@open-slide/core 0.0.12 → 0.0.13

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-CROQh0AA.js";
2
- import { createViteConfig } from "./config-CVqRAagl.js";
1
+ import "./design-BUML7uvZ.js";
2
+ import { createViteConfig } from "./config-Cuw0mC5h.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-R2we2iaF.js");
60
+ const { dev } = await import("../dev-BuWsdYvn.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-aiY_8kwE.js");
64
+ const { build } = await import("../build-DC3FTpWO.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-CU4zSyGp.js");
68
+ const { preview } = await import("../preview-CIcG-lP3.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-CROQh0AA.js";
1
+ import { defaultDesign } from "./design-BUML7uvZ.js";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
@@ -1,4 +1,4 @@
1
- //#region src/design.ts
1
+ //#region src/app/lib/design.ts
2
2
  function designToCssVars(d) {
3
3
  return {
4
4
  "--osd-bg": d.palette.bg,
@@ -1,5 +1,5 @@
1
- import "./design-CROQh0AA.js";
2
- import { createViteConfig } from "./config-CVqRAagl.js";
1
+ import "./design-BUML7uvZ.js";
2
+ import { createViteConfig } from "./config-Cuw0mC5h.js";
3
3
  import { createServer, mergeConfig } from "vite";
4
4
 
5
5
  //#region src/cli/dev.ts
package/dist/index.d.ts CHANGED
@@ -20,7 +20,7 @@ declare function ImagePlaceholder({
20
20
  }: ImagePlaceholderProps): react_jsx_runtime0.JSX.Element;
21
21
 
22
22
  //#endregion
23
- //#region src/design.d.ts
23
+ //#region src/app/lib/design.d.ts
24
24
  type DesignPalette = {
25
25
  bg: string;
26
26
  text: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { cssVarsToString, defaultDesign, designToCssVars } from "./design-CROQh0AA.js";
1
+ import { cssVarsToString, defaultDesign, designToCssVars } from "./design-BUML7uvZ.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-CROQh0AA.js";
2
- import { createViteConfig } from "./config-CVqRAagl.js";
1
+ import "./design-BUML7uvZ.js";
2
+ import { createViteConfig } from "./config-Cuw0mC5h.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-CROQh0AA.js";
2
- import { createViteConfig } from "../config-CVqRAagl.js";
1
+ import "../design-BUML7uvZ.js";
2
+ import { createViteConfig } from "../config-Cuw0mC5h.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": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Runtime and CLI for open-slide — write slides in slides/, we handle the rest.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
2
  import { useWheelPageNavigation } from '@/lib/use-wheel-page-navigation';
3
3
  import { cn } from '@/lib/utils';
4
- import type { DesignSystem } from '../../design';
4
+ import type { DesignSystem } from '../lib/design';
5
5
  import type { Page } from '../lib/sdk';
6
6
  import { PresentBlackoutOverlay } from './present/blackout-overlay';
7
7
  import { PresentControlBar } from './present/control-bar';
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useRef, useState } from 'react';
2
2
  import { cn } from '@/lib/utils';
3
- import type { DesignSystem } from '../../../design';
3
+ import type { DesignSystem } from '../../lib/design';
4
4
  import type { Page } from '../../lib/sdk';
5
5
  import { CANVAS_HEIGHT, CANVAS_WIDTH } from '../../lib/sdk';
6
6
  import { SlideCanvas } from '../slide-canvas';
@@ -1,6 +1,6 @@
1
1
  import { type CSSProperties, type ReactNode, useEffect, useRef, useState } from 'react';
2
2
  import { cn } from '@/lib/utils';
3
- import { type DesignSystem, designToCssVars } from '../../design';
3
+ import { type DesignSystem, designToCssVars } from '../lib/design';
4
4
  import { CANVAS_HEIGHT, CANVAS_WIDTH } from '../lib/sdk';
5
5
 
6
6
  type Props = {
@@ -10,7 +10,7 @@ import {
10
10
  } from 'react';
11
11
  import { toast } from 'sonner';
12
12
  import { useHistory } from '@/components/history-provider';
13
- import { type DesignSystem, defaultDesign, designToCssVars } from '../../../design';
13
+ import { type DesignSystem, defaultDesign, designToCssVars } from '../../lib/design';
14
14
  import { useDesign as useDesignFetch } from './use-design';
15
15
 
16
16
  type DesignCtx = {
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useEffect, useRef, useState } from 'react';
2
- import type { DesignSystem } from '../../../design';
2
+ import type { DesignSystem } from '../../lib/design';
3
3
 
4
4
  type FetchedState = {
5
5
  design: DesignSystem | null;
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
  import { ScrollArea } from '@/components/ui/scroll-area';
3
3
  import { cn } from '@/lib/utils';
4
- import type { DesignSystem } from '../../design';
4
+ import type { DesignSystem } from '../lib/design';
5
5
  import type { Page } from '../lib/sdk';
6
6
  import { CANVAS_HEIGHT, CANVAS_WIDTH } from '../lib/sdk';
7
7
  import { SlideCanvas } from './slide-canvas';
@@ -0,0 +1,64 @@
1
+ export type DesignPalette = {
2
+ bg: string;
3
+ text: string;
4
+ accent: string;
5
+ };
6
+
7
+ export type DesignFonts = {
8
+ display: string;
9
+ body: string;
10
+ };
11
+
12
+ export type DesignTypeScale = {
13
+ hero: number;
14
+ body: number;
15
+ };
16
+
17
+ export type DesignRadius = {
18
+ md: number;
19
+ };
20
+
21
+ export type DesignSystem = {
22
+ palette: DesignPalette;
23
+ fonts: DesignFonts;
24
+ typeScale: DesignTypeScale;
25
+ radius: DesignRadius;
26
+ };
27
+
28
+ export function designToCssVars(d: DesignSystem): Record<string, string> {
29
+ return {
30
+ '--osd-bg': d.palette.bg,
31
+ '--osd-text': d.palette.text,
32
+ '--osd-accent': d.palette.accent,
33
+ '--osd-font-display': d.fonts.display,
34
+ '--osd-font-body': d.fonts.body,
35
+ '--osd-size-hero': `${d.typeScale.hero}px`,
36
+ '--osd-size-body': `${d.typeScale.body}px`,
37
+ '--osd-radius-md': `${d.radius.md}px`,
38
+ };
39
+ }
40
+
41
+ export function cssVarsToString(vars: Record<string, string>): string {
42
+ return Object.entries(vars)
43
+ .map(([k, v]) => ` ${k}: ${v};`)
44
+ .join('\n');
45
+ }
46
+
47
+ export const defaultDesign: DesignSystem = {
48
+ palette: {
49
+ bg: '#f7f5f0',
50
+ text: '#1a1814',
51
+ accent: '#6d4cff',
52
+ },
53
+ fonts: {
54
+ display: 'Georgia, "Times New Roman", serif',
55
+ body: '-apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif',
56
+ },
57
+ typeScale: {
58
+ hero: 168,
59
+ body: 36,
60
+ },
61
+ radius: {
62
+ md: 12,
63
+ },
64
+ };
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { createElement } from 'react';
7
7
  import { createRoot } from 'react-dom/client';
8
- import { designToCssVars } from '../../design';
8
+ import { designToCssVars } from './design';
9
9
  import type { SlideModule } from './sdk';
10
10
 
11
11
  type AssetEntry = { name: string; bytes: Uint8Array };
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { createElement } from 'react';
7
7
  import { createRoot, type Root } from 'react-dom/client';
8
- import { designToCssVars } from '../../design';
8
+ import { designToCssVars } from './design';
9
9
  import { isFrameAnimationSettled, waitForDataWaitfor, waitForFonts } from './print-ready';
10
10
  import type { SlideModule } from './sdk';
11
11
 
@@ -1,5 +1,5 @@
1
1
  import type { ComponentType } from 'react';
2
- import type { DesignSystem } from '../../design.ts';
2
+ import type { DesignSystem } from './design.ts';
3
3
 
4
4
  export type Page = ComponentType;
5
5