@arpproject/recrate 0.1.33 → 0.1.35
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/README.md +80 -2
- package/dist/crate-builder/CrateManager/profile-manager.d.ts +1 -1
- package/dist/crate-builder/RenderEntity/CoreEntityFields.d.ts +26 -0
- package/dist/crate-builder/RenderEntity/EntityEditorLayout.d.ts +23 -0
- package/dist/crate-builder/RenderEntity/EntityEditorToolbar.d.ts +23 -0
- package/dist/crate-builder/RenderEntity/EntityPropertyField.d.ts +33 -0
- package/dist/crate-builder/RenderEntity/EntityPropertyFields.d.ts +20 -0
- package/dist/crate-builder/RenderEntity/PaginateLinkedEntities.d.ts +1 -0
- package/dist/crate-builder/RenderEntity/ProfileTabRail.d.ts +23 -0
- package/dist/crate-builder/RenderEntity/approval-utils.d.ts +7 -0
- package/dist/crate-builder/RenderEntity/profile-tabs.lib.d.ts +14 -0
- package/dist/crate-builder/RenderEntity/profile-tabs.lib.spec.d.ts +1 -0
- package/dist/crate-builder/RenderEntity/useEntityMutationHandlers.d.ts +51 -0
- package/dist/crate-builder/RenderEntity/useEntityMutationHandlers.spec.d.ts +1 -0
- package/dist/crate-builder/RenderEntity/useEntityNavigationState.d.ts +22 -0
- package/dist/crate-builder/RenderEntity/useEntityScrollRestoration.d.ts +31 -0
- package/dist/crate-builder/RenderEntity/useScrollViewportHeight.d.ts +13 -0
- package/dist/crate-builder/RenderEntity/useTabRailScrollState.d.ts +18 -0
- package/dist/crate-builder/Shell.d.ts +3 -3
- package/dist/crate-builder/editor-state.d.ts +3 -0
- package/dist/crate-builder/editor-state.spec.d.ts +1 -0
- package/dist/crate-builder/locales/en.d.ts +7 -0
- package/dist/crate-builder/locales/hu.d.ts +7 -0
- package/dist/index.d.ts +4 -4
- package/dist/recrate.css +2 -2
- package/dist/recrate.es.js +55663 -55045
- package/dist/types.d.ts +222 -12
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,58 +1,268 @@
|
|
|
1
1
|
export interface JSONObject {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Decision emitted when a user resolves AI-generated metadata approval records.
|
|
6
|
+
*/
|
|
7
|
+
export type RoCrateApprovalDecision = "accept" | "reject" | "manual-edit";
|
|
5
8
|
export interface EntityTemplatesParams {
|
|
6
9
|
type?: Array<any> | string;
|
|
7
10
|
queryString?: string;
|
|
8
11
|
limit?: number;
|
|
9
12
|
}
|
|
10
13
|
export interface Lookup {
|
|
14
|
+
/**
|
|
15
|
+
* Look up entity templates in the host application.
|
|
16
|
+
*
|
|
17
|
+
* The component passes the requested `@type`, the user's search string, and a
|
|
18
|
+
* result limit. Most host applications should search at least `@id` and
|
|
19
|
+
* `name`.
|
|
20
|
+
*/
|
|
11
21
|
entityTemplates(params: EntityTemplatesParams): Promise<void>;
|
|
12
22
|
}
|
|
13
|
-
export
|
|
23
|
+
export interface RoCrateApprovalSaveData {
|
|
24
|
+
/**
|
|
25
|
+
* Updated approval data after the decision has been applied.
|
|
26
|
+
*/
|
|
27
|
+
roCrateApproval: JSONObject | JSONObject[] | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Entity whose approval records were changed.
|
|
30
|
+
*/
|
|
31
|
+
entityId: string;
|
|
32
|
+
/**
|
|
33
|
+
* Property whose approval records were changed. Entity-level bulk decisions
|
|
34
|
+
* use `"*"`.
|
|
35
|
+
*/
|
|
36
|
+
propertyName: string;
|
|
37
|
+
/**
|
|
38
|
+
* User decision that caused the approval data update.
|
|
39
|
+
*/
|
|
40
|
+
decision: RoCrateApprovalDecision;
|
|
41
|
+
/**
|
|
42
|
+
* Approval records affected by the decision.
|
|
43
|
+
*/
|
|
44
|
+
approvalRecords: JSONObject[];
|
|
45
|
+
/**
|
|
46
|
+
* Optional edited value associated with a manual decision.
|
|
47
|
+
*/
|
|
48
|
+
value?: any;
|
|
49
|
+
}
|
|
50
|
+
export interface RemoveProfilePayload {
|
|
51
|
+
/**
|
|
52
|
+
* Entity currently being edited.
|
|
53
|
+
*/
|
|
54
|
+
entityId: string;
|
|
55
|
+
/**
|
|
56
|
+
* Profile tab selected for removal.
|
|
57
|
+
*/
|
|
58
|
+
tab: {
|
|
59
|
+
name?: string;
|
|
60
|
+
label?: string;
|
|
61
|
+
hasData?: boolean;
|
|
62
|
+
missingRequiredData?: boolean;
|
|
63
|
+
description?: string;
|
|
64
|
+
inputs?: JSONObject[];
|
|
65
|
+
profileUrl?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export type RecrateCrateBuilderProps = {
|
|
69
|
+
/**
|
|
70
|
+
* RO-Crate JSON to display and edit.
|
|
71
|
+
*/
|
|
14
72
|
crate?: JSONObject;
|
|
73
|
+
/**
|
|
74
|
+
* Optional AI metadata approval records, usually loaded from
|
|
75
|
+
* `ro-crate-approval.json`.
|
|
76
|
+
*
|
|
77
|
+
* Records may be supplied as an array, as `{ items: [...] }`, or as a single
|
|
78
|
+
* entity approval object with an `approval` array. Pending records drive the
|
|
79
|
+
* AI review banner, field-level diffs, edited-field badges, deleted entity
|
|
80
|
+
* review cards, and the AI-edited quick filter.
|
|
81
|
+
*/
|
|
15
82
|
roCrateApproval?: JSONObject | JSONObject[];
|
|
83
|
+
/**
|
|
84
|
+
* Profile to use when editing the crate.
|
|
85
|
+
*/
|
|
16
86
|
profile?: JSONObject;
|
|
87
|
+
/**
|
|
88
|
+
* Initially selected entity id.
|
|
89
|
+
*/
|
|
17
90
|
entityId?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Host-provided lookup callbacks for template and data-pack searches.
|
|
93
|
+
*/
|
|
18
94
|
lookup?: Lookup;
|
|
95
|
+
/**
|
|
96
|
+
* Enable context editor functionality. Only used at component initialization
|
|
97
|
+
* time.
|
|
98
|
+
*/
|
|
19
99
|
enableContextEditor?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Enable crate preview functionality. Only used at component initialization
|
|
102
|
+
* time.
|
|
103
|
+
*/
|
|
20
104
|
enableCratePreview?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Enable entity browser functionality. Only used at component initialization
|
|
107
|
+
* time.
|
|
108
|
+
*/
|
|
21
109
|
enableBrowseEntities?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Enable entity template save functionality. Only used at component
|
|
112
|
+
* initialization time.
|
|
113
|
+
*/
|
|
22
114
|
enableTemplateSave?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Enable bulk-add functionality. Only used at component initialization time.
|
|
117
|
+
*/
|
|
23
118
|
enableBulkAdd?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Show add/remove profile controls in the profile tab rail.
|
|
121
|
+
*
|
|
122
|
+
* When omitted, the component enables these controls automatically if
|
|
123
|
+
* `onAddNewProfileRequest` or `onRemoveProfile` is supplied.
|
|
124
|
+
*/
|
|
24
125
|
enableProfileActions?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* If true, the component does not allow edits and does not call save
|
|
128
|
+
* callbacks.
|
|
129
|
+
*/
|
|
25
130
|
readonly?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Enable the reverse link browser sidebar.
|
|
133
|
+
*/
|
|
26
134
|
enableReverseLinkBrowser?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether the component is hosted as a web component.
|
|
137
|
+
*/
|
|
138
|
+
webComponent?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Let the component manage browser history internally.
|
|
141
|
+
*/
|
|
27
142
|
enableInternalRouting?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Purge unlinked entities from the crate before emitting it for saving.
|
|
145
|
+
*/
|
|
28
146
|
purgeUnlinkedEntities?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Localization language. Supported values are `en` and `hu`; defaults to
|
|
149
|
+
* `en`.
|
|
150
|
+
*/
|
|
29
151
|
language?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Called when the component is ready.
|
|
154
|
+
*/
|
|
30
155
|
onReady?: () => void;
|
|
31
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Called when the component reports an error.
|
|
158
|
+
*/
|
|
159
|
+
onError?: (message: any) => void;
|
|
160
|
+
/**
|
|
161
|
+
* Called when the component reports a warning.
|
|
162
|
+
*/
|
|
163
|
+
onWarning?: (warnings: any) => void;
|
|
164
|
+
/**
|
|
165
|
+
* Called when the crate has changed.
|
|
166
|
+
*/
|
|
32
167
|
onSaveCrate?: (saveData: {
|
|
33
168
|
crate: JSONObject;
|
|
34
169
|
entityId?: string;
|
|
35
170
|
}) => void;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
171
|
+
/**
|
|
172
|
+
* Called when AI approval records change.
|
|
173
|
+
*
|
|
174
|
+
* Accepting a field marks its matching approval records as approved.
|
|
175
|
+
* Rejecting a field or choosing manual edit removes those pending approval
|
|
176
|
+
* records from the approval state. The host application is responsible for
|
|
177
|
+
* persisting the returned `roCrateApproval` payload.
|
|
178
|
+
*/
|
|
179
|
+
onSaveRoCrateApproval?: (saveData: RoCrateApprovalSaveData) => void;
|
|
180
|
+
/**
|
|
181
|
+
* Called when the crate is to be saved as a template.
|
|
182
|
+
*
|
|
183
|
+
* If implemented, also pass a `Lookup` object with `entityTemplates` so saved
|
|
184
|
+
* templates can be looked up and reused in the component.
|
|
185
|
+
*/
|
|
44
186
|
onSaveCrateAsTemplate?: (name: string, crate: JSONObject) => void;
|
|
187
|
+
/**
|
|
188
|
+
* Called when the entity is to be saved as a template.
|
|
189
|
+
*
|
|
190
|
+
* This is the current React component prop.
|
|
191
|
+
*/
|
|
192
|
+
onSaveEntityTemplate?: (entity: JSONObject) => void;
|
|
193
|
+
/**
|
|
194
|
+
* Legacy entity-template callback name kept for consumers that still import
|
|
195
|
+
* the public type.
|
|
196
|
+
*/
|
|
45
197
|
onSaveEntityAsTemplate?: (name: string, entity: JSONObject) => void;
|
|
198
|
+
/**
|
|
199
|
+
* Called when the quick filter/settings panel visibility changes.
|
|
200
|
+
*/
|
|
46
201
|
onQuickSettingsVisibleChange?: (visible: boolean) => void;
|
|
202
|
+
/**
|
|
203
|
+
* Called when the editor requests that the host add a profile to the current
|
|
204
|
+
* entity.
|
|
205
|
+
*
|
|
206
|
+
* The host should update `profile` and/or `crate` as needed; the component
|
|
207
|
+
* remembers existing profile tabs and selects the newly added tab after the
|
|
208
|
+
* update.
|
|
209
|
+
*/
|
|
210
|
+
onAddNewProfileRequest?: (requested: boolean) => void;
|
|
211
|
+
/**
|
|
212
|
+
* Called when the editor requests removal of a profile tab from the current
|
|
213
|
+
* entity.
|
|
214
|
+
*
|
|
215
|
+
* The payload includes the entity id and the tab metadata, including whether
|
|
216
|
+
* the tab currently has data or missing required fields.
|
|
217
|
+
*/
|
|
218
|
+
onRemoveProfile?: (payload: RemoveProfilePayload) => void;
|
|
219
|
+
/**
|
|
220
|
+
* Called when the crate builder navigates to a context entity.
|
|
221
|
+
*/
|
|
47
222
|
onNavigation?: (entity: {
|
|
48
223
|
"@id": string;
|
|
224
|
+
"@type"?: string[];
|
|
225
|
+
name?: string;
|
|
49
226
|
}) => void;
|
|
50
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Location of layout tabs.
|
|
229
|
+
*/
|
|
230
|
+
tabLocation?: "left" | "right" | "top" | "bottom";
|
|
231
|
+
/**
|
|
232
|
+
* Show or hide the main control bar.
|
|
233
|
+
*/
|
|
51
234
|
showControls?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* When the crate/entity is updated, stay on the selected tab instead of
|
|
237
|
+
* jumping back to About.
|
|
238
|
+
*/
|
|
52
239
|
resetTabOnEntityChange?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* When the profile is updated, stay on the selected tab instead of jumping
|
|
242
|
+
* back to About.
|
|
243
|
+
*/
|
|
53
244
|
resetTabOnProfileChange?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Optionally control quick filter/settings panel visibility from a custom
|
|
247
|
+
* header.
|
|
248
|
+
*
|
|
249
|
+
* When visible, the panel lets users toggle field help, filter fields by name
|
|
250
|
+
* or value, hide empty fields, and, when AI approval data exists, show only
|
|
251
|
+
* AI-edited fields.
|
|
252
|
+
*/
|
|
54
253
|
quickSettingsVisible?: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Optional scope identifier used to isolate editor state between multiple
|
|
256
|
+
* concurrent component instances.
|
|
257
|
+
*/
|
|
55
258
|
stateScopeKey?: string;
|
|
259
|
+
/**
|
|
260
|
+
* If true, text fields containing a URL are marked up with an entity link. If
|
|
261
|
+
* false, the URL is shown as plain text.
|
|
262
|
+
*/
|
|
56
263
|
enableUrlMarkup?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* If true, add timestamps reflecting the last time an entity was updated.
|
|
266
|
+
*/
|
|
57
267
|
enableEntityTimestamps?: boolean;
|
|
58
268
|
};
|