proto-table-wc 0.0.478 → 0.0.480

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-7fae5439.js');
5
+ const index = require('./index-7e385ad7.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
  const DemoTableStyle0 = demoTableCss;
@@ -75,7 +75,7 @@ const DemoTable = class {
75
75
  table.details = this.renderDetails;
76
76
  }
77
77
  render() {
78
- return index.h("proto-table", { ref: el => (this.table = el) });
78
+ return index.h("proto-table", { key: 'aa5f26287b85073afb5bbd3c133f9ad388fc8138', ref: el => (this.table = el) });
79
79
  }
80
80
  };
81
81
  DemoTable.style = DemoTableStyle0;
@@ -162,7 +162,7 @@ const ProtoTable = class {
162
162
  }
163
163
  render() {
164
164
  const items = this.data || [];
165
- return (index.h("div", { class: "table" }, this.header(), items.map((item, index) => this.row(item, index))));
165
+ return (index.h("div", { key: 'c30742fde0de976c553234528a7bfb6ce10d3ef5', class: "table" }, this.header(), items.map((item, index) => this.row(item, index))));
166
166
  }
167
167
  };
168
168
  ProtoTable.style = ProtoTableStyle0;
@@ -106,6 +106,7 @@ function queryNonceMetaTagContent(doc) {
106
106
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
107
107
  const h = (nodeName, vnodeData, ...children) => {
108
108
  let child = null;
109
+ let key = null;
109
110
  let simple = false;
110
111
  let lastSimple = false;
111
112
  const vNodeChildren = [];
@@ -133,6 +134,9 @@ const h = (nodeName, vnodeData, ...children) => {
133
134
  };
134
135
  walk(children);
135
136
  if (vnodeData) {
137
+ if (vnodeData.key) {
138
+ key = vnodeData.key;
139
+ }
136
140
  // normalize class / className attributes
137
141
  {
138
142
  const classData = vnodeData.className || vnodeData.class;
@@ -151,6 +155,9 @@ const h = (nodeName, vnodeData, ...children) => {
151
155
  if (vNodeChildren.length > 0) {
152
156
  vnode.$children$ = vNodeChildren;
153
157
  }
158
+ {
159
+ vnode.$key$ = key;
160
+ }
154
161
  return vnode;
155
162
  };
156
163
  /**
@@ -172,6 +179,9 @@ const newVNode = (tag, text) => {
172
179
  {
173
180
  vnode.$attrs$ = null;
174
181
  }
182
+ {
183
+ vnode.$key$ = null;
184
+ }
175
185
  return vnode;
176
186
  };
177
187
  const Host = {};
@@ -339,6 +349,8 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
339
349
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
340
350
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
341
351
  }
352
+ else if (memberName === 'key')
353
+ ;
342
354
  else if (memberName === 'ref') {
343
355
  // minifier will clean this up
344
356
  if (newValue) {
@@ -657,6 +669,8 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
657
669
  const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
658
670
  let oldStartIdx = 0;
659
671
  let newStartIdx = 0;
672
+ let idxInOld = 0;
673
+ let i = 0;
660
674
  let oldEndIdx = oldCh.length - 1;
661
675
  let oldStartVnode = oldCh[0];
662
676
  let oldEndVnode = oldCh[oldEndIdx];
@@ -664,6 +678,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
664
678
  let newStartVnode = newCh[0];
665
679
  let newEndVnode = newCh[newEndIdx];
666
680
  let node;
681
+ let elmToMove;
667
682
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
668
683
  if (oldStartVnode == null) {
669
684
  // VNode might have been moved left
@@ -730,7 +745,41 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
730
745
  newStartVnode = newCh[++newStartIdx];
731
746
  }
732
747
  else {
748
+ // Here we do some checks to match up old and new nodes based on the
749
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
750
+ // in the JSX for a DOM element in the implementation of a Stencil
751
+ // component.
752
+ //
753
+ // First we check to see if there are any nodes in the array of old
754
+ // children which have the same key as the first node in the new
755
+ // children.
756
+ idxInOld = -1;
733
757
  {
758
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
759
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
760
+ idxInOld = i;
761
+ break;
762
+ }
763
+ }
764
+ }
765
+ if (idxInOld >= 0) {
766
+ // We found a node in the old children which matches up with the first
767
+ // node in the new children! So let's deal with that
768
+ elmToMove = oldCh[idxInOld];
769
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
770
+ // the tag doesn't match so we'll need a new DOM element
771
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
772
+ }
773
+ else {
774
+ patch(elmToMove, newStartVnode, isInitialRender);
775
+ // invalidate the matching old node so that we won't try to update it
776
+ // again later on
777
+ oldCh[idxInOld] = undefined;
778
+ node = elmToMove.$elm$;
779
+ }
780
+ newStartVnode = newCh[++newStartIdx];
781
+ }
782
+ else {
734
783
  // We either didn't find an element in the old children that matches
735
784
  // the key of the first new child OR the build is not using `key`
736
785
  // attributes at all. In either case we need to create a new element
@@ -780,6 +829,14 @@ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
780
829
  // compare if two vnode to see if they're "technically" the same
781
830
  // need to have the same element tag, and same key to be the same
782
831
  if (leftVNode.$tag$ === rightVNode.$tag$) {
832
+ // this will be set if JSX tags in the build have `key` attrs set on them
833
+ // we only want to check this if we're not on the first render since on
834
+ // first render `leftVNode.$key$` will always be `null`, so we can be led
835
+ // astray and, for instance, accidentally delete a DOM node that we want to
836
+ // keep around.
837
+ if (!isInitialRender) {
838
+ return leftVNode.$key$ === rightVNode.$key$;
839
+ }
783
840
  return true;
784
841
  }
785
842
  return false;
@@ -1530,25 +1587,29 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1530
1587
  }
1531
1588
  });
1532
1589
  });
1533
- // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
1534
- if (hasSlotRelocation) {
1535
- dataStyles.innerHTML += SLOT_FB_CSS;
1536
- }
1537
- // Add hydration styles
1538
- {
1539
- dataStyles.innerHTML += cmpTags + HYDRATED_CSS;
1540
- }
1541
- // If we have styles, add them to the DOM
1542
- if (dataStyles.innerHTML.length) {
1543
- dataStyles.setAttribute('data-styles', '');
1544
- // Apply CSP nonce to the style tag if it exists
1545
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1546
- if (nonce != null) {
1547
- dataStyles.setAttribute('nonce', nonce);
1548
- }
1549
- // Insert the styles into the document head
1550
- // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
1551
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1590
+ // Only bother generating CSS if we have components
1591
+ // TODO(STENCIL-1118): Add test cases for CSS content based on conditionals
1592
+ if (cmpTags.length > 0) {
1593
+ // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
1594
+ if (hasSlotRelocation) {
1595
+ dataStyles.innerHTML += SLOT_FB_CSS;
1596
+ }
1597
+ // Add hydration styles
1598
+ {
1599
+ dataStyles.innerHTML += cmpTags + HYDRATED_CSS;
1600
+ }
1601
+ // If we have styles, add them to the DOM
1602
+ if (dataStyles.innerHTML.length) {
1603
+ dataStyles.setAttribute('data-styles', '');
1604
+ // Apply CSP nonce to the style tag if it exists
1605
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1606
+ if (nonce != null) {
1607
+ dataStyles.setAttribute('nonce', nonce);
1608
+ }
1609
+ // Insert the styles into the document head
1610
+ // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
1611
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1612
+ }
1552
1613
  }
1553
1614
  // Process deferred connectedCallbacks now all components have been registered
1554
1615
  isBootstrapping = false;
@@ -1573,8 +1634,19 @@ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1573
1634
  /**
1574
1635
  * A WeakMap mapping runtime component references to their corresponding host reference
1575
1636
  * instances.
1637
+ *
1638
+ * **Note**: If we're in an HMR context we need to store a reference to this
1639
+ * value on `window` in order to maintain the mapping of {@link d.RuntimeRef}
1640
+ * to {@link d.HostRef} across HMR updates.
1641
+ *
1642
+ * This is necessary because when HMR updates for a component are processed by
1643
+ * the browser-side dev server client the JS bundle for that component is
1644
+ * re-fetched. Since the module containing {@link hostRefs} is included in
1645
+ * that bundle, if we do not store a reference to it the new iteration of the
1646
+ * component will not have access to the previous hostRef map, leading to a
1647
+ * bug where the new version of the component cannot properly initialize.
1576
1648
  */
1577
- const hostRefs = /*@__PURE__*/ new WeakMap();
1649
+ const hostRefs = new WeakMap();
1578
1650
  /**
1579
1651
  * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
1580
1652
  *
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-7fae5439.js');
5
+ const index = require('./index-7e385ad7.js');
6
6
 
7
7
  const defineCustomElements = (win, options) => {
8
8
  if (typeof window === 'undefined') return undefined;
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-7fae5439.js');
5
+ const index = require('./index-7e385ad7.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Browser v4.11.0 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Browser v4.12.1 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchBrowser = () => {
11
11
  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));
@@ -5,7 +5,7 @@
5
5
  ],
6
6
  "compiler": {
7
7
  "name": "@stencil/core",
8
- "version": "4.11.0",
8
+ "version": "4.12.1",
9
9
  "typescriptVersion": "5.3.3"
10
10
  },
11
11
  "collections": [],
@@ -66,7 +66,7 @@ export class DemoTable {
66
66
  table.details = this.renderDetails;
67
67
  }
68
68
  render() {
69
- return h("proto-table", { ref: el => (this.table = el) });
69
+ return h("proto-table", { key: 'aa5f26287b85073afb5bbd3c133f9ad388fc8138', ref: el => (this.table = el) });
70
70
  }
71
71
  static get is() { return "demo-table"; }
72
72
  static get encapsulation() { return "shadow"; }
@@ -68,7 +68,7 @@ export class ProtoTable {
68
68
  }
69
69
  render() {
70
70
  const items = this.data || [];
71
- return (h("div", { class: "table" }, this.header(), items.map((item, index) => this.row(item, index))));
71
+ return (h("div", { key: 'c30742fde0de976c553234528a7bfb6ce10d3ef5', class: "table" }, this.header(), items.map((item, index) => this.row(item, index))));
72
72
  }
73
73
  static get is() { return "proto-table"; }
74
74
  static get originalStyleUrls() {
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-d7dbc3b8.js';
1
+ import { r as registerInstance, h } from './index-3c4befcf.js';
2
2
 
3
3
  const demoTableCss = ".detailWrapper{font-weight:100;font-size:13px;display:flex;flex-direction:column;justify-items:start;padding:5px;padding-left:30px}";
4
4
  const DemoTableStyle0 = demoTableCss;
@@ -71,7 +71,7 @@ const DemoTable = class {
71
71
  table.details = this.renderDetails;
72
72
  }
73
73
  render() {
74
- return h("proto-table", { ref: el => (this.table = el) });
74
+ return h("proto-table", { key: 'aa5f26287b85073afb5bbd3c133f9ad388fc8138', ref: el => (this.table = el) });
75
75
  }
76
76
  };
77
77
  DemoTable.style = DemoTableStyle0;
@@ -158,7 +158,7 @@ const ProtoTable = class {
158
158
  }
159
159
  render() {
160
160
  const items = this.data || [];
161
- return (h("div", { class: "table" }, this.header(), items.map((item, index) => this.row(item, index))));
161
+ return (h("div", { key: 'c30742fde0de976c553234528a7bfb6ce10d3ef5', class: "table" }, this.header(), items.map((item, index) => this.row(item, index))));
162
162
  }
163
163
  };
164
164
  ProtoTable.style = ProtoTableStyle0;
@@ -84,6 +84,7 @@ function queryNonceMetaTagContent(doc) {
84
84
  // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
85
85
  const h = (nodeName, vnodeData, ...children) => {
86
86
  let child = null;
87
+ let key = null;
87
88
  let simple = false;
88
89
  let lastSimple = false;
89
90
  const vNodeChildren = [];
@@ -111,6 +112,9 @@ const h = (nodeName, vnodeData, ...children) => {
111
112
  };
112
113
  walk(children);
113
114
  if (vnodeData) {
115
+ if (vnodeData.key) {
116
+ key = vnodeData.key;
117
+ }
114
118
  // normalize class / className attributes
115
119
  {
116
120
  const classData = vnodeData.className || vnodeData.class;
@@ -129,6 +133,9 @@ const h = (nodeName, vnodeData, ...children) => {
129
133
  if (vNodeChildren.length > 0) {
130
134
  vnode.$children$ = vNodeChildren;
131
135
  }
136
+ {
137
+ vnode.$key$ = key;
138
+ }
132
139
  return vnode;
133
140
  };
134
141
  /**
@@ -150,6 +157,9 @@ const newVNode = (tag, text) => {
150
157
  {
151
158
  vnode.$attrs$ = null;
152
159
  }
160
+ {
161
+ vnode.$key$ = null;
162
+ }
153
163
  return vnode;
154
164
  };
155
165
  const Host = {};
@@ -317,6 +327,8 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
317
327
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
318
328
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
319
329
  }
330
+ else if (memberName === 'key')
331
+ ;
320
332
  else if (memberName === 'ref') {
321
333
  // minifier will clean this up
322
334
  if (newValue) {
@@ -635,6 +647,8 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
635
647
  const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
636
648
  let oldStartIdx = 0;
637
649
  let newStartIdx = 0;
650
+ let idxInOld = 0;
651
+ let i = 0;
638
652
  let oldEndIdx = oldCh.length - 1;
639
653
  let oldStartVnode = oldCh[0];
640
654
  let oldEndVnode = oldCh[oldEndIdx];
@@ -642,6 +656,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
642
656
  let newStartVnode = newCh[0];
643
657
  let newEndVnode = newCh[newEndIdx];
644
658
  let node;
659
+ let elmToMove;
645
660
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
646
661
  if (oldStartVnode == null) {
647
662
  // VNode might have been moved left
@@ -708,7 +723,41 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
708
723
  newStartVnode = newCh[++newStartIdx];
709
724
  }
710
725
  else {
726
+ // Here we do some checks to match up old and new nodes based on the
727
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
728
+ // in the JSX for a DOM element in the implementation of a Stencil
729
+ // component.
730
+ //
731
+ // First we check to see if there are any nodes in the array of old
732
+ // children which have the same key as the first node in the new
733
+ // children.
734
+ idxInOld = -1;
711
735
  {
736
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
737
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
738
+ idxInOld = i;
739
+ break;
740
+ }
741
+ }
742
+ }
743
+ if (idxInOld >= 0) {
744
+ // We found a node in the old children which matches up with the first
745
+ // node in the new children! So let's deal with that
746
+ elmToMove = oldCh[idxInOld];
747
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
748
+ // the tag doesn't match so we'll need a new DOM element
749
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
750
+ }
751
+ else {
752
+ patch(elmToMove, newStartVnode, isInitialRender);
753
+ // invalidate the matching old node so that we won't try to update it
754
+ // again later on
755
+ oldCh[idxInOld] = undefined;
756
+ node = elmToMove.$elm$;
757
+ }
758
+ newStartVnode = newCh[++newStartIdx];
759
+ }
760
+ else {
712
761
  // We either didn't find an element in the old children that matches
713
762
  // the key of the first new child OR the build is not using `key`
714
763
  // attributes at all. In either case we need to create a new element
@@ -758,6 +807,14 @@ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
758
807
  // compare if two vnode to see if they're "technically" the same
759
808
  // need to have the same element tag, and same key to be the same
760
809
  if (leftVNode.$tag$ === rightVNode.$tag$) {
810
+ // this will be set if JSX tags in the build have `key` attrs set on them
811
+ // we only want to check this if we're not on the first render since on
812
+ // first render `leftVNode.$key$` will always be `null`, so we can be led
813
+ // astray and, for instance, accidentally delete a DOM node that we want to
814
+ // keep around.
815
+ if (!isInitialRender) {
816
+ return leftVNode.$key$ === rightVNode.$key$;
817
+ }
761
818
  return true;
762
819
  }
763
820
  return false;
@@ -1508,25 +1565,29 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1508
1565
  }
1509
1566
  });
1510
1567
  });
1511
- // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
1512
- if (hasSlotRelocation) {
1513
- dataStyles.innerHTML += SLOT_FB_CSS;
1514
- }
1515
- // Add hydration styles
1516
- {
1517
- dataStyles.innerHTML += cmpTags + HYDRATED_CSS;
1518
- }
1519
- // If we have styles, add them to the DOM
1520
- if (dataStyles.innerHTML.length) {
1521
- dataStyles.setAttribute('data-styles', '');
1522
- // Apply CSP nonce to the style tag if it exists
1523
- const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1524
- if (nonce != null) {
1525
- dataStyles.setAttribute('nonce', nonce);
1526
- }
1527
- // Insert the styles into the document head
1528
- // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
1529
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1568
+ // Only bother generating CSS if we have components
1569
+ // TODO(STENCIL-1118): Add test cases for CSS content based on conditionals
1570
+ if (cmpTags.length > 0) {
1571
+ // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
1572
+ if (hasSlotRelocation) {
1573
+ dataStyles.innerHTML += SLOT_FB_CSS;
1574
+ }
1575
+ // Add hydration styles
1576
+ {
1577
+ dataStyles.innerHTML += cmpTags + HYDRATED_CSS;
1578
+ }
1579
+ // If we have styles, add them to the DOM
1580
+ if (dataStyles.innerHTML.length) {
1581
+ dataStyles.setAttribute('data-styles', '');
1582
+ // Apply CSP nonce to the style tag if it exists
1583
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1584
+ if (nonce != null) {
1585
+ dataStyles.setAttribute('nonce', nonce);
1586
+ }
1587
+ // Insert the styles into the document head
1588
+ // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
1589
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1590
+ }
1530
1591
  }
1531
1592
  // Process deferred connectedCallbacks now all components have been registered
1532
1593
  isBootstrapping = false;
@@ -1551,8 +1612,19 @@ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1551
1612
  /**
1552
1613
  * A WeakMap mapping runtime component references to their corresponding host reference
1553
1614
  * instances.
1615
+ *
1616
+ * **Note**: If we're in an HMR context we need to store a reference to this
1617
+ * value on `window` in order to maintain the mapping of {@link d.RuntimeRef}
1618
+ * to {@link d.HostRef} across HMR updates.
1619
+ *
1620
+ * This is necessary because when HMR updates for a component are processed by
1621
+ * the browser-side dev server client the JS bundle for that component is
1622
+ * re-fetched. Since the module containing {@link hostRefs} is included in
1623
+ * that bundle, if we do not store a reference to it the new iteration of the
1624
+ * component will not have access to the previous hostRef map, leading to a
1625
+ * bug where the new version of the component cannot properly initialize.
1554
1626
  */
1555
- const hostRefs = /*@__PURE__*/ new WeakMap();
1627
+ const hostRefs = new WeakMap();
1556
1628
  /**
1557
1629
  * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
1558
1630
  *
@@ -1,5 +1,5 @@
1
- import { b as bootstrapLazy } from './index-d7dbc3b8.js';
2
- export { s as setNonce } from './index-d7dbc3b8.js';
1
+ import { b as bootstrapLazy } from './index-3c4befcf.js';
2
+ export { s as setNonce } from './index-3c4befcf.js';
3
3
 
4
4
  const defineCustomElements = (win, options) => {
5
5
  if (typeof window === 'undefined') return undefined;
@@ -1,8 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-d7dbc3b8.js';
2
- export { s as setNonce } from './index-d7dbc3b8.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-3c4befcf.js';
2
+ export { s as setNonce } from './index-3c4befcf.js';
3
3
 
4
4
  /*
5
- Stencil Client Patch Browser v4.11.0 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Patch Browser v4.12.1 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  const patchBrowser = () => {
8
8
  const importMeta = import.meta.url;
@@ -0,0 +1 @@
1
+ import{r as e,h as t}from"./p-f419fd84.js";const r=class{constructor(r){e(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=e=>{const{tags:r=[]}=e;return t("div",{class:"detailWrapper"},t("span",null,r.length," details..."),t("ul",null,r.map((e=>t("li",null,e)))))}}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:e,items:t,fields:r}=this;e.data=t,e.fields=r,e.details=this.renderDetails}render(){return t("proto-table",{key:"aa5f26287b85073afb5bbd3c133f9ad388fc8138",ref:e=>this.table=e})}};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){e(this,r),this.protoIcon=(e,r,l=24)=>{const o=s[e];return t("svg",{width:l,height:l,viewBox:"0 0 24 24",role:"img","aria-labelledby":"title"},t("title",null,(e=>i[e])(e)),t("g",{fill:r},t("path",{d:o})),t("path",{d:"M0 0h24v24H0z",fill:"none"}))},this.handleCellClick=(e,t)=>()=>{0===e&&(this.expanded=this.expanded===t?void 0:t)},this.handleSortClick=e=>()=>{this.sort===e?2===this.clicks?(this.clicks=0,this.sort=void 0):this.clicks=this.clicks+1:(this.sort=e,this.clicks=1)},this.iconFor=e=>this.sort===e&&2===this.clicks?"arrow-up":"arrow-down",this.header=()=>{const{fields:e,iconFor:r,protoIcon:s}=this;return t("div",{class:"header"},e.map((({label:e},i)=>{const l=i===this.sort?"headerCell sort":"headerCell",o=r(i);return t("div",{class:l,onClick:this.handleSortClick(i)},s(o),t("span",null,e))})))},this.row=(e,r)=>{const{fields:s,protoIcon:i}=this;return t("div",{class:"rowContainer"},t("div",{class:this.expanded===r?"row expanded":"row"},s.map((({prop:s},l)=>t("div",{class:l===this.sort?"cell sort":"cell",onClick:this.handleCellClick(l,r)},i(0===l&&this.details?this.expanded===r?"down":"right":"pad"),e[s])))),this.details&&this.expanded===r&&this.details(e))},this.data=[],this.details=void 0,this.fields=[],this.expanded=void 0,this.sort=void 0,this.clicks=0}render(){const e=this.data||[];return t("div",{key:"c30742fde0de976c553234528a7bfb6ce10d3ef5",class:"table"},this.header(),e.map(((e,t)=>this.row(e,t))))}};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}
@@ -0,0 +1,2 @@
1
+ let e,n,t=!1,l=!1;const o="slot-fb{display:contents}slot-fb[hidden]{display:none}",s={},i=e=>"object"==(e=typeof e)||"function"===e;function c(e){var n,t,l;return null!==(l=null===(t=null===(n=e.head)||void 0===n?void 0:n.querySelector('meta[name="csp-nonce"]'))||void 0===t?void 0:t.getAttribute("content"))&&void 0!==l?l:void 0}const r=(e,n,...t)=>{let l=null,o=null,s=!1,c=!1;const r=[],f=n=>{for(let t=0;t<n.length;t++)l=n[t],Array.isArray(l)?f(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!i(l))&&(l+=""),s&&c?r[r.length-1].t+=l:r.push(s?u(null,l):l),c=s)};if(f(t),n){n.key&&(o=n.key);{const e=n.className||n.class;e&&(n.class="object"!=typeof e?e:Object.keys(e).filter((n=>e[n])).join(" "))}}const a=u(e,null);return a.l=n,r.length>0&&(a.o=r),a.i=o,a},u=(e,n)=>({u:0,p:e,t:n,h:null,o:null,l:null,i:null}),f={},a=new WeakMap,d=e=>"sc-"+e.v,y=(e,n,t,l,o,s)=>{if(t!==l){let c=_(e,n),r=n.toLowerCase();if("class"===n){const n=e.classList,o=h(t),s=h(l);n.remove(...o.filter((e=>e&&!s.includes(e)))),n.add(...s.filter((e=>e&&!o.includes(e))))}else if("key"===n);else if("ref"===n)l&&l(e);else if(c||"o"!==n[0]||"n"!==n[1]){const r=i(l);if((c||r&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[n]=l;else{const o=null==l?"":l;"list"===n?c=!1:null!=t&&e[n]==o||(e[n]=o)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(n)||e.removeAttribute(n):(!c||4&s||o)&&!r&&e.setAttribute(n,l=!0===l?"":l)}else if(n="-"===n[2]?n.slice(3):_(J,r)?r.slice(2):r[2]+n.slice(3),t||l){const o=n.endsWith(v);n=n.replace($,""),t&&Q.rel(e,n,t,o),l&&Q.ael(e,n,l,o)}}},p=/\s/,h=e=>e?e.split(p):[],v="Capture",$=RegExp(v+"$"),m=(e,n,t,l)=>{const o=11===n.h.nodeType&&n.h.host?n.h.host:n.h,i=e&&e.l||s,c=n.l||s;for(l in i)l in c||y(o,l,i[l],void 0,t,n.u);for(l in c)y(o,l,i[l],c[l],t,n.u)},b=(l,o,s)=>{const i=o.o[s];let c,r,u=0;if(null!==i.t)c=i.h=K.createTextNode(i.t);else{if(t||(t="svg"===i.p),c=i.h=K.createElementNS(t?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.p),t&&"foreignObject"===i.p&&(t=!1),m(null,i,t),null!=e&&c["s-si"]!==e&&c.classList.add(c["s-si"]=e),i.o)for(u=0;u<i.o.length;++u)r=b(l,i,u),r&&c.appendChild(r);"svg"===i.p?t=!1:"foreignObject"===c.tagName&&(t=!0)}return c["s-hn"]=n,c},w=(e,t,l,o,s,i)=>{let c,r=e;for(r.shadowRoot&&r.tagName===n&&(r=r.shadowRoot);s<=i;++s)o[s]&&(c=b(null,l,s),c&&(o[s].h=c,r.insertBefore(c,t)))},g=(e,n,t)=>{for(let l=n;l<=t;++l){const n=e[l];if(n){const e=n.h;O(n),e&&e.remove()}}},j=(e,n,t=!1)=>e.p===n.p&&(!!t||e.i===n.i),S=(e,n,l=!1)=>{const o=n.h=e.h,s=e.o,i=n.o,c=n.p,r=n.t;null===r?(t="svg"===c||"foreignObject"!==c&&t,m(e,n,t),null!==s&&null!==i?((e,n,t,l,o=!1)=>{let s,i,c=0,r=0,u=0,f=0,a=n.length-1,d=n[0],y=n[a],p=l.length-1,h=l[0],v=l[p];for(;c<=a&&r<=p;)if(null==d)d=n[++c];else if(null==y)y=n[--a];else if(null==h)h=l[++r];else if(null==v)v=l[--p];else if(j(d,h,o))S(d,h,o),d=n[++c],h=l[++r];else if(j(y,v,o))S(y,v,o),y=n[--a],v=l[--p];else if(j(d,v,o))S(d,v,o),e.insertBefore(d.h,y.h.nextSibling),d=n[++c],v=l[--p];else if(j(y,h,o))S(y,h,o),e.insertBefore(y.h,d.h),y=n[--a],h=l[++r];else{for(u=-1,f=c;f<=a;++f)if(n[f]&&null!==n[f].i&&n[f].i===h.i){u=f;break}u>=0?(i=n[u],i.p!==h.p?s=b(n&&n[r],t,u):(S(i,h,o),n[u]=void 0,s=i.h),h=l[++r]):(s=b(n&&n[r],t,r),h=l[++r]),s&&d.h.parentNode.insertBefore(s,d.h)}c>a?w(e,null==l[p+1]?null:l[p+1].h,t,l,r,p):r>p&&g(n,c,a)})(o,s,n,i,l):null!==i?(null!==e.t&&(o.textContent=""),w(o,null,n,i,0,i.length-1)):null!==s&&g(s,0,s.length-1),t&&"svg"===c&&(t=!1)):e.t!==r&&(o.data=r)},O=e=>{e.l&&e.l.ref&&e.l.ref(null),e.o&&e.o.map(O)},k=(e,n)=>{n&&!e.$&&n["s-p"]&&n["s-p"].push(new Promise((n=>e.$=n)))},M=(e,n)=>{if(e.u|=16,!(4&e.u))return k(e,e.m),se((()=>C(e,n)));e.u|=512},C=(e,n)=>{const t=e.j;let l;return n&&(l=R(t,"componentWillLoad")),x(l,(()=>E(e,t,n)))},x=(e,n)=>P(e)?e.then(n):n(),P=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,E=async(e,n,t)=>{var l;const s=e.$hostElement$,i=s["s-rc"];t&&(e=>{const n=e.S,t=e.$hostElement$,l=n.u,s=((e,n)=>{var t;const l=d(n),s=I.get(l);if(e=11===e.nodeType?e:K,s)if("string"==typeof s){let i,r=a.get(e=e.head||e);if(r||a.set(e,r=new Set),!r.has(l)){{i=K.createElement("style"),i.innerHTML=s;const n=null!==(t=Q.O)&&void 0!==t?t:c(K);null!=n&&i.setAttribute("nonce",n),e.insertBefore(i,e.querySelector("link"))}4&n.u&&(i.innerHTML+=o),r&&r.add(l)}}else e.adoptedStyleSheets.includes(s)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]);return l})(t.shadowRoot?t.shadowRoot:t.getRootNode(),n);10&l&&(t["s-sc"]=s,t.classList.add(s+"-h"))})(e);L(e,n,s,t),i&&(i.map((e=>e())),s["s-rc"]=void 0);{const n=null!==(l=s["s-p"])&&void 0!==l?l:[],t=()=>A(e);0===n.length?t():(Promise.all(n).then(t),e.u|=4,n.length=0)}},L=(t,l,o,s)=>{try{l=l.render(),t.u&=-17,t.u|=2,((t,l,o=!1)=>{const s=t.$hostElement$,i=t.k||u(null,null),c=(e=>e&&e.p===f)(l)?l:r(null,null,l);if(n=s.tagName,o&&c.l)for(const e of Object.keys(c.l))s.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(c.l[e]=s[e]);c.p=null,c.u|=4,t.k=c,c.h=i.h=s.shadowRoot||s,e=s["s-sc"],S(i,c,o)})(t,l,s)}catch(e){z(e,t.$hostElement$)}return null},A=e=>{const n=e.$hostElement$,t=e.j,l=e.m;64&e.u||(e.u|=64,T(n),R(t,"componentDidLoad"),e.M(n),l||N()),e.$&&(e.$(),e.$=void 0),512&e.u&&oe((()=>M(e,!1))),e.u&=-517},N=()=>{T(K.documentElement),oe((()=>(e=>{const n=Q.ce("appload",{detail:{namespace:"proto-table-wc"}});return e.dispatchEvent(n),n})(J)))},R=(e,n,t)=>{if(e&&e[n])try{return e[n](t)}catch(e){z(e)}},T=e=>e.classList.add("hydrated"),W=(e,n,t)=>{var l;const o=e.prototype;if(n.C){const s=Object.entries(n.C);if(s.map((([e,[n]])=>{(31&n||2&t&&32&n)&&Object.defineProperty(o,e,{get(){return((e,n)=>F(this).P.get(n))(0,e)},set(n){((e,n,t)=>{const l=F(e),o=l.P.get(n),s=l.u,c=l.j;t=(e=>(null==e||i(e),e))(t),8&s&&void 0!==o||t===o||Number.isNaN(o)&&Number.isNaN(t)||(l.P.set(n,t),c&&2==(18&s)&&M(l,!1))})(this,e,n)},configurable:!0,enumerable:!0})})),1&t){const t=new Map;o.attributeChangedCallback=function(e,l,s){Q.jmp((()=>{var i;const c=t.get(e);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(o.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const t=F(this),o=null==t?void 0:t.u;if(o&&!(8&o)&&128&o&&s!==l){const o=t.j,c=null===(i=n.L)||void 0===i?void 0:i[e];null==c||c.forEach((n=>{null!=o[n]&&o[n].call(o,s,l,e)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!==(l=n.L)&&void 0!==l?l:{}),...s.filter((([e,n])=>15&n[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))]))}}return e},U=(e,n={})=>{var t;const l=[],s=n.exclude||[],i=J.customElements,r=K.head,u=r.querySelector("meta[charset]"),f=K.createElement("style"),a=[];let y,p=!0;Object.assign(Q,n),Q.A=new URL(n.resourcesUrl||"./",K.baseURI).href;let h=!1;if(e.map((e=>{e[1].map((n=>{const t={u:n[0],v:n[1],C:n[2],N:n[3]};4&t.u&&(h=!0),t.C=n[2];const o=t.v,c=class extends HTMLElement{constructor(e){super(e),V(e=this,t),1&t.u&&e.attachShadow({mode:"open"})}connectedCallback(){y&&(clearTimeout(y),y=null),p?a.push(this):Q.jmp((()=>(e=>{if(0==(1&Q.u)){const n=F(e),t=n.S,l=()=>{};if(1&n.u)(null==n?void 0:n.j)||(null==n?void 0:n.R)&&n.R.then((()=>{}));else{n.u|=1;{let t=e;for(;t=t.parentNode||t.host;)if(t["s-p"]){k(n,n.m=t);break}}t.C&&Object.entries(t.C).map((([n,[t]])=>{if(31&t&&e.hasOwnProperty(n)){const t=e[n];delete e[n],e[n]=t}})),(async(e,n,t)=>{let l;if(0==(32&n.u)){n.u|=32;{if(l=G(t),l.then){const e=()=>{};l=await l,e()}l.isProxied||(W(l,t,2),l.isProxied=!0);const e=()=>{};n.u|=8;try{new l(n)}catch(e){z(e)}n.u&=-9,e()}if(l.style){let e=l.style;const n=d(t);if(!I.has(n)){const l=()=>{};((e,n,t)=>{let l=I.get(e);Y&&t?(l=l||new CSSStyleSheet,"string"==typeof l?l=n:l.replaceSync(n)):l=n,I.set(e,l)})(n,e,!!(1&t.u)),l()}}}const o=n.m,s=()=>M(n,!0);o&&o["s-rc"]?o["s-rc"].push(s):s()})(0,n,t)}l()}})(this)))}disconnectedCallback(){Q.jmp((()=>(async()=>{if(0==(1&Q.u)){const e=F(this);(null==e?void 0:e.j)||(null==e?void 0:e.R)&&e.R.then((()=>{}))}})()))}componentOnReady(){return F(this).R}};t.T=e[0],s.includes(o)||i.get(o)||(l.push(o),i.define(o,W(c,t,1)))}))})),l.length>0&&(h&&(f.innerHTML+=o),f.innerHTML+=l+"{visibility:hidden}.hydrated{visibility:inherit}",f.innerHTML.length)){f.setAttribute("data-styles","");const e=null!==(t=Q.O)&&void 0!==t?t:c(K);null!=e&&f.setAttribute("nonce",e),r.insertBefore(f,u?u.nextSibling:r.firstChild)}p=!1,a.length?a.map((e=>e.connectedCallback())):Q.jmp((()=>y=setTimeout(N,30)))},q=e=>Q.O=e,D=new WeakMap,F=e=>D.get(e),H=(e,n)=>D.set(n.j=e,n),V=(e,n)=>{const t={u:0,$hostElement$:e,S:n,P:new Map};return t.R=new Promise((e=>t.M=e)),e["s-p"]=[],e["s-rc"]=[],D.set(e,t)},_=(e,n)=>n in e,z=(e,n)=>(0,console.error)(e,n),B=new Map,G=e=>{const n=e.v.replace(/-/g,"_"),t=e.T,l=B.get(t);return l?l[n]:import(`./${t}.entry.js`).then((e=>(B.set(t,e),e[n])),z)
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/},I=new Map,J="undefined"!=typeof window?window:{},K=J.document||{head:{}},Q={u:0,A:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,n,t,l)=>e.addEventListener(n,t,l),rel:(e,n,t,l)=>e.removeEventListener(n,t,l),ce:(e,n)=>new CustomEvent(e,n)},X=e=>Promise.resolve(e),Y=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),Z=[],ee=[],ne=(e,n)=>t=>{e.push(t),l||(l=!0,n&&4&Q.u?oe(le):Q.raf(le))},te=e=>{for(let n=0;n<e.length;n++)try{e[n](performance.now())}catch(e){z(e)}e.length=0},le=()=>{te(Z),te(ee),(l=Z.length>0)&&Q.raf(le)},oe=e=>X().then(e),se=ne(ee,!0);export{U as b,r as h,X as p,H as r,q as s}
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-e08124f1.js";export{s as setNonce}from"./p-e08124f1.js";(()=>{const t=import.meta.url,s={};return""!==t&&(s.resourcesUrl=new URL(".",t).href),e(s)})().then((e=>t([["p-f9888c13",[[1,"demo-table"],[0,"proto-table",{data:[16],details:[8],fields:[16],expanded:[32],sort:[32],clicks:[32]}]]]],e)));
1
+ import{p as e,b as t}from"./p-f419fd84.js";export{s as setNonce}from"./p-f419fd84.js";(()=>{const t=import.meta.url,s={};return""!==t&&(s.resourcesUrl=new URL(".",t).href),e(s)})().then((e=>t([["p-a740337c",[[1,"demo-table"],[0,"proto-table",{data:[16],details:[8],fields:[16],expanded:[32],sort:[32],clicks:[32]}]]]],e)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proto-table-wc",
3
- "version": "0.0.478",
3
+ "version": "0.0.480",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -25,12 +25,12 @@
25
25
  "format": "prettier --write src"
26
26
  },
27
27
  "dependencies": {
28
- "@stencil/core": "4.11.0"
28
+ "@stencil/core": "4.12.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "cspell": "8.3.2",
32
32
  "eslint": "8.56.0",
33
- "prettier": "3.2.4",
33
+ "prettier": "3.2.5",
34
34
  "tslint": "6.1.3",
35
35
  "typescript": "5.3.3"
36
36
  },
@@ -1,2 +0,0 @@
1
- let n,t,e=!1,l=!1;const o="slot-fb{display:contents}slot-fb[hidden]{display:none}",s={},i=n=>"object"==(n=typeof n)||"function"===n;function c(n){var t,e,l;return null!==(l=null===(e=null===(t=n.head)||void 0===t?void 0:t.querySelector('meta[name="csp-nonce"]'))||void 0===e?void 0:e.getAttribute("content"))&&void 0!==l?l:void 0}const r=(n,t,...e)=>{let l=null,o=!1,s=!1;const c=[],r=t=>{for(let e=0;e<t.length;e++)l=t[e],Array.isArray(l)?r(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof n&&!i(l))&&(l+=""),o&&s?c[c.length-1].t+=l:c.push(o?u(null,l):l),s=o)};if(r(e),t){const n=t.className||t.class;n&&(t.class="object"!=typeof n?n:Object.keys(n).filter((t=>n[t])).join(" "))}const a=u(n,null);return a.l=t,c.length>0&&(a.o=c),a},u=(n,t)=>({i:0,u:n,t,p:null,o:null,l:null}),a={},f=new WeakMap,d=n=>"sc-"+n.h,p=(n,t,e,l,o,s)=>{if(e!==l){let c=_(n,t),r=t.toLowerCase();if("class"===t){const t=n.classList,o=h(e),s=h(l);t.remove(...o.filter((n=>n&&!s.includes(n)))),t.add(...s.filter((n=>n&&!o.includes(n))))}else if("ref"===t)l&&l(n);else if(c||"o"!==t[0]||"n"!==t[1]){const r=i(l);if((c||r&&null!==l)&&!o)try{if(n.tagName.includes("-"))n[t]=l;else{const o=null==l?"":l;"list"===t?c=!1:null!=e&&n[t]==o||(n[t]=o)}}catch(n){}null==l||!1===l?!1===l&&""!==n.getAttribute(t)||n.removeAttribute(t):(!c||4&s||o)&&!r&&n.setAttribute(t,l=!0===l?"":l)}else if(t="-"===t[2]?t.slice(3):_(J,r)?r.slice(2):r[2]+t.slice(3),e||l){const o=t.endsWith(v);t=t.replace($,""),e&&Q.rel(n,t,e,o),l&&Q.ael(n,t,l,o)}}},y=/\s/,h=n=>n?n.split(y):[],v="Capture",$=RegExp(v+"$"),m=(n,t,e,l)=>{const o=11===t.p.nodeType&&t.p.host?t.p.host:t.p,i=n&&n.l||s,c=t.l||s;for(l in i)l in c||p(o,l,i[l],void 0,e,t.i);for(l in c)p(o,l,i[l],c[l],e,t.i)},w=(l,o,s)=>{const i=o.o[s];let c,r,u=0;if(null!==i.t)c=i.p=K.createTextNode(i.t);else{if(e||(e="svg"===i.u),c=i.p=K.createElementNS(e?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",i.u),e&&"foreignObject"===i.u&&(e=!1),m(null,i,e),null!=n&&c["s-si"]!==n&&c.classList.add(c["s-si"]=n),i.o)for(u=0;u<i.o.length;++u)r=w(l,i,u),r&&c.appendChild(r);"svg"===i.u?e=!1:"foreignObject"===c.tagName&&(e=!0)}return c["s-hn"]=t,c},b=(n,e,l,o,s,i)=>{let c,r=n;for(r.shadowRoot&&r.tagName===t&&(r=r.shadowRoot);s<=i;++s)o[s]&&(c=w(null,l,s),c&&(o[s].p=c,r.insertBefore(c,e)))},g=(n,t,e)=>{for(let l=t;l<=e;++l){const t=n[l];if(t){const n=t.p;O(t),n&&n.remove()}}},j=(n,t)=>n.u===t.u,S=(n,t,l=!1)=>{const o=t.p=n.p,s=n.o,i=t.o,c=t.u,r=t.t;null===r?(e="svg"===c||"foreignObject"!==c&&e,m(n,t,e),null!==s&&null!==i?((n,t,e,l,o=!1)=>{let s,i=0,c=0,r=t.length-1,u=t[0],a=t[r],f=l.length-1,d=l[0],p=l[f];for(;i<=r&&c<=f;)null==u?u=t[++i]:null==a?a=t[--r]:null==d?d=l[++c]:null==p?p=l[--f]:j(u,d)?(S(u,d,o),u=t[++i],d=l[++c]):j(a,p)?(S(a,p,o),a=t[--r],p=l[--f]):j(u,p)?(S(u,p,o),n.insertBefore(u.p,a.p.nextSibling),u=t[++i],p=l[--f]):j(a,d)?(S(a,d,o),n.insertBefore(a.p,u.p),a=t[--r],d=l[++c]):(s=w(t&&t[c],e,c),d=l[++c],s&&u.p.parentNode.insertBefore(s,u.p));i>r?b(n,null==l[f+1]?null:l[f+1].p,e,l,c,f):c>f&&g(t,i,r)})(o,s,t,i,l):null!==i?(null!==n.t&&(o.textContent=""),b(o,null,t,i,0,i.length-1)):null!==s&&g(s,0,s.length-1),e&&"svg"===c&&(e=!1)):n.t!==r&&(o.data=r)},O=n=>{n.l&&n.l.ref&&n.l.ref(null),n.o&&n.o.map(O)},M=(n,t)=>{t&&!n.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>n.v=t)))},k=(n,t)=>{if(n.i|=16,!(4&n.i))return M(n,n.$),sn((()=>C(n,t)));n.i|=512},C=(n,t)=>{const e=n.m;let l;return t&&(l=R(e,"componentWillLoad")),x(l,(()=>E(n,e,t)))},x=(n,t)=>P(n)?n.then(t):t(),P=n=>n instanceof Promise||n&&n.then&&"function"==typeof n.then,E=async(n,t,e)=>{var l;const s=n.$hostElement$,i=s["s-rc"];e&&(n=>{const t=n.j,e=n.$hostElement$,l=t.i,s=((n,t)=>{var e;const l=d(t),s=I.get(l);if(n=11===n.nodeType?n:K,s)if("string"==typeof s){let i,r=f.get(n=n.head||n);if(r||f.set(n,r=new Set),!r.has(l)){{i=K.createElement("style"),i.innerHTML=s;const t=null!==(e=Q.S)&&void 0!==e?e:c(K);null!=t&&i.setAttribute("nonce",t),n.insertBefore(i,n.querySelector("link"))}4&t.i&&(i.innerHTML+=o),r&&r.add(l)}}else n.adoptedStyleSheets.includes(s)||(n.adoptedStyleSheets=[...n.adoptedStyleSheets,s]);return l})(e.shadowRoot?e.shadowRoot:e.getRootNode(),t);10&l&&(e["s-sc"]=s,e.classList.add(s+"-h"))})(n);L(n,t,s,e),i&&(i.map((n=>n())),s["s-rc"]=void 0);{const t=null!==(l=s["s-p"])&&void 0!==l?l:[],e=()=>A(n);0===t.length?e():(Promise.all(t).then(e),n.i|=4,t.length=0)}},L=(e,l,o,s)=>{try{l=l.render(),e.i&=-17,e.i|=2,((e,l,o=!1)=>{const s=e.$hostElement$,i=e.O||u(null,null),c=(n=>n&&n.u===a)(l)?l:r(null,null,l);if(t=s.tagName,o&&c.l)for(const n of Object.keys(c.l))s.hasAttribute(n)&&!["key","ref","style","class"].includes(n)&&(c.l[n]=s[n]);c.u=null,c.i|=4,e.O=c,c.p=i.p=s.shadowRoot||s,n=s["s-sc"],S(i,c,o)})(e,l,s)}catch(n){z(n,e.$hostElement$)}return null},A=n=>{const t=n.$hostElement$,e=n.m,l=n.$;64&n.i||(n.i|=64,T(t),R(e,"componentDidLoad"),n.M(t),l||N()),n.v&&(n.v(),n.v=void 0),512&n.i&&on((()=>k(n,!1))),n.i&=-517},N=()=>{T(K.documentElement),on((()=>(n=>{const t=Q.ce("appload",{detail:{namespace:"proto-table-wc"}});return n.dispatchEvent(t),t})(J)))},R=(n,t,e)=>{if(n&&n[t])try{return n[t](e)}catch(n){z(n)}},T=n=>n.classList.add("hydrated"),W=(n,t,e)=>{var l;const o=n.prototype;if(t.k){const s=Object.entries(t.k);if(s.map((([n,[t]])=>{(31&t||2&e&&32&t)&&Object.defineProperty(o,n,{get(){return((n,t)=>F(this).C.get(t))(0,n)},set(t){((n,t,e)=>{const l=F(n),o=l.C.get(t),s=l.i,c=l.m;e=(n=>(null==n||i(n),n))(e),8&s&&void 0!==o||e===o||Number.isNaN(o)&&Number.isNaN(e)||(l.C.set(t,e),c&&2==(18&s)&&k(l,!1))})(this,n,t)},configurable:!0,enumerable:!0})})),1&e){const e=new Map;o.attributeChangedCallback=function(n,l,s){Q.jmp((()=>{var i;const c=e.get(n);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(o.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const e=F(this),o=null==e?void 0:e.i;if(o&&!(8&o)&&128&o&&s!==l){const o=e.m,c=null===(i=t.P)||void 0===i?void 0:i[n];null==c||c.forEach((t=>{null!=o[t]&&o[t].call(o,s,l,n)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},n.observedAttributes=Array.from(new Set([...Object.keys(null!==(l=t.P)&&void 0!==l?l:{}),...s.filter((([n,t])=>15&t[0])).map((([n,t])=>{const l=t[1]||n;return e.set(l,n),l}))]))}}return n},U=(n,t={})=>{var e;const l=[],s=t.exclude||[],i=J.customElements,r=K.head,u=r.querySelector("meta[charset]"),a=K.createElement("style"),f=[];let p,y=!0;Object.assign(Q,t),Q.L=new URL(t.resourcesUrl||"./",K.baseURI).href;let h=!1;if(n.map((n=>{n[1].map((t=>{const e={i:t[0],h:t[1],k:t[2],A:t[3]};4&e.i&&(h=!0),e.k=t[2];const o=e.h,c=class extends HTMLElement{constructor(n){super(n),V(n=this,e),1&e.i&&n.attachShadow({mode:"open"})}connectedCallback(){p&&(clearTimeout(p),p=null),y?f.push(this):Q.jmp((()=>(n=>{if(0==(1&Q.i)){const t=F(n),e=t.j,l=()=>{};if(1&t.i)(null==t?void 0:t.m)||(null==t?void 0:t.N)&&t.N.then((()=>{}));else{t.i|=1;{let e=n;for(;e=e.parentNode||e.host;)if(e["s-p"]){M(t,t.$=e);break}}e.k&&Object.entries(e.k).map((([t,[e]])=>{if(31&e&&n.hasOwnProperty(t)){const e=n[t];delete n[t],n[t]=e}})),(async(n,t,e)=>{let l;if(0==(32&t.i)){t.i|=32;{if(l=G(e),l.then){const n=()=>{};l=await l,n()}l.isProxied||(W(l,e,2),l.isProxied=!0);const n=()=>{};t.i|=8;try{new l(t)}catch(n){z(n)}t.i&=-9,n()}if(l.style){let n=l.style;const t=d(e);if(!I.has(t)){const l=()=>{};((n,t,e)=>{let l=I.get(n);Y&&e?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,I.set(n,l)})(t,n,!!(1&e.i)),l()}}}const o=t.$,s=()=>k(t,!0);o&&o["s-rc"]?o["s-rc"].push(s):s()})(0,t,e)}l()}})(this)))}disconnectedCallback(){Q.jmp((()=>(async()=>{if(0==(1&Q.i)){const n=F(this);(null==n?void 0:n.m)||(null==n?void 0:n.N)&&n.N.then((()=>{}))}})()))}componentOnReady(){return F(this).N}};e.R=n[0],s.includes(o)||i.get(o)||(l.push(o),i.define(o,W(c,e,1)))}))})),h&&(a.innerHTML+=o),a.innerHTML+=l+"{visibility:hidden}.hydrated{visibility:inherit}",a.innerHTML.length){a.setAttribute("data-styles","");const n=null!==(e=Q.S)&&void 0!==e?e:c(K);null!=n&&a.setAttribute("nonce",n),r.insertBefore(a,u?u.nextSibling:r.firstChild)}y=!1,f.length?f.map((n=>n.connectedCallback())):Q.jmp((()=>p=setTimeout(N,30)))},q=n=>Q.S=n,D=new WeakMap,F=n=>D.get(n),H=(n,t)=>D.set(t.m=n,t),V=(n,t)=>{const e={i:0,$hostElement$:n,j:t,C:new Map};return e.N=new Promise((n=>e.M=n)),n["s-p"]=[],n["s-rc"]=[],D.set(n,e)},_=(n,t)=>t in n,z=(n,t)=>(0,console.error)(n,t),B=new Map,G=n=>{const t=n.h.replace(/-/g,"_"),e=n.R,l=B.get(e);return l?l[t]:import(`./${e}.entry.js`).then((n=>(B.set(e,n),n[t])),z)
2
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/},I=new Map,J="undefined"!=typeof window?window:{},K=J.document||{head:{}},Q={i:0,L:"",jmp:n=>n(),raf:n=>requestAnimationFrame(n),ael:(n,t,e,l)=>n.addEventListener(t,e,l),rel:(n,t,e,l)=>n.removeEventListener(t,e,l),ce:(n,t)=>new CustomEvent(n,t)},X=n=>Promise.resolve(n),Y=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(n){}return!1})(),Z=[],nn=[],tn=(n,t)=>e=>{n.push(e),l||(l=!0,t&&4&Q.i?on(ln):Q.raf(ln))},en=n=>{for(let t=0;t<n.length;t++)try{n[t](performance.now())}catch(n){z(n)}n.length=0},ln=()=>{en(Z),en(nn),(l=Z.length>0)&&Q.raf(ln)},on=n=>X().then(n),sn=tn(nn,!0);export{U as b,r as h,X as p,H as r,q as s}
@@ -1 +0,0 @@
1
- import{r as t,h as e}from"./p-e08124f1.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.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))},this.data=[],this.details=void 0,this.fields=[],this.expanded=void 0,this.sort=void 0,this.clicks=0}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}