@object-ui/core 17.6.0 → 17.7.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/CHANGELOG.md +6610 -0
- package/README.md +101 -14
- package/dist/actions/ActionEngine.d.ts +4 -2
- package/dist/actions/ActionEngine.js +13 -8
- package/dist/actions/ActionRunner.d.ts +288 -27
- package/dist/actions/ActionRunner.js +443 -63
- package/dist/actions/TransactionManager.d.ts +7 -2
- package/dist/actions/actionKeys.d.ts +9 -7
- package/dist/actions/actionKeys.js +57 -14
- package/dist/actions/actionResponse.js +2 -2
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/actions/recordDelete.d.ts +118 -0
- package/dist/actions/recordDelete.js +112 -0
- package/dist/adapters/ValueDataSource.d.ts +6 -1
- package/dist/adapters/ValueDataSource.js +1090 -98
- package/dist/adapters/batchTransaction.d.ts +1 -1
- package/dist/adapters/batchTransaction.js +1 -1
- package/dist/builder/schema-builder.d.ts +38 -81
- package/dist/builder/schema-builder.js +33 -152
- package/dist/data-scope/ViewDataProvider.d.ts +1 -1
- package/dist/data-scope/ViewDataProvider.js +21 -1
- package/dist/data-scope/element-data-source.d.ts +261 -7
- package/dist/data-scope/element-data-source.js +342 -52
- package/dist/data-scope/index.d.ts +9 -4
- package/dist/data-scope/index.js +9 -4
- package/dist/evaluator/ExpressionEvaluator.d.ts +86 -0
- package/dist/evaluator/ExpressionEvaluator.js +184 -12
- package/dist/evaluator/FormulaFunctions.d.ts +0 -10
- package/dist/evaluator/FormulaFunctions.js +166 -27
- package/dist/evaluator/declaredPredicate.d.ts +93 -9
- package/dist/evaluator/declaredPredicate.js +117 -16
- package/dist/evaluator/fieldRules.d.ts +88 -4
- package/dist/evaluator/fieldRules.js +203 -31
- package/dist/evaluator/index.d.ts +1 -0
- package/dist/evaluator/index.js +1 -0
- package/dist/evaluator/listConditional.d.ts +103 -34
- package/dist/evaluator/listConditional.js +127 -50
- package/dist/evaluator/optionRules.d.ts +77 -6
- package/dist/evaluator/optionRules.js +87 -10
- package/dist/evaluator/predicateInput.d.ts +15 -4
- package/dist/evaluator/predicateInput.js +35 -2
- package/dist/evaluator/rowPredicateCanon.d.ts +7 -18
- package/dist/evaluator/rowPredicateCanon.js +65 -115
- package/dist/evaluator/subjectPermissions.d.ts +76 -0
- package/dist/evaluator/subjectPermissions.js +44 -0
- package/dist/evaluator/unevaluablePredicate.d.ts +57 -0
- package/dist/evaluator/unevaluablePredicate.js +70 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +80 -2
- package/dist/protocols/index.d.ts +0 -1
- package/dist/protocols/index.js +9 -1
- package/dist/registry/Registry.d.ts +358 -31
- package/dist/registry/Registry.js +263 -11
- package/dist/registry/WidgetRegistry.js +7 -3
- package/dist/registry/html-tier-intrinsics.d.ts +90 -0
- package/dist/registry/html-tier-intrinsics.js +110 -0
- package/dist/registry/public-blocks.d.ts +8 -0
- package/dist/registry/public-blocks.js +57 -0
- package/dist/theme/ThemeEngine.js +1 -1
- package/dist/utils/chart-category-key.d.ts +82 -0
- package/dist/utils/chart-category-key.js +84 -0
- package/dist/utils/chart-measure-key.d.ts +64 -0
- package/dist/utils/chart-measure-key.js +65 -0
- package/dist/utils/chart-presentation.d.ts +95 -112
- package/dist/utils/chart-presentation.js +169 -104
- package/dist/utils/chart-series.d.ts +131 -5
- package/dist/utils/chart-series.js +98 -16
- package/dist/utils/column-sortability.d.ts +157 -0
- package/dist/utils/column-sortability.js +217 -0
- package/dist/utils/dashboard-filters.d.ts +38 -6
- package/dist/utils/dashboard-filters.js +107 -61
- package/dist/utils/dataset-format.d.ts +211 -30
- package/dist/utils/dataset-format.js +389 -46
- package/dist/utils/date-display.d.ts +354 -0
- package/dist/utils/date-display.js +463 -0
- package/dist/utils/date-macros.js +7 -0
- package/dist/utils/drill-down.d.ts +78 -0
- package/dist/utils/drill-down.js +93 -0
- package/dist/utils/emptiness.d.ts +96 -0
- package/dist/utils/emptiness.js +101 -0
- package/dist/utils/expand-fields.d.ts +76 -6
- package/dist/utils/expand-fields.js +76 -6
- package/dist/utils/extract-records.d.ts +65 -5
- package/dist/utils/extract-records.js +65 -8
- package/dist/utils/filter-converter.d.ts +152 -4
- package/dist/utils/filter-converter.js +1092 -22
- package/dist/utils/filter-tokens.d.ts +49 -5
- package/dist/utils/filter-tokens.js +105 -33
- package/dist/utils/grouping-fields.d.ts +61 -0
- package/dist/utils/grouping-fields.js +84 -0
- package/dist/utils/managedBy.d.ts +3 -3
- package/dist/utils/managedBy.js +5 -5
- package/dist/utils/native-date-value.d.ts +48 -0
- package/dist/utils/native-date-value.js +167 -0
- package/dist/utils/non-grid-row-ceiling.d.ts +143 -0
- package/dist/utils/non-grid-row-ceiling.js +141 -0
- package/dist/utils/normalize-list-view.d.ts +121 -1
- package/dist/utils/normalize-list-view.js +186 -6
- package/dist/utils/number-display.d.ts +63 -14
- package/dist/utils/number-display.js +34 -12
- package/dist/utils/object-aggregate-query.d.ts +113 -0
- package/dist/utils/object-aggregate-query.js +50 -0
- package/dist/utils/parent-scope.d.ts +123 -0
- package/dist/utils/parent-scope.js +140 -0
- package/dist/utils/predicate-fields.d.ts +45 -12
- package/dist/utils/predicate-fields.js +137 -12
- package/dist/utils/record-color.d.ts +75 -0
- package/dist/utils/record-color.js +65 -0
- package/dist/utils/record-source.d.ts +298 -0
- package/dist/utils/record-source.js +331 -0
- package/dist/utils/record-title.d.ts +148 -8
- package/dist/utils/record-title.js +220 -26
- package/dist/utils/reference-keys.d.ts +21 -22
- package/dist/utils/reference-keys.js +532 -29
- package/dist/utils/sort-query.d.ts +115 -15
- package/dist/utils/sort-query.js +240 -13
- package/dist/utils/text-comparand.d.ts +92 -0
- package/dist/utils/text-comparand.js +99 -0
- package/dist/utils/without-denied-fields.d.ts +49 -0
- package/dist/utils/without-denied-fields.js +52 -0
- package/dist/validation/index.d.ts +8 -4
- package/dist/validation/index.js +8 -4
- package/dist/validation/schema-validator.d.ts +1 -1
- package/dist/validation/schema-validator.js +200 -82
- package/dist/validation/validators/object-validation-engine.d.ts +1 -1
- package/dist/validation/validators/object-validation-engine.js +14 -3
- package/package.json +8 -9
- package/dist/data-scope/DataScopeManager.d.ts +0 -127
- package/dist/data-scope/DataScopeManager.js +0 -229
- package/dist/protocols/ResponsiveProtocol.d.ts +0 -73
- package/dist/protocols/ResponsiveProtocol.js +0 -158
- package/dist/validation/validation-engine.d.ts +0 -88
- package/dist/validation/validation-engine.js +0 -434
|
@@ -5,7 +5,27 @@
|
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { ComponentMeta as CanonicalComponentMeta } from '@object-ui/types';
|
|
9
|
+
import type { ComponentConfig } from '@object-ui/types';
|
|
10
|
+
/**
|
|
11
|
+
* The renderer a registration carries — the IDENTITY alias, deliberately.
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ Load-bearing for objectui#6298, which is why it is documented rather than
|
|
14
|
+
* left as a bare line. `ComponentRenderer<T>` resolves to `T` and contributes
|
|
15
|
+
* NO type information: that is the entire reason `@object-ui/types` can declare
|
|
16
|
+
* the one `ComponentConfig` with `component: T` and mean exactly what this
|
|
17
|
+
* package used to mean by `component: ComponentRenderer<T>`, WITHOUT
|
|
18
|
+
* `@object-ui/types` needing to reach this declaration. It could not have
|
|
19
|
+
* reached it: `@object-ui/types` is the bottom layer (`packages/types/package.json`
|
|
20
|
+
* depends on `@objectstack/spec` and `zod` only) and this package depends on it,
|
|
21
|
+
* so an edge in that direction would be a cycle.
|
|
22
|
+
*
|
|
23
|
+
* The alias survives as the NAME this package's own renderer-shaped positions
|
|
24
|
+
* are spelled with ({@link withElementDataSourceInput}, {@link PublicComponentConfig}).
|
|
25
|
+
* If it is ever given real content, `component: T` over in `@object-ui/types`
|
|
26
|
+
* stops being the same slot — `__tests__/component-config-single-declaration.test.ts`
|
|
27
|
+
* asserts the identity so that change cannot pass unnoticed.
|
|
28
|
+
*/
|
|
9
29
|
export type ComponentRenderer<T = any> = T;
|
|
10
30
|
/**
|
|
11
31
|
* What a registration DECLARES about one authorable prop.
|
|
@@ -29,10 +49,106 @@ export type ComponentRenderer<T = any> = T;
|
|
|
29
49
|
* dormant only because no registration had tried to write one yet.
|
|
30
50
|
*/
|
|
31
51
|
export type { ComponentInput } from '@object-ui/types';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
52
|
+
/**
|
|
53
|
+
* An AUTHORING SURFACE a component type can be reached from — the two this
|
|
54
|
+
* engine has, named as its own code already names them.
|
|
55
|
+
*
|
|
56
|
+
* - `'json'` — the JSON/SDUI authoring surface. A node an author (or an AI)
|
|
57
|
+
* writes as `{ "type": "…" }` in metadata.
|
|
58
|
+
* - `'html'` — a `kind:'html'` page, written as constrained JSX text that
|
|
59
|
+
* `@object-ui/sdui-parser` COMPILES (never executes) into SDUI nodes, tag
|
|
60
|
+
* name straight through. `isHtmlTierNode` marks what that parser emitted.
|
|
61
|
+
*
|
|
62
|
+
* The distinction is not decorative here: it is the whole reason
|
|
63
|
+
* {@link ComponentDeprecation} carries a surface list rather than a boolean.
|
|
64
|
+
*/
|
|
65
|
+
export type AuthoringSurface = 'json' | 'html';
|
|
66
|
+
/**
|
|
67
|
+
* That a component type is DEPRECATED for authoring — the machine-readable
|
|
68
|
+
* statement of it (objectui#6674).
|
|
69
|
+
*
|
|
70
|
+
* ## Why this exists at all
|
|
71
|
+
*
|
|
72
|
+
* Before this type, a deprecation was stated in exactly two places, neither of
|
|
73
|
+
* which any gate, test or type can consult: a `console.warn` STRING LITERAL
|
|
74
|
+
* inside the renderer, and the word "(Deprecated)" inside a human-readable
|
|
75
|
+
* `label`. So the question "is this type deprecated?" had no asker. The two
|
|
76
|
+
* gates that touch component types — `examples/schema-catalog/test/
|
|
77
|
+
* catalog-gallery-render.test.tsx` and `scripts/check-doc-component-types.mjs`
|
|
78
|
+
* — both ask only whether a type RESOLVES, and a deprecated type resolves
|
|
79
|
+
* perfectly well. The measurement objectui#6674 filed is what that costs: the
|
|
80
|
+
* catalog suite passes 583/583 with 85 authored `div` nodes in the corpus. The
|
|
81
|
+
* green was the finding.
|
|
82
|
+
*
|
|
83
|
+
* This is a layer BELOW the usual "declared but enforced nowhere" defect: there
|
|
84
|
+
* was nothing declared to enforce.
|
|
85
|
+
*
|
|
86
|
+
* ## Why `surfaces` is required, and why a boolean would have been wrong
|
|
87
|
+
*
|
|
88
|
+
* `deprecated: true` would restate, as a contract, the exact falsehood the
|
|
89
|
+
* maintainer ruled against on 2026-08-10 (objectui#4000): the `span` notice is
|
|
90
|
+
* scoped BY PROVENANCE because that tag is deprecated on the JSON surface and
|
|
91
|
+
* simultaneously vocabulary of the `kind:'html'` tier — an author there writes
|
|
92
|
+
* the plain tag, our own parser maps it straight through, and no other
|
|
93
|
+
* spelling exists for them to migrate to. "A notice that says the type is
|
|
94
|
+
* deprecated FULL STOP is therefore false for one of its two readers"
|
|
95
|
+
* (`span.tsx`), and the reader it was false for was the one who could do
|
|
96
|
+
* nothing about it. (`div` carried the same scope until ruling A on
|
|
97
|
+
* objectstack#20112 deprecated it on the html surface too, with `box` as its
|
|
98
|
+
* replacement; it now declares both surfaces — objectui#10757. The list is
|
|
99
|
+
* what let that be one edit.) A declaration that dropped the scope
|
|
100
|
+
* would hand every future gate the same false premise, in a form that is harder
|
|
101
|
+
* to see than a console string. So the scope travels WITH the declaration, and
|
|
102
|
+
* {@link Registry.deprecationFor} makes callers name the surface they are
|
|
103
|
+
* asking about instead of re-deriving the exemption locally.
|
|
104
|
+
*
|
|
105
|
+
* ## What it deliberately does not do
|
|
106
|
+
*
|
|
107
|
+
* Nothing here fails a build, and nothing here deprecates anything: this is the
|
|
108
|
+
* vocabulary plus the reader. Which types get marked, and when, is
|
|
109
|
+
* objectui#3965's to decide — the ordering matters, because marking a type
|
|
110
|
+
* while the corpus still authors it 85 times produces a red with nowhere to go.
|
|
111
|
+
*/
|
|
112
|
+
export type ComponentDeprecation = {
|
|
113
|
+
/**
|
|
114
|
+
* The surfaces on which authoring this type is deprecated. A surface NOT
|
|
115
|
+
* listed keeps the type as first-class vocabulary there — that is the whole
|
|
116
|
+
* content of the objectui#4000 ruling, said once, in the declaration.
|
|
117
|
+
*
|
|
118
|
+
* Required and expected non-empty: an empty list declares a deprecation that
|
|
119
|
+
* applies to no reader, which is indistinguishable from not declaring one.
|
|
120
|
+
*/
|
|
121
|
+
surfaces: AuthoringSurface[];
|
|
122
|
+
/**
|
|
123
|
+
* One line of migration guidance for the surfaces above — what to author
|
|
124
|
+
* instead. Optional, but it is what makes a gate's failure ACTIONABLE: a gate
|
|
125
|
+
* that can only say "deprecated" sends its reader back to the console string
|
|
126
|
+
* this declaration exists to replace.
|
|
127
|
+
*/
|
|
128
|
+
replacement?: string;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* The keys the REGISTRY adds on top of the one `ComponentMeta` declaration:
|
|
132
|
+
* registration mechanics (`tier` / `namespace` / `skipFallback`), the
|
|
133
|
+
* host-labelling contract (`labelling`), and the authoring-time
|
|
134
|
+
* `deprecated` declaration. None of the five has a counterpart on
|
|
135
|
+
* the general type in `@object-ui/types`, and none is being moved there —
|
|
136
|
+
* publishing registry mechanics on the general type was the alternative
|
|
137
|
+
* objectui#6067 weighed and rejected.
|
|
138
|
+
*
|
|
139
|
+
* They live in their OWN named type so that `ComponentMeta` below can be
|
|
140
|
+
* DERIVED from the canonical declaration instead of restating it. Until
|
|
141
|
+
* objectui#6067 this file carried a second, thirteen-key structural copy of
|
|
142
|
+
* the name: the nine shared members restated from `@object-ui/types`' `base.ts`,
|
|
143
|
+
* these four added here, and `tags` / `description` — declared on the canonical
|
|
144
|
+
* type and on the `ComponentMetaSchema` zod mirror — simply absent. That is
|
|
145
|
+
* objectui#4580's ruling coming true for the third type in a row: *a
|
|
146
|
+
* structural copy would reproduce the defect the moment either side moved.*
|
|
147
|
+
* objectui#5671 executed the same convergence for `ComponentInput` in this very
|
|
148
|
+
* file, and objectui#5893 closed the identical two-key delta inside
|
|
149
|
+
* `@object-ui/types`.
|
|
150
|
+
*/
|
|
151
|
+
export type RegistryComponentMetaExtras = {
|
|
36
152
|
/**
|
|
37
153
|
* Public contract tier (ADR-0080). `'public'` = part of the curated,
|
|
38
154
|
* type-checked, AI-facing block set (gets a strengthened contract, the
|
|
@@ -46,6 +162,12 @@ export type ComponentMeta = {
|
|
|
46
162
|
* Use this when a component should only be accessible via its full namespaced key.
|
|
47
163
|
* This avoids conflicts with other components that share the same base name.
|
|
48
164
|
*
|
|
165
|
+
* ⚠️ That promise covers BOTH registry tables since objectui#9839, and it did
|
|
166
|
+
* not before. Declining the bare key used to leave `register` deleting a bare
|
|
167
|
+
* lazy stub anyway, so a registration that opted out still took the bare key
|
|
168
|
+
* off its owner — and then refused to replace it, leaving it claimed by
|
|
169
|
+
* nobody. An opt-out now leaves the bare key exactly where it was.
|
|
170
|
+
*
|
|
49
171
|
* @example
|
|
50
172
|
* // Register as 'view:form' only, don't overwrite 'form'
|
|
51
173
|
* registry.register('form', FormView, { namespace: 'view', skipFallback: true });
|
|
@@ -90,36 +212,125 @@ export type ComponentMeta = {
|
|
|
90
212
|
* unlabelled group.
|
|
91
213
|
*/
|
|
92
214
|
labelling?: 'control' | 'group' | 'display';
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
export type ComponentConfig<T = any> = ComponentMeta & {
|
|
108
|
-
type: string;
|
|
109
|
-
component: ComponentRenderer<T>;
|
|
215
|
+
/**
|
|
216
|
+
* That authoring this type is DEPRECATED, and on which surfaces
|
|
217
|
+
* (objectui#6674). Absent ⇒ not deprecated anywhere; see
|
|
218
|
+
* {@link ComponentDeprecation} for why the surfaces are part of the
|
|
219
|
+
* declaration rather than a boolean, and {@link Registry.deprecationFor} for
|
|
220
|
+
* the reader a gate asks.
|
|
221
|
+
*
|
|
222
|
+
* This is a DECLARATION about the TYPE, which is why it sits on the
|
|
223
|
+
* registration rather than on a node: every node of a deprecated type is
|
|
224
|
+
* deprecated, and the one place that fact can be stated once is where the
|
|
225
|
+
* type is registered.
|
|
226
|
+
*/
|
|
227
|
+
deprecated?: ComponentDeprecation;
|
|
110
228
|
};
|
|
229
|
+
/**
|
|
230
|
+
* What a registration DECLARES about one component — the type every
|
|
231
|
+
* `ComponentRegistry.register` / `registerLazy` call is checked against.
|
|
232
|
+
*
|
|
233
|
+
* ONE declaration of the shared members: this is `@object-ui/types`'
|
|
234
|
+
* `ComponentMeta` (the declaration `ComponentMetaSchema` mirrors and the
|
|
235
|
+
* plugin-facing surface publishes) intersected with the registry-only keys
|
|
236
|
+
* above. The nine shared members are no longer restated here, so they cannot
|
|
237
|
+
* drift again, and `tags` / `description` now reach the registration surface —
|
|
238
|
+
* the two keys the divergence had made unwritable at the very declaration most
|
|
239
|
+
* component registrations import.
|
|
240
|
+
*
|
|
241
|
+
* NOTE for anyone pinning this: every member of both halves is OPTIONAL, so
|
|
242
|
+
* `extends` is mutually TRUE between the two shapes even when their key sets
|
|
243
|
+
* differ. Measured on the EMITTED `.d.ts` of both packages immediately before
|
|
244
|
+
* this convergence: `Core extends Canonical` and `Canonical extends Core` were
|
|
245
|
+
* BOTH `true` while `tags` / `description` were missing and four keys were
|
|
246
|
+
* extra. An assignability assertion is therefore a ghost here — it was green on
|
|
247
|
+
* the diverged tree. `__tests__/component-meta-derives-from-canonical.test.ts`
|
|
248
|
+
* compares `keyof` sets instead and keeps the assignability check beside it as
|
|
249
|
+
* the labelled control that shows why.
|
|
250
|
+
*/
|
|
251
|
+
export type ComponentMeta = CanonicalComponentMeta & RegistryComponentMetaExtras;
|
|
252
|
+
/**
|
|
253
|
+
* ONE authority for `ComponentConfig` (objectui#6298) — this package RE-EXPORTS
|
|
254
|
+
* `@object-ui/types`' declaration instead of declaring a second one, the same
|
|
255
|
+
* disposition objectui#5671 gave `ComponentInput` a few lines above and
|
|
256
|
+
* objectui#4580 ruled for the whole family: *a structural copy would reproduce
|
|
257
|
+
* the defect the moment either side moved.*
|
|
258
|
+
*
|
|
259
|
+
* ## What was wrong
|
|
260
|
+
*
|
|
261
|
+
* Both spellings were PUBLISHED — `@object-ui/types`' `src/index.ts` exports its
|
|
262
|
+
* one, and this file reaches `@object-ui/core`'s public entry through
|
|
263
|
+
* `src/index.ts`'s `export * from './registry/Registry.js'`. An IDE auto-import
|
|
264
|
+
* therefore picked between two different types by alphabetical order. After
|
|
265
|
+
* objectui#6067 / PR #6297 single-sourced the `ComponentMeta` half, what still
|
|
266
|
+
* differed was GENERICITY AND THE `component` SLOT: `@object-ui/types`' was
|
|
267
|
+
* non-generic with `component: any`, this one was `<T = any>` with
|
|
268
|
+
* `component: ComponentRenderer<T>`.
|
|
269
|
+
*
|
|
270
|
+
* ⚠️ Measured on the EMITTED `.d.ts` of both packages immediately before this
|
|
271
|
+
* convergence, `Exact<TypesConfig, CoreConfig>` — mutual assignability — read
|
|
272
|
+
* `true` on the DIVERGED pair, because `component: any` absorbs everything and
|
|
273
|
+
* every other member is optional. An assignability assertion is a GHOST here,
|
|
274
|
+
* exactly as `__tests__/component-meta-derives-from-canonical.test.ts` records
|
|
275
|
+
* for the sibling type. The readings that actually moved were "is
|
|
276
|
+
* `@object-ui/types`' declaration generic" (`TS2315: Type 'ComponentConfig' is
|
|
277
|
+
* not generic` before, no error after) and the symmetric key-set difference.
|
|
278
|
+
*
|
|
279
|
+
* A re-export is not a second authority — `scripts/__tests__/one-authority-per-exported-name-6273.test.ts`
|
|
280
|
+
* counts declarations and ALIASING re-exports, never `export type { X } from …`
|
|
281
|
+
* — which is why this convergence takes `ComponentConfig` off that gate's
|
|
282
|
+
* `KNOWN_COLLISIONS` baseline. Deriving a new declaration here instead would
|
|
283
|
+
* NOT have: `ComponentMeta` was converged that way by PR #6297 and is still a
|
|
284
|
+
* row on that baseline today.
|
|
285
|
+
*/
|
|
286
|
+
export type { ComponentConfig } from '@object-ui/types';
|
|
287
|
+
/**
|
|
288
|
+
* What the registry actually STORES and hands back — `ComponentConfig` plus the
|
|
289
|
+
* registry-only keys, as a NAMED extension (objectui#6298).
|
|
290
|
+
*
|
|
291
|
+
* This is type-identical to the `ComponentConfig` this file used to declare:
|
|
292
|
+
* `CanonicalComponentMeta & RegistryComponentMetaExtras & { type; component }`,
|
|
293
|
+
* reached from the other side. The two halves are named rather than restated —
|
|
294
|
+
* one declaration for the shared members ({@link ComponentConfig}, in
|
|
295
|
+
* `@object-ui/types`), a named extension for the rest
|
|
296
|
+
* ({@link RegistryComponentMetaExtras}) — which is the shape PR #6297 gave
|
|
297
|
+
* {@link ComponentMeta}.
|
|
298
|
+
*
|
|
299
|
+
* It exists because the extras are NOT optional decoration on a registry entry:
|
|
300
|
+
* {@link Registry.getNamespaceComponents} filters on `config.namespace`, and
|
|
301
|
+
* `tier` / `labelling` / `deprecated` are read off registrations elsewhere. A
|
|
302
|
+
* bare re-export as the entry type would have silently dropped them.
|
|
303
|
+
*
|
|
304
|
+
* ⚠️ `ComponentConfig` remains the AUTHORING vocabulary and the general name;
|
|
305
|
+
* registrations are checked against {@link ComponentMeta}, never against this.
|
|
306
|
+
* Nothing writes a `RegistryComponentConfig` literal — the registry builds them.
|
|
307
|
+
*/
|
|
308
|
+
export type RegistryComponentConfig<T = any> = ComponentConfig<T> & RegistryComponentMetaExtras;
|
|
111
309
|
/**
|
|
112
310
|
* A CONTRACT-surface entry (ADR-0080), as returned by
|
|
113
311
|
* {@link Registry.getPublicConfigs}.
|
|
114
312
|
*
|
|
115
|
-
* Same shape as {@link
|
|
313
|
+
* Same shape as {@link RegistryComponentConfig} except `component` is absent while the
|
|
116
314
|
* entry is still a pending `registerLazy` stub: the plugin module has not been
|
|
117
315
|
* imported yet, so there is no renderer to hand out. Consumers render such an
|
|
118
316
|
* entry through `SchemaRenderer`, which triggers the loader and shows a
|
|
119
317
|
* placeholder in the meantime (objectui#2953).
|
|
318
|
+
*
|
|
319
|
+
* `tier` is widened by one PROJECTION-ONLY value, `'html'`: an entry the html
|
|
320
|
+
* tier's intrinsic roster contributed (objectui#10735). No registration
|
|
321
|
+
* declares it — `RegistryComponentMetaExtras.tier` stays `'public' | 'internal'`
|
|
322
|
+
* — the read stamps it, and `manifestFromConfigs` carries it into the manifest
|
|
323
|
+
* so a consumer that means the CURATED vocabulary can filter it out.
|
|
120
324
|
*/
|
|
121
|
-
export type PublicComponentConfig<T = any> = ComponentMeta & {
|
|
325
|
+
export type PublicComponentConfig<T = any> = Omit<ComponentMeta, 'tier'> & {
|
|
122
326
|
type: string;
|
|
327
|
+
/**
|
|
328
|
+
* The registration's declared tier, or `'html'` for an entry that reaches the
|
|
329
|
+
* contract through {@link HTML_TIER_INTRINSICS} rather than through the
|
|
330
|
+
* curated roster or a `tier: 'public'` opt-in. Absent or `'public'` = the
|
|
331
|
+
* curated JSON-surface vocabulary.
|
|
332
|
+
*/
|
|
333
|
+
tier?: ComponentMeta['tier'] | 'html';
|
|
123
334
|
component?: ComponentRenderer<T>;
|
|
124
335
|
/** True while this entry is a `registerLazy` stub whose loader has not run. */
|
|
125
336
|
lazy?: boolean;
|
|
@@ -132,6 +343,58 @@ export type PublicComponentConfig<T = any> = ComponentMeta & {
|
|
|
132
343
|
* `register()` for that type.
|
|
133
344
|
*/
|
|
134
345
|
export type LazyComponentLoader = () => Promise<unknown>;
|
|
346
|
+
/**
|
|
347
|
+
* Emit the spec's `dataSource` input for a registration whose renderer wraps
|
|
348
|
+
* `ElementDataSourceGate` (objectui#6678).
|
|
349
|
+
*
|
|
350
|
+
* ## The one place, and why it is this one
|
|
351
|
+
*
|
|
352
|
+
* The maintainer ruling of 2026-08-29 adopted option B **in the injection
|
|
353
|
+
* form**: the declaration is emitted mechanically at the wrapping seam so every
|
|
354
|
+
* gate-wrapping registration declares the key from the same place that reads it
|
|
355
|
+
* — one mechanism rather than nine hand-kept copies across nine packages, which
|
|
356
|
+
* drift and which a tenth block would simply forget. `register()` is where every
|
|
357
|
+
* one of those registrations passes through, so it is where the emission lands;
|
|
358
|
+
* the DECLARATION itself is `ELEMENT_DATA_SOURCE_INPUT`, which lives beside the
|
|
359
|
+
* binding's own semantics in `data-scope/element-data-source.ts`.
|
|
360
|
+
*
|
|
361
|
+
* ## What it must NOT do, which is half the ruling
|
|
362
|
+
*
|
|
363
|
+
* Widening this to every registration is option A wearing a different hat: it
|
|
364
|
+
* would silence `dataSource` on `flex` and `card`, which do not read it, and the
|
|
365
|
+
* diagnostic would lie in the other direction instead of the one it lied in
|
|
366
|
+
* before. So the condition is the marker and nothing else — no heuristic over
|
|
367
|
+
* `objectName`, no "looks object-bound".
|
|
368
|
+
*
|
|
369
|
+
* ## Idempotent, and it never overwrites
|
|
370
|
+
*
|
|
371
|
+
* A registration that declares `dataSource` ITSELF keeps its own entry: the
|
|
372
|
+
* emission fills a gap, it does not own the key. (Nothing declares it today —
|
|
373
|
+
* that is the defect — but a block whose binding needs a narrower description
|
|
374
|
+
* later must be able to say so without fighting this function.) Re-registering
|
|
375
|
+
* the same component, which the registry allows and tests do constantly, is
|
|
376
|
+
* likewise a no-op rather than a growing `inputs` array.
|
|
377
|
+
*
|
|
378
|
+
* ## Typed end to end — the cast is gone (`9e37d9b39`)
|
|
379
|
+
*
|
|
380
|
+
* The spliced element is an `InjectedComponentInput` (`@object-ui/types`): a
|
|
381
|
+
* `ComponentInput` plus the framework-set `binding` marker, so it is a plain
|
|
382
|
+
* subtype of the array's element type and the return value type-checks as a
|
|
383
|
+
* `ComponentMeta` with no assertion. This used to read `as ComponentMeta`,
|
|
384
|
+
* because `ELEMENT_DATA_SOURCE_INPUT` carried a hand-written inline type and
|
|
385
|
+
* `binding` had no declared home — and a cast at the one place the key is
|
|
386
|
+
* written is exactly what would have hidden any later drift between the
|
|
387
|
+
* constant and the type. The absence is held by `eslint.config.js`, which
|
|
388
|
+
* scopes `@typescript-eslint/consistent-type-assertions` with
|
|
389
|
+
* `assertionStyle: 'never'` to THIS FILE (objectui#8316) — an AST rule,
|
|
390
|
+
* because `tsc --noEmit` stays at exit 0 with the cast re-added and the
|
|
391
|
+
* source-text pin that used to stand here was green for `<ComponentMeta>{…}`,
|
|
392
|
+
* the same assertion in the other spelling.
|
|
393
|
+
* `packages/types/src/__tests__/injected-component-input-6950.test.ts` still
|
|
394
|
+
* pins the positive half, that the local below is ANNOTATED. Keep it typed: if
|
|
395
|
+
* the shape ever stops fitting, that line is where the compiler should say so.
|
|
396
|
+
*/
|
|
397
|
+
export declare function withElementDataSourceInput<T>(component: ComponentRenderer<T>, meta?: ComponentMeta): ComponentMeta | undefined;
|
|
135
398
|
export declare class Registry<T = any> {
|
|
136
399
|
private components;
|
|
137
400
|
private lazyEntries;
|
|
@@ -171,9 +434,28 @@ export declare class Registry<T = any> {
|
|
|
171
434
|
/**
|
|
172
435
|
* Remove a previously registered component. Mirrors {@link register} by
|
|
173
436
|
* clearing both the namespaced key and the bare-name fallback (when the
|
|
174
|
-
* fallback still points at this registration), plus any matching lazy stub
|
|
437
|
+
* fallback still points at this registration), plus any matching lazy stub —
|
|
438
|
+
* where "matching" means the same thing on both tables: a stub that still
|
|
439
|
+
* belongs to THIS registration (objectui#9839).
|
|
175
440
|
* Notifies subscribers only when something was actually removed.
|
|
176
441
|
*
|
|
442
|
+
* ⭐ Why "matching" cannot mean "a stub under either key". This function
|
|
443
|
+
* already answers that question for the bare `components` key and answers it
|
|
444
|
+
* "ownership" — it will not drop bare `dashboard` when it resolves to
|
|
445
|
+
* `plugin-dashboard:dashboard`. Reading the next line as an unconditional
|
|
446
|
+
* delete makes the SAME call, on the SAME bare key, with the SAME owner,
|
|
447
|
+
* take the opposite decision purely because the owner happens to be sitting
|
|
448
|
+
* in the other table at that instant — and which table it is sitting in is
|
|
449
|
+
* exactly the "has the chunk loaded yet" race that objectui#9533 and
|
|
450
|
+
* objectui#9821 are about. A policy that flips on chunk-load timing is not a
|
|
451
|
+
* policy, so the stub gets the ownership test too.
|
|
452
|
+
*
|
|
453
|
+
* ⚠️ The BARE form (`unregister(type)` with no namespace) is unchanged and
|
|
454
|
+
* is still the unconditional one, on both tables: `fullType === type` there,
|
|
455
|
+
* so the deletes below address the bare key directly. That is the "force"
|
|
456
|
+
* form teardown sites pair with the namespaced call, and taking it away
|
|
457
|
+
* would break them.
|
|
458
|
+
*
|
|
177
459
|
* Mainly used by tests that install a stub renderer and need to restore the
|
|
178
460
|
* prior registry state on teardown, since the registry is a process-level
|
|
179
461
|
* singleton shared across test files.
|
|
@@ -250,7 +532,7 @@ export declare class Registry<T = any> {
|
|
|
250
532
|
* @param namespace - Optional namespace for lookup priority
|
|
251
533
|
* @returns Component configuration or undefined
|
|
252
534
|
*/
|
|
253
|
-
getConfig(type: string, namespace?: string):
|
|
535
|
+
getConfig(type: string, namespace?: string): RegistryComponentConfig<T> | undefined;
|
|
254
536
|
/**
|
|
255
537
|
* Check if a component type is registered.
|
|
256
538
|
*
|
|
@@ -294,12 +576,48 @@ export declare class Registry<T = any> {
|
|
|
294
576
|
* known", not as "declares no props".
|
|
295
577
|
*/
|
|
296
578
|
getMeta(type: string, namespace?: string): ComponentMeta | undefined;
|
|
579
|
+
/**
|
|
580
|
+
* The deprecation `type` declares FOR `surface` — or `undefined` when it
|
|
581
|
+
* declares none there (objectui#6674).
|
|
582
|
+
*
|
|
583
|
+
* ## The question this makes askable
|
|
584
|
+
*
|
|
585
|
+
* "Is this type deprecated?" — which, before the {@link ComponentDeprecation}
|
|
586
|
+
* declaration existed, nothing could ask. The only two statements of a
|
|
587
|
+
* deprecation were a `console.warn` string literal in a renderer and the word
|
|
588
|
+
* "(Deprecated)" inside a human `label`; no gate, test or type can consult
|
|
589
|
+
* either. Both gates that touch component types ask whether a type RESOLVES,
|
|
590
|
+
* and a deprecated type resolves.
|
|
591
|
+
*
|
|
592
|
+
* ## Why the caller must name a surface
|
|
593
|
+
*
|
|
594
|
+
* Because the honest answer differs by surface, and a reader that dropped the
|
|
595
|
+
* distinction would let every caller re-derive it — which is how the same
|
|
596
|
+
* exemption ends up written N times and wrong in N-1 of them. `span` is
|
|
597
|
+
* deprecated for JSON-authored pages and is vocabulary of the `kind:'html'`
|
|
598
|
+
* tier (objectui#4000). Asking `deprecationFor('span', 'html')` therefore
|
|
599
|
+
* correctly answers `undefined` even when the type declares a `'json'`
|
|
600
|
+
* deprecation, while `deprecationFor('div', 'html')` answers the declaration,
|
|
601
|
+
* because `div` names both surfaces (objectui#10757). A gate over html-tier
|
|
602
|
+
* sources gets the right answer for either without knowing the rulings: the
|
|
603
|
+
* console's html compile reads exactly this to decide what it refuses.
|
|
604
|
+
*
|
|
605
|
+
* Returning the DECLARATION rather than a boolean is deliberate: the caller
|
|
606
|
+
* that has to report the finding also needs `replacement` to say what to
|
|
607
|
+
* author instead, and a boolean would send it back to the console string.
|
|
608
|
+
*
|
|
609
|
+
* Resolution is {@link getMeta}'s, so both spellings of a namespaced
|
|
610
|
+
* registration answer alike (`div` and `ui:div`), a `skipFallback` type
|
|
611
|
+
* answers only under its namespaced key, and a pending `registerLazy` stub
|
|
612
|
+
* answers from the meta it was registered with.
|
|
613
|
+
*/
|
|
614
|
+
deprecationFor(type: string, surface: AuthoringSurface, namespace?: string): ComponentDeprecation | undefined;
|
|
297
615
|
/**
|
|
298
616
|
* Get all registered component configurations.
|
|
299
617
|
*
|
|
300
618
|
* @returns Array of all component configurations
|
|
301
619
|
*/
|
|
302
|
-
getAllConfigs():
|
|
620
|
+
getAllConfigs(): RegistryComponentConfig<T>[];
|
|
303
621
|
/**
|
|
304
622
|
* Resolve `tag` for the CONTRACT surface: the loaded registration when the
|
|
305
623
|
* component is already in the registry, otherwise the metadata of a pending
|
|
@@ -312,9 +630,18 @@ export declare class Registry<T = any> {
|
|
|
312
630
|
*/
|
|
313
631
|
private getContractConfig;
|
|
314
632
|
/**
|
|
315
|
-
* Get the
|
|
316
|
-
*
|
|
317
|
-
*
|
|
633
|
+
* Get the CONTRACT-surface component configs (ADR-0080) — what the published
|
|
634
|
+
* `sdui.manifest.json` serialises. A subset of the full rendering capability
|
|
635
|
+
* returned by {@link getAllConfigs}, made of two tiers:
|
|
636
|
+
*
|
|
637
|
+
* - the curated PUBLIC tier — `PUBLIC_BLOCKS` plus registrations that opted
|
|
638
|
+
* in with `tier: 'public'` — the JSON-surface AI-authoring vocabulary;
|
|
639
|
+
* - the html tier's registered intrinsic elements — `HTML_TIER_INTRINSICS`,
|
|
640
|
+
* each entry stamped `tier: 'html'` (objectui#10735). A `kind:'html'` page
|
|
641
|
+
* may author these tags and the gate that reads the manifest must accept
|
|
642
|
+
* them; they are NOT part of the curated vocabulary, so a consumer that
|
|
643
|
+
* means that vocabulary alone — the `kind:'react'` JSX scope, the block
|
|
644
|
+
* list, a census of curated blocks — filters on the stamp.
|
|
318
645
|
*
|
|
319
646
|
* Includes blocks that are only lazily registered so far; those come back
|
|
320
647
|
* with `lazy: true` and no `component` (see {@link PublicComponentConfig}).
|
|
@@ -326,6 +653,6 @@ export declare class Registry<T = any> {
|
|
|
326
653
|
* @param namespace - Namespace to filter by
|
|
327
654
|
* @returns Array of component configurations in the namespace
|
|
328
655
|
*/
|
|
329
|
-
getNamespaceComponents(namespace: string):
|
|
656
|
+
getNamespaceComponents(namespace: string): RegistryComponentConfig<T>[];
|
|
330
657
|
}
|
|
331
658
|
export declare const ComponentRegistry: Registry<any>;
|