@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
@@ -95,6 +95,8 @@ interface AlchemyExportItem {
95
95
  content: BlobPart;
96
96
  extension: string;
97
97
  mime: string;
98
+ /** Optional exact safe basename captured with bytes; omission derives a default, invalid values error. */
99
+ filename?: string;
98
100
  };
99
101
  onSelect?: () => void | Promise<void>;
100
102
  }
@@ -120,6 +122,10 @@ interface MatrxCopyMenuProps {
120
122
  export?: {
121
123
  items: AlchemyExportItem[];
122
124
  sheetRows?: () => Array<Record<string, unknown>>;
125
+ sheetColumns?: () => Array<{
126
+ id: string;
127
+ label: string;
128
+ }>;
123
129
  };
124
130
  /** Host-owned authenticated destination, not a second export serializer. */
125
131
  sendToSheet?: (rows: Array<Record<string, unknown>>, label: string) => Promise<TransferOutcome>;
@@ -95,6 +95,8 @@ interface AlchemyExportItem {
95
95
  content: BlobPart;
96
96
  extension: string;
97
97
  mime: string;
98
+ /** Optional exact safe basename captured with bytes; omission derives a default, invalid values error. */
99
+ filename?: string;
98
100
  };
99
101
  onSelect?: () => void | Promise<void>;
100
102
  }
@@ -120,6 +122,10 @@ interface MatrxCopyMenuProps {
120
122
  export?: {
121
123
  items: AlchemyExportItem[];
122
124
  sheetRows?: () => Array<Record<string, unknown>>;
125
+ sheetColumns?: () => Array<{
126
+ id: string;
127
+ label: string;
128
+ }>;
123
129
  };
124
130
  /** Host-owned authenticated destination, not a second export serializer. */
125
131
  sendToSheet?: (rows: Array<Record<string, unknown>>, label: string) => Promise<TransferOutcome>;
@@ -630,6 +630,7 @@ var actionDone = (message) => ({
630
630
  mimeTypes: [],
631
631
  message
632
632
  });
633
+ var isSafeFilename = (filename) => filename === filename.trim() && filename.length > 0 && !/^\.+$/.test(filename) && !/[\\/\x00-\x1F\x7F]/.test(filename);
633
634
  var sourceFor = (id, label, build) => ({
634
635
  id,
635
636
  label,
@@ -686,14 +687,21 @@ function MatrxCopyMenuSession(props) {
686
687
  ))
687
688
  throw new Error("Sheet rows must be JSON objects.");
688
689
  const rows = value;
689
- const keys = [...new Set(rows.flatMap((row) => Object.keys(row)))];
690
+ const suppliedColumns = props.export.sheetColumns?.();
691
+ const columns = suppliedColumns ?? [...new Set(rows.flatMap((row) => Object.keys(row)))].map((id) => ({ id, label: id }));
692
+ const ids = /* @__PURE__ */ new Set();
693
+ for (const column of columns) {
694
+ if (!column.id || !column.label || ids.has(column.id)) throw new Error("Sheet columns require unique nonempty ids and labels.");
695
+ ids.add(column.id);
696
+ }
697
+ 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.`);
690
698
  return {
691
699
  kind: "rows",
692
700
  rows,
693
- columns: keys.map((key) => ({
694
- id: key,
695
- label: key,
696
- path: `/${key.replace(/~/g, "~0").replace(/\//g, "~1")}`,
701
+ columns: columns.map((column) => ({
702
+ id: column.id,
703
+ label: column.label,
704
+ path: `/${column.id.replace(/~/g, "~0").replace(/\//g, "~1")}`,
697
705
  visible: true
698
706
  }))
699
707
  };
@@ -778,7 +786,8 @@ function MatrxCopyMenuSession(props) {
778
786
  value: {
779
787
  bytes: Array.from(bytes),
780
788
  mime: file.mime,
781
- extension: file.extension
789
+ extension: file.extension,
790
+ ...file.filename !== void 0 ? { filename: file.filename } : {}
782
791
  }
783
792
  };
784
793
  },
@@ -795,12 +804,16 @@ function MatrxCopyMenuSession(props) {
795
804
  (byte) => typeof byte !== "number" || !Number.isInteger(byte) || byte < 0 || byte > 255
796
805
  ))
797
806
  throw new Error(`${item.label} did not capture a valid file.`);
807
+ if (value.filename !== void 0 && (typeof value.filename !== "string" || !isSafeFilename(value.filename)))
808
+ throw new Error(
809
+ `${item.label} has an unsafe filename. Use a nonempty basename without leading or trailing whitespace, dots only, path separators, or control characters.`
810
+ );
798
811
  if (draft.omissions.some((omission) => omission.reason !== "duplicate"))
799
812
  throw new Error(
800
813
  "This custom file exceeds the configured export limits or contains excluded content. Use a standard format or revise the source options."
801
814
  );
802
815
  const bytes = new Uint8Array(value.bytes);
803
- const filename = `${props.label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "export"}.${value.extension.replace(/[^a-zA-Z0-9.-]/g, "") || "bin"}`;
816
+ 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"}`;
804
817
  return transport.download(
805
818
  sealTransferArtifact({
806
819
  snapshotId: snapshot.id,