proto-table-wc 0.0.324 → 0.0.327
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/demo-table_2.cjs.entry.js +1 -1
- package/dist/cjs/{index-7e27bef2.js → index-a6d8dc88.js} +183 -43
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/proto-table-wc.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/demo-table/demo-table.js +12 -12
- package/dist/collection/components/proto-table/proto-table.js +77 -81
- package/dist/esm/demo-table_2.entry.js +1 -1
- package/dist/esm/{index-c660fbbf.js → index-db21c56b.js} +183 -43
- package/dist/esm/loader.js +2 -2
- package/dist/esm/proto-table-wc.js +2 -2
- package/dist/proto-table-wc/{p-33ec0835.entry.js → p-1f6f46a5.entry.js} +1 -1
- package/dist/proto-table-wc/{p-fe8bd63d.js → p-9746b0d9.js} +0 -0
- package/dist/proto-table-wc/proto-table-wc.esm.js +1 -1
- package/loader/package.json +1 -0
- package/package.json +5 -5
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const index = require('./index-
|
5
|
+
const index = require('./index-a6d8dc88.js');
|
6
6
|
|
7
7
|
const demoTableCss = ".detailWrapper{font-weight:100;font-size:13px;display:flex;flex-direction:column;justify-items:start;padding:5px;padding-left:30px}";
|
8
8
|
|
@@ -62,7 +62,7 @@ const uniqueTime = (key, measureText) => {
|
|
62
62
|
};
|
63
63
|
}
|
64
64
|
};
|
65
|
-
const rootAppliedStyles = new WeakMap();
|
65
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
66
66
|
const registerStyle = (scopeId, cssText, allowCS) => {
|
67
67
|
let style = styles.get(scopeId);
|
68
68
|
if (supportsConstructableStylesheets && allowCS) {
|
@@ -84,7 +84,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
84
84
|
const style = styles.get(scopeId);
|
85
85
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
86
86
|
// so the fallback is to always use the document for the root node in those cases
|
87
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
87
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
88
88
|
if (style) {
|
89
89
|
if (typeof style === 'string') {
|
90
90
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
@@ -118,7 +118,7 @@ const attachStyles = (hostRef) => {
|
|
118
118
|
const flags = cmpMeta.$flags$;
|
119
119
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
120
120
|
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
121
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
121
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
122
122
|
// only required when we're NOT using native shadow dom (slot)
|
123
123
|
// or this browser doesn't support native shadow dom
|
124
124
|
// and this host element was NOT created with SSR
|
@@ -317,7 +317,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
317
317
|
}
|
318
318
|
}
|
319
319
|
}
|
320
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
320
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
321
321
|
newValue = newValue === true ? '' : newValue;
|
322
322
|
{
|
323
323
|
elm.setAttribute(memberName, newValue);
|
@@ -332,7 +332,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
332
332
|
// if the element passed in is a shadow root, which is a document fragment
|
333
333
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
334
334
|
// if it's not a shadow root, then we add attrs/props to the same element
|
335
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
335
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
336
336
|
? newVnode.$elm$.host
|
337
337
|
: newVnode.$elm$;
|
338
338
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
@@ -350,6 +350,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
350
350
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
351
351
|
}
|
352
352
|
};
|
353
|
+
/**
|
354
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
355
|
+
*
|
356
|
+
* @param oldParentVNode the parent VNode from the previous render
|
357
|
+
* @param newParentVNode the parent VNode from the current render
|
358
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
359
|
+
* children, for which we will create a new DOM node
|
360
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
361
|
+
* @returns the newly created node
|
362
|
+
*/
|
353
363
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
354
364
|
// tslint:disable-next-line: prefer-const
|
355
365
|
const newVNode = newParentVNode.$children$[childIndex];
|
@@ -429,6 +439,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
429
439
|
}
|
430
440
|
}
|
431
441
|
};
|
442
|
+
/**
|
443
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
444
|
+
* traversing the two collections of children, identifying nodes that are
|
445
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
446
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
447
|
+
*
|
448
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
449
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
450
|
+
* 'windows' by storing start and end indices and references to the
|
451
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
452
|
+
* to the entire array, but we progressively narrow the windows until there are
|
453
|
+
* no children left to update by doing the following:
|
454
|
+
*
|
455
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
456
|
+
* that if we have an initial array like the following we'll end up dealing
|
457
|
+
* only with a window bounded by the highlighted elements:
|
458
|
+
*
|
459
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
460
|
+
* ^^^^^^ ^^^^^^
|
461
|
+
*
|
462
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
463
|
+
* across the windows. This will basically detect elements which haven't
|
464
|
+
* been added, removed, or changed position, i.e. if you had the following
|
465
|
+
* VNode elements (represented as HTML):
|
466
|
+
*
|
467
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
468
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
469
|
+
*
|
470
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
471
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
472
|
+
* same tag in the same position, we'd be able to avoid completely
|
473
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
474
|
+
* call out to `patch` to handle reconciling their children and so on.
|
475
|
+
*
|
476
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
477
|
+
* window corresponds to the element at the end of the other window. This is
|
478
|
+
* a heuristic which will let us identify _some_ situations in which
|
479
|
+
* elements have changed position, for instance it _should_ detect that the
|
480
|
+
* children nodes themselves have not changed but merely moved in the
|
481
|
+
* following example:
|
482
|
+
*
|
483
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
484
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
485
|
+
*
|
486
|
+
* If we find cases like this then we also need to move the concrete DOM
|
487
|
+
* elements corresponding to the moved children to write the re-order to the
|
488
|
+
* DOM.
|
489
|
+
*
|
490
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
491
|
+
* nodes in the old children which have the same key as the first element in
|
492
|
+
* our window on the new children. If we find such a node we handle calling
|
493
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
494
|
+
* what we find.
|
495
|
+
*
|
496
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
497
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
498
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
499
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
500
|
+
* children has collapsed we still have more nodes on the new children that
|
501
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
502
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
503
|
+
* sure the corresponding DOM nodes are removed.
|
504
|
+
*
|
505
|
+
* @param parentElm the node into which the parent VNode is rendered
|
506
|
+
* @param oldCh the old children of the parent node
|
507
|
+
* @param newVNode the new VNode which will replace the parent
|
508
|
+
* @param newCh the new children of the parent node
|
509
|
+
*/
|
432
510
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
433
511
|
let oldStartIdx = 0;
|
434
512
|
let newStartIdx = 0;
|
@@ -441,7 +519,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
441
519
|
let node;
|
442
520
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
443
521
|
if (oldStartVnode == null) {
|
444
|
-
//
|
522
|
+
// VNode might have been moved left
|
445
523
|
oldStartVnode = oldCh[++oldStartIdx];
|
446
524
|
}
|
447
525
|
else if (oldEndVnode == null) {
|
@@ -454,34 +532,67 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
454
532
|
newEndVnode = newCh[--newEndIdx];
|
455
533
|
}
|
456
534
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
535
|
+
// if the start nodes are the same then we should patch the new VNode
|
536
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
537
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
538
|
+
// since things are matched up in order.
|
457
539
|
patch(oldStartVnode, newStartVnode);
|
458
540
|
oldStartVnode = oldCh[++oldStartIdx];
|
459
541
|
newStartVnode = newCh[++newStartIdx];
|
460
542
|
}
|
461
543
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
544
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
545
|
+
// decrement our end indices, and also likewise in this case we don't
|
546
|
+
// need to move any DOM Nodes.
|
462
547
|
patch(oldEndVnode, newEndVnode);
|
463
548
|
oldEndVnode = oldCh[--oldEndIdx];
|
464
549
|
newEndVnode = newCh[--newEndIdx];
|
465
550
|
}
|
466
551
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
467
552
|
patch(oldStartVnode, newEndVnode);
|
553
|
+
// We need to move the element for `oldStartVnode` into a position which
|
554
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
555
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
556
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
557
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
558
|
+
//
|
559
|
+
// <old-start-node />
|
560
|
+
// <some-intervening-node />
|
561
|
+
// <old-end-node />
|
562
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
563
|
+
// <next-sibling />
|
564
|
+
//
|
565
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
566
|
+
// the node for `oldStartVnode` at the end of the children of
|
567
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
568
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
569
|
+
// append it to the children of the parent element.
|
468
570
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
469
571
|
oldStartVnode = oldCh[++oldStartIdx];
|
470
572
|
newEndVnode = newCh[--newEndIdx];
|
471
573
|
}
|
472
574
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
473
575
|
patch(oldEndVnode, newStartVnode);
|
576
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
577
|
+
// the same node, so since we're here we know that they are not. Thus we
|
578
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
579
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
580
|
+
// future.
|
474
581
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
475
582
|
oldEndVnode = oldCh[--oldEndIdx];
|
476
583
|
newStartVnode = newCh[++newStartIdx];
|
477
584
|
}
|
478
585
|
else {
|
479
586
|
{
|
480
|
-
//
|
587
|
+
// We either didn't find an element in the old children that matches
|
588
|
+
// the key of the first new child OR the build is not using `key`
|
589
|
+
// attributes at all. In either case we need to create a new element
|
590
|
+
// for the new node.
|
481
591
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
482
592
|
newStartVnode = newCh[++newStartIdx];
|
483
593
|
}
|
484
594
|
if (node) {
|
595
|
+
// if we created a new node then handle inserting it to the DOM
|
485
596
|
{
|
486
597
|
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
487
598
|
}
|
@@ -489,20 +600,49 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
489
600
|
}
|
490
601
|
}
|
491
602
|
if (oldStartIdx > oldEndIdx) {
|
603
|
+
// we have some more new nodes to add which don't match up with old nodes
|
492
604
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
493
605
|
}
|
494
606
|
else if (newStartIdx > newEndIdx) {
|
607
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
608
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
609
|
+
// relevant DOM nodes)
|
495
610
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
496
611
|
}
|
497
612
|
};
|
498
|
-
|
613
|
+
/**
|
614
|
+
* Compare two VNodes to determine if they are the same
|
615
|
+
*
|
616
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
617
|
+
* information set on the two VNodes and can be misleading under certain
|
618
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
619
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
620
|
+
* checking that they have the same tag.
|
621
|
+
*
|
622
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
623
|
+
* changing order within a `children` array or something along those lines then
|
624
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
625
|
+
*
|
626
|
+
* @param leftVNode the first VNode to check
|
627
|
+
* @param rightVNode the second VNode to check
|
628
|
+
* @returns whether they're equal or not
|
629
|
+
*/
|
630
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
499
631
|
// compare if two vnode to see if they're "technically" the same
|
500
632
|
// need to have the same element tag, and same key to be the same
|
501
|
-
if (
|
633
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
502
634
|
return true;
|
503
635
|
}
|
504
636
|
return false;
|
505
637
|
};
|
638
|
+
/**
|
639
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
640
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
641
|
+
* children of the two nodes (if any).
|
642
|
+
*
|
643
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
644
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
645
|
+
*/
|
506
646
|
const patch = (oldVNode, newVNode) => {
|
507
647
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
508
648
|
const oldChildren = oldVNode.$children$;
|
@@ -515,7 +655,6 @@ const patch = (oldVNode, newVNode) => {
|
|
515
655
|
// only add this to the when the compiler sees we're using an svg somewhere
|
516
656
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
517
657
|
}
|
518
|
-
// element node
|
519
658
|
{
|
520
659
|
{
|
521
660
|
// either this is the first render of an element OR it's an update
|
@@ -526,6 +665,7 @@ const patch = (oldVNode, newVNode) => {
|
|
526
665
|
}
|
527
666
|
if (oldChildren !== null && newChildren !== null) {
|
528
667
|
// looks like there's child vnodes for both the old and new vnodes
|
668
|
+
// so we need to call `updateChildren` to reconcile them
|
529
669
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
530
670
|
}
|
531
671
|
else if (newChildren !== null) {
|
@@ -563,7 +703,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
563
703
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
564
704
|
hostTagName = hostElm.tagName;
|
565
705
|
rootVnode.$tag$ = null;
|
566
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
706
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
567
707
|
hostRef.$vnode$ = rootVnode;
|
568
708
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
569
709
|
{
|
@@ -591,10 +731,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
591
731
|
};
|
592
732
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
593
733
|
{
|
594
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
734
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
595
735
|
}
|
596
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
597
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
736
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
737
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
598
738
|
return;
|
599
739
|
}
|
600
740
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
@@ -646,7 +786,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
646
786
|
}
|
647
787
|
else {
|
648
788
|
Promise.all(childrenPromises).then(postUpdate);
|
649
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
789
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
650
790
|
childrenPromises.length = 0;
|
651
791
|
}
|
652
792
|
}
|
@@ -655,10 +795,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
655
795
|
try {
|
656
796
|
instance = instance.render() ;
|
657
797
|
{
|
658
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
798
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
659
799
|
}
|
660
800
|
{
|
661
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
801
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
662
802
|
}
|
663
803
|
{
|
664
804
|
{
|
@@ -682,8 +822,8 @@ const postUpdateComponent = (hostRef) => {
|
|
682
822
|
const endPostUpdate = createTime('postUpdate', tagName);
|
683
823
|
const instance = hostRef.$lazyInstance$ ;
|
684
824
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
685
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
686
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
825
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
826
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
687
827
|
{
|
688
828
|
// DOM WRITE!
|
689
829
|
addHydratedFlag(elm);
|
@@ -709,10 +849,10 @@ const postUpdateComponent = (hostRef) => {
|
|
709
849
|
hostRef.$onRenderResolve$();
|
710
850
|
hostRef.$onRenderResolve$ = undefined;
|
711
851
|
}
|
712
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
852
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
713
853
|
nextTick(() => scheduleUpdate(hostRef, false));
|
714
854
|
}
|
715
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
855
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
716
856
|
}
|
717
857
|
// ( •_•)
|
718
858
|
// ( •_•)>⌐■-■
|
@@ -786,12 +926,12 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
786
926
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
787
927
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
788
928
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
789
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
929
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
790
930
|
// gadzooks! the property's value has changed!!
|
791
931
|
// set our new value!
|
792
932
|
hostRef.$instanceValues$.set(propName, newVal);
|
793
933
|
if (instance) {
|
794
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
934
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
795
935
|
// looks like this value actually changed, so we've got work to do!
|
796
936
|
// but only if we've already rendered, otherwise just chill out
|
797
937
|
// queue that we need to do an update, but don't worry about queuing
|
@@ -807,8 +947,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
807
947
|
const members = Object.entries(cmpMeta.$members$);
|
808
948
|
const prototype = Cstr.prototype;
|
809
949
|
members.map(([memberName, [memberFlags]]) => {
|
810
|
-
if ((memberFlags & 31 /* Prop */ ||
|
811
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
950
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
951
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
812
952
|
// proxyComponent - prop
|
813
953
|
Object.defineProperty(prototype, memberName, {
|
814
954
|
get() {
|
@@ -824,7 +964,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
824
964
|
});
|
825
965
|
}
|
826
966
|
});
|
827
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
967
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
828
968
|
const attrNameToPropName = new Map();
|
829
969
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
830
970
|
plt.jmp(() => {
|
@@ -880,7 +1020,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
880
1020
|
// create an array of attributes to observe
|
881
1021
|
// and also create a map of html attribute name to js property name
|
882
1022
|
Cstr.observedAttributes = members
|
883
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
1023
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
884
1024
|
.map(([propName, m]) => {
|
885
1025
|
const attrName = m[1] || propName;
|
886
1026
|
attrNameToPropName.set(attrName, propName);
|
@@ -892,10 +1032,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
892
1032
|
};
|
893
1033
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
894
1034
|
// initializeComponent
|
895
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
1035
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
896
1036
|
{
|
897
1037
|
// we haven't initialized this element yet
|
898
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
1038
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
899
1039
|
// lazy loaded components
|
900
1040
|
// request the component's implementation to be
|
901
1041
|
// wired up with the host element
|
@@ -907,7 +1047,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
907
1047
|
endLoad();
|
908
1048
|
}
|
909
1049
|
if (!Cstr.isProxied) {
|
910
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
1050
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
911
1051
|
Cstr.isProxied = true;
|
912
1052
|
}
|
913
1053
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
@@ -915,7 +1055,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
915
1055
|
// but let's keep track of when we start and stop
|
916
1056
|
// so that the getters/setters don't incorrectly step on data
|
917
1057
|
{
|
918
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
1058
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
919
1059
|
}
|
920
1060
|
// construct the lazy-loaded component implementation
|
921
1061
|
// passing the hostRef is very important during
|
@@ -928,7 +1068,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
928
1068
|
consoleError(e);
|
929
1069
|
}
|
930
1070
|
{
|
931
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
1071
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
932
1072
|
}
|
933
1073
|
endNewInstance();
|
934
1074
|
}
|
@@ -938,7 +1078,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
938
1078
|
const scopeId = getScopeId(cmpMeta);
|
939
1079
|
if (!styles.has(scopeId)) {
|
940
1080
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
941
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
1081
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
942
1082
|
endRegisterStyles();
|
943
1083
|
}
|
944
1084
|
}
|
@@ -960,13 +1100,13 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
960
1100
|
}
|
961
1101
|
};
|
962
1102
|
const connectedCallback = (elm) => {
|
963
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
1103
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
964
1104
|
const hostRef = getHostRef(elm);
|
965
1105
|
const cmpMeta = hostRef.$cmpMeta$;
|
966
1106
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
967
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
1107
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
968
1108
|
// first time this component has connected
|
969
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
1109
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
970
1110
|
{
|
971
1111
|
// find the first ancestor component (if there is one) and register
|
972
1112
|
// this component as one of the actively loading child components for its ancestor
|
@@ -986,7 +1126,7 @@ const connectedCallback = (elm) => {
|
|
986
1126
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
987
1127
|
if (cmpMeta.$members$) {
|
988
1128
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
989
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
1129
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
990
1130
|
const value = elm[memberName];
|
991
1131
|
delete elm[memberName];
|
992
1132
|
elm[memberName] = value;
|
@@ -1001,7 +1141,7 @@ const connectedCallback = (elm) => {
|
|
1001
1141
|
}
|
1002
1142
|
};
|
1003
1143
|
const disconnectedCallback = (elm) => {
|
1004
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
1144
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
1005
1145
|
getHostRef(elm);
|
1006
1146
|
}
|
1007
1147
|
};
|
@@ -1037,7 +1177,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1037
1177
|
super(self);
|
1038
1178
|
self = this;
|
1039
1179
|
registerHost(self, cmpMeta);
|
1040
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
1180
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
1041
1181
|
// this component is using shadow dom
|
1042
1182
|
// and this browser supports shadow dom
|
1043
1183
|
// add the read-only property "shadowRoot" to the host element
|
@@ -1072,7 +1212,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1072
1212
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
1073
1213
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
1074
1214
|
cmpTags.push(tagName);
|
1075
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
1215
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
1076
1216
|
}
|
1077
1217
|
});
|
1078
1218
|
});
|
@@ -1094,7 +1234,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1094
1234
|
// Fallback appLoad event
|
1095
1235
|
endBootstrap();
|
1096
1236
|
};
|
1097
|
-
const hostRefs = new WeakMap();
|
1237
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
1098
1238
|
const getHostRef = (ref) => hostRefs.get(ref);
|
1099
1239
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
1100
1240
|
const registerHost = (elm, cmpMeta) => {
|
@@ -1135,14 +1275,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
1135
1275
|
return importedModule[exportName];
|
1136
1276
|
}, consoleError);
|
1137
1277
|
};
|
1138
|
-
const styles = new Map();
|
1278
|
+
const styles = /*@__PURE__*/ new Map();
|
1139
1279
|
const queueDomReads = [];
|
1140
1280
|
const queueDomWrites = [];
|
1141
1281
|
const queueTask = (queue, write) => (cb) => {
|
1142
1282
|
queue.push(cb);
|
1143
1283
|
if (!queuePending) {
|
1144
1284
|
queuePending = true;
|
1145
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
1285
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
1146
1286
|
nextTick(flush);
|
1147
1287
|
}
|
1148
1288
|
else {
|
package/dist/cjs/loader.cjs.js
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const index = require('./index-
|
5
|
+
const index = require('./index-a6d8dc88.js');
|
6
6
|
|
7
7
|
/*
|
8
|
-
Stencil Client Patch Esm v2.
|
8
|
+
Stencil Client Patch Esm v2.18.0 | MIT Licensed | https://stenciljs.com
|
9
9
|
*/
|
10
10
|
const patchEsm = () => {
|
11
11
|
return index.promiseResolve();
|
@@ -1,9 +1,9 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
const index = require('./index-
|
3
|
+
const index = require('./index-a6d8dc88.js');
|
4
4
|
|
5
5
|
/*
|
6
|
-
Stencil Client Patch Browser v2.
|
6
|
+
Stencil Client Patch Browser v2.18.0 | MIT Licensed | https://stenciljs.com
|
7
7
|
*/
|
8
8
|
const patchBrowser = () => {
|
9
9
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('proto-table-wc.cjs.js', document.baseURI).href));
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { h } from '@stencil/core';
|
2
2
|
export class DemoTable {
|
3
3
|
constructor() {
|
4
4
|
this.fields = [
|
@@ -11,11 +11,7 @@ export class DemoTable {
|
|
11
11
|
this.table = undefined;
|
12
12
|
this.renderDetails = item => {
|
13
13
|
const { tags = [] } = item;
|
14
|
-
return (h("div", { class: "detailWrapper" },
|
15
|
-
h("span", null,
|
16
|
-
tags.length,
|
17
|
-
" details..."),
|
18
|
-
h("ul", null, tags.map(tag => (h("li", null, tag))))));
|
14
|
+
return (h("div", { class: "detailWrapper" }, h("span", null, tags.length, " details..."), h("ul", null, tags.map(tag => (h("li", null, tag))))));
|
19
15
|
};
|
20
16
|
}
|
21
17
|
componentWillLoad() {
|
@@ -74,10 +70,14 @@ export class DemoTable {
|
|
74
70
|
}
|
75
71
|
static get is() { return "demo-table"; }
|
76
72
|
static get encapsulation() { return "shadow"; }
|
77
|
-
static get originalStyleUrls() {
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
73
|
+
static get originalStyleUrls() {
|
74
|
+
return {
|
75
|
+
"$": ["demo-table.css"]
|
76
|
+
};
|
77
|
+
}
|
78
|
+
static get styleUrls() {
|
79
|
+
return {
|
80
|
+
"$": ["demo-table.css"]
|
81
|
+
};
|
82
|
+
}
|
83
83
|
}
|