@citolab/qti-components 7.15.1 → 7.15.2

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.
Files changed (45) hide show
  1. package/dist/base.js +2 -49
  2. package/dist/base.js.map +1 -1
  3. package/dist/elements.js +2 -41
  4. package/dist/elements.js.map +1 -1
  5. package/dist/index.js +9 -327
  6. package/dist/index.js.map +1 -1
  7. package/dist/interactions.js +2 -71
  8. package/dist/interactions.js.map +1 -1
  9. package/dist/item.js +2 -22
  10. package/dist/item.js.map +1 -1
  11. package/dist/loader.js +2 -10
  12. package/dist/loader.js.map +1 -1
  13. package/dist/processing.js +2 -102
  14. package/dist/processing.js.map +1 -1
  15. package/dist/test.js +2 -60
  16. package/dist/test.js.map +1 -1
  17. package/dist/transformers.js +2 -11
  18. package/dist/transformers.js.map +1 -1
  19. package/package.json +5 -3
  20. package/dist/chunk-2DOYPVF5.js +0 -481
  21. package/dist/chunk-2DOYPVF5.js.map +0 -1
  22. package/dist/chunk-2ZEJ3RR5.js +0 -89
  23. package/dist/chunk-2ZEJ3RR5.js.map +0 -1
  24. package/dist/chunk-352OTVTY.js +0 -3330
  25. package/dist/chunk-352OTVTY.js.map +0 -1
  26. package/dist/chunk-C2HQFI2C.js +0 -5927
  27. package/dist/chunk-C2HQFI2C.js.map +0 -1
  28. package/dist/chunk-DWIRLYDS.js +0 -20
  29. package/dist/chunk-DWIRLYDS.js.map +0 -1
  30. package/dist/chunk-EUXUH3YW.js +0 -15
  31. package/dist/chunk-EUXUH3YW.js.map +0 -1
  32. package/dist/chunk-F44CI35W.js +0 -145
  33. package/dist/chunk-F44CI35W.js.map +0 -1
  34. package/dist/chunk-INKI27D5.js +0 -493
  35. package/dist/chunk-INKI27D5.js.map +0 -1
  36. package/dist/chunk-JEUY3MYB.js +0 -2010
  37. package/dist/chunk-JEUY3MYB.js.map +0 -1
  38. package/dist/chunk-O4XIWHTF.js +0 -1139
  39. package/dist/chunk-O4XIWHTF.js.map +0 -1
  40. package/dist/chunk-RI47B4ZT.js +0 -1753
  41. package/dist/chunk-RI47B4ZT.js.map +0 -1
  42. package/dist/chunk-VEV4DGPH.js +0 -31
  43. package/dist/chunk-VEV4DGPH.js.map +0 -1
  44. package/dist/chunk-W4SQRNWO.js +0 -3844
  45. package/dist/chunk-W4SQRNWO.js.map +0 -1
