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
@@ -6,7 +6,7 @@
6
6
  import Select from "./Select.svelte";
7
7
  import Drawer from "./Drawer.svelte";
8
8
  import Modal from "./Modal.svelte";
9
- import { defaults } from "../config.js";
9
+ import { getMultistyleDefaults } from "../config.js";
10
10
  import { cn } from "../utils/cn.js";
11
11
  import { filterItems } from "../utils/filter.js";
12
12
  import { normalizeDiscovery } from "../utils/dbmr.js";
@@ -92,7 +92,7 @@
92
92
  // Snippets
93
93
  header: headerSnippet,
94
94
  headerActions: headerActionsSnippet,
95
- filters: filtersSnippet,
95
+ filterBar: filtersSnippet,
96
96
  bulkActions: bulkActionsSnippet,
97
97
  cell: cellSnippet,
98
98
  rowActions: rowActionsSnippet,
@@ -104,8 +104,11 @@
104
104
  ...rest
105
105
  } = $props();
106
106
 
107
- const style = $derived(styleProp ?? defaults.style);
108
- const theme = $derived(themeProp ?? defaults.theme);
107
+ const _cfg = getMultistyleDefaults();
108
+
109
+
110
+ const style = $derived(styleProp ?? _cfg.style);
111
+ const theme = $derived(themeProp ?? _cfg.theme);
109
112
  const styleClass = $derived(`s-crud-view-${style}`);
110
113
  const themeClass = $derived(`theme-${theme}`);
111
114
 
@@ -124,9 +127,12 @@
124
127
  let initialItemSnapshot = $state({});
125
128
  let draftItem = $state({});
126
129
  let isNewItem = $state(false);
130
+ const crudUid = $props.id();
131
+ const deleteTitleId = `crud-delete-title-${crudUid}`;
127
132
  let saving = $state(false);
128
133
  let deleting = $state(false);
129
134
  let actionError = $state("");
135
+ let deleteError = $state("");
130
136
 
131
137
  const discoveredFields = $derived(normalizeDiscovery(discovery));
132
138
 
@@ -260,6 +266,17 @@
260
266
  : filteredDataset.length
261
267
  );
262
268
  const totalPages = $derived(Math.max(1, Math.ceil(totalItems / Math.max(1, perPage))));
269
+ const visiblePages = $derived.by(() => {
270
+ if (totalPages <= 7) return Array.from({ length: totalPages }, (_, i) => i + 1);
271
+ const pages = [1];
272
+ const start = Math.max(2, currentPage - 1);
273
+ const end = Math.min(totalPages - 1, currentPage + 1);
274
+ if (start > 2) pages.push("...");
275
+ for (let p = start; p <= end; p++) pages.push(p);
276
+ if (end < totalPages - 1) pages.push("...");
277
+ pages.push(totalPages);
278
+ return pages;
279
+ });
263
280
 
