taggedjs 2.5.7 → 2.5.9

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 (189) hide show
  1. package/bundle.js +8 -4
  2. package/bundle.js.map +1 -1
  3. package/js/index.d.ts +1 -0
  4. package/js/subject.types.d.ts +1 -2
  5. package/js/tag/html.d.ts +2 -1
  6. package/js/tag/html.js.map +1 -1
  7. package/js/tag/tag.js.map +1 -1
  8. package/js/tag/tagElement.d.ts +7 -0
  9. package/js/tag/tagElement.js +8 -4
  10. package/js/tag/tagElement.js.map +1 -1
  11. package/js/tag/update/updateExistingTagComponent.function.js.map +1 -1
  12. package/package.json +1 -1
  13. package/js/Clones.type.d.ts +0 -3
  14. package/js/Clones.type.js +0 -2
  15. package/js/Clones.type.js.map +0 -1
  16. package/js/ElementTargetEvent.interface.d.ts +0 -6
  17. package/js/ElementTargetEvent.interface.js +0 -2
  18. package/js/ElementTargetEvent.interface.js.map +0 -1
  19. package/js/Tag.class.d.ts +0 -37
  20. package/js/Tag.class.js +0 -21
  21. package/js/Tag.class.js.map +0 -1
  22. package/js/Tag.utils.d.ts +0 -17
  23. package/js/Tag.utils.js +0 -6
  24. package/js/Tag.utils.js.map +0 -1
  25. package/js/TagSupport.class.d.ts +0 -58
  26. package/js/TagSupport.class.js +0 -309
  27. package/js/TagSupport.class.js.map +0 -1
  28. package/js/afterInterpolateElement.function.d.ts +0 -4
  29. package/js/afterInterpolateElement.function.js +0 -14
  30. package/js/afterInterpolateElement.function.js.map +0 -1
  31. package/js/bindSubjectCallback.function.d.ts +0 -7
  32. package/js/bindSubjectCallback.function.js +0 -41
  33. package/js/bindSubjectCallback.function.js.map +0 -1
  34. package/js/checkDestroyPrevious.function.d.ts +0 -8
  35. package/js/checkDestroyPrevious.function.js +0 -83
  36. package/js/checkDestroyPrevious.function.js.map +0 -1
  37. package/js/cloneValueArray.function.d.ts +0 -2
  38. package/js/cloneValueArray.function.js +0 -19
  39. package/js/cloneValueArray.function.js.map +0 -1
  40. package/js/destroy.support.d.ts +0 -6
  41. package/js/destroy.support.js +0 -10
  42. package/js/destroy.support.js.map +0 -1
  43. package/js/destroyTag.function.d.ts +0 -4
  44. package/js/destroyTag.function.js +0 -12
  45. package/js/destroyTag.function.js.map +0 -1
  46. package/js/elementDestroyCheck.function.d.ts +0 -3
  47. package/js/elementDestroyCheck.function.js +0 -17
  48. package/js/elementDestroyCheck.function.js.map +0 -1
  49. package/js/elementInitCheck.d.ts +0 -2
  50. package/js/elementInitCheck.js +0 -18
  51. package/js/elementInitCheck.js.map +0 -1
  52. package/js/getCallback.d.ts +0 -3
  53. package/js/getCallback.js +0 -51
  54. package/js/getCallback.js.map +0 -1
  55. package/js/hasTagSupportChanged.function.d.ts +0 -7
  56. package/js/hasTagSupportChanged.function.js +0 -70
  57. package/js/hasTagSupportChanged.function.js.map +0 -1
  58. package/js/html.d.ts +0 -2
  59. package/js/html.js +0 -5
  60. package/js/html.js.map +0 -1
  61. package/js/inputAttribute.d.ts +0 -1
  62. package/js/inputAttribute.js +0 -19
  63. package/js/inputAttribute.js.map +0 -1
  64. package/js/interpolateAttributes.d.ts +0 -3
  65. package/js/interpolateAttributes.js +0 -20
  66. package/js/interpolateAttributes.js.map +0 -1
  67. package/js/interpolateContentTemplates.d.ts +0 -9
  68. package/js/interpolateContentTemplates.js +0 -42
  69. package/js/interpolateContentTemplates.js.map +0 -1
  70. package/js/interpolateElement.d.ts +0 -13
  71. package/js/interpolateElement.js +0 -36
  72. package/js/interpolateElement.js.map +0 -1
  73. package/js/interpolateTemplate.d.ts +0 -31
  74. package/js/interpolateTemplate.js +0 -89
  75. package/js/interpolateTemplate.js.map +0 -1
  76. package/js/interpolations.d.ts +0 -7
  77. package/js/interpolations.js +0 -18
  78. package/js/interpolations.js.map +0 -1
  79. package/js/isLikeTags.function.d.ts +0 -5
  80. package/js/isLikeTags.function.js +0 -42
  81. package/js/isLikeTags.function.js.map +0 -1
  82. package/js/onDestroy.d.ts +0 -2
  83. package/js/onDestroy.js +0 -17
  84. package/js/onDestroy.js.map +0 -1
  85. package/js/onInit.d.ts +0 -2
  86. package/js/onInit.js +0 -17
  87. package/js/onInit.js.map +0 -1
  88. package/js/processAttribute.function.d.ts +0 -4
  89. package/js/processAttribute.function.js +0 -122
  90. package/js/processAttribute.function.js.map +0 -1
  91. package/js/processNewValue.function.d.ts +0 -3
  92. package/js/processNewValue.function.js +0 -43
  93. package/js/processNewValue.function.js.map +0 -1
  94. package/js/processRegularValue.function.d.ts +0 -5
  95. package/js/processRegularValue.function.js +0 -15
  96. package/js/processRegularValue.function.js.map +0 -1
  97. package/js/processSubjectComponent.function.d.ts +0 -9
  98. package/js/processSubjectComponent.function.js +0 -35
  99. package/js/processSubjectComponent.function.js.map +0 -1
  100. package/js/processSubjectValue.function.d.ts +0 -25
  101. package/js/processSubjectValue.function.js +0 -55
  102. package/js/processSubjectValue.function.js.map +0 -1
  103. package/js/processTag.function.d.ts +0 -11
  104. package/js/processTag.function.js +0 -43
  105. package/js/processTag.function.js.map +0 -1
  106. package/js/processTagArray.d.ts +0 -23
  107. package/js/processTagArray.js +0 -120
  108. package/js/processTagArray.js.map +0 -1
  109. package/js/processTagResult.function.d.ts +0 -11
  110. package/js/processTagResult.function.js +0 -30
  111. package/js/processTagResult.function.js.map +0 -1
  112. package/js/propState.function.d.ts +0 -2
  113. package/js/propState.function.js +0 -3
  114. package/js/propState.function.js.map +0 -1
  115. package/js/provider.utils.d.ts +0 -2
  116. package/js/provider.utils.js +0 -45
  117. package/js/provider.utils.js.map +0 -1
  118. package/js/providers.d.ts +0 -18
  119. package/js/providers.js +0 -86
  120. package/js/providers.js.map +0 -1
  121. package/js/renderExistingTag.function.d.ts +0 -7
  122. package/js/renderExistingTag.function.js +0 -32
  123. package/js/renderExistingTag.function.js.map +0 -1
  124. package/js/renderSubjectComponent.function.d.ts +0 -3
  125. package/js/renderSubjectComponent.function.js +0 -14
  126. package/js/renderSubjectComponent.function.js.map +0 -1
  127. package/js/renderTagOnly.function.d.ts +0 -4
  128. package/js/renderTagOnly.function.js +0 -39
  129. package/js/renderTagOnly.function.js.map +0 -1
  130. package/js/renderTagSupport.function.d.ts +0 -4
  131. package/js/renderTagSupport.function.js +0 -37
  132. package/js/renderTagSupport.function.js.map +0 -1
  133. package/js/renderWithSupport.function.d.ts +0 -5
  134. package/js/renderWithSupport.function.js +0 -31
  135. package/js/renderWithSupport.function.js.map +0 -1
  136. package/js/scanTextAreaValue.function.d.ts +0 -2
  137. package/js/scanTextAreaValue.function.js +0 -16
  138. package/js/scanTextAreaValue.function.js.map +0 -1
  139. package/js/set.function.d.ts +0 -24
  140. package/js/set.function.js +0 -116
  141. package/js/set.function.js.map +0 -1
  142. package/js/setLet.function.d.ts +0 -3
  143. package/js/setLet.function.js +0 -42
  144. package/js/setLet.function.js.map +0 -1
  145. package/js/setProp.function.d.ts +0 -3
  146. package/js/setProp.function.js +0 -37
  147. package/js/setProp.function.js.map +0 -1
  148. package/js/setTagPlaceholder.function.d.ts +0 -2
  149. package/js/setTagPlaceholder.function.js +0 -8
  150. package/js/setTagPlaceholder.function.js.map +0 -1
  151. package/js/setUse.function.d.ts +0 -23
  152. package/js/setUse.function.js +0 -14
  153. package/js/setUse.function.js.map +0 -1
  154. package/js/state/getCallback.d.ts +0 -3
  155. package/js/state/getCallback.js +0 -51
  156. package/js/state/getCallback.js.map +0 -1
  157. package/js/state/setProp.function.d.ts +0 -3
  158. package/js/state/setProp.function.js +0 -37
  159. package/js/state/setProp.function.js.map +0 -1
  160. package/js/tag/updates/processNewValue.function.d.ts +0 -3
  161. package/js/tag/updates/processNewValue.function.js +0 -43
  162. package/js/tag/updates/processNewValue.function.js.map +0 -1
  163. package/js/tag.d.ts +0 -21
  164. package/js/tag.js +0 -121
  165. package/js/tag.js.map +0 -1
  166. package/js/tagElement.d.ts +0 -9
  167. package/js/tagElement.js +0 -55
  168. package/js/tagElement.js.map +0 -1
  169. package/js/tagRunner.d.ts +0 -6
  170. package/js/tagRunner.js +0 -30
  171. package/js/tagRunner.js.map +0 -1
  172. package/js/updateContextItem.function.d.ts +0 -3
  173. package/js/updateContextItem.function.js +0 -42
  174. package/js/updateContextItem.function.js.map +0 -1
  175. package/js/updateExistingTagComponent.function.d.ts +0 -5
  176. package/js/updateExistingTagComponent.function.js +0 -108
  177. package/js/updateExistingTagComponent.function.js.map +0 -1
  178. package/js/updateExistingValue.function.d.ts +0 -4
  179. package/js/updateExistingValue.function.js +0 -135
  180. package/js/updateExistingValue.function.js.map +0 -1
  181. package/js/watch.function.d.ts +0 -3
  182. package/js/watch.function.js +0 -20
  183. package/js/watch.function.js.map +0 -1
  184. /package/js/{Errors.d.ts → errors.d.ts} +0 -0
  185. /package/js/{Errors.js → errors.js} +0 -0
  186. /package/js/{Errors.js.map → errors.js.map} +0 -0
  187. /package/js/subject/{Subject.utils.d.ts → subject.utils.d.ts} +0 -0
  188. /package/js/subject/{Subject.utils.js → subject.utils.js} +0 -0
  189. /package/js/subject/{Subject.utils.js.map → subject.utils.js.map} +0 -0
