@cruxgarden/plasma-ui 0.2.4 → 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.
- package/CHANGELOG.md +104 -0
- package/README.md +82 -7
- package/dist/Plasma.d.ts +31 -6
- package/dist/PlasmaProvider.d.ts +77 -12
- package/dist/index.d.ts +12 -3
- package/dist/index.js +325 -155
- package/dist/renderer.d.ts +30 -2
- package/package.json +7 -3
package/dist/renderer.d.ts
CHANGED
|
@@ -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 {
|
|
@@ -96,6 +108,13 @@ export declare class PlasmaRenderer {
|
|
|
96
108
|
private floatOK;
|
|
97
109
|
/** True between webglcontextlost and webglcontextrestored: draw nothing. */
|
|
98
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;
|
|
99
118
|
private resizeSettle;
|
|
100
119
|
/** Everything initGL() created, so destroy() can free it by hand. */
|
|
101
120
|
private owned;
|
|
@@ -145,13 +164,22 @@ export declare class PlasmaRenderer {
|
|
|
145
164
|
private loadBackground;
|
|
146
165
|
configure(s: RendererSettings, immediate?: boolean): void;
|
|
147
166
|
register(el: HTMLElement, o: ShapeOptions, onJoin?: (j: boolean) => void, onSides?: (sides: JoinedSides) => void): ShapeHandle;
|
|
148
|
-
/**
|
|
149
|
-
|
|
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[];
|
|
150
173
|
private layoutBoxOf;
|
|
151
174
|
/** Send a pulse through the material from a viewport point. */
|
|
152
175
|
pulse(x: number, y: number, strength?: number): void;
|
|
153
176
|
/** Raise the material's energy (brightens contours and color); it decays on its own. */
|
|
154
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;
|
|
155
183
|
/**
|
|
156
184
|
* Every GL object this renderer owns. A lost context invalidates all of
|
|
157
185
|
* them, so creation lives here rather than in the constructor: the restore
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cruxgarden/plasma-ui",
|
|
3
|
-
"version": "0.
|
|
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
|
|
14
|
+
"prepublishOnly": "npm run verify",
|
|
12
15
|
"format": "prettier --write .",
|
|
13
|
-
"
|
|
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",
|