proto-tinker-wc 0.0.165 → 0.0.168
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-98cd237c.js → index-706ad5a3.js} +185 -45
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/proto-tinker-wc.cjs.js +2 -2
- package/dist/cjs/proto-tinker.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/proto-tinker/chevron-double-left.js +1 -5
- package/dist/collection/components/proto-tinker/close.js +1 -5
- package/dist/collection/components/proto-tinker/color-picker.js +1 -2
- package/dist/collection/components/proto-tinker/data-source.js +5 -14
- package/dist/collection/components/proto-tinker/data-values.js +1 -9
- package/dist/collection/components/proto-tinker/eswat2-io.js +1 -2
- package/dist/collection/components/proto-tinker/fingerprint.js +1 -5
- package/dist/collection/components/proto-tinker/proto-tinker.js +34 -33
- package/dist/collection/components/proto-tinker/radio.js +1 -5
- package/dist/collection/components/proto-tinker/refresh.js +1 -5
- package/dist/collection/components/proto-tinker/tw-label.js +1 -3
- package/dist/esm/{index-3536a97f.js → index-6c48b524.js} +185 -45
- package/dist/esm/loader.js +2 -2
- package/dist/esm/proto-tinker-wc.js +2 -2
- package/dist/esm/proto-tinker.entry.js +1 -1
- package/dist/proto-tinker-wc/{p-c4f8a7b1.js → p-856311fc.js} +0 -0
- package/dist/proto-tinker-wc/{p-30f3a263.entry.js → p-fa873b14.entry.js} +1 -1
- package/dist/proto-tinker-wc/proto-tinker-wc.esm.js +1 -1
- package/loader/package.json +1 -0
- package/package.json +7 -7
|
@@ -63,7 +63,7 @@ const uniqueTime = (key, measureText) => {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
-
const rootAppliedStyles = new WeakMap();
|
|
66
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
67
67
|
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
68
68
|
let style = styles.get(scopeId);
|
|
69
69
|
if (supportsConstructableStylesheets && allowCS) {
|
|
@@ -85,7 +85,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
|
85
85
|
const style = styles.get(scopeId);
|
|
86
86
|
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
87
87
|
// so the fallback is to always use the document for the root node in those cases
|
|
88
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
|
|
88
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
89
89
|
if (style) {
|
|
90
90
|
if (typeof style === 'string') {
|
|
91
91
|
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
@@ -119,7 +119,7 @@ const attachStyles = (hostRef) => {
|
|
|
119
119
|
const flags = cmpMeta.$flags$;
|
|
120
120
|
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
121
121
|
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
122
|
-
if (flags & 10 /* needsScopedEncapsulation */) {
|
|
122
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
123
123
|
// only required when we're NOT using native shadow dom (slot)
|
|
124
124
|
// or this browser doesn't support native shadow dom
|
|
125
125
|
// and this host element was NOT created with SSR
|
|
@@ -346,7 +346,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
|
-
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
|
|
349
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
|
350
350
|
newValue = newValue === true ? '' : newValue;
|
|
351
351
|
{
|
|
352
352
|
elm.setAttribute(memberName, newValue);
|
|
@@ -361,7 +361,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
361
361
|
// if the element passed in is a shadow root, which is a document fragment
|
|
362
362
|
// then we want to be adding attrs/props to the shadow root's "host" element
|
|
363
363
|
// if it's not a shadow root, then we add attrs/props to the same element
|
|
364
|
-
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
|
|
364
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
|
365
365
|
? newVnode.$elm$.host
|
|
366
366
|
: newVnode.$elm$;
|
|
367
367
|
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
|
@@ -379,6 +379,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
|
379
379
|
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
|
+
/**
|
|
383
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
|
384
|
+
*
|
|
385
|
+
* @param oldParentVNode the parent VNode from the previous render
|
|
386
|
+
* @param newParentVNode the parent VNode from the current render
|
|
387
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
|
388
|
+
* children, for which we will create a new DOM node
|
|
389
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
|
390
|
+
* @returns the newly created node
|
|
391
|
+
*/
|
|
382
392
|
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
383
393
|
// tslint:disable-next-line: prefer-const
|
|
384
394
|
const newVNode = newParentVNode.$children$[childIndex];
|
|
@@ -457,6 +467,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
|
|
|
457
467
|
}
|
|
458
468
|
}
|
|
459
469
|
};
|
|
470
|
+
/**
|
|
471
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
|
472
|
+
* traversing the two collections of children, identifying nodes that are
|
|
473
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
|
474
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
|
475
|
+
*
|
|
476
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
|
477
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
|
478
|
+
* 'windows' by storing start and end indices and references to the
|
|
479
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
|
480
|
+
* to the entire array, but we progressively narrow the windows until there are
|
|
481
|
+
* no children left to update by doing the following:
|
|
482
|
+
*
|
|
483
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
|
484
|
+
* that if we have an initial array like the following we'll end up dealing
|
|
485
|
+
* only with a window bounded by the highlighted elements:
|
|
486
|
+
*
|
|
487
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
|
488
|
+
* ^^^^^^ ^^^^^^
|
|
489
|
+
*
|
|
490
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
|
491
|
+
* across the windows. This will basically detect elements which haven't
|
|
492
|
+
* been added, removed, or changed position, i.e. if you had the following
|
|
493
|
+
* VNode elements (represented as HTML):
|
|
494
|
+
*
|
|
495
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
|
496
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
|
497
|
+
*
|
|
498
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
|
499
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
|
500
|
+
* same tag in the same position, we'd be able to avoid completely
|
|
501
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
|
502
|
+
* call out to `patch` to handle reconciling their children and so on.
|
|
503
|
+
*
|
|
504
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
|
505
|
+
* window corresponds to the element at the end of the other window. This is
|
|
506
|
+
* a heuristic which will let us identify _some_ situations in which
|
|
507
|
+
* elements have changed position, for instance it _should_ detect that the
|
|
508
|
+
* children nodes themselves have not changed but merely moved in the
|
|
509
|
+
* following example:
|
|
510
|
+
*
|
|
511
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
|
512
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
|
513
|
+
*
|
|
514
|
+
* If we find cases like this then we also need to move the concrete DOM
|
|
515
|
+
* elements corresponding to the moved children to write the re-order to the
|
|
516
|
+
* DOM.
|
|
517
|
+
*
|
|
518
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
|
519
|
+
* nodes in the old children which have the same key as the first element in
|
|
520
|
+
* our window on the new children. If we find such a node we handle calling
|
|
521
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
|
522
|
+
* what we find.
|
|
523
|
+
*
|
|
524
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
|
525
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
|
526
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
|
527
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
|
528
|
+
* children has collapsed we still have more nodes on the new children that
|
|
529
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
|
530
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
|
531
|
+
* sure the corresponding DOM nodes are removed.
|
|
532
|
+
*
|
|
533
|
+
* @param parentElm the node into which the parent VNode is rendered
|
|
534
|
+
* @param oldCh the old children of the parent node
|
|
535
|
+
* @param newVNode the new VNode which will replace the parent
|
|
536
|
+
* @param newCh the new children of the parent node
|
|
537
|
+
*/
|
|
460
538
|
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
461
539
|
let oldStartIdx = 0;
|
|
462
540
|
let newStartIdx = 0;
|
|
@@ -469,7 +547,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
469
547
|
let node;
|
|
470
548
|
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
|
471
549
|
if (oldStartVnode == null) {
|
|
472
|
-
//
|
|
550
|
+
// VNode might have been moved left
|
|
473
551
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
474
552
|
}
|
|
475
553
|
else if (oldEndVnode == null) {
|
|
@@ -482,34 +560,67 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
482
560
|
newEndVnode = newCh[--newEndIdx];
|
|
483
561
|
}
|
|
484
562
|
else if (isSameVnode(oldStartVnode, newStartVnode)) {
|
|
563
|
+
// if the start nodes are the same then we should patch the new VNode
|
|
564
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
|
565
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
|
566
|
+
// since things are matched up in order.
|
|
485
567
|
patch(oldStartVnode, newStartVnode);
|
|
486
568
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
487
569
|
newStartVnode = newCh[++newStartIdx];
|
|
488
570
|
}
|
|
489
571
|
else if (isSameVnode(oldEndVnode, newEndVnode)) {
|
|
572
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
|
573
|
+
// decrement our end indices, and also likewise in this case we don't
|
|
574
|
+
// need to move any DOM Nodes.
|
|
490
575
|
patch(oldEndVnode, newEndVnode);
|
|
491
576
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
492
577
|
newEndVnode = newCh[--newEndIdx];
|
|
493
578
|
}
|
|
494
579
|
else if (isSameVnode(oldStartVnode, newEndVnode)) {
|
|
495
580
|
patch(oldStartVnode, newEndVnode);
|
|
581
|
+
// We need to move the element for `oldStartVnode` into a position which
|
|
582
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
|
583
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
|
584
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
|
585
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
|
586
|
+
//
|
|
587
|
+
// <old-start-node />
|
|
588
|
+
// <some-intervening-node />
|
|
589
|
+
// <old-end-node />
|
|
590
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
|
591
|
+
// <next-sibling />
|
|
592
|
+
//
|
|
593
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
|
594
|
+
// the node for `oldStartVnode` at the end of the children of
|
|
595
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
|
596
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
|
597
|
+
// append it to the children of the parent element.
|
|
496
598
|
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
|
497
599
|
oldStartVnode = oldCh[++oldStartIdx];
|
|
498
600
|
newEndVnode = newCh[--newEndIdx];
|
|
499
601
|
}
|
|
500
602
|
else if (isSameVnode(oldEndVnode, newStartVnode)) {
|
|
501
603
|
patch(oldEndVnode, newStartVnode);
|
|
604
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
|
605
|
+
// the same node, so since we're here we know that they are not. Thus we
|
|
606
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
|
607
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
|
608
|
+
// future.
|
|
502
609
|
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
|
503
610
|
oldEndVnode = oldCh[--oldEndIdx];
|
|
504
611
|
newStartVnode = newCh[++newStartIdx];
|
|
505
612
|
}
|
|
506
613
|
else {
|
|
507
614
|
{
|
|
508
|
-
//
|
|
615
|
+
// We either didn't find an element in the old children that matches
|
|
616
|
+
// the key of the first new child OR the build is not using `key`
|
|
617
|
+
// attributes at all. In either case we need to create a new element
|
|
618
|
+
// for the new node.
|
|
509
619
|
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
|
510
620
|
newStartVnode = newCh[++newStartIdx];
|
|
511
621
|
}
|
|
512
622
|
if (node) {
|
|
623
|
+
// if we created a new node then handle inserting it to the DOM
|
|
513
624
|
{
|
|
514
625
|
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
|
515
626
|
}
|
|
@@ -517,20 +628,49 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
|
|
|
517
628
|
}
|
|
518
629
|
}
|
|
519
630
|
if (oldStartIdx > oldEndIdx) {
|
|
631
|
+
// we have some more new nodes to add which don't match up with old nodes
|
|
520
632
|
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
|
521
633
|
}
|
|
522
634
|
else if (newStartIdx > newEndIdx) {
|
|
635
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
|
636
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
|
637
|
+
// relevant DOM nodes)
|
|
523
638
|
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
524
639
|
}
|
|
525
640
|
};
|
|
526
|
-
|
|
641
|
+
/**
|
|
642
|
+
* Compare two VNodes to determine if they are the same
|
|
643
|
+
*
|
|
644
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
|
645
|
+
* information set on the two VNodes and can be misleading under certain
|
|
646
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
|
647
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
|
648
|
+
* checking that they have the same tag.
|
|
649
|
+
*
|
|
650
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
|
651
|
+
* changing order within a `children` array or something along those lines then
|
|
652
|
+
* we could obtain a false positive and then have to do needless re-rendering.
|
|
653
|
+
*
|
|
654
|
+
* @param leftVNode the first VNode to check
|
|
655
|
+
* @param rightVNode the second VNode to check
|
|
656
|
+
* @returns whether they're equal or not
|
|
657
|
+
*/
|
|
658
|
+
const isSameVnode = (leftVNode, rightVNode) => {
|
|
527
659
|
// compare if two vnode to see if they're "technically" the same
|
|
528
660
|
// need to have the same element tag, and same key to be the same
|
|
529
|
-
if (
|
|
661
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
|
530
662
|
return true;
|
|
531
663
|
}
|
|
532
664
|
return false;
|
|
533
665
|
};
|
|
666
|
+
/**
|
|
667
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
|
668
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
|
669
|
+
* children of the two nodes (if any).
|
|
670
|
+
*
|
|
671
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
|
672
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
|
673
|
+
*/
|
|
534
674
|
const patch = (oldVNode, newVNode) => {
|
|
535
675
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
536
676
|
const oldChildren = oldVNode.$children$;
|
|
@@ -543,7 +683,6 @@ const patch = (oldVNode, newVNode) => {
|
|
|
543
683
|
// only add this to the when the compiler sees we're using an svg somewhere
|
|
544
684
|
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
|
545
685
|
}
|
|
546
|
-
// element node
|
|
547
686
|
{
|
|
548
687
|
{
|
|
549
688
|
// either this is the first render of an element OR it's an update
|
|
@@ -554,6 +693,7 @@ const patch = (oldVNode, newVNode) => {
|
|
|
554
693
|
}
|
|
555
694
|
if (oldChildren !== null && newChildren !== null) {
|
|
556
695
|
// looks like there's child vnodes for both the old and new vnodes
|
|
696
|
+
// so we need to call `updateChildren` to reconcile them
|
|
557
697
|
updateChildren(elm, oldChildren, newVNode, newChildren);
|
|
558
698
|
}
|
|
559
699
|
else if (newChildren !== null) {
|
|
@@ -585,7 +725,7 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
585
725
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
586
726
|
hostTagName = hostElm.tagName;
|
|
587
727
|
rootVnode.$tag$ = null;
|
|
588
|
-
rootVnode.$flags$ |= 4 /* isHost */;
|
|
728
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
|
589
729
|
hostRef.$vnode$ = rootVnode;
|
|
590
730
|
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
|
591
731
|
{
|
|
@@ -613,10 +753,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
|
613
753
|
};
|
|
614
754
|
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
615
755
|
{
|
|
616
|
-
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
|
|
756
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
617
757
|
}
|
|
618
|
-
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
|
|
619
|
-
hostRef.$flags$ |= 512 /* needsRerender */;
|
|
758
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
|
759
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
|
620
760
|
return;
|
|
621
761
|
}
|
|
622
762
|
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
|
@@ -663,7 +803,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
|
|
663
803
|
}
|
|
664
804
|
else {
|
|
665
805
|
Promise.all(childrenPromises).then(postUpdate);
|
|
666
|
-
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
|
|
806
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
|
667
807
|
childrenPromises.length = 0;
|
|
668
808
|
}
|
|
669
809
|
}
|
|
@@ -673,10 +813,10 @@ const callRender = (hostRef, instance, elm) => {
|
|
|
673
813
|
renderingRef = instance;
|
|
674
814
|
instance = instance.render() ;
|
|
675
815
|
{
|
|
676
|
-
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
|
|
816
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
|
677
817
|
}
|
|
678
818
|
{
|
|
679
|
-
hostRef.$flags$ |= 2 /* hasRendered */;
|
|
819
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
|
680
820
|
}
|
|
681
821
|
{
|
|
682
822
|
{
|
|
@@ -701,8 +841,8 @@ const postUpdateComponent = (hostRef) => {
|
|
|
701
841
|
const elm = hostRef.$hostElement$;
|
|
702
842
|
const endPostUpdate = createTime('postUpdate', tagName);
|
|
703
843
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
704
|
-
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
705
|
-
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
844
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
|
845
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
|
706
846
|
{
|
|
707
847
|
// DOM WRITE!
|
|
708
848
|
addHydratedFlag(elm);
|
|
@@ -725,10 +865,10 @@ const postUpdateComponent = (hostRef) => {
|
|
|
725
865
|
hostRef.$onRenderResolve$();
|
|
726
866
|
hostRef.$onRenderResolve$ = undefined;
|
|
727
867
|
}
|
|
728
|
-
if (hostRef.$flags$ & 512 /* needsRerender */) {
|
|
868
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
|
729
869
|
nextTick(() => scheduleUpdate(hostRef, false));
|
|
730
870
|
}
|
|
731
|
-
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
|
|
871
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
|
732
872
|
}
|
|
733
873
|
// ( •_•)
|
|
734
874
|
// ( •_•)>⌐■-■
|
|
@@ -739,7 +879,7 @@ const forceUpdate = (ref) => {
|
|
|
739
879
|
const hostRef = getHostRef(ref);
|
|
740
880
|
const isConnected = hostRef.$hostElement$.isConnected;
|
|
741
881
|
if (isConnected &&
|
|
742
|
-
(hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
882
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
743
883
|
scheduleUpdate(hostRef, false);
|
|
744
884
|
}
|
|
745
885
|
// Returns "true" when the forced update was successfully scheduled
|
|
@@ -785,7 +925,7 @@ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
|
|
785
925
|
const parsePropertyValue = (propValue, propType) => {
|
|
786
926
|
// ensure this value is of the correct prop type
|
|
787
927
|
if (propValue != null && !isComplexType(propValue)) {
|
|
788
|
-
if (propType & 1 /* String */) {
|
|
928
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
789
929
|
// could have been passed as a number or boolean
|
|
790
930
|
// but we still want it as a string
|
|
791
931
|
return String(propValue);
|
|
@@ -808,12 +948,12 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
808
948
|
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
|
809
949
|
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
|
810
950
|
const didValueChange = newVal !== oldVal && !areBothNaN;
|
|
811
|
-
if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
951
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
|
812
952
|
// gadzooks! the property's value has changed!!
|
|
813
953
|
// set our new value!
|
|
814
954
|
hostRef.$instanceValues$.set(propName, newVal);
|
|
815
955
|
if (instance) {
|
|
816
|
-
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
|
|
956
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
|
817
957
|
// looks like this value actually changed, so we've got work to do!
|
|
818
958
|
// but only if we've already rendered, otherwise just chill out
|
|
819
959
|
// queue that we need to do an update, but don't worry about queuing
|
|
@@ -829,8 +969,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
829
969
|
const members = Object.entries(cmpMeta.$members$);
|
|
830
970
|
const prototype = Cstr.prototype;
|
|
831
971
|
members.map(([memberName, [memberFlags]]) => {
|
|
832
|
-
if ((memberFlags & 31 /* Prop */ ||
|
|
833
|
-
((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
|
|
972
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
973
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
834
974
|
// proxyComponent - prop
|
|
835
975
|
Object.defineProperty(prototype, memberName, {
|
|
836
976
|
get() {
|
|
@@ -846,7 +986,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
846
986
|
});
|
|
847
987
|
}
|
|
848
988
|
});
|
|
849
|
-
if ((flags & 1 /* isElementConstructor */)) {
|
|
989
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
|
850
990
|
const attrNameToPropName = new Map();
|
|
851
991
|
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
|
|
852
992
|
plt.jmp(() => {
|
|
@@ -902,7 +1042,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
902
1042
|
// create an array of attributes to observe
|
|
903
1043
|
// and also create a map of html attribute name to js property name
|
|
904
1044
|
Cstr.observedAttributes = members
|
|
905
|
-
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
|
|
1045
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
|
|
906
1046
|
.map(([propName, m]) => {
|
|
907
1047
|
const attrName = m[1] || propName;
|
|
908
1048
|
attrNameToPropName.set(attrName, propName);
|
|
@@ -914,10 +1054,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
914
1054
|
};
|
|
915
1055
|
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
|
|
916
1056
|
// initializeComponent
|
|
917
|
-
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
1057
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
|
918
1058
|
{
|
|
919
1059
|
// we haven't initialized this element yet
|
|
920
|
-
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
1060
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
|
921
1061
|
// lazy loaded components
|
|
922
1062
|
// request the component's implementation to be
|
|
923
1063
|
// wired up with the host element
|
|
@@ -929,7 +1069,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
929
1069
|
endLoad();
|
|
930
1070
|
}
|
|
931
1071
|
if (!Cstr.isProxied) {
|
|
932
|
-
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
|
|
1072
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
|
933
1073
|
Cstr.isProxied = true;
|
|
934
1074
|
}
|
|
935
1075
|
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
|
@@ -937,7 +1077,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
937
1077
|
// but let's keep track of when we start and stop
|
|
938
1078
|
// so that the getters/setters don't incorrectly step on data
|
|
939
1079
|
{
|
|
940
|
-
hostRef.$flags$ |= 8 /* isConstructingInstance */;
|
|
1080
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
|
941
1081
|
}
|
|
942
1082
|
// construct the lazy-loaded component implementation
|
|
943
1083
|
// passing the hostRef is very important during
|
|
@@ -950,7 +1090,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
950
1090
|
consoleError(e);
|
|
951
1091
|
}
|
|
952
1092
|
{
|
|
953
|
-
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
1093
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
|
954
1094
|
}
|
|
955
1095
|
endNewInstance();
|
|
956
1096
|
}
|
|
@@ -960,7 +1100,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
960
1100
|
const scopeId = getScopeId(cmpMeta);
|
|
961
1101
|
if (!styles.has(scopeId)) {
|
|
962
1102
|
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
|
963
|
-
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
|
|
1103
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
|
964
1104
|
endRegisterStyles();
|
|
965
1105
|
}
|
|
966
1106
|
}
|
|
@@ -982,13 +1122,13 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
|
|
|
982
1122
|
}
|
|
983
1123
|
};
|
|
984
1124
|
const connectedCallback = (elm) => {
|
|
985
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1125
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
986
1126
|
const hostRef = getHostRef(elm);
|
|
987
1127
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
988
1128
|
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
|
989
|
-
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
|
|
1129
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
|
990
1130
|
// first time this component has connected
|
|
991
|
-
hostRef.$flags$ |= 1 /* hasConnected */;
|
|
1131
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
|
992
1132
|
{
|
|
993
1133
|
// find the first ancestor component (if there is one) and register
|
|
994
1134
|
// this component as one of the actively loading child components for its ancestor
|
|
@@ -1008,7 +1148,7 @@ const connectedCallback = (elm) => {
|
|
|
1008
1148
|
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
|
1009
1149
|
if (cmpMeta.$members$) {
|
|
1010
1150
|
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
|
1011
|
-
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1151
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
|
1012
1152
|
const value = elm[memberName];
|
|
1013
1153
|
delete elm[memberName];
|
|
1014
1154
|
elm[memberName] = value;
|
|
@@ -1023,7 +1163,7 @@ const connectedCallback = (elm) => {
|
|
|
1023
1163
|
}
|
|
1024
1164
|
};
|
|
1025
1165
|
const disconnectedCallback = (elm) => {
|
|
1026
|
-
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
1166
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1027
1167
|
getHostRef(elm);
|
|
1028
1168
|
}
|
|
1029
1169
|
};
|
|
@@ -1059,7 +1199,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1059
1199
|
super(self);
|
|
1060
1200
|
self = this;
|
|
1061
1201
|
registerHost(self, cmpMeta);
|
|
1062
|
-
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
|
|
1202
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
|
1063
1203
|
// this component is using shadow dom
|
|
1064
1204
|
// and this browser supports shadow dom
|
|
1065
1205
|
// add the read-only property "shadowRoot" to the host element
|
|
@@ -1094,7 +1234,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1094
1234
|
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
|
1095
1235
|
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
|
1096
1236
|
cmpTags.push(tagName);
|
|
1097
|
-
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
|
|
1237
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
|
1098
1238
|
}
|
|
1099
1239
|
});
|
|
1100
1240
|
});
|
|
@@ -1116,7 +1256,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1116
1256
|
// Fallback appLoad event
|
|
1117
1257
|
endBootstrap();
|
|
1118
1258
|
};
|
|
1119
|
-
const hostRefs = new WeakMap();
|
|
1259
|
+
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1120
1260
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1121
1261
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
1122
1262
|
const registerHost = (elm, cmpMeta) => {
|
|
@@ -1157,14 +1297,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1157
1297
|
return importedModule[exportName];
|
|
1158
1298
|
}, consoleError);
|
|
1159
1299
|
};
|
|
1160
|
-
const styles = new Map();
|
|
1300
|
+
const styles = /*@__PURE__*/ new Map();
|
|
1161
1301
|
const queueDomReads = [];
|
|
1162
1302
|
const queueDomWrites = [];
|
|
1163
1303
|
const queueTask = (queue, write) => (cb) => {
|
|
1164
1304
|
queue.push(cb);
|
|
1165
1305
|
if (!queuePending) {
|
|
1166
1306
|
queuePending = true;
|
|
1167
|
-
if (write && plt.$flags$ & 4 /* queueSync */) {
|
|
1307
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
|
1168
1308
|
nextTick(flush);
|
|
1169
1309
|
}
|
|
1170
1310
|
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-706ad5a3.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-706ad5a3.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-tinker-wc.cjs.js', document.baseURI).href));
|
|
@@ -4,11 +4,7 @@ const ChevronDoubleLeft = props => {
|
|
|
4
4
|
const klass = props.class;
|
|
5
5
|
const label = props.label || 'chevron-double-left';
|
|
6
6
|
const size = props.size || 24;
|
|
7
|
-
return (h("svg", { class: klass, width: size, height: size, viewBox: "0 0 24 24", role: "img", "aria-label": "title" },
|
|
8
|
-
h("title", null, label),
|
|
9
|
-
h("g", { fill: hex },
|
|
10
|
-
h("path", { d: "M18.41,7.41L17,6L11,12L17,18L18.41,16.59L13.83,12L18.41,7.41M12.41,7.41L11,6L5,12L11,18L12.41,16.59L7.83,12L12.41,7.41Z" })),
|
|
11
|
-
h("path", { d: "M0 0h24v24H0z", fill: "none" })));
|
|
7
|
+
return (h("svg", { class: klass, width: size, height: size, viewBox: "0 0 24 24", role: "img", "aria-label": "title" }, h("title", null, label), h("g", { fill: hex }, h("path", { d: "M18.41,7.41L17,6L11,12L17,18L18.41,16.59L13.83,12L18.41,7.41M12.41,7.41L11,6L5,12L11,18L12.41,16.59L7.83,12L12.41,7.41Z" })), h("path", { d: "M0 0h24v24H0z", fill: "none" })));
|
|
12
8
|
};
|
|
13
9
|
export { ChevronDoubleLeft };
|
|
14
10
|
export default ChevronDoubleLeft;
|
|
@@ -4,11 +4,7 @@ const Close = props => {
|
|
|
4
4
|
const klass = props.class;
|
|
5
5
|
const label = props.label || 'close';
|
|
6
6
|
const size = props.size || 24;
|
|
7
|
-
return (h("svg", { class: klass, width: size, height: size, viewBox: "0 0 24 24", role: "img", "aria-label": "title" },
|
|
8
|
-
h("title", null, label),
|
|
9
|
-
h("g", { fill: hex },
|
|
10
|
-
h("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })),
|
|
11
|
-
h("path", { d: "M0 0h24v24H0z", fill: "none" })));
|
|
7
|
+
return (h("svg", { class: klass, width: size, height: size, viewBox: "0 0 24 24", role: "img", "aria-label": "title" }, h("title", null, label), h("g", { fill: hex }, h("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })), h("path", { d: "M0 0h24v24H0z", fill: "none" })));
|
|
12
8
|
};
|
|
13
9
|
export { Close };
|
|
14
10
|
export default Close;
|
|
@@ -9,8 +9,7 @@ const ColorPicker = props => {
|
|
|
9
9
|
const selected = pick == key;
|
|
10
10
|
return (h("div", { "aria-label": key, "aria-checked": selected, role: "radio", title: key, onClick: () => {
|
|
11
11
|
actions.updatePick(key);
|
|
12
|
-
} },
|
|
13
|
-
h(Radio, { hex: hex, selected: selected })));
|
|
12
|
+
} }, h(Radio, { hex: hex, selected: selected })));
|
|
14
13
|
})));
|
|
15
14
|
};
|
|
16
15
|
export { ColorPicker };
|
|
@@ -6,20 +6,11 @@ const help = 'click a button... ';
|
|
|
6
6
|
const DataSource = props => {
|
|
7
7
|
const { actions, state } = props;
|
|
8
8
|
const { count } = state;
|
|
9
|
-
return (h("div", { class: "mt-3 mb-10px flex items-center" },
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
h("button", { "aria-label": "Reset", title: "Reset", class: "ds1-button data-button bg-clrs-red", onClick: () => {
|
|
15
|
-
actions.reset();
|
|
16
|
-
} },
|
|
17
|
-
h(Close, null)),
|
|
18
|
-
h("span", { class: "flex items-center" },
|
|
19
|
-
h(ChevronDoubleLeft, { size: 28 }),
|
|
20
|
-
h("span", { class: "italic" },
|
|
21
|
-
help,
|
|
22
|
-
h("sup", null, count)))));
|
|
9
|
+
return (h("div", { class: "mt-3 mb-10px flex items-center" }, h("button", { "aria-label": "Refresh", title: "Refresh", class: "ds1-button data-button bg-clrs-blue", onClick: () => {
|
|
10
|
+
actions.refresh();
|
|
11
|
+
} }, h(Refresh, null)), h("button", { "aria-label": "Reset", title: "Reset", class: "ds1-button data-button bg-clrs-red", onClick: () => {
|
|
12
|
+
actions.reset();
|
|
13
|
+
} }, h(Close, null)), h("span", { class: "flex items-center" }, h(ChevronDoubleLeft, { size: 28 }), h("span", { class: "italic" }, help, h("sup", null, count)))));
|
|
23
14
|
};
|
|
24
15
|
export { DataSource };
|
|
25
16
|
export default DataSource;
|