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.
Files changed (75) hide show
  1. package/README.md +4 -4
  2. package/cli/emit.js +9 -4
  3. package/cli/fixtures/sample.expected.svelte +2 -1
  4. package/cli/generate.js +5 -2
  5. package/cli/schema.js +16 -0
  6. package/dist/actions/dialog.js +13 -3
  7. package/dist/components/Accordion.svelte +7 -4
  8. package/dist/components/Alert.svelte +6 -3
  9. package/dist/components/Avatar.svelte +6 -3
  10. package/dist/components/Breadcrumb.svelte +6 -3
  11. package/dist/components/Button.svelte +6 -3
  12. package/dist/components/ButtonGroup.svelte +6 -3
  13. package/dist/components/Card.svelte +6 -3
  14. package/dist/components/Carousel.svelte +6 -3
  15. package/dist/components/Checkbox.svelte +6 -3
  16. package/dist/components/Chip.svelte +6 -3
  17. package/dist/components/CodeEditor.svelte +10 -4
  18. package/dist/components/Column.svelte +8 -1
  19. package/dist/components/CommandPalette.svelte +6 -3
  20. package/dist/components/CrudView.svelte +68 -28
  21. package/dist/components/DatePicker.svelte +20 -6
  22. package/dist/components/Divider.svelte +6 -3
  23. package/dist/components/Drawer.svelte +14 -3
  24. package/dist/components/DropdownMenu.svelte +6 -3
  25. package/dist/components/FAB.svelte +6 -3
  26. package/dist/components/FileUpload.svelte +17 -4
  27. package/dist/components/FilterBar.svelte +24 -14
  28. package/dist/components/GraphEditor.svelte +4 -3
  29. package/dist/components/Grid.svelte +8 -1
  30. package/dist/components/IconButton.svelte +6 -3
  31. package/dist/components/InlineEdit.svelte +6 -3
  32. package/dist/components/Input.svelte +14 -3
  33. package/dist/components/Modal.svelte +8 -4
  34. package/dist/components/Pagination.svelte +11 -3
  35. package/dist/components/Popover.svelte +12 -4
  36. package/dist/components/ProgressBar.svelte +6 -3
  37. package/dist/components/Radio.svelte +6 -3
  38. package/dist/components/Rating.svelte +10 -6
  39. package/dist/components/Row.svelte +8 -1
  40. package/dist/components/Select.svelte +9 -4
  41. package/dist/components/Skeleton.svelte +6 -3
  42. package/dist/components/Slider.svelte +8 -4
  43. package/dist/components/SortableList.svelte +6 -3
  44. package/dist/components/Spinner.svelte +6 -3
  45. package/dist/components/Stepper.svelte +9 -4
  46. package/dist/components/Table.svelte +6 -3
  47. package/dist/components/Tabs.svelte +8 -4
  48. package/dist/components/TextEditor.svelte +6 -3
  49. package/dist/components/Textarea.svelte +20 -6
  50. package/dist/components/Toast.svelte +8 -5
  51. package/dist/components/Toggle.svelte +6 -3
  52. package/dist/components/Tooltip.svelte +11 -4
  53. package/dist/components/charts/Chart.svelte +32 -21
  54. package/dist/components/charts/MermaidChart.svelte +14 -4
  55. package/dist/components/charts/chart-config.d.ts +3 -3
  56. package/dist/components/charts/chart-config.js +8 -0
  57. package/dist/components/charts/index.d.ts +12 -0
  58. package/dist/components/charts/index.js +12 -0
  59. package/dist/components/checkbox-styles.css +2 -2
  60. package/dist/components/crudview-styles.css +2 -2
  61. package/dist/components/radio-styles.css +2 -2
  62. package/dist/components/slider-styles.css +2 -2
  63. package/dist/components/text-editor-core/sanitizer.js +11 -3
  64. package/dist/components/theme.css +59 -49
  65. package/dist/components/toast-styles.css +8 -8
  66. package/dist/components/toggle-styles.css +3 -3
  67. package/dist/config.d.ts +1 -1
  68. package/dist/config.js +1 -1
  69. package/dist/config.svelte.js +11 -1
  70. package/dist/index.d.ts +0 -12
  71. package/dist/index.js +2 -13
  72. package/dist/themes/generator.js +1 -1
  73. package/dist/themes/presets.js +6 -6
  74. package/dist/utils/filter.js +8 -4
  75. package/package.json +11 -3
