proto-table-wc 0.0.326 → 0.0.327

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,7 @@ const uniqueTime = (key, measureText) => {
40
40
  };
41
41
  }
42
42
  };
43
- const rootAppliedStyles = new WeakMap();
43
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
44
44
  const registerStyle = (scopeId, cssText, allowCS) => {
45
45
  let style = styles.get(scopeId);
46
46
  if (supportsConstructableStylesheets && allowCS) {
@@ -62,7 +62,7 @@ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
62
62
  const style = styles.get(scopeId);
63
63
  // if an element is NOT connected then getRootNode() will return the wrong root node
64
64
  // so the fallback is to always use the document for the root node in those cases
65
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
65
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
66
66
  if (style) {
67
67
  if (typeof style === 'string') {
68
68
  styleContainerNode = styleContainerNode.head || styleContainerNode;
@@ -96,7 +96,7 @@ const attachStyles = (hostRef) => {
96
96
  const flags = cmpMeta.$flags$;
97
97
  const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
98
98
  const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
99
- if (flags & 10 /* needsScopedEncapsulation */) {
99
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
100
100
  // only required when we're NOT using native shadow dom (slot)
101
101
  // or this browser doesn't support native shadow dom
102
102
  // and this host element was NOT created with SSR
@@ -295,7 +295,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
295
295
  }
296
296
  }
297
297
  }
298
- else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
298
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
299
299
  newValue = newValue === true ? '' : newValue;
300
300
  {
301
301
  elm.setAttribute(memberName, newValue);
@@ -310,7 +310,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
310
310
  // if the element passed in is a shadow root, which is a document fragment
311
311
  // then we want to be adding attrs/props to the shadow root's "host" element
312
312
  // if it's not a shadow root, then we add attrs/props to the same element
313
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
313
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
314
314
  ? newVnode.$elm$.host
315
315
  : newVnode.$elm$;
316
316
  const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
@@ -328,6 +328,16 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
328
328
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
329
329
  }
330
330
  };
331
+ /**
332
+ * Create a DOM Node corresponding to one of the children of a given VNode.
333
+ *
334
+ * @param oldParentVNode the parent VNode from the previous render
335
+ * @param newParentVNode the parent VNode from the current render
336
+ * @param childIndex the index of the VNode, in the _new_ parent node's
337
+ * children, for which we will create a new DOM node
338
+ * @param parentElm the parent DOM node which our new node will be a child of
339
+ * @returns the newly created node
340
+ */
331
341
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
332
342
  // tslint:disable-next-line: prefer-const
333
343
  const newVNode = newParentVNode.$children$[childIndex];
@@ -407,6 +417,74 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
407
417
  }
408
418
  }
409
419
  };
