@revolist/revogrid 3.2.4 → 3.2.7

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 (213) hide show
  1. package/custom-element/index.js +29217 -0
  2. package/custom-element/resize-observer.js +503 -0
  3. package/dist/cjs/css-shim-9f5bc84d.js +9 -0
  4. package/dist/cjs/debounce-6cea2774.js +578 -0
  5. package/dist/cjs/dom-fcb646f0.js +78 -0
  6. package/dist/{revo-grid/index-8a604c17.js → cjs/index-cb904e00.js} +230 -1445
  7. package/dist/cjs/index.cjs.js +5 -0
  8. package/dist/cjs/loader.cjs.js +38 -0
  9. package/dist/cjs/resize-observer-bf327d6a.js +507 -0
  10. package/dist/cjs/revo-grid.cjs.js +79 -0
  11. package/dist/cjs/revo-grid_11.cjs.entry.js +28301 -0
  12. package/dist/cjs/revogr-clipboard.cjs.entry.js +56 -0
  13. package/dist/cjs/revogr-filter-panel.cjs.entry.js +278 -0
  14. package/dist/collection/collection-manifest.json +25 -0
  15. package/dist/collection/components/button/button.js +7 -0
  16. package/dist/collection/components/clipboard/revogr-clipboard.js +124 -0
  17. package/dist/collection/components/data/cellRenderer.js +27 -0
  18. package/dist/{revo-grid/columnService-91e552ba.js → collection/components/data/columnService.js} +6 -8
  19. package/dist/collection/components/data/revogr-data-style.css +135 -0
  20. package/dist/collection/components/data/revogr-data.js +325 -0
  21. package/dist/collection/components/data/rowRenderer.js +9 -0
  22. package/dist/collection/components/header/headerCellRenderer.js +29 -0
  23. package/dist/collection/components/header/headerRenderer.js +48 -0
  24. package/dist/collection/components/header/revogr-header-style.css +198 -0
  25. package/dist/collection/components/header/revogr-header.js +300 -0
  26. package/dist/collection/components/order/orderRenderer.js +53 -0
  27. package/dist/collection/components/order/revogr-order-editor.js +361 -0
  28. package/dist/collection/components/order/rowOrderService.js +71 -0
  29. package/dist/collection/components/overlay/autofill.service.js +185 -0
  30. package/dist/collection/components/overlay/clipboard.service.js +42 -0
  31. package/dist/collection/components/overlay/editors/edit.utils.js +8 -0
  32. package/dist/collection/components/overlay/editors/text.js +38 -0
  33. package/dist/collection/components/overlay/keyboard.service.js +131 -0
  34. package/dist/collection/components/overlay/revogr-edit-style.css +86 -0
  35. package/dist/collection/components/overlay/revogr-edit.js +162 -0
  36. package/dist/collection/components/overlay/revogr-overlay-selection.js +729 -0
  37. package/dist/collection/components/overlay/revogr-overlay-style.css +98 -0
  38. package/dist/{revo-grid/selection.utils-a9932db6.js → collection/components/overlay/selection.utils.js} +9 -12
  39. package/dist/collection/components/revo-grid/revo-grid-style.css +544 -0
  40. package/dist/collection/components/revo-grid/revo-grid.js +2226 -0
  41. package/dist/collection/components/revo-grid/viewport.helpers.js +14 -0
  42. package/dist/collection/components/revo-grid/viewport.interfaces.js +4 -0
  43. package/dist/collection/components/revo-grid/viewport.js +21 -0
  44. package/dist/collection/components/revo-grid/viewport.resize.service.js +24 -0
  45. package/dist/collection/components/revo-grid/viewport.scrolling.service.js +63 -0
  46. package/dist/collection/components/revo-grid/viewport.section.js +31 -0
  47. package/dist/collection/components/revo-grid/viewport.service.js +212 -0
  48. package/dist/collection/components/rowHeaders/revogr-row-headers.js +213 -0
  49. package/dist/collection/components/rowHeaders/row-header-render.js +4 -0
  50. package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +137 -0
  51. package/dist/collection/components/scroll/revogr-viewport-scroll.js +402 -0
  52. package/dist/collection/components/scrollable/revogr-scroll-style.css +104 -0
  53. package/dist/collection/components/scrollable/revogr-scroll-virtual.js +256 -0
  54. package/dist/collection/components/selection-focus/revogr-focus-style.css +77 -0
  55. package/dist/collection/components/selection-focus/revogr-focus.js +106 -0
  56. package/dist/collection/components/selection-temp-range/revogr-temp-range-style.css +98 -0
  57. package/dist/collection/components/selection-temp-range/revogr-temp-range.js +141 -0
  58. package/dist/{revo-grid/app-globals-7e6866ba.js → collection/global/global.js} +2 -8
  59. package/dist/collection/index.js +4 -0
  60. package/dist/collection/plugins/autoSizeColumn.js +233 -0
  61. package/dist/collection/plugins/basePlugin.js +30 -0
  62. package/dist/{revo-grid/dispatcher-891af82e.js → collection/plugins/dispatcher.js} +2 -4
  63. package/dist/collection/plugins/export/csv.js +71 -0
  64. package/dist/collection/plugins/export/export.plugin.js +168 -0
  65. package/dist/collection/plugins/export/types.js +4 -0
  66. package/dist/collection/plugins/filter/conditions/equal.js +20 -0
  67. package/dist/collection/plugins/filter/conditions/number/greaterThan.js +13 -0
  68. package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +10 -0
  69. package/dist/collection/plugins/filter/conditions/number/lessThan.js +15 -0
  70. package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +10 -0
  71. package/dist/collection/plugins/filter/conditions/set.js +6 -0
  72. package/dist/collection/plugins/filter/conditions/string/beginswith.js +20 -0
  73. package/dist/collection/plugins/filter/conditions/string/contains.js +21 -0
  74. package/dist/{revo-grid/filter.button-74c1cd9c.js → collection/plugins/filter/filter.button.js} +10 -13
  75. package/dist/collection/plugins/filter/filter.plugin.js +259 -0
  76. package/dist/collection/plugins/filter/filter.pop.js +488 -0
  77. package/dist/collection/plugins/filter/filter.service.js +47 -0
  78. package/dist/collection/plugins/filter/filter.style.css +239 -0
  79. package/dist/collection/plugins/filter/filter.types.js +4 -0
  80. package/dist/collection/plugins/groupingColumn/columnGroupsRenderer.js +33 -0
  81. package/dist/collection/plugins/groupingColumn/grouping.col.plugin.js +39 -0
  82. package/dist/collection/plugins/groupingColumn/headerGroupRenderer.js +24 -0
  83. package/dist/collection/plugins/groupingRow/grouping.const.js +13 -0
  84. package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +79 -0
  85. package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +261 -0
  86. package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +32 -0
  87. package/dist/collection/plugins/groupingRow/grouping.row.types.js +4 -0
  88. package/dist/collection/plugins/groupingRow/grouping.service.js +158 -0
  89. package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +60 -0
  90. package/dist/collection/plugins/moveColumn/columnDragPlugin.js +151 -0
  91. package/dist/collection/plugins/moveColumn/columnOrderHandler.js +63 -0
  92. package/dist/collection/plugins/sorting/sorting.plugin.js +184 -0
  93. package/dist/collection/plugins/sorting/sorting.sign.js +9 -0
  94. package/dist/collection/plugins/stretchPlugin.js +71 -0
  95. package/dist/collection/plugins/trimmed/trimmed.plugin.js +35 -0
  96. package/dist/collection/services/cell.helpers.js +10 -0
  97. package/dist/collection/services/column.data.provider.js +191 -0
  98. package/dist/collection/services/data.provider.js +50 -0
  99. package/dist/collection/services/dimension.provider.js +81 -0
  100. package/dist/{revo-grid/localScrollService-e9b73323.js → collection/services/localScrollService.js} +2 -5
  101. package/dist/collection/services/resizable.directive.js +255 -0
  102. package/dist/collection/services/selection.store.connector.js +216 -0
  103. package/dist/collection/services/viewport.provider.js +17 -0
  104. package/dist/collection/store/dataSource/data.proxy.js +37 -0
  105. package/dist/collection/store/dataSource/data.store.js +130 -0
  106. package/dist/collection/store/dimension/dimension.helpers.js +110 -0
  107. package/dist/collection/store/dimension/dimension.store.js +62 -0
  108. package/dist/collection/store/selection/selection.helpers.js +56 -0
  109. package/dist/collection/store/selection/selection.store.js +71 -0
  110. package/dist/collection/store/selection/selection.store.service.js +38 -0
  111. package/dist/collection/store/storeTypes.js +8 -0
  112. package/dist/{revo-grid/viewport.store-ffaaab6d.js → collection/store/viewPort/viewport.helpers.js} +9 -132
  113. package/dist/collection/store/viewPort/viewport.store.js +124 -0
  114. package/dist/collection/themeManager/theme.compact.js +8 -0
  115. package/dist/collection/themeManager/theme.default.js +8 -0
  116. package/dist/collection/themeManager/theme.material.js +8 -0
  117. package/dist/{revo-grid/themeService-ddaaa364.js → collection/themeManager/themeService.js} +6 -23
  118. package/dist/collection/utils/closestPolifill.js +21 -0
  119. package/dist/collection/utils/consts.js +22 -0
  120. package/dist/collection/utils/generateAlphabetHeader.js +23 -0
  121. package/dist/collection/utils/keyCodes.js +73 -0
  122. package/dist/collection/utils/keyCodes.utils.js +67 -0
  123. package/dist/collection/utils/platform.js +8 -0
  124. package/dist/collection/utils/resizeObserver.js +9 -0
  125. package/dist/collection/utils/store.utils.js +10 -0
  126. package/dist/{revo-grid/utils-2c3b3857.js → collection/utils/utils.js} +8 -10
  127. package/dist/collection/utilsExternal/generate-data.js +132 -0
  128. package/dist/esm/css-shim-e1e1ea5e.js +7 -0
  129. package/dist/esm/debounce-e4e6dd45.js +561 -0
  130. package/dist/esm/dom-21bd1807.js +76 -0
  131. package/dist/esm/index-6f753b3c.js +1817 -0
  132. package/dist/esm/index.js +3 -0
  133. package/dist/esm/loader.js +34 -0
  134. package/dist/esm/polyfills/core-js.js +11 -0
  135. package/dist/esm/polyfills/css-shim.js +1 -0
  136. package/dist/esm/polyfills/dom.js +79 -0
  137. package/dist/esm/polyfills/es5-html-element.js +1 -0
  138. package/dist/esm/polyfills/index.js +34 -0
  139. package/dist/esm/polyfills/system.js +6 -0
  140. package/dist/esm/resize-observer-00c48d78.js +503 -0
  141. package/dist/esm/revo-grid.js +77 -0
  142. package/dist/{revo-grid/lodash-a0ab4cdd.js → esm/revo-grid_11.entry.js} +25351 -14282
  143. package/dist/esm/revogr-clipboard.entry.js +52 -0
  144. package/dist/esm/revogr-filter-panel.entry.js +274 -0
  145. package/dist/esm-es5/css-shim-e1e1ea5e.js +4 -0
  146. package/dist/esm-es5/debounce-e4e6dd45.js +4 -0
  147. package/dist/esm-es5/dom-21bd1807.js +24 -0
  148. package/dist/esm-es5/index-6f753b3c.js +4 -0
  149. package/dist/esm-es5/index.js +3 -0
  150. package/dist/esm-es5/loader.js +4 -0
  151. package/dist/esm-es5/resize-observer-00c48d78.js +4 -0
  152. package/dist/esm-es5/revo-grid.js +4 -0
  153. package/dist/esm-es5/revo-grid_11.entry.js +4 -0
  154. package/dist/esm-es5/revogr-clipboard.entry.js +4 -0
  155. package/dist/esm-es5/revogr-filter-panel.entry.js +4 -0
  156. package/dist/index.cjs.js +1 -0
  157. package/dist/index.js +1 -0
  158. package/dist/revo-grid/css-shim-bcf89cc0.system.js +4 -0
  159. package/dist/revo-grid/css-shim-e1e1ea5e.js +4 -0
  160. package/dist/revo-grid/debounce-5a33c710.system.js +4 -0
  161. package/dist/revo-grid/debounce-726bdadb.js +4 -0
  162. package/dist/revo-grid/dom-21bd1807.js +5 -59
  163. package/dist/revo-grid/dom-726246e2.system.js +24 -0
  164. package/dist/revo-grid/index-f14b41a0.system.js +5 -0
  165. package/dist/revo-grid/index-f30d1de1.js +5 -0
  166. package/dist/revo-grid/index.system.js +4 -0
  167. package/dist/revo-grid/resize-observer-00c48d78.js +1 -500
  168. package/dist/revo-grid/resize-observer-8af0bc0e.system.js +4 -0
  169. package/dist/revo-grid/revo-grid.esm.js +1 -130
  170. package/dist/revo-grid/revo-grid.js +133 -0
  171. package/dist/revo-grid/revo-grid.system.js +4 -0
  172. package/dist/revo-grid/revo-grid_11.entry.js +4 -0
  173. package/dist/revo-grid/revo-grid_11.system.entry.js +4 -0
  174. package/dist/revo-grid/revogr-clipboard.entry.js +1 -49
  175. package/dist/revo-grid/revogr-clipboard.system.entry.js +4 -0
  176. package/dist/revo-grid/revogr-filter-panel.entry.js +1 -274
  177. package/dist/revo-grid/revogr-filter-panel.system.entry.js +4 -0
  178. package/dist/types/components/revo-grid/revo-grid.d.ts +0 -1
  179. package/dist/types/components.d.ts +2 -2
  180. package/loader/cdn.js +3 -1
  181. package/loader/index.cjs.js +3 -1
  182. package/loader/index.d.ts +0 -1
  183. package/loader/index.es2017.js +3 -1
  184. package/loader/index.js +3 -1
  185. package/package.json +1 -1
  186. package/dist/revo-grid/_baseIteratee-af30b221.js +0 -2070
  187. package/dist/revo-grid/consts-ef824e6f.js +0 -46
  188. package/dist/revo-grid/css-shim-5387c708.js +0 -7
  189. package/dist/revo-grid/data.store-3263fff9.js +0 -557
  190. package/dist/revo-grid/debounce-aaa4b4da.js +0 -217
  191. package/dist/revo-grid/dimension.helpers-a7944fc4.js +0 -340
  192. package/dist/revo-grid/each-0378e5a3.js +0 -180
  193. package/dist/revo-grid/identity-c8c7d3d8.js +0 -26
  194. package/dist/revo-grid/isString-a51066b5.js +0 -34
  195. package/dist/revo-grid/isSymbol-e4b5dafe.js +0 -247
  196. package/dist/revo-grid/keyCodes.utils-bd06e3ba.js +0 -299
  197. package/dist/revo-grid/keys-70b7c240.js +0 -561
  198. package/dist/revo-grid/revo-grid.entry.js +0 -3484
  199. package/dist/revo-grid/revogr-data.entry.js +0 -152
  200. package/dist/revo-grid/revogr-edit.entry.js +0 -105
  201. package/dist/revo-grid/revogr-focus.entry.js +0 -41
  202. package/dist/revo-grid/revogr-header.entry.js +0 -560
  203. package/dist/revo-grid/revogr-order-editor.entry.js +0 -175
  204. package/dist/revo-grid/revogr-overlay-selection.entry.js +0 -711
  205. package/dist/revo-grid/revogr-row-headers.entry.js +0 -73
  206. package/dist/revo-grid/revogr-scroll-virtual.entry.js +0 -114
  207. package/dist/revo-grid/revogr-temp-range.entry.js +0 -73
  208. package/dist/revo-grid/revogr-viewport-scroll.entry.js +0 -340
  209. package/dist/revo-grid/selection.store.connector-2b613fd0.js +0 -503
  210. package/dist/revo-grid/shadow-css-602a09db.js +0 -390
  211. package/dist/revo-grid/toInteger-9e6cbfd2.js +0 -107
  212. package/dist/revo-grid/toNumber-913b0b72.js +0 -105
  213. package/dist/revo-grid/viewport.helpers-49d3f031.js +0 -16
