@svgrid/enterprise 3.1.0 → 3.1.1

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 (53) hide show
  1. package/dist/SvSheet.svelte +87 -8
  2. package/dist/cdn/svgrid-enterprise.svelte-external.js +13269 -13209
  3. package/dist/designer/assets/{GridMenus-8gTNssgV.js → GridMenus-DGZJKFvX.js} +1 -1
  4. package/dist/designer/assets/SvGrid.helpers-DE5mmORW.js +1 -0
  5. package/dist/designer/assets/{SvGridCellEditor-DMoWJjEI.js → SvGridCellEditor-C7NWcnNC.js} +1 -1
  6. package/dist/designer/assets/{SvGridChart-Cy1ATrWh.js → SvGridChart-Fg43Yi0M.js} +2 -2
  7. package/dist/designer/assets/{SvGridChartBuilder-eQ3mn0L9.js → SvGridChartBuilder-BqGuA3yU.js} +1 -1
  8. package/dist/designer/assets/{SvGridChartPanel-CATdVc9X.js → SvGridChartPanel-BsiXRAnx.js} +3 -3
  9. package/dist/designer/assets/{SvGridChartView-CmsZtCED.js → SvGridChartView-BgttK0tR.js} +1 -1
  10. package/dist/designer/assets/{SvListBox-BDS66lmZ.js → SvListBox-v2jm0-vf.js} +1 -1
  11. package/dist/designer/assets/cell-formatting-BWrW_O0n.js +1 -0
  12. package/dist/designer/assets/{chart-Cn7MnNqA.js → chart-BIl-dIRv.js} +1 -1
  13. package/dist/designer/assets/{chart-panel-messages-Dz7PTIqT.js → chart-panel-messages-4cF2vw7L.js} +1 -1
  14. package/dist/designer/assets/{chart-summary-BD1qYB2R.js → chart-summary-B7bTtSCC.js} +1 -1
  15. package/dist/designer/assets/{chart-trend-B8xr5LuD.js → chart-trend-CLsn5Hgd.js} +1 -1
  16. package/dist/designer/assets/export-format-DGscOjS9.js +6 -0
  17. package/dist/designer/assets/{index-BSjv6Qec.js → index-DkhD2kIe.js} +314 -314
  18. package/dist/designer/assets/index-l21iGkpF.css +1 -0
  19. package/dist/designer/assets/src-Mu7AGqT8.js +58 -0
  20. package/dist/designer/index.html +12 -12
  21. package/dist/export-ooxml.d.ts +10 -0
  22. package/dist/export-ooxml.js +22 -5
  23. package/dist/import.js +11 -2
  24. package/dist/node/studio.js +221 -129
  25. package/dist/sheet/objects.d.ts +47 -0
  26. package/dist/sheet/objects.js +33 -0
  27. package/dist/studio/cli.js +55 -1
  28. package/dist/studio/init-flow.d.ts +6 -1
  29. package/dist/studio/init-flow.js +43 -2
  30. package/dist/studio/scaffold-app.d.ts +6 -0
  31. package/dist/studio/scaffold-app.js +5 -3
  32. package/dist/studio/scaffold.js +29 -12
  33. package/dist/version.d.ts +1 -1
  34. package/dist/version.js +1 -1
  35. package/dist/wc/{GridMenus-By9vPuq0.js → GridMenus-6_fF5jIm.js} +2 -2
  36. package/dist/wc/{SvGrid.helpers-BdVDtjUm.js → SvGrid.helpers-zBkDTryR.js} +36 -37
  37. package/dist/wc/{SvGridCellEditor-Bnf1Kr5C.js → SvGridCellEditor-CzUKEbkI.js} +1 -1
  38. package/dist/wc/{SvGridChart-BqUJh2pG.js → SvGridChart-C6UvNIbN.js} +3 -3
  39. package/dist/wc/{SvGridChartBuilder-CGycC5cn.js → SvGridChartBuilder-ikf_5LyW.js} +3 -3
  40. package/dist/wc/{SvGridChartPanel-CRnizsHD.js → SvGridChartPanel-Dc_jj7B-.js} +4 -4
  41. package/dist/wc/{SvGridChartView-D1pa_xMy.js → SvGridChartView-thkznAOb.js} +2 -2
  42. package/dist/wc/{cell-formatting-CBfgahv1.js → cell-formatting-hb3vzxhJ.js} +27 -5
  43. package/dist/wc/{chart-6OXlybVT.js → chart-CV5D7_k8.js} +1 -1
  44. package/dist/wc/{chart-summary-2m3ia1-n.js → chart-summary-DGx0QhJa.js} +1 -1
  45. package/dist/wc/{chart-trend-CQOQtTMl.js → chart-trend-BIRH_xH8.js} +1 -1
  46. package/dist/wc/sv-sheet-element.js +7444 -7347
  47. package/dist/wc/{svelte-virtualizer.svelte-CXtQy2TQ.js → svelte-virtualizer.svelte-Du4tjrIP.js} +7 -3
  48. package/package.json +3 -3
  49. package/dist/designer/assets/SvGrid.helpers-BgT-gnCo.js +0 -1
  50. package/dist/designer/assets/cell-formatting-BbubJTVz.js +0 -1
  51. package/dist/designer/assets/export-format-DGckmgKr.js +0 -6
  52. package/dist/designer/assets/index-_JVFxt02.css +0 -1
  53. package/dist/designer/assets/src-DUQ4xE3x.js +0 -58
