@open-slide/core 1.0.0 → 1.0.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.
@@ -1,5 +1,5 @@
1
- import "./design-BUML7uvZ.js";
2
- import { createViteConfig } from "./config-Cuw0mC5h.js";
1
+ import "./design-C13iz9_4.js";
2
+ import { createViteConfig } from "./config-CN7J0RDO.js";
3
3
  import path from "node:path";
4
4
  import { build as build$1, mergeConfig } from "vite";
5
5
 
package/dist/cli/bin.js CHANGED
@@ -57,15 +57,15 @@ async function run(argv) {
57
57
  program.name("open-slide").description("Author slides — we handle the Vite/React stack.").version(version, "-v, --version", "print version").helpOption("-h, --help", "show help").showHelpAfterError(chalk.dim("(run `open-slide --help` for usage)"));
58
58
  program.command("dev").description("Start the dev server").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").option("--no-skills-check", "skip the built-in skills drift check").action(async (flags) => {
59
59
  if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
60
- const { dev } = await import("../dev-BuWsdYvn.js");
60
+ const { dev } = await import("../dev-jWxtWHAG.js");
61
61
  await dev(flags);
62
62
  });
63
63
  program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
64
- const { build } = await import("../build-DC3FTpWO.js");
64
+ const { build } = await import("../build-DqfKmw9h.js");
65
65
  await build(flags);
66
66
  });
67
67
  program.command("preview").description("Preview the production build").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").action(async (flags) => {
68
- const { preview } = await import("../preview-CIcG-lP3.js");
68
+ const { preview } = await import("../preview-CSA05Gfm.js");
69
69
  await preview(flags);
70
70
  });
