@nanoporetech-digital/components 7.7.0 → 7.9.0

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 (70) hide show
  1. package/dist/cjs/app-globals-3e14cb71.js.map +1 -1
  2. package/dist/cjs/index.cjs.js +1 -0
  3. package/dist/cjs/index.cjs.js.map +1 -1
  4. package/dist/cjs/nano-icon-button_2.cjs.entry.js +5 -5
  5. package/dist/cjs/nano-icon-button_2.cjs.entry.js.map +1 -1
  6. package/dist/cjs/nano-icon.cjs.entry.js +1 -1
  7. package/dist/cjs/nano-icon.cjs.entry.js.map +1 -1
  8. package/dist/cjs/{nano-table-806fa39d.js → nano-table-132f2056.js} +2 -2
  9. package/dist/cjs/{nano-table-806fa39d.js.map → nano-table-132f2056.js.map} +1 -1
  10. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  11. package/dist/cjs/{table.worker-fb31c8b7.js → table.worker-1a4b9015.js} +2 -2
  12. package/dist/cjs/table.worker-1a4b9015.js.map +1 -0
  13. package/dist/collection/components/icon/icon.js +3 -2
  14. package/dist/collection/components/icon/icon.js.map +1 -1
  15. package/dist/collection/components/icon-button/icon-button.js +2 -1
  16. package/dist/collection/components/icon-button/icon-button.js.map +1 -1
  17. package/dist/collection/index.js +1 -1
  18. package/dist/collection/index.js.map +1 -1
  19. package/dist/components/icon-button.js +2 -1
  20. package/dist/components/icon-button.js.map +1 -1
  21. package/dist/components/icon.js +1 -1
  22. package/dist/components/icon.js.map +1 -1
  23. package/dist/components/index.js +1 -1
  24. package/dist/components/index.js.map +1 -1
  25. package/dist/esm/app-globals-f0120bbe.js.map +1 -1
  26. package/dist/esm/index.js +1 -1
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm/nano-icon-button_2.entry.js +4 -4
  29. package/dist/esm/nano-icon-button_2.entry.js.map +1 -1
  30. package/dist/esm/nano-icon.entry.js +1 -1
  31. package/dist/esm/nano-icon.entry.js.map +1 -1
  32. package/dist/esm/{nano-table-67d7190b.js → nano-table-5eaf3a0c.js} +2 -2
  33. package/dist/esm/{nano-table-67d7190b.js.map → nano-table-5eaf3a0c.js.map} +1 -1
  34. package/dist/esm/nano-table.entry.js +1 -1
  35. package/dist/esm/{table.worker-d636a71f.js → table.worker-94b9c69e.js} +2 -2
  36. package/dist/esm/table.worker-94b9c69e.js.map +1 -0
  37. package/dist/nano-components/app-globals-f0120bbe.js.map +1 -1
  38. package/dist/nano-components/index.esm.js +1 -1
  39. package/dist/nano-components/index.esm.js.map +1 -1
  40. package/dist/nano-components/nano-icon-button_2.entry.js +1 -1
  41. package/dist/nano-components/nano-icon-button_2.entry.js.map +1 -1
  42. package/dist/nano-components/nano-icon.entry.js +1 -1
  43. package/dist/nano-components/nano-icon.entry.js.map +1 -1
  44. package/dist/nano-components/{nano-table-67d7190b.js → nano-table-5eaf3a0c.js} +2 -2
  45. package/dist/nano-components/nano-table.entry.js +1 -1
  46. package/dist/nano-components/table.worker-94b9c69e.js +5 -0
  47. package/dist/types/components/icon/icon.d.ts +2 -1
  48. package/dist/types/components.d.ts +8 -4
  49. package/dist/types/index.d.ts +1 -1
  50. package/docs-json.json +2 -2
  51. package/docs-vscode.json +1 -1
  52. package/hydrate/index.js +7 -6
  53. package/hydrate/index.mjs +7 -6
  54. package/package.json +1 -1
  55. package/dist/cjs/table.worker-fb31c8b7.js.map +0 -1
  56. package/dist/esm/table.worker-d636a71f.js.map +0 -1
  57. package/dist/nano-components/table.worker-d636a71f.js +0 -5
  58. /package/dist/nano-components/{nano-table-67d7190b.js.map → nano-table-5eaf3a0c.js.map} +0 -0
  59. /package/dist/nano-components/{table.worker-d636a71f.js.map → table.worker-94b9c69e.js.map} +0 -0
  60. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/generators/custom-element-doc-generator.d.ts +0 -0
  61. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/generators/vue/generate-vue-component.d.ts +0 -0
  62. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/generators/vue/index.d.ts +0 -0
  63. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/generators/vue/output-vue.d.ts +0 -0
  64. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/generators/vue/plugin.d.ts +0 -0
  65. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/generators/vue/types.d.ts +0 -0
  66. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/generators/vue/utils.d.ts +0 -0
  67. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/stencil.config.d.ts +0 -0
  68. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/stencil.config.prod.d.ts +0 -0
  69. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/testing/mocks/intersection-observer.d.ts +0 -0
  70. /package/dist/types/builds/{RXAuYz49 → WUhA-BsM}/0/Digital/nano-components/packages/components/.stencil/wdio.conf.d.ts +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-806fa39d.js');
8
+ const nanoTable_entry = require('./nano-table-132f2056.js');
9
9
  require('./index-615cdb64.js');
10
10
  require('./renderer-cd8b6098.js');
11
11
  require('./math-ea9cdc71.js');
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- const nanoTable_entry = require('./nano-table-806fa39d.js');
6
+ const nanoTable_entry = require('./nano-table-132f2056.js');
7
7
  require('./index-615cdb64.js');
8
8
  require('./renderer-cd8b6098.js');
9
9
  require('./math-ea9cdc71.js');
@@ -30,4 +30,4 @@ exports.workerMsgId = workerMsgId;
30
30
  exports.workerName = workerName;
31
31
  exports.workerPath = workerPath;
32
32
 