@@ -1,3 +1,4 @@
1
+ import { resolveSchemas } from './cli.js';
1
2
  import { crudAppFromSchemas } from './screen-suites.js';
2
3
  import { starterDatasets, getStarterDataset } from './samples/datasets.js';
3
4
  import { introspectDatabase, listDatabaseTables, countTableRows } from './introspect-db.js';
@@ -92,7 +93,9 @@ function unwrapRows(body) {
92
93
  return [];
93
94
  }
94
95
  /** Step 1-2: where does the data come from, and what tables does it have? */
95
- async function gatherData(flags, prompts, db, fetchText) {
96
+ async function gatherData(flags, prompts, db, fetchText, io) {
97
+ if (flags.from)
98
+ return gatherFromSchemaFile(flags, flags.from, prompts, io);
96
99
  let source = 'sample';
97
100
  if (flags.db)
98
101
  source = 'db';
@@ -126,6 +129,44 @@ async function gatherData(flags, prompts, db, fetchText) {
126
129
  prompts.say(` Using ${dataset.name} (${entities.length} tables).`);
127
130
  return { schemas: entities, sources, seed, kind, title: dataset.name };
128
131
  }
132
+ /**
133
+ * A schema file names the tables and columns but holds no rows and no
134
+ * connection, so the app runs on the in-memory source and the emitter seeds it
135
+ * with sample rows. `--db` + `--url` is the path to a live database.
136
+ */
137
+ async function gatherFromSchemaFile(flags, from, prompts, io) {
138
+ const clash = flags.db ? '--db' : flags.supabaseUrl ? '--supabase-url' : flags.dataset ? '--dataset' : null;
139
+ if (clash)
140
+ throw new UserError(`--from and ${clash} both name the data source.`, 'Pass one of them.');
141
+ if ((await io.readFile(from)) == null) {
142
+ throw new UserError(`Schema file not found: ${from}`, 'Pass the path to a Drizzle schema (.ts) or a Prisma schema (.prisma).');
143
+ }
144
+ let all;
145
+ try {
146
+ all = await resolveSchemas(from, io);
147
+ }
148
+ catch (e) {
149
+ throw new UserError(`Could not read ${from}: ${e instanceof Error ? e.message : String(e)}`, 'Pass a Drizzle schema (.ts) or a Prisma schema (.prisma).');
150
+ }
151
+ if (all.length === 0) {
152
+ throw new UserError(`No tables or models found in ${from}.`, 'Drizzle tables are read from pgTable / mysqlTable / sqliteTable calls, Prisma models from `model X {` blocks.');
153
+ }
154
+ let picked = all.map((s) => s.name);
155
+ if (!flags.yes) {
156
+ prompts.say('');
157
+ prompts.say(`Found ${all.length} ${all.length === 1 ? 'table' : 'tables'} in ${from}:`);
158
+ all.forEach((s, i) => prompts.say(` ${i + 1}. ${s.name}`));
159
+ picked = parseSelection(await prompts.ask('Which tables? (all, or a comma list of names/numbers)', 'all'), picked);
160
+ }
161
+ const schemas = all.filter((s) => picked.includes(s.name));
162
+ if (schemas.length === 0)
163
+ throw new UserError('No tables picked - nothing to build.');
164
+ const sources = {};
165
+ for (const s of schemas)
166
+ sources[s.name] = { kind: 'memory' };
167
+ prompts.say(` Read ${schemas.length} ${schemas.length === 1 ? 'table' : 'tables'} from ${from} (in-memory data with sample rows).`);
168
+ return { schemas, sources, seed: {}, kind: 'memory' };
169
+ }
129
170
  async function gatherFromDatabase(flags, prompts, db) {
130
171
  if (!db)
131
172
  throw new UserError('Connecting to a database is not available here.');
@@ -417,7 +458,7 @@ export async function runStudioInit(flags, prompts, db, io, fetchText = null) {
417
458
  // it rather than as Studio just changed it.
418
459
  const candidateDir = flags.out ?? '.';
419
460
  const markersBefore = await markersIn(candidateDir, io);
420
- const data = await gatherData(flags, prompts, db, fetchText);
461
+ const data = await gatherData(flags, prompts, db, fetchText, io);
421
462
  const perEntity = await askScreens(data.schemas, flags, prompts);
422
463
  const theme = await askTheme(flags, prompts);
423
464
  const defaultTitle = flags.title ?? data.title ?? 'My app';
@@ -24,6 +24,12 @@ export type ScaffoldAppOptions = {
24
24
  */
25
25
  theme?: string;
26
26
  dark?: boolean;
27
+ /**
28
+ * Global stylesheets the layout imports, as paths relative to `src/` (for
29
+ * example `['app.css', 'custom.css']` in an app `init` generated). List only
30
+ * files that exist: importing a missing file fails the build.
31
+ */
32
+ stylesheets?: string[];
27
33
  };
28
34
  export declare function scaffoldApp(schemas: EntitySchema[], options?: ScaffoldAppOptions): {
29
35
  files: GeneratedFile[];
@@ -14,12 +14,13 @@ import { scaffold, MANAGED_START, MANAGED_END } from './scaffold.js';
14
14
  import { themeTokenCss } from './themes.js';
15
15
  const MANAGED_NOTE = '// Regenerated by SvGrid Studio. Edits inside these markers are overwritten.';
16
16
  const managed = (body) => `${MANAGED_START}\n${MANAGED_NOTE}\n${body}\n${MANAGED_END}`;
17
- function layoutFile(nav, appTitle, theme) {
17
+ function layoutFile(nav, appTitle, theme, stylesheets) {
18
+ const imports = stylesheets.map((css) => ` import '../${css}'\n`).join('');
18
19
  return {
19
20
  path: 'src/routes/+layout.svelte',
20
21
  description: 'App shell: a collapsible nav sidebar linking every entity screen (an off-canvas drawer on tablet/phone), with the routed page in the main area.',
21
22
  contents: `<script lang="ts">
22
- ${managed(` let { children } = $props()
23
+ ${managed(`${imports} let { children } = $props()
23
24
  const appTitle = ${JSON.stringify(appTitle)}
24
25
  const nav = ${JSON.stringify(nav)}
25
26
 
@@ -143,6 +144,7 @@ export function scaffoldApp(schemas, options = {}) {
143
144
  files.push(...scaffold(schema, { dataSource: options.dataSource }).files);
144
145
  }
145
146
  const nav = linked.map((s) => ({ href: `/${s.name}`, label: s.label ?? titleCase(s.name) }));
146
- files.push(layoutFile(nav, appTitle, { preset: options.theme, mode: options.dark ? 'dark' : 'light' }), homeFile(nav, appTitle));
147
+ const theme = { preset: options.theme, mode: options.dark ? 'dark' : 'light' };
148
+ files.push(layoutFile(nav, appTitle, theme, options.stylesheets ?? []), homeFile(nav, appTitle));
147
149
  return { files };
148
150
  }
@@ -213,7 +213,8 @@ ${managed(serverBody)}
213
213
  const pageBody = ` const source = createKitDataSource<${rowType}>({ endpoint: '${apiRoute}' })
214
214
  const columns = schemaToColumns(${constName})${lookupsSection}
215
215
 
216
- let state = $state<ServerState<${rowType}>>({
216
+ // Not "state": a local of that name makes svelte-check read $state as a store of it.
217
+ let view = $state<ServerState<${rowType}>>({
217
218
  rows: [], total: 0, loading: false, saving: false, error: null,
218
219
  pageIndex: 0, pageSize: 25, pageCount: 1, sortModel: [], filterModel: {},
219
220
  })
@@ -221,7 +222,7 @@ ${managed(serverBody)}
221
222
  pageSize: 25,
222
223
  optimistic: true,
223
224
  getRowId: (r) => String(r.${idField}),
224
- onChange: (s) => (state = s),
225
+ onChange: (s) => (view = s),
225
226
  })
226
227
  controller.refresh()
227
228
 
@@ -231,7 +232,7 @@ ${managed(serverBody)}
231
232
  async function save({ mode, id, values }: { mode: 'create' | 'edit'; id: string | null; values: Partial<${rowType}> }) {
232
233
  if (mode === 'create') {
233
234
  await controller.createRow(values)
234
- controller.setPage(state.pageCount - 1) // jump to the new row (appended at the end)
235
+ controller.setPage(view.pageCount - 1) // jump to the new row (appended at the end)
235
236
  } else if (id) {
236
237
  await controller.updateRow(id, values)
237
238
  }
@@ -246,12 +247,11 @@ ${managed(serverBody)}
246
247
  path: `src/routes/${route}/+page.svelte`,
247
248
  description: 'The data screen: sort, filter, search, paging, multi-select delete, and create/edit - wired to the API route.',
248
249
  contents: `<script lang="ts">
249
- import { SvGrid, createServerDataSource } from '@svgrid/grid'
250
+ import { SvGrid, createServerDataSource, type ServerState } from '@svgrid/grid'
250
251
  import {
251
252
  SvGridEditPanel,
252
253
  createKitDataSource,${hasLookups ? '\n createRelationLookup,' : ''}
253
254
  schemaToColumns,
254
- type ServerState,
255
255
  } from '@svgrid/enterprise'
256
256
  import { ${constName}, type ${rowType} } from '${schemaImport}'
257
257
 
@@ -273,12 +273,12 @@ ${themeTokenCss({ preset: options.theme, mode: options.dark ? 'dark' : 'light' }
273
273
  </div>
274
274
  </header>
275
275
 
276
- {#if state.error}<p class="page__error" role="alert">{state.error}</p>{/if}
276
+ {#if view.error}<p class="page__error" role="alert">{view.error}</p>{/if}
277
277
 
278
278
  <SvGrid
279
- data={state.rows}
279
+ data={view.rows}
280
280
  {columns}
281
- loading={state.loading}
281
+ loading={view.loading}
282
282
  loadingOverlay
283
283
  fitColumns
284
284
  enableRowSummaries={false}
@@ -301,11 +301,11 @@ ${themeTokenCss({ preset: options.theme, mode: options.dark ? 'dark' : 'light' }
301
301
  onRowSelectionChange={(_sel, rows) => (selected = rows)}
302
302
  showPagination
303
303
  externalPagination
304
- rowCount={state.total}
305
- pageIndex={state.pageIndex}
306
- pageSize={state.pageSize}
304
+ rowCount={view.total}
305
+ pageIndex={view.pageIndex}
306
+ pageSize={view.pageSize}
307
307
  onPaginationChange={({ pageIndex, pageSize }) => {
308
- if (pageSize !== state.pageSize) controller.setPageSize(pageSize)
308
+ if (pageSize !== view.pageSize) controller.setPageSize(pageSize)
309
309
  else controller.setPage(pageIndex)
310
310
  }}
311
311
  emptyMessage="No ${label} yet"
@@ -338,6 +338,7 @@ ${themeTokenCss({ preset: options.theme, mode: options.dark ? 'dark' : 'light' }
338
338
  export function mergeManaged(existing, generated) {
339
339
  if (!existing)
340
340
  return generated;
341
+ existing = migrateStateLocal(existing);
341
342
  const startIdx = existing.indexOf(MANAGED_START);
342
343
  const endIdx = existing.indexOf(MANAGED_END);
343
344
  if (startIdx === -1 || endIdx === -1 || endIdx < startIdx)
@@ -349,3 +350,19 @@ export function mergeManaged(existing, generated) {
349
350
  const newRegion = generated.slice(genStart, genEnd + MANAGED_END.length);
350
351
  return (existing.slice(0, startIdx) + newRegion + existing.slice(endIdx + MANAGED_END.length));
351
352
  }
353
+ /** The managed line pages scaffolded before the rename carried. */
354
+ const OLD_STATE_LOCAL = /\blet state = \$state<ServerState</;
355
+ /**
356
+ * Pages scaffolded before the rename kept their server state in a local named
357
+ * `state`, which svelte-check reads as a store subscription whenever `$state`
358
+ * appears. The managed region now calls it `view`, but the markup below the
359
+ * region is the user's and still says `state.rows`; a plain merge would leave it
360
+ * pointing at nothing. Rename the references too. Nothing else in such a page
361
+ * could be called `state` (the old local would have clashed), and member reads
362
+ * like `page.state` are skipped.
363
+ */
364
+ function migrateStateLocal(existing) {
365
+ if (!OLD_STATE_LOCAL.test(existing))
366
+ return existing;
367
+ return existing.replace(/(?<![.\w$])state(?=\s*[.?[]|\s*=[^=>])/g, 'view');
368
+ }
package/dist/version.d.ts CHANGED
@@ -10,4 +10,4 @@
10
10
  *
11
11
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
12
12
  */
13
- export declare const SVGRID_VERSION = "3.1.0";
13
+ export declare const SVGRID_VERSION = "3.1.1";
package/dist/version.js CHANGED
@@ -10,4 +10,4 @@
10
10
  *
11
11
  * `version.test.ts` asserts this matches `package.json`, so the two cannot drift.
12
12
  */
13
- export const SVGRID_VERSION = '3.1.0';
13
+ export const SVGRID_VERSION = '3.1.1';
@@ -1,6 +1,6 @@
1
1
  import { $ as e, D as t, G as n, H as r, I as i, L as a, M as o, O as s, P as c, Q as l, R as u, S as d, T as f, U as p, W as m, X as h, Y as g, Z as _, _ as v, a as y, at as b, b as x, d as S, dt as C, et as w, f as T, h as E, ht as D, it as O, j as k, k as A, l as ee, m as j, mt as M, n as N, nt as P, o as F, p as te, pt as I, q as L, st as R, tt as z, u as ne, ut as B, w as re, x as V, y as H, z as U } from "./client-DQIzjDBG.js";
2
- import { c as W, s as ie, t as ae } from "./svelte-virtualizer.svelte-CXtQy2TQ.js";
3
- import { S as oe, h as se, u as ce, w as le } from "./SvGrid.helpers-BdVDtjUm.js";
2
+ import { c as W, s as ie, t as ae } from "./svelte-virtualizer.svelte-Du4tjrIP.js";
3
+ import { S as oe, h as se, u as ce, w as le } from "./SvGrid.helpers-zBkDTryR.js";
4
4
  import { i as ue, t as G } from "./editor-contract-peBDxir_.js";
5
5
  import { t as K } from "./SvField-B_kurx_P.js";
6
6
  import { n as de } from "./dismissable-CQ6XFXsk.js";
@@ -1,15 +1,16 @@
1
+ import { i as e } from "./cell-formatting-hb3vzxhJ.js";
1
2
  //#region ../grid/dist/SvGrid.helpers.js
2
- function e(e) {
3
+ function t(e) {
3
4
  let t = "";
4
5
  return e.color && (t += `color:${e.color};`), e.fontWeight != null && (t += `font-weight:${e.fontWeight};`), t;
5
6
  }
6
- function t(e) {
7
+ function n(e) {
7
8
  return Number.isInteger(e) ? e.toLocaleString() : e.toLocaleString(void 0, { maximumFractionDigits: 2 });
8
9
  }
9
- function n(e, t) {
10
+ function r(e, t) {
10
11
  return `${e}:${t}`;
11
12
  }
12
- function r(e) {
13
+ function i(e) {
13
14
  if (!e) return "";
14
15
  if (typeof e == "string") return e;
15
16
  if (Array.isArray(e)) return e.filter(Boolean).join(" ");
@@ -20,22 +21,22 @@ function r(e) {
20
21
  }
21
22
  return "";
22
23
  }
23
- function i(e) {
24
+ function a(e) {
24
25
  if (e == null || e === "") return "";
25
26
  if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}$/.test(e)) return e;
26
27
  let t = e instanceof Date ? e : new Date(e);
27
28
  return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
28
29
  }
29
- function a(e) {
30
+ function o(e) {
30
31
  if (e == null || e === "") return "";
31
32
  if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(e)) return e;
32
33
  let t = e instanceof Date ? e : new Date(e);
33
34
  return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 16);
34
35
  }
35
- function o(e) {
36
+ function s(e) {
36
37
  return String(e).replace(/-native$/, "");
37
38
  }
38
- function s(e) {
39
+ function c(e) {
39
40
  if (e instanceof Date) return e;
40
41
  if (typeof e == "string") {
41
42
  let t = e.match(/^(\d{1,2}):(\d{2})(?::(\d{2}))?/);
@@ -46,23 +47,23 @@ function s(e) {
46
47
  }
47
48
  return null;
48
49
  }
49
- function c(e) {
50
+ function l(e) {
50
51
  return e ? `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}` : null;
51
52
  }
52
- function l(e, t) {
53
- let n = o(e);
54
- return n === "date" ? i(t) : n === "datetime" ? a(t) : String(t ?? "");
53
+ function u(e, t) {
54
+ let n = s(e);
55
+ return n === "date" ? a(t) : n === "datetime" ? o(t) : String(t ?? "");
55
56
  }
56
- function u(e) {
57
- let t = o(e);
57
+ function d(e) {
58
+ let t = s(e);
58
59
  return t === "number" ? "number" : t === "date" ? "date" : t === "datetime" ? "datetime-local" : t === "time" ? "time" : t === "password" ? "password" : t === "color" ? "color" : "text";
59
60
  }
60
- function d(e) {
61
+ function f(e) {
61
62
  if (!e || Number.isNaN(e.getTime())) return "";
62
63
  let t = (e) => String(e).padStart(2, "0");
63
64
  return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
64
65
  }
65
- function f(e) {
66
+ function p(e) {
66
67
  if (!e) return null;
67
68
  let t = /^(\d{4})-(\d{2})-(\d{2})/.exec(e);
68
69
  if (!t) {
@@ -72,46 +73,44 @@ function f(e) {
72
73
  let n = new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
73
74
  return Number.isNaN(n.getTime()) ? null : n;
74
75
  }
75
- function p(e) {
76
+ function m(e) {
76
77
  if (!e || String(e).endsWith("-native")) return !1;
77
- let t = o(e);
78
+ let t = s(e);
78
79
  return t === "date" || t === "datetime" || t === "time";
79
80
  }
80
- function m(e) {
81
- return o(e) === "number" ? "text" : u(e);
82
- }
83
81
  function h(e) {
84
- return /^-?(\d*\.?\d*)(e-?\d*)?$/i.test(e);
82
+ return s(e) === "number" ? "text" : d(e);
85
83
  }
86
84
  function g(e) {
85
+ return /^-?(\d*\.?\d*)(e-?\d*)?$/i.test(e);
86
+ }
87
+ function _(e) {
87
88
  return e == null || e === "" ? [] : Array.isArray(e) ? e.filter((e) => e != null && e !== "") : [e];
88
89
  }
89
- function _(e, t) {
90
+ function v(e, t) {
90
91
  let n = e.find((e) => e.value === t || String(e.value) === String(t));
91
92
  return n ? n.label : String(t ?? "");
92
93
  }
93
- function v(e, t) {
94
+ function y(e, t) {
94
95
  return e.find((e) => e.value === t || String(e.value) === String(t))?.color;
95
96
  }
96
- function y(e) {
97
+ function b(e) {
97
98
  return e ? `background: color-mix(in srgb, ${e} 22%, transparent);border-color: color-mix(in srgb, ${e} 45%, transparent);color: color-mix(in srgb, ${e} 80%, var(--sg-fg, #0f172a));` : "";
98
99
  }
99
- function b(e) {
100
- let t = o(e);
100
+ function x(e) {
101
+ let t = s(e);
101
102
  return t === "number" ? "sv-grid-cell-editor sv-grid-cell-editor-number" : t === "date" ? "sv-grid-cell-editor sv-grid-cell-editor-date" : t === "datetime" ? "sv-grid-cell-editor sv-grid-cell-editor-datetime" : t === "color" ? "sv-grid-cell-editor sv-grid-cell-editor-color" : "sv-grid-cell-editor";
102
103
  }
103
- function x(e) {
104
- if (e == null || e === "") return null;
105
- let t = e instanceof Date ? e : new Date(e);
106
- return Number.isNaN(t.getTime()) ? null : t;
104
+ function S(t) {
105
+ return e(t);
107
106
  }
108
- function S(e, t) {
107
+ function C(e, t) {
109
108
  return Math.max(8, Math.min(e, window.innerWidth - t - 8));
110
109
  }
111
- function C(e) {
110
+ function w(e) {
112
111
  return typeof CSS < "u" && CSS.escape ? CSS.escape(e) : e.replace(/"/g, "\\\"");
113
112
  }
114
- function w(e, t) {
113
+ function T(e, t) {
115
114
  if (e == null || e === "") return NaN;
116
115
  if (t) {
117
116
  let t = (e instanceof Date ? e : new Date(String(e))).getTime();
@@ -120,11 +119,11 @@ function w(e, t) {
120
119
  let n = typeof e == "number" ? e : Number(e);
121
120
  return Number.isFinite(n) ? n : NaN;
122
121
  }
123
- function T(e) {
122
+ function E(e) {
124
123
  let t = Math.abs(e), n = t >= 1e3 ? 0 : t >= 100 ? 1 : t >= 1 ? 2 : 4;
125
124
  return e.toLocaleString(void 0, { maximumFractionDigits: n });
126
125
  }
127
- function E(e) {
126
+ function D(e) {
128
127
  return new Date(e).toLocaleDateString(void 0, {
129
128
  year: "numeric",
130
129
  month: "short",
@@ -132,4 +131,4 @@ function E(e) {
132
131
  });
133
132
  }
134
133
  //#endregion
135
- export { g as C, d as S, _, C as a, r as b, E as c, m as d, n as f, v as g, u as h, y as i, T as l, b as m, e as n, c as o, l as p, S as r, t as s, x as t, f as u, h as v, p as w, s as x, w as y };
134
+ export { _ as C, f as S, v as _, w as a, i as b, D as c, h as d, r as f, y as g, d as h, b as i, E as l, x as m, t as n, l as o, u as p, C as r, n as s, S as t, p as u, g as v, m as w, c as x, T as y };
@@ -1,5 +1,5 @@
1
1
  import { C as e, D as t, G as n, H as r, I as i, L as a, M as o, O as s, P as c, Q as l, R as u, S as d, U as f, W as p, X as m, Y as h, _ as g, at as _, b as v, dt as y, et as b, h as ee, ht as x, i as te, it as S, j as C, m as w, mt as T, n as E, nt as D, p as O, st as k, tt as A, ut as j, w as M, y as ne } from "./client-DQIzjDBG.js";
2
- import { C as re, d as ie, h as ae, m as oe, o as se, p as ce, v as le, x as ue } from "./SvGrid.helpers-BdVDtjUm.js";
2
+ import { C as re, d as ie, h as ae, m as oe, o as se, p as ce, v as le, x as ue } from "./SvGrid.helpers-zBkDTryR.js";
3
3
  import { n as de, r as fe, t as pe } from "./editor-registry-DxGKqcvx.js";
4
4
  //#region ../grid/dist/SvGridCellEditor.svelte
5
5
  var N = u("<span class=\"sv-grid-chip sv-grid-chip-removable\"> <button type=\"button\" class=\"sv-grid-chip-remove\">×</button></span>"), P = u("<button type=\"button\" class=\"sv-grid-chip-commit\" aria-label=\"Commit chip selection\">Done</button>"), F = u("<div class=\"sv-grid-cell-editor sv-grid-cell-editor-chips\" role=\"group\"><div class=\"sv-grid-chips-row\"><!> <input class=\"sv-grid-chip-input\" type=\"text\"/> <!></div></div>"), I = u("<input type=\"checkbox\" class=\"sv-grid-fr-editor sv-grid-fr-checkbox\"/>"), L = u("<option> </option>"), R = u("<select class=\"sv-grid-cell-editor sv-grid-fr-editor\"></select>"), z = u("<input class=\"sv-grid-cell-editor sv-grid-fr-editor\"/>"), me = u("<button type=\"button\" class=\"sv-grid-checkbox\" role=\"checkbox\" aria-label=\"Edit checkbox value\"></button>"), he = u("<button type=\"button\" role=\"radio\">★</button>"), ge = u("<span class=\"sv-grid-rating-editor\" role=\"radiogroup\" aria-label=\"Rating\"><!> <button type=\"button\" aria-label=\"Clear rating\" class=\"sv-grid-rating-clear\">×</button></span>"), _e = u("<textarea class=\"sv-grid-cell-editor sv-grid-cell-editor-textarea\" rows=\"4\"></textarea>"), ve = u("<button type=\"button\" class=\"sv-grid-autocomplete-option\" role=\"option\"> </button>"), ye = u("<div class=\"sv-grid-autocomplete-list\" role=\"listbox\"></div>"), be = u("<div class=\"sv-grid-autocomplete\"><input class=\"sv-grid-cell-editor sv-grid-cell-editor-autocomplete\" type=\"text\"/> <!></div>"), xe = u("<input type=\"color\"/>"), Se = u("<textarea class=\"sv-grid-cell-editor sv-grid-cell-editor-text sv-grid-cell-editor-multiline\"></textarea>"), Ce = u("<input/>");
@@ -1,7 +1,7 @@
1
1
  import { D as e, G as t, H as n, I as r, J as i, K as a, L as o, M as s, O as c, P as l, R as u, S as d, T as f, U as p, V as m, W as h, X as g, Y as _, a as ee, at as v, dt as te, et as y, it as b, j as x, k as S, l as ne, m as C, mt as w, n as T, nt as E, o as re, p as ie, pt as ae, q as oe, rt as se, st as D, tt as O, ut as ce, w as le, x as k, z as A } from "./client-DQIzjDBG.js";
2
2
  import { a as ue } from "./editor-contract-peBDxir_.js";
3
- import { i as de } from "./chart-trend-CQOQtTMl.js";
4
- import { C as fe, D as pe, E as me, O as he, T as ge, _ as _e, a as ve, b as ye, d as be, g as xe, i as Se, n as Ce, t as we, v as Te, w as Ee, x as De, y as Oe } from "./chart-6OXlybVT.js";
3
+ import { i as de } from "./chart-trend-BIRH_xH8.js";
4
+ import { C as fe, D as pe, E as me, O as he, T as ge, _ as _e, a as ve, b as ye, d as be, g as xe, i as Se, n as Ce, t as we, v as Te, w as Ee, x as De, y as Oe } from "./chart-CV5D7_k8.js";
5
5
  import { i as ke, t as Ae } from "./chart-export-CeSADGfi.js";
6
6
  //#region ../grid/dist/chart-zoom.js
7
7
  function je(e, t, n) {
@@ -324,7 +324,7 @@ function $r(n, u) {
324
324
  return;
325
325
  }
326
326
  let e = t(U), n = !0;
327
- return import("./chart-summary-2m3ia1-n.js").then(({ chartSummary: t }) => {
327
+ return import("./chart-summary-DGx0QhJa.js").then(({ chartSummary: t }) => {
328
328
  n && b(ai, t(e), !0);
329
329
  }), () => {
330
330
  n = !1;
@@ -1,8 +1,8 @@
1
1
  import { G as e, H as t, I as n, L as r, M as i, O as a, P as o, R as s, S as c, T as l, U as u, W as d, X as f, Y as p, _ as m, a as h, at as g, b as _, dt as v, et as y, f as b, h as x, ht as S, it as C, j as w, m as T, mt as E, n as D, nt as O, o as ee, ot as k, p as A, st as j, tt as M, u as N, ut as P, y as F } from "./client-DQIzjDBG.js";
2
2
  import { t as I } from "./SvModal-DrfOYYyX.js";
3
- import { c as L, f as R, l as z, m as B, o as V, p as H, s as U, u as te } from "./chart-6OXlybVT.js";
4
- import { t as W } from "./SvGridChart-BqUJh2pG.js";
5
- import { n as G, t as K } from "./SvGridChartPanel-CRnizsHD.js";
3
+ import { c as L, f as R, l as z, m as B, o as V, p as H, s as U, u as te } from "./chart-CV5D7_k8.js";
4
+ import { t as W } from "./SvGridChart-C6UvNIbN.js";
5
+ import { n as G, t as K } from "./SvGridChartPanel-Dc_jj7B-.js";
6
6
  //#region ../grid/dist/createTabs.svelte.js
7
7
  var q = 0;
8
8
  function J(t) {
@@ -1,7 +1,7 @@
1
1
  import { D as e, E as t, G as n, H as r, I as i, L as a, O as o, P as s, R as c, S as l, T as u, U as d, V as f, W as p, X as m, Y as h, _ as g, a as _, at as v, b as y, dt as ee, et as b, h as x, i as S, it as C, j as w, l as te, m as T, mt as E, n as D, nt as O, o as k, p as A, r as j, st as M, tt as ne, ut as re, x as ie, y as N, z as P } from "./client-DQIzjDBG.js";
2
2
  import { a as ae } from "./editor-contract-peBDxir_.js";
3
- import { S as F, h as I } from "./chart-6OXlybVT.js";
4
- import { t as oe } from "./SvGridChart-BqUJh2pG.js";
3
+ import { S as F, h as I } from "./chart-CV5D7_k8.js";
4
+ import { t as oe } from "./SvGridChart-C6UvNIbN.js";
5
5
  import { a as se, i as ce, n as le, o as ue, t as de } from "./chart-export-CeSADGfi.js";
6
6
  //#region ../../node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.67.0/node_modules/svelte/src/transition/index.js
7
7
  function fe(e) {
@@ -1206,7 +1206,7 @@ function Ot(r, c) {
1206
1206
  C(g, !0);
1207
1207
  return;
1208
1208
  }
1209
- import("./SvGridChartBuilder-CGycC5cn.js").then((e) => {
1209
+ import("./SvGridChartBuilder-ikf_5LyW.js").then((e) => {
1210
1210
  C(u, e.default, !0), C(g, !0);
1211
1211
  });
1212
1212
  }
@@ -1325,7 +1325,7 @@ function Ot(r, c) {
1325
1325
  });
1326
1326
  async function Ve() {
1327
1327
  if (C(U, !1), !n(L)) return;
1328
- let { chartSummary: e } = await import("./chart-summary-2m3ia1-n.js"), t = e(n(L));
1328
+ let { chartSummary: e } = await import("./chart-summary-DGx0QhJa.js"), t = e(n(L));
1329
1329
  try {
1330
1330
  await navigator.clipboard?.writeText(t);
1331
1331
  } catch {}
@@ -1,6 +1,6 @@
1
1
  import { G as e, I as t, R as n, T as r, dt as i, et as a, mt as o, st as s, ut as c } from "./client-DQIzjDBG.js";
2
- import { s as l } from "./chart-6OXlybVT.js";
3
- import { t as u } from "./SvGridChart-BqUJh2pG.js";
2
+ import { s as l } from "./chart-CV5D7_k8.js";
3
+ import { t as u } from "./SvGridChart-C6UvNIbN.js";
4
4
  //#region ../grid/dist/SvGridChartView.svelte
5
5
  var d = n("<div class=\"sv-grid-chart-view svelte-733vyy\"><!></div>"), f = {
6
6
  hash: "svelte-733vyy",
@@ -57,12 +57,34 @@ function n(e, n) {
57
57
  let r = (Array.isArray(e) ? e.join(",") : e ?? "") + "|" + (n.style ?? "") + "|" + (n.currency ?? "") + "|" + (n.minimumFractionDigits ?? "") + "|" + (n.maximumFractionDigits ?? "") + "|" + (n.useGrouping ?? "") + "|" + (n.currencyDisplay ?? "") + "|" + (n.notation ?? "") + "|" + (n.signDisplay ?? "") + "|" + (n.minimumIntegerDigits ?? "") + "|" + (n.compactDisplay ?? "") + "|" + (n.unit ?? "") + "|" + (n.unitDisplay ?? "") + "|" + (n.minimumSignificantDigits ?? "") + "|" + (n.maximumSignificantDigits ?? ""), i = t.get(r);
58
58
  return i || (i = new Intl.NumberFormat(e, n), t.set(r, i)), i;
59
59
  }
60
- var r = /* @__PURE__ */ new Map();
61
- function i(e, t) {
62
- let n = (Array.isArray(e) ? e.join(",") : e ?? "") + "|" + (t.dateStyle ?? "") + "|" + (t.timeStyle ?? "") + "|" + (t.year ?? "") + "|" + (t.month ?? "") + "|" + (t.day ?? "") + "|" + (t.hour ?? "") + "|" + (t.minute ?? "") + "|" + (t.second ?? "") + "|" + (t.weekday ?? "") + "|" + (t.hour12 ?? ""), i = r.get(n);
63
- return i || (i = new Intl.DateTimeFormat(e, t), r.set(n, i)), i;
60
+ function r(e) {
61
+ if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : e;
62
+ if (typeof e == "number") {
63
+ if (!Number.isFinite(e)) return null;
64
+ let t = new Date(e);
65
+ return Number.isNaN(t.getTime()) ? null : t;
66
+ }
67
+ if (typeof e != "string") return null;
68
+ let t = e.trim();
69
+ if (t === "") return null;
70
+ let n = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t);
71
+ if (n) {
72
+ let [e, t, r] = [
73
+ Number(n[1]),
74
+ Number(n[2]) - 1,
75
+ Number(n[3])
76
+ ], i = /* @__PURE__ */ new Date(0);
77
+ return i.setFullYear(e, t, r), i.setHours(0, 0, 0, 0), i.getMonth() === t && i.getDate() === r ? i : null;
78
+ }
79
+ let r = new Date(t);
80
+ return Number.isNaN(r.getTime()) ? null : r;
64
81
  }
82
+ var i = /* @__PURE__ */ new Map();
65
83
  function a(e, t) {
84
+ let n = (Array.isArray(e) ? e.join(",") : e ?? "") + "|" + (t.dateStyle ?? "") + "|" + (t.timeStyle ?? "") + "|" + (t.year ?? "") + "|" + (t.month ?? "") + "|" + (t.day ?? "") + "|" + (t.hour ?? "") + "|" + (t.minute ?? "") + "|" + (t.second ?? "") + "|" + (t.weekday ?? "") + "|" + (t.hour12 ?? ""), r = i.get(n);
85
+ return r || (r = new Intl.DateTimeFormat(e, t), i.set(n, r)), r;
86
+ }
87
+ function o(e, t) {
66
88
  let r = typeof e == "number" ? e : Number(e);
67
89
  if (!Number.isFinite(r)) return String(e ?? "");
68
90
  let i = t.locales;
@@ -83,4 +105,4 @@ function a(e, t) {
83
105
  return n(i, t.options ?? {}).format(r);
84
106
  }
85
107
  //#endregion
86
- export { e as i, i as n, n as r, a as t };
108
+ export { e as a, r as i, a as n, n as r, o as t };
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
2
- import { i as t, n, r, t as i } from "./chart-trend-CQOQtTMl.js";
2
+ import { i as t, n, r, t as i } from "./chart-trend-BIRH_xH8.js";
3
3
  //#region ../grid/dist/chart-scale.js
4
4
  var a = [
5
5
  "#2563eb",
@@ -1,4 +1,4 @@
1
- import { i as e, n as t, t as n } from "./chart-trend-CQOQtTMl.js";
1
+ import { i as e, n as t, t as n } from "./chart-trend-BIRH_xH8.js";
2
2
  //#region ../grid/dist/chart-summary.js
3
3
  var r = (e) => typeof e == "number" && Number.isFinite(e);
4
4
  function i(e) {
@@ -1,4 +1,4 @@
1
- import { r as e } from "./cell-formatting-CBfgahv1.js";
1
+ import { r as e } from "./cell-formatting-hb3vzxhJ.js";
2
2
  //#region ../grid/dist/chart-format.js
3
3
  function t(e) {
4
4
  let t = Math.abs(e);