@ternkit/tern 1.2.1 → 1.4.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 (170) hide show
  1. package/dist/goscript/index.svelte.d.ts +32 -2
  2. package/dist/goscript/index.svelte.js +257 -31
  3. package/dist/goscript/patch.d.ts +6 -0
  4. package/dist/goscript/patch.js +25 -0
  5. package/dist/index.d.ts +2 -1
  6. package/dist/index.js +2 -1
  7. package/dist/runtime/validate.d.ts +31 -0
  8. package/dist/runtime/validate.js +168 -0
  9. package/dist/server/intl.js +55 -12
  10. package/dist/ui/Accordion.svelte +84 -0
  11. package/dist/ui/Accordion.svelte.d.ts +20 -0
  12. package/dist/ui/Alert.svelte +76 -0
  13. package/dist/ui/Alert.svelte.d.ts +12 -0
  14. package/dist/ui/AlertDialog.svelte +79 -0
  15. package/dist/ui/AlertDialog.svelte.d.ts +24 -0
  16. package/dist/ui/AreaChart.svelte +9 -0
  17. package/dist/ui/AreaChart.svelte.d.ts +26 -0
  18. package/dist/ui/AspectRatio.svelte +33 -0
  19. package/dist/ui/AspectRatio.svelte.d.ts +10 -0
  20. package/dist/ui/Avatar.svelte +48 -0
  21. package/dist/ui/Avatar.svelte.d.ts +10 -0
  22. package/dist/ui/Badge.svelte +54 -0
  23. package/dist/ui/Badge.svelte.d.ts +10 -0
  24. package/dist/ui/BarChart.svelte +170 -0
  25. package/dist/ui/BarChart.svelte.d.ts +40 -0
  26. package/dist/ui/Breadcrumb.svelte +92 -0
  27. package/dist/ui/Breadcrumb.svelte.d.ts +14 -0
  28. package/dist/ui/Button.svelte +136 -0
  29. package/dist/ui/Button.svelte.d.ts +18 -0
  30. package/dist/ui/ButtonGroup.svelte +61 -0
  31. package/dist/ui/ButtonGroup.svelte.d.ts +12 -0
  32. package/dist/ui/Calendar.svelte +265 -0
  33. package/dist/ui/Calendar.svelte.d.ts +28 -0
  34. package/dist/ui/Card.svelte +74 -0
  35. package/dist/ui/Card.svelte.d.ts +18 -0
  36. package/dist/ui/Carousel.svelte +169 -0
  37. package/dist/ui/Carousel.svelte.d.ts +36 -0
  38. package/dist/ui/ChartFrame.svelte +174 -0
  39. package/dist/ui/ChartFrame.svelte.d.ts +24 -0
  40. package/dist/ui/Checkbox.svelte +112 -0
  41. package/dist/ui/Checkbox.svelte.d.ts +14 -0
  42. package/dist/ui/Collapsible.svelte +59 -0
  43. package/dist/ui/Collapsible.svelte.d.ts +12 -0
  44. package/dist/ui/Combobox.svelte +350 -0
  45. package/dist/ui/Combobox.svelte.d.ts +24 -0
  46. package/dist/ui/Command.svelte +268 -0
  47. package/dist/ui/Command.svelte.d.ts +28 -0
  48. package/dist/ui/ConsentScreen.svelte +125 -0
  49. package/dist/ui/ConsentScreen.svelte.d.ts +21 -0
  50. package/dist/ui/ContextMenu.svelte +78 -0
  51. package/dist/ui/ContextMenu.svelte.d.ts +13 -0
  52. package/dist/ui/DataTable.svelte +277 -0
  53. package/dist/ui/DataTable.svelte.d.ts +53 -0
  54. package/dist/ui/DatePicker.svelte +138 -0
  55. package/dist/ui/DatePicker.svelte.d.ts +25 -0
  56. package/dist/ui/Dialog.svelte +301 -0
  57. package/dist/ui/Dialog.svelte.d.ts +30 -0
  58. package/dist/ui/DonutChart.svelte +115 -0
  59. package/dist/ui/DonutChart.svelte.d.ts +40 -0
  60. package/dist/ui/Drawer.svelte +19 -0
  61. package/dist/ui/Drawer.svelte.d.ts +14 -0
  62. package/dist/ui/Empty.svelte +62 -0
  63. package/dist/ui/Empty.svelte.d.ts +15 -0
  64. package/dist/ui/Field.svelte +97 -0
  65. package/dist/ui/Field.svelte.d.ts +19 -0
  66. package/dist/ui/Form.svelte +159 -0
  67. package/dist/ui/Form.svelte.d.ts +21 -0
  68. package/dist/ui/HoverCard.svelte +106 -0
  69. package/dist/ui/HoverCard.svelte.d.ts +26 -0
  70. package/dist/ui/Input.svelte +62 -0
  71. package/dist/ui/Input.svelte.d.ts +7 -0
  72. package/dist/ui/InputGroup.svelte +80 -0
  73. package/dist/ui/InputGroup.svelte.d.ts +13 -0
  74. package/dist/ui/InputOTP.svelte +140 -0
  75. package/dist/ui/InputOTP.svelte.d.ts +18 -0
  76. package/dist/ui/Item.svelte +86 -0
  77. package/dist/ui/Item.svelte.d.ts +17 -0
  78. package/dist/ui/Kbd.svelte +24 -0
  79. package/dist/ui/Kbd.svelte.d.ts +7 -0
  80. package/dist/ui/Label.svelte +29 -0
  81. package/dist/ui/Label.svelte.d.ts +10 -0
  82. package/dist/ui/LineChart.svelte +171 -0
  83. package/dist/ui/LineChart.svelte.d.ts +42 -0
  84. package/dist/ui/Menu.svelte +103 -0
  85. package/dist/ui/Menu.svelte.d.ts +15 -0
  86. package/dist/ui/MenuList.svelte +317 -0
  87. package/dist/ui/MenuList.svelte.d.ts +29 -0
  88. package/dist/ui/Menubar.svelte +133 -0
  89. package/dist/ui/Menubar.svelte.d.ts +14 -0
  90. package/dist/ui/NavigationMenu.svelte +208 -0
  91. package/dist/ui/NavigationMenu.svelte.d.ts +18 -0
  92. package/dist/ui/Pagination.svelte +114 -0
  93. package/dist/ui/Pagination.svelte.d.ts +16 -0
  94. package/dist/ui/PasswordInput.svelte +134 -0
  95. package/dist/ui/PasswordInput.svelte.d.ts +11 -0
  96. package/dist/ui/Popover.svelte +127 -0
  97. package/dist/ui/Popover.svelte.d.ts +29 -0
  98. package/dist/ui/Progress.svelte +73 -0
  99. package/dist/ui/Progress.svelte.d.ts +12 -0
  100. package/dist/ui/RadioGroup.svelte +105 -0
  101. package/dist/ui/RadioGroup.svelte.d.ts +21 -0
  102. package/dist/ui/Resizable.svelte +122 -0
  103. package/dist/ui/Resizable.svelte.d.ts +16 -0
  104. package/dist/ui/ScrollArea.svelte +43 -0
  105. package/dist/ui/ScrollArea.svelte.d.ts +13 -0
  106. package/dist/ui/Select.svelte +77 -0
  107. package/dist/ui/Select.svelte.d.ts +18 -0
  108. package/dist/ui/SelectMenu.svelte +301 -0
  109. package/dist/ui/SelectMenu.svelte.d.ts +18 -0
  110. package/dist/ui/Separator.svelte +19 -0
  111. package/dist/ui/Separator.svelte.d.ts +7 -0
  112. package/dist/ui/Sheet.svelte +21 -0
  113. package/dist/ui/Sheet.svelte.d.ts +16 -0
  114. package/dist/ui/Sidebar.svelte +263 -0
  115. package/dist/ui/Sidebar.svelte.d.ts +35 -0
  116. package/dist/ui/SignIn.svelte +182 -0
  117. package/dist/ui/SignIn.svelte.d.ts +38 -0
  118. package/dist/ui/SignUp.svelte +106 -0
  119. package/dist/ui/SignUp.svelte.d.ts +23 -0
  120. package/dist/ui/Skeleton.svelte +29 -0
  121. package/dist/ui/Skeleton.svelte.d.ts +9 -0
  122. package/dist/ui/Slider.svelte +196 -0
  123. package/dist/ui/Slider.svelte.d.ts +19 -0
  124. package/dist/ui/Sparkline.svelte +23 -0
  125. package/dist/ui/Sparkline.svelte.d.ts +11 -0
  126. package/dist/ui/Spinner.svelte +42 -0
  127. package/dist/ui/Spinner.svelte.d.ts +8 -0
  128. package/dist/ui/Stat.svelte +91 -0
  129. package/dist/ui/Stat.svelte.d.ts +18 -0
  130. package/dist/ui/Switch.svelte +90 -0
  131. package/dist/ui/Switch.svelte.d.ts +12 -0
  132. package/dist/ui/Table.svelte +70 -0
  133. package/dist/ui/Table.svelte.d.ts +36 -0
  134. package/dist/ui/Tabs.svelte +112 -0
  135. package/dist/ui/Tabs.svelte.d.ts +19 -0
  136. package/dist/ui/Textarea.svelte +52 -0
  137. package/dist/ui/Textarea.svelte.d.ts +7 -0
  138. package/dist/ui/Toaster.svelte +146 -0
  139. package/dist/ui/Toaster.svelte.d.ts +6 -0
  140. package/dist/ui/Toggle.svelte +82 -0
  141. package/dist/ui/Toggle.svelte.d.ts +17 -0
  142. package/dist/ui/ToggleGroup.svelte +143 -0
  143. package/dist/ui/ToggleGroup.svelte.d.ts +27 -0
  144. package/dist/ui/Tooltip.svelte +85 -0
  145. package/dist/ui/Tooltip.svelte.d.ts +16 -0
  146. package/dist/ui/chart.d.ts +26 -0
  147. package/dist/ui/chart.js +89 -0
  148. package/dist/ui/dates.d.ts +13 -0
  149. package/dist/ui/dates.js +64 -0
  150. package/dist/ui/field.d.ts +18 -0
  151. package/dist/ui/field.js +8 -0
  152. package/dist/ui/floating.d.ts +44 -0
  153. package/dist/ui/floating.js +97 -0
  154. package/dist/ui/form.d.ts +12 -0
  155. package/dist/ui/form.js +8 -0
  156. package/dist/ui/index.d.ts +78 -0
  157. package/dist/ui/index.js +70 -0
  158. package/dist/ui/menu.d.ts +25 -0
  159. package/dist/ui/menu.js +1 -0
  160. package/dist/ui/options.d.ts +17 -0
  161. package/dist/ui/options.js +22 -0
  162. package/dist/ui/table.d.ts +26 -0
  163. package/dist/ui/table.js +1 -0
  164. package/dist/ui/theme.css +176 -0
  165. package/dist/ui/toast.svelte.d.ts +19 -0
  166. package/dist/ui/toast.svelte.js +18 -0
  167. package/dist/vite/goscript.d.ts +14 -0
  168. package/dist/vite/goscript.js +45 -16
  169. package/dist/vite/index.js +15 -4
  170. package/package.json +7 -1
