@open-slide/core 2.0.0-beta.1 → 2.0.0-beta.2
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/dist/{config-AtA2Bqtn.d.ts → config-DjWifhaA.d.ts} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{types-BzPSOxe-.d.ts → types-BWg-Dtbg.d.ts} +1 -2
- package/dist/vite/index.d.ts +1 -1
- package/dist/{zh-tw-BxZ_pYqe.js → zh-tw-DlKyeNX7.js} +4 -8
- package/package.json +1 -1
- package/skills/slide-authoring/SKILL.md +3 -3
- package/skills/slide-authoring/references/morph.md +5 -5
- package/skills/slide-authoring/references/transitions.md +38 -37
- package/skills/slide-authoring/references/webfonts.md +25 -6
- package/src/app/components/command/slide-command-menu.tsx +10 -0
- package/src/app/components/slide-transition-layer.tsx +8 -1
- package/src/app/lib/export-pptx.ts +122 -193
- package/src/app/lib/pptx/color.ts +49 -0
- package/src/app/lib/pptx/css.test.ts +172 -0
- package/src/app/lib/pptx/css.ts +450 -0
- package/src/app/lib/pptx/fonts.ts +145 -0
- package/src/app/lib/pptx/images.ts +116 -0
- package/src/app/lib/pptx/measure.ts +1299 -0
- package/src/app/lib/pptx/ooxml.test.ts +199 -0
- package/src/app/lib/pptx/ooxml.ts +470 -0
- package/src/app/lib/pptx/raster.ts +189 -0
- package/src/app/lib/pptx/render.ts +102 -0
- package/src/app/lib/pptx/scene.ts +116 -0
- package/src/app/lib/pptx/text-lines.test.ts +82 -0
- package/src/app/lib/pptx/text-lines.ts +109 -0
- package/src/app/lib/pptx/units.ts +22 -0
- package/src/app/lib/transition.test.ts +31 -0
- package/src/app/lib/transition.ts +13 -0
- package/src/app/routes/slide.tsx +21 -27
- package/src/locale/en.ts +1 -3
- package/src/locale/ja.ts +1 -3
- package/src/locale/types.ts +1 -2
- package/src/locale/zh-cn.ts +1 -2
- package/src/locale/zh-tw.ts +1 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as Plural, t as Locale } from "./types-
|
|
2
|
-
import { t as OpenSlideConfig } from "./config-
|
|
1
|
+
import { n as Plural, t as Locale } from "./types-BWg-Dtbg.js";
|
|
2
|
+
import { t as OpenSlideConfig } from "./config-DjWifhaA.js";
|
|
3
3
|
import { CSSProperties, ComponentType, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
|
|
4
4
|
//#region src/app/components/image-placeholder.d.ts
|
|
5
5
|
type ImagePlaceholderProps = {
|
|
@@ -63,6 +63,7 @@ type SlideTransition = {
|
|
|
63
63
|
enter?: TransitionPhase;
|
|
64
64
|
exit?: TransitionPhase;
|
|
65
65
|
morph?: boolean | MorphTransition;
|
|
66
|
+
throughBackground?: boolean;
|
|
66
67
|
};
|
|
67
68
|
type MorphTransition = {
|
|
68
69
|
duration?: number;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as en, n as zhCN, r as ja, t as zhTW } from "./zh-tw-
|
|
1
|
+
import { i as en, n as zhCN, r as ja, t as zhTW } from "./zh-tw-DlKyeNX7.js";
|
|
2
2
|
import { n as defaultDesign, r as designToCssVars, t as cssVarsToString } from "./design-Cpqx7SJs.js";
|
|
3
3
|
import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { toast } from "sonner";
|
package/dist/locale/index.d.ts
CHANGED
package/dist/locale/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as en, n as zhCN, r as ja, t as zhTW } from "../zh-tw-
|
|
1
|
+
import { i as en, n as zhCN, r as ja, t as zhTW } from "../zh-tw-DlKyeNX7.js";
|
|
2
2
|
//#region src/locale/format.ts
|
|
3
3
|
function format(template, vars) {
|
|
4
4
|
return template.replace(/\{(\w+)\}/g, (m, key) => {
|
|
@@ -114,9 +114,8 @@ type Locale = {
|
|
|
114
114
|
exportAsPdf: string;
|
|
115
115
|
exportAsImagePptx: string;
|
|
116
116
|
exportAsPptx: string;
|
|
117
|
-
comingSoon: string;
|
|
118
|
-
pptxComingSoonTooltip: string;
|
|
119
117
|
pdfExportFailed: string;
|
|
118
|
+
pptxExportFailed: string;
|
|
120
119
|
imagePptxExportFailed: string;
|
|
121
120
|
pdfExportSafariUnsupported: string;
|
|
122
121
|
present: string;
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -106,9 +106,8 @@ const en = {
|
|
|
106
106
|
exportAsPdf: "Export as PDF",
|
|
107
107
|
exportAsImagePptx: "Export as image PPTX",
|
|
108
108
|
exportAsPptx: "Export as PPTX",
|
|
109
|
-
comingSoon: "Coming soon",
|
|
110
|
-
pptxComingSoonTooltip: "Editable PPTX export isn’t ready yet. For now, use “Export as image PPTX” instead.",
|
|
111
109
|
pdfExportFailed: "PDF export failed",
|
|
110
|
+
pptxExportFailed: "PPTX export failed",
|
|
112
111
|
imagePptxExportFailed: "PPTX export failed",
|
|
113
112
|
pdfExportSafariUnsupported: "Export as PDF is not supported on Safari. Please try a Chromium-based browser instead.",
|
|
114
113
|
present: "Present",
|
|
@@ -566,9 +565,8 @@ const ja = {
|
|
|
566
565
|
exportAsPdf: "PDF として書き出し",
|
|
567
566
|
exportAsImagePptx: "画像 PPTX として書き出し",
|
|
568
567
|
exportAsPptx: "PPTX として書き出し",
|
|
569
|
-
comingSoon: "近日公開",
|
|
570
|
-
pptxComingSoonTooltip: "編集可能な PPTX の書き出しはまだ対応していません。それまでは「画像 PPTX として書き出し」をご利用ください。",
|
|
571
568
|
pdfExportFailed: "PDF の書き出しに失敗しました",
|
|
569
|
+
pptxExportFailed: "PPTX の書き出しに失敗しました",
|
|
572
570
|
imagePptxExportFailed: "PPTX の書き出しに失敗しました",
|
|
573
571
|
pdfExportSafariUnsupported: "PDF の書き出しは現在 Safari では対応していません。Chromium ベースのブラウザでお試しください。",
|
|
574
572
|
present: "発表",
|
|
@@ -1026,9 +1024,8 @@ const zhCN = {
|
|
|
1026
1024
|
exportAsPdf: "导出为 PDF",
|
|
1027
1025
|
exportAsImagePptx: "导出图片 PPTX",
|
|
1028
1026
|
exportAsPptx: "导出 PPTX",
|
|
1029
|
-
comingSoon: "即将推出",
|
|
1030
|
-
pptxComingSoonTooltip: "可编辑的 PPTX 导出尚未支持,在此之前可以先使用“导出图片 PPTX”。",
|
|
1031
1027
|
pdfExportFailed: "PDF 导出失败",
|
|
1028
|
+
pptxExportFailed: "PPTX 导出失败",
|
|
1032
1029
|
imagePptxExportFailed: "PPTX 导出失败",
|
|
1033
1030
|
pdfExportSafariUnsupported: "导出 PDF 目前不支持 Safari 设备,请尝试使用基于 Chromium 的浏览器替代。",
|
|
1034
1031
|
present: "演示",
|
|
@@ -1486,9 +1483,8 @@ const zhTW = {
|
|
|
1486
1483
|
exportAsPdf: "匯出為 PDF",
|
|
1487
1484
|
exportAsImagePptx: "匯出圖片 PPTX",
|
|
1488
1485
|
exportAsPptx: "匯出 PPTX",
|
|
1489
|
-
comingSoon: "即將推出",
|
|
1490
|
-
pptxComingSoonTooltip: "可編輯的 PPTX 匯出尚未支援,在此之前可以先使用「匯出圖片 PPTX」。",
|
|
1491
1486
|
pdfExportFailed: "PDF 匯出失敗",
|
|
1487
|
+
pptxExportFailed: "PPTX 匯出失敗",
|
|
1492
1488
|
imagePptxExportFailed: "PPTX 匯出失敗",
|
|
1493
1489
|
pdfExportSafariUnsupported: "匯出 PDF 目前不支援 Safari 裝置,請嘗試用 Chromium 基底瀏覽器替代。",
|
|
1494
1490
|
present: "簡報",
|
package/package.json
CHANGED
|
@@ -274,7 +274,7 @@ Read `references/steps.md` before authoring a stepped page — it covers composi
|
|
|
274
274
|
|
|
275
275
|
## Page transitions
|
|
276
276
|
|
|
277
|
-
The framework can run an enter/exit animation between slide changes, declared as a `SlideTransition` (module-level default, per-page override; the **incoming page wins**). There's **no default** — pages snap unless you opt in, and snap-swap is a perfectly tasteful default. If you do opt in: one motion DNA per deck,
|
|
277
|
+
The framework can run an enter/exit animation between slide changes, declared as a `SlideTransition` (module-level default, per-page override; the **incoming page wins**). There's **no default** — pages snap unless you opt in, and snap-swap is a perfectly tasteful default. If you do opt in: one motion DNA per deck, 200–280 ms, magnitude under 12 px / 3% scale, the outgoing page holds while the incoming page fades in on top (the framework ignores exit opacity unless `throughBackground: true`).
|
|
278
278
|
|
|
279
279
|
Read `references/transitions.md` before declaring one — it has the full type contract, design principles, a six-member "tasteful family" of ready-to-use transitions sharing one DNA, direction-aware keyframes, and the anti-pattern list.
|
|
280
280
|
|
|
@@ -282,7 +282,7 @@ Read `references/transitions.md` before declaring one — it has the full type c
|
|
|
282
282
|
|
|
283
283
|
When the *same visual object* exists on two adjacent pages, wrap it on both pages in `MorphElement` with the same `id` and enable `morph` on the incoming page's transition — position, size, radius, and colors interpolate in one continuous move (Keynote's "Magic Move"). Morph is for **state continuity** (a toggle sliding, a card expanding, a box joining a row); don't morph decoration.
|
|
284
284
|
|
|
285
|
-
Read `references/morph.md` before writing one — the seven rules there (opacity-only enter
|
|
285
|
+
Read `references/morph.md` before writing one — the seven rules there (held exit + opacity-only enter, deterministic geometry, no `transform` on the morph node, `useIsActivePage()` gating, …) were each earned on a real deck, and violating any of them produces a visibly broken morph.
|
|
286
286
|
|
|
287
287
|
## Repeated elements: component, not `map`
|
|
288
288
|
|
|
@@ -350,7 +350,7 @@ This applies whenever the *visual element* repeats, not whenever the *data* does
|
|
|
350
350
|
- [ ] All imported assets exist on disk — slide-local under `slides/<id>/assets/`, or global under `assets/` (imported via `@assets/...`).
|
|
351
351
|
- [ ] Every `<ImagePlaceholder>` corresponds to a real image the user must supply — not decorative filler. If it could be replaced by typography or layout, it should be.
|
|
352
352
|
- [ ] If a page uses `<Steps>`/`<Step>`, every `<Step>` is a direct child of a `<Steps>`, and the page still reads as complete when jumped to via the overview grid (entering forward builds up; jumping in shows it fully revealed).
|
|
353
|
-
- [ ] If a `SlideTransition` is declared, every page sits in one family — same duration band (
|
|
353
|
+
- [ ] If a `SlideTransition` is declared, every page sits in one family — same duration band (200–280 ms), same easing pair, same hold-then-fade-in shape (no enter delay, no `throughBackground` outside a deliberate section break), magnitude under 12 px / 3%. No six-different-vocabularies decks. When in doubt, omit transitions entirely. (Pages that opt into `morph` may exceed the band to match the morph — see `references/morph.md`.)
|
|
354
354
|
- [ ] If a transition opts into `morph`: every morph `id` is unique per page and stable across the pair, morph geometry is pixel-constant (never measured after mount), no `transform` sits on the morph node, and entrance animations are gated behind `useIsActivePage()`.
|
|
355
355
|
- [ ] If the user asked for a speech script / speaker notes, it lives in `export const notes` (index-aligned with the page array) — not in a markdown or text file.
|
|
356
356
|
- [ ] Nothing outside `slides/<id>/` was edited.
|
|
@@ -11,11 +11,11 @@ When the *same visual object* exists on two adjacent pages, the runtime can morp
|
|
|
11
11
|
import { MorphElement, type Page, type SlideTransition } from '@open-slide/core';
|
|
12
12
|
import type { CSSProperties } from 'react';
|
|
13
13
|
|
|
14
|
-
// Morph transition — opacity-only enter
|
|
14
|
+
// Morph transition — a held exit and an opacity-only enter keep all the motion on the clones (see rules).
|
|
15
15
|
const morphTransition: SlideTransition = {
|
|
16
16
|
duration: 280,
|
|
17
|
-
exit: { duration:
|
|
18
|
-
enter: { duration: 308,
|
|
17
|
+
exit: { duration: 308, easing: 'cubic-bezier(0.4, 0, 1, 1)', keyframes: [{ opacity: 1 }, { opacity: 1 }] },
|
|
18
|
+
enter: { duration: 308, easing: 'cubic-bezier(0, 0, 0.2, 1)', keyframes: [{ opacity: 0 }, { opacity: 1 }] },
|
|
19
19
|
morph: { duration: 868, easing: 'cubic-bezier(0.4, 0, 0.2, 1)' },
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -38,7 +38,7 @@ Narrow.transition = morphTransition; // backward: Wide → Narrow morphs it back
|
|
|
38
38
|
|
|
39
39
|
## Contract
|
|
40
40
|
|
|
41
|
-
- `morph: true` inherits the transition's top-level `duration`/`easing`; pass `{ duration?, easing?, delay? }` to time the morph independently of the page cross-fade. Morphs usually read best 2–4× longer than the fade (e.g. 280 ms fade, 868 ms morph). Fade phases on morphing pages may run past the
|
|
41
|
+
- `morph: true` inherits the transition's top-level `duration`/`easing`; pass `{ duration?, easing?, delay? }` to time the morph independently of the page cross-fade. Morphs usually read best 2–4× longer than the fade (e.g. 280 ms fade, 868 ms morph). Fade phases on morphing pages may run past the 200–280 ms band in `transitions.md` — they're timed against the longer morph, not the standard cut; the band still binds non-morph pages.
|
|
42
42
|
- Elements pair by `id` across the cut. A matched pair FLIP-morphs: the runtime measures both rects, clones the outgoing element into an overlay above both pages, hides the originals, and animates transform + border-radius + colors (border widths ride a separate frame so they don't stretch with the box). Keep each `id` unique within a page; don't nest one `MorphElement` inside another.
|
|
43
43
|
- An `id` present on only one side fades in/out **in place**. This is how "a third box joins the row" reads: carried boxes glide to their new slots, the new one materializes.
|
|
44
44
|
- Colors on the morph node *and its descendants* interpolate too — a label that flips black → white mid-glide just works.
|
|
@@ -46,7 +46,7 @@ Narrow.transition = morphTransition; // backward: Wide → Narrow morphs it back
|
|
|
46
46
|
|
|
47
47
|
## Rules — each one earned on a real deck
|
|
48
48
|
|
|
49
|
-
1. **Prefer opacity-only enter
|
|
49
|
+
1. **Prefer a held exit and an opacity-only enter on morphing pages.** Any transition family composes correctly with the morph (shared rects are measured before the phases start), but while clones glide, a transform-bearing enter also slides the rest of the page — two competing motions. Giving the clones all the motion and fading the incoming page in over the held outgoing page is what makes a morph read as one confident gesture. (Exit opacity is held by the framework anyway — see `transitions.md`; morph originals are hidden with `visibility`, so the held outgoing page never shows a duplicate.)
|
|
50
50
|
2. **Morph geometry must be deterministic at mount.** Rects are snapshotted once at the cut. Position morph elements with pixel constants — never with a value measured in an effect after mount (the re-render shifts the target mid-morph and the move jumps). If text inside a morph box grows over time (typewriter etc.), render a hidden full-width spacer so the measured box never changes size.
|
|
51
51
|
3. **No `transform` on the morph node itself.** A percentage translate (`translate(-50%, -50%)`) gets mis-scaled by the morph and lands the clone tens of px off. Put centering/positioning transforms on a plain wrapper `<div>` *around* the `MorphElement`.
|
|
52
52
|
4. **`MorphElement` merges `className`/`style` onto its single host child** (it adds no wrapper when the child is a lone DOM element). A crop box (`overflow: hidden` + fixed width) therefore needs an explicit nested `<div>` — otherwise the box collapses onto the `<img>` inside and squishes it.
|
|
@@ -30,14 +30,15 @@ type TransitionPhase = {
|
|
|
30
30
|
keyframes: Keyframe[] | PropertyIndexedKeyframes; // WAAPI keyframes
|
|
31
31
|
duration?: number; // ms (falls back to top-level duration)
|
|
32
32
|
easing?: string; // CSS easing
|
|
33
|
-
delay?: number; // ms
|
|
33
|
+
delay?: number; // ms
|
|
34
34
|
};
|
|
35
35
|
type SlideTransition = {
|
|
36
36
|
duration: number; // top-level fallback
|
|
37
37
|
easing?: string; // top-level fallback
|
|
38
38
|
enter?: TransitionPhase; // runs on incoming page
|
|
39
|
-
exit?: TransitionPhase; // runs on outgoing page
|
|
39
|
+
exit?: TransitionPhase; // runs on outgoing page — opacity is held at 1 (see below)
|
|
40
40
|
morph?: boolean | MorphTransition; // shared-element morph — see morph.md
|
|
41
|
+
throughBackground?: boolean; // let exit fade out and dip through --osd-bg
|
|
41
42
|
};
|
|
42
43
|
type MorphTransition = {
|
|
43
44
|
duration?: number;
|
|
@@ -48,33 +49,41 @@ type MorphTransition = {
|
|
|
48
49
|
|
|
49
50
|
The framework also exposes `--osd-dir` (`1` forward, `-1` backward) and `data-osd-dir` (`"forward"` / `"backward"`) on the wrapper, so a single keyframe can mirror direction without a JS callback.
|
|
50
51
|
|
|
52
|
+
## How the layers stack (read this before writing an `exit`)
|
|
53
|
+
|
|
54
|
+
During a cut the outgoing page and the incoming page are stacked in one container painted `--osd-bg`, incoming on top. Every page root fills the canvas and paints its own background, so as long as the outgoing page stays opaque, **the incoming page simply fades in over it and the container colour is never seen**.
|
|
55
|
+
|
|
56
|
+
An exit that fades to `opacity: 0` breaks that: for the stretch where the old page is already transparent and the new one isn't yet opaque, the container shows through. On a deck whose pages all match `--osd-bg` this is invisible; on any page with its own background (a white chapter, a gradient, a full-bleed photo) it reads as a dip to black or a flash. Because this is never what you want by accident, **the framework ignores `opacity` in `exit` keyframes** — the outgoing page holds at full opacity while `transform` / `filter` still apply.
|
|
57
|
+
|
|
58
|
+
- Put the fade on `enter`. The exit is a hold (or a transform-only nudge).
|
|
59
|
+
- Don't delay `enter` — a delay just leaves the old page sitting there for that long.
|
|
60
|
+
- Keep exit transforms tiny or skip them: a translated outgoing page exposes a strip of `--osd-bg` along one edge until the incoming page covers it.
|
|
61
|
+
- If you genuinely want a dip through the background (a section break that goes to black), set `throughBackground: true` on that transition. Exit keyframes then run as written. Only do this where the pages on both sides share `--osd-bg`.
|
|
62
|
+
|
|
51
63
|
## Design principles (hold the line)
|
|
52
64
|
|
|
53
65
|
The single loudest signal of "made in PowerPoint" is six different transitions in one deck. Restraint is the rhythm.
|
|
54
66
|
|
|
55
|
-
- **Pick one DNA, hold it across the deck.** Same duration band, same easing pair, same
|
|
56
|
-
- **Duration:
|
|
67
|
+
- **Pick one DNA, hold it across the deck.** Same duration band, same easing pair, same hold-then-fade-in shape. Variation lives only in *which property* gets the small nudge on enter — Y, X, scale, blur.
|
|
68
|
+
- **Duration: 200–280 ms.** One number for the whole cut; the exit holds for the same duration so the two layers release together. Past 350 ms is video-editor territory; reserve for genuine state changes.
|
|
57
69
|
- **Magnitude ceiling: 12 px or 3% scale.** A 6 px Y-rise reads as "next thought." A 1920 px translateX reads as "different document." Premium tools move barely enough to register.
|
|
58
|
-
- **Opacity is always part of
|
|
59
|
-
- **Easing: ease-
|
|
70
|
+
- **Opacity is always part of enter.** Pure-transform enters look stiff; a pure-opacity enter is the safest possible default.
|
|
71
|
+
- **Easing: ease-out for enter.** `cubic-bezier(0, 0, 0.2, 1)`. Never `linear` (feels like a slideshow). Reserve symmetric `ease-in-out` for state-anchored morphs only.
|
|
60
72
|
|
|
61
73
|
## Tasteful family — six members, one DNA
|
|
62
74
|
|
|
63
|
-
Use this set as a starting point. Pick one as the deck's house transition; optionally reserve a second for hero/cover slides and a third for genuine section breaks.
|
|
75
|
+
Use this set as a starting point. Pick one as the deck's house transition; optionally reserve a second for hero/cover slides and a third for genuine section breaks. Every member holds the outgoing page and fades the incoming one in on top, so none of them can flash the container background.
|
|
64
76
|
|
|
65
77
|
```tsx
|
|
66
78
|
const EASE_OUT = 'cubic-bezier(0, 0, 0.2, 1)';
|
|
67
79
|
const EASE_IN = 'cubic-bezier(0.4, 0, 1, 1)';
|
|
80
|
+
const HOLD: Keyframe[] = [{ opacity: 1 }, { opacity: 1 }];
|
|
68
81
|
|
|
69
82
|
// RISE — house quiet. 6 px Y. Use as module default.
|
|
70
83
|
export const transition: SlideTransition = {
|
|
71
|
-
duration:
|
|
72
|
-
exit: { duration:
|
|
73
|
-
|
|
74
|
-
{ opacity: 1, transform: 'translateY(0)' },
|
|
75
|
-
{ opacity: 0, transform: 'translateY(-4px)' },
|
|
76
|
-
] },
|
|
77
|
-
enter: { duration: 200, delay: 80, easing: EASE_OUT,
|
|
84
|
+
duration: 260,
|
|
85
|
+
exit: { duration: 260, easing: EASE_IN, keyframes: HOLD },
|
|
86
|
+
enter: { duration: 260, easing: EASE_OUT,
|
|
78
87
|
keyframes: [
|
|
79
88
|
{ opacity: 0, transform: 'translateY(6px)' },
|
|
80
89
|
{ opacity: 1, transform: 'translateY(0)' },
|
|
@@ -84,21 +93,16 @@ export const transition: SlideTransition = {
|
|
|
84
93
|
// DISSOLVE — pure opacity. The quietest possible.
|
|
85
94
|
const dissolve: SlideTransition = {
|
|
86
95
|
duration: 240,
|
|
87
|
-
exit: { duration:
|
|
88
|
-
|
|
89
|
-
enter: { duration: 240, delay: 40, easing: EASE_OUT,
|
|
96
|
+
exit: { duration: 240, easing: EASE_IN, keyframes: HOLD },
|
|
97
|
+
enter: { duration: 240, easing: EASE_OUT,
|
|
90
98
|
keyframes: [{ opacity: 0 }, { opacity: 1 }] },
|
|
91
99
|
};
|
|
92
100
|
|
|
93
101
|
// SETTLE — cover-grade. Rise + a hair of blur on enter only.
|
|
94
102
|
Cover.transition = {
|
|
95
103
|
duration: 280,
|
|
96
|
-
exit: { duration:
|
|
97
|
-
|
|
98
|
-
{ opacity: 1, transform: 'translateY(0)' },
|
|
99
|
-
{ opacity: 0, transform: 'translateY(-6px)' },
|
|
100
|
-
] },
|
|
101
|
-
enter: { duration: 280, delay: 100, easing: EASE_OUT,
|
|
104
|
+
exit: { duration: 280, easing: EASE_IN, keyframes: HOLD },
|
|
105
|
+
enter: { duration: 280, easing: EASE_OUT,
|
|
102
106
|
keyframes: [
|
|
103
107
|
{ opacity: 0, transform: 'translateY(12px)', filter: 'blur(4px)' },
|
|
104
108
|
{ opacity: 1, transform: 'translateY(0)', filter: 'blur(0)' },
|
|
@@ -108,12 +112,8 @@ Cover.transition = {
|
|
|
108
112
|
// BLOOM — scale 0.97 → 1, no translate. Materializes in place.
|
|
109
113
|
const bloom: SlideTransition = {
|
|
110
114
|
duration: 240,
|
|
111
|
-
exit: { duration:
|
|
112
|
-
|
|
113
|
-
{ opacity: 1, transform: 'scale(1)' },
|
|
114
|
-
{ opacity: 0, transform: 'scale(1.01)' },
|
|
115
|
-
] },
|
|
116
|
-
enter: { duration: 240, delay: 80, easing: EASE_OUT,
|
|
115
|
+
exit: { duration: 240, easing: EASE_IN, keyframes: HOLD },
|
|
116
|
+
enter: { duration: 240, easing: EASE_OUT,
|
|
117
117
|
keyframes: [
|
|
118
118
|
{ opacity: 0, transform: 'scale(0.97)' },
|
|
119
119
|
{ opacity: 1, transform: 'scale(1)' },
|
|
@@ -122,13 +122,9 @@ const bloom: SlideTransition = {
|
|
|
122
122
|
|
|
123
123
|
// FALL — mirrored Rise. Incoming page comes down from above.
|
|
124
124
|
const fall: SlideTransition = {
|
|
125
|
-
duration:
|
|
126
|
-
exit: { duration:
|
|
127
|
-
|
|
128
|
-
{ opacity: 1, transform: 'translateY(0)' },
|
|
129
|
-
{ opacity: 0, transform: 'translateY(4px)' },
|
|
130
|
-
] },
|
|
131
|
-
enter: { duration: 200, delay: 80, easing: EASE_OUT,
|
|
125
|
+
duration: 260,
|
|
126
|
+
exit: { duration: 260, easing: EASE_IN, keyframes: HOLD },
|
|
127
|
+
enter: { duration: 260, easing: EASE_OUT,
|
|
132
128
|
keyframes: [
|
|
133
129
|
{ opacity: 0, transform: 'translateY(-6px)' },
|
|
134
130
|
{ opacity: 1, transform: 'translateY(0)' },
|
|
@@ -136,9 +132,12 @@ const fall: SlideTransition = {
|
|
|
136
132
|
};
|
|
137
133
|
|
|
138
134
|
// BREATH — section break. Exit fully, hold 120 ms, then enter.
|
|
139
|
-
//
|
|
135
|
+
// The one member that dips through --osd-bg on purpose, so it opts in with
|
|
136
|
+
// `throughBackground`. Use only between pages that share the deck background,
|
|
137
|
+
// and at most 1–2× per deck.
|
|
140
138
|
const breath: SlideTransition = {
|
|
141
139
|
duration: 460,
|
|
140
|
+
throughBackground: true,
|
|
142
141
|
exit: { duration: 180, easing: EASE_IN,
|
|
143
142
|
keyframes: [{ opacity: 1 }, { opacity: 0 }] },
|
|
144
143
|
enter: { duration: 240, delay: 300, easing: EASE_OUT,
|
|
@@ -164,6 +163,8 @@ If you find yourself reaching for this on every transition, you're probably over
|
|
|
164
163
|
|
|
165
164
|
## Anti-patterns
|
|
166
165
|
|
|
166
|
+
- ❌ Fading the exit to `opacity: 0` and delaying the enter — the framework ignores the exit fade, so the outgoing page just sits there for the delay (a dead beat); with `throughBackground: true` the same shape becomes a flash of the container background. Write a hold instead.
|
|
167
|
+
- ❌ `throughBackground: true` on the house transition, or between pages with different backgrounds — every cut dips to black.
|
|
167
168
|
- ❌ Six different transitions across six pages — the single loudest "made in PowerPoint" tell.
|
|
168
169
|
- ❌ `translateX(100%)` slide-from-side — iOS modal / PowerPoint Push; not a slide change.
|
|
169
170
|
- ❌ Aggressive scale-pop (e.g. `0.85 → 1`) + blur — lightbox / photo-viewer vocabulary; implies zooming *into* something.
|
|
@@ -7,12 +7,31 @@ The default is a system font stack — prefer it. When a deck genuinely needs a
|
|
|
7
7
|
```tsx
|
|
8
8
|
const FONT_HREF = 'https://fonts.googleapis.com/css2?family=...&display=swap';
|
|
9
9
|
const FONT_LINK_ID = 'osd-webfont-q2-roadmap'; // suffix = this slide's folder id
|
|
10
|
-
if (typeof document !== 'undefined'
|
|
11
|
-
|
|
12
|
-
link
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
if (typeof document !== 'undefined') {
|
|
11
|
+
let link = document.getElementById(FONT_LINK_ID) as HTMLLinkElement | null;
|
|
12
|
+
if (!link) {
|
|
13
|
+
link = document.createElement('link');
|
|
14
|
+
link.id = FONT_LINK_ID;
|
|
15
|
+
link.rel = 'stylesheet';
|
|
16
|
+
document.head.appendChild(link);
|
|
17
|
+
}
|
|
18
|
+
if (link.href !== FONT_HREF) link.href = FONT_HREF;
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- **Create-or-update, never create-if-missing.** HMR re-runs the module but leaves the previous `<link>` / `<style>` in the document, so an `if (!document.getElementById(id)) { … }` guard skips the new content and edits don't show up until a full reload. The same shape applies to any `<style>` you inject for `@keyframes`:
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
const STYLE_ID = 'osd-styles-q2-roadmap';
|
|
26
|
+
const css = `@keyframes rise { from { opacity: 0 } to { opacity: 1 } }`;
|
|
27
|
+
if (typeof document !== 'undefined') {
|
|
28
|
+
let style = document.getElementById(STYLE_ID);
|
|
29
|
+
if (!style) {
|
|
30
|
+
style = document.createElement('style');
|
|
31
|
+
style.id = STYLE_ID;
|
|
32
|
+
document.head.appendChild(style);
|
|
33
|
+
}
|
|
34
|
+
if (style.textContent !== css) style.textContent = css;
|
|
16
35
|
}
|
|
17
36
|
```
|
|
18
37
|
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
MonitorSpeaker,
|
|
11
11
|
Palette,
|
|
12
12
|
Play,
|
|
13
|
+
Presentation,
|
|
13
14
|
RectangleHorizontal,
|
|
14
15
|
} from 'lucide-react';
|
|
15
16
|
import { useNavigate } from 'react-router-dom';
|
|
@@ -27,6 +28,7 @@ export type SlideCommandHandlers = {
|
|
|
27
28
|
onToggleDesignPanel: () => void;
|
|
28
29
|
onExportHtml: () => void;
|
|
29
30
|
onExportPdf: () => void;
|
|
31
|
+
onExportPptx: () => void;
|
|
30
32
|
onExportImagePptx: () => void;
|
|
31
33
|
onGoToPage: (index: number) => void;
|
|
32
34
|
};
|
|
@@ -132,6 +134,14 @@ export function SlideCommandMenu({
|
|
|
132
134
|
disabled: exporting,
|
|
133
135
|
run: handlers.onExportPdf,
|
|
134
136
|
},
|
|
137
|
+
{
|
|
138
|
+
id: 'export-pptx',
|
|
139
|
+
label: t.slide.exportAsPptx,
|
|
140
|
+
icon: <Presentation />,
|
|
141
|
+
keywords: ['export', 'pptx', 'powerpoint', 'download', 'editable'],
|
|
142
|
+
disabled: exporting,
|
|
143
|
+
run: handlers.onExportPptx,
|
|
144
|
+
},
|
|
135
145
|
{
|
|
136
146
|
id: 'export-image-pptx',
|
|
137
147
|
label: t.slide.exportAsImagePptx,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
StepHost,
|
|
9
9
|
} from '../lib/step-context';
|
|
10
10
|
import {
|
|
11
|
+
holdOpacity,
|
|
11
12
|
type MorphTransition,
|
|
12
13
|
resolveTransition,
|
|
13
14
|
type SlideTransition,
|
|
@@ -711,8 +712,14 @@ export function SlideTransitionLayer({
|
|
|
711
712
|
const morphPhase = resolveMorphTransition(transition.morph, duration, easing);
|
|
712
713
|
const morphRun = morphPhase ? runMorphTransition(wrapper, out, inc, morphPhase) : null;
|
|
713
714
|
|
|
715
|
+
// The wrapper paints --osd-bg under both layers, so an exit that fades
|
|
716
|
+
// out exposes it before the enter has covered it; pages whose own
|
|
717
|
+
// background differs from --osd-bg visibly dip through the wrapper colour.
|
|
718
|
+
// The outgoing page therefore stays opaque unless the deck opts in.
|
|
719
|
+
const exitPhase = transition.throughBackground ? transition.exit : holdOpacity(transition.exit);
|
|
720
|
+
|
|
714
721
|
const anims: Animation[] = [];
|
|
715
|
-
const exitAnim = runPhase(out,
|
|
722
|
+
const exitAnim = runPhase(out, exitPhase, duration, easing);
|
|
716
723
|
const enterAnim = runPhase(inc, transition.enter, duration, easing);
|
|
717
724
|
if (exitAnim) anims.push(exitAnim);
|
|
718
725
|
if (enterAnim) anims.push(enterAnim);
|