cedar-embeddable-designer 0.1.3 → 0.1.4

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 CHANGED
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.4] - 2026-11-24
9
+
10
+ Aligns with `cedar-model-typescript-library@1.0.29`.
11
+
12
+ ### Added
13
+
14
+ - A `preferences` property and a `preferencesChange` event on `<cedar-embeddable-designer>`, with the `CedPreferences`, `CedPreferencesInput`, `CedPreset` and `CedPresetDefinition` types. A host can store an author's preferences and preset definitions and supply them to a later element. They previously lasted only as long as the element that held them.
15
+
16
+ ### Changed
17
+
18
+ - Searches terms by limit and offset rather than by page number, which the terminology server is withdrawing.
19
+ - Wraps long template, element and field names in their name controls rather than cutting them off, and shows the complete build version beside the CEDAR mark.
20
+ - Keeps the space for the insertion actions above a selected card on touch devices, so dismissing them or opening a picker does not move the card.
21
+ - Keeps the outline's reorder controls together at the minimum pane width, and keeps the focus ring of a disabled boundary action visible.
22
+
23
+ ### Removed
24
+
25
+ - The "Show Default Value field" preference, from Preferences and from Define Presets. No control has depended on it since default values joined a field's constraints, so every preset already showed them.
26
+
8
27
  ## [0.1.3] - 2026-11-19
9
28
 
10
29
  Aligns with `cedar-model-typescript-library@1.0.29`.