package/js/tag.js DELETED
@@ -1,121 +0,0 @@
1
- import { isSubjectInstance, isTagArray, isTagClass, isTagTemplater } from './isInstance';
2
- import { setUse } from './state';
3
- import { TemplaterResult } from './TemplaterResult.class';
4
- import { runTagCallback } from './interpolations/bindSubjectCallback.function';
5
- import { deepClone } from './deepFunctions';
6
- import { TagSupport } from './tag/TagSupport.class';
7
- import { alterProps } from './alterProps.function';
8
- import { ValueSubject } from './subject/ValueSubject';
9
- export const tags = [];
10
- let tagCount = 0;
11
- /** Wraps a tag component in a state manager and always push children to last argument as an array */
12
- // export function tag<T>(a: T): T;
13
- export function tag(tagComponent) {
14
- /** function developer triggers */
15
- const result = (function tagWrapper(props, children) {
16
- // is the props argument actually children?
17
- const isPropTag = isTagClass(props) || isTagTemplater(props) || isTagArray(props);
18
- if (isPropTag) {
19
- children = props;
20
- props = undefined;
21
- }
22
- const { childSubject, madeSubject } = kidsToTagArraySubject(children);
23
- childSubject.isChildSubject = true;
24
- const templater = new TemplaterResult(props, childSubject);
25
- // attach memory back to original function that contains developer display logic
26
- const innerTagWrap = getTagWrap(templater, madeSubject);
27
- innerTagWrap.original = tagComponent.lastResult?.original || tagComponent;
28
- templater.tagged = true;
29
- templater.wrapper = innerTagWrap;
30
- return templater;
31
- }); // we override the function provided and pretend original is what's returned
32
- updateResult(result, tagComponent);
33
- // group tags together and have hmr pickup
34
- updateComponent(tagComponent);
35
- tags.push(tagComponent);
36
- // fake the return as being (props?, children?) => TemplaterResult
37
- return result;
38
- }
39
- function kidsToTagArraySubject(children) {
40
- if (isSubjectInstance(children)) {
41
- return { childSubject: children, madeSubject: false };
42
- }
43
- const kidArray = children;
44
- if (isTagArray(kidArray)) {
45
- return { childSubject: new ValueSubject(children), madeSubject: true };
46
- }
47
- const kid = children;
48
- if (kid) {
49
- kid.memory.arrayValue = 0;
50
- return { childSubject: new ValueSubject([kid]), madeSubject: true };
51
- }
52
- return {
53
- childSubject: new ValueSubject([]),
54
- madeSubject: true
55
- };
56
- }
57
- function updateResult(result, tagComponent) {
58
- result.isTag = true;
59
- result.original = tagComponent;
60
- }
61
- function updateComponent(tagComponent) {
62
- tagComponent.tags = tags;
63
- tagComponent.setUse = setUse;
64
- tagComponent.tagIndex = tagCount++; // needed for things like HMR
65
- tagComponent.lastResult = tagComponent;
66
- }
67
- /** creates/returns a function that when called then calls the original component function
68
- * Gets used as templater.wrapper()
69
- */
70
- function getTagWrap(templater, madeSubject) {
71
- // this function gets called by taggedjs
72
- const innerTagWrap = function (oldTagSetup, subject) {
73
- const global = oldTagSetup.global;
74
- ++global.renderCount;
75
- const childSubject = templater.children;
76
- const lastArray = global.oldest?.templater.children.lastArray;
77
- if (lastArray) {
78
- childSubject.lastArray = lastArray;
79
- }
80
- const originalFunction = innerTagWrap.original;
81
- let props = templater.props;
82
- let castedProps = alterProps(props, oldTagSetup.ownerTagSupport);
83
- const clonedProps = deepClone(props); // castedProps
84
- // CALL ORIGINAL COMPONENT FUNCTION
85
- const tag = originalFunction(castedProps, childSubject);
86
- tag.templater = templater;
87
- templater.tag = tag;
88
- const tagSupport = new TagSupport(templater, oldTagSetup.ownerTagSupport, subject, global.renderCount);
89
- tagSupport.global = global;
90
- tagSupport.propsConfig = {
91
- latest: props,
92
- latestCloned: clonedProps,
93
- lastClonedKidValues: tagSupport.propsConfig.lastClonedKidValues,
94
- };
95
- tagSupport.memory = oldTagSetup.memory; // state handover
96
- if (madeSubject) {
97
- childSubject.value.forEach(kid => {
98
- kid.values.forEach((value, index) => {
99
- if (!(value instanceof Function)) {
100
- return;
101
- }
102
- const valuesValue = kid.values[index];
103
- if (valuesValue.isChildOverride) {
104
- return; // already overwritten
105
- }
106
- // all functions need to report to me
107
- kid.values[index] = function (...args) {
108
- const ownerSupport = tagSupport.ownerTagSupport;
109
- runTagCallback(value, // callback
110
- ownerSupport, this, // bindTo
111
- args);
112
- };
113
- valuesValue.isChildOverride = true;
114
- });
115
- });
116
- }
117
- return tagSupport;
118
- };
119
- return innerTagWrap;
120
- }
121
- //# sourceMappingURL=tag.js.map
package/js/tag.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"tag.js","sourceRoot":"","sources":["../ts/tag.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,eAAe,EAAW,MAAM,yBAAyB,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAA;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAgBrD,MAAM,CA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QAAQ,CAAC,EAAE,CAAC;wBAChC,OAAM;oBACR,CAAC;oBAED,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;oBAErC,IAAG,WAAW,CAAC,eAAe,EAAE,CAAC;wBAC/B,OAAM,CAAC,sBAAsB;oBAC/B,CAAC;oBAED,qCAAqC;oBACrC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,UAAS,GAAG,IAAe;wBAC7C,MAAM,YAAY,GAAG,UAAU,CAAC,eAAe,CAAA;wBAC/C,cAAc,CACZ,KAAK,EAAE,WAAW;wBAClB,YAAY,EACZ,IAAI,EAAE,SAAS;wBACf,IAAI,CACL,CAAA;oBACH,CAAC,CAAA;oBAED,WAAW,CAAC,eAAe,GAAG,IAAI,CAAA;gBACpC,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,UAAU,CAAA;IACnB,CAAC,CAAA;IAED,OAAO,YAAuB,CAAA;AAChC,CAAC"}
@@ -1,9 +0,0 @@
1
- import { TagSupport } from './tag/TagSupport.class';
2
- import { TemplaterResult } from './TemplaterResult.class';
3
- import { TagComponent } from './tag';
4
- export declare function tagElement(app: TagComponent, // (...args: unknown[]) => TemplaterResult,
5
- element: HTMLElement | Element, props?: unknown): {
6
- tagSupport: TagSupport;
7
- tags: TagComponent[];
8
- };
9
- export declare function runWrapper(templater: TemplaterResult): TagSupport;
package/js/tagElement.js DELETED
@@ -1,55 +0,0 @@
1
- import { BaseTagSupport } from './tag/TagSupport.class';
2
- import { runAfterRender, runBeforeRender } from './tagRunner';
3
- import { ValueSubject } from './subject/ValueSubject';
4
- const appElements = [];
5
- export function tagElement(app, // (...args: unknown[]) => TemplaterResult,
6
- element, props) {
7
- const appElmIndex = appElements.findIndex(appElm => appElm.element === element);
8
- if (appElmIndex >= 0) {
9
- appElements[appElmIndex].tagSupport.destroy();
10
- appElements.splice(appElmIndex, 1);
11
- // an element already had an app on it
12
- console.warn('Found and destroyed app element already rendered to element', { element });
13
- }
14
- // Create the app which returns [props, runOneTimeFunction]
15
- const wrapper = app(props);
16
- // have a function setup and call the tagWrapper with (props, {update, async, on})
17
- const tagSupport = runWrapper(wrapper);
18
- // TODO: is the below needed?
19
- tagSupport.appElement = element;
20
- tagSupport.isApp = true;
21
- tagSupport.global.isApp = true;
22
- const templateElm = document.createElement('template');
23
- templateElm.setAttribute('id', 'app-tag-' + appElements.length);
24
- templateElm.setAttribute('app-tag-detail', appElements.length.toString());
25
- element.appendChild(templateElm);
26
- element.destroy = async () => {
27
- await tagSupport.destroy();
28
- const insertBefore = tagSupport.global.insertBefore;
29
- const parentNode = insertBefore.parentNode;
30
- parentNode.removeChild(insertBefore);
31
- };
32
- tagSupport.buildBeforeElement(templateElm);
33
- tagSupport.global.oldest = tagSupport;
34
- tagSupport.global.newest = tagSupport;
35
- element.setUse = app.original.setUse;
36
- appElements.push({ element, tagSupport });
37
- return {
38
- tagSupport,
39
- tags: app.original.tags,
40
- };
41
- }
42
- export function runWrapper(templater) {
43
- let newSupport = {};
44
- const subject = new ValueSubject(newSupport);
45
- newSupport = new BaseTagSupport(templater, subject);
46
- subject.set(templater);
47
- subject.tagSupport = newSupport;
48
- runBeforeRender(newSupport, undefined);
49
- // Call the apps function for our tag templater
50
- const wrapper = templater.wrapper;
51
- const tagSupport = wrapper(newSupport, subject);
52
- runAfterRender(newSupport, tagSupport);
53
- return tagSupport;
54
- }
55
- //# sourceMappingURL=tagElement.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tagElement.js","sourceRoot":"","sources":["../ts/tagElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAI7D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAGrD,MAAM,WAAW,GAGX,EAAE,CAAA;AAER,MAAM,UAAU,UA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B,CAAA;QACxD,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;IACtC,CAAC,CAAA;IAED,UAAU,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAA;IAE1C,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,UAAU,CAAA;IACrC,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,UAAU,CAEpC;IAAC,OAAe,CAAC,MAAM,GAAI,GAAW,CAAC,QAAQ,CAAC,MAAM,CAAA;IAEvD,WAAW,CAAC,IAAI,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,CAAC,CAAA;IAEvC,OAAO;QACL,UAAU;QACV,IAAI,EAAG,GAAW,CAAC,QAAQ,CAAC,IAAI;KACjC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,SAA0B;IAE1B,IAAI,UAAU,GAAG,EAAgB,CAAA;IACjC,MAAM,OAAO,GAAG,IAAI,YAAY,CAAa,UAAU,CAA0B,CAAA;IAEjF,UAAU,GAAG,IAAI,cAAc,CAC7B,SAAS,EACT,OAAO,CACM,CAAA;IAEf,OAAO,CAAC,GAAG,CAAE,SAAS,CAAE,CAAA;IAExB,OAAO,CAAC,UAAU,GAAG,UAAU,CAAA;IAE/B,eAAe,CAAC,UAAU,EAAE,SAAkC,CAAC,CAAA;IAE/D,+CAA+C;IAC/C,MAAM,OAAO,GAAG,SAAS,CAAC,OAAkB,CAAA;IAC5C,MAAM,UAAU,GAAG,OAAO,CACxB,UAAU,EACV,OAAO,CACR,CAAA;IAED,cAAc,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAEtC,OAAO,UAAU,CAAA;AACnB,CAAC"}
package/js/tagRunner.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { BaseTagSupport, TagSupport } from './tag/TagSupport.class';
2
- export declare function isInCycle(): BaseTagSupport | undefined;
3
- export declare function runBeforeRender(tagSupport: BaseTagSupport, ownerSupport?: TagSupport): void;
4
- export declare function runAfterRender(tagSupport: BaseTagSupport, ownerTagSupport: TagSupport): void;
5
- export declare function runBeforeRedraw(tagSupport: BaseTagSupport, ownerTagSupport: TagSupport): void;
6
- export declare function runBeforeDestroy(tagSupport: BaseTagSupport, ownerTagSupport: TagSupport): void;
package/js/tagRunner.js DELETED
@@ -1,30 +0,0 @@
1
- // TODO: This should be more like `new TaggedJs().use({})`
2
- import { setUse } from './state';
3
- import { Subject } from './subject';
4
- // Emits event at the end of a tag being rendered. Use tagClosed$.toPromise() to render a tag after a current tag is done rendering
5
- setUse.memory.tagClosed$ = new Subject(undefined, subscription => {
6
- if (!isInCycle()) {
7
- subscription.next(); // we are not currently processing so process now
8
- }
9
- });
10
- export function isInCycle() {
11
- return setUse.memory.stateConfig.tagSupport;
12
- }
13
- // Life cycle 1
14
- export function runBeforeRender(tagSupport, ownerSupport) {
15
- setUse.tagUse.forEach(tagUse => tagUse.beforeRender(tagSupport, ownerSupport));
16
- }
17
- // Life cycle 2
18
- export function runAfterRender(tagSupport, ownerTagSupport) {
19
- setUse.tagUse.forEach(tagUse => tagUse.afterRender(tagSupport, ownerTagSupport));
20
- setUse.memory.tagClosed$.next(ownerTagSupport);
21
- }
22
- // Life cycle 3
23
- export function runBeforeRedraw(tagSupport, ownerTagSupport) {
24
- setUse.tagUse.forEach(tagUse => tagUse.beforeRedraw(tagSupport, ownerTagSupport));
25
- }
26
- // Life cycle 4 - end of life
27
- export function runBeforeDestroy(tagSupport, ownerTagSupport) {
28
- setUse.tagUse.forEach(tagUse => tagUse.beforeDestroy(tagSupport, ownerTagSupport));
29
- }
30
- //# sourceMappingURL=tagRunner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tagRunner.js","sourceRoot":"","sources":["../ts/tagRunner.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAG1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,mIAAmI;AACnI,MAAM,CAAC,MAAM,C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.function';
2
- import { Context } from './Tag.class';
3
- export declare function updateContextItem(context: Context, variableName: string, value: TemplateValue): void;
@@ -1,42 +0,0 @@
1
- import { isSubjectInstance, isTagComponent } from './isInstance';
2
- import { TagSupport } from './tag/TagSupport.class';
3
- export function updateContextItem(context, variableName, value) {
4
- const subject = context[variableName];
5
- const tagSubject = subject;
6
- const tagSupport = tagSubject.tagSupport;
7
- if (tagSupport) {
8
- if (value) {
9
- if (isTagComponent(value)) {
10
- const templater = value;
11
- let newSupport = new TagSupport(templater, tagSupport.ownerTagSupport, subject);
12
- if (isTagComponent(tagSupport)) {
13
- shareTemplaterGlobal(tagSupport, newSupport);
14
- }
15
- }
16
- }
17
- }
18
- if (isSubjectInstance(value)) {
19
- return; // emits on its own
20
- }
21
- // listeners will evaluate updated values to possibly update display(s)
22
- subject.set(value);
23
- return;
24
- }
25
- function shareTemplaterGlobal(oldTagSupport, tagSupport) {
26
- const oldTemp = oldTagSupport.templater;
27
- const oldWrap = oldTemp.wrapper; // tag versus component
28
- const oldValueFn = oldWrap.original;
29
- const templater = tagSupport.templater;
30
- const newWrapper = templater.wrapper;
31
- const newValueFn = newWrapper?.original;
32
- const fnMatched = oldValueFn === newValueFn;
33
- if (fnMatched) {
34
- tagSupport.global = oldTagSupport.global;
35
- const newest = oldTagSupport.global.newest;
36
- if (newest) {
37
- const prevState = newest.memory.state;
38
- tagSupport.memory.state = [...prevState];
39
- }
40
- }
41
- }
42
- //# sourceMappingURL=updateContextItem.function.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"updateContextItem.function.js","sourceRoot":"","sources":["../ts/updateContextItem.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAIhE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAGnD,MAAM,UAAU,iBAAiB,CAC/B,OAAgB,EAChB,YAAoB,EACpB,KAAoB;IAEpB,MAAM,OAAO,GAAG,OAAO,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D,IAAG,MAAM,EAAE,CAAC;YACV,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAA;YACrC,UAAU,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,GAAG,SAAS,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,5 +0,0 @@
1
- import { TagSubject } from './subject.types';
2
- import { TagSupport } from './tag/TagSupport.class';
3
- import { InsertBefore } from './interpolations/Clones.type';
4
- export declare function updateExistingTagComponent(ownerSupport: TagSupport, tagSupport: TagSupport, // lastest
5
- subject: TagSubject, insertBefore: InsertBefore): TagSupport;
@@ -1,108 +0,0 @@
1
- import { hasTagSupportChanged } from './tag/hasTagSupportChanged.function';
2
- import { processSubjectComponent } from './tag/update/processSubjectComponent.function';
3
- import { destroyTagMemory } from './destroyTag.function';
4
- import { renderTagSupport } from './renderTagSupport.function';
5
- import { callbackPropOwner } from './alterProps.function';
6
- import { isLikeTags } from './tag/isLikeTags.function';
7
- export function updateExistingTagComponent(ownerSupport, tagSupport, // lastest
8
- subject, insertBefore) {
9
- let lastSupport = subject.tagSupport?.global.newest; // || subject.tagSupport
10
- let oldestTag = lastSupport.global.oldest;
11
- const oldWrapper = lastSupport.templater.wrapper;
12
- const newWrapper = tagSupport.templater.wrapper;
13
- let isSameTag = false;
14
- if (oldWrapper && newWrapper) {
15
- const oldFunction = oldWrapper.original;
16
- const newFunction = newWrapper.original;
17
- isSameTag = oldFunction === newFunction;
18
- }
19
- const templater = tagSupport.templater;
20
- if (!isSameTag) {
21
- const oldestSupport = lastSupport.global.oldest;
22
- destroyTagMemory(oldestSupport, subject);
23
- return processSubjectComponent(templater, subject, insertBefore, ownerSupport, {
24
- forceElement: false,
25
- counts: { added: 0, removed: 0 },
26
- });
27
- }
28
- else {
29
- const hasChanged = hasTagSupportChanged(lastSupport, tagSupport, templater);
30
- if (!hasChanged) {
31
- // if the new props are an object then implicitly since no change, the old props are an object
32
- const newProps = templater.props;
33
- if (newProps && typeof (newProps) === 'object') {
34
- syncFunctionProps(lastSupport, ownerSupport, newProps);
35
- }
36
- return lastSupport; // its the same tag component
37
- }
38
- }
39
- const previous = lastSupport.global.newest;
40
- const newSupport = renderTagSupport(tagSupport, false);
41
- lastSupport = subject.tagSupport;
42
- const newOldest = newSupport.global.oldest;
43
- const hasOldest = newOldest ? true : false;
44
- if (!hasOldest) {
45
- return buildNewTag(newSupport, insertBefore, lastSupport, subject);
46
- }
47
- if (newOldest && templater.children.value.length) {
48
- const oldKidsSub = newOldest.templater.children;
49
- oldKidsSub.set(templater.children.value);
50
- }
51
- // detect if both the function is the same and the return is the same
52
- const isLikeTag = isSameTag && isLikeTags(previous, newSupport);
53
- if (isLikeTag) {
54
- subject.tagSupport = newSupport;
55
- oldestTag.updateBy(newSupport); // the oldest tag has element references
56
- return newSupport;
57
- }
58
- else {
59
- // Although function looked the same it returned a different html result
60
- if (isSameTag && lastSupport) {
61
- destroyTagMemory(lastSupport, subject);
62
- newSupport.global.context = {}; // do not share previous outputs
63
- }
64
- oldestTag = undefined;
65
- }
66
- if (!oldestTag) {
67
- lastSupport = newSupport;
68
- buildNewTag(newSupport, lastSupport.global.insertBefore, lastSupport, subject);
69
- }
70
- lastSupport.global.newest = newSupport;
71
- return newSupport;
72
- }
73
- function buildNewTag(newSupport, oldInsertBefore, oldTagSupport, subject) {
74
- newSupport.buildBeforeElement(oldInsertBefore, {
75
- forceElement: true,
76
- counts: { added: 0, removed: 0 },
77
- });
78
- newSupport.global.oldest = newSupport;
79
- newSupport.global.newest = newSupport;
80
- oldTagSupport.global.oldest = newSupport;
81
- oldTagSupport.global.newest = newSupport;
82
- subject.tagSupport = newSupport;
83
- return newSupport;
84
- }
85
- function syncFunctionProps(lastSupport, ownerSupport, newProps) {
86
- lastSupport = lastSupport.global.newest || lastSupport;
87
- const priorPropConfig = lastSupport.propsConfig;
88
- const priorProps = priorPropConfig.latestCloned;
89
- const prevSupport = ownerSupport.global.newest;
90
- Object.entries(priorProps).forEach(([name, value]) => {
91
- if (!(value instanceof Function)) {
92
- return;
93
- }
94
- // TODO: The code below maybe irrelevant
95
- const newCallback = newProps[name];
96
- const original = newCallback.original;
97
- if (original) {
98
- return; // already previously converted
99
- }
100
- // Currently, call self but over parent state changes, I may need to call a newer parent tag owner
101
- priorProps[name].toCall = (...args) => {
102
- return callbackPropOwner(newCallback, // value, // newOriginal,
103
- args, prevSupport);
104
- };
105
- return;
106
- });
107
- }
108
- //# sourceMappingURL=updateExistingTagComponent.function.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"updateExistingTagComponent.function.js","sourceRoot":"","sources":["../ts/updateExistingTagComponent.function.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAEtD,MAAM,UAAU,0BAA0B,CACxC,YAAwB,EACxB,UAAsB,EAAE,UAAU;AAClC,OAAmB,EACnB,YAA0B;IAE1B,IAAI,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,MAAoB,CAAA,CAAC,wBAAwB;IAC1F,IAAI,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAA;IAEzC,MAAM,UAAU,GAAG,WAAW,CAAC,SAAS,CAAC,OAAO,CAAA;IAChD,MAAM,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,OAAO,CAAA;IAC/C,IAAI,SAAS,GAAG,KAAK,CAAA;IAErB,IAAG,UAAU,IAAI,UAAU,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,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WAAW,CACZ,CAAA;QACH,CAAC,CAAA;QAED,OAAM;IACR,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,4 +0,0 @@
1
- import { TagSupport } from './tag/TagSupport.class';
2
- import { InterpolateSubject, TemplateValue } from './tag/update/processSubjectValue.function';
3
- import { InsertBefore } from './interpolations/Clones.type';
4
- export declare function updateExistingValue(subject: InterpolateSubject, value: TemplateValue, ownerSupport: TagSupport, insertBefore: InsertBefore): InterpolateSubject;
@@ -1,135 +0,0 @@
1
- import { TagSupport } from './tag/TagSupport.class';
2
- import { TemplaterResult } from './TemplaterResult.class';
3
- import { isSubjectInstance, isTagArray, isTagClass, isTagComponent, isTagTemplater } from './isInstance';
4
- import { processTagArray } from './tag/update/processTagArray';
5
- import { updateExistingTagComponent } from './updateExistingTagComponent.function';
6
- import { processRegularValue } from './tag/update/processRegularValue.function';
7
- import { checkDestroyPrevious } from './checkDestroyPrevious.function';
8
- import { ValueSubject } from './subject/ValueSubject';
9
- import { processSubjectComponent } from './tag/update/processSubjectComponent.function';
10
- import { isLikeTags } from './tag/isLikeTags.function';
11
- import { bindSubjectCallback } from './interpolations/bindSubjectCallback.function';
12
- import { setupNewTemplater, getFakeTemplater, processTag } from './tag/update/processTag.function';
13
- import { insertAfter } from './insertAfter.function';
14
- export function updateExistingValue(subject, value, ownerSupport, insertBefore) {
15
- const subjectTag = subject;
16
- const isComponent = isTagComponent(value);
17
- checkDestroyPrevious(subject, value, insertBefore);
18
- // handle already seen tag components
19
- if (isComponent) {
20
- return prepareUpdateToComponent(value, subjectTag, insertBefore, ownerSupport);
21
- }
22
- // was component but no longer
23
- const tagSupport = subjectTag.tagSupport;
24
- if (tagSupport) {
25
- handleStillTag(subject, value, ownerSupport);
26
- return subjectTag;
27
- }
28
- // its another tag array
29
- if (isTagArray(value)) {
30
- processTagArray(subject, value, insertBefore, // oldInsertBefore as InsertBefore,
31
- ownerSupport, { counts: {
32
- added: 0,
33
- removed: 0,
34
- } });
35
- return subject;
36
- }
37
- if (isTagTemplater(value)) {
38
- processTag(value, insertBefore, ownerSupport, subjectTag);
39
- return subjectTag;
40
- }
41
- if (isTagClass(value)) {
42
- const tag = value;
43
- let templater = tag.templater;
44
- if (!templater) {
45
- templater = getFakeTemplater();
46
- tag.templater = templater;
47
- templater.tag = tag;
48
- }
49
- processTag(templater, insertBefore, ownerSupport, subjectTag);
50
- return subjectTag;
51
- }
52
- // we have been given a subject
53
- if (isSubjectInstance(value)) {
54
- return value;
55
- }
56
- // now its a function
57
- if (value instanceof Function) {
58
- const bound = bindSubjectCallback(value, ownerSupport);
59
- subject.set(bound);
60
- return subject;
61
- }
62
- // This will cause all other values to render
63
- processRegularValue(value, subject, insertBefore);
64
- return subjectTag;
65
- }
66
- function handleStillTag(subject, value, ownerSupport) {
67
- const lastSupport = subject.tagSupport;
68
- let templater = value;
69
- const isClass = isTagClass(value);
70
- if (isClass) {
71
- const tag = value;
72
- templater = tag.templater;
73
- if (!templater) {
74
- const children = new ValueSubject([]);
75
- templater = new TemplaterResult(undefined, children);
76
- templater.tag = tag;
77
- tag.templater = templater;
78
- }
79
- }
80
- const valueSupport = new TagSupport(templater, ownerSupport, subject);
81
- if (isClass) {
82
- valueSupport.global = lastSupport.global;
83
- }
84
- const isSameTag = value && isLikeTags(lastSupport, valueSupport);
85
- if (isTagTemplater(value)) {
86
- setupNewTemplater(valueSupport, ownerSupport, subject);
87
- }
88
- if (isSameTag) {
89
- lastSupport.updateBy(valueSupport);
90
- return;
91
- }
92
- if (isSameTag) {
93
- // const subjectTag = subject as TagSubject
94
- const global = lastSupport.global;
95
- const insertBefore = global.insertBefore;
96
- return processTag(templater, insertBefore, ownerSupport, subject);
97
- }
98
- return processRegularValue(value, subject, subject.insertBefore);
99
- }
100
- function prepareUpdateToComponent(templater, subjectTag, insertBefore, ownerSupport) {
101
- // When last value was not a component
102
- if (!subjectTag.tagSupport) {
103
- processSubjectComponent(templater, subjectTag, insertBefore, // oldInsertBefore as InsertBefore,
104
- ownerSupport, {
105
- forceElement: true,
106
- counts: { added: 0, removed: 0 },
107
- });
108
- return subjectTag;
109
- }
110
- const tagSupport = new TagSupport(templater, ownerSupport, subjectTag);
111
- const subjectSup = subjectTag.tagSupport;
112
- const prevSupport = subjectSup.global.newest;
113
- if (prevSupport) {
114
- const newestState = prevSupport.memory.state;
115
- tagSupport.memory.state = [...newestState];
116
- }
117
- else {
118
- const placeholder = subjectSup.global.placeholder;
119
- if (placeholder && !insertBefore.parentNode) {
120
- insertAfter(insertBefore, placeholder);
121
- delete subjectSup.global.placeholder;
122
- }
123
- processSubjectComponent(templater, subjectTag, insertBefore, ownerSupport, {
124
- forceElement: true,
125
- counts: { added: 0, removed: 0 },
126
- });
127
- return subjectTag;
128
- }
129
- tagSupport.global = subjectSup.global;
130
- subjectTag.tagSupport = tagSupport;
131
- updateExistingTagComponent(ownerSupport, tagSupport, // latest value
132
- subjectTag, insertBefore);
133
- return subjectTag;
134
- }
135
- //# sourceMappingURL=updateExistingValue.function.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"updateExistingValue.function.js","sourceRoot":"","sources":["../ts/updateExistingValue.function.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAExG,OAAO,EAAmB,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAA;AAClF,OAAO,EAAgB,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAA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KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAC;SAC/B,CACF,CAAA;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,UAAU,CAC/B,SAAS,EACT,YAAY,EACZ,UAAU,CACX,CAAA;IAED,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAA;IACxC,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAA;IAC5C,IAAG,WAAW,EAAE,CAAC;QACf,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAA;QAC5C,UAAU,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,GAAG,WAAW,CAAC,CAAA;IAC5C,CAAC;SAAM,CAAC;QACN,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,WAAW,CAAA;QACjD,IAAG,WAAW,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;YAC3C,WAAW,CAAC,YAAY,EAAC,WAAW,CAAC,CAAA;YACrC,OAAO,UAAU,CAAC,MAAM,CAAC,WAAW,CAAA;QACtC,CAAC;QAED,uBAAuB,CACrB,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EACjD;YACE,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAC;SAC/B,CACF,CAAA;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IACD,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAA;IACrC,UAAU,CAAC,UAAU,GAAG,UAAU,CAAA;IAElC,0BAA0B,CACxB,YAAY,EACZ,UAAU,EAAE,eAAe;IAC3B,UAAU,EACV,YAAY,CACb,CAAA;IAED,OAAO,UAAU,CAAA;AACnB,CAAC"}
@@ -1,3 +0,0 @@
1
- export type WatchCallback = (currentValues: any[], previousValues: any[] | undefined) => unknown | ((currentValues: any[]) => unknown) | (() => unknown);
2
- /** When an item in watch array changes, callback function will be triggered */
3
- export declare function watch<T>(currentValues: T[], callback: WatchCallback): T[];
@@ -1,20 +0,0 @@
1
- import { setLet } from './setLet.function';
2
- /** When an item in watch array changes, callback function will be triggered */
3
- export function watch(currentValues, callback) {
4
- let previousValues = setLet(undefined)(x => [previousValues, previousValues = x]);
5
- if (previousValues === undefined) {
6
- callback(currentValues, previousValues);
7
- // const result = {currentValues, previousValues}
8
- previousValues = currentValues;
9
- return currentValues;
10
- }
11
- const allExact = currentValues.every((item, index) => item === previousValues[index]);
12
- if (allExact) {
13
- return currentValues;
14
- }
15
- callback(currentValues, previousValues);
16
- previousValues.length = 0;
17
- previousValues.push(...currentValues);
18
- return currentValues;
19
- }
20
- //# sourceMappingURL=watch.function.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"watch.function.js","sourceRoot":"","sources":["../ts/watch.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAO1C,+EAA+E;AAC/E,MAAM,UAAU,KAAK,CACnB,aAAkB,EAClB,QAAuB;IAEvB,IAAI,cAAc,GAAG,MAAM,CAAC,SAAkC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,cAAc,EAAE,cAAc,GAAG,CAAC,CAAC,CAAC,CAAA;IAE1G,IAAG,cAAc,KAAK,SAAS,EAAE,CAAC;QAChC,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;QACvC,iDAAiD;QACjD,cAAc,GAAG,aAAa,CAAA;QAC9B,OAAO,aAAa,CAAA;IACtB,CAAC;IAED,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,KAAM,cAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;IAChG,IAAG,QAAQ,EAAE,CAAC;QACZ,OAAO,aAAa,CAAA;IACtB,CAAC;IAED,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IACvC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAA;IACzB,cAAc,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAA;IAErC,OAAO,aAAa,CAAA;AACtB,CAAC"}
File without changes
File without changes
File without changes