@hyvor/icons 2.0.0-beta.2 → 2.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Icon.svelte CHANGED
@@ -1,4 +1,5 @@
1
1
  <script lang="ts">
2
+ import { icons } from "./index.js";
2
3
  import type { IconName } from "./types.js";
3
4
 
4
5
  interface Props {
@@ -21,12 +22,11 @@
21
22
  }
22
23
 
23
24
  async function getSvg() {
24
- try {
25
- const svgModule = await import(`./icons/${name}.svg?raw`);
26
- return addAttributes(svgModule.default);
27
- } catch (e) {
28
- return `[?] <!-- ${e} -->`;
29
- }
25
+ const path = `./icons/${name}.svg`;
26
+ const loader = icons[path];
27
+ if (!loader) return '[?]';
28
+ const raw = await loader();
29
+ return addAttributes(raw as string);
30
30
  }
31
31
 
32
32
  const svg = await getSvg();
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export type { IconName } from './types.js';
2
2
  export { default as Icon } from './Icon.svelte';
3
+ declare const icons: any;
4
+ export { icons };
package/dist/index.js CHANGED
@@ -1 +1,3 @@
1
1
  export { default as Icon } from './Icon.svelte';
2
+ const icons = import.meta.glob('./icons/*.svg', { query: '?raw', import: 'default' });
3
+ export { icons };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyvor/icons",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.4",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "url": "https://github.com/hyvor/design"