@@ -1,89 +0,0 @@
1
- // ../lit-utilities/src/decorators/watch.ts
2
- function watch(propertyName, options) {
3
- const resolvedOptions = {
4
- waitUntilFirstUpdate: false,
5
- ...options
6
- };
7
- return (proto, decoratedFnName) => {
8
- const { update } = proto;
9
- const watchedProperties = Array.isArray(propertyName) ? propertyName : [propertyName];
10
- proto.update = function(changedProps) {
11
- watchedProperties.forEach((property) => {
12
- const key = property;
13
- if (changedProps.has(key)) {
14
- const oldValue = changedProps.get(key);
15
- const newValue = this[key];
16
- if (oldValue !== newValue) {
17
- if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {
18
- this[decoratedFnName](oldValue, newValue);
19
- }
20
- }
21
- }
22
- });
23
- update.call(this, changedProps);
24
- };
25
- };
26
- }
27
-
28
- // ../lit-utilities/src/decorators/live-query.ts
29
- function liveQuery(querySelector, options) {
30
- return (proto, decoratedFnName) => {
31
- const { connectedCallback, disconnectedCallback } = proto;
32
- proto.connectedCallback = function() {
33
- connectedCallback.call(this);
34
- const handler = this[decoratedFnName];
35
- const callback = (mutationList) => {
36
- const added = [];
37
- const removed = [];
38
- for (const m of mutationList) {
39
- if (m.type !== "childList") continue;
40
- m.addedNodes.forEach((n2) => {
41
- if (n2.nodeType !== 1) return;
42
- const el = n2;
43
- if (el.matches?.(querySelector)) added.push(el);
44
- added.push(...el.querySelectorAll?.(querySelector) ?? []);
45
- });
46
- m.removedNodes.forEach((n2) => {
47
- if (n2.nodeType !== 1) return;
48
- const el = n2;
49
- if (el.matches?.(querySelector)) removed.push(el);
50
- removed.push(...el.querySelectorAll?.(querySelector) ?? []);
51
- });
52
- }
53
- const dedupe = (arr) => Array.from(new Set(arr));
54
- const A = dedupe(added);
55
- const R = dedupe(removed);
56
- if (A.length || R.length) {
57
- handler.call(this, A, R);
58
- }
59
- };
60
- const obsLight = new MutationObserver(callback);
61
- obsLight.observe(this, { childList: true, subtree: true });
62
- const obsShadow = this.shadowRoot ? new MutationObserver(callback) : null;
63
- obsShadow?.observe(this.shadowRoot, { childList: true, subtree: true });
64
- this.__lqObservers = [obsLight, obsShadow].filter((o) => !!o);
65
- const fireInitial = async () => {
66
- if (options?.waitUntilFirstUpdate && "updateComplete" in this) {
67
- await this.updateComplete;
68
- }
69
- const initial = [
70
- ...this.querySelectorAll(querySelector),
71
- ...this.shadowRoot?.querySelectorAll(querySelector) ?? []
72
- ];
73
- if (initial.length) handler.call(this, initial, []);
74
- };
75
- void fireInitial();
76
- };
77
- proto.disconnectedCallback = function() {
78
- disconnectedCallback.call(this);
79
- this.__lqObservers?.forEach((o) => o.disconnect());
80
- this.__lqObservers = void 0;
81
- };
82
- };
83
- }
84
-
85
- export {
86
- liveQuery,
87
- watch
88
- };
89
- //# sourceMappingURL=chunk-2ZEJ3RR5.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lit-utilities/src/decorators/watch.ts","../../lit-utilities/src/decorators/live-query.ts"],"sourcesContent":["import type { LitElement } from 'lit';\n\ntype UpdateHandler = (prev?: unknown, next?: unknown) => void;\n\ntype NonUndefined<A> = A extends undefined ? never : A;\n\nexport type UpdateHandlerFunctionKeys<T extends object> = {\n [K in keyof T]-?: NonUndefined<T[K]> extends UpdateHandler ? K : never;\n}[keyof T];\n\ninterface WatchOptions {\n /**\n * If true, will only start watching after the initial update/render\n */\n waitUntilFirstUpdate?: boolean;\n}\n\n/**\n * Runs when observed properties change, e.g. @property or @state, but before the component updates. To wait for an\n * update to complete after a change occurs, use `await this.updateComplete` in the handler. To start watching after the\n * initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n *\n * Usage:\n *\n * @watch('propName')\n * handlePropChange(oldValue, newValue) {\n * ...\n * }\n */\nexport function watch(propertyName: string | string[], options?: WatchOptions) {\n const resolvedOptions: Required<WatchOptions> = {\n waitUntilFirstUpdate: false,\n ...options\n };\n return <ElemClass extends LitElement>(\n proto: ElemClass,\n decoratedFnName: UpdateHandlerFunctionKeys<ElemClass> | any\n ) => {\n // @ts-expect-error - update is a protected property\n const { update } = proto;\n const watchedProperties = Array.isArray(propertyName) ? propertyName : [propertyName];\n\n // @ts-expect-error - update is a protected property\n proto.update = function (this: ElemClass, changedProps: Map<keyof ElemClass, ElemClass[keyof ElemClass]>) {\n watchedProperties.forEach(property => {\n const key = property as keyof ElemClass;\n if (changedProps.has(key)) {\n const oldValue = changedProps.get(key);\n const newValue = this[key];\n\n if (oldValue !== newValue) {\n if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {\n ((this as any)[decoratedFnName] as unknown as UpdateHandler)(oldValue, newValue);\n }\n }\n }\n });\n\n update.call(this, changedProps);\n };\n };\n}\n","import type { LitElement } from 'lit';\n\ntype LiveQueryHandler = (added: Element[], removed: Element[]) => void;\ntype LiveQueryHandlerKeys<T extends object> = {\n [K in keyof T]-?: T[K] extends LiveQueryHandler ? K : never;\n}[keyof T];\n\ninterface LiveQueryOptions {\n /**\n * If true, will only start watching after the initial update/render\n */\n waitUntilFirstUpdate?: boolean;\n}\n\nexport function liveQuery(querySelector: string, options?: LiveQueryOptions) {\n return <ElemClass extends LitElement>(proto: ElemClass, decoratedFnName: LiveQueryHandlerKeys<ElemClass>): void => {\n const { connectedCallback, disconnectedCallback } = proto;\n\n proto.connectedCallback = function (this: ElemClass) {\n connectedCallback.call(this);\n\n const handler = this[decoratedFnName] as unknown as LiveQueryHandler;\n\n const callback = (mutationList: MutationRecord[]) => {\n const added: Element[] = [];\n const removed: Element[] = [];\n\n for (const m of mutationList) {\n if (m.type !== 'childList') continue;\n\n m.addedNodes.forEach(n => {\n if (n.nodeType !== 1) return;\n const el = n as Element;\n if (el.matches?.(querySelector)) added.push(el);\n added.push(...(el.querySelectorAll?.(querySelector) ?? []));\n });\n\n m.removedNodes.forEach(n => {\n if (n.nodeType !== 1) return;\n const el = n as Element;\n if (el.matches?.(querySelector)) removed.push(el);\n removed.push(...(el.querySelectorAll?.(querySelector) ?? []));\n });\n }\n\n // deduplicate added and removed (might be multiples since we observe both light and shadow DOM)\n const dedupe = (arr: Element[]) => Array.from(new Set(arr));\n const A = dedupe(added);\n const R = dedupe(removed);\n\n if (A.length || R.length) {\n handler.call(this, A, R);\n }\n };\n\n // observe both light and shadow DOM\n const obsLight = new MutationObserver(callback);\n obsLight.observe(this, { childList: true, subtree: true });\n\n const obsShadow = this.shadowRoot ? new MutationObserver(callback) : null;\n obsShadow?.observe(this.shadowRoot, { childList: true, subtree: true });\n\n (this as any).__lqObservers = [obsLight, obsShadow].filter((o): o is MutationObserver => !!o);\n\n const fireInitial = async () => {\n if (options?.waitUntilFirstUpdate && 'updateComplete' in this) {\n await (this as any).updateComplete;\n }\n const initial = [\n ...this.querySelectorAll(querySelector),\n ...(this.shadowRoot?.querySelectorAll(querySelector) ?? [])\n ] as Element[];\n if (initial.length) handler.call(this, initial, []);\n };\n\n void fireInitial();\n };\n\n proto.disconnectedCallback = function (this: ElemClass) {\n disconnectedCallback.call(this);\n (this as any).__lqObservers?.forEach((o: MutationObserver) => o.disconnect());\n (this as any).__lqObservers = undefined;\n };\n };\n}\n"],"mappings":";AA6BO,SAAS,MAAM,cAAiC,SAAwB;AAC7E,QAAM,kBAA0C;AAAA,IAC9C,sBAAsB;AAAA,IACtB,GAAG;AAAA,EACL;AACA,SAAO,CACL,OACA,oBACG;AAEH,UAAM,EAAE,OAAO,IAAI;AACnB,UAAM,oBAAoB,MAAM,QAAQ,YAAY,IAAI,eAAe,CAAC,YAAY;AAGpF,UAAM,SAAS,SAA2B,cAAgE;AACxG,wBAAkB,QAAQ,cAAY;AACpC,cAAM,MAAM;AACZ,YAAI,aAAa,IAAI,GAAG,GAAG;AACzB,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