cmdesigns 0.0.1

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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/cm-text_2.cjs.entry.js +32 -0
  3. package/dist/cjs/cmdesigns.cjs.js +19 -0
  4. package/dist/cjs/index-77fd923d.js +797 -0
  5. package/dist/cjs/index.cjs.js +2 -0
  6. package/dist/cjs/loader.cjs.js +21 -0
  7. package/dist/cmdesigns/cmdesigns.esm.js +1 -0
  8. package/dist/cmdesigns/index.esm.js +0 -0
  9. package/dist/cmdesigns/p-41d106c8.js +2 -0
  10. package/dist/cmdesigns/p-f6aeaa48.entry.js +1 -0
  11. package/dist/collection/collection-manifest.json +13 -0
  12. package/dist/collection/components/cm-text/cm-text.css +13 -0
  13. package/dist/collection/components/cm-text/cm-text.js +18 -0
  14. package/dist/collection/components/fg-text/fg-text.css +14 -0
  15. package/dist/collection/components/fg-text/fg-text.js +18 -0
  16. package/dist/collection/index.js +1 -0
  17. package/dist/components/cm-text.d.ts +11 -0
  18. package/dist/components/cm-text.js +33 -0
  19. package/dist/components/fg-text.d.ts +11 -0
  20. package/dist/components/fg-text.js +33 -0
  21. package/dist/components/index.d.ts +23 -0
  22. package/dist/components/index.js +3 -0
  23. package/dist/esm/cm-text_2.entry.js +27 -0
  24. package/dist/esm/cmdesigns.js +17 -0
  25. package/dist/esm/index-a877cbd8.js +772 -0
  26. package/dist/esm/index.js +1 -0
  27. package/dist/esm/loader.js +17 -0
  28. package/dist/esm/polyfills/core-js.js +11 -0
  29. package/dist/esm/polyfills/css-shim.js +1 -0
  30. package/dist/esm/polyfills/dom.js +79 -0
  31. package/dist/esm/polyfills/es5-html-element.js +1 -0
  32. package/dist/esm/polyfills/index.js +34 -0
  33. package/dist/esm/polyfills/system.js +6 -0
  34. package/dist/index.cjs.js +1 -0
  35. package/dist/index.js +1 -0
  36. package/dist/types/components/cm-text/cm-text.d.ts +3 -0
  37. package/dist/types/components/fg-text/fg-text.d.ts +3 -0
  38. package/dist/types/components.d.ts +50 -0
  39. package/dist/types/index.d.ts +1 -0
  40. package/dist/types/stencil-public-runtime.d.ts +1581 -0
  41. package/loader/cdn.js +3 -0
  42. package/loader/index.cjs.js +3 -0
  43. package/loader/index.d.ts +12 -0
  44. package/loader/index.es2017.js +3 -0
  45. package/loader/index.js +4 -0
  46. package/loader/package.json +11 -0
  47. package/package.json +38 -0
  48. package/readme.md +75 -0
