@@ -21,8 +21,10 @@ Run via `npm run schema`.
2121` tasks/generate_schema_types.mjs ` is called by ` tasks/schema.mjs ` after
2222writing ` plot-schema.json ` . The generator walks ` schema.traces ` ,
2323` schema.layout.layoutAttributes ` , ` schema.animation ` , ` schema.frames ` , and
24- ` schema.config.edits ` , mapping each attribute's ` valType ` metadata to a
25- TypeScript type.
24+ ` schema.config ` (including ` schema.config.edits ` ), mapping each attribute's
25+ ` valType ` metadata to a TypeScript type. The set of meta keys to strip
26+ during emission is read from ` schema.defs.metaKeys ` so any addition to the
27+ schema's metadata format is picked up automatically.
2628
2729### Phase 0: Common enum discovery
2830
@@ -109,7 +111,7 @@ The Layout interface includes subplot index signatures:
109111// etc.
110112```
111113
112- ### Phase 5: Animation, frame, and edits interfaces
114+ ### Phase 5: Animation, frame, edits, and config interfaces
113115
114116` AnimationOpts ` is emitted from ` schema.animation ` (references the
115117injected ` Transition ` and ` AnimationFrameOpts ` shared types). ` Frame ` is
@@ -128,6 +130,15 @@ The override mechanism is the `fieldOverrides` param on `attrsToProperties`
128130schema can't self-reference. ` Edits ` is emitted from ` schema.config.edits `
129131without overrides (all fields are concrete booleans).
130132
133+ ` ConfigBase ` is emitted from ` schema.config ` after registering Edits'
134+ fingerprint in ` sharedTypes ` , so ` edits?: Edits ` references the named
135+ interface rather than re-inlining the subtree. Seven config fields whose
136+ schema ` valType ` is ` any ` (` locales ` , ` modeBarButtons ` ,
137+ ` modeBarButtonsToAdd ` , ` modeBarButtonsToRemove ` , ` setBackground ` ,
138+ ` showSources ` , ` toImageButtonOptions ` ) come through as ` any ` ; the
139+ hand-written ` Config ` in ` core/config.d.ts ` overrides them via
140+ ` Omit<ConfigBase, keyof ConfigOverrides> & ConfigOverrides ` .
141+
131142### Phase 6: Internal namespace
132143
133144Names in ` INTERNAL_INTERFACES ` are wrapped in `export namespace _ internal {
@@ -182,7 +193,7 @@ src/types/generated/schema.d.ts
182193├── Trace interfaces (ScatterData, BarData, ... — 49 traces)
183194├── Layout component interfaces (LayoutAxis, Legend, Scene, Annotation, etc.)
184195├── Layout interface
185- └── Animation / frames / config (AnimationOpts, Frame, Edits)
196+ └── Animation / frames / config (AnimationOpts, Frame, Edits, ConfigBase )
186197```
187198
188199Regenerate with ` npm run schema ` .
@@ -213,9 +224,10 @@ Attribute name overrides via `ATTR_NAME_OVERRIDES` map specific attribute
213224paths to a type alias regardless of valType (e.g. ` marker.symbol ` →
214225` MarkerSymbol ` ).
215226
216- Reserved keys stripped from the output: ` editType ` , ` role ` , ` description ` ,
217- ` impliedEdits ` , ` _isSubplotObj ` , ` _isLinkedToArray ` , ` _arrayAttrRegexps ` ,
218- ` _deprecated ` .
227+ Reserved keys stripped from the output come from ` schema.defs.metaKeys ` —
228+ currently ` editType ` , ` role ` , ` description ` , ` impliedEdits ` ,
229+ ` _isSubplotObj ` , ` _isLinkedToArray ` , ` _arrayAttrRegexps ` , ` _deprecated ` .
230+ New additions to that list are picked up automatically on regen.
219231
220232## Extending the schema generator
221233
@@ -302,18 +314,19 @@ console.log(s.layout.layoutAttributes.xaxis); // inspect layout attrs
302314console .log (s .traces .scatter .attributes ); // inspect trace attrs
303315```
304316
305- ## Public API re-export check
317+ ## Public API re-export
306318
307319` lib/index.d.ts ` uses ` export type * from '../src/types/generated/schema' ` ,
308320so every top-level exported type from ` schema.d.ts ` is automatically
309321re-exported to consumers. Types inside the ` _internal ` namespace are still
310322reachable via ` _internal.X ` (the namespace itself is exported by the
311323wildcard) but their bare names are not.
312324
313- ` tasks/schema.mjs ` short-circuits its per-name re-export verification
314- when the wildcard is detected. If you ever replace the wildcard with an
315- explicit allowlist, the per-name check runs and warns about any
316- exported-but-not-re-exported types.
325+ The wildcard is load-bearing: it removes the maintenance burden of keeping
326+ ` lib/index.d.ts ` in sync with new schema additions. If anyone ever swaps
327+ it for an explicit allowlist, restore the per-name re-export verifier
328+ that previously lived in ` tasks/schema.mjs ` (see git history) — otherwise
329+ new generated types will silently fail to surface in the public API.
317330
318331## CI integration
319332
0 commit comments