cedar-embeddable-designer 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/README.md +192 -704
- package/bundle-manifest.host-fonts.json +4 -4
- package/bundle-manifest.json +4 -4
- package/cedar-embeddable-designer.host-fonts.js +101 -101
- package/cedar-embeddable-designer.js +101 -101
- package/integration-manifest.json +6 -6
- package/integration.mjs +2702 -2538
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,745 +1,233 @@
|
|
|
1
1
|
# CEDAR Embeddable Designer (CED)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
[CEDAR
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
##
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```html
|
|
74
|
-
<cedar-embeddable-designer language="hu"></cedar-embeddable-designer>
|
|
3
|
+
[](https://github.com/metadatacenter/cedar-embeddable-designer/actions/workflows/test.yml)
|
|
4
|
+
|
|
5
|
+
The CEDAR Embeddable Designer (CED) puts metadata template authoring inside a web
|
|
6
|
+
application. Authors assemble fields and reusable groups, define their allowed
|
|
7
|
+
values and defaults, and preview the form that will collect the metadata. The
|
|
8
|
+
host application receives a CEDAR template that it can store and use in its own
|
|
9
|
+
workflow.
|
|
10
|
+
|
|
11
|
+
A template describes what metadata to collect: field names, value types,
|
|
12
|
+
requirements, repeated groups, and controlled vocabularies. CED lets the people
|
|
13
|
+
responsible for those requirements maintain them through a visual interface,
|
|
14
|
+
without writing schemas by hand or building a template authoring tool.
|
|
15
|
+
|
|
16
|
+
The same CED bundle also includes the CEDAR Embeddable Field Designer (CEFD),
|
|
17
|
+
for creating or editing an individual field definition.
|
|
18
|
+
|
|
19
|
+
CED ships as a standard Web Component. It can be embedded in plain HTML or an
|
|
20
|
+
Angular, React, or other web application without requiring the host to install
|
|
21
|
+
Angular. Basic template authoring needs neither a CEDAR account nor a running
|
|
22
|
+
CEDAR installation. Lookup and repository features use services supplied by
|
|
23
|
+
the host.
|
|
24
|
+
|
|
25
|
+
## How the Components Fit Together
|
|
26
|
+
|
|
27
|
+
CEDAR provides three components for designing templates, choosing vocabularies,
|
|
28
|
+
and collecting metadata:
|
|
29
|
+
|
|
30
|
+
| Component | Role |
|
|
31
|
+
|---|---|
|
|
32
|
+
| [CEDAR Embeddable Designer (CED)](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-designer/) | Authors templates and reusable elements, including their fields, structure, constraints, and defaults. The included Field Designer authors standalone fields. |
|
|
33
|
+
| [CEDAR Embeddable Term Picker (CETP)](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-term-picker/) | Searches vocabularies and selects field constraints and default terms during authoring. It also supports ontology-property selection. |
|
|
34
|
+
| [CEDAR Embeddable Editor (CEE)](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-editor/) | Renders a template for metadata entry or read-only display and returns the resulting metadata instance. |
|
|
35
|
+
|
|
36
|
+
An author designs a template in CED and uses its embedded Term Picker to define
|
|
37
|
+
the vocabularies a field draws from. The host stores the template and supplies
|
|
38
|
+
a selected version to CEE. A researcher completes the form, and the host stores
|
|
39
|
+
the resulting metadata instance.
|
|
40
|
+
|
|
41
|
+
CEE also supplies CED's form preview, and the CEF widget included in CEE's
|
|
42
|
+
bundle supplies individual field controls. Each component is a separate package:
|
|
43
|
+
the host loads the sibling bundles and configures their services, then CED
|
|
44
|
+
manages its embedded preview and pickers. Authentication, template version
|
|
45
|
+
choices, and saving remain the host's responsibility.
|
|
46
|
+
|
|
47
|
+
Applications can use CETP independently for vocabulary selection. A host filling
|
|
48
|
+
an existing template needs only CEE, whose controlled-term fields perform their
|
|
49
|
+
own lookup through the configured terminology service. See
|
|
50
|
+
[Your First Embedded Term Picker](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-term-picker/first-picker/)
|
|
51
|
+
for standalone vocabulary selection and
|
|
52
|
+
[Your First Embedded Editor](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-editor/first-editor/)
|
|
53
|
+
for collecting metadata from a finished template.
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
The [CEDAR Embeddable Designer documentation](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-designer/)
|
|
58
|
+
covers installation, templates and elements, validation, reusable content,
|
|
59
|
+
standalone fields, service configuration, and appearance.
|
|
60
|
+
|
|
61
|
+
[Your First Embedded Designer](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-designer/first-designer/)
|
|
62
|
+
builds a working page from the published packages.
|
|
63
|
+
[Artifacts and Validation](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-designer/artifacts-and-validation/)
|
|
64
|
+
explains what a host supplies, what it reads back, and how to save safely.
|
|
65
|
+
|
|
66
|
+
## Installing
|
|
67
|
+
|
|
68
|
+
Stable releases are published on npm as
|
|
69
|
+
[`cedar-embeddable-designer`](https://www.npmjs.com/package/cedar-embeddable-designer):
|
|
70
|
+
|
|
71
|
+
```shell
|
|
72
|
+
npm install cedar-embeddable-designer
|
|
75
73
|
```
|
|
76
74
|
|
|
77
|
-
|
|
78
|
-
import type { CedarEmbeddableDesignerElement } from 'cedar-embeddable-designer';
|
|
75
|
+
To check the current stable release:
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
designer.language = 'hu';
|
|
83
|
-
console.log(designer.language); // 'hu'
|
|
77
|
+
```shell
|
|
78
|
+
npm view cedar-embeddable-designer version
|
|
84
79
|
```
|
|
85
80
|
|
|
86
|
-
The
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
The designer passes its language on to the components it embeds. It sets
|
|
92
|
-
`language` on every `<cedar-embeddable-term-picker>` it creates, and it configures
|
|
93
|
-
the CEE preview and the embedded CEE field controls with the same `defaultLanguage`
|
|
94
|
-
and a `fallbackLanguage` of `'en'`. CEE applies its configuration once, so a change
|
|
95
|
-
of language replaces those controls rather than reconfiguring them. Dates are
|
|
96
|
-
formatted in the active language's locale: `en-US` for English, as before, and
|
|
97
|
-
`hu-HU` for Hungarian.
|
|
98
|
-
|
|
99
|
-
Validation messages follow the language too. `validationReport` and
|
|
100
|
-
`validationChange` carry each message in the active language, while an issue's
|
|
101
|
-
`tab` keeps its English identifier. An identifier is the tab's original English name,
|
|
102
|
-
so `Display` identifies the tab labelled Presentation, and `Field metadata`,
|
|
103
|
-
`Element metadata` and `Template Metadata` identify the tabs labelled Metadata. A message already shown for a failed edit keeps
|
|
104
|
-
the language it was produced in until the next edit.
|
|
81
|
+
The package contains `cedar-embeddable-designer.js`, the self-contained bundle,
|
|
82
|
+
and `cedar-embeddable-designer.d.ts`, declarations for both designer elements
|
|
83
|
+
and their public APIs. Copy the bundle to the application's static assets and
|
|
84
|
+
load it with a regular `<script>` tag. It is a classic script, not an ES module.
|
|
105
85
|
|
|
106
|
-
|
|
107
|
-
a request. They are `src/assets/i18n/en.json` and `src/assets/i18n/hu.json`. A unit
|
|
108
|
-
test holds the two to the same keys, and another fails when a template or message
|
|
109
|
-
states user-visible text without going through them.
|
|
86
|
+
### Preview, Field Controls, and Terminology
|
|
110
87
|
|
|
111
|
-
|
|
88
|
+
Install the sibling components for form preview, default-value controls, and
|
|
89
|
+
vocabulary selection:
|
|
112
90
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
nvm use
|
|
117
|
-
npm install
|
|
91
|
+
```shell
|
|
92
|
+
npm install cedar-embeddable-editor cedar-embeddable-term-picker
|
|
118
93
|
```
|
|
119
94
|
|
|
120
|
-
|
|
95
|
+
Copy their `cedar-embeddable-editor.js` and `cedar-embeddable-term-picker.js`
|
|
96
|
+
bundles to the same asset directory. CEE also registers CEF, which supplies
|
|
97
|
+
individual field controls. These components are loaded separately and are not
|
|
98
|
+
included in the CED bundle.
|
|
121
99
|
|
|
122
|
-
|
|
123
|
-
serves is a host page: it embeds `<cedar-embeddable-designer>` rather than
|
|
124
|
-
rendering the designer directly, so development exercises the same contract an
|
|
125
|
-
embedder uses.
|
|
100
|
+
### Hosts That Already Supply CEDAR Fonts
|
|
126
101
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
102
|
+
The default bundle includes CEDAR Roboto 400 and 500. Hosts that register those
|
|
103
|
+
fonts in a global stylesheet can instead load
|
|
104
|
+
`cedar-embeddable-designer.host-fonts.js`. Both variants register CED and CEFD
|
|
105
|
+
with the same API; load only one. Without the host's font faces, the host-font
|
|
106
|
+
variant uses the shared system fallback stack.
|
|
130
107
|
|
|
131
|
-
##
|
|
108
|
+
## Embedding
|
|
132
109
|
|
|
133
|
-
|
|
110
|
+
Load the bundles, wait for registration, and start a template:
|
|
134
111
|
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
|
|
112
|
+
```html
|
|
113
|
+
<cedar-embeddable-designer></cedar-embeddable-designer>
|
|
114
|
+
|
|
115
|
+
<script src="/assets/cedar-embeddable-term-picker.js"></script>
|
|
116
|
+
<script src="/assets/cedar-embeddable-editor.js"></script>
|
|
117
|
+
<script src="/assets/cedar-embeddable-designer.js"></script>
|
|
118
|
+
<script type="module">
|
|
119
|
+
await customElements.whenDefined('cedar-embeddable-designer');
|
|
120
|
+
const designer = document.querySelector('cedar-embeddable-designer');
|
|
121
|
+
|
|
122
|
+
designer.config = {};
|
|
123
|
+
designer.addEventListener('artifactChange', (event) => {
|
|
124
|
+
console.log('Current template:', event.detail);
|
|
125
|
+
});
|
|
126
|
+
designer.addEventListener('validationChange', (event) => {
|
|
127
|
+
console.log('Ready to save:', event.detail.canSave);
|
|
128
|
+
});
|
|
129
|
+
designer.newArtifact('template');
|
|
130
|
+
</script>
|
|
138
131
|
```
|
|
139
132
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
Flattening those into the one script an embedder loads follows CEE's approach and
|
|
146
|
-
is not in place yet.
|
|
147
|
-
|
|
148
|
-
`npm run build:app` compiles `src/main.dev.ts` and the host page around it, which
|
|
149
|
-
is what `npm start` serves.
|
|
150
|
-
|
|
151
|
-
## Authoring Style Ownership
|
|
152
|
-
|
|
153
|
-
Native authoring controls and compact tables import the design-token package's
|
|
154
|
-
`authoring` Sass module directly. `src/authoring.scss` is the selector adapter for
|
|
155
|
-
both designer elements: it chooses where central density, select-arrow and entry-row
|
|
156
|
-
recipes apply. Keep shared geometry and typography in the central recipes, not in
|
|
157
|
-
copies under `src/app/shared` or corrective declarations in `src/styles.css`.
|
|
158
|
-
Component styles still own their layout and content-specific widths.
|
|
159
|
-
|
|
160
|
-
The surface registry checks representative authoring surfaces against central
|
|
161
|
-
contracts at desktop and narrow widths. They cover labels and controls in the
|
|
162
|
-
annotation entry row, a field's and an element's metadata and a nested field's
|
|
163
|
-
constraints, a field's constraint select, a default-value label beside real CEF,
|
|
164
|
-
and a field's metadata under a host override of the shared type size. The
|
|
165
|
-
field-type and label-weight browser suites cover the broader authoring matrix,
|
|
166
|
-
every field type in every settings tab. A central contract compares each property
|
|
167
|
-
with a single token, so CED's own browser tests check select-arrow clearance and
|
|
168
|
-
controlled-term default-row alignment. Preserve these rendered expectations when
|
|
169
|
-
consolidating styles; do not update visual baselines to accept an unintended change.
|
|
170
|
-
|
|
171
|
-
## The Sibling Components It Works With
|
|
172
|
-
|
|
173
|
-
The designer uses sibling web components the embedding page loads,
|
|
174
|
-
and this bundle carries none of them. They are siblings rather than dependencies, so a
|
|
175
|
-
host loads three scripts and each component stays its own size:
|
|
133
|
+
Set configuration before opening or creating a document. The empty configuration
|
|
134
|
+
supports basic authoring. Supply `terminologyBaseUrl` for vocabulary constraints
|
|
135
|
+
and controlled-term defaults, and `bridgeBaseUrl` for external-authority defaults.
|
|
136
|
+
Use your deployment's service bases; neither endpoint has a default. The
|
|
137
|
+
terminology service must support the Term Picker's version-aware search API.
|
|
176
138
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
139
|
+
Call `loadArtifact(source)` to open an existing template or element. It accepts
|
|
140
|
+
a JSON object, JSON text, or CEDAR YAML text and throws on invalid input without
|
|
141
|
+
replacing the current document. The `artifact` property accepts the same inputs
|
|
142
|
+
but reports unreadable input to the console. Use JavaScript properties for
|
|
143
|
+
objects, rather than HTML attributes.
|
|
182
144
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
`constraintsSelected`. Authors can add, inspect, replace and remove constraints,
|
|
187
|
-
set branch depth, and author term exclusions and result positions. JSON and YAML
|
|
188
|
-
are read and written by the TypeScript model library. Without the picker the
|
|
189
|
-
panel reports editing as unavailable and retains saved constraints.
|
|
190
|
-
|
|
191
|
-
Constraint changes are checked against an existing default using the complete
|
|
192
|
-
set, including actions. A permitted default survives; an invalid one requires
|
|
193
|
-
**Clear default and apply constraints**, while cancellation and lookup failure
|
|
194
|
-
preserve the saved field.
|
|
195
|
-
|
|
196
|
-
The picker reads the terminology server's version-aware `/search`, which
|
|
197
|
-
**production does not serve yet**: `POST https://terminology.metadatacenter.org/search`
|
|
198
|
-
answers 404. Point `terminologyBaseUrl` at a local terminology server to use it.
|
|
199
|
-
|
|
200
|
-
Preview renders the template with
|
|
201
|
-
[`<cedar-embeddable-editor>`](https://github.com/metadatacenter/cedar-embeddable-editor),
|
|
202
|
-
the renderer that will show the form to whoever fills it in, rather than with a
|
|
203
|
-
drawing of a form of the designer's own. It is asked for a read-only form with no
|
|
204
|
-
instance behind it, which is how CEE reads a template as a statement of what each
|
|
205
|
-
field will accept. Without it the preview panel says so.
|
|
206
|
-
|
|
207
|
-
Field cards also reuse CEF's read-only specification box for numeric, text,
|
|
208
|
-
temporal and terminology constraints. Summaries update as constraints change and
|
|
209
|
-
use CEE's own wording and styles; declared defaults remain separate. Choice lists
|
|
210
|
-
and attribute-value placeholders retain their authoring presentation. If the CEE
|
|
211
|
-
script is not loaded, cards keep their existing placeholders; loading it later
|
|
212
|
-
activates the summaries without reloading the document.
|
|
213
|
-
|
|
214
|
-
All default-capable fields use `<cedar-embeddable-field>` (CEF), registered by
|
|
215
|
-
that same CEE script. Choose the **semantic** preset in Preferences to show Default
|
|
216
|
-
Value. Defaults are written through the TypeScript model library and restored on
|
|
217
|
-
open; clearing the control removes them. Numeric bounds and temporal precision
|
|
218
|
-
from imported fields are preserved. Choice defaults use `selectedByDefault` on
|
|
219
|
-
the field's options.
|
|
220
|
-
|
|
221
|
-
Controlled-term defaults use `<cedar-embeddable-term-picker>` in `selectionMode="term"` and
|
|
222
|
-
are checked against the field's vocabulary constraints before saving. The host
|
|
223
|
-
sets `terminologyBaseUrl` for that check and `bridgeBaseUrl` for external authority
|
|
224
|
-
lookups. Load current sibling bundles: without CEF or the required term picker,
|
|
225
|
-
the control reports that it is unavailable and preserves saved defaults.
|
|
226
|
-
|
|
227
|
-
To run the browser integration tests against real sibling bundles after building:
|
|
228
|
-
|
|
229
|
-
```bash
|
|
230
|
-
CEF_BUNDLE="$PWD/../cedar-embeddable-editor/visual/public/cedar-embeddable-editor.js" \
|
|
231
|
-
PICKER_BUNDLE="$PWD/../cedar-embeddable-term-picker/dist-bundle/cedar-embeddable-term-picker.js" \
|
|
232
|
-
npm run test:browser:prebuilt
|
|
233
|
-
```
|
|
145
|
+
`currentArtifact` and `artifactChange` contain the complete root artifact,
|
|
146
|
+
including edits to nested elements. The output is CEDAR JSON Schema with JSON-LD
|
|
147
|
+
annotations. CED does not submit or store it; the host controls persistence.
|
|
234
148
|
|
|
235
|
-
|
|
236
|
-
lockfile, installed CEDAR token/model packages and compiled output. `npm run bundle`
|
|
237
|
-
and `npm run check:fresh` reject any mismatch, including edits with unchanged file
|
|
238
|
-
timestamps. Rebuild with `npm run dist`; an old bundle without provenance is rejected.
|
|
239
|
-
Browser tests start their own server. Use `PORT=4600` if the default port is occupied.
|
|
149
|
+
## Validation and Saving
|
|
240
150
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
151
|
+
Check `designer.validate().canSave` immediately before reading `currentArtifact`
|
|
152
|
+
for a save. An unfinished setting may be invalid while the last accepted
|
|
153
|
+
artifact is still valid, so the last change event is not a save-readiness check.
|
|
154
|
+
Listen for `validationChange` to update a host Save button and for `dirtyChange`
|
|
155
|
+
to track unsaved work, including incomplete edits.
|
|
244
156
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
157
|
+
Numeric constraints and defaults can contain exact values beyond JavaScript's
|
|
158
|
+
number precision. Use the model library's `JsonSourcePolicy.stringify` for a
|
|
159
|
+
JSON request body; ordinary `JSON.stringify` is not the exact-number serializer.
|
|
160
|
+
[Artifacts and Validation](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-designer/artifacts-and-validation/)
|
|
161
|
+
includes a serialization example, server findings, merged-payload validation,
|
|
162
|
+
save-response handling, and recovery through `captureDraft()` and `restoreDraft()`.
|
|
249
163
|
|
|
250
|
-
|
|
164
|
+
Set `readOnly = true` for inspection without edits. Published definitions remain
|
|
165
|
+
locked independently of the host flag. Local validation complements server
|
|
166
|
+
validation, permissions, and publication rules.
|
|
251
167
|
|
|
252
|
-
|
|
253
|
-
npm --prefix ../cedar-embeddable-term-picker run dist
|
|
254
|
-
npm --prefix ../cedar-embeddable-editor run build:production
|
|
255
|
-
npm --prefix ../cedar-embeddable-editor/visual run bundle
|
|
256
|
-
npm run dist
|
|
257
|
-
cp ../cedar-embeddable-term-picker/dist-bundle/cedar-embeddable-term-picker.js dist-bundle/
|
|
258
|
-
cp ../cedar-embeddable-editor/visual/public/cedar-embeddable-editor.js dist-bundle/
|
|
259
|
-
```
|
|
168
|
+
## Reusable Elements and Standalone Fields
|
|
260
169
|
|
|
261
|
-
|
|
262
|
-
`
|
|
263
|
-
|
|
170
|
+
Use `newArtifact('element')` to author a standalone element. Supply a
|
|
171
|
+
`childSource` adapter to search and load existing fields and elements from a
|
|
172
|
+
repository. The host controls authentication and permissions; CED has no default
|
|
173
|
+
repository. See [Reusable Fields and Elements](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-designer/reusable-content/).
|
|
264
174
|
|
|
265
|
-
|
|
175
|
+
The same bundle registers `<cedar-embeddable-field-designer>` for a field-only
|
|
176
|
+
workflow:
|
|
266
177
|
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
```
|
|
178
|
+
```typescript
|
|
179
|
+
import type { CedarEmbeddableFieldDesignerElement } from 'cedar-embeddable-designer';
|
|
270
180
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
The package carries two bundles. `cedar-embeddable-designer.js` is self-contained and embeds
|
|
277
|
-
CEDAR Roboto 400 and 500. `cedar-embeddable-designer.host-fonts.js` is the same element without
|
|
278
|
-
those faces, for a host that registers them once for its whole page, as the design tokens'
|
|
279
|
-
`fonts.css` does. A page that loads several CEDAR components then downloads the faces once
|
|
280
|
-
rather than once per component. Without the host's faces, the host-fonts bundle draws its text in
|
|
281
|
-
the rest of the shared font stack. Each bundle has its own manifest, `bundle-manifest.json` and
|
|
282
|
-
`bundle-manifest.host-fonts.json`, and its own size ceiling. Load only one of them.
|
|
283
|
-
|
|
284
|
-
The registry a package belongs to is derived from its version rather than passed
|
|
285
|
-
at publish time. A version carrying `-dev.` is a snapshot and names the CEDAR
|
|
286
|
-
Nexus under `@org.metadatacenter`; anything else is a release for public npmjs,
|
|
287
|
-
unscoped. That way a snapshot cannot reach npmjs by forgetting a flag.
|
|
288
|
-
|
|
289
|
-
The published declaration is emitted from `src/app/ced-public-api.ts` alone, which
|
|
290
|
-
is written without imports so its declarations stand alone. Adding an import to
|
|
291
|
-
that file breaks the declaration build rather than shipping a `.d.ts` that names
|
|
292
|
-
paths only this repository has.
|
|
293
|
-
|
|
294
|
-
`browser/fixtures/host.html` is the embedding fixture, and the browser suite
|
|
295
|
-
serves it: a host page whose own styles are chosen to be as intrusive as
|
|
296
|
-
possible, loading the distribution and nothing else.
|
|
297
|
-
|
|
298
|
-
## Testing
|
|
299
|
-
|
|
300
|
-
The model adapter's public facade is `src/app/core/model/cedar-template.ts`.
|
|
301
|
-
Its implementations under `core/model/cedar-model/` separate capabilities,
|
|
302
|
-
metadata, terminology conversion, field writing, container writing and reading.
|
|
303
|
-
Only that module imports the CEDAR model library. Implementations use each other
|
|
304
|
-
directly rather than importing their facade; the key policy uses a leaf adapter
|
|
305
|
-
for reserved names. `test:boundaries` enforces the library boundary and rejects
|
|
306
|
-
dependency cycles reachable from the adapter.
|
|
307
|
-
|
|
308
|
-
| Command | What it does |
|
|
309
|
-
| ------------------------ | --------------------------------------------------------------------------- |
|
|
310
|
-
| `npm test` | unit tests, through the Angular CLI's Vitest builder |
|
|
311
|
-
| `npm run test:packaging` | the publish-channel rule, under `node --test` |
|
|
312
|
-
| `npm run test:browser` | builds the distribution, then drives it in a real browser |
|
|
313
|
-
| `npm run test:visual` | the screenshot baselines, in the container they are taken in |
|
|
314
|
-
| `npm run test:ci` | bounded parallel checks, then distribution, browser and visual verification |
|
|
315
|
-
|
|
316
|
-
`test:ci` overlaps unit, lint, type, boundary and packaging checks within
|
|
317
|
-
`CEDAR_TEST_WORKERS` (1–16; by default half the available CPUs, capped at 8).
|
|
318
|
-
The distribution waits for every check, so Angular builds and unit tests never
|
|
319
|
-
share a live cache. The browser tests and the visual baselines then share the
|
|
320
|
-
budget: the baselines take two workers in their container when the budget is at
|
|
321
|
-
least six, one otherwise, and the browser tests the rest. A failed stage blocks the distribution, browser and visual stages; each stage
|
|
322
|
-
prints its elapsed time. `test:ci` therefore needs Docker, as `test:visual` does.
|
|
323
|
-
It also enables the WebKit interaction project alongside Chromium. Install both
|
|
324
|
-
engines before running the complete gate:
|
|
325
|
-
`./browser/node_modules/.bin/playwright install --with-deps chromium webkit`.
|
|
326
|
-
|
|
327
|
-
The browser suite is the one that matters most, because it is the only one that
|
|
328
|
-
can see the failures this component has actually had: an element that never
|
|
329
|
-
registered on a page without `<app-root>`, a lookup that searched the document
|
|
330
|
-
instead of the shadow tree, menus that closed on their own opening click, a view
|
|
331
|
-
that silently stopped updating under OnPush, an image the package does not carry.
|
|
332
|
-
None of those are visible to a unit test.
|
|
333
|
-
|
|
334
|
-
It drives the built single-file bundle in a host page whose own CSS is chosen to
|
|
335
|
-
be as intrusive as possible, and it is hermetic: no test reaches a terminology
|
|
336
|
-
server, and the one covering `<cedar-embeddable-term-picker>` registers a stub in the page,
|
|
337
|
-
so what is under test is this component's half of that contract.
|
|
338
|
-
|
|
339
|
-
## Related Repositories
|
|
340
|
-
|
|
341
|
-
- [cedar-embeddable-editor](https://github.com/metadatacenter/cedar-embeddable-editor) — renders a template as a form and produces instances
|
|
342
|
-
- [cedar-embeddable-term-picker](https://github.com/metadatacenter/cedar-embeddable-term-picker) — chooses the ontology, branch, term or value set that constrains a field
|
|
343
|
-
- [cedar-model-typescript-library](https://github.com/metadatacenter/cedar-model-typescript-library) — the CEDAR model, and the readers and writers for its serializations
|
|
344
|
-
|
|
345
|
-
## Licence
|
|
346
|
-
|
|
347
|
-
BSD 2-Clause. See [license.txt](license.txt).
|
|
348
|
-
|
|
349
|
-
## Local debugging example
|
|
350
|
-
|
|
351
|
-
With `npm start`, open `http://localhost:4200/?example=all-fields` (or the port
|
|
352
|
-
passed to `npm start`). This loads `public/examples/all-fields-nested.json`, a
|
|
353
|
-
snapshot of the local all-fields template, including NIH Grant ID and DOI in its
|
|
354
|
-
single, repeated and nested collections. Edits in CED remain local;
|
|
355
|
-
the example page does not write back to the stack. Choose Modular to expose all
|
|
356
|
-
authoring features.
|
|
357
|
-
|
|
358
|
-
Field cards start compact. The grey bottom chevron reveals underline tabs for
|
|
359
|
-
values, presentation, placement, type-specific constraints, metadata and identity.
|
|
360
|
-
Settings update immediately as valid values are entered. Incomplete input stays editable
|
|
361
|
-
when switching tabs or collapsing the panel. Published fields allow
|
|
362
|
-
inspection but keep editing controls disabled. Reusable field work remains in
|
|
363
|
-
Field Designer; cards no longer offer a Save field to library action.
|
|
364
|
-
|
|
365
|
-
The Overview shows each field's type icon and a right-aligned reorder handle.
|
|
366
|
-
Dragging reorders siblings within the Overview; the document and main editor update
|
|
367
|
-
only when the field is dropped. Focused handles also support Arrow Up/Down.
|
|
368
|
-
|
|
369
|
-
### Empty containers and save continuity
|
|
370
|
-
|
|
371
|
-
Empty editable templates and elements keep their insertion pills visible, including
|
|
372
|
-
loaded empty documents and containers whose last child was deleted. Populated
|
|
373
|
-
containers retain hover/focus disclosure on desktop. Nested insertion rows reserve
|
|
374
|
-
one row of pills plus eight pixels of padding on each side vertically; wrapped pills
|
|
375
|
-
grow naturally on narrow screens.
|
|
376
|
-
|
|
377
|
-
After a successful save, hosts may call `loadArtifact(savedArtifact, { preserveView: true })`
|
|
378
|
-
to adopt server-assigned identifiers and metadata while keeping open tabs, expansion
|
|
379
|
-
and selection. CED matches child occurrences by their deployment path and kind/type,
|
|
380
|
-
not by reusable artifact IRIs. Ordinary loads still reset the document view. The host
|
|
381
|
-
must verify that the saved response still belongs to the currently submitted document
|
|
382
|
-
before adopting it, so a late save cannot replace newer edits.
|
|
383
|
-
|
|
384
|
-
### Read-only access
|
|
385
|
-
|
|
386
|
-
`readOnly = true` permits inspection without permitting document edits. Tabs,
|
|
387
|
-
expand/collapse, outline selection, card keyboard navigation, preview and display
|
|
388
|
-
preferences remain available. Preview itself stays read-only. Text stays legible;
|
|
389
|
-
editing controls are disabled, insertion palettes are absent, and drag handles
|
|
390
|
-
cannot reorder content. Read-only is separate from the host's temporary `inert`
|
|
391
|
-
state while loading or saving.
|
|
392
|
-
|
|
393
|
-
One session-owned `EditorAccess` policy governs commands and controls:
|
|
394
|
-
|
|
395
|
-
| Open document / node | Definition edits | Parent placement edits | Inspection |
|
|
396
|
-
| ------------------------------------- | ----------------------------------------- | ---------------------- | ---------- |
|
|
397
|
-
| Editable draft | Allowed | Allowed for children | Allowed |
|
|
398
|
-
| Published child in an editable parent | Blocked | Allowed | Allowed |
|
|
399
|
-
| Descendant of a published element | Blocked | Blocked | Allowed |
|
|
400
|
-
| Published root or host read-only | Blocked | Blocked | Allowed |
|
|
401
|
-
| Standalone field | Allowed only when draft and host-writable | No parent placement | Allowed |
|
|
402
|
-
|
|
403
|
-
The public `readOnly` getter reports effective access: clearing the host flag
|
|
404
|
-
cannot unlock a published root. Save is unavailable in read-only mode. Entering
|
|
405
|
-
read-only cancels pending terminology checks, closes editing dialogs and preserves
|
|
406
|
-
existing unsaved input. Restoring access does not revive old asynchronous replies
|
|
407
|
-
or reopen those dialogs. Unknown node identities cannot be edited. Validation
|
|
408
|
-
still reports stored defects. A subdued “Validation issues (N)” disclosure lists
|
|
409
|
-
every finding and navigates to its field and settings tab, without repair controls
|
|
410
|
-
or inline error styling. Header icons toggle Overview and Preview; the panels
|
|
411
|
-
have no duplicate close buttons.
|
|
412
|
-
|
|
413
|
-
`loadArtifact`, `artifact`/`template`, and `newArtifact` are explicit host document
|
|
414
|
-
replacement APIs, so they continue to work while read-only without temporarily
|
|
415
|
-
granting editing permission. A successful replacement resets the edit baseline;
|
|
416
|
-
view navigation never changes artifact content or dirty state.
|
|
417
|
-
|
|
418
|
-
The access matrix and command matrix cover host access, publication, both container
|
|
419
|
-
kinds, standalone fields and nested ownership. Browser tests inspect every field
|
|
420
|
-
type, all settings tabs, keyboard access and wide/narrow layouts. Existing seeded
|
|
421
|
-
terminology histories cover delayed responses across read-only transitions.
|
|
422
|
-
|
|
423
|
-
### Settings validation and saving
|
|
424
|
-
|
|
425
|
-
Use `designer.validate()` (or the read-only `validationReport` property) before
|
|
426
|
-
saving. `report.canSave` and `designer.canSave` are false while settings are invalid,
|
|
427
|
-
including pending edits that have not replaced the last valid model value and
|
|
428
|
-
in-progress default terminology checks. `currentArtifact` and artifact change
|
|
429
|
-
events alone are therefore not a save-readiness check.
|
|
430
|
-
|
|
431
|
-
Listen for `validationChange` to update the wrapper's Save button and error list.
|
|
432
|
-
Its detail is the same report: `{ valid, canSave, issues }`. Each issue includes a
|
|
433
|
-
session `nodeId`, an ancestor-ID `path`, a display `label`, `setting`, settings `tab`,
|
|
434
|
-
stable category `code`, user-facing `message`, `severity` (`error` or `warning`), `source`
|
|
435
|
-
(`model`, `draft` or `host`), and `shown`. An error that is not `shown` still blocks saving,
|
|
436
|
-
but CED's error summary holds it back until the author reaches it: a name nobody has
|
|
437
|
-
touched yet, or a new choice field's blank starter option while its name is still
|
|
438
|
-
being entered. Leaving the name reveals any unfinished option. A host that explains a
|
|
439
|
-
disabled Save by pointing at errors should count only the shown ones. Do not parse
|
|
440
|
-
messages or persist session IDs across documents.
|
|
441
|
-
Validation checks the settings CED supports; it does not replace server validation,
|
|
442
|
-
permission checks, or save/publish lifecycle rules.
|
|
443
|
-
|
|
444
|
-
Assign `designer.validationFindings` (also supported by CEFD) to replace the host's report:
|
|
445
|
-
|
|
446
|
-
```javascript
|
|
447
|
-
designer.validationFindings = [
|
|
448
|
-
{
|
|
449
|
-
location: '/properties/Visits/items/properties/Code/_valueConstraints/regex',
|
|
450
|
-
message: 'Review the pattern accepted by the server.',
|
|
451
|
-
severity: 'error',
|
|
452
|
-
},
|
|
453
|
-
];
|
|
181
|
+
await customElements.whenDefined('cedar-embeddable-field-designer');
|
|
182
|
+
const fieldDesigner = document.createElement('cedar-embeddable-field-designer') as CedarEmbeddableFieldDesignerElement;
|
|
183
|
+
document.body.append(fieldDesigner);
|
|
184
|
+
fieldDesigner.config = {};
|
|
185
|
+
fieldDesigner.newArtifact('text');
|
|
454
186
|
```
|
|
455
187
|
|
|
456
|
-
|
|
457
|
-
and
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
control. Host issues retain `source: 'host'` and `location` in the public report. Warnings
|
|
462
|
-
appear in the summary and do not block saving or mark controls as erroneous.
|
|
463
|
-
|
|
464
|
-
Findings belong to the accepted document at assignment. Any accepted artifact edit or
|
|
465
|
-
document replacement retires them; reverting that edit does not revive them. Incomplete
|
|
466
|
-
setting drafts remain intact and keep their own local errors until corrected or discarded.
|
|
467
|
-
Assign `[]` to clear a report without touching the document or those drafts. The host must
|
|
468
|
-
discard asynchronous findings for an obsolete submission before assigning them, owns server
|
|
469
|
-
requests and permission checks, and should pass a new report only when its contents change.
|
|
470
|
-
Messages are supplied by the host and displayed as text, without translation or HTML rendering.
|
|
471
|
-
|
|
472
|
-
A stored artifact can hold a shape CED cannot represent and the CEDAR validator refuses: a
|
|
473
|
-
numeric field whose datatype is missing or unsupported, a controlled-term default stored as text,
|
|
474
|
-
an order on a field, or a length limit or pattern on a controlled-term field. CED's projection then
|
|
475
|
-
holds something else in its place. The report lists each such shape under `superseded`, with its
|
|
476
|
-
JSON Pointer `location` in the artifact as it was loaded, a `code`, and the `value` the projection
|
|
477
|
-
holds, which is absent when the projection omits the key. A host that saves by merging CED's
|
|
478
|
-
projection into the stored artifact, retaining what the author did not change, applies these to
|
|
479
|
-
its stored copy first. Otherwise a retained branch carries the shape back to the server, which
|
|
480
|
-
refuses the save, and the author has nothing in CED to repair. `superseded` is present only when it
|
|
481
|
-
lists something, never affects `valid` or `canSave`, and stays the same until the next load.
|
|
482
|
-
|
|
483
|
-
`designer.validateArtifact(artifact, kind?)` (also supported by CEFD) returns the CEDAR meta-schema's
|
|
484
|
-
verdict on any schema artifact, not only the open one: `{ findings, structurallyValid, canSave,
|
|
485
|
-
isValid }`, each finding with a `code`, a `category`, a JSON Pointer `path` and a `message`. It is
|
|
486
|
-
the check CED applies to its own document, so a host that saves a merged payload can check that
|
|
487
|
-
payload with the same validator CED carries rather than loading a second copy. `kind` is read from
|
|
488
|
-
the artifact's `@type` when omitted. Calling it changes nothing in the designer.
|
|
489
|
-
|
|
490
|
-
Set `designer.readOnly` when the user may not change the document. Nothing in it can
|
|
491
|
-
then be edited and `canSave` is false. CED also marks none of the document's
|
|
492
|
-
problems, since a reader can fix none of them. `validationReport` still lists them,
|
|
493
|
-
so a host can tell why the document would not save.
|
|
494
|
-
|
|
495
|
-
CED marks affected cards and Overview entries, including ancestor elements, and
|
|
496
|
-
provides a summary linking to the relevant settings. One coordinator retains rejected
|
|
497
|
-
settings, retries them when related values change, and supplies the report to every
|
|
498
|
-
panel. Correcting or clearing an edit removes its issue; deleting an item, hiding an
|
|
499
|
-
inapplicable setting, or loading another document removes its pending issues.
|
|
500
|
-
Schema-valid input can still contain authoring errors. Imported JSON preserves
|
|
501
|
-
numeric and temporal defaults that conflict with their constraints so they can be
|
|
502
|
-
repaired; invalid IRI defaults are reported before any settings panel opens.
|
|
503
|
-
Independent errors are reported together, including children nested several levels
|
|
504
|
-
deep. The summary opens collapsed ancestors and the affected setting. Invalid
|
|
505
|
-
supplied defaults remain visible and can be cleared even without the optional CEF
|
|
506
|
-
control. Pending-only edits count as dirty. Terminology replies are ignored after
|
|
507
|
-
an intervening edit, replacement, cancellation, or destruction of their control.
|
|
508
|
-
Invalid imported children can be repaired independently. If the document cannot be
|
|
509
|
-
serialized, the preview explains why it is unavailable and resumes after repair;
|
|
510
|
-
artifact change events wait until serialization succeeds.
|
|
511
|
-
The wrapper remains responsible for saving and can display
|
|
512
|
-
the report when a save is attempted.
|
|
513
|
-
|
|
514
|
-
## Adding existing fields and elements
|
|
515
|
-
|
|
516
|
-
**Add Child** retains the field-type popup and offers **Select existing fields and elements**.
|
|
517
|
-
The selector stages one or more results in an upper table, with a bin to remove each
|
|
518
|
-
selection and Done/Cancel beside the table. Search results below show name, artifact
|
|
519
|
-
type, created and modified dates, version and status. Done loads the complete batch
|
|
520
|
-
before inserting it at the chosen position; Cancel leaves the document unchanged.
|
|
521
|
-
A published source is linked: it keeps its identifier, version, metadata and
|
|
522
|
-
descendants, and its definition stays locked. A draft source arrives as a copy with an
|
|
523
|
-
identifier of its own. The copy's `pav:derivedFrom` names the version it was loaded
|
|
524
|
-
from, and its own version line starts at 0.0.1. Duplicate child names receive a unique
|
|
525
|
-
placement name without renaming the reusable definition.
|
|
526
|
-
|
|
527
|
-
The embedding host supplies `designer.childSource`, implementing the exported
|
|
528
|
-
`CedChildSource` interface. `search(query, { signal, cursor })` returns
|
|
529
|
-
`{ results, nextCursor? }`; each result has `id`, `name`, `type` (`field` or `element`)
|
|
530
|
-
and optional `createdOn`, `modifiedOn` (ISO dates), `version`, and `status` (display
|
|
531
|
-
label). `load(result, { signal })` returns that artifact's full CEDAR JSON-LD.
|
|
532
|
-
The host owns authentication, permission filtering and repository URL selection.
|
|
533
|
-
An omitted source shows an unavailable message; CED has no default repository.
|
|
534
|
-
Replacing `childSource` closes the selector and cancels pending work. Search requests
|
|
535
|
-
and artifact loads receive abort signals, and late replies cannot change a closed
|
|
536
|
-
selector or a replacement document. Both popup and library-sidebar layouts expose
|
|
537
|
-
the selector.
|
|
538
|
-
|
|
539
|
-
### Versions of Reused Children
|
|
540
|
-
|
|
541
|
-
Every field, element and template has a **Version** tab. It shows the version, the
|
|
542
|
-
publication status, the version it was derived from and its previous version, none of
|
|
543
|
-
which the Metadata tab shows any longer, and how the child relates to stored
|
|
544
|
-
artifacts. The header of a template or element shows its version but never edits it. A child made in the document is local and unversioned. A linked
|
|
545
|
-
child is a published artifact embedded as itself. A copy names the stored version it
|
|
546
|
-
came from. A child inside a linked element belongs to that element and changes only
|
|
547
|
-
when the element is upgraded. The tab offers only the actions that are possible, so it
|
|
548
|
-
may offer none.
|
|
549
|
-
|
|
550
|
-
The actions depend on four optional `CedChildSource` methods. A host that omits one
|
|
551
|
-
loses only the actions that need it.
|
|
552
|
-
|
|
553
|
-
- `versions(reference, { signal })` returns every version of the referenced artifact's
|
|
554
|
-
version line that the user can read, newest first, or `null` when the artifact
|
|
555
|
-
cannot be read. The tab asks when it opens. A linked child is offered the newest
|
|
556
|
-
published version as an upgrade, and a copy is offered its origin's newest published
|
|
557
|
-
version as a replacement. Neither can be replaced with a draft; when no published
|
|
558
|
-
version is available, no replacement is offered. Importing a draft still makes an
|
|
559
|
-
editable copy.
|
|
560
|
-
- `compatibility(current, candidate, { type, signal, document, replacement })` says whether every instance
|
|
561
|
-
that is valid under `current` stays valid under `candidate`. The upgrade and
|
|
562
|
-
replacement buttons name the verdict. The options include the full before/after parent,
|
|
563
|
-
with the exact occurrence and its preserved placement. Schema compatibility is distinct from checking
|
|
564
|
-
only currently stored instances. A breaking replacement requires an explicit
|
|
565
|
-
`invalidatedInstances: 0`; a missing, invalid or positive count does not permit it.
|
|
566
|
-
`compatible: null` explicitly means unknown. With an explicit zero it permits a manual
|
|
567
|
-
replacement without a compatibility label, and never enters Upgrade all compatible.
|
|
568
|
-
Contradictory answers, such as `compatible: true` with a positive count, also withhold
|
|
569
|
-
replacement. A document edit retires the assessment, including edits to siblings or
|
|
570
|
-
placement, and an active Version tab checks again. Each refresh reloads its candidate;
|
|
571
|
-
replacement uses the exact snapshot that was assessed. Without this method, manual
|
|
572
|
-
replacements carry no verdict and are excluded from Upgrade all compatible. The host
|
|
573
|
-
must enforce its update policy at save time, including concurrent instance creation.
|
|
574
|
-
- `save(artifact, { type, publish, signal })` stores a child as a new reusable
|
|
575
|
-
artifact and returns it as stored. A published result is linked in the child's
|
|
576
|
-
place; a stored draft is copied, since only published artifacts are linked.
|
|
577
|
-
- `open(reference)` shows a stored artifact to the user.
|
|
578
|
-
|
|
579
|
-
Detaching a linked child turns it into an editable copy of the version it was. Only
|
|
580
|
-
the child changes identity: its published descendants stay linked. Upgrading or
|
|
581
|
-
replacing a child keeps its key, labels, requirement, multiplicity and property. The
|
|
582
|
-
template's own Version tab lists every linked and copied child with what its lookup
|
|
583
|
-
found, and upgrades all the compatible ones in one step. A published template offers
|
|
584
|
-
no upgrades until it has a new version.
|
|
585
|
-
|
|
586
|
-
```ts
|
|
587
|
-
import type { CedChildSource, CedJsonObject } from 'cedar-embeddable-designer';
|
|
588
|
-
|
|
589
|
-
declare function readJson(url: string, signal: AbortSignal): Promise<CedJsonObject>;
|
|
590
|
-
|
|
591
|
-
export const childSource: CedChildSource = {
|
|
592
|
-
search: async () => ({ results: [] }),
|
|
593
|
-
load: (result, { signal }) => readJson(result.id, signal),
|
|
594
|
-
versions: async (reference, { signal }) => {
|
|
595
|
-
const response = await fetch(`/versions?id=${encodeURIComponent(reference.id)}`, { signal });
|
|
596
|
-
if (response.status === 403 || response.status === 404) return null;
|
|
597
|
-
if (!response.ok) throw new Error(`Version lookup failed (${response.status}).`);
|
|
598
|
-
return response.json();
|
|
599
|
-
},
|
|
600
|
-
};
|
|
601
|
-
```
|
|
188
|
+
Omit the type to show the field-type chooser. CEFD shares the loading, validation,
|
|
189
|
+
change, recovery, and read-only APIs. It edits the field definition; its placement
|
|
190
|
+
inside a parent, including requirement and repetition, is configured in CED.
|
|
191
|
+
[Designing a Single Field](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-designer/field-designer/)
|
|
192
|
+
covers the complete workflow.
|
|
602
193
|
|
|
603
|
-
|
|
194
|
+
## Appearance and Language
|
|
604
195
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
This translation belongs to the demo host adapter and leaves the REST API unchanged.
|
|
610
|
-
The loopback-only demo server signs in to local Keycloak on port 8080 as
|
|
611
|
-
`test1@test.com` and reads fields and elements through the resource server on port 9007. It caches and renews the short-lived token in server memory. Only search and
|
|
612
|
-
artifact reads are exposed; adding children changes the designer document locally.
|
|
613
|
-
The fixed test account and endpoints belong to this development server, not the
|
|
614
|
-
published CED component. The component's `childSource` input still belongs to its host.
|
|
196
|
+
Both elements support English (`en`) and Hungarian (`hu`) through the `language`
|
|
197
|
+
property or attribute. English is the default. Language can change at runtime
|
|
198
|
+
and applies independently to each instance. Author-written content is never
|
|
199
|
+
translated.
|
|
615
200
|
|
|
616
|
-
The
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
201
|
+
The components use Shadow DOM and CEDAR's shared design tokens. See
|
|
202
|
+
[Configuration and Appearance](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-designer/configuration/)
|
|
203
|
+
for framework integration, service requirements, fonts, and host security, and
|
|
204
|
+
the [shared styling guide](https://github.com/metadatacenter/cedar-embeddable-editor/blob/develop/STYLING.md)
|
|
205
|
+
for the common CEDAR control contract.
|
|
621
206
|
|
|
622
|
-
|
|
207
|
+
## Developing the Component
|
|
623
208
|
|
|
624
|
-
|
|
209
|
+
For source builds, use the Node version in `.nvmrc`:
|
|
625
210
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
211
|
+
```shell
|
|
212
|
+
nvm use
|
|
213
|
+
npm ci
|
|
214
|
+
npm run dist
|
|
215
|
+
```
|
|
630
216
|
|
|
631
|
-
|
|
632
|
-
|
|
217
|
+
`npm start` runs the development host. `npm run test:ci` runs the complete gate,
|
|
218
|
+
including browser and visual checks. These are contributor commands; embedding
|
|
219
|
+
the published package requires no component build.
|
|
633
220
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
```
|
|
221
|
+
[Development notes](https://github.com/metadatacenter/cedar-embeddable-designer/blob/develop/docs/development.md)
|
|
222
|
+
cover sibling integration, demos, testing, packaging, and styling ownership.
|
|
223
|
+
Within a CEDAR checkout, use `cedarcli build frontends` for a local source build
|
|
224
|
+
and deployment, or `cedarcli test frontends` for the source build and checks.
|
|
225
|
+
The reactor supplies current local dependencies automatically.
|
|
226
|
+
|
|
227
|
+
The package also includes `integration.mjs` for coordinated Angular host builds.
|
|
228
|
+
Its manifest records exact runtime requirements; ordinary embeds use the
|
|
229
|
+
self-contained script above.
|
|
230
|
+
|
|
231
|
+
## License
|
|
646
232
|
|
|
647
|
-
|
|
648
|
-
on invalid input while preserving the current edits. Successful loads and
|
|
649
|
-
`newArtifact()` reset `isDirty`; invalid settings drafts count as dirty too.
|
|
650
|
-
`validate()`, `validationReport`, `canSave` and `dirtyChange` let a host manage Save
|
|
651
|
-
and navigation. `currentArtifact` is null before type selection and can throw
|
|
652
|
-
while the draft is invalid; check `canSave` before reading it to save. Only valid
|
|
653
|
-
artifacts produce `artifactChange` events, so hosts must not treat the last event
|
|
654
|
-
as a substitute for checking the current validation state.
|
|
655
|
-
|
|
656
|
-
`readOnly` is host-controlled; published definitions remain read only even if the
|
|
657
|
-
host clears it. Configuration is accepted once per instance. Field artifacts
|
|
658
|
-
retain identity, metadata, constraints and provenance on round-trip. Placement
|
|
659
|
-
controls (property IRI, requiredness, repetition and container display overrides)
|
|
660
|
-
belong to CED and are absent from CEFD. Defaults, terminology, field labels,
|
|
661
|
-
language and annotations use the same controls as CED. All 26 field types are
|
|
662
|
-
supported; the chooser groups date/time under Temporal. CEFD takes the same
|
|
663
|
-
`language` property and attribute as CED.
|
|
664
|
-
|
|
665
|
-
The split Designer host uses CEFD for `/fields/create` and `/fields/edit/...`,
|
|
666
|
-
with the host's normal permissions, ETag saves and Workspace return navigation.
|
|
667
|
-
When developing against a newer CEFD than the pinned Nexus snapshot, explicitly
|
|
668
|
-
stage the local bundle using `CEDAR_CED_BUNDLE` in that host; a missing CEFD
|
|
669
|
-
registration reports an upgrade error rather than waiting indefinitely.
|
|
670
|
-
|
|
671
|
-
### Shared defaults during development
|
|
672
|
-
|
|
673
|
-
CED/CEFD use the shared 14px body type and standard 36px CEE control profile.
|
|
674
|
-
Control labels use regular weight; section headings and tabs use medium weight.
|
|
675
|
-
CED has no separate small-text exception. Native controls and
|
|
676
|
-
embedded CEF both honor inherited `--cedar-control-*` overrides. Service bases
|
|
677
|
-
are normalized once and forwarded identically to terminology and CEF; unknown
|
|
678
|
-
keys and wrong value types produce diagnostics without disabling valid siblings.
|
|
679
|
-
|
|
680
|
-
The control, spacing and font exports resolve from the exact Nexus token snapshot
|
|
681
|
-
in `package.json` and `package-lock.json`; a normal `npm ci` installs them. For
|
|
682
|
-
unpublished token development, run `cedarcli test frontends` or `cedarcli build frontends`;
|
|
683
|
-
the reactor automatically supplies the current local token package to both CEE and CED.
|
|
684
|
-
For registry-based CI, before pushing a consumer that needs
|
|
685
|
-
new exports, publish a new token snapshot, update both pins and verify a clean
|
|
686
|
-
`npm ci` build. The real-CEF integration workflow must also pin a CEE revision
|
|
687
|
-
that supports the adopted control profile.
|
|
688
|
-
|
|
689
|
-
### Styling ownership and remaining debt
|
|
690
|
-
|
|
691
|
-
Central `authoring` recipes own labels, controls, tables, settings-dialog structure
|
|
692
|
-
and density. Central `patterns` recipes own dialog surfaces; property, type and
|
|
693
|
-
default-term pickers share the same corners, border and shadow. `src/authoring.scss`
|
|
694
|
-
selects these surfaces without implementing another set of values.
|
|
695
|
-
|
|
696
|
-
Local rules are appropriate for card composition, nested-element indentation,
|
|
697
|
-
sidebar resizing, drag handles, picker bounds and responsive placement. Syntax
|
|
698
|
-
highlighting owns a content palette, and the demo host deliberately uses different
|
|
699
|
-
styles to test embedding. Those are not reasons to duplicate control typography,
|
|
700
|
-
theme colors, focus rings or dialog geometry.
|
|
701
|
-
|
|
702
|
-
The adoption baseline still contains migration debt: outline, toolbar, glyph and
|
|
703
|
-
badge measurements, sidebar resizing geometry, two stacking indices and one hover
|
|
704
|
-
treatment. The token gate admits no exceptions, so a finding leaves the baseline
|
|
705
|
-
only when a shared role, a recipe or a designer size in the tokens package's
|
|
706
|
-
`spacing` export replaces it. Keep resolved entries pruned, document any necessary
|
|
707
|
-
local rule at its owner, and retain desktop/narrow-width, host-override and real-CEF
|
|
708
|
-
checks. Do not substitute an unrelated token merely because its current numeric
|
|
709
|
-
value happens to match.
|
|
710
|
-
|
|
711
|
-
### Recovering unfinished work
|
|
712
|
-
|
|
713
|
-
`captureDraft()` returns a JSON-serializable `CedRecoveryDraft` for either Designer
|
|
714
|
-
or Field Designer. It includes unfinished control input, pending validation gates,
|
|
715
|
-
the document and its clean baseline. It is a recovery file, not a CEDAR artifact:
|
|
716
|
-
use `currentArtifact` only after validation permits saving to the server.
|
|
717
|
-
|
|
718
|
-
`restoreDraft(draft)` validates the complete snapshot before replacing the current
|
|
719
|
-
session and throws on malformed or incompatible input. The host's current read-only
|
|
720
|
-
policy remains in force. Restored asynchronous checks must be retried at their
|
|
721
|
-
controls. A host owns storage, account/deployment isolation, download/import UI and
|
|
722
|
-
fresh permission/revision checks; restoring a snapshot never authorizes a write or
|
|
723
|
-
proves whether an interrupted save committed.
|
|
724
|
-
|
|
725
|
-
### Pattern validation and source preservation
|
|
726
|
-
|
|
727
|
-
Regular expressions use the shared ECMAScript policy: a full-string match with no flags,
|
|
728
|
-
evaluated in a bounded worker. Hosts must permit `worker-src blob:` or the existing validation
|
|
729
|
-
report explains that evaluation is unavailable. `validationReport.pendingValidation` is present
|
|
730
|
-
while checks run; `valid` and `canSave` remain false, and `validationChange` reports completion.
|
|
731
|
-
A pending or rejected edit retains the author's input and accepted document. Changing or opening
|
|
732
|
-
a document cancels obsolete checks. Serialization itself preserves stored patterns and defaults;
|
|
733
|
-
validate before saving. JSON input is passed unchanged to the strict source parser, so Unicode
|
|
734
|
-
whitespace is never silently removed from imported source or stored identity.
|
|
735
|
-
|
|
736
|
-
### Coordinated host build
|
|
737
|
-
|
|
738
|
-
The package also includes `integration.mjs`, an AOT-compiled ES module with host fonts and external
|
|
739
|
-
Angular, RxJS, translation and model dependencies. It is an input to a coordinated Angular application
|
|
740
|
-
build, not a script to load directly in a browser. `integration-manifest.json` records its digest and
|
|
741
|
-
exact runtime versions (including the model content digest); the host must verify those identities
|
|
742
|
-
before combining components. The Template Designer demonstrates this build.
|
|
743
|
-
|
|
744
|
-
The default package entry, standalone script, host-fonts script and public element APIs are unchanged.
|
|
745
|
-
Standalone consumers do not need to install Angular or change their embedding code.
|
|
233
|
+
[BSD 2-Clause](https://github.com/metadatacenter/cedar-embeddable-designer/blob/develop/license.txt).
|