@toonstrip/element 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +74 -0
  3. package/package.json +24 -10
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Daniel Kim
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 ADDED
@@ -0,0 +1,74 @@
1
+ # @toonstrip/element
2
+
3
+ `<comic-strip>` — a zero-framework-dependency custom element that renders a
4
+ `ComicStripDocument` (from `@toonstrip/schema`) as a live, responsive strip
5
+ of `<canvas>` panels, wrapping `@toonstrip/core`. Works in any framework, or
6
+ none.
7
+
8
+ Part of [toonstrip](https://github.com/dkdev24/toonstrip), a
9
+ framework-embeddable comic-strip renderer. Using Astro? See
10
+ [`@toonstrip/astro`](https://www.npmjs.com/package/@toonstrip/astro) for a
11
+ ready-made `<ComicStrip>` component instead.
12
+
13
+ ## Install
14
+
15
+ ```
16
+ npm install @toonstrip/element
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```html
22
+ <comic-strip id="strip"></comic-strip>
23
+
24
+ <script type="module">
25
+ import "@toonstrip/element";
26
+
27
+ const strip = document.getElementById("strip");
28
+ strip.packs = ["/packs/comic-chat/"]; // one or more asset-pack base URLs
29
+ strip.document = {
30
+ version: 1,
31
+ panels: [
32
+ {
33
+ backdrop: "pastoral",
34
+ camera: "establishing",
35
+ bodies: [{ character: "dan", emotion: { angle: 0, intensity: 0.6 } }],
36
+ speakers: [{ speaker: "caption", balloon: "caption", text: "A field outside town." }],
37
+ },
38
+ ],
39
+ };
40
+ </script>
41
+ ```
42
+
43
+ - `.packs` — array of asset-pack **base URLs**. Each must serve a
44
+ `pack.json` plus the `characters/`/`backdrops/` files it declares (fetched
45
+ over HTTP, not read from disk). Registering more than one pack that
46
+ declares the same character/backdrop id throws.
47
+ - `.document` — a `ComicStripDocument`, validated via `@toonstrip/schema` at
48
+ the boundary.
49
+ - `src="..."` attribute is also accepted as a convenience for fetching the
50
+ document JSON from a URL instead of setting `.document` directly.
51
+
52
+ ## Behavior
53
+
54
+ - One `<canvas>` per panel, laid out via `@toonstrip/core`'s `layoutStrip`
55
+ (3 columns wide, 2 mid-width, 1 narrow) and relaid live on
56
+ `ResizeObserver`.
57
+ - `devicePixelRatio`-aware backing store; `IntersectionObserver`-gated
58
+ painting (a panel scrolled off-screen isn't redrawn until visible again).
59
+ - Shadow DOM style isolation; each panel carries `role="img"` and a
60
+ generated `aria-label` describing its camera shot, room, and dialogue.
61
+ - Pose selection is frozen once per panel in document order, so a resize
62
+ repaint reproduces the same figures rather than re-rolling them.
63
+
64
+ ## Asset packs
65
+
66
+ Any `@toonstrip/pack-*` package (e.g.
67
+ [`@toonstrip/pack-comic-chat`](https://www.npmjs.com/package/@toonstrip/pack-comic-chat))
68
+ works, served as static files at the URL you pass to `.packs`. See
69
+ [`docs/packs.md`](https://github.com/dkdev24/toonstrip/blob/main/docs/packs.md)
70
+ in the repo for the pack contract and how to build your own.
71
+
72
+ ## License
73
+
74
+ MIT
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@toonstrip/element",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
+ "description": "<comic-strip>, a zero-framework-deps custom element for embedding toonstrip comic strips.",
4
5
  "license": "MIT",
5
6
  "type": "module",
6
7
  "main": "./dist/index.js",
@@ -8,15 +9,9 @@
8
9
  "files": [
9
10
  "dist"
10
11
  ],
11
- "scripts": {
12
- "build": "tsc -p tsconfig.json",
13
- "test": "vitest run",
14
- "lint": "tsc -p tsconfig.json --noEmit",
15
- "verify:demo": "node scripts/verify-demo.mjs"
16
- },
17
12
  "dependencies": {
18
- "@toonstrip/core": "workspace:*",
19
- "@toonstrip/schema": "workspace:*"
13
+ "@toonstrip/schema": "0.1.1",
14
+ "@toonstrip/core": "0.1.2"
20
15
  },
21
16
  "devDependencies": {
22
17
  "typescript": "^5.6.3",
@@ -27,5 +22,24 @@
27
22
  },
28
23
  "publishConfig": {
29
24
  "access": "public"
25
+ },
26
+ "keywords": [
27
+ "toonstrip",
28
+ "comic",
29
+ "custom-element",
30
+ "web-components"
31
+ ],
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/dkdev24/toonstrip.git",
35
+ "directory": "packages/element"
36
+ },
37
+ "homepage": "https://github.com/dkdev24/toonstrip#readme",
38
+ "bugs": "https://github.com/dkdev24/toonstrip/issues",
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json",
41
+ "test": "vitest run",
42
+ "lint": "tsc -p tsconfig.json --noEmit",
43
+ "verify:demo": "node scripts/verify-demo.mjs"
30
44
  }
31
- }
45
+ }