@ai-matrx/design-system 0.18.3 → 0.18.5

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 (61) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +22 -0
  3. package/dist/content-transfer.cjs +20 -7
  4. package/dist/content-transfer.cjs.map +1 -1
  5. package/dist/content-transfer.d.cts +6 -0
  6. package/dist/content-transfer.d.ts +6 -0
  7. package/dist/content-transfer.js +20 -7
  8. package/dist/content-transfer.js.map +1 -1
  9. package/dist/data-table/copy-helpers.cjs +53 -0
  10. package/dist/data-table/copy-helpers.cjs.map +1 -1
  11. package/dist/data-table/copy-helpers.d.cts +13 -2
  12. package/dist/data-table/copy-helpers.d.ts +13 -2
  13. package/dist/data-table/copy-helpers.js +55 -0
  14. package/dist/data-table/copy-helpers.js.map +1 -1
  15. package/dist/data-table/copy-types.cjs.map +1 -1
  16. package/dist/data-table/copy-types.d.cts +4 -0
  17. package/dist/data-table/copy-types.d.ts +4 -0
  18. package/dist/data-table/data-row-inspector.cjs +78 -52
  19. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  20. package/dist/data-table/data-row-inspector.js +78 -52
  21. package/dist/data-table/data-row-inspector.js.map +1 -1
  22. package/dist/data-table/data-row-window.cjs +78 -52
  23. package/dist/data-table/data-row-window.cjs.map +1 -1
  24. package/dist/data-table/data-row-window.js +78 -52
  25. package/dist/data-table/data-row-window.js.map +1 -1
  26. package/dist/data-table/filter-engine.d.cts +1 -1
  27. package/dist/data-table/filter-engine.d.ts +1 -1
  28. package/dist/data-table/index.cjs +1587 -1277
  29. package/dist/data-table/index.cjs.map +1 -1
  30. package/dist/data-table/index.d.cts +23 -3
  31. package/dist/data-table/index.d.ts +23 -3
  32. package/dist/data-table/index.js +1574 -1262
  33. package/dist/data-table/index.js.map +1 -1
  34. package/dist/data-table/infer-filter.d.cts +1 -1
  35. package/dist/data-table/infer-filter.d.ts +1 -1
  36. package/dist/data-table/layered-filters.d.cts +1 -1
  37. package/dist/data-table/layered-filters.d.ts +1 -1
  38. package/dist/data-table/pagination.cjs +149 -91
  39. package/dist/data-table/pagination.cjs.map +1 -1
  40. package/dist/data-table/pagination.js +144 -86
  41. package/dist/data-table/pagination.js.map +1 -1
  42. package/dist/data-table/query-control.d.cts +1 -1
  43. package/dist/data-table/query-control.d.ts +1 -1
  44. package/dist/data-table/types.cjs.map +1 -1
  45. package/dist/data-table/types.d.cts +1 -1
  46. package/dist/data-table/types.d.ts +1 -1
  47. package/dist/data-table/url-state.d.cts +1 -1
  48. package/dist/data-table/url-state.d.ts +1 -1
  49. package/dist/data-table/uuid-cell.cjs +58 -45
  50. package/dist/data-table/uuid-cell.cjs.map +1 -1
  51. package/dist/data-table/uuid-cell.js +58 -45
  52. package/dist/data-table/uuid-cell.js.map +1 -1
  53. package/dist/data-table/xlsx.d.cts +1 -1
  54. package/dist/data-table/xlsx.d.ts +1 -1
  55. package/dist/index.cjs +2 -2
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.js +2 -2
  58. package/dist/index.js.map +1 -1
  59. package/dist/{types-CD4xGL5Z.d.cts → types-0CNCWvdK.d.cts} +4 -2
  60. package/dist/{types-BhSkeZQ_.d.ts → types-cH8oLqUx.d.ts} +4 -2
  61. package/package.json +1 -1
@@ -1574,6 +1574,7 @@ var actionDone = (message) => ({
1574
1574
  mimeTypes: [],
1575
1575
  message
1576
1576
  });
