@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
|
@@ -8,7 +8,6 @@ const NAMESPACE = 'cura';
|
|
|
8
8
|
*
|
|
9
9
|
* Modified for Stencil's renderer and slot projection
|
|
10
10
|
*/
|
|
11
|
-
let scopeId;
|
|
12
11
|
let contentRef;
|
|
13
12
|
let hostTagName;
|
|
14
13
|
let useNativeShadowDom = false;
|
|
@@ -30,13 +29,6 @@ const uniqueTime = (key, measureText) => {
|
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
};
|
|
33
|
-
const CONTENT_REF_ID = 'r';
|
|
34
|
-
const ORG_LOCATION_ID = 'o';
|
|
35
|
-
const SLOT_NODE_ID = 's';
|
|
36
|
-
const TEXT_NODE_ID = 't';
|
|
37
|
-
const HYDRATE_ID = 's-id';
|
|
38
|
-
const HYDRATED_STYLE_ID = 'sty-id';
|
|
39
|
-
const HYDRATE_CHILD_ID = 'c-id';
|
|
40
32
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
41
33
|
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
|
42
34
|
/**
|
|
@@ -52,31 +44,11 @@ const EMPTY_OBJ = {};
|
|
|
52
44
|
*/
|
|
53
45
|
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
54
46
|
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
|
55
|
-
const isDef = (v) => v != null;
|
|
56
|
-
/**
|
|
57
|
-
* Check whether a value is a 'complex type', defined here as an object or a
|
|
58
|
-
* function.
|
|
59
|
-
*
|
|
60
|
-
* @param o the value to check
|
|
61
|
-
* @returns whether it's a complex type or not
|
|
62
|
-
*/
|
|
63
47
|
const isComplexType = (o) => {
|
|
64
48
|
// https://jsperf.com/typeof-fn-object/5
|
|
65
49
|
o = typeof o;
|
|
66
50
|
return o === 'object' || o === 'function';
|
|
67
51
|
};
|
|
68
|
-
/**
|
|
69
|
-
* Helper method for querying a `meta` tag that contains a nonce value
|
|
70
|
-
* out of a DOM's head.
|
|
71
|
-
*
|
|
72
|
-
* @param doc The DOM containing the `head` to query against
|
|
73
|
-
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
|
74
|
-
* exists or the tag has no content.
|
|
75
|
-
*/
|
|
76
|
-
function queryNonceMetaTagContent(doc) {
|
|
77
|
-
var _a, _b, _c;
|
|
78
|
-
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;
|
|
79
|
-
}
|
|
80
52
|
/**
|
|
81
53
|
* Production h() function based on Preact by
|
|
82
54
|
* Jason Miller (@developit)
|
|
@@ -85,6 +57,7 @@ function queryNonceMetaTagContent(doc) {
|
|
|
85
57
|
*
|
|
86
58
|
* Modified for Stencil's compiler and vdom
|
|
87
59
|
*/
|
|
60
|
+
// const stack: any[] = [];
|
|
88
61
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
|
89
62
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
90
63
|
const h = (nodeName, vnodeData, ...children) => {
|
|
@@ -142,14 +115,6 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
142
115
|
}
|
|
143
116
|
return vnode;
|
|
144
117
|
};
|
|
145
|
-
/**
|
|
146
|
-
* A utility function for creating a virtual DOM node from a tag and some
|
|
147
|
-
* possible text content.
|
|
148
|
-
*
|
|
149
|
-
* @param tag the tag for this element
|
|
150
|
-
* @param text possible text content for the node
|
|
151
|
-
* @returns a newly-minted virtual DOM node
|
|
152
|
-
*/
|
|
153
118
|
const newVNode = (tag, text) => {
|
|
154
119
|
const vnode = {
|
|
155
120
|
$flags$: 0,
|
|
@@ -167,218 +132,7 @@ const newVNode = (tag, text) => {
|
|
|
167
132
|
return vnode;
|
|
168
133
|
};
|
|
169
134
|
const Host = {};
|
|
170
|
-
/**
|
|
171
|
-
* Check whether a given node is a Host node or not
|
|
172
|
-
*
|
|
173
|
-
* @param node the virtual DOM node to check
|
|
174
|
-
* @returns whether it's a Host node or not
|
|
175
|
-
*/
|
|
176
135
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
177
|
-
const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
|
|
178
|
-
const endHydrate = createTime('hydrateClient', tagName);
|
|
179
|
-
const shadowRoot = hostElm.shadowRoot;
|
|
180
|
-
const childRenderNodes = [];
|
|
181
|
-
const slotNodes = [];
|
|
182
|
-
const shadowRootNodes = shadowRoot ? [] : null;
|
|
183
|
-
const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
|
|
184
|
-
if (!plt.$orgLocNodes$) {
|
|
185
|
-
initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
|
|
186
|
-
}
|
|
187
|
-
hostElm[HYDRATE_ID] = hostId;
|
|
188
|
-
hostElm.removeAttribute(HYDRATE_ID);
|
|
189
|
-
clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
|
|
190
|
-
childRenderNodes.map((c) => {
|
|
191
|
-
const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
|
|
192
|
-
const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
|
|
193
|
-
const node = c.$elm$;
|
|
194
|
-
if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
|
|
195
|
-
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
|
|
196
|
-
}
|
|
197
|
-
if (!shadowRoot) {
|
|
198
|
-
node['s-hn'] = tagName;
|
|
199
|
-
if (orgLocationNode) {
|
|
200
|
-
node['s-ol'] = orgLocationNode;
|
|
201
|
-
node['s-ol']['s-nr'] = node;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
plt.$orgLocNodes$.delete(orgLocationId);
|
|
205
|
-
});
|
|
206
|
-
if (shadowRoot) {
|
|
207
|
-
shadowRootNodes.map((shadowRootNode) => {
|
|
208
|
-
if (shadowRootNode) {
|
|
209
|
-
shadowRoot.appendChild(shadowRootNode);
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
endHydrate();
|
|
214
|
-
};
|
|
215
|
-
const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
|
|
216
|
-
let childNodeType;
|
|
217
|
-
let childIdSplt;
|
|
218
|
-
let childVNode;
|
|
219
|
-
let i;
|
|
220
|
-
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
221
|
-
childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
|
|
222
|
-
if (childNodeType) {
|
|
223
|
-
// got the node data from the element's attribute
|
|
224
|
-
// `${hostId}.${nodeId}.${depth}.${index}`
|
|
225
|
-
childIdSplt = childNodeType.split('.');
|
|
226
|
-
if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
|
|
227
|
-
childVNode = {
|
|
228
|
-
$flags$: 0,
|
|
229
|
-
$hostId$: childIdSplt[0],
|
|
230
|
-
$nodeId$: childIdSplt[1],
|
|
231
|
-
$depth$: childIdSplt[2],
|
|
232
|
-
$index$: childIdSplt[3],
|
|
233
|
-
$tag$: node.tagName.toLowerCase(),
|
|
234
|
-
$elm$: node,
|
|
235
|
-
$attrs$: null,
|
|
236
|
-
$children$: null,
|
|
237
|
-
$key$: null,
|
|
238
|
-
$name$: null,
|
|
239
|
-
$text$: null,
|
|
240
|
-
};
|
|
241
|
-
childRenderNodes.push(childVNode);
|
|
242
|
-
node.removeAttribute(HYDRATE_CHILD_ID);
|
|
243
|
-
// this is a new child vnode
|
|
244
|
-
// so ensure its parent vnode has the vchildren array
|
|
245
|
-
if (!parentVNode.$children$) {
|
|
246
|
-
parentVNode.$children$ = [];
|
|
247
|
-
}
|
|
248
|
-
// add our child vnode to a specific index of the vnode's children
|
|
249
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
250
|
-
// this is now the new parent vnode for all the next child checks
|
|
251
|
-
parentVNode = childVNode;
|
|
252
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
253
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
// recursively drill down, end to start so we can remove nodes
|
|
258
|
-
for (i = node.childNodes.length - 1; i >= 0; i--) {
|
|
259
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
|
|
260
|
-
}
|
|
261
|
-
if (node.shadowRoot) {
|
|
262
|
-
// keep drilling down through the shadow root nodes
|
|
263
|
-
for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
|
|
264
|
-
clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
269
|
-
// `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
|
|
270
|
-
childIdSplt = node.nodeValue.split('.');
|
|
271
|
-
if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
|
|
272
|
-
// comment node for either the host id or a 0 host id
|
|
273
|
-
childNodeType = childIdSplt[0];
|
|
274
|
-
childVNode = {
|
|
275
|
-
$flags$: 0,
|
|
276
|
-
$hostId$: childIdSplt[1],
|
|
277
|
-
$nodeId$: childIdSplt[2],
|
|
278
|
-
$depth$: childIdSplt[3],
|
|
279
|
-
$index$: childIdSplt[4],
|
|
280
|
-
$elm$: node,
|
|
281
|
-
$attrs$: null,
|
|
282
|
-
$children$: null,
|
|
283
|
-
$key$: null,
|
|
284
|
-
$name$: null,
|
|
285
|
-
$tag$: null,
|
|
286
|
-
$text$: null,
|
|
287
|
-
};
|
|
288
|
-
if (childNodeType === TEXT_NODE_ID) {
|
|
289
|
-
childVNode.$elm$ = node.nextSibling;
|
|
290
|
-
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
|
|
291
|
-
childVNode.$text$ = childVNode.$elm$.textContent;
|
|
292
|
-
childRenderNodes.push(childVNode);
|
|
293
|
-
// remove the text comment since it's no longer needed
|
|
294
|
-
node.remove();
|
|
295
|
-
if (!parentVNode.$children$) {
|
|
296
|
-
parentVNode.$children$ = [];
|
|
297
|
-
}
|
|
298
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
299
|
-
if (shadowRootNodes && childVNode.$depth$ === '0') {
|
|
300
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
else if (childVNode.$hostId$ === hostId) {
|
|
305
|
-
// this comment node is specifcally for this host id
|
|
306
|
-
if (childNodeType === SLOT_NODE_ID) {
|
|
307
|
-
// `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
|
|
308
|
-
childVNode.$tag$ = 'slot';
|
|
309
|
-
if (childIdSplt[5]) {
|
|
310
|
-
node['s-sn'] = childVNode.$name$ = childIdSplt[5];
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
node['s-sn'] = '';
|
|
314
|
-
}
|
|
315
|
-
node['s-sr'] = true;
|
|
316
|
-
if (shadowRootNodes) {
|
|
317
|
-
// browser support shadowRoot and this is a shadow dom component
|
|
318
|
-
// create an actual slot element
|
|
319
|
-
childVNode.$elm$ = doc.createElement(childVNode.$tag$);
|
|
320
|
-
if (childVNode.$name$) {
|
|
321
|
-
// add the slot name attribute
|
|
322
|
-
childVNode.$elm$.setAttribute('name', childVNode.$name$);
|
|
323
|
-
}
|
|
324
|
-
// insert the new slot element before the slot comment
|
|
325
|
-
node.parentNode.insertBefore(childVNode.$elm$, node);
|
|
326
|
-
// remove the slot comment since it's not needed for shadow
|
|
327
|
-
node.remove();
|
|
328
|
-
if (childVNode.$depth$ === '0') {
|
|
329
|
-
shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
slotNodes.push(childVNode);
|
|
333
|
-
if (!parentVNode.$children$) {
|
|
334
|
-
parentVNode.$children$ = [];
|
|
335
|
-
}
|
|
336
|
-
parentVNode.$children$[childVNode.$index$] = childVNode;
|
|
337
|
-
}
|
|
338
|
-
else if (childNodeType === CONTENT_REF_ID) {
|
|
339
|
-
// `${CONTENT_REF_ID}.${hostId}`;
|
|
340
|
-
if (shadowRootNodes) {
|
|
341
|
-
// remove the content ref comment since it's not needed for shadow
|
|
342
|
-
node.remove();
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
hostElm['s-cr'] = node;
|
|
346
|
-
node['s-cn'] = true;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
else if (parentVNode && parentVNode.$tag$ === 'style') {
|
|
353
|
-
const vnode = newVNode(null, node.textContent);
|
|
354
|
-
vnode.$elm$ = node;
|
|
355
|
-
vnode.$index$ = '0';
|
|
356
|
-
parentVNode.$children$ = [vnode];
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
const initializeDocumentHydrate = (node, orgLocNodes) => {
|
|
360
|
-
if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
|
|
361
|
-
let i = 0;
|
|
362
|
-
for (; i < node.childNodes.length; i++) {
|
|
363
|
-
initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
|
|
364
|
-
}
|
|
365
|
-
if (node.shadowRoot) {
|
|
366
|
-
for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
|
|
367
|
-
initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
|
|
372
|
-
const childIdSplt = node.nodeValue.split('.');
|
|
373
|
-
if (childIdSplt[0] === ORG_LOCATION_ID) {
|
|
374
|
-
orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
|
|
375
|
-
node.nodeValue = '';
|
|
376
|
-
// useful to know if the original location is
|
|
377
|
-
// the root light-dom of a shadow dom component
|
|
378
|
-
node['s-en'] = childIdSplt[3];
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
};
|
|
382
136
|
/**
|
|
383
137
|
* Parse a new property value for a given property type.
|
|
384
138
|
*
|
|
@@ -457,7 +211,6 @@ const registerStyle = (scopeId, cssText, allowCS) => {
|
|
|
457
211
|
styles.set(scopeId, style);
|
|
458
212
|
};
|
|
459
213
|
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
460
|
-
var _a;
|
|
461
214
|
let scopeId = getScopeId(cmpMeta);
|
|
462
215
|
const style = styles.get(scopeId);
|
|
463
216
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
@@ -472,36 +225,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
472
225
|
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
473
226
|
}
|
|
474
227
|
if (!appliedStyles.has(scopeId)) {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
// This is only happening on native shadow-dom, do not needs CSS var shim
|
|
478
|
-
styleElm.innerHTML = style;
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
482
|
-
if (plt.$cssShim$) {
|
|
483
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
484
|
-
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style,
|
|
485
|
-
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
486
|
-
!!(cmpMeta.$flags$ & 10 /* CMP_FLAGS.needsScopedEncapsulation */));
|
|
487
|
-
const newScopeId = styleElm['s-sc'];
|
|
488
|
-
if (newScopeId) {
|
|
489
|
-
scopeId = newScopeId;
|
|
490
|
-
// we don't want to add this styleID to the appliedStyles Set
|
|
491
|
-
// since the cssVarShim might need to apply several different
|
|
492
|
-
// stylesheets for the same component
|
|
493
|
-
appliedStyles = null;
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
else {
|
|
228
|
+
{
|
|
229
|
+
{
|
|
497
230
|
styleElm = doc.createElement('style');
|
|
498
231
|
styleElm.innerHTML = style;
|
|
499
232
|
}
|
|
500
|
-
// Apply CSP nonce to the style tag if it exists
|
|
501
|
-
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
502
|
-
if (nonce != null) {
|
|
503
|
-
styleElm.setAttribute('nonce', nonce);
|
|
504
|
-
}
|
|
505
233
|
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
506
234
|
}
|
|
507
235
|
if (appliedStyles) {
|
|
@@ -518,25 +246,11 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
518
246
|
const attachStyles = (hostRef) => {
|
|
519
247
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
520
248
|
const elm = hostRef.$hostElement$;
|
|
521
|
-
const flags = cmpMeta.$flags$;
|
|
522
249
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
523
|
-
|
|
524
|
-
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
525
|
-
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
526
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
527
|
-
// or this browser doesn't support native shadow dom
|
|
528
|
-
// and this host element was NOT created with SSR
|
|
529
|
-
// let's pick out the inner content for slot projection
|
|
530
|
-
// create a node to represent where the original
|
|
531
|
-
// content was first placed, which is useful later on
|
|
532
|
-
// DOM WRITE!!
|
|
533
|
-
elm['s-sc'] = scopeId;
|
|
534
|
-
elm.classList.add(scopeId + '-h');
|
|
535
|
-
}
|
|
250
|
+
addStyle(elm.getRootNode(), cmpMeta);
|
|
536
251
|
endAttachStyles();
|
|
537
252
|
};
|
|
538
253
|
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
539
|
-
const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
|
|
540
254
|
/**
|
|
541
255
|
* Production setAccessor() function based on Preact by
|
|
542
256
|
* Jason Miller (@developit)
|
|
@@ -722,10 +436,6 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
722
436
|
// remember for later we need to check to relocate nodes
|
|
723
437
|
checkSlotRelocate = true;
|
|
724
438
|
if (newVNode.$tag$ === 'slot') {
|
|
725
|
-
if (scopeId) {
|
|
726
|
-
// scoped css needs to add its scoped id to the parent element
|
|
727
|
-
parentElm.classList.add(scopeId + '-s');
|
|
728
|
-
}
|
|
729
439
|
newVNode.$flags$ |= newVNode.$children$
|
|
730
440
|
? // slot element has fallback content
|
|
731
441
|
2 /* VNODE_FLAGS.isSlotFallback */
|
|
@@ -758,15 +468,10 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
758
468
|
{
|
|
759
469
|
updateElement(null, newVNode, isSvgMode);
|
|
760
470
|
}
|
|
761
|
-
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
|
762
|
-
// if there is a scopeId and this is the initial render
|
|
763
|
-
// then let's add the scopeId as a css class
|
|
764
|
-
elm.classList.add((elm['s-si'] = scopeId));
|
|
765
|
-
}
|
|
766
471
|
if (newVNode.$children$) {
|
|
767
472
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
768
473
|
// create the node
|
|
769
|
-
childNode = createElm(oldParentVNode, newVNode, i
|
|
474
|
+
childNode = createElm(oldParentVNode, newVNode, i);
|
|
770
475
|
// return node could have been null
|
|
771
476
|
if (childNode) {
|
|
772
477
|
// append our new node
|
|
@@ -829,30 +534,12 @@ const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
|
829
534
|
}
|
|
830
535
|
plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
|
|
831
536
|
};
|
|
832
|
-
/**
|
|
833
|
-
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
|
834
|
-
* add them to the DOM in the appropriate place.
|
|
835
|
-
*
|
|
836
|
-
* @param parentElm the DOM node which should be used as a parent for the new
|
|
837
|
-
* DOM nodes
|
|
838
|
-
* @param before a child of the `parentElm` which the new children should be
|
|
839
|
-
* inserted before (optional)
|
|
840
|
-
* @param parentVNode the parent virtual DOM node
|
|
841
|
-
* @param vnodes the new child virtual DOM nodes to produce DOM nodes for
|
|
842
|
-
* @param startIdx the index in the child virtual DOM nodes at which to start
|
|
843
|
-
* creating DOM nodes (inclusive)
|
|
844
|
-
* @param endIdx the index in the child virtual DOM nodes at which to stop
|
|
845
|
-
* creating DOM nodes (inclusive)
|
|
846
|
-
*/
|
|
847
537
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
848
538
|
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
849
539
|
let childNode;
|
|
850
|
-
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
851
|
-
containerElm = containerElm.shadowRoot;
|
|
852
|
-
}
|
|
853
540
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
854
541
|
if (vnodes[startIdx]) {
|
|
855
|
-
childNode = createElm(null, parentVNode, startIdx
|
|
542
|
+
childNode = createElm(null, parentVNode, startIdx);
|
|
856
543
|
if (childNode) {
|
|
857
544
|
vnodes[startIdx].$elm$ = childNode;
|
|
858
545
|
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
@@ -860,40 +547,26 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
|
|
|
860
547
|
}
|
|
861
548
|
}
|
|
862
549
|
};
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
if (elm) {
|
|
880
|
-
{
|
|
881
|
-
// we're removing this element
|
|
882
|
-
// so it's possible we need to show slot fallback content now
|
|
883
|
-
checkSlotFallbackVisibility = true;
|
|
884
|
-
if (elm['s-ol']) {
|
|
885
|
-
// remove the original location comment
|
|
886
|
-
elm['s-ol'].remove();
|
|
887
|
-
}
|
|
888
|
-
else {
|
|
889
|
-
// it's possible that child nodes of the node
|
|
890
|
-
// that's being removed are slot nodes
|
|
891
|
-
putBackInOriginalLocation(elm, true);
|
|
892
|
-
}
|
|
550
|
+
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
551
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
|
552
|
+
if ((vnode = vnodes[startIdx])) {
|
|
553
|
+
elm = vnode.$elm$;
|
|
554
|
+
{
|
|
555
|
+
// we're removing this element
|
|
556
|
+
// so it's possible we need to show slot fallback content now
|
|
557
|
+
checkSlotFallbackVisibility = true;
|
|
558
|
+
if (elm['s-ol']) {
|
|
559
|
+
// remove the original location comment
|
|
560
|
+
elm['s-ol'].remove();
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
// it's possible that child nodes of the node
|
|
564
|
+
// that's being removed are slot nodes
|
|
565
|
+
putBackInOriginalLocation(elm, true);
|
|
893
566
|
}
|
|
894
|
-
// remove the vnode's element from the dom
|
|
895
|
-
elm.remove();
|
|
896
567
|
}
|
|
568
|
+
// remove the vnode's element from the dom
|
|
569
|
+
elm.remove();
|
|
897
570
|
}
|
|
898
571
|
}
|
|
899
572
|
};
|
|
@@ -1081,7 +754,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1081
754
|
// the key of the first new child OR the build is not using `key`
|
|
1082
755
|
// attributes at all. In either case we need to create a new element
|
|
1083
756
|
// for the new node.
|
|
1084
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx
|
|
757
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
1085
758
|
newStartVnode = newCh[++newStartIdx];
|
|
1086
759
|
}
|
|
1087
760
|
if (node) {
|
|
@@ -1114,8 +787,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
1114
787
|
*
|
|
1115
788
|
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
1116
789
|
* changing order within a `children` array or something along those lines then
|
|
1117
|
-
* we could obtain a false
|
|
1118
|
-
* (i.e. we'd say two VNodes aren't equal when in fact they should be).
|
|
790
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
1119
791
|
*
|
|
1120
792
|
* @param leftVNode the first VNode to check
|
|
1121
793
|
* @param rightVNode the second VNode to check
|
|
@@ -1334,18 +1006,6 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
|
1334
1006
|
}
|
|
1335
1007
|
return slotNameAttr === '';
|
|
1336
1008
|
};
|
|
1337
|
-
/**
|
|
1338
|
-
* The main entry point for Stencil's virtual DOM-based rendering engine
|
|
1339
|
-
*
|
|
1340
|
-
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
|
1341
|
-
* function will handle creating a virtual DOM tree with a single root, patching
|
|
1342
|
-
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
|
1343
|
-
* relocation, and reflecting attributes.
|
|
1344
|
-
*
|
|
1345
|
-
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
|
1346
|
-
* the DOM node into which it should be rendered.
|
|
1347
|
-
* @param renderFnResults the virtual DOM nodes to be rendered
|
|
1348
|
-
*/
|
|
1349
1009
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
1350
1010
|
const hostElm = hostRef.$hostElement$;
|
|
1351
1011
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
@@ -1359,13 +1019,10 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
1359
1019
|
rootVnode.$tag$ = null;
|
|
1360
1020
|
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
1361
1021
|
hostRef.$vnode$ = rootVnode;
|
|
1362
|
-
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm
|
|
1363
|
-
{
|
|
1364
|
-
scopeId = hostElm['s-sc'];
|
|
1365
|
-
}
|
|
1022
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm);
|
|
1366
1023
|
{
|
|
1367
1024
|
contentRef = hostElm['s-cr'];
|
|
1368
|
-
useNativeShadowDom =
|
|
1025
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
|
1369
1026
|
// always reset
|
|
1370
1027
|
checkSlotFallbackVisibility = false;
|
|
1371
1028
|
}
|
|
@@ -1468,54 +1125,15 @@ const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
|
1468
1125
|
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
|
1469
1126
|
return writeTask(dispatch) ;
|
|
1470
1127
|
};
|
|
1471
|
-
/**
|
|
1472
|
-
* Dispatch initial-render and update lifecycle hooks, enqueuing calls to
|
|
1473
|
-
* component lifecycle methods like `componentWillLoad` as well as
|
|
1474
|
-
* {@link updateComponent}, which will kick off the virtual DOM re-render.
|
|
1475
|
-
*
|
|
1476
|
-
* @param hostRef a reference to a host DOM node
|
|
1477
|
-
* @param isInitialLoad whether we're on the initial load or not
|
|
1478
|
-
* @returns an empty Promise which is used to enqueue a series of operations for
|
|
1479
|
-
* the component
|
|
1480
|
-
*/
|
|
1481
1128
|
const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
1482
1129
|
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
|
1483
1130
|
const instance = hostRef.$lazyInstance$ ;
|
|
1484
|
-
|
|
1485
|
-
// little promise-based queue. We start out with it `undefined`. When we add
|
|
1486
|
-
// the first function to the queue we'll set this variable to be that
|
|
1487
|
-
// function's return value. When we attempt to add subsequent values to the
|
|
1488
|
-
// queue we'll check that value and, if it was a `Promise`, we'll then chain
|
|
1489
|
-
// the new function off of that `Promise` using `.then()`. This will give our
|
|
1490
|
-
// queue two nice properties:
|
|
1491
|
-
//
|
|
1492
|
-
// 1. If all functions added to the queue are synchronous they'll be called
|
|
1493
|
-
// synchronously right away.
|
|
1494
|
-
// 2. If all functions added to the queue are asynchronous they'll all be
|
|
1495
|
-
// called in order after `dispatchHooks` exits.
|
|
1496
|
-
let maybePromise;
|
|
1131
|
+
let promise;
|
|
1497
1132
|
endSchedule();
|
|
1498
|
-
return
|
|
1133
|
+
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
|
|
1499
1134
|
};
|
|
1500
|
-
/**
|
|
1501
|
-
* This function uses a Promise to implement a simple first-in, first-out queue
|
|
1502
|
-
* of functions to be called.
|
|
1503
|
-
*
|
|
1504
|
-
* The queue is ordered on the basis of the first argument. If it's
|
|
1505
|
-
* `undefined`, then nothing is on the queue yet, so the provided function can
|
|
1506
|
-
* be called synchronously (although note that this function may return a
|
|
1507
|
-
* `Promise`). The idea is that then the return value of that enqueueing
|
|
1508
|
-
* operation is kept around, so that if it was a `Promise` then subsequent
|
|
1509
|
-
* functions can be enqueued by calling this function again with that `Promise`
|
|
1510
|
-
* as the first argument.
|
|
1511
|
-
*
|
|
1512
|
-
* @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
|
|
1513
|
-
* @param fn a function to enqueue
|
|
1514
|
-
* @returns either a `Promise` or the return value of the provided function
|
|
1515
|
-
*/
|
|
1516
|
-
const enqueue = (maybePromise, fn) => maybePromise instanceof Promise ? maybePromise.then(fn) : fn();
|
|
1517
1135
|
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
1518
|
-
|
|
1136
|
+
// updateComponent
|
|
1519
1137
|
const elm = hostRef.$hostElement$;
|
|
1520
1138
|
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
|
1521
1139
|
const rc = elm['s-rc'];
|
|
@@ -1527,11 +1145,6 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1527
1145
|
{
|
|
1528
1146
|
callRender(hostRef, instance);
|
|
1529
1147
|
}
|
|
1530
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
1531
|
-
if (plt.$cssShim$) {
|
|
1532
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
1533
|
-
plt.$cssShim$.updateHost(elm);
|
|
1534
|
-
}
|
|
1535
1148
|
if (rc) {
|
|
1536
1149
|
// ok, so turns out there are some child host elements
|
|
1537
1150
|
// waiting on this parent element to load
|
|
@@ -1542,7 +1155,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
1542
1155
|
endRender();
|
|
1543
1156
|
endUpdate();
|
|
1544
1157
|
{
|
|
1545
|
-
const childrenPromises =
|
|
1158
|
+
const childrenPromises = elm['s-p'];
|
|
1546
1159
|
const postUpdate = () => postUpdateComponent(hostRef);
|
|
1547
1160
|
if (childrenPromises.length === 0) {
|
|
1548
1161
|
postUpdate();
|
|
@@ -1636,6 +1249,9 @@ const safeCall = (instance, method, arg) => {
|
|
|
1636
1249
|
}
|
|
1637
1250
|
return undefined;
|
|
1638
1251
|
};
|
|
1252
|
+
const then = (promise, thenFn) => {
|
|
1253
|
+
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
1254
|
+
};
|
|
1639
1255
|
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
1640
1256
|
;
|
|
1641
1257
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
@@ -1789,9 +1405,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1789
1405
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
1790
1406
|
// initializeComponent
|
|
1791
1407
|
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
1792
|
-
// Let the runtime know that the component has been initialized
|
|
1793
|
-
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1794
1408
|
{
|
|
1409
|
+
// we haven't initialized this element yet
|
|
1410
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
1795
1411
|
// lazy loaded components
|
|
1796
1412
|
// request the component's implementation to be
|
|
1797
1413
|
// wired up with the host element
|
|
@@ -1844,9 +1460,6 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
1844
1460
|
const scopeId = getScopeId(cmpMeta);
|
|
1845
1461
|
if (!styles.has(scopeId)) {
|
|
1846
1462
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
1847
|
-
if (cmpMeta.$flags$ & 8 /* CMP_FLAGS.needsShadowDomShim */) {
|
|
1848
|
-
style = await import('./shadow-css-07b0c8c8.js').then((m) => m.scopeCss(style, scopeId, false));
|
|
1849
|
-
}
|
|
1850
1463
|
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
1851
1464
|
endRegisterStyles();
|
|
1852
1465
|
}
|
|
@@ -1881,24 +1494,12 @@ const connectedCallback = (elm) => {
|
|
|
1881
1494
|
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1882
1495
|
// first time this component has connected
|
|
1883
1496
|
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1884
|
-
let hostId;
|
|
1885
1497
|
{
|
|
1886
|
-
hostId = elm.getAttribute(HYDRATE_ID);
|
|
1887
|
-
if (hostId) {
|
|
1888
|
-
if (supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1889
|
-
const scopeId = addStyle(elm.shadowRoot, cmpMeta);
|
|
1890
|
-
elm.classList.remove(scopeId + '-h', scopeId + '-s');
|
|
1891
|
-
}
|
|
1892
|
-
initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
|
-
if (!hostId) {
|
|
1896
1498
|
// initUpdate
|
|
1897
1499
|
// if the slot polyfill is required we'll need to put some nodes
|
|
1898
1500
|
// in here to act as original content anchors as we move nodes around
|
|
1899
1501
|
// host element has been connected to the DOM
|
|
1900
|
-
if ((
|
|
1901
|
-
cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1502
|
+
if ((cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
|
|
1902
1503
|
setContentReference(elm);
|
|
1903
1504
|
}
|
|
1904
1505
|
}
|
|
@@ -1909,10 +1510,7 @@ const connectedCallback = (elm) => {
|
|
|
1909
1510
|
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
|
1910
1511
|
// climb up the ancestors looking for the first
|
|
1911
1512
|
// component that hasn't finished its lifecycle update yet
|
|
1912
|
-
if (
|
|
1913
|
-
ancestorComponent.hasAttribute('s-id') &&
|
|
1914
|
-
ancestorComponent['s-p']) ||
|
|
1915
|
-
ancestorComponent['s-p']) {
|
|
1513
|
+
if (ancestorComponent['s-p']) {
|
|
1916
1514
|
// we found this components first ancestor component
|
|
1917
1515
|
// keep a reference to this component's ancestor component
|
|
1918
1516
|
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
|
@@ -1956,16 +1554,9 @@ const setContentReference = (elm) => {
|
|
|
1956
1554
|
const disconnectedCallback = (elm) => {
|
|
1957
1555
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1958
1556
|
getHostRef(elm);
|
|
1959
|
-
// clear CSS var-shim tracking
|
|
1960
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
1961
|
-
if (plt.$cssShim$) {
|
|
1962
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
1963
|
-
plt.$cssShim$.removeHost(elm);
|
|
1964
|
-
}
|
|
1965
1557
|
}
|
|
1966
1558
|
};
|
|
1967
1559
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1968
|
-
var _a;
|
|
1969
1560
|
const endBootstrap = createTime();
|
|
1970
1561
|
const cmpTags = [];
|
|
1971
1562
|
const exclude = options.exclude || [];
|
|
@@ -1974,22 +1565,10 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1974
1565
|
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
|
1975
1566
|
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
|
|
1976
1567
|
const deferredConnectedCallbacks = [];
|
|
1977
|
-
const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
|
|
1978
1568
|
let appLoadFallback;
|
|
1979
1569
|
let isBootstrapping = true;
|
|
1980
|
-
let i = 0;
|
|
1981
1570
|
Object.assign(plt, options);
|
|
1982
1571
|
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
|
1983
|
-
{
|
|
1984
|
-
// If the app is already hydrated there is not point to disable the
|
|
1985
|
-
// async queue. This will improve the first input delay
|
|
1986
|
-
plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
|
|
1987
|
-
}
|
|
1988
|
-
{
|
|
1989
|
-
for (; i < styles.length; i++) {
|
|
1990
|
-
registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
|
|
1991
|
-
}
|
|
1992
|
-
}
|
|
1993
1572
|
lazyBundles.map((lazyBundle) => {
|
|
1994
1573
|
lazyBundle[1].map((compactMeta) => {
|
|
1995
1574
|
const cmpMeta = {
|
|
@@ -2007,10 +1586,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2007
1586
|
{
|
|
2008
1587
|
cmpMeta.$watchers$ = {};
|
|
2009
1588
|
}
|
|
2010
|
-
if (!supportsShadow && cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2011
|
-
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
2012
|
-
cmpMeta.$flags$ |= 8 /* CMP_FLAGS.needsShadowDomShim */;
|
|
2013
|
-
}
|
|
2014
1589
|
const tagName = cmpMeta.$tagName$;
|
|
2015
1590
|
const HostElement = class extends HTMLElement {
|
|
2016
1591
|
// StencilLazyHost
|
|
@@ -2019,20 +1594,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2019
1594
|
super(self);
|
|
2020
1595
|
self = this;
|
|
2021
1596
|
registerHost(self, cmpMeta);
|
|
2022
|
-
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
2023
|
-
// this component is using shadow dom
|
|
2024
|
-
// and this browser supports shadow dom
|
|
2025
|
-
// add the read-only property "shadowRoot" to the host element
|
|
2026
|
-
// adding the shadow root build conditionals to minimize runtime
|
|
2027
|
-
if (supportsShadow) {
|
|
2028
|
-
{
|
|
2029
|
-
self.attachShadow({ mode: 'open' });
|
|
2030
|
-
}
|
|
2031
|
-
}
|
|
2032
|
-
else if (!('shadowRoot' in self)) {
|
|
2033
|
-
self.shadowRoot = self;
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2036
1597
|
}
|
|
2037
1598
|
connectedCallback() {
|
|
2038
1599
|
if (appLoadFallback) {
|
|
@@ -2064,11 +1625,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2064
1625
|
{
|
|
2065
1626
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
2066
1627
|
visibilityStyle.setAttribute('data-styles', '');
|
|
2067
|
-
// Apply CSP nonce to the style tag if it exists
|
|
2068
|
-
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
2069
|
-
if (nonce != null) {
|
|
2070
|
-
visibilityStyle.setAttribute('nonce', nonce);
|
|
2071
|
-
}
|
|
2072
1628
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
2073
1629
|
}
|
|
2074
1630
|
// Process deferred connectedCallbacks now all components have been registered
|
|
@@ -2084,13 +1640,6 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
2084
1640
|
// Fallback appLoad event
|
|
2085
1641
|
endBootstrap();
|
|
2086
1642
|
};
|
|
2087
|
-
/**
|
|
2088
|
-
* Assigns the given value to the nonce property on the runtime platform object.
|
|
2089
|
-
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
2090
|
-
* @param nonce The value to be assigned to the platform nonce property.
|
|
2091
|
-
* @returns void
|
|
2092
|
-
*/
|
|
2093
|
-
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
2094
1643
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
2095
1644
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
2096
1645
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -2134,8 +1683,6 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
2134
1683
|
};
|
|
2135
1684
|
const styles = /*@__PURE__*/ new Map();
|
|
2136
1685
|
const win = typeof window !== 'undefined' ? window : {};
|
|
2137
|
-
// TODO(STENCIL-659): Remove code implementing the CSS variable shim
|
|
2138
|
-
const CSS = win.CSS ;
|
|
2139
1686
|
const doc = win.document || { head: {} };
|
|
2140
1687
|
const plt = {
|
|
2141
1688
|
$flags$: 0,
|
|
@@ -2146,10 +1693,6 @@ const plt = {
|
|
|
2146
1693
|
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
2147
1694
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
2148
1695
|
};
|
|
2149
|
-
const supportsShadow =
|
|
2150
|
-
// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
|
|
2151
|
-
/*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)()
|
|
2152
|
-
;
|
|
2153
1696
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
2154
1697
|
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
2155
1698
|
try {
|
|
@@ -2203,6 +1746,4 @@ const flush = () => {
|
|
|
2203
1746
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
2204
1747
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
2205
1748
|
|
|
2206
|
-
export {
|
|
2207
|
-
|
|
2208
|
-
//# sourceMappingURL=index-e11775ce.js.map
|
|
1749
|
+
export { Host as H, bootstrapLazy as b, getElement as g, h, promiseResolve as p, registerInstance as r };
|