@cratis/components 4.42.2 → 4.43.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/compat-manifest.json +67 -13
- package/dist/esm/Chat/ChatTopicEmptyMessage.d.ts +9 -0
- package/dist/esm/Chat/ChatTopicEmptyMessage.d.ts.map +1 -0
- package/dist/esm/Chat/ChatTopicEmptyMessage.js +19 -0
- package/dist/esm/Chat/ChatTopicEmptyMessage.js.map +1 -0
- package/dist/esm/Chat/ChatTopicList.d.ts +2 -2
- package/dist/esm/Chat/ChatTopicList.d.ts.map +1 -1
- package/dist/esm/Chat/ChatTopicList.js +5 -20
- package/dist/esm/Chat/ChatTopicList.js.map +1 -1
- package/dist/esm/Chat/ChatTopicRow.d.ts +22 -0
- package/dist/esm/Chat/ChatTopicRow.d.ts.map +1 -0
- package/dist/esm/Chat/ChatTopicRow.js +23 -0
- package/dist/esm/Chat/ChatTopicRow.js.map +1 -0
- package/dist/esm/Chat/ChatTopicStartButton.d.ts +8 -0
- package/dist/esm/Chat/ChatTopicStartButton.d.ts.map +1 -0
- package/dist/esm/Chat/ChatTopicStartButton.js +7 -0
- package/dist/esm/Chat/ChatTopicStartButton.js.map +1 -0
- package/dist/esm/CommandForm/fields/ChipsField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/ChipsField.js +2 -6
- package/dist/esm/CommandForm/fields/ChipsField.js.map +1 -1
- package/dist/esm/CommandForm/fields/ChipsRoot.d.ts +15 -0
- package/dist/esm/CommandForm/fields/ChipsRoot.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/ChipsRoot.js +11 -0
- package/dist/esm/CommandForm/fields/ChipsRoot.js.map +1 -0
- package/dist/esm/CommandForm/fields/PasswordField.d.ts.map +1 -1
- package/dist/esm/CommandForm/fields/PasswordField.js +4 -14
- package/dist/esm/CommandForm/fields/PasswordField.js.map +1 -1
- package/dist/esm/CommandForm/fields/PasswordInput.d.ts +17 -0
- package/dist/esm/CommandForm/fields/PasswordInput.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/PasswordInput.js +7 -0
- package/dist/esm/CommandForm/fields/PasswordInput.js.map +1 -0
- package/dist/esm/CommandForm/fields/PasswordRoot.d.ts +15 -0
- package/dist/esm/CommandForm/fields/PasswordRoot.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/PasswordRoot.js +7 -0
- package/dist/esm/CommandForm/fields/PasswordRoot.js.map +1 -0
- package/dist/esm/CommandForm/fields/PasswordToggle.d.ts +13 -0
- package/dist/esm/CommandForm/fields/PasswordToggle.d.ts.map +1 -0
- package/dist/esm/CommandForm/fields/PasswordToggle.js +9 -0
- package/dist/esm/CommandForm/fields/PasswordToggle.js.map +1 -0
- package/dist/esm/DataTables/TablePaginatorImplementation.js +1 -1
- package/dist/esm/Dialogs/DialogImplementation.js +1 -1
- package/dist/esm/Dropdown/useDropdownState.js +1 -1
- package/dist/esm/Filter/FilterPanel.d.ts +69 -0
- package/dist/esm/Filter/FilterPanel.d.ts.map +1 -1
- package/dist/esm/Filter/FilterPanel.js +6 -21
- package/dist/esm/Filter/FilterPanel.js.map +1 -1
- package/dist/esm/Filter/FilterPanelContent.d.ts +14 -0
- package/dist/esm/Filter/FilterPanelContent.d.ts.map +1 -0
- package/dist/esm/Filter/FilterPanelContent.js +8 -0
- package/dist/esm/Filter/FilterPanelContent.js.map +1 -0
- package/dist/esm/Filter/usePortalTarget.d.ts +13 -0
- package/dist/esm/Filter/usePortalTarget.d.ts.map +1 -0
- package/dist/esm/Filter/usePortalTarget.js +24 -0
- package/dist/esm/Filter/usePortalTarget.js.map +1 -0
- package/dist/esm/Notifications/ToastCloseButton.d.ts +11 -0
- package/dist/esm/Notifications/ToastCloseButton.d.ts.map +1 -0
- package/dist/esm/Notifications/ToastCloseButton.js +14 -0
- package/dist/esm/Notifications/ToastCloseButton.js.map +1 -0
- package/dist/esm/Notifications/ToastContent.d.ts +10 -0
- package/dist/esm/Notifications/ToastContent.d.ts.map +1 -0
- package/dist/esm/Notifications/ToastContent.js +7 -0
- package/dist/esm/Notifications/ToastContent.js.map +1 -0
- package/dist/esm/Notifications/Toaster.d.ts.map +1 -1
- package/dist/esm/Notifications/Toaster.js +8 -17
- package/dist/esm/Notifications/Toaster.js.map +1 -1
- package/dist/esm/Notifications/useToastAutoDismiss.d.ts +4 -0
- package/dist/esm/Notifications/useToastAutoDismiss.d.ts.map +1 -0
- package/dist/esm/Notifications/useToastAutoDismiss.js +20 -0
- package/dist/esm/Notifications/useToastAutoDismiss.js.map +1 -0
- package/dist/esm/PivotViewer/PivotViewer.d.ts +1 -1
- package/dist/esm/PivotViewer/PivotViewer.d.ts.map +1 -1
- package/dist/esm/PivotViewer/PivotViewer.js +24 -31
- package/dist/esm/PivotViewer/PivotViewer.js.map +1 -1
- package/dist/esm/PivotViewer/components/PivotViewerContent.d.ts +40 -0
- package/dist/esm/PivotViewer/components/PivotViewerContent.d.ts.map +1 -0
- package/dist/esm/PivotViewer/components/PivotViewerContent.js +13 -0
- package/dist/esm/PivotViewer/components/PivotViewerContent.js.map +1 -0
- package/dist/esm/PivotViewer/hooks/usePivotViewerViewState.d.ts +37 -0
- package/dist/esm/PivotViewer/hooks/usePivotViewerViewState.d.ts.map +1 -0
- package/dist/esm/PivotViewer/hooks/usePivotViewerViewState.js +35 -0
- package/dist/esm/PivotViewer/hooks/usePivotViewerViewState.js.map +1 -0
- package/dist/esm/TimeMachine/EventCard.d.ts +9 -0
- package/dist/esm/TimeMachine/EventCard.d.ts.map +1 -0
- package/dist/esm/TimeMachine/EventCard.js +8 -0
- package/dist/esm/TimeMachine/EventCard.js.map +1 -0
- package/dist/esm/TimeMachine/EventSeparator.d.ts +11 -0
- package/dist/esm/TimeMachine/EventSeparator.d.ts.map +1 -0
- package/dist/esm/TimeMachine/EventSeparator.js +7 -0
- package/dist/esm/TimeMachine/EventSeparator.js.map +1 -0
- package/dist/esm/TimeMachine/EventTimelineItem.d.ts +14 -0
- package/dist/esm/TimeMachine/EventTimelineItem.d.ts.map +1 -0
- package/dist/esm/TimeMachine/EventTimelineItem.js +9 -0
- package/dist/esm/TimeMachine/EventTimelineItem.js.map +1 -0
- package/dist/esm/TimeMachine/EventsScrollButton.d.ts +10 -0
- package/dist/esm/TimeMachine/EventsScrollButton.d.ts.map +1 -0
- package/dist/esm/TimeMachine/EventsScrollButton.js +6 -0
- package/dist/esm/TimeMachine/EventsScrollButton.js.map +1 -0
- package/dist/esm/TimeMachine/EventsView.d.ts +1 -1
- package/dist/esm/TimeMachine/EventsView.d.ts.map +1 -1
- package/dist/esm/TimeMachine/EventsView.js +6 -39
- package/dist/esm/TimeMachine/EventsView.js.map +1 -1
- package/dist/esm/TimeMachine/useScrollEdges.d.ts +13 -0
- package/dist/esm/TimeMachine/useScrollEdges.d.ts.map +1 -0
- package/dist/esm/TimeMachine/useScrollEdges.js +40 -0
- package/dist/esm/TimeMachine/useScrollEdges.js.map +1 -0
- package/dist/esm/Toolbar/ToolbarFolder.js +1 -1
- package/dist/esm/renderer/index.d.ts +1 -1
- package/dist/esm/renderer/index.d.ts.map +1 -1
- package/dist/esm/renderer/index.js +1 -1
- package/dist/esm/renderer/manifest.d.ts.map +1 -1
- package/dist/esm/renderer/manifest.js +23 -3
- package/dist/esm/renderer/manifest.js.map +1 -1
- package/dist/esm/renderer/presentation.d.ts +45 -2
- package/dist/esm/renderer/presentation.d.ts.map +1 -1
- package/dist/esm/renderer/presentation.js +113 -29
- package/dist/esm/renderer/presentation.js.map +1 -1
- package/dist/esm/renderer/resolve.d.ts +4 -1
- package/dist/esm/renderer/resolve.d.ts.map +1 -1
- package/dist/esm/renderer/resolve.js +24 -15
- package/dist/esm/renderer/resolve.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ const cratisPresentationSlotIds = Object.freeze([
|
|
|
11
11
|
'common.progress',
|
|
12
12
|
'common.surface',
|
|
13
13
|
]);
|
|
14
|
+
const cratisAtomicSlotIds = Object.freeze(['datatables.paginator']);
|
|
14
15
|
const requiredCapabilityIds = [
|
|
15
16
|
'slot.render',
|
|
16
17
|
'parts.passthrough',
|
|
@@ -27,23 +28,30 @@ const invalidPresentationLibrary = (reason) => {
|
|
|
27
28
|
};
|
|
28
29
|
const hasCanonicalProfileSlots = (profileSlots) => profileSlots.length === cratisPresentationSlotIds.length &&
|
|
29
30
|
profileSlots.every((slotId, index) => slotId === cratisPresentationSlotIds[index]);
|
|
30
|
-
const
|
|
31
|
+
const isRecord = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
32
|
+
const isRendererIdentity = (id) => typeof id === 'string' &&
|
|
33
|
+
id.length <= 128 &&
|
|
34
|
+
/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u.test(id);
|
|
35
|
+
const isDisplayName = (displayName) => typeof displayName === 'string' &&
|
|
36
|
+
displayName.trim().length > 0 &&
|
|
37
|
+
displayName.length <= 128;
|
|
38
|
+
const isComponent = (render) => render !== null && (typeof render === 'function' || typeof render === 'object');
|
|
39
|
+
const isStableFidelity = (fidelity) => fidelity === 'native' || fidelity === 'emulated';
|
|
40
|
+
const validateIdentity = (library) => {
|
|
31
41
|
if (library === null || typeof library !== 'object') {
|
|
32
42
|
invalidPresentationLibrary('manifest must be an object');
|
|
33
43
|
}
|
|
34
|
-
if (
|
|
35
|
-
library.id.length > 128 ||
|
|
36
|
-
!/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u.test(library.id)) {
|
|
44
|
+
if (!isRendererIdentity(library.id)) {
|
|
37
45
|
invalidPresentationLibrary('id must be a valid package-local renderer identity');
|
|
38
46
|
}
|
|
39
|
-
if (
|
|
40
|
-
library.displayName.trim().length === 0 ||
|
|
41
|
-
library.displayName.length > 128) {
|
|
47
|
+
if (!isDisplayName(library.displayName)) {
|
|
42
48
|
invalidPresentationLibrary('displayName must contain between 1 and 128 characters');
|
|
43
49
|
}
|
|
44
50
|
if (library.Provider !== undefined && typeof library.Provider !== 'function') {
|
|
45
51
|
invalidPresentationLibrary('Provider must be a React component when supplied');
|
|
46
52
|
}
|
|
53
|
+
};
|
|
54
|
+
const validateProfile = (library) => {
|
|
47
55
|
if (library.profile !== CRATIS_PRESENTATION_PROFILE) {
|
|
48
56
|
invalidPresentationLibrary(`profile must be '${CRATIS_PRESENTATION_PROFILE}'`);
|
|
49
57
|
}
|
|
@@ -57,6 +65,23 @@ const definePresentationUiLibrary = (library) => {
|
|
|
57
65
|
!hasCanonicalProfileSlots(library.profileSlots)) {
|
|
58
66
|
invalidPresentationLibrary('profileSlots must be the canonical nine-slot profile');
|
|
59
67
|
}
|
|
68
|
+
};
|
|
69
|
+
const declarationProblem = (declaration, label, mode) => {
|
|
70
|
+
if (declaration.mode !== mode)
|
|
71
|
+
return `${label} must use ${mode} mode`;
|
|
72
|
+
if (!isStableFidelity(declaration.fidelity)) {
|
|
73
|
+
return `${label} must use native or emulated fidelity`;
|
|
74
|
+
}
|
|
75
|
+
if (!isComponent(declaration.render))
|
|
76
|
+
return `${label} must provide a component`;
|
|
77
|
+
return undefined;
|
|
78
|
+
};
|
|
79
|
+
const validateDeclaration = (declaration, label, mode) => {
|
|
80
|
+
const problem = declarationProblem(declaration, label, mode);
|
|
81
|
+
if (problem)
|
|
82
|
+
invalidPresentationLibrary(problem);
|
|
83
|
+
};
|
|
84
|
+
const validateSlots = (library) => {
|
|
60
85
|
if (!library.slots || typeof library.slots !== 'object') {
|
|
61
86
|
invalidPresentationLibrary('slots must be an object');
|
|
62
87
|
}
|
|
@@ -68,20 +93,12 @@ const definePresentationUiLibrary = (library) => {
|
|
|
68
93
|
for (const slotId of cratisPresentationSlotIds) {
|
|
69
94
|
const declaration = library.slots[slotId];
|
|
70
95
|
if (!declaration) {
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
if (declaration.mode !== 'presentation') {
|
|
74
|
-
invalidPresentationLibrary(`slot '${slotId}' must use presentation mode`);
|
|
75
|
-
}
|
|
76
|
-
if (declaration.fidelity !== 'native' && declaration.fidelity !== 'emulated') {
|
|
77
|
-
invalidPresentationLibrary(`slot '${slotId}' must use native or emulated fidelity`);
|
|
78
|
-
}
|
|
79
|
-
if (declaration.render === null ||
|
|
80
|
-
(typeof declaration.render !== 'function' &&
|
|
81
|
-
typeof declaration.render !== 'object')) {
|
|
82
|
-
invalidPresentationLibrary(`slot '${slotId}' must provide a component`);
|
|
96
|
+
invalidPresentationLibrary(`slot '${slotId}' must provide a declaration`);
|
|
83
97
|
}
|
|
98
|
+
validateDeclaration(declaration, `slot '${slotId}'`, 'presentation');
|
|
84
99
|
}
|
|
100
|
+
};
|
|
101
|
+
const validateCapabilities = (library) => {
|
|
85
102
|
if (!Array.isArray(library.capabilities) ||
|
|
86
103
|
library.capabilities.some((capability) => !stableCapabilityIds.has(capability))) {
|
|
87
104
|
invalidPresentationLibrary('capabilities must stay within the stable presentation subset');
|
|
@@ -92,14 +109,70 @@ const definePresentationUiLibrary = (library) => {
|
|
|
92
109
|
if (new Set(library.capabilities).size !== library.capabilities.length) {
|
|
93
110
|
invalidPresentationLibrary('capabilities must not contain duplicates');
|
|
94
111
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
};
|
|
113
|
+
const isStableAtomicSlotId = (slotId) => cratisAtomicSlotIds.includes(slotId);
|
|
114
|
+
const snapshotDeclaration = (declaration) => ({
|
|
115
|
+
mode: declaration.mode,
|
|
116
|
+
fidelity: declaration.fidelity,
|
|
117
|
+
render: declaration.render,
|
|
118
|
+
});
|
|
119
|
+
const inspectAtomicSlot = (slotId, value) => {
|
|
120
|
+
const label = `atomic slot '${slotId}'`;
|
|
121
|
+
if (!isStableAtomicSlotId(slotId)) {
|
|
122
|
+
return { slotId, problem: `${label} is not a stable atomic slot` };
|
|
123
|
+
}
|
|
124
|
+
if (value === undefined)
|
|
125
|
+
return { slotId };
|
|
126
|
+
if (!isRecord(value))
|
|
127
|
+
return { slotId, problem: `${label} must provide a declaration` };
|
|
128
|
+
const declaration = snapshotDeclaration(value);
|
|
129
|
+
return { slotId, declaration, problem: declarationProblem(declaration, label, 'atomic') };
|
|
130
|
+
};
|
|
131
|
+
const isPlainPrototype = (prototype) => prototype === null || prototype === Object.prototype;
|
|
132
|
+
const inspectAtomicSlots = (atomicSlots) => {
|
|
133
|
+
if (atomicSlots === undefined)
|
|
134
|
+
return { entries: [] };
|
|
135
|
+
if (!isRecord(atomicSlots)) {
|
|
136
|
+
return { problem: 'atomicSlots must be an object when supplied', entries: [] };
|
|
137
|
+
}
|
|
138
|
+
if (!isPlainPrototype(Object.getPrototypeOf(atomicSlots))) {
|
|
139
|
+
return {
|
|
140
|
+
problem: 'atomicSlots must be a plain object; inherited declarations are not allowed',
|
|
141
|
+
entries: [],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
entries: Object.keys(atomicSlots).map((slotId) => inspectAtomicSlot(slotId, atomicSlots[slotId])),
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
const isUsableAtomicSlot = (entry) => entry.problem === undefined && entry.declaration !== undefined;
|
|
149
|
+
const usableAtomicSlots = (entries) => Object.freeze(Object.fromEntries(entries
|
|
150
|
+
.filter(isUsableAtomicSlot)
|
|
151
|
+
.map(({ slotId, declaration }) => [slotId, Object.freeze(declaration)])));
|
|
152
|
+
const frozenValidAtomicSlots = (atomicSlots) => {
|
|
153
|
+
if (atomicSlots === undefined)
|
|
154
|
+
return undefined;
|
|
155
|
+
const inspection = inspectAtomicSlots(atomicSlots);
|
|
156
|
+
const problem = inspection.problem ?? inspection.entries.find((entry) => entry.problem)?.problem;
|
|
157
|
+
if (problem)
|
|
158
|
+
invalidPresentationLibrary(problem);
|
|
159
|
+
return usableAtomicSlots(inspection.entries);
|
|
160
|
+
};
|
|
161
|
+
const freezeDeclaration = (declaration) => Object.freeze({
|
|
162
|
+
mode: declaration.mode,
|
|
163
|
+
fidelity: declaration.fidelity,
|
|
164
|
+
render: declaration.render,
|
|
165
|
+
});
|
|
166
|
+
const freezePresentationSlots = (slots) => Object.freeze(Object.fromEntries(cratisPresentationSlotIds.map((slotId) => [
|
|
167
|
+
slotId,
|
|
168
|
+
freezeDeclaration(slots[slotId]),
|
|
169
|
+
])));
|
|
170
|
+
const definePresentationUiLibrary = (library) => {
|
|
171
|
+
validateIdentity(library);
|
|
172
|
+
validateProfile(library);
|
|
173
|
+
validateSlots(library);
|
|
174
|
+
validateCapabilities(library);
|
|
175
|
+
const atomicSlots = frozenValidAtomicSlots(library.atomicSlots);
|
|
103
176
|
return Object.freeze({
|
|
104
177
|
id: library.id,
|
|
105
178
|
displayName: library.displayName,
|
|
@@ -110,10 +183,21 @@ const definePresentationUiLibrary = (library) => {
|
|
|
110
183
|
capabilities: Object.freeze([
|
|
111
184
|
...library.capabilities,
|
|
112
185
|
]),
|
|
113
|
-
slots,
|
|
186
|
+
slots: freezePresentationSlots(library.slots),
|
|
114
187
|
Provider: library.Provider,
|
|
188
|
+
...(atomicSlots === undefined ? {} : { atomicSlots }),
|
|
115
189
|
});
|
|
116
190
|
};
|
|
191
|
+
const atomicSlotsInspectionOf = (library) => library.profile === CRATIS_PRESENTATION_PROFILE
|
|
192
|
+
? inspectAtomicSlots(library.atomicSlots)
|
|
193
|
+
: { entries: [] };
|
|
194
|
+
const stableAtomicSlotProblemsOf = (library) => {
|
|
195
|
+
const inspection = atomicSlotsInspectionOf(library);
|
|
196
|
+
if (inspection.problem)
|
|
197
|
+
return [{ message: inspection.problem }];
|
|
198
|
+
return inspection.entries.flatMap(({ slotId, problem }) => problem ? [{ slotId, message: problem }] : []);
|
|
199
|
+
};
|
|
200
|
+
const stableAtomicSlotsOf = (library) => usableAtomicSlots(atomicSlotsInspectionOf(library).entries);
|
|
117
201
|
|
|
118
|
-
export { CRATIS_PRESENTATION_ABI_VERSION, CRATIS_PRESENTATION_PROFILE, cratisPresentationSlotIds, definePresentationUiLibrary };
|
|
202
|
+
export { CRATIS_PRESENTATION_ABI_VERSION, CRATIS_PRESENTATION_PROFILE, cratisAtomicSlotIds, cratisPresentationSlotIds, definePresentationUiLibrary, stableAtomicSlotProblemsOf, stableAtomicSlotsOf };
|
|
119
203
|
//# sourceMappingURL=presentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation.js","sources":["../../../renderer/presentation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ComponentType } from 'react';\nimport type { ButtonProps } from '../Common/Button';\nimport type { CheckboxProps } from '../Common/Checkbox';\nimport type { IconButtonProps } from '../Common/IconButton';\nimport type { RadioProps } from '../Common/Radio';\nimport type { SurfaceProps } from '../Common/Surface';\nimport type { SwitchProps } from '../Common/Switch';\nimport type { TextAreaProps } from '../Common/TextArea';\nimport type { TextInputProps } from '../Common/TextInput';\nimport type { ProgressBarProps } from '../Display/ProgressBar';\nimport type { CratisPresentationUiLibraryProviderProps } from './manifest';\n\n/** Stable renderer profile implemented by certified presentation adapters. */\nexport const CRATIS_PRESENTATION_PROFILE = 'stable-presentation/v1' as const;\n\n/** Renderer ABI major for the stable presentation profile. */\nexport const CRATIS_PRESENTATION_ABI_VERSION = 1 as const;\n\n/** Immutable, canonical slot order for the stable presentation profile. */\nexport const cratisPresentationSlotIds = Object.freeze([\n 'common.button',\n 'common.iconButton',\n 'common.textInput',\n 'common.textArea',\n 'common.checkbox',\n 'common.radio',\n 'common.switch',\n 'common.progress',\n 'common.surface',\n] as const);\n\n/** Identifier of one stable presentation slot. */\nexport type CratisPresentationSlotId = (typeof cratisPresentationSlotIds)[number];\n\n/** Exact public component prop and ref contracts covered by the stable presentation profile. */\nexport interface CratisPresentationSlots {\n /** Cratis button presentation contract, including native button refs and form behavior. */\n readonly 'common.button': ButtonProps;\n /** Accessible icon-only button contract with native button ownership. */\n readonly 'common.iconButton': IconButtonProps;\n /** Native text-input contract with semantic value-first change events. */\n readonly 'common.textInput': TextInputProps;\n /** Native multiline text-input contract with semantic value-first change events. */\n readonly 'common.textArea': TextAreaProps;\n /** Native checkbox contract with checked state, form participation, and input refs. */\n readonly 'common.checkbox': CheckboxProps;\n /** Native radio-option contract with selection state, form participation, and input refs. */\n readonly 'common.radio': RadioProps;\n /** Boolean switch contract preserving switch semantics and input ownership. */\n readonly 'common.switch': SwitchProps;\n /** Determinate or indeterminate progress presentation contract. */\n readonly 'common.progress': ProgressBarProps;\n /** Non-interactive semantic surface and native-element presentation contract. */\n readonly 'common.surface': SurfaceProps;\n}\n\n/** One stable, presentation-owned renderer slot declaration. */\nexport interface CratisPresentationSlotDeclaration<\n SlotId extends CratisPresentationSlotId,\n> {\n /** Stable presentation slots always preserve Components behavior ownership. */\n readonly mode: 'presentation';\n /** Unsupported declarations cannot claim the stable profile. */\n readonly fidelity: 'native' | 'emulated';\n /** Component implementing the slot's exact public props and ref contract. */\n readonly render: ComponentType<CratisPresentationSlots[SlotId]>;\n}\n\n/** Complete implementation table required by the stable presentation profile. */\nexport type CratisPresentationSlotMap = {\n readonly [\n SlotId in CratisPresentationSlotId\n ]: CratisPresentationSlotDeclaration<SlotId>;\n};\n\n/** Capabilities whose meaning is stable for the bounded presentation profile. */\nexport type CratisPresentationCapabilityId =\n | 'slot.render'\n | 'parts.passthrough'\n | 'ssr.staticRender'\n | 'rtl'\n | 'forcedColors'\n | 'motion.reduced';\n\ntype CratisPresentationOptionalCapabilityId = Exclude<\n CratisPresentationCapabilityId,\n 'slot.render' | 'parts.passthrough' | 'ssr.staticRender'\n>;\n\n/** Required presentation capabilities followed by optional stable evidence capabilities. */\nexport type CratisPresentationCapabilities = readonly [\n 'slot.render',\n 'parts.passthrough',\n 'ssr.staticRender',\n ...CratisPresentationOptionalCapabilityId[],\n];\n\n/** Immutable manifest for one implementation of the stable presentation profile. */\nexport interface CratisPresentationUiLibrary {\n /** Stable, package-local renderer identity used for diagnostics and telemetry. */\n readonly id: string;\n /** Human-readable renderer name. */\n readonly displayName: string;\n /** Stable presentation renderer ABI major. */\n readonly abi: typeof CRATIS_PRESENTATION_ABI_VERSION;\n /** The bounded profile is a primitive presentation adapter. */\n readonly level: 'primitive';\n /** Exact stable presentation profile identifier. */\n readonly profile: typeof CRATIS_PRESENTATION_PROFILE;\n /** Canonical immutable list of all nine stable slots. */\n readonly profileSlots: typeof cratisPresentationSlotIds;\n /** Required presentation capabilities followed by any optional stable capabilities. */\n readonly capabilities: CratisPresentationCapabilities;\n /** Complete nine-slot presentation implementation. */\n readonly slots: CratisPresentationSlotMap;\n /** Optional provider mounted once around the selected renderer scope. */\n readonly Provider?: ComponentType<CratisPresentationUiLibraryProviderProps>;\n}\n\nconst requiredCapabilityIds = [\n 'slot.render',\n 'parts.passthrough',\n 'ssr.staticRender',\n] as const;\n\nconst stableCapabilityIds = new Set<CratisPresentationCapabilityId>([\n ...requiredCapabilityIds,\n 'rtl',\n 'forcedColors',\n 'motion.reduced',\n]);\n\nconst invalidPresentationLibrary = (reason: string): never => {\n throw new TypeError(`Invalid stable presentation UI library: ${reason}.`);\n};\n\nconst hasCanonicalProfileSlots = (profileSlots: readonly unknown[]): boolean =>\n profileSlots.length === cratisPresentationSlotIds.length &&\n profileSlots.every((slotId, index) => slotId === cratisPresentationSlotIds[index]);\n\n/**\n * Defines and freezes a complete implementation of the stable nine-slot presentation profile.\n * Runtime validation protects JavaScript callers from claiming a profile they do not implement.\n *\n * @param library Stable presentation library declaration.\n * @returns A defensive, deeply frozen manifest copy.\n */\nexport const definePresentationUiLibrary = (\n library: CratisPresentationUiLibrary,\n): CratisPresentationUiLibrary => {\n if (library === null || typeof library !== 'object') {\n invalidPresentationLibrary('manifest must be an object');\n }\n if (\n typeof library.id !== 'string' ||\n library.id.length > 128 ||\n !/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u.test(library.id)\n ) {\n invalidPresentationLibrary('id must be a valid package-local renderer identity');\n }\n if (\n typeof library.displayName !== 'string' ||\n library.displayName.trim().length === 0 ||\n library.displayName.length > 128\n ) {\n invalidPresentationLibrary(\n 'displayName must contain between 1 and 128 characters',\n );\n }\n if (library.Provider !== undefined && typeof library.Provider !== 'function') {\n invalidPresentationLibrary('Provider must be a React component when supplied');\n }\n if (library.profile !== CRATIS_PRESENTATION_PROFILE) {\n invalidPresentationLibrary(`profile must be '${CRATIS_PRESENTATION_PROFILE}'`);\n }\n if (library.abi !== CRATIS_PRESENTATION_ABI_VERSION) {\n invalidPresentationLibrary(`ABI must be ${CRATIS_PRESENTATION_ABI_VERSION}`);\n }\n if (library.level !== 'primitive') {\n invalidPresentationLibrary(\"level must be 'primitive'\");\n }\n if (\n !Array.isArray(library.profileSlots) ||\n !hasCanonicalProfileSlots(library.profileSlots)\n ) {\n invalidPresentationLibrary(\n 'profileSlots must be the canonical nine-slot profile',\n );\n }\n if (!library.slots || typeof library.slots !== 'object') {\n invalidPresentationLibrary('slots must be an object');\n }\n\n const slotIds = Object.keys(library.slots);\n if (\n slotIds.length !== cratisPresentationSlotIds.length ||\n cratisPresentationSlotIds.some((slotId) => !slotIds.includes(slotId))\n ) {\n invalidPresentationLibrary(\n 'slots must contain exactly the nine stable presentation slots',\n );\n }\n\n for (const slotId of cratisPresentationSlotIds) {\n // SAFETY: the canonical slot list indexes the complete stable map; the wider record view\n // exists only so runtime JavaScript callers can be checked before their value is frozen.\n const declaration = library.slots[slotId] as unknown as\n Record<string, unknown> | undefined;\n if (!declaration) {\n throw new TypeError(\n `Invalid stable presentation UI library: slot '${slotId}' must provide a declaration.`,\n );\n }\n if (declaration.mode !== 'presentation') {\n invalidPresentationLibrary(`slot '${slotId}' must use presentation mode`);\n }\n if (declaration.fidelity !== 'native' && declaration.fidelity !== 'emulated') {\n invalidPresentationLibrary(\n `slot '${slotId}' must use native or emulated fidelity`,\n );\n }\n if (\n declaration.render === null ||\n (typeof declaration.render !== 'function' &&\n typeof declaration.render !== 'object')\n ) {\n invalidPresentationLibrary(`slot '${slotId}' must provide a component`);\n }\n }\n\n if (\n !Array.isArray(library.capabilities) ||\n library.capabilities.some((capability) => !stableCapabilityIds.has(capability))\n ) {\n invalidPresentationLibrary(\n 'capabilities must stay within the stable presentation subset',\n );\n }\n if (\n requiredCapabilityIds.some(\n (capability, index) => library.capabilities[index] !== capability,\n )\n ) {\n invalidPresentationLibrary(\n 'capabilities must begin with slot.render, parts.passthrough, and ssr.staticRender',\n );\n }\n if (new Set(library.capabilities).size !== library.capabilities.length) {\n invalidPresentationLibrary('capabilities must not contain duplicates');\n }\n\n const slots = Object.freeze(\n Object.fromEntries(\n cratisPresentationSlotIds.map((slotId) => [\n slotId,\n Object.freeze({\n mode: library.slots[slotId].mode,\n fidelity: library.slots[slotId].fidelity,\n render: library.slots[slotId].render,\n }),\n ]),\n ),\n ) as CratisPresentationSlotMap;\n\n return Object.freeze({\n id: library.id,\n displayName: library.displayName,\n abi: library.abi,\n level: library.level,\n profile: library.profile,\n profileSlots: cratisPresentationSlotIds,\n capabilities: Object.freeze([\n ...library.capabilities,\n ]) as CratisPresentationCapabilities,\n slots,\n Provider: library.Provider,\n });\n};\n"],"names":[],"mappings":"AAgBO,MAAM,2BAA2B,GAAG;AAGpC,MAAM,+BAA+B,GAAG;AAGxC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,eAAe;IACf,mBAAmB;IACnB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,gBAAgB;AACV,CAAA;AA0FV,MAAM,qBAAqB,GAAG;IAC1B,aAAa;IACb,mBAAmB;IACnB,kBAAkB;CACZ;AAEV,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAiC;AAChE,IAAA,GAAG,qBAAqB;IACxB,KAAK;IACL,cAAc;IACd,gBAAgB;AACnB,CAAA,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAAC,MAAc,KAAW;AACzD,IAAA,MAAM,IAAI,SAAS,CAAC,2CAA2C,MAAM,CAAA,CAAA,CAAG,C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E;QACd,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO;AACxB,QAAA,YAAY,EAAE,yBAAyB;AACvC,QAAA,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC;YACxB,GAAG,OAAO,CAAC,YAAY;SAC1B,CAAmC;QACpC,KAAK;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;AAC7B,KAAA,CAAC;AACN;;"}
|
|
1
|
+
{"version":3,"file":"presentation.js","sources":["../../../renderer/presentation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ComponentType } from 'react';\nimport type { ButtonProps } from '../Common/Button';\nimport type { CheckboxProps } from '../Common/Checkbox';\nimport type { IconButtonProps } from '../Common/IconButton';\nimport type { RadioProps } from '../Common/Radio';\nimport type { SurfaceProps } from '../Common/Surface';\nimport type { SwitchProps } from '../Common/Switch';\nimport type { TextAreaProps } from '../Common/TextArea';\nimport type { TextInputProps } from '../Common/TextInput';\nimport type { TablePaginatorProps } from '../DataTables/TablePaginator';\nimport type { ProgressBarProps } from '../Display/ProgressBar';\nimport type { CratisPresentationUiLibraryProviderProps } from './manifest';\nimport type { unstable_SlotMap } from './slots';\n\n/** Stable renderer profile implemented by certified presentation adapters. */\nexport const CRATIS_PRESENTATION_PROFILE = 'stable-presentation/v1' as const;\n\n/** Renderer ABI major for the stable presentation profile. */\nexport const CRATIS_PRESENTATION_ABI_VERSION = 1 as const;\n\n/** Immutable, canonical slot order for the stable presentation profile. */\nexport const cratisPresentationSlotIds = Object.freeze([\n 'common.button',\n 'common.iconButton',\n 'common.textInput',\n 'common.textArea',\n 'common.checkbox',\n 'common.radio',\n 'common.switch',\n 'common.progress',\n 'common.surface',\n] as const);\n\n/** Identifier of one stable presentation slot. */\nexport type CratisPresentationSlotId = (typeof cratisPresentationSlotIds)[number];\n\n/** Exact public component prop and ref contracts covered by the stable presentation profile. */\nexport interface CratisPresentationSlots {\n /** Cratis button presentation contract, including native button refs and form behavior. */\n readonly 'common.button': ButtonProps;\n /** Accessible icon-only button contract with native button ownership. */\n readonly 'common.iconButton': IconButtonProps;\n /** Native text-input contract with semantic value-first change events. */\n readonly 'common.textInput': TextInputProps;\n /** Native multiline text-input contract with semantic value-first change events. */\n readonly 'common.textArea': TextAreaProps;\n /** Native checkbox contract with checked state, form participation, and input refs. */\n readonly 'common.checkbox': CheckboxProps;\n /** Native radio-option contract with selection state, form participation, and input refs. */\n readonly 'common.radio': RadioProps;\n /** Boolean switch contract preserving switch semantics and input ownership. */\n readonly 'common.switch': SwitchProps;\n /** Determinate or indeterminate progress presentation contract. */\n readonly 'common.progress': ProgressBarProps;\n /** Non-interactive semantic surface and native-element presentation contract. */\n readonly 'common.surface': SurfaceProps;\n}\n\n/** One stable, presentation-owned renderer slot declaration. */\nexport interface CratisPresentationSlotDeclaration<\n SlotId extends CratisPresentationSlotId,\n> {\n /** Stable presentation slots always preserve Components behavior ownership. */\n readonly mode: 'presentation';\n /** Unsupported declarations cannot claim the stable profile. */\n readonly fidelity: 'native' | 'emulated';\n /** Component implementing the slot's exact public props and ref contract. */\n readonly render: ComponentType<CratisPresentationSlots[SlotId]>;\n}\n\n/** Complete implementation table required by the stable presentation profile. */\nexport type CratisPresentationSlotMap = {\n readonly [\n SlotId in CratisPresentationSlotId\n ]: CratisPresentationSlotDeclaration<SlotId>;\n};\n\n/**\n * Immutable list of the atomic slots whose contracts are stable. A stable presentation library may\n * implement any of them through {@link CratisPresentationUiLibrary.atomicSlots}; new ids are only\n * ever appended.\n */\nexport const cratisAtomicSlotIds = Object.freeze(['datatables.paginator'] as const);\n\n/** Identifier of one stable atomic slot. */\nexport type CratisAtomicSlotId = (typeof cratisAtomicSlotIds)[number];\n\n/** Exact public component prop contracts covered by the stable atomic slots. */\nexport interface CratisAtomicSlots {\n /**\n * Table paginator contract: zero-based `page`, `pageCount`, zero-based `onPageChange`, the\n * `TablePaginatorParts` parts and no ref.\n */\n readonly 'datatables.paginator': TablePaginatorProps;\n}\n\n/** One stable, adapter-owned atomic slot declaration. */\nexport interface CratisAtomicSlotDeclaration<SlotId extends CratisAtomicSlotId> {\n /** Stable atomic slots give the adapter ownership of the complete interaction. */\n readonly mode: 'atomic';\n /** Unsupported declarations are expressed by omitting the slot. */\n readonly fidelity: 'native' | 'emulated';\n /** Component implementing the slot's exact public props contract. */\n readonly render: ComponentType<CratisAtomicSlots[SlotId]>;\n}\n\n/** Optional atomic implementations. An omitted slot keeps the built-in Components implementation. */\nexport type CratisAtomicSlotMap = {\n readonly [SlotId in CratisAtomicSlotId]?: CratisAtomicSlotDeclaration<SlotId>;\n};\n\n/** Capabilities whose meaning is stable for the bounded presentation profile. */\nexport type CratisPresentationCapabilityId =\n | 'slot.render'\n | 'parts.passthrough'\n | 'ssr.staticRender'\n | 'rtl'\n | 'forcedColors'\n | 'motion.reduced';\n\ntype CratisPresentationOptionalCapabilityId = Exclude<\n CratisPresentationCapabilityId,\n 'slot.render' | 'parts.passthrough' | 'ssr.staticRender'\n>;\n\n/** Required presentation capabilities followed by optional stable evidence capabilities. */\nexport type CratisPresentationCapabilities = readonly [\n 'slot.render',\n 'parts.passthrough',\n 'ssr.staticRender',\n ...CratisPresentationOptionalCapabilityId[],\n];\n\n/** Immutable manifest for one implementation of the stable presentation profile. */\nexport interface CratisPresentationUiLibrary {\n /** Stable, package-local renderer identity used for diagnostics and telemetry. */\n readonly id: string;\n /** Human-readable renderer name. */\n readonly displayName: string;\n /** Stable presentation renderer ABI major. */\n readonly abi: typeof CRATIS_PRESENTATION_ABI_VERSION;\n /** The bounded profile is a primitive presentation adapter. */\n readonly level: 'primitive';\n /** Exact stable presentation profile identifier. */\n readonly profile: typeof CRATIS_PRESENTATION_PROFILE;\n /** Canonical immutable list of all nine stable slots. */\n readonly profileSlots: typeof cratisPresentationSlotIds;\n /** Required presentation capabilities followed by any optional stable capabilities. */\n readonly capabilities: CratisPresentationCapabilities;\n /** Complete nine-slot presentation implementation. */\n readonly slots: CratisPresentationSlotMap;\n /** Optional provider mounted once around the selected renderer scope. */\n readonly Provider?: ComponentType<CratisPresentationUiLibraryProviderProps>;\n /**\n * Optional adapter-owned implementations of stable atomic slots. Omitted slots resolve to the\n * built-in Components implementation.\n */\n readonly atomicSlots?: CratisAtomicSlotMap;\n}\n\nconst requiredCapabilityIds = [\n 'slot.render',\n 'parts.passthrough',\n 'ssr.staticRender',\n] as const;\n\nconst stableCapabilityIds = new Set<CratisPresentationCapabilityId>([\n ...requiredCapabilityIds,\n 'rtl',\n 'forcedColors',\n 'motion.reduced',\n]);\n\nconst invalidPresentationLibrary: (reason: string) => never = (reason) => {\n throw new TypeError(`Invalid stable presentation UI library: ${reason}.`);\n};\n\nconst hasCanonicalProfileSlots = (profileSlots: readonly unknown[]): boolean =>\n profileSlots.length === cratisPresentationSlotIds.length &&\n profileSlots.every((slotId, index) => slotId === cratisPresentationSlotIds[index]);\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n value !== null && typeof value === 'object' && !Array.isArray(value);\n\nconst isRendererIdentity = (id: unknown): boolean =>\n typeof id === 'string' &&\n id.length <= 128 &&\n /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/u.test(id);\n\nconst isDisplayName = (displayName: unknown): boolean =>\n typeof displayName === 'string' &&\n displayName.trim().length > 0 &&\n displayName.length <= 128;\n\nconst isComponent = (render: unknown): boolean =>\n render !== null && (typeof render === 'function' || typeof render === 'object');\n\nconst isStableFidelity = (fidelity: unknown): boolean =>\n fidelity === 'native' || fidelity === 'emulated';\n\nconst validateIdentity = (library: CratisPresentationUiLibrary) => {\n if (library === null || typeof library !== 'object') {\n invalidPresentationLibrary('manifest must be an object');\n }\n if (!isRendererIdentity(library.id)) {\n invalidPresentationLibrary('id must be a valid package-local renderer identity');\n }\n if (!isDisplayName(library.displayName)) {\n invalidPresentationLibrary(\n 'displayName must contain between 1 and 128 characters',\n );\n }\n if (library.Provider !== undefined && typeof library.Provider !== 'function') {\n invalidPresentationLibrary('Provider must be a React component when supplied');\n }\n};\n\nconst validateProfile = (library: CratisPresentationUiLibrary) => {\n if (library.profile !== CRATIS_PRESENTATION_PROFILE) {\n invalidPresentationLibrary(`profile must be '${CRATIS_PRESENTATION_PROFILE}'`);\n }\n if (library.abi !== CRATIS_PRESENTATION_ABI_VERSION) {\n invalidPresentationLibrary(`ABI must be ${CRATIS_PRESENTATION_ABI_VERSION}`);\n }\n if (library.level !== 'primitive') {\n invalidPresentationLibrary(\"level must be 'primitive'\");\n }\n if (\n !Array.isArray(library.profileSlots) ||\n !hasCanonicalProfileSlots(library.profileSlots)\n ) {\n invalidPresentationLibrary(\n 'profileSlots must be the canonical nine-slot profile',\n );\n }\n};\n\nconst declarationProblem = (\n declaration: Record<string, unknown>,\n label: string,\n mode: 'presentation' | 'atomic',\n): string | undefined => {\n if (declaration.mode !== mode) return `${label} must use ${mode} mode`;\n if (!isStableFidelity(declaration.fidelity)) {\n return `${label} must use native or emulated fidelity`;\n }\n if (!isComponent(declaration.render)) return `${label} must provide a component`;\n return undefined;\n};\n\nconst validateDeclaration = (\n declaration: Record<string, unknown>,\n label: string,\n mode: 'presentation' | 'atomic',\n) => {\n const problem = declarationProblem(declaration, label, mode);\n if (problem) invalidPresentationLibrary(problem);\n};\n\nconst validateSlots = (library: CratisPresentationUiLibrary) => {\n if (!library.slots || typeof library.slots !== 'object') {\n invalidPresentationLibrary('slots must be an object');\n }\n\n const slotIds = Object.keys(library.slots);\n if (\n slotIds.length !== cratisPresentationSlotIds.length ||\n cratisPresentationSlotIds.some((slotId) => !slotIds.includes(slotId))\n ) {\n invalidPresentationLibrary(\n 'slots must contain exactly the nine stable presentation slots',\n );\n }\n\n for (const slotId of cratisPresentationSlotIds) {\n // SAFETY: the canonical slot list indexes the complete stable map; the wider record view\n // exists only so runtime JavaScript callers can be checked before their value is frozen.\n const declaration = library.slots[slotId] as unknown as\n Record<string, unknown> | undefined;\n if (!declaration) {\n invalidPresentationLibrary(`slot '${slotId}' must provide a declaration`);\n }\n validateDeclaration(declaration, `slot '${slotId}'`, 'presentation');\n }\n};\n\nconst validateCapabilities = (library: CratisPresentationUiLibrary) => {\n if (\n !Array.isArray(library.capabilities) ||\n library.capabilities.some((capability) => !stableCapabilityIds.has(capability))\n ) {\n invalidPresentationLibrary(\n 'capabilities must stay within the stable presentation subset',\n );\n }\n if (\n requiredCapabilityIds.some(\n (capability, index) => library.capabilities[index] !== capability,\n )\n ) {\n invalidPresentationLibrary(\n 'capabilities must begin with slot.render, parts.passthrough, and ssr.staticRender',\n );\n }\n if (new Set(library.capabilities).size !== library.capabilities.length) {\n invalidPresentationLibrary('capabilities must not contain duplicates');\n }\n};\n\nconst isStableAtomicSlotId = (slotId: string): slotId is CratisAtomicSlotId =>\n (cratisAtomicSlotIds as readonly string[]).includes(slotId);\n\n/** One atomic slot entry inspected from a single own-enumerable snapshot of `atomicSlots`. */\ninterface AtomicSlotEntry {\n readonly slotId: string;\n /** Declaration read exactly once, or undefined for an explicitly omitted slot. */\n readonly declaration?: Readonly<Record<string, unknown>>;\n /** Why the entry cannot be used; undefined when it is valid. */\n readonly problem?: string;\n}\n\n/** Inspection of a library's `atomicSlots`: one problem for the map, or one result per own key. */\ninterface AtomicSlotInspection {\n readonly problem?: string;\n readonly entries: readonly AtomicSlotEntry[];\n}\n\nconst snapshotDeclaration = (declaration: Record<string, unknown>) => ({\n mode: declaration.mode,\n fidelity: declaration.fidelity,\n render: declaration.render,\n});\n\nconst inspectAtomicSlot = (slotId: string, value: unknown): AtomicSlotEntry => {\n const label = `atomic slot '${slotId}'`;\n if (!isStableAtomicSlotId(slotId)) {\n return { slotId, problem: `${label} is not a stable atomic slot` };\n }\n if (value === undefined) return { slotId };\n if (!isRecord(value)) return { slotId, problem: `${label} must provide a declaration` };\n\n const declaration = snapshotDeclaration(value);\n return { slotId, declaration, problem: declarationProblem(declaration, label, 'atomic') };\n};\n\nconst isPlainPrototype = (prototype: unknown): boolean =>\n prototype === null || prototype === Object.prototype;\n\n/**\n * Inspects `atomicSlots` through ONE snapshot of its own enumerable keys, reading each value\n * once. Inherited and non-enumerable declarations never take part in validation or resolution.\n */\nconst inspectAtomicSlots = (atomicSlots: unknown): AtomicSlotInspection => {\n if (atomicSlots === undefined) return { entries: [] };\n if (!isRecord(atomicSlots)) {\n return { problem: 'atomicSlots must be an object when supplied', entries: [] };\n }\n if (!isPlainPrototype(Object.getPrototypeOf(atomicSlots))) {\n return {\n problem: 'atomicSlots must be a plain object; inherited declarations are not allowed',\n entries: [],\n };\n }\n return {\n entries: Object.keys(atomicSlots).map((slotId) =>\n inspectAtomicSlot(slotId, atomicSlots[slotId]),\n ),\n };\n};\n\nconst isUsableAtomicSlot = (\n entry: AtomicSlotEntry,\n): entry is AtomicSlotEntry & { readonly declaration: Readonly<Record<string, unknown>> } =>\n entry.problem === undefined && entry.declaration !== undefined;\n\n/** Builds a frozen slot-id keyed map of the usable entries; keys are own data properties. */\nconst usableAtomicSlots = (entries: readonly AtomicSlotEntry[]): Readonly<Record<string, object>> =>\n Object.freeze(\n Object.fromEntries(\n entries\n .filter(isUsableAtomicSlot)\n .map(({ slotId, declaration }) => [slotId, Object.freeze(declaration)]),\n ),\n );\n\nconst frozenValidAtomicSlots = (atomicSlots: unknown): CratisAtomicSlotMap | undefined => {\n if (atomicSlots === undefined) return undefined;\n const inspection = inspectAtomicSlots(atomicSlots);\n const problem =\n inspection.problem ?? inspection.entries.find((entry) => entry.problem)?.problem;\n if (problem) invalidPresentationLibrary(problem);\n return usableAtomicSlots(inspection.entries) as CratisAtomicSlotMap;\n};\n\nconst freezeDeclaration = <\n Declaration extends {\n readonly mode: string;\n readonly fidelity: string;\n readonly render: unknown;\n },\n>(\n declaration: Declaration,\n): Declaration =>\n Object.freeze({\n mode: declaration.mode,\n fidelity: declaration.fidelity,\n render: declaration.render,\n }) as Declaration;\n\nconst freezePresentationSlots = (\n slots: CratisPresentationSlotMap,\n): CratisPresentationSlotMap =>\n Object.freeze(\n Object.fromEntries(\n cratisPresentationSlotIds.map((slotId) => [\n slotId,\n freezeDeclaration(slots[slotId]),\n ]),\n ),\n ) as CratisPresentationSlotMap;\n\n/**\n * Defines and freezes a complete implementation of the stable nine-slot presentation profile,\n * plus any optional stable atomic slots. Runtime validation protects JavaScript callers from\n * claiming a profile they do not implement.\n *\n * @param library Stable presentation library declaration.\n * @returns A defensive, deeply frozen manifest copy.\n */\nexport const definePresentationUiLibrary = (\n library: CratisPresentationUiLibrary,\n): CratisPresentationUiLibrary => {\n validateIdentity(library);\n validateProfile(library);\n validateSlots(library);\n validateCapabilities(library);\n const atomicSlots = frozenValidAtomicSlots(library.atomicSlots);\n\n return Object.freeze({\n id: library.id,\n displayName: library.displayName,\n abi: library.abi,\n level: library.level,\n profile: library.profile,\n profileSlots: cratisPresentationSlotIds,\n capabilities: Object.freeze([\n ...library.capabilities,\n ]) as CratisPresentationCapabilities,\n slots: freezePresentationSlots(library.slots),\n Provider: library.Provider,\n ...(atomicSlots === undefined ? {} : { atomicSlots }),\n });\n};\n\nconst atomicSlotsInspectionOf = (library: { readonly profile: string }) =>\n library.profile === CRATIS_PRESENTATION_PROFILE\n ? inspectAtomicSlots((library as { readonly atomicSlots?: unknown }).atomicSlots)\n : { entries: [] };\n\n/** One reason a stable presentation library's atomic slot cannot be resolved. */\nexport interface StableAtomicSlotProblem {\n /** Offending slot id, when the problem concerns a single entry. */\n readonly slotId?: string;\n /** Human-readable reason. */\n readonly message: string;\n}\n\n/**\n * Lists why a stable presentation library's atomic slots cannot all be resolved. Libraries built\n * with the generic definer or as raw manifests can claim the stable profile without passing\n * {@link definePresentationUiLibrary}; resolution skips their invalid entries and this reports them.\n *\n * @param library Renderer library being validated.\n * @returns Problems in key order; empty for valid or absent atomic slots and for other profiles.\n * @internal Resolution helper; not part of the public package surface.\n */\nexport const stableAtomicSlotProblemsOf = (library: {\n readonly profile: string;\n}): readonly StableAtomicSlotProblem[] => {\n const inspection: AtomicSlotInspection = atomicSlotsInspectionOf(library);\n if (inspection.problem) return [{ message: inspection.problem }];\n return inspection.entries.flatMap(({ slotId, problem }) =>\n problem ? [{ slotId, message: problem }] : [],\n );\n};\n\n/**\n * Returns the stable atomic slot declarations a stable presentation library adds to resolution.\n * Only own enumerable, fully valid declarations take part; invalid ones fail closed to the\n * built-in implementation and are reported by {@link stableAtomicSlotProblemsOf}. Libraries of any\n * other profile, and libraries without `atomicSlots`, contribute nothing, so their slot tables\n * resolve exactly as before.\n *\n * @param library Renderer library being resolved.\n * @returns The library's stable atomic declarations keyed by slot id; empty when it has none.\n * @internal Resolution helper; not part of the public package surface.\n */\nexport const stableAtomicSlotsOf = (library: {\n readonly profile: string;\n}): unstable_SlotMap =>\n usableAtomicSlots(atomicSlotsInspectionOf(library).entries) as unstable_SlotMap;\n"],"names":[],"mappings":"AAkBO,MAAM,2BAA2B,GAAG;AAGpC,MAAM,+BAA+B,GAAG;AAGxC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,eAAe;IACf,mBAAmB;IACnB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,gBAAgB;AACV,CAAA;AAmDH,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,sBAAsB,CAAU;AA8ElF,MAAM,qBAAqB,GAAG;IAC1B,aAAa;IACb,mBAAmB;IACnB,kBAAkB;CACZ;AAEV,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAiC;AAChE,IAAA,GAAG,qBAAqB;IACxB,KAAK;IACL,cAAc;IACd,gBAAgB;AACnB,CAAA,CAAC;AAEF,MAAM,0BAA0B,GAA8B,CAAC,MAAM,KAAI;AACrE,IAAA,MAAM,IAAI,SAAS,CAAC,2CAA2C,MAAM,CAAA,CAAA,CAAG,CAAC;AAC7E,CAAC;AAED,M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AAE,MAAM,CAAC,MAAM,CAAC;YACxB,GAAG,OAAO,CAAC,YAAY;SAC1B,CAAmC;AACpC,QAAA,KAAK,EAAE,uBAAuB,CAAC,OAAO,CAAC,KAAK,CAAC;QAC7C,QAAQ,EAAE,OAAO,CAAC,QAAQ;AAC1B,QAAA,IAAI,WAAW,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;AACxD,KAAA,CAAC;AACN;AAEA,MAAM,uBAAuB,GAAG,CAAC,OAAqC,KAClE,OAAO,CAAC,OAAO,KAAK;AAChB,MAAE,kBAAkB,CAAE,OAA8C,CAAC,WAAW;AAChF,MAAE,EAAE,OAAO,EAAE,EAAE,EAAE;AAmBlB,MAAM,0BAA0B,GAAG,CAAC,OAE1C,KAAwC;AACrC,IAAA,MAAM,UAAU,GAAyB,uBAAuB,CAAC,OAAO,CAAC;IACzE,IAAI,UAAU,CAAC,OAAO;QAAE,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC;AAChE,IAAA,OAAO,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAClD,OAAO,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,CAChD;AACL;AAaO,MAAM,mBAAmB,GAAG,CAAC,OAEnC,KACG,iBAAiB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,OAAO;;"}
|
|
@@ -18,7 +18,10 @@ export declare const unstable_emptyCoreRendererSlots: unstable_SlotMap;
|
|
|
18
18
|
export declare const unstable_isKnownSlot: (value: unknown) => value is unstable_SlotId;
|
|
19
19
|
/** Normalizes one library or an ordered last-wins composition without deep merging it. */
|
|
20
20
|
export declare const unstable_resolveLibraryInput: (input: unstable_UiLibrary | readonly unstable_UiLibrary[] | undefined) => unstable_ResolvedLibraryInput;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Creates one immutable slot lookup snapshot for a manifest and optional scope filter. A stable
|
|
23
|
+
* presentation library's optional atomic slots join its nine presentation slots here.
|
|
24
|
+
*/
|
|
22
25
|
export declare const unstable_createRendererLayer: (library: unstable_UiLibrary, only?: readonly unstable_SlotId[]) => unstable_RendererLayer;
|
|
23
26
|
/** Runs ABI, profile, capability, and adapter preflight validation. */
|
|
24
27
|
export declare const unstable_validateUiLibrary: (library: unstable_UiLibrary) => readonly unstable_AdapterDiagnostic[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../renderer/resolve.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAU,CAAC;AAE3D,OAAO,
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../renderer/resolve.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAU,CAAC;AAE3D,OAAO,EAIH,KAAK,kBAAkB,EAC1B,MAAM,eAAY,CAAC;AAEpB,OAAO,KAAK,EACR,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EACnB,MAAM,YAAS,CAAC;AAmBjB,oEAAoE;AACpE,MAAM,WAAW,sBAAsB;IACnC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;CAChD;AAED,sFAAsF;AACtF,MAAM,WAAW,6BAA6B;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACtD;AAED,8FAA8F;AAC9F,eAAO,MAAM,+BAA+B,EAAE,gBAAoC,CAAC;AAEnF,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,UAAW,OAAO,KAAG,KAAK,IAAI,eACU,CAAC;AAE1E,0FAA0F;AAC1F,eAAO,MAAM,4BAA4B,UAC9B,kBAAkB,GAAG,SAAS,kBAAkB,EAAE,GAAG,SAAS,KACtE,6BAeF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,YAC5B,kBAAkB,SACpB,SAAS,eAAe,EAAE,KAClC,sBAKG,CAAC;AAgDP,uEAAuE;AACvE,eAAO,MAAM,0BAA0B,YAC1B,kBAAkB,KAC5B,SAAS,0BAA0B,EA2CrC,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,8BAA8B,SACjC,SAAS,kBAAkB,EAAE,SAC5B,SAAS,kBAAkB,EAAE,KACrC,OAEyD,CAAC;AAW7D,8EAA8E;AAC9E,eAAO,MAAM,gCAAgC,WACjC,SAAS,sBAAsB,EAAE,KAC1C,gBASF,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,eAAe,UAClD,CAAC,SACF,gBAAgB,wBACD,wBAAwB,CAAC,CAAC,CAAC,GAAG,SAAS,aAClD,gBAAgB,KAC5B;IAAE,WAAW,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAUxE,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,sBAAsB,eAAgB,0BAA0B,KAAG,MAMjE,CAAC;AAEhB,mFAAmF;AACnF,eAAO,MAAM,sBAAsB,eAAgB,0BAA0B,KAAG,IAI/E,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { unstable_adapterErrorCodes } from './errors.js';
|
|
2
|
-
import { unstable_composeUiLibraries, unstable_CRATIS_UI_ABI_VERSION } from './manifest.js';
|
|
2
|
+
import { unstable_composeUiLibraries, unstable_CRATIS_UI_ABI_VERSION, defineOwnSlot } from './manifest.js';
|
|
3
|
+
import { stableAtomicSlotsOf, stableAtomicSlotProblemsOf } from './presentation.js';
|
|
3
4
|
|
|
4
5
|
const knownSlots = new Set([
|
|
5
6
|
'common.button',
|
|
@@ -35,7 +36,7 @@ const unstable_resolveLibraryInput = (input) => {
|
|
|
35
36
|
};
|
|
36
37
|
const unstable_createRendererLayer = (library, only) => Object.freeze({
|
|
37
38
|
library,
|
|
38
|
-
slots: Object.freeze({ ...library.slots }),
|
|
39
|
+
slots: Object.freeze({ ...library.slots, ...stableAtomicSlotsOf(library) }),
|
|
39
40
|
only: only ? new Set(only) : undefined,
|
|
40
41
|
});
|
|
41
42
|
const missingRequirement = (library, message, remedy, slotId) => ({
|
|
@@ -45,6 +46,16 @@ const missingRequirement = (library, message, remedy, slotId) => ({
|
|
|
45
46
|
message,
|
|
46
47
|
remedy,
|
|
47
48
|
});
|
|
49
|
+
const profileSlotDiagnostic = (library, profileSlot) => {
|
|
50
|
+
if (!unstable_isKnownSlot(profileSlot)) {
|
|
51
|
+
return missingRequirement(library, `Profile '${library.profile}' promises unknown slot '${String(profileSlot)}'.`, 'Remove the unknown slot or install a Core version that declares it.');
|
|
52
|
+
}
|
|
53
|
+
const declaration = library.slots[profileSlot];
|
|
54
|
+
if (declaration && declaration.fidelity !== 'unsupported')
|
|
55
|
+
return undefined;
|
|
56
|
+
return missingRequirement(library, `Profile '${library.profile}' does not support promised slot '${profileSlot}'.`, `Provide a supported '${profileSlot}' declaration or remove it from profileSlots.`, profileSlot);
|
|
57
|
+
};
|
|
58
|
+
const atomicSlotDiagnostics = (library) => stableAtomicSlotProblemsOf(library).map(({ slotId, message }) => missingRequirement(library, `Invalid stable atomic slot declaration: ${message}.`, 'Correct or remove the atomic slot declaration; the built-in implementation is used instead.', unstable_isKnownSlot(slotId) ? slotId : undefined));
|
|
48
59
|
const unstable_validateUiLibrary = (library) => {
|
|
49
60
|
const diagnostics = [];
|
|
50
61
|
if (library.abi !== unstable_CRATIS_UI_ABI_VERSION) {
|
|
@@ -60,15 +71,11 @@ const unstable_validateUiLibrary = (library) => {
|
|
|
60
71
|
diagnostics.push(missingRequirement(library, `Profile '${library.profile}' promises slots without the 'slot.render' capability.`, "Declare 'slot.render' only after the adapter can render every promised slot."));
|
|
61
72
|
}
|
|
62
73
|
for (const profileSlot of profileSlots) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
const declaration = library.slots[profileSlot];
|
|
68
|
-
if (!declaration || declaration.fidelity === 'unsupported') {
|
|
69
|
-
diagnostics.push(missingRequirement(library, `Profile '${library.profile}' does not support promised slot '${profileSlot}'.`, `Provide a supported '${profileSlot}' declaration or remove it from profileSlots.`, profileSlot));
|
|
70
|
-
}
|
|
74
|
+
const diagnostic = profileSlotDiagnostic(library, profileSlot);
|
|
75
|
+
if (diagnostic)
|
|
76
|
+
diagnostics.push(diagnostic);
|
|
71
77
|
}
|
|
78
|
+
diagnostics.push(...atomicSlotDiagnostics(library));
|
|
72
79
|
if (library.preflight) {
|
|
73
80
|
try {
|
|
74
81
|
diagnostics.push(...library.preflight());
|
|
@@ -86,15 +93,17 @@ const unstable_validateUiLibrary = (library) => {
|
|
|
86
93
|
};
|
|
87
94
|
const unstable_sameLibraryReferences = (left, right) => left.length === right.length &&
|
|
88
95
|
left.every((library, index) => library === right[index]);
|
|
96
|
+
const isResolvable = (layer, slotId, declaration) => {
|
|
97
|
+
if (!declaration || declaration.fidelity === 'unsupported')
|
|
98
|
+
return false;
|
|
99
|
+
return !layer.only || layer.only.has(slotId);
|
|
100
|
+
};
|
|
89
101
|
const unstable_createResolvedSlotTable = (layers) => {
|
|
90
102
|
const resolved = {};
|
|
91
103
|
for (const layer of layers) {
|
|
92
104
|
for (const [slotId, declaration] of Object.entries(layer.slots)) {
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
(layer.only && !layer.only.has(slotId)))
|
|
96
|
-
continue;
|
|
97
|
-
resolved[slotId] = declaration;
|
|
105
|
+
if (isResolvable(layer, slotId, declaration))
|
|
106
|
+
defineOwnSlot(resolved, slotId, declaration);
|
|
98
107
|
}
|
|
99
108
|
}
|
|
100
109
|
return Object.freeze(resolved);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sources":["../../../renderer/resolve.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { unstable_AdapterDiagnostic } from './errors';\nimport { unstable_adapterErrorCodes } from './errors';\nimport {\n unstable_composeUiLibraries,\n unstable_CRATIS_UI_ABI_VERSION,\n type unstable_UiLibrary,\n} from './manifest';\nimport type {\n unstable_SlotDeclaration,\n unstable_SlotId,\n unstable_SlotMap,\n} from './slots';\n\nconst knownSlots = new Set<unstable_SlotId>([\n 'common.button',\n 'common.iconButton',\n 'common.textInput',\n 'common.textArea',\n 'common.checkbox',\n 'common.radio',\n 'common.switch',\n 'common.progress',\n 'common.surface',\n 'common.tooltip',\n 'dropdown.select',\n 'dialogs.dialog',\n 'display.datePicker',\n 'datatables.paginator',\n]);\n\n/** Internal immutable renderer layer used by context resolution. */\nexport interface unstable_RendererLayer {\n readonly library: unstable_UiLibrary;\n readonly slots: unstable_SlotMap;\n readonly only?: ReadonlySet<unstable_SlotId>;\n}\n\n/** Identity-preserving normalization result for a provider or scope library input. */\nexport interface unstable_ResolvedLibraryInput {\n readonly library?: unstable_UiLibrary;\n readonly references: readonly unstable_UiLibrary[];\n}\n\n/** Empty D2 Core fallback table. Slice E can inject its built-in table without a registry. */\nexport const unstable_emptyCoreRendererSlots: unstable_SlotMap = Object.freeze({});\n\n/** Returns whether a value is one of the Core-owned slot identifiers. */\nexport const unstable_isKnownSlot = (value: unknown): value is unstable_SlotId =>\n typeof value === 'string' && knownSlots.has(value as unstable_SlotId);\n\n/** Normalizes one library or an ordered last-wins composition without deep merging it. */\nexport const unstable_resolveLibraryInput = (\n input: unstable_UiLibrary | readonly unstable_UiLibrary[] | undefined,\n): unstable_ResolvedLibraryInput => {\n if (!input) return Object.freeze({ references: Object.freeze([]) });\n\n const references = Object.freeze(Array.isArray(input) ? [...input] : [input]);\n if (references.length === 0) {\n return Object.freeze({ references });\n }\n\n return Object.freeze({\n library:\n references.length === 1\n ? references[0]\n : unstable_composeUiLibraries(...references),\n references,\n });\n};\n\n/** Creates one immutable slot lookup snapshot for a manifest and optional scope filter. */\nexport const unstable_createRendererLayer = (\n library: unstable_UiLibrary,\n only?: readonly unstable_SlotId[],\n): unstable_RendererLayer =>\n Object.freeze({\n library,\n slots: Object.freeze({ ...library.slots }),\n only: only ? new Set(only) : undefined,\n });\n\nconst missingRequirement = (\n library: unstable_UiLibrary,\n message: string,\n remedy: string,\n slotId?: unstable_SlotId,\n): unstable_AdapterDiagnostic => ({\n code: unstable_adapterErrorCodes.missingRequirement,\n adapterId: library.id,\n slotId,\n message,\n remedy,\n});\n\n/** Runs ABI, profile, capability, and adapter preflight validation. */\nexport const unstable_validateUiLibrary = (\n library: unstable_UiLibrary,\n): readonly unstable_AdapterDiagnostic[] => {\n const diagnostics: unstable_AdapterDiagnostic[] = [];\n\n if (library.abi !== unstable_CRATIS_UI_ABI_VERSION) {\n diagnostics.push({\n code: unstable_adapterErrorCodes.abiMismatch,\n adapterId: library.id,\n message: `Renderer ABI ${library.abi} does not match Core ABI ${unstable_CRATIS_UI_ABI_VERSION}.`,\n remedy: `Install a renderer that targets ABI ${unstable_CRATIS_UI_ABI_VERSION}.`,\n });\n }\n\n const profileSlots = library.profileSlots ?? Object.keys(library.slots);\n if (profileSlots.length > 0 && !library.capabilities.includes('slot.render')) {\n diagnostics.push(\n missingRequirement(\n library,\n `Profile '${library.profile}' promises slots without the 'slot.render' capability.`,\n \"Declare 'slot.render' only after the adapter can render every promised slot.\",\n ),\n );\n }\n\n for (const profileSlot of profileSlots) {\n if (!unstable_isKnownSlot(profileSlot)) {\n diagnostics.push(\n missingRequirement(\n library,\n `Profile '${library.profile}' promises unknown slot '${String(profileSlot)}'.`,\n 'Remove the unknown slot or install a Core version that declares it.',\n ),\n );\n continue;\n }\n\n const declaration = library.slots[profileSlot];\n if (!declaration || declaration.fidelity === 'unsupported') {\n diagnostics.push(\n missingRequirement(\n library,\n `Profile '${library.profile}' does not support promised slot '${profileSlot}'.`,\n `Provide a supported '${profileSlot}' declaration or remove it from profileSlots.`,\n profileSlot,\n ),\n );\n }\n }\n\n if (library.preflight) {\n try {\n diagnostics.push(...library.preflight());\n } catch (error: unknown) {\n diagnostics.push({\n code: unstable_adapterErrorCodes.missingUpstreamPeer,\n adapterId: library.id,\n message: `Renderer preflight failed: ${error instanceof Error ? error.message : String(error)}.`,\n remedy: 'Correct the renderer installation so its preflight can complete.',\n });\n }\n }\n\n return Object.freeze([...diagnostics]);\n};\n\n/** Compares normalized library identities without comparing or cloning manifest contents. */\nexport const unstable_sameLibraryReferences = (\n left: readonly unstable_UiLibrary[],\n right: readonly unstable_UiLibrary[],\n): boolean =>\n left.length === right.length &&\n left.every((library, index) => library === right[index]);\n\n/** Flattens outer-to-inner layers into one frozen, last-wins lookup table. */\nexport const unstable_createResolvedSlotTable = (\n layers: readonly unstable_RendererLayer[],\n): unstable_SlotMap => {\n const resolved: Record<string, object> = {};\n for (const layer of layers) {\n for (const [slotId, declaration] of Object.entries(layer.slots)) {\n if (\n !declaration ||\n declaration.fidelity === 'unsupported' ||\n (layer.only && !layer.only.has(slotId as unstable_SlotId))\n )\n continue;\n resolved[slotId] = declaration;\n }\n }\n return Object.freeze(resolved) as unstable_SlotMap;\n};\n\n/** Resolves a slot through external layers, a facade-local Core declaration, then Core context. */\nexport const unstable_resolveSlot = <K extends unstable_SlotId>(\n slotId: K,\n slots: unstable_SlotMap,\n localCoreDeclaration: unstable_SlotDeclaration<K> | undefined,\n coreSlots: unstable_SlotMap,\n): { declaration?: unstable_SlotDeclaration<K>; usedCoreFallback: boolean } => {\n const declaration = slots[slotId] as unstable_SlotDeclaration<K> | undefined;\n if (declaration) return { declaration, usedCoreFallback: false };\n\n return {\n declaration:\n localCoreDeclaration ??\n (coreSlots[slotId] as unstable_SlotDeclaration<K> | undefined),\n usedCoreFallback: true,\n };\n};\n\n/** Stable log key used to de-duplicate diagnostics within one provider identity. */\nexport const unstable_diagnosticKey = (diagnostic: unstable_AdapterDiagnostic): string =>\n [\n diagnostic.code,\n diagnostic.adapterId,\n diagnostic.slotId ?? '',\n diagnostic.message,\n ].join('|');\n\n/** Emits one actionable renderer diagnostic without exposing manifest contents. */\nexport const unstable_logDiagnostic = (diagnostic: unstable_AdapterDiagnostic): void => {\n console.error(\n `[${diagnostic.code}] ${diagnostic.message} Remedy: ${diagnostic.remedy}`,\n );\n};\n"],"names":[],"mappings":";;;AAgBA,MAAM,UAAU,GAAG,IAAI,GAAG,CAAkB;IACxC,eAAe;IACf,mBAAmB;IACnB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,oBAAoB;IACpB,sBAAsB;AACzB,CAAA,CAAC;AAgBK,MAAM,+BAA+B,GAAqB,MAAM,CAAC,MAAM,CAAC,EAAE;MAGpE,oBAAoB,GAAG,CAAC,KAAc,KAC/C,OAAO,KAAK,KAAK,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,KAAwB;AAGjE,MAAM,4BAA4B,GAAG,CACxC,KAAqE,KACtC;AAC/B,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAEnE,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7E,IAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAA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E,IAAI;KACzB;AACL;MAGa,sBAAsB,GAAG,CAAC,UAAsC,KACzE;AACI,IAAA,UAAU,CAAC,IAAI;AACf,IAAA,UAAU,CAAC,SAAS;IACpB,UAAU,CAAC,MAAM,IAAI,EAAE;AACvB,IAAA,UAAU,CAAC,OAAO;AACrB,CAAA,CAAC,IAAI,CAAC,GAAG;AAGP,MAAM,sBAAsB,GAAG,CAAC,UAAsC,KAAU;AACnF,IAAA,OAAO,CAAC,KAAK,CACT,CAAA,CAAA,EAAI,UAAU,CAAC,IAAI,CAAA,EAAA,EAAK,UAAU,CAAC,OAAO,CAAA,SAAA,EAAY,UAAU,CAAC,MAAM,CAAA,CAAE,CAC5E;AACL;;"}
|
|
1
|
+
{"version":3,"file":"resolve.js","sources":["../../../renderer/resolve.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { unstable_AdapterDiagnostic } from './errors';\nimport { unstable_adapterErrorCodes } from './errors';\nimport {\n defineOwnSlot,\n unstable_composeUiLibraries,\n unstable_CRATIS_UI_ABI_VERSION,\n type unstable_UiLibrary,\n} from './manifest';\nimport { stableAtomicSlotProblemsOf, stableAtomicSlotsOf } from './presentation';\nimport type {\n unstable_SlotDeclaration,\n unstable_SlotId,\n unstable_SlotMap,\n} from './slots';\n\nconst knownSlots = new Set<unstable_SlotId>([\n 'common.button',\n 'common.iconButton',\n 'common.textInput',\n 'common.textArea',\n 'common.checkbox',\n 'common.radio',\n 'common.switch',\n 'common.progress',\n 'common.surface',\n 'common.tooltip',\n 'dropdown.select',\n 'dialogs.dialog',\n 'display.datePicker',\n 'datatables.paginator',\n]);\n\n/** Internal immutable renderer layer used by context resolution. */\nexport interface unstable_RendererLayer {\n readonly library: unstable_UiLibrary;\n readonly slots: unstable_SlotMap;\n readonly only?: ReadonlySet<unstable_SlotId>;\n}\n\n/** Identity-preserving normalization result for a provider or scope library input. */\nexport interface unstable_ResolvedLibraryInput {\n readonly library?: unstable_UiLibrary;\n readonly references: readonly unstable_UiLibrary[];\n}\n\n/** Empty D2 Core fallback table. Slice E can inject its built-in table without a registry. */\nexport const unstable_emptyCoreRendererSlots: unstable_SlotMap = Object.freeze({});\n\n/** Returns whether a value is one of the Core-owned slot identifiers. */\nexport const unstable_isKnownSlot = (value: unknown): value is unstable_SlotId =>\n typeof value === 'string' && knownSlots.has(value as unstable_SlotId);\n\n/** Normalizes one library or an ordered last-wins composition without deep merging it. */\nexport const unstable_resolveLibraryInput = (\n input: unstable_UiLibrary | readonly unstable_UiLibrary[] | undefined,\n): unstable_ResolvedLibraryInput => {\n if (!input) return Object.freeze({ references: Object.freeze([]) });\n\n const references = Object.freeze(Array.isArray(input) ? [...input] : [input]);\n if (references.length === 0) {\n return Object.freeze({ references });\n }\n\n return Object.freeze({\n library:\n references.length === 1\n ? references[0]\n : unstable_composeUiLibraries(...references),\n references,\n });\n};\n\n/**\n * Creates one immutable slot lookup snapshot for a manifest and optional scope filter. A stable\n * presentation library's optional atomic slots join its nine presentation slots here.\n */\nexport const unstable_createRendererLayer = (\n library: unstable_UiLibrary,\n only?: readonly unstable_SlotId[],\n): unstable_RendererLayer =>\n Object.freeze({\n library,\n slots: Object.freeze({ ...library.slots, ...stableAtomicSlotsOf(library) }),\n only: only ? new Set(only) : undefined,\n });\n\nconst missingRequirement = (\n library: unstable_UiLibrary,\n message: string,\n remedy: string,\n slotId?: unstable_SlotId,\n): unstable_AdapterDiagnostic => ({\n code: unstable_adapterErrorCodes.missingRequirement,\n adapterId: library.id,\n slotId,\n message,\n remedy,\n});\n\nconst profileSlotDiagnostic = (\n library: unstable_UiLibrary,\n profileSlot: string,\n): unstable_AdapterDiagnostic | undefined => {\n if (!unstable_isKnownSlot(profileSlot)) {\n return missingRequirement(\n library,\n `Profile '${library.profile}' promises unknown slot '${String(profileSlot)}'.`,\n 'Remove the unknown slot or install a Core version that declares it.',\n );\n }\n\n const declaration = library.slots[profileSlot];\n if (declaration && declaration.fidelity !== 'unsupported') return undefined;\n return missingRequirement(\n library,\n `Profile '${library.profile}' does not support promised slot '${profileSlot}'.`,\n `Provide a supported '${profileSlot}' declaration or remove it from profileSlots.`,\n profileSlot,\n );\n};\n\n/** Reports stable atomic slots that resolution skipped, so they fail closed but visibly. */\nconst atomicSlotDiagnostics = (library: unstable_UiLibrary) =>\n stableAtomicSlotProblemsOf(library).map(({ slotId, message }) =>\n missingRequirement(\n library,\n `Invalid stable atomic slot declaration: ${message}.`,\n 'Correct or remove the atomic slot declaration; the built-in implementation is used instead.',\n unstable_isKnownSlot(slotId) ? slotId : undefined,\n ),\n );\n\n/** Runs ABI, profile, capability, and adapter preflight validation. */\nexport const unstable_validateUiLibrary = (\n library: unstable_UiLibrary,\n): readonly unstable_AdapterDiagnostic[] => {\n const diagnostics: unstable_AdapterDiagnostic[] = [];\n\n if (library.abi !== unstable_CRATIS_UI_ABI_VERSION) {\n diagnostics.push({\n code: unstable_adapterErrorCodes.abiMismatch,\n adapterId: library.id,\n message: `Renderer ABI ${library.abi} does not match Core ABI ${unstable_CRATIS_UI_ABI_VERSION}.`,\n remedy: `Install a renderer that targets ABI ${unstable_CRATIS_UI_ABI_VERSION}.`,\n });\n }\n\n const profileSlots = library.profileSlots ?? Object.keys(library.slots);\n if (profileSlots.length > 0 && !library.capabilities.includes('slot.render')) {\n diagnostics.push(\n missingRequirement(\n library,\n `Profile '${library.profile}' promises slots without the 'slot.render' capability.`,\n \"Declare 'slot.render' only after the adapter can render every promised slot.\",\n ),\n );\n }\n\n for (const profileSlot of profileSlots) {\n const diagnostic = profileSlotDiagnostic(library, profileSlot);\n if (diagnostic) diagnostics.push(diagnostic);\n }\n diagnostics.push(...atomicSlotDiagnostics(library));\n\n if (library.preflight) {\n try {\n diagnostics.push(...library.preflight());\n } catch (error: unknown) {\n diagnostics.push({\n code: unstable_adapterErrorCodes.missingUpstreamPeer,\n adapterId: library.id,\n message: `Renderer preflight failed: ${error instanceof Error ? error.message : String(error)}.`,\n remedy: 'Correct the renderer installation so its preflight can complete.',\n });\n }\n }\n\n return Object.freeze([...diagnostics]);\n};\n\n/** Compares normalized library identities without comparing or cloning manifest contents. */\nexport const unstable_sameLibraryReferences = (\n left: readonly unstable_UiLibrary[],\n right: readonly unstable_UiLibrary[],\n): boolean =>\n left.length === right.length &&\n left.every((library, index) => library === right[index]);\n\nconst isResolvable = (\n layer: unstable_RendererLayer,\n slotId: string,\n declaration: { readonly fidelity: string } | undefined,\n): declaration is { readonly fidelity: string } => {\n if (!declaration || declaration.fidelity === 'unsupported') return false;\n return !layer.only || layer.only.has(slotId as unstable_SlotId);\n};\n\n/** Flattens outer-to-inner layers into one frozen, last-wins lookup table. */\nexport const unstable_createResolvedSlotTable = (\n layers: readonly unstable_RendererLayer[],\n): unstable_SlotMap => {\n const resolved: Record<string, object> = {};\n for (const layer of layers) {\n for (const [slotId, declaration] of Object.entries(layer.slots)) {\n if (isResolvable(layer, slotId, declaration))\n defineOwnSlot(resolved, slotId, declaration);\n }\n }\n return Object.freeze(resolved) as unstable_SlotMap;\n};\n\n/** Resolves a slot through external layers, a facade-local Core declaration, then Core context. */\nexport const unstable_resolveSlot = <K extends unstable_SlotId>(\n slotId: K,\n slots: unstable_SlotMap,\n localCoreDeclaration: unstable_SlotDeclaration<K> | undefined,\n coreSlots: unstable_SlotMap,\n): { declaration?: unstable_SlotDeclaration<K>; usedCoreFallback: boolean } => {\n const declaration = slots[slotId] as unstable_SlotDeclaration<K> | undefined;\n if (declaration) return { declaration, usedCoreFallback: false };\n\n return {\n declaration:\n localCoreDeclaration ??\n (coreSlots[slotId] as unstable_SlotDeclaration<K> | undefined),\n usedCoreFallback: true,\n };\n};\n\n/** Stable log key used to de-duplicate diagnostics within one provider identity. */\nexport const unstable_diagnosticKey = (diagnostic: unstable_AdapterDiagnostic): string =>\n [\n diagnostic.code,\n diagnostic.adapterId,\n diagnostic.slotId ?? '',\n diagnostic.message,\n ].join('|');\n\n/** Emits one actionable renderer diagnostic without exposing manifest contents. */\nexport const unstable_logDiagnostic = (diagnostic: unstable_AdapterDiagnostic): void => {\n console.error(\n `[${diagnostic.code}] ${diagnostic.message} Remedy: ${diagnostic.remedy}`,\n );\n};\n"],"names":[],"mappings":";;;;AAkBA,MAAM,UAAU,GAAG,IAAI,GAAG,CAAkB;IACxC,eAAe;IACf,mBAAmB;IACnB,kBAAkB;IAClB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,oBAAoB;IACpB,sBAAsB;AACzB,CAAA,CAAC;AAgBK,MAAM,+BAA+B,GAAqB,MAAM,CAAC,MAAM,CAAC,EAAE;MAGpE,oBAAoB,GAAG,CAAC,KAAc,KAC/C,OAAO,KAAK,KAAK,QAAQ,IAAI,UAAU,CAAC,GAAG,CAAC,KAAwB;AAGjE,MAAM,4BAA4B,GAAG,CACxC,KAAqE,KACtC;AAC/B,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAEnE,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7E,IAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACxC;IAEA,OAAO,MAAM,CAAC,MAAM,CAAC;AACjB,QAAA,OAAO,EACH,UAAU,CAAC,MAAM,KAAK;AAClB,cAAE,UAAU,CAAC,CAAC;AACd,cAAE,2BAA2B,CAAC,GAAG,UAAU,CAAC;QACpD,UAAU;AACb,KAAA,CAAC;AACN;AAMO,MAAM,4BAA4B,GAAG,CACxC,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