@elaraai/east-ui 1.0.7 → 1.0.9

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.
Files changed (41) hide show
  1. package/dist/src/charts/chart/index.d.ts +4 -2
  2. package/dist/src/charts/chart/index.d.ts.map +1 -1
  3. package/dist/src/charts/chart/index.js +1 -1
  4. package/dist/src/charts/chart/index.js.map +1 -1
  5. package/dist/src/component.d.ts +70 -0
  6. package/dist/src/component.d.ts.map +1 -1
  7. package/dist/src/component.js +47 -0
  8. package/dist/src/component.js.map +1 -1
  9. package/dist/src/disclosure/index.d.ts +1 -0
  10. package/dist/src/disclosure/index.d.ts.map +1 -1
  11. package/dist/src/disclosure/index.js +1 -0
  12. package/dist/src/disclosure/index.js.map +1 -1
  13. package/dist/src/disclosure/story/index.d.ts +400 -0
  14. package/dist/src/disclosure/story/index.d.ts.map +1 -0
  15. package/dist/src/disclosure/story/index.js +369 -0
  16. package/dist/src/disclosure/story/index.js.map +1 -0
  17. package/dist/src/disclosure/story/types.d.ts +184 -0
  18. package/dist/src/disclosure/story/types.d.ts.map +1 -0
  19. package/dist/src/disclosure/story/types.js +128 -0
  20. package/dist/src/disclosure/story/types.js.map +1 -0
  21. package/dist/src/index.d.ts +1 -1
  22. package/dist/src/index.d.ts.map +1 -1
  23. package/dist/src/index.js +1 -1
  24. package/dist/src/index.js.map +1 -1
  25. package/dist/src/internal.d.ts +2 -1
  26. package/dist/src/internal.d.ts.map +1 -1
  27. package/dist/src/internal.js +2 -1
  28. package/dist/src/internal.js.map +1 -1
  29. package/dist/src/runtime/disclosure/index.d.ts +1 -0
  30. package/dist/src/runtime/disclosure/index.d.ts.map +1 -1
  31. package/dist/src/runtime/disclosure/index.js +1 -0
  32. package/dist/src/runtime/disclosure/index.js.map +1 -1
  33. package/dist/src/runtime/disclosure/story.d.ts +61 -0
  34. package/dist/src/runtime/disclosure/story.d.ts.map +1 -0
  35. package/dist/src/runtime/disclosure/story.js +58 -0
  36. package/dist/src/runtime/disclosure/story.js.map +1 -0
  37. package/dist/test/disclosure/story.examples.d.ts +11 -0
  38. package/dist/test/disclosure/story.examples.d.ts.map +1 -0
  39. package/dist/test/disclosure/story.examples.js +156 -0
  40. package/dist/test/disclosure/story.examples.js.map +1 -0
  41. package/package.json +3 -3
