@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
@@ -1567,6 +1567,7 @@ var actionDone = (message) => ({
1567
1567
  mimeTypes: [],
1568
1568
  message
1569
1569
  });
1570
+ var isSafeFilename = (filename) => filename === filename.trim() && filename.length > 0 && !/^\.+$/.test(filename) && !/[\\/\x00-\x1F\x7F]/.test(filename);
1570
1571
  var sourceFor = (id, label, build) => ({
1571
1572
  id,
1572
1573
  label,
@@ -1623,14 +1624,21 @@ function MatrxCopyMenuSession(props) {
1623
1624
  ))
1624
1625
  throw new Error("Sheet rows must be JSON objects.");
1625
1626
  const rows = value;
1626
- const keys = [...new Set(rows.flatMap((row) => Object.keys(row)))];
1627
+ const suppliedColumns = props.export.sheetColumns?.();
1628
+ const columns = suppliedColumns ?? [...new Set(rows.flatMap((row) => Object.keys(row)))].map((id) => ({ id, label: id }));
1629
+ const ids = /* @__PURE__ */ new Set();
1630
+ for (const column of columns) {
1631
+ if (!column.id || !column.label || ids.has(column.id)) throw new Error("Sheet columns require unique nonempty ids and labels.");
1632
+ ids.add(column.id);
1633
+ }
1634
+ 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.`);
1627
1635
  return {
1628
1636
  kind: "rows",
1629
1637
  rows,
1630
- columns: keys.map((key) => ({
1631
- id: key,
1632
- label: key,
1633
- path: `/${key.replace(/~/g, "~0").replace(/\//g, "~1")}`,
1638
+ columns: columns.map((column) => ({
1639
+ id: column.id,
1640
+ label: column.label,
1641
+ path: `/${column.id.replace(/~/g, "~0").replace(/\//g, "~1")}`,
1634
1642
  visible: true
1635
1643
  }))
1636
1644
  };
@@ -1715,7 +1723,8 @@ function MatrxCopyMenuSession(props) {
1715
1723
  value: {
1716
1724
  bytes: Array.from(bytes),
1717
1725
  mime: file.mime,
1718
- extension: file.extension
1726
+ extension: file.extension,
1727
+ ...file.filename !== void 0 ? { filename: file.filename } : {}
1719
1728
  }
1720
1729
  };
1721
1730
  },
@@ -1732,12 +1741,16 @@ function MatrxCopyMenuSession(props) {
1732
1741
  (byte) => typeof byte !== "number" || !Number.isInteger(byte) || byte < 0 || byte > 255
1733
1742
  ))
1734
1743
  throw new Error(`${item.label} did not capture a valid file.`);
1744
+ if (value.filename !== void 0 && (typeof value.filename !== "string" || !isSafeFilename(value.filename)))
1745
+ throw new Error(
1746
+ `${item.label} has an unsafe filename. Use a nonempty basename without leading or trailing whitespace, dots only, path separators, or control characters.`
1747
+ );
1735
1748
  if (draft.omissions.some((omission) => omission.reason !== "duplicate"))
1736
1749
  throw new Error(
1737
1750
  "This custom file exceeds the configured export limits or contains excluded content. Use a standard format or revise the source options."
1738
1751
  );
1739
1752
  const bytes = new Uint8Array(value.bytes);
