kei-lisp-plugin-graphics 2.0.0 → 3.0.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 CHANGED
@@ -19,9 +19,17 @@ interpreter. Register it on a `LispInterpreter` and call drawing primitives
19
19
  > are welcome, but external pull requests are generally **not accepted** —
20
20
  > see [CONTRIBUTING.md](./CONTRIBUTING.md).
21
21
 
22
+ ![Shapes and text drawn from Lisp source with kei-lisp-plugin-graphics](./docs/assets/basic-drawing.png)
23
+
24
+ _The canvas above is painted entirely from Lisp source. You can see this
25
+ program rendered in the
26
+ [**example page**](https://ike-keichan.github.io/kei-lisp-plugin-graphics/).
27
+ To write and run kei-lisp yourself, use
28
+ [**kei-lisp-web**](https://ike-keichan.github.io/kei-lisp-web/)._
29
+
22
30
  ## Features
23
31
 
24
- - 45 Canvas2D drawing primitives (`g…` symbols) callable directly from Lisp source
32
+ - 75 Canvas2D drawing primitives (`g…` symbols) callable directly from Lisp source
25
33
  - Works with `HTMLCanvasElement` and `OffscreenCanvas`
26
34
  - ESM and CommonJS dual output with TypeScript types
27
35
  - Zero runtime dependencies
@@ -29,8 +37,14 @@ interpreter. Register it on a `LispInterpreter` and call drawing primitives
29
37
  ## Installation
30
38
 
31
39
  ```sh
40
+ # npm
41
+ npm install kei-lisp-plugin-graphics kei-lisp
42
+
43
+ # yarn
44
+ yarn add kei-lisp-plugin-graphics kei-lisp
45
+
46
+ # pnpm
32
47
  pnpm add kei-lisp-plugin-graphics kei-lisp
33
- # or: npm install kei-lisp-plugin-graphics kei-lisp
34
48
  ```
35
49
 
36
50
  `kei-lisp` is a **peer dependency**; install both into your project. Requires
@@ -77,25 +91,41 @@ canvas's 2D rendering context.
77
91
 
78
92
  ## Provided Lisp functions
79
93
 
80
- | Category | Symbols |
81
- | -------------- | ------------------------------------------------------------------------------------------------------------------ |
82
- | Lifecycle | `gopen`, `gclose`, `gclear`, `gsleep` |
83
- | Path | `gstart-path`, `gfinish-path`, `gmove-to`, `gline-to`, `gquadcurve-to`, `gbezcurve-to`, `garc`, `garc-to`, `grect` |
84
- | Fill / stroke | `gfill`, `gstroke`, `gfill-rect`, `gstroke-rect`, `gfill-tri`, `gstroke-tri`, `gfill-text`, `gstroke-text` |
85
- | Style | `gcolor`, `gfill-color`, `gstroke-color`, `gline-width`, `gline-cap`, `gline-join`, `galpha`, `gpattern` |
86
- | Shadow | `gshadow-color`, `gshadow-blur`, `gshadow-offsetx`, `gshadow-offsety` |
87
- | Text | `gtext-font`, `gtext-align`, `gtext-line`, `gtext-dire` |
88
- | Transform | `gtranslate`, `gscale`, `grotate` |
89
- | State | `gsave`, `grestore` |
90
- | Image / export | `gimage`, `gsave-png`, `gsave-jpeg` |
94
+ | Category | Symbols |
95
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
96
+ | Lifecycle | `gopen`, `gclose`, `gclear`, `greset`, `gwidth`, `gheight`, `gsleep` |
97
+ | Path | `gstart-path`, `gfinish-path`, `gmove-to`, `gline-to`, `gquadcurve-to`, `gbezcurve-to`, `garc`, `garc-to`, `grect`, `ground-rect`, `gellipse`, `gclip`, `gis-point-in-path`, `gis-point-in-stroke` |
98
+ | Fill / stroke | `gfill`, `gstroke`, `gfill-rect`, `gstroke-rect`, `gfill-tri`, `gstroke-tri`, `gfill-text`, `gstroke-text` |
99
+ | Style | `gcolor`, `gfill-color`, `gstroke-color`, `gline-width`, `gline-cap`, `gline-join`, `gline-dash`, `gline-dash-offset`, `gmiter-limit`, `galpha`, `gpattern`, `gcomposite`, `gfilter`, `gimage-smoothing`, `glinear-gradient`, `gradial-gradient`, `gconic-gradient` |
100
+ | Shadow | `gshadow-color`, `gshadow-blur`, `gshadow-offsetx`, `gshadow-offsety` |
101
+ | Text | `gtext-font`, `gtext-align`, `gtext-baseline`, `gtext-direction`, `gmeasure-text`, `gletter-spacing`, `gword-spacing`, `gfont-kerning`, `gfont-stretch`, `gfont-variant`, `gtext-rendering` |
102
+ | Transform | `gtranslate`, `gscale`, `grotate`, `gtransform`, `gset-transform`, `greset-transform` |
103
+ | State | `gsave`, `grestore` |
104
+ | Image / export | `gimage`, `gsave-png`, `gsave-jpeg`, `gclear-rect`, `gpixel`, `gset-pixel` |
91
105
 
92
106
  Each function returns `t` on success. See [`docs/graphics.md`](./docs/graphics.md)
93
107
  for argument signatures and side effects.
94
108
 
109
+ ## Environment support
110
+
111
+ | Capability | Browser (`HTMLCanvasElement`) | `OffscreenCanvas` (worker) | Node.js (e.g. `@napi-rs/canvas`) |
112
+ | ------------------------------------- | -------------------------------------------------------- | -------------------------- | -------------------------------- |
113
+ | Drawing primitives (`g…`) | ✅ | ✅ | ✅ |
114
+ | `gimage` / `gpattern` (image loading) | ✅ | ⚠️ needs a global `Image` | ❌ returns `nil` |
115
+ | `gsave-png` / `gsave-jpeg` (download) | ✅ | ❌ returns `nil` | ❌ returns `nil` |
116
+ | `gsave-png` / `gsave-jpeg` (`path`) | ❌ returns `nil` | ⚠️ async `convertToBlob` | ✅ |
117
+ | Diagnostics | `console.error` (or host-provided `process.stderr` shim) | same | `process.stderr` |
118
+
95
119
  ## Reference
96
120
 
121
+ In-depth documentation of each area:
122
+
123
+ - [Example page](https://ike-keichan.github.io/kei-lisp-plugin-graphics/) — the examples rendered on GitHub Pages
124
+ - [kei-lisp-web](https://ike-keichan.github.io/kei-lisp-web/) — interactive kei-lisp playground
125
+ - [API docs (TypeDoc)](https://ike-keichan.github.io/kei-lisp-plugin-graphics/api/) — generated API documentation
97
126
  - [API Reference](./docs/api.md) — TypeScript / JavaScript API
98
127
  - [Graphics Reference](./docs/graphics.md) — every `g…` Lisp function
128
+ - [Non-goals](./docs/non-goals.md) — what this project deliberately does not do
99
129
  - [kei-lisp Plugin Guide](https://github.com/ike-keichan/kei-lisp/blob/main/docs/plugins.md) — how plugins integrate with the interpreter
100
130
 
101
131
  ## Development
@@ -109,13 +139,16 @@ pnpm install
109
139
  Requires [pnpm](https://pnpm.io/) and Node.js 24+
110
140
  (see [`.node-version`](./.node-version) for the exact version).
111
141
 
112
- | Command | Description |
113
- | ----------------- | ------------------------------------------ |
114
- | `pnpm build` | Build for distribution (CJS + ESM + types) |
115
- | `pnpm test` | Run tests |
116
- | `pnpm test:watch` | Run tests in watch mode |
117
- | `pnpm check` | Run all checks (format, lint, spell, ...) |
118
- | `pnpm fix` | Auto-fix format and lint issues |
142
+ | Command | Description |
143
+ | -------------------- | ----------------------------------------- |
144
+ | `pnpm build` | Build for distribution |
145
+ | `pnpm test` | Run tests |
146
+ | `pnpm test:coverage` | Run tests with coverage thresholds |
147
+ | `pnpm test:watch` | Run tests in watch mode |
148
+ | `pnpm e2e` | Browser E2E (Playwright + Chromium) |
149
+ | `pnpm screenshot` | Regenerate the README screenshot |
150
+ | `pnpm check` | Run all checks (format, lint, spell, ...) |
151
+ | `pnpm fix` | Auto-fix format and lint issues |
119
152
 
120
153
  See [CONTRIBUTING.md](./CONTRIBUTING.md) for the branch policy and PR flow.
121
154