@sentropic/design-system-svelte 0.37.2 → 0.39.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.
package/dist/Icon.svelte CHANGED
@@ -1,10 +1,8 @@
1
1
  <script lang="ts">
2
2
  import type { SVGAttributes } from "svelte/elements";
3
- import { ICONS, type IconName } from "./icons.js";
3
+ import { ICONS, type IconGlyph, type IconName } from "./icons.js";
4
4
 
5
5
  type IconProps = Omit<SVGAttributes<SVGElement>, "class"> & {
6
- /** Canonical DS icon name (see {@link IconName}). */
7
- name: IconName;
8
6
  /** Square size in px. Default 18 — the DS-standard inline glyph size. */
9
7
  size?: number;
10
8
  /**
@@ -19,10 +17,25 @@
19
17
  */
20
18
  title?: string;
21
19
  class?: string;
20
+ /**
21
+ * Canonical DS icon name (see {@link IconName}).
22
+ *
23
+ * Exactly one of `name` or `glyph` is expected: `glyph` wins when both
24
+ * are set, and neither renders nothing.
25
+ */
26
+ name?: IconName;
27
+ /**
28
+ * Arbitrary lucide glyph; wins over `name` when both are set.
29
+ *
30
+ * Exactly one of `name` or `glyph` is expected: `glyph` wins when both
31
+ * are set, and neither renders nothing.
32
+ */
33
+ glyph?: IconGlyph;
22
34
  };
23
35
 
24
36
  let {
25
37
  name,
38
+ glyph,
26
39
  size = 18,
27
40
  strokeWidth,
28
41
  title,
@@ -30,7 +43,8 @@
30
43
  ...rest
31
44
  }: IconProps = $props();
32
45
 
33
- const Glyph = $derived(ICONS[name]);
46
+ // `glyph` wins when both are set; neither renders nothing (no `{#if}` body).
47
+ const Glyph = $derived(glyph ?? (name === undefined ? undefined : ICONS[name]));
34
48
  const classes = $derived(["st-icon", className].filter(Boolean).join(" "));
35
49
  // An explicit prop is marked so the token rule below leaves it alone; the
36
50
  // presentation attribute keeps 2.25 when no stylesheet or theme is loaded.
@@ -1,8 +1,6 @@
1
1
  import type { SVGAttributes } from "svelte/elements";
2
- import { type IconName } from "./icons.js";
2
+ import { type IconGlyph, type IconName } from "./icons.js";
3
3
  type IconProps = Omit<SVGAttributes<SVGElement>, "class"> & {
4
- /** Canonical DS icon name (see {@link IconName}). */
5
- name: IconName;
6
4
  /** Square size in px. Default 18 — the DS-standard inline glyph size. */
7
5
  size?: number;
8
6
  /**
@@ -17,6 +15,20 @@ type IconProps = Omit<SVGAttributes<SVGElement>, "class"> & {
17
15
  */
18
16
  title?: string;
19
17
  class?: string;
18
+ /**
19
+ * Canonical DS icon name (see {@link IconName}).
20
+ *
21
+ * Exactly one of `name` or `glyph` is expected: `glyph` wins when both
22
+ * are set, and neither renders nothing.
23
+ */
24
+ name?: IconName;
25
+ /**
26
+ * Arbitrary lucide glyph; wins over `name` when both are set.
27
+ *
28
+ * Exactly one of `name` or `glyph` is expected: `glyph` wins when both
29
+ * are set, and neither renders nothing.
30
+ */
31
+ glyph?: IconGlyph;
20
32
  };
21
33
  declare const Icon: import("svelte").Component<IconProps, {}, "">;
22
34
  type Icon = ReturnType<typeof Icon>;
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.svelte.d.ts","sourceRoot":"","sources":["../src/lib/Icon.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,KAAK,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,GAAG;IAC1D,qDAAqD;IACrD,IAAI,EAAE,QAAQ,CAAC;IACf,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA8BJ,QAAA,MAAM,IAAI,+CAAwC,CAAC;AACnD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,IAA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