420
+ /**
421
+ * Reconcile the children of a new VNode with the children of an old VNode by
422
+ * traversing the two collections of children, identifying nodes that are
423
+ * conserved or changed, calling out to `patch` to make any necessary
424
+ * updates to the DOM, and rearranging DOM nodes as needed.
425
+ *
426
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
427
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
428
+ * 'windows' by storing start and end indices and references to the
429
+ * corresponding array entries. Initially the two 'windows' are basically equal
430
+ * to the entire array, but we progressively narrow the windows until there are
431
+ * no children left to update by doing the following:
432
+ *
433
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
434
+ * that if we have an initial array like the following we'll end up dealing
435
+ * only with a window bounded by the highlighted elements:
436
+ *
437
+ * [null, null, VNode1 , ... , VNode2, null, null]
438
+ * ^^^^^^ ^^^^^^
439
+ *
440
+ * 2. Check to see if the elements at the head and tail positions are equal
441
+ * across the windows. This will basically detect elements which haven't
442
+ * been added, removed, or changed position, i.e. if you had the following
443
+ * VNode elements (represented as HTML):
444
+ *
445
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
446
+ * newVNode: `<div><p><span>THERE</span></p></div>`
447
+ *
448
+ * Then when comparing the children of the `<div>` tag we check the equality
449
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
450
+ * same tag in the same position, we'd be able to avoid completely
451
+ * re-rendering the subtree under them with a new DOM element and would just
452
+ * call out to `patch` to handle reconciling their children and so on.
453
+ *
454
+ * 3. Check, for both windows, to see if the element at the beginning of the
455
+ * window corresponds to the element at the end of the other window. This is
456
+ * a heuristic which will let us identify _some_ situations in which
457
+ * elements have changed position, for instance it _should_ detect that the
458
+ * children nodes themselves have not changed but merely moved in the
459
+ * following example:
460
+ *
461
+ * oldVNode: `<div><element-one /><element-two /></div>`
462
+ * newVNode: `<div><element-two /><element-one /></div>`
463
+ *
464
+ * If we find cases like this then we also need to move the concrete DOM
465
+ * elements corresponding to the moved children to write the re-order to the
466
+ * DOM.
467
+ *
468
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
469
+ * nodes in the old children which have the same key as the first element in
470
+ * our window on the new children. If we find such a node we handle calling
471
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
472
+ * what we find.
473
+ *
474
+ * Finally, once we've narrowed our 'windows' to the point that either of them
475
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
476
+ * insertion or deletion that needs to happen to get a DOM state that correctly
477
+ * reflects the new child VNodes. If, for instance, after our window on the old
478
+ * children has collapsed we still have more nodes on the new children that
479
+ * we haven't dealt with yet then we need to add them, or if the new children
480
+ * collapse but we still have unhandled _old_ children then we need to make
481
+ * sure the corresponding DOM nodes are removed.
482
+ *
483
+ * @param parentElm the node into which the parent VNode is rendered
484
+ * @param oldCh the old children of the parent node
485
+ * @param newVNode the new VNode which will replace the parent
486
+ * @param newCh the new children of the parent node
487
+ */
410
488
  const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
411
489
  let oldStartIdx = 0;
412
490
  let newStartIdx = 0;
@@ -419,7 +497,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
419
497
  let node;
420
498
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
421
499
  if (oldStartVnode == null) {
422
- // Vnode might have been moved left
500
+ // VNode might have been moved left
423
501
  oldStartVnode = oldCh[++oldStartIdx];
424
502
  }
425
503
  else if (oldEndVnode == null) {
@@ -432,34 +510,67 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
432
510
  newEndVnode = newCh[--newEndIdx];
433
511
  }
434
512
  else if (isSameVnode(oldStartVnode, newStartVnode)) {
513
+ // if the start nodes are the same then we should patch the new VNode
514
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
515
+ // indices to reflect that. We don't need to move any DOM Nodes around
516
+ // since things are matched up in order.
435
517
  patch(oldStartVnode, newStartVnode);
436
518
  oldStartVnode = oldCh[++oldStartIdx];
437
519
  newStartVnode = newCh[++newStartIdx];
438
520
  }
439
521
  else if (isSameVnode(oldEndVnode, newEndVnode)) {
522
+ // likewise, if the end nodes are the same we patch new onto old and
523
+ // decrement our end indices, and also likewise in this case we don't
524
+ // need to move any DOM Nodes.
440
525
  patch(oldEndVnode, newEndVnode);
441
526
  oldEndVnode = oldCh[--oldEndIdx];
442
527
  newEndVnode = newCh[--newEndIdx];
443
528
  }
444
529
  else if (isSameVnode(oldStartVnode, newEndVnode)) {
445
530
  patch(oldStartVnode, newEndVnode);
531
+ // We need to move the element for `oldStartVnode` into a position which
532
+ // will be appropriate for `newEndVnode`. For this we can use
533
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
534
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
535
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
536
+ //
537
+ // <old-start-node />
538
+ // <some-intervening-node />
539
+ // <old-end-node />
540
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
541
+ // <next-sibling />
542
+ //
543
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
544
+ // the node for `oldStartVnode` at the end of the children of
545
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
546
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
547
+ // append it to the children of the parent element.
446
548
  parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
447
549
  oldStartVnode = oldCh[++oldStartIdx];
448
550
  newEndVnode = newCh[--newEndIdx];
449
551
  }
450
552
  else if (isSameVnode(oldEndVnode, newStartVnode)) {
451
553
  patch(oldEndVnode, newStartVnode);
554
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
555
+ // the same node, so since we're here we know that they are not. Thus we
556
+ // can move the element for `oldEndVnode` _before_ the element for
557
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
558
+ // future.
452
559
  parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
453
560
  oldEndVnode = oldCh[--oldEndIdx];
454
561
  newStartVnode = newCh[++newStartIdx];
455
562
  }
