@sarmal/core 0.13.0 → 0.15.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/dist/auto-init.cjs +172 -53
- package/dist/auto-init.cjs.map +1 -1
- package/dist/auto-init.js +172 -53
- package/dist/auto-init.js.map +1 -1
- package/dist/curves/artemis2.d.cts +1 -1
- package/dist/curves/artemis2.d.ts +1 -1
- package/dist/curves/astroid.d.cts +1 -1
- package/dist/curves/astroid.d.ts +1 -1
- package/dist/curves/deltoid.d.cts +1 -1
- package/dist/curves/deltoid.d.ts +1 -1
- package/dist/curves/epicycloid3.d.cts +1 -1
- package/dist/curves/epicycloid3.d.ts +1 -1
- package/dist/curves/epitrochoid7.d.cts +1 -1
- package/dist/curves/epitrochoid7.d.ts +1 -1
- package/dist/curves/index.d.cts +1 -1
- package/dist/curves/index.d.ts +1 -1
- package/dist/curves/lame.d.cts +1 -1
- package/dist/curves/lame.d.ts +1 -1
- package/dist/curves/lissajous32.d.cts +1 -1
- package/dist/curves/lissajous32.d.ts +1 -1
- package/dist/curves/lissajous43.d.cts +1 -1
- package/dist/curves/lissajous43.d.ts +1 -1
- package/dist/curves/rose3.d.cts +1 -1
- package/dist/curves/rose3.d.ts +1 -1
- package/dist/curves/rose5.d.cts +1 -1
- package/dist/curves/rose5.d.ts +1 -1
- package/dist/index.cjs +246 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -5
- package/dist/index.d.ts +20 -5
- package/dist/index.js +246 -58
- package/dist/index.js.map +1 -1
- package/dist/{types-BW0bpL1Z.d.cts → types-BL9HhEmk.d.cts} +43 -21
- package/dist/{types-BW0bpL1Z.d.ts → types-BL9HhEmk.d.ts} +43 -21
- package/package.json +1 -1
|
@@ -7,10 +7,8 @@ interface CurveDef {
|
|
|
7
7
|
/**
|
|
8
8
|
* The parametric function that defines the curve shape.
|
|
9
9
|
* @param t Current position along the curve, in [0, period)
|
|
10
|
-
* @param time Elapsed
|
|
11
|
-
* @param params Named parameter overrides.
|
|
12
|
-
* Always `{}` today — reserved for the upcoming parameterized-curves feature.
|
|
13
|
-
* Do NOT remove this parameter; it is intentional forward-compatible plumbing.
|
|
10
|
+
* @param time Elapsed actual time in seconds. It is always increasing, and never resets on period wrap
|
|
11
|
+
* @param params Named parameter overrides. intentional forward-compatible parameter
|
|
14
12
|
*/
|
|
15
13
|
fn: (t: number, time: number, params: Record<string, number>) => Point;
|
|
16
14
|
/**
|
|
@@ -218,12 +216,39 @@ interface SarmalInstance extends AnimationControls {
|
|
|
218
216
|
* @returns Promise that resolves when the morph is complete
|
|
219
217
|
*/
|
|
220
218
|
morphTo(target: CurveDef, options?: MorphOptions): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Changes render options on a live SarmalInstance without destroying and recreating it.
|
|
221
|
+
*
|
|
222
|
+
* ! Validation fails the operation completely if any of the fields fail the chceck.
|
|
223
|
+
*/
|
|
224
|
+
setRenderOptions(partial: RuntimeRenderOptions): void;
|
|
221
225
|
}
|
|
222
226
|
/**
|
|
223
227
|
* With 'gradient-animated' the colors cycle along the trail over time
|
|
224
228
|
*/
|
|
225
229
|
type TrailStyle = "default" | "gradient-static" | "gradient-animated";
|
|
226
|
-
|
|
230
|
+
/**
|
|
231
|
+
* The value must be a single hex string or an array of hex strings.
|
|
232
|
+
*
|
|
233
|
+
* ! Named colors, shorthand hex, `rgb()`, and `hsl()` notations are not yet supported.
|
|
234
|
+
*/
|
|
235
|
+
type TrailColor = string | string[];
|
|
236
|
+
/**
|
|
237
|
+
* Runtime-renderable options that can be changed on a live instance without destroying and recreating it.
|
|
238
|
+
*
|
|
239
|
+
* Passing `null` for `headColor`makes the head color derive its color from the current `trailColor` and `trailStyle`
|
|
240
|
+
* Passing a hex string locks the head color until overridden.
|
|
241
|
+
*
|
|
242
|
+
* Passing `"transparent"` for `skeletonColor` hides the skeleton. Any other value must be a valid {@link TrailColor}.
|
|
243
|
+
*/
|
|
244
|
+
interface RuntimeRenderOptions {
|
|
245
|
+
trailColor?: TrailColor;
|
|
246
|
+
/** 6-digit hex string to override, or `null` to make it automatic */
|
|
247
|
+
headColor?: string | null;
|
|
248
|
+
/** 6-digit hex string, or `"transparent"` to hide the skeleton. */
|
|
249
|
+
skeletonColor?: string;
|
|
250
|
+
trailStyle?: TrailStyle;
|
|
251
|
+
}
|
|
227
252
|
/**
|
|
228
253
|
* Common renderer options shared between canvas and SVG renderers.
|
|
229
254
|
* Extracted to avoid duplication and ensure consistency.
|
|
@@ -244,31 +269,27 @@ interface BaseRendererOptions {
|
|
|
244
269
|
*/
|
|
245
270
|
skeletonColor?: string;
|
|
246
271
|
/**
|
|
272
|
+
* Single hex color for default trails, or an array of hex colors for gradient trails.
|
|
247
273
|
* @default '#ffffff'
|
|
248
274
|
*/
|
|
249
|
-
trailColor?:
|
|
275
|
+
trailColor?: TrailColor;
|
|
250
276
|
/**
|
|
251
|
-
*
|
|
277
|
+
* Hex color for the head dot.
|
|
278
|
+
* If omitted, the color is derived from the trail
|
|
252
279
|
*/
|
|
253
280
|
headColor?: string;
|
|
254
281
|
/** @default 4 */
|
|
255
282
|
headRadius?: number;
|
|
256
|
-
}
|
|
257
|
-
interface RendererOptions extends BaseRendererOptions {
|
|
258
|
-
/** Target canvas element that will contain the Sarmal */
|
|
259
|
-
canvas: HTMLCanvasElement;
|
|
260
|
-
engine: Engine;
|
|
261
283
|
/**
|
|
262
284
|
* Trail rendering style
|
|
263
285
|
* @default 'default'
|
|
264
286
|
*/
|
|
265
287
|
trailStyle?: TrailStyle;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
palette?: PalettePreset | string[];
|
|
288
|
+
}
|
|
289
|
+
interface RendererOptions extends BaseRendererOptions {
|
|
290
|
+
/** Target canvas element that will contain the Sarmal */
|
|
291
|
+
canvas: HTMLCanvasElement;
|
|
292
|
+
engine: Engine;
|
|
272
293
|
}
|
|
273
294
|
interface SarmalOptions extends Omit<RendererOptions, "canvas" | "engine"> {
|
|
274
295
|
/** @default 120 */
|
|
@@ -280,11 +301,12 @@ export type {
|
|
|
280
301
|
CurveDef as C,
|
|
281
302
|
Engine as E,
|
|
282
303
|
JumpOptions as J,
|
|
283
|
-
|
|
304
|
+
Point as P,
|
|
284
305
|
RendererOptions as R,
|
|
285
306
|
SarmalInstance as S,
|
|
286
|
-
|
|
307
|
+
TrailColor as T,
|
|
287
308
|
SarmalOptions as a,
|
|
288
|
-
|
|
309
|
+
RuntimeRenderOptions as b,
|
|
289
310
|
SeekOptions as c,
|
|
311
|
+
TrailStyle as d,
|
|
290
312
|
};
|
|
@@ -7,10 +7,8 @@ interface CurveDef {
|
|
|
7
7
|
/**
|
|
8
8
|
* The parametric function that defines the curve shape.
|
|
9
9
|
* @param t Current position along the curve, in [0, period)
|
|
10
|
-
* @param time Elapsed
|
|
11
|
-
* @param params Named parameter overrides.
|
|
12
|
-
* Always `{}` today — reserved for the upcoming parameterized-curves feature.
|
|
13
|
-
* Do NOT remove this parameter; it is intentional forward-compatible plumbing.
|
|
10
|
+
* @param time Elapsed actual time in seconds. It is always increasing, and never resets on period wrap
|
|
11
|
+
* @param params Named parameter overrides. intentional forward-compatible parameter
|
|
14
12
|
*/
|
|
15
13
|
fn: (t: number, time: number, params: Record<string, number>) => Point;
|
|
16
14
|
/**
|
|
@@ -218,12 +216,39 @@ interface SarmalInstance extends AnimationControls {
|
|
|
218
216
|
* @returns Promise that resolves when the morph is complete
|
|
219
217
|
*/
|
|
220
218
|
morphTo(target: CurveDef, options?: MorphOptions): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Changes render options on a live SarmalInstance without destroying and recreating it.
|
|
221
|
+
*
|
|
222
|
+
* ! Validation fails the operation completely if any of the fields fail the chceck.
|
|
223
|
+
*/
|
|
224
|
+
setRenderOptions(partial: RuntimeRenderOptions): void;
|
|
221
225
|
}
|
|
222
226
|
/**
|
|
223
227
|
* With 'gradient-animated' the colors cycle along the trail over time
|
|
224
228
|
*/
|
|
225
229
|
type TrailStyle = "default" | "gradient-static" | "gradient-animated";
|
|
226
|
-
|
|
230
|
+
/**
|
|
231
|
+
* The value must be a single hex string or an array of hex strings.
|
|
232
|
+
*
|
|
233
|
+
* ! Named colors, shorthand hex, `rgb()`, and `hsl()` notations are not yet supported.
|
|
234
|
+
*/
|
|
235
|
+
type TrailColor = string | string[];
|
|
236
|
+
/**
|
|
237
|
+
* Runtime-renderable options that can be changed on a live instance without destroying and recreating it.
|
|
238
|
+
*
|
|
239
|
+
* Passing `null` for `headColor`makes the head color derive its color from the current `trailColor` and `trailStyle`
|
|
240
|
+
* Passing a hex string locks the head color until overridden.
|
|
241
|
+
*
|
|
242
|
+
* Passing `"transparent"` for `skeletonColor` hides the skeleton. Any other value must be a valid {@link TrailColor}.
|
|
243
|
+
*/
|
|
244
|
+
interface RuntimeRenderOptions {
|
|
245
|
+
trailColor?: TrailColor;
|
|
246
|
+
/** 6-digit hex string to override, or `null` to make it automatic */
|
|
247
|
+
headColor?: string | null;
|
|
248
|
+
/** 6-digit hex string, or `"transparent"` to hide the skeleton. */
|
|
249
|
+
skeletonColor?: string;
|
|
250
|
+
trailStyle?: TrailStyle;
|
|
251
|
+
}
|
|
227
252
|
/**
|
|
228
253
|
* Common renderer options shared between canvas and SVG renderers.
|
|
229
254
|
* Extracted to avoid duplication and ensure consistency.
|
|
@@ -244,31 +269,27 @@ interface BaseRendererOptions {
|
|
|
244
269
|
*/
|
|
245
270
|
skeletonColor?: string;
|
|
246
271
|
/**
|
|
272
|
+
* Single hex color for default trails, or an array of hex colors for gradient trails.
|
|
247
273
|
* @default '#ffffff'
|
|
248
274
|
*/
|
|
249
|
-
trailColor?:
|
|
275
|
+
trailColor?: TrailColor;
|
|
250
276
|
/**
|
|
251
|
-
*
|
|
277
|
+
* Hex color for the head dot.
|
|
278
|
+
* If omitted, the color is derived from the trail
|
|
252
279
|
*/
|
|
253
280
|
headColor?: string;
|
|
254
281
|
/** @default 4 */
|
|
255
282
|
headRadius?: number;
|
|
256
|
-
}
|
|
257
|
-
interface RendererOptions extends BaseRendererOptions {
|
|
258
|
-
/** Target canvas element that will contain the Sarmal */
|
|
259
|
-
canvas: HTMLCanvasElement;
|
|
260
|
-
engine: Engine;
|
|
261
283
|
/**
|
|
262
284
|
* Trail rendering style
|
|
263
285
|
* @default 'default'
|
|
264
286
|
*/
|
|
265
287
|
trailStyle?: TrailStyle;
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
palette?: PalettePreset | string[];
|
|
288
|
+
}
|
|
289
|
+
interface RendererOptions extends BaseRendererOptions {
|
|
290
|
+
/** Target canvas element that will contain the Sarmal */
|
|
291
|
+
canvas: HTMLCanvasElement;
|
|
292
|
+
engine: Engine;
|
|
272
293
|
}
|
|
273
294
|
interface SarmalOptions extends Omit<RendererOptions, "canvas" | "engine"> {
|
|
274
295
|
/** @default 120 */
|
|
@@ -280,11 +301,12 @@ export type {
|
|
|
280
301
|
CurveDef as C,
|
|
281
302
|
Engine as E,
|
|
282
303
|
JumpOptions as J,
|
|
283
|
-
|
|
304
|
+
Point as P,
|
|
284
305
|
RendererOptions as R,
|
|
285
306
|
SarmalInstance as S,
|
|
286
|
-
|
|
307
|
+
TrailColor as T,
|
|
287
308
|
SarmalOptions as a,
|
|
288
|
-
|
|
309
|
+
RuntimeRenderOptions as b,
|
|
289
310
|
SeekOptions as c,
|
|
311
|
+
TrailStyle as d,
|
|
290
312
|
};
|