@xtyle/svelte 0.5.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 (135) hide show
  1. package/README.md +42 -0
  2. package/dist/Accordion.svelte +50 -0
  3. package/dist/Accordion.svelte.d.ts +22 -0
  4. package/dist/Alert.svelte +55 -0
  5. package/dist/Alert.svelte.d.ts +25 -0
  6. package/dist/AppShell.svelte +69 -0
  7. package/dist/AppShell.svelte.d.ts +27 -0
  8. package/dist/Avatar.svelte +53 -0
  9. package/dist/Avatar.svelte.d.ts +23 -0
  10. package/dist/AvatarGroup.svelte +31 -0
  11. package/dist/AvatarGroup.svelte.d.ts +18 -0
  12. package/dist/Badge.svelte +56 -0
  13. package/dist/Badge.svelte.d.ts +21 -0
  14. package/dist/Bar.svelte +69 -0
  15. package/dist/Bar.svelte.d.ts +30 -0
  16. package/dist/Breadcrumb.svelte +33 -0
  17. package/dist/Breadcrumb.svelte.d.ts +27 -0
  18. package/dist/Button.svelte +74 -0
  19. package/dist/Button.svelte.d.ts +28 -0
  20. package/dist/Card.svelte +26 -0
  21. package/dist/Card.svelte.d.ts +18 -0
  22. package/dist/CardLink.svelte +45 -0
  23. package/dist/CardLink.svelte.d.ts +18 -0
  24. package/dist/Carousel.svelte +39 -0
  25. package/dist/Carousel.svelte.d.ts +16 -0
  26. package/dist/Checkbox.svelte +59 -0
  27. package/dist/Checkbox.svelte.d.ts +21 -0
  28. package/dist/CheckboxGroup.svelte +47 -0
  29. package/dist/CheckboxGroup.svelte.d.ts +20 -0
  30. package/dist/Cluster.svelte +24 -0
  31. package/dist/Cluster.svelte.d.ts +17 -0
  32. package/dist/Code.svelte +29 -0
  33. package/dist/Code.svelte.d.ts +23 -0
  34. package/dist/ColorPicker.svelte +82 -0
  35. package/dist/ColorPicker.svelte.d.ts +26 -0
  36. package/dist/Dialog.svelte +60 -0
  37. package/dist/Dialog.svelte.d.ts +22 -0
  38. package/dist/Dock.svelte +57 -0
  39. package/dist/Dock.svelte.d.ts +23 -0
  40. package/dist/DockZone.svelte +74 -0
  41. package/dist/DockZone.svelte.d.ts +33 -0
  42. package/dist/Eyebrow.svelte +24 -0
  43. package/dist/Eyebrow.svelte.d.ts +17 -0
  44. package/dist/Field.svelte +92 -0
  45. package/dist/Field.svelte.d.ts +34 -0
  46. package/dist/FormGroup.svelte +43 -0
  47. package/dist/FormGroup.svelte.d.ts +18 -0
  48. package/dist/Grid.svelte +24 -0
  49. package/dist/Grid.svelte.d.ts +17 -0
  50. package/dist/Heading.svelte +20 -0
  51. package/dist/Heading.svelte.d.ts +14 -0
  52. package/dist/Heatmap.svelte +100 -0
  53. package/dist/Heatmap.svelte.d.ts +41 -0
  54. package/dist/Hero.svelte +20 -0
  55. package/dist/Hero.svelte.d.ts +13 -0
  56. package/dist/Icon.svelte +20 -0
  57. package/dist/Icon.svelte.d.ts +16 -0
  58. package/dist/Image.svelte +44 -0
  59. package/dist/Image.svelte.d.ts +19 -0
  60. package/dist/Kbd.svelte +21 -0
  61. package/dist/Kbd.svelte.d.ts +14 -0
  62. package/dist/Link.svelte +34 -0
  63. package/dist/Link.svelte.d.ts +18 -0
  64. package/dist/Menu.svelte +34 -0
  65. package/dist/Menu.svelte.d.ts +13 -0
  66. package/dist/NumberInput.svelte +76 -0
  67. package/dist/NumberInput.svelte.d.ts +25 -0
  68. package/dist/Pagination.svelte +56 -0
  69. package/dist/Pagination.svelte.d.ts +22 -0
  70. package/dist/Panel.svelte +52 -0
  71. package/dist/Panel.svelte.d.ts +19 -0
  72. package/dist/Parallax.svelte +19 -0
  73. package/dist/Parallax.svelte.d.ts +13 -0
  74. package/dist/Pie.svelte +48 -0
  75. package/dist/Pie.svelte.d.ts +17 -0
  76. package/dist/Progress.svelte +68 -0
  77. package/dist/Progress.svelte.d.ts +30 -0
  78. package/dist/Radio.svelte +72 -0
  79. package/dist/Radio.svelte.d.ts +24 -0
  80. package/dist/RadioGroup.svelte +39 -0
  81. package/dist/RadioGroup.svelte.d.ts +16 -0
  82. package/dist/Section.svelte +37 -0
  83. package/dist/Section.svelte.d.ts +21 -0
  84. package/dist/Segment.svelte +23 -0
  85. package/dist/Segment.svelte.d.ts +14 -0
  86. package/dist/Segmented.svelte +64 -0
  87. package/dist/Segmented.svelte.d.ts +28 -0
  88. package/dist/Select.svelte +57 -0
  89. package/dist/Select.svelte.d.ts +21 -0
  90. package/dist/Separator.svelte +23 -0
  91. package/dist/Separator.svelte.d.ts +16 -0
  92. package/dist/Skeleton.svelte +19 -0
  93. package/dist/Skeleton.svelte.d.ts +14 -0
  94. package/dist/Slider.svelte +82 -0
  95. package/dist/Slider.svelte.d.ts +24 -0
  96. package/dist/Sparkline.svelte +62 -0
  97. package/dist/Sparkline.svelte.d.ts +25 -0
  98. package/dist/Spinner.svelte +16 -0
  99. package/dist/Spinner.svelte.d.ts +12 -0
  100. package/dist/Splitter.svelte +85 -0
  101. package/dist/Splitter.svelte.d.ts +30 -0
  102. package/dist/Stack.svelte +23 -0
  103. package/dist/Stack.svelte.d.ts +16 -0
  104. package/dist/Stat.svelte +41 -0
  105. package/dist/Stat.svelte.d.ts +23 -0
  106. package/dist/Statusbar.svelte +50 -0
  107. package/dist/Statusbar.svelte.d.ts +20 -0
  108. package/dist/Swatch.svelte +48 -0
  109. package/dist/Swatch.svelte.d.ts +22 -0
  110. package/dist/Switch.svelte +69 -0
  111. package/dist/Switch.svelte.d.ts +24 -0
  112. package/dist/Table.svelte +39 -0
  113. package/dist/Table.svelte.d.ts +17 -0
  114. package/dist/Tabs.svelte +84 -0
  115. package/dist/Tabs.svelte.d.ts +28 -0
  116. package/dist/Text.svelte +38 -0
  117. package/dist/Text.svelte.d.ts +22 -0
  118. package/dist/Textarea.svelte +74 -0
  119. package/dist/Textarea.svelte.d.ts +25 -0
  120. package/dist/Toast.svelte +55 -0
  121. package/dist/Toast.svelte.d.ts +25 -0
  122. package/dist/Toc.svelte +22 -0
  123. package/dist/Toc.svelte.d.ts +15 -0
  124. package/dist/Toolbar.svelte +49 -0
  125. package/dist/Toolbar.svelte.d.ts +20 -0
  126. package/dist/Tooltip.svelte +28 -0
  127. package/dist/Tooltip.svelte.d.ts +19 -0
  128. package/dist/Tree.svelte +51 -0
  129. package/dist/Tree.svelte.d.ts +24 -0
  130. package/dist/elements.d.ts +65 -0
  131. package/dist/index.d.ts +65 -0
  132. package/dist/index.js +65 -0
  133. package/dist/register.d.ts +2 -0
  134. package/dist/register.js +2 -0
  135. package/package.json +41 -0
