From 859e9d7cc28ecdabab13dbb1069c665ff54b6632 Mon Sep 17 00:00:00 2001 From: Andreas Philippi <18646892+andreasphil@users.noreply.github.com> Date: Mon, 23 Dec 2024 22:21:13 +0100 Subject: [PATCH] chore: bump dependencies --- scripts/app.js | 8 ++++--- scripts/lib.js | 2 +- style/style.css | 2 +- .../design-system@v0.39.0/VENDOR_LICENSES.md | 21 ------------------ .../LICENSE.md | 22 +++++++++++++++++++ .../dist/design-system.min.css} | 0 .../scripts/utils.d.ts | 0 .../scripts/utils.js | 0 .../js-inverted-index@v1.7.0/dist/lib.js.map | 7 ------ .../LICENSE.md | 0 .../dist/invertedIndex.d.ts} | 0 .../dist/invertedIndex.js} | 2 +- .../dist/invertedIndex.js.map | 7 ++++++ .../LICENSE.md | 0 .../dist/useAsyncTask.d.ts} | 0 .../dist/useAsyncTask.js} | 2 +- .../dist/useAsyncTask.js.map} | 2 +- 17 files changed, 39 insertions(+), 36 deletions(-) delete mode 100644 vendor/andreasphil/design-system@v0.39.0/VENDOR_LICENSES.md rename vendor/andreasphil/{vue-use-async-task@v0.5.0 => design-system@v0.40.0}/LICENSE.md (53%) rename vendor/andreasphil/{design-system@v0.39.0/dist/index.min.css => design-system@v0.40.0/dist/design-system.min.css} (100%) rename vendor/andreasphil/{design-system@v0.39.0 => design-system@v0.40.0}/scripts/utils.d.ts (100%) rename vendor/andreasphil/{design-system@v0.39.0 => design-system@v0.40.0}/scripts/utils.js (100%) delete mode 100644 vendor/andreasphil/js-inverted-index@v1.7.0/dist/lib.js.map rename vendor/andreasphil/{design-system@v0.39.0 => js-inverted-index@v1.8.0}/LICENSE.md (100%) rename vendor/andreasphil/{js-inverted-index@v1.7.0/dist/lib.d.ts => js-inverted-index@v1.8.0/dist/invertedIndex.d.ts} (100%) rename vendor/andreasphil/{js-inverted-index@v1.7.0/dist/lib.js => js-inverted-index@v1.8.0/dist/invertedIndex.js} (97%) create mode 100644 vendor/andreasphil/js-inverted-index@v1.8.0/dist/invertedIndex.js.map rename vendor/andreasphil/{js-inverted-index@v1.7.0 => vue-use-async-task@v0.7.0}/LICENSE.md (100%) rename vendor/andreasphil/{vue-use-async-task@v0.5.0/dist/lib.d.ts => vue-use-async-task@v0.7.0/dist/useAsyncTask.d.ts} (100%) rename vendor/andreasphil/{vue-use-async-task@v0.5.0/dist/lib.js => vue-use-async-task@v0.7.0/dist/useAsyncTask.js} (89%) rename vendor/andreasphil/{vue-use-async-task@v0.5.0/dist/lib.js.map => vue-use-async-task@v0.7.0/dist/useAsyncTask.js.map} (98%) diff --git a/scripts/app.js b/scripts/app.js index 7d18b87..9d50aa9 100644 --- a/scripts/app.js +++ b/scripts/app.js @@ -1,6 +1,6 @@ import { html, useFilteredStars, useStargazeStorage } from "@/lib.js"; -import { useThemeColor } from "@vendor/andreasphil/design-system@v0.39.0/scripts/utils.js"; -import { useAsyncTask } from "@vendor/andreasphil/vue-use-async-task@v0.5.0/dist/lib.js"; +import { useThemeColor } from "@vendor/andreasphil/design-system@v0.40.0/scripts/utils.js"; +import { useAsyncTask } from "@vendor/andreasphil/vue-use-async-task@v0.7.0/dist/useAsyncTask.js"; import { computed, createApp, @@ -123,7 +123,9 @@ export const List = defineComponent({ * Website links * * -------------------------------------------------- */ - const preferWebsite = ref(localStorage.getItem("prefer-website") === "true"); + const preferWebsite = ref( + localStorage.getItem("prefer-website") === "true" + ); watch(preferWebsite, (is) => { localStorage.setItem("prefer-website", is.toString()); diff --git a/scripts/lib.js b/scripts/lib.js index 5bffb7b..f97d17f 100644 --- a/scripts/lib.js +++ b/scripts/lib.js @@ -1,6 +1,6 @@ import createSearch, { startsWith, -} from "@vendor/andreasphil/js-inverted-index@v1.7.0/dist/lib.js"; +} from "@vendor/andreasphil/js-inverted-index@v1.8.0/dist/invertedIndex.js"; import { computed, ref, watch } from "vue"; /* -------------------------------------------------- * diff --git a/style/style.css b/style/style.css index 8d2c619..31cede5 100644 --- a/style/style.css +++ b/style/style.css @@ -1,4 +1,4 @@ -@import url("../vendor/andreasphil/design-system@v0.39.0/dist/index.min.css") +@import url("../vendor/andreasphil/design-system@v0.40.0/dist/design-system.min.css") layer(theme); :root { diff --git a/vendor/andreasphil/design-system@v0.39.0/VENDOR_LICENSES.md b/vendor/andreasphil/design-system@v0.39.0/VENDOR_LICENSES.md deleted file mode 100644 index d40adec..0000000 --- a/vendor/andreasphil/design-system@v0.39.0/VENDOR_LICENSES.md +++ /dev/null @@ -1,21 +0,0 @@ -# Licenses for vendored dependencies - -## [Lucide](https://lucide.dev) - -ISC License - -Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 -as part of Feather (MIT). All other copyright (c) for Lucide are held -by Lucide Contributors 2022. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/andreasphil/vue-use-async-task@v0.5.0/LICENSE.md b/vendor/andreasphil/design-system@v0.40.0/LICENSE.md similarity index 53% rename from vendor/andreasphil/vue-use-async-task@v0.5.0/LICENSE.md rename to vendor/andreasphil/design-system@v0.40.0/LICENSE.md index 09d856d..a395b8b 100644 --- a/vendor/andreasphil/vue-use-async-task@v0.5.0/LICENSE.md +++ b/vendor/andreasphil/design-system@v0.40.0/LICENSE.md @@ -19,3 +19,25 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Vendored Dependencies + +## [Lucide](https://lucide.dev) + +ISC License + +Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 +as part of Feather (MIT). All other copyright (c) for Lucide are held +by Lucide Contributors 2022. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/vendor/andreasphil/design-system@v0.39.0/dist/index.min.css b/vendor/andreasphil/design-system@v0.40.0/dist/design-system.min.css similarity index 100% rename from vendor/andreasphil/design-system@v0.39.0/dist/index.min.css rename to vendor/andreasphil/design-system@v0.40.0/dist/design-system.min.css diff --git a/vendor/andreasphil/design-system@v0.39.0/scripts/utils.d.ts b/vendor/andreasphil/design-system@v0.40.0/scripts/utils.d.ts similarity index 100% rename from vendor/andreasphil/design-system@v0.39.0/scripts/utils.d.ts rename to vendor/andreasphil/design-system@v0.40.0/scripts/utils.d.ts diff --git a/vendor/andreasphil/design-system@v0.39.0/scripts/utils.js b/vendor/andreasphil/design-system@v0.40.0/scripts/utils.js similarity index 100% rename from vendor/andreasphil/design-system@v0.39.0/scripts/utils.js rename to vendor/andreasphil/design-system@v0.40.0/scripts/utils.js diff --git a/vendor/andreasphil/js-inverted-index@v1.7.0/dist/lib.js.map b/vendor/andreasphil/js-inverted-index@v1.7.0/dist/lib.js.map deleted file mode 100644 index 1ec2ead..0000000 --- a/vendor/andreasphil/js-inverted-index@v1.7.0/dist/lib.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../src/lib.js"], - "sourcesContent": ["// @ts-check\n\n/* -------------------------------------------------- *\n * Types *\n * -------------------------------------------------- */\n\n/**\n * Specifies a nested property inside an object.\n *\n * @typedef {string | string[]} PropPath\n */\n\n/**\n * Strings or stuff that can be converted into a string.\n *\n * @typedef {string | { toString: () => string }} Stringable\n */\n\n/**\n * Documents that can be added to the search index.\n *\n * @typedef {Record} Searchable\n */\n\n/**\n * Mapping of search terms to the IDs of matching documents.\n *\n * @typedef {Record>} SearchIndex\n */\n\n/**\n * Search index with an ID array instead of a set (for JSON serialization).\n *\n * @typedef {Record} SearchIndexDump\n */\n\n/**\n * Takes a document and returns a value that can be used for uniquely\n * identifying the document.\n *\n * @template {Searchable} [T = any]\n * @template [U = string]\n * @callback IdentifierFn\n * @param {T} document Original document\n * @returns {U} Identifier of the document\n */\n\n/**\n * Takes a string and splits it into individual tokens. These tokens will be\n * used for building the search index.\n *\n * @callback TokenizerFn\n * @param {string} input Source string\n * @returns {string[]} Tokens found in the source string\n */\n\n/**\n * Takes a string and returns it in a normalized format, e.g. converts it to\n * lowercase and trim leading/trailing whitespace.\n *\n * @callback NormalizerFn\n * @param {string} input Source string\n * @returns {string} Normalized string\n */\n\n/**\n * Takes and index and returns all search results for the specified term. Calls\n * to the function will also use the original indexing options. These can be\n * used for normalizing and tokenizing the search term in the same way the\n * documents in the index are in order to make matches more likely.\n *\n * @callback SearcherFn\n * @param {SearchIndex} index Index to search in\n * @param {string} term Term to search for\n * @param {IndexingOptions} options Options used for generating the index\n * @returns {Set} Set of IDs of documents matching the term\n */\n\n/**\n * Specifies configuration for building a search index.\n *\n * @typedef IndexingOptions\n * @prop {IdentifierFn} identifier Strategy for extracting an ID from a document.\n * @prop {TokenizerFn} tokenizer Strategy for splitting a value of a document into tokens.\n * @prop {NormalizerFn} normalizer Strategy for normalizing the format of the tokens.\n * @prop {SearcherFn} searcher Strategy for looking up terms in the index.\n * @prop {PropPath[]} fields An array containing the properties that should be indexed.\n */\n\n/**\n * The closure returned when the search has been initialized. Contains methods\n * for interacting with the index, such as adding documents or searching.\n *\n * @template {Searchable} T\n * @typedef Search\n * @prop {(term: string) => T[]} search\n * @prop {(documents: T[]) => void} add\n * @prop {() => SearchIndexDump} dump\n * @prop {(index: SearchIndexDump, documents: T[]) => void} hydrate\n */\n\n/* -------------------------------------------------- *\n * Helpers *\n * -------------------------------------------------- */\n\n/**\n * Recursively reads the value of a property from nested object structures. For\n * example:\n *\n * getNestedProp({ a: { b: 'value' }}, 'a.b') // => 'value'\n * getNestedProp({ a: { b: 'value' }}, ['a', 'b']) // => 'value'\n *\n * @param {Record} obj\n * @param {PropPath} prop\n * @returns {Stringable | undefined}\n */\nexport function unwrap(obj, prop) {\n if (!obj) return undefined;\n\n const path = Array.isArray(prop) ? prop : prop.split(\".\");\n const [head, ...tail] = path;\n\n if (tail.length) return unwrap(obj[head], tail);\n else return obj[head];\n}\n\n/**\n * Returns the intersection of multiple sets.\n *\n * @template T\n * @param {Set[]} sets Sets to get common elements from\n * @returns {Set} Set containing the elements shared among the source sets\n */\nexport function intersect(...sets) {\n if (!sets.length || sets.some((set) => !set)) return new Set();\n else if (sets.length === 1) return sets[0];\n\n const setsCopy = [...sets];\n const a = setsCopy.shift();\n const b = setsCopy.shift();\n const intersection = new Set();\n\n a.forEach((itemFromA) => {\n if (b.has(itemFromA)) intersection.add(itemFromA);\n });\n\n setsCopy.unshift(intersection);\n\n return intersect(...setsCopy);\n}\n\n/**\n * Identifies documents by the value of a property.\n *\n * @template {Record} T\n * @param {keyof T} prop\n * @returns {IdentifierFn}\n */\nexport function idProp(prop) {\n return (document) => document[prop]?.toString?.();\n}\n\n/* -------------------------------------------------- *\n * Normalizers *\n * -------------------------------------------------- */\n\n/**\n * Removes leading/trailing whitespace and converts the value to lowercase.\n * @type {NormalizerFn}\n */\nexport const lowercaseTrim = (input) => input?.trim().toLowerCase();\n\n/* -------------------------------------------------- *\n * Matchers *\n * -------------------------------------------------- */\n\n/**\n * Looks up all ID entries in the index for a search term. The search term is\n * split according to the provided matcher expression. If the term consists of\n * multiple words, only results containing all words are returned.\n *\n * @type {SearcherFn}\n */\nexport const matchAllTerms = (index, term, options) => {\n if (!term || Object.keys(index).length === 0) {\n return new Set();\n }\n\n const { tokenizer, normalizer } = options;\n const termTokens = tokenizer(term).map((token) => normalizer(token));\n const matches = termTokens.map((token) => index[token]);\n\n return intersect(...matches);\n};\n\n/* -------------------------------------------------- *\n * Tokenizers *\n * -------------------------------------------------- */\n\n/**\n * Returns a new tokenizer that splits a value based on the specified regex.\n *\n * @param {RegExp} exp\n * @returns {TokenizerFn}\n */\nexport function regexSplit(exp) {\n return (input) => (input ? input.match(exp) || [] : []);\n}\n\n/**\n * Returns a tokenizer that splits values on word boundaries.\n */\nexport const fullWordSplit = regexSplit(/\\w+/g);\n\n/**\n * Returns a tokenizer that returns the word itself as well as anything that\n * that would return true if used with `startsWith`, e.g. for dog, return d,\n * do, and dog.\n *\n * @type {TokenizerFn}\n */\nexport const startsWith = (input) => {\n const inputWords = fullWordSplit(input);\n const tokens = new Set();\n\n inputWords\n .filter((word) => word.length > 0)\n .forEach((word) => {\n for (let i = 1; i <= word.length; i++) {\n tokens.add(word.substring(0, i));\n }\n });\n\n return Array.from(tokens);\n};\n\n/* -------------------------------------------------- *\n * Search index *\n * -------------------------------------------------- */\n\n/**\n * Creates a new search index and returns functions for interacting with it.\n *\n * @template {Searchable} T\n * @param {Partial} [options={}]\n * @returns {Search}\n */\nexport default function createSearch(options = {}) {\n // Merge custom and default options\n /** @type {IndexingOptions} */\n const effectiveOptions = {\n tokenizer: fullWordSplit,\n identifier: idProp(\"id\"),\n normalizer: lowercaseTrim,\n searcher: matchAllTerms,\n fields: [],\n ...options,\n };\n\n /**\n * Map of possible search terms -> document IDs\n * @type {SearchIndex}\n */\n let index = Object.create(null);\n\n /**\n * Map of document IDs -> original documents\n * @type {Record}\n */\n let indexedDocuments = {};\n\n /** @type {Search[\"search\"]} */\n const search = (term) => {\n /** @type {T[]} */\n const matches = [];\n const idMatches = effectiveOptions.searcher(index, term, effectiveOptions);\n idMatches.forEach((id) => {\n if (indexedDocuments[id]) matches.push(indexedDocuments[id]);\n });\n\n return matches;\n };\n\n /** @type {Search[\"add\"]} */\n const add = (documents) => {\n const { tokenizer, identifier, normalizer, fields } = effectiveOptions;\n\n documents.forEach((document) => {\n const id = identifier(document);\n indexedDocuments[id] = document;\n\n fields\n .map((path) => unwrap(document, path))\n .filter(/** @returns {value is Stringable} */ (value) =>\n !!value?.toString\n )\n .flatMap((value) => tokenizer(value.toString()))\n .map((token) => normalizer(token))\n .forEach((token) => {\n if (index[token]) index[token].add(id);\n else index[token] = new Set([id]);\n });\n });\n };\n\n /** @type {Search[\"dump\"]} */\n const dump = () => {\n /** @type {SearchIndexDump} */\n const dumpInit = {};\n\n return Object.entries(index).reduce((all, [k, v]) => {\n all[k] = Array.from(v);\n return all;\n }, dumpInit);\n };\n\n /** @type {Search[\"hydrate\"]} */\n const hydrate = (dump, documents) => {\n /** @type {SearchIndex} */\n const indexInit = {};\n\n /** @type {Record} */\n const documentsInit = {};\n\n index = Object.entries(dump).reduce((all, [k, v]) => {\n all[k] = new Set(v);\n return all;\n }, indexInit);\n\n indexedDocuments = documents.reduce((all, i) => {\n all[effectiveOptions.identifier(i)] = i;\n return all;\n }, documentsInit);\n };\n\n return { search, add, dump, hydrate };\n}\n"], - "mappings": "AAoHO,SAASA,EAAOC,EAAKC,EAAM,CAChC,GAAI,CAACD,EAAK,OAEV,IAAME,EAAO,MAAM,QAAQD,CAAI,EAAIA,EAAOA,EAAK,MA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W,CAAC,EAElB,OAAO,OAAO,QAAQtB,CAAK,EAAE,OAAO,CAACuB,EAAK,CAACC,EAAGC,CAAC,KAC7CF,EAAIC,CAAC,EAAI,MAAM,KAAKC,CAAC,EACdF,GACND,CAAQ,CACb,EAqB4B,QAlBZ,CAACI,EAAMR,IAAc,CAEnC,IAAMS,EAAY,CAAC,EAGbC,EAAgB,CAAC,EAEvB5B,EAAQ,OAAO,QAAQ0B,CAAI,EAAE,OAAO,CAACH,EAAK,CAACC,EAAGC,CAAC,KAC7CF,EAAIC,CAAC,EAAI,IAAI,IAAIC,CAAC,EACXF,GACNI,CAAS,EAEZX,EAAmBE,EAAU,OAAO,CAACK,EAAKM,KACxCN,EAAIR,EAAiB,WAAWc,CAAC,CAAC,EAAIA,EAC/BN,GACNK,CAAa,CAClB,CAEoC,CACtC", - "names": ["unwrap", "obj", "prop", "path", "head", "tail", "intersect", "sets", "set", "setsCopy", "a", "b", "intersection", "itemFromA", "idProp", "document", "lowercaseTrim", "input", "matchAllTerms", "index", "term", "options", "tokenizer", "normalizer", "matches", "token", "regexSplit", "exp", "fullWordSplit", "startsWith", "inputWords", "tokens", "word", "createSearch", "effectiveOptions", "indexedDocuments", "id", "documents", "identifier", "fields", "value", "dumpInit", "all", "k", "v", "dump", "indexInit", "documentsInit", "i"] -} diff --git a/vendor/andreasphil/design-system@v0.39.0/LICENSE.md b/vendor/andreasphil/js-inverted-index@v1.8.0/LICENSE.md similarity index 100% rename from vendor/andreasphil/design-system@v0.39.0/LICENSE.md rename to vendor/andreasphil/js-inverted-index@v1.8.0/LICENSE.md diff --git a/vendor/andreasphil/js-inverted-index@v1.7.0/dist/lib.d.ts b/vendor/andreasphil/js-inverted-index@v1.8.0/dist/invertedIndex.d.ts similarity index 100% rename from vendor/andreasphil/js-inverted-index@v1.7.0/dist/lib.d.ts rename to vendor/andreasphil/js-inverted-index@v1.8.0/dist/invertedIndex.d.ts diff --git a/vendor/andreasphil/js-inverted-index@v1.7.0/dist/lib.js b/vendor/andreasphil/js-inverted-index@v1.8.0/dist/invertedIndex.js similarity index 97% rename from vendor/andreasphil/js-inverted-index@v1.7.0/dist/lib.js rename to vendor/andreasphil/js-inverted-index@v1.8.0/dist/invertedIndex.js index e327668..d3ba4dd 100644 --- a/vendor/andreasphil/js-inverted-index@v1.7.0/dist/lib.js +++ b/vendor/andreasphil/js-inverted-index@v1.8.0/dist/invertedIndex.js @@ -1,2 +1,2 @@ function g(t,e){if(!t)return;let n=Array.isArray(e)?e:e.split("."),[r,...i]=n;return i.length?g(t[r],i):t[r]}function x(...t){if(!t.length||t.some(d=>!d))return new Set;if(t.length===1)return t[0];let e=[...t],n=e.shift(),r=e.shift(),i=new Set;return n.forEach(d=>{r.has(d)&&i.add(d)}),e.unshift(i),x(...e)}function w(t){return e=>e[t]?.toString?.()}var y=t=>t?.trim().toLowerCase(),z=(t,e,n)=>{if(!e||Object.keys(t).length===0)return new Set;let{tokenizer:r,normalizer:i}=n,m=r(e).map(p=>i(p)).map(p=>t[p]);return x(...m)};function k(t){return e=>e?e.match(t)||[]:[]}var S=k(/\w+/g),O=t=>{let e=S(t),n=new Set;return e.filter(r=>r.length>0).forEach(r=>{for(let i=1;i<=r.length;i++)n.add(r.substring(0,i))}),Array.from(n)};function E(t={}){let e={tokenizer:S,identifier:w("id"),normalizer:y,searcher:z,fields:[],...t},n=Object.create(null),r={};return{search:f=>{let c=[];return e.searcher(n,f,e).forEach(s=>{r[s]&&c.push(r[s])}),c},add:f=>{let{tokenizer:c,identifier:h,normalizer:s,fields:u}=e;f.forEach(a=>{let l=h(a);r[l]=a,u.map(o=>g(a,o)).filter(o=>!!o?.toString).flatMap(o=>c(o.toString())).map(o=>s(o)).forEach(o=>{n[o]?n[o].add(l):n[o]=new Set([l])})})},dump:()=>{let f={};return Object.entries(n).reduce((c,[h,s])=>(c[h]=Array.from(s),c),f)},hydrate:(f,c)=>{let h={},s={};n=Object.entries(f).reduce((u,[a,l])=>(u[a]=new Set(l),u),h),r=c.reduce((u,a)=>(u[e.identifier(a)]=a,u),s)}}}export{E as default,S as fullWordSplit,w as idProp,x as intersect,y as lowercaseTrim,z as matchAllTerms,k as regexSplit,O as startsWith,g as unwrap}; -//# sourceMappingURL=lib.js.map +//# sourceMappingURL=invertedIndex.js.map diff --git a/vendor/andreasphil/js-inverted-index@v1.8.0/dist/invertedIndex.js.map b/vendor/andreasphil/js-inverted-index@v1.8.0/dist/invertedIndex.js.map new file mode 100644 index 0000000..95884d1 --- /dev/null +++ b/vendor/andreasphil/js-inverted-index@v1.8.0/dist/invertedIndex.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/invertedIndex.js"], + "sourcesContent": ["/* -------------------------------------------------- *\n * Types *\n * -------------------------------------------------- */\n\n/**\n * Specifies a nested property inside an object.\n *\n * @typedef {string | string[]} PropPath\n */\n\n/**\n * Strings or stuff that can be converted into a string.\n *\n * @typedef {string | { toString: () => string }} Stringable\n */\n\n/**\n * Documents that can be added to the search index.\n *\n * @typedef {Record} Searchable\n */\n\n/**\n * Mapping of search terms to the IDs of matching documents.\n *\n * @typedef {Record>} SearchIndex\n */\n\n/**\n * Search index with an ID array instead of a set (for JSON serialization).\n *\n * @typedef {Record} SearchIndexDump\n */\n\n/**\n * Takes a document and returns a value that can be used for uniquely\n * identifying the document.\n *\n * @template {Searchable} [T = any]\n * @template [U = string]\n * @callback IdentifierFn\n * @param {T} document Original document\n * @returns {U} Identifier of the document\n */\n\n/**\n * Takes a string and splits it into individual tokens. These tokens will be\n * used for building the search index.\n *\n * @callback TokenizerFn\n * @param {string} input Source string\n * @returns {string[]} Tokens found in the source string\n */\n\n/**\n * Takes a string and returns it in a normalized format, e.g. converts it to\n * lowercase and trim leading/trailing whitespace.\n *\n * @callback NormalizerFn\n * @param {string} input Source string\n * @returns {string} Normalized string\n */\n\n/**\n * Takes and index and returns all search results for the specified term. Calls\n * to the function will also use the original indexing options. These can be\n * used for normalizing and tokenizing the search term in the same way the\n * documents in the index are in order to make matches more likely.\n *\n * @callback SearcherFn\n * @param {SearchIndex} index Index to search in\n * @param {string} term Term to search for\n * @param {IndexingOptions} options Options used for generating the index\n * @returns {Set} Set of IDs of documents matching the term\n */\n\n/**\n * Specifies configuration for building a search index.\n *\n * @typedef IndexingOptions\n * @prop {IdentifierFn} identifier Strategy for extracting an ID from a document.\n * @prop {TokenizerFn} tokenizer Strategy for splitting a value of a document into tokens.\n * @prop {NormalizerFn} normalizer Strategy for normalizing the format of the tokens.\n * @prop {SearcherFn} searcher Strategy for looking up terms in the index.\n * @prop {PropPath[]} fields An array containing the properties that should be indexed.\n */\n\n/**\n * The closure returned when the search has been initialized. Contains methods\n * for interacting with the index, such as adding documents or searching.\n *\n * @template {Searchable} T\n * @typedef Search\n * @prop {(term: string) => T[]} search\n * @prop {(documents: T[]) => void} add\n * @prop {() => SearchIndexDump} dump\n * @prop {(index: SearchIndexDump, documents: T[]) => void} hydrate\n */\n\n/* -------------------------------------------------- *\n * Helpers *\n * -------------------------------------------------- */\n\n/**\n * Recursively reads the value of a property from nested object structures. For\n * example:\n *\n * getNestedProp({ a: { b: 'value' }}, 'a.b') // => 'value'\n * getNestedProp({ a: { b: 'value' }}, ['a', 'b']) // => 'value'\n *\n * @param {Record} obj\n * @param {PropPath} prop\n * @returns {Stringable | undefined}\n */\nexport function unwrap(obj, prop) {\n if (!obj) return undefined;\n\n const path = Array.isArray(prop) ? prop : prop.split(\".\");\n const [head, ...tail] = path;\n\n if (tail.length) return unwrap(obj[head], tail);\n else return obj[head];\n}\n\n/**\n * Returns the intersection of multiple sets.\n *\n * @template T\n * @param {Set[]} sets Sets to get common elements from\n * @returns {Set} Set containing the elements shared among the source sets\n */\nexport function intersect(...sets) {\n if (!sets.length || sets.some((set) => !set)) return new Set();\n else if (sets.length === 1) return sets[0];\n\n const setsCopy = [...sets];\n const a = setsCopy.shift();\n const b = setsCopy.shift();\n const intersection = new Set();\n\n a.forEach((itemFromA) => {\n if (b.has(itemFromA)) intersection.add(itemFromA);\n });\n\n setsCopy.unshift(intersection);\n\n return intersect(...setsCopy);\n}\n\n/**\n * Identifies documents by the value of a property.\n *\n * @template {Record} T\n * @param {keyof T} prop\n * @returns {IdentifierFn}\n */\nexport function idProp(prop) {\n return (document) => document[prop]?.toString?.();\n}\n\n/* -------------------------------------------------- *\n * Normalizers *\n * -------------------------------------------------- */\n\n/**\n * Removes leading/trailing whitespace and converts the value to lowercase.\n * @type {NormalizerFn}\n */\nexport const lowercaseTrim = (input) => input?.trim().toLowerCase();\n\n/* -------------------------------------------------- *\n * Matchers *\n * -------------------------------------------------- */\n\n/**\n * Looks up all ID entries in the index for a search term. The search term is\n * split according to the provided matcher expression. If the term consists of\n * multiple words, only results containing all words are returned.\n *\n * @type {SearcherFn}\n */\nexport const matchAllTerms = (index, term, options) => {\n if (!term || Object.keys(index).length === 0) {\n return new Set();\n }\n\n const { tokenizer, normalizer } = options;\n const termTokens = tokenizer(term).map((token) => normalizer(token));\n const matches = termTokens.map((token) => index[token]);\n\n return intersect(...matches);\n};\n\n/* -------------------------------------------------- *\n * Tokenizers *\n * -------------------------------------------------- */\n\n/**\n * Returns a new tokenizer that splits a value based on the specified regex.\n *\n * @param {RegExp} exp\n * @returns {TokenizerFn}\n */\nexport function regexSplit(exp) {\n return (input) => (input ? input.match(exp) || [] : []);\n}\n\n/**\n * Returns a tokenizer that splits values on word boundaries.\n */\nexport const fullWordSplit = regexSplit(/\\w+/g);\n\n/**\n * Returns a tokenizer that returns the word itself as well as anything that\n * that would return true if used with `startsWith`, e.g. for dog, return d,\n * do, and dog.\n *\n * @type {TokenizerFn}\n */\nexport const startsWith = (input) => {\n const inputWords = fullWordSplit(input);\n const tokens = new Set();\n\n inputWords\n .filter((word) => word.length > 0)\n .forEach((word) => {\n for (let i = 1; i <= word.length; i++) {\n tokens.add(word.substring(0, i));\n }\n });\n\n return Array.from(tokens);\n};\n\n/* -------------------------------------------------- *\n * Search index *\n * -------------------------------------------------- */\n\n/**\n * Creates a new search index and returns functions for interacting with it.\n *\n * @template {Searchable} T\n * @param {Partial} [options={}]\n * @returns {Search}\n */\nexport default function createSearch(options = {}) {\n // Merge custom and default options\n /** @type {IndexingOptions} */\n const effectiveOptions = {\n tokenizer: fullWordSplit,\n identifier: idProp(\"id\"),\n normalizer: lowercaseTrim,\n searcher: matchAllTerms,\n fields: [],\n ...options,\n };\n\n /**\n * Map of possible search terms -> document IDs\n * @type {SearchIndex}\n */\n let index = Object.create(null);\n\n /**\n * Map of document IDs -> original documents\n * @type {Record}\n */\n let indexedDocuments = {};\n\n /** @type {Search[\"search\"]} */\n const search = (term) => {\n /** @type {T[]} */\n const matches = [];\n const idMatches = effectiveOptions.searcher(index, term, effectiveOptions);\n idMatches.forEach((id) => {\n if (indexedDocuments[id]) matches.push(indexedDocuments[id]);\n });\n\n return matches;\n };\n\n /** @type {Search[\"add\"]} */\n const add = (documents) => {\n const { tokenizer, identifier, normalizer, fields } = effectiveOptions;\n\n documents.forEach((document) => {\n const id = identifier(document);\n indexedDocuments[id] = document;\n\n fields\n .map((path) => unwrap(document, path))\n .filter(/** @returns {value is Stringable} */ (value) =>\n !!value?.toString\n )\n .flatMap((value) => tokenizer(value.toString()))\n .map((token) => normalizer(token))\n .forEach((token) => {\n if (index[token]) index[token].add(id);\n else index[token] = new Set([id]);\n });\n });\n };\n\n /** @type {Search[\"dump\"]} */\n const dump = () => {\n /** @type {SearchIndexDump} */\n const dumpInit = {};\n\n return Object.entries(index).reduce((all, [k, v]) => {\n all[k] = Array.from(v);\n return all;\n }, dumpInit);\n };\n\n /** @type {Search[\"hydrate\"]} */\n const hydrate = (dump, documents) => {\n /** @type {SearchIndex} */\n const indexInit = {};\n\n /** @type {Record} */\n const documentsInit = {};\n\n index = Object.entries(dump).reduce((all, [k, v]) => {\n all[k] = new Set(v);\n return all;\n }, indexInit);\n\n indexedDocuments = documents.reduce((all, i) => {\n all[effectiveOptions.identifier(i)] = i;\n return all;\n }, documentsInit);\n };\n\n return { search, add, dump, hydrate };\n}\n"],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,EAChCjB,EAAMM,CAAK,EAAI,IAAI,IAAI,CAACW,CAAE,CAAC,CAClC,CAAC,CACL,CAAC,CACH,EAgCsB,KA7BT,IAAM,CAEjB,IAAMK,EAAW,CAAC,EAElB,OAAO,OAAO,QAAQtB,CAAK,EAAE,OAAO,CAACuB,EAAK,CAACC,EAAGC,CAAC,KAC7CF,EAAIC,CAAC,EAAI,MAAM,KAAKC,CAAC,EACdF,GACND,CAAQ,CACb,EAqB4B,QAlBZ,CAACI,EAAMR,IAAc,CAEnC,IAAMS,EAAY,CAAC,EAGbC,EAAgB,CAAC,EAEvB5B,EAAQ,OAAO,QAAQ0B,CAAI,EAAE,OAAO,CAACH,EAAK,CAACC,EAAGC,CAAC,KAC7CF,EAAIC,CAAC,EAAI,IAAI,IAAIC,CAAC,EACXF,GACNI,CAAS,EAEZX,EAAmBE,EAAU,OAAO,CAACK,EAAKM,KACxCN,EAAIR,EAAiB,WAAWc,CAAC,CAAC,EAAIA,EAC/BN,GACNK,CAAa,CAClB,CAEoC,CACtC", + "names": ["unwrap", "obj", "prop", "path", "head", "tail", "intersect", "sets", "set", "setsCopy", "a", "b", "intersection", "itemFromA", "idProp", "document", "lowercaseTrim", "input", "matchAllTerms", "index", "term", "options", "tokenizer", "normalizer", "matches", "token", "regexSplit", "exp", "fullWordSplit", "startsWith", "inputWords", "tokens", "word", "createSearch", "effectiveOptions", "indexedDocuments", "id", "documents", "identifier", "fields", "value", "dumpInit", "all", "k", "v", "dump", "indexInit", "documentsInit", "i"] +} diff --git a/vendor/andreasphil/js-inverted-index@v1.7.0/LICENSE.md b/vendor/andreasphil/vue-use-async-task@v0.7.0/LICENSE.md similarity index 100% rename from vendor/andreasphil/js-inverted-index@v1.7.0/LICENSE.md rename to vendor/andreasphil/vue-use-async-task@v0.7.0/LICENSE.md diff --git a/vendor/andreasphil/vue-use-async-task@v0.5.0/dist/lib.d.ts b/vendor/andreasphil/vue-use-async-task@v0.7.0/dist/useAsyncTask.d.ts similarity index 100% rename from vendor/andreasphil/vue-use-async-task@v0.5.0/dist/lib.d.ts rename to vendor/andreasphil/vue-use-async-task@v0.7.0/dist/useAsyncTask.d.ts diff --git a/vendor/andreasphil/vue-use-async-task@v0.5.0/dist/lib.js b/vendor/andreasphil/vue-use-async-task@v0.7.0/dist/useAsyncTask.js similarity index 89% rename from vendor/andreasphil/vue-use-async-task@v0.5.0/dist/lib.js rename to vendor/andreasphil/vue-use-async-task@v0.7.0/dist/useAsyncTask.js index 7297702..996baf3 100644 --- a/vendor/andreasphil/vue-use-async-task@v0.5.0/dist/lib.js +++ b/vendor/andreasphil/vue-use-async-task@v0.7.0/dist/useAsyncTask.js @@ -1,2 +1,2 @@ import{computed as i,ref as t}from"vue";function y(s,u){let a=t(),r=u?.isLoading??t(!1),n=u?.error??t(void 0),d=i(()=>!!n.value);return{run:async(...f)=>{r.value=!0,n.value=void 0;try{let e=await s(...f);return a.value=e,[e,void 0]}catch(e){return n.value=e,[void 0,e]}finally{r.value=!1}},data:a,isLoading:r,error:n,hasError:d}}export{y as useAsyncTask}; -//# sourceMappingURL=lib.js.map +//# sourceMappingURL=useAsyncTask.js.map diff --git a/vendor/andreasphil/vue-use-async-task@v0.5.0/dist/lib.js.map b/vendor/andreasphil/vue-use-async-task@v0.7.0/dist/useAsyncTask.js.map similarity index 98% rename from vendor/andreasphil/vue-use-async-task@v0.5.0/dist/lib.js.map rename to vendor/andreasphil/vue-use-async-task@v0.7.0/dist/useAsyncTask.js.map index ea1ad8e..0d56f49 100644 --- a/vendor/andreasphil/vue-use-async-task@v0.5.0/dist/lib.js.map +++ b/vendor/andreasphil/vue-use-async-task@v0.7.0/dist/useAsyncTask.js.map @@ -1,6 +1,6 @@ { "version": 3, - "sources": ["../src/lib.ts"], + "sources": ["../src/useAsyncTask.ts"], "sourcesContent": ["import { computed, ref, type Ref } from \"vue\";\n\n// For more information about InferArgs and InferReturn see:\n// https://fettblog.eu/variadic-tuple-types-preview/\n\n/** Returns the parameters of a generic function T */\nexport type InferArgs = T extends (...t: [...infer Params]) => any\n ? Params\n : never;\n\n/** Returns the return value of a generic function T */\nexport type InferReturn = T extends (...t: any) => infer Return\n ? Return\n : never;\n\n/**\n * Returns a wrapper for an asynchronous function that keeps track of the\n * loading state, errors, and return value of the function.\n */\nexport function useAsyncTask<\n F extends (...args: any[]) => Promise,\n E = any\n>(\n /** Function that performs an async task */\n fetcher: F,\n /**\n * If provided, will use existing reactive variables for storing state\n * instead of creating new ones. Useful e.g. for sharing the `isLoading`\n * state between multiple async tasks.\n */\n shared?: {\n isLoading?: Ref;\n error?: Ref;\n }\n) {\n // Shorthands for the various types we need\n type FetcherArgs = InferArgs;\n type FetcherReturn = Awaited> | undefined;\n type RunnerReturn = [FetcherReturn, undefined] | [undefined, E];\n\n // State\n const data = ref();\n const isLoading = shared?.isLoading ?? ref(false);\n const error = shared?.error ?? ref(undefined);\n const hasError = computed(() => !!error.value);\n\n const run = async (...args: FetcherArgs): Promise => {\n isLoading.value = true;\n error.value = undefined;\n\n try {\n const result = await fetcher(...args);\n data.value = result;\n return [result, undefined];\n } catch (e: any) {\n error.value = e;\n return [undefined, e];\n } finally {\n isLoading.value = false;\n }\n };\n\n return {\n /**\n * Executes the task and updates all the state properties. Returns a tuple\n * of the shape `[data, error]` that contains the result of the task. If\n * the task succeeded, `data` will be set to the return value (if one\n * exists), `error` will be undefined. If the task threw, `data` will be\n * undefined and `error` will be set to the value that was thrown. Note\n * that `run` itself never throws, so you don't need to catch anything.\n *\n * Example:\n *\n * ```\n * const { run } = useAsyncTask(myTask);\n * const [data, error] = await run();\n * if (error) {\n * // Handle error here\n * } else {\n * // Do something with data here\n * }\n * ```\n */\n run,\n /** Return value of the task */\n data,\n /** True while the task is running */\n isLoading,\n /** Will receive the exception thrown by the task if one occurs */\n error,\n /** True if an exception has been thrown */\n hasError,\n };\n}\n"], "mappings": "AAAA,OAAS,YAAAA,EAAU,OAAAC,MAAqB,MAmBjC,SAASC,EAKdC,EAMAC,EAIA,CAOA,IAAMC,EAAOJ,EAAmB,EAC1BK,EAAYF,GAAQ,WAAaH,EAAI,EAAK,EAC1CM,EAAQH,GAAQ,OAASH,EAAmB,MAAS,EACrDO,EAAWR,EAAS,IAAM,CAAC,CAACO,EAAM,KAAK,EAkB7C,MAAO,CAqBL,IArCU,SAAUE,IAA6C,CACjEH,EAAU,MAAQ,GAClBC,EAAM,MAAQ,OAEd,GAAI,CACF,IAAMG,EAAS,MAAMP,EAAQ,GAAGM,CAAI,EACpC,OAAAJ,EAAK,MAAQK,EACN,CAACA,EAAQ,MAAS,CAC3B,OAAS,EAAQ,CACf,OAAAH,EAAM,MAAQ,EACP,CAAC,OAAW,CAAC,CACtB,QAAE,CACAD,EAAU,MAAQ,EACpB,CACF,EAyBE,KAAAD,EAEA,UAAAC,EAEA,MAAAC,EAEA,SAAAC,CACF,CACF", "names": ["computed", "ref", "useAsyncTask", "fetcher", "shared", "data", "isLoading", "error", "hasError", "args", "result"]