@maggioli-design-system/mds-modal 2.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-6f89e656.js → index-90939077.js} +204 -59
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mds-modal.cjs.entry.js +3 -42
- package/dist/cjs/mds-modal.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/mds-modal/mds-modal.css +30 -19
- package/dist/collection/components/mds-modal/mds-modal.js +100 -91
- package/dist/collection/components/mds-modal/test/mds-modal.stories.js +2 -19
- package/dist/collection/dictionary/typography.js +14 -3
- package/dist/components/index.d.ts +1 -5
- package/dist/components/index.js +1 -0
- package/dist/components/mds-modal.js +2 -41
- package/dist/esm/{index-7c9adc93.js → index-5dfae565.js} +204 -59
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mds-modal.entry.js +3 -42
- package/dist/esm/mds-modal.js +2 -2
- package/dist/esm-es5/index-5dfae565.js +2 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mds-modal.entry.js +1 -1
- package/dist/esm-es5/mds-modal.js +1 -1
- package/dist/mds-modal/mds-modal.esm.js +1 -1
- package/dist/mds-modal/mds-modal.js +2 -1
- package/dist/mds-modal/p-19fa0f59.js +2 -0
- package/dist/mds-modal/p-4288d1a7.system.entry.js +1 -0
- package/dist/mds-modal/{p-93da9930.system.js → p-5935b9a5.system.js} +1 -1
- package/dist/mds-modal/p-9c47a964.system.js +2 -0
- package/dist/mds-modal/p-f1135a2e.entry.js +1 -0
- package/dist/stats.json +32 -32
- package/dist/types/dictionary/typography.d.ts +5 -3
- package/dist/types/types/typography.d.ts +4 -2
- package/loader/package.json +1 -0
- package/package.json +4 -4
- package/src/components/mds-modal/.gitlab-ci.yml +2 -2
- package/src/components/mds-modal/mds-modal.css +18 -7
- package/src/dictionary/typography.ts +19 -4
- package/src/types/typography.ts +13 -2
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/mds-modal.js +2 -1
- package/www/build/p-19fa0f59.js +2 -0
- package/www/build/p-4288d1a7.system.entry.js +1 -0
- package/www/build/{p-93da9930.system.js → p-5935b9a5.system.js} +1 -1
- package/www/build/p-9c47a964.system.js +2 -0
- package/www/build/p-f1135a2e.entry.js +1 -0
- package/dist/esm-es5/index-7c9adc93.js +0 -2
- package/dist/mds-modal/p-36906985.entry.js +0 -1
- package/dist/mds-modal/p-656f0e04.system.js +0 -2
- package/dist/mds-modal/p-a496fae0.system.entry.js +0 -1
- package/dist/mds-modal/p-b8cb7be9.js +0 -2
- package/www/build/p-36906985.entry.js +0 -1
- package/www/build/p-656f0e04.system.js +0 -2
- package/www/build/p-a496fae0.system.entry.js +0 -1
- package/www/build/p-b8cb7be9.js +0 -2
|
@@ -16,10 +16,10 @@ const plt = {
|
|
|
16
16
|
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
17
17
|
};
|
|
18
18
|
const promiseResolve = (v) => Promise.resolve(v);
|
|
19
|
-
const
|
|
19
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
20
20
|
try {
|
|
21
21
|
new CSSStyleSheet();
|
|
22
|
-
return typeof new CSSStyleSheet().
|
|
22
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
23
23
|
}
|
|
24
24
|
catch (e) { }
|
|
25
25
|
return false;
|
|
@@ -39,7 +39,7 @@ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =
|
|
|
39
39
|
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
40
40
|
try {
|
|
41
41
|
{
|
|
42
|
-
if (hostRef.$flags$ & 256 /* isListenReady */) {
|
|
42
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
43
43
|
// instance is ready, let's call it's member method for this event
|
|
44
44
|
hostRef.$lazyInstance$[methodName](ev);
|
|
45
45
|
}
|
|
@@ -53,12 +53,12 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
const getHostListenerTarget = (elm, flags) => {
|
|
56
|
-
if (flags & 4 /* TargetDocument */)
|
|
56
|
+
if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
57
57
|
return doc;
|
|
58
58
|
return elm;
|
|
59
59
|
};
|
|
60
60
|
// prettier-ignore
|
|
61
|
-
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
|
|
61
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
62
62
|
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
63
63
|
const createTime = (fnName, tagName = '') => {
|
|
64
64
|
{
|
|
@@ -74,12 +74,17 @@ const uniqueTime = (key, measureText) => {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
const rootAppliedStyles = new WeakMap();
|
|
77
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
78
78
|
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
79
79
|
let style = styles.get(scopeId);
|
|
80
|
-
if (
|
|
80
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
81
81
|
style = (style || new CSSStyleSheet());
|
|
82
|
-
style
|
|
82
|
+
if (typeof style === 'string') {
|
|
83
|
+
style = cssText;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
style.replaceSync(cssText);
|
|
87
|
+
}
|
|
83
88
|
}
|
|
84
89
|
else {
|
|
85
90
|
style = cssText;
|
|
@@ -91,7 +96,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
91
96
|
const style = styles.get(scopeId);
|
|
92
97
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
93
98
|
// so the fallback is to always use the document for the root node in those cases
|
|
94
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
99
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
95
100
|
if (style) {
|
|
96
101
|
if (typeof style === 'string') {
|
|
97
102
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -125,7 +130,7 @@ const attachStyles = (hostRef) => {
|
|
|
125
130
|
const flags = cmpMeta.$flags$;
|
|
126
131
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
127
132
|
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
128
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
133
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
129
134
|
// only required when we're NOT using native shadow dom (slot)
|
|
130
135
|
// or this browser doesn't support native shadow dom
|
|
131
136
|
// and this host element was NOT created with SSR
|
|
@@ -313,7 +318,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
313
318
|
}
|
|
314
319
|
}
|
|
315
320
|
}
|
|
316
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
321
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
317
322
|
newValue = newValue === true ? '' : newValue;
|
|
318
323
|
{
|
|
319
324
|
elm.setAttribute(memberName, newValue);
|
|
@@ -328,7 +333,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
328
333
|
// if the element passed in is a shadow root, which is a document fragment
|
|
329
334
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
330
335
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
331
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
336
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
332
337
|
? newVnode.$elm$.host
|
|
333
338
|
: newVnode.$elm$;
|
|
334
339
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -346,6 +351,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
346
351
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
347
352
|
}
|
|
348
353
|
};
|
|
354
|
+
/**
|
|
355
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
356
|
+
*
|
|
357
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
358
|
+
* @param newParentVNode the parent VNode from the current render
|
|
359
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
360
|
+
* children, for which we will create a new DOM node
|
|
361
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
362
|
+
* @returns the newly created node
|
|
363
|
+
*/
|
|
349
364
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
350
365
|
// tslint:disable-next-line: prefer-const
|
|
351
366
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
@@ -407,6 +422,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
407
422
|
}
|
|
408
423
|
}
|
|
409
424
|
};
|
|
425
|
+
/**
|
|
426
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
427
|
+
* traversing the two collections of children, identifying nodes that are
|
|
428
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
429
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
430
|
+
*
|
|
431
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
432
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
433
|
+
* 'windows' by storing start and end indices and references to the
|
|
434
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
435
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
436
|
+
* no children left to update by doing the following:
|
|
437
|
+
*
|
|
438
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
439
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
440
|
+
* only with a window bounded by the highlighted elements:
|
|
441
|
+
*
|
|
442
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
443
|
+
* ^^^^^^ ^^^^^^
|
|
444
|
+
*
|
|
445
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
446
|
+
* across the windows. This will basically detect elements which haven't
|
|
447
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
448
|
+
* VNode elements (represented as HTML):
|
|
449
|
+
*
|
|
450
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
451
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
452
|
+
*
|
|
453
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
454
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
455
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
456
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
457
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
458
|
+
*
|
|
459
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
460
|
+
* window corresponds to the element at the end of the other window. This is
|
|
461
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
462
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
463
|
+
* children nodes themselves have not changed but merely moved in the
|
|
464
|
+
* following example:
|
|
465
|
+
*
|
|
466
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
467
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
468
|
+
*
|
|
469
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
470
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
471
|
+
* DOM.
|
|
472
|
+
*
|
|
473
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
474
|
+
* nodes in the old children which have the same key as the first element in
|
|
475
|
+
* our window on the new children. If we find such a node we handle calling
|
|
476
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
477
|
+
* what we find.
|
|
478
|
+
*
|
|
479
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
480
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
481
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
482
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
483
|
+
* children has collapsed we still have more nodes on the new children that
|
|
484
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
485
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
486
|
+
* sure the corresponding DOM nodes are removed.
|
|
487
|
+
*
|
|
488
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
489
|
+
* @param oldCh the old children of the parent node
|
|
490
|
+
* @param newVNode the new VNode which will replace the parent
|
|
491
|
+
* @param newCh the new children of the parent node
|
|
492
|
+
*/
|
|
410
493
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
411
494
|
let oldStartIdx = 0;
|
|
412
495
|
let newStartIdx = 0;
|
|
@@ -419,7 +502,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
419
502
|
let node;
|
|
420
503
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
421
504
|
if (oldStartVnode == null) {
|
|
422
|
-
//
|
|
505
|
+
// VNode might have been moved left
|
|
423
506
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
424
507
|
}
|
|
425
508
|
else if (oldEndVnode == null) {
|
|
@@ -432,34 +515,67 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
432
515
|
newEndVnode = newCh[--newEndIdx];
|
|
433
516
|
}
|
|
434
517
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
518
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
519
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
520
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
521
|
+
// since things are matched up in order.
|
|
435
522
|
patch(oldStartVnode, newStartVnode);
|
|
436
523
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
437
524
|
newStartVnode = newCh[++newStartIdx];
|
|
438
525
|
}
|
|
439
526
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
527
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
528
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
529
|
+
// need to move any DOM Nodes.
|
|
440
530
|
patch(oldEndVnode, newEndVnode);
|
|
441
531
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
442
532
|
newEndVnode = newCh[--newEndIdx];
|
|
443
533
|
}
|
|
444
534
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
445
535
|
patch(oldStartVnode, newEndVnode);
|
|
536
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
537
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
538
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
539
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
540
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
541
|
+
//
|
|
542
|
+
// <old-start-node />
|
|
543
|
+
// <some-intervening-node />
|
|
544
|
+
// <old-end-node />
|
|
545
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
546
|
+
// <next-sibling />
|
|
547
|
+
//
|
|
548
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
549
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
550
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
551
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
552
|
+
// append it to the children of the parent element.
|
|
446
553
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
447
554
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
448
555
|
newEndVnode = newCh[--newEndIdx];
|
|
449
556
|
}
|
|
450
557
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
451
558
|
patch(oldEndVnode, newStartVnode);
|
|
559
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
560
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
561
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
562
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
563
|
+
// future.
|
|
452
564
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
453
565
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
454
566
|
newStartVnode = newCh[++newStartIdx];
|
|
455
567
|
}
|
|
456
568
|
else {
|
|
457
569
|
{
|
|
458
|
-
//
|
|
570
|
+
// We either didn't find an element in the old children that matches
|
|
571
|
+
// the key of the first new child OR the build is not using `key`
|
|
572
|
+
// attributes at all. In either case we need to create a new element
|
|
573
|
+
// for the new node.
|
|
459
574
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
460
575
|
newStartVnode = newCh[++newStartIdx];
|
|
461
576
|
}
|
|
462
577
|
if (node) {
|
|
578
|
+
// if we created a new node then handle inserting it to the DOM
|
|
463
579
|
{
|
|
464
580
|
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
465
581
|
}
|
|
@@ -467,20 +583,49 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
467
583
|
}
|
|
468
584
|
}
|
|
469
585
|
if (oldStartIdx > oldEndIdx) {
|
|
586
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
470
587
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
471
588
|
}
|
|
472
589
|
else if (newStartIdx > newEndIdx) {
|
|
590
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
591
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
592
|
+
// relevant DOM nodes)
|
|
473
593
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
474
594
|
}
|
|
475
595
|
};
|
|
476
|
-
|
|
596
|
+
/**
|
|
597
|
+
* Compare two VNodes to determine if they are the same
|
|
598
|
+
*
|
|
599
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
600
|
+
* information set on the two VNodes and can be misleading under certain
|
|
601
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
602
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
603
|
+
* checking that they have the same tag.
|
|
604
|
+
*
|
|
605
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
606
|
+
* changing order within a `children` array or something along those lines then
|
|
607
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
608
|
+
*
|
|
609
|
+
* @param leftVNode the first VNode to check
|
|
610
|
+
* @param rightVNode the second VNode to check
|
|
611
|
+
* @returns whether they're equal or not
|
|
612
|
+
*/
|
|
613
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
477
614
|
// compare if two vnode to see if they're "technically" the same
|
|
478
615
|
// need to have the same element tag, and same key to be the same
|
|
479
|
-
if (
|
|
616
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
480
617
|
return true;
|
|
481
618
|
}
|
|
482
619
|
return false;
|
|
483
620
|
};
|
|
621
|
+
/**
|
|
622
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
623
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
624
|
+
* children of the two nodes (if any).
|
|
625
|
+
*
|
|
626
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
627
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
628
|
+
*/
|
|
484
629
|
const patch = (oldVNode, newVNode) => {
|
|
485
630
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
486
631
|
const oldChildren = oldVNode.$children$;
|
|
@@ -488,7 +633,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
488
633
|
const tag = newVNode.$tag$;
|
|
489
634
|
const text = newVNode.$text$;
|
|
490
635
|
if (text === null) {
|
|
491
|
-
// element node
|
|
492
636
|
{
|
|
493
637
|
if (tag === 'slot')
|
|
494
638
|
;
|
|
@@ -501,6 +645,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
501
645
|
}
|
|
502
646
|
if (oldChildren !== null && newChildren !== null) {
|
|
503
647
|
// looks like there's child vnodes for both the old and new vnodes
|
|
648
|
+
// so we need to call `updateChildren` to reconcile them
|
|
504
649
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
505
650
|
}
|
|
506
651
|
else if (newChildren !== null) {
|
|
@@ -534,7 +679,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
534
679
|
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
535
680
|
}
|
|
536
681
|
rootVnode.$tag$ = null;
|
|
537
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
682
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
538
683
|
hostRef.$vnode$ = rootVnode;
|
|
539
684
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
540
685
|
{
|
|
@@ -549,9 +694,9 @@ const createEvent = (ref, name, flags) => {
|
|
|
549
694
|
return {
|
|
550
695
|
emit: (detail) => {
|
|
551
696
|
return emitEvent(elm, name, {
|
|
552
|
-
bubbles: !!(flags & 4 /* Bubbles */),
|
|
553
|
-
composed: !!(flags & 2 /* Composed */),
|
|
554
|
-
cancelable: !!(flags & 1 /* Cancellable */),
|
|
697
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
698
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
699
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
555
700
|
detail,
|
|
556
701
|
});
|
|
557
702
|
},
|
|
@@ -576,10 +721,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
576
721
|
};
|
|
577
722
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
578
723
|
{
|
|
579
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
724
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
580
725
|
}
|
|
581
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
582
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
726
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
727
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
583
728
|
return;
|
|
584
729
|
}
|
|
585
730
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -595,7 +740,7 @@ const dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
595
740
|
let promise;
|
|
596
741
|
if (isInitialLoad) {
|
|
597
742
|
{
|
|
598
|
-
hostRef.$flags$ |= 256 /* isListenReady */;
|
|
743
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
|
599
744
|
if (hostRef.$queuedListeners$) {
|
|
600
745
|
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
|
601
746
|
hostRef.$queuedListeners$ = null;
|
|
@@ -641,7 +786,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
641
786
|
}
|
|
642
787
|
else {
|
|
643
788
|
Promise.all(childrenPromises).then(postUpdate);
|
|
644
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
789
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
645
790
|
childrenPromises.length = 0;
|
|
646
791
|
}
|
|
647
792
|
}
|
|
@@ -650,10 +795,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
650
795
|
try {
|
|
651
796
|
instance = instance.render() ;
|
|
652
797
|
{
|
|
653
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
798
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
654
799
|
}
|
|
655
800
|
{
|
|
656
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
801
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
657
802
|
}
|
|
658
803
|
{
|
|
659
804
|
{
|
|
@@ -680,8 +825,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
680
825
|
{
|
|
681
826
|
safeCall(instance, 'componentDidRender');
|
|
682
827
|
}
|
|
683
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
684
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
828
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
829
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
685
830
|
{
|
|
686
831
|
// DOM WRITE!
|
|
687
832
|
addHydratedFlag(elm);
|
|
@@ -704,10 +849,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
704
849
|
hostRef.$onRenderResolve$();
|
|
705
850
|
hostRef.$onRenderResolve$ = undefined;
|
|
706
851
|
}
|
|
707
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
852
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
708
853
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
709
854
|
}
|
|
710
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
855
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
711
856
|
}
|
|
712
857
|
// ( •_•)
|
|
713
858
|
// ( •_•)>⌐■-■
|
|
@@ -763,12 +908,12 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
|
763
908
|
const parsePropertyValue = (propValue, propType) => {
|
|
764
909
|
// ensure this value is of the correct prop type
|
|
765
910
|
if (propValue != null && !isComplexType(propValue)) {
|
|
766
|
-
if (propType & 4 /* Boolean */) {
|
|
911
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
767
912
|
// per the HTML spec, any string value means it is a boolean true value
|
|
768
913
|
// but we'll cheat here and say that the string "false" is the boolean false
|
|
769
914
|
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
770
915
|
}
|
|
771
|
-
if (propType & 1 /* String */) {
|
|
916
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
772
917
|
// could have been passed as a number or boolean
|
|
773
918
|
// but we still want it as a string
|
|
774
919
|
return String(propValue);
|
|
@@ -792,13 +937,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
792
937
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
793
938
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
794
939
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
795
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
940
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
796
941
|
// gadzooks! the property's value has changed!!
|
|
797
942
|
// set our new value!
|
|
798
943
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
799
944
|
if (instance) {
|
|
800
945
|
// get an array of method names of watch functions to call
|
|
801
|
-
if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
|
|
946
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
|
802
947
|
const watchMethods = cmpMeta.$watchers$[propName];
|
|
803
948
|
if (watchMethods) {
|
|
804
949
|
// this instance is watching for when this property changed
|
|
@@ -813,7 +958,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
813
958
|
});
|
|
814
959
|
}
|
|
815
960
|
}
|
|
816
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
961
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
817
962
|
// looks like this value actually changed, so we've got work to do!
|
|
818
963
|
// but only if we've already rendered, otherwise just chill out
|
|
819
964
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -832,8 +977,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
832
977
|
const members = Object.entries(cmpMeta.$members$);
|
|
833
978
|
const prototype = Cstr.prototype;
|
|
834
979
|
members.map(([memberName, [memberFlags]]) => {
|
|
835
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
836
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
980
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
981
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
837
982
|
// proxyComponent - prop
|
|
838
983
|
Object.defineProperty(prototype, memberName, {
|
|
839
984
|
get() {
|
|
@@ -849,7 +994,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
849
994
|
});
|
|
850
995
|
}
|
|
851
996
|
});
|
|
852
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
997
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
853
998
|
const attrNameToPropName = new Map();
|
|
854
999
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
855
1000
|
plt.jmp(() => {
|
|
@@ -905,11 +1050,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
905
1050
|
// create an array of attributes to observe
|
|
906
1051
|
// and also create a map of html attribute name to js property name
|
|
907
1052
|
Cstr.observedAttributes = members
|
|
908
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1053
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
909
1054
|
.map(([propName, m]) => {
|
|
910
1055
|
const attrName = m[1] || propName;
|
|
911
1056
|
attrNameToPropName.set(attrName, propName);
|
|
912
|
-
if (m[0] & 512 /* ReflectAttr */) {
|
|
1057
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
913
1058
|
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
914
1059
|
}
|
|
915
1060
|
return attrName;
|
|
@@ -920,10 +1065,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
920
1065
|
};
|
|
921
1066
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
922
1067
|
// initializeComponent
|
|
923
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1068
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
924
1069
|
{
|
|
925
1070
|
// we haven't initialized this element yet
|
|
926
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1071
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
927
1072
|
// lazy loaded components
|
|
928
1073
|
// request the component's implementation to be
|
|
929
1074
|
// wired up with the host element
|
|
@@ -941,7 +1086,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
941
1086
|
{
|
|
942
1087
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
943
1088
|
}
|
|
944
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1089
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
945
1090
|
Cstr.isProxied = true;
|
|
946
1091
|
}
|
|
947
1092
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -949,7 +1094,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
949
1094
|
// but let's keep track of when we start and stop
|
|
950
1095
|
// so that the getters/setters don't incorrectly step on data
|
|
951
1096
|
{
|
|
952
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1097
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
953
1098
|
}
|
|
954
1099
|
// construct the lazy-loaded component implementation
|
|
955
1100
|
// passing the hostRef is very important during
|
|
@@ -962,10 +1107,10 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
962
1107
|
consoleError(e);
|
|
963
1108
|
}
|
|
964
1109
|
{
|
|
965
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1110
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
966
1111
|
}
|
|
967
1112
|
{
|
|
968
|
-
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1113
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
|
969
1114
|
}
|
|
970
1115
|
endNewInstance();
|
|
971
1116
|
}
|
|
@@ -975,7 +1120,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
975
1120
|
const scopeId = getScopeId(cmpMeta);
|
|
976
1121
|
if (!styles.has(scopeId)) {
|
|
977
1122
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
978
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1123
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
979
1124
|
endRegisterStyles();
|
|
980
1125
|
}
|
|
981
1126
|
}
|
|
@@ -997,13 +1142,13 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
997
1142
|
}
|
|
998
1143
|
};
|
|
999
1144
|
const connectedCallback = (elm) => {
|
|
1000
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1145
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1001
1146
|
const hostRef = getHostRef(elm);
|
|
1002
1147
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1003
1148
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
1004
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1149
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
1005
1150
|
// first time this component has connected
|
|
1006
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1151
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
1007
1152
|
{
|
|
1008
1153
|
// find the first ancestor component (if there is one) and register
|
|
1009
1154
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1023,7 +1168,7 @@ const connectedCallback = (elm) => {
|
|
|
1023
1168
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1024
1169
|
if (cmpMeta.$members$) {
|
|
1025
1170
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1026
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1171
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1027
1172
|
const value = elm[memberName];
|
|
1028
1173
|
delete elm[memberName];
|
|
1029
1174
|
elm[memberName] = value;
|
|
@@ -1044,7 +1189,7 @@ const connectedCallback = (elm) => {
|
|
|
1044
1189
|
}
|
|
1045
1190
|
};
|
|
1046
1191
|
const disconnectedCallback = (elm) => {
|
|
1047
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1192
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1048
1193
|
const hostRef = getHostRef(elm);
|
|
1049
1194
|
{
|
|
1050
1195
|
if (hostRef.$rmListeners$) {
|
|
@@ -1095,7 +1240,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1095
1240
|
super(self);
|
|
1096
1241
|
self = this;
|
|
1097
1242
|
registerHost(self, cmpMeta);
|
|
1098
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1243
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1099
1244
|
// this component is using shadow dom
|
|
1100
1245
|
// and this browser supports shadow dom
|
|
1101
1246
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1130,7 +1275,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1130
1275
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1131
1276
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1132
1277
|
cmpTags.push(tagName);
|
|
1133
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1278
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1134
1279
|
}
|
|
1135
1280
|
});
|
|
1136
1281
|
});
|
|
@@ -1152,7 +1297,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1152
1297
|
// Fallback appLoad event
|
|
1153
1298
|
endBootstrap();
|
|
1154
1299
|
};
|
|
1155
|
-
const hostRefs = new WeakMap();
|
|
1300
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1156
1301
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1157
1302
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1158
1303
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1194,14 +1339,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1194
1339
|
return importedModule[exportName];
|
|
1195
1340
|
}, consoleError);
|
|
1196
1341
|
};
|
|
1197
|
-
const styles = new Map();
|
|
1342
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1198
1343
|
const queueDomReads = [];
|
|
1199
1344
|
const queueDomWrites = [];
|
|
1200
1345
|
const queueTask = (queue, write) => (cb) => {
|
|
1201
1346
|
queue.push(cb);
|
|
1202
1347
|
if (!queuePending) {
|
|
1203
1348
|
queuePending = true;
|
|
1204
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1349
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1205
1350
|
nextTick(flush);
|
|
1206
1351
|
}
|
|
1207
1352
|
else {
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-5dfae565.js';
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
|
-
Stencil Client Patch Esm v2.
|
|
4
|
+
Stencil Client Patch Esm v2.18.0 | MIT Licensed | https://stenciljs.com
|
|
5
5
|
*/
|
|
6
6
|
const patchEsm = () => {
|
|
7
7
|
return promiseResolve();
|