package/README.md CHANGED
@@ -21,7 +21,7 @@ npm install svelte-multistyle-ui
21
21
  pnpm add svelte-multistyle-ui
22
22
  ```
23
23
 
24
- > Peer dependencies are Svelte `^5.0.0`, Chart.js `^4.5.1` for data charts, and Mermaid `^12.3.0` for Mermaid diagrams.
24
+ > Peer dependencies are Svelte `^5.20.0`, plus optional Chart.js `^4.5.1` (for `svelte-multistyle-ui/charts`) and Mermaid `^12.3.0` (for `MermaidChart`).
25
25
 
26
26
  ## LLM skill
27
27
 
@@ -89,7 +89,7 @@ The library exports the following components from `svelte-multistyle-ui`:
89
89
  - Navigation: `Breadcrumb`, `Pagination`, `Stepper`
90
90
  - Data display: `Avatar`, `Chip`, `Tooltip`, `ProgressBar`, `Table`, `Spinner`, `Skeleton`, `Rating`
91
91
  - Feedback: `Alert`, `Toast`
92
- - Charts: `BarChart`, `LineChart`, `PieChart`, `DoughnutChart`, `RadarChart`, `PolarAreaChart`, `ScatterChart`, `BubbleChart`, `StackedBarChart`, `StackedLineChart`, `ComboChart`, `MermaidChart`
92
+ - Charts (`svelte-multistyle-ui/charts`): `BarChart`, `LineChart`, `PieChart`, `DoughnutChart`, `RadarChart`, `PolarAreaChart`, `ScatterChart`, `BubbleChart`, `StackedBarChart`, `StackedLineChart`, `ComboChart`, `MermaidChart`
93
93
  - Graphs: `GraphEditor` for flowcharts and executable blueprints
94
94
  - Aggregate / CRUD: [`FilterBar`](skill/references/FilterBar.md), [`CrudView`](skill/references/CrudView.md) (with `createDbmrClient`, `normalizeDiscovery`, `mapOptionsToCrudProps`, `serializeDbmrQuery`, `buildDbmrFilterAst`, `serializeDbmrQueryBody`)
95
95
 
@@ -311,7 +311,7 @@ Chart components are thin styled wrappers around [Chart.js](https://www.chartjs.
311
311
 
312
312
  ```svelte
313
313
  <script>
314
- import { BarChart } from 'svelte-multistyle-ui';
314
+ import { BarChart } from 'svelte-multistyle-ui/charts';
315
315
  import 'svelte-multistyle-ui/theme.css';
316
316
 
