@nanoporetech-digital/components 6.8.0 → 6.8.1

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/nano-more-less.cjs.entry.js +2 -1
  3. package/dist/cjs/nano-more-less.cjs.entry.js.map +1 -1
  4. package/dist/cjs/{nano-table-b4de2576.js → nano-table-a578c5a2.js} +2 -2
  5. package/dist/cjs/{nano-table-b4de2576.js.map → nano-table-a578c5a2.js.map} +1 -1
  6. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  7. package/dist/cjs/{table.worker-074a4646.js → table.worker-3a73e248.js} +2 -2
  8. package/dist/cjs/table.worker-3a73e248.js.map +1 -0
  9. package/dist/collection/components/more-less/more-less.js +2 -1
  10. package/dist/collection/components/more-less/more-less.js.map +1 -1
  11. package/dist/components/nano-more-less.js +2 -1
  12. package/dist/components/nano-more-less.js.map +1 -1
  13. package/dist/esm/nano-more-less.entry.js +2 -1
  14. package/dist/esm/nano-more-less.entry.js.map +1 -1
  15. package/dist/esm/{nano-table-dd08a12c.js → nano-table-92092ea8.js} +2 -2
  16. package/dist/esm/{nano-table-dd08a12c.js.map → nano-table-92092ea8.js.map} +1 -1
  17. package/dist/esm/nano-table.entry.js +1 -1
  18. package/dist/esm/{table.worker-094f28de.js → table.worker-5e8af93c.js} +2 -2
  19. package/dist/esm/table.worker-5e8af93c.js.map +1 -0
  20. package/dist/nano-components/nano-more-less.entry.js +1 -1
  21. package/dist/nano-components/nano-more-less.entry.js.map +1 -1
  22. package/dist/nano-components/nano-table-92092ea8.js +5 -0
  23. package/dist/nano-components/{nano-table-dd08a12c.js.map → nano-table-92092ea8.js.map} +1 -1
  24. package/dist/nano-components/nano-table.entry.js +1 -1
  25. package/dist/nano-components/table.worker-5e8af93c.js +5 -0
  26. package/docs-json.json +1 -1
  27. package/hydrate/index.js +2 -1
  28. package/package.json +2 -2
  29. package/dist/cjs/table.worker-074a4646.js.map +0 -1
  30. package/dist/esm/table.worker-094f28de.js.map +0 -1
  31. package/dist/nano-components/nano-table-dd08a12c.js +0 -5
  32. package/dist/nano-components/table.worker-094f28de.js +0 -5
  33. /package/dist/nano-components/{table.worker-094f28de.js.map → table.worker-5e8af93c.js.map} +0 -0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
- const nanoTable_entry = require('./nano-table-b4de2576.js');
8
+ const nanoTable_entry = require('./nano-table-a578c5a2.js');
9
9
  require('./index-14451c95.js');
10
10
  require('./math-a8123703.js');
11
11
  require('./throttle-dfa64b9e.js');
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- const nanoTable_entry = require('./nano-table-b4de2576.js');
6
+ const nanoTable_entry = require('./nano-table-a578c5a2.js');
7
7
  require('./index-14451c95.js');
8
8
  require('./math-a8123703.js');
9
9
  require('./throttle-dfa64b9e.js');
@@ -23,4 +23,4 @@ exports.workerMsgId = workerMsgId;
23
23
  exports.workerName = workerName;
24
24
  exports.workerPath = workerPath;
25
25
 
26
- //# sourceMappingURL=table.worker-074a4646.js.map
26
+ //# sourceMappingURL=table.worker-3a73e248.js.map
@@ -0,0 +1 @@
1
+ {"file":"table.worker-3a73e248.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -50,8 +50,9 @@ export class Rating {
50
50
  }
51
51
  processSlottedContent() {
52
52
  const elements = Array.from(this.children);
53
+ console.log(elements);
53
54
  const diff = elements.filter((x) => !this.slottedElements.includes(x));
54
- if (diff)
55
+ if (diff?.length)
55
56
  this.slottedElements = elements;
56
57
  }
