@verdocs/web-sdk 1.0.15 → 1.0.19

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