@@ -0,0 +1,84 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+ import type { Size } from "@xtyle/core";
5
+ import type { TabItemData, TabsVariant, TabsActivation } from "@xtyle/core/markup";
6
+
7
+ interface Props {
8
+ items?: TabItemData[];
9
+ variant?: TabsVariant;
10
+ size?: Size;
11
+ activation?: TabsActivation;
12
+ value?: string;
13
+ label?: string;
14
+ labelledby?: string;
15
+ sticky?: boolean;
16
+ /** Mount a panel's content only once its tab is first shown, then keep it mounted. Off by default
17
+ * (every panel renders up front). Reach for it when panels are heavy (an editor, a chart) or must
18
+ * lay out only while visible; the tab strip, roving focus, and a11y are unchanged either way. */
19
+ lazy?: boolean;
20
+ onchange?: (value: string) => void;
21
+ /** The content for the active tab. Omit it for a headless tablist: the element drives `value`,
22
+ * roving focus, and a11y as a bare tab strip while you render the content yourself (so a
23
+ * persistent sidebar can live outside the panel region and keep its own state across switches). */
24
+ panel?: Snippet<[string]>;
25
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
26
+ [key: string]: unknown;
27
+ }
28
+
29
+ let {
30
+ items = [],
31
+ variant = "underline",
32
+ size = "md",
33
+ activation = "automatic",
34
+ value = $bindable(),
35
+ label,
36
+ labelledby,
37
+ sticky = false,
38
+ lazy = false,
39
+ onchange,
40
+ panel,
41
+ ...rest
42
+ }: Props = $props();
43
+
44
+ const headless = $derived(!panel);
45
+ // Fall back to the first *enabled* tab, matching the element's own default selection.
46
+ const activeKey = $derived(value ?? items.find((t) => !t.disabled)?.value ?? items[0]?.value ?? "0");
47
+ // Keep-alive of shown panels. Must reassign the array: mutating a `$state` Set/array in place
48
+ // doesn't re-run Svelte 5's template dependents.
49
+ let shownKeys = $state<string[]>([]);
50
+ $effect(() => {
51
+ if (lazy && !shownKeys.includes(activeKey)) shownKeys = [...shownKeys, activeKey];
52
+ });
53
+
54
+ function handleChange(event: Event) {
55
+ // `xtyle-tabs` dispatches `change` with `composed: true`, so a nested Tabs' change
56
+ // bubbles up to an outer one. Only act on changes from this element, not descendants.
57
+ if (event.target !== event.currentTarget) return;
58
+ const next = (event as CustomEvent<{ value: string }>).detail?.value;
59
+ if (next === undefined) return;
60
+ value = next;
61
+ onchange?.(next);
62
+ }
63
+ </script>
64
+
65
+ <xtyle-tabs
66
+ {...rest}
67
+ {variant}
68
+ {size}
69
+ {activation}
70
+ {value}
71
+ {label}
72
+ sticky={sticky || undefined}
73
+ tablist={headless || undefined}
74
+ labelledby={labelledby || undefined}
75
+ onchange={handleChange}
76
+ >
77
+ {#each items as tab, i (tab.value ?? i)}
78
+ {@const key = tab.value ?? String(i)}
79
+ <span slot="tab" value={key} disabled={tab.disabled || undefined}>{tab.label}</span>
80
+ {#if !headless}
81
+ <div slot="panel">{#if !lazy || shownKeys.includes(key)}{@render panel?.(key)}{/if}</div>
82
+ {/if}
83
+ {/each}
84
+ </xtyle-tabs>
@@ -0,0 +1,28 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ import type { Size } from "@xtyle/core";
4
+ import type { TabItemData, TabsVariant, TabsActivation } from "@xtyle/core/markup";
5
+ interface Props {
6
+ items?: TabItemData[];
7
+ variant?: TabsVariant;
8
+ size?: Size;
9
+ activation?: TabsActivation;
10
+ value?: string;
11
+ label?: string;
12
+ labelledby?: string;
13
+ sticky?: boolean;
14
+ /** Mount a panel's content only once its tab is first shown, then keep it mounted. Off by default
15
+ * (every panel renders up front). Reach for it when panels are heavy (an editor, a chart) or must
16
+ * lay out only while visible; the tab strip, roving focus, and a11y are unchanged either way. */
17
+ lazy?: boolean;
18
+ onchange?: (value: string) => void;
19
+ /** The content for the active tab. Omit it for a headless tablist: the element drives `value`,
20
+ * roving focus, and a11y as a bare tab strip while you render the content yourself (so a
21
+ * persistent sidebar can live outside the panel region and keep its own state across switches). */
22
+ panel?: Snippet<[string]>;
23
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
24
+ [key: string]: unknown;
25
+ }
26
+ declare const Tabs: import("svelte").Component<Props, {}, "value">;
27
+ type Tabs = ReturnType<typeof Tabs>;
28
+ export default Tabs;
@@ -0,0 +1,38 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+ import type { FullTone } from "@xtyle/core";
5
+
6
+ type TextAs = "p" | "span";
7
+ type TextSize = "xs" | "sm" | "body" | "lg";
8
+ type TextWeight = "normal" | "medium" | "semibold" | "bold";
9
+ type TextLeading = "tight" | "snug" | "loose";
10
+ type TextTone = "default" | "muted" | "subtle" | FullTone;
11
+
12
+ interface Props {
13
+ as?: TextAs;
14
+ size?: TextSize;
15
+ weight?: TextWeight;
16
+ leading?: TextLeading;
17
+ tone?: TextTone;
18
+ mono?: boolean;
19
+ children?: Snippet;
20
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
21
+ [key: string]: unknown;
22
+ }
23
+
24
+ let {
25
+ as = "p",
26
+ size = "body",
27
+ weight = "normal",
28
+ leading = "snug",
29
+ tone = "default",
30
+ mono = false,
31
+ children,
32
+ ...rest
33
+ }: Props = $props();
34
+ </script>
35
+
36
+ <xtyle-text {...rest} {as} {size} {weight} {leading} {tone} mono={mono || undefined}>
37
+ {@render children?.()}
38
+ </xtyle-text>
@@ -0,0 +1,22 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ import type { FullTone } from "@xtyle/core";
4
+ type TextAs = "p" | "span";
5
+ type TextSize = "xs" | "sm" | "body" | "lg";
6
+ type TextWeight = "normal" | "medium" | "semibold" | "bold";
7
+ type TextLeading = "tight" | "snug" | "loose";
8
+ type TextTone = "default" | "muted" | "subtle" | FullTone;
9
+ interface Props {
10
+ as?: TextAs;
11
+ size?: TextSize;
12
+ weight?: TextWeight;
13
+ leading?: TextLeading;
14
+ tone?: TextTone;
15
+ mono?: boolean;
16
+ children?: Snippet;
17
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
18
+ [key: string]: unknown;
19
+ }
20
+ declare const Text: import("svelte").Component<Props, {}, "">;
21
+ type Text = ReturnType<typeof Text>;
22
+ export default Text;
@@ -0,0 +1,74 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Size } from "@xtyle/core";
4
+
5
+ type TextareaResize = "none" | "vertical" | "horizontal" | "both";
6
+
7
+ interface Props {
8
+ label?: string;
9
+ value?: string;
10
+ rows?: number;
11
+ resize?: TextareaResize;
12
+ placeholder?: string;
13
+ size?: Size;
14
+ name?: string;
15
+ disabled?: boolean;
16
+ invalid?: boolean;
17
+ required?: boolean;
18
+ error?: string;
19
+ ariaLabel?: string;
20
+ mono?: boolean;
21
+ onchange?: (event: Event) => void;
22
+ oninput?: (event: Event) => void;
23
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
24
+ [key: string]: unknown;
25
+ }
26
+
27
+ let {
28
+ label = "",
29
+ value = $bindable(""),
30
+ rows = 3,
31
+ resize = "vertical",
32
+ placeholder,
33
+ size = "md",
34
+ name,
35
+ disabled = false,
36
+ invalid = false,
37
+ required = false,
38
+ error = "",
39
+ ariaLabel,
40
+ mono = false,
41
+ onchange,
42
+ oninput,
43
+ ...rest
44
+ }: Props = $props();
45
+
46
+ function handleInput(event: Event) {
47
+ value = (event.target as HTMLElement & { value: string }).value;
48
+ oninput?.(event);
49
+ }
50
+
51
+ function handleChange(event: Event) {
52
+ value = (event.target as HTMLElement & { value: string }).value;
53
+ onchange?.(event);
54
+ }
55
+ </script>
56
+
57
+ <xtyle-textarea
58
+ {...rest}
59
+ {label}
60
+ {value}
61
+ rows={rows}
62
+ {resize}
63
+ {placeholder}
64
+ {size}
65
+ {name}
66
+ disabled={disabled || undefined}
67
+ invalid={invalid || undefined}
68
+ required={required || undefined}
69
+ mono={mono || undefined}
70
+ {error}
71
+ aria-label={ariaLabel ?? (rest["aria-label"] as string | undefined)}
72
+ oninput={handleInput}
73
+ onchange={handleChange}
74
+ ></xtyle-textarea>
@@ -0,0 +1,25 @@
1
+ import "./register.js";
2
+ import type { Size } from "@xtyle/core";
3
+ type TextareaResize = "none" | "vertical" | "horizontal" | "both";
4
+ interface Props {
5
+ label?: string;
6
+ value?: string;
7
+ rows?: number;
8
+ resize?: TextareaResize;
9
+ placeholder?: string;
10
+ size?: Size;
11
+ name?: string;
12
+ disabled?: boolean;
13
+ invalid?: boolean;
14
+ required?: boolean;
15
+ error?: string;
16
+ ariaLabel?: string;
17
+ mono?: boolean;
18
+ onchange?: (event: Event) => void;
19
+ oninput?: (event: Event) => void;
20
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
21
+ [key: string]: unknown;
22
+ }
23
+ declare const Textarea: import("svelte").Component<Props, {}, "value">;
24
+ type Textarea = ReturnType<typeof Textarea>;
25
+ export default Textarea;
@@ -0,0 +1,55 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+ import type { FullTone } from "@xtyle/core";
5
+ type ToastSeverity = "success" | "warn" | "danger" | "info";
6
+
7
+ type ToastVariant = "soft" | "solid";
8
+
9
+ interface Props {
10
+ /** Color — any semantic role, accent variant, or named hue. Defaults to the severity color. */
11
+ tone?: FullTone;
12
+ /** Meaning — drives the glyph + politeness, independent of color. Omit for a color-only toast. */
13
+ severity?: ToastSeverity;
14
+ variant?: ToastVariant;
15
+ closable?: boolean;
16
+ closeLabel?: string;
17
+ actionLabel?: string;
18
+ ondismiss?: (event: Event) => void;
19
+ onaction?: (event: Event) => void;
20
+ /** Overrides the built-in severity glyph. */
21
+ icon?: Snippet;
22
+ children?: Snippet;
23
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
24
+ [key: string]: unknown;
25
+ }
26
+
27
+ let {
28
+ tone,
29
+ severity,
30
+ variant = "soft",
31
+ closable = true,
32
+ closeLabel,
33
+ actionLabel,
34
+ ondismiss,
35
+ onaction,
36
+ icon,
37
+ children,
38
+ ...rest
39
+ }: Props = $props();
40
+ </script>
41
+
42
+ <xtyle-toast
43
+ {...rest}
44
+ {tone}
45
+ {severity}
46
+ {variant}
47
+ closable={closable || undefined}
48
+ close-label={closeLabel}
49
+ action-label={actionLabel}
50
+ {ondismiss}
51
+ {onaction}
52
+ >
53
+ {#if icon}<span slot="icon">{@render icon()}</span>{/if}
54
+ {@render children?.()}
55
+ </xtyle-toast>
@@ -0,0 +1,25 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ import type { FullTone } from "@xtyle/core";
4
+ type ToastSeverity = "success" | "warn" | "danger" | "info";
5
+ type ToastVariant = "soft" | "solid";
6
+ interface Props {
7
+ /** Color — any semantic role, accent variant, or named hue. Defaults to the severity color. */
8
+ tone?: FullTone;
9
+ /** Meaning — drives the glyph + politeness, independent of color. Omit for a color-only toast. */
10
+ severity?: ToastSeverity;
11
+ variant?: ToastVariant;
12
+ closable?: boolean;
13
+ closeLabel?: string;
14
+ actionLabel?: string;
15
+ ondismiss?: (event: Event) => void;
16
+ onaction?: (event: Event) => void;
17
+ /** Overrides the built-in severity glyph. */
18
+ icon?: Snippet;
19
+ children?: Snippet;
20
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
21
+ [key: string]: unknown;
22
+ }
23
+ declare const Toast: import("svelte").Component<Props, {}, "">;
24
+ type Toast = ReturnType<typeof Toast>;
25
+ export default Toast;
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+
4
+ interface TocItem {
5
+ id: string;
6
+ label: string;
7
+ }
8
+
9
+ interface Props {
10
+ items?: TocItem[];
11
+ label?: string;
12
+ sticky?: boolean;
13
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
14
+ [key: string]: unknown;
15
+ }
16
+
17
+ let { items = [], label = "On this page", sticky = false, ...rest }: Props = $props();
18
+
19
+ const itemsJson = $derived(JSON.stringify(items));
20
+ </script>
21
+
22
+ <xtyle-toc {...rest} items={itemsJson} {label} sticky={sticky || undefined}></xtyle-toc>
@@ -0,0 +1,15 @@
1
+ import "./register.js";
2
+ interface TocItem {
3
+ id: string;
4
+ label: string;
5
+ }
6
+ interface Props {
7
+ items?: TocItem[];
8
+ label?: string;
9
+ sticky?: boolean;
10
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
11
+ [key: string]: unknown;
12
+ }
13
+ declare const Toc: import("svelte").Component<Props, {}, "">;
14
+ type Toc = ReturnType<typeof Toc>;
15
+ export default Toc;
@@ -0,0 +1,49 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+ import type { Size } from "@xtyle/core";
5
+
6
+ interface Props {
7
+ heading?: string;
8
+ href?: string;
9
+ size?: Size;
10
+ landmark?: boolean;
11
+ sticky?: boolean;
12
+ bare?: boolean;
13
+ start?: Snippet;
14
+ center?: Snippet;
15
+ end?: Snippet;
16
+ children?: Snippet;
17
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
18
+ [key: string]: unknown;
19
+ }
20
+
21
+ let {
22
+ heading,
23
+ href,
24
+ size = "md",
25
+ landmark = false,
26
+ sticky = false,
27
+ bare = false,
28
+ start,
29
+ center,
30
+ end,
31
+ children,
32
+ ...rest
33
+ }: Props = $props();
34
+ </script>
35
+
36
+ <xtyle-toolbar
37
+ {...rest}
38
+ {heading}
39
+ {href}
40
+ {size}
41
+ landmark={landmark || undefined}
42
+ sticky={sticky || undefined}
43
+ bare={bare || undefined}
44
+ >
45
+ {#if start}<span slot="start">{@render start()}</span>{/if}
46
+ {@render children?.()}
47
+ {#if center}<span slot="center">{@render center()}</span>{/if}
48
+ {#if end}<span slot="end">{@render end()}</span>{/if}
49
+ </xtyle-toolbar>
@@ -0,0 +1,20 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ import type { Size } from "@xtyle/core";
4
+ interface Props {
5
+ heading?: string;
6
+ href?: string;
7
+ size?: Size;
8
+ landmark?: boolean;
9
+ sticky?: boolean;
10
+ bare?: boolean;
11
+ start?: Snippet;
12
+ center?: Snippet;
13
+ end?: Snippet;
14
+ children?: Snippet;
15
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
16
+ [key: string]: unknown;
17
+ }
18
+ declare const Toolbar: import("svelte").Component<Props, {}, "">;
19
+ type Toolbar = ReturnType<typeof Toolbar>;
20
+ export default Toolbar;
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Snippet } from "svelte";
4
+
5
+ type Placement = "top" | "bottom" | "left" | "right";
6
+
7
+ interface Props {
8
+ text?: string;
9
+ placement?: Placement;
10
+ open?: boolean;
11
+ tone?: string;
12
+ variant?: "soft" | "solid";
13
+ mode?: "hint" | "rich";
14
+ size?: "sm" | "md";
15
+ children?: Snippet;
16
+ content?: Snippet;
17
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
18
+ [key: string]: unknown;
19
+ }
20
+
21
+ let { text, placement = "top", open = $bindable(false), tone, variant, mode, size, content, children, ...rest }: Props =
22
+ $props();
23
+ </script>
24
+
25
+ <xtyle-tooltip {...rest} {text} {placement} open={open || undefined} {tone} {variant} {mode} {size}>
26
+ {@render children?.()}
27
+ {#if content}<span slot="content">{@render content()}</span>{/if}
28
+ </xtyle-tooltip>
@@ -0,0 +1,19 @@
1
+ import "./register.js";
2
+ import type { Snippet } from "svelte";
3
+ type Placement = "top" | "bottom" | "left" | "right";
4
+ interface Props {
5
+ text?: string;
6
+ placement?: Placement;
7
+ open?: boolean;
8
+ tone?: string;
9
+ variant?: "soft" | "solid";
10
+ mode?: "hint" | "rich";
11
+ size?: "sm" | "md";
12
+ children?: Snippet;
13
+ content?: Snippet;
14
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
15
+ [key: string]: unknown;
16
+ }
17
+ declare const Tooltip: import("svelte").Component<Props, {}, "open">;
18
+ type Tooltip = ReturnType<typeof Tooltip>;
19
+ export default Tooltip;
@@ -0,0 +1,51 @@
1
+ <script lang="ts">
2
+ import "./register.js";
3
+ import type { Size } from "@xtyle/core";
4
+
5
+ interface TreeNode {
6
+ label: string;
7
+ value?: string;
8
+ href?: string;
9
+ expanded?: boolean;
10
+ selected?: boolean;
11
+ disabled?: boolean;
12
+ children?: TreeNode[];
13
+ }
14
+
15
+ interface Props {
16
+ items?: TreeNode[];
17
+ size?: Size;
18
+ label?: string;
19
+ labelledby?: string;
20
+ onselect?: (event: Event) => void;
21
+ ontoggle?: (event: Event) => void;
22
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
23
+ [key: string]: unknown;
24
+ }
25
+
26
+ let {
27
+ items = [],
28
+ size = "md",
29
+ label,
30
+ labelledby,
31
+ onselect,
32
+ ontoggle,
33
+ ...rest
34
+ }: Props = $props();
35
+
36
+ let el: (HTMLElement & { items?: TreeNode[] }) | undefined = $state();
37
+
38
+ $effect(() => {
39
+ if (el) el.items = items;
40
+ });
41
+ </script>
42
+
43
+ <xtyle-tree
44
+ {...rest}
45
+ bind:this={el}
46
+ {size}
47
+ {label}
48
+ labelledby={labelledby || undefined}
49
+ {onselect}
50
+ {ontoggle}
51
+ ></xtyle-tree>
@@ -0,0 +1,24 @@
1
+ import "./register.js";
2
+ import type { Size } from "@xtyle/core";
3
+ interface TreeNode {
4
+ label: string;
5
+ value?: string;
6
+ href?: string;
7
+ expanded?: boolean;
8
+ selected?: boolean;
9
+ disabled?: boolean;
10
+ children?: TreeNode[];
11
+ }
12
+ interface Props {
13
+ items?: TreeNode[];
14
+ size?: Size;
15
+ label?: string;
16
+ labelledby?: string;
17
+ onselect?: (event: Event) => void;
18
+ ontoggle?: (event: Event) => void;
19
+ /** Any other attribute (`title`, `id`, `data-*`, `aria-*`, …) passes through to the element. */
20
+ [key: string]: unknown;
21
+ }
22
+ declare const Tree: import("svelte").Component<Props, {}, "">;
23
+ type Tree = ReturnType<typeof Tree>;
24
+ export default Tree;
@@ -0,0 +1,65 @@
1
+ import type { HTMLAttributes } from "svelte/elements";
2
+
3
+ type XtyleAttributes<T extends EventTarget = HTMLElement> = HTMLAttributes<T>;
4
+
5
+ interface XtyleButtonAttributes extends XtyleAttributes {
6
+ variant?: "accent" | "neutral" | "danger";
7
+ size?: "sm" | "md" | "lg";
8
+ type?: "button" | "submit" | "reset";
9
+ disabled?: boolean;
10
+ }
11
+
12
+ interface XtyleFieldAttributes extends XtyleAttributes {
13
+ label?: string;
14
+ placeholder?: string;
15
+ value?: string;
16
+ type?: string;
17
+ disabled?: boolean;
18
+ invalid?: boolean;
19
+ required?: boolean;
20
+ error?: string;
21
+ }
22
+
23
+ interface XtyleCardAttributes extends XtyleAttributes {
24
+ overlay?: boolean;
25
+ }
26
+
27
+ interface XtyleBadgeAttributes extends XtyleAttributes {
28
+ tone?: string;
29
+ }
30
+
31
+ interface XtyleSwitchAttributes extends XtyleAttributes {
32
+ checked?: boolean;
33
+ disabled?: boolean;
34
+ label?: string;
35
+ labelledby?: string;
36
+ }
37
+
38
+ interface XtyleAlertAttributes extends XtyleAttributes {
39
+ tone?: "success" | "warn" | "danger" | "info";
40
+ }
41
+
42
+ interface XtyleLinkAttributes extends XtyleAttributes {
43
+ href?: string;
44
+ target?: string;
45
+ rel?: string;
46
+ }
47
+
48
+ interface XtyleCodeAttributes extends XtyleAttributes {
49
+ lang?: string;
50
+ code?: string;
51
+ preload?: boolean;
52
+ }
53
+
54
+ declare module "svelte/elements" {
55
+ interface SvelteHTMLElements {
56
+ "xtyle-button": XtyleButtonAttributes;
57
+ "xtyle-field": XtyleFieldAttributes;
58
+ "xtyle-card": XtyleCardAttributes;
59
+ "xtyle-badge": XtyleBadgeAttributes;
60
+ "xtyle-switch": XtyleSwitchAttributes;
61
+ "xtyle-alert": XtyleAlertAttributes;
62
+ "xtyle-link": XtyleLinkAttributes;
63
+ "xtyle-code": XtyleCodeAttributes;
64
+ }
65
+ }