@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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract module for `DecisionDossier` (§5.1, §5.4 — the composition pilot).
|
|
3
|
+
*
|
|
4
|
+
* SOURCE OF TRUTH: the `DecisionDossierDocument` of `@sentropic/focus`
|
|
5
|
+
* (owner decision 2026-10-30 on 0.5.0-rc.9, pinned at 0.5.0 once it reached `latest`:
|
|
6
|
+
* same files as rc.9 except package.json, same v1 schema sha256). The pin
|
|
7
|
+
* below records WHY v1: the package's `./validate` export validates legacy v1
|
|
8
|
+
* by default when `schemaVersion` is absent (its d.ts names the v1 asset as
|
|
9
|
+
* the published schema it matches, `DOSSIER_SCHEMA_VERSION = "1.0.0"`), while
|
|
10
|
+
* v2 requires an explicit `schemaVersion: 2` with a breaking evidence
|
|
11
|
+
* envelope. The catalogue therefore embeds the v1 schema
|
|
12
|
+
* (`@sentropic/focus/schemas/decision-dossier-document.v1.schema.json`,
|
|
13
|
+
* `$id` `urn:sentropic:focus:DecisionDossierDocument:1.0.0`) and routes
|
|
14
|
+
* semantics to `@sentropic/focus/validate` (§4.3 item 2, source "focus").
|
|
15
|
+
* The embedded copy is scoped to its host document — its internal
|
|
16
|
+
* `#/$defs/X` refs are rewritten to `#/$defs/DecisionDossierDocument/$defs/X`
|
|
17
|
+
* and its root `$id` dropped (the A2UI SDK's zod converter resolves `#/` refs
|
|
18
|
+
* against the host root); the urn identity stays in
|
|
19
|
+
* `x-sentropic.semantic.schemaId`.
|
|
20
|
+
*
|
|
21
|
+
* The generator fails if the installed schema file's sha256 no longer matches
|
|
22
|
+
* the pin. The `document` prop below is a MARKER type the emitter replaces
|
|
23
|
+
* with a `$ref` to the embedded schema — the declared replacement type for
|
|
24
|
+
* this prop, never an implicit `any`.
|
|
25
|
+
*/
|
|
26
|
+
/** The declared contract of `DecisionDossier` (§5.1, §11.2). */
|
|
27
|
+
export const decisionDossierContract = {
|
|
28
|
+
component: "DecisionDossier",
|
|
29
|
+
propsTypeName: "DecisionDossierProps",
|
|
30
|
+
source: {
|
|
31
|
+
packageName: "@sentropic/focus",
|
|
32
|
+
file: "schemas/decision-dossier-document.v1.schema.json",
|
|
33
|
+
typeName: "DecisionDossierDocument",
|
|
34
|
+
note: "Semantic documents reuse their owners' types (§5.1): the schema is embedded " +
|
|
35
|
+
"from the pinned package, not re-declared here.",
|
|
36
|
+
},
|
|
37
|
+
excluded: [],
|
|
38
|
+
replacedTypes: [
|
|
39
|
+
{
|
|
40
|
+
prop: "document",
|
|
41
|
+
sourceType: "DecisionDossierDocument (focus v1, urn:sentropic:focus:DecisionDossierDocument:1.0.0)",
|
|
42
|
+
replacement: "Embedded focus v1 JSON Schema under $defs.DecisionDossierDocument, referenced by " +
|
|
43
|
+
"$ref from the document property (marker type DecisionDossierDocumentRef). The " +
|
|
44
|
+
"embedded copy is scoped to its host: the root $id is dropped and every internal " +
|
|
45
|
+
"#/$defs/X ref is rewritten to #/$defs/DecisionDossierDocument/$defs/X so it " +
|
|
46
|
+
"resolves inside the catalogue and standalone documents; the urn identity stays " +
|
|
47
|
+
"in x-sentropic.semantic.schemaId and the sha256 pin verifies the source file. " +
|
|
48
|
+
"The pinned owner schema declares diagramNode.scene as an unconstrained object " +
|
|
49
|
+
"('{ \"type\": \"object\" }' plus its description): an owner declaration, not an " +
|
|
50
|
+
"implicit any of this generator — it is listed in the scan's inventory.",
|
|
51
|
+
reason: "§5.1: the owner's schema is authoritative; the marker keeps the props interface " +
|
|
52
|
+
"declared while the emitted schema is the owner's, sha256-pinned below.",
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
narrowedUnions: [],
|
|
56
|
+
callbacks: [
|
|
57
|
+
{
|
|
58
|
+
callback: "onChooseOption (option card click)",
|
|
59
|
+
signature: "(optionId: string) => void",
|
|
60
|
+
intent: "choose-option",
|
|
61
|
+
targetFrom: "option id",
|
|
62
|
+
note: "§11.2 criterion 4: clicking an option card emits choose-option with the option id.",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
frameworks: [
|
|
66
|
+
{ framework: "svelte", file: "packages/components-svelte", typeName: "", role: "no-counterpart" },
|
|
67
|
+
{ framework: "react", file: "packages/components-react", typeName: "", role: "no-counterpart" },
|
|
68
|
+
{ framework: "vue", file: "packages/components-vue", typeName: "", role: "no-counterpart" },
|
|
69
|
+
{ framework: "angular", file: "packages/components-angular", typeName: "", role: "no-counterpart" },
|
|
70
|
+
],
|
|
71
|
+
metadata: {
|
|
72
|
+
contract: "1.0",
|
|
73
|
+
element: "st-decision-dossier",
|
|
74
|
+
engine: "lazy:focus",
|
|
75
|
+
events: ["choose-option"],
|
|
76
|
+
fallback: "text",
|
|
77
|
+
},
|
|
78
|
+
example: {
|
|
79
|
+
id: "root",
|
|
80
|
+
component: "DecisionDossier",
|
|
81
|
+
"document": {
|
|
82
|
+
ref: "decision-1",
|
|
83
|
+
subject: "Adopt the JSON render standard for design-system rendering",
|
|
84
|
+
title: "Decision: adopt the JSON render standard",
|
|
85
|
+
hash: "b7d3f0c9",
|
|
86
|
+
cursor: "2026-10-30T10:00:00Z",
|
|
87
|
+
sections: [
|
|
88
|
+
{
|
|
89
|
+
kind: "question",
|
|
90
|
+
id: "q1",
|
|
91
|
+
targetRef: "decision-1",
|
|
92
|
+
question: "Which rendering contract do we adopt?",
|
|
93
|
+
state: "open",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
kind: "optionSet",
|
|
97
|
+
id: "options-1",
|
|
98
|
+
targetRef: "q1",
|
|
99
|
+
title: "Options",
|
|
100
|
+
options: [
|
|
101
|
+
{
|
|
102
|
+
kind: "option",
|
|
103
|
+
id: "opt-json",
|
|
104
|
+
targetRef: "q1",
|
|
105
|
+
label: "Adopt the JSON render standard",
|
|
106
|
+
annotation: "none",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
kind: "option",
|
|
110
|
+
id: "opt-status-quo",
|
|
111
|
+
targetRef: "q1",
|
|
112
|
+
label: "Keep the status quo",
|
|
113
|
+
annotation: "none",
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
interactions: [],
|
|
119
|
+
provenance: { source: "track", readAt: "2026-10-30T10:00:00Z" },
|
|
120
|
+
amendmentTrace: [],
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
semantic: {
|
|
124
|
+
source: "focus",
|
|
125
|
+
runtimePackage: "@sentropic/focus@0.5.0",
|
|
126
|
+
schemaSubpath: "schemas/decision-dossier-document.v1.schema.json",
|
|
127
|
+
schemaId: "urn:sentropic:focus:DecisionDossierDocument:1.0.0",
|
|
128
|
+
sha256: "725bc07e7c6b6ad51a1f720cc9fb02649d8f31bc54e71c61c350fd20058c8852",
|
|
129
|
+
reason: "§4.3 item 2: the pinned focus validator is authoritative for a DecisionDossierDocument. " +
|
|
130
|
+
"The example above is valid for both the embedded schema and the real validator.",
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=decision-dossier.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The catalogue registry (§5.1): every contract module, in catalogue order.
|
|
3
|
+
* Adding a component is a lot item with its own parity check (§5.4); this
|
|
4
|
+
* array is the single place a new contract module registers.
|
|
5
|
+
*/
|
|
6
|
+
import type { ContractModule } from "./types.js";
|
|
7
|
+
export type { ContractModule } from "./types.js";
|
|
8
|
+
export { type BarChartProps, type BarChartDatum, type BarChartTone, type ChartAnnotation, type ChartAnnotationMarker, type ChartBand, type ChartGoalLine, type ChartOverlayTone, type ChartReferenceLine, type ChartScale, type DataLabelsJson, } from "./bar-chart.js";
|
|
9
|
+
export { type BpmnCanvasDocument, type BpmnCanvasProps } from "./bpmn-canvas.js";
|
|
10
|
+
export { type DecisionDossierDocumentRef, type DecisionDossierProps } from "./decision-dossier.js";
|
|
11
|
+
/** The catalogue identity (§5.2): `$id` = `catalogId`. */
|
|
12
|
+
export declare const CATALOG_ID = "https://design-system.sent-tech.ca/catalogs/elements/v1/catalog.json";
|
|
13
|
+
/** The envelope schema's `$id` (the standalone schemas live next to it, §5.2). */
|
|
14
|
+
export declare const ENVELOPE_ID = "https://design-system.sent-tech.ca/catalogs/elements/v1/envelope.json";
|
|
15
|
+
/** Standalone schema `$id` for one component (§5.2). */
|
|
16
|
+
export declare function standaloneId(component: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* The A2UI v0.9.1 common-types URI the catalogue's entries reference
|
|
19
|
+
* (`ComponentCommon`). The installed SDK (0.14.0) ships no v0_9_1 schema set
|
|
20
|
+
* (only v0_8, v0_9 and v1_0), so the vendored copy is generated from the
|
|
21
|
+
* SDK's v0_9 common_types.json with this `$id` (see src/generated).
|
|
22
|
+
*/
|
|
23
|
+
export declare const A2UI_COMMON_TYPES_ID = "https://a2ui.org/specification/v0_9_1/common_types.json";
|
|
24
|
+
/** The A2UI protocol version this catalogue targets (§5.2). */
|
|
25
|
+
export declare const A2UI_PROTOCOL_VERSION = "0.9.1";
|
|
26
|
+
/** Every contract module, in catalogue order (§5.4). */
|
|
27
|
+
export declare const contracts: readonly ContractModule[];
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The catalogue registry (§5.1): every contract module, in catalogue order.
|
|
3
|
+
* Adding a component is a lot item with its own parity check (§5.4); this
|
|
4
|
+
* array is the single place a new contract module registers.
|
|
5
|
+
*/
|
|
6
|
+
import { barChartContract } from "./bar-chart.js";
|
|
7
|
+
import { bpmnCanvasContract } from "./bpmn-canvas.js";
|
|
8
|
+
import { decisionDossierContract } from "./decision-dossier.js";
|
|
9
|
+
export {} from "./bar-chart.js";
|
|
10
|
+
export {} from "./bpmn-canvas.js";
|
|
11
|
+
export {} from "./decision-dossier.js";
|
|
12
|
+
/** The catalogue identity (§5.2): `$id` = `catalogId`. */
|
|
13
|
+
export const CATALOG_ID = "https://design-system.sent-tech.ca/catalogs/elements/v1/catalog.json";
|
|
14
|
+
/** The envelope schema's `$id` (the standalone schemas live next to it, §5.2). */
|
|
15
|
+
export const ENVELOPE_ID = "https://design-system.sent-tech.ca/catalogs/elements/v1/envelope.json";
|
|
16
|
+
/** Standalone schema `$id` for one component (§5.2). */
|
|
17
|
+
export function standaloneId(component) {
|
|
18
|
+
return `https://design-system.sent-tech.ca/catalogs/elements/v1/components/${component}.json`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The A2UI v0.9.1 common-types URI the catalogue's entries reference
|
|
22
|
+
* (`ComponentCommon`). The installed SDK (0.14.0) ships no v0_9_1 schema set
|
|
23
|
+
* (only v0_8, v0_9 and v1_0), so the vendored copy is generated from the
|
|
24
|
+
* SDK's v0_9 common_types.json with this `$id` (see src/generated).
|
|
25
|
+
*/
|
|
26
|
+
export const A2UI_COMMON_TYPES_ID = "https://a2ui.org/specification/v0_9_1/common_types.json";
|
|
27
|
+
/** The A2UI protocol version this catalogue targets (§5.2). */
|
|
28
|
+
export const A2UI_PROTOCOL_VERSION = "0.9.1";
|
|
29
|
+
/** Every contract module, in catalogue order (§5.4). */
|
|
30
|
+
export const contracts = [
|
|
31
|
+
barChartContract,
|
|
32
|
+
bpmnCanvasContract,
|
|
33
|
+
decisionDossierContract,
|
|
34
|
+
];
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract-module types (SPEC_EVOL_DS_JSON_RENDER_STANDARD §5.1).
|
|
3
|
+
*
|
|
4
|
+
* A contract module is the DECLARED reduction of one component's TypeScript
|
|
5
|
+
* props type to its JSON subset. It names the source props type, lists every
|
|
6
|
+
* excluded prop with a reason, declares an explicit replacement for every type
|
|
7
|
+
* the generator cannot convert (never an implicit `any`), narrows complex
|
|
8
|
+
* unions to their JSON form, maps each callback to an output intent (§4.6) and
|
|
9
|
+
* carries the `x-sentropic` metadata (§5.2).
|
|
10
|
+
*
|
|
11
|
+
* The generator (src/generator) reads the props interface declared alongside
|
|
12
|
+
* this metadata in the same module file and turns it into the catalogue entry.
|
|
13
|
+
* The registry of every contract module lives in `./index.ts`.
|
|
14
|
+
*/
|
|
15
|
+
/** Output intents of §4.6. `null` marks a callback with no mapping. */
|
|
16
|
+
export type IntentName = "select" | "open" | "choose-option" | "comment";
|
|
17
|
+
/** One row per real callback, §4.6: mapped or explicitly unmapped. */
|
|
18
|
+
export interface CallbackIntentRow {
|
|
19
|
+
/** The source component's callback name, e.g. `onSelect`. */
|
|
20
|
+
readonly callback: string;
|
|
21
|
+
/** The callback's TypeScript signature, for the reader. */
|
|
22
|
+
readonly signature: string;
|
|
23
|
+
/** The intent it maps to, or `null` when the callback stays local (hover). */
|
|
24
|
+
readonly intent: IntentName | null;
|
|
25
|
+
/** Where the intent's `target` comes from, when mapped. */
|
|
26
|
+
readonly targetFrom?: string;
|
|
27
|
+
/** Why this mapping (or why there is none). */
|
|
28
|
+
readonly note: string;
|
|
29
|
+
}
|
|
30
|
+
/** Why a prop is excluded from the catalogue. The list is explicit, never inferred. */
|
|
31
|
+
export type ExcludedKind = "function" | "snippet" | "children" | "style-hook";
|
|
32
|
+
export interface ExcludedProp {
|
|
33
|
+
readonly prop: string;
|
|
34
|
+
readonly kind: ExcludedKind;
|
|
35
|
+
readonly reason: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A prop whose source type the generator cannot convert, replaced here by an
|
|
39
|
+
* explicit declared type — the §5.1 rule: never an implicit `any`. Every entry
|
|
40
|
+
* must correspond to a visible replacement type in the module, or to a schema
|
|
41
|
+
* fragment the emitter substitutes.
|
|
42
|
+
*/
|
|
43
|
+
export interface ReplacedType {
|
|
44
|
+
readonly prop: string;
|
|
45
|
+
/** The source type that cannot pass through, e.g. `DataLabelsProp` with a function member. */
|
|
46
|
+
readonly sourceType: string;
|
|
47
|
+
/** The replacement that lands in the schema, e.g. the embedded focus v1 JSON Schema. */
|
|
48
|
+
readonly replacement: string;
|
|
49
|
+
readonly reason: string;
|
|
50
|
+
}
|
|
51
|
+
/** A complex union narrowed to its JSON form (§5.1, e.g. `dataLabels`). */
|
|
52
|
+
export interface NarrowedUnion {
|
|
53
|
+
readonly prop: string;
|
|
54
|
+
readonly sourceForm: string;
|
|
55
|
+
readonly jsonForm: string;
|
|
56
|
+
/** Members of the source form dropped because they are not JSON (e.g. `format`). */
|
|
57
|
+
readonly dropped: readonly string[];
|
|
58
|
+
readonly reason: string;
|
|
59
|
+
}
|
|
60
|
+
/** One framework implementation compared by the parity guard (§5.1). */
|
|
61
|
+
export type FrameworkName = "svelte" | "react" | "vue" | "angular";
|
|
62
|
+
export interface FrameworkSource {
|
|
63
|
+
readonly framework: FrameworkName;
|
|
64
|
+
/** Workspace-relative path of the file the guard reads. */
|
|
65
|
+
readonly file: string;
|
|
66
|
+
/** The public props type name in that framework. */
|
|
67
|
+
readonly typeName: string;
|
|
68
|
+
/**
|
|
69
|
+
* - `source-of-truth`: the Svelte reference pilot the catalogue is derived
|
|
70
|
+
* from (not mechanically generatable — it lives inside a `.svelte` file).
|
|
71
|
+
* - `compared`: mechanically compared by the guard.
|
|
72
|
+
* - `no-counterpart`: this framework ships no such component.
|
|
73
|
+
*/
|
|
74
|
+
readonly role: "source-of-truth" | "compared" | "no-counterpart";
|
|
75
|
+
readonly note?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The pin of the owning runtime that validates the component's semantics
|
|
79
|
+
* (§4.3 item 2). `document` is the prop carrying the semantic payload.
|
|
80
|
+
*/
|
|
81
|
+
export interface SemanticPin {
|
|
82
|
+
readonly source: "focus" | "bpmn-canvas" | "diagram-core";
|
|
83
|
+
/** The exact runtime package the pin was measured against. */
|
|
84
|
+
readonly runtimePackage: string;
|
|
85
|
+
/** Schema subpath inside that package, when it ships one. */
|
|
86
|
+
readonly schemaSubpath?: string;
|
|
87
|
+
/** `$id` of that schema, when it ships one. */
|
|
88
|
+
readonly schemaId?: string;
|
|
89
|
+
/** sha256 of the schema file, recorded so a changed file fails generation. */
|
|
90
|
+
readonly sha256?: string;
|
|
91
|
+
readonly reason: string;
|
|
92
|
+
}
|
|
93
|
+
/** The `x-sentropic` block of §5.2, minus `parity` and `schema` (generator-owned). */
|
|
94
|
+
export interface XSentropicCore {
|
|
95
|
+
readonly contract: string;
|
|
96
|
+
readonly element: string;
|
|
97
|
+
/** "core" or "lazy:<chunk>" — the lazy chunk names the semantic owner too. */
|
|
98
|
+
readonly engine: string;
|
|
99
|
+
/** Intent names the component can emit (§4.6). */
|
|
100
|
+
readonly events: readonly IntentName[];
|
|
101
|
+
readonly fallback: "text" | "svg";
|
|
102
|
+
}
|
|
103
|
+
/** One catalogued component's declared contract (§5.1). */
|
|
104
|
+
export interface ContractModule {
|
|
105
|
+
/** The A2UI component name, the `catalogue.components` key. */
|
|
106
|
+
readonly component: string;
|
|
107
|
+
/** The props interface name the generator reads from this module. */
|
|
108
|
+
readonly propsTypeName: string;
|
|
109
|
+
/** The source props type this module is derived from (§5.1). */
|
|
110
|
+
readonly source: {
|
|
111
|
+
readonly packageName: string;
|
|
112
|
+
readonly file: string;
|
|
113
|
+
readonly typeName: string;
|
|
114
|
+
readonly note: string;
|
|
115
|
+
};
|
|
116
|
+
readonly excluded: readonly ExcludedProp[];
|
|
117
|
+
readonly replacedTypes: readonly ReplacedType[];
|
|
118
|
+
readonly narrowedUnions: readonly NarrowedUnion[];
|
|
119
|
+
readonly callbacks: readonly CallbackIntentRow[];
|
|
120
|
+
readonly frameworks: readonly FrameworkSource[];
|
|
121
|
+
readonly metadata: XSentropicCore;
|
|
122
|
+
/** The committed example: an A2UI component object (`id`, `component`, props). */
|
|
123
|
+
readonly example: Record<string, unknown>;
|
|
124
|
+
/** Present when a runtime owns this component's semantics (§4.3 item 2). */
|
|
125
|
+
readonly semantic?: SemanticPin;
|
|
126
|
+
/** §5.2 `x-sentropic.status` — placeholder entries only. */
|
|
127
|
+
readonly status?: "unknown";
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract-module types (SPEC_EVOL_DS_JSON_RENDER_STANDARD §5.1).
|
|
3
|
+
*
|
|
4
|
+
* A contract module is the DECLARED reduction of one component's TypeScript
|
|
5
|
+
* props type to its JSON subset. It names the source props type, lists every
|
|
6
|
+
* excluded prop with a reason, declares an explicit replacement for every type
|
|
7
|
+
* the generator cannot convert (never an implicit `any`), narrows complex
|
|
8
|
+
* unions to their JSON form, maps each callback to an output intent (§4.6) and
|
|
9
|
+
* carries the `x-sentropic` metadata (§5.2).
|
|
10
|
+
*
|
|
11
|
+
* The generator (src/generator) reads the props interface declared alongside
|
|
12
|
+
* this metadata in the same module file and turns it into the catalogue entry.
|
|
13
|
+
* The registry of every contract module lives in `./index.ts`.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The minimal F1→XML adapter of the `<st-bpmn-canvas>` element (§6.2, §10.2,
|
|
3
|
+
* §14 L2): a moddle-JSON tree (`bpmn:Definitions`) becomes BPMN 2.0 XML at the
|
|
4
|
+
* edge of the element — the owner rule « un seul modèle JSON moddle de bout
|
|
5
|
+
* en bout, XML seulement en sortie » (§10.2).
|
|
6
|
+
*
|
|
7
|
+
* The adapter is MINIMAL and is REPLACED by the real F1 `hydrate`/`project`
|
|
8
|
+
* once `@sentropic/bpmn-canvas` publishes it (§3.3 F1, U-7). It covers the
|
|
9
|
+
* BPMN + DI subset bpmn-moddle's meta-model knows (MIT, devDependency, no
|
|
10
|
+
* network) and refuses everything else with the F1 codes measured on the
|
|
11
|
+
* unpushed workbench (`BC-WB:src/io/muddle-json.ts`): `unknown-type` on an
|
|
12
|
+
* unregistered `$type`, `unresolved-reference` on a reference that names no
|
|
13
|
+
* element of the document, `missing-$type` on a tree node without `$type`,
|
|
14
|
+
* and `unsupported-extension` on a non-data value (§4.1: functions never
|
|
15
|
+
* ride in an envelope).
|
|
16
|
+
*
|
|
17
|
+
* Pure orchestration over bpmn-moddle: one fresh moddle instance per call
|
|
18
|
+
* (no global lookup state — the same tree twice yields the same XML), and
|
|
19
|
+
* the JSON pointers of every refusal locate the offending node exactly.
|
|
20
|
+
*/
|
|
21
|
+
/** The refusal codes of the minimal adapter (F1's own vocabulary). */
|
|
22
|
+
export type F1RefusalCode = "unknown-type" | "unresolved-reference" | "missing-$type" | "unsupported-extension";
|
|
23
|
+
/** A non-blocking fact the adapter surfaces (kept empty by the minimal set). */
|
|
24
|
+
export interface F1Warning {
|
|
25
|
+
readonly code: string;
|
|
26
|
+
readonly message: string;
|
|
27
|
+
}
|
|
28
|
+
export type F1ToXmlResult = {
|
|
29
|
+
readonly ok: true;
|
|
30
|
+
readonly xml: string;
|
|
31
|
+
readonly warnings: readonly F1Warning[];
|
|
32
|
+
} | {
|
|
33
|
+
readonly ok: false;
|
|
34
|
+
readonly code: F1RefusalCode;
|
|
35
|
+
readonly message: string;
|
|
36
|
+
readonly pointer?: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The minimal semantic hydrate of one F1 tree: the meta-model walk with the
|
|
40
|
+
* exact refusal codes and pointers, WITHOUT the XML serialization — the
|
|
41
|
+
* synchronous validation the `bpmn-canvas` semantic port is built from
|
|
42
|
+
* (`createBpmnCanvasPort`, `src/ports`), per §4.3 item 2: the owning
|
|
43
|
+
* runtime validates the payload.
|
|
44
|
+
*/
|
|
45
|
+
export declare function hydrateF1(input: unknown): F1ToXmlResult;
|
|
46
|
+
/**
|
|
47
|
+
* Turn one F1 moddle-JSON tree into BPMN 2.0 XML. Never throws: every
|
|
48
|
+
* refusal comes back as `{ ok: false, code, message, pointer? }`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function f1ToXml(input: unknown): Promise<F1ToXmlResult>;
|
|
51
|
+
//# sourceMappingURL=f1-to-xml.d.ts.map
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The minimal F1→XML adapter of the `<st-bpmn-canvas>` element (§6.2, §10.2,
|
|
3
|
+
* §14 L2): a moddle-JSON tree (`bpmn:Definitions`) becomes BPMN 2.0 XML at the
|
|
4
|
+
* edge of the element — the owner rule « un seul modèle JSON moddle de bout
|
|
5
|
+
* en bout, XML seulement en sortie » (§10.2).
|
|
6
|
+
*
|
|
7
|
+
* The adapter is MINIMAL and is REPLACED by the real F1 `hydrate`/`project`
|
|
8
|
+
* once `@sentropic/bpmn-canvas` publishes it (§3.3 F1, U-7). It covers the
|
|
9
|
+
* BPMN + DI subset bpmn-moddle's meta-model knows (MIT, devDependency, no
|
|
10
|
+
* network) and refuses everything else with the F1 codes measured on the
|
|
11
|
+
* unpushed workbench (`BC-WB:src/io/muddle-json.ts`): `unknown-type` on an
|
|
12
|
+
* unregistered `$type`, `unresolved-reference` on a reference that names no
|
|
13
|
+
* element of the document, `missing-$type` on a tree node without `$type`,
|
|
14
|
+
* and `unsupported-extension` on a non-data value (§4.1: functions never
|
|
15
|
+
* ride in an envelope).
|
|
16
|
+
*
|
|
17
|
+
* Pure orchestration over bpmn-moddle: one fresh moddle instance per call
|
|
18
|
+
* (no global lookup state — the same tree twice yields the same XML), and
|
|
19
|
+
* the JSON pointers of every refusal locate the offending node exactly.
|
|
20
|
+
*/
|
|
21
|
+
import { BpmnModdle } from "bpmn-moddle";
|
|
22
|
+
function isPlainObject(value) {
|
|
23
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
24
|
+
}
|
|
25
|
+
/** Type guard: one F1 result is a refusal when `ok` is false. */
|
|
26
|
+
function isRefusal(value) {
|
|
27
|
+
return isPlainObject(value) && value.ok === false;
|
|
28
|
+
}
|
|
29
|
+
function refusal(code, message, pointer) {
|
|
30
|
+
return pointer === undefined
|
|
31
|
+
? { ok: false, code, message }
|
|
32
|
+
: { ok: false, code, message, pointer };
|
|
33
|
+
}
|
|
34
|
+
function appendToken(pointer, token) {
|
|
35
|
+
return `${pointer}/${String(token).replace(/~/g, "~0").replace(/\//g, "~1")}`;
|
|
36
|
+
}
|
|
37
|
+
/** §4.1: the tree is data — a function anywhere is an unsupported extension. */
|
|
38
|
+
function assertDataOnly(value, pointer) {
|
|
39
|
+
if (typeof value === "function") {
|
|
40
|
+
return refusal("unsupported-extension", "the F1 tree carries a non-data value (§4.1)", pointer);
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* One JSON walk that (1) refuses non-data and `$type`-less objects with the
|
|
46
|
+
* exact pointer, (2) creates every node through the meta-model (unknown
|
|
47
|
+
* `$type` refused), and (3) indexes every element by id for the reference
|
|
48
|
+
* pass. Returns the created root and the index, or a refusal.
|
|
49
|
+
*/
|
|
50
|
+
function createTree(moddle, value, pointer, index) {
|
|
51
|
+
const dataRefusal = assertDataOnly(value, pointer);
|
|
52
|
+
if (dataRefusal !== undefined)
|
|
53
|
+
return { refused: dataRefusal };
|
|
54
|
+
if (!isPlainObject(value)) {
|
|
55
|
+
return { refused: refusal("missing-$type", `the F1 tree node at ${pointer || "/"} is not an object`, pointer) };
|
|
56
|
+
}
|
|
57
|
+
const type = value.$type;
|
|
58
|
+
if (typeof type !== "string" || type.length === 0) {
|
|
59
|
+
return { refused: refusal("missing-$type", `the F1 tree node at ${pointer || "/"} has no $type`, appendToken(pointer, "$type")) };
|
|
60
|
+
}
|
|
61
|
+
const attrs = {};
|
|
62
|
+
for (const [key, child] of Object.entries(value)) {
|
|
63
|
+
if (key === "$type")
|
|
64
|
+
continue;
|
|
65
|
+
const childPointer = appendToken(pointer, key);
|
|
66
|
+
const childRefusal = assertDataOnly(child, childPointer);
|
|
67
|
+
if (childRefusal !== undefined)
|
|
68
|
+
return { refused: childRefusal };
|
|
69
|
+
if (Array.isArray(child)) {
|
|
70
|
+
const items = [];
|
|
71
|
+
for (let itemIndex = 0; itemIndex < child.length; itemIndex += 1) {
|
|
72
|
+
const itemPointer = appendToken(childPointer, itemIndex);
|
|
73
|
+
if (isPlainObject(child[itemIndex])) {
|
|
74
|
+
const nested = createTree(moddle, child[itemIndex], itemPointer, index);
|
|
75
|
+
if ("refused" in nested)
|
|
76
|
+
return nested;
|
|
77
|
+
items.push(nested.root);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const itemRefusal = assertDataOnly(child[itemIndex], itemPointer);
|
|
81
|
+
if (itemRefusal !== undefined)
|
|
82
|
+
return { refused: itemRefusal };
|
|
83
|
+
items.push(child[itemIndex]);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
attrs[key] = items;
|
|
87
|
+
}
|
|
88
|
+
else if (isPlainObject(child)) {
|
|
89
|
+
const nested = createTree(moddle, child, childPointer, index);
|
|
90
|
+
if ("refused" in nested)
|
|
91
|
+
return nested;
|
|
92
|
+
attrs[key] = nested.root;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
attrs[key] = child;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
let element;
|
|
99
|
+
try {
|
|
100
|
+
element = moddle.create(type, attrs);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
104
|
+
return { refused: refusal("unknown-type", message, appendToken(pointer, "$type")) };
|
|
105
|
+
}
|
|
106
|
+
if (typeof value.id === "string")
|
|
107
|
+
index.set(value.id, element);
|
|
108
|
+
return { root: element };
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The reference pass: every meta-model `isReference` property that still
|
|
112
|
+
* holds a string must name an element of THIS document — moddle serializes
|
|
113
|
+
* resolved elements back to their ids, so an unresolved name is refused,
|
|
114
|
+
* never silently dropped.
|
|
115
|
+
*/
|
|
116
|
+
function resolveReferences(source, element, index, pointer) {
|
|
117
|
+
for (const property of element.$descriptor.properties) {
|
|
118
|
+
if (!property.isReference)
|
|
119
|
+
continue;
|
|
120
|
+
const propertyPointer = appendToken(pointer, property.name);
|
|
121
|
+
const value = element[property.name];
|
|
122
|
+
/** Resolve one string to its element, or refuse with the pointer. */
|
|
123
|
+
const resolveOne = (item, itemPointer) => {
|
|
124
|
+
if (typeof item !== "string")
|
|
125
|
+
return item;
|
|
126
|
+
const target = index.get(item);
|
|
127
|
+
if (target === undefined) {
|
|
128
|
+
return refusal("unresolved-reference", `the reference "${item}" names no element of the document`, itemPointer);
|
|
129
|
+
}
|
|
130
|
+
return target;
|
|
131
|
+
};
|
|
132
|
+
if (property.isMany) {
|
|
133
|
+
if (Array.isArray(value)) {
|
|
134
|
+
const resolved = [];
|
|
135
|
+
for (let itemIndex = 0; itemIndex < value.length; itemIndex += 1) {
|
|
136
|
+
const item = resolveOne(value[itemIndex], appendToken(propertyPointer, itemIndex));
|
|
137
|
+
if (isRefusal(item))
|
|
138
|
+
return item;
|
|
139
|
+
resolved.push(item);
|
|
140
|
+
}
|
|
141
|
+
element[property.name] = resolved;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (value !== undefined) {
|
|
145
|
+
const item = resolveOne(value, propertyPointer);
|
|
146
|
+
if (isRefusal(item))
|
|
147
|
+
return item;
|
|
148
|
+
element[property.name] = item;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
for (const [key, child] of Object.entries(source)) {
|
|
152
|
+
if (key === "$type")
|
|
153
|
+
continue;
|
|
154
|
+
const childElement = element[key];
|
|
155
|
+
const childValue = child;
|
|
156
|
+
const childPointer = appendToken(pointer, key);
|
|
157
|
+
if (Array.isArray(childValue) && Array.isArray(childElement)) {
|
|
158
|
+
for (let itemIndex = 0; itemIndex < childValue.length; itemIndex += 1) {
|
|
159
|
+
if (isPlainObject(childValue[itemIndex]) && childValue[itemIndex].$type !== undefined) {
|
|
160
|
+
const nested = resolveReferences(childValue[itemIndex], childElement[itemIndex], index, appendToken(childPointer, itemIndex));
|
|
161
|
+
if (nested !== undefined)
|
|
162
|
+
return nested;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else if (isPlainObject(childValue) && childValue.$type !== undefined) {
|
|
167
|
+
const nested = resolveReferences(childValue, childElement, index, childPointer);
|
|
168
|
+
if (nested !== undefined)
|
|
169
|
+
return nested;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The minimal semantic hydrate of one F1 tree: the meta-model walk with the
|
|
176
|
+
* exact refusal codes and pointers, WITHOUT the XML serialization — the
|
|
177
|
+
* synchronous validation the `bpmn-canvas` semantic port is built from
|
|
178
|
+
* (`createBpmnCanvasPort`, `src/ports`), per §4.3 item 2: the owning
|
|
179
|
+
* runtime validates the payload.
|
|
180
|
+
*/
|
|
181
|
+
export function hydrateF1(input) {
|
|
182
|
+
if (!isPlainObject(input)) {
|
|
183
|
+
return refusal("missing-$type", "the F1 document is not a JSON object");
|
|
184
|
+
}
|
|
185
|
+
const moddle = new BpmnModdle();
|
|
186
|
+
const index = new Map();
|
|
187
|
+
const created = createTree(moddle, input, "", index);
|
|
188
|
+
if ("refused" in created)
|
|
189
|
+
return created.refused;
|
|
190
|
+
const referenceRefusal = resolveReferences(input, created.root, index, "");
|
|
191
|
+
if (referenceRefusal !== undefined)
|
|
192
|
+
return referenceRefusal;
|
|
193
|
+
return { ok: true, xml: "", warnings: [] };
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Turn one F1 moddle-JSON tree into BPMN 2.0 XML. Never throws: every
|
|
197
|
+
* refusal comes back as `{ ok: false, code, message, pointer? }`.
|
|
198
|
+
*/
|
|
199
|
+
export async function f1ToXml(input) {
|
|
200
|
+
if (!isPlainObject(input)) {
|
|
201
|
+
return refusal("missing-$type", "the F1 document is not a JSON object");
|
|
202
|
+
}
|
|
203
|
+
const moddle = new BpmnModdle();
|
|
204
|
+
const index = new Map();
|
|
205
|
+
const created = createTree(moddle, input, "", index);
|
|
206
|
+
if ("refused" in created)
|
|
207
|
+
return created.refused;
|
|
208
|
+
const referenceRefusal = resolveReferences(input, created.root, index, "");
|
|
209
|
+
if (referenceRefusal !== undefined)
|
|
210
|
+
return referenceRefusal;
|
|
211
|
+
try {
|
|
212
|
+
const { xml } = await moddle.toXML(created.root, { format: true });
|
|
213
|
+
return { ok: true, xml, warnings: [] };
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
217
|
+
return refusal("unsupported-extension", `the F1 tree cannot be serialized: ${message}`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=f1-to-xml.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The minimal Markdown subset of the `<st-decision-dossier>` element's lazy
|
|
3
|
+
* renderer (§6.2, §6.4, U-14; conductor's L2 scope: the Focus renderer
|
|
4
|
+
* defaults F-R0–F-R7 are lot L6, and L2 renders the document through a
|
|
5
|
+
* minimal lazy renderer so the pilot works end to end).
|
|
6
|
+
*
|
|
7
|
+
* The subset is deliberately small and REPLACED by L6's choice (§6.4: « the
|
|
8
|
+
* Markdown parser and the allowed subset are chosen with the Focus pilot »):
|
|
9
|
+
* paragraphs split on blank lines, `**bold**`, `*italic*`, `` `code` ``,
|
|
10
|
+
* `[text](https://…)` links and `- ` bullet lists. Everything else is TEXT.
|
|
11
|
+
*
|
|
12
|
+
* Emitted markup, exactly (the DOMPurify allowlist in
|
|
13
|
+
* `src/element/dom/engines/focus-renderer.ts` mirrors this subset, U-14):
|
|
14
|
+
* tags `p`, `ul`, `li`, `code`, `a`, `strong`, `em` only; attribute `href`
|
|
15
|
+
* on anchors only, `https:` URLs only; no data attributes, no event
|
|
16
|
+
* handlers, no `style`, no other tags.
|
|
17
|
+
*
|
|
18
|
+
* Pure half: raw HTML in the source is ESCAPED here, and the DOM half
|
|
19
|
+
* (`src/element/dom`) passes this module's output through DOMPurify before
|
|
20
|
+
* insertion anyway (§6.4 defense in depth; U-14: DOMPurify 3.4.15 is the
|
|
21
|
+
* chosen sanitizer, pinned, its license recorded by `licensing:check`).
|
|
22
|
+
* Only `https:` links become anchors; every other scheme — `javascript:`,
|
|
23
|
+
* `data:`, relative — stays literal text.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Render one Markdown source in the minimal subset. Pure: no DOM, no
|
|
27
|
+
* sanitizer — the caller sanitizes (the DOM half routes this through
|
|
28
|
+
* DOMPurify before insertion, §6.4).
|
|
29
|
+
*/
|
|
30
|
+
export declare function renderMarkdown(source: string): string;
|
|
31
|
+
//# sourceMappingURL=minimal-markdown.d.ts.map
|