@usetheo/ui 0.1.0-next.0 → 0.1.0-next.1
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 +14 -0
- package/README.md +116 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin-Atb0VKtr.d.ts +172 -0
- package/dist/slide/index.d.ts +212 -0
- package/dist/slide/index.js +714 -0
- package/dist/slide/index.js.map +1 -0
- package/dist/slide/plugins/emoji/index.d.ts +29 -0
- package/dist/slide/plugins/emoji/index.js +157 -0
- package/dist/slide/plugins/emoji/index.js.map +1 -0
- package/dist/slide/plugins/math/index.d.ts +13 -0
- package/dist/slide/plugins/math/index.js +145 -0
- package/dist/slide/plugins/math/index.js.map +1 -0
- package/dist/slide/plugins/mermaid/index.d.ts +55 -0
- package/dist/slide/plugins/mermaid/index.js +218 -0
- package/dist/slide/plugins/mermaid/index.js.map +1 -0
- package/dist/slide/plugins/shiki/index.d.ts +18 -0
- package/dist/slide/plugins/shiki/index.js +87 -0
- package/dist/slide/plugins/shiki/index.js.map +1 -0
- package/dist/slide/themes/default.css +256 -0
- package/dist/slide/themes/layouts.css +143 -0
- package/dist/slide/themes/violet-forge.css +256 -0
- package/dist/slide-deck/index.css +52 -0
- package/dist/slide-deck/index.css.map +1 -0
- package/dist/slide-deck/index.d.ts +377 -0
- package/dist/slide-deck/index.js +1797 -0
- package/dist/slide-deck/index.js.map +1 -0
- package/dist/whiteboard/index.d.ts +258 -0
- package/dist/whiteboard/index.js +738 -0
- package/dist/whiteboard/index.js.map +1 -0
- package/package.json +141 -9
- package/registry/r/agent-composer.json +4 -4
- package/registry/r/agent-editor.json +9 -9
- package/registry/r/agent-error-card.json +2 -2
- package/registry/r/agent-event.json +4 -4
- package/registry/r/agent-handoff.json +2 -2
- package/registry/r/agent-profile.json +2 -2
- package/registry/r/agent-starting-state.json +2 -2
- package/registry/r/agent-stream.json +9 -9
- package/registry/r/agent-streaming.json +2 -2
- package/registry/r/agent-timeline.json +4 -4
- package/registry/r/approval-card.json +4 -4
- package/registry/r/artifact-preview.json +2 -2
- package/registry/r/attachment-chip.json +4 -4
- package/registry/r/audit-log-entry.json +3 -3
- package/registry/r/auto-compact-notice.json +2 -2
- package/registry/r/avatar.json +2 -2
- package/registry/r/badge.json +2 -2
- package/registry/r/browser-controls.json +2 -2
- package/registry/r/build-log-stream.json +2 -2
- package/registry/r/button.json +2 -2
- package/registry/r/capability-indicator.json +3 -3
- package/registry/r/card.json +2 -2
- package/registry/r/chat-composer.json +3 -3
- package/registry/r/chat-message.json +3 -3
- package/registry/r/chat-thread.json +2 -2
- package/registry/r/checkbox.json +2 -2
- package/registry/r/command-palette.json +4 -4
- package/registry/r/context-card.json +3 -3
- package/registry/r/context-window-bar.json +2 -2
- package/registry/r/cost-meter.json +2 -2
- package/registry/r/created-files-card.json +3 -3
- package/registry/r/cron-job-card.json +2 -2
- package/registry/r/cron-jobs-list.json +3 -3
- package/registry/r/deployment-row.json +3 -3
- package/registry/r/dialog.json +2 -2
- package/registry/r/diff-viewer.json +2 -2
- package/registry/r/domain-config.json +6 -6
- package/registry/r/empty-state.json +3 -3
- package/registry/r/env-var-editor.json +5 -5
- package/registry/r/folder-context-card.json +3 -3
- package/registry/r/folder-selector.json +2 -2
- package/registry/r/form-field.json +2 -2
- package/registry/r/hook-config.json +2 -2
- package/registry/r/hook-event-log.json +2 -2
- package/registry/r/input.json +2 -2
- package/registry/r/intent-selector.json +3 -3
- package/registry/r/label.json +2 -2
- package/registry/r/lane-board.json +2 -2
- package/registry/r/login-split.json +2 -2
- package/registry/r/mcp-server-card.json +2 -2
- package/registry/r/mcp-server-list.json +3 -3
- package/registry/r/memory-editor.json +3 -3
- package/registry/r/mention-menu.json +3 -3
- package/registry/r/metrics-panel.json +2 -2
- package/registry/r/model-card.json +3 -3
- package/registry/r/model-selector.json +2 -2
- package/registry/r/permission-matrix.json +2 -2
- package/registry/r/permission-modal.json +4 -4
- package/registry/r/preview-env-card.json +5 -5
- package/registry/r/preview-panel.json +3 -3
- package/registry/r/progress-checklist.json +3 -3
- package/registry/r/project-card.json +5 -5
- package/registry/r/project-switcher.json +2 -2
- package/registry/r/quick-action-chips.json +3 -3
- package/registry/r/radio-group.json +2 -2
- package/registry/r/recent-folders-list.json +2 -2
- package/registry/r/rollback-ui.json +4 -4
- package/registry/r/rule-card.json +3 -3
- package/registry/r/rule-editor.json +10 -10
- package/registry/r/rule-types.json +1 -1
- package/registry/r/run-stats.json +2 -2
- package/registry/r/running-tasks-panel.json +2 -2
- package/registry/r/scroll-area.json +2 -2
- package/registry/r/select.json +2 -2
- package/registry/r/session-list-item.json +2 -2
- package/registry/r/session-timeline.json +2 -2
- package/registry/r/sheet.json +2 -2
- package/registry/r/sidebar.json +2 -2
- package/registry/r/skeleton.json +2 -2
- package/registry/r/skill-card.json +4 -4
- package/registry/r/skill-editor.json +10 -10
- package/registry/r/skills-list.json +3 -3
- package/registry/r/social-auth-row.json +3 -3
- package/registry/r/steps-rail.json +2 -2
- package/registry/r/sub-agent-dispatch.json +2 -2
- package/registry/r/switch.json +2 -2
- package/registry/r/system-prompt-editor.json +2 -2
- package/registry/r/tabs.json +2 -2
- package/registry/r/task-header.json +4 -4
- package/registry/r/task-plan.json +2 -2
- package/registry/r/terminal-panel.json +2 -2
- package/registry/r/textarea.json +2 -2
- package/registry/r/theme-provider.json +2 -2
- package/registry/r/theme-script.json +1 -1
- package/registry/r/theo-ui-provider.json +2 -2
- package/registry/r/toast.json +2 -2
- package/registry/r/token-usage-chart.json +2 -2
- package/registry/r/tool-call-card.json +3 -3
- package/registry/r/tool-call.json +2 -2
- package/registry/r/tool-result.json +2 -2
- package/registry/r/tools-list.json +3 -3
- package/registry/r/tooltip.json +2 -2
- package/registry/r/topnav.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/composites/slide-deck/transitions.css"],"sourcesContent":["/*\n * Slide deck transitions (ADR D8).\n *\n * Three presets via the `data-theo-slide-deck-transition` attribute on the\n * deck root: \"none\" | \"fade\" | \"slide\".\n *\n * Active transition direction is signaled via `data-theo-slide-deck-direction`\n * (\"none\" | \"next\" | \"prev\"). CSS animations are 250ms, GPU-accelerated.\n *\n * Respects `prefers-reduced-motion: reduce` — all durations collapse to 0ms,\n * effectively becoming \"none\" regardless of the prop.\n */\n\n.theo-slide-deck-slide-frame {\n --theo-slide-deck-transition-duration: 250ms;\n position: absolute;\n inset: 0;\n}\n\n/* fade preset */\n.theo-slide-deck-slide-frame[data-theo-slide-deck-transition=\"fade\"]\n > [data-theo-slide-deck-slide-state=\"incoming\"] {\n animation: theo-slide-deck-fade-in var(--theo-slide-deck-transition-duration) ease-out;\n}\n\n@keyframes theo-slide-deck-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n/* slide preset */\n.theo-slide-deck-slide-frame[data-theo-slide-deck-transition=\"slide\"][data-theo-slide-deck-direction=\"next\"]\n > [data-theo-slide-deck-slide-state=\"incoming\"] {\n animation: theo-slide-deck-slide-in-right var(--theo-slide-deck-transition-duration) ease-out;\n}\n\n.theo-slide-deck-slide-frame[data-theo-slide-deck-transition=\"slide\"][data-theo-slide-deck-direction=\"prev\"]\n > [data-theo-slide-deck-slide-state=\"incoming\"] {\n animation: theo-slide-deck-slide-in-left var(--theo-slide-deck-transition-duration) ease-out;\n}\n\n@keyframes theo-slide-deck-slide-in-right {\n from {\n transform: translateX(30%);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n}\n\n@keyframes theo-slide-deck-slide-in-left {\n from {\n transform: translateX(-30%);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .theo-slide-deck-slide-frame,\n .theo-slide-deck-slide-frame * {\n animation-duration: 0ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0ms !important;\n }\n}\n"],"mappings":";AAaA,CAAC;AACC,yCAAuC;AACvC,YAAU;AACV,SAAO;AACT;AAGA,CAPC,2BAO2B,CAAC,sCAC3B,EAAE,CAAC;AACH,aAAW,wBAAwB,IAAI,uCAAuC;AAChF;AAEA,WAHa;AAIX;AACE,aAAS;AACX;AACA;AACE,aAAS;AACX;AACF;AAGA,CAtBC,2BAsB2B,CAAC,sCAAwC,CAAC,qCACpE,EAAE,CAAC;AACH,aAAW,+BAA+B,IAAI,uCAAuC;AACvF;AAEA,CA3BC,2BA2B2B,CAAC,sCAAwC,CAAC,qCACpE,EAAE,CAAC;AACH,aAAW,8BAA8B,IAAI,uCAAuC;AACtF;AAEA,WARa;AASX;AACE,eAAW,WAAW;AACtB,aAAS;AACX;AACA;AACE,eAAW,WAAW;AACtB,aAAS;AACX;AACF;AAEA,WAda;AAeX;AACE,eAAW,WAAW;AACtB,aAAS;AACX;AACA;AACE,eAAW,WAAW;AACtB,aAAS;AACX;AACF;AAEA,QAAO,wBAAyB;AAC9B,GAvDD;AAAA,EAwDC,CAxDD,4BAwD8B;AAC3B,wBAAoB;AACpB,+BAA2B;AAC3B,yBAAqB;AACvB;AACF;","names":[]}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { FC, ReactNode, Dispatch, RefObject } from 'react';
|
|
3
|
+
import { a as SlidePlugin } from '../plugin-Atb0VKtr.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import 'hast';
|
|
6
|
+
import 'mdast';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* `<SlideDeck.Controls>` — prev/next buttons + slide indicator ("3 / 12").
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface ControlsProps {
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const Controls: FC<ControlsProps>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `<SlideDeck.PresenterView>` — inline split-screen panel.
|
|
19
|
+
*
|
|
20
|
+
* Pragmatic v0.4 scope: renders an in-page panel (current slide + next slide +
|
|
21
|
+
* speaker notes + timer) when `state.presenterMode === true`. The separate
|
|
22
|
+
* window via `window.open` + `BroadcastChannel` is deferred to v0.5 (consumer
|
|
23
|
+
* demand will trigger the upgrade — D6 of the plan is reduced to inline panel).
|
|
24
|
+
*
|
|
25
|
+
* Toggling presenter mode is dispatched via hotkey (n/N/p/P, see useDeckKeyboard).
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
interface PresenterViewProps {
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
declare const PresenterView: FC<PresenterViewProps>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* `<SlideDeck.ProgressBar>` — horizontal HTML5 progress element.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
interface ProgressBarProps {
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
declare const ProgressBar: FC<ProgressBarProps>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Zod schema for `<SlideDeck>` input.
|
|
44
|
+
*
|
|
45
|
+
* Two shapes accepted (ADR D4):
|
|
46
|
+
* - `string` — full markdown, split internally by `splitDeck` (top-level
|
|
47
|
+
* `thematicBreak`, see ADR D3 / D12 of Slide).
|
|
48
|
+
* - `SlideDeckSlide[]` — pre-parsed array (CMS/DB consumers).
|
|
49
|
+
*
|
|
50
|
+
* See `.claude/knowledge-base/plans/slide-deck-composite-plan.md` §16.3.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
declare const slideDeckSlide: z.ZodObject<{
|
|
54
|
+
markdown: z.ZodString;
|
|
55
|
+
id: z.ZodOptional<z.ZodString>;
|
|
56
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
/** Composed input — `slides` prop accepts either form. */
|
|
59
|
+
declare const slideDeckInput: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
|
|
60
|
+
markdown: z.ZodString;
|
|
61
|
+
id: z.ZodOptional<z.ZodString>;
|
|
62
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>>]>;
|
|
64
|
+
type SlideDeckSlide = z.infer<typeof slideDeckSlide>;
|
|
65
|
+
type SlideDeckInput = z.infer<typeof slideDeckInput>;
|
|
66
|
+
/** Transition presets. ADR D8. */
|
|
67
|
+
declare const slideDeckTransition: z.ZodEnum<{
|
|
68
|
+
slide: "slide";
|
|
69
|
+
none: "none";
|
|
70
|
+
fade: "fade";
|
|
71
|
+
}>;
|
|
72
|
+
type SlideDeckTransition = z.infer<typeof slideDeckTransition>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* `<SlideDeck.SlideNumber>` — decorative "N / Total" overlay.
|
|
76
|
+
*
|
|
77
|
+
* aria-hidden because the live indicator in <Controls> already announces the
|
|
78
|
+
* current position; this is purely visual chrome.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
interface SlideNumberProps {
|
|
82
|
+
className?: string;
|
|
83
|
+
}
|
|
84
|
+
declare const SlideNumber: FC<SlideNumberProps>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* `<SlideDeck.Thumbnails>` — sidebar with mini Slide instances.
|
|
88
|
+
*
|
|
89
|
+
* Performance strategy:
|
|
90
|
+
* - Each thumbnail renders the actual `<Slide>` inside a scaled wrapper (~0.18×).
|
|
91
|
+
* - IntersectionObserver lazy-loads thumbnails — off-screen ones show a
|
|
92
|
+
* placeholder skeleton instead of parsing the markdown.
|
|
93
|
+
* - EC-13: when IntersectionObserver is undefined (legacy env / SSR), falls
|
|
94
|
+
* back to eager render. Acceptable for decks ≤ 50 slides.
|
|
95
|
+
*
|
|
96
|
+
* Click handler dispatches JUMP_TO. Auto-scroll keeps current thumbnail visible.
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
interface ThumbnailsProps {
|
|
100
|
+
className?: string;
|
|
101
|
+
/** Scale of each thumbnail. Default 0.18. */
|
|
102
|
+
scale?: number;
|
|
103
|
+
}
|
|
104
|
+
declare const Thumbnails: FC<ThumbnailsProps>;
|
|
105
|
+
|
|
106
|
+
interface SlideDeckProps {
|
|
107
|
+
/** Markdown string (auto-split) or pre-parsed slide array. */
|
|
108
|
+
slides: SlideDeckInput;
|
|
109
|
+
/** Initial slide index (0-based). Default 0. */
|
|
110
|
+
initialIndex?: number;
|
|
111
|
+
/** Transition preset. Default "fade". */
|
|
112
|
+
transition?: SlideDeckTransition;
|
|
113
|
+
/** Enable keyboard navigation. Default true. */
|
|
114
|
+
enableKeyboard?: boolean;
|
|
115
|
+
/** Enable touch/pointer swipe navigation. Default true. */
|
|
116
|
+
enableTouch?: boolean;
|
|
117
|
+
/** Enable hash routing (#/N). Default true. */
|
|
118
|
+
enableHashRouting?: boolean;
|
|
119
|
+
/** Optional unique deck id (auto-generated UUID if absent). */
|
|
120
|
+
deckId?: string;
|
|
121
|
+
/** Called after each navigation. */
|
|
122
|
+
onIndexChange?: (index: number, slide: SlideDeckSlide | undefined) => void;
|
|
123
|
+
/** Headless mode: render custom chrome using `<SlideDeck.X>` sub-components. */
|
|
124
|
+
children?: ReactNode;
|
|
125
|
+
/** Outer className for the deck root. */
|
|
126
|
+
className?: string;
|
|
127
|
+
/** Accessible label for the deck region. Defaults to "Slide deck". */
|
|
128
|
+
"aria-label"?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Rich-content plugins relayed to every inner `<Slide>` (D15 / RFC 0004).
|
|
131
|
+
* Pass MEMOIZED arrays to avoid re-parses on every render.
|
|
132
|
+
*/
|
|
133
|
+
plugins?: SlidePlugin[];
|
|
134
|
+
}
|
|
135
|
+
type SlideDeckComponent = FC<SlideDeckProps> & {
|
|
136
|
+
Slides: FC<{
|
|
137
|
+
className?: string;
|
|
138
|
+
}>;
|
|
139
|
+
Controls: typeof Controls;
|
|
140
|
+
ProgressBar: typeof ProgressBar;
|
|
141
|
+
SlideNumber: typeof SlideNumber;
|
|
142
|
+
Thumbnails: typeof Thumbnails;
|
|
143
|
+
PresenterView: typeof PresenterView;
|
|
144
|
+
PresenterButton: FC<{
|
|
145
|
+
className?: string;
|
|
146
|
+
}>;
|
|
147
|
+
FullscreenButton: FC<{
|
|
148
|
+
className?: string;
|
|
149
|
+
}>;
|
|
150
|
+
PrintButton: FC<{
|
|
151
|
+
className?: string;
|
|
152
|
+
}>;
|
|
153
|
+
};
|
|
154
|
+
declare const SlideDeck: SlideDeckComponent;
|
|
155
|
+
|
|
156
|
+
declare function splitDeck(markdown: string): Promise<SlideDeckSlide[]>;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Speaker notes extractor (ADR D11).
|
|
160
|
+
*
|
|
161
|
+
* Sintaxe: HTML comments `<!-- notes: ... -->` ou `<!-- note: ... -->`.
|
|
162
|
+
* Aceita ambos singular e plural. Texto interno é plain (sem markdown nesting
|
|
163
|
+
* em v0.4 — pode vir em v0.5).
|
|
164
|
+
*
|
|
165
|
+
* Returns the body with comments removed and the aggregated notes string.
|
|
166
|
+
*/
|
|
167
|
+
interface ExtractNotesResult {
|
|
168
|
+
body: string;
|
|
169
|
+
notes: string | undefined;
|
|
170
|
+
}
|
|
171
|
+
declare function extractNotes(md: string): ExtractNotesResult;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Progressive fragments detector (ADR D12).
|
|
175
|
+
*
|
|
176
|
+
* Marpit convention: lists with `*` (asterisco) marker — instead of `-` or `+`
|
|
177
|
+
* — become fragment-revealed lists. Each item is a step.
|
|
178
|
+
*
|
|
179
|
+
* Implementation: regex pre-pass on raw markdown counts top-of-line `* ` markers.
|
|
180
|
+
* Decision (EC-9): mixed `*` and `-` in the same list is rare; we count ONLY
|
|
181
|
+
* `* ` items as fragments. Plain `- item` lists remain non-fragmented.
|
|
182
|
+
*
|
|
183
|
+
* v0.4: counts only. CSS attribute application happens at render time inside
|
|
184
|
+
* `<SlideDeck.Slides>`, post-parse, by walking the rendered DOM.
|
|
185
|
+
*/
|
|
186
|
+
/**
|
|
187
|
+
* Count fragment markers in raw markdown.
|
|
188
|
+
*
|
|
189
|
+
* Detects only `*` at start of a line followed by space + non-whitespace.
|
|
190
|
+
* Avoids matching `**bold**`, `*italic*`, or `_ * _` patterns.
|
|
191
|
+
*/
|
|
192
|
+
declare function countFragmentsInMarkdown(markdown: string): number;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Deck state machine (ADR D5).
|
|
196
|
+
*
|
|
197
|
+
* Single useReducer governs all deck-level state transitions: currentIndex,
|
|
198
|
+
* currentFragment, presenterMode, fullscreen, transitionDirection.
|
|
199
|
+
*
|
|
200
|
+
* NEXT_SLIDE advances fragment first if `currentFragment < totalFragmentsInCurrent`,
|
|
201
|
+
* else advances slide. PREV_SLIDE mirrors. JUMP_TO clamps to valid range.
|
|
202
|
+
*
|
|
203
|
+
* ADR D17: lazy init reads hash via `initFromHash` callback when provided —
|
|
204
|
+
* SSR-safe (callback guards `typeof window !== "undefined"`).
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
interface DeckState {
|
|
208
|
+
currentIndex: number;
|
|
209
|
+
currentFragment: number;
|
|
210
|
+
presenterMode: boolean;
|
|
211
|
+
fullscreen: boolean;
|
|
212
|
+
transitionDirection: "none" | "next" | "prev";
|
|
213
|
+
totalSlides: number;
|
|
214
|
+
totalFragmentsInCurrent: number;
|
|
215
|
+
}
|
|
216
|
+
type DeckAction = {
|
|
217
|
+
type: "NEXT_SLIDE";
|
|
218
|
+
} | {
|
|
219
|
+
type: "PREV_SLIDE";
|
|
220
|
+
} | {
|
|
221
|
+
type: "JUMP_TO";
|
|
222
|
+
index: number;
|
|
223
|
+
} | {
|
|
224
|
+
type: "NEXT_FRAGMENT";
|
|
225
|
+
} | {
|
|
226
|
+
type: "PREV_FRAGMENT";
|
|
227
|
+
} | {
|
|
228
|
+
type: "RESET_FRAGMENTS";
|
|
229
|
+
} | {
|
|
230
|
+
type: "TOGGLE_PRESENTER";
|
|
231
|
+
} | {
|
|
232
|
+
type: "SET_FULLSCREEN";
|
|
233
|
+
value: boolean;
|
|
234
|
+
} | {
|
|
235
|
+
type: "UPDATE_TOTAL_SLIDES";
|
|
236
|
+
total: number;
|
|
237
|
+
} | {
|
|
238
|
+
type: "UPDATE_TOTAL_FRAGMENTS";
|
|
239
|
+
total: number;
|
|
240
|
+
} | {
|
|
241
|
+
type: "TRANSITION_END";
|
|
242
|
+
};
|
|
243
|
+
declare function deckReducer(state: DeckState, action: DeckAction): DeckState;
|
|
244
|
+
interface UseDeckStateOptions {
|
|
245
|
+
initialIndex?: number;
|
|
246
|
+
totalSlides: number;
|
|
247
|
+
/** Lazy initializer hook (D17): returns initial index, e.g. parsing hash. */
|
|
248
|
+
initFromHash?: () => number | undefined;
|
|
249
|
+
}
|
|
250
|
+
declare function useDeckState(opts: UseDeckStateOptions): readonly [DeckState, Dispatch<DeckAction>];
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Hash routing hook (ADR D13).
|
|
254
|
+
*
|
|
255
|
+
* Pattern `#/N` (1-based). Bidirectional sync:
|
|
256
|
+
* - Initial state: read via `useDeckState`'s lazy `initFromHash` (D17 SSR-safe).
|
|
257
|
+
* - hashchange event → JUMP_TO.
|
|
258
|
+
* - currentIndex change → `history.replaceState` (does NOT trigger hashchange,
|
|
259
|
+
* so no infinite loop — verified in test EC-10).
|
|
260
|
+
*/
|
|
261
|
+
|
|
262
|
+
interface UseDeckHashRoutingOptions {
|
|
263
|
+
enabled?: boolean;
|
|
264
|
+
totalSlides: number;
|
|
265
|
+
currentIndex: number;
|
|
266
|
+
}
|
|
267
|
+
/** Read hash → return 0-based index, or undefined if not present/invalid. */
|
|
268
|
+
declare function readHashIndex(hash: string): number | undefined;
|
|
269
|
+
/** SSR-safe wrapper for initial hash read (D17). */
|
|
270
|
+
declare function readInitialHash(): number | undefined;
|
|
271
|
+
/** Format index → hash string. */
|
|
272
|
+
declare function formatHash(zeroBasedIndex: number): string;
|
|
273
|
+
declare function useDeckHashRouting(dispatch: Dispatch<DeckAction>, opts: UseDeckHashRoutingOptions): void;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Keyboard navigation hook (ADR D9).
|
|
277
|
+
*
|
|
278
|
+
* Hardcoded bindings (no remap in v0.4):
|
|
279
|
+
* ArrowRight, Space, PageDown → NEXT_SLIDE
|
|
280
|
+
* ArrowLeft, PageUp → PREV_SLIDE
|
|
281
|
+
* Home → JUMP_TO 0
|
|
282
|
+
* End → JUMP_TO last
|
|
283
|
+
* Escape → SET_FULLSCREEN false
|
|
284
|
+
* f / F → toggleFullscreen callback
|
|
285
|
+
* n / N / p / P → TOGGLE_PRESENTER
|
|
286
|
+
* Ctrl+P / Meta+P → onPrint callback (preventDefault)
|
|
287
|
+
*
|
|
288
|
+
* Guards: ignora events quando target é INPUT, TEXTAREA, ou contentEditable
|
|
289
|
+
* (consumer pode ter inputs em modais sem conflito).
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
interface UseDeckKeyboardOptions {
|
|
293
|
+
enabled?: boolean;
|
|
294
|
+
totalSlides: number;
|
|
295
|
+
onToggleFullscreen?: () => void;
|
|
296
|
+
onPrint?: () => void;
|
|
297
|
+
}
|
|
298
|
+
declare function useDeckKeyboard(dispatch: Dispatch<DeckAction>, opts: UseDeckKeyboardOptions): void;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Touch swipe hook (ADR D10).
|
|
302
|
+
*
|
|
303
|
+
* Detecta swipe horizontal via Pointer Events nativos:
|
|
304
|
+
* - threshold: 50px de deslocamento
|
|
305
|
+
* - velocity: > 0.3 px/ms
|
|
306
|
+
* - direction guard: |dx| > 2*|dy| (bloqueia swipe vertical / scroll)
|
|
307
|
+
*
|
|
308
|
+
* Swipe left (dx < 0) → NEXT_SLIDE
|
|
309
|
+
* Swipe right (dx > 0) → PREV_SLIDE
|
|
310
|
+
*
|
|
311
|
+
* EC-6: pointercancel limpa o tracking state (mobile browser pode cancelar mid-swipe).
|
|
312
|
+
* EC-7: tracking limita ao primeiro pointerId (multi-touch é ignorado).
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
interface UseDeckSwipeOptions {
|
|
316
|
+
enabled?: boolean;
|
|
317
|
+
}
|
|
318
|
+
declare function useDeckSwipe(ref: RefObject<HTMLElement | null>, dispatch: Dispatch<DeckAction>, opts?: UseDeckSwipeOptions): void;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Cross-browser fullscreen hook (ADR D6 area / EC-8).
|
|
322
|
+
*
|
|
323
|
+
* Wraps `Element.requestFullscreen()` + Safari `webkit*` prefix. Listens
|
|
324
|
+
* `fullscreenchange` (+ webkit) to sync state when user presses Esc via the
|
|
325
|
+
* native UI.
|
|
326
|
+
*
|
|
327
|
+
* EC-8: iOS Safari < 16 doesn't expose fullscreen on arbitrary elements (only
|
|
328
|
+
* `<video>`). Feature-detect — when unavailable, hook is a no-op and `toggle`
|
|
329
|
+
* is safe to call.
|
|
330
|
+
*/
|
|
331
|
+
|
|
332
|
+
interface UseFullscreenResult {
|
|
333
|
+
isFullscreen: boolean;
|
|
334
|
+
toggle: () => Promise<void>;
|
|
335
|
+
isSupported: boolean;
|
|
336
|
+
}
|
|
337
|
+
declare function useFullscreen(ref: RefObject<HTMLElement | null>): UseFullscreenResult;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Print CSS injection (ADR D7).
|
|
341
|
+
*
|
|
342
|
+
* Injects a `<style id="theo-slide-deck-print">` element into the document
|
|
343
|
+
* head with `@page` + `@media print` rules that render `.theo-slide-deck-print-container`
|
|
344
|
+
* with one slide per page. Calls `window.print()`. Removes the style on the
|
|
345
|
+
* `afterprint` event (cleanup runs regardless of print cancel/complete).
|
|
346
|
+
*/
|
|
347
|
+
declare function injectPrintStyles(): HTMLStyleElement;
|
|
348
|
+
declare function removePrintStyles(): void;
|
|
349
|
+
interface PrintDeckOptions {
|
|
350
|
+
/** Optional callback fired after print dialog closes (success or cancel). */
|
|
351
|
+
onAfterPrint?: () => void;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Trigger native print dialog with deck-specific CSS injected.
|
|
355
|
+
*
|
|
356
|
+
* The `afterprint` event listener is cleaned up automatically. Idempotent —
|
|
357
|
+
* calling twice in quick succession is safe (style is reused).
|
|
358
|
+
*/
|
|
359
|
+
declare function printDeck(opts?: PrintDeckOptions): void;
|
|
360
|
+
|
|
361
|
+
interface DeckContextValue {
|
|
362
|
+
state: DeckState;
|
|
363
|
+
dispatch: Dispatch<DeckAction>;
|
|
364
|
+
slides: SlideDeckSlide[];
|
|
365
|
+
transition: SlideDeckTransition;
|
|
366
|
+
deckId: string;
|
|
367
|
+
/** Rich-content plugins relayed to every inner `<Slide>` (D15). */
|
|
368
|
+
plugins?: SlidePlugin[];
|
|
369
|
+
/** Toggle browser fullscreen on the deck root. Safe to call when unsupported. */
|
|
370
|
+
toggleFullscreen: () => void | Promise<void>;
|
|
371
|
+
/** Trigger native print dialog with deck-specific @page CSS. */
|
|
372
|
+
print: () => void;
|
|
373
|
+
}
|
|
374
|
+
declare const DeckContext: react.Context<DeckContextValue | null>;
|
|
375
|
+
declare function useDeckContext(): DeckContextValue;
|
|
376
|
+
|
|
377
|
+
export { Controls, type DeckAction, DeckContext, type DeckContextValue, type DeckState, PresenterView, ProgressBar, SlideDeck, type SlideDeckInput, type SlideDeckProps, type SlideDeckSlide, type SlideDeckTransition, SlideNumber, Thumbnails, countFragmentsInMarkdown, deckReducer, extractNotes, formatHash, injectPrintStyles, printDeck, readHashIndex, readInitialHash, removePrintStyles, slideDeckInput, slideDeckSlide, slideDeckTransition, splitDeck, useDeckContext, useDeckHashRouting, useDeckKeyboard, useDeckState, useDeckSwipe, useFullscreen };
|