@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
@@ -1514,6 +1514,7 @@ var actionDone = (message) => ({
1514
1514
  mimeTypes: [],
1515
1515
  message
1516
1516
  });
1517
+ var isSafeFilename = (filename) => filename === filename.trim() && filename.length > 0 && !/^\.+$/.test(filename) && !/[\\/\x00-\x1F\x7F]/.test(filename);
1517
1518
  var sourceFor = (id, label, build) => ({
1518
1519
  id,
1519
1520
  label,
@@ -1570,14 +1571,21 @@ function MatrxCopyMenuSession(props) {
1570
1571
  ))
1571
1572
  throw new Error("Sheet rows must be JSON objects.");
1572
1573
  const rows = value;
1573
- const keys = [...new Set(rows.flatMap((row) => Object.keys(row)))];
1574
+ const suppliedColumns = props.export.sheetColumns?.();
1575
+ const columns = suppliedColumns ?? [...new Set(rows.flatMap((row) => Object.keys(row)))].map((id) => ({ id, label: id }));
1576
+ const ids = /* @__PURE__ */ new Set();
1577
+ for (const column of columns) {
1578
+ if (!column.id || !column.label || ids.has(column.id)) throw new Error("Sheet columns require unique nonempty ids and labels.");
1579
+ ids.add(column.id);
1580
+ }
1581
+ 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.`);
1574
1582
  return {
1575
1583
  kind: "rows",
1576
1584
  rows,
1577
- columns: keys.map((key) => ({
1578
- id: key,
1579
- label: key,
1580
- path: `/${key.replace(/~/g, "~0").replace(/\//g, "~1")}`,
1585
+ columns: columns.map((column) => ({
1586
+ id: column.id,
1587
+ label: column.label,
1588
+ path: `/${column.id.replace(/~/g, "~0").replace(/\//g, "~1")}`,
1581
1589
  visible: true
1582
1590
  }))
1583
1591
  };
@@ -1662,7 +1670,8 @@ function MatrxCopyMenuSession(props) {
1662
1670
  value: {
1663
1671
  bytes: Array.from(bytes),
1664
1672
  mime: file.mime,
1665
- extension: file.extension
1673
+ extension: file.extension,
1674
+ ...file.filename !== void 0 ? { filename: file.filename } : {}
1666
1675
  }
1667
1676
  };
1668
1677
  },
@@ -1679,12 +1688,16 @@ function MatrxCopyMenuSession(props) {
1679
1688
  (byte) => typeof byte !== "number" || !Number.isInteger(byte) || byte < 0 || byte > 255
1680
1689
  ))
1681
1690
  throw new Error(`${item.label} did not capture a valid file.`);
1691
+ if (value.filename !== void 0 && (typeof value.filename !== "string" || !isSafeFilename(value.filename)))
1692
+ throw new Error(
1693
+ `${item.label} has an unsafe filename. Use a nonempty basename without leading or trailing whitespace, dots only, path separators, or control characters.`
1694
+ );
1682
1695
  if (draft.omissions.some((omission) => omission.reason !== "duplicate"))
1683
1696
  throw new Error(
1684
1697
  "This custom file exceeds the configured export limits or contains excluded content. Use a standard format or revise the source options."
1685
1698
  );
1686
1699
  const bytes = new Uint8Array(value.bytes);
