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