1577
+ var isSafeFilename = (filename) => filename === filename.trim() && filename.length > 0 && !/^\.+$/.test(filename) && !/[\\/\x00-\x1F\x7F]/.test(filename);
1577
1578
  var sourceFor = (id, label, build) => ({
1578
1579
  id,
1579
1580
  label,
@@ -1630,14 +1631,21 @@ function MatrxCopyMenuSession(props) {
1630
1631
  ))
1631
1632
  throw new Error("Sheet rows must be JSON objects.");
1632
1633
  const rows = value;
1633
- const keys = [...new Set(rows.flatMap((row) => Object.keys(row)))];
1634
+ const suppliedColumns = props.export.sheetColumns?.();
1635
+ const columns = suppliedColumns ?? [...new Set(rows.flatMap((row) => Object.keys(row)))].map((id) => ({ id, label: id }));
1636
+ const ids = /* @__PURE__ */ new Set();
1637
+ for (const column of columns) {
1638
+ if (!column.id || !column.label || ids.has(column.id)) throw new Error("Sheet columns require unique nonempty ids and labels.");
1639
+ ids.add(column.id);
1640
+ }
1641
+ for (const row of rows) for (const key of Object.keys(row)) if (!ids.has(key)) throw new Error(`Sheet row key "${key}" is not declared in sheetColumns.`);
1634
1642
  return {
1635
1643
  kind: "rows",
1636
1644
  rows,
1637
- columns: keys.map((key) => ({
1638
- id: key,
1639
- label: key,
1640
- path: `/${key.replace(/~/g, "~0").replace(/\//g, "~1")}`,
1645
+ columns: columns.map((column) => ({
1646
+ id: column.id,
1647
+ label: column.label,
1648
+ path: `/${column.id.replace(/~/g, "~0").replace(/\//g, "~1")}`,
1641
1649
  visible: true
1642
1650
  }))
1643
1651
  };
@@ -1722,7 +1730,8 @@ function MatrxCopyMenuSession(props) {
1722
1730
  value: {
1723
1731
  bytes: Array.from(bytes),
1724
1732
  mime: file.mime,
1725
- extension: file.extension
1733
+ extension: file.extension,
1734
+ ...file.filename !== void 0 ? { filename: file.filename } : {}
1726
1735
  }
1727
1736
  };
1728
1737
  },
@@ -1739,12 +1748,16 @@ function MatrxCopyMenuSession(props) {
1739
1748
  (byte) => typeof byte !== "number" || !Number.isInteger(byte) || byte < 0 || byte > 255
1740
1749
  ))
1741
1750
  throw new Error(`${item.label} did not capture a valid file.`);
1751
+ if (value.filename !== void 0 && (typeof value.filename !== "string" || !isSafeFilename(value.filename)))
1752
+ throw new Error(
1753
+ `${item.label} has an unsafe filename. Use a nonempty basename without leading or trailing whitespace, dots only, path separators, or control characters.`
1754
+ );
1742
1755
  if (draft.omissions.some((omission) => omission.reason !== "duplicate"))
1743
1756
  throw new Error(
1744
1757
  "This custom file exceeds the configured export limits or contains excluded content. Use a standard format or revise the source options."
1745
1758
  );
1746
1759
  const bytes = new Uint8Array(value.bytes);
1747
- const filename = `${props.label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "export"}.${value.extension.replace(/[^a-zA-Z0-9.-]/g, "") || "bin"}`;
1760
+ const filename = typeof value.filename === "string" ? value.filename : `${props.label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "export"}.${value.extension.replace(/[^a-zA-Z0-9.-]/g, "") || "bin"}`;
1748
1761
  return transport.download(
1749
1762
  (0, import_content_transfer2.sealTransferArtifact)({
1750
1763
  snapshotId: snapshot.id,
@@ -2254,7 +2267,7 @@ function MatrxUuidCell({
2254
2267
  }
2255
2268
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all", children: display });
2256
2269
  })();
2257
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2270
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2258
2271
  "span",
2259
2272
  {
2260
2273
  "data-matrx-cell-control": true,
@@ -2264,51 +2277,64 @@ function MatrxUuidCell({
2264
2277
  ),
2265
2278
  onClick: stop,
2266
2279
  children: [
2267
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Tooltip, { children: [
2280
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Tooltip, { children: [
2268
2281
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "inline-flex min-w-0 max-w-full items-center", children: idNode }) }),
2269
2282
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipContent, { side: "top", className: "max-w-sm break-all font-mono", children: forbidden ? `No access \xB7 ${tip}` : tip })
2270
- ] }) }),
2271
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2272
- "button",
2273
- {
2274
- type: "button",
2275
- onClick: onCopy,
2276
- "aria-label": copied ? "Copied" : `Copy ${label ?? "id"}`,
2277
- title: `Copy ${label ?? "id"}: ${value}`,
2278
- className: cn(
2279
- "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2280
- copied && "text-primary"
2281
- ),
2282
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Copy, { className: "h-3 w-3" })
2283
- }
2284
- ),
2285
- canPeek ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2286
- "button",
2287
- {
2288
- type: "button",
2289
- onClick: (e) => {
2290
- stop(e);
2291
- setPeekOpen(true);
2292
- },
2293
- "aria-label": `Quick look at ${label ?? "record"}`,
2294
- title: `Quick look at ${label ?? "record"}`,
2295
- className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2296
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Lightbulb, { className: "h-3 w-3" })
2297
- }
2298
- ) : null,
2299
- onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2300
- "a",
2301
- {
2302
- href: resolvedHref,
2303
- target: "_blank",
2304
- rel: "noopener noreferrer",
2305
- onClick: stop,
2306
- "aria-label": `Open ${label ?? "record"} in a new tab`,
2307
- title: `Open ${label ?? "record"} in a new tab`,
2308
- className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2309
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ExternalLink, { className: "h-3 w-3" })
2310
- }
2311
- ) : null,
2283
+ ] }),
2284
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Tooltip, { children: [
2285
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2286
+ "button",
2287
+ {
2288
+ type: "button",
2289
+ onClick: onCopy,
2290
+ "aria-label": copied ? "Copied" : `Copy ${label ?? "id"}`,
2291
+ className: cn(
2292
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2293
+ copied && "text-primary"
2294
+ ),
2295
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Copy, { className: "h-3 w-3" })
2296
+ }
2297
+ ) }),
2298
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipContent, { side: "top", children: copied ? "Copied" : `Copy ${label ?? "id"}: ${value}` })
2299
+ ] }),
2300
+ canPeek ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Tooltip, { children: [
2301
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2302
+ "button",
2303
+ {
2304
+ type: "button",
2305
+ onClick: (e) => {
2306
+ stop(e);
2307
+ setPeekOpen(true);
2308
+ },
2309
+ "aria-label": `Quick look at ${label ?? "record"}`,
2310
+ className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2311
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Lightbulb, { className: "h-3 w-3" })
2312
+ }
2313
+ ) }),
2314
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(TooltipContent, { side: "top", children: [
2315
+ "Quick look at ",
2316
+ label ?? "record"
2317
+ ] })
2318
+ ] }) : null,
2319
+ onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Tooltip, { children: [
2320
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2321
+ "a",
2322
+ {
2323
+ href: resolvedHref,
2324
+ target: "_blank",
2325
+ rel: "noopener noreferrer",
2326
+ onClick: stop,
2327
+ "aria-label": `Open ${label ?? "record"} in a new tab`,
2328
+ className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2329
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ExternalLink, { className: "h-3 w-3" })
2330
+ }
2331
+ ) }),
2332
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(TooltipContent, { side: "top", children: [
2333
+ "Open ",
2334
+ label ?? "record",
2335
+ " in a new tab"
2336
+ ] })
2337
+ ] }) : null,
2312
2338
  trailing,
2313
2339
  notice,
2314
2340
  canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
@@ -2322,7 +2348,7 @@ function MatrxUuidCell({
2322
2348
  ) : null
2323
2349
  ]
2324
2350
  }
2325
- );
2351
+ ) });
2326
2352
  }
2327
2353
 
2328
2354
  // src/data-table/entity.ts