@arpproject/recrate 0.1.44 → 0.1.45-test
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.
|
@@ -6,6 +6,7 @@ export declare const getProfileTabKey: (tab: any) => string;
|
|
|
6
6
|
export declare const isProfileTab: (tab: any) => boolean;
|
|
7
7
|
export declare const findAddedProfileTab: (tabs: any[], previousTabKeys: Set<string>) => any;
|
|
8
8
|
export declare const isAboutTab: (tab: any) => boolean;
|
|
9
|
+
export declare const tabHasRenderableContent: (tab: any) => boolean;
|
|
9
10
|
export declare const tabContainsProperty: (tab: any, property: string) => boolean;
|
|
10
11
|
export declare const findTabForProperty: (tabs: any[], property: string) => any;
|
|
11
12
|
export declare const addMissingReviewPropertiesToTabs: (tabs: any[], properties: string[]) => any[];
|
|
@@ -27,7 +27,8 @@ interface UseEntityScrollRestorationOptions {
|
|
|
27
27
|
captureViewContext: (tabName?: string, explicitScrollTop?: number, options?: {
|
|
28
28
|
updateActiveTab?: boolean;
|
|
29
29
|
}) => void;
|
|
30
|
+
disabled?: boolean;
|
|
30
31
|
debugScroll?: (...args: any[]) => void;
|
|
31
32
|
}
|
|
32
|
-
declare const useEntityScrollRestoration: ({ activeTab, activeContentRef, contextEntity, renderTabs, tabsLength, extraPropertiesLength, scrollRestoreNonce, setScrollRestoreNonce, navigationRestoreReadyRef, pendingRestoredTabRef, restoreInProgressRef, pendingAddedPropertyRef, showAddPanel, reverseSidebarVisible, highlightRequiredProperties, iconView, tabPaneWidth, state, isAiScrollRestoreSuppressed, captureViewContext, debugScroll, }: UseEntityScrollRestorationOptions) => void;
|
|
33
|
+
declare const useEntityScrollRestoration: ({ activeTab, activeContentRef, contextEntity, renderTabs, tabsLength, extraPropertiesLength, scrollRestoreNonce, setScrollRestoreNonce, navigationRestoreReadyRef, pendingRestoredTabRef, restoreInProgressRef, pendingAddedPropertyRef, showAddPanel, reverseSidebarVisible, highlightRequiredProperties, iconView, tabPaneWidth, state, isAiScrollRestoreSuppressed, captureViewContext, disabled, debugScroll, }: UseEntityScrollRestorationOptions) => void;
|
|
33
34
|
export default useEntityScrollRestoration;
|
package/dist/recrate.es.js
CHANGED
|
@@ -4809,7 +4809,7 @@ const seedToken = Object.assign(Object.assign({}, defaultPresetColors), {
|
|
|
4809
4809
|
// Motion
|
|
4810
4810
|
motion: true
|
|
4811
4811
|
});
|
|
4812
|
-
const round
|
|
4812
|
+
const round = Math.round;
|
|
4813
4813
|
function splitColorStr(str, parseNum) {
|
|
4814
4814
|
const match2 = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
|
|
4815
4815
|
const numList = match2.map((item) => parseFloat(item));
|
|
@@ -4927,7 +4927,7 @@ class FastColor {
|
|
|
4927
4927
|
if (delta === 0) {
|
|
4928
4928
|
this._h = 0;
|
|
4929
4929
|
} else {
|
|
4930
|
-
this._h = round
|
|
4930
|
+
this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
|
|
4931
4931
|
}
|
|
4932
4932
|
}
|
|
4933
4933
|
return this._h;
|
|
@@ -5004,10 +5004,10 @@ class FastColor {
|
|
|
5004
5004
|
const p2 = amount / 100;
|
|
5005
5005
|
const calc = (key) => (color[key] - this[key]) * p2 + this[key];
|
|
5006
5006
|
const rgba = {
|
|
5007
|
-
r: round
|
|
5008
|
-
g: round
|
|
5009
|
-
b: round
|
|
5010
|
-
a: round
|
|
5007
|
+
r: round(calc("r")),
|
|
5008
|
+
g: round(calc("g")),
|
|
5009
|
+
b: round(calc("b")),
|
|
5010
|
+
a: round(calc("a") * 100) / 100
|
|
5011
5011
|
};
|
|
5012
5012
|
return this._c(rgba);
|
|
5013
5013
|
}
|
|
@@ -5039,7 +5039,7 @@ class FastColor {
|
|
|
5039
5039
|
const bg = this._c(background2);
|
|
5040
5040
|
const alpha2 = this.a + bg.a * (1 - this.a);
|
|
5041
5041
|
const calc = (key) => {
|
|
5042
|
-
return round
|
|
5042
|
+
return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha2);
|
|
5043
5043
|
};
|
|
5044
5044
|
return this._c({
|
|
5045
5045
|
r: calc("r"),
|
|
@@ -5072,7 +5072,7 @@ class FastColor {
|
|
|
5072
5072
|
const bHex = (this.b || 0).toString(16);
|
|
5073
5073
|
hex2 += bHex.length === 2 ? bHex : "0" + bHex;
|
|
5074
5074
|
if (typeof this.a === "number" && this.a >= 0 && this.a < 1) {
|
|
5075
|
-
const aHex = round
|
|
5075
|
+
const aHex = round(this.a * 255).toString(16);
|
|
5076
5076
|
hex2 += aHex.length === 2 ? aHex : "0" + aHex;
|
|
5077
5077
|
}
|
|
5078
5078
|
return hex2;
|
|
@@ -5089,8 +5089,8 @@ class FastColor {
|
|
|
5089
5089
|
/** CSS support color pattern */
|
|
5090
5090
|
toHslString() {
|
|
5091
5091
|
const h = this.getHue();
|
|
5092
|
-
const s2 = round
|
|
5093
|
-
const l2 = round
|
|
5092
|
+
const s2 = round(this.getSaturation() * 100);
|
|
5093
|
+
const l2 = round(this.getLightness() * 100);
|
|
5094
5094
|
return this.a !== 1 ? `hsla(${h},${s2}%,${l2}%,${this.a})` : `hsl(${h},${s2}%,${l2}%)`;
|
|
5095
5095
|
}
|
|
5096
5096
|
/** Same as toHsb */
|
|
@@ -5166,7 +5166,7 @@ class FastColor {
|
|
|
5166
5166
|
this._l = l2;
|
|
5167
5167
|
this.a = typeof a === "number" ? a : 1;
|
|
5168
5168
|
if (s2 <= 0) {
|
|
5169
|
-
const rgb = round
|
|
5169
|
+
const rgb = round(l2 * 255);
|
|
5170
5170
|
this.r = rgb;
|
|
5171
5171
|
this.g = rgb;
|
|
5172
5172
|
this.b = rgb;
|
|
@@ -5195,9 +5195,9 @@ class FastColor {
|
|
|
5195
5195
|
b2 = secondComponent;
|
|
5196
5196
|
}
|
|
5197
5197
|
const lightnessModification = l2 - chroma / 2;
|
|
5198
|
-
this.r = round
|
|
5199
|
-
this.g = round
|
|
5200
|
-
this.b = round
|
|
5198
|
+
this.r = round((r2 + lightnessModification) * 255);
|
|
5199
|
+
this.g = round((g2 + lightnessModification) * 255);
|
|
5200
|
+
this.b = round((b2 + lightnessModification) * 255);
|
|
5201
5201
|
}
|
|
5202
5202
|
fromHsv({
|
|
5203
5203
|
h,
|
|
@@ -5209,7 +5209,7 @@ class FastColor {
|
|
|
5209
5209
|
this._s = s2;
|
|
5210
5210
|
this._v = v2;
|
|
5211
5211
|
this.a = typeof a === "number" ? a : 1;
|
|
5212
|
-
const vv = round
|
|
5212
|
+
const vv = round(v2 * 255);
|
|
5213
5213
|
this.r = vv;
|
|
5214
5214
|
this.g = vv;
|
|
5215
5215
|
this.b = vv;
|
|
@@ -5219,9 +5219,9 @@ class FastColor {
|
|
|
5219
5219
|
const hh = h / 60;
|
|
5220
5220
|
const i = Math.floor(hh);
|
|
5221
5221
|
const ff = hh - i;
|
|
5222
|
-
const p2 = round
|
|
5223
|
-
const q2 = round
|
|
5224
|
-
const t2 = round
|
|
5222
|
+
const p2 = round(v2 * (1 - s2) * 255);
|
|
5223
|
+
const q2 = round(v2 * (1 - s2 * ff) * 255);
|
|
5224
|
+
const t2 = round(v2 * (1 - s2 * (1 - ff)) * 255);
|
|
5225
5225
|
switch (i) {
|
|
5226
5226
|
case 0:
|
|
5227
5227
|
this.g = t2;
|
|
@@ -5271,7 +5271,7 @@ class FastColor {
|
|
|
5271
5271
|
fromRgbString(trimStr) {
|
|
5272
5272
|
const cells = splitColorStr(trimStr, (num, txt) => (
|
|
5273
5273
|
// Convert percentage to number. e.g. 50% -> 128
|
|
5274
|
-
txt.includes("%") ? round
|
|
5274
|
+
txt.includes("%") ? round(num / 100 * 255) : num
|
|
5275
5275
|
));
|
|
5276
5276
|
this.r = cells[0];
|
|
5277
5277
|
this.g = cells[1];
|
|
@@ -60950,6 +60950,7 @@ const isAboutTab = (tab) => {
|
|
|
60950
60950
|
const label = String((tab == null ? void 0 : tab.label) || (tab == null ? void 0 : tab.name) || "").toLowerCase();
|
|
60951
60951
|
return name2 === "about" || label === "about";
|
|
60952
60952
|
};
|
|
60953
|
+
const tabHasRenderableContent = (tab) => isAboutTab(tab) || Array.isArray(tab == null ? void 0 : tab.inputs) && tab.inputs.length > 0;
|
|
60953
60954
|
const tabContainsProperty = (tab, property) => {
|
|
60954
60955
|
var _a2;
|
|
60955
60956
|
return (_a2 = tab == null ? void 0 : tab.inputs) == null ? void 0 : _a2.some((input) => (input == null ? void 0 : input.name) === property || (input == null ? void 0 : input.id) === property);
|
|
@@ -124132,10 +124133,12 @@ const useEntityScrollRestoration = ({
|
|
|
124132
124133
|
state,
|
|
124133
124134
|
isAiScrollRestoreSuppressed,
|
|
124134
124135
|
captureViewContext,
|
|
124136
|
+
disabled: disabled2 = false,
|
|
124135
124137
|
debugScroll = () => void 0
|
|
124136
124138
|
}) => {
|
|
124137
124139
|
useEffect(() => {
|
|
124138
124140
|
var _a2, _b, _c, _d;
|
|
124141
|
+
if (disabled2) return;
|
|
124139
124142
|
if (!navigationRestoreReadyRef.current) return;
|
|
124140
124143
|
if (!(contextEntity == null ? void 0 : contextEntity["@id"])) return;
|
|
124141
124144
|
if (((_a2 = pendingAddedPropertyRef.current) == null ? void 0 : _a2.entityId) === contextEntity["@id"]) return;
|
|
@@ -124220,9 +124223,10 @@ const useEntityScrollRestoration = ({
|
|
|
124220
124223
|
window.cancelAnimationFrame(rafId);
|
|
124221
124224
|
window.clearTimeout(timerId);
|
|
124222
124225
|
};
|
|
124223
|
-
}, [activeTab, contextEntity == null ? void 0 : contextEntity["@id"], renderTabs, tabsLength, scrollRestoreNonce]);
|
|
124226
|
+
}, [activeTab, contextEntity == null ? void 0 : contextEntity["@id"], renderTabs, tabsLength, scrollRestoreNonce, disabled2]);
|
|
124224
124227
|
useEffect(() => {
|
|
124225
124228
|
var _a2;
|
|
124229
|
+
if (disabled2) return;
|
|
124226
124230
|
const pendingTab = pendingRestoredTabRef.current;
|
|
124227
124231
|
if (!(contextEntity == null ? void 0 : contextEntity["@id"])) return;
|
|
124228
124232
|
if (((_a2 = pendingAddedPropertyRef.current) == null ? void 0 : _a2.entityId) === contextEntity["@id"]) return;
|
|
@@ -124251,9 +124255,11 @@ const useEntityScrollRestoration = ({
|
|
|
124251
124255
|
highlightRequiredProperties,
|
|
124252
124256
|
iconView,
|
|
124253
124257
|
tabPaneWidth,
|
|
124254
|
-
contextEntity == null ? void 0 : contextEntity["@id"]
|
|
124258
|
+
contextEntity == null ? void 0 : contextEntity["@id"],
|
|
124259
|
+
disabled2
|
|
124255
124260
|
]);
|
|
124256
124261
|
useEffect(() => {
|
|
124262
|
+
if (disabled2) return;
|
|
124257
124263
|
const pendingAddedProperty = pendingAddedPropertyRef.current;
|
|
124258
124264
|
if (!pendingAddedProperty || pendingAddedProperty.entityId !== (contextEntity == null ? void 0 : contextEntity["@id"])) return;
|
|
124259
124265
|
if (pendingAddedProperty.tabName && pendingAddedProperty.tabName !== activeTab) return;
|
|
@@ -124323,7 +124329,7 @@ const useEntityScrollRestoration = ({
|
|
|
124323
124329
|
window.cancelAnimationFrame(rafId);
|
|
124324
124330
|
window.clearTimeout(timerId);
|
|
124325
124331
|
};
|
|
124326
|
-
}, [activeTab, contextEntity == null ? void 0 : contextEntity["@id"], tabsLength, extraPropertiesLength]);
|
|
124332
|
+
}, [activeTab, contextEntity == null ? void 0 : contextEntity["@id"], tabsLength, extraPropertiesLength, disabled2]);
|
|
124327
124333
|
};
|
|
124328
124334
|
const CORE_AI_REVIEW_PROPERTY_ORDER = ["@id", "@type", "name"];
|
|
124329
124335
|
const getFieldNames = (field) => {
|
|
@@ -124993,7 +124999,7 @@ const hasFieldValue = (value) => {
|
|
|
124993
124999
|
return true;
|
|
124994
125000
|
};
|
|
124995
125001
|
const RenderEntity = forwardRef((props, ref) => {
|
|
124996
|
-
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k;
|
|
125002
|
+
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l;
|
|
124997
125003
|
const {
|
|
124998
125004
|
entity,
|
|
124999
125005
|
onLoadEntity,
|
|
@@ -125049,6 +125055,8 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
125049
125055
|
}, []);
|
|
125050
125056
|
const [tabPaneWidth, setTabPaneWidth] = useState(initialTabPaneWidth);
|
|
125051
125057
|
const labelTabPaneWidthRef = useRef(initialTabPaneWidth);
|
|
125058
|
+
const readonly = Boolean((_c = state.configuration) == null ? void 0 : _c.readonly);
|
|
125059
|
+
const previousReadonlyRef = useRef(readonly);
|
|
125052
125060
|
const persistTabWidth = useMemo$1(() => debounce((w2) => {
|
|
125053
125061
|
if (iconView) return;
|
|
125054
125062
|
const clamped = clampLabelTabPaneWidth(w2);
|
|
@@ -125133,6 +125141,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
125133
125141
|
state,
|
|
125134
125142
|
isAiScrollRestoreSuppressed,
|
|
125135
125143
|
captureViewContext,
|
|
125144
|
+
disabled: readonly,
|
|
125136
125145
|
debugScroll
|
|
125137
125146
|
});
|
|
125138
125147
|
const pendingAiApprovalRecords = useMemo$1(() => getPendingEntityApprovalRecords(approvalContext == null ? void 0 : approvalContext.roCrateApproval, contextEntity == null ? void 0 : contextEntity["@id"]), [approvalContext == null ? void 0 : approvalContext.roCrateApproval, contextEntity == null ? void 0 : contextEntity["@id"]]);
|
|
@@ -125313,10 +125322,11 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
125313
125322
|
setTabs(layout.tabs);
|
|
125314
125323
|
const navState = isCurrentHistoryEntity ? latestEntry == null ? void 0 : latestEntry.navigationState : state.editorState.getNavigationState(entity2["@id"]);
|
|
125315
125324
|
const tabNames = layout.tabs.map((tab) => tab.name);
|
|
125316
|
-
const
|
|
125317
|
-
const
|
|
125325
|
+
const restorableTabNames = readonly ? tabNames : layout.tabs.filter(tabHasRenderableContent).map((tab) => tab.name);
|
|
125326
|
+
const fallbackTab = restorableTabNames.includes("about") ? "about" : restorableTabNames[0] ?? tabNames[0] ?? "about";
|
|
125327
|
+
const currentTabStillValid = layout.renderTabs && (contextEntity == null ? void 0 : contextEntity["@id"]) === entity2["@id"] && restorableTabNames.includes(activeTab);
|
|
125318
125328
|
const savedActiveTab = (navState == null ? void 0 : navState.activeTab) ?? (isCurrentHistoryEntity ? latestEntry == null ? void 0 : latestEntry.tab : void 0);
|
|
125319
|
-
const savedTabStillValid = layout.renderTabs && typeof savedActiveTab === "string" &&
|
|
125329
|
+
const savedTabStillValid = layout.renderTabs && typeof savedActiveTab === "string" && restorableTabNames.includes(savedActiveTab);
|
|
125320
125330
|
const restoredTab = savedTabStillValid ? savedActiveTab : currentTabStillValid ? activeTab : fallbackTab;
|
|
125321
125331
|
const pendingAddedProfileSelection = pendingAddedProfileSelectionRef.current;
|
|
125322
125332
|
const pendingAddedProfileTabKeys = Array.isArray((_a3 = navState == null ? void 0 : navState.uiState) == null ? void 0 : _a3.pendingAddedProfileTabKeys) ? navState.uiState.pendingAddedProfileTabKeys : readPendingAddedProfileTabKeys(entity2["@id"]);
|
|
@@ -125371,6 +125381,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
125371
125381
|
isCurrentHistoryEntity,
|
|
125372
125382
|
renderTabs: layout.renderTabs,
|
|
125373
125383
|
tabNames,
|
|
125384
|
+
restorableTabNames,
|
|
125374
125385
|
savedActiveTab,
|
|
125375
125386
|
savedTabStillValid,
|
|
125376
125387
|
currentTabStillValid,
|
|
@@ -125415,6 +125426,13 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
125415
125426
|
if (!entityObj) return;
|
|
125416
125427
|
init2({ entity: entityObj });
|
|
125417
125428
|
};
|
|
125429
|
+
useEffect(() => {
|
|
125430
|
+
const wasReadonly = previousReadonlyRef.current;
|
|
125431
|
+
previousReadonlyRef.current = readonly;
|
|
125432
|
+
if (wasReadonly && !readonly && (entity == null ? void 0 : entity["@id"])) {
|
|
125433
|
+
refresh();
|
|
125434
|
+
}
|
|
125435
|
+
}, [readonly, entity == null ? void 0 : entity["@id"]]);
|
|
125418
125436
|
const handleLoadEntityWithContext = (params) => {
|
|
125419
125437
|
debugScroll("navigate", {
|
|
125420
125438
|
fromEntityId: contextEntity == null ? void 0 : contextEntity["@id"],
|
|
@@ -125817,7 +125835,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
125817
125835
|
pendingDeletedEntityReviewProperties,
|
|
125818
125836
|
displayedAiReviewPropertyOrder,
|
|
125819
125837
|
profileManager == null ? void 0 : profileManager.$key,
|
|
125820
|
-
(
|
|
125838
|
+
(_d = profileManager == null ? void 0 : profileManager.profile) == null ? void 0 : _d.layouts,
|
|
125821
125839
|
tabs.length
|
|
125822
125840
|
]);
|
|
125823
125841
|
useEffect(() => {
|
|
@@ -126343,13 +126361,13 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
126343
126361
|
}
|
|
126344
126362
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row", children: [
|
|
126345
126363
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col w-full", children: [
|
|
126346
|
-
((
|
|
126364
|
+
((_e2 = state.configuration) == null ? void 0 : _e2.showControls) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
126347
126365
|
EntityEditorToolbar,
|
|
126348
126366
|
{
|
|
126349
126367
|
entity: contextEntity,
|
|
126350
126368
|
quickSettingsVisible,
|
|
126351
126369
|
reverseSidebarVisible,
|
|
126352
|
-
enableReverseLinkBrowser: (
|
|
126370
|
+
enableReverseLinkBrowser: (_f = state.configuration) == null ? void 0 : _f.enableReverseLinkBrowser,
|
|
126353
126371
|
onLoadEntity: handleLoadEntityWithContext,
|
|
126354
126372
|
onBack: () => {
|
|
126355
126373
|
captureCurrentViewContext(activeTab);
|
|
@@ -126375,7 +126393,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
126375
126393
|
activePropertyLabel: selectedAiApprovalProperty ? getFieldTitle(selectedAiApprovalProperty) : void 0,
|
|
126376
126394
|
remainingEntityCount: pendingOtherAiApprovalEntities.length,
|
|
126377
126395
|
remainingFieldCount: pendingOtherAiApprovalFieldCount,
|
|
126378
|
-
readonly: (
|
|
126396
|
+
readonly: (_g = state.configuration) == null ? void 0 : _g.readonly,
|
|
126379
126397
|
canGoPrevious: selectedAiApprovalIndex > 0,
|
|
126380
126398
|
canGoNext: selectedAiApprovalIndex < pendingAiApprovals.length - 1,
|
|
126381
126399
|
onPrevious: () => navigateToAiApproval(selectedAiApprovalIndex - 1),
|
|
@@ -126389,7 +126407,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
126389
126407
|
EntityEditorLayout,
|
|
126390
126408
|
{
|
|
126391
126409
|
renderTabs,
|
|
126392
|
-
tabLocation: (
|
|
126410
|
+
tabLocation: (_h = state.configuration) == null ? void 0 : _h.tabLocation,
|
|
126393
126411
|
iconView,
|
|
126394
126412
|
tabPaneWidth,
|
|
126395
126413
|
scrollViewportHeight,
|
|
@@ -126402,7 +126420,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
126402
126420
|
quickSettingsHeader: renderQuickSettingsHeader(),
|
|
126403
126421
|
untabbedContent: renderUntabbedEntityFields(),
|
|
126404
126422
|
untabbedTopContent: renderUntabbedEntityFields({ untabbedNameSavedClassName: "bg-green-200 rounded p-1 my-1" }),
|
|
126405
|
-
tabbedRequiredWarning: !((
|
|
126423
|
+
tabbedRequiredWarning: !((_i = state.configuration) == null ? void 0 : _i.readonly) && ((_j = tabs.find((t22) => t22.name === activeTab)) == null ? void 0 : _j.missingRequiredData) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
126406
126424
|
FloatingRequiredPropertiesWarning,
|
|
126407
126425
|
{
|
|
126408
126426
|
onClick: () => setHighlightRequiredProperties(!highlightRequiredProperties)
|
|
@@ -126410,7 +126428,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
126410
126428
|
),
|
|
126411
126429
|
tabbedAboutContent: activeTab === "about" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: showFieldHelp ? "space-y-3" : "space-y-1", children: [
|
|
126412
126430
|
renderCoreEntityFields("tabbed"),
|
|
126413
|
-
renderEntityPropertyFields(((
|
|
126431
|
+
renderEntityPropertyFields(((_k = tabsWithAiReviewProperties.find((tab) => tab.name === "about")) == null ? void 0 : _k.inputs) ?? [], "tabbed")
|
|
126414
126432
|
] }),
|
|
126415
126433
|
tabbedOtherTabsContent: tabsWithAiReviewProperties.map((tab) => {
|
|
126416
126434
|
if (tab.name === activeTab && tab.name !== "about") {
|
|
@@ -126431,7 +126449,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
126431
126449
|
onClose: handleCloseContextReviewDialog,
|
|
126432
126450
|
onUpdateContext: handleUpdateContext,
|
|
126433
126451
|
approvalRecord: currentContextApprovalItem == null ? void 0 : currentContextApprovalItem.approvalRecord,
|
|
126434
|
-
readonly: (
|
|
126452
|
+
readonly: (_l = state.configuration) == null ? void 0 : _l.readonly,
|
|
126435
126453
|
onAcceptAiContext: handleAcceptAiContext,
|
|
126436
126454
|
onRejectAiContext: handleRejectAiContext
|
|
126437
126455
|
}
|
|
@@ -126495,75 +126513,6 @@ function requireIsEmpty() {
|
|
|
126495
126513
|
}
|
|
126496
126514
|
var isEmptyExports = requireIsEmpty();
|
|
126497
126515
|
const isEmpty = /* @__PURE__ */ getDefaultExportFromCjs(isEmptyExports);
|
|
126498
|
-
var toFinite_1;
|
|
126499
|
-
var hasRequiredToFinite;
|
|
126500
|
-
function requireToFinite() {
|
|
126501
|
-
if (hasRequiredToFinite) return toFinite_1;
|
|
126502
|
-
hasRequiredToFinite = 1;
|
|
126503
|
-
var toNumber = requireToNumber();
|
|
126504
|
-
var INFINITY = 1 / 0, MAX_INTEGER = 17976931348623157e292;
|
|
126505
|
-
function toFinite(value) {
|
|
126506
|
-
if (!value) {
|
|
126507
|
-
return value === 0 ? value : 0;
|
|
126508
|
-
}
|
|
126509
|
-
value = toNumber(value);
|
|
126510
|
-
if (value === INFINITY || value === -INFINITY) {
|
|
126511
|
-
var sign = value < 0 ? -1 : 1;
|
|
126512
|
-
return sign * MAX_INTEGER;
|
|
126513
|
-
}
|
|
126514
|
-
return value === value ? value : 0;
|
|
126515
|
-
}
|
|
126516
|
-
toFinite_1 = toFinite;
|
|
126517
|
-
return toFinite_1;
|
|
126518
|
-
}
|
|
126519
|
-
var toInteger_1;
|
|
126520
|
-
var hasRequiredToInteger;
|
|
126521
|
-
function requireToInteger() {
|
|
126522
|
-
if (hasRequiredToInteger) return toInteger_1;
|
|
126523
|
-
hasRequiredToInteger = 1;
|
|
126524
|
-
var toFinite = requireToFinite();
|
|
126525
|
-
function toInteger(value) {
|
|
126526
|
-
var result = toFinite(value), remainder = result % 1;
|
|
126527
|
-
return result === result ? remainder ? result - remainder : result : 0;
|
|
126528
|
-
}
|
|
126529
|
-
toInteger_1 = toInteger;
|
|
126530
|
-
return toInteger_1;
|
|
126531
|
-
}
|
|
126532
|
-
var _createRound;
|
|
126533
|
-
var hasRequired_createRound;
|
|
126534
|
-
function require_createRound() {
|
|
126535
|
-
if (hasRequired_createRound) return _createRound;
|
|
126536
|
-
hasRequired_createRound = 1;
|
|
126537
|
-
var root = require_root(), toInteger = requireToInteger(), toNumber = requireToNumber(), toString2 = requireToString$1();
|
|
126538
|
-
var nativeIsFinite = root.isFinite, nativeMin = Math.min;
|
|
126539
|
-
function createRound(methodName) {
|
|
126540
|
-
var func = Math[methodName];
|
|
126541
|
-
return function(number4, precision) {
|
|
126542
|
-
number4 = toNumber(number4);
|
|
126543
|
-
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
|
126544
|
-
if (precision && nativeIsFinite(number4)) {
|
|
126545
|
-
var pair2 = (toString2(number4) + "e").split("e"), value = func(pair2[0] + "e" + (+pair2[1] + precision));
|
|
126546
|
-
pair2 = (toString2(value) + "e").split("e");
|
|
126547
|
-
return +(pair2[0] + "e" + (+pair2[1] - precision));
|
|
126548
|
-
}
|
|
126549
|
-
return func(number4);
|
|
126550
|
-
};
|
|
126551
|
-
}
|
|
126552
|
-
_createRound = createRound;
|
|
126553
|
-
return _createRound;
|
|
126554
|
-
}
|
|
126555
|
-
var round_1;
|
|
126556
|
-
var hasRequiredRound;
|
|
126557
|
-
function requireRound() {
|
|
126558
|
-
if (hasRequiredRound) return round_1;
|
|
126559
|
-
hasRequiredRound = 1;
|
|
126560
|
-
var createRound = require_createRound();
|
|
126561
|
-
var round2 = createRound("round");
|
|
126562
|
-
round_1 = round2;
|
|
126563
|
-
return round_1;
|
|
126564
|
-
}
|
|
126565
|
-
var roundExports = requireRound();
|
|
126566
|
-
const round = /* @__PURE__ */ getDefaultExportFromCjs(roundExports);
|
|
126567
126516
|
var uniq_1;
|
|
126568
126517
|
var hasRequiredUniq;
|
|
126569
126518
|
function requireUniq() {
|
|
@@ -126773,7 +126722,6 @@ class CrateManager {
|
|
|
126773
126722
|
messages: []
|
|
126774
126723
|
}
|
|
126775
126724
|
};
|
|
126776
|
-
const t0 = performance.now();
|
|
126777
126725
|
if (!crate["@context"]) {
|
|
126778
126726
|
this.__setError("init", `The crate file does not have a '@context'.`);
|
|
126779
126727
|
return;
|
|
@@ -126852,25 +126800,27 @@ class CrateManager {
|
|
|
126852
126800
|
);
|
|
126853
126801
|
}
|
|
126854
126802
|
}
|
|
126803
|
+
const reverseLinkIds = {};
|
|
126855
126804
|
for (let i = 0; i < this.graphLength; i++) {
|
|
126856
126805
|
const normalisedEntity = this.crate["@graph"][i];
|
|
126857
126806
|
if (!normalisedEntity) continue;
|
|
126858
126807
|
for (let property of Object.keys(normalisedEntity)) {
|
|
126859
126808
|
if (this.coreProperties.includes(property)) continue;
|
|
126860
126809
|
normalisedEntity[property].forEach((entry) => {
|
|
126810
|
+
var _a2, _b;
|
|
126861
126811
|
if (entry == null ? void 0 : entry["@id"])
|
|
126862
126812
|
entry["@id"] = idMap[entry["@id"]] ? idMap[entry["@id"]] : entry["@id"];
|
|
126863
126813
|
if ((entry == null ? void 0 : entry["@id"]) && this.reverse[entry["@id"]]) {
|
|
126864
126814
|
if (!this.reverse[entry["@id"]][property]) {
|
|
126865
126815
|
this.reverse[entry["@id"]][property] = [];
|
|
126866
126816
|
}
|
|
126867
|
-
|
|
126868
|
-
|
|
126869
|
-
)
|
|
126870
|
-
if (!links.includes(normalisedEntity["@id"])) {
|
|
126817
|
+
reverseLinkIds[_a2 = entry["@id"]] ?? (reverseLinkIds[_a2] = {});
|
|
126818
|
+
(_b = reverseLinkIds[entry["@id"]])[property] ?? (_b[property] = /* @__PURE__ */ new Set());
|
|
126819
|
+
if (!reverseLinkIds[entry["@id"]][property].has(normalisedEntity["@id"])) {
|
|
126871
126820
|
this.reverse[entry["@id"]][property].push({
|
|
126872
126821
|
"@id": normalisedEntity["@id"]
|
|
126873
126822
|
});
|
|
126823
|
+
reverseLinkIds[entry["@id"]][property].add(normalisedEntity["@id"]);
|
|
126874
126824
|
}
|
|
126875
126825
|
}
|
|
126876
126826
|
});
|
|
@@ -126884,8 +126834,6 @@ class CrateManager {
|
|
|
126884
126834
|
if (context) {
|
|
126885
126835
|
this.providedContext = structuredClone(this.__normaliseContext(context));
|
|
126886
126836
|
}
|
|
126887
|
-
const t1 = performance.now();
|
|
126888
|
-
console.debug(`Crate ingest and prep: ${round(t1 - t0, 1)}ms`);
|
|
126889
126837
|
}
|
|
126890
126838
|
/** Get the context
|
|
126891
126839
|
* @returns the crate context
|
|
@@ -127956,7 +127904,6 @@ class CrateManager {
|
|
|
127956
127904
|
|
|
127957
127905
|
*/
|
|
127958
127906
|
exportCrate() {
|
|
127959
|
-
const t0 = performance.now();
|
|
127960
127907
|
let entities = this.crate["@graph"].filter((e3) => {
|
|
127961
127908
|
return !isUndefined(e3);
|
|
127962
127909
|
}).map((e3) => {
|
|
@@ -127980,8 +127927,6 @@ class CrateManager {
|
|
|
127980
127927
|
"@context": context.length === 1 ? context[0] : context,
|
|
127981
127928
|
"@graph": entities
|
|
127982
127929
|
};
|
|
127983
|
-
const t1 = performance.now();
|
|
127984
|
-
console.debug(`Crate export: ${round(t1 - t0, 1)}ms`);
|
|
127985
127930
|
return crate;
|
|
127986
127931
|
}
|
|
127987
127932
|
/**
|
|
@@ -135232,7 +135177,7 @@ var EmotionCacheContext = /* @__PURE__ */ React.createContext(
|
|
|
135232
135177
|
}) : null
|
|
135233
135178
|
);
|
|
135234
135179
|
var CacheProvider = EmotionCacheContext.Provider;
|
|
135235
|
-
const version = "0.1.
|
|
135180
|
+
const version = "0.1.45-test";
|
|
135236
135181
|
const pkg = {
|
|
135237
135182
|
version
|
|
135238
135183
|
};
|
|
@@ -135439,7 +135384,6 @@ function RecrateCrateBuilderInner(props) {
|
|
|
135439
135384
|
resetTabOnEntityChange = false,
|
|
135440
135385
|
resetTabOnProfileChange = false,
|
|
135441
135386
|
quickSettingsVisible,
|
|
135442
|
-
stateScopeKey,
|
|
135443
135387
|
onReady,
|
|
135444
135388
|
onError,
|
|
135445
135389
|
onWarning,
|
|
@@ -135462,11 +135406,23 @@ function RecrateCrateBuilderInner(props) {
|
|
|
135462
135406
|
const renderEntityRef = useRef(null);
|
|
135463
135407
|
const lastHandledScrollRequestNonceRef = useRef(void 0);
|
|
135464
135408
|
const keys2 = useRef({ cm: 0, pm: 0, lookups: 0 });
|
|
135409
|
+
const cmRef = useRef(null);
|
|
135465
135410
|
const lastHandledEntityIdRef = useRef(void 0);
|
|
135411
|
+
const entityIdRef = useRef(entityId);
|
|
135412
|
+
const lastInitializedCrateRef = useRef(void 0);
|
|
135413
|
+
const lastInitializedProfileRef = useRef(void 0);
|
|
135414
|
+
const lastInitializedEntityTimestampsRef = useRef(void 0);
|
|
135415
|
+
const lastAppliedConfigurationRef = useRef(void 0);
|
|
135466
135416
|
const hasProfileActionHandler = Boolean(onAddNewProfileRequest || onRemoveProfile);
|
|
135467
135417
|
useEffect(() => {
|
|
135468
135418
|
setApprovalState(roCrateApproval);
|
|
135469
135419
|
}, [roCrateApproval]);
|
|
135420
|
+
useEffect(() => {
|
|
135421
|
+
cmRef.current = cm;
|
|
135422
|
+
}, [cm]);
|
|
135423
|
+
useEffect(() => {
|
|
135424
|
+
entityIdRef.current = entityId;
|
|
135425
|
+
}, [entityId]);
|
|
135470
135426
|
const markApprovalPropertyApproved = useCallback((params) => {
|
|
135471
135427
|
const { entityId: entityId2, propertyName: propertyName2, decision, value } = params;
|
|
135472
135428
|
if (!entityId2 || !propertyName2) return;
|
|
@@ -135617,6 +135573,14 @@ function RecrateCrateBuilderInner(props) {
|
|
|
135617
135573
|
lookup,
|
|
135618
135574
|
hasProfileActionHandler
|
|
135619
135575
|
]);
|
|
135576
|
+
const createProfileManager = useCallback((profileToUse) => {
|
|
135577
|
+
const profileClone = profileToUse ? JSON.parse(JSON.stringify(profileToUse)) : {};
|
|
135578
|
+
const nextPm = new ProfileManager({
|
|
135579
|
+
profile: profileClone
|
|
135580
|
+
});
|
|
135581
|
+
nextPm.$key = ++keys2.current.pm;
|
|
135582
|
+
return nextPm;
|
|
135583
|
+
}, []);
|
|
135620
135584
|
const init2 = useCallback(async () => {
|
|
135621
135585
|
var _a2, _b;
|
|
135622
135586
|
instance.changeLanguage(language2);
|
|
@@ -135626,6 +135590,29 @@ function RecrateCrateBuilderInner(props) {
|
|
|
135626
135590
|
setError(false);
|
|
135627
135591
|
return;
|
|
135628
135592
|
}
|
|
135593
|
+
const currentCm = cmRef.current;
|
|
135594
|
+
const sameCrate = !!currentCm && lastInitializedCrateRef.current === crate;
|
|
135595
|
+
const sameEntityTimestampMode = lastInitializedEntityTimestampsRef.current === enableEntityTimestamps;
|
|
135596
|
+
if (sameCrate && sameEntityTimestampMode && lastInitializedProfileRef.current === profile) {
|
|
135597
|
+
if (lastAppliedConfigurationRef.current !== configuration) {
|
|
135598
|
+
state.setConfiguration(configuration);
|
|
135599
|
+
lastAppliedConfigurationRef.current = configuration;
|
|
135600
|
+
}
|
|
135601
|
+
setReady(true);
|
|
135602
|
+
return;
|
|
135603
|
+
}
|
|
135604
|
+
if (sameCrate && sameEntityTimestampMode) {
|
|
135605
|
+
const nextPm = createProfileManager(profile);
|
|
135606
|
+
currentCm.setProfileManager(nextPm);
|
|
135607
|
+
if (nextPm.context) currentCm.setContext(nextPm.context);
|
|
135608
|
+
setPm(nextPm);
|
|
135609
|
+
state.setConfiguration(configuration);
|
|
135610
|
+
lastInitializedProfileRef.current = profile;
|
|
135611
|
+
lastAppliedConfigurationRef.current = configuration;
|
|
135612
|
+
setReady(true);
|
|
135613
|
+
onReady == null ? void 0 : onReady();
|
|
135614
|
+
return;
|
|
135615
|
+
}
|
|
135629
135616
|
const serialisedContext = JSON.stringify(crate["@context"] ?? "");
|
|
135630
135617
|
schemaRegistry.setActiveSpecification(
|
|
135631
135618
|
serialisedContext.includes("/ro/crate/1.1/") ? "1.1" : "1.2"
|
|
@@ -135634,11 +135621,7 @@ function RecrateCrateBuilderInner(props) {
|
|
|
135634
135621
|
crate,
|
|
135635
135622
|
entityTimestamps: enableEntityTimestamps
|
|
135636
135623
|
});
|
|
135637
|
-
const
|
|
135638
|
-
const newPm = new ProfileManager({
|
|
135639
|
-
profile: profileClone
|
|
135640
|
-
});
|
|
135641
|
-
newPm.$key = ++keys2.current.pm;
|
|
135624
|
+
const newPm = createProfileManager(profile);
|
|
135642
135625
|
newCm.setProfileManager(newPm);
|
|
135643
135626
|
if (newPm.context) newCm.setContext(newPm.context);
|
|
135644
135627
|
if (lookup) {
|
|
@@ -135658,6 +135641,10 @@ function RecrateCrateBuilderInner(props) {
|
|
|
135658
135641
|
setCm(newCm);
|
|
135659
135642
|
setPm(newPm);
|
|
135660
135643
|
setError(false);
|
|
135644
|
+
lastInitializedCrateRef.current = crate;
|
|
135645
|
+
lastInitializedProfileRef.current = profile;
|
|
135646
|
+
lastInitializedEntityTimestampsRef.current = enableEntityTimestamps;
|
|
135647
|
+
lastAppliedConfigurationRef.current = configuration;
|
|
135661
135648
|
state.setConfiguration(configuration);
|
|
135662
135649
|
try {
|
|
135663
135650
|
const graph = Array.isArray(crate == null ? void 0 : crate["@graph"]) ? crate["@graph"] : [];
|
|
@@ -135665,7 +135652,7 @@ function RecrateCrateBuilderInner(props) {
|
|
|
135665
135652
|
graph.filter((entry) => entry && typeof entry === "object" && typeof entry["@id"] === "string").map((entry) => String(entry["@id"]))
|
|
135666
135653
|
);
|
|
135667
135654
|
state.editorState.prune(validIds);
|
|
135668
|
-
const candidateIds = [(_a2 = state.editorState.latest()) == null ? void 0 : _a2.id,
|
|
135655
|
+
const candidateIds = [(_a2 = state.editorState.latest()) == null ? void 0 : _a2.id, entityIdRef.current, "./"];
|
|
135669
135656
|
let nextEntity = null;
|
|
135670
135657
|
for (const candidateId of candidateIds) {
|
|
135671
135658
|
if (!candidateId) continue;
|
|
@@ -135689,7 +135676,7 @@ function RecrateCrateBuilderInner(props) {
|
|
|
135689
135676
|
setError(true);
|
|
135690
135677
|
onError == null ? void 0 : onError({ error: "Failed to initialize entity" });
|
|
135691
135678
|
}
|
|
135692
|
-
}, [crate, profile,
|
|
135679
|
+
}, [crate, profile, lookup, configuration, createProfileManager, enableEntityTimestamps, language2, onError, onReady, state.editorState]);
|
|
135693
135680
|
const handleSetCurrentEntity = useCallback((params) => {
|
|
135694
135681
|
const { id: id2, updateState = true } = params;
|
|
135695
135682
|
if (!id2 || !cm) return;
|
|
@@ -135748,7 +135735,10 @@ function RecrateCrateBuilderInner(props) {
|
|
|
135748
135735
|
lastHandledEntityIdRef.current = void 0;
|
|
135749
135736
|
return;
|
|
135750
135737
|
}
|
|
135751
|
-
if (
|
|
135738
|
+
if (!cm) {
|
|
135739
|
+
return;
|
|
135740
|
+
}
|
|
135741
|
+
if (lastHandledEntityIdRef.current === entityId && entityId === (contextEntity == null ? void 0 : contextEntity["@id"])) {
|
|
135752
135742
|
return;
|
|
135753
135743
|
}
|
|
135754
135744
|
lastHandledEntityIdRef.current = entityId;
|
|
@@ -135756,7 +135746,7 @@ function RecrateCrateBuilderInner(props) {
|
|
|
135756
135746
|
const shouldPushToHistory = ((_a2 = state.editorState.latest()) == null ? void 0 : _a2.id) !== entityId;
|
|
135757
135747
|
handleSetCurrentEntity({ id: entityId, updateState: shouldPushToHistory });
|
|
135758
135748
|
}
|
|
135759
|
-
}, [entityId, contextEntity, handleSetCurrentEntity, state.editorState]);
|
|
135749
|
+
}, [cm, entityId, contextEntity, handleSetCurrentEntity, state.editorState]);
|
|
135760
135750
|
useEffect(() => {
|
|
135761
135751
|
const request = scrollToFieldRequest;
|
|
135762
135752
|
if (!(request == null ? void 0 : request.entityId) || !request.fieldName || !ready) {
|