@paperless/core 0.1.0-alpha.2 → 0.1.0-alpha.22
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 +199 -0
- package/README.md +18 -1
- package/dist/assets/images/avatar/company-default.svg +12 -0
- package/dist/assets/images/avatar/user-default.svg +12 -0
- package/dist/assets/images/helper/helper-hover.svg +15 -0
- package/dist/assets/images/helper/helper.svg +15 -0
- package/dist/build/p-17c11169.entry.js +1 -0
- package/dist/build/p-42dab9d4.entry.js +1 -0
- package/dist/build/p-47b52f92.entry.js +1 -0
- package/dist/build/p-554b5a22.entry.js +1 -0
- package/dist/build/p-5ec6ea71.entry.js +1 -0
- package/dist/build/p-76464e0b.js +2 -0
- package/dist/build/{p-feec8ec1.entry.js → p-8501ba07.entry.js} +1 -1
- package/dist/build/p-aae3d4f0.entry.js +1 -0
- package/dist/build/p-adcb0b93.entry.js +1 -0
- package/dist/build/p-bbec0e86.entry.js +1 -0
- package/dist/build/p-d23e4d57.entry.js +1 -0
- package/dist/build/p-f65d7bbf.entry.js +1 -0
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/{index-5b30cb95.js → index-a46a39a5.js} +494 -9
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{p-loader.cjs.entry.js → p-avatar.cjs.entry.js} +13 -38
- package/dist/cjs/{p-icon.cjs.entry.js → p-button_3.cjs.entry.js} +108 -5
- package/dist/cjs/p-counter.cjs.entry.js +19 -0
- package/dist/cjs/p-divider.cjs.entry.js +19 -0
- package/dist/cjs/{p-button.cjs.entry.js → p-helper.cjs.entry.js} +6 -10
- package/dist/cjs/p-illustration.cjs.entry.js +9 -12
- package/dist/cjs/p-info-panel.cjs.entry.js +31 -0
- package/dist/cjs/p-navigation-item.cjs.entry.js +23 -0
- package/dist/cjs/p-pagination-item.cjs.entry.js +23 -0
- package/dist/cjs/p-pagination.cjs.entry.js +167 -0
- package/dist/cjs/p-tooltip.cjs.entry.js +62 -20
- package/dist/cjs/paperless.cjs.js +2 -2
- package/dist/collection/assets/images/avatar/company-default.svg +12 -0
- package/dist/collection/assets/images/avatar/user-default.svg +12 -0
- package/dist/collection/assets/images/helper/helper-hover.svg +15 -0
- package/dist/collection/assets/images/helper/helper.svg +15 -0
- package/dist/collection/collection-manifest.json +9 -1
- package/dist/collection/components/atoms/avatar/avatar.component.css +31 -0
- package/dist/collection/components/atoms/avatar/avatar.component.js +105 -0
- package/dist/collection/components/atoms/button/button.component.css +68 -3
- package/dist/collection/components/atoms/button/button.component.js +241 -7
- package/dist/collection/components/atoms/counter/counter.component.css +5 -0
- package/dist/collection/components/atoms/counter/counter.component.js +15 -0
- package/dist/collection/components/atoms/divider/divider.component.css +3 -0
- package/dist/collection/components/atoms/divider/divider.component.js +14 -0
- package/dist/collection/components/atoms/helper/helper.component.css +7 -0
- package/dist/collection/components/atoms/helper/helper.component.js +18 -0
- package/dist/collection/components/atoms/icon/icon.component.js +2 -7
- package/dist/collection/components/atoms/illustration/illustration.component.js +2 -9
- package/dist/collection/components/atoms/info-panel/info-panel.component.css +28 -0
- package/dist/collection/components/atoms/info-panel/info-panel.component.js +106 -0
- package/dist/collection/components/atoms/loader/loader.component.js +1 -1
- package/dist/collection/components/atoms/pagination-item/pagination-item.component.css +16 -0
- package/dist/collection/components/atoms/pagination-item/pagination-item.component.js +41 -0
- package/dist/collection/components/atoms/tooltip/tooltip.component.css +15 -12
- package/dist/collection/components/atoms/tooltip/tooltip.component.js +122 -32
- package/dist/collection/components/molecules/navigation-item/navigation-item.component.css +28 -0
- package/dist/collection/components/molecules/navigation-item/navigation-item.component.js +118 -0
- package/dist/collection/components/molecules/pagination/pagination.component.css +3 -0
- package/dist/collection/components/molecules/pagination/pagination.component.js +238 -0
- package/dist/collection/tailwind/border-radius.js +1 -0
- package/dist/collection/tailwind/grid.js +24 -4
- package/dist/collection/tailwind.config.js +1 -1
- package/dist/components/counter.component.js +30 -0
- package/dist/{esm/p-icon.entry.js → components/icon.component.js} +26 -11
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.js +8 -0
- package/dist/{esm/p-loader.entry.js → components/loader.component.js} +30 -9
- package/dist/components/p-avatar.d.ts +11 -0
- package/dist/components/p-avatar.js +52 -0
- package/dist/components/p-button.js +67 -8
- package/dist/components/p-counter.d.ts +11 -0
- package/dist/components/p-counter.js +6 -0
- package/dist/components/p-divider.d.ts +11 -0
- package/dist/components/p-divider.js +33 -0
- package/dist/components/p-helper.d.ts +11 -0
- package/dist/components/p-helper.js +39 -0
- package/dist/components/p-icon.js +1 -815
- package/dist/components/p-illustration.js +0 -4
- package/dist/components/p-info-panel.d.ts +11 -0
- package/dist/components/p-info-panel.js +56 -0
- package/dist/components/p-loader.js +1 -72
- package/dist/components/p-navigation-item.d.ts +11 -0
- package/dist/components/p-navigation-item.js +55 -0
- package/dist/components/p-pagination-item.d.ts +11 -0
- package/dist/components/p-pagination-item.js +6 -0
- package/dist/components/p-pagination.d.ts +11 -0
- package/dist/components/p-pagination.js +196 -0
- package/dist/components/p-tooltip.js +1 -1886
- package/dist/components/pagination-item.component.js +36 -0
- package/dist/components/tooltip.component.js +1932 -0
- package/dist/esm/{index-111a6307.js → index-a68e547b.js} +494 -10
- package/dist/esm/loader.js +2 -2
- package/dist/esm/p-avatar.entry.js +28 -0
- package/dist/esm/p-button_3.entry.js +899 -0
- package/dist/esm/p-counter.entry.js +15 -0
- package/dist/esm/p-divider.entry.js +15 -0
- package/dist/esm/{p-button.entry.js → p-helper.entry.js} +6 -10
- package/dist/esm/p-illustration.entry.js +9 -12
- package/dist/esm/p-info-panel.entry.js +27 -0
- package/dist/esm/p-navigation-item.entry.js +19 -0
- package/dist/esm/p-pagination-item.entry.js +19 -0
- package/dist/esm/p-pagination.entry.js +163 -0
- package/dist/esm/p-tooltip.entry.js +62 -20
- package/dist/esm/paperless.js +2 -2
- package/dist/index.html +1 -1
- package/dist/paperless/p-17c11169.entry.js +1 -0
- package/dist/paperless/p-42dab9d4.entry.js +1 -0
- package/dist/paperless/p-47b52f92.entry.js +1 -0
- package/dist/paperless/p-554b5a22.entry.js +1 -0
- package/dist/paperless/p-5ec6ea71.entry.js +1 -0
- package/dist/paperless/p-76464e0b.js +2 -0
- package/dist/paperless/{p-feec8ec1.entry.js → p-8501ba07.entry.js} +1 -1
- package/dist/paperless/p-aae3d4f0.entry.js +1 -0
- package/dist/paperless/p-adcb0b93.entry.js +1 -0
- package/dist/paperless/p-bbec0e86.entry.js +1 -0
- package/dist/paperless/p-d23e4d57.entry.js +1 -0
- package/dist/paperless/p-f65d7bbf.entry.js +1 -0
- package/dist/paperless/paperless.css +96 -0
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +240 -51
- package/dist/tailwind.config.js +1 -1
- package/dist/types/components/atoms/avatar/avatar.component.d.ts +21 -0
- package/dist/types/components/atoms/button/button.component.d.ts +45 -1
- package/dist/types/components/atoms/counter/counter.component.d.ts +3 -0
- package/dist/types/components/atoms/divider/divider.component.d.ts +3 -0
- package/dist/types/components/atoms/helper/helper.component.d.ts +3 -0
- package/dist/types/components/atoms/info-panel/info-panel.component.d.ts +24 -0
- package/dist/types/components/atoms/pagination-item/pagination-item.component.d.ts +7 -0
- package/dist/types/components/atoms/tooltip/tooltip.component.d.ts +20 -8
- package/dist/types/components/molecules/navigation-item/navigation-item.component.d.ts +24 -0
- package/dist/types/components/molecules/pagination/pagination.component.d.ts +28 -0
- package/dist/types/components.d.ts +358 -16
- 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-bbd1d3df.entry.js +0 -1
- package/dist/build/p-cd525dcc.entry.js +0 -1
- 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-bbd1d3df.entry.js +0 -1
- package/dist/paperless/p-cd525dcc.entry.js +0 -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 : {};
|
|
@@ -28,7 +32,7 @@ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
|
|
|
28
32
|
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
29
33
|
if (listeners) {
|
|
30
34
|
listeners.map(([flags, name, method]) => {
|
|
31
|
-
const target = elm;
|
|
35
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
32
36
|
const handler = hostListenerProxy(hostRef, method);
|
|
33
37
|
const opts = hostListenerOpts(flags);
|
|
34
38
|
plt.ael(target, name, handler, opts);
|
|
@@ -52,6 +56,11 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
52
56
|
consoleError(e);
|
|
53
57
|
}
|
|
54
58
|
};
|
|
59
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
60
|
+
if (flags & 4 /* TargetDocument */)
|
|
61
|
+
return doc;
|
|
62
|
+
return elm;
|
|
63
|
+
};
|
|
55
64
|
// prettier-ignore
|
|
56
65
|
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
57
66
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
@@ -161,6 +170,7 @@ const isComplexType = (o) => {
|
|
|
161
170
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
162
171
|
const h = (nodeName, vnodeData, ...children) => {
|
|
163
172
|
let child = null;
|
|
173
|
+
let slotName = null;
|
|
164
174
|
let simple = false;
|
|
165
175
|
let lastSimple = false;
|
|
166
176
|
const vNodeChildren = [];
|
|
@@ -188,6 +198,9 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
188
198
|
};
|
|
189
199
|
walk(children);
|
|
190
200
|
if (vnodeData) {
|
|
201
|
+
if (vnodeData.name) {
|
|
202
|
+
slotName = vnodeData.name;
|
|
203
|
+
}
|
|
191
204
|
{
|
|
192
205
|
const classData = vnodeData.className || vnodeData.class;
|
|
193
206
|
if (classData) {
|
|
@@ -200,11 +213,18 @@ const h = (nodeName, vnodeData, ...children) => {
|
|
|
200
213
|
}
|
|
201
214
|
}
|
|
202
215
|
}
|
|
216
|
+
if (typeof nodeName === 'function') {
|
|
217
|
+
// nodeName is a functional component
|
|
218
|
+
return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
|
|
219
|
+
}
|
|
203
220
|
const vnode = newVNode(nodeName, null);
|
|
204
221
|
vnode.$attrs$ = vnodeData;
|
|
205
222
|
if (vNodeChildren.length > 0) {
|
|
206
223
|
vnode.$children$ = vNodeChildren;
|
|
207
224
|
}
|
|
225
|
+
{
|
|
226
|
+
vnode.$name$ = slotName;
|
|
227
|
+
}
|
|
208
228
|
return vnode;
|
|
209
229
|
};
|
|
210
230
|
const newVNode = (tag, text) => {
|
|
@@ -218,10 +238,43 @@ const newVNode = (tag, text) => {
|
|
|
218
238
|
{
|
|
219
239
|
vnode.$attrs$ = null;
|
|
220
240
|
}
|
|
241
|
+
{
|
|
242
|
+
vnode.$name$ = null;
|
|
243
|
+
}
|
|
221
244
|
return vnode;
|
|
222
245
|
};
|
|
223
246
|
const Host = {};
|
|
224
247
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
248
|
+
const vdomFnUtils = {
|
|
249
|
+
forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
|
|
250
|
+
map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
|
|
251
|
+
};
|
|
252
|
+
const convertToPublic = (node) => ({
|
|
253
|
+
vattrs: node.$attrs$,
|
|
254
|
+
vchildren: node.$children$,
|
|
255
|
+
vkey: node.$key$,
|
|
256
|
+
vname: node.$name$,
|
|
257
|
+
vtag: node.$tag$,
|
|
258
|
+
vtext: node.$text$,
|
|
259
|
+
});
|
|
260
|
+
const convertToPrivate = (node) => {
|
|
261
|
+
if (typeof node.vtag === 'function') {
|
|
262
|
+
const vnodeData = Object.assign({}, node.vattrs);
|
|
263
|
+
if (node.vkey) {
|
|
264
|
+
vnodeData.key = node.vkey;
|
|
265
|
+
}
|
|
266
|
+
if (node.vname) {
|
|
267
|
+
vnodeData.name = node.vname;
|
|
268
|
+
}
|
|
269
|
+
return h(node.vtag, vnodeData, ...(node.vchildren || []));
|
|
270
|
+
}
|
|
271
|
+
const vnode = newVNode(node.vtag, node.vtext);
|
|
272
|
+
vnode.$attrs$ = node.vattrs;
|
|
273
|
+
vnode.$children$ = node.vchildren;
|
|
274
|
+
vnode.$key$ = node.vkey;
|
|
275
|
+
vnode.$name$ = node.vname;
|
|
276
|
+
return vnode;
|
|
277
|
+
};
|
|
225
278
|
/**
|
|
226
279
|
* Production setAccessor() function based on Preact by
|
|
227
280
|
* Jason Miller (@developit)
|
|
@@ -233,7 +286,7 @@ const isHost = (node) => node && node.$tag$ === Host;
|
|
|
233
286
|
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
234
287
|
if (oldValue !== newValue) {
|
|
235
288
|
let isProp = isMemberInElement(elm, memberName);
|
|
236
|
-
memberName.toLowerCase();
|
|
289
|
+
let ln = memberName.toLowerCase();
|
|
237
290
|
if (memberName === 'class') {
|
|
238
291
|
const classList = elm.classList;
|
|
239
292
|
const oldClasses = parseClassList(oldValue);
|
|
@@ -247,6 +300,45 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
247
300
|
newValue(elm);
|
|
248
301
|
}
|
|
249
302
|
}
|
|
303
|
+
else if ((!isProp ) &&
|
|
304
|
+
memberName[0] === 'o' &&
|
|
305
|
+
memberName[1] === 'n') {
|
|
306
|
+
// Event Handlers
|
|
307
|
+
// so if the member name starts with "on" and the 3rd characters is
|
|
308
|
+
// a capital letter, and it's not already a member on the element,
|
|
309
|
+
// then we're assuming it's an event listener
|
|
310
|
+
if (memberName[2] === '-') {
|
|
311
|
+
// on- prefixed events
|
|
312
|
+
// allows to be explicit about the dom event to listen without any magic
|
|
313
|
+
// under the hood:
|
|
314
|
+
// <my-cmp on-click> // listens for "click"
|
|
315
|
+
// <my-cmp on-Click> // listens for "Click"
|
|
316
|
+
// <my-cmp on-ionChange> // listens for "ionChange"
|
|
317
|
+
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
|
318
|
+
memberName = memberName.slice(3);
|
|
319
|
+
}
|
|
320
|
+
else if (isMemberInElement(win, ln)) {
|
|
321
|
+
// standard event
|
|
322
|
+
// the JSX attribute could have been "onMouseOver" and the
|
|
323
|
+
// member name "onmouseover" is on the window's prototype
|
|
324
|
+
// so let's add the listener "mouseover", which is all lowercased
|
|
325
|
+
memberName = ln.slice(2);
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
// custom event
|
|
329
|
+
// the JSX attribute could have been "onMyCustomEvent"
|
|
330
|
+
// so let's trim off the "on" prefix and lowercase the first character
|
|
331
|
+
// and add the listener "myCustomEvent"
|
|
332
|
+
// except for the first character, we keep the event name case
|
|
333
|
+
memberName = ln[2] + memberName.slice(3);
|
|
334
|
+
}
|
|
335
|
+
if (oldValue) {
|
|
336
|
+
plt.rel(elm, memberName, oldValue, false);
|
|
337
|
+
}
|
|
338
|
+
if (newValue) {
|
|
339
|
+
plt.ael(elm, memberName, newValue, false);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
250
342
|
else {
|
|
251
343
|
// Set property if it exists and it's not a SVG
|
|
252
344
|
const isComplex = isComplexType(newValue);
|
|
@@ -314,13 +406,36 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
314
406
|
let i = 0;
|
|
315
407
|
let elm;
|
|
316
408
|
let childNode;
|
|
409
|
+
let oldVNode;
|
|
410
|
+
if (!useNativeShadowDom) {
|
|
411
|
+
// remember for later we need to check to relocate nodes
|
|
412
|
+
checkSlotRelocate = true;
|
|
413
|
+
if (newVNode.$tag$ === 'slot') {
|
|
414
|
+
if (scopeId) {
|
|
415
|
+
// scoped css needs to add its scoped id to the parent element
|
|
416
|
+
parentElm.classList.add(scopeId + '-s');
|
|
417
|
+
}
|
|
418
|
+
newVNode.$flags$ |= newVNode.$children$
|
|
419
|
+
? // slot element has fallback content
|
|
420
|
+
2 /* isSlotFallback */
|
|
421
|
+
: // slot element does not have fallback content
|
|
422
|
+
1 /* isSlotReference */;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
317
425
|
if (newVNode.$text$ !== null) {
|
|
318
426
|
// create text node
|
|
319
427
|
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
|
320
428
|
}
|
|
429
|
+
else if (newVNode.$flags$ & 1 /* isSlotReference */) {
|
|
430
|
+
// create a slot reference node
|
|
431
|
+
elm = newVNode.$elm$ =
|
|
432
|
+
doc.createTextNode('');
|
|
433
|
+
}
|
|
321
434
|
else {
|
|
322
435
|
// create element
|
|
323
|
-
elm = newVNode.$elm$ = (doc.createElement(newVNode.$
|
|
436
|
+
elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
|
|
437
|
+
? 'slot-fb'
|
|
438
|
+
: newVNode.$tag$));
|
|
324
439
|
// add css classes, attrs, props, listeners, etc.
|
|
325
440
|
{
|
|
326
441
|
updateElement(null, newVNode, isSvgMode);
|
|
@@ -333,7 +448,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
333
448
|
if (newVNode.$children$) {
|
|
334
449
|
for (i = 0; i < newVNode.$children$.length; ++i) {
|
|
335
450
|
// create the node
|
|
336
|
-
childNode = createElm(oldParentVNode, newVNode, i);
|
|
451
|
+
childNode = createElm(oldParentVNode, newVNode, i, elm);
|
|
337
452
|
// return node could have been null
|
|
338
453
|
if (childNode) {
|
|
339
454
|
// append our new node
|
|
@@ -342,20 +457,62 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
342
457
|
}
|
|
343
458
|
}
|
|
344
459
|
}
|
|
460
|
+
{
|
|
461
|
+
elm['s-hn'] = hostTagName;
|
|
462
|
+
if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
|
|
463
|
+
// remember the content reference comment
|
|
464
|
+
elm['s-sr'] = true;
|
|
465
|
+
// remember the content reference comment
|
|
466
|
+
elm['s-cr'] = contentRef;
|
|
467
|
+
// remember the slot name, or empty string for default slot
|
|
468
|
+
elm['s-sn'] = newVNode.$name$ || '';
|
|
469
|
+
// check if we've got an old vnode for this slot
|
|
470
|
+
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
|
|
471
|
+
if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
|
|
472
|
+
// we've got an old slot vnode and the wrapper is being replaced
|
|
473
|
+
// so let's move the old slot content back to it's original location
|
|
474
|
+
putBackInOriginalLocation(oldParentVNode.$elm$, false);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
345
478
|
return elm;
|
|
346
479
|
};
|
|
480
|
+
const putBackInOriginalLocation = (parentElm, recursive) => {
|
|
481
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
482
|
+
const oldSlotChildNodes = parentElm.childNodes;
|
|
483
|
+
for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
|
|
484
|
+
const childNode = oldSlotChildNodes[i];
|
|
485
|
+
if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
|
|
486
|
+
// // this child node in the old element is from another component
|
|
487
|
+
// // remove this node from the old slot's parent
|
|
488
|
+
// childNode.remove();
|
|
489
|
+
// and relocate it back to it's original location
|
|
490
|
+
parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
|
|
491
|
+
// remove the old original location comment entirely
|
|
492
|
+
// later on the patch function will know what to do
|
|
493
|
+
// and move this to the correct spot in need be
|
|
494
|
+
childNode['s-ol'].remove();
|
|
495
|
+
childNode['s-ol'] = undefined;
|
|
496
|
+
checkSlotRelocate = true;
|
|
497
|
+
}
|
|
498
|
+
if (recursive) {
|
|
499
|
+
putBackInOriginalLocation(childNode, recursive);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
503
|
+
};
|
|
347
504
|
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
|
348
|
-
let containerElm = (parentElm);
|
|
505
|
+
let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
|
|
349
506
|
let childNode;
|
|
350
507
|
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
|
351
508
|
containerElm = containerElm.shadowRoot;
|
|
352
509
|
}
|
|
353
510
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
354
511
|
if (vnodes[startIdx]) {
|
|
355
|
-
childNode = createElm(null, parentVNode, startIdx);
|
|
512
|
+
childNode = createElm(null, parentVNode, startIdx, parentElm);
|
|
356
513
|
if (childNode) {
|
|
357
514
|
vnodes[startIdx].$elm$ = childNode;
|
|
358
|
-
containerElm.insertBefore(childNode, before);
|
|
515
|
+
containerElm.insertBefore(childNode, referenceNode(before) );
|
|
359
516
|
}
|
|
360
517
|
}
|
|
361
518
|
}
|
|
@@ -365,6 +522,20 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
365
522
|
if ((vnode = vnodes[startIdx])) {
|
|
366
523
|
elm = vnode.$elm$;
|
|
367
524
|
callNodeRefs(vnode);
|
|
525
|
+
{
|
|
526
|
+
// we're removing this element
|
|
527
|
+
// so it's possible we need to show slot fallback content now
|
|
528
|
+
checkSlotFallbackVisibility = true;
|
|
529
|
+
if (elm['s-ol']) {
|
|
530
|
+
// remove the original location comment
|
|
531
|
+
elm['s-ol'].remove();
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
// it's possible that child nodes of the node
|
|
535
|
+
// that's being removed are slot nodes
|
|
536
|
+
putBackInOriginalLocation(elm, true);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
368
539
|
// remove the vnode's element from the dom
|
|
369
540
|
elm.remove();
|
|
370
541
|
}
|
|
@@ -405,12 +576,20 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
405
576
|
newEndVnode = newCh[--newEndIdx];
|
|
406
577
|
}
|
|
407
578
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
579
|
+
// Vnode moved right
|
|
580
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
581
|
+
putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
|
|
582
|
+
}
|
|
408
583
|
patch(oldStartVnode, newEndVnode);
|
|
409
584
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
410
585
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
411
586
|
newEndVnode = newCh[--newEndIdx];
|
|
412
587
|
}
|
|
413
588
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
589
|
+
// Vnode moved left
|
|
590
|
+
if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
|
|
591
|
+
putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
|
|
592
|
+
}
|
|
414
593
|
patch(oldEndVnode, newStartVnode);
|
|
415
594
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
416
595
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
@@ -419,12 +598,12 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
419
598
|
else {
|
|
420
599
|
{
|
|
421
600
|
// new element
|
|
422
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
601
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
|
|
423
602
|
newStartVnode = newCh[++newStartIdx];
|
|
424
603
|
}
|
|
425
604
|
if (node) {
|
|
426
605
|
{
|
|
427
|
-
oldStartVnode.$elm
|
|
606
|
+
parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
|
|
428
607
|
}
|
|
429
608
|
}
|
|
430
609
|
}
|
|
@@ -440,16 +619,28 @@ const isSameVnode = (vnode1, vnode2) => {
|
|
|
440
619
|
// compare if two vnode to see if they're "technically" the same
|
|
441
620
|
// need to have the same element tag, and same key to be the same
|
|
442
621
|
if (vnode1.$tag$ === vnode2.$tag$) {
|
|
622
|
+
if (vnode1.$tag$ === 'slot') {
|
|
623
|
+
return vnode1.$name$ === vnode2.$name$;
|
|
624
|
+
}
|
|
443
625
|
return true;
|
|
444
626
|
}
|
|
445
627
|
return false;
|
|
446
628
|
};
|
|
629
|
+
const referenceNode = (node) => {
|
|
630
|
+
// this node was relocated to a new location in the dom
|
|
631
|
+
// because of some other component's slot
|
|
632
|
+
// but we still have an html comment in place of where
|
|
633
|
+
// it's original location was according to it's original vdom
|
|
634
|
+
return (node && node['s-ol']) || node;
|
|
635
|
+
};
|
|
636
|
+
const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
|
|
447
637
|
const patch = (oldVNode, newVNode) => {
|
|
448
638
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
449
639
|
const oldChildren = oldVNode.$children$;
|
|
450
640
|
const newChildren = newVNode.$children$;
|
|
451
641
|
const tag = newVNode.$tag$;
|
|
452
642
|
const text = newVNode.$text$;
|
|
643
|
+
let defaultHolder;
|
|
453
644
|
if (text === null) {
|
|
454
645
|
// element node
|
|
455
646
|
{
|
|
@@ -480,12 +671,147 @@ const patch = (oldVNode, newVNode) => {
|
|
|
480
671
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
481
672
|
}
|
|
482
673
|
}
|
|
674
|
+
else if ((defaultHolder = elm['s-cr'])) {
|
|
675
|
+
// this element has slotted content
|
|
676
|
+
defaultHolder.parentNode.textContent = text;
|
|
677
|
+
}
|
|
483
678
|
else if (oldVNode.$text$ !== text) {
|
|
484
679
|
// update the text content for the text only vnode
|
|
485
680
|
// and also only if the text is different than before
|
|
486
681
|
elm.data = text;
|
|
487
682
|
}
|
|
488
683
|
};
|
|
684
|
+
const updateFallbackSlotVisibility = (elm) => {
|
|
685
|
+
// tslint:disable-next-line: prefer-const
|
|
686
|
+
const childNodes = elm.childNodes;
|
|
687
|
+
let childNode;
|
|
688
|
+
let i;
|
|
689
|
+
let ilen;
|
|
690
|
+
let j;
|
|
691
|
+
let slotNameAttr;
|
|
692
|
+
let nodeType;
|
|
693
|
+
for (i = 0, ilen = childNodes.length; i < ilen; i++) {
|
|
694
|
+
childNode = childNodes[i];
|
|
695
|
+
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
696
|
+
if (childNode['s-sr']) {
|
|
697
|
+
// this is a slot fallback node
|
|
698
|
+
// get the slot name for this slot reference node
|
|
699
|
+
slotNameAttr = childNode['s-sn'];
|
|
700
|
+
// by default always show a fallback slot node
|
|
701
|
+
// then hide it if there are other slots in the light dom
|
|
702
|
+
childNode.hidden = false;
|
|
703
|
+
for (j = 0; j < ilen; j++) {
|
|
704
|
+
nodeType = childNodes[j].nodeType;
|
|
705
|
+
if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
|
|
706
|
+
// this sibling node is from a different component OR is a named fallback slot node
|
|
707
|
+
if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
|
|
708
|
+
childNode.hidden = true;
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
// this is a default fallback slot node
|
|
714
|
+
// any element or text node (with content)
|
|
715
|
+
// should hide the default fallback slot node
|
|
716
|
+
if (nodeType === 1 /* ElementNode */ ||
|
|
717
|
+
(nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
|
|
718
|
+
childNode.hidden = true;
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
// keep drilling down
|
|
725
|
+
updateFallbackSlotVisibility(childNode);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
const relocateNodes = [];
|
|
730
|
+
const relocateSlotContent = (elm) => {
|
|
731
|
+
// tslint:disable-next-line: prefer-const
|
|
732
|
+
let childNode;
|
|
733
|
+
let node;
|
|
734
|
+
let hostContentNodes;
|
|
735
|
+
let slotNameAttr;
|
|
736
|
+
let relocateNodeData;
|
|
737
|
+
let j;
|
|
738
|
+
let i = 0;
|
|
739
|
+
const childNodes = elm.childNodes;
|
|
740
|
+
const ilen = childNodes.length;
|
|
741
|
+
for (; i < ilen; i++) {
|
|
742
|
+
childNode = childNodes[i];
|
|
743
|
+
if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
|
|
744
|
+
// first got the content reference comment node
|
|
745
|
+
// then we got it's parent, which is where all the host content is in now
|
|
746
|
+
hostContentNodes = node.parentNode.childNodes;
|
|
747
|
+
slotNameAttr = childNode['s-sn'];
|
|
748
|
+
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
749
|
+
node = hostContentNodes[j];
|
|
750
|
+
if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
|
|
751
|
+
// let's do some relocating to its new home
|
|
752
|
+
// but never relocate a content reference node
|
|
753
|
+
// that is suppose to always represent the original content location
|
|
754
|
+
if (isNodeLocatedInSlot(node, slotNameAttr)) {
|
|
755
|
+
// it's possible we've already decided to relocate this node
|
|
756
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
757
|
+
// made some changes to slots
|
|
758
|
+
// let's make sure we also double check
|
|
759
|
+
// fallbacks are correctly hidden or shown
|
|
760
|
+
checkSlotFallbackVisibility = true;
|
|
761
|
+
node['s-sn'] = node['s-sn'] || slotNameAttr;
|
|
762
|
+
if (relocateNodeData) {
|
|
763
|
+
// previously we never found a slot home for this node
|
|
764
|
+
// but turns out we did, so let's remember it now
|
|
765
|
+
relocateNodeData.$slotRefNode$ = childNode;
|
|
766
|
+
}
|
|
767
|
+
else {
|
|
768
|
+
// add to our list of nodes to relocate
|
|
769
|
+
relocateNodes.push({
|
|
770
|
+
$slotRefNode$: childNode,
|
|
771
|
+
$nodeToRelocate$: node,
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
if (node['s-sr']) {
|
|
775
|
+
relocateNodes.map((relocateNode) => {
|
|
776
|
+
if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
|
|
777
|
+
relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
778
|
+
if (relocateNodeData && !relocateNode.$slotRefNode$) {
|
|
779
|
+
relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
|
|
786
|
+
// so far this element does not have a slot home, not setting slotRefNode on purpose
|
|
787
|
+
// if we never find a home for this element then we'll need to hide it
|
|
788
|
+
relocateNodes.push({
|
|
789
|
+
$nodeToRelocate$: node,
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
if (childNode.nodeType === 1 /* ElementNode */) {
|
|
796
|
+
relocateSlotContent(childNode);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
|
|
801
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
802
|
+
if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
|
|
803
|
+
return true;
|
|
804
|
+
}
|
|
805
|
+
if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
|
|
806
|
+
return true;
|
|
807
|
+
}
|
|
808
|
+
return false;
|
|
809
|
+
}
|
|
810
|
+
if (nodeToRelocate['s-sn'] === slotNameAttr) {
|
|
811
|
+
return true;
|
|
812
|
+
}
|
|
813
|
+
return slotNameAttr === '';
|
|
814
|
+
};
|
|
489
815
|
const callNodeRefs = (vNode) => {
|
|
490
816
|
{
|
|
491
817
|
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
|
|
@@ -494,9 +820,14 @@ const callNodeRefs = (vNode) => {
|
|
|
494
820
|
};
|
|
495
821
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
496
822
|
const hostElm = hostRef.$hostElement$;
|
|
823
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
497
824
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
498
825
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
499
826
|
hostTagName = hostElm.tagName;
|
|
827
|
+
if (cmpMeta.$attrsToReflect$) {
|
|
828
|
+
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
829
|
+
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
830
|
+
}
|
|
500
831
|
rootVnode.$tag$ = null;
|
|
501
832
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
502
833
|
hostRef.$vnode$ = rootVnode;
|
|
@@ -504,10 +835,105 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
504
835
|
{
|
|
505
836
|
scopeId = hostElm['s-sc'];
|
|
506
837
|
}
|
|
838
|
+
{
|
|
839
|
+
contentRef = hostElm['s-cr'];
|
|
840
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
841
|
+
// always reset
|
|
842
|
+
checkSlotFallbackVisibility = false;
|
|
843
|
+
}
|
|
507
844
|
// synchronous patch
|
|
508
845
|
patch(oldVNode, rootVnode);
|
|
846
|
+
{
|
|
847
|
+
// while we're moving nodes around existing nodes, temporarily disable
|
|
848
|
+
// the disconnectCallback from working
|
|
849
|
+
plt.$flags$ |= 1 /* isTmpDisconnected */;
|
|
850
|
+
if (checkSlotRelocate) {
|
|
851
|
+
relocateSlotContent(rootVnode.$elm$);
|
|
852
|
+
let relocateData;
|
|
853
|
+
let nodeToRelocate;
|
|
854
|
+
let orgLocationNode;
|
|
855
|
+
let parentNodeRef;
|
|
856
|
+
let insertBeforeNode;
|
|
857
|
+
let refNode;
|
|
858
|
+
let i = 0;
|
|
859
|
+
for (; i < relocateNodes.length; i++) {
|
|
860
|
+
relocateData = relocateNodes[i];
|
|
861
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
862
|
+
if (!nodeToRelocate['s-ol']) {
|
|
863
|
+
// add a reference node marking this node's original location
|
|
864
|
+
// keep a reference to this node for later lookups
|
|
865
|
+
orgLocationNode =
|
|
866
|
+
doc.createTextNode('');
|
|
867
|
+
orgLocationNode['s-nr'] = nodeToRelocate;
|
|
868
|
+
nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
for (i = 0; i < relocateNodes.length; i++) {
|
|
872
|
+
relocateData = relocateNodes[i];
|
|
873
|
+
nodeToRelocate = relocateData.$nodeToRelocate$;
|
|
874
|
+
if (relocateData.$slotRefNode$) {
|
|
875
|
+
// by default we're just going to insert it directly
|
|
876
|
+
// after the slot reference node
|
|
877
|
+
parentNodeRef = relocateData.$slotRefNode$.parentNode;
|
|
878
|
+
insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
|
|
879
|
+
orgLocationNode = nodeToRelocate['s-ol'];
|
|
880
|
+
while ((orgLocationNode = orgLocationNode.previousSibling)) {
|
|
881
|
+
refNode = orgLocationNode['s-nr'];
|
|
882
|
+
if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
|
|
883
|
+
refNode = refNode.nextSibling;
|
|
884
|
+
if (!refNode || !refNode['s-nr']) {
|
|
885
|
+
insertBeforeNode = refNode;
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
|
|
891
|
+
nodeToRelocate.nextSibling !== insertBeforeNode) {
|
|
892
|
+
// we've checked that it's worth while to relocate
|
|
893
|
+
// since that the node to relocate
|
|
894
|
+
// has a different next sibling or parent relocated
|
|
895
|
+
if (nodeToRelocate !== insertBeforeNode) {
|
|
896
|
+
if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
|
|
897
|
+
// probably a component in the index.html that doesn't have it's hostname set
|
|
898
|
+
nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
|
|
899
|
+
}
|
|
900
|
+
// add it back to the dom but in its new home
|
|
901
|
+
parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
else {
|
|
906
|
+
// this node doesn't have a slot home to go to, so let's hide it
|
|
907
|
+
if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
|
|
908
|
+
nodeToRelocate.hidden = true;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
if (checkSlotFallbackVisibility) {
|
|
914
|
+
updateFallbackSlotVisibility(rootVnode.$elm$);
|
|
915
|
+
}
|
|
916
|
+
// done moving nodes around
|
|
917
|
+
// allow the disconnect callback to work again
|
|
918
|
+
plt.$flags$ &= ~1 /* isTmpDisconnected */;
|
|
919
|
+
// always reset
|
|
920
|
+
relocateNodes.length = 0;
|
|
921
|
+
}
|
|
509
922
|
};
|
|
510
923
|
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
924
|
+
const createEvent = (ref, name, flags) => {
|
|
925
|
+
const elm = getElement(ref);
|
|
926
|
+
return {
|
|
927
|
+
emit: (detail) => {
|
|
928
|
+
return emitEvent(elm, name, {
|
|
929
|
+
bubbles: !!(flags & 4 /* Bubbles */),
|
|
930
|
+
composed: !!(flags & 2 /* Composed */),
|
|
931
|
+
cancelable: !!(flags & 1 /* Cancellable */),
|
|
932
|
+
detail,
|
|
933
|
+
});
|
|
934
|
+
},
|
|
935
|
+
};
|
|
936
|
+
};
|
|
511
937
|
/**
|
|
512
938
|
* Helper function to create & dispatch a custom Event on a provided target
|
|
513
939
|
* @param elm the target of the Event
|
|
@@ -732,6 +1158,7 @@ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propNam
|
|
|
732
1158
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
733
1159
|
// check our new property value against our internal value
|
|
734
1160
|
const hostRef = getHostRef(ref);
|
|
1161
|
+
const elm = hostRef.$hostElement$ ;
|
|
735
1162
|
const oldVal = hostRef.$instanceValues$.get(propName);
|
|
736
1163
|
const flags = hostRef.$flags$;
|
|
737
1164
|
const instance = hostRef.$lazyInstance$ ;
|
|
@@ -744,6 +1171,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
744
1171
|
// set our new value!
|
|
745
1172
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
746
1173
|
if (instance) {
|
|
1174
|
+
// get an array of method names of watch functions to call
|
|
1175
|
+
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
1176
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
|
1177
|
+
if (watchMethods) {
|
|
1178
|
+
// this instance is watching for when this property changed
|
|
1179
|
+
watchMethods.map((watchMethodName) => {
|
|
1180
|
+
try {
|
|
1181
|
+
// fire off each of the watch methods that are watching this property
|
|
1182
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
|
1183
|
+
}
|
|
1184
|
+
catch (e) {
|
|
1185
|
+
consoleError(e, elm);
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
747
1190
|
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
748
1191
|
if (instance.componentShouldUpdate) {
|
|
749
1192
|
if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
|
|
@@ -761,6 +1204,9 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
761
1204
|
};
|
|
762
1205
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
763
1206
|
if (cmpMeta.$members$) {
|
|
1207
|
+
if (Cstr.watchers) {
|
|
1208
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1209
|
+
}
|
|
764
1210
|
// It's better to have a const than two Object.entries()
|
|
765
1211
|
const members = Object.entries(cmpMeta.$members$);
|
|
766
1212
|
const prototype = Cstr.prototype;
|
|
@@ -842,6 +1288,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
842
1288
|
.map(([propName, m]) => {
|
|
843
1289
|
const attrName = m[1] || propName;
|
|
844
1290
|
attrNameToPropName.set(attrName, propName);
|
|
1291
|
+
if (m[0] & 512 /* ReflectAttr */) {
|
|
1292
|
+
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
1293
|
+
}
|
|
845
1294
|
return attrName;
|
|
846
1295
|
});
|
|
847
1296
|
}
|
|
@@ -865,6 +1314,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
865
1314
|
endLoad();
|
|
866
1315
|
}
|
|
867
1316
|
if (!Cstr.isProxied) {
|
|
1317
|
+
// we've never proxied this Constructor before
|
|
1318
|
+
// let's add the getters/setters to its prototype before
|
|
1319
|
+
// the first time we create an instance of the implementation
|
|
1320
|
+
{
|
|
1321
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1322
|
+
}
|
|
868
1323
|
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
869
1324
|
Cstr.isProxied = true;
|
|
870
1325
|
}
|
|
@@ -888,6 +1343,9 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
888
1343
|
{
|
|
889
1344
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
890
1345
|
}
|
|
1346
|
+
{
|
|
1347
|
+
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1348
|
+
}
|
|
891
1349
|
endNewInstance();
|
|
892
1350
|
}
|
|
893
1351
|
if (Cstr.style) {
|
|
@@ -925,6 +1383,15 @@ const connectedCallback = (elm) => {
|
|
|
925
1383
|
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
926
1384
|
// first time this component has connected
|
|
927
1385
|
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1386
|
+
{
|
|
1387
|
+
// initUpdate
|
|
1388
|
+
// if the slot polyfill is required we'll need to put some nodes
|
|
1389
|
+
// in here to act as original content anchors as we move nodes around
|
|
1390
|
+
// host element has been connected to the DOM
|
|
1391
|
+
if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
|
|
1392
|
+
setContentReference(elm);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
928
1395
|
{
|
|
929
1396
|
// find the first ancestor component (if there is one) and register
|
|
930
1397
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -964,6 +1431,17 @@ const connectedCallback = (elm) => {
|
|
|
964
1431
|
endConnected();
|
|
965
1432
|
}
|
|
966
1433
|
};
|
|
1434
|
+
const setContentReference = (elm) => {
|
|
1435
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
1436
|
+
// or this browser doesn't support native shadow dom
|
|
1437
|
+
// and this host element was NOT created with SSR
|
|
1438
|
+
// let's pick out the inner content for slot projection
|
|
1439
|
+
// create a node to represent where the original
|
|
1440
|
+
// content was first placed, which is useful later on
|
|
1441
|
+
const contentRefElm = (elm['s-cr'] = doc.createComment(''));
|
|
1442
|
+
contentRefElm['s-cn'] = true;
|
|
1443
|
+
elm.insertBefore(contentRefElm, elm.firstChild);
|
|
1444
|
+
};
|
|
967
1445
|
const disconnectedCallback = (elm) => {
|
|
968
1446
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
969
1447
|
const hostRef = getHostRef(elm);
|
|
@@ -1002,6 +1480,12 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1002
1480
|
{
|
|
1003
1481
|
cmpMeta.$listeners$ = compactMeta[3];
|
|
1004
1482
|
}
|
|
1483
|
+
{
|
|
1484
|
+
cmpMeta.$attrsToReflect$ = [];
|
|
1485
|
+
}
|
|
1486
|
+
{
|
|
1487
|
+
cmpMeta.$watchers$ = {};
|
|
1488
|
+
}
|
|
1005
1489
|
const tagName = cmpMeta.$tagName$;
|
|
1006
1490
|
const HostElement = class extends HTMLElement {
|
|
1007
1491
|
// StencilLazyHost
|
|
@@ -1153,4 +1637,4 @@ const flush = () => {
|
|
|
1153
1637
|
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
|
|
1154
1638
|
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
|
1155
1639
|
|
|
1156
|
-
export { Host as H, bootstrapLazy as b, getElement as g, h, promiseResolve as p, registerInstance as r };
|
|
1640
|
+
export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };
|