@sentropic/design-system-elements 0.0.0-stage → 0.1.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 +146 -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-BgsZGo7n.js +8 -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,147 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sentropic/design-system-elements
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JSON-render standard, lot L2: thin Svelte custom-element wrappers over the
|
|
4
|
+
catalogue components of the sentropic design system. One ESM browser bundle
|
|
5
|
+
registers three elements:
|
|
6
|
+
|
|
7
|
+
| Element | Catalogue component | Engine chunk (§6.6) |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `<st-bar-chart>` | `BarChart` | none — in the core chunk |
|
|
10
|
+
| `<st-bpmn-canvas>` | `BpmnCanvas` | `chunks/bpmn-canvas-*.js` (lazy, first mount) |
|
|
11
|
+
| `<st-decision-dossier>` | `DecisionDossier` | `chunks/focus-renderer-*.js` (lazy, first mount) |
|
|
12
|
+
|
|
13
|
+
Each wrapper: shadow DOM `open`, envelope validation through the L1
|
|
14
|
+
validator, the §4.5 error panel on refusal (never a blank element), props
|
|
15
|
+
mapping to the underlying component, and component callbacks translated to
|
|
16
|
+
§4.6 `st-intent` events. Every component in the bundle is compiled with
|
|
17
|
+
`css: "injected"` (§6.2 known risk: styles ship inside the chunk).
|
|
18
|
+
|
|
19
|
+
## Using the elements
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<script type="module" src="/…/elements.js"></script>
|
|
23
|
+
|
|
24
|
+
<!-- envelope as a child data island -->
|
|
25
|
+
<st-bar-chart id="chart">
|
|
26
|
+
<script type="application/json">{ "root": { "component": "BarChart", "id": "q1", "label": "Revenue (M€)", "data": [ { "label": "Q1", "value": 12 } ] } }</script>
|
|
27
|
+
</st-bar-chart>
|
|
28
|
+
|
|
29
|
+
<!-- or the envelope as a JS property -->
|
|
30
|
+
<script type="module">
|
|
31
|
+
const chart = document.getElementById("chart");
|
|
32
|
+
chart.envelope = { root: { component: "BarChart", id: "q1", data: [ { "label": "Q1", "value": 12 } ] } };
|
|
33
|
+
</script>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Wrapper API
|
|
37
|
+
|
|
38
|
+
| Member | Channel | Meaning |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| `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. |
|
|
41
|
+
| `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. |
|
|
42
|
+
| `state` | getter | `"idle" \| "rendering" \| "rendered" \| "refused"` |
|
|
43
|
+
| `diagnostics` | getter | The validator's diagnostics of the last ingest (`{ code, path, message, severity, … }[]`). |
|
|
44
|
+
| `ready` | getter | A `Promise<void>` that settles (never rejects) the first time the element reaches `rendered` or `refused`. |
|
|
45
|
+
|
|
46
|
+
Property semantics: an `envelope` (or `hostConfig`) assigned on the element
|
|
47
|
+
BEFORE the custom element is defined is picked up at definition time; an
|
|
48
|
+
assignment after that re-renders reactively. An invalid envelope never
|
|
49
|
+
throws — the element enters `refused` and lists the diagnostics in the
|
|
50
|
+
error panel.
|
|
51
|
+
|
|
52
|
+
### `st-intent` (§4.6)
|
|
53
|
+
|
|
54
|
+
Component callbacks never escape the element (the envelope is data);
|
|
55
|
+
each wrapper maps them to one composed, bubbling `CustomEvent("st-intent")`
|
|
56
|
+
on the host element:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
interface IntentDetail {
|
|
60
|
+
event: "intent";
|
|
61
|
+
name: "select" | "choose-option";
|
|
62
|
+
target: string; // the catalogue key / option id
|
|
63
|
+
context: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Callback → intent mapping (AC-L2)
|
|
68
|
+
|
|
69
|
+
### `st-bar-chart` (`BarChart`)
|
|
70
|
+
|
|
71
|
+
| Component callback | Element behaviour |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `onSelect(key)` | `st-intent` `select`, `target = key` |
|
|
74
|
+
| `onSelectKey(key)` — keyboard activation | `st-intent` `select`, `target = key`; `null` key (no selected bar) dispatches nothing |
|
|
75
|
+
| `onHoverKeyChange(key)` | local state only — no intent (hover is not an §4.6 intent) |
|
|
76
|
+
|
|
77
|
+
### `st-decision-dossier` (`DecisionDossier`)
|
|
78
|
+
|
|
79
|
+
| Interaction | Element behaviour |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| 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 }` dispatches nothing |
|
|
82
|
+
|
|
83
|
+
### `st-bpmn-canvas` (`BpmnCanvas`)
|
|
84
|
+
|
|
85
|
+
The catalogue contract records no interactive callbacks for this component;
|
|
86
|
+
the element emits no intent. The canvas renders the envelope's BPMN document
|
|
87
|
+
(via the lazy `@sentropic/bpmn-canvas` engine); `assetBase` for its assets
|
|
88
|
+
comes from `hostConfig` (§6.5), never from a `data:` URI; the watermark
|
|
89
|
+
follows §13 (passed only in the `hostConfig` form the W4 guard accepts).
|
|
90
|
+
|
|
91
|
+
## Theme (§6.3)
|
|
92
|
+
|
|
93
|
+
The internal root carries `data-st-theme` (from `hostConfig.theme`, default
|
|
94
|
+
`sent-tech`) and `data-color-mode`; the theme stylesheet is adopted inside
|
|
95
|
+
the shadow root (`sent-tech` in the core chunk, `forge` / `entropic` as lazy
|
|
96
|
+
chunks). `--st-*` custom properties inherit through the shadow boundary;
|
|
97
|
+
the wrappers define no font of their own (the content inherits the page's).
|
|
98
|
+
|
|
99
|
+
## Build, sizes, integrity
|
|
100
|
+
|
|
101
|
+
`npm run build` runs the Node build and then the browser bundle, so
|
|
102
|
+
`dist/browser/` and `dist/browser/sri.json` are produced together
|
|
103
|
+
(`npm run build:browser` re-runs the bundle step alone). `sri.json` lists
|
|
104
|
+
every file with raw / gzip / brotli sizes and a sha384 integrity hash
|
|
105
|
+
(`sri.json` never lists itself). The §6.6 core budget — the entry closure
|
|
106
|
+
that renders `<st-bar-chart>` — is 53,916 B gzip of the 153,600 B budget
|
|
107
|
+
(re-measured at 0.1.0; 23 files pinned by `sri.json`).
|
|
108
|
+
The bundle is eval-free (§6.4: no `eval`, no `new Function` in any chunk —
|
|
109
|
+
enforced by `scripts/elements-browser-artifacts.test.mjs`), works mounted
|
|
110
|
+
under any subpath (no document-anchored preload hints), and needs no
|
|
111
|
+
per-chunk CSS assets.
|
|
112
|
+
|
|
113
|
+
## CDN (§7)
|
|
114
|
+
|
|
115
|
+
The published tarball is served from the CDN base with the exact version
|
|
116
|
+
pinned — never a range, never `latest` (the version segment is bumped with
|
|
117
|
+
each release):
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
https://cdn.jsdelivr.net/npm/@sentropic/design-system-elements@0.1.0/dist/browser/
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Load the entry with its integrity hash (the sha384 from
|
|
124
|
+
`dist/browser/sri.json`) and `crossorigin="anonymous"`:
|
|
125
|
+
|
|
126
|
+
```html
|
|
127
|
+
<script type="module"
|
|
128
|
+
src="https://cdn.jsdelivr.net/npm/@sentropic/design-system-elements@0.1.0/dist/browser/elements.js"
|
|
129
|
+
integrity="sha384-<hash from dist/browser/sri.json>"
|
|
130
|
+
crossorigin="anonymous"></script>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Lazy chunks resolve module-relative to that base, so the whole
|
|
134
|
+
`dist/browser/` tree must be served, not the entry alone. SRI limit: the
|
|
135
|
+
entry hash above is browser-enforced; the chunk hashes in `sri.json` are the
|
|
136
|
+
audit pin a host or reviewer recomputes — `scripts/elements-publish-tarball.test.mjs`
|
|
137
|
+
is that recomputation against the tarball bytes. For the h2a consumer the
|
|
138
|
+
CDN is an optimisation; the inlined module remains the fallback.
|
|
139
|
+
|
|
140
|
+
Further reading:
|
|
141
|
+
|
|
142
|
+
- `docs/json-render-comparison.md` — the §6.2 comparison against
|
|
143
|
+
`@json-render` (not adopted).
|
|
144
|
+
- `tests/browser/chromium-suite.mjs` — the offline Chromium suite: CSP rows,
|
|
145
|
+
P-DATA parity, computed-style parity, lazy-chunk boundary.
|
|
146
|
+
- `catalog.json` / `envelope.json` — the L1 catalogue and envelope schemas
|
|
147
|
+
the validator runs (A2UI v0.9.1).
|