svelte-multistyle-ui 0.0.16-alpha → 0.1.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/README.md +4 -4
- package/cli/emit.js +9 -4
- package/cli/fixtures/sample.expected.svelte +2 -1
- package/cli/generate.js +5 -2
- package/cli/schema.js +16 -0
- package/dist/actions/dialog.js +13 -3
- package/dist/components/Accordion.svelte +7 -4
- package/dist/components/Alert.svelte +6 -3
- package/dist/components/Avatar.svelte +6 -3
- package/dist/components/Breadcrumb.svelte +6 -3
- package/dist/components/Button.svelte +6 -3
- package/dist/components/ButtonGroup.svelte +6 -3
- package/dist/components/Card.svelte +6 -3
- package/dist/components/Carousel.svelte +6 -3
- package/dist/components/Checkbox.svelte +6 -3
- package/dist/components/Chip.svelte +6 -3
- package/dist/components/CodeEditor.svelte +10 -4
- package/dist/components/Column.svelte +8 -1
- package/dist/components/CommandPalette.svelte +6 -3
- package/dist/components/CrudView.svelte +68 -28
- package/dist/components/DatePicker.svelte +20 -6
- package/dist/components/Divider.svelte +6 -3
- package/dist/components/Drawer.svelte +14 -3
- package/dist/components/DropdownMenu.svelte +6 -3
- package/dist/components/FAB.svelte +6 -3
- package/dist/components/FileUpload.svelte +17 -4
- package/dist/components/FilterBar.svelte +24 -14
- package/dist/components/GraphEditor.svelte +4 -3
- package/dist/components/Grid.svelte +8 -1
- package/dist/components/IconButton.svelte +6 -3
- package/dist/components/InlineEdit.svelte +6 -3
- package/dist/components/Input.svelte +14 -3
- package/dist/components/Modal.svelte +8 -4
- package/dist/components/Pagination.svelte +11 -3
- package/dist/components/Popover.svelte +12 -4
- package/dist/components/ProgressBar.svelte +6 -3
- package/dist/components/Radio.svelte +6 -3
- package/dist/components/Rating.svelte +10 -6
- package/dist/components/Row.svelte +8 -1
- package/dist/components/Select.svelte +9 -4
- package/dist/components/Skeleton.svelte +6 -3
- package/dist/components/Slider.svelte +8 -4
- package/dist/components/SortableList.svelte +6 -3
- package/dist/components/Spinner.svelte +6 -3
- package/dist/components/Stepper.svelte +9 -4
- package/dist/components/Table.svelte +6 -3
- package/dist/components/Tabs.svelte +8 -4
- package/dist/components/TextEditor.svelte +6 -3
- package/dist/components/Textarea.svelte +20 -6
- package/dist/components/Toast.svelte +8 -5
- package/dist/components/Toggle.svelte +6 -3
- package/dist/components/Tooltip.svelte +11 -4
- package/dist/components/charts/Chart.svelte +32 -21
- package/dist/components/charts/MermaidChart.svelte +14 -4
- package/dist/components/charts/chart-config.d.ts +3 -3
- package/dist/components/charts/chart-config.js +8 -0
- package/dist/components/charts/index.d.ts +12 -0
- package/dist/components/charts/index.js +12 -0
- package/dist/components/checkbox-styles.css +2 -2
- package/dist/components/crudview-styles.css +2 -2
- package/dist/components/radio-styles.css +2 -2
- package/dist/components/slider-styles.css +2 -2
- package/dist/components/text-editor-core/sanitizer.js +11 -3
- package/dist/components/theme.css +59 -49
- package/dist/components/toast-styles.css +8 -8
- package/dist/components/toggle-styles.css +3 -3
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/config.svelte.js +11 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.js +2 -13
- package/dist/themes/generator.js +1 -1
- package/dist/themes/presets.js +6 -6
- package/dist/utils/filter.js +8 -4
- package/package.json +11 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import "./toggle-styles.css";
|
|
3
|
-
import {
|
|
3
|
+
import { getMultistyleDefaults } from "../config.js";
|
|
4
4
|
import { cn } from "../utils/cn.js";
|
|
5
5
|
|
|
6
6
|
/** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
|
|
@@ -17,8 +17,11 @@
|
|
|
17
17
|
...rest
|
|
18
18
|
} = $props();
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const _cfg = getMultistyleDefaults();
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const style = $derived(styleProp ?? _cfg.style);
|
|
24
|
+
const theme = $derived(themeProp ?? _cfg.theme);
|
|
22
25
|
|
|
23
26
|
const styleClass = $derived(`s-toggle-${style}`);
|
|
24
27
|
const themeClass = $derived(`theme-${theme}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import "./tooltip-styles.css";
|
|
3
|
-
import {
|
|
3
|
+
import { getMultistyleDefaults } from "../config.js";
|
|
4
4
|
import { cn } from "../utils/cn.js";
|
|
5
5
|
|
|
6
6
|
/** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
|
|
@@ -16,12 +16,17 @@
|
|
|
16
16
|
...rest
|
|
17
17
|
} = $props();
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
const _cfg = getMultistyleDefaults();
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const style = $derived(styleProp ?? _cfg.style);
|
|
23
|
+
const theme = $derived(themeProp ?? _cfg.theme);
|
|
21
24
|
|
|
22
25
|
const styleClass = $derived(`s-tooltip-${style}`);
|
|
23
26
|
const themeClass = $derived(`theme-${theme}`);
|
|
24
27
|
|
|
28
|
+
const uid = $props.id();
|
|
29
|
+
const tooltipId = `tooltip-${uid}`;
|
|
25
30
|
let visible = $state(false);
|
|
26
31
|
</script>
|
|
27
32
|
|
|
@@ -31,10 +36,12 @@
|
|
|
31
36
|
onmouseleave={() => (visible = false)}
|
|
32
37
|
onfocusin={() => (visible = true)}
|
|
33
38
|
onfocusout={() => (visible = false)}
|
|
39
|
+
onkeydown={(e) => { if (e.key === "Escape") visible = false; }}
|
|
40
|
+
aria-describedby={visible && text ? tooltipId : undefined}
|
|
34
41
|
{...rest}
|
|
35
42
|
>
|
|
36
43
|
{@render children?.()}
|
|
37
44
|
{#if visible && text}
|
|
38
|
-
<div class="s-tooltip tooltip-{position}" role="tooltip">{text}</div>
|
|
45
|
+
<div id={tooltipId} class="s-tooltip tooltip-{position}" role="tooltip">{text}</div>
|
|
39
46
|
{/if}
|
|
40
47
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { onDestroy } from "svelte";
|
|
3
3
|
import { Chart as ChartJS } from "chart.js";
|
|
4
4
|
import "./chart-styles.css";
|
|
5
|
-
import {
|
|
5
|
+
import { getMultistyleDefaults } from "../../config.js";
|
|
6
6
|
import { cn } from "../../utils/cn.js";
|
|
7
7
|
import { buildData, buildOptions, readTokens } from "./chart-config.js";
|
|
8
8
|
|
|
@@ -28,8 +28,11 @@
|
|
|
28
28
|
...rest
|
|
29
29
|
} = $props();
|
|
30
30
|
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const _cfg = getMultistyleDefaults();
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const style = $derived(styleProp ?? _cfg.style);
|
|
35
|
+
const theme = $derived(themeProp ?? _cfg.theme);
|
|
33
36
|
const styleClass = $derived(`s-chart-${style}`);
|
|
34
37
|
const themeClass = $derived(`theme-${theme}`);
|
|
35
38
|
const typeClass = $derived(`s-chart-${type}`);
|
|
@@ -136,7 +139,14 @@
|
|
|
136
139
|
const snapData = $state.snapshot(normalized.data);
|
|
137
140
|
const snapSeries = $state.snapshot(normalized.series);
|
|
138
141
|
const snapLabels = $state.snapshot(normalized.labels);
|
|
139
|
-
const
|
|
142
|
+
const toPlain = (v) => {
|
|
143
|
+
if (v === null || typeof v !== "object") return v;
|
|
144
|
+
if (Array.isArray(v)) return v.map(toPlain);
|
|
145
|
+
const out = {};
|
|
146
|
+
for (const k of Object.keys(v)) out[k] = toPlain(v[k]);
|
|
147
|
+
return out;
|
|
148
|
+
};
|
|
149
|
+
const snapOptions = toPlain(options);
|
|
140
150
|
|
|
141
151
|
// Check if a chart already exists on this canvas
|
|
142
152
|
const existing = ChartJS.getChart(canvas);
|
|
@@ -162,34 +172,35 @@
|
|
|
162
172
|
let rafId = 0;
|
|
163
173
|
let resizeId = 0;
|
|
164
174
|
let cancelled = false;
|
|
175
|
+
let ro = null;
|
|
165
176
|
const container = canvas.parentElement;
|
|
166
|
-
const
|
|
167
|
-
if (cancelled) return;
|
|
168
|
-
// Wait until the chart's container has a real layout size. Charts mount
|
|
169
|
-
// while their gallery section is display:none (parent 0×0); creating now
|
|
170
|
-
// yields a degenerate chartArea that hides axes/labels. The container
|
|
171
|
-
// (not the canvas — it has a 300×150 intrinsic default) is Chart.js's
|
|
172
|
-
// size source.
|
|
173
|
-
if (!container || container.clientWidth === 0 || container.clientHeight === 0) {
|
|
174
|
-
rafId = requestAnimationFrame(init);
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
+
const createNow = () => {
|
|
178
|
+
if (cancelled || !container || container.clientWidth === 0 || container.clientHeight === 0) return false;
|
|
177
179
|
chartInstance = new ChartJS(canvas.getContext("2d"), cfg);
|
|
178
|
-
// Layout can still settle one frame after the container becomes visible;
|
|
179
|
-
// force a re-measure so the first render's chartArea is final and axes
|
|
180
|
-
// + labels draw.
|
|
181
180
|
resizeId = requestAnimationFrame(() => {
|
|
182
181
|
if (cancelled || !chartInstance) return;
|
|
183
182
|
chartInstance.resize();
|
|
184
183
|
});
|
|
184
|
+
return true;
|
|
185
185
|
};
|
|
186
|
-
rafId = requestAnimationFrame(
|
|
186
|
+
rafId = requestAnimationFrame(() => {
|
|
187
|
+
if (cancelled) return;
|
|
188
|
+
if (!createNow() && container && typeof ResizeObserver !== "undefined") {
|
|
189
|
+
ro = new ResizeObserver(() => {
|
|
190
|
+
if (createNow()) {
|
|
191
|
+
ro?.disconnect();
|
|
192
|
+
ro = null;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
ro.observe(container);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
187
198
|
|
|
188
|
-
// Cancel any pending deferred init when deps change again or on unmount.
|
|
189
199
|
return () => {
|
|
190
200
|
cancelled = true;
|
|
191
201
|
if (rafId) cancelAnimationFrame(rafId);
|
|
192
202
|
if (resizeId) cancelAnimationFrame(resizeId);
|
|
203
|
+
ro?.disconnect();
|
|
193
204
|
};
|
|
194
205
|
});
|
|
195
206
|
|
|
@@ -215,7 +226,7 @@
|
|
|
215
226
|
labels: $state.snapshot(normalized.labels),
|
|
216
227
|
}, tokens);
|
|
217
228
|
existing.options = buildOptions(type, style, tokens, {
|
|
218
|
-
title, legend, animated, userOptions:
|
|
229
|
+
title, legend, animated, userOptions: options, seriesCount, xAxisLabel, yAxisLabel,
|
|
219
230
|
});
|
|
220
231
|
existing.update("none");
|
|
221
232
|
});
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
31
|
<script>
|
|
32
|
-
import {
|
|
32
|
+
import { getMultistyleDefaults } from "../../config.js";
|
|
33
33
|
import { cn } from "../../utils/cn.js";
|
|
34
34
|
import "./chart-styles.css";
|
|
35
35
|
import "./mermaid-chart-styles.css";
|
|
@@ -45,9 +45,19 @@
|
|
|
45
45
|
let { source = "", title = "", diagramTheme, style: styleProp, theme: themeProp, class: className = "" } = $props();
|
|
46
46
|
|
|
47
47
|
const instanceId = $props.id();
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const
|
|
48
|
+
const _cfg = getMultistyleDefaults();
|
|
49
|
+
|
|
50
|
+
const style = $derived(styleProp ?? _cfg.style);
|
|
51
|
+
const theme = $derived(themeProp ?? _cfg.theme);
|
|
52
|
+
let domDark = $state(typeof document !== "undefined" ? document.documentElement.classList.contains("dark") : false);
|
|
53
|
+
$effect(() => {
|
|
54
|
+
if (typeof document === "undefined") return;
|
|
55
|
+
const root = document.documentElement;
|
|
56
|
+
const ob = new MutationObserver(() => { domDark = root.classList.contains("dark"); });
|
|
57
|
+
ob.observe(root, { attributes: true, attributeFilter: ["class"] });
|
|
58
|
+
return () => ob.disconnect();
|
|
59
|
+
});
|
|
60
|
+
const dark = $derived(_cfg.mode === "dark" || (_cfg.mode === "system" && _cfg.systemDark) || domDark);
|
|
51
61
|
let svg = $state("");
|
|
52
62
|
let error = $state("");
|
|
53
63
|
let loading = $state(false);
|
|
@@ -29,15 +29,15 @@ export function buildData(type: any, { data, series, labels }: {
|
|
|
29
29
|
series: any;
|
|
30
30
|
labels: any;
|
|
31
31
|
}, tokens: any): {
|
|
32
|
+
labels: any;
|
|
33
|
+
datasets: any;
|
|
34
|
+
} | {
|
|
32
35
|
datasets: {
|
|
33
36
|
label: any;
|
|
34
37
|
data: any;
|
|
35
38
|
backgroundColor: any;
|
|
36
39
|
}[];
|
|
37
40
|
labels?: undefined;
|
|
38
|
-
} | {
|
|
39
|
-
labels: any;
|
|
40
|
-
datasets: any;
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
43
|
* Build a full Chart.js options object inferred from type, style, and tokens.
|
|
@@ -103,6 +103,14 @@ export function palette(n, tokens) {
|
|
|
103
103
|
* Build a Chart.js data object from the canonical user-facing API.
|
|
104
104
|
*/
|
|
105
105
|
export function buildData(type, { data, series, labels }, tokens) {
|
|
106
|
+
// Native Chart.js { labels, datasets } pass-through
|
|
107
|
+
if (data && typeof data === "object" && !Array.isArray(data) && Array.isArray(data.datasets)) {
|
|
108
|
+
return {
|
|
109
|
+
labels: data.labels ?? labels ?? [],
|
|
110
|
+
datasets: data.datasets,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
106
114
|
// Normalize object-style data: {q1:12, q2:19} → labels=["q1","q2"], data=[12,19]
|
|
107
115
|
if (
|
|
108
116
|
data &&
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as BarChart } from "./BarChart.svelte";
|
|
2
|
+
export { default as LineChart } from "./LineChart.svelte";
|
|
3
|
+
export { default as PieChart } from "./PieChart.svelte";
|
|
4
|
+
export { default as DoughnutChart } from "./DoughnutChart.svelte";
|
|
5
|
+
export { default as RadarChart } from "./RadarChart.svelte";
|
|
6
|
+
export { default as PolarAreaChart } from "./PolarAreaChart.svelte";
|
|
7
|
+
export { default as ScatterChart } from "./ScatterChart.svelte";
|
|
8
|
+
export { default as BubbleChart } from "./BubbleChart.svelte";
|
|
9
|
+
export { default as StackedBarChart } from "./StackedBarChart.svelte";
|
|
10
|
+
export { default as StackedLineChart } from "./StackedLineChart.svelte";
|
|
11
|
+
export { default as ComboChart } from "./ComboChart.svelte";
|
|
12
|
+
export { default as MermaidChart } from "./MermaidChart.svelte";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as BarChart } from "./BarChart.svelte";
|
|
2
|
+
export { default as LineChart } from "./LineChart.svelte";
|
|
3
|
+
export { default as PieChart } from "./PieChart.svelte";
|
|
4
|
+
export { default as DoughnutChart } from "./DoughnutChart.svelte";
|
|
5
|
+
export { default as RadarChart } from "./RadarChart.svelte";
|
|
6
|
+
export { default as PolarAreaChart } from "./PolarAreaChart.svelte";
|
|
7
|
+
export { default as ScatterChart } from "./ScatterChart.svelte";
|
|
8
|
+
export { default as BubbleChart } from "./BubbleChart.svelte";
|
|
9
|
+
export { default as StackedBarChart } from "./StackedBarChart.svelte";
|
|
10
|
+
export { default as StackedLineChart } from "./StackedLineChart.svelte";
|
|
11
|
+
export { default as ComboChart } from "./ComboChart.svelte";
|
|
12
|
+
export { default as MermaidChart } from "./MermaidChart.svelte";
|
|
@@ -115,8 +115,8 @@
|
|
|
115
115
|
border: 1px solid rgba(255,255,255,0.2);
|
|
116
116
|
box-shadow: var(--t-shadow-sm), inset 0 1px 0 rgba(255,255,255,0.3);
|
|
117
117
|
}
|
|
118
|
-
.s-checkbox
|
|
119
|
-
.s-checkbox
|
|
118
|
+
.s-checkbox input:focus-visible + .s-checkbox-box,
|
|
119
|
+
.s-checkbox input:focus-visible {
|
|
120
120
|
outline: 2px solid var(--t-primary);
|
|
121
121
|
outline-offset: 2px;
|
|
122
122
|
}
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
}
|
|
194
194
|
.s-crud-bulk-delete-btn:hover {
|
|
195
195
|
background: var(--t-error, #ef4444);
|
|
196
|
-
color: #fff;
|
|
196
|
+
color: var(--t-text-on-primary, #fff);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
.s-crud-bulk-clear-btn {
|
|
@@ -969,7 +969,7 @@
|
|
|
969
969
|
background: var(--t-error, #ef4444);
|
|
970
970
|
border: none;
|
|
971
971
|
border-radius: var(--t-btn-radius, 6px);
|
|
972
|
-
color: #ffffff;
|
|
972
|
+
color: var(--t-text-on-primary, #ffffff);
|
|
973
973
|
cursor: pointer;
|
|
974
974
|
transition: all 0.15s;
|
|
975
975
|
}
|
|
@@ -111,8 +111,8 @@
|
|
|
111
111
|
border: 1px solid rgba(255,255,255,0.2);
|
|
112
112
|
box-shadow: var(--t-shadow-sm), inset 0 1px 0 rgba(255,255,255,0.3);
|
|
113
113
|
}
|
|
114
|
-
.s-radio
|
|
115
|
-
.s-radio
|
|
114
|
+
.s-radio input:focus-visible + .s-radio-circle,
|
|
115
|
+
.s-radio input:focus-visible {
|
|
116
116
|
outline: 2px solid var(--t-primary);
|
|
117
117
|
outline-offset: 2px;
|
|
118
118
|
}
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
height: 18px;
|
|
33
33
|
border-radius: 50%;
|
|
34
34
|
background: var(--t-primary);
|
|
35
|
-
border: 2px solid #fff;
|
|
35
|
+
border: 2px solid var(--t-text-on-primary, var(--t-surface, #fff));
|
|
36
36
|
box-shadow: var(--t-shadow-sm);
|
|
37
37
|
cursor: pointer;
|
|
38
38
|
transition: all 0.2s ease;
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
/* Liquid Glass */
|
|
80
80
|
.s-slider-liquid-glass .s-slider-track-wrapper input[type="range"] { background: rgba(255,255,255,0.15); border-radius: 3px; }
|
|
81
81
|
.s-slider-liquid-glass .s-slider-track-wrapper input[type="range"]::-webkit-slider-thumb { background: rgba(255,255,255,0.8); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.3); }
|
|
82
|
-
.s-slider:focus-visible {
|
|
82
|
+
.s-slider-track-wrapper input[type="range"].s-slider:focus-visible {
|
|
83
83
|
outline: 2px solid var(--t-primary);
|
|
84
84
|
outline-offset: 3px;
|
|
85
85
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const ALLOWED_TAGS = new Set([
|
|
7
|
-
"p", "div", "span", "br", "b", "i", "strong", "em", "u", "s", "sup", "sub", "font",
|
|
7
|
+
"p", "div", "span", "br", "b", "i", "strong", "em", "u", "s", "strike", "sup", "sub", "font",
|
|
8
8
|
"ul", "ol", "li", "blockquote", "pre", "code",
|
|
9
9
|
"table", "thead", "tbody", "tr", "td", "th", "caption",
|
|
10
10
|
"figure", "figcaption", "img", "a", "iframe", "hr", "h1", "h2", "h3", "h4", "h5", "h6",
|
|
@@ -18,7 +18,7 @@ const FORBIDDEN_TAGS = new Set([
|
|
|
18
18
|
const ALLOWED_ATTRS = new Set([
|
|
19
19
|
"href", "title", "target", "rel",
|
|
20
20
|
"src", "alt", "width", "height",
|
|
21
|
-
"align", "
|
|
21
|
+
"align", "style",
|
|
22
22
|
"color", "face", "size",
|
|
23
23
|
"colspan", "rowspan",
|
|
24
24
|
"frameborder", "allowfullscreen",
|
|
@@ -109,7 +109,8 @@ function cleanNode(node) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
if (!ALLOWED_TAGS.has(tag)) {
|
|
112
|
-
//
|
|
112
|
+
// Clean children first, then unwrap the unknown tag so nested XSS payloads cannot bypass cleaning.
|
|
113
|
+
cleanNode(child);
|
|
113
114
|
const parent = child.parentNode;
|
|
114
115
|
while (child.firstChild) {
|
|
115
116
|
parent.insertBefore(child.firstChild, child);
|
|
@@ -141,6 +142,10 @@ function cleanNode(node) {
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
|
|
145
|
+
if (tag === "a" && child.getAttribute("target") === "_blank") {
|
|
146
|
+
child.setAttribute("rel", "noopener noreferrer");
|
|
147
|
+
}
|
|
148
|
+
|
|
144
149
|
cleanNode(child);
|
|
145
150
|
} else {
|
|
146
151
|
// Remove comments and other non-element/text nodes.
|
|
@@ -202,6 +207,9 @@ export function sanitizeURL(url, { allowDataImage = false } = {}) {
|
|
|
202
207
|
return trimmed;
|
|
203
208
|
}
|
|
204
209
|
|
|
210
|
+
// Reject protocol-relative //host URLs
|
|
211
|
+
if (normalized.startsWith("//")) return "";
|
|
212
|
+
|
|
205
213
|
// Allow relative paths (e.g. /foo, ./bar, ../baz, #anchor, ?query) without protocol-relative //
|
|
206
214
|
if (/^(\/(?!\/)|\.\/|\.\.\/|#|\?)/.test(normalized)) {
|
|
207
215
|
return trimmed;
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
--t-border-width: 1.5px;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
html.dark .theme-default
|
|
38
|
+
html.dark .theme-default,
|
|
39
|
+
html.dark.theme-default {
|
|
39
40
|
--t-surface: hsl(0, 0%, 10%);
|
|
40
41
|
--t-card-bg: hsl(0, 0%, 10%);
|
|
41
42
|
--t-card-surface: hsl(210, 40%, 16%);
|
|
@@ -48,12 +49,12 @@ html.dark .theme-default {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
.theme-ocean {
|
|
51
|
-
--t-primary: #
|
|
52
|
-
--t-secondary: #
|
|
53
|
-
--t-info: #
|
|
54
|
-
--t-success: #
|
|
55
|
-
--t-warning: #
|
|
56
|
-
--t-error: #
|
|
52
|
+
--t-primary: #0369a1;
|
|
53
|
+
--t-secondary: #0e7490;
|
|
54
|
+
--t-info: #0369a1;
|
|
55
|
+
--t-success: #15803d;
|
|
56
|
+
--t-warning: #a16207;
|
|
57
|
+
--t-error: #be123c;
|
|
57
58
|
--t-text-on-primary: #ffffff;
|
|
58
59
|
--t-surface: #ffffff;
|
|
59
60
|
--t-card-bg: #ffffff;
|
|
@@ -64,13 +65,13 @@ html.dark .theme-default {
|
|
|
64
65
|
--t-text-hint: color-mix(in srgb, #0c4a6e 50%, transparent);
|
|
65
66
|
--t-text-muted: color-mix(in srgb, #0c4a6e 50%, transparent);
|
|
66
67
|
--t-text-disabled: color-mix(in srgb, #0c4a6e 50%, transparent);
|
|
67
|
-
--t-text-primary: #
|
|
68
|
-
--t-text-secondary: #
|
|
69
|
-
--t-text-info: #
|
|
70
|
-
--t-text-success: #
|
|
71
|
-
--t-text-warning: #
|
|
72
|
-
--t-text-error: #
|
|
73
|
-
--t-btn-bg: #
|
|
68
|
+
--t-text-primary: #0369a1;
|
|
69
|
+
--t-text-secondary: #0e7490;
|
|
70
|
+
--t-text-info: #0369a1;
|
|
71
|
+
--t-text-success: #15803d;
|
|
72
|
+
--t-text-warning: #a16207;
|
|
73
|
+
--t-text-error: #be123c;
|
|
74
|
+
--t-btn-bg: #0369a1;
|
|
74
75
|
--t-btn-border-color: transparent;
|
|
75
76
|
--t-btn-radius: 10px;
|
|
76
77
|
--t-card-radius: 12px;
|
|
@@ -78,7 +79,8 @@ html.dark .theme-default {
|
|
|
78
79
|
--t-border-width: 1.5px;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
html.dark .theme-ocean
|
|
82
|
+
html.dark .theme-ocean,
|
|
83
|
+
html.dark.theme-ocean {
|
|
82
84
|
--t-surface: hsl(0, 0%, 10%);
|
|
83
85
|
--t-card-bg: hsl(0, 0%, 10%);
|
|
84
86
|
--t-card-surface: hsl(204, 94%, 20%);
|
|
@@ -91,12 +93,12 @@ html.dark .theme-ocean {
|
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
.theme-forest {
|
|
94
|
-
--t-primary: #
|
|
95
|
-
--t-secondary: #
|
|
96
|
-
--t-info: #
|
|
97
|
-
--t-success: #
|
|
98
|
-
--t-warning: #
|
|
99
|
-
--t-error: #
|
|
96
|
+
--t-primary: #15803d;
|
|
97
|
+
--t-secondary: #166534;
|
|
98
|
+
--t-info: #0e7490;
|
|
99
|
+
--t-success: #15803d;
|
|
100
|
+
--t-warning: #a16207;
|
|
101
|
+
--t-error: #b91c1c;
|
|
100
102
|
--t-text-on-primary: #ffffff;
|
|
101
103
|
--t-surface: #ffffff;
|
|
102
104
|
--t-card-bg: #ffffff;
|
|
@@ -107,13 +109,13 @@ html.dark .theme-ocean {
|
|
|
107
109
|
--t-text-hint: color-mix(in srgb, #14532d 50%, transparent);
|
|
108
110
|
--t-text-muted: color-mix(in srgb, #14532d 50%, transparent);
|
|
109
111
|
--t-text-disabled: color-mix(in srgb, #14532d 50%, transparent);
|
|
110
|
-
--t-text-primary: #
|
|
111
|
-
--t-text-secondary: #
|
|
112
|
-
--t-text-info: #
|
|
113
|
-
--t-text-success: #
|
|
114
|
-
--t-text-warning: #
|
|
115
|
-
--t-text-error: #
|
|
116
|
-
--t-btn-bg: #
|
|
112
|
+
--t-text-primary: #15803d;
|
|
113
|
+
--t-text-secondary: #166534;
|
|
114
|
+
--t-text-info: #0e7490;
|
|
115
|
+
--t-text-success: #15803d;
|
|
116
|
+
--t-text-warning: #a16207;
|
|
117
|
+
--t-text-error: #b91c1c;
|
|
118
|
+
--t-btn-bg: #15803d;
|
|
117
119
|
--t-btn-border-color: transparent;
|
|
118
120
|
--t-btn-radius: 8px;
|
|
119
121
|
--t-card-radius: 12px;
|
|
@@ -121,7 +123,8 @@ html.dark .theme-ocean {
|
|
|
121
123
|
--t-border-width: 1.5px;
|
|
122
124
|
}
|
|
123
125
|
|
|
124
|
-
html.dark .theme-forest
|
|
126
|
+
html.dark .theme-forest,
|
|
127
|
+
html.dark.theme-forest {
|
|
125
128
|
--t-surface: hsl(0, 0%, 10%);
|
|
126
129
|
--t-card-bg: hsl(0, 0%, 10%);
|
|
127
130
|
--t-card-surface: hsl(141, 84%, 21%);
|
|
@@ -134,12 +137,12 @@ html.dark .theme-forest {
|
|
|
134
137
|
}
|
|
135
138
|
|
|
136
139
|
.theme-rose {
|
|
137
|
-
--t-primary: #
|
|
138
|
-
--t-secondary: #
|
|
139
|
-
--t-info: #
|
|
140
|
-
--t-success: #
|
|
141
|
-
--t-warning: #
|
|
142
|
-
--t-error: #
|
|
140
|
+
--t-primary: #be123c;
|
|
141
|
+
--t-secondary: #9f1239;
|
|
142
|
+
--t-info: #be123c;
|
|
143
|
+
--t-success: #15803d;
|
|
144
|
+
--t-warning: #a16207;
|
|
145
|
+
--t-error: #be123c;
|
|
143
146
|
--t-text-on-primary: #ffffff;
|
|
144
147
|
--t-surface: #ffffff;
|
|
145
148
|
--t-card-bg: #ffffff;
|
|
@@ -150,13 +153,13 @@ html.dark .theme-forest {
|
|
|
150
153
|
--t-text-hint: color-mix(in srgb, #881337 50%, transparent);
|
|
151
154
|
--t-text-muted: color-mix(in srgb, #881337 50%, transparent);
|
|
152
155
|
--t-text-disabled: color-mix(in srgb, #881337 50%, transparent);
|
|
153
|
-
--t-text-primary: #
|
|
154
|
-
--t-text-secondary: #
|
|
155
|
-
--t-text-info: #
|
|
156
|
-
--t-text-success: #
|
|
157
|
-
--t-text-warning: #
|
|
158
|
-
--t-text-error: #
|
|
159
|
-
--t-btn-bg: #
|
|
156
|
+
--t-text-primary: #be123c;
|
|
157
|
+
--t-text-secondary: #9f1239;
|
|
158
|
+
--t-text-info: #be123c;
|
|
159
|
+
--t-text-success: #15803d;
|
|
160
|
+
--t-text-warning: #a16207;
|
|
161
|
+
--t-text-error: #be123c;
|
|
162
|
+
--t-btn-bg: #be123c;
|
|
160
163
|
--t-btn-border-color: transparent;
|
|
161
164
|
--t-btn-radius: 12px;
|
|
162
165
|
--t-card-radius: 14px;
|
|
@@ -164,7 +167,8 @@ html.dark .theme-forest {
|
|
|
164
167
|
--t-border-width: 1.5px;
|
|
165
168
|
}
|
|
166
169
|
|
|
167
|
-
html.dark .theme-rose
|
|
170
|
+
html.dark .theme-rose,
|
|
171
|
+
html.dark.theme-rose {
|
|
168
172
|
--t-surface: hsl(0, 0%, 10%);
|
|
169
173
|
--t-card-bg: hsl(0, 0%, 10%);
|
|
170
174
|
--t-card-surface: hsl(356, 100%, 19%);
|
|
@@ -207,7 +211,8 @@ html.dark .theme-rose {
|
|
|
207
211
|
--t-border-width: 1.5px;
|
|
208
212
|
}
|
|
209
213
|
|
|
210
|
-
html.dark .theme-midnight
|
|
214
|
+
html.dark .theme-midnight,
|
|
215
|
+
html.dark.theme-midnight {
|
|
211
216
|
--t-surface: #0f0d2e;
|
|
212
217
|
--t-card-bg: #0f0d2e;
|
|
213
218
|
--t-card-surface: #312e81;
|
|
@@ -250,7 +255,8 @@ html.dark .theme-midnight {
|
|
|
250
255
|
--t-border-width: 1.5px;
|
|
251
256
|
}
|
|
252
257
|
|
|
253
|
-
html.dark .theme-gold
|
|
258
|
+
html.dark .theme-gold,
|
|
259
|
+
html.dark.theme-gold {
|
|
254
260
|
--t-surface: hsl(0, 0%, 10%);
|
|
255
261
|
--t-card-bg: hsl(0, 0%, 10%);
|
|
256
262
|
--t-card-surface: hsl(55, 97%, 26%);
|
|
@@ -293,7 +299,8 @@ html.dark .theme-gold {
|
|
|
293
299
|
--t-border-width: 1px;
|
|
294
300
|
}
|
|
295
301
|
|
|
296
|
-
html.dark .theme-slate
|
|
302
|
+
html.dark .theme-slate,
|
|
303
|
+
html.dark.theme-slate {
|
|
297
304
|
--t-surface: hsl(0, 0%, 10%);
|
|
298
305
|
--t-card-bg: hsl(0, 0%, 10%);
|
|
299
306
|
--t-card-surface: hsl(210, 40%, 18%);
|
|
@@ -336,7 +343,8 @@ html.dark .theme-slate {
|
|
|
336
343
|
--t-border-width: 1.5px;
|
|
337
344
|
}
|
|
338
345
|
|
|
339
|
-
html.dark .theme-candy
|
|
346
|
+
html.dark .theme-candy,
|
|
347
|
+
html.dark.theme-candy {
|
|
340
348
|
--t-surface: hsl(0, 0%, 10%);
|
|
341
349
|
--t-card-bg: hsl(0, 0%, 10%);
|
|
342
350
|
--t-card-surface: hsl(326, 78%, 19%);
|
|
@@ -379,7 +387,8 @@ html.dark .theme-candy {
|
|
|
379
387
|
--t-border-width: 1px;
|
|
380
388
|
}
|
|
381
389
|
|
|
382
|
-
html.dark .theme-storm
|
|
390
|
+
html.dark .theme-storm,
|
|
391
|
+
html.dark.theme-storm {
|
|
383
392
|
--t-surface: #0a0f1a;
|
|
384
393
|
--t-card-bg: #0a0f1a;
|
|
385
394
|
--t-card-surface: #1e293b;
|
|
@@ -422,7 +431,8 @@ html.dark .theme-storm {
|
|
|
422
431
|
--t-border-width: 1.5px;
|
|
423
432
|
}
|
|
424
433
|
|
|
425
|
-
html.dark .theme-royal
|
|
434
|
+
html.dark .theme-royal,
|
|
435
|
+
html.dark.theme-royal {
|
|
426
436
|
--t-surface: #1a0840;
|
|
427
437
|
--t-card-bg: #1a0840;
|
|
428
438
|
--t-card-surface: #3b0764;
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/* Variants */
|
|
67
|
-
.s-toast-info { border-color: #3b82f6; background: color-mix(in srgb, #3b82f6 8%, var(--t-surface)); }
|
|
68
|
-
.s-toast-success { border-color: #22c55e; background: color-mix(in srgb, #22c55e 8%, var(--t-surface)); }
|
|
69
|
-
.s-toast-warning { border-color: #eab308; background: color-mix(in srgb, #eab308 8%, var(--t-surface)); }
|
|
70
|
-
.s-toast-error { border-color: #ef4444; background: color-mix(in srgb, #ef4444 8%, var(--t-surface)); }
|
|
71
|
-
.s-toast-info .s-toast-progress { background: #3b82f6; }
|
|
72
|
-
.s-toast-success .s-toast-progress { background: #22c55e; }
|
|
73
|
-
.s-toast-warning .s-toast-progress { background: #eab308; }
|
|
74
|
-
.s-toast-error .s-toast-progress { background: #ef4444; }
|
|
67
|
+
.s-toast-info { border-color: var(--t-info, #3b82f6); background: color-mix(in srgb, var(--t-info, #3b82f6) 8%, var(--t-surface)); }
|
|
68
|
+
.s-toast-success { border-color: var(--t-success, #22c55e); background: color-mix(in srgb, var(--t-success, #22c55e) 8%, var(--t-surface)); }
|
|
69
|
+
.s-toast-warning { border-color: var(--t-warning, #eab308); background: color-mix(in srgb, var(--t-warning, #eab308) 8%, var(--t-surface)); }
|
|
70
|
+
.s-toast-error { border-color: var(--t-error, #ef4444); background: color-mix(in srgb, var(--t-error, #ef4444) 8%, var(--t-surface)); }
|
|
71
|
+
.s-toast-info .s-toast-progress { background: var(--t-info, #3b82f6); }
|
|
72
|
+
.s-toast-success .s-toast-progress { background: var(--t-success, #22c55e); }
|
|
73
|
+
.s-toast-warning .s-toast-progress { background: var(--t-warning, #eab308); }
|
|
74
|
+
.s-toast-error .s-toast-progress { background: var(--t-error, #ef4444); }
|
|
75
75
|
|
|
76
76
|
/* ===== STYLE OVERRIDES ===== */
|
|
77
77
|
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
width: 20px;
|
|
33
33
|
height: 20px;
|
|
34
34
|
border-radius: 50%;
|
|
35
|
-
background: #fff;
|
|
35
|
+
background: var(--t-text-on-primary, var(--t-surface, #fff));
|
|
36
36
|
position: absolute;
|
|
37
37
|
top: 2px;
|
|
38
38
|
left: 2px;
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
box-shadow: var(--t-shadow-sm), inset 0 1px 0 rgba(255,255,255,0.3);
|
|
120
120
|
}
|
|
121
121
|
.s-toggle-liquid-glass.checked .s-toggle-track { background: color-mix(in srgb, var(--t-primary) 60%, transparent); }
|
|
122
|
-
.s-toggle
|
|
123
|
-
.s-toggle
|
|
122
|
+
.s-toggle input:focus-visible + .s-toggle-track,
|
|
123
|
+
.s-toggle input:focus-visible {
|
|
124
124
|
outline: 2px solid var(--t-primary);
|
|
125
125
|
outline-offset: 2px;
|
|
126
126
|
}
|
package/dist/config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { defaults, initMultistyleUI, iconClass } from "./config.svelte.js";
|
|
1
|
+
export { defaults, initMultistyleUI, getMultistyleDefaults, iconClass } from "./config.svelte.js";
|
package/dist/config.js
CHANGED