@particle-academy/fancy-slides 0.4.0 → 0.5.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/README.md +9 -0
- package/dist/index.cjs +200 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -68
- package/dist/index.d.ts +109 -68
- package/dist/index.js +199 -116
- package/dist/index.js.map +1 -1
- package/dist/registry.d.cts +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/{types-P-9MmnGU.d.cts → types-9BbelJX1.d.cts} +10 -0
- package/dist/{types-P-9MmnGU.d.ts → types-9BbelJX1.d.ts} +10 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isDarkColor, SlideContext } from './chunk-WIUXPQAK.js';
|
|
2
2
|
export { useIsDarkSlide, useSlideContext, useSlideTheme } from './chunk-WIUXPQAK.js';
|
|
3
3
|
import { useId, useRef, useState, useEffect, useMemo, useCallback } from 'react';
|
|
4
|
-
import { ContentRenderer, Text, Action, ContextMenu, Separator, Tooltip, Dropdown, Badge, Heading, Tabs, Card, Select, Input, ColorPicker, Slider, Textarea } from '@particle-academy/react-fancy';
|
|
4
|
+
import { ContentRenderer, Text, Action, ContextMenu, Separator, Tooltip, Dropdown, Badge, Heading, Tabs, Card, Select, Input, ColorPicker, Slider, Switch, Textarea } from '@particle-academy/react-fancy';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
// src/theme/default-theme.ts
|
|
@@ -72,6 +72,15 @@ function cn(...parts) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/utils/builds.ts
|
|
75
|
+
function splitParagraphs(content) {
|
|
76
|
+
const lines = content.split("\n");
|
|
77
|
+
if (lines.length > 1 && lines[lines.length - 1] === "") lines.pop();
|
|
78
|
+
return lines;
|
|
79
|
+
}
|
|
80
|
+
function isByParagraph(element, animation) {
|
|
81
|
+
if (!animation.byParagraph || element.type !== "text") return false;
|
|
82
|
+
return splitParagraphs(element.content).length > 1;
|
|
83
|
+
}
|
|
75
84
|
var DEFAULT_BUILD_DURATION = 500;
|
|
76
85
|
function collectBuilds(slide) {
|
|
77
86
|
if (!slide) return [];
|
|
@@ -81,12 +90,25 @@ function collectBuilds(slide) {
|
|
|
81
90
|
builds.push({ element, animation: element.animation, index });
|
|
82
91
|
}
|
|
83
92
|
});
|
|
84
|
-
|
|
93
|
+
const ordered = builds.sort((a, b) => {
|
|
85
94
|
const ao = a.animation.order ?? 0;
|
|
86
95
|
const bo = b.animation.order ?? 0;
|
|
87
96
|
if (ao !== bo) return ao - bo;
|
|
88
97
|
return a.index - b.index;
|
|
89
98
|
});
|
|
99
|
+
const expanded = [];
|
|
100
|
+
for (const build of ordered) {
|
|
101
|
+
if (isByParagraph(build.element, build.animation)) {
|
|
102
|
+
const paras = splitParagraphs(build.element.content);
|
|
103
|
+
paras.forEach((_, paraIndex) => {
|
|
104
|
+
const animation = paraIndex === 0 ? build.animation : { ...build.animation, trigger: "on-click" };
|
|
105
|
+
expanded.push({ element: build.element, animation, index: build.index, paraIndex });
|
|
106
|
+
});
|
|
107
|
+
} else {
|
|
108
|
+
expanded.push(build);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return expanded;
|
|
90
112
|
}
|
|
91
113
|
function buildSteps(slide) {
|
|
92
114
|
const builds = collectBuilds(slide);
|
|
@@ -110,7 +132,9 @@ function visibleElementIds(slide, buildStep) {
|
|
|
110
132
|
const steps = buildSteps(slide);
|
|
111
133
|
const stepOfElement = /* @__PURE__ */ new Map();
|
|
112
134
|
steps.forEach((step, i) => {
|
|
113
|
-
for (const b of step.builds)
|
|
135
|
+
for (const b of step.builds) {
|
|
136
|
+
if (!stepOfElement.has(b.element.id)) stepOfElement.set(b.element.id, i + 1);
|
|
137
|
+
}
|
|
114
138
|
});
|
|
115
139
|
for (const element of slide.elements) {
|
|
116
140
|
const revealStep = stepOfElement.get(element.id);
|
|
@@ -122,6 +146,25 @@ function visibleElementIds(slide, buildStep) {
|
|
|
122
146
|
}
|
|
123
147
|
return visible;
|
|
124
148
|
}
|
|
149
|
+
function paragraphReveals(slide, buildStep) {
|
|
150
|
+
const out = /* @__PURE__ */ new Map();
|
|
151
|
+
if (!slide) return out;
|
|
152
|
+
const steps = buildSteps(slide);
|
|
153
|
+
steps.forEach((step, i) => {
|
|
154
|
+
const stepNum = i + 1;
|
|
155
|
+
for (const b of step.builds) {
|
|
156
|
+
if (b.paraIndex === void 0) continue;
|
|
157
|
+
const fired = buildStep >= stepNum;
|
|
158
|
+
const prev = out.get(b.element.id) ?? { revealed: 0 };
|
|
159
|
+
if (fired) {
|
|
160
|
+
prev.revealed = Math.max(prev.revealed, b.paraIndex + 1);
|
|
161
|
+
if (stepNum === buildStep) prev.firingParaIndex = b.paraIndex;
|
|
162
|
+
}
|
|
163
|
+
out.set(b.element.id, prev);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
return out;
|
|
167
|
+
}
|
|
125
168
|
function buildsForStep(slide, buildStep) {
|
|
126
169
|
const steps = buildSteps(slide);
|
|
127
170
|
const step = steps[buildStep - 1];
|
|
@@ -143,13 +186,95 @@ function stepDelays(builds) {
|
|
|
143
186
|
}
|
|
144
187
|
return delays;
|
|
145
188
|
}
|
|
189
|
+
|
|
190
|
+
// src/components/Slide/builds-style.ts
|
|
191
|
+
var DEFAULT_BUILD_DURATION2 = 500;
|
|
192
|
+
var EASE = "cubic-bezier(0.16, 1, 0.3, 1)";
|
|
193
|
+
function buildEnterStyle(animation, effectiveDelay) {
|
|
194
|
+
const duration = animation.duration ?? DEFAULT_BUILD_DURATION2;
|
|
195
|
+
const dir = animation.direction ?? "left";
|
|
196
|
+
let name;
|
|
197
|
+
switch (animation.effect) {
|
|
198
|
+
case "fade":
|
|
199
|
+
name = "fs-build-fade";
|
|
200
|
+
break;
|
|
201
|
+
case "zoom":
|
|
202
|
+
name = "fs-build-zoom";
|
|
203
|
+
break;
|
|
204
|
+
case "fly-in":
|
|
205
|
+
name = `fs-build-fly-${dir}`;
|
|
206
|
+
break;
|
|
207
|
+
case "wipe":
|
|
208
|
+
name = `fs-build-wipe-${dir}`;
|
|
209
|
+
break;
|
|
210
|
+
default:
|
|
211
|
+
name = "fs-build-fade";
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
animationName: name,
|
|
215
|
+
animationDuration: `${duration}ms`,
|
|
216
|
+
animationDelay: `${effectiveDelay}ms`,
|
|
217
|
+
animationTimingFunction: EASE,
|
|
218
|
+
animationFillMode: "both"
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
var BUILD_KEYFRAMES = `
|
|
222
|
+
@media (prefers-reduced-motion: reduce) {
|
|
223
|
+
.fs-build-enter { animation: none !important; }
|
|
224
|
+
}
|
|
225
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
226
|
+
@keyframes fs-build-fade {
|
|
227
|
+
from { opacity: 0; }
|
|
228
|
+
to { opacity: 1; }
|
|
229
|
+
}
|
|
230
|
+
@keyframes fs-build-zoom {
|
|
231
|
+
from { opacity: 0; transform: scale(0.8); }
|
|
232
|
+
to { opacity: 1; transform: scale(1); }
|
|
233
|
+
}
|
|
234
|
+
@keyframes fs-build-fly-left {
|
|
235
|
+
from { opacity: 0; transform: translateX(-24%); }
|
|
236
|
+
to { opacity: 1; transform: translateX(0); }
|
|
237
|
+
}
|
|
238
|
+
@keyframes fs-build-fly-right {
|
|
239
|
+
from { opacity: 0; transform: translateX(24%); }
|
|
240
|
+
to { opacity: 1; transform: translateX(0); }
|
|
241
|
+
}
|
|
242
|
+
@keyframes fs-build-fly-up {
|
|
243
|
+
from { opacity: 0; transform: translateY(24%); }
|
|
244
|
+
to { opacity: 1; transform: translateY(0); }
|
|
245
|
+
}
|
|
246
|
+
@keyframes fs-build-fly-down {
|
|
247
|
+
from { opacity: 0; transform: translateY(-24%); }
|
|
248
|
+
to { opacity: 1; transform: translateY(0); }
|
|
249
|
+
}
|
|
250
|
+
/* wipe: clip-path inset reveals from the named edge toward the opposite one.
|
|
251
|
+
inset(top right bottom left) \u2014 start fully clipped on the far side. */
|
|
252
|
+
@keyframes fs-build-wipe-left {
|
|
253
|
+
from { clip-path: inset(0 100% 0 0); }
|
|
254
|
+
to { clip-path: inset(0 0 0 0); }
|
|
255
|
+
}
|
|
256
|
+
@keyframes fs-build-wipe-right {
|
|
257
|
+
from { clip-path: inset(0 0 0 100%); }
|
|
258
|
+
to { clip-path: inset(0 0 0 0); }
|
|
259
|
+
}
|
|
260
|
+
@keyframes fs-build-wipe-up {
|
|
261
|
+
from { clip-path: inset(100% 0 0 0); }
|
|
262
|
+
to { clip-path: inset(0 0 0 0); }
|
|
263
|
+
}
|
|
264
|
+
@keyframes fs-build-wipe-down {
|
|
265
|
+
from { clip-path: inset(0 0 100% 0); }
|
|
266
|
+
to { clip-path: inset(0 0 0 0); }
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
`;
|
|
146
270
|
function TextElementRenderer({
|
|
147
271
|
element,
|
|
148
272
|
theme,
|
|
149
273
|
slideWidthPx,
|
|
150
274
|
editing = false,
|
|
151
275
|
selected = false,
|
|
152
|
-
onContentChange
|
|
276
|
+
onContentChange,
|
|
277
|
+
paraReveal
|
|
153
278
|
}) {
|
|
154
279
|
const t = resolveTheme(theme);
|
|
155
280
|
const style = element.style ?? {};
|
|
@@ -196,30 +321,53 @@ function TextElementRenderer({
|
|
|
196
321
|
}
|
|
197
322
|
);
|
|
198
323
|
}
|
|
324
|
+
const proseScope = `[data-fs-text-scope="${scopeId}"]`;
|
|
325
|
+
const doubleScope = `${proseScope}${proseScope}`;
|
|
326
|
+
const proseStyle = /* @__PURE__ */ jsx("style", { children: `
|
|
327
|
+
${proseScope} > div { width: 100%; height: 100%; font-size: inherit; }
|
|
328
|
+
${doubleScope} :is(p, ul, ol, li, blockquote, h1, h2, h3, h4, h5, h6, pre, code, strong, em, a) {
|
|
329
|
+
font-size: inherit;
|
|
330
|
+
}
|
|
331
|
+
${doubleScope} h1 { font-size: 1.6em; font-weight: 700; }
|
|
332
|
+
${doubleScope} h2 { font-size: 1.35em; font-weight: 700; }
|
|
333
|
+
${doubleScope} h3 { font-size: 1.15em; font-weight: 600; }
|
|
334
|
+
${proseScope} :where(p, ul, ol, h1, h2, h3, h4, h5, h6, pre, blockquote) {
|
|
335
|
+
margin: 0;
|
|
336
|
+
padding: 0;
|
|
337
|
+
}
|
|
338
|
+
${proseScope} :where(p, li) + :where(p, li, ul, ol) { margin-top: 0.4em; }
|
|
339
|
+
${proseScope} :where(ul, ol) { padding-left: 1.4em; }
|
|
340
|
+
${proseScope} :where(strong) { font-weight: ${Math.max(700, weight(style.weight) ?? 400 + 200)}; }
|
|
341
|
+
${proseScope} :where(a) { color: inherit; text-decoration: underline; }
|
|
342
|
+
${proseScope} :where(code) { font-family: ${t.fonts?.mono ?? "monospace"}; }
|
|
343
|
+
` });
|
|
344
|
+
const renderChunk = (content) => format === "plain" ? content : /* @__PURE__ */ jsx(ContentRenderer, { value: content, format: format === "html" ? "html" : "markdown" });
|
|
345
|
+
if (paraReveal) {
|
|
346
|
+
const paras = splitParagraphs(element.content);
|
|
347
|
+
return /* @__PURE__ */ jsxs("div", { "data-fs-text-scope": scopeId, style: css, children: [
|
|
348
|
+
proseStyle,
|
|
349
|
+
paras.map((para, i) => {
|
|
350
|
+
if (i >= paraReveal.revealed) return null;
|
|
351
|
+
const firing = i === paraReveal.firingParaIndex && !!element.animation;
|
|
352
|
+
const enter = firing ? buildEnterStyle(element.animation, element.animation.delay ?? 0) : null;
|
|
353
|
+
return /* @__PURE__ */ jsx(
|
|
354
|
+
"div",
|
|
355
|
+
{
|
|
356
|
+
className: firing ? "fs-build-enter" : void 0,
|
|
357
|
+
style: { whiteSpace: format === "plain" ? "pre-wrap" : "normal", ...enter },
|
|
358
|
+
"data-fancy-slides-paragraph": i,
|
|
359
|
+
children: renderChunk(para)
|
|
360
|
+
},
|
|
361
|
+
i
|
|
362
|
+
);
|
|
363
|
+
})
|
|
364
|
+
] });
|
|
365
|
+
}
|
|
199
366
|
if (format === "plain") {
|
|
200
367
|
return /* @__PURE__ */ jsx("div", { style: css, children: element.content });
|
|
201
368
|
}
|
|
202
|
-
const proseScope = `[data-fs-text-scope="${scopeId}"]`;
|
|
203
|
-
const doubleScope = `${proseScope}${proseScope}`;
|
|
204
369
|
return /* @__PURE__ */ jsxs("div", { "data-fs-text-scope": scopeId, style: css, children: [
|
|
205
|
-
|
|
206
|
-
${proseScope} > div { width: 100%; height: 100%; font-size: inherit; }
|
|
207
|
-
${doubleScope} :is(p, ul, ol, li, blockquote, h1, h2, h3, h4, h5, h6, pre, code, strong, em, a) {
|
|
208
|
-
font-size: inherit;
|
|
209
|
-
}
|
|
210
|
-
${doubleScope} h1 { font-size: 1.6em; font-weight: 700; }
|
|
211
|
-
${doubleScope} h2 { font-size: 1.35em; font-weight: 700; }
|
|
212
|
-
${doubleScope} h3 { font-size: 1.15em; font-weight: 600; }
|
|
213
|
-
${proseScope} :where(p, ul, ol, h1, h2, h3, h4, h5, h6, pre, blockquote) {
|
|
214
|
-
margin: 0;
|
|
215
|
-
padding: 0;
|
|
216
|
-
}
|
|
217
|
-
${proseScope} :where(p, li) + :where(p, li, ul, ol) { margin-top: 0.4em; }
|
|
218
|
-
${proseScope} :where(ul, ol) { padding-left: 1.4em; }
|
|
219
|
-
${proseScope} :where(strong) { font-weight: ${Math.max(700, weight(style.weight) ?? 400 + 200)}; }
|
|
220
|
-
${proseScope} :where(a) { color: inherit; text-decoration: underline; }
|
|
221
|
-
${proseScope} :where(code) { font-family: ${t.fonts?.mono ?? "monospace"}; }
|
|
222
|
-
` }),
|
|
370
|
+
proseStyle,
|
|
223
371
|
/* @__PURE__ */ jsx(ContentRenderer, { value: element.content, format: format === "html" ? "html" : "markdown" })
|
|
224
372
|
] });
|
|
225
373
|
}
|
|
@@ -311,87 +459,6 @@ function renderShape(el, s) {
|
|
|
311
459
|
return null;
|
|
312
460
|
}
|
|
313
461
|
}
|
|
314
|
-
|
|
315
|
-
// src/components/Slide/builds-style.ts
|
|
316
|
-
var DEFAULT_BUILD_DURATION2 = 500;
|
|
317
|
-
var EASE = "cubic-bezier(0.16, 1, 0.3, 1)";
|
|
318
|
-
function buildEnterStyle(animation, effectiveDelay) {
|
|
319
|
-
const duration = animation.duration ?? DEFAULT_BUILD_DURATION2;
|
|
320
|
-
const dir = animation.direction ?? "left";
|
|
321
|
-
let name;
|
|
322
|
-
switch (animation.effect) {
|
|
323
|
-
case "fade":
|
|
324
|
-
name = "fs-build-fade";
|
|
325
|
-
break;
|
|
326
|
-
case "zoom":
|
|
327
|
-
name = "fs-build-zoom";
|
|
328
|
-
break;
|
|
329
|
-
case "fly-in":
|
|
330
|
-
name = `fs-build-fly-${dir}`;
|
|
331
|
-
break;
|
|
332
|
-
case "wipe":
|
|
333
|
-
name = `fs-build-wipe-${dir}`;
|
|
334
|
-
break;
|
|
335
|
-
default:
|
|
336
|
-
name = "fs-build-fade";
|
|
337
|
-
}
|
|
338
|
-
return {
|
|
339
|
-
animationName: name,
|
|
340
|
-
animationDuration: `${duration}ms`,
|
|
341
|
-
animationDelay: `${effectiveDelay}ms`,
|
|
342
|
-
animationTimingFunction: EASE,
|
|
343
|
-
animationFillMode: "both"
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
var BUILD_KEYFRAMES = `
|
|
347
|
-
@media (prefers-reduced-motion: reduce) {
|
|
348
|
-
.fs-build-enter { animation: none !important; }
|
|
349
|
-
}
|
|
350
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
351
|
-
@keyframes fs-build-fade {
|
|
352
|
-
from { opacity: 0; }
|
|
353
|
-
to { opacity: 1; }
|
|
354
|
-
}
|
|
355
|
-
@keyframes fs-build-zoom {
|
|
356
|
-
from { opacity: 0; transform: scale(0.8); }
|
|
357
|
-
to { opacity: 1; transform: scale(1); }
|
|
358
|
-
}
|
|
359
|
-
@keyframes fs-build-fly-left {
|
|
360
|
-
from { opacity: 0; transform: translateX(-24%); }
|
|
361
|
-
to { opacity: 1; transform: translateX(0); }
|
|
362
|
-
}
|
|
363
|
-
@keyframes fs-build-fly-right {
|
|
364
|
-
from { opacity: 0; transform: translateX(24%); }
|
|
365
|
-
to { opacity: 1; transform: translateX(0); }
|
|
366
|
-
}
|
|
367
|
-
@keyframes fs-build-fly-up {
|
|
368
|
-
from { opacity: 0; transform: translateY(24%); }
|
|
369
|
-
to { opacity: 1; transform: translateY(0); }
|
|
370
|
-
}
|
|
371
|
-
@keyframes fs-build-fly-down {
|
|
372
|
-
from { opacity: 0; transform: translateY(-24%); }
|
|
373
|
-
to { opacity: 1; transform: translateY(0); }
|
|
374
|
-
}
|
|
375
|
-
/* wipe: clip-path inset reveals from the named edge toward the opposite one.
|
|
376
|
-
inset(top right bottom left) \u2014 start fully clipped on the far side. */
|
|
377
|
-
@keyframes fs-build-wipe-left {
|
|
378
|
-
from { clip-path: inset(0 100% 0 0); }
|
|
379
|
-
to { clip-path: inset(0 0 0 0); }
|
|
380
|
-
}
|
|
381
|
-
@keyframes fs-build-wipe-right {
|
|
382
|
-
from { clip-path: inset(0 0 0 100%); }
|
|
383
|
-
to { clip-path: inset(0 0 0 0); }
|
|
384
|
-
}
|
|
385
|
-
@keyframes fs-build-wipe-up {
|
|
386
|
-
from { clip-path: inset(100% 0 0 0); }
|
|
387
|
-
to { clip-path: inset(0 0 0 0); }
|
|
388
|
-
}
|
|
389
|
-
@keyframes fs-build-wipe-down {
|
|
390
|
-
from { clip-path: inset(0 0 100% 0); }
|
|
391
|
-
to { clip-path: inset(0 0 0 0); }
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
`;
|
|
395
462
|
function Slide({
|
|
396
463
|
slide,
|
|
397
464
|
theme,
|
|
@@ -448,13 +515,16 @@ function Slide({
|
|
|
448
515
|
if (steps.length === 0) return null;
|
|
449
516
|
const revealStep = /* @__PURE__ */ new Map();
|
|
450
517
|
steps.forEach((step, i) => {
|
|
451
|
-
for (const b of step.builds)
|
|
518
|
+
for (const b of step.builds) {
|
|
519
|
+
if (!revealStep.has(b.element.id)) revealStep.set(b.element.id, i + 1);
|
|
520
|
+
}
|
|
452
521
|
});
|
|
453
522
|
const driven = buildStep !== void 0;
|
|
454
523
|
const currentStep = driven ? buildStep : steps.length;
|
|
455
524
|
const firing = driven ? steps[currentStep - 1] : void 0;
|
|
456
525
|
const delays = firing ? stepDelays(firing.builds) : /* @__PURE__ */ new Map();
|
|
457
|
-
|
|
526
|
+
const paraReveals = driven ? paragraphReveals(slide, currentStep) : /* @__PURE__ */ new Map();
|
|
527
|
+
return { revealStep, currentStep, delays, paraReveals, driven };
|
|
458
528
|
}, [editing, slide, buildStep]);
|
|
459
529
|
return /* @__PURE__ */ jsx(SlideContext.Provider, { value: slideContext, children: /* @__PURE__ */ jsxs(
|
|
460
530
|
"div",
|
|
@@ -480,12 +550,13 @@ function Slide({
|
|
|
480
550
|
let buildHidden = false;
|
|
481
551
|
let buildAnimation;
|
|
482
552
|
let buildDelay = 0;
|
|
553
|
+
const paraReveal = buildInfo?.paraReveals.get(element.id);
|
|
483
554
|
if (buildInfo) {
|
|
484
555
|
const step = buildInfo.revealStep.get(element.id);
|
|
485
556
|
if (step !== void 0) {
|
|
486
557
|
if (buildInfo.currentStep < step) {
|
|
487
558
|
buildHidden = true;
|
|
488
|
-
} else if (buildInfo.currentStep === step && element.animation) {
|
|
559
|
+
} else if (paraReveal) ; else if (buildInfo.currentStep === step && element.animation) {
|
|
489
560
|
buildAnimation = element.animation;
|
|
490
561
|
buildDelay = buildInfo.delays.get(element.id) ?? 0;
|
|
491
562
|
}
|
|
@@ -507,7 +578,8 @@ function Slide({
|
|
|
507
578
|
onResize: onElementResize,
|
|
508
579
|
renderElement,
|
|
509
580
|
buildAnimation,
|
|
510
|
-
buildDelay
|
|
581
|
+
buildDelay,
|
|
582
|
+
paraReveal
|
|
511
583
|
},
|
|
512
584
|
element.id
|
|
513
585
|
);
|
|
@@ -531,7 +603,8 @@ function SlideElementHost({
|
|
|
531
603
|
onResize,
|
|
532
604
|
renderElement,
|
|
533
605
|
buildAnimation,
|
|
534
|
-
buildDelay = 0
|
|
606
|
+
buildDelay = 0,
|
|
607
|
+
paraReveal
|
|
535
608
|
}) {
|
|
536
609
|
const dragRef = useRef(null);
|
|
537
610
|
if (element.hidden) return null;
|
|
@@ -603,7 +676,7 @@ function SlideElementHost({
|
|
|
603
676
|
touchAction: canMove ? "none" : void 0,
|
|
604
677
|
...buildAnimation ? buildEnterStyle(buildAnimation, buildDelay) : null
|
|
605
678
|
};
|
|
606
|
-
const inner = renderInner({ element, theme, slideWidthPx, editing, selected, onContentChange }) ?? renderElement?.(element, slideWidthPx);
|
|
679
|
+
const inner = renderInner({ element, theme, slideWidthPx, editing, selected, onContentChange, paraReveal }) ?? renderElement?.(element, slideWidthPx);
|
|
607
680
|
return /* @__PURE__ */ jsxs(
|
|
608
681
|
"div",
|
|
609
682
|
{
|
|
@@ -670,7 +743,7 @@ function ResizeHandles({ onStart, onMove, onEnd }) {
|
|
|
670
743
|
anchor
|
|
671
744
|
)) });
|
|
672
745
|
}
|
|
673
|
-
function renderInner({ element, theme, slideWidthPx, editing, selected, onContentChange }) {
|
|
746
|
+
function renderInner({ element, theme, slideWidthPx, editing, selected, onContentChange, paraReveal }) {
|
|
674
747
|
switch (element.type) {
|
|
675
748
|
case "text":
|
|
676
749
|
return /* @__PURE__ */ jsx(
|
|
@@ -681,7 +754,8 @@ function renderInner({ element, theme, slideWidthPx, editing, selected, onConten
|
|
|
681
754
|
slideWidthPx,
|
|
682
755
|
editing,
|
|
683
756
|
selected,
|
|
684
|
-
onContentChange: onContentChange ? (c) => onContentChange(element.id, c) : void 0
|
|
757
|
+
onContentChange: onContentChange ? (c) => onContentChange(element.id, c) : void 0,
|
|
758
|
+
paraReveal
|
|
685
759
|
}
|
|
686
760
|
);
|
|
687
761
|
case "image":
|
|
@@ -1855,7 +1929,7 @@ function ElementInspector({ element, onPatch, onDelete, onLockToggle, slide, onS
|
|
|
1855
1929
|
] }),
|
|
1856
1930
|
/* @__PURE__ */ jsxs(Tabs.Panels, { children: [
|
|
1857
1931
|
/* @__PURE__ */ jsx(Tabs.Panel, { value: "style", children: /* @__PURE__ */ jsx(Card, { padding: "md", className: "!bg-white dark:!bg-zinc-950", children: /* @__PURE__ */ jsx(StyleSection, { element, onPatch }) }) }),
|
|
1858
|
-
/* @__PURE__ */ jsx(Tabs.Panel, { value: "build", children: /* @__PURE__ */ jsx(Card, { padding: "md", className: "!bg-white dark:!bg-zinc-950", children: /* @__PURE__ */ jsx(AnimateSection, { animation: element.animation, onSetAnimation }) }) }),
|
|
1932
|
+
/* @__PURE__ */ jsx(Tabs.Panel, { value: "build", children: /* @__PURE__ */ jsx(Card, { padding: "md", className: "!bg-white dark:!bg-zinc-950", children: /* @__PURE__ */ jsx(AnimateSection, { animation: element.animation, onSetAnimation, isText: element.type === "text" }) }) }),
|
|
1859
1933
|
/* @__PURE__ */ jsx(Tabs.Panel, { value: "layout", children: /* @__PURE__ */ jsx(Card, { padding: "md", className: "!bg-white dark:!bg-zinc-950", children: /* @__PURE__ */ jsx(LayoutSection, { element, onPatch }) }) }),
|
|
1860
1934
|
/* @__PURE__ */ jsx(Tabs.Panel, { value: "advanced", children: /* @__PURE__ */ jsx(Card, { padding: "md", className: "!bg-white dark:!bg-zinc-950", children: /* @__PURE__ */ jsx(AdvancedSection, { element, onPatch }) }) })
|
|
1861
1935
|
] })
|
|
@@ -2005,7 +2079,8 @@ function AdvancedSection({ element, onPatch }) {
|
|
|
2005
2079
|
var NO_ANIMATION = "none";
|
|
2006
2080
|
function AnimateSection({
|
|
2007
2081
|
animation,
|
|
2008
|
-
onSetAnimation
|
|
2082
|
+
onSetAnimation,
|
|
2083
|
+
isText
|
|
2009
2084
|
}) {
|
|
2010
2085
|
if (!onSetAnimation) {
|
|
2011
2086
|
return /* @__PURE__ */ jsx(Text, { size: "sm", className: "!text-zinc-500", children: "Build animations aren't wired up in this editor." });
|
|
@@ -2092,6 +2167,14 @@ function AnimateSection({
|
|
|
2092
2167
|
onChange: (e) => set({ order: parseInt(e.target.value, 10) || 0 })
|
|
2093
2168
|
}
|
|
2094
2169
|
),
|
|
2170
|
+
isText && /* @__PURE__ */ jsx(
|
|
2171
|
+
Switch,
|
|
2172
|
+
{
|
|
2173
|
+
label: "Animate by paragraph (one line per click)",
|
|
2174
|
+
checked: !!animation?.byParagraph,
|
|
2175
|
+
onCheckedChange: (v) => set({ byParagraph: v })
|
|
2176
|
+
}
|
|
2177
|
+
),
|
|
2095
2178
|
/* @__PURE__ */ jsx(Text, { size: "xs", className: "!text-zinc-500", children: `Builds reveal in ascending order. "On click" starts a new step; "with previous" plays alongside the step's lead; "after previous" follows it. Honors prefers-reduced-motion.` })
|
|
2096
2179
|
] })
|
|
2097
2180
|
] });
|
|
@@ -2783,6 +2866,6 @@ function DeckEditor({
|
|
|
2783
2866
|
);
|
|
2784
2867
|
}
|
|
2785
2868
|
|
|
2786
|
-
export { DeckEditor, EditorToolbar, ElementInspector, ImageElementRenderer, PresenterView, ShapeElementRenderer, Slide, SlideRail, SlideThumbnail, SlideViewer, SpeakerNotes, TextElementRenderer, buildSteps, buildsForStep, builtinThemes, chartStarterOption, collectBuilds, darkTheme, deckId, defaultTheme, defineTheme, elementId, nextId, reduce as reduceDeck, resolveTheme, slideId, stepDelays, totalBuildSteps, useDeckState, useSlideKeyboard, visibleElementIds, vividTheme };
|
|
2869
|
+
export { DeckEditor, EditorToolbar, ElementInspector, ImageElementRenderer, PresenterView, ShapeElementRenderer, Slide, SlideRail, SlideThumbnail, SlideViewer, SpeakerNotes, TextElementRenderer, buildSteps, buildsForStep, builtinThemes, chartStarterOption, collectBuilds, darkTheme, deckId, defaultTheme, defineTheme, elementId, isByParagraph, nextId, paragraphReveals, reduce as reduceDeck, resolveTheme, slideId, splitParagraphs, stepDelays, totalBuildSteps, useDeckState, useSlideKeyboard, visibleElementIds, vividTheme };
|
|
2787
2870
|
//# sourceMappingURL=index.js.map
|
|
2788
2871
|
//# sourceMappingURL=index.js.map
|