@godot-scene-web/html 0.1.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/LICENSE +21 -0
- package/dist/extents-R8RIim2S.d.ts +1223 -0
- package/dist/extents-R8RIim2S.d.ts.map +1 -0
- package/dist/index.d.ts +346 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5330 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime-BkfFs_eO.js +6540 -0
- package/dist/runtime-BkfFs_eO.js.map +1 -0
- package/dist/runtime.d.ts +225 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +2 -0
- package/package.json +54 -0
- package/vendor/LICENSE-OpenSans +201 -0
- package/vendor/OpenSans_SemiBold.woff2 +0 -0
- package/vendor/VENDOR.md +51 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { L as StaticImageSwapCounters, a as parseParticleSpecConfig, b as GodotHtmlRuntimeOptions, c as ParticleRuntimeStats, i as normalizeParticleSpecConfig, l as createParticleRuntime, nt as GodotEffectRenderInfo, o as ParticleProfile, r as ParticleSpecConfig, s as ParticleRuntime, u as WebgpuFallbackReason, y as GodotHtmlMountOptions } from "./extents-R8RIim2S.js";
|
|
2
|
+
import { GodotBlendMode } from "@godot-scene-web/effects/shaders";
|
|
3
|
+
|
|
4
|
+
//#region src/webgl/runtime.d.ts
|
|
5
|
+
/** OPT-IN per-frame cost attribution for ONE shader runtime (`effectsProfiling`, see `../types`),
|
|
6
|
+
* read from `stats().profile`; NULL when the option is off. The particle runtime's `ParticleProfile`
|
|
7
|
+
* with the two CPU buckets removed — a shader frame has no simulation and no instance buffer, so
|
|
8
|
+
* everything a shader tick does on the main thread is submit + blit. */
|
|
9
|
+
interface ShaderProfile {
|
|
10
|
+
/** Loop ticks that rendered at least one binding. A tick deferred by the FPS cap (`capDeferrals`)
|
|
11
|
+
* or one where every binding was clean/parked/suspended books none. */
|
|
12
|
+
ticks: number;
|
|
13
|
+
/** Bindings the tick handed to `renderNode`, summed across those ticks — static-frame cache hits
|
|
14
|
+
* included, whether they blit or simply confirm their canvas already presents the keyed frame.
|
|
15
|
+
* Clean, parked and suspended bindings are skipped by the loop before this and never counted. */
|
|
16
|
+
bindings: number;
|
|
17
|
+
/** GL SUBMIT: `renderNode`'s viewport/clear/program preamble, its texture binds and uniform
|
|
18
|
+
* writes, and the `drawArrays`. SUBMIT ONLY — the GPU runs asynchronously, so this never contains
|
|
19
|
+
* GPU execution time. Deliberately EXCLUDES the throttled SCREEN_TEXTURE capture (a 2D composite
|
|
20
|
+
* of the DOM plus an upload, on its own ~300 ms cadence), which would otherwise spike this bucket
|
|
21
|
+
* on the frames that happen to refresh it. */
|
|
22
|
+
glMs: number;
|
|
23
|
+
/** GL→2D BLIT: the node canvas's `clearRect` + the `drawImage` copying the shared GL canvas onto
|
|
24
|
+
* it — and a cross-canvas static-frame cache-hit blit, which is the cost that cache trades the GL draw for.
|
|
25
|
+
* Fill cost, so it scales with backing-store area (`renderScale` × devicePixelRatio), not with
|
|
26
|
+
* shader complexity. */
|
|
27
|
+
blitMs: number;
|
|
28
|
+
}
|
|
29
|
+
/** Live, monotonically-increasing counters for ONE shader runtime (see `WebglShaderRuntime.stats`).
|
|
30
|
+
* Plain fields bumped with `++` on the hot paths — no allocation, no behavior change; a probe
|
|
31
|
+
* snapshots the object and diffs across a gesture window. Never reset for the runtime's lifetime. */
|
|
32
|
+
interface WebglShaderRuntimeStats extends StaticImageSwapCounters {
|
|
33
|
+
/** Actual GL draws of a shader frame (`renderNode` reaching `gl.drawArrays`). */
|
|
34
|
+
draws: number;
|
|
35
|
+
/** Frozen-mode static-frame cache hits: the GL draw was skipped and a cached frame was handled. */
|
|
36
|
+
cacheHits: number;
|
|
37
|
+
/** Cache hits whose target canvas already held the named frame, so the 2D clear/blit was skipped.
|
|
38
|
+
* `onBindingRendered` still fires: the binding presented/handled its current frame even though no
|
|
39
|
+
* pixels changed. */
|
|
40
|
+
blitSkips: number;
|
|
41
|
+
/** SEAM — 0 today: static re-renders skipped because the quantized frame key was unchanged.
|
|
42
|
+
* Future consumer: the `staticDirtyByFrameKey` dirty gating (Fix B) in `updateBinding`. */
|
|
43
|
+
dirtySkips: number;
|
|
44
|
+
/** Ticks pushed past the fps-cap boundary (the `!pacer.isDue` re-arm in `tick`). Today only capped
|
|
45
|
+
* ANIMATED loops take this path — frozen mode bypasses the cap entirely (`capRemaining` returns 0),
|
|
46
|
+
* so this stays 0 in static mode until `capStaticRerenders` (Fix A) routes static dirty re-renders
|
|
47
|
+
* through the cap too. */
|
|
48
|
+
capDeferrals: number;
|
|
49
|
+
/** Node-canvas backing-store reallocations: `syncCanvasSize` calls that actually re-assigned
|
|
50
|
+
* `canvas.width`/`height` (one event per call, however many dimensions moved). */
|
|
51
|
+
canvasReallocs: number;
|
|
52
|
+
/** Synchronous out-of-loop renders (`renderBindingNow`): the uv-window/realloc anti-flicker path
|
|
53
|
+
* that draws immediately instead of waiting for the next tick. */
|
|
54
|
+
syncRenders: number;
|
|
55
|
+
/** `syncCanvasSize` calls that sized a binding at the PINNED static ratio
|
|
56
|
+
* (`staticShaderPixelRatio`) instead of `devicePixelRatio × renderScale`. A device probe reads
|
|
57
|
+
* this to confirm the pin is actually in force — it stays 0 when the option is unset OR the
|
|
58
|
+
* runtime never entered frozen mode, which `canvasReallocs` alone cannot distinguish (that
|
|
59
|
+
* counter is about the OPPOSITE thing: how much re-sizing churn is still happening). */
|
|
60
|
+
pinnedCanvasSyncs: number;
|
|
61
|
+
/** Per-frame cost attribution (see `ShaderProfile`), or NULL when `effectsProfiling` is off — the
|
|
62
|
+
* default, and the no-op handle always. NULL rather than a zeroed object ON PURPOSE: "not
|
|
63
|
+
* measured" must never read as "measured, cost nothing". The same object every `stats()` call. */
|
|
64
|
+
profile: ShaderProfile | null;
|
|
65
|
+
/** GAUGE — which renderer NEW bindings of this runtime are created on RIGHT NOW, re-derived on
|
|
66
|
+
* each `stats()` read (a runtime can change backend mid-life, in one direction: a WebGPU device
|
|
67
|
+
* that is lost is rebuilt on WebGL).
|
|
68
|
+
*
|
|
69
|
+
* `"pending"` is a real state: with `effectsRenderer: "auto"`/`"webgpu"` on a browser that HAS
|
|
70
|
+
* `navigator.gpu`, the device arrives from a promise, and until it does no binding is created at
|
|
71
|
+
* all — every opted-in node simply keeps its CSS/SVG paint, exactly as it does while its shader
|
|
72
|
+
* source is still being fetched. `"none"` is the no-op handle (no WebGL2, or no shader resolver).
|
|
73
|
+
*
|
|
74
|
+
* It is the RUNTIME's answer, not a binding's: individual bindings can be on WebGL under a
|
|
75
|
+
* `"webgpu"` runtime (see `webgpuBindingFallbacks`). */
|
|
76
|
+
renderer: "pending" | "webgpu" | "webgl" | "none";
|
|
77
|
+
/** COUNTER. Times this runtime adopted WebGL after being asked for `"auto"`/`"webgpu"` — the
|
|
78
|
+
* SYNCHRONOUS "this browser has no navigator.gpu" decline included, which is the common case and
|
|
79
|
+
* the reason a plain WebGL page reports 1 here rather than 0. Stays 0 for `effectsRenderer:
|
|
80
|
+
* "webgl"` (nothing was ever asked for) and for a runtime that adopted WebGPU and kept it. */
|
|
81
|
+
webgpuFallbacks: number;
|
|
82
|
+
/** COUNTER — bindings that took the WebGL backend under a runtime whose renderer is WebGPU,
|
|
83
|
+
* because THEIR shader cannot run there: it samples SCREEN_TEXTURE, its WGSL transpile refused a
|
|
84
|
+
* construct, or its module/pipeline failed to build. This is the counter that says the
|
|
85
|
+
* per-binding fallback is doing its job — one screen-reading shader must not veto N WebGPU
|
|
86
|
+
* canvases, and without this the only symptom would be a node that is quietly slower. */
|
|
87
|
+
webgpuBindingFallbacks: number;
|
|
88
|
+
/** The FIRST reason this runtime declined WebGPU (later ones cannot un-explain it), or null while
|
|
89
|
+
* it never has. THE diagnostic for a silent fallback: `renderer: "webgl"` under
|
|
90
|
+
* `effectsRenderer: "webgpu"` says something went wrong, and only this says what. */
|
|
91
|
+
webgpuFallbackReason: WebgpuFallbackReason | null;
|
|
92
|
+
/** COUNTER — `queue.submit` calls this runtime's WebGPU backend has made, sampled on read. ONE per
|
|
93
|
+
* tick that drew anything, whatever the binding count: that batching is the measured win (S7), so
|
|
94
|
+
* a probe that finds it climbing with N nodes has found the win being given back. 0 on WebGL,
|
|
95
|
+
* where the question is meaningless. */
|
|
96
|
+
webgpuSubmits: number;
|
|
97
|
+
/** GAUGE — `device.lost` resolutions seen by the page-wide device (see `../webgpu/device`). A lost
|
|
98
|
+
* device stops producing frames, so a non-zero value here next to `renderer: "webgl"` is the
|
|
99
|
+
* device-loss rebuild having happened. */
|
|
100
|
+
webgpuDeviceLosses: number;
|
|
101
|
+
/** GAUGE — `uncapturederror` events on the page-wide device. Non-zero means a frame was silently
|
|
102
|
+
* WRONG: WebGPU reports most command-level mistakes this way and nothing else says so. */
|
|
103
|
+
webgpuErrors: number;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* One shader to compile AHEAD of the node that will need it. See {@link WebglShaderRuntime.warmPrograms}.
|
|
107
|
+
*
|
|
108
|
+
* The same three values the create path derives from a node's `data-godot-shader-*` attributes, so a caller that
|
|
109
|
+
* knows its scene's shader set can name them without a node existing yet.
|
|
110
|
+
*/
|
|
111
|
+
interface WebglWarmSpec {
|
|
112
|
+
/** The shader id — the `programCache` key, and what `resolveShaderSource` is ultimately asked about. */
|
|
113
|
+
shaderKey: string;
|
|
114
|
+
/** Resource path passed to `resolveShaderSource`. Omit when the consumer resolves by uid alone. */
|
|
115
|
+
path?: string;
|
|
116
|
+
/** Resource uid passed to `resolveShaderSource`. */
|
|
117
|
+
uid?: string;
|
|
118
|
+
}
|
|
119
|
+
/** A persistent WebGL shader runtime for a mounted scene root (see createWebglShaderRuntime). */
|
|
120
|
+
interface WebglShaderRuntime {
|
|
121
|
+
/** Diff the live `[data-godot-shader-webgl]` set against the bindings: keep+update
|
|
122
|
+
* unchanged nodes (no forced layout), create new ones, dispose gone ones. */
|
|
123
|
+
reconcile(): void;
|
|
124
|
+
/** Live retune the backing-store resolution (devicePixelRatio × clamped `scale`) without a
|
|
125
|
+
* dispose+recreate — for an adaptive-quality consumer that lowers fill cost under load. While a
|
|
126
|
+
* pin is in force (see `setStaticShaderPixelRatio`) AND the runtime is in frozen mode this
|
|
127
|
+
* re-sizes nothing: the frozen backing stores (and their cached frames) are deliberately held
|
|
128
|
+
* still. The new scale still takes effect for live bindings the moment frozen mode is left. */
|
|
129
|
+
setRenderScale(scale: number): void;
|
|
130
|
+
/** Live set/clear the pinned FROZEN backing-store ratio (see `staticShaderPixelRatio`). Pass
|
|
131
|
+
* `undefined` (or a non-positive value) to un-pin, restoring `devicePixelRatio × renderScale`
|
|
132
|
+
* sizing for frozen bindings too. Only frozen bindings are affected — a live binding is never
|
|
133
|
+
* sized by the pin. */
|
|
134
|
+
setStaticShaderPixelRatio(ratio: number | undefined): void;
|
|
135
|
+
/** Live retune the animated re-render FPS cap (0 = uncapped). */
|
|
136
|
+
setFps(fps: number): void;
|
|
137
|
+
/** Live toggle frozen-TIME (single-shot) mode: render each shader ONCE at a pinned TIME and stop the loop
|
|
138
|
+
* (true), or resume per-frame animation (false). The low-end fallback that renders a correct still frame
|
|
139
|
+
* instead of a per-frame loop — see the `staticShaders` option. */
|
|
140
|
+
setStaticShaders(value: boolean): void;
|
|
141
|
+
/** Live toggle of the frozen-surface image swap (see the `staticShaderImages` option and
|
|
142
|
+
* `../surface-image-swap`). Turning it OFF reverts every live swap immediately and revokes its
|
|
143
|
+
* object URLs — the kill switch, safe to throw at any time. Turning it back ON re-arms the
|
|
144
|
+
* runtime's CONFIGURED policy (a boolean here never replaces it) and every binding re-earns. */
|
|
145
|
+
setStaticShaderImages(value: boolean): void;
|
|
146
|
+
/** HOST-DRIVEN revert of the surface image swap, WITHOUT blocking: with no argument every swapped
|
|
147
|
+
* surface is handed back to its canvas; with a node list, only the bindings at (or under) those
|
|
148
|
+
* elements. Each affected surface restarts its gate and re-earns the swap on its own. This is how
|
|
149
|
+
* a host that knows something the runtime cannot see — it is about to re-parent a subtree, it
|
|
150
|
+
* just re-themed, its own occlusion pass changed its mind — un-shadows a stale stand-in
|
|
151
|
+
* immediately instead of waiting for a watchdog window. */
|
|
152
|
+
invalidateStaticSurfaces(nodes?: Iterable<HTMLElement>): void;
|
|
153
|
+
/** The runtime's live counters (see `WebglShaderRuntimeStats`). Returns the SAME live object every
|
|
154
|
+
* call — read-only by convention; snapshot (spread) it to diff. All-zero on the no-op handle.
|
|
155
|
+
* `.profile` carries the opt-in per-frame cost attribution (`effectsProfiling`) and is NULL
|
|
156
|
+
* whenever it was not measured, the no-op handle included. */
|
|
157
|
+
stats(): WebglShaderRuntimeStats;
|
|
158
|
+
/**
|
|
159
|
+
* TEST / DIAGNOSTIC HOOK: the binding at (or under) `node` re-rendered into an offscreen texture
|
|
160
|
+
* and read back as tightly-packed RGBA (PREMULTIPLIED, top-down, at the canvas's BACKING-STORE
|
|
161
|
+
* size), or null when there is nothing to read — no binding there, a zero-sized canvas, or a
|
|
162
|
+
* binding rendering on WebGL.
|
|
163
|
+
*
|
|
164
|
+
* WEBGL RETURNS NULL ON PURPOSE, and it is not a gap: that canvas holds readable 2D pixels, so a
|
|
165
|
+
* caller who wants them uses `getImageData` on it. This exists because a WebGPU canvas has no such
|
|
166
|
+
* path — `drawImage`/`toDataURL` from one are blank under headless Chrome and pathological on
|
|
167
|
+
* Android (docs/perf-harness.md S7) — so the frame has to be produced a SECOND time, into a
|
|
168
|
+
* texture that `copyTextureToBuffer` can reach (`../webgpu/readback`). It renders the binding's
|
|
169
|
+
* CURRENT state at the runtime's current TIME, which for a frozen binding is exactly the frame on
|
|
170
|
+
* screen.
|
|
171
|
+
*
|
|
172
|
+
* This is the WebGL↔WebGPU image-parity harness's capture path.
|
|
173
|
+
*/
|
|
174
|
+
captureNodePixels?(node: HTMLElement): Promise<Uint8Array | null>;
|
|
175
|
+
/**
|
|
176
|
+
* Resolve, transpile and LINK these shaders now, so the node that eventually wants one finds it cached.
|
|
177
|
+
* Resolves to how many of `specs` ended with a usable program (cached ones included).
|
|
178
|
+
*
|
|
179
|
+
* WHY THIS EXISTS. `compileProgramAsync` yields to the driver before asking a blocking question, which on a
|
|
180
|
+
* device with `KHR_parallel_shader_compile` makes a cold link nearly free. WITHOUT that extension — and it is
|
|
181
|
+
* absent on real Android hardware; a Moto G86 answers null for it — `ready()` reports true immediately and
|
|
182
|
+
* `finish()` then blocks on `LINK_STATUS` for as long as the driver needs. One measured link cost 90.3 ms of
|
|
183
|
+
* main thread, and it landed mid-combat because that was the first frame a node asked for that shader.
|
|
184
|
+
*
|
|
185
|
+
* THIS CANNOT MAKE THE LINK FREE, and does not pretend to: the driver's work is the driver's work. It only
|
|
186
|
+
* lets a consumer choose WHEN to pay — behind a loading screen, where 90 ms is invisible, instead of on the
|
|
187
|
+
* frame a card is played. That is the whole claim, and it is the one to verify.
|
|
188
|
+
*
|
|
189
|
+
* PURELY ADDITIVE. Nothing about the lazy create path changes; this only populates the cache it already
|
|
190
|
+
* consults. A spec whose source will not resolve, or will not compile, is counted as a miss and leaves that
|
|
191
|
+
* shader exactly where it was — the node that needs it later keeps its CSS/SVG paint, as it does today. Safe
|
|
192
|
+
* to call more than once and safe to ignore the result.
|
|
193
|
+
*/
|
|
194
|
+
warmPrograms(specs: Iterable<WebglWarmSpec>): Promise<number>;
|
|
195
|
+
/** Tear everything down (cancel the rAF loop, disconnect observers, remove canvases). */
|
|
196
|
+
dispose(): void;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Create a PERSISTENT WebGL runtime for a mounted scene root. Unlike a teardown+reattach
|
|
200
|
+
* per render, the caller keeps this handle and calls `reconcile()` on each re-render:
|
|
201
|
+
* unchanged shader nodes KEEP their binding (a cheap attribute-only update — no
|
|
202
|
+
* `syncCanvasSize`/`clientWidth` forced layout), new nodes are created, gone nodes
|
|
203
|
+
* disposed. One shared rAF loop renders the live binding set. A no-op handle when WebGL2
|
|
204
|
+
* is unavailable or no shader resolver is configured.
|
|
205
|
+
*/
|
|
206
|
+
declare function createWebglShaderRuntime(root: HTMLElement, options: GodotHtmlRuntimeOptions): WebglShaderRuntime;
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/runtime.d.ts
|
|
209
|
+
/** Per-family overrides let an external host tune one binding without restarting the other. */
|
|
210
|
+
interface HtmlEffectsHostOptions extends GodotHtmlRuntimeOptions {
|
|
211
|
+
shaderOptions?: GodotHtmlRuntimeOptions;
|
|
212
|
+
particleOptions?: GodotHtmlRuntimeOptions;
|
|
213
|
+
}
|
|
214
|
+
/** One DOM binding owner; the canvas renderer has its own stage/frame lifecycle. */
|
|
215
|
+
interface HtmlEffectsHost {
|
|
216
|
+
readonly shaders: WebglShaderRuntime | null;
|
|
217
|
+
readonly particles: ParticleRuntime | null;
|
|
218
|
+
reconcile(): void;
|
|
219
|
+
updateOptions(options: HtmlEffectsHostOptions): void;
|
|
220
|
+
dispose(): void;
|
|
221
|
+
}
|
|
222
|
+
declare function createHtmlEffectsHost(stage: HTMLElement, initialOptions?: HtmlEffectsHostOptions): HtmlEffectsHost;
|
|
223
|
+
//#endregion
|
|
224
|
+
export { type GodotEffectRenderInfo, type GodotHtmlMountOptions, type GodotHtmlRuntimeOptions, HtmlEffectsHost, HtmlEffectsHostOptions, type ParticleProfile, type ParticleRuntime, type ParticleRuntimeStats, type ParticleSpecConfig, type WebglShaderRuntime, type WebglShaderRuntimeStats, type WebglWarmSpec, createHtmlEffectsHost, createParticleRuntime, createWebglShaderRuntime, normalizeParticleSpecConfig, parseParticleSpecConfig };
|
|
225
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../src/webgl/runtime.ts","../src/runtime.ts"],"mappings":";;;;;;;;UAknBiB,aAAA;;;EAGf,KAAA;;;;EAIA,QAAA;;;;;;EAMA,IAAA;;;;;EAKA,MAAA;AAAA;;;;UAYe,uBAAA,SAAgC,uBAAA;;EAE/C,KAAA;;EAEA,SAAA;;;;EAIA,SAAA;;;EAGA,UAAA;;;;;EAKA,YAAA;;;EAGA,cAAA;;;EAGA,WAAA;;;;;;EAMA,iBAAA;;;;EAIA,OAAA,EAAS,aAAA;;;;;;;;;;;;EAYT,QAAA;;;;;EAKA,eAAA;;;;;;EAMA,sBAAA;;;;EAIA,oBAAA,EAAsB,oBAAA;;;;;EAKtB,aAAA;;;;EAIA,kBAAA;;;EAGA,YAAA;AAAA;;;;;;;UAiDe,aAAA;;EAEf,SAAA;;EAEA,IAAA;;EAEA,GAAA;AAAA;;UAIe,kBAAA;;;EAGf,SAAA;;;;;;EAMA,cAAA,CAAe,KAAA;;;;;EAKf,yBAAA,CAA0B,KAAA;;EAE1B,MAAA,CAAO,GAAA;;;;EAIP,gBAAA,CAAiB,KAAA;;;;;EAKjB,qBAAA,CAAsB,KAAA;;;;;;;EAOtB,wBAAA,CAAyB,KAAA,GAAQ,QAAA,CAAS,WAAA;;;;;EAK1C,KAAA,IAAS,uBAAA;;;;;;;;;;;;;;;;;EAiBT,iBAAA,EAAmB,IAAA,EAAM,WAAA,GAAc,OAAA,CAAQ,UAAA;;;;;;;;;;;;;;;;;;;;EAoB/C,YAAA,CAAa,KAAA,EAAO,QAAA,CAAS,aAAA,IAAiB,OAAA;;EAE9C,OAAA;AAAA;;;;;;;;;iBAWc,wBAAA,CACd,IAAA,EAAM,WAAA,EACN,OAAA,EAAS,uBAAA,GACR,kBAAA;;;;UC50Bc,sBAAA,SAA+B,uBAAA;EAC9C,aAAA,GAAgB,uBAAA;EAChB,eAAA,GAAkB,uBAAA;AAAA;AD8mBpB;AAAA,UC1mBiB,eAAA;EAAA,SACN,OAAA,EAAS,kBAAA;EAAA,SACT,SAAA,EAAW,eAAA;EACpB,SAAA;EACA,aAAA,CAAc,OAAA,EAAS,sBAAA;EACvB,OAAA;AAAA;AAAA,iBAGc,qBAAA,CACd,KAAA,EAAO,WAAA,EACP,cAAA,GAAgB,sBAAA,GACf,eAAA"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as parseParticleSpecConfig, i as normalizeParticleSpecConfig, n as createWebglShaderRuntime, r as createParticleRuntime, t as createHtmlEffectsHost } from "./runtime-BkfFs_eO.js";
|
|
2
|
+
export { createHtmlEffectsHost, createParticleRuntime, createWebglShaderRuntime, normalizeParticleSpecConfig, parseParticleSpecConfig };
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@godot-scene-web/html",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Godot scene layout and effects renderer for DOM and CSS.",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"registry": "https://registry.npmjs.org/"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/tfoxy/godot-scene-web.git"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/tfoxy/godot-scene-web#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/tfoxy/godot-scene-web/issues"
|
|
18
|
+
},
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"development": "./src/index.ts",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./runtime": {
|
|
27
|
+
"development": "./src/runtime.ts",
|
|
28
|
+
"types": "./dist/runtime.d.ts",
|
|
29
|
+
"import": "./dist/runtime.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"main": "./dist/index.js",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"vendor",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@godot-scene-web/layout": "0.1.0",
|
|
41
|
+
"@godot-scene-web/scene-graph": "0.1.0",
|
|
42
|
+
"@godot-scene-web/core": "0.1.0",
|
|
43
|
+
"@godot-scene-web/effects": "0.1.0",
|
|
44
|
+
"@godot-scene-web/canvas-effects": "0.1.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@godot-scene-web/tscn-parser": "0.1.0"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsdown",
|
|
51
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
52
|
+
"test": "cd ../.. && vitest run --config vitest.config.ts packages/html/test"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
Binary file
|
package/vendor/VENDOR.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Godot default-theme font
|
|
2
|
+
|
|
3
|
+
`OpenSans_SemiBold.woff2` is a committed third-party binary, not a build
|
|
4
|
+
output. Godot 4.5.1 embeds these exact bytes as its default GUI theme font
|
|
5
|
+
(`scene/theme/default_theme.cpp` calls `set_data_ptr(_font_OpenSans_SemiBold,
|
|
6
|
+
...)`). The HTML renderer embeds the same bytes as a data URL so it works both
|
|
7
|
+
for source consumers and for a packed package without a host-specific asset
|
|
8
|
+
copy rule.
|
|
9
|
+
|
|
10
|
+
| file | bytes | sha256 |
|
|
11
|
+
| --- | ---: | --- |
|
|
12
|
+
| `OpenSans_SemiBold.woff2` | 46 392 | `661e2d9975d3029aeb32bf37b1b963c31c7c3ce08ac1bab2c8ebe27e135c4ec2` |
|
|
13
|
+
|
|
14
|
+
## Provenance
|
|
15
|
+
|
|
16
|
+
- Source: Godot Engine 4.5.1-stable,
|
|
17
|
+
`thirdparty/fonts/OpenSans_SemiBold.woff2`, copied byte-for-byte.
|
|
18
|
+
- Godot records its upstream as [Google Fonts: Open Sans](https://fonts.google.com/specimen/Open+Sans),
|
|
19
|
+
version 1.10, downloaded February 2021, under Apache License 2.0
|
|
20
|
+
(`thirdparty/README.md`).
|
|
21
|
+
- The file was converted by Godot from the unhinted TTF source using
|
|
22
|
+
[google/woff2](https://github.com/google/woff2), as recorded in that same
|
|
23
|
+
Godot third-party manifest.
|
|
24
|
+
|
|
25
|
+
## Packaging
|
|
26
|
+
|
|
27
|
+
`scripts/inline-default-font.mjs` regenerates
|
|
28
|
+
`src/default-font-data.ts` from this binary. That module is imported by the
|
|
29
|
+
renderer, so tsdown carries the data URL into `dist` and Vite source consumers
|
|
30
|
+
need neither a special URL resolver nor a copied font asset. The vendor binary
|
|
31
|
+
and this provenance file remain in the npm package for auditability.
|
|
32
|
+
|
|
33
|
+
## Default bold role
|
|
34
|
+
|
|
35
|
+
Godot does not select a separate Open Sans Bold file for `[b]`: its default
|
|
36
|
+
theme constructs a `FontVariation` over this SemiBold face with
|
|
37
|
+
`variation_embolden = 1.2` (`scene/theme/default_theme.cpp`). In
|
|
38
|
+
`TextServerAdvanced`, the variation contributes
|
|
39
|
+
`embolden * (font_size * 64) / 4096` to every glyph advance: 0.3 px at the
|
|
40
|
+
default 16 px. Browser `font-synthesis` changes glyph ink but does not make
|
|
41
|
+
`Range` geometry include that advance. The renderer therefore uses a 0.5 px
|
|
42
|
+
tracking emulation for the *implicit* default bold role: 0.3 px from Godot's
|
|
43
|
+
formula plus the measured cross-shaper/hinting rounding gap. It is deliberately
|
|
44
|
+
not applied when an explicit bold FontFile/FontVariation resolves, and it
|
|
45
|
+
resets a normal FontVariation's `spacing_glyph` instead of inheriting it.
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
Godot declares this historical Open Sans 1.10 binary Apache License 2.0. The
|
|
50
|
+
verbatim license text is in `LICENSE-OpenSans`; retain it with every copy of
|
|
51
|
+
the binary.
|