@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.
- package/CHANGELOG.md +18 -0
- package/README.md +22 -0
- package/dist/content-transfer.cjs +20 -7
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.d.cts +6 -0
- package/dist/content-transfer.d.ts +6 -0
- package/dist/content-transfer.js +20 -7
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/copy-helpers.cjs +53 -0
- package/dist/data-table/copy-helpers.cjs.map +1 -1
- package/dist/data-table/copy-helpers.d.cts +13 -2
- package/dist/data-table/copy-helpers.d.ts +13 -2
- package/dist/data-table/copy-helpers.js +55 -0
- package/dist/data-table/copy-helpers.js.map +1 -1
- package/dist/data-table/copy-types.cjs.map +1 -1
- package/dist/data-table/copy-types.d.cts +4 -0
- package/dist/data-table/copy-types.d.ts +4 -0
- package/dist/data-table/data-row-inspector.cjs +78 -52
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +78 -52
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +78 -52
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +78 -52
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/filter-engine.d.cts +1 -1
- package/dist/data-table/filter-engine.d.ts +1 -1
- package/dist/data-table/index.cjs +1587 -1277
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +23 -3
- package/dist/data-table/index.d.ts +23 -3
- package/dist/data-table/index.js +1574 -1262
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.d.cts +1 -1
- package/dist/data-table/infer-filter.d.ts +1 -1
- package/dist/data-table/layered-filters.d.cts +1 -1
- package/dist/data-table/layered-filters.d.ts +1 -1
- package/dist/data-table/pagination.cjs +149 -91
- package/dist/data-table/pagination.cjs.map +1 -1
- package/dist/data-table/pagination.js +144 -86
- package/dist/data-table/pagination.js.map +1 -1
- package/dist/data-table/query-control.d.cts +1 -1
- package/dist/data-table/query-control.d.ts +1 -1
- package/dist/data-table/types.cjs.map +1 -1
- package/dist/data-table/types.d.cts +1 -1
- package/dist/data-table/types.d.ts +1 -1
- package/dist/data-table/url-state.d.cts +1 -1
- package/dist/data-table/url-state.d.ts +1 -1
- package/dist/data-table/uuid-cell.cjs +58 -45
- package/dist/data-table/uuid-cell.cjs.map +1 -1
- package/dist/data-table/uuid-cell.js +58 -45
- package/dist/data-table/uuid-cell.js.map +1 -1
- package/dist/data-table/xlsx.d.cts +1 -1
- package/dist/data-table/xlsx.d.ts +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{types-CD4xGL5Z.d.cts → types-0CNCWvdK.d.cts} +4 -2
- package/dist/{types-BhSkeZQ_.d.ts → types-cH8oLqUx.d.ts} +4 -2
- 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>;
|
package/dist/content-transfer.js
CHANGED
|
@@ -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
|
|
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:
|
|
694
|
-
id:
|
|
695
|
-
label:
|
|
696
|
-
path: `/${
|
|
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,
|