@_linked/shape-ui 2.0.0 → 2.2.0
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/lib/esm/columns.d.ts +58 -0
- package/lib/esm/columns.js +173 -0
- package/lib/esm/columns.js.map +1 -0
- package/lib/esm/components/AddInstanceForms.d.ts +38 -0
- package/lib/esm/components/AddInstanceForms.js +143 -0
- package/lib/esm/components/AddInstanceForms.js.map +1 -0
- package/lib/esm/components/AddInstanceForms.module.css +12 -0
- package/lib/esm/components/BatchEditDrawer.d.ts +13 -0
- package/lib/esm/components/BatchEditDrawer.js +122 -0
- package/lib/esm/components/BatchEditDrawer.js.map +1 -0
- package/lib/esm/components/BatchEditDrawer.module.css +193 -0
- package/lib/esm/components/CustomMultiSelect.d.ts +26 -0
- package/lib/esm/components/CustomMultiSelect.js +344 -0
- package/lib/esm/components/CustomMultiSelect.js.map +1 -0
- package/lib/esm/components/CustomMultiSelect.module.css +291 -0
- package/lib/esm/components/DynamicFormField.d.ts +21 -0
- package/lib/esm/components/DynamicFormField.js +149 -0
- package/lib/esm/components/DynamicFormField.js.map +1 -0
- package/lib/esm/components/DynamicFormField.module.css +169 -0
- package/lib/esm/components/EditInstanceForms.d.ts +15 -0
- package/lib/esm/components/EditInstanceForms.js +118 -0
- package/lib/esm/components/EditInstanceForms.js.map +1 -0
- package/lib/esm/components/FilterBadge.d.ts +20 -0
- package/lib/esm/components/FilterBadge.js +26 -0
- package/lib/esm/components/FilterBadge.js.map +1 -0
- package/lib/esm/components/FilterBadge.module.css +25 -0
- package/lib/esm/components/FormField.d.ts +18 -0
- package/lib/esm/components/FormField.js +9 -0
- package/lib/esm/components/FormField.js.map +1 -0
- package/lib/esm/components/FormField.module.css +57 -0
- package/lib/esm/components/InstanceDeletionDialog.d.ts +17 -0
- package/lib/esm/components/InstanceDeletionDialog.js +83 -0
- package/lib/esm/components/InstanceDeletionDialog.js.map +1 -0
- package/lib/esm/components/InstanceDeletionDialog.module.css +59 -0
- package/lib/esm/components/InstanceOverview.d.ts +37 -0
- package/lib/esm/components/InstanceOverview.js +233 -0
- package/lib/esm/components/InstanceOverview.js.map +1 -0
- package/lib/esm/components/InstanceOverview.module.css +35 -0
- package/lib/esm/components/InstanceView.d.ts +29 -0
- package/lib/esm/components/InstanceView.js +97 -0
- package/lib/esm/components/InstanceView.js.map +1 -0
- package/lib/esm/components/InstanceView.module.css +157 -0
- package/lib/esm/components/NodeBadge.d.ts +25 -0
- package/lib/esm/components/NodeBadge.js +29 -0
- package/lib/esm/components/NodeBadge.js.map +1 -0
- package/lib/esm/components/NodeValuesEditor.d.ts +15 -0
- package/lib/esm/components/NodeValuesEditor.js +29 -0
- package/lib/esm/components/NodeValuesEditor.js.map +1 -0
- package/lib/esm/components/NodeValuesEditor.module.css +4 -0
- package/lib/esm/components/ReactTable.d.ts +50 -0
- package/lib/esm/components/ReactTable.js +370 -0
- package/lib/esm/components/ReactTable.js.map +1 -0
- package/lib/esm/components/ReactTable.module.css +950 -0
- package/lib/esm/components/TextfieldEditor.d.ts +1 -2
- package/lib/esm/components/TextfieldEditor.js +2 -2
- package/lib/esm/components/TextfieldEditor.js.map +1 -1
- package/lib/esm/components/forms.module.css +96 -0
- package/lib/esm/host.d.ts +196 -0
- package/lib/esm/host.js +25 -0
- package/lib/esm/host.js.map +1 -0
- package/lib/esm/hostContext.d.ts +34 -0
- package/lib/esm/hostContext.js +95 -0
- package/lib/esm/hostContext.js.map +1 -0
- package/lib/esm/index.d.ts +64 -10
- package/lib/esm/index.js +63 -14
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/read.d.ts +48 -0
- package/lib/esm/read.js +96 -0
- package/lib/esm/read.js.map +1 -0
- package/lib/esm/search.d.ts +32 -0
- package/lib/esm/search.js +87 -0
- package/lib/esm/search.js.map +1 -0
- package/lib/esm/shape/contracts.d.ts +58 -0
- package/lib/esm/shape/contracts.js +15 -0
- package/lib/esm/shape/contracts.js.map +1 -0
- package/lib/esm/shape/naming.d.ts +30 -0
- package/lib/esm/shape/naming.js +52 -0
- package/lib/esm/shape/naming.js.map +1 -0
- package/lib/esm/shape/nodeDisplay.d.ts +36 -0
- package/lib/esm/shape/nodeDisplay.js +117 -0
- package/lib/esm/shape/nodeDisplay.js.map +1 -0
- package/lib/esm/shape/propertyTypes.d.ts +12 -0
- package/lib/esm/shape/propertyTypes.js +60 -0
- package/lib/esm/shape/propertyTypes.js.map +1 -0
- package/lib/esm/shape/propertyVisibility.d.ts +56 -0
- package/lib/esm/shape/propertyVisibility.js +112 -0
- package/lib/esm/shape/propertyVisibility.js.map +1 -0
- package/lib/esm/shape/shapeDependencies.d.ts +41 -0
- package/lib/esm/shape/shapeDependencies.js +141 -0
- package/lib/esm/shape/shapeDependencies.js.map +1 -0
- package/lib/esm/shape/tableFilters.d.ts +35 -0
- package/lib/esm/shape/tableFilters.js +171 -0
- package/lib/esm/shape/tableFilters.js.map +1 -0
- package/lib/esm/shape/useFormDependencies.d.ts +38 -0
- package/lib/esm/shape/useFormDependencies.js +178 -0
- package/lib/esm/shape/useFormDependencies.js.map +1 -0
- package/lib/esm/shape/validation.d.ts +15 -0
- package/lib/esm/shape/validation.js +106 -0
- package/lib/esm/shape/validation.js.map +1 -0
- package/lib/esm/tokens.css +25 -0
- package/lib/esm/types.d.ts +22 -0
- package/lib/esm/types.js +1 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/esm/write.d.ts +51 -0
- package/lib/esm/write.js +99 -0
- package/lib/esm/write.js.map +1 -0
- package/package.json +44 -18
- package/src/backend.ts +1 -0
- package/src/columns.regression.test.ts +143 -0
- package/src/columns.test.ts +200 -0
- package/src/columns.ts +228 -0
- package/src/components/AddInstanceForms.module.css +12 -0
- package/src/components/AddInstanceForms.tsx +321 -0
- package/src/components/AvatarEditor.tsx +34 -0
- package/src/components/BatchEditDrawer.module.css +193 -0
- package/src/components/BatchEditDrawer.tsx +295 -0
- package/src/components/CheckboxEditor.module.css +6 -0
- package/src/components/CheckboxEditor.tsx +86 -0
- package/src/components/CustomMultiSelect.module.css +291 -0
- package/src/components/CustomMultiSelect.tsx +527 -0
- package/src/components/DateEditor.tsx +50 -0
- package/src/components/DynamicFormField.module.css +169 -0
- package/src/components/DynamicFormField.tsx +357 -0
- package/src/components/EditInstanceForms.tsx +260 -0
- package/src/components/FilterBadge.module.css +25 -0
- package/src/components/FilterBadge.tsx +70 -0
- package/src/components/FormField.module.css +57 -0
- package/src/components/FormField.tsx +59 -0
- package/src/components/ImageValueEditor.module.css +3 -0
- package/src/components/ImageValueEditor.tsx +82 -0
- package/src/components/InstanceDeletionDialog.module.css +59 -0
- package/src/components/InstanceDeletionDialog.tsx +175 -0
- package/src/components/InstanceOverview.module.css +35 -0
- package/src/components/InstanceOverview.tsx +374 -0
- package/src/components/InstanceView.module.css +157 -0
- package/src/components/InstanceView.tsx +212 -0
- package/src/components/NodeBadge.tsx +60 -0
- package/src/components/NodeValuesEditor.module.css +4 -0
- package/src/components/NodeValuesEditor.tsx +64 -0
- package/src/components/RadioButtonEditor.module.css +22 -0
- package/src/components/RadioButtonEditor.tsx +96 -0
- package/src/components/ReactTable.module.css +950 -0
- package/src/components/ReactTable.tsx +991 -0
- package/src/components/SelectEditor.tsx +85 -0
- package/src/components/ShapeTable.module.css +394 -0
- package/src/components/SwitchEditor.tsx +60 -0
- package/src/components/TextareaEditor.tsx +55 -0
- package/src/components/TextfieldEditor.tsx +67 -0
- package/src/components/ToggleEditor.tsx +63 -0
- package/src/components/forms.module.css +96 -0
- package/src/host.ts +226 -0
- package/src/hostContext.tsx +114 -0
- package/src/index.ts +99 -0
- package/src/package.ts +21 -0
- package/src/read.ts +148 -0
- package/src/search.test.ts +174 -0
- package/src/search.ts +108 -0
- package/src/shape/contracts.ts +66 -0
- package/src/shape/naming.ts +52 -0
- package/src/shape/nodeDisplay.ts +114 -0
- package/src/shape/propertyTypes.ts +86 -0
- package/src/shape/propertyVisibility.ts +180 -0
- package/src/shape/shapeDependencies.ts +183 -0
- package/src/shape/tableFilters.ts +223 -0
- package/src/shape/types.ts +1158 -0
- package/src/shape/useFormDependencies.ts +257 -0
- package/src/shape/validation.ts +121 -0
- package/src/tokens.css +25 -0
- package/src/types.ts +20 -0
- package/src/utils/helper.ts +35 -0
- package/src/write.test.ts +174 -0
- package/src/write.ts +114 -0
- package/.changeset/README.md +0 -20
- package/.changeset/config.json +0 -14
- package/.github/workflows/changeset-check.yml +0 -44
- package/.github/workflows/ci.yml +0 -43
- package/.github/workflows/publish.yml +0 -158
- package/CHANGELOG.md +0 -30
- package/lib/esm/components/AvatarEditor.d.ts +0 -20
- package/lib/esm/components/AvatarEditor.js +0 -7
- package/lib/esm/components/AvatarEditor.js.map +0 -1
- package/lib/esm/components/CheckboxEditor.d.ts +0 -21
- package/lib/esm/components/CheckboxEditor.js +0 -44
- package/lib/esm/components/CheckboxEditor.js.map +0 -1
- package/lib/esm/components/DateEditor.d.ts +0 -20
- package/lib/esm/components/DateEditor.js +0 -22
- package/lib/esm/components/DateEditor.js.map +0 -1
- package/lib/esm/components/RadioButtonEditor.d.ts +0 -23
- package/lib/esm/components/RadioButtonEditor.js +0 -41
- package/lib/esm/components/RadioButtonEditor.js.map +0 -1
- package/lib/esm/components/SelectEditor.d.ts +0 -21
- package/lib/esm/components/SelectEditor.js +0 -30
- package/lib/esm/components/SelectEditor.js.map +0 -1
- package/lib/esm/components/SwitchEditor.d.ts +0 -21
- package/lib/esm/components/SwitchEditor.js +0 -23
- package/lib/esm/components/SwitchEditor.js.map +0 -1
- package/lib/esm/components/TextareaEditor.d.ts +0 -23
- package/lib/esm/components/TextareaEditor.js +0 -15
- package/lib/esm/components/TextareaEditor.js.map +0 -1
- package/lib/esm/components/ToggleEditor.d.ts +0 -22
- package/lib/esm/components/ToggleEditor.js +0 -23
- package/lib/esm/components/ToggleEditor.js.map +0 -1
- package/lib/esm/ontologies/lincd-ui.d.ts +0 -6
- package/lib/esm/ontologies/lincd-ui.js +0 -18
- package/lib/esm/ontologies/lincd-ui.js.map +0 -1
- package/lib/esm/package.d.ts +0 -3
- package/lib/esm/package.js +0 -4
- package/lib/esm/package.js.map +0 -1
- package/tsconfig-cjs.json +0 -8
- package/tsconfig-esm.json +0 -9
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Shape } from '@_linked/core/shapes/Shape';
|
|
3
2
|
import { InputProps } from '@_linked/primitives/components/Input';
|
|
4
3
|
export interface TextfieldProps extends InputProps {
|
|
5
4
|
onChange?: (e: any) => void;
|
|
6
5
|
value?: number | string;
|
|
7
6
|
helperText?: string;
|
|
8
|
-
of
|
|
7
|
+
of?: Record<string, any>;
|
|
9
8
|
valueProperty?: string;
|
|
10
9
|
property?: any;
|
|
11
10
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Input } from '@_linked/primitives/components/Input';
|
|
3
3
|
export const TextfieldEditor = ({ onChange, value, of, property, valueProperty, preConvertValueFn, postConvertValueFn, ...restProps }) => {
|
|
4
4
|
const onBlur = (e) => {
|
|
@@ -17,7 +17,7 @@ export const TextfieldEditor = ({ onChange, value, of, property, valueProperty,
|
|
|
17
17
|
onChange(e);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
return (
|
|
20
|
+
return (_jsx(Input, { value: value, onChange: onChangeHandler, defaultValue: of
|
|
21
21
|
? preConvertValueFn
|
|
22
22
|
? preConvertValueFn(of[property.label])
|
|
23
23
|
: of[property.label]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextfieldEditor.js","sourceRoot":"","sources":["../../../src/components/TextfieldEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextfieldEditor.js","sourceRoot":"","sources":["../../../src/components/TextfieldEditor.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAc,MAAM,sCAAsC,CAAC;AAuBzE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,QAAQ,EACR,KAAK,EACL,EAAE,EACF,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,GAAG,SAAS,EACG,EAAE,EAAE;IACnB,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE;QACnB,IAAI,KAAK,GAAG,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;QAClC,IAAI,CAAC,EAAE;YAAE,OAAO;QAChB,IAAI,kBAAkB,EAAE,CAAC;YACvB,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;QACD,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,EAAE;QAC5B,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,CAAC,CAAC,CAAC;QACd,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,KAAK,IACJ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,eAAe,EACzB,YAAY,EACV,EAAE;YACA,CAAC,CAAC,iBAAiB;gBACjB,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACvC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;YACtB,CAAC,CAAC,EAAE,EAER,MAAM,EAAE,MAAM,KACV,SAAS,GACb,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
EditInstanceForms.module.css
|
|
3
|
+
|
|
4
|
+
Form layout for editing instance data.
|
|
5
|
+
Matches ViewInstance styling with card container.
|
|
6
|
+
Uses semantic tokens from theme.css.
|
|
7
|
+
============================================================================ */
|
|
8
|
+
|
|
9
|
+
/* === Container (Card) === */
|
|
10
|
+
.container {
|
|
11
|
+
background: var(--surface-bg);
|
|
12
|
+
border: 1px solid var(--surface-border);
|
|
13
|
+
border-radius: var(--radius-box);
|
|
14
|
+
margin: var(--section-gap) 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* === Rows Wrapper === */
|
|
18
|
+
.rows {
|
|
19
|
+
padding: var(--surface-gap) var(--space-2xl) var(--space-lg) var(--space-2xl);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* === Section Title === */
|
|
23
|
+
.sectionTitle {
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding: var(--surface-padding) var(--space-2xl) 0 var(--space-2xl);
|
|
26
|
+
font-size: var(--typography-small-size);
|
|
27
|
+
color: var(--forms-gray-500, var(--color-gray-500));
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
text-transform: uppercase;
|
|
30
|
+
letter-spacing: 0.05em;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* === Add Field Section === */
|
|
34
|
+
.addFieldSection {
|
|
35
|
+
padding: var(--space-sm) 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* === Save Error === */
|
|
39
|
+
.saveError {
|
|
40
|
+
color: var(--intent-danger-text);
|
|
41
|
+
font-size: var(--typography-small-size);
|
|
42
|
+
margin: var(--space-sm) 0 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* === Actions === */
|
|
46
|
+
.actions {
|
|
47
|
+
display: flex;
|
|
48
|
+
justify-content: flex-end;
|
|
49
|
+
gap: var(--surface-gap);
|
|
50
|
+
margin-top: var(--space-lg);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* ============================================================================
|
|
54
|
+
Dark Mode
|
|
55
|
+
============================================================================ */
|
|
56
|
+
|
|
57
|
+
/* .container uses --card-bg / --card-border which auto-switch in dark mode */
|
|
58
|
+
|
|
59
|
+
[data-theme='dark'] .sectionTitle {
|
|
60
|
+
color: var(--forms-gray-400, var(--color-gray-400));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* ============================================================================
|
|
64
|
+
Mobile Responsive Styles
|
|
65
|
+
============================================================================ */
|
|
66
|
+
|
|
67
|
+
@media only screen and (max-width: 768px) {
|
|
68
|
+
.rows {
|
|
69
|
+
padding: var(--space-sm) var(--space-md);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@media only screen and (max-width: 480px) {
|
|
74
|
+
.container {
|
|
75
|
+
margin: var(--space-md) 0;
|
|
76
|
+
border-radius: var(--radius-field);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.rows {
|
|
80
|
+
padding: var(--space-xs) var(--space-sm);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.sectionTitle {
|
|
84
|
+
padding: var(--space-sm) var(--space-sm) 0 var(--space-sm);
|
|
85
|
+
font-size: 0.6875rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.actions {
|
|
89
|
+
flex-direction: column-reverse;
|
|
90
|
+
gap: var(--space-sm);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.actions button {
|
|
94
|
+
width: 100%;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a host application supplies to the data manager.
|
|
3
|
+
*
|
|
4
|
+
* The point of this contract is what it does NOT contain: no project id, no branch, no
|
|
5
|
+
* store, no dataset name. Routing is decided below the component by `LinkedStorage` —
|
|
6
|
+
* `AppDataRouter` inside Create Now, the app's own default dataset in a standalone or
|
|
7
|
+
* Capacitor build — so the component issues a Linked Query and never names a project.
|
|
8
|
+
* Everything here is genuinely host-specific: where IRIs are minted, how the catalog is
|
|
9
|
+
* found, and where a click should go.
|
|
10
|
+
*/
|
|
11
|
+
import type { NodeShapeWire } from '@_linked/core/shapes/nodeShapeWire';
|
|
12
|
+
import type { ReactNode } from 'react';
|
|
13
|
+
/** Where a host sends the viewer when they act on a row. */
|
|
14
|
+
export interface DataManagerNavigation {
|
|
15
|
+
toInstance(shapeIri: string, instanceId: string): void;
|
|
16
|
+
toEdit(shapeIri: string, instanceId: string): void;
|
|
17
|
+
toAdd(shapeIri: string): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* "Pick mode" — the flow where a form asks the user to choose a related instance and
|
|
21
|
+
* returns with it. Optional because it is a Create Now studio affordance; a standalone
|
|
22
|
+
* app that has no such flow simply omits it, rather than being asked to stub it.
|
|
23
|
+
*/
|
|
24
|
+
/** What a field needs the host to open a picker for. */
|
|
25
|
+
export interface PickRequest {
|
|
26
|
+
/** The shape whose instances the viewer should choose from. */
|
|
27
|
+
shapeIri: string;
|
|
28
|
+
/** The field asking, so the host can route the answer back to it. */
|
|
29
|
+
propertyLabel: string;
|
|
30
|
+
/** The shape being edited — the same field label can exist on more than one. */
|
|
31
|
+
sourceShapeIri?: string;
|
|
32
|
+
minCount?: number;
|
|
33
|
+
maxCount?: number;
|
|
34
|
+
/** Already-chosen values, so the picker can show them as selected. */
|
|
35
|
+
alreadySelected?: InstanceSuggestion[];
|
|
36
|
+
/**
|
|
37
|
+
* An opaque token the host must carry across the round trip and hand back on return.
|
|
38
|
+
*
|
|
39
|
+
* A field with unsaved work flushes it before the viewer leaves, and that flush yields
|
|
40
|
+
* an identifier — Create Now's draft id — without which the half-filled form is lost on
|
|
41
|
+
* the way back. The field cannot store it itself; it is about to unmount. It is opaque
|
|
42
|
+
* here on purpose: how a host preserves it is its own business (Create Now puts it in
|
|
43
|
+
* the return URL), and a host with no navigation to survive can ignore it.
|
|
44
|
+
*/
|
|
45
|
+
resumeToken?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface DataManagerPicking {
|
|
48
|
+
/**
|
|
49
|
+
* A field is asking the viewer to choose. How that is presented is entirely the host's
|
|
50
|
+
* call — Create Now navigates to the overview in pick mode, a mobile app would open a
|
|
51
|
+
* sheet — which is why this is a request rather than a URL.
|
|
52
|
+
*
|
|
53
|
+
* A host that omits `picking` gets a picker with no "browse all" affordance rather than
|
|
54
|
+
* a broken one; the inline search still works.
|
|
55
|
+
*/
|
|
56
|
+
open(request: PickRequest): void;
|
|
57
|
+
/**
|
|
58
|
+
* The viewer completed a choice.
|
|
59
|
+
*
|
|
60
|
+
* Called ONCE per completed choice with everything chosen, not once per instance —
|
|
61
|
+
* a multi-pick host has to write all the values and then return, and per-instance calls
|
|
62
|
+
* made it navigate away on the first one.
|
|
63
|
+
*
|
|
64
|
+
* The full suggestion is passed, not just the id, because the host generally has to
|
|
65
|
+
* store something displayable straight away: the field that opened the picker renders
|
|
66
|
+
* a chip before anything re-reads the instance. Passing an id alone forced the host to
|
|
67
|
+
* look the label back up, which is a read it should not need.
|
|
68
|
+
*/
|
|
69
|
+
select(instances: InstanceSuggestion[]): void;
|
|
70
|
+
/**
|
|
71
|
+
* The return leg: values the viewer picked for this field while it was away.
|
|
72
|
+
*
|
|
73
|
+
* A field that sends the viewer elsewhere to choose is unmounted by the time they do,
|
|
74
|
+
* so the answer cannot be handed back through a callback — the field has to ask for it
|
|
75
|
+
* when it mounts again. Which is why `open` and `select` alone were not enough: the
|
|
76
|
+
* component was reading Create Now's sessionStorage directly to close the loop.
|
|
77
|
+
*
|
|
78
|
+
* Returns only what belongs to THIS field: several relation fields can be on one form,
|
|
79
|
+
* and the picked values must not land in the wrong one. Returns null when there is
|
|
80
|
+
* nothing waiting, which is the normal case on almost every mount.
|
|
81
|
+
*
|
|
82
|
+
* The host consumes the result. Note that under React Strict Mode a field mounts,
|
|
83
|
+
* unmounts and mounts again, so a host that clears synchronously will lose the value
|
|
84
|
+
* on the second mount — clear on a later tick.
|
|
85
|
+
*/
|
|
86
|
+
takeResult(field: {
|
|
87
|
+
propertyLabel: string;
|
|
88
|
+
sourceShapeIri?: string;
|
|
89
|
+
}): InstanceSuggestion[] | null;
|
|
90
|
+
}
|
|
91
|
+
/** One candidate for a relation field. */
|
|
92
|
+
export interface InstanceSuggestion {
|
|
93
|
+
id: string;
|
|
94
|
+
label: string;
|
|
95
|
+
image?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface SearchInstancesOptions {
|
|
98
|
+
/** Free text; empty means "browse". */
|
|
99
|
+
query?: string;
|
|
100
|
+
limit?: number;
|
|
101
|
+
offset?: number;
|
|
102
|
+
/** Restrict to these ids — used when another field's value narrows the choices. */
|
|
103
|
+
narrowedIds?: string[] | null;
|
|
104
|
+
}
|
|
105
|
+
export interface DataManagerHost {
|
|
106
|
+
/**
|
|
107
|
+
* Base IRI for minting new instance IRIs.
|
|
108
|
+
*
|
|
109
|
+
* In Create Now this is the project's `dataRoot` — the ONE value in the catalog path
|
|
110
|
+
* that comes from cn-main rather than the app's own dataset. A standalone app knows its
|
|
111
|
+
* own domain and passes it from config, which is why this is a plain value here and not
|
|
112
|
+
* a lookup.
|
|
113
|
+
*/
|
|
114
|
+
dataRoot?: string;
|
|
115
|
+
/**
|
|
116
|
+
* The metadata for ONE shape, by IRI.
|
|
117
|
+
*
|
|
118
|
+
* The only required member, and deliberately the smallest one that works. It used to ask
|
|
119
|
+
* for the whole catalog, which read as though a consumer needed a catalogue query before
|
|
120
|
+
* they could render anything — and that is not what the components do with it. There are
|
|
121
|
+
* exactly two uses: resolving the shape a relation field is searching, and resolving the
|
|
122
|
+
* shape a form is writing to. Both want one shape.
|
|
123
|
+
*
|
|
124
|
+
* So an app that composes a page for `Contact` returns its `Contact` shape from a constant
|
|
125
|
+
* and is done. An app that does have a catalog answers from it. Neither is asked to build
|
|
126
|
+
* a shape browser in order to render one table.
|
|
127
|
+
*
|
|
128
|
+
* Return `undefined` for an unknown IRI: a search then yields nothing rather than
|
|
129
|
+
* guessing, and a write is refused rather than putting untyped triples in the graph.
|
|
130
|
+
*/
|
|
131
|
+
resolveShape(shapeIri: string): Promise<NodeShapeWire | undefined>;
|
|
132
|
+
/**
|
|
133
|
+
* The whole catalog, when the host happens to have one.
|
|
134
|
+
*
|
|
135
|
+
* Optional, and only a convenience: supplying it means `resolveShape` can be derived, so a
|
|
136
|
+
* host with a catalog need not write both.
|
|
137
|
+
*/
|
|
138
|
+
resolveCatalog?(): Promise<Record<string, NodeShapeWire>>;
|
|
139
|
+
/**
|
|
140
|
+
* Find instances of a shape, for a relation field's picker.
|
|
141
|
+
*
|
|
142
|
+
* A host concern because *how* you search is host-specific: Create Now asks its backend
|
|
143
|
+
* on behalf of a project, a standalone app queries its own dataset. What the picker needs
|
|
144
|
+
* back is the same either way — id, a human label, optionally an image.
|
|
145
|
+
*/
|
|
146
|
+
searchInstances?(shapeIri: string, options?: SearchInstancesOptions): Promise<{
|
|
147
|
+
results: InstanceSuggestion[];
|
|
148
|
+
hasMore: boolean;
|
|
149
|
+
}>;
|
|
150
|
+
/**
|
|
151
|
+
* Render a form for creating a related instance inline, without leaving the field.
|
|
152
|
+
*
|
|
153
|
+
* A render slot rather than a component reference on purpose. The relation picker used to
|
|
154
|
+
* `import AddInstanceForms` directly — a molecule importing an organism, which is a cycle
|
|
155
|
+
* and also the single thing that made the picker unextractable. The host decides what
|
|
156
|
+
* "create one of these" looks like; the picker only decides when to ask.
|
|
157
|
+
*/
|
|
158
|
+
inlineCreate?(args: {
|
|
159
|
+
shapeIri: string;
|
|
160
|
+
onCreated: (created: InstanceSuggestion) => void;
|
|
161
|
+
onCancel: () => void;
|
|
162
|
+
}): ReactNode;
|
|
163
|
+
/**
|
|
164
|
+
* Read one instance's values.
|
|
165
|
+
*
|
|
166
|
+
* Used by the form's dependency cascade, which needs a parent instance's values to narrow
|
|
167
|
+
* a child field's choices. On the host because the read is host-specific; the cascade
|
|
168
|
+
* logic is not.
|
|
169
|
+
*/
|
|
170
|
+
readInstance?(shapeIri: string, instanceId: string): Promise<{
|
|
171
|
+
rows: Record<string, unknown>[];
|
|
172
|
+
}>;
|
|
173
|
+
navigate?: DataManagerNavigation;
|
|
174
|
+
picking?: DataManagerPicking;
|
|
175
|
+
/**
|
|
176
|
+
* Create an instance and return its IRI.
|
|
177
|
+
*
|
|
178
|
+
* Optional, and filled in from the DSL when absent — like `searchInstances`, and for the
|
|
179
|
+
* same reason: a form that cannot save unless the host wrote a create by hand is not
|
|
180
|
+
* "works standalone". Create Now overrides it only because its create also has to write
|
|
181
|
+
* a draft and record a projection edit, neither of which is a write concern.
|
|
182
|
+
*/
|
|
183
|
+
createInstance?(shapeIri: string, values: Record<string, unknown>): Promise<{
|
|
184
|
+
id: string;
|
|
185
|
+
}>;
|
|
186
|
+
/** Update an instance. Optional, and filled in from the DSL when absent. */
|
|
187
|
+
updateInstance?(shapeIri: string, instanceId: string, values: Record<string, unknown>): Promise<void>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* A host with nothing wired up: catalog is empty, navigation is a no-op.
|
|
191
|
+
*
|
|
192
|
+
* For tests and for a first render before the real host exists. Deliberately silent
|
|
193
|
+
* rather than throwing — a missing host should render an empty table, not break the page
|
|
194
|
+
* that embedded it.
|
|
195
|
+
*/
|
|
196
|
+
export declare function nullHost(): DataManagerHost;
|
package/lib/esm/host.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a host application supplies to the data manager.
|
|
3
|
+
*
|
|
4
|
+
* The point of this contract is what it does NOT contain: no project id, no branch, no
|
|
5
|
+
* store, no dataset name. Routing is decided below the component by `LinkedStorage` —
|
|
6
|
+
* `AppDataRouter` inside Create Now, the app's own default dataset in a standalone or
|
|
7
|
+
* Capacitor build — so the component issues a Linked Query and never names a project.
|
|
8
|
+
* Everything here is genuinely host-specific: where IRIs are minted, how the catalog is
|
|
9
|
+
* found, and where a click should go.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* A host with nothing wired up: catalog is empty, navigation is a no-op.
|
|
13
|
+
*
|
|
14
|
+
* For tests and for a first render before the real host exists. Deliberately silent
|
|
15
|
+
* rather than throwing — a missing host should render an empty table, not break the page
|
|
16
|
+
* that embedded it.
|
|
17
|
+
*/
|
|
18
|
+
export function nullHost() {
|
|
19
|
+
return {
|
|
20
|
+
async resolveShape() {
|
|
21
|
+
return undefined;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA2MH;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO;QACL,KAAK,CAAC,YAAY;YAChB,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host, supplied by context rather than threaded as props.
|
|
3
|
+
*
|
|
4
|
+
* The components that need the host are three levels down — a form renders a field, which
|
|
5
|
+
* renders a value editor, which renders the relation picker — and the picker is the one
|
|
6
|
+
* that needs to search, navigate and offer inline creation. Passing four callbacks through
|
|
7
|
+
* every intermediate component would put host concerns in the signature of components that
|
|
8
|
+
* have no interest in them.
|
|
9
|
+
*
|
|
10
|
+
* So: one provider at the top, `useDataManagerHost()` where it is needed. The default is
|
|
11
|
+
* `nullHost()`, which does nothing rather than throwing — a component rendered without a
|
|
12
|
+
* provider should show an empty picker, not break the page that embedded it.
|
|
13
|
+
*/
|
|
14
|
+
import { type ReactNode } from 'react';
|
|
15
|
+
import { type DataManagerHost } from './host.js';
|
|
16
|
+
export interface DataManagerHostProviderProps {
|
|
17
|
+
host: DataManagerHost;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare function DataManagerHostProvider({ host, children, }: DataManagerHostProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<DataManagerHost>>;
|
|
21
|
+
/**
|
|
22
|
+
* The host for the surrounding provider, with the defaults filled in.
|
|
23
|
+
*
|
|
24
|
+
* `searchInstances`, `createInstance` and `updateInstance` are supplied from the DSL when
|
|
25
|
+
* the host does not provide them, so reading, searching and saving all work with no host
|
|
26
|
+
* wiring at all. Callers therefore never branch on whether a method exists — which they
|
|
27
|
+
* previously had to, and which meant a host that forgot one rendered a silently empty
|
|
28
|
+
* picker or a form whose save button did nothing.
|
|
29
|
+
*
|
|
30
|
+
* Read and write are filled in from the same place on purpose. They are routed by
|
|
31
|
+
* `LinkedStorage` as a pair, and a read routed one way with a write routed another is how
|
|
32
|
+
* a form saves into a dataset the table is not looking at.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useDataManagerHost(): DataManagerHost;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host, supplied by context rather than threaded as props.
|
|
3
|
+
*
|
|
4
|
+
* The components that need the host are three levels down — a form renders a field, which
|
|
5
|
+
* renders a value editor, which renders the relation picker — and the picker is the one
|
|
6
|
+
* that needs to search, navigate and offer inline creation. Passing four callbacks through
|
|
7
|
+
* every intermediate component would put host concerns in the signature of components that
|
|
8
|
+
* have no interest in them.
|
|
9
|
+
*
|
|
10
|
+
* So: one provider at the top, `useDataManagerHost()` where it is needed. The default is
|
|
11
|
+
* `nullHost()`, which does nothing rather than throwing — a component rendered without a
|
|
12
|
+
* provider should show an empty picker, not break the page that embedded it.
|
|
13
|
+
*/
|
|
14
|
+
import { createContext, createElement, useContext, useMemo } from 'react';
|
|
15
|
+
import { nullHost } from './host.js';
|
|
16
|
+
import { registerRuntimeShapes } from '@_linked/core/shapes/registerRuntimeShape';
|
|
17
|
+
import { narrowSuggestions, searchInstancesWithDsl } from './search.js';
|
|
18
|
+
import { createInstanceWithDsl, updateInstanceWithDsl } from './write.js';
|
|
19
|
+
const HostContext = createContext(nullHost());
|
|
20
|
+
export function DataManagerHostProvider({ host, children, }) {
|
|
21
|
+
return createElement(HostContext.Provider, { value: host }, children);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The host for the surrounding provider, with the defaults filled in.
|
|
25
|
+
*
|
|
26
|
+
* `searchInstances`, `createInstance` and `updateInstance` are supplied from the DSL when
|
|
27
|
+
* the host does not provide them, so reading, searching and saving all work with no host
|
|
28
|
+
* wiring at all. Callers therefore never branch on whether a method exists — which they
|
|
29
|
+
* previously had to, and which meant a host that forgot one rendered a silently empty
|
|
30
|
+
* picker or a form whose save button did nothing.
|
|
31
|
+
*
|
|
32
|
+
* Read and write are filled in from the same place on purpose. They are routed by
|
|
33
|
+
* `LinkedStorage` as a pair, and a read routed one way with a write routed another is how
|
|
34
|
+
* a form saves into a dataset the table is not looking at.
|
|
35
|
+
*/
|
|
36
|
+
export function useDataManagerHost() {
|
|
37
|
+
const host = useContext(HostContext);
|
|
38
|
+
return useMemo(() => {
|
|
39
|
+
const filled = { ...host };
|
|
40
|
+
// Resolve one shape, and register it on the way through.
|
|
41
|
+
//
|
|
42
|
+
// `SelectBuilder.from(shapeIri)` resolves the IRI against core's shape registry, so a
|
|
43
|
+
// shape that was never registered produces an EMPTY result rather than an error — a table
|
|
44
|
+
// that silently shows nothing, indistinguishable from a shape with no instances. Asking
|
|
45
|
+
// the host to remember `registerRuntimeShapes` would make that the first thing every
|
|
46
|
+
// consumer gets wrong, so it happens here. Registration is idempotent and never shadows a
|
|
47
|
+
// compiled class.
|
|
48
|
+
//
|
|
49
|
+
// A host that supplied only `resolveCatalog` is served from it, so having a catalog does
|
|
50
|
+
// not mean writing the single-shape lookup as well.
|
|
51
|
+
const resolveShape = async (shapeIri) => {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
const shape = host.resolveShape
|
|
54
|
+
? await host.resolveShape(shapeIri)
|
|
55
|
+
: (_b = (await ((_a = host.resolveCatalog) === null || _a === void 0 ? void 0 : _a.call(host)))) === null || _b === void 0 ? void 0 : _b[shapeIri];
|
|
56
|
+
if (shape)
|
|
57
|
+
registerRuntimeShapes([shape]);
|
|
58
|
+
return shape;
|
|
59
|
+
};
|
|
60
|
+
filled.resolveShape = resolveShape;
|
|
61
|
+
/** The shape, or a thrown error naming the IRI — a write must not guess. */
|
|
62
|
+
const requireShape = async (shapeIri) => {
|
|
63
|
+
const shape = await resolveShape(shapeIri);
|
|
64
|
+
if (!shape) {
|
|
65
|
+
throw new Error(`Cannot write to ${shapeIri}: it is not in the catalog this host resolved. ` +
|
|
66
|
+
'A write against an unknown shape would put untyped triples in the graph.');
|
|
67
|
+
}
|
|
68
|
+
return shape;
|
|
69
|
+
};
|
|
70
|
+
if (!filled.searchInstances) {
|
|
71
|
+
filled.searchInstances = async (shapeIri, options) => {
|
|
72
|
+
const shape = await resolveShape(shapeIri);
|
|
73
|
+
// No shape means no label property and no idea what to project. An empty result is
|
|
74
|
+
// the honest answer; guessing a projection would produce a wrong query.
|
|
75
|
+
if (!shape)
|
|
76
|
+
return { results: [], hasMore: false };
|
|
77
|
+
const found = await searchInstancesWithDsl(shape, options);
|
|
78
|
+
return {
|
|
79
|
+
...found,
|
|
80
|
+
results: narrowSuggestions(found.results, options === null || options === void 0 ? void 0 : options.narrowedIds),
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (!filled.createInstance) {
|
|
85
|
+
filled.createInstance = async (shapeIri, values) => createInstanceWithDsl(await requireShape(shapeIri), values, {
|
|
86
|
+
dataRoot: host.dataRoot,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (!filled.updateInstance) {
|
|
90
|
+
filled.updateInstance = async (shapeIri, instanceId, values) => updateInstanceWithDsl(await requireShape(shapeIri), instanceId, values);
|
|
91
|
+
}
|
|
92
|
+
return filled;
|
|
93
|
+
}, [host]);
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=hostContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostContext.js","sourceRoot":"","sources":["../../src/hostContext.tsx"],"names":[],"mappings":"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"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,10 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `@_linked/shape-ui` — UI driven by a shape.
|
|
3
|
+
*
|
|
4
|
+
* Two halves that grew separately and belong together.
|
|
5
|
+
*
|
|
6
|
+
* The **editors** take a shape and a property and render one control — a text field, a select,
|
|
7
|
+
* a date picker. Import them by path: `@_linked/shape-ui/components/TextfieldEditor`.
|
|
8
|
+
*
|
|
9
|
+
* The **surfaces** are what you build out of those: a table over any shape's instances, a form
|
|
10
|
+
* derived from its property list, a read-only view, a relation picker, and the shape domain
|
|
11
|
+
* underneath — column derivation, property visibility, validation, and the read and write paths
|
|
12
|
+
* through the Linked Query DSL.
|
|
13
|
+
*
|
|
14
|
+
* The surfaces arrived from `@create-now/data-manager`, where they were private on the
|
|
15
|
+
* assumption that shape-driven CRUD was a product. It is not: it renders any shape, knows
|
|
16
|
+
* nothing about projects, and is worth nothing without shapes to render. The product is the
|
|
17
|
+
* studio that authors them. See arch-03 §UI package layering.
|
|
18
|
+
*
|
|
19
|
+
* **No side-effect imports here, and that is a deliberate exception to the house pattern.**
|
|
20
|
+
* Most `@_linked/*` packages import `./package.js` and `./ontologies/*.js` from their entry
|
|
21
|
+
* point so the package registers itself and its ontology. This one has nothing to register:
|
|
22
|
+
* no `@linkedShape`, no `@linkedUtil`, no `@linkedComponent` anywhere in `src`. Its ontology
|
|
23
|
+
* was empty template scaffolding — one export, no terms, a namespace on a domain we no longer
|
|
24
|
+
* use — and has been deleted.
|
|
25
|
+
*
|
|
26
|
+
* Importing `./package.js` from here was not merely redundant, it was breaking: this barrel
|
|
27
|
+
* also pulls the whole component graph, and adding core's package machinery on top of that
|
|
28
|
+
* closed an import cycle that left `Shape` undefined when a runtime shape was registered —
|
|
29
|
+
* surfacing as "Class extends value undefined is not a constructor or null", thrown from
|
|
30
|
+
* inside a query, with a stack naming none of it.
|
|
31
|
+
*
|
|
32
|
+
* A package that gains a shape should import `./package.js` from that shape's module, the way
|
|
33
|
+
* `@_linked/auth` does — not from here.
|
|
34
|
+
*/
|
|
35
|
+
export type { DataManagerHost, DataManagerNavigation, DataManagerPicking, PickRequest, InstanceSuggestion, SearchInstancesOptions, } from './host.js';
|
|
36
|
+
export { nullHost } from './host.js';
|
|
37
|
+
export type { DataManagerHostProviderProps } from './hostContext.js';
|
|
38
|
+
export { DataManagerHostProvider, useDataManagerHost } from './hostContext.js';
|
|
39
|
+
export type { InstanceQuery, InstanceRows } from './read.js';
|
|
40
|
+
export { selectInstance, selectInstances } from './read.js';
|
|
41
|
+
export type { InstanceValues } from './write.js';
|
|
42
|
+
export { createInstanceWithDsl, mintInstanceIri, updateInstanceWithDsl, } from './write.js';
|
|
43
|
+
export type { Column, DisplayContext, TableMode } from './columns.js';
|
|
44
|
+
export { columnsFor, displayableProperties, hasDeclaredRanks, labelProperty, } from './columns.js';
|
|
45
|
+
export { narrowSuggestions, searchInstancesWithDsl } from './search.js';
|
|
46
|
+
export { default as InstanceOverview } from './components/InstanceOverview.js';
|
|
47
|
+
export type { BatchResult } from './components/InstanceOverview.js';
|
|
48
|
+
export { default as ReactTable } from './components/ReactTable.js';
|
|
49
|
+
export type { ReactTableProps } from './components/ReactTable.js';
|
|
50
|
+
export { InstanceView } from './components/InstanceView.js';
|
|
51
|
+
export { default as AddInstanceForms } from './components/AddInstanceForms.js';
|
|
52
|
+
export { default as EditInstanceForms } from './components/EditInstanceForms.js';
|
|
53
|
+
export { InstanceDeletionDialog } from './components/InstanceDeletionDialog.js';
|
|
54
|
+
export { default as BatchEditDrawer } from './components/BatchEditDrawer.js';
|
|
55
|
+
export { default as CustomMultiSelect } from './components/CustomMultiSelect.js';
|
|
56
|
+
export { DynamicForm } from './components/DynamicFormField.js';
|
|
57
|
+
export { FormField } from './components/FormField.js';
|
|
58
|
+
export { default as NodeValuesEditor } from './components/NodeValuesEditor.js';
|
|
59
|
+
export { NodeBadge } from './components/NodeBadge.js';
|
|
60
|
+
export { FilterBadge } from './components/FilterBadge.js';
|
|
61
|
+
export * from './shape/contracts.js';
|
|
62
|
+
export * from './shape/naming.js';
|
|
63
|
+
export * from './shape/nodeDisplay.js';
|
|
64
|
+
export * from './shape/propertyVisibility.js';
|
package/lib/esm/index.js
CHANGED
|
@@ -1,15 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `@_linked/shape-ui` — UI driven by a shape.
|
|
3
|
+
*
|
|
4
|
+
* Two halves that grew separately and belong together.
|
|
5
|
+
*
|
|
6
|
+
* The **editors** take a shape and a property and render one control — a text field, a select,
|
|
7
|
+
* a date picker. Import them by path: `@_linked/shape-ui/components/TextfieldEditor`.
|
|
8
|
+
*
|
|
9
|
+
* The **surfaces** are what you build out of those: a table over any shape's instances, a form
|
|
10
|
+
* derived from its property list, a read-only view, a relation picker, and the shape domain
|
|
11
|
+
* underneath — column derivation, property visibility, validation, and the read and write paths
|
|
12
|
+
* through the Linked Query DSL.
|
|
13
|
+
*
|
|
14
|
+
* The surfaces arrived from `@create-now/data-manager`, where they were private on the
|
|
15
|
+
* assumption that shape-driven CRUD was a product. It is not: it renders any shape, knows
|
|
16
|
+
* nothing about projects, and is worth nothing without shapes to render. The product is the
|
|
17
|
+
* studio that authors them. See arch-03 §UI package layering.
|
|
18
|
+
*
|
|
19
|
+
* **No side-effect imports here, and that is a deliberate exception to the house pattern.**
|
|
20
|
+
* Most `@_linked/*` packages import `./package.js` and `./ontologies/*.js` from their entry
|
|
21
|
+
* point so the package registers itself and its ontology. This one has nothing to register:
|
|
22
|
+
* no `@linkedShape`, no `@linkedUtil`, no `@linkedComponent` anywhere in `src`. Its ontology
|
|
23
|
+
* was empty template scaffolding — one export, no terms, a namespace on a domain we no longer
|
|
24
|
+
* use — and has been deleted.
|
|
25
|
+
*
|
|
26
|
+
* Importing `./package.js` from here was not merely redundant, it was breaking: this barrel
|
|
27
|
+
* also pulls the whole component graph, and adding core's package machinery on top of that
|
|
28
|
+
* closed an import cycle that left `Shape` undefined when a runtime shape was registered —
|
|
29
|
+
* surfacing as "Class extends value undefined is not a constructor or null", thrown from
|
|
30
|
+
* inside a query, with a stack naming none of it.
|
|
31
|
+
*
|
|
32
|
+
* A package that gains a shape should import `./package.js` from that shape's module, the way
|
|
33
|
+
* `@_linked/auth` does — not from here.
|
|
34
|
+
*/
|
|
35
|
+
export { nullHost } from './host.js';
|
|
36
|
+
export { DataManagerHostProvider, useDataManagerHost } from './hostContext.js';
|
|
37
|
+
export { selectInstance, selectInstances } from './read.js';
|
|
38
|
+
export { createInstanceWithDsl, mintInstanceIri, updateInstanceWithDsl, } from './write.js';
|
|
39
|
+
export { columnsFor, displayableProperties, hasDeclaredRanks, labelProperty, } from './columns.js';
|
|
40
|
+
export { narrowSuggestions, searchInstancesWithDsl } from './search.js';
|
|
41
|
+
// ─── Components ──────────────────────────────────────────────────────────────
|
|
42
|
+
//
|
|
43
|
+
// The shape-driven CRUD surfaces. Each one takes shape metadata and instance data and asks
|
|
44
|
+
// the host for anything that is specific to the application around it — where a click leads,
|
|
45
|
+
// where an IRI is minted, how a picker is opened.
|
|
46
|
+
export { default as InstanceOverview } from './components/InstanceOverview.js';
|
|
47
|
+
export { default as ReactTable } from './components/ReactTable.js';
|
|
48
|
+
export { InstanceView } from './components/InstanceView.js';
|
|
49
|
+
export { default as AddInstanceForms } from './components/AddInstanceForms.js';
|
|
50
|
+
export { default as EditInstanceForms } from './components/EditInstanceForms.js';
|
|
51
|
+
export { InstanceDeletionDialog } from './components/InstanceDeletionDialog.js';
|
|
52
|
+
export { default as BatchEditDrawer } from './components/BatchEditDrawer.js';
|
|
53
|
+
export { default as CustomMultiSelect } from './components/CustomMultiSelect.js';
|
|
54
|
+
export { DynamicForm } from './components/DynamicFormField.js';
|
|
55
|
+
export { FormField } from './components/FormField.js';
|
|
56
|
+
export { default as NodeValuesEditor } from './components/NodeValuesEditor.js';
|
|
57
|
+
export { NodeBadge } from './components/NodeBadge.js';
|
|
58
|
+
export { FilterBadge } from './components/FilterBadge.js';
|
|
59
|
+
// ─── Shape domain ────────────────────────────────────────────────────────────
|
|
60
|
+
export * from './shape/contracts.js';
|
|
61
|
+
export * from './shape/naming.js';
|
|
62
|
+
export * from './shape/nodeDisplay.js';
|
|
63
|
+
export * from './shape/propertyVisibility.js';
|
|
15
64
|
//# sourceMappingURL=index.js.map
|