@open-slide/core 1.0.0 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-slide/core",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
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
 
@@ -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.