@byfungsi/lipat 0.0.0-stage → 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lipat contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,155 @@
1
- # Temporary Holding Version
1
+ # Lipat
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An agent-friendly slide authoring engine with an independent PPTX parser and exporter. Create slides from semantic JSON, TypeScript presets or Markdown; edit by stable IDs; compile into a shared scene for preview and export. The portable Rust core runs natively and as real WebAssembly in browsers and Node.
4
+
5
+ Inspired by [Nori](https://github.com/byfungsi/nori)'s headless model/runtime/adapters and [reveal.js](https://github.com/hakimel/reveal.js)'s declarative presentation flow. Lipat's primary source is an abstract authoring document. PPTX is a separate file adapter.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ npm install @byfungsi/lipat
11
+ # Add React only when using @byfungsi/lipat/react:
12
+ npm install react react-dom
13
+ ```
14
+
15
+ [Documentation](https://byfungsi.github.io/lipat/) · [Playground](https://byfungsi.github.io/lipat/playground.html) · [GitHub](https://github.com/byfungsi/lipat) · [npm](https://www.npmjs.com/package/@byfungsi/lipat)
16
+
17
+ ## Run locally
18
+
19
+ Requires Node 22.12+, npm, stable Rust and the WASM target:
20
+
21
+ ```sh
22
+ rustup target add wasm32-unknown-unknown
23
+ npm ci
24
+ npm run verify
25
+ npm run dev
26
+ ```
27
+
28
+ `npm run dev` builds the package and prints the Vite URL. The demo includes semantic editing, drag/resize and keyboard nudges, history, source JSON, Markdown/PPTX upload, presentation playback, an agent edit and a read-only attachment preview. The library ships no global CSS. Choose **Animation sample** to try fade, rise, slide and zoom, or [open it directly](https://byfungsi.github.io/lipat/playground/index.html?sample=animations).
29
+
30
+ ## Create and edit
31
+
32
+ The host loads the bundled WASM bytes explicitly. Importing the library performs no file access, network access or engine initialization.
33
+
34
+ ```ts
35
+ import {
36
+ createLipat,
37
+ createDeck,
38
+ createTitleSlide,
39
+ createComparisonSlide,
40
+ } from "@byfungsi/lipat";
41
+
42
+ // Browser: fetch a URL emitted by your bundler for @byfungsi/lipat/lipat.wasm.
43
+ // Node: readFileSync(import.meta.resolve('@byfungsi/lipat/lipat.wasm')) via fileURLToPath.
44
+ const initialized = createLipat(wasmBytes);
45
+ if (!initialized.ok) throw new Error(initialized.error.message);
46
+ const engine = initialized.value;
47
+
48
+ const created = createDeck(
49
+ {
50
+ id: "launch",
51
+ title: "A better workflow",
52
+ slides: [
53
+ createTitleSlide({
54
+ id: "intro",
55
+ title: "Make room for better ideas",
56
+ subtitle: "An introduction to Lipat",
57
+ }),
58
+ createComparisonSlide({
59
+ id: "compare",
60
+ title: "What changes?",
61
+ columns: [
62
+ { title: "Today", body: "Position every element manually." },
63
+ { title: "Tomorrow", body: "Describe content and layout intent." },
64
+ ],
65
+ }),
66
+ ],
67
+ },
68
+ { engine },
69
+ );
70
+ if (!created.ok) throw new Error(created.error.message);
71
+ const deck = created.value;
72
+
73
+ const result = deck.apply(
74
+ [
75
+ {
76
+ type: "updateText",
77
+ nodeId: "intro-title",
78
+ text: "Fold your next idea into a story",
79
+ },
80
+ ],
81
+ { expectedRevision: deck.getState().revision },
82
+ );
83
+ if (!result.ok) console.error(result.error);
84
+ const compiled = deck.compile(); // { scene, diagnostics } inside a Result
85
+ ```
86
+
87
+ Expected failures use `{ ok: true, value } | { ok: false, error }`. Handle results at your application boundary. Examples throw only to terminate their setup when they cannot proceed.
88
+
89
+ ## Independent PPTX flow
90
+
91
+ ```ts
92
+ import { parsePptx, writePptx } from "@byfungsi/lipat/pptx";
93
+
94
+ const imported = parsePptx(bytes, { engine });
95
+ if (imported.ok) {
96
+ // Preview or export the imported scene without creating an authoring runtime.
97
+ console.log(imported.value.scene, imported.value.diagnostics);
98
+ const exported = writePptx(imported.value.scene, { engine });
99
+ // Explicit conversion retains imported positioning as editable canvas nodes.
100
+ const document = engine.importScene(imported.value.scene);
101
+ }
102
+ ```
103
+
104
+ Parsing does not infer that positioned objects form a semantic comparison, title or grid. Agents can explicitly replace imported canvas content with higher-level layouts. Export produces a canonical PPTX; arbitrary original XML parts are not preserved.
105
+
106
+ ## Agent loop
107
+
108
+ ```ts
109
+ import { createAgentTools, deckSchemas } from "@byfungsi/lipat/agent";
110
+ const agentTools = createAgentTools(deck, { engine });
111
+ // Register agentTools.tools with your preferred framework.
112
+ // Route calls to agentTools.execute(name, arguments).
113
+ ```
114
+
115
+ Five provider-neutral tools implement inspect → edit → compile → preview → export. Edit calls require an expected revision and return compact updated outlines. Tool and document schemas are generated from the same Rust types used to execute operations. No LLM provider, API key, server or MCP transport is required. See [agent authoring](docs/agents.md).
116
+
117
+ ## Public entrypoints
118
+
119
+ | Import | Responsibility |
120
+ | ----------------- | ---------------------------------------------------------------------- |
121
+ | `@byfungsi/lipat` | WASM initialization, creation, presets, common types and PPTX helpers |
122
+ | `/model` | Portable document, scene, operation and diagnostic contracts |
123
+ | `/core` | Runtime, history, subscriptions, presets and Markdown authoring |
124
+ | `/pptx` | Independent PPTX byte adapter |
125
+ | `/wasm` | Explicit Rust engine initialization |
126
+ | `/render` | Headless SVG and self-contained HTML output |
127
+ | `/motion` | Optional Motion browser playback adapter (install `motion` separately) |
128
+ | `/react` | Provider, hooks, canvas, inspector, editor, preview and player |
129
+ | `/agent` | Tool definitions, execution and generated JSON schemas |
130
+ | `/reveal` | Optional reveal.js-compatible markup and synchronization |
131
+ | `/lipat.wasm` | Bundled binary asset, emitted/copied by the host's bundler |
132
+
133
+ ESM and TypeScript declarations are supplied. React 18.3/19 and Motion 14.6+ are optional peers isolated to `/react` and `/motion`. The npm package has no runtime JavaScript dependencies. Source releases and documentation are published from the byfungsi/lipat repository.
134
+
135
+ ## Architecture and compatibility
136
+
137
+ Read [architecture](docs/architecture.md), [creation](docs/creation.md), [API](docs/api.md), [WASM and native usage](docs/wasm.md), [support and Nori parity](docs/support.md), [React](docs/react.md), [import/export](docs/pptx.md), and [verification](docs/verification.md).
138
+
139
+ Flow layout uses deterministic font metrics. Defaults are approximate and reported as diagnostics; supply measured glyph widths for accurate wrapping. Browser font rasterization can differ from the compiler. Supported PPTX content includes ordinary text/runs, basic shapes, raster images, simple tables, notes, slide ordering and inherited placeholder geometry. Browser entrance effects are available through the optional [Motion adapter](docs/animations.md). Charts, SmartArt, media, native PPTX animations and arbitrary lossless PPTX rewriting are outside this version. Import/export warnings make these boundaries visible.
140
+
141
+ ## Native Rust
142
+
143
+ ```rust
144
+ let document: lipat_model::DeckDocument = serde_json::from_str(source)?;
145
+ let compiled = lipat_layout::compile_document(&document, &Default::default());
146
+ let imported = lipat_pptx::parse_pptx(&bytes);
147
+ ```
148
+
149
+ Workspace crates are path dependencies until published. `cargo run -p lipat-wasm --bin lipat-native` exposes the same JSON request protocol as WASM on stdin/stdout. See [native usage](docs/wasm.md).
150
+
151
+ ## Verification
152
+
153
+ `npm run verify` checks dependency boundaries, strict/headless TypeScript, behavioral/property/React tests through the real WASM engine, native Rust tests, native/WASM equivalence, builds, an isolated packed npm consumer, optional React/SSR isolation and documentation generation/build.
154
+
155
+ `npm run verify:browser` exercises the built demo in a real Chromium browser. `npm run verify:interop` independently opens exported PPTX with python-pptx after installing `scripts/requirements-interop.txt`. CI runs these extra checks too.