317
317
  const data = {
@@ -335,7 +335,7 @@ npm install svelte-multistyle-ui mermaid
335
335
 
336
336
  ```svelte
337
337
  <script>
338
- import { MermaidChart } from 'svelte-multistyle-ui';
338
+ import { MermaidChart } from 'svelte-multistyle-ui/charts';
339
339
  import 'svelte-multistyle-ui/theme.css';
340
340
 
341
341
  const source = 'flowchart LR\n A[Draft] --> B[Review] --> C[Publish]';
package/cli/emit.js CHANGED
@@ -36,9 +36,14 @@ export function emitPage(doc, cfg) {
36
36
 
37
37
  function emitImports(used) {
38
38
  const components = [...used].sort();
39
+ const rootComps = components.filter((c) => !registry[c]?.chart);
40
+ const chartComps = components.filter((c) => registry[c]?.chart);
39
41
  const lines = [`import { onMount } from "svelte";`];
40
- if (components.length) {
41
- lines.push(`import { ${components.join(", ")} } from "svelte-multistyle-ui";`);
42
+ if (rootComps.length) {
43
+ lines.push(`import { ${rootComps.join(", ")} } from "svelte-multistyle-ui";`);
44
+ }
45
+ if (chartComps.length) {
46
+ lines.push(`import { ${chartComps.join(", ")} } from "svelte-multistyle-ui/charts";`);
42
47
  }
43
48
  return lines;
44
49
  }
@@ -187,8 +192,8 @@ function emitProp(key, value) {
187
192
  if (typeof value === "string") {
188
193
  const ref = value.match(/^\{([A-Za-z_$][\w$]*)\}$/);
189
194
  if (ref) return `${key}={${ref[1]}}`; // reactive ref to a state var
190
- if (value.includes("{") || value.includes("}")) {
191
- return `${key}={${JSON.stringify(value)}}`; // prevent Svelte from evaluating {expr} inside quoted attrs
195
+ if (value.includes("{") || value.includes("}") || value.includes('"')) {
196
+ return `${key}={${JSON.stringify(value)}}`; // prevent Svelte from evaluating {expr} or breaking on \" inside quoted attrs
192
197
  }
193
198
  return `${key}=${JSON.stringify(value)}`; // plain string literal
194
199
  }
@@ -1,6 +1,7 @@
1
1
  <script>
2
2
  import { onMount } from "svelte";
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";
3
+ import { Accordion, Alert, Avatar, Breadcrumb, Button, ButtonGroup, Card, Checkbox, Chip, Column, DatePicker, Divider, DropdownMenu, FileUpload, Grid, IconButton, Input, MultiSelect, Pagination, Popover, ProgressBar, Radio, Rating, Row, Select, Skeleton, Slider, Spinner, Stepper, Table, Tabs, Textarea, Toggle, Tooltip } from "svelte-multistyle-ui";
4
+ import { BarChart, DoughnutChart, LineChart, PieChart, PolarAreaChart, RadarChart } from "svelte-multistyle-ui/charts";
4
5
 
5
6
  let username = $state("");
6
7
  let email = $state("");
package/cli/generate.js CHANGED
@@ -90,7 +90,8 @@ const BIND_TYPE = {
90
90
  Rating: "number",
91
91
  FilterBar: "array",
92
92
  CrudView: "array",
93
- GraphEditor: "object",
93
+ Toast: "array",
94
+ GraphEditor: "graph",
94
95
  };
95
96
 
96
97
  const CONFIG_KEYS = new Set(["style", "theme", "mode"]);
@@ -422,7 +423,7 @@ function buildAutoState(nodes, used = new Set()) {
422
423
  function makeStateName(node, entry, used) {
423
424
  const props = node.props || {};
424
425
  const raw = props.label || props.placeholder || props.title || entry.importName;
425
- const parts = String(raw)
426
+ let parts = String(raw)
426
427
  .toLowerCase()
427
428
  .replace(/[^a-z0-9_$]+/g, " ")
428
429
  .trim()
@@ -460,6 +461,8 @@ function defaultValue(type) {
460
461
  return false;
461
462
  case "array":
462
463
  return [];
464
+ case "graph":
465
+ return { nodes: [], edges: [] };
463
466
  case "object":
464
467
  return {};
465
468
  default:
package/cli/schema.js CHANGED
@@ -99,6 +99,7 @@ function walkNode(node, stateNames, errors, warnings, depth) {
99
99
  }
100
100
 
101
101
  validateBind(node, entry, stateNames, errors);
102
+ validateProps(node, errors);
102
103
 
103
104
  if ((node.children != null || node.text != null) && entry.kind === "leaf") {
104
105
  warnings.push(`Component "${node.component}" takes no children; ignoring.`);
@@ -118,6 +119,17 @@ function walkNode(node, stateNames, errors, warnings, depth) {
118
119
  if (Array.isArray(node.children)) walkBody(node.children, stateNames, errors, warnings, depth + 1);
119
120
  }
120
121
 
122
+ const VALID_KEY_RE = /^[A-Za-z_$][\w$-]*$/;
123
+
124
+ function validateProps(node, errors) {
125
+ if (!node.props || typeof node.props !== "object") return;
126
+ for (const k of Object.keys(node.props)) {
127
+ if (!VALID_KEY_RE.test(k)) {
128
+ errors.push(`Invalid prop name "${k}" on ${node.component}; must match /^[A-Za-z_$][\\w$-]*$/.`);
129
+ }
130
+ }
131
+ }
132
+
121
133
  function validateBind(node, entry, stateNames, errors) {
122
134
  const bind = node.bind;
123
135
  if (bind == null) return;
@@ -131,6 +143,10 @@ function validateBind(node, entry, stateNames, errors) {
131
143
  }
132
144
  if (typeof bind === "object" && !Array.isArray(bind)) {
133
145
  for (const [prop, refName] of Object.entries(bind)) {
146
+ if (!VALID_KEY_RE.test(prop)) {
147
+ errors.push(`Invalid bind prop name "${prop}" on ${node.component}.`);
148
+ continue;
149
+ }
134
150
  if (typeof refName !== "string") {
135
151
  errors.push(`bind.${prop} must be a variable name string.`);
136
152
  continue;
@@ -57,10 +57,19 @@ export function dialog(node, params = {}) {
57
57
  });
58
58
  }
59
59
 
60
+ let closed = false;
61
+ function triggerClose() {
62
+ if (closed) return;
63
+ closed = true;
64
+ currentParams.onclose?.();
65
+ }
66
+
60
67
  function handleKeydown(e) {
61
68
  if (e.key === "Escape") {
69
+ if (e.defaultPrevented) return;
70
+ e.preventDefault();
62
71
  e.stopPropagation();
63
- currentParams.onclose?.();
72
+ triggerClose();
64
73
  return;
65
74
  }
66
75
 
@@ -86,14 +95,15 @@ export function dialog(node, params = {}) {
86
95
  }
87
96
  }
88
97
 
89
- node.addEventListener("keydown", handleKeydown);
98
+ document.addEventListener("keydown", handleKeydown);
90
99
 
91
100
  return {
92
101
  update(nextParams) {
93
102
  currentParams = nextParams || {};
103
+ closed = false;
94
104
  },
95
105
  destroy() {
96
- node.removeEventListener("keydown", handleKeydown);
106
+ document.removeEventListener("keydown", handleKeydown);
97
107
  if (shouldLock && typeof document !== "undefined") {
98
108
  scrollLockCount = Math.max(0, scrollLockCount - 1);
99
109
  if (scrollLockCount === 0) {
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./accordion-styles.css";
3
- import { defaults } from "../config.js";
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,8 +16,11 @@
16
16
  ...rest
17
17
  } = $props();
18
18
 
19
- const style = $derived(styleProp ?? defaults.style);
20
- const theme = $derived(themeProp ?? defaults.theme);
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-accordion-${style}`);
23
26
  const themeClass = $derived(`theme-${theme}`);