456
563
  else {
457
564
  {
458
- // new element
565
+ // We either didn't find an element in the old children that matches
566
+ // the key of the first new child OR the build is not using `key`
567
+ // attributes at all. In either case we need to create a new element
568
+ // for the new node.
459
569
  node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
460
570
  newStartVnode = newCh[++newStartIdx];
461
571
  }
462
572
  if (node) {
573
+ // if we created a new node then handle inserting it to the DOM
463
574
  {
464
575
  oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
465
576
  }
@@ -467,20 +578,49 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
467
578
  }
468
579
  }
469
580
  if (oldStartIdx > oldEndIdx) {
581
+ // we have some more new nodes to add which don't match up with old nodes
470
582
  addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
471
583
  }
472
584
  else if (newStartIdx > newEndIdx) {
585
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
586
+ // in the new array, so lets remove them (which entails cleaning up the
587
+ // relevant DOM nodes)
473
588
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
474
589
  }
475
590
  };
476
- const isSameVnode = (vnode1, vnode2) => {
591
+ /**
592
+ * Compare two VNodes to determine if they are the same
593
+ *
594
+ * **NB**: This function is an equality _heuristic_ based on the available
595
+ * information set on the two VNodes and can be misleading under certain
596
+ * circumstances. In particular, if the two nodes do not have `key` attrs
597
+ * (available under `$key$` on VNodes) then the function falls back on merely
598
+ * checking that they have the same tag.
599
+ *
600
+ * So, in other words, if `key` attrs are not set on VNodes which may be
601
+ * changing order within a `children` array or something along those lines then
602
+ * we could obtain a false positive and then have to do needless re-rendering.
603
+ *
604
+ * @param leftVNode the first VNode to check
605
+ * @param rightVNode the second VNode to check
606
+ * @returns whether they're equal or not
607
+ */
608
+ const isSameVnode = (leftVNode, rightVNode) => {
477
609
  // compare if two vnode to see if they're "technically" the same
478
610
  // need to have the same element tag, and same key to be the same
479
- if (vnode1.$tag$ === vnode2.$tag$) {
611
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
480
612
  return true;
481
613
  }
482
614
  return false;
483
615
  };
616
+ /**
617
+ * Handle reconciling an outdated VNode with a new one which corresponds to
618
+ * it. This function handles flushing updates to the DOM and reconciling the
619
+ * children of the two nodes (if any).
620
+ *
621
+ * @param oldVNode an old VNode whose DOM element and children we want to update
622
+ * @param newVNode a new VNode representing an updated version of the old one
623
+ */
484
624
  const patch = (oldVNode, newVNode) => {
485
625
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
486
626
  const oldChildren = oldVNode.$children$;
@@ -493,7 +633,6 @@ const patch = (oldVNode, newVNode) => {
493
633
  // only add this to the when the compiler sees we're using an svg somewhere
494
634
  isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
495
635
  }
496
- // element node
497
636
  {
498
637
  {
499
638
  // either this is the first render of an element OR it's an update
@@ -504,6 +643,7 @@ const patch = (oldVNode, newVNode) => {
504
643
  }
505
644
  if (oldChildren !== null && newChildren !== null) {
506
645
  // looks like there's child vnodes for both the old and new vnodes
646
+ // so we need to call `updateChildren` to reconcile them
507
647
  updateChildren(elm, oldChildren, newVNode, newChildren);
508
648
  }
509
649
  else if (newChildren !== null) {
@@ -541,7 +681,7 @@ const renderVdom = (hostRef, renderFnResults) => {
541
681
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
542
682
  hostTagName = hostElm.tagName;
543
683
  rootVnode.$tag$ = null;
544
- rootVnode.$flags$ |= 4 /* isHost */;
684
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
545
685
  hostRef.$vnode$ = rootVnode;
546
686
  rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
547
687
  {
@@ -569,10 +709,10 @@ const attachToAncestor = (hostRef, ancestorComponent) => {
569
709
  };
570
710
  const scheduleUpdate = (hostRef, isInitialLoad) => {
571
711
  {
572
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
712
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
573
713
  }
574
- if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
575
- hostRef.$flags$ |= 512 /* needsRerender */;
714
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
715
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
576
716
  return;
577
717
  }
578
718
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
@@ -624,7 +764,7 @@ const updateComponent = async (hostRef, instance, isInitialLoad) => {
624
764
  }
625
765
  else {
626
766
  Promise.all(childrenPromises).then(postUpdate);
627
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
767
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
628
768
  childrenPromises.length = 0;
629
769
  }
630
770
  }
@@ -633,10 +773,10 @@ const callRender = (hostRef, instance, elm) => {
633
773
  try {
634
774
  instance = instance.render() ;
635
775
  {
636
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
776
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
637
777
  }
638
778
  {
639
- hostRef.$flags$ |= 2 /* hasRendered */;
779
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
640
780
  }
641
781
  {
642
782
  {
@@ -660,8 +800,8 @@ const postUpdateComponent = (hostRef) => {
660
800
  const endPostUpdate = createTime('postUpdate', tagName);
661
801
  const instance = hostRef.$lazyInstance$ ;
662
802
  const ancestorComponent = hostRef.$ancestorComponent$;
663
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
664
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
803
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
804
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
665
805
  {
666
806
  // DOM WRITE!
667
807
  addHydratedFlag(elm);
@@ -687,10 +827,10 @@ const postUpdateComponent = (hostRef) => {
687
827
  hostRef.$onRenderResolve$();
688
828
  hostRef.$onRenderResolve$ = undefined;
689
829
  }
690
- if (hostRef.$flags$ & 512 /* needsRerender */) {
830
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
691
831
  nextTick(() => scheduleUpdate(hostRef, false));
692
832
  }
693
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
833
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
694
834
  }
695
835
  // ( •_•)
696
836
  // ( •_•)>⌐■-■
@@ -764,12 +904,12 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
764
904
  // explicitly check for NaN on both sides, as `NaN === NaN` is always false
765
905
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
766
906
  const didValueChange = newVal !== oldVal && !areBothNaN;
767
- if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
907
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
768
908
  // gadzooks! the property's value has changed!!
769
909
  // set our new value!
770
910
  hostRef.$instanceValues$.set(propName, newVal);
771
911
  if (instance) {
772
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
912
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
773
913
  // looks like this value actually changed, so we've got work to do!
774
914
  // but only if we've already rendered, otherwise just chill out
775
915
  // queue that we need to do an update, but don't worry about queuing
@@ -785,8 +925,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
785
925
  const members = Object.entries(cmpMeta.$members$);
786
926
  const prototype = Cstr.prototype;
787
927
  members.map(([memberName, [memberFlags]]) => {
788
- if ((memberFlags & 31 /* Prop */ ||
789
- ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
928
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
929
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
790
930
  // proxyComponent - prop
791
931
  Object.defineProperty(prototype, memberName, {
792
932
  get() {
@@ -802,7 +942,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
802
942
  });
803
943
  }
804
944
  });
805
- if ((flags & 1 /* isElementConstructor */)) {
945
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
806
946
  const attrNameToPropName = new Map();
807
947
  prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
808
948
  plt.jmp(() => {
@@ -858,7 +998,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
858
998
  // create an array of attributes to observe
859
999
  // and also create a map of html attribute name to js property name
860
1000
  Cstr.observedAttributes = members
861
- .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1001
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
862
1002
  .map(([propName, m]) => {
863
1003
  const attrName = m[1] || propName;
864
1004
  attrNameToPropName.set(attrName, propName);
@@ -870,10 +1010,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
870
1010
  };
871
1011
  const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
872
1012
  // initializeComponent
873
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1013
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
874
1014
  {
875
1015
  // we haven't initialized this element yet
876
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1016
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
877
1017
  // lazy loaded components
878
1018
  // request the component's implementation to be
879
1019
  // wired up with the host element
@@ -885,7 +1025,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
885
1025
  endLoad();
886
1026
  }
887
1027
  if (!Cstr.isProxied) {
888
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1028
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
889
1029
  Cstr.isProxied = true;
890
1030
  }
891
1031
  const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
@@ -893,7 +1033,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
893
1033
  // but let's keep track of when we start and stop
894
1034
  // so that the getters/setters don't incorrectly step on data
895
1035
  {
896
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1036
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
897
1037
  }
898
1038
  // construct the lazy-loaded component implementation
899
1039
  // passing the hostRef is very important during
@@ -906,7 +1046,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
906
1046
  consoleError(e);
907
1047
  }
908
1048
  {
909
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1049
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
910
1050
  }
911
1051
  endNewInstance();
912
1052
  }
@@ -916,7 +1056,7 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
916
1056
  const scopeId = getScopeId(cmpMeta);
917
1057
  if (!styles.has(scopeId)) {
918
1058
  const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
919
- registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1059
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
920
1060
  endRegisterStyles();
921
1061
  }
922
1062
  }
@@ -938,13 +1078,13 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) =>
938
1078
  }
939
1079
  };
940
1080
  const connectedCallback = (elm) => {
941
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1081
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
942
1082
  const hostRef = getHostRef(elm);
943
1083
  const cmpMeta = hostRef.$cmpMeta$;
944
1084
  const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
945
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1085
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
946
1086
  // first time this component has connected
947
- hostRef.$flags$ |= 1 /* hasConnected */;
1087
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
948
1088
  {
949
1089
  // find the first ancestor component (if there is one) and register
950
1090
  // this component as one of the actively loading child components for its ancestor
@@ -964,7 +1104,7 @@ const connectedCallback = (elm) => {
964
1104
  // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
965
1105
  if (cmpMeta.$members$) {
966
1106
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
967
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1107
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
968
1108
  const value = elm[memberName];
969
1109
  delete elm[memberName];
970
1110
  elm[memberName] = value;
@@ -979,7 +1119,7 @@ const connectedCallback = (elm) => {
979
1119
  }
980
1120
  };
981
1121
  const disconnectedCallback = (elm) => {
982
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1122
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
983
1123
  getHostRef(elm);
984
1124
  }
985
1125
  };
@@ -1015,7 +1155,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1015
1155
  super(self);
1016
1156
  self = this;
1017
1157
  registerHost(self, cmpMeta);
1018
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1158
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1019
1159
  // this component is using shadow dom
1020
1160
  // and this browser supports shadow dom
1021
1161
  // add the read-only property "shadowRoot" to the host element
@@ -1050,7 +1190,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1050
1190
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
1051
1191
  if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1052
1192
  cmpTags.push(tagName);
1053
- customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1193
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1054
1194
  }
1055
1195
  });
1056
1196
  });
@@ -1072,7 +1212,7 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1072
1212
  // Fallback appLoad event
1073
1213
  endBootstrap();
1074
1214
  };
1075
- const hostRefs = new WeakMap();
1215
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1076
1216
  const getHostRef = (ref) => hostRefs.get(ref);
1077
1217
  const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1078
1218
  const registerHost = (elm, cmpMeta) => {
@@ -1113,14 +1253,14 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1113
1253
  return importedModule[exportName];
1114
1254
  }, consoleError);
1115
1255
  };
1116
- const styles = new Map();
1256
+ const styles = /*@__PURE__*/ new Map();
1117
1257
  const queueDomReads = [];
1118
1258
  const queueDomWrites = [];
1119
1259
  const queueTask = (queue, write) => (cb) => {
1120
1260
  queue.push(cb);
1121
1261
  if (!queuePending) {
1122
1262
  queuePending = true;
1123
- if (write && plt.$flags$ & 4 /* queueSync */) {
1263
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1124
1264
  nextTick(flush);
1125
1265
  }
1126
1266
  else {
@@ -1,7 +1,7 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-c660fbbf.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-db21c56b.js';
2
2
 
3
3
  /*
4
- Stencil Client Patch Esm v2.17.4 | MIT Licensed | https://stenciljs.com
4
+ Stencil Client Patch Esm v2.18.0 | MIT Licensed | https://stenciljs.com
5
5
  */
6
6
  const patchEsm = () => {
7
7
  return promiseResolve();
@@ -1,7 +1,7 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-c660fbbf.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-db21c56b.js';
2
2
 
3
3
  /*
4
- Stencil Client Patch Browser v2.17.4 | MIT Licensed | https://stenciljs.com
4
+ Stencil Client Patch Browser v2.18.0 | MIT Licensed | https://stenciljs.com
5
5
  */
6
6
  const patchBrowser = () => {
7
7
  const importMeta = import.meta.url;
@@ -1 +1 @@
1
- import{r as t,h as e}from"./p-fe8bd63d.js";const r=class{constructor(r){t(this,r),this.fields=[{label:"Date",prop:"date"},{label:"List Price",prop:"price"},{label:"% of Market",prop:"market"},{label:"ProfitTime Score",prop:"score"}],this.items=[],this.table=void 0,this.renderDetails=t=>{const{tags:r=[]}=t;return e("div",{class:"detailWrapper"},e("span",null,r.length," details..."),e("ul",null,r.map((t=>e("li",null,t)))))}}componentWillLoad(){this.items=[{date:"08/30/2020",price:"$24,000",market:"98%",score:"No Score",tags:["one","two","three"]},{date:"08/31/2020",price:"$24,000",market:"99%",score:"No Score",tags:["uno","duo"]},{date:"09/01/2020",price:"$27,000",market:"102%",score:"Platinum"},{date:"09/02/2020",price:"$27,423",market:"104%",score:"Platinum",tags:["dog","cat","fish","hamster"]},{date:"09/03/2020",price:"$27,521",market:"106%",score:"Platinum",tags:["4wd","sports"]},{date:"09/04/2020",price:"$27,687",market:"107%",score:"Platinum",tags:["leather","chrome"]}]}componentDidLoad(){const{table:t,items:e,fields:r}=this;t.data=e,t.fields=r,t.details=this.renderDetails}render(){return e("proto-table",{ref:t=>this.table=t})}};r.style=".detailWrapper{font-weight:100;font-size:13px;display:flex;flex-direction:column;justify-items:start;padding:5px;padding-left:30px}";const s={down:"M12 15.4L6.6 10 8 8.6l4 4 4-4 1.4 1.4z",up:"M16 15.4l-4-4-4 4L6.6 14 12 8.6l5.4 5.4z",left:"M14 17.4L8.6 12 14 6.6 15.4 8l-4 4 4 4z",right:"M10 17.4L8.6 16l4-4-4-4L10 6.6l5.4 5.4z",more:"M12 14a2 2 0 100-4 2 2 0 000 4zm-6 0a2 2 0 100-4 2 2 0 000 4zm12 0a2 2 0 100-4 2 2 0 000 4z","arrow-up":"M5.3 10.7l1.4 1.4L11 7.8V20h2V7.8l4.3 4.3 1.4-1.4L12 4z","arrow-down":"M18.7 13.3l-1.4-1.4-4.3 4.3V4h-2v12.2l-4.3-4.3-1.4 1.4L12 20z"},i={right:"show",down:"hide","arrow-up":"sort","arrow-down":"sort"},l=class{constructor(r){t(this,r),this.data=[],this.details=void 0,this.fields=[],this.expanded=void 0,this.sort=void 0,this.clicks=0,this.protoIcon=(t,r,l=24)=>{const o=s[t];return e("svg",{width:l,height:l,viewBox:"0 0 24 24",role:"img","aria-labelledby":"title"},e("title",null,(t=>i[t])(t)),e("g",{fill:r},e("path",{d:o})),e("path",{d:"M0 0h24v24H0z",fill:"none"}))},this.handleCellClick=(t,e)=>()=>{0===t&&(this.expanded=this.expanded===e?void 0:e)},this.handleSortClick=t=>()=>{this.sort===t?2===this.clicks?(this.clicks=0,this.sort=void 0):this.clicks=this.clicks+1:(this.sort=t,this.clicks=1)},this.iconFor=t=>this.sort===t&&2===this.clicks?"arrow-up":"arrow-down",this.header=()=>{const{fields:t,iconFor:r,protoIcon:s}=this;return e("div",{class:"header"},t.map((({label:t},i)=>{const l=i===this.sort?"headerCell sort":"headerCell",o=r(i);return e("div",{class:l,onClick:this.handleSortClick(i)},s(o),e("span",null,t))})))},this.row=(t,r)=>{const{fields:s,protoIcon:i}=this;return e("div",{class:"rowContainer"},e("div",{class:this.expanded===r?"row expanded":"row"},s.map((({prop:s},l)=>e("div",{class:l===this.sort?"cell sort":"cell",onClick:this.handleCellClick(l,r)},i(0===l&&this.details?this.expanded===r?"down":"right":"pad"),t[s])))),this.details&&this.expanded===r&&this.details(t))}}render(){const t=this.data||[];return e("div",{class:"table"},this.header(),t.map(((t,e)=>this.row(t,e))))}};l.style=".table{font-weight:400;font-size:13px;display:flex;flex-direction:column;width:100%;border:1px solid var(--clrs-navy);border-radius:2px}.table svg{fill:var(--clrs-navy)}.header{display:flex}.headerCell{flex-basis:100%;display:flex;align-items:center;justify-items:start;border-right:1px solid var(--clrs-navy);border-bottom:1px solid var(--clrs-navy);padding:5px;cursor:pointer}.headerCell svg g{display:none}.headerCell.sort svg g{display:inline}.headerCell:hover svg g{display:inline}.headerCell:hover{background-color:var(--clrs-silver)}.headerCell:last-child{border-right:none}.cell{flex-basis:100%;display:flex;align-items:center;justify-items:start;padding:5px}.cell:first-child svg{cursor:pointer}.sort{background-color:var(--cx-column-sort)}.row{display:flex;justify-items:stretch;width:100%}.row.expanded{background-color:var(--cx-row-expanded)}.row.expanded svg{fill:var(--clrs-red)}.row:hover{background-color:var(--cx-row-hover)}";export{r as demo_table,l as proto_table}
1
+ import{r as t,h as e}from"./p-9746b0d9.js";const r=class{constructor(r){t(this,r),this.fields=[{label:"Date",prop:"date"},{label:"List Price",prop:"price"},{label:"% of Market",prop:"market"},{label:"ProfitTime Score",prop:"score"}],this.items=[],this.table=void 0,this.renderDetails=t=>{const{tags:r=[]}=t;return e("div",{class:"detailWrapper"},e("span",null,r.length," details..."),e("ul",null,r.map((t=>e("li",null,t)))))}}componentWillLoad(){this.items=[{date:"08/30/2020",price:"$24,000",market:"98%",score:"No Score",tags:["one","two","three"]},{date:"08/31/2020",price:"$24,000",market:"99%",score:"No Score",tags:["uno","duo"]},{date:"09/01/2020",price:"$27,000",market:"102%",score:"Platinum"},{date:"09/02/2020",price:"$27,423",market:"104%",score:"Platinum",tags:["dog","cat","fish","hamster"]},{date:"09/03/2020",price:"$27,521",market:"106%",score:"Platinum",tags:["4wd","sports"]},{date:"09/04/2020",price:"$27,687",market:"107%",score:"Platinum",tags:["leather","chrome"]}]}componentDidLoad(){const{table:t,items:e,fields:r}=this;t.data=e,t.fields=r,t.details=this.renderDetails}render(){return e("proto-table",{ref:t=>this.table=t})}};r.style=".detailWrapper{font-weight:100;font-size:13px;display:flex;flex-direction:column;justify-items:start;padding:5px;padding-left:30px}";const s={down:"M12 15.4L6.6 10 8 8.6l4 4 4-4 1.4 1.4z",up:"M16 15.4l-4-4-4 4L6.6 14 12 8.6l5.4 5.4z",left:"M14 17.4L8.6 12 14 6.6 15.4 8l-4 4 4 4z",right:"M10 17.4L8.6 16l4-4-4-4L10 6.6l5.4 5.4z",more:"M12 14a2 2 0 100-4 2 2 0 000 4zm-6 0a2 2 0 100-4 2 2 0 000 4zm12 0a2 2 0 100-4 2 2 0 000 4z","arrow-up":"M5.3 10.7l1.4 1.4L11 7.8V20h2V7.8l4.3 4.3 1.4-1.4L12 4z","arrow-down":"M18.7 13.3l-1.4-1.4-4.3 4.3V4h-2v12.2l-4.3-4.3-1.4 1.4L12 20z"},i={right:"show",down:"hide","arrow-up":"sort","arrow-down":"sort"},l=class{constructor(r){t(this,r),this.data=[],this.details=void 0,this.fields=[],this.expanded=void 0,this.sort=void 0,this.clicks=0,this.protoIcon=(t,r,l=24)=>{const o=s[t];return e("svg",{width:l,height:l,viewBox:"0 0 24 24",role:"img","aria-labelledby":"title"},e("title",null,(t=>i[t])(t)),e("g",{fill:r},e("path",{d:o})),e("path",{d:"M0 0h24v24H0z",fill:"none"}))},this.handleCellClick=(t,e)=>()=>{0===t&&(this.expanded=this.expanded===e?void 0:e)},this.handleSortClick=t=>()=>{this.sort===t?2===this.clicks?(this.clicks=0,this.sort=void 0):this.clicks=this.clicks+1:(this.sort=t,this.clicks=1)},this.iconFor=t=>this.sort===t&&2===this.clicks?"arrow-up":"arrow-down",this.header=()=>{const{fields:t,iconFor:r,protoIcon:s}=this;return e("div",{class:"header"},t.map((({label:t},i)=>{const l=i===this.sort?"headerCell sort":"headerCell",o=r(i);return e("div",{class:l,onClick:this.handleSortClick(i)},s(o),e("span",null,t))})))},this.row=(t,r)=>{const{fields:s,protoIcon:i}=this;return e("div",{class:"rowContainer"},e("div",{class:this.expanded===r?"row expanded":"row"},s.map((({prop:s},l)=>e("div",{class:l===this.sort?"cell sort":"cell",onClick:this.handleCellClick(l,r)},i(0===l&&this.details?this.expanded===r?"down":"right":"pad"),t[s])))),this.details&&this.expanded===r&&this.details(t))}}render(){const t=this.data||[];return e("div",{class:"table"},this.header(),t.map(((t,e)=>this.row(t,e))))}};l.style=".table{font-weight:400;font-size:13px;display:flex;flex-direction:column;width:100%;border:1px solid var(--clrs-navy);border-radius:2px}.table svg{fill:var(--clrs-navy)}.header{display:flex}.headerCell{flex-basis:100%;display:flex;align-items:center;justify-items:start;border-right:1px solid var(--clrs-navy);border-bottom:1px solid var(--clrs-navy);padding:5px;cursor:pointer}.headerCell svg g{display:none}.headerCell.sort svg g{display:inline}.headerCell:hover svg g{display:inline}.headerCell:hover{background-color:var(--clrs-silver)}.headerCell:last-child{border-right:none}.cell{flex-basis:100%;display:flex;align-items:center;justify-items:start;padding:5px}.cell:first-child svg{cursor:pointer}.sort{background-color:var(--cx-column-sort)}.row{display:flex;justify-items:stretch;width:100%}.row.expanded{background-color:var(--cx-row-expanded)}.row.expanded svg{fill:var(--clrs-red)}.row:hover{background-color:var(--cx-row-hover)}";export{r as demo_table,l as proto_table}
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-fe8bd63d.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-33ec0835",[[1,"demo-table"],[0,"proto-table",{data:[16],details:[8],fields:[16],expanded:[32],sort:[32],clicks:[32]}]]]],e)));
1
+ import{p as t,b as a}from"./p-9746b0d9.js";(()=>{const a=import.meta.url,e={};return""!==a&&(e.resourcesUrl=new URL(".",a).href),t(e)})().then((t=>a([["p-1f6f46a5",[[1,"demo-table"],[0,"proto-table",{data:[16],details:[8],fields:[16],expanded:[32],sort:[32],clicks:[32]}]]]],t)));
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "proto-table-wc-loader",
3
+ "private": true,
3
4
  "typings": "./index.d.ts",
4
5
  "module": "./index.js",
5
6
  "main": "./index.cjs.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proto-table-wc",
3
- "version": "0.0.326",
3
+ "version": "0.0.327",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "format": "prettier --write src"
28
28
  },
29
29
  "dependencies": {
30
- "@stencil/core": "2.17.4"
30
+ "@stencil/core": "2.18.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/jest": "29.0.1",