svelte-multistyle-ui 0.0.5-alpha → 0.0.8-alpha
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/cli/bin.js +3 -0
- package/cli/emit.js +3 -5
- package/cli/fixtures/sample.expected.svelte +229 -56
- package/cli/fixtures/sample.yaml +254 -128
- package/cli/generate.js +438 -7
- package/dist/components/Accordion.svelte +3 -1
- package/dist/components/Accordion.svelte.d.ts +2 -0
- package/dist/components/Alert.svelte +5 -3
- package/dist/components/Alert.svelte.d.ts +4 -2
- package/dist/components/Avatar.svelte +3 -1
- package/dist/components/Avatar.svelte.d.ts +2 -0
- package/dist/components/Breadcrumb.svelte +3 -2
- package/dist/components/Breadcrumb.svelte.d.ts +2 -0
- package/dist/components/Button.svelte +3 -1
- package/dist/components/Button.svelte.d.ts +2 -0
- package/dist/components/ButtonGroup.svelte +3 -1
- package/dist/components/ButtonGroup.svelte.d.ts +2 -0
- package/dist/components/Card.svelte +2 -1
- package/dist/components/Carousel.svelte +3 -1
- package/dist/components/Carousel.svelte.d.ts +2 -0
- package/dist/components/Checkbox.svelte +3 -1
- package/dist/components/Checkbox.svelte.d.ts +2 -0
- package/dist/components/Chip.svelte +3 -1
- package/dist/components/Chip.svelte.d.ts +2 -0
- package/dist/components/Column.svelte +2 -1
- package/dist/components/CommandPalette.svelte +3 -1
- package/dist/components/CommandPalette.svelte.d.ts +2 -0
- package/dist/components/DatePicker.svelte +3 -1
- package/dist/components/DatePicker.svelte.d.ts +2 -0
- package/dist/components/Divider.svelte +3 -1
- package/dist/components/Divider.svelte.d.ts +2 -0
- package/dist/components/Drawer.svelte +3 -1
- package/dist/components/Drawer.svelte.d.ts +2 -0
- package/dist/components/DropdownMenu.svelte +3 -1
- package/dist/components/DropdownMenu.svelte.d.ts +2 -0
- package/dist/components/FAB.svelte +3 -1
- package/dist/components/FAB.svelte.d.ts +2 -0
- package/dist/components/FileUpload.svelte +3 -1
- package/dist/components/FileUpload.svelte.d.ts +2 -0
- package/dist/components/Grid.svelte +2 -1
- package/dist/components/IconButton.svelte +3 -1
- package/dist/components/IconButton.svelte.d.ts +2 -0
- package/dist/components/Input.svelte +3 -1
- package/dist/components/Input.svelte.d.ts +2 -0
- package/dist/components/Modal.svelte +3 -1
- package/dist/components/Modal.svelte.d.ts +2 -0
- package/dist/components/MultiSelect.svelte +3 -1
- package/dist/components/MultiSelect.svelte.d.ts +2 -0
- package/dist/components/Pagination.svelte +3 -1
- package/dist/components/Pagination.svelte.d.ts +2 -0
- package/dist/components/Popover.svelte +3 -1
- package/dist/components/Popover.svelte.d.ts +2 -0
- package/dist/components/ProgressBar.svelte +3 -1
- package/dist/components/ProgressBar.svelte.d.ts +2 -0
- package/dist/components/Radio.svelte +3 -1
- package/dist/components/Radio.svelte.d.ts +2 -0
- package/dist/components/Rating.svelte +3 -1
- package/dist/components/Rating.svelte.d.ts +2 -0
- package/dist/components/Row.svelte +2 -1
- package/dist/components/Select.svelte +3 -1
- package/dist/components/Select.svelte.d.ts +2 -0
- package/dist/components/Skeleton.svelte +3 -1
- package/dist/components/Skeleton.svelte.d.ts +2 -0
- package/dist/components/Slider.svelte +3 -1
- package/dist/components/Slider.svelte.d.ts +2 -0
- package/dist/components/SortableList.svelte +3 -1
- package/dist/components/SortableList.svelte.d.ts +2 -0
- package/dist/components/Spinner.svelte +3 -1
- package/dist/components/Spinner.svelte.d.ts +2 -0
- package/dist/components/Stepper.svelte +3 -1
- package/dist/components/Stepper.svelte.d.ts +2 -0
- package/dist/components/Table.svelte +3 -1
- package/dist/components/Table.svelte.d.ts +2 -0
- package/dist/components/Tabs.svelte +3 -1
- package/dist/components/Tabs.svelte.d.ts +2 -0
- package/dist/components/Textarea.svelte +3 -1
- package/dist/components/Textarea.svelte.d.ts +2 -0
- package/dist/components/Toast.svelte +7 -5
- package/dist/components/Toast.svelte.d.ts +2 -0
- package/dist/components/Toggle.svelte +3 -1
- package/dist/components/Toggle.svelte.d.ts +2 -0
- package/dist/components/Tooltip.svelte +3 -1
- package/dist/components/Tooltip.svelte.d.ts +2 -0
- package/dist/components/charts/BarChart.svelte +2 -2
- package/dist/components/charts/BarChart.svelte.d.ts +2 -0
- package/dist/components/charts/BubbleChart.svelte +2 -2
- package/dist/components/charts/BubbleChart.svelte.d.ts +2 -0
- package/dist/components/charts/Chart.svelte +3 -1
- package/dist/components/charts/Chart.svelte.d.ts +2 -0
- package/dist/components/charts/ComboChart.svelte +2 -2
- package/dist/components/charts/ComboChart.svelte.d.ts +2 -0
- package/dist/components/charts/DoughnutChart.svelte +2 -2
- package/dist/components/charts/DoughnutChart.svelte.d.ts +2 -0
- package/dist/components/charts/LineChart.svelte +2 -2
- package/dist/components/charts/LineChart.svelte.d.ts +2 -0
- package/dist/components/charts/PieChart.svelte +2 -2
- package/dist/components/charts/PieChart.svelte.d.ts +2 -0
- package/dist/components/charts/PolarAreaChart.svelte +2 -2
- package/dist/components/charts/PolarAreaChart.svelte.d.ts +2 -0
- package/dist/components/charts/RadarChart.svelte +2 -2
- package/dist/components/charts/RadarChart.svelte.d.ts +2 -0
- package/dist/components/charts/ScatterChart.svelte +2 -2
- package/dist/components/charts/ScatterChart.svelte.d.ts +2 -0
- package/dist/components/charts/StackedBarChart.svelte +2 -2
- package/dist/components/charts/StackedBarChart.svelte.d.ts +2 -0
- package/dist/components/charts/StackedLineChart.svelte +2 -2
- package/dist/components/charts/StackedLineChart.svelte.d.ts +2 -0
- package/dist/components/select-styles.css +6 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/utils/cn.d.ts +1 -0
- package/dist/utils/cn.js +9 -0
- package/package.json +5 -5
package/cli/bin.js
CHANGED
|
@@ -38,6 +38,9 @@ Usage:
|
|
|
38
38
|
|
|
39
39
|
Subcommands:
|
|
40
40
|
generate Convert a YAML file into a Svelte 5 route page.
|
|
41
|
+
Supports the standard verbose schema, a proper nested
|
|
42
|
+
YAML tree, and a compact indentation-based shorthand
|
|
43
|
+
(all auto-detected).
|
|
41
44
|
|
|
42
45
|
Options:
|
|
43
46
|
--input <path> YAML source file (required)
|
package/cli/emit.js
CHANGED
|
@@ -22,7 +22,6 @@ export function emitPage(doc, cfg) {
|
|
|
22
22
|
const sections = [
|
|
23
23
|
emitImports(used),
|
|
24
24
|
emitState(state),
|
|
25
|
-
emitDarkEffect(cfg.mode),
|
|
26
25
|
emitOnMount(),
|
|
27
26
|
].filter((s) => s.length);
|
|
28
27
|
|
|
@@ -37,12 +36,11 @@ export function emitPage(doc, cfg) {
|
|
|
37
36
|
|
|
38
37
|
function emitImports(used) {
|
|
39
38
|
const components = [...used].sort();
|
|
40
|
-
const lines = [
|
|
39
|
+
const lines = [];
|
|
41
40
|
if (components.length) {
|
|
41
|
+
lines.push(`import { onMount } from "svelte";`);
|
|
42
42
|
lines.push(`import { ${components.join(", ")} } from "svelte-multistyle-ui";`);
|
|
43
43
|
}
|
|
44
|
-
// initMultistyleUI is intentionally NOT imported here — the consuming app
|
|
45
|
-
// sets global style/theme/mode once in its layout, not per-page.
|
|
46
44
|
return lines;
|
|
47
45
|
}
|
|
48
46
|
|
|
@@ -142,7 +140,7 @@ function emitNode(node, depth, used) {
|
|
|
142
140
|
let inner = "";
|
|
143
141
|
if (typeof content === "string") inner = `${IND.repeat(depth + 2)}${content}`;
|
|
144
142
|
else if (Array.isArray(content)) inner = emitBody(content, depth + 2, used);
|
|
145
|
-
return `${indent}${IND}{#snippet ${sn}()}\n${inner
|
|
143
|
+
return `${indent}${IND}{#snippet ${sn}()}\n${inner ? inner + "\n" : ""}${indent}${IND}{/snippet}`;
|
|
146
144
|
});
|
|
147
145
|
return `${open}>\n${blocks.join("\n")}\n${indent}</${name}>`;
|
|
148
146
|
}
|
|
@@ -1,69 +1,242 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { onMount } from "svelte";
|
|
3
|
-
import { BarChart, Breadcrumb, Button, Card, Checkbox, Input,
|
|
3
|
+
import { Accordion, Alert, Avatar, BarChart, Breadcrumb, Button, ButtonGroup, Card, Checkbox, Chip, Column, DatePicker, Divider, DoughnutChart, DropdownMenu, FileUpload, Grid, IconButton, Input, LineChart, MultiSelect, Pagination, PieChart, PolarAreaChart, Popover, ProgressBar, RadarChart, Radio, Rating, Row, Select, Skeleton, Slider, Spinner, Stepper, Table, Tabs, Textarea, Toggle, Tooltip } from "svelte-multistyle-ui";
|
|
4
4
|
|
|
5
5
|
let username = $state("");
|
|
6
|
-
let
|
|
7
|
-
let count = $state(0);
|
|
8
|
-
let rating = $state(3);
|
|
9
|
-
let agreed = $state(false);
|
|
10
|
-
let tags = $state([]);
|
|
6
|
+
let email = $state("");
|
|
11
7
|
let selectedFruit = $state("");
|
|
12
|
-
let
|
|
13
|
-
let
|
|
14
|
-
let
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
$
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
mq.addEventListener("change", handler);
|
|
26
|
-
return () => mq.removeEventListener("change", handler);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const isDarkMode = $derived(MODE === "dark" || (MODE === "system" && systemDark));
|
|
30
|
-
|
|
31
|
-
$effect(() => {
|
|
32
|
-
const root = document.documentElement;
|
|
33
|
-
root.classList.toggle("dark", isDarkMode);
|
|
34
|
-
root.classList.toggle("light", !isDarkMode);
|
|
35
|
-
});
|
|
8
|
+
let selectedHobbies = $state([]);
|
|
9
|
+
let bio = $state("");
|
|
10
|
+
let subscribeToNewsletter = $state(false);
|
|
11
|
+
let enableNotifications = $state(false);
|
|
12
|
+
let planA = $state("");
|
|
13
|
+
let planB = $state("");
|
|
14
|
+
let volume = $state(0);
|
|
15
|
+
let startDate = $state("");
|
|
16
|
+
let buttongroup = $state("");
|
|
17
|
+
let rating = $state(0);
|
|
18
|
+
let tabs = $state(0);
|
|
19
|
+
let pagination = $state(0);
|
|
20
|
+
let popover = $state(false);
|
|
36
21
|
|
|
37
22
|
onMount(() => {
|
|
38
23
|
// TODO: add setup logic here
|
|
39
24
|
});
|
|
40
25
|
</script>
|
|
41
26
|
|
|
42
|
-
<Card
|
|
43
|
-
<Row
|
|
27
|
+
<Card>
|
|
28
|
+
<Row>
|
|
44
29
|
<Input label="Username" placeholder="Enter name" bind:value={username} />
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
</
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
30
|
+
</Row>
|
|
31
|
+
</Card>
|
|
32
|
+
<Card>
|
|
33
|
+
<Row>
|
|
34
|
+
<Input label="Email" placeholder="Enter email" bind:value={email} />
|
|
35
|
+
</Row>
|
|
36
|
+
</Card>
|
|
37
|
+
<Card>
|
|
38
|
+
<Row>
|
|
39
|
+
<Button label="Submit" />
|
|
40
|
+
</Row>
|
|
41
|
+
</Card>
|
|
42
|
+
<Card>
|
|
43
|
+
<Row>
|
|
44
|
+
<Select placeholder="Fruit" options={[{value:"apple",label:"Apple"},{value:"banana",label:"Banana"},{value:"cherry",label:"Cherry"}]} bind:value={selectedFruit} />
|
|
45
|
+
</Row>
|
|
46
|
+
</Card>
|
|
47
|
+
<Card>
|
|
48
|
+
<Row>
|
|
49
|
+
<MultiSelect placeholder="Hobbies" options={[{value:"reading",label:"Reading"},{value:"traveling",label:"Traveling"},{value:"cooking",label:"Cooking"}]} bind:selected={selectedHobbies} />
|
|
50
|
+
</Row>
|
|
51
|
+
</Card>
|
|
52
|
+
<Card>
|
|
53
|
+
<Row>
|
|
54
|
+
<Textarea label="Bio" placeholder="Tell us about yourself" rows={4} bind:value={bio} />
|
|
55
|
+
</Row>
|
|
56
|
+
</Card>
|
|
57
|
+
<Card>
|
|
58
|
+
<Row>
|
|
59
|
+
<Checkbox label="Subscribe to newsletter" bind:checked={subscribeToNewsletter} />
|
|
60
|
+
</Row>
|
|
61
|
+
</Card>
|
|
62
|
+
<Card>
|
|
63
|
+
<Row>
|
|
64
|
+
<Toggle label="Enable notifications" bind:checked={enableNotifications} />
|
|
65
|
+
</Row>
|
|
66
|
+
</Card>
|
|
67
|
+
<Card>
|
|
68
|
+
<Row>
|
|
69
|
+
<Radio label="Plan A" value="plan-a" bind:group={planA} />
|
|
70
|
+
</Row>
|
|
71
|
+
</Card>
|
|
72
|
+
<Card>
|
|
73
|
+
<Row>
|
|
74
|
+
<Radio label="Plan B" value="plan-b" bind:group={planB} />
|
|
75
|
+
</Row>
|
|
76
|
+
</Card>
|
|
77
|
+
<Card>
|
|
78
|
+
<Row>
|
|
79
|
+
<Slider label="Volume" min={0} max={100} bind:value={volume} />
|
|
80
|
+
</Row>
|
|
81
|
+
</Card>
|
|
82
|
+
<Card>
|
|
83
|
+
<Row>
|
|
84
|
+
<DatePicker label="Start date" bind:value={startDate} />
|
|
85
|
+
</Row>
|
|
86
|
+
</Card>
|
|
87
|
+
<Card>
|
|
88
|
+
<Row>
|
|
89
|
+
<FileUpload label="Upload resume" />
|
|
90
|
+
</Row>
|
|
91
|
+
</Card>
|
|
92
|
+
<Card>
|
|
93
|
+
<Row>
|
|
94
|
+
<ButtonGroup items={[{value:"grid",label:"Grid"},{value:"list",label:"List"}]} bind:value={buttongroup} />
|
|
95
|
+
</Row>
|
|
96
|
+
</Card>
|
|
97
|
+
<Card>
|
|
98
|
+
<Row>
|
|
99
|
+
<Rating max={5} bind:value={rating} />
|
|
100
|
+
</Row>
|
|
101
|
+
</Card>
|
|
102
|
+
<Card>
|
|
103
|
+
<Row>
|
|
104
|
+
<Chip>
|
|
105
|
+
Tag
|
|
106
|
+
</Chip>
|
|
107
|
+
</Row>
|
|
108
|
+
</Card>
|
|
109
|
+
<Card>
|
|
110
|
+
<Row>
|
|
111
|
+
<IconButton icon="search" ariaLabel="Search" />
|
|
112
|
+
</Row>
|
|
113
|
+
</Card>
|
|
114
|
+
<Card>
|
|
115
|
+
<Row>
|
|
116
|
+
<Tabs tabs={[{id:"home",label:"Home"},{id:"profile",label:"Profile"}]} bind:active={tabs} />
|
|
117
|
+
</Row>
|
|
118
|
+
</Card>
|
|
119
|
+
<Card>
|
|
120
|
+
<Row>
|
|
121
|
+
<Breadcrumb items={[{label:"Home",href:"/"},{label:"Products"},{label:"Details"}]} />
|
|
122
|
+
</Row>
|
|
123
|
+
</Card>
|
|
124
|
+
<Card>
|
|
125
|
+
<Row>
|
|
126
|
+
<Stepper steps={[{label:"Cart"},{label:"Shipping"},{label:"Payment"}]} current={1} />
|
|
127
|
+
</Row>
|
|
128
|
+
</Card>
|
|
129
|
+
<Card>
|
|
130
|
+
<Row>
|
|
131
|
+
<Pagination total={100} perPage={10} bind:current={pagination} />
|
|
132
|
+
</Row>
|
|
133
|
+
</Card>
|
|
134
|
+
<Card>
|
|
135
|
+
<Row>
|
|
136
|
+
<Accordion items={[{id:"faq-1",title:"What is this?",content:"A multi-style UI library."},{id:"faq-2",title:"How do I use it?",content:"Import components and pick a style."}]} />
|
|
137
|
+
</Row>
|
|
138
|
+
</Card>
|
|
139
|
+
<Card>
|
|
140
|
+
<Row>
|
|
141
|
+
<DropdownMenu items={[{label:"Edit"},{label:"Delete"},{divider:true},{label:"Share"}]} />
|
|
142
|
+
</Row>
|
|
143
|
+
</Card>
|
|
144
|
+
<Card>
|
|
145
|
+
<Row>
|
|
146
|
+
<Tooltip>
|
|
147
|
+
Info
|
|
148
|
+
</Tooltip>
|
|
149
|
+
</Row>
|
|
150
|
+
</Card>
|
|
151
|
+
<Card>
|
|
152
|
+
<Row>
|
|
153
|
+
<Popover bind:open={popover}>
|
|
154
|
+
{#snippet children()}
|
|
155
|
+
{/snippet}
|
|
156
|
+
{#snippet content()}
|
|
157
|
+
Popover body
|
|
158
|
+
{/snippet}
|
|
159
|
+
</Popover>
|
|
160
|
+
</Row>
|
|
161
|
+
</Card>
|
|
162
|
+
<Card>
|
|
163
|
+
<Row>
|
|
164
|
+
<Alert preset="success" title="Done">
|
|
165
|
+
Your changes were saved.
|
|
166
|
+
</Alert>
|
|
167
|
+
</Row>
|
|
168
|
+
</Card>
|
|
169
|
+
<Card>
|
|
170
|
+
<Row>
|
|
171
|
+
<ProgressBar value={60} />
|
|
172
|
+
</Row>
|
|
173
|
+
</Card>
|
|
174
|
+
<Card>
|
|
175
|
+
<Row>
|
|
176
|
+
<Spinner />
|
|
177
|
+
</Row>
|
|
178
|
+
</Card>
|
|
179
|
+
<Card>
|
|
180
|
+
<Row>
|
|
181
|
+
<Skeleton />
|
|
182
|
+
</Row>
|
|
183
|
+
</Card>
|
|
184
|
+
<Card>
|
|
185
|
+
<Row>
|
|
186
|
+
<Divider />
|
|
187
|
+
</Row>
|
|
188
|
+
</Card>
|
|
189
|
+
<Card>
|
|
190
|
+
<Row>
|
|
191
|
+
<Avatar src="" fallback="JD" />
|
|
192
|
+
</Row>
|
|
193
|
+
</Card>
|
|
194
|
+
<Card>
|
|
195
|
+
<Row>
|
|
196
|
+
<Grid columns={2}>
|
|
197
|
+
Grid cell
|
|
198
|
+
</Grid>
|
|
199
|
+
</Row>
|
|
200
|
+
</Card>
|
|
201
|
+
<Card>
|
|
202
|
+
<Row>
|
|
203
|
+
<Column>
|
|
204
|
+
Column cell
|
|
205
|
+
</Column>
|
|
206
|
+
</Row>
|
|
207
|
+
</Card>
|
|
208
|
+
<Card>
|
|
209
|
+
<Row>
|
|
210
|
+
<Table data={[{id:1,name:"Alice",role:"Admin"},{id:2,name:"Bob",role:"User"},{id:3,name:"Cara",role:"Editor"}]} />
|
|
211
|
+
</Row>
|
|
212
|
+
</Card>
|
|
213
|
+
<Card>
|
|
214
|
+
<Row>
|
|
215
|
+
<BarChart title="Quarterly Revenue" xAxisLabel="Quarter" yAxisLabel="Revenue" downloadable={true} data={[{label:"q1",value:12},{label:"q2",value:19},{label:"q3",value:8},{label:"q4",value:15}]} />
|
|
216
|
+
</Row>
|
|
217
|
+
</Card>
|
|
218
|
+
<Card>
|
|
219
|
+
<Row>
|
|
220
|
+
<LineChart title="Trend" data={[{label:"q1",value:12},{label:"q2",value:19},{label:"q3",value:8},{label:"q4",value:15}]} />
|
|
221
|
+
</Row>
|
|
222
|
+
</Card>
|
|
223
|
+
<Card>
|
|
224
|
+
<Row>
|
|
225
|
+
<PieChart title="Share" data={[{label:"q1",value:12},{label:"q2",value:19},{label:"q3",value:8},{label:"q4",value:15}]} />
|
|
226
|
+
</Row>
|
|
227
|
+
</Card>
|
|
228
|
+
<Card>
|
|
229
|
+
<Row>
|
|
230
|
+
<DoughnutChart title="Distribution" data={[{label:"q1",value:12},{label:"q2",value:19},{label:"q3",value:8},{label:"q4",value:15}]} />
|
|
231
|
+
</Row>
|
|
232
|
+
</Card>
|
|
233
|
+
<Card>
|
|
234
|
+
<Row>
|
|
235
|
+
<RadarChart title="Radar" data={[{label:"q1",value:12},{label:"q2",value:19},{label:"q3",value:8},{label:"q4",value:15}]} />
|
|
236
|
+
</Row>
|
|
237
|
+
</Card>
|
|
238
|
+
<Card>
|
|
239
|
+
<Row>
|
|
240
|
+
<PolarAreaChart title="Polar" data={[{label:"q1",value:12},{label:"q2",value:19},{label:"q3",value:8},{label:"q4",value:15}]} />
|
|
241
|
+
</Row>
|
|
69
242
|
</Card>
|