wraplet 0.25.0 → 0.27.0

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.
@@ -6,8 +6,8 @@ import { ChildInstance } from "./types/ChildInstance";
6
6
  import { Groupable, GroupableSymbol, GroupExtractor } from "./types/Groupable";
7
7
  import { NodeTreeParent, NodeTreeParentSymbol } from "./types/NodeTreeParent";
8
8
  import { Core } from "./types/Core";
9
- export declare abstract class AbstractWraplet<M extends WrapletChildrenMap = {}, N extends Node = Node> implements Wraplet<N>, Groupable, NodeTreeParent {
10
- protected core: Core<M, N>;
9
+ export declare abstract class AbstractWraplet<N extends Node = Node, M extends WrapletChildrenMap = {}> implements Wraplet<N>, Groupable, NodeTreeParent {
10
+ protected core: Core<N, M>;
11
11
  [WrapletSymbol]: true;
12
12
  [GroupableSymbol]: true;
13
13
  [NodeTreeParentSymbol]: true;
@@ -21,7 +21,7 @@ export declare abstract class AbstractWraplet<M extends WrapletChildrenMap = {},
21
21
  * This is the log of all node accessors, available for easier debugging.
22
22
  */
23
23
  private __debugNodeAccessors;
24
- constructor(core: Core<M, N>);
24
+ constructor(core: Core<N, M>);
25
25
  getNodeTreeChildren(): Wraplet[];
26
26
  setGroupsExtractor(callback: GroupExtractor): void;
27
27
  getGroups(): string[];
@@ -52,6 +52,6 @@ export declare abstract class AbstractWraplet<M extends WrapletChildrenMap = {},
52
52
  * @protected
53
53
  */
54
54
  protected isChildInstance<K extends keyof M>(item: ChildInstance<M, keyof M>, actualUnknownId: keyof M, onlyId?: K | null): item is ChildInstance<M, K>;
55
- protected static createCore<N extends Node, M extends WrapletChildrenMap>(node: N, map: M): Core<M, N>;
56
- protected static createWraplets<N extends Node, T extends AbstractWraplet<any, N> = never>(node: ParentNode, map: WrapletChildrenMap, attribute: string, additional_args?: unknown[]): T[];
55
+ protected static createCore<N extends Node, M extends WrapletChildrenMap>(node: N, map: M): Core<N, M>;
56
+ protected static createWraplets<N extends Node, T extends AbstractWraplet<N, any> = never>(node: ParentNode, map: WrapletChildrenMap, attribute: string, additional_args?: unknown[]): T[];
57
57
  }
@@ -8,7 +8,7 @@ import { Core, CoreSymbol } from "./types/Core";
8
8
  import { NodeTreeParentSymbol } from "./types/NodeTreeParent";
9
9
  import { MapWrapper } from "./Map/MapWrapper";
10
10
  import { WrapletCreator } from "./types/WrapletCreator";
11
- export declare class DefaultCore<M extends WrapletChildrenMap = {}, N extends Node = Node> implements Core<M, N> {
11
+ export declare class DefaultCore<N extends Node = Node, M extends WrapletChildrenMap = {}> implements Core<N, M> {
12
12
  node: N;
13
13
  [CoreSymbol]: true;
14
14
  [NodeTreeParentSymbol]: true;
package/dist/storage.cjs CHANGED
@@ -1,2 +1,2 @@
1
- var t={d:(e,s)=>{for(var r in s)t.o(s,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:s[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{ElementStorage:()=>r});class s extends Error{}class r{element;attribute;defaults;validators;data;options;constructor(t,e,s,r,i={}){this.element=t,this.attribute=e,this.defaults=s,this.validators=r,this.options={keepFresh:!0,elementOptionsMerger:(t,e)=>({...t,...e}),...i},this.data=this.fetchFreshData()}has(t){return t in this.getAll()}get(t){return this.getAll()[t]}getMultiple(t){const e=this.getAll();return t.reduce((t,s)=>(t[s]=e[s],t),{})}getAll(){return this.options.keepFresh&&this.refresh(),this.data}set(t,e){if(!this.validators[t](e))throw new s(`Attempted to set an invalid value for the key ${String(t)}.`);const r=this.getAttributeValue(this.attribute),i=JSON.parse(r);i[t]=e,this.setAll(i)}setMultiple(t){const e=this.getAll();this.setAll({...e,...t})}setAll(t){this.element.setAttribute(this.attribute,JSON.stringify(t))}delete(t){const e=this.getAll();t in e&&(delete e[t],this.element.setAttribute(this.attribute,JSON.stringify(e)))}deleteMultiple(t){const e=this.getAll();for(const s of t)delete e[s];this.setAll(e)}deleteAll(){this.element.removeAttribute(this.attribute),this.refresh()}refresh(){this.data=this.fetchFreshData()}fetchFreshData(){const t=this.getAttributeValue(this.attribute);if("{"!==t.charAt(0))throw new s("Data has to be defined as an object.");const e=JSON.parse(t);if(!this.validateData(e))throw new s("Invalid storage value.");return this.options.elementOptionsMerger(this.defaults,e)}validateData(t){for(const e in t)if(!this.validators[e](t[e]))return!1;return!0}getAttributeValue(t){return this.element.getAttribute(t)||"{}"}}var i=exports;for(var l in e)i[l]=e[l];e.__esModule&&Object.defineProperty(i,"__esModule",{value:!0});
1
+ var t={d:(e,i)=>{for(var r in i)t.o(i,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:i[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{ElementStorage:()=>r});class i extends Error{}class r{element;attribute;defaults;validators;data;options;constructor(t,e,i,r,s={}){this.element=t,this.attribute=e,this.defaults=i,this.validators=r,this.options={keepFresh:!0,elementOptionsMerger:(t,e)=>({...t,...e}),...s},this.data=this.fetchFreshData()}has(t){return t in this.getAll()}get(t){return this.getAll()[t]}getMultiple(t){const e=this.getAll();return t.reduce((t,i)=>(t[i]=e[i],t),{})}getAll(){return this.options.keepFresh&&this.refresh(),this.data}set(t,e){if(!this.validators[t](e))throw new i(`Attempted to set an invalid value for the key ${String(t)}.`);const r=this.getAttributeValue(this.attribute),s=JSON.parse(r);s[t]=e,this.setAll(s)}setMultiple(t){const e=this.getAll();this.setAll({...e,...t})}setAll(t){this.element.setAttribute(this.attribute,JSON.stringify(t))}delete(t){const e=this.getAll();t in e&&(delete e[t],this.element.setAttribute(this.attribute,JSON.stringify(e)))}deleteMultiple(t){const e=this.getAll();for(const i of t)delete e[i];this.setAll(e)}deleteAll(){this.element.removeAttribute(this.attribute),this.refresh()}refresh(){this.data=this.fetchFreshData()}fetchFreshData(){const t=this.getAttributeValue(this.attribute);if("{"!==t.charAt(0))throw new i("Data has to be defined as an object.");const e=JSON.parse(t);if(!this.validateData(e))throw new i("Invalid storage value.");return this.options.elementOptionsMerger(this.defaults,e)}validateData(t){for(const e in t){if(!(e in this.validators))return console.warn(`Option ${e} doesn't have a validator.`),!1;if("function"!=typeof this.validators[e])return console.warn(`Validator for option ${e} is not a function.`),!1;if(!this.validators[e](t[e]))return!1}return!0}getAttributeValue(t){return this.element.getAttribute(t)||"{}"}}var s=exports;for(var a in e)s[a]=e[a];e.__esModule&&Object.defineProperty(s,"__esModule",{value:!0});
2
2
  //# sourceMappingURL=storage.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.cjs","mappings":"AACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,0CCGhD,MAAMC,UAA+BC,OCPrC,MAAMC,EACTC,QACAC,UACAC,SACAC,WACAC,KACAC,QACA,WAAAC,CAAYN,EAASC,EAAWC,EAAUC,EAAYE,EAAU,CAAC,GAC7DE,KAAKP,QAAUA,EACfO,KAAKN,UAAYA,EACjBM,KAAKL,SAAWA,EAChBK,KAAKJ,WAAaA,EAClBI,KAAKF,QAAU,CACXG,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,KAAKK,gBACrB,CACA,cAAAA,GACI,MAAMsB,EAAa3B,KAAKgB,kBAAkBhB,KAAKN,WAC/C,GAA6B,MAAzBiC,EAAWC,OAAO,GAClB,MAAM,IAAItC,EAAuB,wCAErC,MAAMO,EAAOoB,KAAKC,MAAMS,GACxB,IAAK3B,KAAK6B,aAAahC,GACnB,MAAM,IAAIP,EAAuB,0BAErC,OAAOU,KAAKF,QAAQI,qBAAqBF,KAAKL,SAAUE,EAC5D,CACA,YAAAgC,CAAahC,GACT,IAAK,MAAMrB,KAAOqB,EACd,IAAKG,KAAKJ,WAAWpB,GAAKqB,EAAKrB,IAC3B,OAAO,EAGf,OAAO,CACX,CACA,iBAAAwC,CAAkBtB,GACd,OAAOM,KAAKP,QAAQqC,aAAapC,IAAc,IACnD,E","sources":["webpack://wraplet/webpack/bootstrap","webpack://wraplet/webpack/runtime/define property getters","webpack://wraplet/webpack/runtime/hasOwnProperty shorthand","webpack://wraplet/webpack/runtime/make namespace object","webpack://wraplet/./src/errors.ts","webpack://wraplet/./src/Storage/ElementStorage.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export class MissingRequiredChildError extends Error {\n}\nexport class MapError extends Error {\n}\nexport class RequiredChildDestroyedError extends Error {\n}\nexport class ChildrenAreNotAvailableError extends Error {\n}\nexport class StorageValidationError extends Error {\n}\nexport class ChildrenTooManyFoundError extends Error {\n}\nexport class ChildrenAreAlreadyDestroyedError extends Error {\n}\nexport class InternalLogicError extends Error {\n}\n","import { StorageValidationError } from \"../errors\";\nexport class ElementStorage {\n element;\n attribute;\n defaults;\n validators;\n data;\n options;\n constructor(element, attribute, defaults, validators, options = {}) {\n this.element = element;\n this.attribute = attribute;\n this.defaults = defaults;\n this.validators = validators;\n this.options = {\n keepFresh: true,\n elementOptionsMerger: (defaultOptions, elementOptions) => {\n return { ...defaultOptions, ...elementOptions };\n },\n ...options,\n };\n this.data = this.fetchFreshData();\n }\n has(key) {\n const data = this.getAll();\n return key in data;\n }\n get(key) {\n const data = this.getAll();\n return data[key];\n }\n getMultiple(keys) {\n const data = this.getAll();\n return keys.reduce((acc, key) => {\n acc[key] = data[key];\n return acc;\n }, {});\n }\n getAll() {\n if (this.options.keepFresh) {\n this.refresh();\n }\n return this.data;\n }\n set(key, value) {\n if (!this.validators[key](value)) {\n throw new StorageValidationError(`Attempted to set an invalid value for the key ${String(key)}.`);\n }\n const attributeValue = this.getAttributeValue(this.attribute);\n const data = JSON.parse(attributeValue);\n data[key] = value;\n this.setAll(data);\n }\n setMultiple(data) {\n const oldData = this.getAll();\n this.setAll({ ...oldData, ...data });\n }\n setAll(data) {\n this.element.setAttribute(this.attribute, JSON.stringify(data));\n }\n delete(key) {\n const data = this.getAll();\n if (!(key in data)) {\n return;\n }\n delete data[key];\n this.element.setAttribute(this.attribute, JSON.stringify(data));\n }\n deleteMultiple(keys) {\n const data = this.getAll();\n for (const key of keys) {\n delete data[key];\n }\n this.setAll(data);\n }\n deleteAll() {\n this.element.removeAttribute(this.attribute);\n this.refresh();\n }\n refresh() {\n this.data = this.fetchFreshData();\n }\n fetchFreshData() {\n const dataString = this.getAttributeValue(this.attribute);\n if (dataString.charAt(0) !== \"{\") {\n throw new StorageValidationError(`Data has to be defined as an object.`);\n }\n const data = JSON.parse(dataString);\n if (!this.validateData(data)) {\n throw new StorageValidationError(\"Invalid storage value.\");\n }\n return this.options.elementOptionsMerger(this.defaults, data);\n }\n validateData(data) {\n for (const key in data) {\n if (!this.validators[key](data[key])) {\n return false;\n }\n }\n return true;\n }\n getAttributeValue(attribute) {\n return this.element.getAttribute(attribute) || \"{}\";\n }\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","StorageValidationError","Error","ElementStorage","element","attribute","defaults","validators","data","options","constructor","this","keepFresh","elementOptionsMerger","defaultOptions","elementOptions","fetchFreshData","has","getAll","getMultiple","keys","reduce","acc","refresh","set","String","attributeValue","getAttributeValue","JSON","parse","setAll","setMultiple","oldData","setAttribute","stringify","deleteMultiple","deleteAll","removeAttribute","dataString","charAt","validateData","getAttribute"],"sourceRoot":""}
1
+ {"version":3,"file":"storage.cjs","mappings":"AACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,0CCGhD,MAAMC,UAA+BC,OCPrC,MAAMC,EACTC,QACAC,UACAC,SACAC,WACAC,KACAC,QACA,WAAAC,CAAYN,EAASC,EAAWC,EAAUC,EAAYE,EAAU,CAAC,GAC7DE,KAAKP,QAAUA,EACfO,KAAKN,UAAYA,EACjBM,KAAKL,SAAWA,EAChBK,KAAKJ,WAAaA,EAClBI,KAAKF,QAAU,CACXG,WAAW,EACXC,qBAAsB,CAACC,EAAgBC,K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MsB,EAAa3B,KAAKgB,kBAAkBhB,KAAKN,WAC/C,GAA6B,MAAzBiC,EAAWC,OAAO,GAClB,MAAM,IAAItC,EAAuB,wCAErC,MAAMO,EAAOoB,KAAKC,MAAMS,GACxB,IAAK3B,KAAK6B,aAAahC,GACnB,MAAM,IAAIP,EAAuB,0BAErC,OAAOU,KAAKF,QAAQI,qBAAqBF,KAAKL,SAAUE,EAC5D,CACA,YAAAgC,CAAahC,GACT,IAAK,MAAMrB,KAAOqB,EAAM,CACpB,KAAMrB,KAAOwB,KAAKJ,YAEd,OADAkC,QAAQC,KAAK,UAAUvD,gCAChB,EAEN,GAAoC,mBAAzBwB,KAAKJ,WAAWpB,GAE5B,OADAsD,QAAQC,KAAK,wBAAwBvD,yBAC9B,EAEN,IAAKwB,KAAKJ,WAAWpB,GAAKqB,EAAKrB,IAChC,OAAO,CAEf,CACA,OAAO,CACX,CACA,iBAAAwC,CAAkBtB,GACd,OAAOM,KAAKP,QAAQuC,aAAatC,IAAc,IACnD,E","sources":["webpack://wraplet/webpack/bootstrap","webpack://wraplet/webpack/runtime/define property getters","webpack://wraplet/webpack/runtime/hasOwnProperty shorthand","webpack://wraplet/webpack/runtime/make namespace object","webpack://wraplet/./src/errors.ts","webpack://wraplet/./src/Storage/ElementStorage.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export class MissingRequiredChildError extends Error {\n}\nexport class MapError extends Error {\n}\nexport class RequiredChildDestroyedError extends Error {\n}\nexport class ChildrenAreNotAvailableError extends Error {\n}\nexport class StorageValidationError extends Error {\n}\nexport class ChildrenTooManyFoundError extends Error {\n}\nexport class ChildrenAreAlreadyDestroyedError extends Error {\n}\nexport class InternalLogicError extends Error {\n}\n","import { StorageValidationError } from \"../errors\";\nexport class ElementStorage {\n element;\n attribute;\n defaults;\n validators;\n data;\n options;\n constructor(element, attribute, defaults, validators, options = {}) {\n this.element = element;\n this.attribute = attribute;\n this.defaults = defaults;\n this.validators = validators;\n this.options = {\n keepFresh: true,\n elementOptionsMerger: (defaultOptions, elementOptions) => {\n return { ...defaultOptions, ...elementOptions };\n },\n ...options,\n };\n this.data = this.fetchFreshData();\n }\n has(key) {\n const data = this.getAll();\n return key in data;\n }\n get(key) {\n const data = this.getAll();\n return data[key];\n }\n getMultiple(keys) {\n const data = this.getAll();\n return keys.reduce((acc, key) => {\n acc[key] = data[key];\n return acc;\n }, {});\n }\n getAll() {\n if (this.options.keepFresh) {\n this.refresh();\n }\n return this.data;\n }\n set(key, value) {\n if (!this.validators[key](value)) {\n throw new StorageValidationError(`Attempted to set an invalid value for the key ${String(key)}.`);\n }\n const attributeValue = this.getAttributeValue(this.attribute);\n const data = JSON.parse(attributeValue);\n data[key] = value;\n this.setAll(data);\n }\n setMultiple(data) {\n const oldData = this.getAll();\n this.setAll({ ...oldData, ...data });\n }\n setAll(data) {\n this.element.setAttribute(this.attribute, JSON.stringify(data));\n }\n delete(key) {\n const data = this.getAll();\n if (!(key in data)) {\n return;\n }\n delete data[key];\n this.element.setAttribute(this.attribute, JSON.stringify(data));\n }\n deleteMultiple(keys) {\n const data = this.getAll();\n for (const key of keys) {\n delete data[key];\n }\n this.setAll(data);\n }\n deleteAll() {\n this.element.removeAttribute(this.attribute);\n this.refresh();\n }\n refresh() {\n this.data = this.fetchFreshData();\n }\n fetchFreshData() {\n const dataString = this.getAttributeValue(this.attribute);\n if (dataString.charAt(0) !== \"{\") {\n throw new StorageValidationError(`Data has to be defined as an object.`);\n }\n const data = JSON.parse(dataString);\n if (!this.validateData(data)) {\n throw new StorageValidationError(\"Invalid storage value.\");\n }\n return this.options.elementOptionsMerger(this.defaults, data);\n }\n validateData(data) {\n for (const key in data) {\n if (!(key in this.validators)) {\n console.warn(`Option ${key} doesn't have a validator.`);\n return false;\n }\n else if (typeof this.validators[key] !== \"function\") {\n console.warn(`Validator for option ${key} is not a function.`);\n return false;\n }\n else if (!this.validators[key](data[key])) {\n return false;\n }\n }\n return true;\n }\n getAttributeValue(attribute) {\n return this.element.getAttribute(attribute) || \"{}\";\n }\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","StorageValidationError","Error","ElementStorage","element","attribute","defaults","validators","data","options","constructor","this","keepFresh","elementOptionsMerger","defaultOptions","elementOptions","fetchFreshData","has","getAll","getMultiple","keys","reduce","acc","refresh","set","String","attributeValue","getAttributeValue","JSON","parse","setAll","setMultiple","oldData","setAttribute","stringify","deleteMultiple","deleteAll","removeAttribute","dataString","charAt","validateData","console","warn","getAttribute"],"sourceRoot":""}
package/dist/storage.js CHANGED
@@ -1,2 +1,2 @@
1
- class t extends Error{}class e{element;attribute;defaults;validators;data;options;constructor(t,e,s,i,r={}){this.element=t,this.attribute=e,this.defaults=s,this.validators=i,this.options={keepFresh:!0,elementOptionsMerger:(t,e)=>({...t,...e}),...r},this.data=this.fetchFreshData()}has(t){return t in this.getAll()}get(t){return this.getAll()[t]}getMultiple(t){const e=this.getAll();return t.reduce((t,s)=>(t[s]=e[s],t),{})}getAll(){return this.options.keepFresh&&this.refresh(),this.data}set(e,s){if(!this.validators[e](s))throw new t(`Attempted to set an invalid value for the key ${String(e)}.`);const i=this.getAttributeValue(this.attribute),r=JSON.parse(i);r[e]=s,this.setAll(r)}setMultiple(t){const e=this.getAll();this.setAll({...e,...t})}setAll(t){this.element.setAttribute(this.attribute,JSON.stringify(t))}delete(t){const e=this.getAll();t in e&&(delete e[t],this.element.setAttribute(this.attribute,JSON.stringify(e)))}deleteMultiple(t){const e=this.getAll();for(const s of t)delete e[s];this.setAll(e)}deleteAll(){this.element.removeAttribute(this.attribute),this.refresh()}refresh(){this.data=this.fetchFreshData()}fetchFreshData(){const e=this.getAttributeValue(this.attribute);if("{"!==e.charAt(0))throw new t("Data has to be defined as an object.");const s=JSON.parse(e);if(!this.validateData(s))throw new t("Invalid storage value.");return this.options.elementOptionsMerger(this.defaults,s)}validateData(t){for(const e in t)if(!this.validators[e](t[e]))return!1;return!0}getAttributeValue(t){return this.element.getAttribute(t)||"{}"}}export{e as ElementStorage};
1
+ class t extends Error{}class e{element;attribute;defaults;validators;data;options;constructor(t,e,s,i,r={}){this.element=t,this.attribute=e,this.defaults=s,this.validators=i,this.options={keepFresh:!0,elementOptionsMerger:(t,e)=>({...t,...e}),...r},this.data=this.fetchFreshData()}has(t){return t in this.getAll()}get(t){return this.getAll()[t]}getMultiple(t){const e=this.getAll();return t.reduce((t,s)=>(t[s]=e[s],t),{})}getAll(){return this.options.keepFresh&&this.refresh(),this.data}set(e,s){if(!this.validators[e](s))throw new t(`Attempted to set an invalid value for the key ${String(e)}.`);const i=this.getAttributeValue(this.attribute),r=JSON.parse(i);r[e]=s,this.setAll(r)}setMultiple(t){const e=this.getAll();this.setAll({...e,...t})}setAll(t){this.element.setAttribute(this.attribute,JSON.stringify(t))}delete(t){const e=this.getAll();t in e&&(delete e[t],this.element.setAttribute(this.attribute,JSON.stringify(e)))}deleteMultiple(t){const e=this.getAll();for(const s of t)delete e[s];this.setAll(e)}deleteAll(){this.element.removeAttribute(this.attribute),this.refresh()}refresh(){this.data=this.fetchFreshData()}fetchFreshData(){const e=this.getAttributeValue(this.attribute);if("{"!==e.charAt(0))throw new t("Data has to be defined as an object.");const s=JSON.parse(e);if(!this.validateData(s))throw new t("Invalid storage value.");return this.options.elementOptionsMerger(this.defaults,s)}validateData(t){for(const e in t){if(!(e in this.validators))return console.warn(`Option ${e} doesn't have a validator.`),!1;if("function"!=typeof this.validators[e])return console.warn(`Validator for option ${e} is not a function.`),!1;if(!this.validators[e](t[e]))return!1}return!0}getAttributeValue(t){return this.element.getAttribute(t)||"{}"}}export{e as ElementStorage};
2
2
  //# sourceMappingURL=storage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.js","mappings":"AAQO,MAAMA,UAA+BC,OCPrC,MAAMC,EACTC,QACAC,UACAC,SACAC,WACAC,KACAC,QACA,WAAAC,CAAYN,EAASC,EAAWC,EAAUC,EAAYE,EAAU,CAAC,GAC7DE,KAAKP,QAAUA,EACfO,KAAKN,UAAYA,EACjBM,KAAKL,SAAWA,EAChBK,KAAKJ,WAAaA,EAClBI,KAAKF,QAAU,CACXG,WAAW,EACXC,qBAAsB,CAACC,EAAgBC,KAC5B,IAAKD,KAAmBC,OAEhCN,GAEPE,KAAKH,KAAOG,KAAKK,gBACrB,CACA,GAAAC,CAAIC,GAEA,OAAOA,KADMP,KAAKQ,QAEtB,CACA,GAAAC,CAAIF,GAEA,OADaP,KAAKQ,SACND,EAChB,CACA,WAAAG,CAAYC,GACR,MAAMd,EAAOG,KAAKQ,SAClB,OAAOG,EAAKC,OAAO,CAACC,EAAKN,KACrBM,EAAIN,GAAOV,EAAKU,GACTM,GACR,CAAC,EACR,CACA,MAAAL,GAII,OAHIR,KAAKF,QAAQG,WACbD,KAAKc,UAEFd,KAAKH,IAChB,CACA,GAAAkB,CAAIR,EAAKS,GACL,IAAKhB,KAAKJ,WAAWW,GAAKS,GACtB,MAAM,IAAI1B,EAAuB,iDAAiD2B,OAAOV,OAE7F,MAAMW,EAAiBlB,KAAKmB,kBAAkBnB,KAAKN,WAC7CG,EAAOuB,KAAKC,MAAMH,GACxBrB,EAAKU,GAAOS,EACZhB,KAAKsB,OAAOzB,EAChB,CACA,WAAA0B,CAAY1B,GACR,MAAM2B,EAAUxB,KAAKQ,SACrBR,KAAKsB,OAAO,IAAKE,KAAY3B,GACjC,CACA,MAAAyB,CAAOzB,GACHG,KAAKP,QAAQgC,aAAazB,KAAKN,UAAW0B,KAAKM,UAAU7B,GAC7D,CACA,OAAOU,GACH,MAAMV,EAAOG,KAAKQ,SACZD,KAAOV,WAGNA,EAAKU,GACZP,KAAKP,QAAQgC,aAAazB,KAAKN,UAAW0B,KAAKM,UAAU7B,IAC7D,CACA,cAAA8B,CAAehB,GACX,MAAMd,EAAOG,KAAKQ,SAClB,IAAK,MAAMD,KAAOI,SACPd,EAAKU,GAEhBP,KAAKsB,OAAOzB,EAChB,CACA,SAAA+B,GACI5B,KAAKP,QAAQoC,gBAAgB7B,KAAKN,WAClCM,KAAKc,SACT,CACA,OAAAA,GACId,KAAKH,KAAOG,KAAKK,gBACrB,CACA,cAAAA,GACI,MAAMyB,EAAa9B,KAAKmB,kBAAkBnB,KAAKN,WAC/C,GAA6B,MAAzBoC,EAAWC,OAAO,GAClB,MAAM,IAAIzC,EAAuB,wCAErC,MAAMO,EAAOuB,KAAKC,MAAMS,GACxB,IAAK9B,KAAKgC,aAAanC,GACnB,MAAM,IAAIP,EAAuB,0BAErC,OAAOU,KAAKF,QAAQI,qBAAqBF,KAAKL,SAAUE,EAC5D,CACA,YAAAmC,CAAanC,GACT,IAAK,MAAMU,KAAOV,EACd,IAAKG,KAAKJ,WAAWW,GAAKV,EAAKU,IAC3B,OAAO,EAGf,OAAO,CACX,CACA,iBAAAY,CAAkBzB,GACd,OAAOM,KAAKP,QAAQwC,aAAavC,IAAc,IACnD,S","sources":["webpack://wraplet/./src/errors.ts","webpack://wraplet/./src/Storage/ElementStorage.ts"],"sourcesContent":["export class MissingRequiredChildError extends Error {\n}\nexport class MapError extends Error {\n}\nexport class RequiredChildDestroyedError extends Error {\n}\nexport class ChildrenAreNotAvailableError extends Error {\n}\nexport class StorageValidationError extends Error {\n}\nexport class ChildrenTooManyFoundError extends Error {\n}\nexport class ChildrenAreAlreadyDestroyedError extends Error {\n}\nexport class InternalLogicError extends Error {\n}\n","import { StorageValidationError } from \"../errors\";\nexport class ElementStorage {\n element;\n attribute;\n defaults;\n validators;\n data;\n options;\n constructor(element, attribute, defaults, validators, options = {}) {\n this.element = element;\n this.attribute = attribute;\n this.defaults = defaults;\n this.validators = validators;\n this.options = {\n keepFresh: true,\n elementOptionsMerger: (defaultOptions, elementOptions) => {\n return { ...defaultOptions, ...elementOptions };\n },\n ...options,\n };\n this.data = this.fetchFreshData();\n }\n has(key) {\n const data = this.getAll();\n return key in data;\n }\n get(key) {\n const data = this.getAll();\n return data[key];\n }\n getMultiple(keys) {\n const data = this.getAll();\n return keys.reduce((acc, key) => {\n acc[key] = data[key];\n return acc;\n }, {});\n }\n getAll() {\n if (this.options.keepFresh) {\n this.refresh();\n }\n return this.data;\n }\n set(key, value) {\n if (!this.validators[key](value)) {\n throw new StorageValidationError(`Attempted to set an invalid value for the key ${String(key)}.`);\n }\n const attributeValue = this.getAttributeValue(this.attribute);\n const data = JSON.parse(attributeValue);\n data[key] = value;\n this.setAll(data);\n }\n setMultiple(data) {\n const oldData = this.getAll();\n this.setAll({ ...oldData, ...data });\n }\n setAll(data) {\n this.element.setAttribute(this.attribute, JSON.stringify(data));\n }\n delete(key) {\n const data = this.getAll();\n if (!(key in data)) {\n return;\n }\n delete data[key];\n this.element.setAttribute(this.attribute, JSON.stringify(data));\n }\n deleteMultiple(keys) {\n const data = this.getAll();\n for (const key of keys) {\n delete data[key];\n }\n this.setAll(data);\n }\n deleteAll() {\n this.element.removeAttribute(this.attribute);\n this.refresh();\n }\n refresh() {\n this.data = this.fetchFreshData();\n }\n fetchFreshData() {\n const dataString = this.getAttributeValue(this.attribute);\n if (dataString.charAt(0) !== \"{\") {\n throw new StorageValidationError(`Data has to be defined as an object.`);\n }\n const data = JSON.parse(dataString);\n if (!this.validateData(data)) {\n throw new StorageValidationError(\"Invalid storage value.\");\n }\n return this.options.elementOptionsMerger(this.defaults, data);\n }\n validateData(data) {\n for (const key in data) {\n if (!this.validators[key](data[key])) {\n return false;\n }\n }\n return true;\n }\n getAttributeValue(attribute) {\n return this.element.getAttribute(attribute) || \"{}\";\n }\n}\n"],"names":["StorageValidationError","Error","ElementStorage","element","attribute","defaults","validators","data","options","constructor","this","keepFresh","elementOptionsMerger","defaultOptions","elementOptions","fetchFreshData","has","key","getAll","get","getMultiple","keys","reduce","acc","refresh","set","value","String","attributeValue","getAttributeValue","JSON","parse","setAll","setMultiple","oldData","setAttribute","stringify","deleteMultiple","deleteAll","removeAttribute","dataString","charAt","validateData","getAttribute"],"sourceRoot":""}
1
+ {"version":3,"file":"storage.js","mappings":"AAQO,MAAMA,UAA+BC,OCPrC,MAAMC,EACTC,QACAC,UACAC,SACAC,WACAC,KACAC,QACA,WAAAC,CAAYN,EAASC,EAAWC,EAAUC,EAAYE,EAAU,CAAC,GAC7DE,KAAKP,QAAUA,EACfO,KAAKN,UAAYA,EACjBM,KAAKL,SAAWA,EAChBK,KAAKJ,WAAaA,EAClBI,KAAKF,QAAU,CACXG,WAAW,EACXC,qBAAsB,CAACC,EAAgBC,KAC5B,IAAKD,KAAmBC,OAEhCN,GAEPE,KAAKH,KAAOG,KAAKK,gBACrB,CACA,GAAAC,CAAIC,GAEA,OAAOA,KADMP,KAAKQ,QAEtB,CACA,GAAAC,CAAIF,GAEA,OADaP,KAAKQ,SACND,EAChB,CACA,WAAAG,CAAYC,GACR,MAAMd,EAAOG,KAAKQ,SAClB,OAAOG,EAAKC,OAAO,CAACC,EAAKN,KACrBM,EAAIN,GAAOV,EAAKU,GACTM,GACR,CAAC,EACR,CACA,MAAAL,GAII,OAHIR,KAAKF,QAAQG,WACbD,KAAKc,UAEFd,KAAKH,IAChB,CACA,GAAAkB,CAAIR,EAAKS,GACL,IAAKhB,KAAKJ,WAAWW,GAAKS,GACtB,MAAM,IAAI1B,EAAuB,iDAAiD2B,OAAOV,OAE7F,MAAMW,EAAiBlB,KAAKmB,kBAAkBnB,KAAKN,WAC7CG,EAAOuB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QAAQ0C,aAAazC,IAAc,IACnD,S","sources":["webpack://wraplet/./src/errors.ts","webpack://wraplet/./src/Storage/ElementStorage.ts"],"sourcesContent":["export class MissingRequiredChildError extends Error {\n}\nexport class MapError extends Error {\n}\nexport class RequiredChildDestroyedError extends Error {\n}\nexport class ChildrenAreNotAvailableError extends Error {\n}\nexport class StorageValidationError extends Error {\n}\nexport class ChildrenTooManyFoundError extends Error {\n}\nexport class ChildrenAreAlreadyDestroyedError extends Error {\n}\nexport class InternalLogicError extends Error {\n}\n","import { StorageValidationError } from \"../errors\";\nexport class ElementStorage {\n element;\n attribute;\n defaults;\n validators;\n data;\n options;\n constructor(element, attribute, defaults, validators, options = {}) {\n this.element = element;\n this.attribute = attribute;\n this.defaults = defaults;\n this.validators = validators;\n this.options = {\n keepFresh: true,\n elementOptionsMerger: (defaultOptions, elementOptions) => {\n return { ...defaultOptions, ...elementOptions };\n },\n ...options,\n };\n this.data = this.fetchFreshData();\n }\n has(key) {\n const data = this.getAll();\n return key in data;\n }\n get(key) {\n const data = this.getAll();\n return data[key];\n }\n getMultiple(keys) {\n const data = this.getAll();\n return keys.reduce((acc, key) => {\n acc[key] = data[key];\n return acc;\n }, {});\n }\n getAll() {\n if (this.options.keepFresh) {\n this.refresh();\n }\n return this.data;\n }\n set(key, value) {\n if (!this.validators[key](value)) {\n throw new StorageValidationError(`Attempted to set an invalid value for the key ${String(key)}.`);\n }\n const attributeValue = this.getAttributeValue(this.attribute);\n const data = JSON.parse(attributeValue);\n data[key] = value;\n this.setAll(data);\n }\n setMultiple(data) {\n const oldData = this.getAll();\n this.setAll({ ...oldData, ...data });\n }\n setAll(data) {\n this.element.setAttribute(this.attribute, JSON.stringify(data));\n }\n delete(key) {\n const data = this.getAll();\n if (!(key in data)) {\n return;\n }\n delete data[key];\n this.element.setAttribute(this.attribute, JSON.stringify(data));\n }\n deleteMultiple(keys) {\n const data = this.getAll();\n for (const key of keys) {\n delete data[key];\n }\n this.setAll(data);\n }\n deleteAll() {\n this.element.removeAttribute(this.attribute);\n this.refresh();\n }\n refresh() {\n this.data = this.fetchFreshData();\n }\n fetchFreshData() {\n const dataString = this.getAttributeValue(this.attribute);\n if (dataString.charAt(0) !== \"{\") {\n throw new StorageValidationError(`Data has to be defined as an object.`);\n }\n const data = JSON.parse(dataString);\n if (!this.validateData(data)) {\n throw new StorageValidationError(\"Invalid storage value.\");\n }\n return this.options.elementOptionsMerger(this.defaults, data);\n }\n validateData(data) {\n for (const key in data) {\n if (!(key in this.validators)) {\n console.warn(`Option ${key} doesn't have a validator.`);\n return false;\n }\n else if (typeof this.validators[key] !== \"function\") {\n console.warn(`Validator for option ${key} is not a function.`);\n return false;\n }\n else if (!this.validators[key](data[key])) {\n return false;\n }\n }\n return true;\n }\n getAttributeValue(attribute) {\n return this.element.getAttribute(attribute) || \"{}\";\n }\n}\n"],"names":["StorageValidationError","Error","ElementStorage","element","attribute","defaults","validators","data","options","constructor","this","keepFresh","elementOptionsMerger","defaultOptions","elementOptions","fetchFreshData","has","key","getAll","get","getMultiple","keys","reduce","acc","refresh","set","value","String","attributeValue","getAttributeValue","JSON","parse","setAll","setMultiple","oldData","setAttribute","stringify","deleteMultiple","deleteAll","removeAttribute","dataString","charAt","validateData","console","warn","getAttribute"],"sourceRoot":""}
@@ -11,7 +11,7 @@ export { CoreSymbol };
11
11
  * Children manager interface that defines the public API for managing wraplet relationships
12
12
  * and lifecycles.
13
13
  */
14
- export interface Core<M extends WrapletChildrenMap = {}, N extends Node = Node> extends NodeTreeParent {
14
+ export interface Core<N extends Node = Node, M extends WrapletChildrenMap = {}> extends NodeTreeParent {
15
15
  [CoreSymbol]: true;
16
16
  [NodeTreeParentSymbol]: true;
17
17
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wraplet",
3
- "version": "0.25.0",
3
+ "version": "0.27.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -27,9 +27,9 @@
27
27
  ],
28
28
  "scripts": {
29
29
  "setup": "yarn install",
30
- "build": "NODE_OPTIONS='--no-experimental-strip-types --import tsx' node ./node_modules/.bin/webpack --mode production --config ./webpack.config.ts",
31
- "dev:build": "NODE_OPTIONS='--no-experimental-strip-types --import tsx' node ./node_modules/.bin/webpack --mode development --config ./webpack.config.ts",
32
- "dev:watch": "NODE_OPTIONS='--no-experimental-strip-types --import tsx' node ./node_modules/.bin/webpack --mode development --watch --config ./webpack.config.ts",
30
+ "build": "tsx ./node_modules/.bin/webpack --mode production --config ./webpack.config.ts",
31
+ "dev:build": "tsx ./node_modules/.bin/webpack --mode development --config ./webpack.config.ts",
32
+ "dev:watch": "tsx ./node_modules/.bin/webpack --mode development --watch --config ./webpack.config.ts",
33
33
  "lint": "tsc --noemit && npx eslint './src/**/*.ts' './tests/**/*.ts'",
34
34
  "lint:fix": "npx eslint './src/**/*.ts' './tests/**/*.ts' --fix",
35
35
  "tests": "jest --coverage"