@alexpeng/dsh-custom-plugin 0.10.0 → 0.11.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/lib/index.js CHANGED
@@ -95,6 +95,8 @@ const BG_FX_ASCII_PRESETS = [
95
95
  "flow",
96
96
  "rain",
97
97
  "ocean",
98
+ "whale",
99
+ "jelly",
98
100
  "starfield",
99
101
  "ripple",
100
102
  "static"
@@ -27,6 +27,8 @@ import { type BgPointerEventLike } from './bg-pointer.ts';
27
27
  export { FLOW_LEVEL_FLOOR, quantizeLevel } from './bg-field.ts';
28
28
  export type { AsciiInput, AsciiPiece } from './bg-field.ts';
29
29
  export { createOceanPiece } from './bg-ocean.ts';
30
+ export { createWhalePiece } from './bg-whale.ts';
31
+ export { createJellyPiece } from './bg-jelly.ts';
30
32
  /** Upper bound for the backing-store scale. */
31
33
  export declare const DPR_CAP = 2;
32
34
  /** Hard grid caps: beyond these the cell size grows instead of the grid. */
@@ -41,7 +43,7 @@ export type AsciiCharset = 'classic' | 'blocks' | 'dots';
41
43
  /** Glyph ramps ordered by increasing ink density. */
42
44
  export declare const CHARSET: Record<AsciiCharset, string>;
43
45
  /** Every ASCII piece id. `static` is the zero-rAF tier. */
44
- export type AsciiPreset = 'flow' | 'rain' | 'ocean' | 'starfield' | 'ripple' | 'static';
46
+ export type AsciiPreset = 'flow' | 'rain' | 'ocean' | 'whale' | 'jelly' | 'starfield' | 'ripple' | 'static';
45
47
  /** Inclusive numeric bounds a future settings panel may write. */
46
48
  export interface AsciiRange {
47
49
  readonly min: number;
@@ -73,6 +75,12 @@ export interface AsciiPresetSpec {
73
75
  * emphasis buffer. `flow` and `ocean` opt in today; `static` deliberately
74
76
  * does not, so its one frame stays deterministic. */
75
77
  readonly interactive?: boolean;
78
+ /** Picture presets keep the full marked ink inside the calm zone. The
79
+ * reading-column mask exists to thin a texture, but a preset whose subject
80
+ * is a drawn animal has no texture to thin: at the 0.65 emphasis floor the
81
+ * whale measured as a ghost behind the content surfaces (Desktop pass,
82
+ * 2026-12-03), which defeats the preset. Off for every texture preset. */
83
+ readonly emphasisFull?: boolean;
76
84
  /** Shape-aware rendering: a cell on a contour swaps its ramp glyph for a
77
85
  * directional stroke of similar ink weight (the MIT `glyph-graphics` idea).
78
86
  * The `dots` pieces and `rain` keep their plain ramp. */
@@ -35,7 +35,9 @@ export interface AsciiInput {
35
35
  }
36
36
  /** Glyphs a piece may place through the overlay buffer. Index 0 is "none";
37
37
  * 1–8 are single-cell direction marks for the small fish, 9–13 are the body,
38
- * edge, head and tail cells of a koi. */
38
+ * edge, head and tail cells of a koi, 14–19 are the punctuation the `whale`
39
+ * piece needs for its spout and bubbles. Append-only: existing slots are
40
+ * persisted in no state, but the ocean piece indexes them by number. */
39
41
  export declare const OVERLAY_GLYPHS: readonly string[];
40
42
  /** Lowest field value the `flow` / `static` piece may emit, as a fraction of
41
43
  * the ramp. 0.45 keeps the darkest cell around the middle of the ramp instead
@@ -0,0 +1,53 @@
1
+ /**
2
+ * `jelly`: a jellyfish rising slowly through the page.
3
+ *
4
+ * The animal is three layers:
5
+ * 1. a bell rasterised once from a half-ellipse at module load — concentric
6
+ * tonal rings (rim level 9 down to a translucent level 4 centre) with a
7
+ * wavy skirt on the bottom row;
8
+ * 2. six parametric tendrils hanging from the skirt, each with its own
9
+ * phase, amplitude and length drawn as `| / \ ~` direction marks with a
10
+ * faint ramp cell underneath;
11
+ * 3. drifting plankton (sparse level 1–2 dots that wrap vertically) and click
12
+ * sparks (short-lived overlay points that spread out from the pointer).
13
+ *
14
+ * The bell pulses at 1.15 rad/s: the whole animal bobs one row and the
15
+ * tendrils shorten on the contraction, which is what makes it read as
16
+ * swimming rather than floating. The pointer is felt: inside 12 cells the
17
+ * jellyfish rises faster and contracts; a click adds a stronger contraction
18
+ * and lights a ring of sparks at the click.
19
+ *
20
+ * Every bell and tendril cell is marked for emphasis, and the preset carries
21
+ * `emphasisFull` (bg-ascii spec flag), so the animal keeps its own ink inside
22
+ * the calm zone instead of fading to the 0.65 floor — the same contract the
23
+ * whale uses. Plankton stays masked like any texture. Nothing allocates per
24
+ * frame: the bell is module-level, the spark pool is fixed, and the plankton
25
+ * positions are hashes of their index.
26
+ * @module @alexpeng/dsh-custom-plugin/client/bg-jelly
27
+ */
28
+ import { type AsciiPiece } from './bg-field.ts';
29
+ /** Bell size in grid cells; the tendrils add ~15 rows below it. */
30
+ export declare const JELLY_BELL_W = 24;
31
+ export declare const JELLY_BELL_H = 8;
32
+ /** One baked bell cell: offset from the bell's top-left, ramp level and
33
+ * whether it sits on the wavy skirt. */
34
+ export interface JellyBellCell {
35
+ readonly dx: number;
36
+ readonly dy: number;
37
+ readonly level: number;
38
+ readonly skirt: boolean;
39
+ }
40
+ /**
41
+ * Rasterise the bell. Runs once at module load. The tonal rings are what give
42
+ * the bell its dome: the rim is the darkest step, the interior steps down ring
43
+ * by ring, and the very centre stays translucent (level 4).
44
+ */
45
+ export declare function buildJellyBell(): JellyBellCell[];
46
+ /** The baked bell, shared by every instance. */
47
+ export declare const JELLY_BELL_CELLS: readonly JellyBellCell[];
48
+ /**
49
+ * Create the jellyfish piece. The returned function owns the bell position, the
50
+ * contraction state, the spark pool and the plankton hashes; all of it is
51
+ * reused for the piece's lifetime and reset only when the grid changes.
52
+ */
53
+ export declare function createJellyPiece(levels: number, dither: boolean): AsciiPiece;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * `whale`: a large ASCII whale that crosses the page, with a spout and bubbles.
3
+ *
4
+ * The scene has three layers:
5
+ * 1. a very faint sea — drifting value-noise water plus two long swell lines
6
+ * that roll across the lower and middle bands of the page;
7
+ * 2. one whale, rasterised once from a hand-tuned outline into a cell mask
8
+ * (a shader-like silhouette with a character ramp inside: dark rim, mid
9
+ * spine, light belly, a hole for the eye and a darker mouth line), swimming
10
+ * leftwards with a slow bob and a tail that beats;
11
+ * 3. particles — a spout above the blowhole every few seconds, a bubble trail
12
+ * behind the tail, and a few bubbles where the user clicks.
13
+ *
14
+ * Every cell of the whale is marked in `emphasis`, so the calm zone may thin it
15
+ * but never erase it: a recognisable picture is the whole point of the preset,
16
+ * and the 0.15 floor would leave a ghost. The sea and the automatic bubbles
17
+ * are *not* marked — only the whale and the bubbles the user just caused keep
18
+ * the `EFFECT_FOCUS_FLOOR` strength inside the reading column.
19
+ *
20
+ * The pointer is felt, not obeyed: inside a 14-cell radius the whale speeds up
21
+ * a little and banks away vertically; a click inside 18 cells startles it (a
22
+ * short burst of speed plus a spout). Nothing here allocates per frame — the
23
+ * mask is module-level, the particle pool is fixed, the per-column swell scratch
24
+ * grows only with the grid.
25
+ * @module @alexpeng/dsh-custom-plugin/client/bg-whale
26
+ */
27
+ import { type AsciiPiece } from './bg-field.ts';
28
+ /** Mask-space size of the whale in grid cells. The cells are ~1.9× taller
29
+ * than wide, so 50×12 cells reads back as a ~3:1 silhouette on screen. */
30
+ export declare const WHALE_ART_W = 50;
31
+ export declare const WHALE_ART_H = 12;
32
+ /** One baked whale cell: offset from the mask origin, ramp level (0–9, mapped
33
+ * to the live ramp length at paint time), hole kind (0 none, 1 eye, 2 mouth)
34
+ * and tail weight. */
35
+ export interface WhaleCell {
36
+ readonly dx: number;
37
+ readonly dy: number;
38
+ readonly level: number;
39
+ readonly hole: 0 | 1 | 2;
40
+ readonly wag: number;
41
+ }
42
+ /**
43
+ * Rasterise the whale outline into cells. Runs once at module load: the rim is
44
+ * one step darker than the interior (and the interior darkens toward the
45
+ * spine), which is what draws the silhouette through the ramp alone, so a
46
+ * ~260-cell whale costs one blit per cell and no overlay pass at all.
47
+ */
48
+ export declare function buildWhaleCells(): WhaleCell[];
49
+ /** The baked mask, shared by every instance (it never changes). */
50
+ export declare const WHALE_CELLS: readonly WhaleCell[];
51
+ /**
52
+ * Create the whale piece. The returned function owns the whale position, the
53
+ * particle pool and the sea scratch; all three are reused for the piece's
54
+ * lifetime and reset only when the grid changes.
55
+ */
56
+ export declare function createWhalePiece(levels: number, dither: boolean): AsciiPiece;
@@ -13,7 +13,7 @@ export declare const CUSTOM_PLUGIN_API_PREFIX = "/api/custom-plugin";
13
13
  /** Path the host serves the fetched Mermaid engine at (script src). */
14
14
  export declare const MERMAID_SCRIPT_PATH = "/custom-plugin/mermaid.js";
15
15
  /** ASCII preset ids; keep in sync with `ASCII_PRESETS` in `client/bg-ascii.ts`. */
16
- export declare const BG_FX_ASCII_PRESETS: readonly ["flow", "rain", "ocean", "starfield", "ripple", "static"];
16
+ export declare const BG_FX_ASCII_PRESETS: readonly ["flow", "rain", "ocean", "whale", "jelly", "starfield", "ripple", "static"];
17
17
  /** Shader style ids; keep in sync with `SHADER_STYLES` in `client/bg-shader.ts`. */
18
18
  export declare const BG_FX_SHADER_STYLES: readonly ["liquid", "grain"];
19
19
  /** The `bgFxPreset` value space: one flat string across both renderer tiers.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alexpeng/dsh-custom-plugin",
3
3
  "description": "Custom convenience suite for the dsh web GUI: appearance, folders, prompts, session export/search, Mermaid, usage analytics, local budget, key-free backups, and a Ctrl/Cmd+K command palette; dual-face plugin mounted without dsh source changes.",
4
- "version": "0.10.0",
4
+ "version": "0.11.0",
5
5
  "type": "module",
6
6
  "icon": "./icon.svg",
7
7
  "main": "lib/index.js",