@sentropic/design-system-elements 0.0.0-stage → 0.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/LICENSE +21 -0
- package/LICENSE.THIRD-PARTY.md +4734 -0
- package/README.md +189 -2
- package/catalog.json +1234 -0
- package/dist/browser/assets/bpmn-CZlEAdL6.ttf +0 -0
- package/dist/browser/assets/bpmn-DaGVGZ7K.woff +0 -0
- package/dist/browser/assets/bpmn-DaJ2be00.woff2 +0 -0
- package/dist/browser/chunks/BpmnRenderUtil-WMCgqGDs.js +1 -0
- package/dist/browser/chunks/BpmnUpdater-C-UNbzXl.js +1 -0
- package/dist/browser/chunks/LabelUtil-7QpE43Ed.js +1 -0
- package/dist/browser/chunks/LayoutUtil-hAMJmJFU.js +1 -0
- package/dist/browser/chunks/ModelUtil-CMh7LuN4.js +1 -0
- package/dist/browser/chunks/Modeler-BfAmwsmK.js +389 -0
- package/dist/browser/chunks/Viewer-eYLzc3fD.js +4 -0
- package/dist/browser/chunks/bpmn-canvas-DeAWdJFy.js +2207 -0
- package/dist/browser/chunks/colored-CSIQaGsQ.js +1 -0
- package/dist/browser/chunks/dist-Co2MgHWm.js +1 -0
- package/dist/browser/chunks/dist-O6_2ByYB.js +1 -0
- package/dist/browser/chunks/dist-kvAYI1vo.js +1 -0
- package/dist/browser/chunks/entropic-CM5BHERN.js +2173 -0
- package/dist/browser/chunks/focus-renderer-0elVToA2.js +10 -0
- package/dist/browser/chunks/forge-B8hrW4lA.js +2173 -0
- package/dist/browser/chunks/layout-q0TR9-aY.js +1 -0
- package/dist/browser/chunks/legend-CXdfCBh6.js +1 -0
- package/dist/browser/chunks/textMetrics-BrMS6-sA.js +2 -0
- package/dist/browser/chunks/tokens-DFPpCvf1.js +1 -0
- package/dist/browser/elements.js +2221 -0
- package/dist/browser/sri.json +166 -0
- package/dist/contracts/bar-chart.d.ts +158 -0
- package/dist/contracts/bar-chart.js +117 -0
- package/dist/contracts/bpmn-canvas.d.ts +39 -0
- package/dist/contracts/bpmn-canvas.js +77 -0
- package/dist/contracts/decision-dossier.d.ts +43 -0
- package/dist/contracts/decision-dossier.js +133 -0
- package/dist/contracts/index.d.ts +28 -0
- package/dist/contracts/index.js +35 -0
- package/dist/contracts/types.d.ts +129 -0
- package/dist/contracts/types.js +16 -0
- package/dist/element/f1/f1-to-xml.d.ts +51 -0
- package/dist/element/f1/f1-to-xml.js +220 -0
- package/dist/element/markdown/minimal-markdown.d.ts +31 -0
- package/dist/element/markdown/minimal-markdown.js +98 -0
- package/dist/element/theme/theme-scoping.d.ts +27 -0
- package/dist/element/theme/theme-scoping.js +39 -0
- package/dist/generated/a2ui-common-types.d.ts +25 -0
- package/dist/generated/a2ui-common-types.js +367 -0
- package/dist/generator/canonical.d.ts +21 -0
- package/dist/generator/canonical.js +36 -0
- package/dist/generator/emit.d.ts +48 -0
- package/dist/generator/emit.js +400 -0
- package/dist/generator/main.d.ts +19 -0
- package/dist/generator/main.js +67 -0
- package/dist/generator/parity.d.ts +55 -0
- package/dist/generator/parity.js +223 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10 -0
- package/dist/ports/bpmn-canvas.d.ts +34 -0
- package/dist/ports/bpmn-canvas.js +36 -0
- package/dist/ports/focus.d.ts +40 -0
- package/dist/ports/focus.js +49 -0
- package/dist/ports/types.d.ts +36 -0
- package/dist/ports/types.js +12 -0
- package/dist/structure/ajv.d.ts +41 -0
- package/dist/structure/ajv.js +108 -0
- package/dist/structure/interpreter.d.ts +47 -0
- package/dist/structure/interpreter.js +576 -0
- package/dist/validate/diagnostics.d.ts +63 -0
- package/dist/validate/diagnostics.js +56 -0
- package/dist/validate/envelope.d.ts +92 -0
- package/dist/validate/envelope.js +306 -0
- package/dist/validate/index.d.ts +22 -0
- package/dist/validate/index.js +24 -0
- package/dist/validate/structure.d.ts +32 -0
- package/dist/validate/structure.js +13 -0
- package/envelope.json +43 -0
- package/package.json +54 -4
- package/schemas/BarChart.v1.json +556 -0
- package/schemas/BpmnCanvas.v1.json +139 -0
- package/schemas/DecisionDossier.v1.json +635 -0
package/README.md
CHANGED
|
@@ -1,3 +1,190 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sentropic/design-system-elements
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JSON-render standard, lots L2/L6: thin Svelte custom-element wrappers over the
|
|
4
|
+
catalogue components of the sentropic design system. One ESM browser bundle
|
|
5
|
+
registers three elements (lot L6 imposes the Focus renderer defaults
|
|
6
|
+
F-R0–F-R7 on the dossier engine chunk; see below):
|
|
7
|
+
|
|
8
|
+
| Element | Catalogue component | Engine chunk (§6.6) |
|
|
9
|
+
| --- | --- | --- |
|
|
10
|
+
| `<st-bar-chart>` | `BarChart` | none — in the core chunk |
|
|
11
|
+
| `<st-bpmn-canvas>` | `BpmnCanvas` | `chunks/bpmn-canvas-*.js` (lazy, first mount) |
|
|
12
|
+
| `<st-decision-dossier>` | `DecisionDossier` | `chunks/focus-renderer-*.js` (lazy, first mount) |
|
|
13
|
+
|
|
14
|
+
Each wrapper: shadow DOM `open`, envelope validation through the L1
|
|
15
|
+
validator, the §4.5 error panel on refusal (never a blank element), props
|
|
16
|
+
mapping to the underlying component, and component callbacks translated to
|
|
17
|
+
§4.6 `st-intent` events. Every component in the bundle is compiled with
|
|
18
|
+
`css: "injected"` (§6.2 known risk: styles ship inside the chunk).
|
|
19
|
+
|
|
20
|
+
## Using the elements
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<script type="module" src="/…/elements.js"></script>
|
|
24
|
+
|
|
25
|
+
<!-- envelope as a child data island -->
|
|
26
|
+
<st-bar-chart id="chart">
|
|
27
|
+
<script type="application/json">{ "root": { "component": "BarChart", "id": "q1", "label": "Revenue (M€)", "data": [ { "label": "Q1", "value": 12 } ] } }</script>
|
|
28
|
+
</st-bar-chart>
|
|
29
|
+
|
|
30
|
+
<!-- or the envelope as a JS property -->
|
|
31
|
+
<script type="module">
|
|
32
|
+
const chart = document.getElementById("chart");
|
|
33
|
+
chart.envelope = { root: { component: "BarChart", id: "q1", data: [ { "label": "Q1", "value": 12 } ] } };
|
|
34
|
+
</script>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Wrapper API
|
|
38
|
+
|
|
39
|
+
| Member | Channel | Meaning |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `envelope` | JS property, or the first child `<script type="application/json">` (re-read through a MutationObserver when the island is replaced) | The render envelope. No attribute ever carries data (§6.2). A malformed island reaches the validator as raw text and is refused with a diagnostic — the panel shows it. |
|
|
42
|
+
| `hostConfig` | JS property, or the page-level `<script type="application/json" id="st-host-config">` island | Host configuration (§6.5): `{ theme?, colorScheme?, locale?, assetBase?, bpmn?: { watermark?: { hidden?, license? } } }`. The theme id is never taken from the envelope. |
|
|
43
|
+
| `state` | getter | `"idle" \| "rendering" \| "rendered" \| "refused"` |
|
|
44
|
+
| `diagnostics` | getter | The validator's diagnostics of the last ingest (`{ code, path, message, severity, … }[]`). |
|
|
45
|
+
| `ready` | getter | A `Promise<void>` that settles (never rejects) the first time the element reaches `rendered` or `refused`. |
|
|
46
|
+
|
|
47
|
+
Property semantics: an `envelope` (or `hostConfig`) assigned on the element
|
|
48
|
+
BEFORE the custom element is defined is picked up at definition time; an
|
|
49
|
+
assignment after that re-renders reactively. An invalid envelope never
|
|
50
|
+
throws — the element enters `refused` and lists the diagnostics in the
|
|
51
|
+
error panel.
|
|
52
|
+
|
|
53
|
+
### `st-intent` (§4.6)
|
|
54
|
+
|
|
55
|
+
Component callbacks never escape the element (the envelope is data);
|
|
56
|
+
each wrapper maps them to one composed, bubbling `CustomEvent("st-intent")`
|
|
57
|
+
on the host element:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
interface IntentDetail {
|
|
61
|
+
event: "intent";
|
|
62
|
+
name: "select" | "choose-option";
|
|
63
|
+
target: string; // the catalogue key / option id
|
|
64
|
+
context: Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Callback → intent mapping (AC-L2)
|
|
69
|
+
|
|
70
|
+
### `st-bar-chart` (`BarChart`)
|
|
71
|
+
|
|
72
|
+
| Component callback | Element behaviour |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `onSelect(key)` | `st-intent` `select`, `target = key` |
|
|
75
|
+
| `onSelectKey(key)` — keyboard activation | `st-intent` `select`, `target = key`; `null` key (no selected bar) dispatches nothing |
|
|
76
|
+
| `onHoverKeyChange(key)` | local state only — no intent (hover is not an §4.6 intent) |
|
|
77
|
+
|
|
78
|
+
### `st-decision-dossier` (`DecisionDossier`)
|
|
79
|
+
|
|
80
|
+
| Interaction | Element behaviour |
|
|
81
|
+
| --- | --- |
|
|
82
|
+
| option card click / keyboard activation (when enabled) | `st-intent` `choose-option`, `target = <option id>`; an option gated inert by an `interactions` entry `{ name: "choose-option", targetRef, enabled: false }` renders as an inert card and dispatches nothing |
|
|
83
|
+
| card click again / another card (single-selection rule) | local renderer state only: reselecting clears the card with no emission, choosing another card moves the selection with one emission; the envelope and the document are never written back |
|
|
84
|
+
| expand control on a long card | toggles the folded argument, emits nothing, never selects |
|
|
85
|
+
|
|
86
|
+
### Dossier renderer defaults (F-R0–F-R7, lot L6)
|
|
87
|
+
|
|
88
|
+
The `focus-renderer` chunk (`src/element/dom/engines/focus-renderer.ts` plus
|
|
89
|
+
its stylesheet `dossier-styles.ts`) imposes the §11.2 defaults; the author
|
|
90
|
+
cannot work around them:
|
|
91
|
+
|
|
92
|
+
- F-R0: no author layout property exists anywhere — a `layout` hint at
|
|
93
|
+
`root` level is refused by the catalogue structure and one inside the
|
|
94
|
+
document by the embedded focus schema, both with `schema-violation`
|
|
95
|
+
(§4.5 panel, never a partial dossier).
|
|
96
|
+
- F-R1: the whole option card is the single selection control (one node
|
|
97
|
+
carries both `data-option-card` and `data-option-id`).
|
|
98
|
+
- F-R2: card outlines are `1px solid var(--st-…)`; every colour resolves to
|
|
99
|
+
a `--st-*` token and no rule exceeds 1 px (static scan in
|
|
100
|
+
`tests/focus-renderer-l6.test.ts`, computed scan in
|
|
101
|
+
`tests/browser/chromium-suite.mjs`).
|
|
102
|
+
- F-R3: selection is a light local state (1 px outline change and/or token
|
|
103
|
+
tint, no layout shift); F-R7: nothing is ever preselected, not even the
|
|
104
|
+
recommended option.
|
|
105
|
+
- F-R4: an argument over 300 characters (the option `body`, else its
|
|
106
|
+
label-plus-consequence text) renders collapsed with a labelled expand
|
|
107
|
+
control; shorter arguments render fully with no fold control.
|
|
108
|
+
- F-R5: the renderer alone picks `list` (any long option, or one or two
|
|
109
|
+
options) or `grid` (three or more short options, capped at two columns),
|
|
110
|
+
exposed as `data-st-layout` (`decideOptionSetLayout`).
|
|
111
|
+
- F-R6: annotations render as display state only — no per-option control
|
|
112
|
+
besides the card (and the fold control on long cards).
|
|
113
|
+
- F-R7: the recommended option carries one discreet badge; an unmatched
|
|
114
|
+
`recommendedAnswer` renders as question context text, never as a
|
|
115
|
+
preselection.
|
|
116
|
+
|
|
117
|
+
Content parity with the owner `renderHtml` is witnessed on the
|
|
118
|
+
presentation-valid fixtures (`tests/focus-renderer-l6.test.ts`); inputs the
|
|
119
|
+
owner presentation gate refuses (long bodies, legacy documents) still render
|
|
120
|
+
their sections, ids and outcome from the input. Diagrams render as the
|
|
121
|
+
fenced fallback until a diagram renderer exists.
|
|
122
|
+
|
|
123
|
+
### `st-bpmn-canvas` (`BpmnCanvas`)
|
|
124
|
+
|
|
125
|
+
The catalogue contract records no interactive callbacks for this component;
|
|
126
|
+
the element emits no intent. The canvas renders the envelope's BPMN document
|
|
127
|
+
(via the lazy `@sentropic/bpmn-canvas` engine); `assetBase` for its assets
|
|
128
|
+
comes from `hostConfig` (§6.5), never from a `data:` URI; the watermark
|
|
129
|
+
follows §13 (passed only in the `hostConfig` form the W4 guard accepts).
|
|
130
|
+
|
|
131
|
+
## Theme (§6.3)
|
|
132
|
+
|
|
133
|
+
The internal root carries `data-st-theme` (from `hostConfig.theme`, default
|
|
134
|
+
`sent-tech`) and `data-color-mode`; the theme stylesheet is adopted inside
|
|
135
|
+
the shadow root (`sent-tech` in the core chunk, `forge` / `entropic` as lazy
|
|
136
|
+
chunks). `--st-*` custom properties inherit through the shadow boundary;
|
|
137
|
+
the wrappers define no font of their own (the content inherits the page's).
|
|
138
|
+
|
|
139
|
+
## Build, sizes, integrity
|
|
140
|
+
|
|
141
|
+
`npm run build` runs the Node build and then the browser bundle, so
|
|
142
|
+
`dist/browser/` and `dist/browser/sri.json` are produced together
|
|
143
|
+
(`npm run build:browser` re-runs the bundle step alone). `sri.json` lists
|
|
144
|
+
every file with raw / gzip / brotli sizes and a sha384 integrity hash
|
|
145
|
+
(`sri.json` never lists itself). The §6.6 core budget — the entry closure
|
|
146
|
+
that renders `<st-bar-chart>` — is 53,920 B gzip of the 153,600 B budget
|
|
147
|
+
(53,919 B at L7a, +1 B rebuild variance; 23 files pinned by `sri.json`).
|
|
148
|
+
The L6 `focus` chunk is 21,174 B gzip (19,073 B at L7a, +2,101 B for the
|
|
149
|
+
stylesheet, fold/layout and selection logic); core + focus raw bytes stay
|
|
150
|
+
far under the §8.3 2 MiB `ui://` resource budget.
|
|
151
|
+
The bundle is eval-free (§6.4: no `eval`, no `new Function` in any chunk —
|
|
152
|
+
enforced by `scripts/elements-browser-artifacts.test.mjs`), works mounted
|
|
153
|
+
under any subpath (no document-anchored preload hints), and needs no
|
|
154
|
+
per-chunk CSS assets.
|
|
155
|
+
|
|
156
|
+
## CDN (§7)
|
|
157
|
+
|
|
158
|
+
The published tarball is served from the CDN base with the exact version
|
|
159
|
+
pinned — never a range, never `latest` (the version segment is bumped with
|
|
160
|
+
each release):
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
https://cdn.jsdelivr.net/npm/@sentropic/design-system-elements@0.2.0/dist/browser/
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Load the entry with its integrity hash (the sha384 from
|
|
167
|
+
`dist/browser/sri.json`) and `crossorigin="anonymous"`:
|
|
168
|
+
|
|
169
|
+
```html
|
|
170
|
+
<script type="module"
|
|
171
|
+
src="https://cdn.jsdelivr.net/npm/@sentropic/design-system-elements@0.2.0/dist/browser/elements.js"
|
|
172
|
+
integrity="sha384-<hash from dist/browser/sri.json>"
|
|
173
|
+
crossorigin="anonymous"></script>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Lazy chunks resolve module-relative to that base, so the whole
|
|
177
|
+
`dist/browser/` tree must be served, not the entry alone. SRI limit: the
|
|
178
|
+
entry hash above is browser-enforced; the chunk hashes in `sri.json` are the
|
|
179
|
+
audit pin a host or reviewer recomputes — `scripts/elements-publish-tarball.test.mjs`
|
|
180
|
+
is that recomputation against the tarball bytes. For the h2a consumer the
|
|
181
|
+
CDN is an optimisation; the inlined module remains the fallback.
|
|
182
|
+
|
|
183
|
+
Further reading:
|
|
184
|
+
|
|
185
|
+
- `docs/json-render-comparison.md` — the §6.2 comparison against
|
|
186
|
+
`@json-render` (not adopted).
|
|
187
|
+
- `tests/browser/chromium-suite.mjs` — the offline Chromium suite: CSP rows,
|
|
188
|
+
P-DATA parity, computed-style parity, lazy-chunk boundary.
|
|
189
|
+
- `catalog.json` / `envelope.json` — the L1 catalogue and envelope schemas
|
|
190
|
+
the validator runs (A2UI v0.9.1).
|