1740
- const filename = `${props.label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "export"}.${value.extension.replace(/[^a-zA-Z0-9.-]/g, "") || "bin"}`;
1753
+ 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"}`;
1741
1754
  return transport.download(
1742
1755
  sealTransferArtifact2({
1743
1756
  snapshotId: snapshot.id,
@@ -2251,7 +2264,7 @@ function MatrxUuidCell({
2251
2264
  }
2252
2265
  return /* @__PURE__ */ jsx15("span", { className: "min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all", children: display });
2253
2266
  })();
2254
- return /* @__PURE__ */ jsxs9(
2267
+ return /* @__PURE__ */ jsx15(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs9(
2255
2268
  "span",
2256
2269
  {
2257
2270
  "data-matrx-cell-control": true,
@@ -2261,51 +2274,64 @@ function MatrxUuidCell({
2261
2274
  ),
2262
2275
  onClick: stop,
2263
2276
  children: [
2264
- /* @__PURE__ */ jsx15(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs9(Tooltip, { children: [
2277
+ /* @__PURE__ */ jsxs9(Tooltip, { children: [
2265
2278
  /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx15("span", { className: "inline-flex min-w-0 max-w-full items-center", children: idNode }) }),
2266
2279
  /* @__PURE__ */ jsx15(TooltipContent, { side: "top", className: "max-w-sm break-all font-mono", children: forbidden ? `No access \xB7 ${tip}` : tip })
2267
- ] }) }),
2268
- /* @__PURE__ */ jsx15(
2269
- "button",
2270
- {
2271
- type: "button",
2272
- onClick: onCopy,
2273
- "aria-label": copied ? "Copied" : `Copy ${label ?? "id"}`,
2274
- title: `Copy ${label ?? "id"}: ${value}`,
2275
- className: cn(
2276
- "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2277
- copied && "text-primary"
2278
- ),
2279
- children: copied ? /* @__PURE__ */ jsx15(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx15(Copy, { className: "h-3 w-3" })
2280
- }
2281
- ),
2282
- canPeek ? /* @__PURE__ */ jsx15(
2283
- "button",
2284
- {
2285
- type: "button",
2286
- onClick: (e) => {
2287
- stop(e);
2288
- setPeekOpen(true);
2289
- },
2290
- "aria-label": `Quick look at ${label ?? "record"}`,
2291
- title: `Quick look at ${label ?? "record"}`,
2292
- 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",
2293
- children: /* @__PURE__ */ jsx15(Lightbulb, { className: "h-3 w-3" })
2294
- }
2295
- ) : null,
2296
- onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ jsx15(
2297
- "a",
2298
- {
2299
- href: resolvedHref,
2300
- target: "_blank",
2301
- rel: "noopener noreferrer",
2302
- onClick: stop,
2303
- "aria-label": `Open ${label ?? "record"} in a new tab`,
2304
- title: `Open ${label ?? "record"} in a new tab`,
2305
- 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",
2306
- children: /* @__PURE__ */ jsx15(ExternalLink, { className: "h-3 w-3" })
2307
- }
2308
- ) : null,
2280
+ ] }),
2281
+ /* @__PURE__ */ jsxs9(Tooltip, { children: [
2282
+ /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx15(
2283
+ "button",
2284
+ {
2285
+ type: "button",
2286
+ onClick: onCopy,
2287
+ "aria-label": copied ? "Copied" : `Copy ${label ?? "id"}`,
2288
+ className: cn(
2289
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2290
+ copied && "text-primary"
2291
+ ),
2292
+ children: copied ? /* @__PURE__ */ jsx15(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx15(Copy, { className: "h-3 w-3" })
2293
+ }
2294
+ ) }),
2295
+ /* @__PURE__ */ jsx15(TooltipContent, { side: "top", children: copied ? "Copied" : `Copy ${label ?? "id"}: ${value}` })
2296
+ ] }),
2297
+ canPeek ? /* @__PURE__ */ jsxs9(Tooltip, { children: [
2298
+ /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx15(
2299
+ "button",
2300
+ {
2301
+ type: "button",
2302
+ onClick: (e) => {
2303
+ stop(e);
2304
+ setPeekOpen(true);
2305
+ },
2306
+ "aria-label": `Quick look at ${label ?? "record"}`,
2307
+ 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",
2308
+ children: /* @__PURE__ */ jsx15(Lightbulb, { className: "h-3 w-3" })
2309
+ }
2310
+ ) }),
2311
+ /* @__PURE__ */ jsxs9(TooltipContent, { side: "top", children: [
2312
+ "Quick look at ",
2313
+ label ?? "record"
2314
+ ] })
2315
+ ] }) : null,
2316
+ onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ jsxs9(Tooltip, { children: [
2317
+ /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx15(
2318
+ "a",
2319
+ {
2320
+ href: resolvedHref,
2321
+ target: "_blank",
2322
+ rel: "noopener noreferrer",
2323
+ onClick: stop,
2324
+ "aria-label": `Open ${label ?? "record"} in a new tab`,
2325
+ 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",
2326
+ children: /* @__PURE__ */ jsx15(ExternalLink, { className: "h-3 w-3" })
2327
+ }
2328
+ ) }),
2329
+ /* @__PURE__ */ jsxs9(TooltipContent, { side: "top", children: [
2330
+ "Open ",
2331
+ label ?? "record",
2332
+ " in a new tab"
2333
+ ] })
2334
+ ] }) : null,
2309
2335
  trailing,
2310
2336
  notice,
2311
2337
  canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ jsx15(
@@ -2319,7 +2345,7 @@ function MatrxUuidCell({
2319
2345
  ) : null
2320
2346
  ]
2321
2347
  }
2322
- );
2348
+ ) });
2323
2349
  }
2324
2350
 
2325
2351
  // src/data-table/entity.ts