@toonstrip/astro 0.1.0 → 0.1.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/README.md +71 -0
- package/package.json +16 -2
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# @toonstrip/astro
|
|
2
|
+
|
|
3
|
+
An Astro integration plus a `<ComicStrip>` component, wrapping
|
|
4
|
+
`@toonstrip/element`'s `<comic-strip>` custom element for use in Astro
|
|
5
|
+
sites/blogs.
|
|
6
|
+
|
|
7
|
+
Part of [toonstrip](https://github.com/dkdev24/toonstrip), a
|
|
8
|
+
framework-embeddable comic-strip renderer.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
npm install @toonstrip/astro @toonstrip/pack-comic-chat
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Setup
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
// astro.config.mjs
|
|
20
|
+
import { defineConfig } from "astro/config";
|
|
21
|
+
import toonstrip from "@toonstrip/astro";
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
integrations: [
|
|
25
|
+
toonstrip({ packs: ["@toonstrip/pack-comic-chat"] }),
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`packs` is a list of asset-pack **npm package specifiers** used anywhere in
|
|
31
|
+
the site. At `astro:config:setup`, each specifier is resolved, its
|
|
32
|
+
`pack.json` read, and `pack.json` + `characters/` + `backdrops/` copied into
|
|
33
|
+
`public/_toonstrip/<pack.json name>/`. A pack used by a page must be listed
|
|
34
|
+
here explicitly — there's no auto-discovery.
|
|
35
|
+
|
|
36
|
+
## Embedding a strip
|
|
37
|
+
|
|
38
|
+
```astro
|
|
39
|
+
---
|
|
40
|
+
import { ComicStrip } from "@toonstrip/astro";
|
|
41
|
+
import doc from "../content/my-strip.json";
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
<ComicStrip document={doc} packs={["comic-chat"]} client:visible />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- `document` — a `ComicStripDocument` (see
|
|
48
|
+
[`@toonstrip/schema`](https://www.npmjs.com/package/@toonstrip/schema)),
|
|
49
|
+
typically imported as JSON.
|
|
50
|
+
- `packs` — pack **names** here (the `pack.json` `name` field, e.g.
|
|
51
|
+
`"comic-chat"`), not the npm specifiers used in `astro.config.mjs`. Each
|
|
52
|
+
name resolves to the `/_toonstrip/<name>/` URL the integration copied that
|
|
53
|
+
pack to.
|
|
54
|
+
- `client:visible` is a standard Astro client directive — recommended so the
|
|
55
|
+
element's JS and its canvas rendering work don't load until the strip
|
|
56
|
+
scrolls into view, but any client directive works.
|
|
57
|
+
|
|
58
|
+
Server-side render emits only an inert placeholder tag — real rendering
|
|
59
|
+
needs a canvas context and only ever happens client-side, once the chosen
|
|
60
|
+
directive's condition fires.
|
|
61
|
+
|
|
62
|
+
## Worked example
|
|
63
|
+
|
|
64
|
+
See `examples/astro-blog` in the
|
|
65
|
+
[repo](https://github.com/dkdev24/toonstrip/tree/main/examples/astro-blog)
|
|
66
|
+
for a complete, runnable site. Full field reference:
|
|
67
|
+
[`docs/astro.md`](https://github.com/dkdev24/toonstrip/blob/main/docs/astro.md).
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toonstrip/astro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Astro integration and <ComicStrip> component for embedding toonstrip comic strips.",
|
|
4
5
|
"license": "MIT",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "./dist/index.js",
|
|
@@ -27,5 +28,18 @@
|
|
|
27
28
|
},
|
|
28
29
|
"publishConfig": {
|
|
29
30
|
"access": "public"
|
|
30
|
-
}
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"toonstrip",
|
|
34
|
+
"comic",
|
|
35
|
+
"astro",
|
|
36
|
+
"astro-integration"
|
|
37
|
+
],
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/dkdev24/toonstrip.git",
|
|
41
|
+
"directory": "packages/astro"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/dkdev24/toonstrip#readme",
|
|
44
|
+
"bugs": "https://github.com/dkdev24/toonstrip/issues"
|
|
31
45
|
}
|