@cruxgarden/plasma-ui 0.2.3 → 0.3.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.
@@ -21,6 +21,16 @@ export interface RendererSettings {
21
21
  highlight: number;
22
22
  /** Thin edge line strength. */
23
23
  edgeLine: number;
24
+ /** Slow iridescent sheen across the body of each surface. 0 = none. */
25
+ shimmer: number;
26
+ /** Colored bloom the plasma casts onto the background around it. 0 = none. */
27
+ glow: number;
28
+ /** How much the material tints what is seen through it. 0 = clear as water. */
29
+ wash: number;
30
+ /** Film grain over the background. 0 = none. */
31
+ grain: number;
32
+ /** Blur applied to the background only, in CSS px (0-40). Costs 8 extra blur passes when above 0. */
33
+ backgroundBlur: number;
24
34
  /** 0 = watery and bouncy, 1 = thick and slow. */
25
35
  viscosity: number;
26
36
  /** How far the surface trails behind moving panels. 0 = no trailing. */
@@ -55,6 +65,8 @@ export interface ShapeOptions {
55
65
  elevation?: number | null;
56
66
  /** When false, this surface never blends, bridges, or joins with others. Default true. */
57
67
  fuse?: boolean;
68
+ /** Snap only against surfaces carrying the same group. null groups with the other ungrouped surfaces. */
69
+ group?: string | null;
58
70
  }
59
71
  /** Handle returned by `register`, used by <Plasma>. */
60
72
  export interface JoinedSides {
@@ -94,13 +106,24 @@ export declare class PlasmaRenderer {
94
106
  private bgColor;
95
107
  private srcEl;
96
108
  private floatOK;
109
+ /** True between webglcontextlost and webglcontextrestored: draw nothing. */
110
+ private lost;
111
+ private warnedOverflow;
112
+ /**
113
+ * Set by destroy(). The canvas and its context outlive this renderer, so an
114
+ * async callback that lands afterwards would happily allocate on a context
115
+ * nothing can free it from.
116
+ */
117
+ private destroyed;
118
+ private resizeSettle;
119
+ /** Everything initGL() created, so destroy() can free it by hand. */
120
+ private owned;
97
121
  private recs;
98
122
  private nextId;
99
123
  private raf;
100
124
  private last;
101
125
  private time;
102
126
  private dpr;
103
- private resizeQueued;
104
127
  /** Coarse pointer = touch. Only there does a fling run on the compositor with rAF deferred. */
105
128
  private coarse;
106
129
  private frozen;
@@ -141,13 +164,37 @@ export declare class PlasmaRenderer {
141
164
  private loadBackground;
142
165
  configure(s: RendererSettings, immediate?: boolean): void;
143
166
  register(el: HTMLElement, o: ShapeOptions, onJoin?: (j: boolean) => void, onSides?: (sides: JoinedSides) => void): ShapeHandle;
144
- /** Layout boxes of all shapes (lean removed; animating draggables report their destination). */
145
- layoutBoxes(excludeId?: number, fusingOnly?: boolean): Box[];
167
+ /**
168
+ * Layout boxes of all shapes (lean removed; animating draggables report
169
+ * their destination). Pass `group` to see only the surfaces in that group;
170
+ * omit it - as any caller written before groups existed does - to see them all.
171
+ */
172
+ layoutBoxes(excludeId?: number, fusingOnly?: boolean, group?: string | null): Box[];
146
173
  private layoutBoxOf;
147
174
  /** Send a pulse through the material from a viewport point. */
148
175
  pulse(x: number, y: number, strength?: number): void;
149
176
  /** Raise the material's energy (brightens contours and color); it decays on its own. */
150
177
  bump(e: number): void;
178
+ /** Rebuild the shaders and uniform arrays for a new surface budget. */
179
+ private setMax;
180
+ private allocUniformArrays;
181
+ /** Delete every GL object this renderer created, leaving the canvas usable. */
182
+ private releaseGL;
183
+ /**
184
+ * Every GL object this renderer owns. A lost context invalidates all of
185
+ * them, so creation lives here rather than in the constructor: the restore
186
+ * handler runs exactly the same path.
187
+ */
188
+ private initGL;
189
+ /**
190
+ * A drag-resize reallocates eight render targets per distinct size, and the
191
+ * driver can drop the context under that. Without these two handlers the
192
+ * field simply stopped: the frame loop kept running against a dead context
193
+ * and nothing ever brought it back. preventDefault is what asks the browser
194
+ * to attempt a restore at all.
195
+ */
196
+ private onContextLost;
197
+ private onContextRestored;
151
198
  destroy(): void;
152
199
  /**
153
200
  * A hidden tab draws nothing anyone can see. Browsers throttle rAF there
package/package.json CHANGED
@@ -1,16 +1,20 @@
1
1
  {
2
2
  "name": "@cruxgarden/plasma-ui",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Liquid panels for React, rendered in WebGL on canvas: every panel is one shared plasma - they fuse on contact, refract, and snap to a grid.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "build": "esbuild src/index.ts --bundle --format=esm --jsx=automatic --target=es2020 --external:react --external:react-dom --outfile=dist/index.js && tsc",
8
8
  "build:site": "node site/build.mjs",
9
9
  "typecheck": "tsc --noEmit",
10
+ "typecheck:app": "tsc -p tsconfig.app.json",
11
+ "typecheck:react19": "npm i --no-save --no-audit --no-fund @types/react@19 @types/react-dom@19 && tsc -p tsconfig.app.json",
12
+ "format:check": "prettier --check site examples scripts",
10
13
  "test": "node --test tests/*.test.mjs",
11
- "prepublishOnly": "npm run typecheck && npm test && npm run build",
14
+ "prepublishOnly": "npm run verify",
12
15
  "format": "prettier --write .",
13
- "verify": "npm run typecheck && npm test && npm run build",
16
+ "check:docs": "node scripts/check-docs.mjs",
17
+ "verify": "npm run typecheck && npm run typecheck:app && npm run format:check && npm test && npm run build && npm run check:docs",
14
18
  "publish:patch": "npm version patch && npm publish && git push && git push --tags",
15
19
  "publish:minor": "npm version minor && npm publish && git push && git push --tags",
16
20
  "publish:major": "npm version major && npm publish && git push && git push --tags",