1687
- const filename = `${props.label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "export"}.${value.extension.replace(/[^a-zA-Z0-9.-]/g, "") || "bin"}`;
1700
+ 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"}`;
1688
1701
  return transport.download(
1689
1702
  sealTransferArtifact2({
1690
1703
  snapshotId: snapshot.id,
@@ -2226,7 +2239,7 @@ function MatrxUuidCell({
2226
2239
  }
2227
2240
  return /* @__PURE__ */ jsx14("span", { className: "min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all", children: display });
2228
2241
  })();
2229
- return /* @__PURE__ */ jsxs8(
2242
+ return /* @__PURE__ */ jsx14(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs8(
2230
2243
  "span",
2231
2244
  {
2232
2245
  "data-matrx-cell-control": true,
@@ -2236,51 +2249,64 @@ function MatrxUuidCell({
2236
2249
  ),
2237
2250
  onClick: stop,
2238
2251
  children: [
2239
- /* @__PURE__ */ jsx14(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs8(Tooltip, { children: [
2252
+ /* @__PURE__ */ jsxs8(Tooltip, { children: [
2240
2253
  /* @__PURE__ */ jsx14(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx14("span", { className: "inline-flex min-w-0 max-w-full items-center", children: idNode }) }),
2241
2254
  /* @__PURE__ */ jsx14(TooltipContent, { side: "top", className: "max-w-sm break-all font-mono", children: forbidden ? `No access \xB7 ${tip}` : tip })
2242
- ] }) }),
2243
- /* @__PURE__ */ jsx14(
2244
- "button",
2245
- {
2246
- type: "button",
2247
- onClick: onCopy,
2248
- "aria-label": copied ? "Copied" : `Copy ${label ?? "id"}`,
2249
- title: `Copy ${label ?? "id"}: ${value}`,
2250
- className: cn(
2251
- "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2252
- copied && "text-primary"
2253
- ),
2254
- children: copied ? /* @__PURE__ */ jsx14(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx14(Copy, { className: "h-3 w-3" })
2255
- }
2256
- ),
2257
- canPeek ? /* @__PURE__ */ jsx14(
2258
- "button",
2259
- {
2260
- type: "button",
2261
- onClick: (e) => {
2262
- stop(e);
2263
- setPeekOpen(true);
2264
- },
2265
- "aria-label": `Quick look at ${label ?? "record"}`,
2266
- title: `Quick look at ${label ?? "record"}`,
2267
- 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",
2268
- children: /* @__PURE__ */ jsx14(Lightbulb, { className: "h-3 w-3" })
2269
- }
2270
- ) : null,
2271
- onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ jsx14(
2272
- "a",
2273
- {
2274
- href: resolvedHref,
2275
- target: "_blank",
2276
- rel: "noopener noreferrer",
2277
- onClick: stop,
2278
- "aria-label": `Open ${label ?? "record"} in a new tab`,
2279
- title: `Open ${label ?? "record"} in a new tab`,
2280
- 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",
2281
- children: /* @__PURE__ */ jsx14(ExternalLink, { className: "h-3 w-3" })
2282
- }
2283
- ) : null,
2255
+ ] }),
2256
+ /* @__PURE__ */ jsxs8(Tooltip, { children: [
2257
+ /* @__PURE__ */ jsx14(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx14(
2258
+ "button",
2259
+ {
2260
+ type: "button",
2261
+ onClick: onCopy,
2262
+ "aria-label": copied ? "Copied" : `Copy ${label ?? "id"}`,
2263
+ className: cn(
2264
+ "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
2265
+ copied && "text-primary"
2266
+ ),
2267
+ children: copied ? /* @__PURE__ */ jsx14(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx14(Copy, { className: "h-3 w-3" })
2268
+ }
2269
+ ) }),
2270
+ /* @__PURE__ */ jsx14(TooltipContent, { side: "top", children: copied ? "Copied" : `Copy ${label ?? "id"}: ${value}` })
2271
+ ] }),
2272
+ canPeek ? /* @__PURE__ */ jsxs8(Tooltip, { children: [
2273
+ /* @__PURE__ */ jsx14(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx14(
2274
+ "button",
2275
+ {
2276
+ type: "button",
2277
+ onClick: (e) => {
2278
+ stop(e);
2279
+ setPeekOpen(true);
2280
+ },
2281
+ "aria-label": `Quick look at ${label ?? "record"}`,
2282
+ 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",
2283
+ children: /* @__PURE__ */ jsx14(Lightbulb, { className: "h-3 w-3" })
2284
+ }
2285
+ ) }),
2286
+ /* @__PURE__ */ jsxs8(TooltipContent, { side: "top", children: [
2287
+ "Quick look at ",
2288
+ label ?? "record"
2289
+ ] })
2290
+ ] }) : null,
2291
+ onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ jsxs8(Tooltip, { children: [
2292
+ /* @__PURE__ */ jsx14(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx14(
2293
+ "a",
2294
+ {
2295
+ href: resolvedHref,
2296
+ target: "_blank",
2297
+ rel: "noopener noreferrer",
2298
+ onClick: stop,
2299
+ "aria-label": `Open ${label ?? "record"} in a new tab`,
2300
+ 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",
2301
+ children: /* @__PURE__ */ jsx14(ExternalLink, { className: "h-3 w-3" })
2302
+ }
2303
+ ) }),
2304
+ /* @__PURE__ */ jsxs8(TooltipContent, { side: "top", children: [
2305
+ "Open ",
2306
+ label ?? "record",
2307
+ " in a new tab"
2308
+ ] })
2309
+ ] }) : null,
2284
2310
  trailing,
2285
2311
  notice,
2286
2312
  canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ jsx14(
@@ -2294,7 +2320,7 @@ function MatrxUuidCell({
2294
2320
  ) : null
2295
2321
  ]
2296
2322
  }
2297
- );
2323
+ ) });
2298
2324
  }
2299
2325
 
2300
2326
  // src/data-table/entity.ts