@@ -0,0 +1,174 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import Collapsible from './Collapsible.svelte';
4
+ import ScrollArea from './ScrollArea.svelte';
5
+
6
+ type Props = {
7
+ title: string;
8
+ description?: string;
9
+ /** The heading level, to fit the page's outline. */
10
+ level?: 2 | 3 | 4;
11
+ legend: { label: string; color: string; kind: 'line' | 'rect' }[];
12
+ /** The table view: every value, reachable without hovering. */
13
+ table: { headers: string[]; rows: string[][] };
14
+ /** What the live readout says for the focused point, for keyboard and screen reader users. */
15
+ readout: string;
16
+ children: Snippet;
17
+ class?: string;
18
+ };
19
+ let { title, description, level = 3, legend, table, readout, children, class: klass = '' }: Props = $props();
20
+ const uid = $props.id();
21
+ </script>
22
+
23
+ <figure class="tern-chart {klass}" aria-labelledby="tern-chart-{uid}-title">
24
+ <figcaption>
25
+ <svelte:element this={`h${level}`} class="title" id="tern-chart-{uid}-title">{title}</svelte:element>
26
+ {#if description}<p class="description">{description}</p>{/if}
27
+ </figcaption>
28
+ {#if legend.length >= 2}
29
+ <ul class="legend" aria-label="Legend">
30
+ {#each legend as item (item.label)}
31
+ <li><span class="key {item.kind}" style:background={item.color} aria-hidden="true"></span>{item.label}</li>
32
+ {/each}
33
+ </ul>
34
+ {/if}
35
+ {@render children()}
36
+ <p class="tern-sr-only" aria-live="polite">{readout}</p>
37
+ <Collapsible label="Show data">
38
+ <ScrollArea label="{title} data" maxHeight="16rem" class="table">
39
+ <table class="tern-table">
40
+ <caption class="tern-sr-only">{title}</caption>
41
+ <thead><tr>{#each table.headers as h, i (i)}<th scope="col" style:text-align={i ? 'end' : undefined}>{h}</th>{/each}</tr></thead>
42
+ <tbody>
43
+ {#each table.rows as row, r (r)}
44
+ <tr>{#each row as cell, i (i)}{#if i === 0}<th scope="row">{cell}</th>{:else}<td style:text-align="end">{cell}</td>{/if}{/each}</tr>
45
+ {/each}
46
+ </tbody>
47
+ </table>
48
+ </ScrollArea>
49
+ </Collapsible>
50
+ </figure>
51
+
52
+ <style>
53
+ .tern-chart {
54
+ display: grid;
55
+ grid-template-columns: minmax(0, 1fr);
56
+ gap: 0.5rem;
57
+ min-width: 0;
58
+ margin: 0;
59
+ color: var(--tern-fg);
60
+ }
61
+ .title {
62
+ margin: 0;
63
+ font-size: 0.9375rem;
64
+ font-weight: 600;
65
+ }
66
+ .description {
67
+ margin: 0.15rem 0 0;
68
+ font-size: 0.8125rem;
69
+ color: var(--tern-muted);
70
+ }
71
+ .legend {
72
+ display: flex;
73
+ flex-wrap: wrap;
74
+ gap: 0.25rem 1rem;
75
+ margin: 0;
76
+ padding: 0;
77
+ list-style: none;
78
+ font-size: 0.8125rem;
79
+ color: var(--tern-muted);
80
+ }
81
+ .legend li {
82
+ display: inline-flex;
83
+ align-items: center;
84
+ gap: 0.4rem;
85
+ }
86
+ .key.line {
87
+ width: 0.875rem;
88
+ height: 2px;
89
+ border-radius: 1px;
90
+ }
91
+ .key.rect {
92
+ width: 0.625rem;
93
+ height: 0.625rem;
94
+ border-radius: 2px;
95
+ }
96
+ .tern-chart :global(.table th[scope='row']) {
97
+ font-weight: 500;
98
+ text-transform: none;
99
+ letter-spacing: 0;
100
+ font-size: 0.875rem;
101
+ color: var(--tern-fg);
102
+ }
103
+ .tern-chart :global(.table td) {
104
+ font-variant-numeric: tabular-nums;
105
+ }
106
+ /* Shared by the charts' SVG. */
107
+ .tern-chart :global(.tern-plot) {
108
+ position: relative;
109
+ outline: none;
110
+ border-radius: var(--tern-radius-sm);
111
+ }
112
+ .tern-chart :global(.tern-plot:focus-visible) {
113
+ box-shadow: 0 0 0 2px var(--tern-ring);
114
+ }
115
+ .tern-chart :global(.tern-plot svg) {
116
+ display: block;
117
+ width: 100%;
118
+ overflow: visible;
119
+ }
120
+ .tern-chart :global(.grid) {
121
+ stroke: var(--tern-border);
122
+ stroke-width: 1;
123
+ shape-rendering: crispEdges;
124
+ }
125
+ .tern-chart :global(.tick) {
126
+ fill: var(--tern-muted);
127
+ font-size: 12px;
128
+ font-variant-numeric: tabular-nums;
129
+ }
130
+ .tern-chart :global(.direct) {
131
+ fill: var(--tern-fg);
132
+ font-size: 12px;
133
+ font-weight: 500;
134
+ }
135
+ .tern-chart :global(.tooltip) {
136
+ position: absolute;
137
+ top: 0;
138
+ z-index: 2;
139
+ display: grid;
140
+ gap: 0.2rem;
141
+ min-width: 8rem;
142
+ padding: 0.5rem 0.65rem;
143
+ font-size: 0.8125rem;
144
+ color: var(--tern-fg);
145
+ background: var(--tern-surface);
146
+ border: 1px solid var(--tern-border);
147
+ border-radius: var(--tern-radius-sm);
148
+ box-shadow: var(--tern-shadow-lg);
149
+ pointer-events: none;
150
+ white-space: nowrap;
151
+ }
152
+ .tern-chart :global(.tooltip .head) {
153
+ color: var(--tern-muted);
154
+ font-size: 0.75rem;
155
+ }
156
+ .tern-chart :global(.tooltip .row) {
157
+ display: flex;
158
+ align-items: center;
159
+ gap: 0.45rem;
160
+ }
161
+ .tern-chart :global(.tooltip .row strong) {
162
+ font-variant-numeric: tabular-nums;
163
+ font-weight: 650;
164
+ }
165
+ .tern-chart :global(.tooltip .row span) {
166
+ color: var(--tern-muted);
167
+ }
168
+ .tern-chart :global(.tooltip .swatch) {
169
+ width: 0.75rem;
170
+ height: 2px;
171
+ border-radius: 1px;
172
+ flex: none;
173
+ }
174
+ </style>
@@ -0,0 +1,24 @@
1
+ import type { Snippet } from 'svelte';
2
+ type Props = {
3
+ title: string;
4
+ description?: string;
5
+ /** The heading level, to fit the page's outline. */
6
+ level?: 2 | 3 | 4;
7
+ legend: {
8
+ label: string;
9
+ color: string;
10
+ kind: 'line' | 'rect';
11
+ }[];
12
+ /** The table view: every value, reachable without hovering. */
13
+ table: {
14
+ headers: string[];
15
+ rows: string[][];
16
+ };
17
+ /** What the live readout says for the focused point, for keyboard and screen reader users. */
18
+ readout: string;
19
+ children: Snippet;
20
+ class?: string;
21
+ };
22
+ declare const ChartFrame: import("svelte").Component<Props, {}, "">;
23
+ type ChartFrame = ReturnType<typeof ChartFrame>;
24
+ export default ChartFrame;
@@ -0,0 +1,112 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import type { HTMLInputAttributes } from 'svelte/elements';
4
+ import { getForm } from './form.js';
5
+
6
+ type Props = Omit<HTMLInputAttributes, 'type'> & {
7
+ checked?: boolean;
8
+ /** Shows a dash, for "some selected". */
9
+ indeterminate?: boolean;
10
+ /** The label. */
11
+ children?: Snippet;
12
+ /** Help text under the label. */
13
+ description?: string;
14
+ };
15
+ let { checked = $bindable(false), indeterminate = $bindable(false), children, description, class: klass = '', ...rest }: Props = $props();
16
+ const uid = $props.id();
17
+ // In a Form, a named checkbox shows its own error, such as "Terms must be checked."
18
+ const form = getForm();
19
+ const error = $derived(typeof rest.name === 'string' ? form?.error(rest.name) : undefined);
20
+ const describedBy = $derived([description ? `tern-check-${uid}` : '', error ? `tern-check-${uid}-error` : ''].filter(Boolean).join(' ') || undefined);
21
+ </script>
22
+
23
+ <label class="tern-check {klass}">
24
+ <input type="checkbox" {...rest} bind:checked bind:indeterminate aria-describedby={describedBy} aria-invalid={error ? true : undefined} />
25
+ <span class="box" aria-hidden="true">
26
+ <svg viewBox="0 0 16 16"><path class="tick" d="M3.5 8.5l3 3 6-7" /><path class="dash" d="M4 8h8" /></svg>
27
+ </span>
28
+ <span class="text">
29
+ {@render children?.()}
30
+ {#if description}<span class="description" id="tern-check-{uid}">{description}</span>{/if}
31
+ {#if error}<span class="error" id="tern-check-{uid}-error" role="alert">{error}</span>{/if}
32
+ </span>
33
+ </label>
34
+
35
+ <style>
36
+ .tern-check {
37
+ display: inline-flex;
38
+ align-items: flex-start;
39
+ gap: 0.6rem;
40
+ font-size: 0.875rem;
41
+ cursor: pointer;
42
+ position: relative;
43
+ }
44
+ input {
45
+ position: absolute;
46
+ opacity: 0;
47
+ width: 1.125rem;
48
+ height: 1.125rem;
49
+ margin: 0.1rem 0 0;
50
+ cursor: inherit;
51
+ }
52
+ .box {
53
+ flex: none;
54
+ display: grid;
55
+ place-items: center;
56
+ width: 1.125rem;
57
+ height: 1.125rem;
58
+ margin-top: 0.1rem;
59
+ border: 1px solid var(--tern-border-strong);
60
+ border-radius: 5px;
61
+ background: var(--tern-surface);
62
+ transition:
63
+ background-color var(--tern-duration),
64
+ border-color var(--tern-duration);
65
+ }
66
+ svg {
67
+ width: 0.8rem;
68
+ height: 0.8rem;
69
+ fill: none;
70
+ stroke: var(--tern-accent-fg);
71
+ stroke-width: 2.2;
72
+ stroke-linecap: round;
73
+ stroke-linejoin: round;
74
+ }
75
+ .tick,
76
+ .dash {
77
+ display: none;
78
+ }
79
+ input:checked + .box,
80
+ input:indeterminate + .box {
81
+ background: var(--tern-accent);
82
+ border-color: var(--tern-accent);
83
+ }
84
+ input:checked:not(:indeterminate) + .box .tick,
85
+ input:indeterminate + .box .dash {
86
+ display: block;
87
+ }
88
+ input:focus-visible + .box {
89
+ outline: 2px solid var(--tern-ring);
90
+ outline-offset: 2px;
91
+ }
92
+ input:disabled ~ * {
93
+ opacity: 0.55;
94
+ }
95
+ .tern-check:has(input:disabled) {
96
+ cursor: not-allowed;
97
+ }
98
+ .text {
99
+ display: grid;
100
+ gap: 0.125rem;
101
+ }
102
+ .description {
103
+ color: var(--tern-muted);
104
+ font-size: 0.8125rem;
105
+ }
106
+ .error {
107
+ display: block;
108
+ font-size: 0.8125rem;
109
+ font-weight: 500;
110
+ color: var(--tern-danger);
111
+ }
112
+ </style>
@@ -0,0 +1,14 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLInputAttributes } from 'svelte/elements';
3
+ type Props = Omit<HTMLInputAttributes, 'type'> & {
4
+ checked?: boolean;
5
+ /** Shows a dash, for "some selected". */
6
+ indeterminate?: boolean;
7
+ /** The label. */
8
+ children?: Snippet;
9
+ /** Help text under the label. */
10
+ description?: string;
11
+ };
12
+ declare const Checkbox: import("svelte").Component<Props, {}, "checked" | "indeterminate">;
13
+ type Checkbox = ReturnType<typeof Checkbox>;
14
+ export default Checkbox;
@@ -0,0 +1,59 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ type Props = {
5
+ /** Whether it's open; bind it. */
6
+ open?: boolean;
7
+ /** The button's text. */
8
+ label: string;
9
+ children: Snippet;
10
+ class?: string;
11
+ };
12
+ let { open = $bindable(false), label, children, class: klass = '' }: Props = $props();
13
+ const uid = $props.id();
14
+ </script>
15
+
16
+ <!-- A button that shows and hides a region: the disclosure pattern. -->
17
+ <div class="tern-collapsible {klass}">
18
+ <button type="button" aria-expanded={open} aria-controls="tern-collapsible-{uid}" onclick={() => (open = !open)}>
19
+ <svg aria-hidden="true" viewBox="0 0 16 16" width="14" height="14"><path d="M6 4l4 4-4 4" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" /></svg>
20
+ {label}
21
+ </button>
22
+ <div id="tern-collapsible-{uid}" class="content" hidden={!open}>
23
+ {@render children()}
24
+ </div>
25
+ </div>
26
+
27
+ <style>
28
+ button {
29
+ display: inline-flex;
30
+ align-items: center;
31
+ gap: 0.375rem;
32
+ padding: 0.3rem 0.4rem 0.3rem 0.2rem;
33
+ font: inherit;
34
+ font-size: 0.875rem;
35
+ font-weight: 550;
36
+ color: var(--tern-fg);
37
+ background: transparent;
38
+ border: 0;
39
+ border-radius: var(--tern-radius-sm);
40
+ cursor: pointer;
41
+ }
42
+ button:hover {
43
+ background: var(--tern-surface-2);
44
+ }
45
+ button:focus-visible {
46
+ outline: 2px solid var(--tern-ring);
47
+ outline-offset: 1px;
48
+ }
49
+ svg {
50
+ color: var(--tern-muted);
51
+ transition: rotate var(--tern-duration);
52
+ }
53
+ [aria-expanded='true'] svg {
54
+ rotate: 90deg;
55
+ }
56
+ .content {
57
+ padding: 0.5rem 0 0 1.4rem;
58
+ }
59
+ </style>
@@ -0,0 +1,12 @@
1
+ import type { Snippet } from 'svelte';
2
+ type Props = {
3
+ /** Whether it's open; bind it. */
4
+ open?: boolean;
5
+ /** The button's text. */
6
+ label: string;
7
+ children: Snippet;
8
+ class?: string;
9
+ };
10
+ declare const Collapsible: import("svelte").Component<Props, {}, "open">;
11
+ type Collapsible = ReturnType<typeof Collapsible>;
12
+ export default Collapsible;