@@ -0,0 +1,369 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import { East, ArrayType, FunctionType, IntegerType, NullType, OptionType, StringType, StructType, variant, some, none, } from "@elaraai/east";
6
+ import { UIComponentType } from "../../component.js";
7
+ import { StoryLayoutType, StoryLayout, StoryStepLengthType, StoryActiveBindingType, StoryProgressBindingType, StoryStyleType, } from "./types.js";
8
+ // Re-export types
9
+ export { StoryLayoutType, StoryLayout, StoryStepLengthType, StoryStepLength, StoryActiveBindingType, StoryProgressBindingType, StoryStyleType, } from "./types.js";
10
+ // ============================================================================
11
+ // StoryStepType — standalone mirror of the inline `StoryStep` variant
12
+ // ============================================================================
13
+ /**
14
+ * Concrete struct mirroring the inline `StoryStep` variant in
15
+ * `component.ts`. Renderers reference this for `equalFor` / `ValueTypeOf`.
16
+ *
17
+ * @remarks
18
+ * One narrative beat: spine node · eyebrow (`index / total · label`) ·
19
+ * title · body. The body is the step's children — any east-ui subtree —
20
+ * and fills the step's full scroll runway. The optional `stage` is the
21
+ * keyframe shown in the sticky slot while this step is active; a step
22
+ * without one holds the previous keyframe (the natural shape for two beats
23
+ * narrating the same visual).
24
+ *
25
+ * @property id - Step identifier, used for deep links, snapshot names, and
26
+ * the `activeStep` static override
27
+ * @property eyebrow - Short label after the `index / total` prefix
28
+ * @property title - Step heading (DM Sans 17px/600)
29
+ * @property stage - Keyframe rendered in the sticky stage while active
30
+ * @property body - Rail content (the step's children)
31
+ */
32
+ export const StoryStepType = StructType({
33
+ id: StringType,
34
+ eyebrow: OptionType(StringType),
35
+ title: OptionType(StringType),
36
+ stage: OptionType(UIComponentType),
37
+ body: ArrayType(UIComponentType),
38
+ });
39
+ // ============================================================================
40
+ // StoryType — standalone mirror of the inline `Story` variant
41
+ // ============================================================================
42
+ /**
43
+ * Concrete struct mirroring the inline `Story` variant in `component.ts`.
44
+ *
45
+ * @property steps - Children; expected to be `StoryStep` values (soft
46
+ * contract, like ChipRail's chip-shaped children — the renderer skips
47
+ * non-step children with a dev warning)
48
+ * @property active - Optional narrative-position binding (Integer
49
+ * read/write closures, the `State.bind` struct)
50
+ * @property progress - Optional within-step scrub binding (Float 0–1)
51
+ * @property activeStep - Static override: renders one deterministic
52
+ * keyframe by step id (snapshot pipeline / deep links)
53
+ * @property title - When present, the one-row `Story.Progress` chrome is
54
+ * rendered sticky above the story with this eyebrow title
55
+ * @property onStepEnter - Fired with the step id on activation (either
56
+ * scroll direction)
57
+ * @property onStepExit - Fired with the step id on deactivation
58
+ * @property style - Visual-presentation sub-struct
59
+ */
60
+ export const StoryType = StructType({
61
+ steps: ArrayType(UIComponentType),
62
+ active: OptionType(StoryActiveBindingType),
63
+ progress: OptionType(StoryProgressBindingType),
64
+ activeStep: OptionType(StringType),
65
+ title: OptionType(StringType),
66
+ onStepEnter: OptionType(FunctionType([StringType], NullType)),
67
+ onStepExit: OptionType(FunctionType([StringType], NullType)),
68
+ style: OptionType(StoryStyleType),
69
+ });
70
+ // ============================================================================
71
+ // StoryProgressType — standalone mirror of the inline `StoryProgress` variant
72
+ // ============================================================================
73
+ /**
74
+ * Concrete struct mirroring the inline `StoryProgress` variant in
75
+ * `component.ts`.
76
+ *
77
+ * @remarks
78
+ * The one-row chrome strip: eyebrow title · per-step dots · counter ·
79
+ * prev/next. Mounts standalone anywhere (a page header, a Drawer foot)
80
+ * because it only talks to the `active` binding.
81
+ *
82
+ * @property count - Total number of steps
83
+ * @property active - Optional narrative-position binding
84
+ * @property title - Eyebrow title at the left of the row
85
+ */
86
+ export const StoryProgressType = StructType({
87
+ count: IntegerType,
88
+ active: OptionType(StoryActiveBindingType),
89
+ title: OptionType(StringType),
90
+ });
91
+ // ============================================================================
92
+ // Story Step Factory
93
+ // ============================================================================
94
+ /**
95
+ * Creates a Story step — one narrative beat in the rail.
96
+ *
97
+ * @param body - Rail content (any east-ui subtree); fills the step's full
98
+ * scroll runway
99
+ * @param options - `id` (required) plus `eyebrow` / `title` / `stage`
100
+ * @returns An East expression representing the StoryStep component
101
+ *
102
+ * @remarks
103
+ * Steps are real components (a `UIComponentType` variant arm), so a
104
+ * conditional step (`cond.ifElse(stepA, stepB)`) is legal. One idea per
105
+ * step: a body that needs a scrollbar is two steps.
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * import { East } from "@elaraai/east";
110
+ * import { Story, Text, UIComponentType } from "@elaraai/east-ui";
111
+ *
112
+ * const step = East.function([], UIComponentType, _$ =>
113
+ * Story.Step([
114
+ * Text.Root("Orders climbed from week 6 and never gave the gain back."),
115
+ * ], { id: "demand", eyebrow: "Demand", title: "Demand ran hot" }),
116
+ * );
117
+ * ```
118
+ */
119
+ function createStoryStep(body, options) {
120
+ // Cast at variant boundary — the inline `StoryStep` variant in
121
+ // component.ts uses the recursive `node` for stage/body, structurally
122
+ // identical to `UIComponentType` after unfolding but not provably
123
+ // equal to TS.
124
+ return East.value(variant("StoryStep", {
125
+ id: options.id,
126
+ eyebrow: options.eyebrow !== undefined ? some(options.eyebrow) : none,
127
+ title: options.title !== undefined ? some(options.title) : none,
128
+ stage: options.stage !== undefined ? some(options.stage) : none,
129
+ body: body,
130
+ }), UIComponentType);
131
+ }
132
+ // ============================================================================
133
+ // Story Root Factory
134
+ // ============================================================================
135
+ /**
136
+ * Creates a Story — a scroll-driven narrative with a prose rail and a
137
+ * sticky stage (design/story.html §2.7 Narrate).
138
+ *
139
+ * @param steps - The narrative beats, built with `Story.Step` (soft
140
+ * contract — non-step children are skipped with a dev warning)
141
+ * @param options - State + behaviour + visual style fields
142
+ * @returns An East expression representing the Story component
143
+ *
144
+ * @remarks
145
+ * Scroll drives the active step; the active step drives the stage
146
+ * keyframe. The component observes native scroll and never hijacks it;
147
+ * the single sanctioned programmatic scroll is navigation (a step/dot
148
+ * click or an external `active` write smooth-scrolls that step to the
149
+ * trigger line). The position is one ordinary state binding — omit
150
+ * `active` and Story keeps it internal.
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * import { East } from "@elaraai/east";
155
+ * import { Story, Text, UIComponentType } from "@elaraai/east-ui";
156
+ *
157
+ * const review = East.function([], UIComponentType, _$ =>
158
+ * Story.Root([
159
+ * Story.Step([Text.Root("Orders climbed steadily from week 6.")],
160
+ * { id: "demand", eyebrow: "Demand", title: "Demand ran hot",
161
+ * stage: Text.Root("kf 1") }),
162
+ * Story.Step([Text.Root("The committed forecast kept its old slope.")],
163
+ * { id: "forecast", eyebrow: "Forecast", title: "The plan missed the turn",
164
+ * stage: Text.Root("kf 2") }),
165
+ * ], { title: "Q4 demand review", stageHeight: 420, stepLength: "default" }),
166
+ * );
167
+ * ```
168
+ */
169
+ function createStoryRoot(steps, options) {
170
+ const { active, progress, activeStep, title, onStepEnter, onStepExit, ...visual } = options ?? {};
171
+ const hasVisual = Object.values(visual).some(field => field !== undefined);
172
+ const styleValue = hasVisual ? buildStoryStyle(visual) : undefined;
173
+ return East.value(variant("Story", {
174
+ steps: steps,
175
+ active: active !== undefined ? some(active) : none,
176
+ progress: progress !== undefined ? some(progress) : none,
177
+ activeStep: activeStep !== undefined ? some(activeStep) : none,
178
+ title: title !== undefined ? some(title) : none,
179
+ onStepEnter: onStepEnter ? some(onStepEnter) : none,
180
+ onStepExit: onStepExit ? some(onStepExit) : none,
181
+ style: styleValue ? some(styleValue) : none,
182
+ }), UIComponentType);
183
+ }
184
+ function buildStoryStyle(style) {
185
+ const layoutValue = style.layout
186
+ ? (typeof style.layout === "string"
187
+ ? East.value(variant(style.layout, null), StoryLayoutType)
188
+ : style.layout)
189
+ : undefined;
190
+ const stepLengthValue = style.stepLength
191
+ ? (typeof style.stepLength === "string"
192
+ ? East.value(variant(style.stepLength, null), StoryStepLengthType)
193
+ : style.stepLength)
194
+ : undefined;
195
+ const stageHeightValue = style.stageHeight !== undefined
196
+ ? (typeof style.stageHeight === "number"
197
+ ? `${Math.round(style.stageHeight)}px`
198
+ : style.stageHeight)
199
+ : undefined;
200
+ const heightValue = style.height !== undefined
201
+ ? (typeof style.height === "number"
202
+ ? `${Math.round(style.height)}px`
203
+ : style.height)
204
+ : undefined;
205
+ return East.value({
206
+ layout: layoutValue ? some(layoutValue) : none,
207
+ stageHeight: stageHeightValue !== undefined ? some(stageHeightValue) : none,
208
+ stepLength: stepLengthValue ? some(stepLengthValue) : none,
209
+ height: heightValue !== undefined ? some(heightValue) : none,
210
+ }, StoryStyleType);
211
+ }
212
+ // ============================================================================
213
+ // Story Progress Factory
214
+ // ============================================================================
215
+ /**
216
+ * Creates the Story.Progress chrome strip: eyebrow title · per-step dots ·
217
+ * counter · prev/next.
218
+ *
219
+ * @param options - `count` (required) plus the `active` binding and `title`
220
+ * @returns An East expression representing the StoryProgress component
221
+ *
222
+ * @remarks
223
+ * Mounts standalone anywhere because it shares nothing with the Story but
224
+ * the binding: dots and prev/next simply write `active`, and the Story's
225
+ * rail treats the write as navigation. Inside `Story.Root` the chrome is
226
+ * rendered automatically when the story's `title` option is set.
227
+ *
228
+ * @example
229
+ * ```ts
230
+ * import { East } from "@elaraai/east";
231
+ * import { Story, UIComponentType } from "@elaraai/east-ui";
232
+ *
233
+ * const chrome = East.function([], UIComponentType, _$ =>
234
+ * Story.Progress({ count: 4, title: "Q4 demand review" }),
235
+ * );
236
+ * ```
237
+ */
238
+ function createStoryProgress(options) {
239
+ const countValue = typeof options.count === "number"
240
+ ? BigInt(Math.round(options.count))
241
+ : options.count;
242
+ return East.value(variant("StoryProgress", {
243
+ count: countValue,
244
+ active: options.active !== undefined ? some(options.active) : none,
245
+ title: options.title !== undefined ? some(options.title) : none,
246
+ }), UIComponentType);
247
+ }
248
+ // ============================================================================
249
+ // Story Compound Namespace
250
+ // ============================================================================
251
+ /**
252
+ * Story compound primitive for scroll-driven narratives — one persistent
253
+ * visual (the stage) evolving through keyframes while prose steps scroll
254
+ * past in a rail beside it. The reader's scrollbar is the timeline.
255
+ *
256
+ * @remarks
257
+ * Use `Story.Root(steps, options)` for the container, `Story.Step(body,
258
+ * { id, … })` for each beat, and `Story.Progress(options)` for standalone
259
+ * chrome. Reach for Story only when the *sequence* of readings carries the
260
+ * argument; random-access beats are Tabs, equal-weight siblings with no
261
+ * shared visual are a Carousel.
262
+ */
263
+ export const Story = {
264
+ /**
265
+ * Creates a Story container.
266
+ *
267
+ * @param steps - The narrative beats, built with `Story.Step`
268
+ * @param options - State + behaviour + visual style fields
269
+ * @returns An East expression representing the Story component
270
+ *
271
+ * @remarks
272
+ * See {@link createStoryRoot} for full semantics. `active` / `progress`
273
+ * / `activeStep` (state) and `onStepEnter` / `onStepExit` (behaviour)
274
+ * sit alongside the visual style fields in one flat bag.
275
+ *
276
+ * @example
277
+ * ```ts
278
+ * import { East } from "@elaraai/east";
279
+ * import { Story, Text, UIComponentType } from "@elaraai/east-ui";
280
+ *
281
+ * const ex = East.function([], UIComponentType, _$ =>
282
+ * Story.Root([
283
+ * Story.Step([Text.Root("Beat one.")], { id: "one", title: "One" }),
284
+ * Story.Step([Text.Root("Beat two.")], { id: "two", title: "Two" }),
285
+ * ], { stageHeight: 420 }),
286
+ * );
287
+ * ```
288
+ */
289
+ Root: createStoryRoot,
290
+ /**
291
+ * Creates a Story step.
292
+ *
293
+ * @param body - Rail content (any east-ui subtree)
294
+ * @param options - `id` (required) plus `eyebrow` / `title` / `stage`
295
+ * @returns An East expression representing the StoryStep component
296
+ *
297
+ * @example
298
+ * ```ts
299
+ * import { East } from "@elaraai/east";
300
+ * import { Story, Text, UIComponentType } from "@elaraai/east-ui";
301
+ *
302
+ * const ex = East.function([], UIComponentType, _$ =>
303
+ * Story.Step([Text.Root("Orders climbed steadily.")],
304
+ * { id: "demand", eyebrow: "Demand", title: "Demand ran hot" }),
305
+ * );
306
+ * ```
307
+ */
308
+ Step: createStoryStep,
309
+ /**
310
+ * Creates the standalone Story.Progress chrome strip.
311
+ *
312
+ * @param options - `count` (required) plus `active` binding and `title`
313
+ * @returns An East expression representing the StoryProgress component
314
+ *
315
+ * @example
316
+ * ```ts
317
+ * import { East } from "@elaraai/east";
318
+ * import { Story, UIComponentType } from "@elaraai/east-ui";
319
+ *
320
+ * const ex = East.function([], UIComponentType, _$ =>
321
+ * Story.Progress({ count: 4, title: "Q4 demand review" }),
322
+ * );
323
+ * ```
324
+ */
325
+ Progress: createStoryProgress,
326
+ /**
327
+ * Helper for creating story layout values.
328
+ *
329
+ * @param v - The layout string
330
+ * @returns An East expression representing the layout
331
+ */
332
+ Layout: StoryLayout,
333
+ Types: {
334
+ /**
335
+ * The concrete East type for the Story container — mirrors the
336
+ * inline `Story` variant in `component.ts`.
337
+ */
338
+ Story: StoryType,
339
+ /**
340
+ * The concrete East type for a Story step.
341
+ */
342
+ Step: StoryStepType,
343
+ /**
344
+ * The concrete East type for the Story.Progress chrome.
345
+ */
346
+ Progress: StoryProgressType,
347
+ /**
348
+ * Visual-only style struct for Story. See {@link StoryStyleType}.
349
+ */
350
+ Style: StoryStyleType,
351
+ /**
352
+ * Layout enum (rail-left / rail-right / stacked).
353
+ */
354
+ Layout: StoryLayoutType,
355
+ /**
356
+ * Step runway enum (compact / default / long).
357
+ */
358
+ StepLength: StoryStepLengthType,
359
+ /**
360
+ * Narrative-position binding struct (Integer read/write closures).
361
+ */
362
+ ActiveBinding: StoryActiveBindingType,
363
+ /**
364
+ * Within-step scrub binding struct (Float read/write closures).
365
+ */
366
+ ProgressBinding: StoryProgressBindingType,
367
+ },
368
+ };
369
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/disclosure/story/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGH,IAAI,EACJ,SAAS,EACT,YAA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;;;;;;;;OAiBG;IACH,IAAI,EAAE,eAAe;IACrB;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,EAAE,mBAAmB;IAC7B;;;;;OAKG;IACH,MAAM,EAAE,WAAW;IACnB,KAAK,EAAE;QACH;;;WAGG;QACH,KAAK,EAAE,SAAS;QAChB;;WAEG;QACH,IAAI,EAAE,aAAa;QACnB;;WAEG;QACH,QAAQ,EAAE,iBAAiB;QAC3B;;WAEG;QACH,KAAK,EAAE,cAAc;QACrB;;WAEG;QACH,MAAM,EAAE,eAAe;QACvB;;WAEG;QACH,UAAU,EAAE,mBAAmB;QAC/B;;WAEG;QACH,aAAa,EAAE,sBAAsB;QACrC;;WAEG;QACH,eAAe,EAAE,wBAAwB;KAC5C;CACK,CAAC"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import { type ExprType, type SubtypeExprOrValue, BooleanType, FloatType, FunctionType, IntegerType, NullType, OptionType, StringType, StructType, VariantType } from "@elaraai/east";
6
+ /**
7
+ * Layout options for Story (design/story.html §Story.Root Layouts).
8
+ *
9
+ * @remarks
10
+ * `stacked` is also forced automatically below 720px container width: the
11
+ * stage compresses to `min(stageHeight, 280px)`, sticks to the top, and the
12
+ * prose scrolls beneath it full-width. There is no overlay layout — text
13
+ * never floats over the visual.
14
+ *
15
+ * @property rail-left - Prose rail left, stage right (default; reading order matches scan order)
16
+ * @property rail-right - Mirror image; for pages whose surrounding chrome already sits left
17
+ * @property stacked - Stage on top, prose beneath (forced under 720px)
18
+ */
19
+ export declare const StoryLayoutType: VariantType<{
20
+ readonly "rail-left": NullType;
21
+ readonly "rail-right": NullType;
22
+ readonly stacked: NullType;
23
+ }>;
24
+ /**
25
+ * Type representing the StoryLayout structure.
26
+ */
27
+ export type StoryLayoutType = typeof StoryLayoutType;
28
+ /**
29
+ * String literal type for story layout values.
30
+ */
31
+ export type StoryLayoutLiteral = "rail-left" | "rail-right" | "stacked";
32
+ /**
33
+ * Helper function to create story layout values.
34
+ *
35
+ * @param v - The layout string
36
+ * @returns An East expression representing the story layout
37
+ */
38
+ export declare function StoryLayout(v: StoryLayoutLiteral): ExprType<StoryLayoutType>;
39
+ /**
40
+ * Step runway presets — the scroll distance the reader travels per keyframe
41
+ * (design/story.html §Story.Root Dimensions).
42
+ *
43
+ * @property compact - 36vh per step
44
+ * @property default - 52vh per step
45
+ * @property long - 72vh per step
46
+ */
47
+ export declare const StoryStepLengthType: VariantType<{
48
+ readonly compact: NullType;
49
+ readonly default: NullType;
50
+ readonly long: NullType;
51
+ }>;
52
+ /**
53
+ * Type representing the StoryStepLength structure.
54
+ */
55
+ export type StoryStepLengthType = typeof StoryStepLengthType;
56
+ /**
57
+ * String literal type for story step length values.
58
+ */
59
+ export type StoryStepLengthLiteral = "compact" | "default" | "long";
60
+ /**
61
+ * Helper function to create story step length values.
62
+ *
63
+ * @param v - The step length string
64
+ * @returns An East expression representing the step length
65
+ */
66
+ export declare function StoryStepLength(v: StoryStepLengthLiteral): ExprType<StoryStepLengthType>;
67
+ /**
68
+ * The narrative-position binding: Integer read/write closures, the exact
69
+ * struct `State.bind([IntegerType], key, default)` produces — bindings pass
70
+ * straight through, no adapter (design/story.html §Wiring).
71
+ *
72
+ * @remarks
73
+ * The scroll driver writes it as steps cross the trigger line; an external
74
+ * write is treated as navigation — the rail smooth-scrolls that step to the
75
+ * trigger line, then resumes observing. Anything exposing these closures
76
+ * works; there is no bespoke handle type.
77
+ *
78
+ * @property read - Returns the active step index
79
+ * @property write - Sets the active step index (navigation when external)
80
+ * @property has - True when the underlying state key exists
81
+ */
82
+ export declare const StoryActiveBindingType: StructType<{
83
+ readonly read: FunctionType<[], IntegerType>;
84
+ readonly write: FunctionType<[IntegerType], NullType>;
85
+ readonly has: FunctionType<[], BooleanType>;
86
+ }>;
87
+ /**
88
+ * Type representing the StoryActiveBinding structure.
89
+ */
90
+ export type StoryActiveBindingType = typeof StoryActiveBindingType;
91
+ /**
92
+ * The within-step scrub binding: Float read/write closures over progress
93
+ * ∈ [0, 1] through the active step, the exact struct
94
+ * `State.bind([FloatType], key, default)` produces.
95
+ *
96
+ * @remarks
97
+ * Written by the scroll driver only; consumers read it (inside `Reactive`)
98
+ * for scroll-locked effects and never write it. Scrub maps 1:1 to scroll —
99
+ * no easing, no duration.
100
+ *
101
+ * @property read - Returns progress through the active step (0–1)
102
+ * @property write - Sets the progress (scroll driver only)
103
+ * @property has - True when the underlying state key exists
104
+ */
105
+ export declare const StoryProgressBindingType: StructType<{
106
+ readonly read: FunctionType<[], FloatType>;
107
+ readonly write: FunctionType<[FloatType], NullType>;
108
+ readonly has: FunctionType<[], BooleanType>;
109
+ }>;
110
+ /**
111
+ * Type representing the StoryProgressBinding structure.
112
+ */
113
+ export type StoryProgressBindingType = typeof StoryProgressBindingType;
114
+ /**
115
+ * Visual-only style struct for Story. Content (`steps`), state (`active` /
116
+ * `progress` / `activeStep`), and behaviour (`onStepEnter` / `onStepExit`)
117
+ * live on the main `Story` variant (inline in `component.ts` because steps
118
+ * are recursive `node` children).
119
+ *
120
+ * @property layout - Rail placement (rail-left / rail-right / stacked)
121
+ * @property stageHeight - Stage height as a CSS length (default "420px") —
122
+ * fixed per story so keyframe tweens never reflow the page
123
+ * @property stepLength - Step runway preset (compact / default / long)
124
+ * @property height - Scrollport height as a CSS length. When set, the
125
+ * story owns an internal scroll container (the spec demo's `.story-demo`
126
+ * form) — use it for embeds whose ancestors break sticky (cards,
127
+ * overflow-clipped frames, showcases). When omitted the story rides the
128
+ * native page scroll, the default for report pages.
129
+ */
130
+ export declare const StoryStyleType: StructType<{
131
+ readonly layout: OptionType<VariantType<{
132
+ readonly "rail-left": NullType;
133
+ readonly "rail-right": NullType;
134
+ readonly stacked: NullType;
135
+ }>>;
136
+ readonly stageHeight: OptionType<StringType>;
137
+ readonly stepLength: OptionType<VariantType<{
138
+ readonly compact: NullType;
139
+ readonly default: NullType;
140
+ readonly long: NullType;
141
+ }>>;
142
+ readonly height: OptionType<StringType>;
143
+ }>;
144
+ /**
145
+ * Type representing the Story visual-style structure.
146
+ */
147
+ export type StoryStyleType = typeof StoryStyleType;
148
+ /**
149
+ * TypeScript options bag for Story's `style` sub-struct — visual props only.
150
+ *
151
+ * @remarks
152
+ * State (`active` / `progress` / `activeStep`) and behaviour
153
+ * (`onStepEnter` / `onStepExit`) live on the main options object passed to
154
+ * `Story.Root`, not here.
155
+ */
156
+ export interface StoryStyle {
157
+ /** Rail placement (rail-left / rail-right / stacked) */
158
+ layout?: SubtypeExprOrValue<StoryLayoutType> | StoryLayoutLiteral;
159
+ /** Stage height as a CSS length ("420px", "50vh"); bare numbers are px */
160
+ stageHeight?: SubtypeExprOrValue<StringType> | number;
161
+ /** Step runway preset (compact / default / long) */
162
+ stepLength?: SubtypeExprOrValue<StoryStepLengthType> | StoryStepLengthLiteral;
163
+ /** Scrollport height as a CSS length ("520px", "70vh", "100%"); bare
164
+ * numbers are px. When set the story owns an internal scroll container
165
+ * (spec demo form); omit to ride the page scroll */
166
+ height?: SubtypeExprOrValue<StringType> | number;
167
+ }
168
+ /**
169
+ * TypeScript options bag for `Story.Progress`.
170
+ *
171
+ * @property count - Total number of steps shown by the dots / counter
172
+ * @property active - Narrative-position binding (`State.bind` struct) shared
173
+ * with the Story it narrates
174
+ * @property title - Eyebrow title at the left of the chrome row
175
+ */
176
+ export interface StoryProgressOptions {
177
+ /** Total number of steps shown by the dots / counter */
178
+ count: SubtypeExprOrValue<IntegerType> | number;
179
+ /** Narrative-position binding shared with the Story */
180
+ active?: SubtypeExprOrValue<StoryActiveBindingType>;
181
+ /** Eyebrow title at the left of the chrome row */
182
+ title?: SubtypeExprOrValue<StringType>;
183
+ }
184
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/disclosure/story/types.ts"],"names":[],"mappings":"AAAA;;;GA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