33
- //# sourceMappingURL=table.worker-fb31c8b7.js.map
33
+ //# sourceMappingURL=table.worker-1a4b9015.js.map
@@ -0,0 +1 @@
1
+ {"file":"table.worker-1a4b9015.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -7,7 +7,8 @@ import { createColorClasses } from "../../utils/theme";
7
7
  import { getSvgContent, iconContent } from "./request";
8
8
  import { getName, getUrl } from "./utils";
9
9
  /**
10
- * An SVG loader / helper. Comes bundled with all fontawesome pro icons by default but can use any custom SVG (with an correct path). Lazily loads SVG for each icon, so will only request the icons that you're using and that are visible.
10
+ * An SVG loader / helper. Comes bundled with all fontawesome pro icons by default but can use any custom SVG (with an correct path).
11
+ * Lazily loads SVG for each icon, so will only request the icons that you're using and that are visible.
11
12
  */
12
13
  export class Icon {
13
14
  io;
@@ -162,7 +163,7 @@ export class Icon {
162
163
  this.name.indexOf('chevron') > -1) &&
163
164
  this.isRtl() &&
164
165
  this.flipRtl !== false);
165
- return (h(Host, { key: 'b63eb962d8abc727b57cbb63b665296a2801f4a0', class: {
166
+ return (h(Host, { key: 'bcb65502c19151978a0035c5493e1cfe37019c4a', class: {
166
167
  ...createColorClasses(this.color),
167
168
  loading: this.isLoading,
168
169
  [`icon-${this.size}`]: !!this.size,
@@ -1 +1 @@
1
- {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../../src/components/icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,a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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Build,\n Component,\n Element,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { h } from '../../utils/renderer';\nimport { createColorClasses } from '../../utils/theme';\nimport { getSvgContent, iconContent } from './request';\nimport { getName, getUrl } from './utils';\nimport type { Color } from '../../types/shared';\n\n/**\n * An SVG loader / helper. Comes bundled with all fontawesome pro icons by default but can use any custom SVG (with an correct path). Lazily loads SVG for each icon, so will only request the icons that you're using and that are visible.\n */\n@Component({\n tag: 'nano-icon',\n styleUrl: 'icon.scss',\n shadow: true,\n})\nexport class Icon {\n private io?: IntersectionObserver;\n\n @Element() el!: HTMLNanoIconElement;\n\n @State() svgContent?: string;\n @State() isVisible = false;\n @State() isLoading = true;\n\n /**\n * Color to use from your application's color palette.\n * Default options are: `\"primary\"`, `\"secondary\"`, `\"tertiary\"`, `\"success\"`, `\"warning\"`, `\"danger\"`, `\"light\"`, `\"medium\"`, and `\"dark\"`.\n */\n @Prop() color?: Color;\n\n /**\n * Specifies the role to use for accessibility. Defaults to 'presentation' (invisible to screen-readers)\n */\n @Prop({ mutable: true, reflect: true }) role: string;\n\n /**\n * Specifies the label to use for accessibility. Defaults to the icon name.\n */\n @Prop({ mutable: true, reflect: true }) ariaLabel: string;\n\n /**\n * Specifies whether the icon should horizontally flip when `dir` is `\"rtl\"`.\n */\n @Prop() flipRtl?: boolean;\n\n /**\n * Specifies which icon to use from the built-in set of icons.\n */\n @Prop() name?: string;\n\n /**\n * Specifies the exact `src` of an SVG file to use.\n */\n @Prop() src?: string;\n\n /**\n * A combination of both `name` and `src`. If a `src` url is detected\n * it will set the `src` property. Otherwise it assumes it's a built-in named\n * SVG and set the `name` property.\n */\n @Prop() icon?: any;\n\n /**\n * The size of the icon.\n * Available options are: `\"small\"` and `\"large\"`.\n */\n @Prop() size?: 'small' | 'large';\n\n /**\n * If enabled, nano-icon will be loaded lazily when it's visible in the viewport.\n * Default, `true`.\n */\n @Prop() lazy = true;\n\n @Watch('ariaLabel')\n udpateRole() {\n // force the role to be 'img' if the aria-label is explicitly set\n if (this.ariaLabel) this.role = 'img';\n else if (!this.ariaLabel) this.role = 'presentation';\n }\n\n @Watch('role')\n setAriaLabel() {\n if (!this.ariaLabel && !this.el.ariaLabel) {\n if (!this.role || this.role !== 'presentation') {\n // if the role is not 'presentation' and the user did not explicitly set a role,\n // let's try and derive one from the icon name\n\n const label = getName(this.name, this.icon);\n // user did not provide a label\n // come up with the label based on the icon name\n if (label) {\n this.ariaLabel = label.split('/').slice(-1)[0].replace(/-/g, ' ');\n }\n }\n } else if (this.role === 'presentation') {\n this.ariaLabel = undefined;\n }\n }\n\n connectedCallback() {\n // purposely do not return the promise here because loading\n // the svg file should not hold up loading the app\n // only load the svg if it's visible\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIcon();\n });\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n componentWillLoad() {\n this.udpateRole();\n this.setAriaLabel();\n }\n\n private waitUntilVisible(\n el: HTMLElement,\n rootMargin: string,\n cb: () => void\n ) {\n if (\n Build.isBrowser &&\n this.lazy &&\n typeof window !== 'undefined' &&\n (window as any).IntersectionObserver\n ) {\n const io = (this.io = new (window as any).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting || (data[1] && data[1].isIntersecting)) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n },\n { rootMargin }\n ));\n\n io.observe(el);\n } else {\n // not a browser env (e.g. node)\n // or we're not loading lazily\n // or env doesn't support IntersectionObserver (testing?)\n // - immediately fetch icon\n cb();\n }\n }\n\n @Watch('name')\n @Watch('src')\n @Watch('icon')\n loadIcon() {\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (iconContent.has(url)) {\n // sync if it's already loaded\n this.svgContent = iconContent.get(url);\n requestAnimationFrame(() => (this.isLoading = false));\n } else {\n // async if it hasn't been loaded\n getSvgContent(url).then(() => {\n this.svgContent = iconContent.get(url);\n requestAnimationFrame(() => (this.isLoading = false));\n this.setAriaLabel();\n });\n }\n }\n }\n }\n\n private isRtl() {\n // doc is in rtl\n if (this.el.ownerDocument?.dir === 'rtl') return true;\n // html element is in rtl element\n if (this.el.closest('[dir=\"rtl\"]')) return true;\n\n // nested in a shadow dom - see if that host element is contained in an rtl element\n const rootNode = this.el.getRootNode() as ShadowRoot;\n const ownerHost = rootNode.host;\n if (ownerHost && ownerHost.closest('[dir=\"rtl\"]')) return true;\n\n return false;\n }\n\n render() {\n const flipRtl =\n this.flipRtl ||\n (this.name &&\n (this.name.indexOf('arrow') > -1 ||\n this.name.indexOf('chevron') > -1) &&\n this.isRtl() &&\n this.flipRtl !== false);\n\n return (\n <Host\n class={{\n ...createColorClasses(this.color),\n loading: this.isLoading,\n [`icon-${this.size}`]: !!this.size,\n 'flip-rtl': !!flipRtl,\n 'nano-icon': true,\n }}\n >\n {Build.isBrowser && this.svgContent ? (\n <div class=\"icon-inner\" innerHTML={this.svgContent}></div>\n ) : (\n <div class=\"icon-inner\"></div>\n )}\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../../src/components/icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Build,\n Component,\n Element,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { h } from '../../utils/renderer';\nimport { createColorClasses } from '../../utils/theme';\nimport { getSvgContent, iconContent } from './request';\nimport { getName, getUrl } from './utils';\nimport type { Color } from '../../types/shared';\n\n/**\n * An SVG loader / helper. Comes bundled with all fontawesome pro icons by default but can use any custom SVG (with an correct path).\n * Lazily loads SVG for each icon, so will only request the icons that you're using and that are visible.\n */\n@Component({\n tag: 'nano-icon',\n styleUrl: 'icon.scss',\n shadow: true,\n})\nexport class Icon {\n private io?: IntersectionObserver;\n\n @Element() el!: HTMLNanoIconElement;\n\n @State() svgContent?: string;\n @State() isVisible = false;\n @State() isLoading = true;\n\n /**\n * Color to use from your application's color palette.\n * Default options are: `\"primary\"`, `\"secondary\"`, `\"tertiary\"`, `\"success\"`, `\"warning\"`, `\"danger\"`, `\"light\"`, `\"medium\"`, and `\"dark\"`.\n */\n @Prop() color?: Color;\n\n /**\n * Specifies the role to use for accessibility. Defaults to 'presentation' (invisible to screen-readers)\n */\n @Prop({ mutable: true, reflect: true }) role: string;\n\n /**\n * Specifies the label to use for accessibility. Defaults to the icon name.\n */\n @Prop({ mutable: true, reflect: true }) ariaLabel: string;\n\n /**\n * Specifies whether the icon should horizontally flip when `dir` is `\"rtl\"`.\n */\n @Prop() flipRtl?: boolean;\n\n /**\n * Specifies which icon to use from the built-in set of icons.\n */\n @Prop() name?: string;\n\n /**\n * Specifies the exact `src` of an SVG file to use.\n */\n @Prop() src?: string;\n\n /**\n * A combination of both `name` and `src`. If a `src` url is detected\n * it will set the `src` property. Otherwise it assumes it's a built-in named\n * SVG and set the `name` property.\n */\n @Prop() icon?: any;\n\n /**\n * The size of the icon.\n * Available options are: `\"small\"` and `\"large\"`.\n */\n @Prop() size?: 'small' | 'large';\n\n /**\n * If enabled, nano-icon will be loaded lazily when it's visible in the viewport.\n * Default, `true`.\n */\n @Prop() lazy = true;\n\n @Watch('ariaLabel')\n udpateRole() {\n // force the role to be 'img' if the aria-label is explicitly set\n if (this.ariaLabel) this.role = 'img';\n else if (!this.ariaLabel) this.role = 'presentation';\n }\n\n @Watch('role')\n setAriaLabel() {\n if (!this.ariaLabel && !this.el.ariaLabel) {\n if (!this.role || this.role !== 'presentation') {\n // if the role is not 'presentation' and the user did not explicitly set a role,\n // let's try and derive one from the icon name\n\n const label = getName(this.name, this.icon);\n // user did not provide a label\n // come up with the label based on the icon name\n if (label) {\n this.ariaLabel = label.split('/').slice(-1)[0].replace(/-/g, ' ');\n }\n }\n } else if (this.role === 'presentation') {\n this.ariaLabel = undefined;\n }\n }\n\n connectedCallback() {\n // purposely do not return the promise here because loading\n // the svg file should not hold up loading the app\n // only load the svg if it's visible\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIcon();\n });\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n componentWillLoad() {\n this.udpateRole();\n this.setAriaLabel();\n }\n\n private waitUntilVisible(\n el: HTMLElement,\n rootMargin: string,\n cb: () => void\n ) {\n if (\n Build.isBrowser &&\n this.lazy &&\n typeof window !== 'undefined' &&\n (window as any).IntersectionObserver\n ) {\n const io = (this.io = new (window as any).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting || (data[1] && data[1].isIntersecting)) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n },\n { rootMargin }\n ));\n\n io.observe(el);\n } else {\n // not a browser env (e.g. node)\n // or we're not loading lazily\n // or env doesn't support IntersectionObserver (testing?)\n // - immediately fetch icon\n cb();\n }\n }\n\n @Watch('name')\n @Watch('src')\n @Watch('icon')\n loadIcon() {\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (iconContent.has(url)) {\n // sync if it's already loaded\n this.svgContent = iconContent.get(url);\n requestAnimationFrame(() => (this.isLoading = false));\n } else {\n // async if it hasn't been loaded\n getSvgContent(url).then(() => {\n this.svgContent = iconContent.get(url);\n requestAnimationFrame(() => (this.isLoading = false));\n this.setAriaLabel();\n });\n }\n }\n }\n }\n\n private isRtl() {\n // doc is in rtl\n if (this.el.ownerDocument?.dir === 'rtl') return true;\n // html element is in rtl element\n if (this.el.closest('[dir=\"rtl\"]')) return true;\n\n // nested in a shadow dom - see if that host element is contained in an rtl element\n const rootNode = this.el.getRootNode() as ShadowRoot;\n const ownerHost = rootNode.host;\n if (ownerHost && ownerHost.closest('[dir=\"rtl\"]')) return true;\n\n return false;\n }\n\n render() {\n const flipRtl =\n this.flipRtl ||\n (this.name &&\n (this.name.indexOf('arrow') > -1 ||\n this.name.indexOf('chevron') > -1) &&\n this.isRtl() &&\n this.flipRtl !== false);\n\n return (\n <Host\n class={{\n ...createColorClasses(this.color),\n loading: this.isLoading,\n [`icon-${this.size}`]: !!this.size,\n 'flip-rtl': !!flipRtl,\n 'nano-icon': true,\n }}\n >\n {Build.isBrowser && this.svgContent ? (\n <div class=\"icon-inner\" innerHTML={this.svgContent}></div>\n ) : (\n <div class=\"icon-inner\"></div>\n )}\n </Host>\n );\n }\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import { h, Host, } from "@stencil/core";
4
+ import { Host, } from "@stencil/core";
5
+ import { h } from "../../utils/renderer";
5
6
  import { focusVisible } from "../../utils/focus-visible";
6
7
  /** Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars.
7
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../../../src/components/icon-button/icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,CAAC,EAED,MAAM,EACN,OAAO,EACP,IAAI,GACL,MAAM,eAAe,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Prop,\n h,\n ComponentInterface,\n Method,\n Element,\n Host,\n} from '@stencil/core';\nimport { focusVisible } from '../../utils/focus-visible';\n\n/** Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars.\n *\n * @part base - the main control (either `<a />` or `<button />`)\n * @part icon - a `<nano-icon />` component\n */\n@Component({\n tag: 'nano-icon-button',\n styleUrl: 'icon-button.scss',\n shadow: true,\n})\nexport class IconButton implements ComponentInterface {\n private button: HTMLButtonElement;\n\n @Element() host: HTMLNanoIconButtonElement;\n\n /** The name of the icon to draw. */\n @Prop() iconName?: string;\n\n /** An external URL of an SVG file. */\n @Prop() iconSrc?: string;\n\n /** The default behavior of the button. */\n @Prop({ reflect: true }) type: 'submit' | 'reset' | 'button' = 'button';\n\n /** The name of the button, submitted as a pair with the button’s value as part of the form data. */\n @Prop({ reflect: true }) name?: string;\n\n /** Defines the value associated with the button’s name when it’s submitted with the form data. */\n @Prop({ reflect: true }) value?: string;\n\n /** A description that gets read by screen readers and other assistive devices. For optimal accessibility, you should\n * always include a label that describes what the icon button does. */\n @Prop() label!: string;\n\n /** display the label as a `<nano-tooltip />` */\n @Prop() showTooltip: boolean = false;\n\n /** Set to true to disable the button. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered. */\n @Prop() href: string | undefined;\n\n /** Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types) */\n @Prop() rel: string | undefined;\n\n /** Specifies where to display the linked URL. Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`. */\n @Prop() target: string | undefined;\n\n /** The HTML form element or form element id.\n * Used to submit a form when the button is not a child of the form. */\n @Prop() form: HTMLFormElement | string;\n\n /** Sets focus on the internal button */\n @Method()\n async setFocus() {\n this.button.focus();\n }\n\n /**\n * Finds the form element based on the provided `form` selector\n * or element reference provided.\n * @returns the found form element (if found)\n */\n private findForm(): HTMLFormElement | null {\n const { form, host } = this;\n if (!form) return host.closest('form');\n\n if (form instanceof HTMLFormElement) {\n return form;\n }\n if (typeof form === 'string') {\n const el = document.getElementById(form);\n if (el instanceof HTMLFormElement) {\n return el;\n }\n }\n return null;\n }\n\n private handleClick = (ev: Event) => {\n if (this.type === 'button') return;\n const formEl = this.findForm();\n\n if (formEl) {\n ev.preventDefault();\n\n const fakeButton = document.createElement('button');\n fakeButton.type = this.type;\n fakeButton.style.display = 'none';\n formEl.appendChild(fakeButton);\n fakeButton.click();\n fakeButton.remove();\n }\n };\n\n componentDidLoad() {\n focusVisible.observe(this.button);\n }\n\n connectedCallback() {\n if (this.button) focusVisible.observe(this.button);\n }\n\n disconnectedCallback() {\n focusVisible.unobserve(this.button);\n }\n\n private content() {\n const TagType: 'a' | 'button' = this.href === undefined ? 'button' : 'a';\n\n return (\n <TagType\n onClick={this.handleClick}\n part=\"base\"\n ref={(el) => (this.button = el)}\n class={{\n 'icon-button': true,\n 'icon-button--disabled': this.disabled,\n }}\n name={this.name}\n value={this.value}\n href={this.href || undefined}\n target={this.href && this.target ? this.target : undefined}\n rel={this.rel || undefined}\n type={!this.href && this.type ? this.type : undefined}\n >\n <span class=\"icon-button__label\">{this.label}</span>\n <nano-icon\n name={this.iconName}\n src={this.iconSrc}\n aria-hidden=\"true\"\n lazy={false}\n part=\"icon\"\n />\n </TagType>\n );\n }\n\n render() {\n if (this.showTooltip) {\n return (\n <Host\n class=\"nano-icon-button\"\n aria-disabled={this.disabled ? 'true' : null}\n >\n <nano-tooltip content={this.label}>{this.content()}</nano-tooltip>\n </Host>\n );\n }\n return (\n <Host\n class=\"nano-icon-button\"\n aria-disabled={this.disabled ? 'true' : null}\n >\n {this.content()}\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../../../src/components/icon-button/icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EAEJ,MAAM,EACN,OAAO,EACP,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,sBAAsB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;GAIG;AAMH,MAAM,OAAO,UAAU;IACb,MAAM,CAAoB;IAEvB,IAAI,CAA4B;IAE3C,oCAAoC;IAC5B,QAAQ,CAAU;IAE1B,sCAAsC;IAC9B,OAAO,CAAU;IAEzB,0CAA0C;IACjB,IAAI,GAAkC,QAAQ,CAAC;IAExE,oGAAoG;IAC3E,IAAI,CAAU;IAEvC,kGAAkG;IACzE,KAAK,CAAU;IAExC;0EACsE;IAC9D,KAAK,CAAU;IAEvB,gDAAgD;IACxC,WAAW,GAAY,KAAK,CAAC;IAErC,yCAAyC;IAChB,QAAQ,GAAG,KAAK,CAAC;IAE1C;kEAC8D;IACtD,IAAI,CAAqB;IAEjC;2HACuH;IAC/G,GAAG,CAAqB;IAEhC;yEACqE;IAC7D,MAAM,CAAqB;IAEnC;2EACuE;IAC/D,IAAI,CAA2B;IAEvC,wCAAwC;IAExC,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACK,QAAQ;QACd,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEvC,IAAI,IAAI,YAAY,eAAe,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,OAAO,IAAI,K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AAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAE3C,IAAI,CAAC,OAAO,EAAE,CACV,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Prop,\n ComponentInterface,\n Method,\n Element,\n Host,\n} from '@stencil/core';\nimport { h } from '../../utils/renderer';\nimport { focusVisible } from '../../utils/focus-visible';\n\n/** Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars.\n *\n * @part base - the main control (either `<a />` or `<button />`)\n * @part icon - a `<nano-icon />` component\n */\n@Component({\n tag: 'nano-icon-button',\n styleUrl: 'icon-button.scss',\n shadow: true,\n})\nexport class IconButton implements ComponentInterface {\n private button: HTMLButtonElement;\n\n @Element() host: HTMLNanoIconButtonElement;\n\n /** The name of the icon to draw. */\n @Prop() iconName?: string;\n\n /** An external URL of an SVG file. */\n @Prop() iconSrc?: string;\n\n /** The default behavior of the button. */\n @Prop({ reflect: true }) type: 'submit' | 'reset' | 'button' = 'button';\n\n /** The name of the button, submitted as a pair with the button’s value as part of the form data. */\n @Prop({ reflect: true }) name?: string;\n\n /** Defines the value associated with the button’s name when it’s submitted with the form data. */\n @Prop({ reflect: true }) value?: string;\n\n /** A description that gets read by screen readers and other assistive devices. For optimal accessibility, you should\n * always include a label that describes what the icon button does. */\n @Prop() label!: string;\n\n /** display the label as a `<nano-tooltip />` */\n @Prop() showTooltip: boolean = false;\n\n /** Set to true to disable the button. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered. */\n @Prop() href: string | undefined;\n\n /** Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types) */\n @Prop() rel: string | undefined;\n\n /** Specifies where to display the linked URL. Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`. */\n @Prop() target: string | undefined;\n\n /** The HTML form element or form element id.\n * Used to submit a form when the button is not a child of the form. */\n @Prop() form: HTMLFormElement | string;\n\n /** Sets focus on the internal button */\n @Method()\n async setFocus() {\n this.button.focus();\n }\n\n /**\n * Finds the form element based on the provided `form` selector\n * or element reference provided.\n * @returns the found form element (if found)\n */\n private findForm(): HTMLFormElement | null {\n const { form, host } = this;\n if (!form) return host.closest('form');\n\n if (form instanceof HTMLFormElement) {\n return form;\n }\n if (typeof form === 'string') {\n const el = document.getElementById(form);\n if (el instanceof HTMLFormElement) {\n return el;\n }\n }\n return null;\n }\n\n private handleClick = (ev: Event) => {\n if (this.type === 'button') return;\n const formEl = this.findForm();\n\n if (formEl) {\n ev.preventDefault();\n\n const fakeButton = document.createElement('button');\n fakeButton.type = this.type;\n fakeButton.style.display = 'none';\n formEl.appendChild(fakeButton);\n fakeButton.click();\n fakeButton.remove();\n }\n };\n\n componentDidLoad() {\n focusVisible.observe(this.button);\n }\n\n connectedCallback() {\n if (this.button) focusVisible.observe(this.button);\n }\n\n disconnectedCallback() {\n focusVisible.unobserve(this.button);\n }\n\n private content() {\n const TagType: 'a' | 'button' = this.href === undefined ? 'button' : 'a';\n\n return (\n <TagType\n onClick={this.handleClick}\n part=\"base\"\n ref={(el) => (this.button = el)}\n class={{\n 'icon-button': true,\n 'icon-button--disabled': this.disabled,\n }}\n name={this.name}\n value={this.value}\n href={this.href || undefined}\n target={this.href && this.target ? this.target : undefined}\n rel={this.rel || undefined}\n type={!this.href && this.type ? this.type : undefined}\n >\n <span class=\"icon-button__label\">{this.label}</span>\n <nano-icon\n name={this.iconName}\n src={this.iconSrc}\n aria-hidden=\"true\"\n lazy={false}\n part=\"icon\"\n />\n </TagType>\n );\n }\n\n render() {\n if (this.showTooltip) {\n return (\n <Host\n class=\"nano-icon-button\"\n aria-disabled={this.disabled ? 'true' : null}\n >\n <nano-tooltip content={this.label}>{this.content()}</nano-tooltip>\n </Host>\n );\n }\n return (\n <Host\n class=\"nano-icon-button\"\n aria-disabled={this.disabled ? 'true' : null}\n >\n {this.content()}\n </Host>\n );\n }\n}\n"]}
@@ -21,7 +21,7 @@ export function componentPrefix(prefix) {
21
21
  }
22
22
  return tagTransform;
23
23
  }
24
- export { getTagPrefix } from './utils/renderer';
24
+ export { getTagPrefix, transformTag } from './utils/renderer';
25
25
  export const initialize = (helpers = {}) => {
26
26
  if (typeof window === 'undefined') {
27
27
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,yDAAyD;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,QAAQ,IAAI,YAAY,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEjC,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAE1C,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAC7C,iBAAiB,SAAS,WAAW,CACtC,CAAC;IACF,IAAI,gBAAgB,EAAE,CAAC;QACrB,gBAAgB,CAAC,WAAW,CAAC,GAAG;YAC9B,gBAAgB,EAAE,YAAY;SAC/B,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,UAAiD,EAAE,EACnD,EAAE;IACF,IAAI,OAAQ,MAAc,KAAK,WAAW,EAAE,CAAC;QAC3C,OAAO;IACT,CAAC;IACD,MAAM,eAAe,GAAQ,EAAE,CAAC;IAChC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,eAAe,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IACrC,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,eAAe,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IACrC,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,eAAe,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IACnC,CAAC;IACD,uCAAuC;AACzC,CAAC,CAAC;AAEF,cAAc,cAAc,CAAC","sourcesContent":["// import { setPlatformHelpers } from '@stencil/core';\n// @ts-expect-error - NAMESPACE isn't officially exported\nimport { NAMESPACE } from '@stencil/core';\nimport { setTagPrefix } from './utils/renderer';\n\nexport * from './components/alert/alert.helpers';\nexport * from './components/dialog/dialog.helpers';\nexport {\n debounce as nanoDebounce,\n throttle as nanoThrottle,\n} from './utils/throttle';\nexport { getTabbableElements as nanoGetTabElements } from './utils/tabbable';\n\nexport function componentPrefix(prefix: string) {\n if (!window || !document) return;\n\n const tagTransform = setTagPrefix(prefix);\n\n const autoLoaderScript = document.querySelector(\n `script[src$=\"/${NAMESPACE}.esm.js\"]`\n );\n if (autoLoaderScript) {\n autoLoaderScript['data-opts'] = {\n transformTagName: tagTransform,\n };\n }\n return tagTransform;\n}\n\nexport { getTagPrefix } from './utils/renderer';\n\nexport const initialize = (\n helpers: { _ael?: any; _ce?: any; _rel?: any } = {}\n) => {\n if (typeof (window as any) === 'undefined') {\n return;\n }\n const platformHelpers: any = {};\n if (helpers._ael) {\n platformHelpers.ael = helpers._ael;\n }\n if (helpers._rel) {\n platformHelpers.rel = helpers._rel;\n }\n if (helpers._ce) {\n platformHelpers.ce = helpers._ce;\n }\n // setPlatformHelpers(platformHelpers);\n};\n\nexport * from './components';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,yDAAyD;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,QAAQ,IAAI,YAAY,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEjC,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAE1C,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAC7C,iBAAiB,SAAS,WAAW,CACtC,CAAC;IACF,IAAI,gBAAgB,EAAE,CAAC;QACrB,gBAAgB,CAAC,WAAW,CAAC,GAAG;YAC9B,gBAAgB,EAAE,YAAY;SAC/B,CAAC;IACJ,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,UAAiD,EAAE,EACnD,EAAE;IACF,IAAI,OAAQ,MAAc,KAAK,WAAW,EAAE,CAAC;QAC3C,OAAO;IACT,CAAC;IACD,MAAM,eAAe,GAAQ,EAAE,CAAC;IAChC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,eAAe,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IACrC,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,eAAe,CAAC,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IACrC,CAAC;IACD,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,eAAe,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IACnC,CAAC;IACD,uCAAuC;AACzC,CAAC,CAAC;AAEF,cAAc,cAAc,CAAC","sourcesContent":["// import { setPlatformHelpers } from '@stencil/core';\n// @ts-expect-error - NAMESPACE isn't officially exported\nimport { NAMESPACE } from '@stencil/core';\nimport { setTagPrefix } from './utils/renderer';\n\nexport * from './components/alert/alert.helpers';\nexport * from './components/dialog/dialog.helpers';\nexport {\n debounce as nanoDebounce,\n throttle as nanoThrottle,\n} from './utils/throttle';\nexport { getTabbableElements as nanoGetTabElements } from './utils/tabbable';\n\nexport function componentPrefix(prefix: string) {\n if (!window || !document) return;\n\n const tagTransform = setTagPrefix(prefix);\n\n const autoLoaderScript = document.querySelector(\n `script[src$=\"/${NAMESPACE}.esm.js\"]`\n );\n if (autoLoaderScript) {\n autoLoaderScript['data-opts'] = {\n transformTagName: tagTransform,\n };\n }\n return tagTransform;\n}\n\nexport { getTagPrefix, transformTag } from './utils/renderer';\n\nexport const initialize = (\n helpers: { _ael?: any; _ce?: any; _rel?: any } = {}\n) => {\n if (typeof (window as any) === 'undefined') {\n return;\n }\n const platformHelpers: any = {};\n if (helpers._ael) {\n platformHelpers.ael = helpers._ael;\n }\n if (helpers._rel) {\n platformHelpers.rel = helpers._rel;\n }\n if (helpers._ce) {\n platformHelpers.ce = helpers._ce;\n }\n // setPlatformHelpers(platformHelpers);\n};\n\nexport * from './components';\n"]}
@@ -1,7 +1,8 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
4
+ import { proxyCustomElement, HTMLElement, Host } from '@stencil/core/internal/client';
5
+ import { h } from './renderer.js';
5
6
  import { f as focusVisible } from './focus-visible.js';
6
7
  import { d as defineCustomElement$2 } from './icon.js';
7
8
  import { d as defineCustomElement$1 } from './tooltip.js';
@@ -1 +1 @@
1
- {"file":"icon-button.js","mappings":";;;;;;;;AAAA,MAAM,aAAa,GAAG,++CAA++C,CAAC;AACtgD,6BAAe,aAAa;;MCoBf,UAAU;;;;;;IACb,MAAM,CAAoB;;;IAK1B,QAAQ,CAAU;;IAGlB,OAAO,CAAU;;IAGA,IAAI,GAAkC,QAAQ,CAAC;;IAG/C,IAAI,CAAU;;IAGd,KAAK,CAAU;;;IAIhC,KAAK,CAAU;;IAGf,WAAW,GAAY,KAAK,CAAC;;IAGZ,QAAQ,GAAG,KAAK,CAAC;;;IAIlC,IAAI,CAAqB;;;IAIzB,GAAG,CAAqB;;;IAIxB,MAAM,CAAqB;;;IAI3B,IAAI,CAA2B;;IAIvC,MAAM,QAAQ;QACZ,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;KACrB;;;;;;IAOO,QAAQ;QACd,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEvC,IAAI,IAAI,YAAY,eAAe,EAAE;YACnC,OAAO,IAAI,CAAC;SACb;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,MAAM,EAAE,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YACzC,IAAI,EAAE,YAAY,eAAe,EAAE;gBACjC,OAAO,EAAE,CAAC;aACX;SACF;QACD,OAAO,I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IAAI,CAAC,IAAI,IAAI,SAAS,EAC5B,MAAM,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,SAAS,EAC1D,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,SAAS,EAC1B,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,SAAS,IAErD,YAAM,KAAK,EAAC,oBAAoB,IAAE,IAAI,CAAC,KAAK,CAAQ,EACpD,iBACE,IAAI,EAAE,IAAI,CAAC,QAAQ,EACnB,GAAG,EAAE,IAAI,CAAC,OAAO,iBACL,MAAM,EAClB,IAAI,EAAE,KAAK,EACX,IAAI,EAAC,MAAM,GACX,CACM,EACV;KACH;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,QACE,EAAC,IAAI,IACH,KAAK,EAAC,kBAAkB,mBACT,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,IAAI,IAE5C,oBAAc,OAAO,EAAE,IAAI,CAAC,KAAK,IAAG,IAAI,CAAC,OAAO,EAAE,CAAgB,CAC7D,EACP;SACH;QACD,QACE,EAAC,IAAI,IACH,KAAK,EAAC,kBAAkB,mBACT,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,IAAI,IAE3C,IAAI,CAAC,OAAO,EAAE,CACV,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/icon-button/icon-button.scss?tag=nano-icon-button&encapsulation=shadow","src/components/icon-button/icon-button.tsx"],"sourcesContent":["@use 'sass:map';\n@use '../../global/style/nano-theme/tokens';\n@use '../../global/style/utilities/mixins' as mx;\n\n:host {\n /**\n * @prop --color: defaults to #{map.get(tokens.$colors, palegrey)};\n * @prop --active-color: defaults to #{map.get(tokens.$colors, darkblue--faded)};\n * @prop --hover-color: defaults to #{map.get(tokens.$colors, blue)};\n * @prop --background: defaults to transparent;\n * @prop --padding: defaults to #{tokens.$spacing-small};\n * @prop --box-shadow: defaults to none;\n */\n\n --border-radius: #{tokens.$border-radius-medium};\n --active-color: #{map.get(tokens.$colors, darkblue--faded)};\n --hover-color: #{map.get(tokens.$colors, blue)};\n --nano-color-base: var(--color, #{map.get(tokens.$colors, mediumgrey)});\n --background: transparent;\n --padding: #{tokens.$spacing-small};\n --box-shadow: none;\n --button-bg: var(--background);\n\n border-radius: var(--border-radius);\n display: inline-block;\n}\n\n\n.icon-button {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n border: none;\n border-radius: inherit;\n background: var(--button-bg);\n font-size: inherit;\n color: var(--color);\n padding: var(--padding);\n cursor: pointer;\n appearance: none;\n transition: box-shadow #{tokens.$transition-xfast} ease-in-out;\n box-shadow: var(--box-shadow);\n\n &:hover:not(.icon-button--disabled),\n &:focus:not(.icon-button--disabled) {\n color: var(--hover-color);\n\n --nano-color-base: var(--hover-color);\n }\n\n &:active:not(.icon-button--disabled) {\n color: var(--active-color);\n\n --nano-color-base: var(--active-color);\n }\n\n &:focus {\n outline: none;\n }\n}\n\n.icon-button__label {\n @include mx.visually-hide();\n}\n\n.icon-button--disabled {\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.focus-visible.icon-button:focus {\n box-shadow: #{tokens.$control-focus-style};\n}\n","import {\n Component,\n Prop,\n h,\n ComponentInterface,\n Method,\n Element,\n Host,\n} from '@stencil/core';\nimport { focusVisible } from '../../utils/focus-visible';\n\n/** Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars.\n *\n * @part base - the main control (either `<a />` or `<button />`)\n * @part icon - a `<nano-icon />` component\n */\n@Component({\n tag: 'nano-icon-button',\n styleUrl: 'icon-button.scss',\n shadow: true,\n})\nexport class IconButton implements ComponentInterface {\n private button: HTMLButtonElement;\n\n @Element() host: HTMLNanoIconButtonElement;\n\n /** The name of the icon to draw. */\n @Prop() iconName?: string;\n\n /** An external URL of an SVG file. */\n @Prop() iconSrc?: string;\n\n /** The default behavior of the button. */\n @Prop({ reflect: true }) type: 'submit' | 'reset' | 'button' = 'button';\n\n /** The name of the button, submitted as a pair with the button’s value as part of the form data. */\n @Prop({ reflect: true }) name?: string;\n\n /** Defines the value associated with the button’s name when it’s submitted with the form data. */\n @Prop({ reflect: true }) value?: string;\n\n /** A description that gets read by screen readers and other assistive devices. For optimal accessibility, you should\n * always include a label that describes what the icon button does. */\n @Prop() label!: string;\n\n /** display the label as a `<nano-tooltip />` */\n @Prop() showTooltip: boolean = false;\n\n /** Set to true to disable the button. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered. */\n @Prop() href: string | undefined;\n\n /** Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types) */\n @Prop() rel: string | undefined;\n\n /** Specifies where to display the linked URL. Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`. */\n @Prop() target: string | undefined;\n\n /** The HTML form element or form element id.\n * Used to submit a form when the button is not a child of the form. */\n @Prop() form: HTMLFormElement | string;\n\n /** Sets focus on the internal button */\n @Method()\n async setFocus() {\n this.button.focus();\n }\n\n /**\n * Finds the form element based on the provided `form` selector\n * or element reference provided.\n * @returns the found form element (if found)\n */\n private findForm(): HTMLFormElement | null {\n const { form, host } = this;\n if (!form) return host.closest('form');\n\n if (form instanceof HTMLFormElement) {\n return form;\n }\n if (typeof form === 'string') {\n const el = document.getElementById(form);\n if (el instanceof HTMLFormElement) {\n return el;\n }\n }\n return null;\n }\n\n private handleClick = (ev: Event) => {\n if (this.type === 'button') return;\n const formEl = this.findForm();\n\n if (formEl) {\n ev.preventDefault();\n\n const fakeButton = document.createElement('button');\n fakeButton.type = this.type;\n fakeButton.style.display = 'none';\n formEl.appendChild(fakeButton);\n fakeButton.click();\n fakeButton.remove();\n }\n };\n\n componentDidLoad() {\n focusVisible.observe(this.button);\n }\n\n connectedCallback() {\n if (this.button) focusVisible.observe(this.button);\n }\n\n disconnectedCallback() {\n focusVisible.unobserve(this.button);\n }\n\n private content() {\n const TagType: 'a' | 'button' = this.href === undefined ? 'button' : 'a';\n\n return (\n <TagType\n onClick={this.handleClick}\n part=\"base\"\n ref={(el) => (this.button = el)}\n class={{\n 'icon-button': true,\n 'icon-button--disabled': this.disabled,\n }}\n name={this.name}\n value={this.value}\n href={this.href || undefined}\n target={this.href && this.target ? this.target : undefined}\n rel={this.rel || undefined}\n type={!this.href && this.type ? this.type : undefined}\n >\n <span class=\"icon-button__label\">{this.label}</span>\n <nano-icon\n name={this.iconName}\n src={this.iconSrc}\n aria-hidden=\"true\"\n lazy={false}\n part=\"icon\"\n />\n </TagType>\n );\n }\n\n render() {\n if (this.showTooltip) {\n return (\n <Host\n class=\"nano-icon-button\"\n aria-disabled={this.disabled ? 'true' : null}\n >\n <nano-tooltip content={this.label}>{this.content()}</nano-tooltip>\n </Host>\n );\n }\n return (\n <Host\n class=\"nano-icon-button\"\n aria-disabled={this.disabled ? 'true' : null}\n >\n {this.content()}\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"icon-button.js","mappings":";;;;;;;;;AAAA,MAAM,aAAa,GAAG,++CAA++C,CAAC;AACtgD,6BAAe,aAAa;;MCoBf,UAAU;;;;;;IACb,MAAM,CAAoB;;;IAK1B,QAAQ,CAAU;;IAGlB,OAAO,CAAU;;IAGA,IAAI,GAAkC,QAAQ,CAAC;;IAG/C,IAAI,CAAU;;IAGd,KAAK,CAAU;;;IAIhC,KAAK,CAAU;;IAGf,WAAW,GAAY,KAAK,CAAC;;IAGZ,QAAQ,GAAG,KAAK,CAAC;;;IAIlC,IAAI,CAAqB;;;IAIzB,GAAG,CAAqB;;;IAIxB,MAAM,CAAqB;;;IAI3B,IAAI,CAA2B;;IAIvC,MAAM,QAAQ;QACZ,IAAI,CAAC,MAAM,CAA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kB,mBACT,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,IAAI,IAE3C,IAAI,CAAC,OAAO,EAAE,CACV,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/icon-button/icon-button.scss?tag=nano-icon-button&encapsulation=shadow","src/components/icon-button/icon-button.tsx"],"sourcesContent":["@use 'sass:map';\n@use '../../global/style/nano-theme/tokens';\n@use '../../global/style/utilities/mixins' as mx;\n\n:host {\n /**\n * @prop --color: defaults to #{map.get(tokens.$colors, palegrey)};\n * @prop --active-color: defaults to #{map.get(tokens.$colors, darkblue--faded)};\n * @prop --hover-color: defaults to #{map.get(tokens.$colors, blue)};\n * @prop --background: defaults to transparent;\n * @prop --padding: defaults to #{tokens.$spacing-small};\n * @prop --box-shadow: defaults to none;\n */\n\n --border-radius: #{tokens.$border-radius-medium};\n --active-color: #{map.get(tokens.$colors, darkblue--faded)};\n --hover-color: #{map.get(tokens.$colors, blue)};\n --nano-color-base: var(--color, #{map.get(tokens.$colors, mediumgrey)});\n --background: transparent;\n --padding: #{tokens.$spacing-small};\n --box-shadow: none;\n --button-bg: var(--background);\n\n border-radius: var(--border-radius);\n display: inline-block;\n}\n\n\n.icon-button {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n border: none;\n border-radius: inherit;\n background: var(--button-bg);\n font-size: inherit;\n color: var(--color);\n padding: var(--padding);\n cursor: pointer;\n appearance: none;\n transition: box-shadow #{tokens.$transition-xfast} ease-in-out;\n box-shadow: var(--box-shadow);\n\n &:hover:not(.icon-button--disabled),\n &:focus:not(.icon-button--disabled) {\n color: var(--hover-color);\n\n --nano-color-base: var(--hover-color);\n }\n\n &:active:not(.icon-button--disabled) {\n color: var(--active-color);\n\n --nano-color-base: var(--active-color);\n }\n\n &:focus {\n outline: none;\n }\n}\n\n.icon-button__label {\n @include mx.visually-hide();\n}\n\n.icon-button--disabled {\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.focus-visible.icon-button:focus {\n box-shadow: #{tokens.$control-focus-style};\n}\n","import {\n Component,\n Prop,\n ComponentInterface,\n Method,\n Element,\n Host,\n} from '@stencil/core';\nimport { h } from '../../utils/renderer';\nimport { focusVisible } from '../../utils/focus-visible';\n\n/** Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars.\n *\n * @part base - the main control (either `<a />` or `<button />`)\n * @part icon - a `<nano-icon />` component\n */\n@Component({\n tag: 'nano-icon-button',\n styleUrl: 'icon-button.scss',\n shadow: true,\n})\nexport class IconButton implements ComponentInterface {\n private button: HTMLButtonElement;\n\n @Element() host: HTMLNanoIconButtonElement;\n\n /** The name of the icon to draw. */\n @Prop() iconName?: string;\n\n /** An external URL of an SVG file. */\n @Prop() iconSrc?: string;\n\n /** The default behavior of the button. */\n @Prop({ reflect: true }) type: 'submit' | 'reset' | 'button' = 'button';\n\n /** The name of the button, submitted as a pair with the button’s value as part of the form data. */\n @Prop({ reflect: true }) name?: string;\n\n /** Defines the value associated with the button’s name when it’s submitted with the form data. */\n @Prop({ reflect: true }) value?: string;\n\n /** A description that gets read by screen readers and other assistive devices. For optimal accessibility, you should\n * always include a label that describes what the icon button does. */\n @Prop() label!: string;\n\n /** display the label as a `<nano-tooltip />` */\n @Prop() showTooltip: boolean = false;\n\n /** Set to true to disable the button. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered. */\n @Prop() href: string | undefined;\n\n /** Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types) */\n @Prop() rel: string | undefined;\n\n /** Specifies where to display the linked URL. Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`. */\n @Prop() target: string | undefined;\n\n /** The HTML form element or form element id.\n * Used to submit a form when the button is not a child of the form. */\n @Prop() form: HTMLFormElement | string;\n\n /** Sets focus on the internal button */\n @Method()\n async setFocus() {\n this.button.focus();\n }\n\n /**\n * Finds the form element based on the provided `form` selector\n * or element reference provided.\n * @returns the found form element (if found)\n */\n private findForm(): HTMLFormElement | null {\n const { form, host } = this;\n if (!form) return host.closest('form');\n\n if (form instanceof HTMLFormElement) {\n return form;\n }\n if (typeof form === 'string') {\n const el = document.getElementById(form);\n if (el instanceof HTMLFormElement) {\n return el;\n }\n }\n return null;\n }\n\n private handleClick = (ev: Event) => {\n if (this.type === 'button') return;\n const formEl = this.findForm();\n\n if (formEl) {\n ev.preventDefault();\n\n const fakeButton = document.createElement('button');\n fakeButton.type = this.type;\n fakeButton.style.display = 'none';\n formEl.appendChild(fakeButton);\n fakeButton.click();\n fakeButton.remove();\n }\n };\n\n componentDidLoad() {\n focusVisible.observe(this.button);\n }\n\n connectedCallback() {\n if (this.button) focusVisible.observe(this.button);\n }\n\n disconnectedCallback() {\n focusVisible.unobserve(this.button);\n }\n\n private content() {\n const TagType: 'a' | 'button' = this.href === undefined ? 'button' : 'a';\n\n return (\n <TagType\n onClick={this.handleClick}\n part=\"base\"\n ref={(el) => (this.button = el)}\n class={{\n 'icon-button': true,\n 'icon-button--disabled': this.disabled,\n }}\n name={this.name}\n value={this.value}\n href={this.href || undefined}\n target={this.href && this.target ? this.target : undefined}\n rel={this.rel || undefined}\n type={!this.href && this.type ? this.type : undefined}\n >\n <span class=\"icon-button__label\">{this.label}</span>\n <nano-icon\n name={this.iconName}\n src={this.iconSrc}\n aria-hidden=\"true\"\n lazy={false}\n part=\"icon\"\n />\n </TagType>\n );\n }\n\n render() {\n if (this.showTooltip) {\n return (\n <Host\n class=\"nano-icon-button\"\n aria-disabled={this.disabled ? 'true' : null}\n >\n <nano-tooltip content={this.label}>{this.content()}</nano-tooltip>\n </Host>\n );\n }\n return (\n <Host\n class=\"nano-icon-button\"\n aria-disabled={this.disabled ? 'true' : null}\n >\n {this.content()}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -296,7 +296,7 @@ const Icon = /*@__PURE__*/ proxyCustomElement(class Icon extends HTMLElement {
296
296
  this.name.indexOf('chevron') > -1) &&
297
297
  this.isRtl() &&
298
298
  this.flipRtl !== false);
299
- return (h(Host, { key: 'b63eb962d8abc727b57cbb63b665296a2801f4a0', class: {
299
+ return (h(Host, { key: 'bcb65502c19151978a0035c5493e1cfe37019c4a', class: {
300
300
  ...createColorClasses(this.color),
301
301
  loading: this.isLoading,
302
302
  [`icon-${this.size}`]: !!this.size,
@@ -1 +1 @@
1
- {"file":"icon.js","mappings":";;;;;;;AAGA,IAAI,UAA+B,CAAC;AAE7B,MAAM,UAAU,GAAG;IACxB,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,GAAG,GAAG,MAAa,CAAC;QAC1B,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC;QACpC,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC;KACjE;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAOK,MAAM,MAAM,GAAG,CAAC,CAAO;IAC5B,IAAI,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,GAAG,EAAE;QACP,OAAO,GAAG,CAAC;KACZ;IAED,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,GAAG,EAAE;QACP,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;KACzB;IAED,IAAI,CAAC,CAAC,IAAI,EAAE;QACV,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,GAAG,EAAE;YACP,OAAO,GAAG,CAAC;SACZ;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,QAAgB;IAC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AAC,IAAI,qDACH,KAAK,EAAE;gBACL,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;gBACjC,OAAO,EAAE,IAAI,CAAC,SAAS;gBACvB,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI;gBAClC,UAAU,EAAE,CAAC,CAAC,OAAO;gBACrB,WAAW,EAAE,IAAI;aAClB,IAEA,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,IACjC,WAAK,KAAK,EAAC,YAAY,EAAC,SAAS,EAAE,IAAI,CAAC,UAAU,GAAQ,KAE1D,WAAK,KAAK,EAAC,YAAY,GAAO,CAC/B,CACI,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/icon/utils.ts","src/components/icon/validate.ts","src/components/icon/request.ts","src/components/icon/icon.scss?tag=nano-icon&encapsulation=shadow","src/components/icon/icon.tsx"],"sourcesContent":["import { getAssetPath } from '@stencil/core';\nimport { Icon } from './icon';\n\nlet CACHED_MAP: Map<string, string>;\n\nexport const getIconMap = (): Map<string, string> => {\n if (!CACHED_MAP) {\n const win = window as any;\n win.Nanoicons = win.Nanoicons || {};\n CACHED_MAP = win.Nanoicons.map = win.Nanoicons.map || new Map();\n }\n return CACHED_MAP;\n};\n\nexport const addIcons = (icons: { [name: string]: string }) => {\n const map = getIconMap();\n Object.keys(icons).forEach((name) => map.set(name, icons[name]));\n};\n\nexport const getUrl = (i: Icon) => {\n let url = getSrc(i.src);\n if (url) {\n return url;\n }\n\n url = getName(i.name, i.icon);\n if (url) {\n return getNamedUrl(url);\n }\n\n if (i.icon) {\n url = getSrc(i.icon);\n if (url) {\n return url;\n }\n }\n return null;\n};\n\nconst getNamedUrl = (iconName: string) => {\n const url = getIconMap().get(iconName);\n if (url) {\n return url;\n }\n return getAssetPath(`../nano-assets/fontawesome-pro/svgs/${iconName}.svg`);\n};\n\nexport const getName = (\n iconName: string | undefined,\n icon: string | undefined\n) => {\n if (!iconName && icon && !isSrc(icon)) {\n iconName = icon;\n }\n if (isStr(iconName)) {\n iconName = toLower(iconName);\n }\n\n if (!isStr(iconName) || iconName.trim() === '') {\n return null;\n }\n\n // only allow alpha characters and dash\n const invalidChars = iconName.replace(/[a-z]|-|\\/|\\d/gi, '');\n if (invalidChars !== '') {\n console.warn('invalid characters in icon name ' + iconName);\n return null;\n }\n return iconName;\n};\n\nexport const getSrc = (src: string | undefined) => {\n if (isStr(src)) {\n src = src.trim();\n if (isSrc(src)) {\n return src;\n }\n }\n return null;\n};\n\nexport const isSrc = (str: string) => str.length > 0 && /(\\/|\\.)/.test(str);\nexport const isStr = (val: any): val is string => typeof val === 'string';\nexport const toLower = (val: string) => val.toLowerCase();\n","import { isStr } from './utils';\n\nexport const validateContent = (svgContent: string | null) => {\n if (svgContent) {\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n // setup this way to ensure it works on our buddy IE\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {\n const svgClass = svgElm.getAttribute('class') || '';\n svgElm.setAttribute(\n 'class',\n (svgClass + ' sc-nano-icon s-nano-icon svg').trim()\n );\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as any)) {\n return div.innerHTML;\n }\n }\n }\n return '';\n};\n\nexport const isValid = (elm: HTMLElement) => {\n if (elm.nodeType === 1) {\n if (elm.nodeName.toLowerCase() === 'script') {\n return false;\n }\n\n for (let i = 0; i < elm.attributes.length; i++) {\n const val = elm.attributes[i].value;\n if (isStr(val) && val.toLowerCase().indexOf('on') === 0) {\n return false;\n }\n }\n\n for (let i = 0; i < elm.childNodes.length; i++) {\n if (!isValid(elm.childNodes[i] as any)) {\n return false;\n }\n }\n }\n return true;\n};\n","import { validateContent } from './validate';\nexport const iconContent = new Map<string, string>();\nconst requests = new Map<string, Promise<any>>();\n\nexport const getSvgContent = (url: string) => {\n // see if we already have a request for this url\n let req = requests.get(url);\n if (!req) {\n // we don't already have a request\n req = fetch(url).then((rsp) => {\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n iconContent.set(url, validateContent(svgContent));\n });\n }\n iconContent.set(url, '');\n });\n\n // cache for the same requests\n requests.set(url, req);\n }\n return req;\n};\n","@import '../../global/style/utilities/globals';\n\n:host {\n /**\n * @prop --color: defaults to current context color\n * @prop --primary-color: used for duotone icons to set the primary color\n * @prop --secondary-color: used for duotone icons to set the secondary color\n * @prop --primary-opacity: used for duotone icons to set the primary opacity\n * @prop --secondary-opacity: used for duotone icons to set the secondary opacity\n * @prop --stroke-width: 32px default stroke width\n */\n\n --color: var(--nano-color-base, currentcolor);\n --primary-color: var(--nano-color-tint, currentcolor);\n --secondary-color: var(--nano-color-shade, currentcolor);\n --stroke-width: 32px;\n --primary-opacity: 0.8;\n --secondary-opacity: 1;\n --icon-size: var(--nano-icon-size, 1em);\n --icon-margin-top: var(--nano-icon-margin-top, 0);\n --icon-margin-end: var(--nano-icon-margin-end, 0);\n --icon-margin-bottom: var(--nano-icon-margin-bottom, 0);\n --icon-margin-start: var(--nano-icon-margin-start, 0);\n\n display: inline-block;\n inline-size: var(--icon-size);\n block-size: var(--icon-size);\n min-inline-size: var(--icon-size);\n min-block-size: var(--icon-size);\n contain: strict;\n fill: currentcolor;\n box-sizing: content-box !important;\n transition: opacity 0.3s ease;\n color: var(--color);\n margin-inline: var(--icon-margin-start) var(--icon-margin-end);\n margin-block: var(--icon-margin-top) var(--icon-margin-bottom);\n}\n\n:host .nanoicon {\n stroke: currentcolor;\n}\n\n.nanoicon-fill-none {\n fill: none;\n}\n\n.nanoicon-stroke-width {\n stroke-width: 32px;\n stroke-width: var(--stroke-width);\n}\n\n.icon-inner,\n.nanoicon,\nsvg,\n.svg {\n display: block;\n block-size: 100%;\n inline-size: 100%;\n overflow: visible;\n}\n\n:host(.loading) {\n opacity: 0;\n}\n\n.fa-primary {\n color: var(--primary-color);\n opacity: var(--primary-opacity, 1);\n}\n\n.fa-secondary {\n color: var(--secondary-color);\n opacity: var(--secondary-opacity) !important;\n}\n\n/* Icon RTL\n * -----------------------------------------------------------\n */\n:host(.flip-rtl) .icon-inner {\n transform: scaleX(-1);\n}\n\n/* Icon Sizes\n * -----------------------------------------------------------\n */\n:host(.icon-small) {\n font-size: 18px !important;\n}\n\n:host(.icon-large) {\n font-size: 32px !important;\n}\n","import {\n Build,\n Component,\n Element,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { h } from '../../utils/renderer';\nimport { createColorClasses } from '../../utils/theme';\nimport { getSvgContent, iconContent } from './request';\nimport { getName, getUrl } from './utils';\nimport type { Color } from '../../types/shared';\n\n/**\n * An SVG loader / helper. Comes bundled with all fontawesome pro icons by default but can use any custom SVG (with an correct path). Lazily loads SVG for each icon, so will only request the icons that you're using and that are visible.\n */\n@Component({\n tag: 'nano-icon',\n styleUrl: 'icon.scss',\n shadow: true,\n})\nexport class Icon {\n private io?: IntersectionObserver;\n\n @Element() el!: HTMLNanoIconElement;\n\n @State() svgContent?: string;\n @State() isVisible = false;\n @State() isLoading = true;\n\n /**\n * Color to use from your application's color palette.\n * Default options are: `\"primary\"`, `\"secondary\"`, `\"tertiary\"`, `\"success\"`, `\"warning\"`, `\"danger\"`, `\"light\"`, `\"medium\"`, and `\"dark\"`.\n */\n @Prop() color?: Color;\n\n /**\n * Specifies the role to use for accessibility. Defaults to 'presentation' (invisible to screen-readers)\n */\n @Prop({ mutable: true, reflect: true }) role: string;\n\n /**\n * Specifies the label to use for accessibility. Defaults to the icon name.\n */\n @Prop({ mutable: true, reflect: true }) ariaLabel: string;\n\n /**\n * Specifies whether the icon should horizontally flip when `dir` is `\"rtl\"`.\n */\n @Prop() flipRtl?: boolean;\n\n /**\n * Specifies which icon to use from the built-in set of icons.\n */\n @Prop() name?: string;\n\n /**\n * Specifies the exact `src` of an SVG file to use.\n */\n @Prop() src?: string;\n\n /**\n * A combination of both `name` and `src`. If a `src` url is detected\n * it will set the `src` property. Otherwise it assumes it's a built-in named\n * SVG and set the `name` property.\n */\n @Prop() icon?: any;\n\n /**\n * The size of the icon.\n * Available options are: `\"small\"` and `\"large\"`.\n */\n @Prop() size?: 'small' | 'large';\n\n /**\n * If enabled, nano-icon will be loaded lazily when it's visible in the viewport.\n * Default, `true`.\n */\n @Prop() lazy = true;\n\n @Watch('ariaLabel')\n udpateRole() {\n // force the role to be 'img' if the aria-label is explicitly set\n if (this.ariaLabel) this.role = 'img';\n else if (!this.ariaLabel) this.role = 'presentation';\n }\n\n @Watch('role')\n setAriaLabel() {\n if (!this.ariaLabel && !this.el.ariaLabel) {\n if (!this.role || this.role !== 'presentation') {\n // if the role is not 'presentation' and the user did not explicitly set a role,\n // let's try and derive one from the icon name\n\n const label = getName(this.name, this.icon);\n // user did not provide a label\n // come up with the label based on the icon name\n if (label) {\n this.ariaLabel = label.split('/').slice(-1)[0].replace(/-/g, ' ');\n }\n }\n } else if (this.role === 'presentation') {\n this.ariaLabel = undefined;\n }\n }\n\n connectedCallback() {\n // purposely do not return the promise here because loading\n // the svg file should not hold up loading the app\n // only load the svg if it's visible\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIcon();\n });\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n componentWillLoad() {\n this.udpateRole();\n this.setAriaLabel();\n }\n\n private waitUntilVisible(\n el: HTMLElement,\n rootMargin: string,\n cb: () => void\n ) {\n if (\n Build.isBrowser &&\n this.lazy &&\n typeof window !== 'undefined' &&\n (window as any).IntersectionObserver\n ) {\n const io = (this.io = new (window as any).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting || (data[1] && data[1].isIntersecting)) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n },\n { rootMargin }\n ));\n\n io.observe(el);\n } else {\n // not a browser env (e.g. node)\n // or we're not loading lazily\n // or env doesn't support IntersectionObserver (testing?)\n // - immediately fetch icon\n cb();\n }\n }\n\n @Watch('name')\n @Watch('src')\n @Watch('icon')\n loadIcon() {\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (iconContent.has(url)) {\n // sync if it's already loaded\n this.svgContent = iconContent.get(url);\n requestAnimationFrame(() => (this.isLoading = false));\n } else {\n // async if it hasn't been loaded\n getSvgContent(url).then(() => {\n this.svgContent = iconContent.get(url);\n requestAnimationFrame(() => (this.isLoading = false));\n this.setAriaLabel();\n });\n }\n }\n }\n }\n\n private isRtl() {\n // doc is in rtl\n if (this.el.ownerDocument?.dir === 'rtl') return true;\n // html element is in rtl element\n if (this.el.closest('[dir=\"rtl\"]')) return true;\n\n // nested in a shadow dom - see if that host element is contained in an rtl element\n const rootNode = this.el.getRootNode() as ShadowRoot;\n const ownerHost = rootNode.host;\n if (ownerHost && ownerHost.closest('[dir=\"rtl\"]')) return true;\n\n return false;\n }\n\n render() {\n const flipRtl =\n this.flipRtl ||\n (this.name &&\n (this.name.indexOf('arrow') > -1 ||\n this.name.indexOf('chevron') > -1) &&\n this.isRtl() &&\n this.flipRtl !== false);\n\n return (\n <Host\n class={{\n ...createColorClasses(this.color),\n loading: this.isLoading,\n [`icon-${this.size}`]: !!this.size,\n 'flip-rtl': !!flipRtl,\n 'nano-icon': true,\n }}\n >\n {Build.isBrowser && this.svgContent ? (\n <div class=\"icon-inner\" innerHTML={this.svgContent}></div>\n ) : (\n <div class=\"icon-inner\"></div>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"icon.js","mappings":";;;;;;;AAGA,IAAI,UAA+B,CAAC;AAE7B,MAAM,UAAU,GAAG;IACxB,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,GAAG,GAAG,MAAa,CAAC;QAC1B,GAAG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;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/icon/utils.ts","src/components/icon/validate.ts","src/components/icon/request.ts","src/components/icon/icon.scss?tag=nano-icon&encapsulation=shadow","src/components/icon/icon.tsx"],"sourcesContent":["import { getAssetPath } from '@stencil/core';\nimport { Icon } from './icon';\n\nlet CACHED_MAP: Map<string, string>;\n\nexport const getIconMap = (): Map<string, string> => {\n if (!CACHED_MAP) {\n const win = window as any;\n win.Nanoicons = win.Nanoicons || {};\n CACHED_MAP = win.Nanoicons.map = win.Nanoicons.map || new Map();\n }\n return CACHED_MAP;\n};\n\nexport const addIcons = (icons: { [name: string]: string }) => {\n const map = getIconMap();\n Object.keys(icons).forEach((name) => map.set(name, icons[name]));\n};\n\nexport const getUrl = (i: Icon) => {\n let url = getSrc(i.src);\n if (url) {\n return url;\n }\n\n url = getName(i.name, i.icon);\n if (url) {\n return getNamedUrl(url);\n }\n\n if (i.icon) {\n url = getSrc(i.icon);\n if (url) {\n return url;\n }\n }\n return null;\n};\n\nconst getNamedUrl = (iconName: string) => {\n const url = getIconMap().get(iconName);\n if (url) {\n return url;\n }\n return getAssetPath(`../nano-assets/fontawesome-pro/svgs/${iconName}.svg`);\n};\n\nexport const getName = (\n iconName: string | undefined,\n icon: string | undefined\n) => {\n if (!iconName && icon && !isSrc(icon)) {\n iconName = icon;\n }\n if (isStr(iconName)) {\n iconName = toLower(iconName);\n }\n\n if (!isStr(iconName) || iconName.trim() === '') {\n return null;\n }\n\n // only allow alpha characters and dash\n const invalidChars = iconName.replace(/[a-z]|-|\\/|\\d/gi, '');\n if (invalidChars !== '') {\n console.warn('invalid characters in icon name ' + iconName);\n return null;\n }\n return iconName;\n};\n\nexport const getSrc = (src: string | undefined) => {\n if (isStr(src)) {\n src = src.trim();\n if (isSrc(src)) {\n return src;\n }\n }\n return null;\n};\n\nexport const isSrc = (str: string) => str.length > 0 && /(\\/|\\.)/.test(str);\nexport const isStr = (val: any): val is string => typeof val === 'string';\nexport const toLower = (val: string) => val.toLowerCase();\n","import { isStr } from './utils';\n\nexport const validateContent = (svgContent: string | null) => {\n if (svgContent) {\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n // setup this way to ensure it works on our buddy IE\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {\n const svgClass = svgElm.getAttribute('class') || '';\n svgElm.setAttribute(\n 'class',\n (svgClass + ' sc-nano-icon s-nano-icon svg').trim()\n );\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as any)) {\n return div.innerHTML;\n }\n }\n }\n return '';\n};\n\nexport const isValid = (elm: HTMLElement) => {\n if (elm.nodeType === 1) {\n if (elm.nodeName.toLowerCase() === 'script') {\n return false;\n }\n\n for (let i = 0; i < elm.attributes.length; i++) {\n const val = elm.attributes[i].value;\n if (isStr(val) && val.toLowerCase().indexOf('on') === 0) {\n return false;\n }\n }\n\n for (let i = 0; i < elm.childNodes.length; i++) {\n if (!isValid(elm.childNodes[i] as any)) {\n return false;\n }\n }\n }\n return true;\n};\n","import { validateContent } from './validate';\nexport const iconContent = new Map<string, string>();\nconst requests = new Map<string, Promise<any>>();\n\nexport const getSvgContent = (url: string) => {\n // see if we already have a request for this url\n let req = requests.get(url);\n if (!req) {\n // we don't already have a request\n req = fetch(url).then((rsp) => {\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n iconContent.set(url, validateContent(svgContent));\n });\n }\n iconContent.set(url, '');\n });\n\n // cache for the same requests\n requests.set(url, req);\n }\n return req;\n};\n","@import '../../global/style/utilities/globals';\n\n:host {\n /**\n * @prop --color: defaults to current context color\n * @prop --primary-color: used for duotone icons to set the primary color\n * @prop --secondary-color: used for duotone icons to set the secondary color\n * @prop --primary-opacity: used for duotone icons to set the primary opacity\n * @prop --secondary-opacity: used for duotone icons to set the secondary opacity\n * @prop --stroke-width: 32px default stroke width\n */\n\n --color: var(--nano-color-base, currentcolor);\n --primary-color: var(--nano-color-tint, currentcolor);\n --secondary-color: var(--nano-color-shade, currentcolor);\n --stroke-width: 32px;\n --primary-opacity: 0.8;\n --secondary-opacity: 1;\n --icon-size: var(--nano-icon-size, 1em);\n --icon-margin-top: var(--nano-icon-margin-top, 0);\n --icon-margin-end: var(--nano-icon-margin-end, 0);\n --icon-margin-bottom: var(--nano-icon-margin-bottom, 0);\n --icon-margin-start: var(--nano-icon-margin-start, 0);\n\n display: inline-block;\n inline-size: var(--icon-size);\n block-size: var(--icon-size);\n min-inline-size: var(--icon-size);\n min-block-size: var(--icon-size);\n contain: strict;\n fill: currentcolor;\n box-sizing: content-box !important;\n transition: opacity 0.3s ease;\n color: var(--color);\n margin-inline: var(--icon-margin-start) var(--icon-margin-end);\n margin-block: var(--icon-margin-top) var(--icon-margin-bottom);\n}\n\n:host .nanoicon {\n stroke: currentcolor;\n}\n\n.nanoicon-fill-none {\n fill: none;\n}\n\n.nanoicon-stroke-width {\n stroke-width: 32px;\n stroke-width: var(--stroke-width);\n}\n\n.icon-inner,\n.nanoicon,\nsvg,\n.svg {\n display: block;\n block-size: 100%;\n inline-size: 100%;\n overflow: visible;\n}\n\n:host(.loading) {\n opacity: 0;\n}\n\n.fa-primary {\n color: var(--primary-color);\n opacity: var(--primary-opacity, 1);\n}\n\n.fa-secondary {\n color: var(--secondary-color);\n opacity: var(--secondary-opacity) !important;\n}\n\n/* Icon RTL\n * -----------------------------------------------------------\n */\n:host(.flip-rtl) .icon-inner {\n transform: scaleX(-1);\n}\n\n/* Icon Sizes\n * -----------------------------------------------------------\n */\n:host(.icon-small) {\n font-size: 18px !important;\n}\n\n:host(.icon-large) {\n font-size: 32px !important;\n}\n","import {\n Build,\n Component,\n Element,\n Host,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { h } from '../../utils/renderer';\nimport { createColorClasses } from '../../utils/theme';\nimport { getSvgContent, iconContent } from './request';\nimport { getName, getUrl } from './utils';\nimport type { Color } from '../../types/shared';\n\n/**\n * An SVG loader / helper. Comes bundled with all fontawesome pro icons by default but can use any custom SVG (with an correct path).\n * Lazily loads SVG for each icon, so will only request the icons that you're using and that are visible.\n */\n@Component({\n tag: 'nano-icon',\n styleUrl: 'icon.scss',\n shadow: true,\n})\nexport class Icon {\n private io?: IntersectionObserver;\n\n @Element() el!: HTMLNanoIconElement;\n\n @State() svgContent?: string;\n @State() isVisible = false;\n @State() isLoading = true;\n\n /**\n * Color to use from your application's color palette.\n * Default options are: `\"primary\"`, `\"secondary\"`, `\"tertiary\"`, `\"success\"`, `\"warning\"`, `\"danger\"`, `\"light\"`, `\"medium\"`, and `\"dark\"`.\n */\n @Prop() color?: Color;\n\n /**\n * Specifies the role to use for accessibility. Defaults to 'presentation' (invisible to screen-readers)\n */\n @Prop({ mutable: true, reflect: true }) role: string;\n\n /**\n * Specifies the label to use for accessibility. Defaults to the icon name.\n */\n @Prop({ mutable: true, reflect: true }) ariaLabel: string;\n\n /**\n * Specifies whether the icon should horizontally flip when `dir` is `\"rtl\"`.\n */\n @Prop() flipRtl?: boolean;\n\n /**\n * Specifies which icon to use from the built-in set of icons.\n */\n @Prop() name?: string;\n\n /**\n * Specifies the exact `src` of an SVG file to use.\n */\n @Prop() src?: string;\n\n /**\n * A combination of both `name` and `src`. If a `src` url is detected\n * it will set the `src` property. Otherwise it assumes it's a built-in named\n * SVG and set the `name` property.\n */\n @Prop() icon?: any;\n\n /**\n * The size of the icon.\n * Available options are: `\"small\"` and `\"large\"`.\n */\n @Prop() size?: 'small' | 'large';\n\n /**\n * If enabled, nano-icon will be loaded lazily when it's visible in the viewport.\n * Default, `true`.\n */\n @Prop() lazy = true;\n\n @Watch('ariaLabel')\n udpateRole() {\n // force the role to be 'img' if the aria-label is explicitly set\n if (this.ariaLabel) this.role = 'img';\n else if (!this.ariaLabel) this.role = 'presentation';\n }\n\n @Watch('role')\n setAriaLabel() {\n if (!this.ariaLabel && !this.el.ariaLabel) {\n if (!this.role || this.role !== 'presentation') {\n // if the role is not 'presentation' and the user did not explicitly set a role,\n // let's try and derive one from the icon name\n\n const label = getName(this.name, this.icon);\n // user did not provide a label\n // come up with the label based on the icon name\n if (label) {\n this.ariaLabel = label.split('/').slice(-1)[0].replace(/-/g, ' ');\n }\n }\n } else if (this.role === 'presentation') {\n this.ariaLabel = undefined;\n }\n }\n\n connectedCallback() {\n // purposely do not return the promise here because loading\n // the svg file should not hold up loading the app\n // only load the svg if it's visible\n this.waitUntilVisible(this.el, '50px', () => {\n this.isVisible = true;\n this.loadIcon();\n });\n }\n\n disconnectedCallback() {\n if (this.io) {\n this.io.disconnect();\n this.io = undefined;\n }\n }\n\n componentWillLoad() {\n this.udpateRole();\n this.setAriaLabel();\n }\n\n private waitUntilVisible(\n el: HTMLElement,\n rootMargin: string,\n cb: () => void\n ) {\n if (\n Build.isBrowser &&\n this.lazy &&\n typeof window !== 'undefined' &&\n (window as any).IntersectionObserver\n ) {\n const io = (this.io = new (window as any).IntersectionObserver(\n (data: IntersectionObserverEntry[]) => {\n if (data[0].isIntersecting || (data[1] && data[1].isIntersecting)) {\n io.disconnect();\n this.io = undefined;\n cb();\n }\n },\n { rootMargin }\n ));\n\n io.observe(el);\n } else {\n // not a browser env (e.g. node)\n // or we're not loading lazily\n // or env doesn't support IntersectionObserver (testing?)\n // - immediately fetch icon\n cb();\n }\n }\n\n @Watch('name')\n @Watch('src')\n @Watch('icon')\n loadIcon() {\n if (Build.isBrowser && this.isVisible) {\n const url = getUrl(this);\n if (url) {\n if (iconContent.has(url)) {\n // sync if it's already loaded\n this.svgContent = iconContent.get(url);\n requestAnimationFrame(() => (this.isLoading = false));\n } else {\n // async if it hasn't been loaded\n getSvgContent(url).then(() => {\n this.svgContent = iconContent.get(url);\n requestAnimationFrame(() => (this.isLoading = false));\n this.setAriaLabel();\n });\n }\n }\n }\n }\n\n private isRtl() {\n // doc is in rtl\n if (this.el.ownerDocument?.dir === 'rtl') return true;\n // html element is in rtl element\n if (this.el.closest('[dir=\"rtl\"]')) return true;\n\n // nested in a shadow dom - see if that host element is contained in an rtl element\n const rootNode = this.el.getRootNode() as ShadowRoot;\n const ownerHost = rootNode.host;\n if (ownerHost && ownerHost.closest('[dir=\"rtl\"]')) return true;\n\n return false;\n }\n\n render() {\n const flipRtl =\n this.flipRtl ||\n (this.name &&\n (this.name.indexOf('arrow') > -1 ||\n this.name.indexOf('chevron') > -1) &&\n this.isRtl() &&\n this.flipRtl !== false);\n\n return (\n <Host\n class={{\n ...createColorClasses(this.color),\n loading: this.isLoading,\n [`icon-${this.size}`]: !!this.size,\n 'flip-rtl': !!flipRtl,\n 'nano-icon': true,\n }}\n >\n {Build.isBrowser && this.svgContent ? (\n <div class=\"icon-inner\" innerHTML={this.svgContent}></div>\n ) : (\n <div class=\"icon-inner\"></div>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -4,7 +4,7 @@
4
4
  import { NAMESPACE } from '@stencil/core/internal/client';
5
5
  export { getAssetPath, setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
6
6
  import { t as transformTag, s as setTagPrefix } from './renderer.js';
7
- export { g as getTagPrefix } from './renderer.js';
7
+ export { g as getTagPrefix, t as transformTag } from './renderer.js';
8
8
  export { d as nanoDebounce, t as nanoThrottle } from './throttle.js';
9
9
  export { g as nanoGetTabElements } from './tabbable.js';
10
10
 
@@ -1 +1 @@
1
- {"file":"index.js","mappings":";;;;;;;;;;AAAA,wBAAe;IACb,IACE,UAAU,CAAC,MAAM;QACjB,kBAAkB,IAAI,UAAU,CAAC,MAAM;QACvC,UAAU,CAAC,UAAU,CAAC,EACtB;;QAGA,MAAM,MAAM,GAAG,QAAQ,CAAC,eAAe;QAEvC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE;YACjC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;SACjC,CAAC;Q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AAC,EAAE,CAAC;cACX,EACN,EAAE;KACH,CACF,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAC9D,CAAC,GAAgB;YACf,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAC3B,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,EAAE,CAC7C,CAAC;YACF,IAAI,QAAQ,IAAI,QAAQ,CAAC,OAAO,EAAE;gBAChC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;aACjD;SACF,CACF,CAAC;KACH;IAED,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB;;AC9DA;SAagB,eAAe,CAAC,MAAc;IAC5C,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEjC,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAE1C,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAC7C,iBAAiB,SAAS,WAAW,CACtC,CAAC;IACF,IAAI,gBAAgB,EAAE;QACpB,gBAAgB,CAAC,WAAW,CAAC,GAAG;YAC9B,gBAAgB,EAAE,YAAY;SAC/B,CAAC;KACH;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;MAIY,UAAU,GAAG,CACxB,UAAiD,EAAE;IAEnD,IAAI,OAAQ,MAAc,KAAK,WAAW,EAAE;QAC1C,OAAO;KACR;;AAYH;;;;;;","names":[],"sources":["src/global/script/global.ts","@stencil/core/internal/app-globals","src/components/alert/alert.helpers.ts","src/components/dialog/dialog.helpers.ts","src/index.ts"],"sourcesContent":["export default async () => {\n if (\n globalThis.window &&\n 'MutationObserver' in globalThis.window &&\n globalThis['document']\n ) {\n // fire global 'ready' event when everything is hydrated\n\n const docEle = document.documentElement;\n\n window.addEventListener('appload', () => {\n docEle.classList.add('hydrated');\n });\n\n const docIsReady = () => {\n if (!docEle.classList.contains('hydrated')) return false;\n docEle.dispatchEvent(new CustomEvent('nanoComponentsReady'));\n return true;\n };\n\n if (!docIsReady()) {\n let mutationO = new MutationObserver((_) => {\n if (!docIsReady()) return;\n\n mutationO.disconnect();\n mutationO = null;\n });\n\n mutationO.observe(docEle, {\n childList: false,\n subtree: false,\n attributes: true,\n });\n }\n }\n};\n","import appGlobalScript from '/builds/RXAuYz49/0/Digital/nano-components/packages/components/src/global/script/global.ts';\nexport const globalScripts = appGlobalScript;\n","import { transformTag } from '../../utils/renderer';\nimport type { Color } from '../../types/shared';\n\ninterface ImperativeAlertOptions {\n color?: Color;\n duration?: number;\n closable?: boolean;\n}\n\ninterface ImperativeAlertButton {\n classes: string;\n content: string;\n handler?: (e: MouseEvent) => void;\n}\n\nexport type AlertToastPosition = 'tr' | 'tl' | 'bl' | 'br';\n\nconst alertContent = (\n message: string,\n buttons: ImperativeAlertButton[] = []\n) => {\n return `${message}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`;\n};\n\nconst addBtnHandlers = (\n alert: HTMLNanoAlertElement,\n buttons: ImperativeAlertButton[] = []\n) => {\n if (buttons.length) {\n Array.from(alert.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n};\n\n/**\n * `nano-alert` helper to create toast notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param position - the position of the toast. Options are 'tr', 'tl', 'bl' & 'br'\n * @param icon - name for the `nano-icon`\n * @param alertOptions - { color: Color, duration: number, closable: boolean }\n * @returns `Promise<void>`\n */\nexport async function nanoShowToast(\n message: string,\n position: AlertToastPosition = 'tr',\n icon?: string,\n alertOptions?: ImperativeAlertOptions,\n buttons: ImperativeAlertButton[] = []\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: 3000,\n closable: true,\n ...alertOptions,\n };\n icon = icon || 'light/circle-info';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement(transformTag('nano-alert')) as HTMLNanoAlertElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n <nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n requestAnimationFrame(async (_) => {\n await alert.toast(position);\n resolve(alert);\n });\n });\n}\n\n/**\n * `nano-alert` helper to create alert notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons\n * @param label - descriptive label for assitive technology\n * @param icon - name for the `nano-icon`\n * @param alertOptions\n * @returns `Promise<void>`\n */\nexport function nanoShowAlert(\n message: string,\n buttons: ImperativeAlertButton[] = [],\n label: string,\n icon: string | undefined = 'light/circle-info',\n alertOptions: ImperativeAlertOptions = {}\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: Infinity,\n closable: false,\n ...alertOptions,\n };\n icon = icon || 'light/circle-info';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement(transformTag('nano-alert')) as HTMLNanoAlertElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n ${icon ? `<nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>` : ''}\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n setTimeout(async (_) => {\n await alert.alert(label);\n resolve(alert);\n }, 100);\n });\n}\n","import { transformTag } from '../../utils/renderer';\n\ninterface ImperativeDialogOptions {\n noUserDismiss: boolean;\n noHeader?: boolean;\n noFooter?: boolean;\n label: string;\n}\n/**\n * `nano-dialog` helper to create dialog modals imperatively.\n * @param body - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons - { classes: string; content: string; handler: () => {} }[]\n * @param dialogOptions - { noUserDismiss: boolean, noHeader?: boolean, noFooter?: boolean, label: string }\n * @returns `Promise<void>`\n */\nexport function nanoCreateDialog(\n body: string,\n buttons: { classes: string; content: string; handler: () => void }[] = [],\n dialogOptions?: ImperativeDialogOptions\n) {\n const opts: ImperativeDialogOptions = {\n noUserDismiss: false,\n label: 'Dialog',\n ...dialogOptions,\n };\n const dialog: HTMLNanoDialogElement = Object.assign(\n document.createElement(\n transformTag('nano-dialog')\n ) as HTMLNanoDialogElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n ${body}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`,\n }\n );\n\n if (buttons.length) {\n Array.from(dialog.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n\n document.body.appendChild(dialog);\n return dialog;\n}\n","// import { setPlatformHelpers } from '@stencil/core';\n// @ts-expect-error - NAMESPACE isn't officially exported\nimport { NAMESPACE } from '@stencil/core';\nimport { setTagPrefix } from './utils/renderer';\n\nexport * from './components/alert/alert.helpers';\nexport * from './components/dialog/dialog.helpers';\nexport {\n debounce as nanoDebounce,\n throttle as nanoThrottle,\n} from './utils/throttle';\nexport { getTabbableElements as nanoGetTabElements } from './utils/tabbable';\n\nexport function componentPrefix(prefix: string) {\n if (!window || !document) return;\n\n const tagTransform = setTagPrefix(prefix);\n\n const autoLoaderScript = document.querySelector(\n `script[src$=\"/${NAMESPACE}.esm.js\"]`\n );\n if (autoLoaderScript) {\n autoLoaderScript['data-opts'] = {\n transformTagName: tagTransform,\n };\n }\n return tagTransform;\n}\n\nexport { getTagPrefix } from './utils/renderer';\n\nexport const initialize = (\n helpers: { _ael?: any; _ce?: any; _rel?: any } = {}\n) => {\n if (typeof (window as any) === 'undefined') {\n return;\n }\n const platformHelpers: any = {};\n if (helpers._ael) {\n platformHelpers.ael = helpers._ael;\n }\n if (helpers._rel) {\n platformHelpers.rel = helpers._rel;\n }\n if (helpers._ce) {\n platformHelpers.ce = helpers._ce;\n }\n // setPlatformHelpers(platformHelpers);\n};\n\nexport * from './components';\n"],"version":3}
1
+ {"file":"index.js","mappings":";;;;;;;;;;AAAA,wBAAe;IACb,IACE,UAAU,CAAC,MAAM;QACjB,kBAAkB,IAAI,UAAU,CAAC,MAAM;QACvC,UAAU,CAAC,UAAU,CAAC,EACtB;;QAGA,MAAM,MAAM,GAAG,QAAQ,CAAC,eAAe;QAEvC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE;YACjC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;SACjC,CAAC;QAEF,MAAM,UAAU,GAAG;YACjB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAAE,OAAO,KAAK;YACxD,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,qBAAqB,CAAC,CAAC;YAC5D,OAAO,IAAI;SACZ;QAED,IAAI,CAAC,UAAU,EAAE,EAAE;YACjB,IAAI,SAAS,GAAG,IAAI,gBAAgB,CAAC,CAAC,CAAC;gBACrC,IAAI,CAAC,UAAU,EAAE;oBAAE;gBAEnB,SAAS,CAAC,UAAU,EAAE;gBACtB,SAAS,GAAG,IAAI;aACjB,CAAC;YAEF,SAAS,CAAC,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gB,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;aACjD;SACF,CACF,CAAC;KACH;IAED,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB;;AC9DA;SAagB,eAAe,CAAC,MAAc;IAC5C,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEjC,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAE1C,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAC7C,iBAAiB,SAAS,WAAW,CACtC,CAAC;IACF,IAAI,gBAAgB,EAAE;QACpB,gBAAgB,CAAC,WAAW,CAAC,GAAG;YAC9B,gBAAgB,EAAE,YAAY;SAC/B,CAAC;KACH;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;MAIY,UAAU,GAAG,CACxB,UAAiD,EAAE;IAEnD,IAAI,OAAQ,MAAc,KAAK,WAAW,EAAE;QAC1C,OAAO;KACR;;AAYH;;;;;;","names":[],"sources":["src/global/script/global.ts","@stencil/core/internal/app-globals","src/components/alert/alert.helpers.ts","src/components/dialog/dialog.helpers.ts","src/index.ts"],"sourcesContent":["export default async () => {\n if (\n globalThis.window &&\n 'MutationObserver' in globalThis.window &&\n globalThis['document']\n ) {\n // fire global 'ready' event when everything is hydrated\n\n const docEle = document.documentElement;\n\n window.addEventListener('appload', () => {\n docEle.classList.add('hydrated');\n });\n\n const docIsReady = () => {\n if (!docEle.classList.contains('hydrated')) return false;\n docEle.dispatchEvent(new CustomEvent('nanoComponentsReady'));\n return true;\n };\n\n if (!docIsReady()) {\n let mutationO = new MutationObserver((_) => {\n if (!docIsReady()) return;\n\n mutationO.disconnect();\n mutationO = null;\n });\n\n mutationO.observe(docEle, {\n childList: false,\n subtree: false,\n attributes: true,\n });\n }\n }\n};\n","import appGlobalScript from '/builds/WUhA-BsM/0/Digital/nano-components/packages/components/src/global/script/global.ts';\nexport const globalScripts = appGlobalScript;\n","import { transformTag } from '../../utils/renderer';\nimport type { Color } from '../../types/shared';\n\ninterface ImperativeAlertOptions {\n color?: Color;\n duration?: number;\n closable?: boolean;\n}\n\ninterface ImperativeAlertButton {\n classes: string;\n content: string;\n handler?: (e: MouseEvent) => void;\n}\n\nexport type AlertToastPosition = 'tr' | 'tl' | 'bl' | 'br';\n\nconst alertContent = (\n message: string,\n buttons: ImperativeAlertButton[] = []\n) => {\n return `${message}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`;\n};\n\nconst addBtnHandlers = (\n alert: HTMLNanoAlertElement,\n buttons: ImperativeAlertButton[] = []\n) => {\n if (buttons.length) {\n Array.from(alert.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n};\n\n/**\n * `nano-alert` helper to create toast notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param position - the position of the toast. Options are 'tr', 'tl', 'bl' & 'br'\n * @param icon - name for the `nano-icon`\n * @param alertOptions - { color: Color, duration: number, closable: boolean }\n * @returns `Promise<void>`\n */\nexport async function nanoShowToast(\n message: string,\n position: AlertToastPosition = 'tr',\n icon?: string,\n alertOptions?: ImperativeAlertOptions,\n buttons: ImperativeAlertButton[] = []\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: 3000,\n closable: true,\n ...alertOptions,\n };\n icon = icon || 'light/circle-info';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement(transformTag('nano-alert')) as HTMLNanoAlertElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n <nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n requestAnimationFrame(async (_) => {\n await alert.toast(position);\n resolve(alert);\n });\n });\n}\n\n/**\n * `nano-alert` helper to create alert notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons\n * @param label - descriptive label for assitive technology\n * @param icon - name for the `nano-icon`\n * @param alertOptions\n * @returns `Promise<void>`\n */\nexport function nanoShowAlert(\n message: string,\n buttons: ImperativeAlertButton[] = [],\n label: string,\n icon: string | undefined = 'light/circle-info',\n alertOptions: ImperativeAlertOptions = {}\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: Infinity,\n closable: false,\n ...alertOptions,\n };\n icon = icon || 'light/circle-info';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement(transformTag('nano-alert')) as HTMLNanoAlertElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n ${icon ? `<nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>` : ''}\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n setTimeout(async (_) => {\n await alert.alert(label);\n resolve(alert);\n }, 100);\n });\n}\n","import { transformTag } from '../../utils/renderer';\n\ninterface ImperativeDialogOptions {\n noUserDismiss: boolean;\n noHeader?: boolean;\n noFooter?: boolean;\n label: string;\n}\n/**\n * `nano-dialog` helper to create dialog modals imperatively.\n * @param body - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons - { classes: string; content: string; handler: () => {} }[]\n * @param dialogOptions - { noUserDismiss: boolean, noHeader?: boolean, noFooter?: boolean, label: string }\n * @returns `Promise<void>`\n */\nexport function nanoCreateDialog(\n body: string,\n buttons: { classes: string; content: string; handler: () => void }[] = [],\n dialogOptions?: ImperativeDialogOptions\n) {\n const opts: ImperativeDialogOptions = {\n noUserDismiss: false,\n label: 'Dialog',\n ...dialogOptions,\n };\n const dialog: HTMLNanoDialogElement = Object.assign(\n document.createElement(\n transformTag('nano-dialog')\n ) as HTMLNanoDialogElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n ${body}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`,\n }\n );\n\n if (buttons.length) {\n Array.from(dialog.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n\n document.body.appendChild(dialog);\n return dialog;\n}\n","// import { setPlatformHelpers } from '@stencil/core';\n// @ts-expect-error - NAMESPACE isn't officially exported\nimport { NAMESPACE } from '@stencil/core';\nimport { setTagPrefix } from './utils/renderer';\n\nexport * from './components/alert/alert.helpers';\nexport * from './components/dialog/dialog.helpers';\nexport {\n debounce as nanoDebounce,\n throttle as nanoThrottle,\n} from './utils/throttle';\nexport { getTabbableElements as nanoGetTabElements } from './utils/tabbable';\n\nexport function componentPrefix(prefix: string) {\n if (!window || !document) return;\n\n const tagTransform = setTagPrefix(prefix);\n\n const autoLoaderScript = document.querySelector(\n `script[src$=\"/${NAMESPACE}.esm.js\"]`\n );\n if (autoLoaderScript) {\n autoLoaderScript['data-opts'] = {\n transformTagName: tagTransform,\n };\n }\n return tagTransform;\n}\n\nexport { getTagPrefix, transformTag } from './utils/renderer';\n\nexport const initialize = (\n helpers: { _ael?: any; _ce?: any; _rel?: any } = {}\n) => {\n if (typeof (window as any) === 'undefined') {\n return;\n }\n const platformHelpers: any = {};\n if (helpers._ael) {\n platformHelpers.ael = helpers._ael;\n }\n if (helpers._rel) {\n platformHelpers.rel = helpers._rel;\n }\n if (helpers._ce) {\n platformHelpers.ce = helpers._ce;\n }\n // setPlatformHelpers(platformHelpers);\n};\n\nexport * from './components';\n"],"version":3}
@@ -1 +1 @@
1
- {"file":"app-globals-f0120bbe.js","mappings":";;;AAAA,wBAAe;IACb,IACE,UAAU,CAAC,MAAM;QACjB,kBAAkB,IAAI,UAAU,CAAC,MAAM;QACvC,UAAU,CAAC,UAAU,CAAC,EACtB;;QAGA,MAAM,MAAM,GAAG,QAAQ,CAAC,eAAe;QAEvC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE;YACjC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;SACjC,CAAC;QAEF,MAAM,UAAU,GAAG;YACjB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAAE,OAAO,KAAK;YACxD,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,qBAAqB,CAAC,CAAC;YAC5D,OAAO,IAAI;SACZ;QAED,IAAI,CAAC,UAAU,EAAE,EAAE;YACjB,IAAI,SAAS,GAAG,IAAI,gBAAgB,CAAC,CAAC,CAAC;gBACrC,IAAI,CAAC,UAAU,EAAE;oBAAE;gBAEnB,SAAS,CAAC,UAAU,EAAE;gBACtB,SAAS,GAAG,IAAI;aACjB,CAAC;YAEF,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE;gBACxB,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,IAAI;aACjB,CAAC;;;AAGR,CAAC;;AClCW,MAAC,aAAa,GAAG;;;;","names":[],"sources":["src/global/script/global.ts","@stencil/core/internal/app-globals"],"sourcesContent":["export default async () => {\n if (\n globalThis.window &&\n 'MutationObserver' in globalThis.window &&\n globalThis['document']\n ) {\n // fire global 'ready' event when everything is hydrated\n\n const docEle = document.documentElement;\n\n window.addEventListener('appload', () => {\n docEle.classList.add('hydrated');\n });\n\n const docIsReady = () => {\n if (!docEle.classList.contains('hydrated')) return false;\n docEle.dispatchEvent(new CustomEvent('nanoComponentsReady'));\n return true;\n };\n\n if (!docIsReady()) {\n let mutationO = new MutationObserver((_) => {\n if (!docIsReady()) return;\n\n mutationO.disconnect();\n mutationO = null;\n });\n\n mutationO.observe(docEle, {\n childList: false,\n subtree: false,\n attributes: true,\n });\n }\n }\n};\n","import appGlobalScript from '/builds/RXAuYz49/0/Digital/nano-components/packages/components/src/global/script/global.ts';\nexport const globalScripts = appGlobalScript;\n"],"version":3}
1
+ {"file":"app-globals-f0120bbe.js","mappings":";;;AAAA,wBAAe;IACb,IACE,UAAU,CAAC,MAAM;QACjB,kBAAkB,IAAI,UAAU,CAAC,MAAM;QACvC,UAAU,CAAC,UAAU,CAAC,EACtB;;QAGA,MAAM,MAAM,GAAG,QAAQ,CAAC,eAAe;QAEvC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE;YACjC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;SACjC,CAAC;QAEF,MAAM,UAAU,GAAG;YACjB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC;gBAAE,OAAO,KAAK;YACxD,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,qBAAqB,CAAC,CAAC;YAC5D,OAAO,IAAI;SACZ;QAED,IAAI,CAAC,UAAU,EAAE,EAAE;YACjB,IAAI,SAAS,GAAG,IAAI,gBAAgB,CAAC,CAAC,CAAC;gBACrC,IAAI,CAAC,UAAU,EAAE;oBAAE;gBAEnB,SAAS,CAAC,UAAU,EAAE;gBACtB,SAAS,GAAG,IAAI;aACjB,CAAC;YAEF,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE;gBACxB,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,IAAI;aACjB,CAAC;;;AAGR,CAAC;;AClCW,MAAC,aAAa,GAAG;;;;","names":[],"sources":["src/global/script/global.ts","@stencil/core/internal/app-globals"],"sourcesContent":["export default async () => {\n if (\n globalThis.window &&\n 'MutationObserver' in globalThis.window &&\n globalThis['document']\n ) {\n // fire global 'ready' event when everything is hydrated\n\n const docEle = document.documentElement;\n\n window.addEventListener('appload', () => {\n docEle.classList.add('hydrated');\n });\n\n const docIsReady = () => {\n if (!docEle.classList.contains('hydrated')) return false;\n docEle.dispatchEvent(new CustomEvent('nanoComponentsReady'));\n return true;\n };\n\n if (!docIsReady()) {\n let mutationO = new MutationObserver((_) => {\n if (!docIsReady()) return;\n\n mutationO.disconnect();\n mutationO = null;\n });\n\n mutationO.observe(docEle, {\n childList: false,\n subtree: false,\n attributes: true,\n });\n }\n }\n};\n","import appGlobalScript from '/builds/WUhA-BsM/0/Digital/nano-components/packages/components/src/global/script/global.ts';\nexport const globalScripts = appGlobalScript;\n"],"version":3}
package/dist/esm/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { N as NAMESPACE } from './index-6cc72cd9.js';
5
5
  import { t as transformTag, s as setTagPrefix } from './renderer-4bc3e2dc.js';
6
- export { g as getTagPrefix } from './renderer-4bc3e2dc.js';
6
+ export { g as getTagPrefix, t as transformTag } from './renderer-4bc3e2dc.js';
7
7
  export { d as nanoDebounce, t as nanoThrottle } from './throttle-df960210.js';
8
8
  export { g as nanoGetTabElements } from './tabbable-44932eb7.js';
9
9
 
@@ -1 +1 @@
1
- {"file":"index.js","mappings":";;;;;;;;;AAiBA,MAAM,YAAY,GAAG,CACnB,OAAe,EACf,UAAmC,EAAE;IAErC,OAAO,GAAG,OAAO;MAEb,OAAO,CAAC,MAAM;UACV,OAAO;aACJ,GAAG,CACF,CAAC,GAAG,EAAE,CAAC,KACL,qBAAqB,CAAC,mBAAmB,GAAG,CAAC,OAAO,mBAAmB,GAAG,CAAC,OAAO,WAAW,CAChG;aACA,IAAI,CAAC,EAAE,CAAC;UACX,EACN,EAAE,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CACrB,KAA2B,EA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KACH;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;MAIY,UAAU,GAAG,CACxB,UAAiD,EAAE;IAEnD,IAAI,OAAQ,MAAc,KAAK,WAAW,EAAE;QAC1C,OAAO;KACR;;AAYH;;;;","names":[],"sources":["src/components/alert/alert.helpers.ts","src/components/dialog/dialog.helpers.ts","src/index.ts"],"sourcesContent":["import { transformTag } from '../../utils/renderer';\nimport type { Color } from '../../types/shared';\n\ninterface ImperativeAlertOptions {\n color?: Color;\n duration?: number;\n closable?: boolean;\n}\n\ninterface ImperativeAlertButton {\n classes: string;\n content: string;\n handler?: (e: MouseEvent) => void;\n}\n\nexport type AlertToastPosition = 'tr' | 'tl' | 'bl' | 'br';\n\nconst alertContent = (\n message: string,\n buttons: ImperativeAlertButton[] = []\n) => {\n return `${message}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`;\n};\n\nconst addBtnHandlers = (\n alert: HTMLNanoAlertElement,\n buttons: ImperativeAlertButton[] = []\n) => {\n if (buttons.length) {\n Array.from(alert.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n};\n\n/**\n * `nano-alert` helper to create toast notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param position - the position of the toast. Options are 'tr', 'tl', 'bl' & 'br'\n * @param icon - name for the `nano-icon`\n * @param alertOptions - { color: Color, duration: number, closable: boolean }\n * @returns `Promise<void>`\n */\nexport async function nanoShowToast(\n message: string,\n position: AlertToastPosition = 'tr',\n icon?: string,\n alertOptions?: ImperativeAlertOptions,\n buttons: ImperativeAlertButton[] = []\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: 3000,\n closable: true,\n ...alertOptions,\n };\n icon = icon || 'light/circle-info';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement(transformTag('nano-alert')) as HTMLNanoAlertElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n <nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n requestAnimationFrame(async (_) => {\n await alert.toast(position);\n resolve(alert);\n });\n });\n}\n\n/**\n * `nano-alert` helper to create alert notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons\n * @param label - descriptive label for assitive technology\n * @param icon - name for the `nano-icon`\n * @param alertOptions\n * @returns `Promise<void>`\n */\nexport function nanoShowAlert(\n message: string,\n buttons: ImperativeAlertButton[] = [],\n label: string,\n icon: string | undefined = 'light/circle-info',\n alertOptions: ImperativeAlertOptions = {}\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: Infinity,\n closable: false,\n ...alertOptions,\n };\n icon = icon || 'light/circle-info';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement(transformTag('nano-alert')) as HTMLNanoAlertElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n ${icon ? `<nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>` : ''}\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n setTimeout(async (_) => {\n await alert.alert(label);\n resolve(alert);\n }, 100);\n });\n}\n","import { transformTag } from '../../utils/renderer';\n\ninterface ImperativeDialogOptions {\n noUserDismiss: boolean;\n noHeader?: boolean;\n noFooter?: boolean;\n label: string;\n}\n/**\n * `nano-dialog` helper to create dialog modals imperatively.\n * @param body - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons - { classes: string; content: string; handler: () => {} }[]\n * @param dialogOptions - { noUserDismiss: boolean, noHeader?: boolean, noFooter?: boolean, label: string }\n * @returns `Promise<void>`\n */\nexport function nanoCreateDialog(\n body: string,\n buttons: { classes: string; content: string; handler: () => void }[] = [],\n dialogOptions?: ImperativeDialogOptions\n) {\n const opts: ImperativeDialogOptions = {\n noUserDismiss: false,\n label: 'Dialog',\n ...dialogOptions,\n };\n const dialog: HTMLNanoDialogElement = Object.assign(\n document.createElement(\n transformTag('nano-dialog')\n ) as HTMLNanoDialogElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n ${body}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`,\n }\n );\n\n if (buttons.length) {\n Array.from(dialog.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n\n document.body.appendChild(dialog);\n return dialog;\n}\n","// import { setPlatformHelpers } from '@stencil/core';\n// @ts-expect-error - NAMESPACE isn't officially exported\nimport { NAMESPACE } from '@stencil/core';\nimport { setTagPrefix } from './utils/renderer';\n\nexport * from './components/alert/alert.helpers';\nexport * from './components/dialog/dialog.helpers';\nexport {\n debounce as nanoDebounce,\n throttle as nanoThrottle,\n} from './utils/throttle';\nexport { getTabbableElements as nanoGetTabElements } from './utils/tabbable';\n\nexport function componentPrefix(prefix: string) {\n if (!window || !document) return;\n\n const tagTransform = setTagPrefix(prefix);\n\n const autoLoaderScript = document.querySelector(\n `script[src$=\"/${NAMESPACE}.esm.js\"]`\n );\n if (autoLoaderScript) {\n autoLoaderScript['data-opts'] = {\n transformTagName: tagTransform,\n };\n }\n return tagTransform;\n}\n\nexport { getTagPrefix } from './utils/renderer';\n\nexport const initialize = (\n helpers: { _ael?: any; _ce?: any; _rel?: any } = {}\n) => {\n if (typeof (window as any) === 'undefined') {\n return;\n }\n const platformHelpers: any = {};\n if (helpers._ael) {\n platformHelpers.ael = helpers._ael;\n }\n if (helpers._rel) {\n platformHelpers.rel = helpers._rel;\n }\n if (helpers._ce) {\n platformHelpers.ce = helpers._ce;\n }\n // setPlatformHelpers(platformHelpers);\n};\n\nexport * from './components';\n"],"version":3}
1
+ {"file":"index.js","mappings":";;;;;;;;;AAiBA,MAAM,YAAY,GAAG,CACnB,OAAe,EACf,UAAmC,EAAE;IAErC,OAAO,GAAG,OAAO;MAEb,OAAO,CAAC,MAAM;UACV,OAAO;aACJ,GAAG,CACF,CAAC,GAAG,EAAE,CAAC,KACL,qBAAqB,CAAC,mBAAmB,GAAG,CAAC,OAAO,mBAAmB,GAAG,CAAC,OAAO,WAAW,CAChG;aACA,IAAI,CAAC,EAAE,CAAC;UACX,EACN,EAAE,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CACrB,KAA2B,EAC3B,UAAmC,EAAE;IAErC,IAAI,OAAO,CAAC,MAAM,EAAE;QAClB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAC7D,CAAC,GAAgB;YACf,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAC3B,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,EAAE,CAC7C,CAAC;YACF,IAAI,QAAQ,IAAI,QAAQ,CAAC,OAAO,EAAE;gBAChC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;aACjD;SACF,CACF,CAAC;KACH;AACH,CAAC,CAAC;AAEF;;;;;;;;AAQO,eAAe,aAAa,CACjC,OAAe,EACf,WAA+B,IAAI,EACnC,IAAa,EACb,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CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,QAAQ,EAAE,CAC7C,CAAC;YACF,IAAI,QAAQ,IAAI,QAAQ,CAAC,OAAO,EAAE;gBAChC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;aACjD;SACF,CACF,CAAC;KACH;IAED,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB;;AC9DA;SAagB,eAAe,CAAC,MAAc;IAC5C,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEjC,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAE1C,MAAM,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAC7C,iBAAiB,SAAS,WAAW,CACtC,CAAC;IACF,IAAI,gBAAgB,EAAE;QACpB,gBAAgB,CAAC,WAAW,CAAC,GAAG;YAC9B,gBAAgB,EAAE,YAAY;SAC/B,CAAC;KACH;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;MAIY,UAAU,GAAG,CACxB,UAAiD,EAAE;IAEnD,IAAI,OAAQ,MAAc,KAAK,WAAW,EAAE;QAC1C,OAAO;KACR;;AAYH;;;;","names":[],"sources":["src/components/alert/alert.helpers.ts","src/components/dialog/dialog.helpers.ts","src/index.ts"],"sourcesContent":["import { transformTag } from '../../utils/renderer';\nimport type { Color } from '../../types/shared';\n\ninterface ImperativeAlertOptions {\n color?: Color;\n duration?: number;\n closable?: boolean;\n}\n\ninterface ImperativeAlertButton {\n classes: string;\n content: string;\n handler?: (e: MouseEvent) => void;\n}\n\nexport type AlertToastPosition = 'tr' | 'tl' | 'bl' | 'br';\n\nconst alertContent = (\n message: string,\n buttons: ImperativeAlertButton[] = []\n) => {\n return `${message}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`;\n};\n\nconst addBtnHandlers = (\n alert: HTMLNanoAlertElement,\n buttons: ImperativeAlertButton[] = []\n) => {\n if (buttons.length) {\n Array.from(alert.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n};\n\n/**\n * `nano-alert` helper to create toast notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param position - the position of the toast. Options are 'tr', 'tl', 'bl' & 'br'\n * @param icon - name for the `nano-icon`\n * @param alertOptions - { color: Color, duration: number, closable: boolean }\n * @returns `Promise<void>`\n */\nexport async function nanoShowToast(\n message: string,\n position: AlertToastPosition = 'tr',\n icon?: string,\n alertOptions?: ImperativeAlertOptions,\n buttons: ImperativeAlertButton[] = []\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: 3000,\n closable: true,\n ...alertOptions,\n };\n icon = icon || 'light/circle-info';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement(transformTag('nano-alert')) as HTMLNanoAlertElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n <nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n requestAnimationFrame(async (_) => {\n await alert.toast(position);\n resolve(alert);\n });\n });\n}\n\n/**\n * `nano-alert` helper to create alert notifications imperatively.\n * @param message - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons\n * @param label - descriptive label for assitive technology\n * @param icon - name for the `nano-icon`\n * @param alertOptions\n * @returns `Promise<void>`\n */\nexport function nanoShowAlert(\n message: string,\n buttons: ImperativeAlertButton[] = [],\n label: string,\n icon: string | undefined = 'light/circle-info',\n alertOptions: ImperativeAlertOptions = {}\n) {\n const opts: ImperativeAlertOptions = {\n color: 'primary',\n duration: Infinity,\n closable: false,\n ...alertOptions,\n };\n icon = icon || 'light/circle-info';\n const alert: HTMLNanoAlertElement = Object.assign(\n document.createElement(transformTag('nano-alert')) as HTMLNanoAlertElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n ${icon ? `<nano-icon name=\"${icon}\" slot=\"icon\"></nano-icon>` : ''}\n ${alertContent(message, buttons)}\n `,\n }\n );\n addBtnHandlers(alert, buttons);\n\n document.body.appendChild(alert);\n return new Promise<HTMLNanoAlertElement>((resolve) => {\n setTimeout(async (_) => {\n await alert.alert(label);\n resolve(alert);\n }, 100);\n });\n}\n","import { transformTag } from '../../utils/renderer';\n\ninterface ImperativeDialogOptions {\n noUserDismiss: boolean;\n noHeader?: boolean;\n noFooter?: boolean;\n label: string;\n}\n/**\n * `nano-dialog` helper to create dialog modals imperatively.\n * @param body - a JS template string e.g. `<h4>Hello</h4> ${aVariable}`\n * @param buttons - { classes: string; content: string; handler: () => {} }[]\n * @param dialogOptions - { noUserDismiss: boolean, noHeader?: boolean, noFooter?: boolean, label: string }\n * @returns `Promise<void>`\n */\nexport function nanoCreateDialog(\n body: string,\n buttons: { classes: string; content: string; handler: () => void }[] = [],\n dialogOptions?: ImperativeDialogOptions\n) {\n const opts: ImperativeDialogOptions = {\n noUserDismiss: false,\n label: 'Dialog',\n ...dialogOptions,\n };\n const dialog: HTMLNanoDialogElement = Object.assign(\n document.createElement(\n transformTag('nano-dialog')\n ) as HTMLNanoDialogElement,\n {\n ...opts,\n open: false,\n innerHTML: `\n ${body}\n ${\n buttons.length\n ? buttons\n .map(\n (btn, i) =>\n `<button data-btn=\"${i}\" class=\"button ${btn.classes}\" slot=\"footer\">${btn.content}</button>`\n )\n .join('')\n : ''\n }`,\n }\n );\n\n if (buttons.length) {\n Array.from(dialog.querySelectorAll('button[slot=\"footer\"]')).map(\n (btn: HTMLElement) => {\n const foundBtn = buttons.find(\n (_fb, i) => btn.dataset.btn === i.toString()\n );\n if (foundBtn && foundBtn.handler) {\n btn.addEventListener('click', foundBtn.handler);\n }\n }\n );\n }\n\n document.body.appendChild(dialog);\n return dialog;\n}\n","// import { setPlatformHelpers } from '@stencil/core';\n// @ts-expect-error - NAMESPACE isn't officially exported\nimport { NAMESPACE } from '@stencil/core';\nimport { setTagPrefix } from './utils/renderer';\n\nexport * from './components/alert/alert.helpers';\nexport * from './components/dialog/dialog.helpers';\nexport {\n debounce as nanoDebounce,\n throttle as nanoThrottle,\n} from './utils/throttle';\nexport { getTabbableElements as nanoGetTabElements } from './utils/tabbable';\n\nexport function componentPrefix(prefix: string) {\n if (!window || !document) return;\n\n const tagTransform = setTagPrefix(prefix);\n\n const autoLoaderScript = document.querySelector(\n `script[src$=\"/${NAMESPACE}.esm.js\"]`\n );\n if (autoLoaderScript) {\n autoLoaderScript['data-opts'] = {\n transformTagName: tagTransform,\n };\n }\n return tagTransform;\n}\n\nexport { getTagPrefix, transformTag } from './utils/renderer';\n\nexport const initialize = (\n helpers: { _ael?: any; _ce?: any; _rel?: any } = {}\n) => {\n if (typeof (window as any) === 'undefined') {\n return;\n }\n const platformHelpers: any = {};\n if (helpers._ael) {\n platformHelpers.ael = helpers._ael;\n }\n if (helpers._rel) {\n platformHelpers.rel = helpers._rel;\n }\n if (helpers._ce) {\n platformHelpers.ce = helpers._ce;\n }\n // setPlatformHelpers(platformHelpers);\n};\n\nexport * from './components';\n"],"version":3}
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import { r as registerInstance, g as getElement, h, a as Host, c as createEvent } from './index-6cc72cd9.js';
4
+ import { r as registerInstance, g as getElement, a as Host, c as createEvent } from './index-6cc72cd9.js';
5
+ import { h } from './renderer-4bc3e2dc.js';
5
6
  import { f as focusVisible } from './focus-visible-e5f02c46.js';
6
- import { h as h$1 } from './renderer-4bc3e2dc.js';
7
7
  import { P as Popover } from './popover-30ce6cac.js';
8
8
 
9
9
  const iconButtonCss = ":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--border-radius:var(--nano-border-radius-medium, 4px);--active-color:#005c75;--hover-color:#007495;--nano-color-base:var(--color, #687576);--background:transparent;--padding:var(--nano-spacing-small, 8px);--box-shadow:none;--button-bg:var(--background);border-radius:var(--border-radius);display:inline-block}.icon-button{flex:0 0 auto;display:flex;align-items:center;border:none;border-radius:inherit;background:var(--button-bg);font-size:inherit;color:var(--color);padding:var(--padding);cursor:pointer;appearance:none;transition:box-shadow var(--nano-transition-fast, 0.1s) ease-in-out;box-shadow:var(--box-shadow)}.icon-button:hover:not(.icon-button--disabled),.icon-button:focus:not(.icon-button--disabled){color:var(--hover-color);--nano-color-base:var(--hover-color)}.icon-button:active:not(.icon-button--disabled){color:var(--active-color);--nano-color-base:var(--active-color)}.icon-button:focus{outline:none}.icon-button__label{clip:rect(1px, 1px, 1px, 1px);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}.icon-button--disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}.focus-visible.icon-button:focus{box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8)))}";
@@ -319,10 +319,10 @@ const Tooltip = class {
319
319
  this.popover.destroy();
320
320
  }
321
321
  render() {
322
- return (h$1(Host, { key: 'aea96e5f6c3a04be33309614166cde8809501bdd', onKeyDown: this.handleKeyDown, onMouseOver: this.handleMouseOver, onMouseOut: this.handleMouseOut, onBlur: this.handleBlur, onFocus: this.handleFocus, onClick: this.handleClick, class: "nano-tooltip" }, h$1("slot", { key: '1d35074667f546275cd81875cf49b5de5a9a144f', onSlotchange: this.handleSlotChange }), h$1("div", { key: '694a19141a36749d393e0db08ce48bfc490e7938', ref: (el) => (this.tooltipPositioner = el), class: "tooltip-positioner", popover: "manual" }, h$1("div", { key: '8b181e183dff1ab3b1a2253f693f6d62f6a504d2', part: "base", ref: (el) => (this.tooltip = el), class: {
322
+ return (h(Host, { key: 'aea96e5f6c3a04be33309614166cde8809501bdd', onKeyDown: this.handleKeyDown, onMouseOver: this.handleMouseOver, onMouseOut: this.handleMouseOut, onBlur: this.handleBlur, onFocus: this.handleFocus, onClick: this.handleClick, class: "nano-tooltip" }, h("slot", { key: '1d35074667f546275cd81875cf49b5de5a9a144f', onSlotchange: this.handleSlotChange }), h("div", { key: '694a19141a36749d393e0db08ce48bfc490e7938', ref: (el) => (this.tooltipPositioner = el), class: "tooltip-positioner", popover: "manual" }, h("div", { key: '8b181e183dff1ab3b1a2253f693f6d62f6a504d2', part: "base", ref: (el) => (this.tooltip = el), class: {
323
323
  tooltip: true,
324
324
  'tooltip--open': this.open,
325
- }, role: "tooltip", "aria-hidden": this.open ? 'false' : 'true' }, h$1("slot", { key: 'ba3d58a1cab421828b90a880019c334ddd15c40a', name: "content", onSlotchange: () => this.setLabel() }, this.content), h$1("div", { key: 'e254be92d3ca7ff1fc592c6f81a6b4de0185434a', class: "tooltip-arrow", "data-popper-arrow": true })))));
325
+ }, role: "tooltip", "aria-hidden": this.open ? 'false' : 'true' }, h("slot", { key: 'ba3d58a1cab421828b90a880019c334ddd15c40a', name: "content", onSlotchange: () => this.setLabel() }, this.content), h("div", { key: 'e254be92d3ca7ff1fc592c6f81a6b4de0185434a', class: "tooltip-arrow", "data-popper-arrow": true })))));
326
326
  }
327
327
  static get watchers() { return {
328
328
  "content": ["setLabel"],