@@ -53,7 +56,7 @@
53
56
  height="18"
54
57
  viewBox="0 0 24 24"
55
58
  fill="none"
56
- stroke="#64748b"
59
+ stroke="currentColor"
57
60
  stroke-width="2"
58
61
  >
59
62
  <path d="M6 9l6 6 6-6" />
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./alert-styles.css";
3
- import { defaults, iconClass } from "../config.js";
3
+ import { getMultistyleDefaults, iconClass } from "../config.js";
4
4
  import { slide } from "svelte/transition";
5
5
  import { cn } from "../utils/cn.js";
6
6
 
@@ -19,8 +19,11 @@
19
19
  ...rest
20
20
  } = $props();
21
21
 
22
- const style = $derived(styleProp ?? defaults.style);
23
- const theme = $derived(themeProp ?? defaults.theme);
22
+ const _cfg = getMultistyleDefaults();
23
+
24
+
25
+ const style = $derived(styleProp ?? _cfg.style);
26
+ const theme = $derived(themeProp ?? _cfg.theme);
24
27
 
25
28
  const styleClass = $derived(`s-alert-${style}`);
26
29
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./avatar-styles.css";
3
- import { defaults } from "../config.js";
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 style = $derived(styleProp ?? defaults.style);
21
- const theme = $derived(themeProp ?? defaults.theme);
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-avatar-${style}`);
24
27
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./breadcrumb-styles.css";
3
- import { defaults } from "../config.js";
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 }} */
@@ -8,8 +8,11 @@
8
8
 
9
9
  let { style: styleProp, theme: themeProp, items = [], class: className = "", ...rest } = $props();
10
10
 
11
- const style = $derived(styleProp ?? defaults.style);
12
- const theme = $derived(themeProp ?? defaults.theme);
11
+ const _cfg = getMultistyleDefaults();
12
+
13
+
14
+ const style = $derived(styleProp ?? _cfg.style);
15
+ const theme = $derived(themeProp ?? _cfg.theme);
13
16
 
14
17
  const styleClass = $derived(`s-breadcrumb-${style}`);
15
18
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./button-styles.css";
3
- import { defaults, iconClass } from "../config.js";
3
+ import { getMultistyleDefaults, iconClass } 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 }} */
@@ -21,8 +21,11 @@
21
21
  ...rest
22
22
  } = $props();
23
23
 
24
- const style = $derived(styleProp ?? defaults.style);
25
- const theme = $derived(themeProp ?? defaults.theme);
24
+ const _cfg = getMultistyleDefaults();
25
+
26
+
27
+ const style = $derived(styleProp ?? _cfg.style);
28
+ const theme = $derived(themeProp ?? _cfg.theme);
26
29
 
27
30
  const styleClass = $derived(`s-button-${style}`);
28
31
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./buttongroup-styles.css";
3
- import { defaults } from "../config.js";
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 }} */
@@ -18,8 +18,11 @@
18
18
  ...rest
19
19
  } = $props();
20
20
 
21
- const style = $derived(styleProp ?? defaults.style);
22
- const theme = $derived(themeProp ?? defaults.theme);
21
+ const _cfg = getMultistyleDefaults();
22
+
23
+
24
+ const style = $derived(styleProp ?? _cfg.style);
25
+ const theme = $derived(themeProp ?? _cfg.theme);
23
26
  const styleClass = $derived(`s-btn-group-${style}`);
24
27
  const themeClass = $derived(`theme-${theme}`);
25
28
 
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./card-styles.css";
3
- import { defaults } from "../config.js";
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,8 +16,11 @@
16
16
  ...rest
17
17
  } = $props();
18
18
 
19
- const style = $derived(styleProp ?? defaults.style);
20
- const theme = $derived(themeProp ?? defaults.theme);
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-card-${style}`);
23
26
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./carousel-styles.css";
3
- import { defaults } from "../config.js";
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 }} */
@@ -18,8 +18,11 @@
18
18
  ...rest
