@arpproject/recrate 0.1.10 → 0.1.11
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.
|
@@ -10,6 +10,7 @@ interface RenderEntityProps {
|
|
|
10
10
|
onWarning: () => void;
|
|
11
11
|
onError: () => void;
|
|
12
12
|
onAddNewProfileRequest?: (requested: boolean) => void;
|
|
13
|
+
onRemoveProfile?: (data: any) => void;
|
|
13
14
|
}
|
|
14
15
|
declare const RenderEntity: React.ForwardRefExoticComponent<RenderEntityProps & React.RefAttributes<any>>;
|
|
15
16
|
export default RenderEntity;
|
|
@@ -33,6 +33,7 @@ export interface DescriboCrateBuilderProps {
|
|
|
33
33
|
}) => void;
|
|
34
34
|
onSaveEntityTemplate?: (entity: any) => void;
|
|
35
35
|
onAddNewProfileRequest?: (requested: boolean) => void;
|
|
36
|
+
onRemoveProfile?: (payload: any) => void;
|
|
36
37
|
}
|
|
37
38
|
export declare const ProfileManagerContext: React.Context<any>;
|
|
38
39
|
export declare const CrateManagerContext: React.Context<any>;
|
package/dist/recrate.es.js
CHANGED
|
@@ -67061,6 +67061,7 @@ function validateId({ id: id2, type: type4 }) {
|
|
|
67061
67061
|
if (id2.match(/arcp:\/\/name,.*/)) return { isValid: true };
|
|
67062
67062
|
if (id2.match(/arcp:\/\/uuid,.*/)) return { isValid: true };
|
|
67063
67063
|
if (id2.match(/arcp:\/\/ni,sha-256;,.*/)) return { isValid: true };
|
|
67064
|
+
if (id2.match(/^file:\/\/.*/)) return { isValid: true };
|
|
67064
67065
|
try {
|
|
67065
67066
|
let result = validateIri(id2, IriValidationStrategy.Strict);
|
|
67066
67067
|
if (!result) {
|
|
@@ -109245,7 +109246,7 @@ function applyTabDataIndicators({
|
|
|
109245
109246
|
}
|
|
109246
109247
|
const RenderEntity = forwardRef((props, ref) => {
|
|
109247
109248
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
109248
|
-
const { entity, onLoadEntity, onSaveCrate, onSaveEntityTemplate, onWarning, onError, onAddNewProfileRequest } = props;
|
|
109249
|
+
const { entity, onLoadEntity, onSaveCrate, onSaveEntityTemplate, onWarning, onError, onAddNewProfileRequest, onRemoveProfile } = props;
|
|
109249
109250
|
const state = useStateStore();
|
|
109250
109251
|
const profileManager = useContext(ProfileManagerContext);
|
|
109251
109252
|
const crateManager = useContext(CrateManagerContext);
|
|
@@ -109332,6 +109333,24 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
109332
109333
|
onError();
|
|
109333
109334
|
}
|
|
109334
109335
|
};
|
|
109336
|
+
const handleRemoveProfile = (tab) => {
|
|
109337
|
+
try {
|
|
109338
|
+
onRemoveProfile == null ? void 0 : onRemoveProfile({
|
|
109339
|
+
entityId: entity["@id"],
|
|
109340
|
+
tab: {
|
|
109341
|
+
name: tab.name,
|
|
109342
|
+
label: tab.label || tab.name,
|
|
109343
|
+
hasData: tab.hasData,
|
|
109344
|
+
missingRequiredData: tab.missingRequiredData,
|
|
109345
|
+
description: tab.description,
|
|
109346
|
+
inputs: tab.inputs
|
|
109347
|
+
}
|
|
109348
|
+
});
|
|
109349
|
+
} catch (error2) {
|
|
109350
|
+
console.error(error2);
|
|
109351
|
+
onError();
|
|
109352
|
+
}
|
|
109353
|
+
};
|
|
109335
109354
|
const notifySave = (property) => {
|
|
109336
109355
|
setSavedProperty(property);
|
|
109337
109356
|
setTimeout(() => {
|
|
@@ -109606,12 +109625,24 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
109606
109625
|
items: [
|
|
109607
109626
|
...tabs.map((tab) => ({
|
|
109608
109627
|
key: tab.name,
|
|
109609
|
-
label: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col w-full", children: [
|
|
109610
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center justify-between w-full", children: [
|
|
109628
|
+
label: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col w-full group", children: [
|
|
109629
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center justify-between w-full relative", children: [
|
|
109611
109630
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-left text-base font-medium text-gray-700 describo-tab-label", children: tab.label || tab.name }),
|
|
109612
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ml-2", children: [
|
|
109631
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ml-2 flex items-center space-x-2", children: [
|
|
109613
109632
|
tab.missingRequiredData && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-red-600", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FontAwesomeIcon, { icon: faCircleXmark, size: "lg" }) }),
|
|
109614
|
-
tab.hasData && !tab.missingRequiredData && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-green-600", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FontAwesomeIcon, { icon: faCircleCheck, size: "lg" }) })
|
|
109633
|
+
tab.hasData && !tab.missingRequiredData && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-green-600", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FontAwesomeIcon, { icon: faCircleCheck, size: "lg" }) }),
|
|
109634
|
+
!(["about", "overflow", "other"].includes((tab.name || "").toLowerCase()) || ["about", "other"].includes((tab.label || tab.name || "").toLowerCase())) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109635
|
+
Button$1,
|
|
109636
|
+
{
|
|
109637
|
+
"aria-label": "Remove profile",
|
|
109638
|
+
type: "text",
|
|
109639
|
+
onClick: (e2) => {
|
|
109640
|
+
e2.stopPropagation();
|
|
109641
|
+
handleRemoveProfile(tab);
|
|
109642
|
+
},
|
|
109643
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$b, { style: { color: "oklch(57.7% 0.245 27.325)" } })
|
|
109644
|
+
}
|
|
109645
|
+
)
|
|
109615
109646
|
] })
|
|
109616
109647
|
] }),
|
|
109617
109648
|
tab.description && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-left text-gray-500 font-light text-xs describo-tab-description", children: tab.description })
|
|
@@ -110047,7 +110078,7 @@ class CrateManager {
|
|
|
110047
110078
|
entity: []
|
|
110048
110079
|
},
|
|
110049
110080
|
invalidIdentifier: {
|
|
110050
|
-
description: `The entity identifier (@id) is not valid
|
|
110081
|
+
description: `The entity identifier (@id) is not valid.`,
|
|
110051
110082
|
entity: []
|
|
110052
110083
|
},
|
|
110053
110084
|
clash: {
|
|
@@ -110081,7 +110112,10 @@ class CrateManager {
|
|
|
110081
110112
|
}
|
|
110082
110113
|
this.graphLength = crate["@graph"].length;
|
|
110083
110114
|
for (let i = 0; i < this.graphLength; i++) {
|
|
110084
|
-
|
|
110115
|
+
const eid = crate["@graph"][i]["@id"];
|
|
110116
|
+
const isRootDescriptor = eid === "ro-crate-metadata.json" || typeof eid === "string" && eid.match(/^file:\/\/\.\/ro-crate-metadata\.json$/) || typeof eid === "string" && eid.match(/^\.\/ro-crate-metadata\.json$/);
|
|
110117
|
+
if (isRootDescriptor) {
|
|
110118
|
+
crate["@graph"][i]["@id"] = "ro-crate-metadata.json";
|
|
110085
110119
|
this.rootDescriptor = i;
|
|
110086
110120
|
if ("about" in crate["@graph"][i]) {
|
|
110087
110121
|
if (Array.isArray(crate["@graph"][i].about)) {
|
|
@@ -118064,7 +118098,7 @@ var EmotionCacheContext = /* @__PURE__ */ React.createContext(
|
|
|
118064
118098
|
}) : null
|
|
118065
118099
|
);
|
|
118066
118100
|
var CacheProvider = EmotionCacheContext.Provider;
|
|
118067
|
-
const version = "0.1.
|
|
118101
|
+
const version = "0.1.11";
|
|
118068
118102
|
const pkg = {
|
|
118069
118103
|
version
|
|
118070
118104
|
};
|
|
@@ -118099,7 +118133,8 @@ function DescriboCrateBuilder(props) {
|
|
|
118099
118133
|
onNavigation,
|
|
118100
118134
|
onSaveCrate,
|
|
118101
118135
|
onSaveEntityTemplate,
|
|
118102
|
-
onAddNewProfileRequest
|
|
118136
|
+
onAddNewProfileRequest,
|
|
118137
|
+
onRemoveProfile
|
|
118103
118138
|
} = props;
|
|
118104
118139
|
console.log("DescriboCrateBuilder props:", { crate, profile, entityId });
|
|
118105
118140
|
const [ready, setReady] = useState(false);
|
|
@@ -118293,7 +118328,8 @@ function DescriboCrateBuilder(props) {
|
|
|
118293
118328
|
onSaveEntityTemplate: saveEntityAsTemplate,
|
|
118294
118329
|
onWarning: handleWarning,
|
|
118295
118330
|
onError: handleError,
|
|
118296
|
-
onAddNewProfileRequest: handleAddProfileRequest
|
|
118331
|
+
onAddNewProfileRequest: handleAddProfileRequest,
|
|
118332
|
+
onRemoveProfile
|
|
118297
118333
|
}
|
|
118298
118334
|
) }) }) }) }) }) }),
|
|
118299
118335
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pointer-events-none fixed bottom-2 right-2 z-50 text-xs text-gray-400", children: [
|