@particle-academy/fancy-slides 0.1.3

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 ADDED
@@ -0,0 +1,99 @@
1
+ # @particle-academy/fancy-slides
2
+
3
+ Presentation editor + web viewer for the Fancy UI set. Google-Slides-style deck
4
+ authoring with a JSON-friendly schema, full keyboard-driven viewer, and an agent
5
+ bridge so LLMs can compose decks directly.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @particle-academy/fancy-slides @particle-academy/react-fancy
11
+ ```
12
+
13
+ Optional peers (only needed if your decks include those element types):
14
+
15
+ ```bash
16
+ npm install @particle-academy/fancy-echarts # ChartElement
17
+ npm install @particle-academy/fancy-code # CodeElement
18
+ ```
19
+
20
+ ## Quickstart — viewer
21
+
22
+ ```tsx
23
+ import { SlideViewer } from "@particle-academy/fancy-slides";
24
+ import "@particle-academy/fancy-slides/styles.css";
25
+
26
+ const deck = {
27
+ id: "demo",
28
+ title: "Welcome",
29
+ slides: [
30
+ {
31
+ id: "s1",
32
+ layout: "title",
33
+ elements: [
34
+ {
35
+ id: "e1",
36
+ type: "text",
37
+ x: 0.1, y: 0.4, w: 0.8, h: 0.2,
38
+ content: "Welcome to Fancy Slides",
39
+ style: { fontSize: 48, weight: "bold", align: "center" },
40
+ },
41
+ ],
42
+ },
43
+ ],
44
+ theme: { name: "default" },
45
+ };
46
+
47
+ <SlideViewer deck={deck} />
48
+ ```
49
+
50
+ ## Quickstart — editor
51
+
52
+ ```tsx
53
+ import { DeckEditor } from "@particle-academy/fancy-slides";
54
+
55
+ function App() {
56
+ const [deck, setDeck] = useState(initialDeck);
57
+ return <DeckEditor value={deck} onChange={setDeck} />;
58
+ }
59
+ ```
60
+
61
+ ## Human+ contract
62
+
63
+ `fancy-slides` is designed around the Human+ contract: humans and agents share
64
+ the same surface. The deck is plain JSON — easy for an LLM to emit. Every
65
+ slide and element has a stable `id`. State is controlled. An agent bridge
66
+ exposes MCP tools (`deck_add_slide`, `slide_add_element`,
67
+ `slide_set_layout`, `deck_apply_theme`, …) so agents drive the deck via the
68
+ same operations a human would.
69
+
70
+ See `docs/human-plus.md` for the full contract.
71
+
72
+ ## Element types
73
+
74
+ | Type | Renders via | Notes |
75
+ |----------|--------------------------------------------|-------|
76
+ | `text` | inline contenteditable (or react-fancy `Editor`) | rich text, markdown |
77
+ | `image` | `<img>` | URL or data URI |
78
+ | `chart` | `@particle-academy/fancy-echarts` `<EChart>` | optional peer |
79
+ | `code` | `@particle-academy/fancy-code` `<CodeEditor>` | optional peer |
80
+ | `table` | react-fancy `<Table>` | |
81
+ | `shape` | SVG primitives (rect, ellipse, line, arrow) | |
82
+ | `embed` | iframe | for video / external |
83
+
84
+ ## Theme
85
+
86
+ ```ts
87
+ type Theme = {
88
+ name: string;
89
+ colors: { background, text, accent, muted };
90
+ fonts: { heading, body, mono };
91
+ slideRatio: 16 / 9;
92
+ };
93
+ ```
94
+
95
+ A few built-in themes ship; consumers can register their own.
96
+
97
+ ## License
98
+
99
+ MIT
@@ -0,0 +1,11 @@
1
+ import { EChart } from '@particle-academy/fancy-echarts';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ // src/registry/element-renderers/chart-host.tsx
5
+ function ChartHost({ element }) {
6
+ return /* @__PURE__ */ jsx("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsx(EChart, { option: element.option, theme: element.chartTheme }) });
7
+ }
8
+
9
+ export { ChartHost as default };
10
+ //# sourceMappingURL=chart-host-VIGM3J5Q.js.map
11
+ //# sourceMappingURL=chart-host-VIGM3J5Q.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/registry/element-renderers/chart-host.tsx"],"names":[],"mappings":";;;;AAGe,SAAR,SAAA,CAA2B,EAAE,OAAA,EAAQ,EAAoD;AAC5F,EAAA,2BACK,KAAA,EAAA,EAAI,KAAA,EAAO,EAAE,KAAA,EAAO,QAAQ,MAAA,EAAQ,MAAA,EAAO,EACxC,QAAA,kBAAA,GAAA,CAAC,UAAO,MAAA,EAAQ,OAAA,CAAQ,QAAkD,KAAA,EAAO,OAAA,CAAQ,YAAY,CAAA,EACzG,CAAA;AAER","file":"chart-host-VIGM3J5Q.js","sourcesContent":["import { EChart } from \"@particle-academy/fancy-echarts\";\nimport type { ChartElement } from \"../../types\";\n\nexport default function ChartHost({ element }: { element: ChartElement; slideWidthPx: number }) {\n return (\n <div style={{ width: \"100%\", height: \"100%\" }}>\n <EChart option={element.option as Parameters<typeof EChart>[0][\"option\"]} theme={element.chartTheme} />\n </div>\n );\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { CodeEditor } from '@particle-academy/fancy-code';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ // src/registry/element-renderers/code-host.tsx
5
+ function CodeHost({ element }) {
6
+ return /* @__PURE__ */ jsx("div", { style: { width: "100%", height: "100%", overflow: "hidden", borderRadius: 8 }, children: /* @__PURE__ */ jsx(
7
+ CodeEditor,
8
+ {
9
+ value: element.code,
10
+ language: element.language ?? "javascript",
11
+ theme: element.codeTheme ?? "dark",
12
+ readOnly: true,
13
+ lineNumbers: element.lineNumbers ?? true,
14
+ children: /* @__PURE__ */ jsx(CodeEditor.Panel, {})
15
+ }
16
+ ) });
17
+ }
18
+
19
+ export { CodeHost as default };
20
+ //# sourceMappingURL=code-host-IYT6QDLA.js.map
21
+ //# sourceMappingURL=code-host-IYT6QDLA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/registry/element-renderers/code-host.tsx"],"names":[],"mappings":";;;;AAGe,SAAR,QAAA,CAA0B,EAAE,OAAA,EAAQ,EAA6B;AACpE,EAAA,uBACI,GAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAO,EAAE,KAAA,EAAO,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,QAAA,EAAU,QAAA,EAAU,YAAA,EAAc,CAAA,EAAE,EAC7E,QAAA,kBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACG,OAAO,OAAA,CAAQ,IAAA;AAAA,MACf,QAAA,EAAU,QAAQ,QAAA,IAAY,YAAA;AAAA,MAC9B,KAAA,EAAO,QAAQ,SAAA,IAAa,MAAA;AAAA,MAC5B,QAAA,EAAQ,IAAA;AAAA,MACR,WAAA,EAAa,QAAQ,WAAA,IAAe,IAAA;AAAA,MAEpC,QAAA,kBAAA,GAAA,CAAC,UAAA,CAAW,KAAA,EAAX,EAAiB;AAAA;AAAA,GACtB,EACJ,CAAA;AAER","file":"code-host-IYT6QDLA.js","sourcesContent":["import { CodeEditor } from \"@particle-academy/fancy-code\";\nimport type { CodeElement } from \"../../types\";\n\nexport default function CodeHost({ element }: { element: CodeElement }) {\n return (\n <div style={{ width: \"100%\", height: \"100%\", overflow: \"hidden\", borderRadius: 8 }}>\n <CodeEditor\n value={element.code}\n language={element.language ?? \"javascript\"}\n theme={element.codeTheme ?? \"dark\"}\n readOnly\n lineNumbers={element.lineNumbers ?? true}\n >\n <CodeEditor.Panel />\n </CodeEditor>\n </div>\n );\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+
3
+ // src/registry/element-renderers/embed-host.tsx
4
+ function EmbedHost({ element }) {
5
+ return /* @__PURE__ */ jsx(
6
+ "iframe",
7
+ {
8
+ src: element.src,
9
+ title: element.title ?? "Embedded content",
10
+ sandbox: element.sandbox ?? "allow-scripts",
11
+ style: { width: "100%", height: "100%", border: 0, display: "block" }
12
+ }
13
+ );
14
+ }
15
+
16
+ export { EmbedHost as default };
17
+ //# sourceMappingURL=embed-host-ZECUEAOU.js.map
18
+ //# sourceMappingURL=embed-host-ZECUEAOU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/registry/element-renderers/embed-host.tsx"],"names":[],"mappings":";;;AAEe,SAAR,SAAA,CAA2B,EAAE,OAAA,EAAQ,EAA8B;AACtE,EAAA,uBACI,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACG,KAAK,OAAA,CAAQ,GAAA;AAAA,MACb,KAAA,EAAO,QAAQ,KAAA,IAAS,kBAAA;AAAA,MACxB,OAAA,EAAS,QAAQ,OAAA,IAAW,eAAA;AAAA,MAC5B,KAAA,EAAO,EAAE,KAAA,EAAO,MAAA,EAAQ,QAAQ,MAAA,EAAQ,MAAA,EAAQ,CAAA,EAAG,OAAA,EAAS,OAAA;AAAQ;AAAA,GACxE;AAER","file":"embed-host-ZECUEAOU.js","sourcesContent":["import type { EmbedElement } from \"../../types\";\n\nexport default function EmbedHost({ element }: { element: EmbedElement }) {\n return (\n <iframe\n src={element.src}\n title={element.title ?? \"Embedded content\"}\n sandbox={element.sandbox ?? \"allow-scripts\"}\n style={{ width: \"100%\", height: \"100%\", border: 0, display: \"block\" }}\n />\n );\n}\n"]}