@sarmal/core 0.14.0 → 0.15.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.
@@ -216,12 +216,39 @@ interface SarmalInstance extends AnimationControls {
216
216
  * @returns Promise that resolves when the morph is complete
217
217
  */
218
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;
219
225
  }
220
226
  /**
221
227
  * With 'gradient-animated' the colors cycle along the trail over time
222
228
  */
223
229
  type TrailStyle = "default" | "gradient-static" | "gradient-animated";
224
- type PalettePreset = "bard" | "sunset" | "ocean" | "ice" | "fire" | "forest";
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
+ }
225
252
  /**
226
253
  * Common renderer options shared between canvas and SVG renderers.
227
254
  * Extracted to avoid duplication and ensure consistency.
@@ -242,11 +269,13 @@ interface BaseRendererOptions {
242
269
  */
243
270
  skeletonColor?: string;
244
271
  /**
272
+ * Single hex color for default trails, or an array of hex colors for gradient trails.
245
273
  * @default '#ffffff'
246
274
  */
247
- trailColor?: string;
275
+ trailColor?: TrailColor;
248
276
  /**
249
- * @default '#ffffff'
277
+ * Hex color for the head dot.
278
+ * If omitted, the color is derived from the trail
250
279
  */
251
280
  headColor?: string;
252
281
  /** @default 4 */
@@ -256,12 +285,6 @@ interface BaseRendererOptions {
256
285
  * @default 'default'
257
286
  */
258
287
  trailStyle?: TrailStyle;
259
- /**
260
- * Color palette for gradient trails.
261
- * Can be a preset name or a custom array of hex color strings.
262
- * @default 'bard' for 'gradient-animated', 'ice' for 'gradient-static'
263
- */
264
- palette?: PalettePreset | string[];
265
288
  }
266
289
  interface RendererOptions extends BaseRendererOptions {
267
290
  /** Target canvas element that will contain the Sarmal */
@@ -273,4 +296,4 @@ interface SarmalOptions extends Omit<RendererOptions, "canvas" | "engine"> {
273
296
  trailLength?: number;
274
297
  }
275
298
 
276
- export type { BaseRendererOptions as B, CurveDef as C, Engine as E, JumpOptions as J, PalettePreset as P, RendererOptions as R, SarmalInstance as S, TrailStyle as T, SarmalOptions as a, Point as b, SeekOptions as c };
299
+ export type { BaseRendererOptions as B, CurveDef as C, Engine as E, JumpOptions as J, Point as P, RendererOptions as R, SarmalInstance as S, TrailColor as T, SarmalOptions as a, RuntimeRenderOptions as b, SeekOptions as c, TrailStyle as d };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sarmal/core",
3
- "version": "0.14.0",
3
+ "version": "0.15.1",
4
4
  "description": "Curve path based loading indicators and their renderer",
5
5
  "keywords": [
6
6
  "animation",