57
58
  handleClick(_e) {
@@ -1 +1 @@
1
- {"version":3,"file":"more-less.js","sourceRoot":"","sources":["../../../src/components/more-less/more-less.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,CAAC,EAED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CAAC,CAAC,MAAM,EAAE,EACnD,KAAK,EAAC,gBAAgB,EACtB,IAAI,EAAC,qCAAqC,EAC1C,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAEnC,YAAM,IAAI,EAAC,MAAM;UACf;;YACe,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS;gBAClD,CACJ,CACH,CACP,CACI,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Prop,\n h,\n ComponentInterface,\n Host,\n Build,\n Watch,\n State,\n} from '@stencil/core';\n\n/**\n * A simple component to show more or less elements.\n *\n * @slot less - a button displayed when all fewer are shown. When clicked will show elements\n * @slot more - a button displayed when all items are shown. When clicked will hide elements\n * @slot - default slot displaying children elements to show or hide\n *\n * @part button-wrapper - wraps the 'more' / 'less' buttons\n * @part button-wrapper--more - wraps the 'more' button\n * @part button-wrapper--less - wraps the 'less' button\n */\n@Component({\n tag: 'nano-more-less',\n scoped: true,\n styles: /* css */ `:host { display: contents; }`,\n})\nexport class Rating implements ComponentInterface {\n private mo: MutationObserver;\n\n @State() slottedElements: HTMLElement[] = [];\n @Element() host: HTMLNanoMoreLessElement;\n\n /** The default state. `false` - excess items are hidden. `true` - excess items are shown. */\n @Prop({ reflect: true, mutable: true }) show = false;\n\n /** Optional JS selector to target which elements to hide or show */\n @Prop() childrenSelector: string;\n\n /** The maximum number of items to show when `show` is true.\n * Excess items will be hidden. */\n @Prop() maxToShow = 3;\n\n /** Only show the 'show more' button */\n @Prop() noHideBtn = false;\n\n get children() {\n if (this.childrenSelector)\n return this.host.querySelectorAll(this.childrenSelector);\n return this.host.__children.length\n ? this.host.__children\n : this.host.children;\n }\n\n @Watch('slottedElements')\n @Watch('maxToShow')\n @Watch('show')\n handleShowHideElements() {\n this.slottedElements.forEach((ele, i) => {\n if (this.show) {\n if (ele.style.display === 'none') {\n ele.style.display = '';\n }\n } else if (i >= this.maxToShow && !ele.hasAttribute('slot')) {\n ele.style.display = 'none';\n }\n });\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n const mo = (this.mo = new MutationObserver(() => {\n this.processSlottedContent();\n }));\n mo.observe(this.host, { childList: true });\n }\n\n private processSlottedContent() {\n const elements = Array.from(this.children) as HTMLElement[];\n const diff = elements.filter((x) => !this.slottedElements.includes(x));\n if (diff) this.slottedElements = elements;\n }\n\n private handleClick(_e: MouseEvent) {\n this.show = !this.show;\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n }\n\n connectedCallback() {\n this.processSlottedContent();\n }\n\n disconnectedCallback() {\n if (Build.isBrowser && this.mo) this.mo.disconnect();\n }\n\n render() {\n return (\n <Host>\n <slot />\n <div\n style={{ display: this.show ? 'none' : 'contents' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--less\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"less\">\n <button>\n Show more (+{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n {!this.noHideBtn && (\n <div\n style={{ display: this.show ? 'contents' : 'none' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--more\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"more\">\n <button>\n Show less (-{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n )}\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"more-less.js","sourceRoot":"","sources":["../../../src/components/more-less/more-less.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,CAAC,EAED,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;GAUG;AAMH,MAAM,OAAO,MAA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,EACtB,IAAI,EAAC,qCAAqC,EAC1C,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QAEnC,YAAM,IAAI,EAAC,MAAM;UACf;;YACe,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS;gBAClD,CACJ,CACH,CACP,CACI,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Prop,\n h,\n ComponentInterface,\n Host,\n Build,\n Watch,\n State,\n} from '@stencil/core';\n\n/**\n * A simple component to show more or less elements.\n *\n * @slot less - a button displayed when all fewer are shown. When clicked will show elements\n * @slot more - a button displayed when all items are shown. When clicked will hide elements\n * @slot - default slot displaying children elements to show or hide\n *\n * @part button-wrapper - wraps the 'more' / 'less' buttons\n * @part button-wrapper--more - wraps the 'more' button\n * @part button-wrapper--less - wraps the 'less' button\n */\n@Component({\n tag: 'nano-more-less',\n scoped: true,\n styles: /* css */ `:host { display: contents; }`,\n})\nexport class Rating implements ComponentInterface {\n private mo: MutationObserver;\n\n @State() slottedElements: HTMLElement[] = [];\n @Element() host: HTMLNanoMoreLessElement;\n\n /** The default state. `false` - excess items are hidden. `true` - excess items are shown. */\n @Prop({ reflect: true, mutable: true }) show = false;\n\n /** Optional JS selector to target which elements to hide or show */\n @Prop() childrenSelector: string;\n\n /** The maximum number of items to show when `show` is true.\n * Excess items will be hidden. */\n @Prop() maxToShow = 3;\n\n /** Only show the 'show more' button */\n @Prop() noHideBtn = false;\n\n get children() {\n if (this.childrenSelector)\n return this.host.querySelectorAll(this.childrenSelector);\n return this.host.__children.length\n ? this.host.__children\n : this.host.children;\n }\n\n @Watch('slottedElements')\n @Watch('maxToShow')\n @Watch('show')\n handleShowHideElements() {\n this.slottedElements.forEach((ele, i) => {\n if (this.show) {\n if (ele.style.display === 'none') {\n ele.style.display = '';\n }\n } else if (i >= this.maxToShow && !ele.hasAttribute('slot')) {\n ele.style.display = 'none';\n }\n });\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n const mo = (this.mo = new MutationObserver(() => {\n this.processSlottedContent();\n }));\n mo.observe(this.host, { childList: true });\n }\n\n private processSlottedContent() {\n const elements = Array.from(this.children) as HTMLElement[];\n console.log(elements)\n const diff = elements.filter((x) => !this.slottedElements.includes(x));\n if (diff?.length) this.slottedElements = elements;\n }\n\n private handleClick(_e: MouseEvent) {\n this.show = !this.show;\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n }\n\n connectedCallback() {\n this.processSlottedContent();\n }\n\n disconnectedCallback() {\n if (Build.isBrowser && this.mo) this.mo.disconnect();\n }\n\n render() {\n return (\n <Host>\n <slot />\n <div\n style={{ display: this.show ? 'none' : 'contents' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--less\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"less\">\n <button>\n Show more (+{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n {!this.noHideBtn && (\n <div\n style={{ display: this.show ? 'contents' : 'none' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--more\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"more\">\n <button>\n Show less (-{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n )}\n </Host>\n );\n }\n}\n"]}
@@ -42,8 +42,9 @@ const Rating = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
42
42
  }
43
43
  processSlottedContent() {
44
44
  const elements = Array.from(this.children);
45
+ console.log(elements);
45
46
  const diff = elements.filter((x) => !this.slottedElements.includes(x));
46
- if (diff)
47
+ if (diff?.length)
47
48
  this.slottedElements = elements;
48
49
  }
49
50
  handleClick(_e) {
@@ -1 +1 @@
1
- {"file":"nano-more-less.js","mappings":";;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;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/more-less/more-less.tsx"],"sourcesContent":["import {\n Component,\n Element,\n Prop,\n h,\n ComponentInterface,\n Host,\n Build,\n Watch,\n State,\n} from '@stencil/core';\n\n/**\n * A simple component to show more or less elements.\n *\n * @slot less - a button displayed when all fewer are shown. When clicked will show elements\n * @slot more - a button displayed when all items are shown. When clicked will hide elements\n * @slot - default slot displaying children elements to show or hide\n *\n * @part button-wrapper - wraps the 'more' / 'less' buttons\n * @part button-wrapper--more - wraps the 'more' button\n * @part button-wrapper--less - wraps the 'less' button\n */\n@Component({\n tag: 'nano-more-less',\n scoped: true,\n styles: /* css */ `:host { display: contents; }`,\n})\nexport class Rating implements ComponentInterface {\n private mo: MutationObserver;\n\n @State() slottedElements: HTMLElement[] = [];\n @Element() host: HTMLNanoMoreLessElement;\n\n /** The default state. `false` - excess items are hidden. `true` - excess items are shown. */\n @Prop({ reflect: true, mutable: true }) show = false;\n\n /** Optional JS selector to target which elements to hide or show */\n @Prop() childrenSelector: string;\n\n /** The maximum number of items to show when `show` is true.\n * Excess items will be hidden. */\n @Prop() maxToShow = 3;\n\n /** Only show the 'show more' button */\n @Prop() noHideBtn = false;\n\n get children() {\n if (this.childrenSelector)\n return this.host.querySelectorAll(this.childrenSelector);\n return this.host.__children.length\n ? this.host.__children\n : this.host.children;\n }\n\n @Watch('slottedElements')\n @Watch('maxToShow')\n @Watch('show')\n handleShowHideElements() {\n this.slottedElements.forEach((ele, i) => {\n if (this.show) {\n if (ele.style.display === 'none') {\n ele.style.display = '';\n }\n } else if (i >= this.maxToShow && !ele.hasAttribute('slot')) {\n ele.style.display = 'none';\n }\n });\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n const mo = (this.mo = new MutationObserver(() => {\n this.processSlottedContent();\n }));\n mo.observe(this.host, { childList: true });\n }\n\n private processSlottedContent() {\n const elements = Array.from(this.children) as HTMLElement[];\n const diff = elements.filter((x) => !this.slottedElements.includes(x));\n if (diff) this.slottedElements = elements;\n }\n\n private handleClick(_e: MouseEvent) {\n this.show = !this.show;\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n }\n\n connectedCallback() {\n this.processSlottedContent();\n }\n\n disconnectedCallback() {\n if (Build.isBrowser && this.mo) this.mo.disconnect();\n }\n\n render() {\n return (\n <Host>\n <slot />\n <div\n style={{ display: this.show ? 'none' : 'contents' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--less\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"less\">\n <button>\n Show more (+{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n {!this.noHideBtn && (\n <div\n style={{ display: this.show ? 'contents' : 'none' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--more\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"more\">\n <button>\n Show less (-{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"nano-more-less.js","mappings":";;;;;MA4Ba,MAAM;;;;2BAGyB,EAAE;gBAIG,KAAK;;qBAOhC,CAAC;qBAGD,KAAK;;EAEzB,IAAI,QAAQ;IACV,IAAI,IAAI,CAAC,gBAAgB;MACvB,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM;QAC9B,IAAI,CAAC,IAAI,CAAC,UAAU;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;GACxB;EAKD,sBAAsB;IACpB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC;MAClC,IAAI,IAAI,CAAC,IAAI,EAAE;QACb,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,MAAM,EAAE;UAChC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE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,EACR,WACE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,GAAG,MAAM,GAAG,UAAU,EAAE,EACnD,KAAK,EAAC,gBAAgB,EACtB,IAAI,EAAC,qCAAqC,EAC1C,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAEnC,YAAM,IAAI,EAAC,MAAM,IACf,kCACe,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,MAClD,CACJ,CACH,EACL,CAAC,IAAI,CAAC,SAAS,KACd,WACE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,GAAG,UAAU,GAAG,MAAM,EAAE,EACnD,KAAK,EAAC,gBAAgB,EACtB,IAAI,EAAC,qCAAqC,EAC1C,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAEnC,YAAM,IAAI,EAAC,MAAM,IACf,kCACe,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,MAClD,CACJ,CACH,CACP,CACI,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/more-less/more-less.tsx"],"sourcesContent":["import {\n Component,\n Element,\n Prop,\n h,\n ComponentInterface,\n Host,\n Build,\n Watch,\n State,\n} from '@stencil/core';\n\n/**\n * A simple component to show more or less elements.\n *\n * @slot less - a button displayed when all fewer are shown. When clicked will show elements\n * @slot more - a button displayed when all items are shown. When clicked will hide elements\n * @slot - default slot displaying children elements to show or hide\n *\n * @part button-wrapper - wraps the 'more' / 'less' buttons\n * @part button-wrapper--more - wraps the 'more' button\n * @part button-wrapper--less - wraps the 'less' button\n */\n@Component({\n tag: 'nano-more-less',\n scoped: true,\n styles: /* css */ `:host { display: contents; }`,\n})\nexport class Rating implements ComponentInterface {\n private mo: MutationObserver;\n\n @State() slottedElements: HTMLElement[] = [];\n @Element() host: HTMLNanoMoreLessElement;\n\n /** The default state. `false` - excess items are hidden. `true` - excess items are shown. */\n @Prop({ reflect: true, mutable: true }) show = false;\n\n /** Optional JS selector to target which elements to hide or show */\n @Prop() childrenSelector: string;\n\n /** The maximum number of items to show when `show` is true.\n * Excess items will be hidden. */\n @Prop() maxToShow = 3;\n\n /** Only show the 'show more' button */\n @Prop() noHideBtn = false;\n\n get children() {\n if (this.childrenSelector)\n return this.host.querySelectorAll(this.childrenSelector);\n return this.host.__children.length\n ? this.host.__children\n : this.host.children;\n }\n\n @Watch('slottedElements')\n @Watch('maxToShow')\n @Watch('show')\n handleShowHideElements() {\n this.slottedElements.forEach((ele, i) => {\n if (this.show) {\n if (ele.style.display === 'none') {\n ele.style.display = '';\n }\n } else if (i >= this.maxToShow && !ele.hasAttribute('slot')) {\n ele.style.display = 'none';\n }\n });\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n const mo = (this.mo = new MutationObserver(() => {\n this.processSlottedContent();\n }));\n mo.observe(this.host, { childList: true });\n }\n\n private processSlottedContent() {\n const elements = Array.from(this.children) as HTMLElement[];\n console.log(elements)\n const diff = elements.filter((x) => !this.slottedElements.includes(x));\n if (diff?.length) this.slottedElements = elements;\n }\n\n private handleClick(_e: MouseEvent) {\n this.show = !this.show;\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n }\n\n connectedCallback() {\n this.processSlottedContent();\n }\n\n disconnectedCallback() {\n if (Build.isBrowser && this.mo) this.mo.disconnect();\n }\n\n render() {\n return (\n <Host>\n <slot />\n <div\n style={{ display: this.show ? 'none' : 'contents' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--less\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"less\">\n <button>\n Show more (+{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n {!this.noHideBtn && (\n <div\n style={{ display: this.show ? 'contents' : 'none' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--more\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"more\">\n <button>\n Show less (-{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -39,8 +39,9 @@ const Rating = class {
39
39
  }
40
40
  processSlottedContent() {
41
41
  const elements = Array.from(this.children);
42
+ console.log(elements);
42
43
  const diff = elements.filter((x) => !this.slottedElements.includes(x));
43
- if (diff)
44
+ if (diff?.length)
44
45
  this.slottedElements = elements;
45
46
  }
46
47
  handleClick(_e) {
@@ -1 +1 @@
1
- {"file":"nano-more-less.entry.js","mappings":";;;;;MA4Ba,MAAM;;;2BAGyB,EAAE;gBAIG,KAAK;;qBAOhC,CAAC;qBAGD,KAAK;;EAEzB,IAAI,QAAQ;IACV,IAAI,IAAI,CAAC,gBAAgB;MACvB,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM;QAC9B,IAAI,CAAC,IAAI,CAAC,UAAU;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;GACxB;EAKD,sBAAsB;IACpB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC;MAClC,IAAI,IAAI,CAAC,IAAI,EAAE;QACb,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,MAAM,EAAE;UAChC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;SACxB;OACF;WAAM,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;QAC3D,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;OAC5B;KACF,CAAC,CAAC;GACJ;EAEO,kBAAkB;IAExB,MAAM,EAAE,IAAI,IAAI,CAAC,EAAE,GAAG,IAAI,gBAAgB,CAAC;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,GAAG,UAAU,GAAG,MAAM,EAAE,EACnD,KAAK,EAAC,gBAAgB,EACtB,IAAI,EAAC,qCAAqC,EAC1C,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAEnC,YAAM,IAAI,EAAC,MAAM,IACf,kCACe,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,MAClD,CACJ,CACH,CACP,CACI,EACP;GACH;;;;;;;;;;;;","names":[],"sources":["./src/components/more-less/more-less.tsx"],"sourcesContent":["import {\n Component,\n Element,\n Prop,\n h,\n ComponentInterface,\n Host,\n Build,\n Watch,\n State,\n} from '@stencil/core';\n\n/**\n * A simple component to show more or less elements.\n *\n * @slot less - a button displayed when all fewer are shown. When clicked will show elements\n * @slot more - a button displayed when all items are shown. When clicked will hide elements\n * @slot - default slot displaying children elements to show or hide\n *\n * @part button-wrapper - wraps the 'more' / 'less' buttons\n * @part button-wrapper--more - wraps the 'more' button\n * @part button-wrapper--less - wraps the 'less' button\n */\n@Component({\n tag: 'nano-more-less',\n scoped: true,\n styles: /* css */ `:host { display: contents; }`,\n})\nexport class Rating implements ComponentInterface {\n private mo: MutationObserver;\n\n @State() slottedElements: HTMLElement[] = [];\n @Element() host: HTMLNanoMoreLessElement;\n\n /** The default state. `false` - excess items are hidden. `true` - excess items are shown. */\n @Prop({ reflect: true, mutable: true }) show = false;\n\n /** Optional JS selector to target which elements to hide or show */\n @Prop() childrenSelector: string;\n\n /** The maximum number of items to show when `show` is true.\n * Excess items will be hidden. */\n @Prop() maxToShow = 3;\n\n /** Only show the 'show more' button */\n @Prop() noHideBtn = false;\n\n get children() {\n if (this.childrenSelector)\n return this.host.querySelectorAll(this.childrenSelector);\n return this.host.__children.length\n ? this.host.__children\n : this.host.children;\n }\n\n @Watch('slottedElements')\n @Watch('maxToShow')\n @Watch('show')\n handleShowHideElements() {\n this.slottedElements.forEach((ele, i) => {\n if (this.show) {\n if (ele.style.display === 'none') {\n ele.style.display = '';\n }\n } else if (i >= this.maxToShow && !ele.hasAttribute('slot')) {\n ele.style.display = 'none';\n }\n });\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n const mo = (this.mo = new MutationObserver(() => {\n this.processSlottedContent();\n }));\n mo.observe(this.host, { childList: true });\n }\n\n private processSlottedContent() {\n const elements = Array.from(this.children) as HTMLElement[];\n const diff = elements.filter((x) => !this.slottedElements.includes(x));\n if (diff) this.slottedElements = elements;\n }\n\n private handleClick(_e: MouseEvent) {\n this.show = !this.show;\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n }\n\n connectedCallback() {\n this.processSlottedContent();\n }\n\n disconnectedCallback() {\n if (Build.isBrowser && this.mo) this.mo.disconnect();\n }\n\n render() {\n return (\n <Host>\n <slot />\n <div\n style={{ display: this.show ? 'none' : 'contents' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--less\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"less\">\n <button>\n Show more (+{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n {!this.noHideBtn && (\n <div\n style={{ display: this.show ? 'contents' : 'none' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--more\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"more\">\n <button>\n Show less (-{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"nano-more-less.entry.js","mappings":";;;;;MA4Ba,MAAM;;;2BAGyB,EAAE;gBAIG,KAAK;;qBAOhC,CAAC;qBAGD,KAAK;;EAEzB,IAAI,QAAQ;IACV,IAAI,IAAI,CAAC,gBAAgB;MACvB,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM;QAC9B,IAAI,CAAC,IAAI,CAAC,UAA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B;EAED,iBAAiB;IACf,IAAI,CAAC,qBAAqB,EAAE,CAAC;GAC9B;EAED,oBAAoB;IAClB,IAAuB,IAAI,CAAC,EAAE;MAAE,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;GACtD;EAED,MAAM;IACJ,QACE,EAAC,IAAI,QACH,eAAQ,EACR,WACE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,GAAG,MAAM,GAAG,UAAU,EAAE,EACnD,KAAK,EAAC,gBAAgB,EACtB,IAAI,EAAC,qCAAqC,EAC1C,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAEnC,YAAM,IAAI,EAAC,MAAM,IACf,kCACe,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,MAClD,CACJ,CACH,EACL,CAAC,IAAI,CAAC,SAAS,KACd,WACE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,GAAG,UAAU,GAAG,MAAM,EAAE,EACnD,KAAK,EAAC,gBAAgB,EACtB,IAAI,EAAC,qCAAqC,EAC1C,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAEnC,YAAM,IAAI,EAAC,MAAM,IACf,kCACe,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,MAClD,CACJ,CACH,CACP,CACI,EACP;GACH;;;;;;;;;;;;","names":[],"sources":["./src/components/more-less/more-less.tsx"],"sourcesContent":["import {\n Component,\n Element,\n Prop,\n h,\n ComponentInterface,\n Host,\n Build,\n Watch,\n State,\n} from '@stencil/core';\n\n/**\n * A simple component to show more or less elements.\n *\n * @slot less - a button displayed when all fewer are shown. When clicked will show elements\n * @slot more - a button displayed when all items are shown. When clicked will hide elements\n * @slot - default slot displaying children elements to show or hide\n *\n * @part button-wrapper - wraps the 'more' / 'less' buttons\n * @part button-wrapper--more - wraps the 'more' button\n * @part button-wrapper--less - wraps the 'less' button\n */\n@Component({\n tag: 'nano-more-less',\n scoped: true,\n styles: /* css */ `:host { display: contents; }`,\n})\nexport class Rating implements ComponentInterface {\n private mo: MutationObserver;\n\n @State() slottedElements: HTMLElement[] = [];\n @Element() host: HTMLNanoMoreLessElement;\n\n /** The default state. `false` - excess items are hidden. `true` - excess items are shown. */\n @Prop({ reflect: true, mutable: true }) show = false;\n\n /** Optional JS selector to target which elements to hide or show */\n @Prop() childrenSelector: string;\n\n /** The maximum number of items to show when `show` is true.\n * Excess items will be hidden. */\n @Prop() maxToShow = 3;\n\n /** Only show the 'show more' button */\n @Prop() noHideBtn = false;\n\n get children() {\n if (this.childrenSelector)\n return this.host.querySelectorAll(this.childrenSelector);\n return this.host.__children.length\n ? this.host.__children\n : this.host.children;\n }\n\n @Watch('slottedElements')\n @Watch('maxToShow')\n @Watch('show')\n handleShowHideElements() {\n this.slottedElements.forEach((ele, i) => {\n if (this.show) {\n if (ele.style.display === 'none') {\n ele.style.display = '';\n }\n } else if (i >= this.maxToShow && !ele.hasAttribute('slot')) {\n ele.style.display = 'none';\n }\n });\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n const mo = (this.mo = new MutationObserver(() => {\n this.processSlottedContent();\n }));\n mo.observe(this.host, { childList: true });\n }\n\n private processSlottedContent() {\n const elements = Array.from(this.children) as HTMLElement[];\n console.log(elements)\n const diff = elements.filter((x) => !this.slottedElements.includes(x));\n if (diff?.length) this.slottedElements = elements;\n }\n\n private handleClick(_e: MouseEvent) {\n this.show = !this.show;\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n }\n\n connectedCallback() {\n this.processSlottedContent();\n }\n\n disconnectedCallback() {\n if (Build.isBrowser && this.mo) this.mo.disconnect();\n }\n\n render() {\n return (\n <Host>\n <slot />\n <div\n style={{ display: this.show ? 'none' : 'contents' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--less\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"less\">\n <button>\n Show more (+{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n {!this.noHideBtn && (\n <div\n style={{ display: this.show ? 'contents' : 'none' }}\n class=\"button-wrapper\"\n part=\"button-wrapper button-wrapper--more\"\n onClick={(e) => this.handleClick(e)}\n >\n <slot name=\"more\">\n <button>\n Show less (-{this.slottedElements.length - this.maxToShow})\n </button>\n </slot>\n </div>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -111,7 +111,7 @@ const createWorkerProxy = (worker, workerMsgId, exportedMethod) => (
111
111
  })
112
112
  );
113
113
 
114
- const workerPromise = import('./table.worker-094f28de.js').then(m => m.worker);
114
+ const workerPromise = import('./table.worker-5e8af93c.js').then(m => m.worker);
115
115
  const createWorkerStore = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'createWorkerStore');
116
116
  const syncConfigToWorker = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'syncConfigToWorker');
117
117
  const syncDataToWorker = /*@__PURE__*/createWorkerProxy(workerPromise, 'stencil.table.worker', 'syncDataToWorker');
@@ -1780,4 +1780,4 @@ Table.style = tableCss;
1780
1780
 
1781
1781
  export { Table as T, createWorker as c };
1782
1782
 
1783
- //# sourceMappingURL=nano-table-dd08a12c.js.map
1783
+ //# sourceMappingURL=nano-table-92092ea8.js.map