264
281
  $effect(() => {
265
282
  if (hasKnownTotal && currentPage > totalPages && totalPages > 0) {
@@ -282,9 +299,10 @@
282
299
  return item;
283
300
  }
284
301
 
302
+ const selectedKeySet = $derived(new Set(selected.map(getRowKey)));
303
+
285
304
  function isRowSelected(item) {
286
- const key = getRowKey(item);
287
- return selected.some((s) => getRowKey(s) === key);
305
+ return selectedKeySet.has(getRowKey(item));
288
306
  }
289
307
 
290
308
  const isAllSelected = $derived(
@@ -553,7 +571,7 @@
553
571
  openMenuIndex = null;
554
572
  itemToDelete = item;
555
573
  isBulkDelete = false;
556
- actionError = "";
574
+ deleteError = "";
557
575
  deleteModalOpen = true;
558
576
  }
559
577
 
@@ -561,31 +579,47 @@
561
579
  if (selected.length === 0) return;
562
580
  itemToDelete = null;
563
581
  isBulkDelete = true;
564
- actionError = "";
582
+ deleteError = "";
565
583
  deleteModalOpen = true;
566
584
  }
567
585
 
568
586
  async function confirmDelete() {
569
587
  if (deleting) return;
570
- actionError = "";
588
+ deleteError = "";
571
589
  deleting = true;
572
590
 
573
591
  try {
574
592
  if (isBulkDelete) {
575
- let res;
593
+ let deletedKeys;
576
594
  if (onbulkdelete) {
577
- res = await onbulkdelete(selected);
595
+ const res = await onbulkdelete(selected);
596
+ if (res === false) return;
597
+ deletedKeys = new Set(selected.map(getRowKey));
578
598
  } else if (serverSide && ondelete) {
579
- await Promise.all(selected.map((item) => ondelete(item)));
599
+ deletedKeys = new Set();
600
+ const results = await Promise.allSettled(
601
+ selected.map(async (item) => {
602
+ const r = await ondelete(item);
603
+ if (r !== false) deletedKeys.add(getRowKey(item));
604
+ })
605
+ );
606
+ const rejected = results.find((r) => r.status === "rejected");
607
+ if (deletedKeys.size === 0 && rejected) {
608
+ throw rejected.reason;
609
+ }
610
+ } else {
611
+ deletedKeys = new Set(selected.map(getRowKey));
580
612
  }
581
- if (res === false) return;
582
- const deletedKeys = new Set(selected.map(getRowKey));
583
613
  if (data && Array.isArray(data)) {
584
614
  data = data.filter((d) => !deletedKeys.has(getRowKey(d)));
585
615
  } else if (items && Array.isArray(items)) {
586
616
  items = items.filter((d) => !deletedKeys.has(getRowKey(d)));
587
617
  }
588
- selected = [];
618
+ selected = selected.filter((s) => !deletedKeys.has(getRowKey(s)));
619
+ if (selected.length > 0) {
620
+ deleteError = `${selected.length} item(s) could not be deleted.`;
621
+ return;
622
+ }
589
623
  } else if (itemToDelete) {
590
624
  const res = await ondelete?.(itemToDelete);
591
625
  if (res === false) return;
@@ -602,7 +636,7 @@
602
636
  }
603
637
  }
604
638
  } catch (err) {
605
- actionError = err?.message || "Delete failed";
639
+ deleteError = err?.message || "Delete failed";
606
640
  return;
607
641
  } finally {
608
642
  deleting = false;
@@ -753,6 +787,7 @@
753
787
  <button
754
788
  type="button"
755
789
  role="tab"
790
+ aria-selected={activeDetailTab === "details"}
756
791
  class="s-crud-nav-tab"
757
792
  class:active={activeDetailTab === "details"}
758
793
  onclick={() => (activeDetailTab = "details")}
@@ -771,6 +806,7 @@
771
806
  <button
772
807
  type="button"
773
808
  role="tab"
809
+ aria-selected={activeDetailTab === child.name}
774
810
  class="s-crud-nav-tab"
775
811
  class:active={activeDetailTab === child.name}
776
812
  onclick={() => handleSelectChildTab(child)}
@@ -860,7 +896,8 @@
860
896
  if (activeChild?.onadd) {
861
897
  activeChild.onadd(activeItem);
862
898
  } else if (activeItem) {
863
- const newChild = { id: 'c_' + Date.now(), title: `New ${activeChild?.label || 'Item'} ${childItems ? childItems.length + 1 : 1}`, pages: 10, order: childItems ? childItems.length + 1 : 1 };
899
+ const newChild = {};
900
+ for (const cCol of childCols) newChild[cCol.key] = "";
864
901
  if (!activeItem[activeChild.name]) activeItem[activeChild.name] = [];
865
902
  activeItem[activeChild.name] = [...activeItem[activeChild.name], newChild];
866
903
  }
@@ -1172,7 +1209,10 @@
1172
1209
  {/if}
1173
1210
 
1174
1211
  <!-- DATA TABLE -->
1175
- <div class="s-crud-table-container">
1212
+ <div class="s-crud-table-container" aria-busy={loading}>
1213
+ {#if loading}
1214
+ <div class="s-crud-loading-bar" style="padding:8px 14px;font-size:12.5px;color:var(--t-text-hint);border-bottom:1px solid var(--t-card-border-color,#e2e8f0);">Loading...</div>
1215
+ {/if}
1176
1216
  <div class="s-crud-table-scroll">
1177
1217
  <table class="s-crud-table">
1178
1218
  <thead>
@@ -1372,16 +1412,16 @@
1372
1412
  >&laquo;</button>
1373
1413
 
1374
1414
  {#if hasKnownTotal}
1375
- {#each Array.from({ length: totalPages }, (_, i) => i + 1) as p}
1376
- {#if p === 1 || p === totalPages || (p >= currentPage - 1 && p <= currentPage + 1)}
1415
+ {#each visiblePages as p}
1416
+ {#if p === "..."}
1417
+ <span style="padding: 0 4px; opacity: 0.5;">...</span>
1418
+ {:else}
1377
1419
  <button
1378
1420
  type="button"
1379
1421
  class="s-crud-page-btn"
1380
1422
  class:active={p === currentPage}
1381
1423
  onclick={() => { currentPage = p; notifyParamsChange(); }}
1382
1424
  >{p}</button>
1383
- {:else if p === currentPage - 2 || p === currentPage + 2}
1384
- <span style="padding: 0 4px; opacity: 0.5;">...</span>
1385
1425
  {/if}
1386
1426
  {/each}
1387
1427
  {:else}
@@ -1502,12 +1542,12 @@
1502
1542
  {#if deleteModalOpen}
1503
1543
  <div
1504
1544
  use:portal
1505
- use:dialog={{ onclose: () => { deleteModalOpen = false; itemToDelete = null; actionError = ""; } }}
1545
+ use:dialog={{ onclose: () => { deleteModalOpen = false; itemToDelete = null; deleteError = ""; } }}
1506
1546
  class={cn("s-crud-modal-overlay", styleClass, themeClass)}
1507
1547
  transition:fade={{ duration: 150 }}
1508
1548
  role="dialog"
1509
1549
  aria-modal="true"
1510
- aria-labelledby="crud-delete-title"
1550
+ aria-labelledby={deleteTitleId}
1511
1551
  >
1512
1552
  <div
1513
1553
  class="s-crud-delete-modal"
@@ -1530,16 +1570,16 @@
1530
1570
  <line x1="12" y1="16" x2="12.01" y2="16"></line>
1531
1571
  </svg>
1532
1572
  </div>
1533
- <h3 id="crud-delete-title" class="s-crud-modal-title">
1573
+ <h3 id={deleteTitleId} class="s-crud-modal-title">
1534
1574
  {isBulkDelete ? `Delete ${selected.length} items` : deleteConfirmTitle}
1535
1575
  </h3>
1536
1576
  </div>
1537
1577
 
1538
1578
  <p class="s-crud-modal-desc">{getDeleteMessage()}</p>
1539
1579
 
1540
- {#if actionError}
1580
+ {#if deleteError}
1541
1581
  <div class="s-crud-action-error" role="alert" style="color: var(--t-error, #dc2626); background: color-mix(in srgb, var(--t-error, #dc2626) 10%, transparent); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px;">
1542
- {actionError}
1582
+ {deleteError}
1543
1583
  </div>
1544
1584
  {/if}
1545
1585
 
@@ -1548,7 +1588,7 @@
1548
1588
  type="button"
1549
1589
  class="s-crud-btn-cancel"
1550
1590
  disabled={deleting}
1551
- onclick={() => { deleteModalOpen = false; itemToDelete = null; actionError = ""; }}
1591
+ onclick={() => { deleteModalOpen = false; itemToDelete = null; deleteError = ""; }}
1552
1592
  >Cancel</button>
1553
1593
  <button
1554
1594
  type="button"
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./datepicker-styles.css";
3
- import { defaults, iconClass } from "../config.js";
3
+ import { getMultistyleDefaults, iconClass } from "../config.js";
4
4
  import { portal } from "../actions/portal.js";
5
5
  import { dialog } from "../actions/dialog.js";
6
6
  import { cn } from "../utils/cn.js";
@@ -27,11 +27,15 @@
27
27
  ...rest
28
28
  } = $props();
29
29
 
30
- const style = $derived(styleProp ?? defaults.style);
31
- const theme = $derived(themeProp ?? defaults.theme);
30
+ const _cfg = getMultistyleDefaults();
31
+
32
+
33
+ const style = $derived(styleProp ?? _cfg.style);
34
+ const theme = $derived(themeProp ?? _cfg.theme);
32
35
  const styleClass = $derived(`s-datepicker-${style}`);
33
36
  const themeClass = $derived(`theme-${theme}`);
34
- const internalId = `dp-${$props.id()}`;
37
+ const uid = $props.id();
38
+ const internalId = `dp-${uid}`;
35
39
  const dispFormat = $derived(displayFormat ?? format);
36
40
 
37
41
  // State
@@ -40,6 +44,16 @@
40
44
  let viewDate = $state(new Date());
41
45
  let selectedDate = $state(null);
42
46
  let isMobile = $state(false);
47
+ let skipNextFocus = false;
48
+ function closePicker() {
49
+ skipNextFocus = true;
50
+ open = false;
51
+ if (typeof requestAnimationFrame !== "undefined") {
52
+ requestAnimationFrame(() => { skipNextFocus = false; });
53
+ } else {
54
+ skipNextFocus = false;
55
+ }
56
+ }
43
57
 
44
58
  // Format helpers — uses dayjs for full format support (MMM, MMMM, etc.)
45
59
  function toDayjsFmt(f) {
@@ -329,7 +343,7 @@
329
343
  placeholder={useFloatingLabel ? "" : inputPlaceholder}
330
344
  {disabled}
331
345
  onfocus={() => {
332
- if (!disabled) open = true;
346
+ if (!disabled && !skipNextFocus) open = true;
333
347
  }}
334
348
  onclick={() => {
335
349
  if (!disabled) open = true;
@@ -349,7 +363,7 @@
349
363
  class:s-datepicker-mobile={isMobile}
350
364
  bind:this={overlayEl}
351
365
  use:portal
352
- use:dialog={{ onclose: () => (open = false), lockScroll: isMobile }}
366
+ use:dialog={{ onclose: closePicker, lockScroll: isMobile }}
353
367
  role="dialog"
354
368
  aria-modal="true"
355
369
  aria-label="Date picker"
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./divider-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 }} */
@@ -15,8 +15,11 @@
15
15
  ...rest
16
16
  } = $props();
17
17
 
18
- const style = $derived(styleProp ?? defaults.style);
19
- const theme = $derived(themeProp ?? defaults.theme);
18
+ const _cfg = getMultistyleDefaults();
19
+
20
+
21
+ const style = $derived(styleProp ?? _cfg.style);
22
+ const theme = $derived(themeProp ?? _cfg.theme);
20
23
 
21
24
  const styleClass = $derived(`s-divider-${style}`);
22
25
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./drawer-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 { dialog } from "../actions/dialog.js";
@@ -14,14 +14,19 @@
14
14
  theme: themeProp,
15
15
  position = "left",
16
16
  open = $bindable(false),
17
+ title = "",
18
+ showClose = true,
17
19
  children,
18
20
  onclose,
19
21
  class: className = "",
20
22
  ...rest
21
23
  } = $props();
22
24
 
23
- const style = $derived(styleProp ?? defaults.style);
24
- const theme = $derived(themeProp ?? defaults.theme);
25
+ const _cfg = getMultistyleDefaults();
26
+
27
+
28
+ const style = $derived(styleProp ?? _cfg.style);
29
+ const theme = $derived(themeProp ?? _cfg.theme);
25
30
  const styleClass = $derived(`s-drawer-${style}`);
26
31
  const themeClass = $derived(`theme-${theme}`);
27
32
 
@@ -70,6 +75,12 @@
70
75
  role="dialog"
71
76
  aria-modal="true"
72
77
  >
78
+ {#if title || showClose}
79
+ <div class="s-drawer-header" style="display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;">
80
+ {#if title}<h3 class="s-drawer-title" style="margin:0;font-size:16px;font-weight:600;">{title}</h3>{:else}<span></span>{/if}
81
+ {#if showClose}<button type="button" class="s-drawer-close" onclick={handleClose} aria-label="Close" style="background:none;border:none;font-size:20px;line-height:1;cursor:pointer;color:inherit;">&times;</button>{/if}
82
+ </div>
83
+ {/if}
73
84
  {@render children?.()}
74
85
  </div>
75
86
  </div>
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./dropdown-styles.css";
3
- import { defaults } from "../config.js";
3
+ import { getMultistyleDefaults } from "../config.js";
4
4
  import { fly } from "svelte/transition";
5
5
  import { cn } from "../utils/cn.js";
6
6
 
@@ -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-dropdown-${style}`);
26
29
  const themeClass = $derived(`theme-${theme}`);
27
30
  const variantClass = $derived(`dropdown-${color}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./fab-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-fab-${style}`);
24
27
  const themeClass = $derived(`theme-${theme}`);
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./fileupload-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 }} */
@@ -14,18 +14,29 @@
14
14
  multiple = false,
15
15
  disabled = false,
16
16
  label = "Drop files or click to upload",
17
+ onfiles,
17
18
  onchange,
18
19
  class: className = "",
19
20
  ...rest
20
21
  } = $props();
21
22
 
22
- const style = $derived(styleProp ?? defaults.style);
23
- 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);
24
28
 
25
29
  const styleClass = $derived(`s-fileupload-${style}`);
26
30
  const themeClass = $derived(`theme-${theme}`);
27
31
 
28
32
  let dragging = $state(false);
33
+ let inputEl = $state(null);
34
+
35
+ $effect(() => {
36
+ if (inputEl && (!files || files.length === 0)) {
37
+ inputEl.value = "";
38
+ }
39
+ });
29
40
 
30
41
  function matchesAccept(file) {
31
42
  if (!accept) return true;
@@ -45,6 +56,7 @@
45
56
  let next = Array.from(rawList || []).filter(matchesAccept);
46
57
  if (!multiple && next.length > 1) next = [next[0]];
47
58
  files = next;
59
+ onfiles?.(files);
48
60
  onchange?.(files);
49
61
  }
50
62
 
@@ -73,6 +85,7 @@
73
85
  {...rest}
74
86
  >
75
87
  <input
88
+ bind:this={inputEl}
76
89
  type="file"
77
90
  {accept}
78
91
  {multiple}
@@ -87,7 +100,7 @@
87
100
  height="32"
88
101
  viewBox="0 0 24 24"
89
102
  fill="none"
90
- stroke="#64748b"
103
+ stroke="currentColor"
91
104
  stroke-width="2"
92
105
  >
93
106
  <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><polyline
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./filterbar-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 {
6
6
  getOperatorsForType,
@@ -39,8 +39,11 @@
39
39
  ...rest
40
40
  } = $props();
41
41
 
42
- const style = $derived(styleProp ?? defaults.style);
43
- const theme = $derived(themeProp ?? defaults.theme);
42
+ const _cfg = getMultistyleDefaults();
43
+
44
+
45
+ const style = $derived(styleProp ?? _cfg.style);
46
+ const theme = $derived(themeProp ?? _cfg.theme);
44
47
  const styleClass = $derived(`s-filter-bar-${style}`);
45
48
  const themeClass = $derived(`theme-${theme}`);
46
49
 
@@ -198,10 +201,10 @@
198
201
  }
199
202
 
200
203
  // Remove filter
201
- function removeFilter(filterId, e) {
204
+ function removeFilter(filterKey, e) {
202
205
  if (e) e.stopPropagation();
203
- filters = filters.filter((f) => f.id !== filterId);
204
- if (editingFilterId === filterId) {
206
+ filters = filters.filter((f, i) => (f.id ?? i) !== filterKey);
207
+ if (editingFilterId === filterKey) {
205
208
  editingFilterId = null;
206
209
  }
207
210
  notifyChange();
@@ -288,12 +291,17 @@
288
291
  }
289
292
  });
290
293
 
291
- // Watch for search/conjunction/filter rule changes (including in-place rule edits)
294
+ // Watch for search/conjunction/filter rule changes (skip initial mount)
295
+ let _mounted = false;
292
296
  $effect(() => {
293
297
  const _s = search;
294
298
  const _c = conjunction;
295
299
  const _a = activeView;
296
- const _f = JSON.stringify(filters);
300
+ if (!_mounted) {
301
+ _mounted = true;
302
+ lastNotifiedSignature = JSON.stringify({ filters, conjunction, search, activeView });
303
+ return;
304
+ }
297
305
  notifyChange();
298
306
  });
299
307
 
@@ -319,6 +327,7 @@
319
327
  const chipEl = e.target.closest(".s-filter-chip");
320
328
  if (!chipEl) {
321
329
  editingFilterId = null;
330
+ notifyChange();
322
331
  }
323
332
  }
324
333
 
@@ -561,10 +570,11 @@
561
570
  {#if filters.length > 0}
562
571
  <div class="s-filter-chips">
563
572
  {#each filters as rule, idx (rule.id ?? idx)}
573
+ {@const ruleKey = rule.id ?? idx}
564
574
  {@const field = fieldMap.get(rule.field)}
565
575
  {@const type = field?.type || "text"}
566
576
  {@const isUnary = isUnaryOperator(rule.operator, type)}
567
- {@const isEditing = editingFilterId === rule.id}
577
+ {@const isEditing = editingFilterId === ruleKey}
568
578
 
569
579
  <div class="s-filter-chip-wrapper">
570
580
  <div
@@ -572,8 +582,8 @@
572
582
  class:active={isEditing}
573
583
  role="button"
574
584
  tabindex="0"
575
- onclick={() => (editingFilterId = isEditing ? null : rule.id)}
576
- onkeydown={(e) => { if (e.key === 'Enter') editingFilterId = isEditing ? null : rule.id; }}
585
+ onclick={() => (editingFilterId = isEditing ? null : ruleKey)}
586
+ onkeydown={(e) => { if (e.key === 'Enter') editingFilterId = isEditing ? null : ruleKey; }}
577
587
  >
578
588
  <span class="s-filter-chip-field">{getFieldLabel(rule.field)}</span>
579
589
  <span class="s-filter-chip-operator">{getOperatorLabel(rule.field, rule.operator)}</span>
@@ -583,7 +593,7 @@
583
593
  <button
584
594
  type="button"
585
595
  class="s-filter-chip-remove"
586
- onclick={(e) => removeFilter(rule.id, e)}
596
+ onclick={(e) => removeFilter(ruleKey, e)}
587
597
  aria-label="Remove filter"
588
598
  >&times;</button>
589
599
  </div>
@@ -741,12 +751,12 @@
741
751
  <button
742
752
  type="button"
743
753
  class="s-filter-editor-del-btn"
744
- onclick={(e) => removeFilter(rule.id, e)}
754
+ onclick={(e) => removeFilter(ruleKey, e)}
745
755
  >Remove filter</button>
746
756
  <button
747
757
  type="button"
748
758
  class="s-filter-editor-done-btn"
749
- onclick={() => (editingFilterId = null)}
759
+ onclick={() => { editingFilterId = null; notifyChange(); }}
750
760
  >Apply</button>
751
761
  </div>
752
762
  </div>
@@ -1,7 +1,8 @@
1
1
  <script>
2
2
  import { untrack } from "svelte";
3
3
  import { on } from "svelte/events";
4
- import { defaults } from "../config.js";
4
+ import { getMultistyleDefaults } from "../config.js";
5
+ const _cfg = getMultistyleDefaults();
5
6
  import { graphNodeTypes, createGraph, createGraphNode, connectGraphNodes, edgeStyles, orientFlowGraph, parseGraph, pruneGraphEdges } from "../graph/index.js";
6
7
  import { getDefinition, getPorts } from "../graph/node-types.js";
7
8
  import { arrowPath, constrainFlowSize, flowPortPoint, flowShape, flowSizeLimit, graphBounds, nodeSize, portPoint, wirePath } from "../graph/geometry.js";
@@ -489,7 +490,7 @@
489
490
  event.preventDefault();
490
491
  stepHistory(event.shiftKey);
491
492
  } else if (event.key === "Delete" || event.key === "Backspace") {
492
- if (event.target.closest("button, a, [role='button'], [role='menuitem']")) return;
493
+ if (event.target.closest(".s-graph-palette, .s-graph-toolbar, .s-graph-inspector, a, [role='menuitem']")) return;
493
494
  event.preventDefault();
494
495
  removeSelected();
495
496
  }
@@ -497,7 +498,7 @@
497
498
  </script>
498
499
 
499
500
  <div
500
- class="s-graph-editor s-graph-editor-{style ?? defaults.style} theme-{theme ?? defaults.theme} {className}"
501
+ class="s-graph-editor s-graph-editor-{style ?? _cfg.style} theme-{theme ?? _cfg.theme} {className}"
501
502
  data-mode={mode}
502
503
  role="region"
503
504
  aria-label="Graph editor"
@@ -1,11 +1,14 @@
1
1
  <script>
2
2
  import "./grid-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
  columns = 1,
10
13
  gap = "8px",
11
14
  rows = undefined,
@@ -37,6 +40,10 @@
37
40
  evenly: "space-evenly",
38
41
  };
39
42
 
43
+ const _cfg = getMultistyleDefaults();
44
+ const style = $derived(styleProp ?? _cfg.style);
45
+ const theme = $derived(themeProp ?? _cfg.theme);
46
+
40
47
  const templateColumns = $derived(
41
48
  minColumnWidth && (columns === "auto" || columns === "auto-fill")
42
49
  ? `repeat(auto-fill, minmax(${minColumnWidth}, 1fr))`
@@ -50,6 +57,6 @@
50
57
  );
51
58
  </script>
52
59
 
53
- <div class={cn("s-grid", className)} style={styleStr} {...rest}>
60
+ <div class={cn("s-grid", `s-grid-${style}`, `theme-${theme}`, className)} style={styleStr} {...rest}>
54
61
  {@render children?.()}
55
62
  </div>
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import "./iconbutton-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 }} */
@@ -22,8 +22,11 @@
22
22
  ...rest
23
23
  } = $props();
24
24
 
25
- const style = $derived(styleProp ?? defaults.style);
26
- const theme = $derived(themeProp ?? defaults.theme);
25
+ const _cfg = getMultistyleDefaults();
26
+
27
+
28
+ const style = $derived(styleProp ?? _cfg.style);
29
+ const theme = $derived(themeProp ?? _cfg.theme);
27
30
 
28
31
  const styleClass = $derived(`s-iconbtn-${style}`);
29
32
  const themeClass = $derived(`theme-${theme}`);