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