package/README.md CHANGED
@@ -191,6 +191,37 @@ inside a parent, including requirement and repetition, is configured in CED.
191
191
  [Designing a Single Field](https://metadatacenter.readthedocs.io/en/latest/cedar-embeddable-designer/field-designer/)
192
192
  covers the complete workflow.
193
193
 
194
+ ## Author Preferences
195
+
196
+ An author sets preferences from the designer's user menu. They select the field
197
+ settings and field types CED offers, the place of the field-type picker, and the
198
+ content of each preset configuration. CED keeps them in memory for one element.
199
+ To keep them longer, store the value each `preferencesChange` event carries and
200
+ assign it to `preferences` on a later element:
201
+
202
+ ```typescript
203
+ import type { CedarEmbeddableDesignerElement, CedPreferences } from 'cedar-embeddable-designer';
204
+
205
+ const designer = document.createElement('cedar-embeddable-designer') as CedarEmbeddableDesignerElement;
206
+ const stored = localStorage.getItem('designer-preferences');
207
+ designer.preferences = stored ? (JSON.parse(stored) as CedPreferences) : null;
208
+ designer.addEventListener('preferencesChange', (event) => {
209
+ localStorage.setItem('designer-preferences', JSON.stringify(event.detail));
210
+ });
211
+ document.body.append(designer);
212
+ ```
213
+
214
+ The event carries the complete preferences after each change the author makes.
215
+ CED sends none at startup and none for the host's own assignment, so a host can
216
+ store every value it receives. An assignment replaces the preferences and can
217
+ come at any time. An omitted key takes its default and `null` restores every
218
+ default, so a value stored by an earlier version remains assignable. CED reports
219
+ a value it cannot use to the console, ignores it, and never throws.
220
+
221
+ Preferences change the controls CED offers and never the document. A field of a
222
+ hidden type, or an element while elements are switched off, stays in the
223
+ artifact. The field designer has no preferences.
224
+
194
225
  ## Appearance and Language
195
226
 
196
227
  Both elements support English (`en`) and Hungarian (`hu`) through the `language`
@@ -1,12 +1,12 @@
1
1
  {
2
- "bytes": 1895311,
3
- "sha256": "4fd2dcfcac16e84e5b3a83b5aa84dccde9d9442cf8f4369ac295d815ebb1051f",
2
+ "bytes": 1899602,
3
+ "sha256": "59e8c8b85ec6a2aa9229f9edfed793a9cdebaf7f71d223910c746bcc046d1cf9",
4
4
  "inputs": [
5
5
  "dist/cedar-embeddable-designer-host-fonts/browser/polyfills.js",
6
6
  "dist/cedar-embeddable-designer-host-fonts/browser/main.js"
7
7
  ],
8
8
  "provenance": {
9
- "source": "9bd0e0e5e91f09917da50dd889574ff35ff597131a9f18b56c43eb8b4fc2bfa9",
10
- "output": "2a2e32ce7cd143c46550920a75817b2233bfce1e89afcc2bf21ac74bbc625703"
9
+ "source": "ec3166efe3d51cd1c2a95477d4a2de9c9afcaa906ecca64f1af893315e615251",
10
+ "output": "ab2dfe345cc9f26a3b334ce973fca5de377e73c083f5e7802a821ca995d7af16"
11
11
  }
12
12
  }
@@ -1,12 +1,12 @@
1
1
  {
2
- "bytes": 2017963,
3
- "sha256": "bd016d290cd70bd1ccb1bbf05ceb82dc5e9f063826ea81791d6b362fc678c1dd",
2
+ "bytes": 2022254,
3
+ "sha256": "67697cd4300a4f9c071384163fc454ece9beda132f300d05ba903c9b573561e2",
4
4
  "inputs": [
5
5
  "dist/cedar-embeddable-designer/browser/polyfills.js",
6
6
  "dist/cedar-embeddable-designer/browser/main.js"
7
7
  ],
8
8
  "provenance": {
9
- "source": "9bd0e0e5e91f09917da50dd889574ff35ff597131a9f18b56c43eb8b4fc2bfa9",
10
- "output": "5fb3238789b3069f6ac706a20d8721f08bdabef4374ba2d3f21ddda5f8db97cc"
9
+ "source": "ec3166efe3d51cd1c2a95477d4a2de9c9afcaa906ecca64f1af893315e615251",
10
+ "output": "a09120b51b9af44f9069278771a481222be68af9ffcb600a73ccd066f86de20f"
11
11
  }
12
12
  }
@@ -51,6 +51,44 @@ export interface CedConfig {
51
51
  /** Base URL for external-authority default lookups through CEF. A missing trailing slash is normalized. */
52
52
  bridgeBaseUrl?: string;
53
53
  }
54
+ /** A preset the Preferences dialog offers. Choosing one sets every preference its definition holds. */
55
+ export type CedPreset = 'basic' | 'semantic' | 'modular';
56
+ /** The preferences one preset sets. */
57
+ export interface CedPresetDefinition {
58
+ /** Whether a field's settings offer the Required control. */
59
+ showRequired: boolean;
60
+ /** Whether a field's settings offer the Allow multiple control. */
61
+ showAllowMultiple: boolean;
62
+ /** Whether the designer offers to add an element. */
63
+ showElements: boolean;
64
+ /** The field types the type pickers leave out, in the order `CedFieldType` lists them. */
65
+ hiddenFieldTypes: CedFieldType[];
66
+ }
67
+ /**
68
+ * An author's preferences, as the designer reports them and as a host stores them.
69
+ *
70
+ * The designer keeps preferences in memory, for one element. A host that wants them to outlast
71
+ * the element stores the value `preferencesChange` carries and assigns it to `preferences` on a
72
+ * later element. The value is plain JSON, so `JSON.stringify` and `JSON.parse` carry it.
73
+ *
74
+ * A preference changes which controls the designer offers and never changes the document. A field
75
+ * of a hidden type or an element that an artifact already holds stays in it.
76
+ */
77
+ export interface CedPreferences extends CedPresetDefinition {
78
+ /** Where the author picks a field type: beside the insertion point, or in the library sidebar. */
79
+ fieldSelectionStyle: 'inline' | 'sidebar';
80
+ /** What each preset sets. The author can redefine a preset, so the definitions travel with the preferences. */
81
+ presets: Record<CedPreset, CedPresetDefinition>;
82
+ }
83
+ /**
84
+ * The preferences a host assigns.
85
+ *
86
+ * Every key is optional, and an omitted key takes the designer's default. A state stored by an
87
+ * earlier version therefore remains assignable after a later version adds a preference.
88
+ */
89
+ export interface CedPreferencesInput extends Partial<Omit<CedPreferences, 'presets'>> {
90
+ presets?: Partial<Record<CedPreset, Partial<CedPresetDefinition>>>;
91
+ }
54
92
  /** A JSON-serialisable value, as it appears in a CEDAR artifact. */
55
93
  /** Exact numeric artifact atom; use String(value) to inspect it without rounding. */
56
94
  export interface CedExactNumber {
@@ -93,6 +131,20 @@ export interface CedarEmbeddableDesignerElement extends HTMLElement {
93
131
  * editing, saving and inline authoring error markers are disabled.
94
132
  */
95
133
  readOnly: boolean;
134
+ /**
135
+ * The author's preferences. Reading the property returns the complete current state.
136
+ *
137
+ * An assignment replaces the state and may come at any time. An omitted key takes its default,
138
+ * and `null` restores every default. A value the designer cannot use is reported to the console
139
+ * and leaves the affected preference as it was or at its default; an assignment never throws.
140
+ */
141
+ get preferences(): CedPreferences;
142
+ set preferences(value: CedPreferencesInput | null);
143
+ /**
144
+ * The complete preferences after the author changes one of them or redefines a preset. An
145
+ * assignment to `preferences` is not reported back, and nothing is reported at startup.
146
+ */
147
+ addEventListener(type: 'preferencesChange', listener: (event: CustomEvent<CedPreferences>) => void, options?: boolean | AddEventListenerOptions): void;
96
148
  /** Host-owned repository search and artifact retrieval. Replaceable between documents. */
97
149
  childSource: CedChildSource | null;
98
150
  /** A template or element document. The legacy property name remains supported. */