@@ -0,0 +1,1817 @@
1
+ /*!
2
+ * Built by Revolist
3
+ */
4
+ const NAMESPACE = 'revo-grid';
5
+
6
+ let contentRef;
7
+ let hostTagName;
8
+ let useNativeShadowDom = false;
9
+ let checkSlotFallbackVisibility = false;
10
+ let checkSlotRelocate = false;
11
+ let isSvgMode = false;
12
+ let renderingRef = null;
13
+ let queuePending = false;
14
+ const win = typeof window !== 'undefined' ? window : {};
15
+ const CSS = win.CSS ;
16
+ const doc = win.document || { head: {} };
17
+ const plt = {
18
+ $flags$: 0,
19
+ $resourcesUrl$: '',
20
+ jmp: (h) => h(),
21
+ raf: (h) => requestAnimationFrame(h),
22
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
23
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
24
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
25
+ };
26
+ const promiseResolve = (v) => Promise.resolve(v);
27
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
28
+ try {
29
+ new CSSStyleSheet();
30
+ return typeof new CSSStyleSheet().replaceSync === 'function';
31
+ }
32
+ catch (e) { }
33
+ return false;
34
+ })()
35
+ ;
36
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
37
+ if (listeners) {
38
+ listeners.map(([flags, name, method]) => {
39
+ const target = getHostListenerTarget(elm, flags) ;
40
+ const handler = hostListenerProxy(hostRef, method);
41
+ const opts = hostListenerOpts(flags);
42
+ plt.ael(target, name, handler, opts);
43
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
44
+ });
45
+ }
46
+ };
47
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
48
+ try {
49
+ {
50
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
51
+ // instance is ready, let's call it's member method for this event
52
+ hostRef.$lazyInstance$[methodName](ev);
53
+ }
54
+ else {
55
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
56
+ }
57
+ }
58
+ }
59
+ catch (e) {
60
+ consoleError(e);
61
+ }
62
+ };
63
+ const getHostListenerTarget = (elm, flags) => {
64
+ if (flags & 4 /* TargetDocument */)
65
+ return doc;
66
+ return elm;
67
+ };
68
+ // prettier-ignore
69
+ const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
70
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
71
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
72
+ const createTime = (fnName, tagName = '') => {
73
+ {
74
+ return () => {
75
+ return;
76
+ };
77
+ }
78
+ };
79
+ const uniqueTime = (key, measureText) => {
80
+ {
81
+ return () => {
82
+ return;
83
+ };
84
+ }
85
+ };
86
+ const rootAppliedStyles = new WeakMap();
87
+ const registerStyle = (scopeId, cssText, allowCS) => {
88
+ let style = styles.get(scopeId);
89
+ if (supportsConstructableStylesheets && allowCS) {
90
+ style = (style || new CSSStyleSheet());
91
+ if (typeof style === 'string') {
92
+ style = cssText;
93
+ }
94
+ else {
95
+ style.replaceSync(cssText);
96
+ }
97
+ }
98
+ else {
99
+ style = cssText;
100
+ }
101
+ styles.set(scopeId, style);
102
+ };
103
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
104
+ let scopeId = getScopeId(cmpMeta);
105
+ const style = styles.get(scopeId);
106
+ // if an element is NOT connected then getRootNode() will return the wrong root node
107
+ // so the fallback is to always use the document for the root node in those cases
108
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
109
+ if (style) {
110
+ if (typeof style === 'string') {
111
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
112
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
113
+ let styleElm;
114
+ if (!appliedStyles) {
115
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
116
+ }
117
+ if (!appliedStyles.has(scopeId)) {
118
+ {
119
+ if (plt.$cssShim$) {
120
+ styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
121
+ const newScopeId = styleElm['s-sc'];
122
+ if (newScopeId) {
123
+ scopeId = newScopeId;
124
+ // we don't want to add this styleID to the appliedStyles Set
125
+ // since the cssVarShim might need to apply several different
126
+ // stylesheets for the same component
127
+ appliedStyles = null;
128
+ }
129
+ }
130
+ else {
131
+ styleElm = doc.createElement('style');
132
+ styleElm.innerHTML = style;
133
+ }
134
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
135
+ }
136
+ if (appliedStyles) {
137
+ appliedStyles.add(scopeId);
138
+ }
139
+ }
140
+ }
141
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
142
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
143
+ }
144
+ }
145
+ return scopeId;
146
+ };
147
+ const attachStyles = (hostRef) => {
148
+ const cmpMeta = hostRef.$cmpMeta$;
149
+ const elm = hostRef.$hostElement$;
150
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
151
+ addStyle(elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
152
+ endAttachStyles();
153
+ };
154
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
155
+ /**
156
+ * Default style mode id
157
+ */
158
+ /**
159
+ * Reusable empty obj/array
160
+ * Don't add values to these!!
161
+ */
162
+ const EMPTY_OBJ = {};
163
+ /**
164
+ * Namespaces
165
+ */
166
+ const SVG_NS = 'http://www.w3.org/2000/svg';
167
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
168
+ const isComplexType = (o) => {
169
+ // https://jsperf.com/typeof-fn-object/5
170
+ o = typeof o;
171
+ return o === 'object' || o === 'function';
172
+ };
173
+ /**
174
+ * Production h() function based on Preact by
175
+ * Jason Miller (@developit)
176
+ * Licensed under the MIT License
177
+ * https://github.com/developit/preact/blob/master/LICENSE
178
+ *
179
+ * Modified for Stencil's compiler and vdom
180
+ */
181
+ // const stack: any[] = [];
182
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
183
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
184
+ const h = (nodeName, vnodeData, ...children) => {
185
+ let child = null;
186
+ let key = null;
187
+ let slotName = null;
188
+ let simple = false;
189
+ let lastSimple = false;
190
+ const vNodeChildren = [];
191
+ const walk = (c) => {
192
+ for (let i = 0; i < c.length; i++) {
193
+ child = c[i];
194
+ if (Array.isArray(child)) {
195
+ walk(child);
196
+ }
197
+ else if (child != null && typeof child !== 'boolean') {
198
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
199
+ child = String(child);
200
+ }
201
+ if (simple && lastSimple) {
202
+ // If the previous child was simple (string), we merge both
203
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
204
+ }
205
+ else {
206
+ // Append a new vNode, if it's text, we create a text vNode
207
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
208
+ }
209
+ lastSimple = simple;
210
+ }
211
+ }
212
+ };
213
+ walk(children);
214
+ if (vnodeData) {
215
+ // normalize class / classname attributes
216
+ if (vnodeData.key) {
217
+ key = vnodeData.key;
218
+ }
219
+ if (vnodeData.name) {
220
+ slotName = vnodeData.name;
221
+ }
222
+ {
223
+ const classData = vnodeData.className || vnodeData.class;
224
+ if (classData) {
225
+ vnodeData.class =
226
+ typeof classData !== 'object'
227
+ ? classData
228
+ : Object.keys(classData)
229
+ .filter((k) => classData[k])
230
+ .join(' ');
231
+ }
232
+ }
233
+ }
234
+ if (typeof nodeName === 'function') {
235
+ // nodeName is a functional component
236
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
237
+ }
238
+ const vnode = newVNode(nodeName, null);
239
+ vnode.$attrs$ = vnodeData;
240
+ if (vNodeChildren.length > 0) {
241
+ vnode.$children$ = vNodeChildren;
242
+ }
243
+ {
244
+ vnode.$key$ = key;
245
+ }
246
+ {
247
+ vnode.$name$ = slotName;
248
+ }
249
+ return vnode;
250
+ };
251
+ const newVNode = (tag, text) => {
252
+ const vnode = {
253
+ $flags$: 0,
254
+ $tag$: tag,
255
+ $text$: text,
256
+ $elm$: null,
257
+ $children$: null,
258
+ };
259
+ {
260
+ vnode.$attrs$ = null;
261
+ }
262
+ {
263
+ vnode.$key$ = null;
264
+ }
265
+ {
266
+ vnode.$name$ = null;
267
+ }
268
+ return vnode;
269
+ };
270
+ const Host = {};
271
+ const isHost = (node) => node && node.$tag$ === Host;
272
+ const vdomFnUtils = {
273
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
274
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
275
+ };
276
+ const convertToPublic = (node) => ({
277
+ vattrs: node.$attrs$,
278
+ vchildren: node.$children$,
279
+ vkey: node.$key$,
280
+ vname: node.$name$,
281
+ vtag: node.$tag$,
282
+ vtext: node.$text$,
283
+ });
284
+ const convertToPrivate = (node) => {
285
+ if (typeof node.vtag === 'function') {
286
+ const vnodeData = Object.assign({}, node.vattrs);
287
+ if (node.vkey) {
288
+ vnodeData.key = node.vkey;
289
+ }
290
+ if (node.vname) {
291
+ vnodeData.name = node.vname;
292
+ }
293
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
294
+ }
295
+ const vnode = newVNode(node.vtag, node.vtext);
296
+ vnode.$attrs$ = node.vattrs;
297
+ vnode.$children$ = node.vchildren;
298
+ vnode.$key$ = node.vkey;
299
+ vnode.$name$ = node.vname;
300
+ return vnode;
301
+ };
302
+ /**
303
+ * Production setAccessor() function based on Preact by
304
+ * Jason Miller (@developit)
305
+ * Licensed under the MIT License
306
+ * https://github.com/developit/preact/blob/master/LICENSE
307
+ *
308
+ * Modified for Stencil's compiler and vdom
309
+ */
310
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
311
+ if (oldValue !== newValue) {
312
+ let isProp = isMemberInElement(elm, memberName);
313
+ let ln = memberName.toLowerCase();
314
+ if (memberName === 'class') {
315
+ const classList = elm.classList;
316
+ const oldClasses = parseClassList(oldValue);
317
+ const newClasses = parseClassList(newValue);
318
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
319
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
320
+ }
321
+ else if (memberName === 'style') {
322
+ // update style attribute, css properties and values
323
+ {
324
+ for (const prop in oldValue) {
325
+ if (!newValue || newValue[prop] == null) {
326
+ if (prop.includes('-')) {
327
+ elm.style.removeProperty(prop);
328
+ }
329
+ else {
330
+ elm.style[prop] = '';
331
+ }
332
+ }
333
+ }
334
+ }
335
+ for (const prop in newValue) {
336
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
337
+ if (prop.includes('-')) {
338
+ elm.style.setProperty(prop, newValue[prop]);
339
+ }
340
+ else {
341
+ elm.style[prop] = newValue[prop];
342
+ }
343
+ }
344
+ }
345
+ }
346
+ else if (memberName === 'key')
347
+ ;
348
+ else if (memberName === 'ref') {
349
+ // minifier will clean this up
350
+ if (newValue) {
351
+ newValue(elm);
352
+ }
353
+ }
354
+ else if ((!isProp ) &&
355
+ memberName[0] === 'o' &&
356
+ memberName[1] === 'n') {
357
+ // Event Handlers
358
+ // so if the member name starts with "on" and the 3rd characters is
359
+ // a capital letter, and it's not already a member on the element,
360
+ // then we're assuming it's an event listener
361
+ if (memberName[2] === '-') {
362
+ // on- prefixed events
363
+ // allows to be explicit about the dom event to listen without any magic
364
+ // under the hood:
365
+ // <my-cmp on-click> // listens for "click"
366
+ // <my-cmp on-Click> // listens for "Click"
367
+ // <my-cmp on-ionChange> // listens for "ionChange"
368
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
369
+ memberName = memberName.slice(3);
370
+ }
371
+ else if (isMemberInElement(win, ln)) {
372
+ // standard event
373
+ // the JSX attribute could have been "onMouseOver" and the
374
+ // member name "onmouseover" is on the window's prototype
375
+ // so let's add the listener "mouseover", which is all lowercased
376
+ memberName = ln.slice(2);
377
+ }
378
+ else {
379
+ // custom event
380
+ // the JSX attribute could have been "onMyCustomEvent"
381
+ // so let's trim off the "on" prefix and lowercase the first character
382
+ // and add the listener "myCustomEvent"
383
+ // except for the first character, we keep the event name case
384
+ memberName = ln[2] + memberName.slice(3);
385
+ }
386
+ if (oldValue) {
387
+ plt.rel(elm, memberName, oldValue, false);
388
+ }
389
+ if (newValue) {
390
+ plt.ael(elm, memberName, newValue, false);
391
+ }
392
+ }
393
+ else {
394
+ // Set property if it exists and it's not a SVG
395
+ const isComplex = isComplexType(newValue);
396
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
397
+ try {
398
+ if (!elm.tagName.includes('-')) {
399
+ const n = newValue == null ? '' : newValue;
400
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
401
+ if (memberName === 'list') {
402
+ isProp = false;
403
+ }
404
+ else if (oldValue == null || elm[memberName] != n) {
405
+ elm[memberName] = n;
406
+ }
407
+ }
408
+ else {
409
+ elm[memberName] = newValue;
410
+ }
411
+ }
412
+ catch (e) { }
413
+ }
414
+ /**
415
+ * Need to manually update attribute if:
416
+ * - memberName is not an attribute
417
+ * - if we are rendering the host element in order to reflect attribute
418
+ * - if it's a SVG, since properties might not work in <svg>
419
+ * - if the newValue is null/undefined or 'false'.
420
+ */
421
+ let xlink = false;
422
+ {
423
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
424
+ memberName = ln;
425
+ xlink = true;
426
+ }
427
+ }
428
+ if (newValue == null || newValue === false) {
429
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
430
+ if (xlink) {
431
+ elm.removeAttributeNS(XLINK_NS, memberName);
432
+ }
433
+ else {
434
+ elm.removeAttribute(memberName);
435
+ }
436
+ }
437
+ }
438
+ else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
439
+ newValue = newValue === true ? '' : newValue;
440
+ if (xlink) {
441
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
442
+ }
443
+ else {
444
+ elm.setAttribute(memberName, newValue);
445
+ }
446
+ }
447
+ }
448
+ }
449
+ };
450
+ const parseClassListRegex = /\s/;
451
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
452
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
453
+ // if the element passed in is a shadow root, which is a document fragment
454
+ // then we want to be adding attrs/props to the shadow root's "host" element
455
+ // if it's not a shadow root, then we add attrs/props to the same element
456
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
457
+ ? newVnode.$elm$.host
458
+ : newVnode.$elm$;
459
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
460
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
461
+ {
462
+ // remove attributes no longer present on the vnode by setting them to undefined
463
+ for (memberName in oldVnodeAttrs) {
464
+ if (!(memberName in newVnodeAttrs)) {
465
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
466
+ }
467
+ }
468
+ }
469
+ // add new & update changed attributes
470
+ for (memberName in newVnodeAttrs) {
471
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
472
+ }
473
+ };
474
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
475
+ // tslint:disable-next-line: prefer-const
476
+ const newVNode = newParentVNode.$children$[childIndex];
477
+ let i = 0;
478
+ let elm;
479
+ let childNode;
480
+ let oldVNode;
481
+ if (!useNativeShadowDom) {
482
+ // remember for later we need to check to relocate nodes
483
+ checkSlotRelocate = true;
484
+ if (newVNode.$tag$ === 'slot') {
485
+ newVNode.$flags$ |= newVNode.$children$
486
+ ? // slot element has fallback content
487
+ 2 /* isSlotFallback */
488
+ : // slot element does not have fallback content
489
+ 1 /* isSlotReference */;
490
+ }
491
+ }
492
+ if (newVNode.$text$ !== null) {
493
+ // create text node
494
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
495
+ }
496
+ else if (newVNode.$flags$ & 1 /* isSlotReference */) {
497
+ // create a slot reference node
498
+ elm = newVNode.$elm$ =
499
+ doc.createTextNode('');
500
+ }
501
+ else {
502
+ if (!isSvgMode) {
503
+ isSvgMode = newVNode.$tag$ === 'svg';
504
+ }
505
+ // create element
506
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* isSlotFallback */
507
+ ? 'slot-fb'
508
+ : newVNode.$tag$)
509
+ );
510
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
511
+ isSvgMode = false;
512
+ }
513
+ // add css classes, attrs, props, listeners, etc.
514
+ {
515
+ updateElement(null, newVNode, isSvgMode);
516
+ }
517
+ if (newVNode.$children$) {
518
+ for (i = 0; i < newVNode.$children$.length; ++i) {
519
+ // create the node
520
+ childNode = createElm(oldParentVNode, newVNode, i);
521
+ // return node could have been null
522
+ if (childNode) {
523
+ // append our new node
524
+ elm.appendChild(childNode);
525
+ }
526
+ }
527
+ }
528
+ {
529
+ if (newVNode.$tag$ === 'svg') {
530
+ // Only reset the SVG context when we're exiting <svg> element
531
+ isSvgMode = false;
532
+ }
533
+ else if (elm.tagName === 'foreignObject') {
534
+ // Reenter SVG context when we're exiting <foreignObject> element
535
+ isSvgMode = true;
536
+ }
537
+ }
538
+ }
539
+ {
540
+ elm['s-hn'] = hostTagName;
541
+ if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
542
+ // remember the content reference comment
543
+ elm['s-sr'] = true;
544
+ // remember the content reference comment
545
+ elm['s-cr'] = contentRef;
546
+ // remember the slot name, or empty string for default slot
547
+ elm['s-sn'] = newVNode.$name$ || '';
548
+ // check if we've got an old vnode for this slot
549
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
550
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
551
+ // we've got an old slot vnode and the wrapper is being replaced
552
+ // so let's move the old slot content back to it's original location
553
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
554
+ }
555
+ }
556
+ }
557
+ return elm;
558
+ };
559
+ const putBackInOriginalLocation = (parentElm, recursive) => {
560
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
561
+ const oldSlotChildNodes = parentElm.childNodes;
562
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
563
+ const childNode = oldSlotChildNodes[i];
564
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
565
+ // // this child node in the old element is from another component
566
+ // // remove this node from the old slot's parent
567
+ // childNode.remove();
568
+ // and relocate it back to it's original location
569
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
570
+ // remove the old original location comment entirely
571
+ // later on the patch function will know what to do
572
+ // and move this to the correct spot in need be
573
+ childNode['s-ol'].remove();
574
+ childNode['s-ol'] = undefined;
575
+ checkSlotRelocate = true;
576
+ }
577
+ if (recursive) {
578
+ putBackInOriginalLocation(childNode, recursive);
579
+ }
580
+ }
581
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
582
+ };
583
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
584
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
585
+ let childNode;
586
+ for (; startIdx <= endIdx; ++startIdx) {
587
+ if (vnodes[startIdx]) {
588
+ childNode = createElm(null, parentVNode, startIdx);
589
+ if (childNode) {
590
+ vnodes[startIdx].$elm$ = childNode;
591
+ containerElm.insertBefore(childNode, referenceNode(before) );
592
+ }
593
+ }
594
+ }
595
+ };
596
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
597
+ for (; startIdx <= endIdx; ++startIdx) {
598
+ if ((vnode = vnodes[startIdx])) {
599
+ elm = vnode.$elm$;
600
+ callNodeRefs(vnode);
601
+ {
602
+ // we're removing this element
603
+ // so it's possible we need to show slot fallback content now
604
+ checkSlotFallbackVisibility = true;
605
+ if (elm['s-ol']) {
606
+ // remove the original location comment
607
+ elm['s-ol'].remove();
608
+ }
609
+ else {
610
+ // it's possible that child nodes of the node
611
+ // that's being removed are slot nodes
612
+ putBackInOriginalLocation(elm, true);
613
+ }
614
+ }
615
+ // remove the vnode's element from the dom
616
+ elm.remove();
617
+ }
618
+ }
619
+ };
620
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
621
+ let oldStartIdx = 0;
622
+ let newStartIdx = 0;
623
+ let idxInOld = 0;
624
+ let i = 0;
625
+ let oldEndIdx = oldCh.length - 1;
626
+ let oldStartVnode = oldCh[0];
627
+ let oldEndVnode = oldCh[oldEndIdx];
628
+ let newEndIdx = newCh.length - 1;
629
+ let newStartVnode = newCh[0];
630
+ let newEndVnode = newCh[newEndIdx];
631
+ let node;
632
+ let elmToMove;
633
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
634
+ if (oldStartVnode == null) {
635
+ // Vnode might have been moved left
636
+ oldStartVnode = oldCh[++oldStartIdx];
637
+ }
638
+ else if (oldEndVnode == null) {
639
+ oldEndVnode = oldCh[--oldEndIdx];
640
+ }
641
+ else if (newStartVnode == null) {
642
+ newStartVnode = newCh[++newStartIdx];
643
+ }
644
+ else if (newEndVnode == null) {
645
+ newEndVnode = newCh[--newEndIdx];
646
+ }
647
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
648
+ patch(oldStartVnode, newStartVnode);
649
+ oldStartVnode = oldCh[++oldStartIdx];
650
+ newStartVnode = newCh[++newStartIdx];
651
+ }
652
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
653
+ patch(oldEndVnode, newEndVnode);
654
+ oldEndVnode = oldCh[--oldEndIdx];
655
+ newEndVnode = newCh[--newEndIdx];
656
+ }
657
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
658
+ // Vnode moved right
659
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
660
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
661
+ }
662
+ patch(oldStartVnode, newEndVnode);
663
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
664
+ oldStartVnode = oldCh[++oldStartIdx];
665
+ newEndVnode = newCh[--newEndIdx];
666
+ }
667
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
668
+ // Vnode moved left
669
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
670
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
671
+ }
672
+ patch(oldEndVnode, newStartVnode);
673
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
674
+ oldEndVnode = oldCh[--oldEndIdx];
675
+ newStartVnode = newCh[++newStartIdx];
676
+ }
677
+ else {
678
+ // createKeyToOldIdx
679
+ idxInOld = -1;
680
+ {
681
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
682
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
683
+ idxInOld = i;
684
+ break;
685
+ }
686
+ }
687
+ }
688
+ if (idxInOld >= 0) {
689
+ elmToMove = oldCh[idxInOld];
690
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
691
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
692
+ }
693
+ else {
694
+ patch(elmToMove, newStartVnode);
695
+ oldCh[idxInOld] = undefined;
696
+ node = elmToMove.$elm$;
697
+ }
698
+ newStartVnode = newCh[++newStartIdx];
699
+ }
700
+ else {
701
+ // new element
702
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
703
+ newStartVnode = newCh[++newStartIdx];
704
+ }
705
+ if (node) {
706
+ {
707
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
708
+ }
709
+ }
710
+ }
711
+ }
712
+ if (oldStartIdx > oldEndIdx) {
713
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
714
+ }
715
+ else if (newStartIdx > newEndIdx) {
716
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
717
+ }
718
+ };
719
+ const isSameVnode = (vnode1, vnode2) => {
720
+ // compare if two vnode to see if they're "technically" the same
721
+ // need to have the same element tag, and same key to be the same
722
+ if (vnode1.$tag$ === vnode2.$tag$) {
723
+ if (vnode1.$tag$ === 'slot') {
724
+ return vnode1.$name$ === vnode2.$name$;
725
+ }
726
+ {
727
+ return vnode1.$key$ === vnode2.$key$;
728
+ }
729
+ }
730
+ return false;
731
+ };
732
+ const referenceNode = (node) => {
733
+ // this node was relocated to a new location in the dom
734
+ // because of some other component's slot
735
+ // but we still have an html comment in place of where
736
+ // it's original location was according to it's original vdom
737
+ return (node && node['s-ol']) || node;
738
+ };
739
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
740
+ const patch = (oldVNode, newVNode) => {
741
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
742
+ const oldChildren = oldVNode.$children$;
743
+ const newChildren = newVNode.$children$;
744
+ const tag = newVNode.$tag$;
745
+ const text = newVNode.$text$;
746
+ let defaultHolder;
747
+ if (text === null) {
748
+ {
749
+ // test if we're rendering an svg element, or still rendering nodes inside of one
750
+ // only add this to the when the compiler sees we're using an svg somewhere
751
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
752
+ }
753
+ // element node
754
+ {
755
+ if (tag === 'slot')
756
+ ;
757
+ else {
758
+ // either this is the first render of an element OR it's an update
759
+ // AND we already know it's possible it could have changed
760
+ // this updates the element's css classes, attrs, props, listeners, etc.
761
+ updateElement(oldVNode, newVNode, isSvgMode);
762
+ }
763
+ }
764
+ if (oldChildren !== null && newChildren !== null) {
765
+ // looks like there's child vnodes for both the old and new vnodes
766
+ updateChildren(elm, oldChildren, newVNode, newChildren);
767
+ }
768
+ else if (newChildren !== null) {
769
+ // no old child vnodes, but there are new child vnodes to add
770
+ if (oldVNode.$text$ !== null) {
771
+ // the old vnode was text, so be sure to clear it out
772
+ elm.textContent = '';
773
+ }
774
+ // add the new vnode children
775
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
776
+ }
777
+ else if (oldChildren !== null) {
778
+ // no new child vnodes, but there are old child vnodes to remove
779
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
780
+ }
781
+ if (isSvgMode && tag === 'svg') {
782
+ isSvgMode = false;
783
+ }
784
+ }
785
+ else if ((defaultHolder = elm['s-cr'])) {
786
+ // this element has slotted content
787
+ defaultHolder.parentNode.textContent = text;
788
+ }
789
+ else if (oldVNode.$text$ !== text) {
790
+ // update the text content for the text only vnode
791
+ // and also only if the text is different than before
792
+ elm.data = text;
793
+ }
794
+ };
795
+ const updateFallbackSlotVisibility = (elm) => {
796
+ // tslint:disable-next-line: prefer-const
797
+ const childNodes = elm.childNodes;
798
+ let childNode;
799
+ let i;
800
+ let ilen;
801
+ let j;
802
+ let slotNameAttr;
803
+ let nodeType;
804
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
805
+ childNode = childNodes[i];
806
+ if (childNode.nodeType === 1 /* ElementNode */) {
807
+ if (childNode['s-sr']) {
808
+ // this is a slot fallback node
809
+ // get the slot name for this slot reference node
810
+ slotNameAttr = childNode['s-sn'];
811
+ // by default always show a fallback slot node
812
+ // then hide it if there are other slots in the light dom
813
+ childNode.hidden = false;
814
+ for (j = 0; j < ilen; j++) {
815
+ nodeType = childNodes[j].nodeType;
816
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
817
+ // this sibling node is from a different component OR is a named fallback slot node
818
+ if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
819
+ childNode.hidden = true;
820
+ break;
821
+ }
822
+ }
823
+ else {
824
+ // this is a default fallback slot node
825
+ // any element or text node (with content)
826
+ // should hide the default fallback slot node
827
+ if (nodeType === 1 /* ElementNode */ ||
828
+ (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
829
+ childNode.hidden = true;
830
+ break;
831
+ }
832
+ }
833
+ }
834
+ }
835
+ // keep drilling down
836
+ updateFallbackSlotVisibility(childNode);
837
+ }
838
+ }
839
+ };
840
+ const relocateNodes = [];
841
+ const relocateSlotContent = (elm) => {
842
+ // tslint:disable-next-line: prefer-const
843
+ let childNode;
844
+ let node;
845
+ let hostContentNodes;
846
+ let slotNameAttr;
847
+ let relocateNodeData;
848
+ let j;
849
+ let i = 0;
850
+ const childNodes = elm.childNodes;
851
+ const ilen = childNodes.length;
852
+ for (; i < ilen; i++) {
853
+ childNode = childNodes[i];
854
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
855
+ // first got the content reference comment node
856
+ // then we got it's parent, which is where all the host content is in now
857
+ hostContentNodes = node.parentNode.childNodes;
858
+ slotNameAttr = childNode['s-sn'];
859
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
860
+ node = hostContentNodes[j];
861
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
862
+ // let's do some relocating to its new home
863
+ // but never relocate a content reference node
864
+ // that is suppose to always represent the original content location
865
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
866
+ // it's possible we've already decided to relocate this node
867
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
868
+ // made some changes to slots
869
+ // let's make sure we also double check
870
+ // fallbacks are correctly hidden or shown
871
+ checkSlotFallbackVisibility = true;
872
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
873
+ if (relocateNodeData) {
874
+ // previously we never found a slot home for this node
875
+ // but turns out we did, so let's remember it now
876
+ relocateNodeData.$slotRefNode$ = childNode;
877
+ }
878
+ else {
879
+ // add to our list of nodes to relocate
880
+ relocateNodes.push({
881
+ $slotRefNode$: childNode,
882
+ $nodeToRelocate$: node,
883
+ });
884
+ }
885
+ if (node['s-sr']) {
886
+ relocateNodes.map((relocateNode) => {
887
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
888
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
889
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
890
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
891
+ }
892
+ }
893
+ });
894
+ }
895
+ }
896
+ else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
897
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
898
+ // if we never find a home for this element then we'll need to hide it
899
+ relocateNodes.push({
900
+ $nodeToRelocate$: node,
901
+ });
902
+ }
903
+ }
904
+ }
905
+ }
906
+ if (childNode.nodeType === 1 /* ElementNode */) {
907
+ relocateSlotContent(childNode);
908
+ }
909
+ }
910
+ };
911
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
912
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
913
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
914
+ return true;
915
+ }
916
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
917
+ return true;
918
+ }
919
+ return false;
920
+ }
921
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
922
+ return true;
923
+ }
924
+ return slotNameAttr === '';
925
+ };
926
+ const callNodeRefs = (vNode) => {
927
+ {
928
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
929
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
930
+ }
931
+ };
932
+ const renderVdom = (hostRef, renderFnResults) => {
933
+ const hostElm = hostRef.$hostElement$;
934
+ const cmpMeta = hostRef.$cmpMeta$;
935
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
936
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
937
+ hostTagName = hostElm.tagName;
938
+ if (cmpMeta.$attrsToReflect$) {
939
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
940
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
941
+ }
942
+ rootVnode.$tag$ = null;
943
+ rootVnode.$flags$ |= 4 /* isHost */;
944
+ hostRef.$vnode$ = rootVnode;
945
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
946
+ {
947
+ contentRef = hostElm['s-cr'];
948
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
949
+ // always reset
950
+ checkSlotFallbackVisibility = false;
951
+ }
952
+ // synchronous patch
953
+ patch(oldVNode, rootVnode);
954
+ {
955
+ // while we're moving nodes around existing nodes, temporarily disable
956
+ // the disconnectCallback from working
957
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
958
+ if (checkSlotRelocate) {
959
+ relocateSlotContent(rootVnode.$elm$);
960
+ let relocateData;
961
+ let nodeToRelocate;
962
+ let orgLocationNode;
963
+ let parentNodeRef;
964
+ let insertBeforeNode;
965
+ let refNode;
966
+ let i = 0;
967
+ for (; i < relocateNodes.length; i++) {
968
+ relocateData = relocateNodes[i];
969
+ nodeToRelocate = relocateData.$nodeToRelocate$;
970
+ if (!nodeToRelocate['s-ol']) {
971
+ // add a reference node marking this node's original location
972
+ // keep a reference to this node for later lookups
973
+ orgLocationNode =
974
+ doc.createTextNode('');
975
+ orgLocationNode['s-nr'] = nodeToRelocate;
976
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
977
+ }
978
+ }
979
+ for (i = 0; i < relocateNodes.length; i++) {
980
+ relocateData = relocateNodes[i];
981
+ nodeToRelocate = relocateData.$nodeToRelocate$;
982
+ if (relocateData.$slotRefNode$) {
983
+ // by default we're just going to insert it directly
984
+ // after the slot reference node
985
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
986
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
987
+ orgLocationNode = nodeToRelocate['s-ol'];
988
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
989
+ refNode = orgLocationNode['s-nr'];
990
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
991
+ refNode = refNode.nextSibling;
992
+ if (!refNode || !refNode['s-nr']) {
993
+ insertBeforeNode = refNode;
994
+ break;
995
+ }
996
+ }
997
+ }
998
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
999
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
1000
+ // we've checked that it's worth while to relocate
1001
+ // since that the node to relocate
1002
+ // has a different next sibling or parent relocated
1003
+ if (nodeToRelocate !== insertBeforeNode) {
1004
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1005
+ // probably a component in the index.html that doesn't have it's hostname set
1006
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1007
+ }
1008
+ // add it back to the dom but in its new home
1009
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1010
+ }
1011
+ }
1012
+ }
1013
+ else {
1014
+ // this node doesn't have a slot home to go to, so let's hide it
1015
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1016
+ nodeToRelocate.hidden = true;
1017
+ }
1018
+ }
1019
+ }
1020
+ }
1021
+ if (checkSlotFallbackVisibility) {
1022
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1023
+ }
1024
+ // done moving nodes around
1025
+ // allow the disconnect callback to work again
1026
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
1027
+ // always reset
1028
+ relocateNodes.length = 0;
1029
+ }
1030
+ };
1031
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
1032
+ const createEvent = (ref, name, flags) => {
1033
+ const elm = getElement(ref);
1034
+ return {
1035
+ emit: (detail) => {
1036
+ return emitEvent(elm, name, {
1037
+ bubbles: !!(flags & 4 /* Bubbles */),
1038
+ composed: !!(flags & 2 /* Composed */),
1039
+ cancelable: !!(flags & 1 /* Cancellable */),
1040
+ detail,
1041
+ });
1042
+ },
1043
+ };
1044
+ };
1045
+ /**
1046
+ * Helper function to create & dispatch a custom Event on a provided target
1047
+ * @param elm the target of the Event
1048
+ * @param name the name to give the custom Event
1049
+ * @param opts options for configuring a custom Event
1050
+ * @returns the custom Event
1051
+ */
1052
+ const emitEvent = (elm, name, opts) => {
1053
+ const ev = plt.ce(name, opts);
1054
+ elm.dispatchEvent(ev);
1055
+ return ev;
1056
+ };
1057
+ const attachToAncestor = (hostRef, ancestorComponent) => {
1058
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1059
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1060
+ }
1061
+ };
1062
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
1063
+ {
1064
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1065
+ }
1066
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1067
+ hostRef.$flags$ |= 512 /* needsRerender */;
1068
+ return;
1069
+ }
1070
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1071
+ // there is no ancestor component or the ancestor component
1072
+ // has already fired off its lifecycle update then
1073
+ // fire off the initial update
1074
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1075
+ return writeTask(dispatch) ;
1076
+ };
1077
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1078
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1079
+ const instance = hostRef.$lazyInstance$ ;
1080
+ let promise;
1081
+ if (isInitialLoad) {
1082
+ {
1083
+ hostRef.$flags$ |= 256 /* isListenReady */;
1084
+ if (hostRef.$queuedListeners$) {
1085
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1086
+ hostRef.$queuedListeners$ = null;
1087
+ }
1088
+ }
1089
+ {
1090
+ promise = safeCall(instance, 'componentWillLoad');
1091
+ }
1092
+ }
1093
+ {
1094
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1095
+ }
1096
+ endSchedule();
1097
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1098
+ };
1099
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1100
+ // updateComponent
1101
+ const elm = hostRef.$hostElement$;
1102
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1103
+ const rc = elm['s-rc'];
1104
+ if (isInitialLoad) {
1105
+ // DOM WRITE!
1106
+ attachStyles(hostRef);
1107
+ }
1108
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1109
+ {
1110
+ callRender(hostRef, instance);
1111
+ }
1112
+ if (plt.$cssShim$) {
1113
+ plt.$cssShim$.updateHost(elm);
1114
+ }
1115
+ if (rc) {
1116
+ // ok, so turns out there are some child host elements
1117
+ // waiting on this parent element to load
1118
+ // let's fire off all update callbacks waiting
1119
+ rc.map((cb) => cb());
1120
+ elm['s-rc'] = undefined;
1121
+ }
1122
+ endRender();
1123
+ endUpdate();
1124
+ {
1125
+ const childrenPromises = elm['s-p'];
1126
+ const postUpdate = () => postUpdateComponent(hostRef);
1127
+ if (childrenPromises.length === 0) {
1128
+ postUpdate();
1129
+ }
1130
+ else {
1131
+ Promise.all(childrenPromises).then(postUpdate);
1132
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1133
+ childrenPromises.length = 0;
1134
+ }
1135
+ }
1136
+ };
1137
+ const callRender = (hostRef, instance, elm) => {
1138
+ try {
1139
+ renderingRef = instance;
1140
+ instance = instance.render && instance.render();
1141
+ {
1142
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1143
+ }
1144
+ {
1145
+ hostRef.$flags$ |= 2 /* hasRendered */;
1146
+ }
1147
+ {
1148
+ {
1149
+ // looks like we've got child nodes to render into this host element
1150
+ // or we need to update the css class/attrs on the host element
1151
+ // DOM WRITE!
1152
+ {
1153
+ renderVdom(hostRef, instance);
1154
+ }
1155
+ }
1156
+ }
1157
+ }
1158
+ catch (e) {
1159
+ consoleError(e, hostRef.$hostElement$);
1160
+ }
1161
+ renderingRef = null;
1162
+ return null;
1163
+ };
1164
+ const getRenderingRef = () => renderingRef;
1165
+ const postUpdateComponent = (hostRef) => {
1166
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1167
+ const elm = hostRef.$hostElement$;
1168
+ const endPostUpdate = createTime('postUpdate', tagName);
1169
+ const instance = hostRef.$lazyInstance$ ;
1170
+ const ancestorComponent = hostRef.$ancestorComponent$;
1171
+ {
1172
+ safeCall(instance, 'componentDidRender');
1173
+ }
1174
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1175
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1176
+ {
1177
+ // DOM WRITE!
1178
+ addHydratedFlag(elm);
1179
+ }
1180
+ {
1181
+ safeCall(instance, 'componentDidLoad');
1182
+ }
1183
+ endPostUpdate();
1184
+ {
1185
+ hostRef.$onReadyResolve$(elm);
1186
+ if (!ancestorComponent) {
1187
+ appDidLoad();
1188
+ }
1189
+ }
1190
+ }
1191
+ else {
1192
+ endPostUpdate();
1193
+ }
1194
+ {
1195
+ hostRef.$onInstanceResolve$(elm);
1196
+ }
1197
+ // load events fire from bottom to top
1198
+ // the deepest elements load first then bubbles up
1199
+ {
1200
+ if (hostRef.$onRenderResolve$) {
1201
+ hostRef.$onRenderResolve$();
1202
+ hostRef.$onRenderResolve$ = undefined;
1203
+ }
1204
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
1205
+ nextTick(() => scheduleUpdate(hostRef, false));
1206
+ }
1207
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1208
+ }
1209
+ // ( •_•)
1210
+ // ( •_•)>⌐■-■
1211
+ // (⌐■_■)
1212
+ };
1213
+ const forceUpdate = (ref) => {
1214
+ {
1215
+ const hostRef = getHostRef(ref);
1216
+ const isConnected = hostRef.$hostElement$.isConnected;
1217
+ if (isConnected &&
1218
+ (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1219
+ scheduleUpdate(hostRef, false);
1220
+ }
1221
+ // Returns "true" when the forced update was successfully scheduled
1222
+ return isConnected;
1223
+ }
1224
+ };
1225
+ const appDidLoad = (who) => {
1226
+ // on appload
1227
+ // we have finish the first big initial render
1228
+ {
1229
+ addHydratedFlag(doc.documentElement);
1230
+ }
1231
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1232
+ };
1233
+ const safeCall = (instance, method, arg) => {
1234
+ if (instance && instance[method]) {
1235
+ try {
1236
+ return instance[method](arg);
1237
+ }
1238
+ catch (e) {
1239
+ consoleError(e);
1240
+ }
1241
+ }
1242
+ return undefined;
1243
+ };
1244
+ const then = (promise, thenFn) => {
1245
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1246
+ };
1247
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1248
+ ;
1249
+ /**
1250
+ * Parse a new property value for a given property type.
1251
+ *
1252
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1253
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1254
+ * 1. `any`, the type given to `propValue` in the function signature
1255
+ * 2. the type stored from `propType`.
1256
+ *
1257
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1258
+ *
1259
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1260
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1261
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1262
+ * ```tsx
1263
+ * <my-cmp prop-val={0}></my-cmp>
1264
+ * ```
1265
+ *
1266
+ * HTML prop values on the other hand, will always a string
1267
+ *
1268
+ * @param propValue the new value to coerce to some type
1269
+ * @param propType the type of the prop, expressed as a binary number
1270
+ * @returns the parsed/coerced value
1271
+ */
1272
+ const parsePropertyValue = (propValue, propType) => {
1273
+ // ensure this value is of the correct prop type
1274
+ if (propValue != null && !isComplexType(propValue)) {
1275
+ if (propType & 4 /* Boolean */) {
1276
+ // per the HTML spec, any string value means it is a boolean true value
1277
+ // but we'll cheat here and say that the string "false" is the boolean false
1278
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
1279
+ }
1280
+ if (propType & 2 /* Number */) {
1281
+ // force it to be a number
1282
+ return parseFloat(propValue);
1283
+ }
1284
+ if (propType & 1 /* String */) {
1285
+ // could have been passed as a number or boolean
1286
+ // but we still want it as a string
1287
+ return String(propValue);
1288
+ }
1289
+ // redundant return here for better minification
1290
+ return propValue;
1291
+ }
1292
+ // not sure exactly what type we want
1293
+ // so no need to change to a different type
1294
+ return propValue;
1295
+ };
1296
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1297
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1298
+ // check our new property value against our internal value
1299
+ const hostRef = getHostRef(ref);
1300
+ const elm = hostRef.$hostElement$ ;
1301
+ const oldVal = hostRef.$instanceValues$.get(propName);
1302
+ const flags = hostRef.$flags$;
1303
+ const instance = hostRef.$lazyInstance$ ;
1304
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1305
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1306
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1307
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1308
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1309
+ // gadzooks! the property's value has changed!!
1310
+ // set our new value!
1311
+ hostRef.$instanceValues$.set(propName, newVal);
1312
+ if (instance) {
1313
+ // get an array of method names of watch functions to call
1314
+ if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1315
+ const watchMethods = cmpMeta.$watchers$[propName];
1316
+ if (watchMethods) {
1317
+ // this instance is watching for when this property changed
1318
+ watchMethods.map((watchMethodName) => {
1319
+ try {
1320
+ // fire off each of the watch methods that are watching this property
1321
+ instance[watchMethodName](newVal, oldVal, propName);
1322
+ }
1323
+ catch (e) {
1324
+ consoleError(e, elm);
1325
+ }
1326
+ });
1327
+ }
1328
+ }
1329
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1330
+ // looks like this value actually changed, so we've got work to do!
1331
+ // but only if we've already rendered, otherwise just chill out
1332
+ // queue that we need to do an update, but don't worry about queuing
1333
+ // up millions cuz this function ensures it only runs once
1334
+ scheduleUpdate(hostRef, false);
1335
+ }
1336
+ }
1337
+ }
1338
+ };
1339
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1340
+ if (cmpMeta.$members$) {
1341
+ if (Cstr.watchers) {
1342
+ cmpMeta.$watchers$ = Cstr.watchers;
1343
+ }
1344
+ // It's better to have a const than two Object.entries()
1345
+ const members = Object.entries(cmpMeta.$members$);
1346
+ const prototype = Cstr.prototype;
1347
+ members.map(([memberName, [memberFlags]]) => {
1348
+ if ((memberFlags & 31 /* Prop */ ||
1349
+ ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1350
+ // proxyComponent - prop
1351
+ Object.defineProperty(prototype, memberName, {
1352
+ get() {
1353
+ // proxyComponent, get value
1354
+ return getValue(this, memberName);
1355
+ },
1356
+ set(newValue) {
1357
+ // proxyComponent, set value
1358
+ setValue(this, memberName, newValue, cmpMeta);
1359
+ },
1360
+ configurable: true,
1361
+ enumerable: true,
1362
+ });
1363
+ }
1364
+ else if (flags & 1 /* isElementConstructor */ &&
1365
+ memberFlags & 64 /* Method */) {
1366
+ // proxyComponent - method
1367
+ Object.defineProperty(prototype, memberName, {
1368
+ value(...args) {
1369
+ const ref = getHostRef(this);
1370
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
1371
+ },
1372
+ });
1373
+ }
1374
+ });
1375
+ if ((flags & 1 /* isElementConstructor */)) {
1376
+ const attrNameToPropName = new Map();
1377
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1378
+ plt.jmp(() => {
1379
+ const propName = attrNameToPropName.get(attrName);
1380
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1381
+ // in the case where an attribute was set inline.
1382
+ // ```html
1383
+ // <my-component some-attribute="some-value"></my-component>
1384
+ // ```
1385
+ //
1386
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1387
+ // programmatically changes it before it has been upgraded as shown below:
1388
+ //
1389
+ // ```html
1390
+ // <!-- this component has _not_ been upgraded yet -->
1391
+ // <my-component id="test" some-attribute="some-value"></my-component>
1392
+ // <script>
1393
+ // // grab non-upgraded component
1394
+ // el = document.querySelector("#test");
1395
+ // el.someAttribute = "another-value";
1396
+ // // upgrade component
1397
+ // customElements.define('my-component', MyComponent);
1398
+ // </script>
1399
+ // ```
1400
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1401
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1402
+ // to the value that was set inline i.e. "some-value" from above example. When
1403
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1404
+ //
1405
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1406
+ // by connectedCallback as this attributeChangedCallback will not fire.
1407
+ //
1408
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1409
+ //
1410
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1411
+ // properties here given that this goes against best practices outlined here
1412
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1413
+ if (this.hasOwnProperty(propName)) {
1414
+ newValue = this[propName];
1415
+ delete this[propName];
1416
+ }
1417
+ else if (prototype.hasOwnProperty(propName) &&
1418
+ typeof this[propName] === 'number' &&
1419
+ this[propName] == newValue) {
1420
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1421
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1422
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1423
+ return;
1424
+ }
1425
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1426
+ });
1427
+ };
1428
+ // create an array of attributes to observe
1429
+ // and also create a map of html attribute name to js property name
1430
+ Cstr.observedAttributes = members
1431
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1432
+ .map(([propName, m]) => {
1433
+ const attrName = m[1] || propName;
1434
+ attrNameToPropName.set(attrName, propName);
1435
+ if (m[0] & 512 /* ReflectAttr */) {
1436
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1437
+ }
1438
+ return attrName;
1439
+ });
1440
+ }
1441
+ }
1442
+ return Cstr;
1443
+ };
1444
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1445
+ // initializeComponent
1446
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1447
+ {
1448
+ // we haven't initialized this element yet
1449
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1450
+ // lazy loaded components
1451
+ // request the component's implementation to be
1452
+ // wired up with the host element
1453
+ Cstr = loadModule(cmpMeta);
1454
+ if (Cstr.then) {
1455
+ // Await creates a micro-task avoid if possible
1456
+ const endLoad = uniqueTime();
1457
+ Cstr = await Cstr;
1458
+ endLoad();
1459
+ }
1460
+ if (!Cstr.isProxied) {
1461
+ // we've never proxied this Constructor before
1462
+ // let's add the getters/setters to its prototype before
1463
+ // the first time we create an instance of the implementation
1464
+ {
1465
+ cmpMeta.$watchers$ = Cstr.watchers;
1466
+ }
1467
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1468
+ Cstr.isProxied = true;
1469
+ }
1470
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1471
+ // ok, time to construct the instance
1472
+ // but let's keep track of when we start and stop
1473
+ // so that the getters/setters don't incorrectly step on data
1474
+ {
1475
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1476
+ }
1477
+ // construct the lazy-loaded component implementation
1478
+ // passing the hostRef is very important during
1479
+ // construction in order to directly wire together the
1480
+ // host element and the lazy-loaded instance
1481
+ try {
1482
+ new Cstr(hostRef);
1483
+ }
1484
+ catch (e) {
1485
+ consoleError(e);
1486
+ }
1487
+ {
1488
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1489
+ }
1490
+ {
1491
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1492
+ }
1493
+ endNewInstance();
1494
+ fireConnectedCallback(hostRef.$lazyInstance$);
1495
+ }
1496
+ if (Cstr.style) {
1497
+ // this component has styles but we haven't registered them yet
1498
+ let style = Cstr.style;
1499
+ const scopeId = getScopeId(cmpMeta);
1500
+ if (!styles.has(scopeId)) {
1501
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1502
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1503
+ endRegisterStyles();
1504
+ }
1505
+ }
1506
+ }
1507
+ // we've successfully created a lazy instance
1508
+ const ancestorComponent = hostRef.$ancestorComponent$;
1509
+ const schedule = () => scheduleUpdate(hostRef, true);
1510
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1511
+ // this is the initial load and this component it has an ancestor component
1512
+ // but the ancestor component has NOT fired its will update lifecycle yet
1513
+ // so let's just cool our jets and wait for the ancestor to continue first
1514
+ // this will get fired off when the ancestor component
1515
+ // finally gets around to rendering its lazy self
1516
+ // fire off the initial update
1517
+ ancestorComponent['s-rc'].push(schedule);
1518
+ }
1519
+ else {
1520
+ schedule();
1521
+ }
1522
+ };
1523
+ const fireConnectedCallback = (instance) => {
1524
+ {
1525
+ safeCall(instance, 'connectedCallback');
1526
+ }
1527
+ };
1528
+ const connectedCallback = (elm) => {
1529
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1530
+ const hostRef = getHostRef(elm);
1531
+ const cmpMeta = hostRef.$cmpMeta$;
1532
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1533
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1534
+ // first time this component has connected
1535
+ hostRef.$flags$ |= 1 /* hasConnected */;
1536
+ {
1537
+ // initUpdate
1538
+ // if the slot polyfill is required we'll need to put some nodes
1539
+ // in here to act as original content anchors as we move nodes around
1540
+ // host element has been connected to the DOM
1541
+ if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1542
+ setContentReference(elm);
1543
+ }
1544
+ }
1545
+ {
1546
+ // find the first ancestor component (if there is one) and register
1547
+ // this component as one of the actively loading child components for its ancestor
1548
+ let ancestorComponent = elm;
1549
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1550
+ // climb up the ancestors looking for the first
1551
+ // component that hasn't finished its lifecycle update yet
1552
+ if (ancestorComponent['s-p']) {
1553
+ // we found this components first ancestor component
1554
+ // keep a reference to this component's ancestor component
1555
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1556
+ break;
1557
+ }
1558
+ }
1559
+ }
1560
+ // Lazy properties
1561
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1562
+ if (cmpMeta.$members$) {
1563
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1564
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1565
+ const value = elm[memberName];
1566
+ delete elm[memberName];
1567
+ elm[memberName] = value;
1568
+ }
1569
+ });
1570
+ }
1571
+ {
1572
+ // connectedCallback, taskQueue, initialLoad
1573
+ // angular sets attribute AFTER connectCallback
1574
+ // https://github.com/angular/angular/issues/18909
1575
+ // https://github.com/angular/angular/issues/19940
1576
+ nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
1577
+ }
1578
+ }
1579
+ else {
1580
+ // not the first time this has connected
1581
+ // reattach any event listeners to the host
1582
+ // since they would have been removed when disconnected
1583
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1584
+ // fire off connectedCallback() on component instance
1585
+ fireConnectedCallback(hostRef.$lazyInstance$);
1586
+ }
1587
+ endConnected();
1588
+ }
1589
+ };
1590
+ const setContentReference = (elm) => {
1591
+ // only required when we're NOT using native shadow dom (slot)
1592
+ // or this browser doesn't support native shadow dom
1593
+ // and this host element was NOT created with SSR
1594
+ // let's pick out the inner content for slot projection
1595
+ // create a node to represent where the original
1596
+ // content was first placed, which is useful later on
1597
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1598
+ contentRefElm['s-cn'] = true;
1599
+ elm.insertBefore(contentRefElm, elm.firstChild);
1600
+ };
1601
+ const disconnectedCallback = (elm) => {
1602
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1603
+ const hostRef = getHostRef(elm);
1604
+ const instance = hostRef.$lazyInstance$ ;
1605
+ {
1606
+ if (hostRef.$rmListeners$) {
1607
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1608
+ hostRef.$rmListeners$ = undefined;
1609
+ }
1610
+ }
1611
+ // clear CSS var-shim tracking
1612
+ if (plt.$cssShim$) {
1613
+ plt.$cssShim$.removeHost(elm);
1614
+ }
1615
+ {
1616
+ safeCall(instance, 'disconnectedCallback');
1617
+ }
1618
+ }
1619
+ };
1620
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1621
+ const endBootstrap = createTime();
1622
+ const cmpTags = [];
1623
+ const exclude = options.exclude || [];
1624
+ const customElements = win.customElements;
1625
+ const head = doc.head;
1626
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1627
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1628
+ const deferredConnectedCallbacks = [];
1629
+ let appLoadFallback;
1630
+ let isBootstrapping = true;
1631
+ Object.assign(plt, options);
1632
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1633
+ lazyBundles.map((lazyBundle) => {
1634
+ lazyBundle[1].map((compactMeta) => {
1635
+ const cmpMeta = {
1636
+ $flags$: compactMeta[0],
1637
+ $tagName$: compactMeta[1],
1638
+ $members$: compactMeta[2],
1639
+ $listeners$: compactMeta[3],
1640
+ };
1641
+ {
1642
+ cmpMeta.$members$ = compactMeta[2];
1643
+ }
1644
+ {
1645
+ cmpMeta.$listeners$ = compactMeta[3];
1646
+ }
1647
+ {
1648
+ cmpMeta.$attrsToReflect$ = [];
1649
+ }
1650
+ {
1651
+ cmpMeta.$watchers$ = {};
1652
+ }
1653
+ const tagName = cmpMeta.$tagName$;
1654
+ const HostElement = class extends HTMLElement {
1655
+ // StencilLazyHost
1656
+ constructor(self) {
1657
+ // @ts-ignore
1658
+ super(self);
1659
+ self = this;
1660
+ registerHost(self, cmpMeta);
1661
+ }
1662
+ connectedCallback() {
1663
+ if (appLoadFallback) {
1664
+ clearTimeout(appLoadFallback);
1665
+ appLoadFallback = null;
1666
+ }
1667
+ if (isBootstrapping) {
1668
+ // connectedCallback will be processed once all components have been registered
1669
+ deferredConnectedCallbacks.push(this);
1670
+ }
1671
+ else {
1672
+ plt.jmp(() => connectedCallback(this));
1673
+ }
1674
+ }
1675
+ disconnectedCallback() {
1676
+ plt.jmp(() => disconnectedCallback(this));
1677
+ }
1678
+ componentOnReady() {
1679
+ return getHostRef(this).$onReadyPromise$;
1680
+ }
1681
+ };
1682
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1683
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1684
+ cmpTags.push(tagName);
1685
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1686
+ }
1687
+ });
1688
+ });
1689
+ {
1690
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1691
+ visibilityStyle.setAttribute('data-styles', '');
1692
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1693
+ }
1694
+ // Process deferred connectedCallbacks now all components have been registered
1695
+ isBootstrapping = false;
1696
+ if (deferredConnectedCallbacks.length) {
1697
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1698
+ }
1699
+ else {
1700
+ {
1701
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1702
+ }
1703
+ }
1704
+ // Fallback appLoad event
1705
+ endBootstrap();
1706
+ };
1707
+ const hostRefs = new WeakMap();
1708
+ const getHostRef = (ref) => hostRefs.get(ref);
1709
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1710
+ const registerHost = (elm, cmpMeta) => {
1711
+ const hostRef = {
1712
+ $flags$: 0,
1713
+ $hostElement$: elm,
1714
+ $cmpMeta$: cmpMeta,
1715
+ $instanceValues$: new Map(),
1716
+ };
1717
+ {
1718
+ hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
1719
+ }
1720
+ {
1721
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1722
+ elm['s-p'] = [];
1723
+ elm['s-rc'] = [];
1724
+ }
1725
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1726
+ return hostRefs.set(elm, hostRef);
1727
+ };
1728
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1729
+ const consoleError = (e, el) => (0, console.error)(e, el);
1730
+ const cmpModules = /*@__PURE__*/ new Map();
1731
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1732
+ // loadModuleImport
1733
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1734
+ const bundleId = cmpMeta.$lazyBundleId$;
1735
+ const module = cmpModules.get(bundleId) ;
1736
+ if (module) {
1737
+ return module[exportName];
1738
+ }
1739
+
1740
+ if (!hmrVersionId || !BUILD.hotModuleReplacement) {
1741
+ const processMod = importedModule => {
1742
+ cmpModules.set(bundleId, importedModule);
1743
+ return importedModule[exportName];
1744
+ }
1745
+ switch(bundleId) {
1746
+
1747
+ case 'revo-grid_11':
1748
+ return import(
1749
+ /* webpackMode: "lazy" */
1750
+ './revo-grid_11.entry.js').then(processMod, consoleError);
1751
+ case 'revogr-clipboard':
1752
+ return import(
1753
+ /* webpackMode: "lazy" */
1754
+ './revogr-clipboard.entry.js').then(processMod, consoleError);
1755
+ case 'revogr-filter-panel':
1756
+ return import(
1757
+ /* webpackMode: "lazy" */
1758
+ './revogr-filter-panel.entry.js').then(processMod, consoleError);
1759
+ }
1760
+ }
1761
+ return import(
1762
+ /* @vite-ignore */
1763
+ /* webpackInclude: /\.entry\.js$/ */
1764
+ /* webpackExclude: /\.system\.entry\.js$/ */
1765
+ /* webpackMode: "lazy" */
1766
+ `./${bundleId}.entry.js${''}`).then((importedModule) => {
1767
+ {
1768
+ cmpModules.set(bundleId, importedModule);
1769
+ }
1770
+ return importedModule[exportName];
1771
+ }, consoleError);
1772
+ };
1773
+ const styles = new Map();
1774
+ const queueDomReads = [];
1775
+ const queueDomWrites = [];
1776
+ const queueTask = (queue, write) => (cb) => {
1777
+ queue.push(cb);
1778
+ if (!queuePending) {
1779
+ queuePending = true;
1780
+ if (write && plt.$flags$ & 4 /* queueSync */) {
1781
+ nextTick(flush);
1782
+ }
1783
+ else {
1784
+ plt.raf(flush);
1785
+ }
1786
+ }
1787
+ };
1788
+ const consume = (queue) => {
1789
+ for (let i = 0; i < queue.length; i++) {
1790
+ try {
1791
+ queue[i](performance.now());
1792
+ }
1793
+ catch (e) {
1794
+ consoleError(e);
1795
+ }
1796
+ }
1797
+ queue.length = 0;
1798
+ };
1799
+ const flush = () => {
1800
+ // always force a bunch of medium callbacks to run, but still have
1801
+ // a throttle on how many can run in a certain time
1802
+ // DOM READS!!!
1803
+ consume(queueDomReads);
1804
+ // DOM WRITES!!!
1805
+ {
1806
+ consume(queueDomWrites);
1807
+ if ((queuePending = queueDomReads.length > 0)) {
1808
+ // still more to do yet, but we've run out of time
1809
+ // let's let this thing cool off and try again in the next tick
1810
+ plt.raf(flush);
1811
+ }
1812
+ }
1813
+ };
1814
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1815
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1816
+
1817
+ export { CSS as C, Host as H, NAMESPACE as N, promiseResolve as a, bootstrapLazy as b, createEvent as c, doc as d, getElement as e, forceUpdate as f, getRenderingRef as g, h, plt as p, registerInstance as r, win as w };