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/dist/index.d.ts CHANGED
@@ -5,23 +5,17 @@ import { Cons, InterpretedSymbol, KeiLispPlugin, LispValue, PluginContext } from
5
5
  * @class
6
6
  * @classdesc Canvas2D drawing plugin for the kei-lisp interpreter. Implements
7
7
  * the `KeiLispPlugin` contract (`name` / `has` / `apply`) and
8
- * exposes 45 `g…` Lisp functions that proxy to a 2D rendering
9
- * context.
8
+ * exposes 75 `g…` Lisp functions (plus two deprecated aliases)
9
+ * that proxy to a 2D rendering context.
10
10
  * @author Keisuke Ikeda
11
- * @this {GraphicsPlugin}
12
11
  */
13
- declare class GraphicsPlugin extends Object implements KeiLispPlugin {
12
+ declare class GraphicsPlugin implements KeiLispPlugin {
14
13
  #private;
15
14
  /**
16
- * Dispatch map from a Lisp function name (InterpretedSymbol) to the name of
17
- * the GraphicsPlugin method that implements it.
15
+ * Lists every Lisp function name this plugin registers.
16
+ * @return the sorted `g…` function names
18
17
  */
19
- static readonly buildInFunctions: Map<InterpretedSymbol, string>;
20
- /**
21
- * Builds the dispatch table.
22
- * @return the dispatch table
23
- */
24
- static setup(): Map<InterpretedSymbol, string>;
18
+ static functionNames(): string[];
25
19
  /**
26
20
  * Plugin identifier, used for diagnostics.
27
21
  */
@@ -49,28 +43,10 @@ declare class GraphicsPlugin extends Object implements KeiLispPlugin {
49
43
  * @return the method's result, or `Cons.nil` if dispatch fails
50
44
  */
51
45
  apply(aSymbol: InterpretedSymbol, arguments_: Cons, _context: PluginContext): LispValue;
52
- /**
53
- * Resolves the procedure name and invokes the matching method.
54
- * @param procedure - the Lisp symbol
55
- * @param arguments_ - the evaluated argument list
56
- * @return the method's result, or `Cons.nil` if not registered
57
- */
58
- selectProcedure(procedure: InterpretedSymbol, arguments_: Cons): LispValue;
59
- /**
60
- * Looks up and invokes the JS method that implements the given Lisp symbol.
61
- * Throws `TypeError` when the dispatch table points to a method that does
62
- * not exist on the instance — this matches the legacy behavior, where the
63
- * Ramda `R.invoker(1, methodName)(args, this)` call would surface the same
64
- * error by attempting to call `undefined`.
65
- * @param procedure - the Lisp symbol
66
- * @param arguments_ - the evaluated argument list
67
- * @return the method's result
68
- */
69
- buildInFunction(procedure: InterpretedSymbol, arguments_: Cons): LispValue;
70
46
  /**
71
47
  * Checks whether the canvas exposes a usable 2D context, and narrows
72
48
  * `this.ctx` to non-null for the caller when it returns true.
73
- * @return type predicate — true when ctx is non-null
49
+ * @return type predicate — true when context is non-null
74
50
  */
75
51
  checkSupport(): this is GraphicsPlugin & {
76
52
  ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
@@ -79,7 +55,7 @@ declare class GraphicsPlugin extends Object implements KeiLispPlugin {
79
55
  gArc(arguments_: Cons): LispValue;
80
56
  gArcTo(arguments_: Cons): LispValue;
81
57
  gBezCurveTo(arguments_: Cons): LispValue;
82
- gClear(): LispValue;
58
+ gClear(arguments_: Cons): LispValue;
83
59
  gClose(): LispValue;
84
60
  gColor(arguments_: Cons): LispValue;
85
61
  gFill(): LispValue;
@@ -131,7 +107,7 @@ declare class GraphicsPlugin extends Object implements KeiLispPlugin {
131
107
  /**
132
108
  * Pushes the current drawing state (styles, transform, clip) onto the
133
109
  * context's state stack. Pairs with `gRestore` to let Lisp callers manage
134
- * state explicitly. Replaces the legacy per-method `ctx.save()` calls, which
110
+ * state explicitly. Replaces the legacy per-method `context.save()` calls, which
135
111
  * pushed state on every draw with no matching `restore()` and grew the stack
136
112
  * unbounded.
137
113
  * @return `t` on success, `Cons.nil` otherwise
@@ -143,6 +119,36 @@ declare class GraphicsPlugin extends Object implements KeiLispPlugin {
143
119
  * @return `t` on success, `Cons.nil` otherwise
144
120
  */
145
121
  gRestore(): LispValue;
122
+ gEllipse(arguments_: Cons): LispValue;
123
+ gRoundRect(arguments_: Cons): LispValue;
124
+ gLineDash(arguments_: Cons): LispValue;
125
+ gLineDashOffset(arguments_: Cons): LispValue;
126
+ gMiterLimit(arguments_: Cons): LispValue;
127
+ gClip(): LispValue;
128
+ gIsPointInPath(arguments_: Cons): LispValue;
129
+ gIsPointInStroke(arguments_: Cons): LispValue;
130
+ gTransform(arguments_: Cons): LispValue;
131
+ gSetTransform(arguments_: Cons): LispValue;
132
+ gResetTransform(): LispValue;
133
+ gComposite(arguments_: Cons): LispValue;
134
+ gFilter(arguments_: Cons): LispValue;
135
+ gImageSmoothing(arguments_: Cons): LispValue;
136
+ gMeasureText(arguments_: Cons): LispValue;
137
+ gLetterSpacing(arguments_: Cons): LispValue;
138
+ gWordSpacing(arguments_: Cons): LispValue;
139
+ gFontKerning(arguments_: Cons): LispValue;
140
+ gFontStretch(arguments_: Cons): LispValue;
141
+ gFontVariant(arguments_: Cons): LispValue;
142
+ gTextRendering(arguments_: Cons): LispValue;
143
+ gClearRect(arguments_: Cons): LispValue;
144
+ gReset(): LispValue;
145
+ gWidth(): LispValue;
146
+ gHeight(): LispValue;
147
+ gPixel(arguments_: Cons): LispValue;
148
+ gSetPixel(arguments_: Cons): LispValue;
149
+ gLinearGradient(arguments_: Cons): LispValue;
150
+ gRadialGradient(arguments_: Cons): LispValue;
151
+ gConicGradient(arguments_: Cons): LispValue;
146
152
  /**
147
153
  * Parses a color spec from the head of the argument Cons. Accepts
148
154
  * (1 string), (3 numbers — rgb), or (4 numbers — rgba); falls back to