@@ -0,0 +1,797 @@
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 = 'cmdesigns';
24
+
25
+ /**
26
+ * Virtual DOM patching algorithm based on Snabbdom by
27
+ * Simon Friis Vindum (@paldepind)
28
+ * Licensed under the MIT License
29
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
30
+ *
31
+ * Modified for Stencil's renderer and slot projection
32
+ */
33
+ let scopeId;
34
+ let hostTagName;
35
+ let queuePending = false;
36
+ const createTime = (fnName, tagName = '') => {
37
+ {
38
+ return () => {
39
+ return;
40
+ };
41
+ }
42
+ };
43
+ const uniqueTime = (key, measureText) => {
44
+ {
45
+ return () => {
46
+ return;
47
+ };
48
+ }
49
+ };
50
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
51
+ /**
52
+ * Default style mode id
53
+ */
54
+ /**
55
+ * Reusable empty obj/array
56
+ * Don't add values to these!!
57
+ */
58
+ const EMPTY_OBJ = {};
59
+ const isDef = (v) => v != null;
60
+ const isComplexType = (o) => {
61
+ // https://jsperf.com/typeof-fn-object/5
62
+ o = typeof o;
63
+ return o === 'object' || o === 'function';
64
+ };
65
+ /**
66
+ * Production h() function based on Preact by
67
+ * Jason Miller (@developit)
68
+ * Licensed under the MIT License
69
+ * https://github.com/developit/preact/blob/master/LICENSE
70
+ *
71
+ * Modified for Stencil's compiler and vdom
72
+ */
73
+ // const stack: any[] = [];
74
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
75
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
76
+ const h = (nodeName, vnodeData, ...children) => {
77
+ let child = null;
78
+ let simple = false;
79
+ let lastSimple = false;
80
+ const vNodeChildren = [];
81
+ const walk = (c) => {
82
+ for (let i = 0; i < c.length; i++) {
83
+ child = c[i];
84
+ if (Array.isArray(child)) {
85
+ walk(child);
86
+ }
87
+ else if (child != null && typeof child !== 'boolean') {
88
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
89
+ child = String(child);
90
+ }
91
+ if (simple && lastSimple) {
92
+ // If the previous child was simple (string), we merge both
93
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
94
+ }
95
+ else {
96
+ // Append a new vNode, if it's text, we create a text vNode
97
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
98
+ }
99
+ lastSimple = simple;
100
+ }
101
+ }
102
+ };
103
+ walk(children);
104
+ if (vnodeData) {
105
+ {
106
+ const classData = vnodeData.className || vnodeData.class;
107
+ if (classData) {
108
+ vnodeData.class =
109
+ typeof classData !== 'object'
110
+ ? classData
111
+ : Object.keys(classData)
112
+ .filter((k) => classData[k])
113
+ .join(' ');
114
+ }
115
+ }
116
+ }
117
+ const vnode = newVNode(nodeName, null);
118
+ vnode.$attrs$ = vnodeData;
119
+ if (vNodeChildren.length > 0) {
120
+ vnode.$children$ = vNodeChildren;
121
+ }
122
+ return vnode;
123
+ };
124
+ const newVNode = (tag, text) => {
125
+ const vnode = {
126
+ $flags$: 0,
127
+ $tag$: tag,
128
+ $text$: text,
129
+ $elm$: null,
130
+ $children$: null,
131
+ };
132
+ {
133
+ vnode.$attrs$ = null;
134
+ }
135
+ return vnode;
136
+ };
137
+ const Host = {};
138
+ const isHost = (node) => node && node.$tag$ === Host;
139
+ /**
140
+ * Helper function to create & dispatch a custom Event on a provided target
141
+ * @param elm the target of the Event
142
+ * @param name the name to give the custom Event
143
+ * @param opts options for configuring a custom Event
144
+ * @returns the custom Event
145
+ */
146
+ const emitEvent = (elm, name, opts) => {
147
+ const ev = plt.ce(name, opts);
148
+ elm.dispatchEvent(ev);
149
+ return ev;
150
+ };
151
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
152
+ const registerStyle = (scopeId, cssText, allowCS) => {
153
+ let style = styles.get(scopeId);
154
+ if (supportsConstructableStylesheets && allowCS) {
155
+ style = (style || new CSSStyleSheet());
156
+ if (typeof style === 'string') {
157
+ style = cssText;
158
+ }
159
+ else {
160
+ style.replaceSync(cssText);
161
+ }
162
+ }
163
+ else {
164
+ style = cssText;
165
+ }
166
+ styles.set(scopeId, style);
167
+ };
168
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
169
+ let scopeId = getScopeId(cmpMeta);
170
+ const style = styles.get(scopeId);
171
+ // if an element is NOT connected then getRootNode() will return the wrong root node
172
+ // so the fallback is to always use the document for the root node in those cases
173
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
174
+ if (style) {
175
+ if (typeof style === 'string') {
176
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
177
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
178
+ let styleElm;
179
+ if (!appliedStyles) {
180
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
181
+ }
182
+ if (!appliedStyles.has(scopeId)) {
183
+ {
184
+ {
185
+ styleElm = doc.createElement('style');
186
+ styleElm.innerHTML = style;
187
+ }
188
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
189
+ }
190
+ if (appliedStyles) {
191
+ appliedStyles.add(scopeId);
192
+ }
193
+ }
194
+ }
195
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
196
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
197
+ }
198
+ }
199
+ return scopeId;
200
+ };
201
+ const attachStyles = (hostRef) => {
202
+ const cmpMeta = hostRef.$cmpMeta$;
203
+ const elm = hostRef.$hostElement$;
204
+ const flags = cmpMeta.$flags$;
205
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
206
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
207
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
208
+ // only required when we're NOT using native shadow dom (slot)
209
+ // or this browser doesn't support native shadow dom
210
+ // and this host element was NOT created with SSR
211
+ // let's pick out the inner content for slot projection
212
+ // create a node to represent where the original
213
+ // content was first placed, which is useful later on
214
+ // DOM WRITE!!
215
+ elm['s-sc'] = scopeId;
216
+ elm.classList.add(scopeId + '-h');
217
+ }
218
+ endAttachStyles();
219
+ };
220
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
221
+ /**
222
+ * Production setAccessor() function based on Preact by
223
+ * Jason Miller (@developit)
224
+ * Licensed under the MIT License
225
+ * https://github.com/developit/preact/blob/master/LICENSE
226
+ *
227
+ * Modified for Stencil's compiler and vdom
228
+ */
229
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
230
+ if (oldValue !== newValue) {
231
+ memberName.toLowerCase();
232
+ if (memberName === 'class') {
233
+ const classList = elm.classList;
234
+ const oldClasses = parseClassList(oldValue);
235
+ const newClasses = parseClassList(newValue);
236
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
237
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
238
+ }
239
+ }
240
+ };
241
+ const parseClassListRegex = /\s/;
242
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
243
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
244
+ // if the element passed in is a shadow root, which is a document fragment
245
+ // then we want to be adding attrs/props to the shadow root's "host" element
246
+ // if it's not a shadow root, then we add attrs/props to the same element
247
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
248
+ ? newVnode.$elm$.host
249
+ : newVnode.$elm$;
250
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
251
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
252
+ // add new & update changed attributes
253
+ for (memberName in newVnodeAttrs) {
254
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName]);
255
+ }
256
+ };
257
+ /**
258
+ * Create a DOM Node corresponding to one of the children of a given VNode.
259
+ *
260
+ * @param oldParentVNode the parent VNode from the previous render
261
+ * @param newParentVNode the parent VNode from the current render
262
+ * @param childIndex the index of the VNode, in the _new_ parent node's
263
+ * children, for which we will create a new DOM node
264
+ * @param parentElm the parent DOM node which our new node will be a child of
265
+ * @returns the newly created node
266
+ */
267
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
268
+ // tslint:disable-next-line: prefer-const
269
+ const newVNode = newParentVNode.$children$[childIndex];
270
+ let i = 0;
271
+ let elm;
272
+ let childNode;
273
+ if (newVNode.$text$ !== null) {
274
+ // create text node
275
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
276
+ }
277
+ else {
278
+ // create element
279
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
280
+ // add css classes, attrs, props, listeners, etc.
281
+ {
282
+ updateElement(null, newVNode);
283
+ }
284
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
285
+ // if there is a scopeId and this is the initial render
286
+ // then let's add the scopeId as a css class
287
+ elm.classList.add((elm['s-si'] = scopeId));
288
+ }
289
+ if (newVNode.$children$) {
290
+ for (i = 0; i < newVNode.$children$.length; ++i) {
291
+ // create the node
292
+ childNode = createElm(oldParentVNode, newVNode, i);
293
+ // return node could have been null
294
+ if (childNode) {
295
+ // append our new node
296
+ elm.appendChild(childNode);
297
+ }
298
+ }
299
+ }
300
+ }
301
+ return elm;
302
+ };
303
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
304
+ let containerElm = (parentElm);
305
+ let childNode;
306
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
307
+ containerElm = containerElm.shadowRoot;
308
+ }
309
+ for (; startIdx <= endIdx; ++startIdx) {
310
+ if (vnodes[startIdx]) {
311
+ childNode = createElm(null, parentVNode, startIdx);
312
+ if (childNode) {
313
+ vnodes[startIdx].$elm$ = childNode;
314
+ containerElm.insertBefore(childNode, before);
315
+ }
316
+ }
317
+ }
318
+ };
319
+ /**
320
+ * Handle reconciling an outdated VNode with a new one which corresponds to
321
+ * it. This function handles flushing updates to the DOM and reconciling the
322
+ * children of the two nodes (if any).
323
+ *
324
+ * @param oldVNode an old VNode whose DOM element and children we want to update
325
+ * @param newVNode a new VNode representing an updated version of the old one
326
+ */
327
+ const patch = (oldVNode, newVNode) => {
328
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
329
+ const newChildren = newVNode.$children$;
330
+ const text = newVNode.$text$;
331
+ if (text === null) {
332
+ {
333
+ {
334
+ // either this is the first render of an element OR it's an update
335
+ // AND we already know it's possible it could have changed
336
+ // this updates the element's css classes, attrs, props, listeners, etc.
337
+ updateElement(oldVNode, newVNode);
338
+ }
339
+ }
340
+ if (newChildren !== null) {
341
+ // add the new vnode children
342
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
343
+ }
344
+ else ;
345
+ }
346
+ else if (oldVNode.$text$ !== text) {
347
+ // update the text content for the text only vnode
348
+ // and also only if the text is different than before
349
+ elm.data = text;
350
+ }
351
+ };
352
+ const renderVdom = (hostRef, renderFnResults) => {
353
+ const hostElm = hostRef.$hostElement$;
354
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
355
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
356
+ hostTagName = hostElm.tagName;
357
+ rootVnode.$tag$ = null;
358
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
359
+ hostRef.$vnode$ = rootVnode;
360
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
361
+ {
362
+ scopeId = hostElm['s-sc'];
363
+ }
364
+ // synchronous patch
365
+ patch(oldVNode, rootVnode);
366
+ };
367
+ const attachToAncestor = (hostRef, ancestorComponent) => {
368
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
369
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
370
+ }
371
+ };
372
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
373
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
374
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
375
+ return;
376
+ }
377
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
378
+ // there is no ancestor component or the ancestor component
379
+ // has already fired off its lifecycle update then
380
+ // fire off the initial update
381
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
382
+ return writeTask(dispatch) ;
383
+ };
384
+ const dispatchHooks = (hostRef, isInitialLoad) => {
385
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
386
+ const instance = hostRef.$lazyInstance$ ;
387
+ let promise;
388
+ endSchedule();
389
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
390
+ };
391
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
392
+ // updateComponent
393
+ const elm = hostRef.$hostElement$;
394
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
395
+ const rc = elm['s-rc'];
396
+ if (isInitialLoad) {
397
+ // DOM WRITE!
398
+ attachStyles(hostRef);
399
+ }
400
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
401
+ {
402
+ callRender(hostRef, instance);
403
+ }
404
+ if (rc) {
405
+ // ok, so turns out there are some child host elements
406
+ // waiting on this parent element to load
407
+ // let's fire off all update callbacks waiting
408
+ rc.map((cb) => cb());
409
+ elm['s-rc'] = undefined;
410
+ }
411
+ endRender();
412
+ endUpdate();
413
+ {
414
+ const childrenPromises = elm['s-p'];
415
+ const postUpdate = () => postUpdateComponent(hostRef);
416
+ if (childrenPromises.length === 0) {
417
+ postUpdate();
418
+ }
419
+ else {
420
+ Promise.all(childrenPromises).then(postUpdate);
421
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
422
+ childrenPromises.length = 0;
423
+ }
424
+ }
425
+ };
426
+ const callRender = (hostRef, instance, elm) => {
427
+ try {
428
+ instance = instance.render() ;
429
+ {
430
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
431
+ }
432
+ {
433
+ {
434
+ // looks like we've got child nodes to render into this host element
435
+ // or we need to update the css class/attrs on the host element
436
+ // DOM WRITE!
437
+ {
438
+ renderVdom(hostRef, instance);
439
+ }
440
+ }
441
+ }
442
+ }
443
+ catch (e) {
444
+ consoleError(e, hostRef.$hostElement$);
445
+ }
446
+ return null;
447
+ };
448
+ const postUpdateComponent = (hostRef) => {
449
+ const tagName = hostRef.$cmpMeta$.$tagName$;
450
+ const elm = hostRef.$hostElement$;
451
+ const endPostUpdate = createTime('postUpdate', tagName);
452
+ const ancestorComponent = hostRef.$ancestorComponent$;
453
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
454
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
455
+ {
456
+ // DOM WRITE!
457
+ addHydratedFlag(elm);
458
+ }
459
+ endPostUpdate();
460
+ {
461
+ hostRef.$onReadyResolve$(elm);
462
+ if (!ancestorComponent) {
463
+ appDidLoad();
464
+ }
465
+ }
466
+ }
467
+ else {
468
+ endPostUpdate();
469
+ }
470
+ // load events fire from bottom to top
471
+ // the deepest elements load first then bubbles up
472
+ {
473
+ if (hostRef.$onRenderResolve$) {
474
+ hostRef.$onRenderResolve$();
475
+ hostRef.$onRenderResolve$ = undefined;
476
+ }
477
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
478
+ nextTick(() => scheduleUpdate(hostRef, false));
479
+ }
480
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
481
+ }
482
+ // ( •_•)
483
+ // ( •_•)>⌐■-■
484
+ // (⌐■_■)
485
+ };
486
+ const appDidLoad = (who) => {
487
+ // on appload
488
+ // we have finish the first big initial render
489
+ {
490
+ addHydratedFlag(doc.documentElement);
491
+ }
492
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
493
+ };
494
+ const then = (promise, thenFn) => {
495
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
496
+ };
497
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
498
+ ;
499
+ /**
500
+ * Attach a series of runtime constructs to a compiled Stencil component
501
+ * constructor, including getters and setters for the `@Prop` and `@State`
502
+ * decorators, callbacks for when attributes change, and so on.
503
+ *
504
+ * @param Cstr the constructor for a component that we need to process
505
+ * @param cmpMeta metadata collected previously about the component
506
+ * @param flags a number used to store a series of bit flags
507
+ * @returns a reference to the same constructor passed in (but now mutated)
508
+ */
509
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
510
+ return Cstr;
511
+ };
512
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
513
+ // initializeComponent
514
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
515
+ {
516
+ // we haven't initialized this element yet
517
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
518
+ // lazy loaded components
519
+ // request the component's implementation to be
520
+ // wired up with the host element
521
+ Cstr = loadModule(cmpMeta);
522
+ if (Cstr.then) {
523
+ // Await creates a micro-task avoid if possible
524
+ const endLoad = uniqueTime();
525
+ Cstr = await Cstr;
526
+ endLoad();
527
+ }
528
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
529
+ // construct the lazy-loaded component implementation
530
+ // passing the hostRef is very important during
531
+ // construction in order to directly wire together the
532
+ // host element and the lazy-loaded instance
533
+ try {
534
+ new Cstr(hostRef);
535
+ }
536
+ catch (e) {
537
+ consoleError(e);
538
+ }
539
+ endNewInstance();
540
+ }
541
+ if (Cstr.style) {
542
+ // this component has styles but we haven't registered them yet
543
+ let style = Cstr.style;
544
+ const scopeId = getScopeId(cmpMeta);
545
+ if (!styles.has(scopeId)) {
546
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
547
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
548
+ endRegisterStyles();
549
+ }
550
+ }
551
+ }
552
+ // we've successfully created a lazy instance
553
+ const ancestorComponent = hostRef.$ancestorComponent$;
554
+ const schedule = () => scheduleUpdate(hostRef, true);
555
+ if (ancestorComponent && ancestorComponent['s-rc']) {
556
+ // this is the initial load and this component it has an ancestor component
557
+ // but the ancestor component has NOT fired its will update lifecycle yet
558
+ // so let's just cool our jets and wait for the ancestor to continue first
559
+ // this will get fired off when the ancestor component
560
+ // finally gets around to rendering its lazy self
561
+ // fire off the initial update
562
+ ancestorComponent['s-rc'].push(schedule);
563
+ }
564
+ else {
565
+ schedule();
566
+ }
567
+ };
568
+ const connectedCallback = (elm) => {
569
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
570
+ const hostRef = getHostRef(elm);
571
+ const cmpMeta = hostRef.$cmpMeta$;
572
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
573
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
574
+ // first time this component has connected
575
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
576
+ {
577
+ // find the first ancestor component (if there is one) and register
578
+ // this component as one of the actively loading child components for its ancestor
579
+ let ancestorComponent = elm;
580
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
581
+ // climb up the ancestors looking for the first
582
+ // component that hasn't finished its lifecycle update yet
583
+ if (ancestorComponent['s-p']) {
584
+ // we found this components first ancestor component
585
+ // keep a reference to this component's ancestor component
586
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
587
+ break;
588
+ }
589
+ }
590
+ }
591
+ {
592
+ initializeComponent(elm, hostRef, cmpMeta);
593
+ }
594
+ }
595
+ endConnected();
596
+ }
597
+ };
598
+ const disconnectedCallback = (elm) => {
599
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
600
+ getHostRef(elm);
601
+ }
602
+ };
603
+ const bootstrapLazy = (lazyBundles, options = {}) => {
604
+ const endBootstrap = createTime();
605
+ const cmpTags = [];
606
+ const exclude = options.exclude || [];
607
+ const customElements = win.customElements;
608
+ const head = doc.head;
609
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
610
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
611
+ const deferredConnectedCallbacks = [];
612
+ let appLoadFallback;
613
+ let isBootstrapping = true;
614
+ Object.assign(plt, options);
615
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
616
+ lazyBundles.map((lazyBundle) => {
617
+ lazyBundle[1].map((compactMeta) => {
618
+ const cmpMeta = {
619
+ $flags$: compactMeta[0],
620
+ $tagName$: compactMeta[1],
621
+ $members$: compactMeta[2],
622
+ $listeners$: compactMeta[3],
623
+ };
624
+ const tagName = cmpMeta.$tagName$;
625
+ const HostElement = class extends HTMLElement {
626
+ // StencilLazyHost
627
+ constructor(self) {
628
+ // @ts-ignore
629
+ super(self);
630
+ self = this;
631
+ registerHost(self, cmpMeta);
632
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
633
+ // this component is using shadow dom
634
+ // and this browser supports shadow dom
635
+ // add the read-only property "shadowRoot" to the host element
636
+ // adding the shadow root build conditionals to minimize runtime
637
+ {
638
+ {
639
+ self.attachShadow({ mode: 'open' });
640
+ }
641
+ }
642
+ }
643
+ }
644
+ connectedCallback() {
645
+ if (appLoadFallback) {
646
+ clearTimeout(appLoadFallback);
647
+ appLoadFallback = null;
648
+ }
649
+ if (isBootstrapping) {
650
+ // connectedCallback will be processed once all components have been registered
651
+ deferredConnectedCallbacks.push(this);
652
+ }
653
+ else {
654
+ plt.jmp(() => connectedCallback(this));
655
+ }
656
+ }
657
+ disconnectedCallback() {
658
+ plt.jmp(() => disconnectedCallback(this));
659
+ }
660
+ componentOnReady() {
661
+ return getHostRef(this).$onReadyPromise$;
662
+ }
663
+ };
664
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
665
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
666
+ cmpTags.push(tagName);
667
+ customElements.define(tagName, proxyComponent(HostElement));
668
+ }
669
+ });
670
+ });
671
+ {
672
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
673
+ visibilityStyle.setAttribute('data-styles', '');
674
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
675
+ }
676
+ // Process deferred connectedCallbacks now all components have been registered
677
+ isBootstrapping = false;
678
+ if (deferredConnectedCallbacks.length) {
679
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
680
+ }
681
+ else {
682
+ {
683
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
684
+ }
685
+ }
686
+ // Fallback appLoad event
687
+ endBootstrap();
688
+ };
689
+ const hostRefs = /*@__PURE__*/ new WeakMap();
690
+ const getHostRef = (ref) => hostRefs.get(ref);
691
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
692
+ const registerHost = (elm, cmpMeta) => {
693
+ const hostRef = {
694
+ $flags$: 0,
695
+ $hostElement$: elm,
696
+ $cmpMeta$: cmpMeta,
697
+ $instanceValues$: new Map(),
698
+ };
699
+ {
700
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
701
+ elm['s-p'] = [];
702
+ elm['s-rc'] = [];
703
+ }
704
+ return hostRefs.set(elm, hostRef);
705
+ };
706
+ const consoleError = (e, el) => (0, console.error)(e, el);
707
+ const cmpModules = /*@__PURE__*/ new Map();
708
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
709
+ // loadModuleImport
710
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
711
+ const bundleId = cmpMeta.$lazyBundleId$;
712
+ const module = cmpModules.get(bundleId) ;
713
+ if (module) {
714
+ return module[exportName];
715
+ }
716
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
717
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
718
+ /* @vite-ignore */
719
+ /* webpackInclude: /\.entry\.js$/ */
720
+ /* webpackExclude: /\.system\.entry\.js$/ */
721
+ /* webpackMode: "lazy" */
722
+ `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
723
+ {
724
+ cmpModules.set(bundleId, importedModule);
725
+ }
726
+ return importedModule[exportName];
727
+ }, consoleError);
728
+ };
729
+ const styles = /*@__PURE__*/ new Map();
730
+ const win = typeof window !== 'undefined' ? window : {};
731
+ const doc = win.document || { head: {} };
732
+ const plt = {
733
+ $flags$: 0,
734
+ $resourcesUrl$: '',
735
+ jmp: (h) => h(),
736
+ raf: (h) => requestAnimationFrame(h),
737
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
738
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
739
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
740
+ };
741
+ const promiseResolve = (v) => Promise.resolve(v);
742
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
743
+ try {
744
+ new CSSStyleSheet();
745
+ return typeof new CSSStyleSheet().replaceSync === 'function';
746
+ }
747
+ catch (e) { }
748
+ return false;
749
+ })()
750
+ ;
751
+ const queueDomReads = [];
752
+ const queueDomWrites = [];
753
+ const queueTask = (queue, write) => (cb) => {
754
+ queue.push(cb);
755
+ if (!queuePending) {
756
+ queuePending = true;
757
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
758
+ nextTick(flush);
759
+ }
760
+ else {
761
+ plt.raf(flush);
762
+ }
763
+ }
764
+ };
765
+ const consume = (queue) => {
766
+ for (let i = 0; i < queue.length; i++) {
767
+ try {
768
+ queue[i](performance.now());
769
+ }
770
+ catch (e) {
771
+ consoleError(e);
772
+ }
773
+ }
774
+ queue.length = 0;
775
+ };
776
+ const flush = () => {
777
+ // always force a bunch of medium callbacks to run, but still have
778
+ // a throttle on how many can run in a certain time
779
+ // DOM READS!!!
780
+ consume(queueDomReads);
781
+ // DOM WRITES!!!
782
+ {
783
+ consume(queueDomWrites);
784
+ if ((queuePending = queueDomReads.length > 0)) {
785
+ // still more to do yet, but we've run out of time
786
+ // let's let this thing cool off and try again in the next tick
787
+ plt.raf(flush);
788
+ }
789
+ }
790
+ };
791
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
792
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
793
+
794
+ exports.bootstrapLazy = bootstrapLazy;
795
+ exports.h = h;
796
+ exports.promiseResolve = promiseResolve;
797
+ exports.registerInstance = registerInstance;