@descope/sdk-helpers 0.1.58 → 0.1.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../src/dom.ts","../../src/generic.ts","../../src/state.ts","../../src/compose.ts","../../src/mixins.ts"],"sourcesContent":["export const createTemplate = (templateString: string) => {\n const template = document.createElement('template');\n template.innerHTML = templateString;\n\n return template;\n};\n","// preventing duplicate separators\nexport const pathJoin = (...paths: string[]) =>\n paths.join('/').replace(/\\/+/g, '/');\n\nexport const compareArrays = (array1: any[], array2: any[]) =>\n array1.length === array2.length &&\n array1.every((value: any, index: number) => value === array2[index]);\n\nexport const withMemCache = <I extends any[], O>(fn: (...args: I) => O) => {\n let prevArgs: any[];\n let cache: any;\n return (...args: I) => {\n if (prevArgs && compareArrays(prevArgs, args)) return cache as O;\n\n prevArgs = args;\n cache = fn(...args);\n\n return cache as O;\n };\n};\n\nexport const kebabCase = (str: string) =>\n str\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/[\\s_.]+/g, '-')\n .toLowerCase();\n\nexport const isObjEmpty = (obj: object) =>\n Object.keys(obj).length === 0 && obj.constructor === Object;\n\nexport const pluralize =\n (amount: number) =>\n (strings: TemplateStringsArray, ...expressions: (string | number)[][]) =>\n strings.reduce(\n (acc, str, idx) =>\n `${acc}${str}${expressions?.[idx]?.[amount > 1 ? 1 : 0] || ''}`,\n '',\n );\n\nexport const debounce = (fn: Function, ms = 500) => {\n let timeoutId: ReturnType<typeof setTimeout>;\n return function debounced(this: any, ...args: any[]) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn.apply(this, args), ms);\n };\n};\n","const createIsChanged =\n <T extends Record<string, any>>(state: T, prevState: T) =>\n (attrName: keyof T) =>\n state[attrName] !== prevState[attrName];\n\ntype StateObject = Record<string, any>;\n\ntype UpdateStateCb<T> = (state: T) => Partial<T>;\ntype Subscribers<T> = Record<string, SubscribeCb<T>>;\n\n// eslint-disable-next-line import/exports-last\nexport type SubscribeCb<T> = (\n state: T,\n prevState: T,\n isChanged: ReturnType<typeof createIsChanged>,\n) => void | Promise<void>;\n\nfunction compareObjects(\n objectA: Record<string, any>,\n objectB: Record<string, any>,\n) {\n const aProperties = Object.getOwnPropertyNames(objectA);\n const bProperties = Object.getOwnPropertyNames(objectB);\n\n if (aProperties.length !== bProperties.length) {\n return false;\n }\n\n for (let i = 0; i < aProperties.length; i += 1) {\n const propName = aProperties[i];\n\n const valA = objectA[propName];\n const valB = objectB[propName];\n if (valA === null || valB === null) {\n if (valA !== valB) {\n return false;\n }\n } else if (typeof valA === 'object' && typeof valB === 'object') {\n // compare nested objects\n if (!compareObjects(valA, valB)) {\n return false;\n }\n } else if (valA !== valB) {\n return false;\n }\n }\n\n return true;\n}\n\nexport type IsChanged<T> = Parameters<SubscribeCb<T>>[2];\n\nexport class State<T extends StateObject> {\n #state: T;\n\n #subscribers: Subscribers<T> = {};\n\n #token = 0;\n\n #updateOnlyOnChange = false;\n\n constructor(init: T = {} as T, { updateOnlyOnChange = true } = {}) {\n this.#state = init;\n this.#updateOnlyOnChange = updateOnlyOnChange;\n }\n\n get current() {\n return { ...this.#state };\n }\n\n update = (newState: Partial<T> | UpdateStateCb<T>) => {\n const internalNewState =\n typeof newState === 'function' ? newState(this.#state) : newState;\n\n const nextState = { ...this.#state, ...internalNewState };\n if (!this.#updateOnlyOnChange || !compareObjects(this.#state, nextState)) {\n const prevState = this.#state;\n this.#state = nextState;\n Object.freeze(this.#state);\n\n setTimeout(() => {\n Object.values(this.#subscribers).forEach((cb) =>\n cb(nextState, prevState, createIsChanged(nextState, prevState)),\n );\n }, 0);\n }\n };\n\n subscribe(cb: SubscribeCb<T>) {\n this.#token += 1;\n this.#subscribers[this.#token] = cb;\n\n return this.#token.toString();\n }\n\n unsubscribe(token: string) {\n const isFound = !!this.#subscribers[token];\n\n if (isFound) {\n delete this.#subscribers[token];\n }\n\n return isFound;\n }\n\n unsubscribeAll() {\n this.#subscribers = {};\n\n return true;\n }\n}\n","type Fn = (arg: any) => any;\n\nexport function compose<Input, A1>(\n fn1: (input: Input) => A1,\n): (input: Input) => A1;\n\nexport function compose<Input, A1, A2>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n): (input: Input) => A2;\n\nexport function compose<Input, A1, A2, A3>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n): (input: Input) => A3;\n\nexport function compose<Input, A1, A2, A3, A4>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n): (input: Input) => A4;\n\nexport function compose<Input, A1, A2, A3, A4, A5>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n): (input: Input) => A5;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n): (input: Input) => A6;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n): (input: Input) => A7;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n): (input: Input) => A8;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n): (input: Input) => A9;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n): (input: Input) => A10;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n fn11: (input: A10) => A11,\n): (input: Input) => A11;\n\nexport function compose<\n Input,\n A1,\n A2,\n A3,\n A4,\n A5,\n A6,\n A7,\n A8,\n A9,\n A10,\n A11,\n A12,\n>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n fn11: (input: A10) => A11,\n fn12: (input: A11) => A12,\n): (input: Input) => A12;\n\n/**\n * Currently there is no way to create a compose function in Typescript without using overloading\n * This function currently support up to 10 wrappers\n * If needed you can add more by duplicating the type and add more parameters\n */\n\nexport function compose(...args: Fn[]) {\n return (data: any) => args.reduce((acc, elem) => elem(acc), data) as any;\n}\n","const getFunctionHash = (fn: Function) => {\n const functionSource = fn.toString();\n\n let hash = 0;\n\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < functionSource.length; i++) {\n const char = functionSource.charCodeAt(i);\n // eslint-disable-next-line no-bitwise\n hash = (hash << 5) - hash + char;\n // eslint-disable-next-line no-bitwise\n hash &= hash; // Convert to 32-bit integer\n }\n\n return hash.toString(16);\n};\n\ntype Mixin = (superclass: CustomElementConstructor) => CustomElementConstructor;\n\n// because a single mixin can be a dependency for many other mixins, a mixin can be loaded multiple times\n// some mixins should not be loaded multiple times, wrapping a mixin with this fn ensures it will load only once\nexport const createSingletonMixin = <T extends Mixin>(mixin: T): T => {\n const mixinNameSym = Symbol(getFunctionHash(mixin));\n\n const singletonMixin = (superclass: CustomElementConstructor) => {\n if (superclass[mixinNameSym]) {\n return superclass;\n }\n\n const cls = mixin(superclass);\n cls[mixinNameSym] = true;\n\n return cls;\n };\n\n return singletonMixin as T;\n};\n"],"names":["compareArrays","array1","array2","length","every","value","index","compareObjects","objectA","objectB","aProperties","Object","getOwnPropertyNames","bProperties","i","propName","valA","valB","constructor","init","updateOnlyOnChange","_State_state","set","this","_State_subscribers","_State_token","_State_updateOnlyOnChange","update","newState","internalNewState","__classPrivateFieldGet","nextState","prevState","__classPrivateFieldSet","freeze","setTimeout","values","forEach","cb","state","attrName","createIsChanged","current","assign","subscribe","toString","unsubscribe","token","isFound","unsubscribeAll","args","data","reduce","acc","elem","mixin","mixinNameSym","Symbol","fn","functionSource","hash","charCodeAt","getFunctionHash","superclass","cls","templateString","template","document","createElement","innerHTML","ms","timeoutId","clearTimeout","apply","obj","keys","str","replace","toLowerCase","paths","join","amount","strings","expressions","idx","_a","prevArgs","cache"],"mappings":"oCAAa,MCIAA,EAAgB,CAACC,EAAeC,IAC3CD,EAAOE,SAAWD,EAAOC,QACzBF,EAAOG,OAAM,CAACC,EAAYC,IAAkBD,IAAUH,EAAOI,iBCW/D,SAASC,EACPC,EACAC,GAEA,MAAMC,EAAcC,O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ACrD,CAAC,qBAjBwBI,GACG,IAA5B/D,OAAOgE,KAAKD,GAAKvE,QAAgBuE,EAAIxD,cAAgBP,yBAP7BiE,GACxBA,EACGC,QAAQ,kBAAmB,SAC3BA,QAAQ,WAAY,KACpBC,+BAxBmB,IAAIC,IAC1BA,EAAMC,KAAK,KAAKH,QAAQ,OAAQ,uBA6B/BI,GACD,CAACC,KAAkCC,IACjCD,EAAQ9B,QACN,CAACC,EAAKuB,EAAKQ,KAAO,IAAAC,EAChB,MAAA,GAAGhC,IAAMuB,KAA2B,QAArBS,EAAAF,aAAW,EAAXA,EAAcC,UAAO,IAAAC,OAAA,EAAAA,EAAAJ,EAAS,EAAI,EAAI,KAAM,IAAI,GACjE,yBA5B2CvB,IAC/C,IAAI4B,EACAC,EACJ,MAAO,IAAIrC,KACLoC,GAAYtF,EAAcsF,EAAUpC,KAExCoC,EAAWpC,EACXqC,EAAQ7B,KAAMR,IAHwCqC,EAMvD"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/dom.ts","../../src/generic.ts","../../src/state.ts","../../src/compose.ts","../../src/mixins.ts"],"sourcesContent":["export const createTemplate = (templateString: string) => {\n const template = document.createElement('template');\n template.innerHTML = templateString;\n\n return template;\n};\n","// preventing duplicate separators\nexport const pathJoin = (...paths: string[]) =>\n paths.join('/').replace(/\\/+/g, '/');\n\nexport const compareArrays = (array1: any[], array2: any[]) =>\n array1.length === array2.length &&\n array1.every((value: any, index: number) => value === array2[index]);\n\nexport const withMemCache = <I extends any[], O>(fn: (...args: I) => O) => {\n let prevArgs: any[];\n let cache: any;\n return (...args: I) => {\n if (prevArgs && compareArrays(prevArgs, args)) return cache as O;\n\n prevArgs = args;\n cache = fn(...args);\n\n return cache as O;\n };\n};\n\nexport const kebabCase = (str: string) =>\n str\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/[\\s_.]+/g, '-')\n .toLowerCase();\n\nexport const isObjEmpty = (obj: object) =>\n Object.keys(obj).length === 0 && obj.constructor === Object;\n\nexport const pluralize =\n (amount: number) =>\n (strings: TemplateStringsArray, ...expressions: (string | number)[][]) =>\n strings.reduce(\n (acc, str, idx) =>\n `${acc}${str}${expressions?.[idx]?.[amount > 1 ? 1 : 0] || ''}`,\n '',\n );\n\nexport const debounce = (fn: Function, ms = 500) => {\n let timeoutId: ReturnType<typeof setTimeout>;\n return function debounced(this: any, ...args: any[]) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn.apply(this, args), ms);\n };\n};\n","const createIsChanged =\n <T extends Record<string, any>>(state: T, prevState: T) =>\n (attrName: keyof T) =>\n state[attrName] !== prevState[attrName];\n\ntype StateObject = Record<string, any>;\n\ntype UpdateStateCb<T> = (state: T) => Partial<T>;\ntype Subscribers<T> = Record<string, SubscribeCb<T>>;\n\n// eslint-disable-next-line import/exports-last\nexport type SubscribeCb<T> = (\n state: T,\n prevState: T,\n isChanged: ReturnType<typeof createIsChanged>,\n) => void | Promise<void>;\n\nfunction compareObjects(\n objectA: Record<string, any>,\n objectB: Record<string, any>,\n) {\n const aProperties = Object.getOwnPropertyNames(objectA);\n const bProperties = Object.getOwnPropertyNames(objectB);\n\n if (aProperties.length !== bProperties.length) {\n return false;\n }\n\n for (let i = 0; i < aProperties.length; i += 1) {\n const propName = aProperties[i];\n\n const valA = objectA[propName];\n const valB = objectB[propName];\n if (valA === null || valB === null) {\n if (valA !== valB) {\n return false;\n }\n } else if (typeof valA === 'object' && typeof valB === 'object') {\n // compare nested objects\n if (!compareObjects(valA, valB)) {\n return false;\n }\n } else if (valA !== valB) {\n return false;\n }\n }\n\n return true;\n}\n\nexport type IsChanged<T> = Parameters<SubscribeCb<T>>[2];\n\nexport class State<T extends StateObject> {\n #state: T;\n\n #subscribers: Subscribers<T> = {};\n\n #token = 0;\n\n #updateOnlyOnChange = false;\n\n constructor(init: T = {} as T, { updateOnlyOnChange = true } = {}) {\n this.#state = init;\n this.#updateOnlyOnChange = updateOnlyOnChange;\n }\n\n get current() {\n return { ...this.#state };\n }\n\n update = (newState: Partial<T> | UpdateStateCb<T>) => {\n const internalNewState =\n typeof newState === 'function' ? newState(this.#state) : newState;\n\n const nextState = { ...this.#state, ...internalNewState };\n if (!this.#updateOnlyOnChange || !compareObjects(this.#state, nextState)) {\n const prevState = this.#state;\n this.#state = nextState;\n Object.freeze(this.#state);\n\n setTimeout(() => {\n Object.values(this.#subscribers).forEach((cb) =>\n cb(nextState, prevState, createIsChanged(nextState, prevState)),\n );\n }, 0);\n }\n };\n\n subscribe(cb: SubscribeCb<T>) {\n this.#token += 1;\n this.#subscribers[this.#token] = cb;\n\n return this.#token.toString();\n }\n\n unsubscribe(token: string) {\n const isFound = !!this.#subscribers[token];\n\n if (isFound) {\n delete this.#subscribers[token];\n }\n\n return isFound;\n }\n\n unsubscribeAll() {\n this.#subscribers = {};\n\n return true;\n }\n}\n","type Fn = (arg: any) => any;\n\nexport function compose<Input, A1>(\n fn1: (input: Input) => A1,\n): (input: Input) => A1;\n\nexport function compose<Input, A1, A2>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n): (input: Input) => A2;\n\nexport function compose<Input, A1, A2, A3>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n): (input: Input) => A3;\n\nexport function compose<Input, A1, A2, A3, A4>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n): (input: Input) => A4;\n\nexport function compose<Input, A1, A2, A3, A4, A5>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n): (input: Input) => A5;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n): (input: Input) => A6;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n): (input: Input) => A7;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n): (input: Input) => A8;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n): (input: Input) => A9;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n): (input: Input) => A10;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n fn11: (input: A10) => A11,\n): (input: Input) => A11;\n\nexport function compose<\n Input,\n A1,\n A2,\n A3,\n A4,\n A5,\n A6,\n A7,\n A8,\n A9,\n A10,\n A11,\n A12,\n>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n fn11: (input: A10) => A11,\n fn12: (input: A11) => A12,\n): (input: Input) => A12;\n\n/**\n * Currently there is no way to create a compose function in Typescript without using overloading\n * This function currently support up to 10 wrappers\n * If needed you can add more by duplicating the type and add more parameters\n */\n\nexport function compose(...args: Fn[]) {\n return (data: any) => args.reduce((acc, elem) => elem(acc), data) as any;\n}\n","const getFunctionHash = (fn: Function) => {\n const functionSource = fn.toString();\n\n let hash = 0;\n\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < functionSource.length; i++) {\n const char = functionSource.charCodeAt(i);\n // eslint-disable-next-line no-bitwise\n hash = (hash << 5) - hash + char;\n // eslint-disable-next-line no-bitwise\n hash &= hash; // Convert to 32-bit integer\n }\n\n return hash.toString(16);\n};\n\ntype Mixin = (superclass: CustomElementConstructor) => CustomElementConstructor;\n\n// because a single mixin can be a dependency for many other mixins, a mixin can be loaded multiple times\n// some mixins should not be loaded multiple times, wrapping a mixin with this fn ensures it will load only once\nexport const createSingletonMixin = <T extends Mixin>(mixin: T): T => {\n const mixinNameSym = Symbol(getFunctionHash(mixin));\n\n const singletonMixin = (superclass: CustomElementConstructor) => {\n if (superclass[mixinNameSym]) {\n return superclass;\n }\n\n const cls = mixin(superclass);\n cls[mixinNameSym] = true;\n\n return cls;\n };\n\n return singletonMixin as T;\n};\n"],"names":["compareArrays","array1","array2","length","every","value","index","compareObjects","objectA","objectB","aProperties","Object","getOwnPropertyNames","bProperties","i","propName","valA","valB","constructor","init","updateOnlyOnChange","_State_state","set","this","_State_subscribers","_State_token","_State_updateOnlyOnChange","update","newState","internalNewState","__classPrivateFieldGet","nextState","prevState","__classPrivateFieldSet","freeze","setTimeout","values","forEach","cb","state","attrName","createIsChanged","current","assign","subscribe","toString","unsubscribe","token","isFound","unsubscribeAll","args","data","reduce","acc","elem","mixin","mixinNameSym","Symbol","fn","functionSource","hash","charCodeAt","getFunctionHash","superclass","cls","templateString","template","document","createElement","innerHTML","ms","timeoutId","clearTimeout","apply","obj","keys","str","replace","toLowerCase","paths","join","amount","strings","expressions","idx","_a","prevArgs","cache"],"mappings":"oCAAa,MCIAA,EAAgB,CAACC,EAAeC,IAC3CD,EAAOE,SAAWD,EAAOC,QACzBF,EAAOG,OAAM,CAACC,EAAYC,IAAkBD,IAAUH,EAAOI,iBCW/D,SAASC,EACPC,EACAC,GAEA,MAAMC,EAAcC,OAAOC,oBAAoBJ,GACzCK,EAAcF,OAAOC,oBAAoBH,GAE/C,GAAIC,EAAYP,SAAWU,EAAYV,OACrC,OAAO,EAGT,IAAK,IAAIW,EAAI,EAAGA,EAAIJ,EAAYP,OAAQW,GAAK,EAAG,CAC9C,MAAMC,EAAWL,EAAYI,GAEvBE,EAAOR,EAAQO,GACfE,EAAOR,EAAQM,GACrB,GAAa,OAATC,GAA0B,OAATC,GACnB,GAAID,IAASC,EACX,OAAO,OAEJ,GAAoB,iBAATD,GAAqC,iBAATC,GAE5C,IAAKV,EAAeS,EAAMC,GACxB,OAAO,OAEJ,GAAID,IAASC,EAClB,OAAO,CAEV,CAED,OAAO,CACT,6EAaEC,YAAYC,EAAU,CAAO,GAAEC,mBAAEA,GAAqB,GAAS,IAR/DC,EAAUC,IAAAC,UAAA,GAEVC,EAAAF,IAAAC,KAA+B,CAAA,GAE/BE,EAAAH,IAAAC,KAAS,GAETG,EAAAJ,IAAAC,MAAsB,GAWtBA,KAAAI,OAAUC,IACR,MAAMC,EACgB,mBAAbD,EAA0BA,EAASE,yBAAAP,KAAWF,EAAA,MAAIO,EAErDG,iCAAiBD,EAAAA,uBAAAP,aAAgBM,GACvC,IAAKC,EAAAA,uBAAAP,KAAIG,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GAAQ,GAAKA,EAFRD,EAAeE,WAAW/C,GAIvC8C,GAAQA,EAGV,OAAOA,EAAKf,SAAS,GAAG,EAQIiB,CAAgBP,IAa5C,OAXwBQ,IACtB,GAAIA,EAAWP,GACb,OAAOO,EAGT,MAAMC,EAAMT,EAAMQ,GAGlB,OAFAC,EAAIR,IAAgB,EAEbQ,CAAG,CAGc,yBJnCGC,IAC7B,MAAMC,EAAWC,SAASC,cAAc,YAGxC,OAFAF,EAASG,UAAYJ,EAEdC,CAAQ,mBCmCO,CAACR,EAAcY,EAAK,OAC1C,IAAIC,EACJ,OAAO,YAAiCrB,GACtCsB,aAAaD,GACbA,EAAYpC,YAAW,IAAMuB,EAAGe,MAAMlD,KAAM2B,IAAOoB,EACrD,CAAC,qBAjBwBI,GACG,IAA5B/D,OAAOgE,KAAKD,GAAKvE,QAAgBuE,EAAIxD,cAAgBP,yBAP7BiE,GACxBA,EACGC,QAAQ,kBAAmB,SAC3BA,QAAQ,WAAY,KACpBC,+BAxBmB,IAAIC,IAC1BA,EAAMC,KAAK,KAAKH,QAAQ,OAAQ,uBA6B/BI,GACD,CAACC,KAAkCC,IACjCD,EAAQ9B,QACN,CAACC,EAAKuB,EAAKQ,KAAO,IAAAC,EAChB,MAAA,GAAGhC,IAAMuB,KAA2B,QAArBS,EAAAF,aAAW,EAAXA,EAAcC,UAAO,IAAAC,OAAA,EAAAA,EAAAJ,EAAS,EAAI,EAAI,KAAM,IAAI,GACjE,yBA5B2CvB,IAC/C,IAAI4B,EACAC,EACJ,MAAO,IAAIrC,KACLoC,GAAYtF,EAAcsF,EAAUpC,KAExCoC,EAAWpC,EACXqC,EAAQ7B,KAAMR,IAHwCqC,EAMvD"}
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/compose.ts","../src/dom.ts","../src/generic.ts","../src/mixins.ts","../src/state.ts"],"sourcesContent":["type Fn = (arg: any) => any;\n\nexport function compose<Input, A1>(\n fn1: (input: Input) => A1,\n): (input: Input) => A1;\n\nexport function compose<Input, A1, A2>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n): (input: Input) => A2;\n\nexport function compose<Input, A1, A2, A3>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n): (input: Input) => A3;\n\nexport function compose<Input, A1, A2, A3, A4>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n): (input: Input) => A4;\n\nexport function compose<Input, A1, A2, A3, A4, A5>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n): (input: Input) => A5;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n): (input: Input) => A6;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n): (input: Input) => A7;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n): (input: Input) => A8;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n): (input: Input) => A9;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n): (input: Input) => A10;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n fn11: (input: A10) => A11,\n): (input: Input) => A11;\n\nexport function compose<\n Input,\n A1,\n A2,\n A3,\n A4,\n A5,\n A6,\n A7,\n A8,\n A9,\n A10,\n A11,\n A12,\n>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n fn11: (input: A10) => A11,\n fn12: (input: A11) => A12,\n): (input: Input) => A12;\n\n/**\n * Currently there is no way to create a compose function in Typescript without using overloading\n * This function currently support up to 10 wrappers\n * If needed you can add more by duplicating the type and add more parameters\n */\n\nexport function compose(...args: Fn[]) {\n return (data: any) => args.reduce((acc, elem) => elem(acc), data) as any;\n}\n","export const createTemplate = (templateString: string) => {\n const template = document.createElement('template');\n template.innerHTML = templateString;\n\n return template;\n};\n","// preventing duplicate separators\nexport const pathJoin = (...paths: string[]) =>\n paths.join('/').replace(/\\/+/g, '/');\n\nexport const compareArrays = (array1: any[], array2: any[]) =>\n array1.length === array2.length &&\n array1.every((value: any, index: number) => value === array2[index]);\n\nexport const withMemCache = <I extends any[], O>(fn: (...args: I) => O) => {\n let prevArgs: any[];\n let cache: any;\n return (...args: I) => {\n if (prevArgs && compareArrays(prevArgs, args)) return cache as O;\n\n prevArgs = args;\n cache = fn(...args);\n\n return cache as O;\n };\n};\n\nexport const kebabCase = (str: string) =>\n str\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/[\\s_.]+/g, '-')\n .toLowerCase();\n\nexport const isObjEmpty = (obj: object) =>\n Object.keys(obj).length === 0 && obj.constructor === Object;\n\nexport const pluralize =\n (amount: number) =>\n (strings: TemplateStringsArray, ...expressions: (string | number)[][]) =>\n strings.reduce(\n (acc, str, idx) =>\n `${acc}${str}${expressions?.[idx]?.[amount > 1 ? 1 : 0] || ''}`,\n '',\n );\n\nexport const debounce = (fn: Function, ms = 500) => {\n let timeoutId: ReturnType<typeof setTimeout>;\n return function debounced(this: any, ...args: any[]) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn.apply(this, args), ms);\n };\n};\n","const getFunctionHash = (fn: Function) => {\n const functionSource = fn.toString();\n\n let hash = 0;\n\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < functionSource.length; i++) {\n const char = functionSource.charCodeAt(i);\n // eslint-disable-next-line no-bitwise\n hash = (hash << 5) - hash + char;\n // eslint-disable-next-line no-bitwise\n hash &= hash; // Convert to 32-bit integer\n }\n\n return hash.toString(16);\n};\n\ntype Mixin = (superclass: CustomElementConstructor) => CustomElementConstructor;\n\n// because a single mixin can be a dependency for many other mixins, a mixin can be loaded multiple times\n// some mixins should not be loaded multiple times, wrapping a mixin with this fn ensures it will load only once\nexport const createSingletonMixin = <T extends Mixin>(mixin: T): T => {\n const mixinNameSym = Symbol(getFunctionHash(mixin));\n\n const singletonMixin = (superclass: CustomElementConstructor) => {\n if (superclass[mixinNameSym]) {\n return superclass;\n }\n\n const cls = mixin(superclass);\n cls[mixinNameSym] = true;\n\n return cls;\n };\n\n return singletonMixin as T;\n};\n","const createIsChanged =\n <T extends Record<string, any>>(state: T, prevState: T) =>\n (attrName: keyof T) =>\n state[attrName] !== prevState[attrName];\n\ntype StateObject = Record<string, any>;\n\ntype UpdateStateCb<T> = (state: T) => Partial<T>;\ntype Subscribers<T> = Record<string, SubscribeCb<T>>;\n\n// eslint-disable-next-line import/exports-last\nexport type SubscribeCb<T> = (\n state: T,\n prevState: T,\n isChanged: ReturnType<typeof createIsChanged>,\n) => void | Promise<void>;\n\nfunction compareObjects(\n objectA: Record<string, any>,\n objectB: Record<string, any>,\n) {\n const aProperties = Object.getOwnPropertyNames(objectA);\n const bProperties = Object.getOwnPropertyNames(objectB);\n\n if (aProperties.length !== bProperties.length) {\n return false;\n }\n\n for (let i = 0; i < aProperties.length; i += 1) {\n const propName = aProperties[i];\n\n const valA = objectA[propName];\n const valB = objectB[propName];\n if (valA === null || valB === null) {\n if (valA !== valB) {\n return false;\n }\n } else if (typeof valA === 'object' && typeof valB === 'object') {\n // compare nested objects\n if (!compareObjects(valA, valB)) {\n return false;\n }\n } else if (valA !== valB) {\n return false;\n }\n }\n\n return true;\n}\n\nexport type IsChanged<T> = Parameters<SubscribeCb<T>>[2];\n\nexport class State<T extends StateObject> {\n #state: T;\n\n #subscribers: Subscribers<T> = {};\n\n #token = 0;\n\n #updateOnlyOnChange = false;\n\n constructor(init: T = {} as T, { updateOnlyOnChange = true } = {}) {\n this.#state = init;\n this.#updateOnlyOnChange = updateOnlyOnChange;\n }\n\n get current() {\n return { ...this.#state };\n }\n\n update = (newState: Partial<T> | UpdateStateCb<T>) => {\n const internalNewState =\n typeof newState === 'function' ? newState(this.#state) : newState;\n\n const nextState = { ...this.#state, ...internalNewState };\n if (!this.#updateOnlyOnChange || !compareObjects(this.#state, nextState)) {\n const prevState = this.#state;\n this.#state = nextState;\n Object.freeze(this.#state);\n\n setTimeout(() => {\n Object.values(this.#subscribers).forEach((cb) =>\n cb(nextState, prevState, createIsChanged(nextState, prevState)),\n );\n }, 0);\n }\n };\n\n subscribe(cb: SubscribeCb<T>) {\n this.#token += 1;\n this.#subscribers[this.#token] = cb;\n\n return this.#token.toString();\n }\n\n unsubscribe(token: string) {\n const isFound = !!this.#subscribers[token];\n\n if (isFound) {\n delete this.#subscribers[token];\n }\n\n return isFound;\n }\n\n unsubscribeAll() {\n this.#subscribers = {};\n\n return true;\n }\n}\n"],"names":["compose","args","data","reduce","acc","elem","createTemplate","templateString","template","document","createElement","innerHTML","pathJoin","paths","join","replace","compareArrays","array1","array2","length","every","value","index","withMemCache","fn","prevArgs","cache","kebabCase","str","toLowerCase","isObjEmpty","obj","Object","keys","constructor","pluralize","amount","strings","expressions","idx","_a","debounce","ms","timeoutId","clearTimeout","setTimeout","apply","this","createSingletonMixin","mixin","mixinNameSym","Symbol","functionSource","toString","hash","i","charCodeAt","getFunctionHash","superclass","cls","compareObjects","objectA","objectB","aProperties","getOwnPropertyNames","bProperties","propName","valA","valB","State","init","updateOnlyOnChange","_State_state","set","_State_subscribers","_State_token","_State_updateOnlyOnChange","update","newState","internalNewState","__classPrivateFieldGet","nextState","prevState","__classPrivateFieldSet","freeze","values","forEach","cb","state","attrName","createIsChanged","current","assign","subscribe","unsubscribe","token","isFound","unsubscribeAll"],"mappings":"2EAwIgB,SAAAA,KAAWC,GACzB,OAAQC,GAAcD,EAAKE,QAAO,CAACC,EAAKC,IAASA,EAAKD,IAAMF,EAC9D,CC1Ia,MAAAI,EAAkBC,IAC7B,MAAMC,EAAWC,SAASC,cAAc,YAGxC,OAFAF,EAASG,UAAYJ,EAEdC,CAAQ,ECHJI,EAAW,IAAIC,IAC1BA,EAAMC,KAAK,KAAKC,QAAQ,OAAQ,KAErBC,EAAgB,CAACC,EAAeC,IAC3CD,EAAOE,SAAWD,EAAOC,QACzBF,EAAOG,OAAM,CAACC,EAAYC,IAAkBD,IAAUH,EAAOI,K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,EAAepC,KAAA4B,EAAAK,EAAAjC,KAAA4B,EAAA,KAAA,OACfK,EAAAjC,YAAkBiC,EAAAjC,KAAW4B,EAAA,MAAIY,EAE1BP,EAAAjC,KAAI4B,EAAA,KAAQtB,UACpB,CAEDyC,YAAYC,GACV,MAAMC,IAAYhB,EAAAjC,KAAiB2B,EAAA,KAACqB,GAMpC,OAJIC,UACKhB,EAAAjC,KAAI2B,EAAA,KAAcqB,GAGpBC,CACR,CAEDC,iBAGE,OAFAd,EAAApC,KAAI2B,EAAgB,CAAE,EAAA,MAEf,CACR"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/compose.ts","../src/dom.ts","../src/generic.ts","../src/mixins.ts","../src/state.ts"],"sourcesContent":["type Fn = (arg: any) => any;\n\nexport function compose<Input, A1>(\n fn1: (input: Input) => A1,\n): (input: Input) => A1;\n\nexport function compose<Input, A1, A2>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n): (input: Input) => A2;\n\nexport function compose<Input, A1, A2, A3>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n): (input: Input) => A3;\n\nexport function compose<Input, A1, A2, A3, A4>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n): (input: Input) => A4;\n\nexport function compose<Input, A1, A2, A3, A4, A5>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n): (input: Input) => A5;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n): (input: Input) => A6;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n): (input: Input) => A7;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n): (input: Input) => A8;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n): (input: Input) => A9;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n): (input: Input) => A10;\n\nexport function compose<Input, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n fn11: (input: A10) => A11,\n): (input: Input) => A11;\n\nexport function compose<\n Input,\n A1,\n A2,\n A3,\n A4,\n A5,\n A6,\n A7,\n A8,\n A9,\n A10,\n A11,\n A12,\n>(\n fn1: (input: Input) => A1,\n fn2: (input: A1) => A2,\n fn3: (input: A2) => A3,\n fn4: (input: A3) => A4,\n fn5: (input: A4) => A5,\n fn6: (input: A5) => A6,\n fn7: (input: A6) => A7,\n fn8: (input: A7) => A8,\n fn9: (input: A8) => A9,\n fn10: (input: A9) => A10,\n fn11: (input: A10) => A11,\n fn12: (input: A11) => A12,\n): (input: Input) => A12;\n\n/**\n * Currently there is no way to create a compose function in Typescript without using overloading\n * This function currently support up to 10 wrappers\n * If needed you can add more by duplicating the type and add more parameters\n */\n\nexport function compose(...args: Fn[]) {\n return (data: any) => args.reduce((acc, elem) => elem(acc), data) as any;\n}\n","export const createTemplate = (templateString: string) => {\n const template = document.createElement('template');\n template.innerHTML = templateString;\n\n return template;\n};\n","// preventing duplicate separators\nexport const pathJoin = (...paths: string[]) =>\n paths.join('/').replace(/\\/+/g, '/');\n\nexport const compareArrays = (array1: any[], array2: any[]) =>\n array1.length === array2.length &&\n array1.every((value: any, index: number) => value === array2[index]);\n\nexport const withMemCache = <I extends any[], O>(fn: (...args: I) => O) => {\n let prevArgs: any[];\n let cache: any;\n return (...args: I) => {\n if (prevArgs && compareArrays(prevArgs, args)) return cache as O;\n\n prevArgs = args;\n cache = fn(...args);\n\n return cache as O;\n };\n};\n\nexport const kebabCase = (str: string) =>\n str\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/[\\s_.]+/g, '-')\n .toLowerCase();\n\nexport const isObjEmpty = (obj: object) =>\n Object.keys(obj).length === 0 && obj.constructor === Object;\n\nexport const pluralize =\n (amount: number) =>\n (strings: TemplateStringsArray, ...expressions: (string | number)[][]) =>\n strings.reduce(\n (acc, str, idx) =>\n `${acc}${str}${expressions?.[idx]?.[amount > 1 ? 1 : 0] || ''}`,\n '',\n );\n\nexport const debounce = (fn: Function, ms = 500) => {\n let timeoutId: ReturnType<typeof setTimeout>;\n return function debounced(this: any, ...args: any[]) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn.apply(this, args), ms);\n };\n};\n","const getFunctionHash = (fn: Function) => {\n const functionSource = fn.toString();\n\n let hash = 0;\n\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < functionSource.length; i++) {\n const char = functionSource.charCodeAt(i);\n // eslint-disable-next-line no-bitwise\n hash = (hash << 5) - hash + char;\n // eslint-disable-next-line no-bitwise\n hash &= hash; // Convert to 32-bit integer\n }\n\n return hash.toString(16);\n};\n\ntype Mixin = (superclass: CustomElementConstructor) => CustomElementConstructor;\n\n// because a single mixin can be a dependency for many other mixins, a mixin can be loaded multiple times\n// some mixins should not be loaded multiple times, wrapping a mixin with this fn ensures it will load only once\nexport const createSingletonMixin = <T extends Mixin>(mixin: T): T => {\n const mixinNameSym = Symbol(getFunctionHash(mixin));\n\n const singletonMixin = (superclass: CustomElementConstructor) => {\n if (superclass[mixinNameSym]) {\n return superclass;\n }\n\n const cls = mixin(superclass);\n cls[mixinNameSym] = true;\n\n return cls;\n };\n\n return singletonMixin as T;\n};\n","const createIsChanged =\n <T extends Record<string, any>>(state: T, prevState: T) =>\n (attrName: keyof T) =>\n state[attrName] !== prevState[attrName];\n\ntype StateObject = Record<string, any>;\n\ntype UpdateStateCb<T> = (state: T) => Partial<T>;\ntype Subscribers<T> = Record<string, SubscribeCb<T>>;\n\n// eslint-disable-next-line import/exports-last\nexport type SubscribeCb<T> = (\n state: T,\n prevState: T,\n isChanged: ReturnType<typeof createIsChanged>,\n) => void | Promise<void>;\n\nfunction compareObjects(\n objectA: Record<string, any>,\n objectB: Record<string, any>,\n) {\n const aProperties = Object.getOwnPropertyNames(objectA);\n const bProperties = Object.getOwnPropertyNames(objectB);\n\n if (aProperties.length !== bProperties.length) {\n return false;\n }\n\n for (let i = 0; i < aProperties.length; i += 1) {\n const propName = aProperties[i];\n\n const valA = objectA[propName];\n const valB = objectB[propName];\n if (valA === null || valB === null) {\n if (valA !== valB) {\n return false;\n }\n } else if (typeof valA === 'object' && typeof valB === 'object') {\n // compare nested objects\n if (!compareObjects(valA, valB)) {\n return false;\n }\n } else if (valA !== valB) {\n return false;\n }\n }\n\n return true;\n}\n\nexport type IsChanged<T> = Parameters<SubscribeCb<T>>[2];\n\nexport class State<T extends StateObject> {\n #state: T;\n\n #subscribers: Subscribers<T> = {};\n\n #token = 0;\n\n #updateOnlyOnChange = false;\n\n constructor(init: T = {} as T, { updateOnlyOnChange = true } = {}) {\n this.#state = init;\n this.#updateOnlyOnChange = updateOnlyOnChange;\n }\n\n get current() {\n return { ...this.#state };\n }\n\n update = (newState: Partial<T> | UpdateStateCb<T>) => {\n const internalNewState =\n typeof newState === 'function' ? newState(this.#state) : newState;\n\n const nextState = { ...this.#state, ...internalNewState };\n if (!this.#updateOnlyOnChange || !compareObjects(this.#state, nextState)) {\n const prevState = this.#state;\n this.#state = nextState;\n Object.freeze(this.#state);\n\n setTimeout(() => {\n Object.values(this.#subscribers).forEach((cb) =>\n cb(nextState, prevState, createIsChanged(nextState, prevState)),\n );\n }, 0);\n }\n };\n\n subscribe(cb: SubscribeCb<T>) {\n this.#token += 1;\n this.#subscribers[this.#token] = cb;\n\n return this.#token.toString();\n }\n\n unsubscribe(token: string) {\n const isFound = !!this.#subscribers[token];\n\n if (isFound) {\n delete this.#subscribers[token];\n }\n\n return isFound;\n }\n\n unsubscribeAll() {\n this.#subscribers = {};\n\n return true;\n }\n}\n"],"names":["compose","args","data","reduce","acc","elem","createTemplate","templateString","template","document","createElement","innerHTML","pathJoin","paths","join","replace","compareArrays","array1","array2","length","every","value","index","withMemCache","fn","prevArgs","cache","kebabCase","str","toLowerCase","isObjEmpty","obj","Object","keys","constructor","pluralize","amount","strings","expressions","idx","_a","debounce","ms","timeoutId","clearTimeout","setTimeout","apply","this","createSingletonMixin","mixin","mixinNameSym","Symbol","functionSource","toString","hash","i","charCodeAt","getFunctionHash","superclass","cls","compareObjects","objectA","objectB","aProperties","getOwnPropertyNames","bProperties","propName","valA","valB","State","init","updateOnlyOnChange","_State_state","set","_State_subscribers","_State_token","_State_updateOnlyOnChange","update","newState","internalNewState","__classPrivateFieldGet","nextState","prevState","__classPrivateFieldSet","freeze","values","forEach","cb","state","attrName","createIsChanged","current","assign","subscribe","unsubscribe","token","isFound","unsubscribeAll"],"mappings":"2EAwIgB,SAAAA,KAAWC,GACzB,OAAQC,GAAcD,EAAKE,QAAO,CAACC,EAAKC,IAASA,EAAKD,IAAMF,EAC9D,CC1Ia,MAAAI,EAAkBC,IAC7B,MAAMC,EAAWC,SAASC,cAAc,YAGxC,OAFAF,EAASG,UAAYJ,EAEdC,CAAQ,ECHJI,EAAW,IAAIC,IAC1BA,EAAMC,KAAK,KAAKC,QAAQ,OAAQ,KAErBC,EAAgB,CAACC,EAAeC,IAC3CD,EAAOE,SAAWD,EAAOC,QACzBF,EAAOG,OAAM,CAACC,EAAYC,IAAkBD,IAAUH,EAAOI,KAElDC,EAAoCC,IAC/C,IAAIC,EACAC,EACJ,MAAO,IAAIzB,KACLwB,GAAYT,EAAcS,EAAUxB,KAExCwB,EAAWxB,EACXyB,EAAQF,KAAMvB,IAHwCyB,EAMvD,EAGUC,EAAaC,GACxBA,EACGb,QAAQ,kBAAmB,SAC3BA,QAAQ,WAAY,KACpBc,cAEQC,EAAcC,GACG,IAA5BC,OAAOC,KAAKF,GAAKZ,QAAgBY,EAAIG,cAAgBF,OAE1CG,EACVC,GACD,CAACC,KAAkCC,IACjCD,EAAQlC,QACN,CAACC,EAAKwB,EAAKW,KAAO,IAAAC,EAChB,MAAA,GAAGpC,IAAMwB,KAA2B,QAArBY,EAAAF,aAAW,EAAXA,EAAcC,UAAO,IAAAC,OAAA,EAAAA,EAAAJ,EAAS,EAAI,EAAI,KAAM,IAAI,GACjE,IAGOK,EAAW,CAACjB,EAAckB,EAAK,OAC1C,IAAIC,EACJ,OAAO,YAAiC1C,GACtC2C,aAAaD,GACbA,EAAYE,YAAW,IAAMrB,EAAGsB,MAAMC,KAAM9C,IAAOyC,EACrD,CAAC,ECvBUM,EAAyCC,IACpD,MAAMC,EAAeC,OAtBC,CAAC3B,IACvB,MAA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ACxE,MAAMC,EAAYF,EAAAjC,YAClBoC,EAAApC,KAAIyB,EAAUS,EAAS,KACvBjD,OAAOoD,OAAOJ,EAAAjC,KAAIyB,EAAA,MAElB3B,YAAW,KACTb,OAAOqD,OAAOL,EAAAjC,KAAI2B,EAAA,MAAeY,SAASC,GACxCA,EAAGN,EAAWC,EAjFtB,EAAgCM,EAAUN,IACzCO,GACCD,EAAMC,KAAcP,EAAUO,GA+ECC,CAAgBT,EAAWC,KACrD,GACA,EACJ,GAvBDC,EAAApC,KAAIyB,EAAUF,EAAI,KAClBa,EAAApC,KAAI6B,EAAuBL,EAAkB,IAC9C,CAEGoB,cACF,OAAY3D,OAAA4D,OAAA,GAAAZ,EAAAjC,KAAIyB,EAAA,KACjB,CAoBDqB,UAAUN,GAIR,OAHAJ,EAAepC,KAAA4B,EAAAK,EAAAjC,KAAA4B,EAAA,KAAA,OACfK,EAAAjC,YAAkBiC,EAAAjC,KAAW4B,EAAA,MAAIY,EAE1BP,EAAAjC,KAAI4B,EAAA,KAAQtB,UACpB,CAEDyC,YAAYC,GACV,MAAMC,IAAYhB,EAAAjC,KAAiB2B,EAAA,KAACqB,GAMpC,OAJIC,UACKhB,EAAAjC,KAAI2B,EAAA,KAAcqB,GAGpBC,CACR,CAEDC,iBAGE,OAFAd,EAAApC,KAAI2B,EAAgB,CAAE,EAAA,MAEf,CACR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descope/sdk-helpers",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.60",
|
|
4
4
|
"author": "Descope Team <info@descope.com>",
|
|
5
5
|
"homepage": "https://github.com/descope/sdk-helpers",
|
|
6
6
|
"bugs": {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"rollup-plugin-livereload": "^2.0.5",
|
|
76
76
|
"ts-jest": "^29.0.0",
|
|
77
77
|
"ts-node": "10.9.2",
|
|
78
|
-
"typescript": "^
|
|
78
|
+
"typescript": "^5.0.2"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"tslib": "2.6.3"
|