@rededor/cura 0.3.4-alpha.0 → 0.3.4-alpha.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.
- package/dist/cjs/{app-globals-a41d7f40.js → app-globals-0f70160b.js} +17 -40
- package/dist/cjs/cura-display_4.cjs.entry.js +257 -0
- package/dist/cjs/cura-icon.cjs.entry.js +59 -0
- package/dist/cjs/cura-icons-view.cjs.entry.js +2 -4
- package/dist/cjs/cura.cjs.js +4 -19
- package/dist/cjs/{index-29633529.js → index-76f95c4b.js} +39 -502
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +4 -23
- package/dist/collection/api/cura-api.js +0 -1
- package/dist/collection/api/cura-api.type.js +0 -1
- package/dist/collection/api/modules/cura-theme-colors-module.js +0 -1
- package/dist/collection/api/modules/cura-theme-fonts-module.js +0 -1
- package/dist/collection/api/modules/cura-theme-module.js +0 -1
- package/dist/collection/api/modules/cura-theme-spacing-module.js +0 -1
- package/dist/collection/api/theme-presets/static.js +0 -1
- package/dist/collection/api/theme-presets/theme-default.js +5 -6
- package/dist/collection/api/theme-presets/theme-maternity.js +0 -8
- package/dist/collection/api/theme-presets/theme-oncology.js +12 -27
- package/dist/collection/api/theme-presets/theme-presets.js +0 -1
- package/dist/collection/assets/icons/iconset-default-list.js +0 -1
- package/dist/collection/collection-manifest.json +2 -3
- package/dist/collection/components/cura-icon/cura-icon.css +2 -2
- package/dist/collection/components/cura-icon/cura-icon.js +5 -8
- package/dist/collection/components/cura-icons-view/cura-icons-view.js +1 -3
- package/dist/collection/components/cura-page-template/cura-page-template.css +24 -24
- package/dist/collection/components/cura-page-template/cura-page-template.js +1 -3
- package/dist/collection/components/text/cura-display/cura-display.css +14 -13
- package/dist/collection/components/text/cura-display/cura-display.js +17 -3
- package/dist/collection/components/text/cura-heading/cura-heading.css +15 -15
- package/dist/collection/components/text/cura-heading/cura-heading.js +21 -3
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.css +17 -16
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +13 -3
- package/dist/collection/index.js +0 -1
- package/dist/collection/rededor-cura-start.js +0 -1
- package/dist/collection/utils/utils.js +0 -1
- package/dist/components/cura-display.js +20 -7
- package/dist/components/cura-heading.js +24 -7
- package/dist/components/cura-icon.js +0 -2
- package/dist/components/cura-icon2.js +8 -12
- package/dist/components/cura-icons-view.js +3 -6
- package/dist/components/cura-page-template.js +4 -7
- package/dist/components/cura-paragraph.js +16 -7
- package/dist/components/index.d.ts +9 -21
- package/dist/components/index.js +24 -67
- package/dist/cura/cura.esm.js +1 -2
- package/dist/cura/cura.js +1 -3
- package/dist/cura/index.esm.js +0 -2
- package/dist/cura/p-0b79032f.system.js +2 -0
- package/dist/cura/p-11002b56.system.js +1 -0
- package/dist/cura/p-32769783.system.js +1 -0
- package/dist/cura/p-50ea2036.system.js +1 -2
- package/dist/cura/{p-958c8695.system.entry.js → p-54c09404.system.entry.js} +1 -2
- package/dist/cura/p-57c5329e.js +2 -0
- package/dist/cura/p-5a6643e1.entry.js +1 -0
- package/dist/cura/p-a2ad5637.system.entry.js +1 -0
- package/dist/cura/p-aca36c98.js +1 -0
- package/dist/cura/p-bd91ecb9.system.entry.js +1 -0
- package/dist/cura/p-d69916ee.entry.js +1 -0
- package/dist/cura/p-f8a5b97d.entry.js +1 -0
- package/dist/dist/loader/index.d.ts +0 -9
- package/dist/esm/{app-globals-8ed931e6.js → app-globals-cb45bff3.js} +17 -40
- package/dist/esm/cura-display_4.entry.js +250 -0
- package/dist/esm/cura-icon.entry.js +55 -0
- package/dist/esm/cura-icons-view.entry.js +2 -4
- package/dist/esm/cura.js +4 -16
- package/dist/esm/{index-e11775ce.js → index-7e8c969d.js} +40 -499
- package/dist/esm/index.js +0 -2
- package/dist/esm/loader.js +4 -23
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm-es5/app-globals-cb45bff3.js +1 -0
- package/dist/esm-es5/cura-display_4.entry.js +1 -0
- package/dist/esm-es5/cura-icon.entry.js +1 -0
- package/dist/esm-es5/cura-icons-view.entry.js +1 -2
- package/dist/esm-es5/cura.js +1 -2
- package/dist/esm-es5/index-7e8c969d.js +2 -0
- package/dist/esm-es5/index.js +0 -2
- package/dist/esm-es5/loader.js +1 -2
- package/dist/types/api/theme-presets/theme-maternity.d.ts +0 -7
- package/dist/types/api/theme-presets/theme-oncology.d.ts +5 -5
- package/dist/types/api/theme-presets/theme-presets.d.ts +5 -12
- package/dist/types/components.d.ts +0 -93
- package/dist/types/stencil-public-runtime.d.ts +15 -77
- package/package.json +7 -7
- package/dist/cjs/app-globals-a41d7f40.js.map +0 -1
- package/dist/cjs/css-shim-83cf0349.js +0 -8
- package/dist/cjs/css-shim-83cf0349.js.map +0 -1
- package/dist/cjs/cura-button_6.cjs.entry.js +0 -322
- package/dist/cjs/cura-button_6.cjs.entry.js.map +0 -1
- package/dist/cjs/cura-icons-view.cjs.entry.js.map +0 -1
- package/dist/cjs/cura.cjs.js.map +0 -1
- package/dist/cjs/index-29633529.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/shadow-css-8baae635.js +0 -391
- package/dist/cjs/shadow-css-8baae635.js.map +0 -1
- package/dist/collection/api/cura-api.js.map +0 -1
- package/dist/collection/api/cura-api.type.js.map +0 -1
- package/dist/collection/api/modules/cura-theme-colors-module.js.map +0 -1
- package/dist/collection/api/modules/cura-theme-fonts-module.js.map +0 -1
- package/dist/collection/api/modules/cura-theme-module.js.map +0 -1
- package/dist/collection/api/modules/cura-theme-spacing-module.js.map +0 -1
- package/dist/collection/api/theme-presets/static.js.map +0 -1
- package/dist/collection/api/theme-presets/theme-default.js.map +0 -1
- package/dist/collection/api/theme-presets/theme-maternity.js.map +0 -1
- package/dist/collection/api/theme-presets/theme-oncology.js.map +0 -1
- package/dist/collection/api/theme-presets/theme-presets.js.map +0 -1
- package/dist/collection/assets/icons/iconset-default-list.js.map +0 -1
- package/dist/collection/components/buttons/cura-button/cura-button.css +0 -70
- package/dist/collection/components/buttons/cura-button/cura-button.js +0 -255
- package/dist/collection/components/buttons/cura-button/cura-button.js.map +0 -1
- package/dist/collection/components/cura-icon/cura-icon.js.map +0 -1
- package/dist/collection/components/cura-icons-view/cura-icons-view.js.map +0 -1
- package/dist/collection/components/cura-page-template/cura-page-template.js.map +0 -1
- package/dist/collection/components/text/cura-display/cura-display.js.map +0 -1
- package/dist/collection/components/text/cura-heading/cura-heading.js.map +0 -1
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/rededor-cura-start.js.map +0 -1
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/collection/utils/utils.spec.js +0 -16
- package/dist/collection/utils/utils.spec.js.map +0 -1
- package/dist/components/cura-button.d.ts +0 -11
- package/dist/components/cura-button.js +0 -97
- package/dist/components/cura-button.js.map +0 -1
- package/dist/components/cura-display.js.map +0 -1
- package/dist/components/cura-heading.js.map +0 -1
- package/dist/components/cura-icon.js.map +0 -1
- package/dist/components/cura-icon2.js.map +0 -1
- package/dist/components/cura-icons-view.js.map +0 -1
- package/dist/components/cura-page-template.js.map +0 -1
- package/dist/components/cura-paragraph.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/cura/cura.esm.js.map +0 -1
- package/dist/cura/index.esm.js.map +0 -1
- package/dist/cura/p-118112e5.system.js +0 -14
- package/dist/cura/p-118112e5.system.js.map +0 -1
- package/dist/cura/p-183305c3.js +0 -2
- package/dist/cura/p-183305c3.js.map +0 -1
- package/dist/cura/p-3f6aaefc.system.js +0 -2
- package/dist/cura/p-3f6aaefc.system.js.map +0 -1
- package/dist/cura/p-4c60d085.entry.js +0 -2
- package/dist/cura/p-4c60d085.entry.js.map +0 -1
- package/dist/cura/p-4fc49972.system.js +0 -2
- package/dist/cura/p-4fc49972.system.js.map +0 -1
- package/dist/cura/p-50ea2036.system.js.map +0 -1
- package/dist/cura/p-61953b75.system.js +0 -2
- package/dist/cura/p-61953b75.system.js.map +0 -1
- package/dist/cura/p-731abb13.entry.js +0 -2
- package/dist/cura/p-731abb13.entry.js.map +0 -1
- package/dist/cura/p-958c8695.system.entry.js.map +0 -1
- package/dist/cura/p-b5872ed0.system.entry.js +0 -2
- package/dist/cura/p-b5872ed0.system.entry.js.map +0 -1
- package/dist/cura/p-bac0b4ab.js +0 -2
- package/dist/cura/p-bac0b4ab.js.map +0 -1
- package/dist/cura/p-beab48cd.js +0 -13
- package/dist/cura/p-beab48cd.js.map +0 -1
- package/dist/cura/p-c30e14d5.system.js +0 -3
- package/dist/cura/p-c30e14d5.system.js.map +0 -1
- package/dist/cura/p-d5990392.js +0 -3
- package/dist/cura/p-d5990392.js.map +0 -1
- package/dist/esm/app-globals-8ed931e6.js.map +0 -1
- package/dist/esm/css-shim-d13f0738.js +0 -6
- package/dist/esm/css-shim-d13f0738.js.map +0 -1
- package/dist/esm/cura-button_6.entry.js +0 -313
- package/dist/esm/cura-button_6.entry.js.map +0 -1
- package/dist/esm/cura-icons-view.entry.js.map +0 -1
- package/dist/esm/cura.js.map +0 -1
- package/dist/esm/index-e11775ce.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/shadow-css-07b0c8c8.js +0 -389
- package/dist/esm/shadow-css-07b0c8c8.js.map +0 -1
- package/dist/esm-es5/app-globals-8ed931e6.js +0 -2
- package/dist/esm-es5/app-globals-8ed931e6.js.map +0 -1
- package/dist/esm-es5/css-shim-d13f0738.js +0 -2
- package/dist/esm-es5/css-shim-d13f0738.js.map +0 -1
- package/dist/esm-es5/cura-button_6.entry.js +0 -2
- package/dist/esm-es5/cura-button_6.entry.js.map +0 -1
- package/dist/esm-es5/cura-icons-view.entry.js.map +0 -1
- package/dist/esm-es5/cura.js.map +0 -1
- package/dist/esm-es5/index-e11775ce.js +0 -3
- package/dist/esm-es5/index-e11775ce.js.map +0 -1
- package/dist/esm-es5/index.js.map +0 -1
- package/dist/esm-es5/loader.js.map +0 -1
- package/dist/esm-es5/shadow-css-07b0c8c8.js +0 -13
- package/dist/esm-es5/shadow-css-07b0c8c8.js.map +0 -1
- package/dist/loader/index.d.ts +0 -12
- package/dist/types/components/buttons/cura-button/cura-button.d.ts +0 -49
|
@@ -30,7 +30,6 @@ const NAMESPACE = 'cura';
|
|
|
30
30
|
*
|
|
31
31
|
* Modified for Stencil's renderer and slot projection
|
|
32
32
|
*/
|
|
33
|
-
let scopeId;
|
|
34
33
|
let contentRef;
|
|
35
34
|
let hostTagName;
|
|
36
35
|
let useNativeShadowDom = false;
|
|
@@ -52,13 +51,6 @@ const uniqueTime = (key, measureText) => {
|
|
|
52
51
|
};
|
|
53
52
|
}
|
|
54
53
|
};
|
|
55
|
-
const CONTENT_REF_ID = 'r';
|
|
56
|
-
const ORG_LOCATION_ID = 'o';
|
|
57
|
-
const SLOT_NODE_ID = 's';
|
|
58
|
-
const TEXT_NODE_ID = 't';
|
|
59
|
-
const HYDRATE_ID = 's-id';
|
|
60
|
-
const HYDRATED_STYLE_ID = 'sty-id';
|
|
61
|
-
const HYDRATE_CHILD_ID = 'c-id';
|
|
62
54
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
63
55
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
64
56
|
/**
|
|
@@ -74,31 +66,11 @@ const EMPTY_OBJ = {};
|
|
|
74
66
|
*/
|
|
75
67
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
76
68
|
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
77
|
-
const isDef = (v) => v != null;
|
|
78
|
-
/**
|
|
79
|
-
* Check whether a value is a 'complex type', defined here as an object or a
|
|
80
|
-
* function.
|
|
81
|
-
*
|
|
82
|
-
* @param o the value to check
|
|
83
|
-
* @returns whether it's a complex type or not
|
|
84
|
-
*/
|
|
85
69
|
const isComplexType = (o) => {
|
|
86
70
|
// https://jsperf.com/typeof-fn-object/5
|
|
87
71
|
o = typeof o;
|
|
88
72
|
return o === 'object' || o === 'function';
|
|
89
73
|
};
|
|
90
|
-
/**
|
|
91
|
-
* Helper method for querying a `meta` tag that contains a nonce value
|
|
92
|
-
* out of a DOM's head.
|
|
93
|
-
*
|
|
94
|
-
* @param doc The DOM containing the `head` to query against
|
|
95
|
-
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
|
96
|
-
* exists or the tag has no content.
|
|
97
|
-
*/
|
|
98
|
-
function queryNonceMetaTagContent(doc) {
|
|
99
|
-
var _a, _b, _c;
|
|
100
|
-
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
|
101
|
-
}
|
|
102
74
|
/**
|
|
103
75
|
* Production h() function based on Preact by
|
|
104
76
|
* Jason Miller (@developit)
|
|
@@ -107,6 +79,7 @@ function queryNonceMetaTagContent(doc) {
|
|
|
107
79
|
*
|
|
108
80
|
* Modified for Stencil's compiler and vdom
|
|
109
81
|
*/
|
|
82
|
+
// const stack: any[] = [];
|
|
110
83
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
|
111
84
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
112
85
|
const h = (nodeName, vnodeData, ...children) => {
|
|
@@ -164,14 +137,6 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
164
137
|
}
|
|
165
138
|
return vnode;
|
|
166
139
|
};
|
|
167
|
-
/**
|
|
168
|
-
* A utility function for creating a virtual DOM node from a tag and some
|
|
169
|
-
* possible text content.
|
|
170
|
-
*
|
|
171
|
-
* @param tag the tag for this element
|
|
172
|
-
* @param text possible text content for the node
|
|
173
|
-
* @returns a newly-minted virtual DOM node
|
|
174
|
-
*/
|
|
175
140
|
const newVNode = (tag, text) => {
|
|
176
141
|
const vnode = {
|
|
177
142
|
$flags$: 0,
|
|
@@ -189,218 +154,7 @@ const newVNode = (tag, text) => {
|
|
|
189
154
|
return vnode;
|
|
190
155
|
};
|
|
191
156
|
const Host = {};
|
|
192
|
-
/**
|
|
193
|
-
* Check whether a given node is a Host node or not
|
|
194
|
-
*
|
|
195
|
-
* @param node the virtual DOM node to check
|
|
196
|
-
* @returns whether it's a Host node or not
|
|
197
|
-
*/
|
|
198
157
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
199
|
-
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
200
|
-
const endHydrate = createTime('hydrateClient', tagName);
|
|
201
|
-
const shadowRoot = hostElm.shadowRoot;
|
|
202
|
-
const childRenderNodes = [];
|
|
203
|
-
const slotNodes = [];
|
|
204
|
-
const shadowRootNodes = shadowRoot ? [] : null;
|
|
205
|
-
const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
|
|
206
|
-
if (!plt.$orgLocNodes$) {
|
|
207
|
-
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
|
208
|
-
}
|
|
209
|
-
hostElm[HYDRATE_ID] = hostId;
|
|
210
|
-
hostElm.removeAttribute(HYDRATE_ID);
|
|
211
|
-
clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
|
|
212
|
-
childRenderNodes.map((c) => {
|
|
213
|
-
const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
|
|
214
|
-
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
215
|
-
const node = c.$elm$;
|
|
216
|
-
if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
|
|
217
|
-
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
218
|
-
}
|
|
219
|
-
if (!shadowRoot) {
|
|
220
|
-
node['s-hn'] = tagName;
|
|
221
|
-
if (orgLocationNode) {
|
|
222
|
-
node['s-ol'] = orgLocationNode;
|
|
223
|
-
node['s-ol']['s-nr'] = node;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
plt.$orgLocNodes$.delete(orgLocationId);
|
|
227
|
-
});
|
|
228
|
-
if (shadowRoot) {
|
|
229
|
-
shadowRootNodes.map((shadowRootNode) => {
|
|
230
|
-
if (shadowRootNode) {
|
|
231
|
-
shadowRoot.appendChild(shadowRootNode);
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
endHydrate();
|
|
236
|
-
};
|
|
237
|
-
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
|
238
|
-
let childNodeType;
|
|
239
|
-
let childIdSplt;
|
|
240
|
-
let childVNode;
|
|
241
|
-
let i;
|
|
242
|
-
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
243
|
-
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
244
|
-
if (childNodeType) {
|
|
245
|
-
// got the node data from the element's attribute
|
|
246
|
-
// `${hostId}.${nodeId}.${depth}.${index}`
|
|
247
|
-
childIdSplt = childNodeType.split('.');
|
|
248
|
-
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
|
249
|
-
childVNode = {
|
|
250
|
-
$flags$: 0,
|
|
251
|
-
$hostId$: childIdSplt[0],
|
|
252
|
-
$nodeId$: childIdSplt[1],
|
|
253
|
-
$depth$: childIdSplt[2],
|
|
254
|
-
$index$: childIdSplt[3],
|
|
255
|
-
$tag$: node.tagName.toLowerCase(),
|
|
256
|
-
$elm$: node,
|
|
257
|
-
$attrs$: null,
|
|
258
|
-
$children$: null,
|
|
259
|
-
$key$: null,
|
|
260
|
-
$name$: null,
|
|
261
|
-
$text$: null,
|
|
262
|
-
};
|
|
263
|
-
childRenderNodes.push(childVNode);
|
|
264
|
-
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
265
|
-
// this is a new child vnode
|
|
266
|
-
// so ensure its parent vnode has the vchildren array
|
|
267
|
-
if (!parentVNode.$children$) {
|
|
268
|
-
parentVNode.$children$ = [];
|
|
269
|
-
}
|
|
270
|
-
// add our child vnode to a specific index of the vnode's children
|
|
271
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
272
|
-
// this is now the new parent vnode for all the next child checks
|
|
273
|
-
parentVNode = childVNode;
|
|
274
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
275
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
// recursively drill down, end to start so we can remove nodes
|
|
280
|
-
for (i = node.childNodes.length - 1; i >= 0; i--) {
|
|
281
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
|
282
|
-
}
|
|
283
|
-
if (node.shadowRoot) {
|
|
284
|
-
// keep drilling down through the shadow root nodes
|
|
285
|
-
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
|
286
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
291
|
-
// `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
|
|
292
|
-
childIdSplt = node.nodeValue.split('.');
|
|
293
|
-
if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
|
294
|
-
// comment node for either the host id or a 0 host id
|
|
295
|
-
childNodeType = childIdSplt[0];
|
|
296
|
-
childVNode = {
|
|
297
|
-
$flags$: 0,
|
|
298
|
-
$hostId$: childIdSplt[1],
|
|
299
|
-
$nodeId$: childIdSplt[2],
|
|
300
|
-
$depth$: childIdSplt[3],
|
|
301
|
-
$index$: childIdSplt[4],
|
|
302
|
-
$elm$: node,
|
|
303
|
-
$attrs$: null,
|
|
304
|
-
$children$: null,
|
|
305
|
-
$key$: null,
|
|
306
|
-
$name$: null,
|
|
307
|
-
$tag$: null,
|
|
308
|
-
$text$: null,
|
|
309
|
-
};
|
|
310
|
-
if (childNodeType === TEXT_NODE_ID) {
|
|
311
|
-
childVNode.$elm$ = node.nextSibling;
|
|
312
|
-
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
|
313
|
-
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
314
|
-
childRenderNodes.push(childVNode);
|
|
315
|
-
// remove the text comment since it's no longer needed
|
|
316
|
-
node.remove();
|
|
317
|
-
if (!parentVNode.$children$) {
|
|
318
|
-
parentVNode.$children$ = [];
|
|
319
|
-
}
|
|
320
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
321
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
322
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
else if (childVNode.$hostId$ === hostId) {
|
|
327
|
-
// this comment node is specifcally for this host id
|
|
328
|
-
if (childNodeType === SLOT_NODE_ID) {
|
|
329
|
-
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
|
|
330
|
-
childVNode.$tag$ = 'slot';
|
|
331
|
-
if (childIdSplt[5]) {
|
|
332
|
-
node['s-sn'] = childVNode.$name$ = childIdSplt[5];
|
|
333
|
-
}
|
|
334
|
-
else {
|
|
335
|
-
node['s-sn'] = '';
|
|
336
|
-
}
|
|
337
|
-
node['s-sr'] = true;
|
|
338
|
-
if (shadowRootNodes) {
|
|
339
|
-
// browser support shadowRoot and this is a shadow dom component
|
|
340
|
-
// create an actual slot element
|
|
341
|
-
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
342
|
-
if (childVNode.$name$) {
|
|
343
|
-
// add the slot name attribute
|
|
344
|
-
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
|
345
|
-
}
|
|
346
|
-
// insert the new slot element before the slot comment
|
|
347
|
-
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
348
|
-
// remove the slot comment since it's not needed for shadow
|
|
349
|
-
node.remove();
|
|
350
|
-
if (childVNode.$depth$ === '0') {
|
|
351
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
slotNodes.push(childVNode);
|
|
355
|
-
if (!parentVNode.$children$) {
|
|
356
|
-
parentVNode.$children$ = [];
|
|
357
|
-
}
|
|
358
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
359
|
-
}
|
|
360
|
-
else if (childNodeType === CONTENT_REF_ID) {
|
|
361
|
-
// `${CONTENT_REF_ID}.${hostId}`;
|
|
362
|
-
if (shadowRootNodes) {
|
|
363
|
-
// remove the content ref comment since it's not needed for shadow
|
|
364
|
-
node.remove();
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
hostElm['s-cr'] = node;
|
|
368
|
-
node['s-cn'] = true;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
else if (parentVNode && parentVNode.$tag$ === 'style') {
|
|
375
|
-
const vnode = newVNode(null, node.textContent);
|
|
376
|
-
vnode.$elm$ = node;
|
|
377
|
-
vnode.$index$ = '0';
|
|
378
|
-
parentVNode.$children$ = [vnode];
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
const initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
382
|
-
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
383
|
-
let i = 0;
|
|
384
|
-
for (; i < node.childNodes.length; i++) {
|
|
385
|
-
initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
|
|
386
|
-
}
|
|
387
|
-
if (node.shadowRoot) {
|
|
388
|
-
for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
|
389
|
-
initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
394
|
-
const childIdSplt = node.nodeValue.split('.');
|
|
395
|
-
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
396
|
-
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
|
397
|
-
node.nodeValue = '';
|
|
398
|
-
// useful to know if the original location is
|
|
399
|
-
// the root light-dom of a shadow dom component
|
|
400
|
-
node['s-en'] = childIdSplt[3];
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
158
|
/**
|
|
405
159
|
* Parse a new property value for a given property type.
|
|
406
160
|
*
|
|
@@ -479,7 +233,6 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
479
233
|
styles.set(scopeId, style);
|
|
480
234
|
};
|
|
481
235
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
482
|
-
var _a;
|
|
483
236
|
let scopeId = getScopeId(cmpMeta);
|
|
484
237
|
const style = styles.get(scopeId);
|
|
485
238
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
@@ -494,36 +247,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
494
247
|
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
495
248
|
}
|
|
496
249
|
if (!appliedStyles.has(scopeId)) {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
// This is only happening on native shadow-dom, do not needs CSS var shim
|
|
500
|
-
styleElm.innerHTML = style;
|
|
501
|
-
}
|
|
502
|
-
else {
|
|
503
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
504
|
-
if (plt.$cssShim$) {
|
|
505
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
506
|
-
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style,
|
|
507
|
-
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
508
|
-
!!(cmpMeta.$flags$ & 10 /* CMP_FLAGS.needsScopedEncapsulation */));
|
|
509
|
-
const newScopeId = styleElm['s-sc'];
|
|
510
|
-
if (newScopeId) {
|
|
511
|
-
scopeId = newScopeId;
|
|
512
|
-
// we don't want to add this styleID to the appliedStyles Set
|
|
513
|
-
// since the cssVarShim might need to apply several different
|
|
514
|
-
// stylesheets for the same component
|
|
515
|
-
appliedStyles = null;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
else {
|
|
250
|
+
{
|
|
251
|
+
{
|
|
519
252
|
styleElm = doc.createElement('style');
|
|
520
253
|
styleElm.innerHTML = style;
|
|
521
254
|
}
|
|
522
|
-
// Apply CSP nonce to the style tag if it exists
|
|
523
|
-
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
524
|
-
if (nonce != null) {
|
|
525
|
-
styleElm.setAttribute('nonce', nonce);
|
|
526
|
-
}
|
|
527
255
|
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
528
256
|
}
|
|
529
257
|
if (appliedStyles) {
|
|
@@ -540,25 +268,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
540
268
|
const attachStyles = (hostRef) => {
|
|
541
269
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
542
270
|
const elm = hostRef.$hostElement$;
|
|
543
|
-
const flags = cmpMeta.$flags$;
|
|
544
271
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
545
|
-
|
|
546
|
-
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
547
|
-
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
548
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
549
|
-
// or this browser doesn't support native shadow dom
|
|
550
|
-
// and this host element was NOT created with SSR
|
|
551
|
-
// let's pick out the inner content for slot projection
|
|
552
|
-
// create a node to represent where the original
|
|
553
|
-
// content was first placed, which is useful later on
|
|
554
|
-
// DOM WRITE!!
|
|
555
|
-
elm['s-sc'] = scopeId;
|
|
556
|
-
elm.classList.add(scopeId + '-h');
|
|
557
|
-
}
|
|
272
|
+
addStyle(elm.getRootNode(), cmpMeta);
|
|
558
273
|
endAttachStyles();
|
|
559
274
|
};
|
|
560
275
|
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
561
|
-
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
|
562
276
|
/**
|
|
563
277
|
* Production setAccessor() function based on Preact by
|
|
564
278
|
* Jason Miller (@developit)
|
|
@@ -744,10 +458,6 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
744
458
|
// remember for later we need to check to relocate nodes
|
|
745
459
|
checkSlotRelocate = true;
|
|
746
460
|
if (newVNode.$tag$ === 'slot') {
|
|
747
|
-
if (scopeId) {
|
|
748
|
-
// scoped css needs to add its scoped id to the parent element
|
|
749
|
-
parentElm.classList.add(scopeId + '-s');
|
|
750
|
-
}
|
|
751
461
|
newVNode.$flags$ |= newVNode.$children$
|
|
752
462
|
? // slot element has fallback content
|
|
753
463
|
2 /* VNODE_FLAGS.isSlotFallback */
|
|
@@ -780,15 +490,10 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
780
490
|
{
|
|
781
491
|
updateElement(null, newVNode, isSvgMode);
|
|
782
492
|
}
|
|
783
|
-
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
784
|
-
// if there is a scopeId and this is the initial render
|
|
785
|
-
// then let's add the scopeId as a css class
|
|
786
|
-
elm.classList.add((elm['s-si'] = scopeId));
|
|
787
|
-
}
|
|
788
493
|
if (newVNode.$children$) {
|
|
789
494
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
790
495
|
// create the node
|
|
791
|
-
childNode = createElm(oldParentVNode, newVNode, i
|
|
496
|
+
childNode = createElm(oldParentVNode, newVNode, i);
|
|
792
497
|
// return node could have been null
|
|
793
498
|
if (childNode) {
|
|
794
499
|
// append our new node
|
|
@@ -851,30 +556,12 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
851
556
|
}
|
|
852
557
|
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
853
558
|
};
|
|
854
|
-
/**
|
|
855
|
-
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
856
|
-
* add them to the DOM in the appropriate place.
|
|
857
|
-
*
|
|
858
|
-
* @param parentElm the DOM node which should be used as a parent for the new
|
|
859
|
-
* DOM nodes
|
|
860
|
-
* @param before a child of the `parentElm` which the new children should be
|
|
861
|
-
* inserted before (optional)
|
|
862
|
-
* @param parentVNode the parent virtual DOM node
|
|
863
|
-
* @param vnodes the new child virtual DOM nodes to produce DOM nodes for
|
|
864
|
-
* @param startIdx the index in the child virtual DOM nodes at which to start
|
|
865
|
-
* creating DOM nodes (inclusive)
|
|
866
|
-
* @param endIdx the index in the child virtual DOM nodes at which to stop
|
|
867
|
-
* creating DOM nodes (inclusive)
|
|
868
|
-
*/
|
|
869
559
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
870
560
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
871
561
|
let childNode;
|
|
872
|
-
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
873
|
-
containerElm = containerElm.shadowRoot;
|
|
874
|
-
}
|
|
875
562
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
876
563
|
if (vnodes[startIdx]) {
|
|
877
|
-
childNode = createElm(null, parentVNode, startIdx
|
|
564
|
+
childNode = createElm(null, parentVNode, startIdx);
|
|
878
565
|
if (childNode) {
|
|
879
566
|
vnodes[startIdx].$elm$ = childNode;
|
|
880
567
|
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
@@ -882,40 +569,26 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
882
569
|
}
|
|
883
570
|
}
|
|
884
571
|
};
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
if (elm) {
|
|
902
|
-
{
|
|
903
|
-
// we're removing this element
|
|
904
|
-
// so it's possible we need to show slot fallback content now
|
|
905
|
-
checkSlotFallbackVisibility = true;
|
|
906
|
-
if (elm['s-ol']) {
|
|
907
|
-
// remove the original location comment
|
|
908
|
-
elm['s-ol'].remove();
|
|
909
|
-
}
|
|
910
|
-
else {
|
|
911
|
-
// it's possible that child nodes of the node
|
|
912
|
-
// that's being removed are slot nodes
|
|
913
|
-
putBackInOriginalLocation(elm, true);
|
|
914
|
-
}
|
|
572
|
+
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
573
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
574
|
+
if ((vnode = vnodes[startIdx])) {
|
|
575
|
+
elm = vnode.$elm$;
|
|
576
|
+
{
|
|
577
|
+
// we're removing this element
|
|
578
|
+
// so it's possible we need to show slot fallback content now
|
|
579
|
+
checkSlotFallbackVisibility = true;
|
|
580
|
+
if (elm['s-ol']) {
|
|
581
|
+
// remove the original location comment
|
|
582
|
+
elm['s-ol'].remove();
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
// it's possible that child nodes of the node
|
|
586
|
+
// that's being removed are slot nodes
|
|
587
|
+
putBackInOriginalLocation(elm, true);
|
|
915
588
|
}
|
|
916
|
-
// remove the vnode's element from the dom
|
|
917
|
-
elm.remove();
|
|
918
589
|
}
|
|
590
|
+
// remove the vnode's element from the dom
|
|
591
|
+
elm.remove();
|
|
919
592
|
}
|
|
920
593
|
}
|
|
921
594
|
};
|
|
@@ -1103,7 +776,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1103
776
|
// the key of the first new child OR the build is not using `key`
|
|
1104
777
|
// attributes at all. In either case we need to create a new element
|
|
1105
778
|
// for the new node.
|
|
1106
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx
|
|
779
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
1107
780
|
newStartVnode = newCh[++newStartIdx];
|
|
1108
781
|
}
|
|
1109
782
|
if (node) {
|
|
@@ -1136,8 +809,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1136
809
|
*
|
|
1137
810
|
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
1138
811
|
* changing order within a `children` array or something along those lines then
|
|
1139
|
-
* we could obtain a false
|
|
1140
|
-
* (i.e. we'd say two VNodes aren't equal when in fact they should be).
|
|
812
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
1141
813
|
*
|
|
1142
814
|
* @param leftVNode the first VNode to check
|
|
1143
815
|
* @param rightVNode the second VNode to check
|
|
@@ -1356,18 +1028,6 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
|
1356
1028
|
}
|
|
1357
1029
|
return slotNameAttr === '';
|
|
1358
1030
|
};
|
|
1359
|
-
/**
|
|
1360
|
-
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
1361
|
-
*
|
|
1362
|
-
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
|
1363
|
-
* function will handle creating a virtual DOM tree with a single root, patching
|
|
1364
|
-
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
|
1365
|
-
* relocation, and reflecting attributes.
|
|
1366
|
-
*
|
|
1367
|
-
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
1368
|
-
* the DOM node into which it should be rendered.
|
|
1369
|
-
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
1370
|
-
*/
|
|
1371
1031
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
1372
1032
|
const hostElm = hostRef.$hostElement$;
|
|
1373
1033
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -1381,13 +1041,10 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1381
1041
|
rootVnode.$tag$ = null;
|
|
1382
1042
|
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
1383
1043
|
hostRef.$vnode$ = rootVnode;
|
|
1384
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm
|
|
1385
|
-
{
|
|
1386
|
-
scopeId = hostElm['s-sc'];
|
|
1387
|
-
}
|
|
1044
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
|
1388
1045
|
{
|
|
1389
1046
|
contentRef = hostElm['s-cr'];
|
|
1390
|
-
useNativeShadowDom =
|
|
1047
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
1391
1048
|
// always reset
|
|
1392
1049
|
checkSlotFallbackVisibility = false;
|
|
1393
1050
|
}
|
|
@@ -1490,54 +1147,15 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
1490
1147
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1491
1148
|
return writeTask(dispatch) ;
|
|
1492
1149
|
};
|
|
1493
|
-
/**
|
|
1494
|
-
* Dispatch initial-render and update lifecycle hooks, enqueuing calls to
|
|
1495
|
-
* component lifecycle methods like `componentWillLoad` as well as
|
|
1496
|
-
* {@link updateComponent}, which will kick off the virtual DOM re-render.
|
|
1497
|
-
*
|
|
1498
|
-
* @param hostRef a reference to a host DOM node
|
|
1499
|
-
* @param isInitialLoad whether we're on the initial load or not
|
|
1500
|
-
* @returns an empty Promise which is used to enqueue a series of operations for
|
|
1501
|
-
* the component
|
|
1502
|
-
*/
|
|
1503
1150
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1504
1151
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
1505
1152
|
const instance = hostRef.$lazyInstance$ ;
|
|
1506
|
-
|
|
1507
|
-
// little promise-based queue. We start out with it `undefined`. When we add
|
|
1508
|
-
// the first function to the queue we'll set this variable to be that
|
|
1509
|
-
// function's return value. When we attempt to add subsequent values to the
|
|
1510
|
-
// queue we'll check that value and, if it was a `Promise`, we'll then chain
|
|
1511
|
-
// the new function off of that `Promise` using `.then()`. This will give our
|
|
1512
|
-
// queue two nice properties:
|
|
1513
|
-
//
|
|
1514
|
-
// 1. If all functions added to the queue are synchronous they'll be called
|
|
1515
|
-
// synchronously right away.
|
|
1516
|
-
// 2. If all functions added to the queue are asynchronous they'll all be
|
|
1517
|
-
// called in order after `dispatchHooks` exits.
|
|
1518
|
-
let maybePromise;
|
|
1153
|
+
let promise;
|
|
1519
1154
|
endSchedule();
|
|
1520
|
-
return
|
|
1155
|
+
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1521
1156
|
};
|
|
1522
|
-
/**
|
|
1523
|
-
* This function uses a Promise to implement a simple first-in, first-out queue
|
|
1524
|
-
* of functions to be called.
|
|
1525
|
-
*
|
|
1526
|
-
* The queue is ordered on the basis of the first argument. If it's
|
|
1527
|
-
* `undefined`, then nothing is on the queue yet, so the provided function can
|
|
1528
|
-
* be called synchronously (although note that this function may return a
|
|
1529
|
-
* `Promise`). The idea is that then the return value of that enqueueing
|
|
1530
|
-
* operation is kept around, so that if it was a `Promise` then subsequent
|
|
1531
|
-
* functions can be enqueued by calling this function again with that `Promise`
|
|
1532
|
-
* as the first argument.
|
|
1533
|
-
*
|
|
1534
|
-
* @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
|
|
1535
|
-
* @param fn a function to enqueue
|
|
1536
|
-
* @returns either a `Promise` or the return value of the provided function
|
|
1537
|
-
*/
|
|
1538
|
-
const enqueue = (maybePromise, fn) => maybePromise instanceof Promise ? maybePromise.then(fn) : fn();
|
|
1539
1157
|
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1540
|
-
|
|
1158
|
+
// updateComponent
|
|
1541
1159
|
const elm = hostRef.$hostElement$;
|
|
1542
1160
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1543
1161
|
const rc = elm['s-rc'];
|
|
@@ -1549,11 +1167,6 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1549
1167
|
{
|
|
1550
1168
|
callRender(hostRef, instance);
|
|
1551
1169
|
}
|
|
1552
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
1553
|
-
if (plt.$cssShim$) {
|
|
1554
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
1555
|
-
plt.$cssShim$.updateHost(elm);
|
|
1556
|
-
}
|
|
1557
1170
|
if (rc) {
|
|
1558
1171
|
// ok, so turns out there are some child host elements
|
|
1559
1172
|
// waiting on this parent element to load
|
|
@@ -1564,7 +1177,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1564
1177
|
endRender();
|
|
1565
1178
|
endUpdate();
|
|
1566
1179
|
{
|
|
1567
|
-
const childrenPromises =
|
|
1180
|
+
const childrenPromises = elm['s-p'];
|
|
1568
1181
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
1569
1182
|
if (childrenPromises.length === 0) {
|
|
1570
1183
|
postUpdate();
|
|
@@ -1658,6 +1271,9 @@ const safeCall = (instance, method, arg) => {
|
|
|
1658
1271
|
}
|
|
1659
1272
|
return undefined;
|
|
1660
1273
|
};
|
|
1274
|
+
const then = (promise, thenFn) => {
|
|
1275
|
+
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1276
|
+
};
|
|
1661
1277
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1662
1278
|
;
|
|
1663
1279
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
@@ -1811,9 +1427,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1811
1427
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1812
1428
|
// initializeComponent
|
|
1813
1429
|
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1814
|
-
// Let the runtime know that the component has been initialized
|
|
1815
|
-
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1816
1430
|
{
|
|
1431
|
+
// we haven't initialized this element yet
|
|
1432
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1817
1433
|
// lazy loaded components
|
|
1818
1434
|
// request the component's implementation to be
|
|
1819
1435
|
// wired up with the host element
|
|
@@ -1866,9 +1482,6 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1866
1482
|
const scopeId = getScopeId(cmpMeta);
|
|
1867
1483
|
if (!styles.has(scopeId)) {
|
|
1868
1484
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1869
|
-
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
1870
|
-
style = await Promise.resolve().then(function () { return require('./shadow-css-8baae635.js'); }).then((m) => m.scopeCss(style, scopeId, false));
|
|
1871
|
-
}
|
|
1872
1485
|
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1873
1486
|
endRegisterStyles();
|
|
1874
1487
|
}
|
|
@@ -1903,24 +1516,12 @@ const connectedCallback = (elm) => {
|
|
|
1903
1516
|
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1904
1517
|
// first time this component has connected
|
|
1905
1518
|
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1906
|
-
let hostId;
|
|
1907
1519
|
{
|
|
1908
|
-
hostId = elm.getAttribute(HYDRATE_ID);
|
|
1909
|
-
if (hostId) {
|
|
1910
|
-
if (supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1911
|
-
const scopeId = addStyle(elm.shadowRoot, cmpMeta);
|
|
1912
|
-
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
|
1913
|
-
}
|
|
1914
|
-
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
if (!hostId) {
|
|
1918
1520
|
// initUpdate
|
|
1919
1521
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1920
1522
|
// in here to act as original content anchors as we move nodes around
|
|
1921
1523
|
// host element has been connected to the DOM
|
|
1922
|
-
if ((
|
|
1923
|
-
cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1524
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1924
1525
|
setContentReference(elm);
|
|
1925
1526
|
}
|
|
1926
1527
|
}
|
|
@@ -1931,10 +1532,7 @@ const connectedCallback = (elm) => {
|
|
|
1931
1532
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1932
1533
|
// climb up the ancestors looking for the first
|
|
1933
1534
|
// component that hasn't finished its lifecycle update yet
|
|
1934
|
-
if (
|
|
1935
|
-
ancestorComponent.hasAttribute('s-id') &&
|
|
1936
|
-
ancestorComponent['s-p']) ||
|
|
1937
|
-
ancestorComponent['s-p']) {
|
|
1535
|
+
if (ancestorComponent['s-p']) {
|
|
1938
1536
|
// we found this components first ancestor component
|
|
1939
1537
|
// keep a reference to this component's ancestor component
|
|
1940
1538
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -1978,16 +1576,9 @@ const setContentReference = (elm) => {
|
|
|
1978
1576
|
const disconnectedCallback = (elm) => {
|
|
1979
1577
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1980
1578
|
getHostRef(elm);
|
|
1981
|
-
// clear CSS var-shim tracking
|
|
1982
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
1983
|
-
if (plt.$cssShim$) {
|
|
1984
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
1985
|
-
plt.$cssShim$.removeHost(elm);
|
|
1986
|
-
}
|
|
1987
1579
|
}
|
|
1988
1580
|
};
|
|
1989
1581
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1990
|
-
var _a;
|
|
1991
1582
|
const endBootstrap = createTime();
|
|
1992
1583
|
const cmpTags = [];
|
|
1993
1584
|
const exclude = options.exclude || [];
|
|
@@ -1996,22 +1587,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1996
1587
|
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
|
1997
1588
|
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
|
|
1998
1589
|
const deferredConnectedCallbacks = [];
|
|
1999
|
-
const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
2000
1590
|
let appLoadFallback;
|
|
2001
1591
|
let isBootstrapping = true;
|
|
2002
|
-
let i = 0;
|
|
2003
1592
|
Object.assign(plt, options);
|
|
2004
1593
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
2005
|
-
{
|
|
2006
|
-
// If the app is already hydrated there is not point to disable the
|
|
2007
|
-
// async queue. This will improve the first input delay
|
|
2008
|
-
plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
|
|
2009
|
-
}
|
|
2010
|
-
{
|
|
2011
|
-
for (; i < styles.length; i++) {
|
|
2012
|
-
registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
1594
|
lazyBundles.map((lazyBundle) => {
|
|
2016
1595
|
lazyBundle[1].map((compactMeta) => {
|
|
2017
1596
|
const cmpMeta = {
|
|
@@ -2029,10 +1608,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2029
1608
|
{
|
|
2030
1609
|
cmpMeta.$watchers$ = {};
|
|
2031
1610
|
}
|
|
2032
|
-
if (!supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2033
|
-
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
2034
|
-
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
|
2035
|
-
}
|
|
2036
1611
|
const tagName = cmpMeta.$tagName$;
|
|
2037
1612
|
const HostElement = class extends HTMLElement {
|
|
2038
1613
|
// StencilLazyHost
|
|
@@ -2041,20 +1616,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2041
1616
|
super(self);
|
|
2042
1617
|
self = this;
|
|
2043
1618
|
registerHost(self, cmpMeta);
|
|
2044
|
-
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2045
|
-
// this component is using shadow dom
|
|
2046
|
-
// and this browser supports shadow dom
|
|
2047
|
-
// add the read-only property "shadowRoot" to the host element
|
|
2048
|
-
// adding the shadow root build conditionals to minimize runtime
|
|
2049
|
-
if (supportsShadow) {
|
|
2050
|
-
{
|
|
2051
|
-
self.attachShadow({ mode: 'open' });
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
else if (!('shadowRoot' in self)) {
|
|
2055
|
-
self.shadowRoot = self;
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
1619
|
}
|
|
2059
1620
|
connectedCallback() {
|
|
2060
1621
|
if (appLoadFallback) {
|
|
@@ -2086,11 +1647,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2086
1647
|
{
|
|
2087
1648
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
2088
1649
|
visibilityStyle.setAttribute('data-styles', '');
|
|
2089
|
-
// Apply CSP nonce to the style tag if it exists
|
|
2090
|
-
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
2091
|
-
if (nonce != null) {
|
|
2092
|
-
visibilityStyle.setAttribute('nonce', nonce);
|
|
2093
|
-
}
|
|
2094
1650
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
2095
1651
|
}
|
|
2096
1652
|
// Process deferred connectedCallbacks now all components have been registered
|
|
@@ -2106,13 +1662,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2106
1662
|
// Fallback appLoad event
|
|
2107
1663
|
endBootstrap();
|
|
2108
1664
|
};
|
|
2109
|
-
/**
|
|
2110
|
-
* Assigns the given value to the nonce property on the runtime platform object.
|
|
2111
|
-
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
2112
|
-
* @param nonce The value to be assigned to the platform nonce property.
|
|
2113
|
-
* @returns void
|
|
2114
|
-
*/
|
|
2115
|
-
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
2116
1665
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
2117
1666
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
2118
1667
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -2156,8 +1705,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
2156
1705
|
};
|
|
2157
1706
|
const styles = /*@__PURE__*/ new Map();
|
|
2158
1707
|
const win = typeof window !== 'undefined' ? window : {};
|
|
2159
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
2160
|
-
const CSS = win.CSS ;
|
|
2161
1708
|
const doc = win.document || { head: {} };
|
|
2162
1709
|
const plt = {
|
|
2163
1710
|
$flags$: 0,
|
|
@@ -2168,10 +1715,6 @@ const plt = {
|
|
|
2168
1715
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
2169
1716
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
2170
1717
|
};
|
|
2171
|
-
const supportsShadow =
|
|
2172
|
-
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
2173
|
-
/*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
|
|
2174
|
-
;
|
|
2175
1718
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
2176
1719
|
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
2177
1720
|
try {
|
|
@@ -2225,15 +1768,9 @@ const flush = () => {
|
|
|
2225
1768
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
2226
1769
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
2227
1770
|
|
|
2228
|
-
exports.CSS = CSS;
|
|
2229
1771
|
exports.Host = Host;
|
|
2230
1772
|
exports.bootstrapLazy = bootstrapLazy;
|
|
2231
1773
|
exports.getElement = getElement;
|
|
2232
1774
|
exports.h = h;
|
|
2233
|
-
exports.plt = plt;
|
|
2234
1775
|
exports.promiseResolve = promiseResolve;
|
|
2235
1776
|
exports.registerInstance = registerInstance;
|
|
2236
|
-
exports.setNonce = setNonce;
|
|
2237
|
-
exports.win = win;
|
|
2238
|
-
|
|
2239
|
-
//# sourceMappingURL=index-29633529.js.map
|