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