71
71
  program.command("sync:skills").description("Sync built-in skills from @open-slide/core into this workspace").option("--dry-run", "show what would change without writing").action(async (flags) => {
@@ -1,4 +1,4 @@
1
- import { defaultDesign } from "./design-BUML7uvZ.js";
1
+ import { defaultDesign } from "./design-C13iz9_4.js";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
@@ -8,7 +8,7 @@ function designToCssVars(d) {
8
8
  "--osd-font-body": d.fonts.body,
9
9
  "--osd-size-hero": `${d.typeScale.hero}px`,
10
10
  "--osd-size-body": `${d.typeScale.body}px`,
11
- "--osd-radius-md": `${d.radius.md}px`
11
+ "--osd-radius": `${d.radius}px`
12
12
  };
13
13
  }
14
14
  function cssVarsToString(vars) {
@@ -28,7 +28,7 @@ const defaultDesign = {
28
28
  hero: 168,
29
29
  body: 36
30
30
  },
31
- radius: { md: 12 }
31
+ radius: 12
32
32
  };
33
33
 
34
34
  //#endregion
@@ -1,5 +1,5 @@
1
- import "./design-BUML7uvZ.js";
2
- import { createViteConfig } from "./config-Cuw0mC5h.js";
1
+ import "./design-C13iz9_4.js";
2
+ import { createViteConfig } from "./config-CN7J0RDO.js";
3
3
  import { createServer, mergeConfig } from "vite";
4
4
 
5
5
  //#region src/cli/dev.ts
package/dist/index.d.ts CHANGED
@@ -34,14 +34,11 @@ type DesignTypeScale = {
34
34
  hero: number;
35
35
  body: number;
36
36
  };
37
- type DesignRadius = {
38
- md: number;
39
- };
40
37
  type DesignSystem = {
41
38
  palette: DesignPalette;
42
39
  fonts: DesignFonts;
43
40
  typeScale: DesignTypeScale;
44
- radius: DesignRadius;
41
+ radius: number;
45
42
  };
46
43
  declare function designToCssVars(d: DesignSystem): Record<string, string>;
47
44
  declare function cssVarsToString(vars: Record<string, string>): string;
@@ -63,4 +60,4 @@ declare const CANVAS_WIDTH = 1920;
63
60
  declare const CANVAS_HEIGHT = 1080;
64
61
 
65
62
  //#endregion
66
- export { CANVAS_HEIGHT, CANVAS_WIDTH, DesignFonts, DesignPalette, DesignRadius, DesignSystem, DesignTypeScale, ImagePlaceholder, ImagePlaceholderProps, OpenSlideConfig, Page, SlideMeta, SlideModule, cssVarsToString, defaultDesign, designToCssVars };
63
+ export { CANVAS_HEIGHT, CANVAS_WIDTH, DesignFonts, DesignPalette, DesignSystem, DesignTypeScale, ImagePlaceholder, ImagePlaceholderProps, OpenSlideConfig, Page, SlideMeta, SlideModule, cssVarsToString, defaultDesign, designToCssVars };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { cssVarsToString, defaultDesign, designToCssVars } from "./design-BUML7uvZ.js";
1
+ import { cssVarsToString, defaultDesign, designToCssVars } from "./design-C13iz9_4.js";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
 
4
4
  //#region src/app/components/image-placeholder.tsx
@@ -1,5 +1,5 @@
1
- import "./design-BUML7uvZ.js";
2
- import { createViteConfig } from "./config-Cuw0mC5h.js";
1
+ import "./design-C13iz9_4.js";
2
+ import { createViteConfig } from "./config-CN7J0RDO.js";
3
3
  import { mergeConfig, preview as preview$1 } from "vite";
4
4
 
5
5
  //#region src/cli/preview.ts
@@ -1,4 +1,4 @@
1
- import "../design-BUML7uvZ.js";
2
- import { createViteConfig } from "../config-Cuw0mC5h.js";
1
+ import "../design-C13iz9_4.js";
2
+ import { createViteConfig } from "../config-CN7J0RDO.js";
3
3
 
4
4
  export { createViteConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-slide/core",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Runtime and CLI for open-slide — write slides in slides/, we handle the rest.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -58,7 +58,7 @@ If the deck topic naturally calls for specific real images the user must supply
58
58
 
59
59
  Pick one coherent palette / type scale / aesthetic and hold it across every page. The full set of constraints (palette structure, type scale, padding, aesthetic options) lives in `slide-authoring` — apply it.
60
60
 
61
- If the user wants the slide to remain tweakable from the Design panel afterwards, declare a top-level `const design: DesignSystem = { … }` at the top of `index.tsx` (after imports) using the chosen palette / type scale, and reference `design.X` from inline styles. The "Design system" section of `slide-authoring` covers the format and available tokens.
61
+ **Default: declare a top-level `export const design: DesignSystem = { … }`** at the top of `index.tsx` (after imports) using the chosen palette / type scale, and reference the values via `var(--osd-X)` from inline styles. This keeps the slide tweakable from the Design panel after generation, which is what the user almost always wants. Only skip the `design` const for a one-off slide whose palette is intentionally locked and not meant to be re-themed — in that case, fall back to the local `palette` constants pattern. The "Design system" section of `slide-authoring` covers the format and available tokens.
62
62
 
63
63
  Consult the `frontend-design` skill for deeper aesthetic guidance if the user wants something bold.
64
64
 
@@ -125,7 +125,7 @@ export const design: DesignSystem = {
125
125
  body: '-apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif',
126
126
  },
127
127
  typeScale: { hero: 168, body: 36 },
128
- radius: { md: 12 },
128
+ radius: 12,
129
129
  };
130
130
  ```
131
131
 
@@ -137,9 +137,9 @@ There are **two consumption surfaces**, and you should mix them inside the same
137
137
 
138
138
  - **`var(--osd-X)` for visual properties (color, font, font-size, radius)** — these get instant updates while the user drags a slider in the Design panel, before any file write.
139
139
  ```tsx
140
- <div style={{ background: 'var(--osd-bg)', color: 'var(--osd-text)', borderRadius: 'var(--osd-radius-md)', fontFamily: 'var(--osd-font-body)', fontSize: 'var(--osd-size-body)' }}>
140
+ <div style={{ background: 'var(--osd-bg)', color: 'var(--osd-text)', borderRadius: 'var(--osd-radius)', fontFamily: 'var(--osd-font-body)', fontSize: 'var(--osd-size-body)' }}>
141
141
  ```
142
- Available vars: `--osd-bg`, `--osd-text`, `--osd-accent`, `--osd-font-display`, `--osd-font-body`, `--osd-size-hero`, `--osd-size-body`, `--osd-radius-md`.
142
+ Available vars: `--osd-bg`, `--osd-text`, `--osd-accent`, `--osd-font-display`, `--osd-font-body`, `--osd-size-hero`, `--osd-size-body`, `--osd-radius`.
143
143
 
144
144
  - **Direct `design.X` reads** — when you need a JS number for arithmetic or to label something in the UI. These update via HMR after the panel commits the file, not while dragging.
145
145
  ```tsx
@@ -148,7 +148,7 @@ There are **two consumption surfaces**, and you should mix them inside the same
148
148
 
149
149
  The dev UI has a **Design** button in the slide header (next to Inspect). Edits update an in-memory draft and the live-preview overlay; a floating Save / Discard bar at the bottom of the canvas commits or reverts. The const stays the single source of truth — production builds bake the saved values.
150
150
 
151
- When to use it: any time the slide should remain tweakable from the panel after generation. When to *not* use it: one-off slides whose palette is intentionally fixed (then use the local `palette` constants pattern from the starter template). Both styles can coexist across slides — the panel only operates on the *currently viewed* slide.
151
+ **Default to using it.** Every new slide should declare a `design` const so it stays tweakable from the panel after generation this is the expected baseline. Only fall back to the local `palette` constants pattern (see starter template) for a one-off slide whose palette is intentionally locked and not meant to be re-themed. Both styles can coexist across slides — the panel only operates on the *currently viewed* slide.
152
152
 
153
153
  Format constraints (for the panel's AST writer):
154
154
  - Must be `[export] const design: DesignSystem = { … }` (or `as DesignSystem` / `satisfies DesignSystem`) at module top level.
@@ -158,49 +158,64 @@ Format constraints (for the panel's AST writer):
158
158
  ## Starter template
159
159
 
160
160
  ```tsx
161
- import type { Page, SlideMeta } from '@open-slide/core';
161
+ import type { DesignSystem, Page, SlideMeta } from '@open-slide/core';
162
162
 
163
- const palette = {
164
- bg: '#0f172a',
165
- text: '#f8fafc',
166
- accent: '#fbbf24',
167
- muted: '#94a3b8',
163
+ export const design: DesignSystem = {
164
+ palette: { bg: '#0f172a', text: '#f8fafc', accent: '#fbbf24' },
165
+ fonts: {
166
+ display: 'system-ui, -apple-system, sans-serif',
167
+ body: 'system-ui, -apple-system, sans-serif',
168
+ },
169
+ typeScale: { hero: 180, body: 40 },
168
170
  };
169
171
 
172
+ // Extra colors / sizes outside the DesignSystem shape stay as plain consts.
173
+ const muted = '#94a3b8';
174
+
170
175
  const fill = {
171
176
  width: '100%',
172
177
  height: '100%',
173
- fontFamily: 'system-ui, -apple-system, sans-serif',
178
+ fontFamily: 'var(--osd-font-body)',
174
179
  } as const;
175
180
 
176
181
  const Cover: Page = () => (
177
182
  <div
178
183
  style={{
179
184
  ...fill,
180
- background: palette.bg,
181
- color: palette.text,
185
+ background: 'var(--osd-bg)',
186
+ color: 'var(--osd-text)',
182
187
  display: 'flex',
183
188
  flexDirection: 'column',
184
189
  justifyContent: 'center',
185
190
  padding: '0 160px',
186
191
  }}
187
192
  >
188
- <div style={{ fontSize: 28, color: palette.accent, letterSpacing: '0.2em' }}>
193
+ <div style={{ fontSize: 28, color: 'var(--osd-accent)', letterSpacing: '0.2em' }}>
189
194
  CHAPTER 01
190
195
  </div>
191
- <h1 style={{ fontSize: 180, fontWeight: 900, margin: '32px 0', lineHeight: 1.05 }}>
196
+ <h1
197
+ style={{
198
+ fontFamily: 'var(--osd-font-display)',
199
+ fontSize: 'var(--osd-size-hero)',
200
+ fontWeight: 900,
201
+ margin: '32px 0',
202
+ lineHeight: 1.05,
203
+ }}
204
+ >
192
205
  The Big Idea
193
206
  </h1>
194
- <p style={{ fontSize: 40, color: palette.muted, maxWidth: 1200 }}>
207
+ <p style={{ fontSize: 'var(--osd-size-body)', color: muted, maxWidth: 1200 }}>
195
208
  A short subtitle that explains what this slide is about.
196
209
  </p>
197
210
  </div>
198
211
  );
199
212
 
200
213
  const Content: Page = () => (
201
- <div style={{ ...fill, background: palette.bg, color: palette.text, padding: 120 }}>
202
- <h2 style={{ fontSize: 80, fontWeight: 800, margin: 0 }}>Section heading</h2>
203
- <ul style={{ fontSize: 40, lineHeight: 1.6, marginTop: 64, paddingLeft: 48 }}>
214
+ <div style={{ ...fill, background: 'var(--osd-bg)', color: 'var(--osd-text)', padding: 120 }}>
215
+ <h2 style={{ fontFamily: 'var(--osd-font-display)', fontSize: 80, fontWeight: 800, margin: 0 }}>
216
+ Section heading
217
+ </h2>
218
+ <ul style={{ fontSize: 'var(--osd-size-body)', lineHeight: 1.6, marginTop: 64, paddingLeft: 48 }}>
204
219
  <li>One clear point per line</li>
205
220
  <li>Keep to 3–5 bullets</li>
206
221
  <li>Let the space breathe</li>
@@ -264,7 +279,7 @@ Size the placeholder to the slot it occupies. Pass `width`/`height` when the lay
264
279
  - [ ] **For every page, sum (font_size × line_height × lines) + gaps + 2×padding ≤ 1080px.** If close, split the page. No `overflow: auto` escape hatches.
265
280
  - [ ] No bullet wraps to a second line at the chosen font size.
266
281
  - [ ] One coherent visual direction across every page (palette + type scale).
267
- - [ ] If the slide should be tweakable from the Design panel, it declares a top-level `const design: DesignSystem = { … }` and references `design.X` from inline styles.
282
+ - [ ] Slide declares a top-level `export const design: DesignSystem = { … }` and references the values via `var(--osd-X)` (use `design.X` only when you need a JS number for arithmetic). Only omit the `design` const for a one-off slide whose palette is intentionally locked.
268
283
  - [ ] One idea per page.
269
284
  - [ ] All imported assets exist on disk under `slides/<id>/assets/`.
270
285
  - [ ] 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.
@@ -158,15 +158,15 @@ export function DesignPanel({ open, onClose }: DesignPanelProps) {
158
158
  <Section title="Shape">
159
159
  <SliderField
160
160
  label="Radius"
161
- value={draft.radius.md}
161
+ value={draft.radius}
162
162
  min={0}
163
163
  max={80}
164
164
  step={1}
165
165
  suffix="px"
166
166
  onChange={(n) =>
167
167
  update((d) => {
168
- d.radius.md = n;
169
- }, 'design:radius.md')
168
+ d.radius = n;
169
+ }, 'design:radius')
170
170
  }
171
171
  />
172
172
  </Section>
@@ -14,15 +14,11 @@ export type DesignTypeScale = {
14
14
  body: number;
15
15
  };
16
16
 
17
- export type DesignRadius = {
18
- md: number;
19
- };
20
-
21
17
  export type DesignSystem = {
22
18
  palette: DesignPalette;
23
19
  fonts: DesignFonts;
24
20
  typeScale: DesignTypeScale;
25
- radius: DesignRadius;
21
+ radius: number;
26
22
  };
27
23
 
28
24
  export function designToCssVars(d: DesignSystem): Record<string, string> {
@@ -34,7 +30,7 @@ export function designToCssVars(d: DesignSystem): Record<string, string> {
34
30
  '--osd-font-body': d.fonts.body,
35
31
  '--osd-size-hero': `${d.typeScale.hero}px`,
36
32
  '--osd-size-body': `${d.typeScale.body}px`,
37
- '--osd-radius-md': `${d.radius.md}px`,
33
+ '--osd-radius': `${d.radius}px`,
38
34
  };
39
35
  }
40
36
 
@@ -58,7 +54,5 @@ export const defaultDesign: DesignSystem = {
58
54
  hero: 168,
59
55
  body: 36,
60
56
  },
61
- radius: {
62
- md: 12,
63
- },
57
+ radius: 12,
64
58
  };