@liquid-glass-forge/webgl 0.0.0-stage → 0.1.0-rc.2
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/LICENSE +21 -0
- package/NOTICE +7 -0
- package/README.md +33 -2
- package/dist/atlas.d.ts +111 -0
- package/dist/atlas.js +611 -0
- package/dist/dom.d.ts +171 -0
- package/dist/dom.js +226 -0
- package/dist/effects.d.ts +18 -0
- package/dist/effects.js +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/shaders.d.ts +4 -0
- package/dist/shaders.js +75 -0
- package/package.json +42 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nami Poursafargholi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Liquid Glass Forge
|
|
2
|
+
Copyright (c) 2026 Nami Poursafargholi. MIT licensed.
|
|
3
|
+
|
|
4
|
+
Independent implementation inspired by Apple's Liquid Glass design.
|
|
5
|
+
Not affiliated with, sponsored by or endorsed by Apple Inc.
|
|
6
|
+
Apple and its design/assets remain subject to their respective rights.
|
|
7
|
+
No Apple assets or upstream Liquid Glass/Sileo implementation is included.
|
package/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @liquid-glass-forge/webgl
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
WebGL2 glass refraction and a shared atlas for compositing optical surfaces.
|
|
4
|
+
|
|
5
|
+
[](https://namipsg.github.io/liquid-glass-forge/#playground)
|
|
6
|
+
|
|
7
|
+
[Live showcase](https://namipsg.github.io/liquid-glass-forge/#playground) · [Examples](https://namipsg.github.io/liquid-glass-forge/examples.html) · [Documentation](https://github.com/namipsg/liquid-glass-forge/blob/main/docs/PHASE-6.md) · [Support](https://namipsg.github.io/liquid-glass-forge/support.html) · [Install by framework](https://github.com/namipsg/liquid-glass-forge/blob/main/docs/QUICKSTART.md)
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @liquid-glass-forge/webgl@0.1.0-rc.2
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Keep the Forge packages at matching versions. This is an experimental preview.
|
|
16
|
+
The [support guide](https://namipsg.github.io/liquid-glass-forge/support.html) describes browser and device qualification.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Experimental preview package, `0.1.0-rc.2`. Shared persistent WebGL2 atlas,
|
|
21
|
+
versioned optics, GPU blur and synchronous Canvas2D tile presentation.
|
|
22
|
+
|
|
23
|
+
Use `WebGLAtlas` from `@liquid-glass-forge/webgl` for owned Canvas2D targets.
|
|
24
|
+
Use `createWebGLRenderer` or `createOpticalRenderer` from
|
|
25
|
+
`@liquid-glass-forge/webgl/dom` with the vanilla host. Import and construction
|
|
26
|
+
allocate no browser resources. Forced modes never downgrade; auto requires an
|
|
27
|
+
explicit `none`, `cpu` or `material` fallback policy. Dispose renderers and release
|
|
28
|
+
standalone canvas frames. The caller owns source bytes and supplied targets.
|
|
29
|
+
|
|
30
|
+
Core scenes retain 16-host / 4-million-pixel bounds. The direct atlas accepts up
|
|
31
|
+
to 50 small tiles under aggregate pixel, texture-size and image-memory bounds.
|
|
32
|
+
Nonzero GPU blur requires renderable float buffers. No production GPU readback.
|
|
33
|
+
Performance support is limited to named measured workloads. See the repository
|
|
34
|
+
`docs/PHASE-6.md` for API, source ownership, recovery and measured scope.
|
package/dist/atlas.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { PixelSource, SurfaceInput } from '@liquid-glass-forge/core';
|
|
2
|
+
import { type WebGLEffects } from './effects.js';
|
|
3
|
+
export declare class WebGLError extends Error {
|
|
4
|
+
readonly code: string;
|
|
5
|
+
constructor(code: string, message: string, options?: ErrorOptions);
|
|
6
|
+
}
|
|
7
|
+
export declare const WEBGL_ATTRIBUTES: Readonly<{
|
|
8
|
+
alpha: true;
|
|
9
|
+
premultipliedAlpha: true;
|
|
10
|
+
preserveDrawingBuffer: false;
|
|
11
|
+
antialias: false;
|
|
12
|
+
depth: false;
|
|
13
|
+
stencil: false;
|
|
14
|
+
}>;
|
|
15
|
+
export interface WebGLAtlasOptions {
|
|
16
|
+
readonly maxBytes?: number;
|
|
17
|
+
readonly maxRestores?: number;
|
|
18
|
+
readonly canvasFactory?: () => HTMLCanvasElement;
|
|
19
|
+
}
|
|
20
|
+
export interface WebGLTile {
|
|
21
|
+
readonly surface: SurfaceInput;
|
|
22
|
+
readonly target: HTMLCanvasElement;
|
|
23
|
+
}
|
|
24
|
+
export interface WebGLUpdate {
|
|
25
|
+
readonly generation?: number;
|
|
26
|
+
readonly revision?: number;
|
|
27
|
+
readonly dirtyIds?: readonly string[];
|
|
28
|
+
readonly effects?: WebGLEffects;
|
|
29
|
+
readonly signal?: AbortSignal;
|
|
30
|
+
}
|
|
31
|
+
export declare function webglContextPoolDiagnostics(): Readonly<{
|
|
32
|
+
contexts: number;
|
|
33
|
+
leased: number;
|
|
34
|
+
idle: number;
|
|
35
|
+
cap: 4;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function releaseIdleWebGLContexts(): void;
|
|
38
|
+
/** Persistent atlas. update() finishes GPU→default framebuffer→Canvas2D copies
|
|
39
|
+
* synchronously, before returning. Callers own target canvases and source bytes. */
|
|
40
|
+
export declare class WebGLAtlas {
|
|
41
|
+
#private;
|
|
42
|
+
constructor(options?: WebGLAtlasOptions);
|
|
43
|
+
get context(): WebGL2RenderingContext | undefined;
|
|
44
|
+
get diagnostics(): Readonly<{
|
|
45
|
+
backend: 'webgl';
|
|
46
|
+
contextType: "webgl2";
|
|
47
|
+
state: "disposed" | "lost" | "new" | "ready" | "unavailable";
|
|
48
|
+
failure: string | undefined;
|
|
49
|
+
restores: number;
|
|
50
|
+
handleGeneration: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
sourceWidth: number;
|
|
54
|
+
sourceHeight: number;
|
|
55
|
+
renderCount: number;
|
|
56
|
+
batchCount: number;
|
|
57
|
+
uploadCount: number;
|
|
58
|
+
targetBytes: number;
|
|
59
|
+
requestedAttributes: Readonly<{
|
|
60
|
+
alpha: true;
|
|
61
|
+
premultipliedAlpha: true;
|
|
62
|
+
preserveDrawingBuffer: false;
|
|
63
|
+
antialias: false;
|
|
64
|
+
depth: false;
|
|
65
|
+
stencil: false;
|
|
66
|
+
}>;
|
|
67
|
+
attributes: WebGLContextAttributes | null | undefined;
|
|
68
|
+
pool: Readonly<{
|
|
69
|
+
contexts: number;
|
|
70
|
+
leased: number;
|
|
71
|
+
idle: number;
|
|
72
|
+
cap: 4;
|
|
73
|
+
}>;
|
|
74
|
+
resources: Readonly<{
|
|
75
|
+
contexts: 0 | 1;
|
|
76
|
+
textures: number;
|
|
77
|
+
framebuffers: number;
|
|
78
|
+
programs: number;
|
|
79
|
+
shaders: number;
|
|
80
|
+
buffers: 0;
|
|
81
|
+
vertexArrays: 0;
|
|
82
|
+
}>;
|
|
83
|
+
ownedImageBytes: number;
|
|
84
|
+
lastBatch: Readonly<{
|
|
85
|
+
dirty: number;
|
|
86
|
+
gpuSnapshots: number;
|
|
87
|
+
uploadMs: number;
|
|
88
|
+
drawMs: number;
|
|
89
|
+
snapshotMs: number;
|
|
90
|
+
copyMs: number;
|
|
91
|
+
batchMs: number;
|
|
92
|
+
completedAt: readonly number[];
|
|
93
|
+
}>;
|
|
94
|
+
sourceDecoding: "calibrated-srgb-texture" | "explicit-shader";
|
|
95
|
+
decodeProbeMaxByteError: number | undefined;
|
|
96
|
+
colorConvention: "straight sRGB upload; manual linear-premultiplied sampling/blur; calibrated premultiplied sRGB byte presentation";
|
|
97
|
+
storageProfile: "nearest" | "upward";
|
|
98
|
+
}>;
|
|
99
|
+
initialize(): void;
|
|
100
|
+
dispose(): void;
|
|
101
|
+
update(source: PixelSource, entries: readonly WebGLTile[], options?: WebGLUpdate): Readonly<{
|
|
102
|
+
dirty: number;
|
|
103
|
+
gpuSnapshots: number;
|
|
104
|
+
uploadMs: number;
|
|
105
|
+
drawMs: number;
|
|
106
|
+
snapshotMs: number;
|
|
107
|
+
copyMs: number;
|
|
108
|
+
batchMs: number;
|
|
109
|
+
completedAt: readonly number[];
|
|
110
|
+
}>;
|
|
111
|
+
}
|