@ai-matrx/design-system 0.18.2 → 0.18.3
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 +12 -0
- package/dist/content-transfer.cjs +119 -28
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.js +119 -28
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/data-row-inspector.cjs +119 -28
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +119 -28
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +119 -28
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +119 -28
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/index.cjs +119 -28
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +119 -28
- package/dist/data-table/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -701,6 +701,10 @@ function materialIdentity(material) {
|
|
|
701
701
|
}
|
|
702
702
|
return `payload:${id}`;
|
|
703
703
|
}
|
|
704
|
+
function snapshotContent(snapshot) {
|
|
705
|
+
const { sourceId, label, payload, coverage, unsavedChanges, omissions, sections, limits } = snapshot;
|
|
706
|
+
return JSON.stringify({ sourceId, label, payload, coverage, unsavedChanges, omissions, sections, limits });
|
|
707
|
+
}
|
|
704
708
|
function useFence() {
|
|
705
709
|
const mounted = React7.useRef(true);
|
|
706
710
|
const nextId = React7.useRef(0);
|
|
@@ -803,7 +807,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
803
807
|
const captured = await material.capture(signal);
|
|
804
808
|
sourceMaterial = { id: captured.snapshot.sourceId, label: captured.snapshot.label, capture: async () => captured };
|
|
805
809
|
} else if ("kind" in material) {
|
|
806
|
-
sourceMaterial =
|
|
810
|
+
sourceMaterial = { id: materialIdentity(material), label: sourceLabel, capture: async () => directSource(material, { sourceId: materialIdentity(material), label: sourceLabel, ...applyMenuProjection && projection ? { projection } : {}, ...applyMenuProjection && sections ? { sections } : {} }) };
|
|
807
811
|
} else if (applyMenuProjection && (projection || sections)) {
|
|
808
812
|
sourceMaterial = {
|
|
809
813
|
id: material.id,
|
|
@@ -820,7 +824,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
820
824
|
} else {
|
|
821
825
|
sourceMaterial = material;
|
|
822
826
|
}
|
|
823
|
-
const raw =
|
|
827
|
+
const raw = await sourceMaterial.capture({ scope, signal });
|
|
824
828
|
const constrained = resolveTransferPreferences(providerPreferences, preferences, raw.snapshot.limits);
|
|
825
829
|
const result = await capture({ id: raw.snapshot.sourceId, label: raw.snapshot.label, capture: async () => ({ ...raw, snapshot: { ...raw.snapshot, limits: constrained.limits } }) }, signal, scope);
|
|
826
830
|
if (scope !== "all-matching" || !collectPages) return result;
|
|
@@ -880,31 +884,117 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
880
884
|
fence.finish(controller);
|
|
881
885
|
}
|
|
882
886
|
}, [captureOne, capturePrimary, fence, formatSources, initialScope, preferences, providerPreferences, report, transport]);
|
|
883
|
-
const openWorkspace = React7.useCallback(
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
887
|
+
const openWorkspace = React7.useCallback(
|
|
888
|
+
async (key = primaryWorkspaceKey, variant) => {
|
|
889
|
+
const variantMaterial = variant && "kind" in variant.source ? {
|
|
890
|
+
id: `variant:${key}`,
|
|
891
|
+
label: variant.label,
|
|
892
|
+
capture: async () => directSource(variant.source, {
|
|
893
|
+
sourceId: `variant:${key}`,
|
|
894
|
+
label: variant.label
|
|
895
|
+
})
|
|
896
|
+
} : variant?.source;
|
|
897
|
+
const captureWorkspace = (scope, signal, collectPages = true) => captureOne(variantMaterial ?? primary, scope, signal, true, collectPages);
|
|
898
|
+
workspaceCaptures.current.set(key, captureWorkspace);
|
|
899
|
+
const existing = workspaces[key];
|
|
900
|
+
const { controller, id } = fence.begin();
|
|
901
|
+
if (existing) {
|
|
902
|
+
try {
|
|
903
|
+
const allMatching = existing.scope === "all-matching";
|
|
904
|
+
const fresh = await captureWorkspace(
|
|
905
|
+
existing.scope,
|
|
906
|
+
controller.signal,
|
|
907
|
+
!allMatching
|
|
908
|
+
);
|
|
909
|
+
if (!fence.valid(id, controller) || !workspaceCaptures.current.has(key))
|
|
910
|
+
return;
|
|
911
|
+
if (allMatching && (!existing.allMatching || !fresh.allMatching))
|
|
912
|
+
throw new Error(
|
|
913
|
+
"This source can no longer provide an all-matching snapshot."
|
|
914
|
+
);
|
|
915
|
+
const collectionIdentity = (value) => value && {
|
|
916
|
+
query: value.source.query,
|
|
917
|
+
projection: value.projection,
|
|
918
|
+
columns: value.columns,
|
|
919
|
+
limits: value.limits
|
|
920
|
+
};
|
|
921
|
+
const changed = allMatching ? JSON.stringify(collectionIdentity(existing.allMatching)) !== JSON.stringify(collectionIdentity(fresh.allMatching)) : snapshotContent(existing.snapshot) !== snapshotContent(fresh.snapshot);
|
|
922
|
+
setWorkspaces((current) => {
|
|
923
|
+
const retained = current[key];
|
|
924
|
+
if (!retained) return current;
|
|
925
|
+
return {
|
|
926
|
+
...current,
|
|
927
|
+
[key]: {
|
|
928
|
+
...retained,
|
|
929
|
+
error: fresh.collectionError,
|
|
930
|
+
...allMatching ? { sourceStale: changed } : changed ? { pending: { ...fresh, scope: retained.scope } } : { pending: void 0 }
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
});
|
|
934
|
+
setWorkspaceKey(key);
|
|
935
|
+
setWorkspaceOpen(true);
|
|
936
|
+
} catch (error) {
|
|
937
|
+
if (fence.valid(id, controller) && workspaceCaptures.current.has(key)) {
|
|
938
|
+
setWorkspaces(
|
|
939
|
+
(current) => current[key] ? {
|
|
940
|
+
...current,
|
|
941
|
+
[key]: {
|
|
942
|
+
...current[key],
|
|
943
|
+
error: errorMessage(error, "Could not refresh source")
|
|
944
|
+
}
|
|
945
|
+
} : current
|
|
946
|
+
);
|
|
947
|
+
setWorkspaceKey(key);
|
|
948
|
+
setWorkspaceOpen(true);
|
|
949
|
+
}
|
|
950
|
+
} finally {
|
|
951
|
+
fence.finish(controller);
|
|
952
|
+
}
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
try {
|
|
956
|
+
const result = await captureWorkspace(initialScope, controller.signal);
|
|
957
|
+
if (!fence.valid(id, controller)) return;
|
|
958
|
+
const resolved = resolveTransferPreferences(
|
|
959
|
+
providerPreferences,
|
|
960
|
+
preferences,
|
|
961
|
+
result.snapshot.limits
|
|
962
|
+
);
|
|
963
|
+
const original = createDraft(result.snapshot);
|
|
964
|
+
const base = {
|
|
965
|
+
...result,
|
|
966
|
+
key,
|
|
967
|
+
original,
|
|
968
|
+
draft: original,
|
|
969
|
+
scope: initialScope,
|
|
970
|
+
preferences: resolved,
|
|
971
|
+
...result.collectionError ? { error: result.collectionError } : {}
|
|
972
|
+
};
|
|
973
|
+
setWorkspaces((current) => ({
|
|
974
|
+
...current,
|
|
975
|
+
[key]: { ...base, draft: rebuild(base, initialControls(base)) }
|
|
976
|
+
}));
|
|
977
|
+
setWorkspaceKey(key);
|
|
978
|
+
setWorkspaceOpen(true);
|
|
979
|
+
} catch (error) {
|
|
980
|
+
if (fence.valid(id, controller))
|
|
981
|
+
setNotice(errorMessage(error, "Could not capture content"));
|
|
982
|
+
} finally {
|
|
983
|
+
fence.finish(controller);
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
[
|
|
987
|
+
captureOne,
|
|
988
|
+
capturePrimary,
|
|
989
|
+
fence,
|
|
990
|
+
initialScope,
|
|
991
|
+
preferences,
|
|
992
|
+
primaryWorkspaceKey,
|
|
993
|
+
primary,
|
|
994
|
+
providerPreferences,
|
|
995
|
+
workspaces
|
|
996
|
+
]
|
|
997
|
+
);
|
|
908
998
|
React7.useImperativeHandle(controllerRef, () => ({
|
|
909
999
|
focusTrigger: () => triggerRef.current?.focus(),
|
|
910
1000
|
prepare: async (requestedSource, options) => {
|
|
@@ -1127,7 +1217,7 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1127
1217
|
setBusy("capture");
|
|
1128
1218
|
try {
|
|
1129
1219
|
const result = await captureScope(scope, controller.signal);
|
|
1130
|
-
if (fence.valid(id, controller) && latest.current.draft.revision === revision) onChange({ ...latest.current, pending: { ...result, scope }, error: result.collectionError });
|
|
1220
|
+
if (fence.valid(id, controller) && latest.current.draft.revision === revision) onChange({ ...latest.current, pending: { ...result, scope }, sourceStale: false, error: result.collectionError });
|
|
1131
1221
|
} catch (error) {
|
|
1132
1222
|
if (fence.valid(id, controller)) onChange({ ...latest.current, error: errorMessage(error, "Refresh failed") });
|
|
1133
1223
|
} finally {
|
|
@@ -1370,6 +1460,7 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1370
1460
|
/* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
|
|
1371
1461
|
/* @__PURE__ */ jsx10(Button, { type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
|
|
1372
1462
|
] }) : null,
|
|
1463
|
+
state.sourceStale ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
|
|
1373
1464
|
state.pending ? /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-decision", role: "alert", children: [
|
|
1374
1465
|
/* @__PURE__ */ jsx10("p", { children: "A fresh source snapshot is ready." }),
|
|
1375
1466
|
/* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
|