@paperless/core 0.1.0-alpha.2 → 0.1.0-alpha.5
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/CHANGELOG.md +33 -0
- package/dist/{paperless/p-bbd1d3df.entry.js → build/p-4144f8a0.entry.js} +1 -1
- package/dist/build/p-c04e9d44.entry.js +1 -0
- package/dist/build/{p-feec8ec1.entry.js → p-f04c4de0.entry.js} +1 -1
- package/dist/build/p-f33e1285.js +2 -0
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/{index-5b30cb95.js → index-a2da05ae.js} +406 -7
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{p-icon.cjs.entry.js → p-button_3.cjs.entry.js} +108 -1
- package/dist/cjs/p-illustration.cjs.entry.js +1 -1
- package/dist/cjs/p-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/paperless.cjs.js +2 -2
- package/dist/collection/components/atoms/button/button.component.css +68 -3
- package/dist/collection/components/atoms/button/button.component.js +241 -7
- package/dist/{esm/p-icon.entry.js → components/icon.component.js} +26 -7
- package/dist/{esm/p-loader.entry.js → components/loader.component.js} +29 -8
- package/dist/components/p-button.js +67 -8
- package/dist/components/p-icon.js +1 -815
- package/dist/components/p-loader.js +1 -72
- package/dist/esm/{index-111a6307.js → index-d08bfe75.js} +406 -8
- package/dist/esm/loader.js +2 -2
- package/dist/esm/p-button_3.entry.js +903 -0
- package/dist/esm/p-illustration.entry.js +1 -1
- package/dist/esm/p-tooltip.entry.js +1 -1
- package/dist/esm/paperless.js +2 -2
- package/dist/index.html +1 -1
- package/dist/{build/p-bbd1d3df.entry.js → paperless/p-4144f8a0.entry.js} +1 -1
- package/dist/paperless/p-c04e9d44.entry.js +1 -0
- package/dist/paperless/{p-feec8ec1.entry.js → p-f04c4de0.entry.js} +1 -1
- package/dist/paperless/p-f33e1285.js +2 -0
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +33 -55
- package/dist/types/components/atoms/button/button.component.d.ts +45 -1
- package/dist/types/components.d.ts +83 -2
- package/package.json +1 -1
- package/dist/build/p-1d13a9d2.entry.js +0 -1
- package/dist/build/p-208c1f28.entry.js +0 -1
- package/dist/build/p-98d07776.js +0 -2
- package/dist/build/p-cd525dcc.entry.js +0 -1
- package/dist/cjs/p-button.cjs.entry.js +0 -23
- package/dist/cjs/p-loader.cjs.entry.js +0 -57
- package/dist/esm/p-button.entry.js +0 -19
- package/dist/paperless/p-1d13a9d2.entry.js +0 -1
- package/dist/paperless/p-208c1f28.entry.js +0 -1
- package/dist/paperless/p-98d07776.js +0 -2
- package/dist/paperless/p-cd525dcc.entry.js +0 -1
|
@@ -1,75 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const loaderComponentCss = "/*! tailwindcss v3.1.4 | MIT License | https://tailwindcss.com*/*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;border:0 solid;box-sizing:border-box}:after,:before{--tw-content:\"\"}html{-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}::-webkit-backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed!important}.top-0{top:0!important}.left-0{left:0!important}.inline-block{display:inline-block!important}.flex{display:flex!important}.h-\\[1em\\]{height:1em!important}.w-\\[1em\\]{width:1em!important}.w-screen{width:100vw!important}.w-full{width:100%!important}@-webkit-keyframes spin{to{transform:rotate(1turn)}}.animate-spin{-webkit-animation:spin 1s linear infinite!important;animation:spin 1s linear infinite!important}.items-center{align-items:center!important}.border-2{border-width:2px!important}.border-solid{border-style:solid!important}.border-indigo-light{--tw-border-opacity:1!important;border-color:rgb(241 246 255/var(--tw-border-opacity))!important}.border-storm-light\\/40{border-color:rgba(176,178,203,.4)!important}.border-indigo-light\\/40{border-color:rgba(241,246,255,.4)!important}.border-t-indigo{--tw-border-opacity:1!important;border-top-color:rgb(82 138 250/var(--tw-border-opacity))!important}.border-t-storm{--tw-border-opacity:1!important;border-top-color:rgb(81 83 107/var(--tw-border-opacity))!important}.border-t-white{--tw-border-opacity:1!important;border-top-color:rgb(255 255 255/var(--tw-border-opacity))!important}:host .loader{--tw-border-opacity:1!important;-webkit-animation:spin 1s linear infinite;animation:spin 1s linear infinite;border-color:rgb(241 246 255/var(--tw-border-opacity))!important;border-radius:100%;border-style:solid!important;border-top:solid rgb(82 138 250/var(--tw-border-opacity))!important;border-width:2px!important;display:inline-block;height:1em;transition-duration:.5s;width:1em}:host .loader.color-storm{--tw-border-opacity:1!important;border-color:rgba(176,178,203,.4)!important;border-top-color:rgb(81 83 107/var(--tw-border-opacity))!important}:host .loader.color-white{--tw-border-opacity:1!important;border-color:rgba(241,246,255,.4)!important;border-top-color:rgb(255 255 255/var(--tw-border-opacity))!important}:host .loading-screen{--tw-bg-opacity:1;align-items:center;background-color:rgb(247 250 252/var(--tw-bg-opacity));display:flex;height:100vh;justify-content:center;left:0;position:fixed;top:0;width:100vw;z-index:9999}:host .loading-screen .content{max-width:20rem}:host .loading-screen .content .loader-wrapper{display:flex;justify-content:center;width:100%}:host .loading-screen .content .loader-wrapper .loader{font-size:2.25rem;line-height:2.5rem}.static{position:static!important}.inline{display:inline!important}.justify-center{justify-content:center!important}.text-4xl{font-size:2.25rem!important;line-height:2.5rem!important}";
|
|
4
|
-
|
|
5
|
-
const Loader = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
this.__registerHost();
|
|
9
|
-
this.__attachShadow();
|
|
10
|
-
/**
|
|
11
|
-
* Wether to show or hide the loader
|
|
12
|
-
*/
|
|
13
|
-
this.show = true;
|
|
14
|
-
/**
|
|
15
|
-
* Variant of loader
|
|
16
|
-
*/
|
|
17
|
-
this.variant = 'inline';
|
|
18
|
-
/**
|
|
19
|
-
* Color of the loader
|
|
20
|
-
*/
|
|
21
|
-
this.color = 'indigo';
|
|
22
|
-
this._show = this.show;
|
|
23
|
-
this._loader = (h("div", { class: `loader color-${this.color}` }));
|
|
24
|
-
}
|
|
25
|
-
componentWillRender() {
|
|
26
|
-
this._checkShow();
|
|
27
|
-
}
|
|
28
|
-
componentShouldUpdate() {
|
|
29
|
-
this._checkShow();
|
|
30
|
-
}
|
|
31
|
-
render() {
|
|
32
|
-
if (!this._show) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (this.variant === 'full-screen') {
|
|
36
|
-
return (h(Host, { class: "p-loader" }, h("div", { class: "loading-screen" }, h("div", { class: "content" }, h("slot", null), h("div", { class: "loader-wrapper" }, this._loader)))));
|
|
37
|
-
}
|
|
38
|
-
return h(Host, { class: `p-loader ${this.variant === 'full-width' && 'w-100 d-block flex justify-center text-4xl'}` }, this._loader);
|
|
39
|
-
}
|
|
40
|
-
_checkShow() {
|
|
41
|
-
var _a;
|
|
42
|
-
if (this._showSubscriber) {
|
|
43
|
-
this._showSubscriber.unsubscribe();
|
|
44
|
-
this._showSubscriber = null;
|
|
45
|
-
}
|
|
46
|
-
if (typeof this.show !== 'boolean') {
|
|
47
|
-
this._showSubscriber = (_a = this.show) === null || _a === void 0 ? void 0 : _a.subscribe(show => (this._show = show));
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
this._show = this.show;
|
|
51
|
-
}
|
|
52
|
-
static get style() { return loaderComponentCss; }
|
|
53
|
-
}, [1, "p-loader", {
|
|
54
|
-
"show": [4],
|
|
55
|
-
"variant": [1],
|
|
56
|
-
"color": [1],
|
|
57
|
-
"modalTitle": [1, "modal-title"],
|
|
58
|
-
"modalDescription": [1, "modal-description"]
|
|
59
|
-
}]);
|
|
60
|
-
function defineCustomElement$1() {
|
|
61
|
-
if (typeof customElements === "undefined") {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const components = ["p-loader"];
|
|
65
|
-
components.forEach(tagName => { switch (tagName) {
|
|
66
|
-
case "p-loader":
|
|
67
|
-
if (!customElements.get(tagName)) {
|
|
68
|
-
customElements.define(tagName, Loader);
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
} });
|
|
72
|
-
}
|
|
1
|
+
import { L as Loader, d as defineCustomElement$1 } from './loader.component.js';
|
|
73
2
|
|
|
74
3
|
const PLoader = Loader;
|
|
75
4
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
const NAMESPACE = 'paperless';
|
|
2
2
|
|
|
3
3
|
let scopeId;
|
|
4
|
+
let contentRef;
|
|
4
5
|
let hostTagName;
|
|
6
|
+
let useNativeShadowDom = false;
|
|
7
|
+
let checkSlotFallbackVisibility = false;
|
|
8
|
+
let checkSlotRelocate = false;
|
|
5
9
|
let isSvgMode = false;
|
|
6
10
|
let queuePending = false;
|
|
7
11
|
const win = typeof window !== 'undefined' ? window : {};
|
|
@@ -161,6 +165,7 @@ const isComplexType = (o) => {
|
|
|
161
165
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
162
166
|
const h = (nodeName, vnodeData, ...children) => {
|
|
163
167
|
let child = null;
|
|
168
|
+
let slotName = null;
|
|
164
169
|
let simple = false;
|
|
165
170
|
let lastSimple = false;
|
|
166
171
|
const vNodeChildren = [];
|
|
@@ -188,6 +193,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
188
193
|
};
|
|
189
194
|
walk(children);
|
|
190
195
|
if (vnodeData) {
|
|
196
|
+
if (vnodeData.name) {
|
|
197
|
+
slotName = vnodeData.name;
|
|
198
|
+
}
|
|
191
199
|
{
|
|
192
200
|
const classData = vnodeData.className || vnodeData.class;
|
|
193
201
|
if (classData) {
|
|
@@ -200,11 +208,18 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
200
208
|
}
|
|
201
209
|
}
|
|
202
210
|
}
|
|
211
|
+
if (typeof nodeName === 'function') {
|
|
212
|
+
// nodeName is a functional component
|
|
213
|
+
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
214
|
+
}
|
|
203
215
|
const vnode = newVNode(nodeName, null);
|
|
204
216
|
vnode.$attrs$ = vnodeData;
|
|
205
217
|
if (vNodeChildren.length > 0) {
|
|
206
218
|
vnode.$children$ = vNodeChildren;
|
|
207
219
|
}
|
|
220
|
+
{
|
|
221
|
+
vnode.$name$ = slotName;
|
|
222
|
+
}
|
|
208
223
|
return vnode;
|
|
209
224
|
};
|
|
210
225
|
const newVNode = (tag, text) => {
|
|
@@ -218,10 +233,43 @@ const newVNode = (tag, text) => {
|
|
|
218
233
|
{
|
|
219
234
|
vnode.$attrs$ = null;
|
|
220
235
|
}
|
|
236
|
+
{
|
|
237
|
+
vnode.$name$ = null;
|
|
238
|
+
}
|
|
221
239
|
return vnode;
|
|
222
240
|
};
|
|
223
241
|
const Host = {};
|
|
224
242
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
243
|
+
const vdomFnUtils = {
|
|
244
|
+
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
245
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
246
|
+
};
|
|
247
|
+
const convertToPublic = (node) => ({
|
|
248
|
+
vattrs: node.$attrs$,
|
|
249
|
+
vchildren: node.$children$,
|
|
250
|
+
vkey: node.$key$,
|
|
251
|
+
vname: node.$name$,
|
|
252
|
+
vtag: node.$tag$,
|
|
253
|
+
vtext: node.$text$,
|
|
254
|
+
});
|
|
255
|
+
const convertToPrivate = (node) => {
|
|
256
|
+
if (typeof node.vtag === 'function') {
|
|
257
|
+
const vnodeData = Object.assign({}, node.vattrs);
|
|
258
|
+
if (node.vkey) {
|
|
259
|
+
vnodeData.key = node.vkey;
|
|
260
|
+
}
|
|
261
|
+
if (node.vname) {
|
|
262
|
+
vnodeData.name = node.vname;
|
|
263
|
+
}
|
|
264
|
+
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
|
265
|
+
}
|
|
266
|
+
const vnode = newVNode(node.vtag, node.vtext);
|
|
267
|
+
vnode.$attrs$ = node.vattrs;
|
|
268
|
+
vnode.$children$ = node.vchildren;
|
|
269
|
+
vnode.$key$ = node.vkey;
|
|
270
|
+
vnode.$name$ = node.vname;
|
|
271
|
+
return vnode;
|
|
272
|
+
};
|
|
225
273
|
/**
|
|
226
274
|
* Production setAccessor() function based on Preact by
|
|
227
275
|
* Jason Miller (@developit)
|
|
@@ -314,13 +362,36 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
314
362
|
let i = 0;
|
|
315
363
|
let elm;
|
|
316
364
|
let childNode;
|
|
365
|
+
let oldVNode;
|
|
366
|
+
if (!useNativeShadowDom) {
|
|
367
|
+
// remember for later we need to check to relocate nodes
|
|
368
|
+
checkSlotRelocate = true;
|
|
369
|
+
if (newVNode.$tag$ === 'slot') {
|
|
370
|
+
if (scopeId) {
|
|
371
|
+
// scoped css needs to add its scoped id to the parent element
|
|
372
|
+
parentElm.classList.add(scopeId + '-s');
|
|
373
|
+
}
|
|
374
|
+
newVNode.$flags$ |= newVNode.$children$
|
|
375
|
+
? // slot element has fallback content
|
|
376
|
+
2 /* isSlotFallback */
|
|
377
|
+
: // slot element does not have fallback content
|
|
378
|
+
1 /* isSlotReference */;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
317
381
|
if (newVNode.$text$ !== null) {
|
|
318
382
|
// create text node
|
|
319
383
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
320
384
|
}
|
|
385
|
+
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
386
|
+
// create a slot reference node
|
|
387
|
+
elm = newVNode.$elm$ =
|
|
388
|
+
doc.createTextNode('');
|
|
389
|
+
}
|
|
321
390
|
else {
|
|
322
391
|
// create element
|
|
323
|
-
elm = newVNode.$elm$ = (doc.createElement(newVNode.$
|
|
392
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
|
|
393
|
+
? 'slot-fb'
|
|
394
|
+
: newVNode.$tag$));
|
|
324
395
|
// add css classes, attrs, props, listeners, etc.
|
|
325
396
|
{
|
|
326
397
|
updateElement(null, newVNode, isSvgMode);
|
|
@@ -333,7 +404,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
333
404
|
if (newVNode.$children$) {
|
|
334
405
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
335
406
|
// create the node
|
|
336
|
-
childNode = createElm(oldParentVNode, newVNode, i);
|
|
407
|
+
childNode = createElm(oldParentVNode, newVNode, i, elm);
|
|
337
408
|
// return node could have been null
|
|
338
409
|
if (childNode) {
|
|
339
410
|
// append our new node
|
|
@@ -342,20 +413,62 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
342
413
|
}
|
|
343
414
|
}
|
|
344
415
|
}
|
|
416
|
+
{
|
|
417
|
+
elm['s-hn'] = hostTagName;
|
|
418
|
+
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
419
|
+
// remember the content reference comment
|
|
420
|
+
elm['s-sr'] = true;
|
|
421
|
+
// remember the content reference comment
|
|
422
|
+
elm['s-cr'] = contentRef;
|
|
423
|
+
// remember the slot name, or empty string for default slot
|
|
424
|
+
elm['s-sn'] = newVNode.$name$ || '';
|
|
425
|
+
// check if we've got an old vnode for this slot
|
|
426
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
427
|
+
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
428
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
|
429
|
+
// so let's move the old slot content back to it's original location
|
|
430
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
345
434
|
return elm;
|
|
346
435
|
};
|
|
436
|
+
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
437
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
438
|
+
const oldSlotChildNodes = parentElm.childNodes;
|
|
439
|
+
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
440
|
+
const childNode = oldSlotChildNodes[i];
|
|
441
|
+
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
442
|
+
// // this child node in the old element is from another component
|
|
443
|
+
// // remove this node from the old slot's parent
|
|
444
|
+
// childNode.remove();
|
|
445
|
+
// and relocate it back to it's original location
|
|
446
|
+
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
447
|
+
// remove the old original location comment entirely
|
|
448
|
+
// later on the patch function will know what to do
|
|
449
|
+
// and move this to the correct spot in need be
|
|
450
|
+
childNode['s-ol'].remove();
|
|
451
|
+
childNode['s-ol'] = undefined;
|
|
452
|
+
checkSlotRelocate = true;
|
|
453
|
+
}
|
|
454
|
+
if (recursive) {
|
|
455
|
+
putBackInOriginalLocation(childNode, recursive);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
459
|
+
};
|
|
347
460
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
348
|
-
let containerElm = (parentElm);
|
|
461
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
349
462
|
let childNode;
|
|
350
463
|
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
351
464
|
containerElm = containerElm.shadowRoot;
|
|
352
465
|
}
|
|
353
466
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
354
467
|
if (vnodes[startIdx]) {
|
|
355
|
-
childNode = createElm(null, parentVNode, startIdx);
|
|
468
|
+
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
356
469
|
if (childNode) {
|
|
357
470
|
vnodes[startIdx].$elm$ = childNode;
|
|
358
|
-
containerElm.insertBefore(childNode, before);
|
|
471
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
359
472
|
}
|
|
360
473
|
}
|
|
361
474
|
}
|
|
@@ -365,6 +478,20 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
365
478
|
if ((vnode = vnodes[startIdx])) {
|
|
366
479
|
elm = vnode.$elm$;
|
|
367
480
|
callNodeRefs(vnode);
|
|
481
|
+
{
|
|
482
|
+
// we're removing this element
|
|
483
|
+
// so it's possible we need to show slot fallback content now
|
|
484
|
+
checkSlotFallbackVisibility = true;
|
|
485
|
+
if (elm['s-ol']) {
|
|
486
|
+
// remove the original location comment
|
|
487
|
+
elm['s-ol'].remove();
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
// it's possible that child nodes of the node
|
|
491
|
+
// that's being removed are slot nodes
|
|
492
|
+
putBackInOriginalLocation(elm, true);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
368
495
|
// remove the vnode's element from the dom
|
|
369
496
|
elm.remove();
|
|
370
497
|
}
|
|
@@ -405,12 +532,20 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
405
532
|
newEndVnode = newCh[--newEndIdx];
|
|
406
533
|
}
|
|
407
534
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
535
|
+
// Vnode moved right
|
|
536
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
537
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
538
|
+
}
|
|
408
539
|
patch(oldStartVnode, newEndVnode);
|
|
409
540
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
410
541
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
411
542
|
newEndVnode = newCh[--newEndIdx];
|
|
412
543
|
}
|
|
413
544
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
545
|
+
// Vnode moved left
|
|
546
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
547
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
548
|
+
}
|
|
414
549
|
patch(oldEndVnode, newStartVnode);
|
|
415
550
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
416
551
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
@@ -419,12 +554,12 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
419
554
|
else {
|
|
420
555
|
{
|
|
421
556
|
// new element
|
|
422
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
557
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
423
558
|
newStartVnode = newCh[++newStartIdx];
|
|
424
559
|
}
|
|
425
560
|
if (node) {
|
|
426
561
|
{
|
|
427
|
-
oldStartVnode.$elm
|
|
562
|
+
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
428
563
|
}
|
|
429
564
|
}
|
|
430
565
|
}
|
|
@@ -440,16 +575,28 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
440
575
|
// compare if two vnode to see if they're "technically" the same
|
|
441
576
|
// need to have the same element tag, and same key to be the same
|
|
442
577
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
578
|
+
if (vnode1.$tag$ === 'slot') {
|
|
579
|
+
return vnode1.$name$ === vnode2.$name$;
|
|
580
|
+
}
|
|
443
581
|
return true;
|
|
444
582
|
}
|
|
445
583
|
return false;
|
|
446
584
|
};
|
|
585
|
+
const referenceNode = (node) => {
|
|
586
|
+
// this node was relocated to a new location in the dom
|
|
587
|
+
// because of some other component's slot
|
|
588
|
+
// but we still have an html comment in place of where
|
|
589
|
+
// it's original location was according to it's original vdom
|
|
590
|
+
return (node && node['s-ol']) || node;
|
|
591
|
+
};
|
|
592
|
+
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
447
593
|
const patch = (oldVNode, newVNode) => {
|
|
448
594
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
449
595
|
const oldChildren = oldVNode.$children$;
|
|
450
596
|
const newChildren = newVNode.$children$;
|
|
451
597
|
const tag = newVNode.$tag$;
|
|
452
598
|
const text = newVNode.$text$;
|
|
599
|
+
let defaultHolder;
|
|
453
600
|
if (text === null) {
|
|
454
601
|
// element node
|
|
455
602
|
{
|
|
@@ -480,12 +627,147 @@ const patch = (oldVNode, newVNode) => {
|
|
|
480
627
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
481
628
|
}
|
|
482
629
|
}
|
|
630
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
631
|
+
// this element has slotted content
|
|
632
|
+
defaultHolder.parentNode.textContent = text;
|
|
633
|
+
}
|
|
483
634
|
else if (oldVNode.$text$ !== text) {
|
|
484
635
|
// update the text content for the text only vnode
|
|
485
636
|
// and also only if the text is different than before
|
|
486
637
|
elm.data = text;
|
|
487
638
|
}
|
|
488
639
|
};
|
|
640
|
+
const updateFallbackSlotVisibility = (elm) => {
|
|
641
|
+
// tslint:disable-next-line: prefer-const
|
|
642
|
+
const childNodes = elm.childNodes;
|
|
643
|
+
let childNode;
|
|
644
|
+
let i;
|
|
645
|
+
let ilen;
|
|
646
|
+
let j;
|
|
647
|
+
let slotNameAttr;
|
|
648
|
+
let nodeType;
|
|
649
|
+
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
650
|
+
childNode = childNodes[i];
|
|
651
|
+
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
652
|
+
if (childNode['s-sr']) {
|
|
653
|
+
// this is a slot fallback node
|
|
654
|
+
// get the slot name for this slot reference node
|
|
655
|
+
slotNameAttr = childNode['s-sn'];
|
|
656
|
+
// by default always show a fallback slot node
|
|
657
|
+
// then hide it if there are other slots in the light dom
|
|
658
|
+
childNode.hidden = false;
|
|
659
|
+
for (j = 0; j < ilen; j++) {
|
|
660
|
+
nodeType = childNodes[j].nodeType;
|
|
661
|
+
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
662
|
+
// this sibling node is from a different component OR is a named fallback slot node
|
|
663
|
+
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
664
|
+
childNode.hidden = true;
|
|
665
|
+
break;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
else {
|
|
669
|
+
// this is a default fallback slot node
|
|
670
|
+
// any element or text node (with content)
|
|
671
|
+
// should hide the default fallback slot node
|
|
672
|
+
if (nodeType === 1 /* ElementNode */ ||
|
|
673
|
+
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
674
|
+
childNode.hidden = true;
|
|
675
|
+
break;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
// keep drilling down
|
|
681
|
+
updateFallbackSlotVisibility(childNode);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
const relocateNodes = [];
|
|
686
|
+
const relocateSlotContent = (elm) => {
|
|
687
|
+
// tslint:disable-next-line: prefer-const
|
|
688
|
+
let childNode;
|
|
689
|
+
let node;
|
|
690
|
+
let hostContentNodes;
|
|
691
|
+
let slotNameAttr;
|
|
692
|
+
let relocateNodeData;
|
|
693
|
+
let j;
|
|
694
|
+
let i = 0;
|
|
695
|
+
const childNodes = elm.childNodes;
|
|
696
|
+
const ilen = childNodes.length;
|
|
697
|
+
for (; i < ilen; i++) {
|
|
698
|
+
childNode = childNodes[i];
|
|
699
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
700
|
+
// first got the content reference comment node
|
|
701
|
+
// then we got it's parent, which is where all the host content is in now
|
|
702
|
+
hostContentNodes = node.parentNode.childNodes;
|
|
703
|
+
slotNameAttr = childNode['s-sn'];
|
|
704
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
705
|
+
node = hostContentNodes[j];
|
|
706
|
+
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
707
|
+
// let's do some relocating to its new home
|
|
708
|
+
// but never relocate a content reference node
|
|
709
|
+
// that is suppose to always represent the original content location
|
|
710
|
+
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
711
|
+
// it's possible we've already decided to relocate this node
|
|
712
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
713
|
+
// made some changes to slots
|
|
714
|
+
// let's make sure we also double check
|
|
715
|
+
// fallbacks are correctly hidden or shown
|
|
716
|
+
checkSlotFallbackVisibility = true;
|
|
717
|
+
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
|
718
|
+
if (relocateNodeData) {
|
|
719
|
+
// previously we never found a slot home for this node
|
|
720
|
+
// but turns out we did, so let's remember it now
|
|
721
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
// add to our list of nodes to relocate
|
|
725
|
+
relocateNodes.push({
|
|
726
|
+
$slotRefNode$: childNode,
|
|
727
|
+
$nodeToRelocate$: node,
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
if (node['s-sr']) {
|
|
731
|
+
relocateNodes.map((relocateNode) => {
|
|
732
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
733
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
734
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
735
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
742
|
+
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
743
|
+
// if we never find a home for this element then we'll need to hide it
|
|
744
|
+
relocateNodes.push({
|
|
745
|
+
$nodeToRelocate$: node,
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
752
|
+
relocateSlotContent(childNode);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
757
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
758
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
761
|
+
if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
|
|
762
|
+
return true;
|
|
763
|
+
}
|
|
764
|
+
return false;
|
|
765
|
+
}
|
|
766
|
+
if (nodeToRelocate['s-sn'] === slotNameAttr) {
|
|
767
|
+
return true;
|
|
768
|
+
}
|
|
769
|
+
return slotNameAttr === '';
|
|
770
|
+
};
|
|
489
771
|
const callNodeRefs = (vNode) => {
|
|
490
772
|
{
|
|
491
773
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
@@ -494,6 +776,7 @@ const callNodeRefs = (vNode) => {
|
|
|
494
776
|
};
|
|
495
777
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
496
778
|
const hostElm = hostRef.$hostElement$;
|
|
779
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
497
780
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
498
781
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
499
782
|
hostTagName = hostElm.tagName;
|
|
@@ -504,10 +787,105 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
504
787
|
{
|
|
505
788
|
scopeId = hostElm['s-sc'];
|
|
506
789
|
}
|
|
790
|
+
{
|
|
791
|
+
contentRef = hostElm['s-cr'];
|
|
792
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
793
|
+
// always reset
|
|
794
|
+
checkSlotFallbackVisibility = false;
|
|
795
|
+
}
|
|
507
796
|
// synchronous patch
|
|
508
797
|
patch(oldVNode, rootVnode);
|
|
798
|
+
{
|
|
799
|
+
// while we're moving nodes around existing nodes, temporarily disable
|
|
800
|
+
// the disconnectCallback from working
|
|
801
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
802
|
+
if (checkSlotRelocate) {
|
|
803
|
+
relocateSlotContent(rootVnode.$elm$);
|
|
804
|
+
let relocateData;
|
|
805
|
+
let nodeToRelocate;
|
|
806
|
+
let orgLocationNode;
|
|
807
|
+
let parentNodeRef;
|
|
808
|
+
let insertBeforeNode;
|
|
809
|
+
let refNode;
|
|
810
|
+
let i = 0;
|
|
811
|
+
for (; i < relocateNodes.length; i++) {
|
|
812
|
+
relocateData = relocateNodes[i];
|
|
813
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
814
|
+
if (!nodeToRelocate['s-ol']) {
|
|
815
|
+
// add a reference node marking this node's original location
|
|
816
|
+
// keep a reference to this node for later lookups
|
|
817
|
+
orgLocationNode =
|
|
818
|
+
doc.createTextNode('');
|
|
819
|
+
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
820
|
+
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
for (i = 0; i < relocateNodes.length; i++) {
|
|
824
|
+
relocateData = relocateNodes[i];
|
|
825
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
826
|
+
if (relocateData.$slotRefNode$) {
|
|
827
|
+
// by default we're just going to insert it directly
|
|
828
|
+
// after the slot reference node
|
|
829
|
+
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
|
830
|
+
insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
|
|
831
|
+
orgLocationNode = nodeToRelocate['s-ol'];
|
|
832
|
+
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
|
833
|
+
refNode = orgLocationNode['s-nr'];
|
|
834
|
+
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
835
|
+
refNode = refNode.nextSibling;
|
|
836
|
+
if (!refNode || !refNode['s-nr']) {
|
|
837
|
+
insertBeforeNode = refNode;
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
843
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
844
|
+
// we've checked that it's worth while to relocate
|
|
845
|
+
// since that the node to relocate
|
|
846
|
+
// has a different next sibling or parent relocated
|
|
847
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
|
848
|
+
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
849
|
+
// probably a component in the index.html that doesn't have it's hostname set
|
|
850
|
+
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
851
|
+
}
|
|
852
|
+
// add it back to the dom but in its new home
|
|
853
|
+
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
else {
|
|
858
|
+
// this node doesn't have a slot home to go to, so let's hide it
|
|
859
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
860
|
+
nodeToRelocate.hidden = true;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
if (checkSlotFallbackVisibility) {
|
|
866
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
867
|
+
}
|
|
868
|
+
// done moving nodes around
|
|
869
|
+
// allow the disconnect callback to work again
|
|
870
|
+
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
871
|
+
// always reset
|
|
872
|
+
relocateNodes.length = 0;
|
|
873
|
+
}
|
|
509
874
|
};
|
|
510
875
|
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
876
|
+
const createEvent = (ref, name, flags) => {
|
|
877
|
+
const elm = getElement(ref);
|
|
878
|
+
return {
|
|
879
|
+
emit: (detail) => {
|
|
880
|
+
return emitEvent(elm, name, {
|
|
881
|
+
bubbles: !!(flags & 4 /* Bubbles */),
|
|
882
|
+
composed: !!(flags & 2 /* Composed */),
|
|
883
|
+
cancelable: !!(flags & 1 /* Cancellable */),
|
|
884
|
+
detail,
|
|
885
|
+
});
|
|
886
|
+
},
|
|
887
|
+
};
|
|
888
|
+
};
|
|
511
889
|
/**
|
|
512
890
|
* Helper function to create & dispatch a custom Event on a provided target
|
|
513
891
|
* @param elm the target of the Event
|
|
@@ -925,6 +1303,15 @@ const connectedCallback = (elm) => {
|
|
|
925
1303
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
926
1304
|
// first time this component has connected
|
|
927
1305
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1306
|
+
{
|
|
1307
|
+
// initUpdate
|
|
1308
|
+
// if the slot polyfill is required we'll need to put some nodes
|
|
1309
|
+
// in here to act as original content anchors as we move nodes around
|
|
1310
|
+
// host element has been connected to the DOM
|
|
1311
|
+
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1312
|
+
setContentReference(elm);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
928
1315
|
{
|
|
929
1316
|
// find the first ancestor component (if there is one) and register
|
|
930
1317
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -964,6 +1351,17 @@ const connectedCallback = (elm) => {
|
|
|
964
1351
|
endConnected();
|
|
965
1352
|
}
|
|
966
1353
|
};
|
|
1354
|
+
const setContentReference = (elm) => {
|
|
1355
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
1356
|
+
// or this browser doesn't support native shadow dom
|
|
1357
|
+
// and this host element was NOT created with SSR
|
|
1358
|
+
// let's pick out the inner content for slot projection
|
|
1359
|
+
// create a node to represent where the original
|
|
1360
|
+
// content was first placed, which is useful later on
|
|
1361
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
1362
|
+
contentRefElm['s-cn'] = true;
|
|
1363
|
+
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1364
|
+
};
|
|
967
1365
|
const disconnectedCallback = (elm) => {
|
|
968
1366
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
969
1367
|
const hostRef = getHostRef(elm);
|
|
@@ -1153,4 +1551,4 @@ const flush = () => {
|
|
|
1153
1551
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1154
1552
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1155
1553
|
|
|
1156
|
-
export { Host as H, bootstrapLazy as b, getElement as g, h, promiseResolve as p, registerInstance as r };
|
|
1554
|
+
export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };
|