19
19
  } = $props();
20
20
 
21
- const style = $derived(styleProp ?? defaults.style);
22
- const theme = $derived(themeProp ?? defaults.theme);
21
+ const _cfg = getMultistyleDefaults();
22
+
23
+
24
+ const style = $derived(styleProp ?? _cfg.style);
25
+ const theme = $derived(themeProp ?? _cfg.theme);
23
26
  const styleClass = $derived(`s-carousel-${style}`);
24
27
  const themeClass = $derived(`theme-${theme}`);
25
28
  let current = $state(0);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./checkbox-styles.css";
3
- import { defaults } from "../config.js";
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 style = $derived(styleProp ?? defaults.style);
21
- const theme = $derived(themeProp ?? defaults.theme);
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-checkbox-${style}`);
24
27
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./chip-styles.css";
3
- import { defaults } from "../config.js";
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 }} */
@@ -20,8 +20,11 @@
20
20
  ...rest
21
21
  } = $props();
22
22
 
23
- const style = $derived(styleProp ?? defaults.style);
24
- const theme = $derived(themeProp ?? defaults.theme);
23
+ const _cfg = getMultistyleDefaults();
24
+
25
+
26
+ const style = $derived(styleProp ?? _cfg.style);
27
+ const theme = $derived(themeProp ?? _cfg.theme);
25
28
  const styleClass = $derived(`s-chip-${style}`);
26
29
  const themeClass = $derived(`theme-${theme}`);
27
30
 
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./codeeditor-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { cn } from "../utils/cn.js";
5
5
  import "./prism-manual.js";
6
6
  import Prism from "prismjs";
@@ -31,8 +31,11 @@
31
31
  ...rest
32
32
  } = $props();
33
33
 
34
- const style = $derived(styleProp ?? defaults.style);
35
- const theme = $derived(themeProp ?? defaults.theme);
34
+ const _cfg = getMultistyleDefaults();
35
+
36
+
37
+ const style = $derived(styleProp ?? _cfg.style);
38
+ const theme = $derived(themeProp ?? _cfg.theme);
36
39
  const styleClass = $derived(`s-codeeditor-${style}`);
37
40
  const themeClass = $derived(`theme-${theme}`);
38
41
 
@@ -91,6 +94,8 @@
91
94
 
92
95
  // Scroll sync: keep the highlighted <pre> (behind) aligned with the
93
96
  // transparent <textarea> (front) so the caret tracks the tokens.
97
+ const uid = $props.id();
98
+ const editorId = `codeeditor-${uid}`;
94
99
  let preEl = $state(null);
95
100
  let taEl = $state(null);
96
101
  function syncScroll() {
@@ -103,7 +108,7 @@
103
108
 
104
109
  <div class={cn("s-codeeditor-wrapper", styleClass, themeClass, className)}>
105
110
  {#if label}
106
- <label class="s-codeeditor-label">{label}</label>
111
+ <label class="s-codeeditor-label" for={editable ? editorId : undefined}>{label}</label>
107
112
  {/if}
108
113
  <div class="s-codeeditor-toolbar">
109
114
  <span class="s-codeeditor-lang">{langLabel}</span>
@@ -121,6 +126,7 @@
121
126
  >{@html highlighted}</code></pre>
122
127
  {#if editable}
123
128
  <textarea
129
+ id={editorId}
124
130
  class="s-codeeditor-textarea"
125
131
  bind:value
126
132
  bind:this={taEl}
@@ -1,11 +1,14 @@
1
1
  <script>
2
2
  import "./column-styles.css";
3
+ import { getMultistyleDefaults } from "../config.js";
3
4
  import { cn } from "../utils/cn.js";
4
5
 
5
6
  /** @type {{ style?: string, theme?: string, class?: string, [key: string]: any }} */
6
7
 
7
8
 
8
9
  let {
10
+ style: styleProp,
11
+ theme: themeProp,
9
12
  gap = "8px",
10
13
  align = "stretch",
11
14
  justify = "start",
@@ -32,11 +35,15 @@
32
35
  evenly: "space-evenly",
33
36
  };
34
37
 
38
+ const _cfg = getMultistyleDefaults();
39
+ const style = $derived(styleProp ?? _cfg.style);
40
+ const theme = $derived(themeProp ?? _cfg.theme);
41
+
35
42
  const styleStr = $derived(
36
43
  `display:flex;flex-direction:column;gap:${gap};align-items:${alignItems[align] ?? align};justify-content:${justifyContent[justify] ?? justify};${fill ? "width:100%;" : ""}`
37
44
  );
38
45
  </script>
39
46
 
40
- <div class={cn("s-column", className)} style={styleStr} {...rest}>
47
+ <div class={cn("s-column", `s-column-${style}`, `theme-${theme}`, className)} style={styleStr} {...rest}>
41
48
  {@render children?.()}
42
49
  </div>
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./commandpalette-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { fade } from "svelte/transition";
5
5
  import { portal } from "../actions/portal.js";
6
6
  import { cn } from "../utils/cn.js";
@@ -19,8 +19,11 @@
19
19
  ...rest
20
20
  } = $props();
21
21
 
22
- const style = $derived(styleProp ?? defaults.style);
23
- const theme = $derived(themeProp ?? defaults.theme);
22
+ const _cfg = getMultistyleDefaults();
23
+
24
+
25
+ const style = $derived(styleProp ?? _cfg.style);
26
+ const theme = $derived(themeProp ?? _cfg.theme);
24
27
  const styleClass = $derived(`s-cmdk-${style}`);
25
28
  const themeClass = $derived(`theme-${theme}`);
26
29