@neo-ui-kit/react 1.3.4 → 1.3.6
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/README.md +1 -1
- package/dist/chunks/{chunk-NVKL7ONR.js → chunk-6VBE5UOI.js} +303 -4
- package/dist/chunks/{chunk-N5XCG6VF.js → chunk-X7KO7G4S.js} +1 -1
- package/dist/core/border-worker.d.ts +7 -0
- package/dist/core.js +1 -1
- package/dist/forms.js +2 -2
- package/dist/index.js +14 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ import "@neo-ui-kit/react/styles.css";
|
|
|
25
25
|
To test repository changes before publishing, run `npm run package` from the repository root and install the resulting archive in a separate application:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npm install /path/to/adui/release/neo-ui-kit-react-1.3.
|
|
28
|
+
npm install /path/to/adui/release/neo-ui-kit-react-1.3.6.tgz
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Maintainers publish new versions from `Pro100Dimka/adui` using the `release.yml` GitHub Actions workflow, a matching `v<version>` tag, and the `npm-publication` environment. npm trusts its OIDC identity; no `NPM_TOKEN` is required. The workflow checks the project and packed consumer before publishing the tested archive. Published `1.0.0` cannot be overwritten: code and README changes in npm require a new package version. See the [repository release instructions](https://github.com/Pro100Dimka/adui#npm-пакет).
|
|
@@ -9,6 +9,287 @@ import {
|
|
|
9
9
|
useMotion
|
|
10
10
|
} from "./chunk-FCOU3ODR.js";
|
|
11
11
|
|
|
12
|
+
// src/core/border-worker.js
|
|
13
|
+
function renderBorders() {
|
|
14
|
+
const scenes = /* @__PURE__ */ new Map();
|
|
15
|
+
let frame = null, fps = 30, last2 = -Infinity;
|
|
16
|
+
const release = (scene) => {
|
|
17
|
+
for (const layer of scene.layers) {
|
|
18
|
+
layer.mask.close();
|
|
19
|
+
layer.texture.close();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const draw = (scene) => {
|
|
23
|
+
const { ctx, width, height, points, length, radius } = scene;
|
|
24
|
+
ctx.clearRect(0, 0, width, height);
|
|
25
|
+
for (const layer of scene.layers) {
|
|
26
|
+
const paint = layer.ctx;
|
|
27
|
+
paint.globalCompositeOperation = "source-over";
|
|
28
|
+
paint.clearRect(0, 0, width, height);
|
|
29
|
+
for (const light of scene.lights) {
|
|
30
|
+
const index = (light.phase + scene.elapsed * light.speed / length) % 1 * 1024;
|
|
31
|
+
const lo = Math.floor(index), hi = (lo + 1) % 1024, weight = index - lo;
|
|
32
|
+
const x = points[lo * 2] * (1 - weight) + points[hi * 2] * weight;
|
|
33
|
+
const y = points[lo * 2 + 1] * (1 - weight) + points[hi * 2 + 1] * weight;
|
|
34
|
+
paint.drawImage(layer.texture, x - radius + 16, y - radius + 16, radius * 2, radius * 2);
|
|
35
|
+
}
|
|
36
|
+
paint.globalCompositeOperation = "destination-in";
|
|
37
|
+
paint.drawImage(layer.mask, 0, 0, width, height);
|
|
38
|
+
ctx.globalAlpha = layer.opacity;
|
|
39
|
+
ctx.drawImage(layer.buffer, 0, 0, width, height);
|
|
40
|
+
}
|
|
41
|
+
ctx.globalAlpha = 1;
|
|
42
|
+
};
|
|
43
|
+
const schedule2 = () => {
|
|
44
|
+
if (frame === null && [...scenes.values()].some((scene) => scene.visible))
|
|
45
|
+
frame = requestAnimationFrame(tick2);
|
|
46
|
+
};
|
|
47
|
+
function tick2(now) {
|
|
48
|
+
frame = null;
|
|
49
|
+
if (now - last2 >= 1e3 / fps - 0.5) {
|
|
50
|
+
for (const scene of scenes.values()) {
|
|
51
|
+
if (!scene.visible) continue;
|
|
52
|
+
if (scene.previous !== null) scene.elapsed += Math.min(0.1, Math.max(0, (now - scene.previous) / 1e3));
|
|
53
|
+
scene.previous = now;
|
|
54
|
+
draw(scene);
|
|
55
|
+
}
|
|
56
|
+
last2 = now;
|
|
57
|
+
}
|
|
58
|
+
schedule2();
|
|
59
|
+
}
|
|
60
|
+
onmessage = ({ data }) => {
|
|
61
|
+
const scene = scenes.get(data.id);
|
|
62
|
+
if (data.type === "rate") fps = data.fps;
|
|
63
|
+
else if (data.type === "remove") {
|
|
64
|
+
if (scene) release(scene);
|
|
65
|
+
scenes.delete(data.id);
|
|
66
|
+
} else if (data.type === "visible") {
|
|
67
|
+
if (scene) {
|
|
68
|
+
scene.visible = data.visible;
|
|
69
|
+
scene.previous = null;
|
|
70
|
+
}
|
|
71
|
+
} else if (data.type === "update") {
|
|
72
|
+
if (scene) release(scene);
|
|
73
|
+
const next = { ...data, canvas: scene?.canvas ?? data.canvas, elapsed: scene?.elapsed ?? data.elapsed, previous: null };
|
|
74
|
+
next.canvas.width = Math.ceil(data.width * data.dpr);
|
|
75
|
+
next.canvas.height = Math.ceil(data.height * data.dpr);
|
|
76
|
+
next.ctx = next.canvas.getContext("2d");
|
|
77
|
+
next.ctx.setTransform(data.dpr, 0, 0, data.dpr, 0, 0);
|
|
78
|
+
for (const layer of next.layers) {
|
|
79
|
+
layer.buffer = new OffscreenCanvas(next.canvas.width, next.canvas.height);
|
|
80
|
+
layer.ctx = layer.buffer.getContext("2d");
|
|
81
|
+
layer.ctx.setTransform(data.dpr, 0, 0, data.dpr, 0, 0);
|
|
82
|
+
}
|
|
83
|
+
scenes.set(data.id, next);
|
|
84
|
+
draw(next);
|
|
85
|
+
postMessage({ id: data.id, elapsed: next.elapsed, revision: data.revision });
|
|
86
|
+
}
|
|
87
|
+
schedule2();
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
var worker = null;
|
|
91
|
+
var workerUrl = null;
|
|
92
|
+
var serial = 0;
|
|
93
|
+
var unavailable = false;
|
|
94
|
+
var frameRate = 30;
|
|
95
|
+
var clients = /* @__PURE__ */ new Map();
|
|
96
|
+
var visibilityChanged = () => {
|
|
97
|
+
for (const client of clients.values()) client.visibility();
|
|
98
|
+
};
|
|
99
|
+
var resized = () => {
|
|
100
|
+
for (const client of clients.values()) client.update();
|
|
101
|
+
};
|
|
102
|
+
function setBorderFrameRate(fps) {
|
|
103
|
+
frameRate = fps;
|
|
104
|
+
worker?.postMessage({ type: "rate", fps });
|
|
105
|
+
}
|
|
106
|
+
function stopWorker() {
|
|
107
|
+
worker?.terminate();
|
|
108
|
+
if (workerUrl) URL.revokeObjectURL(workerUrl);
|
|
109
|
+
worker = workerUrl = null;
|
|
110
|
+
document.removeEventListener("visibilitychange", visibilityChanged);
|
|
111
|
+
window.removeEventListener("resize", resized);
|
|
112
|
+
}
|
|
113
|
+
function startWorker() {
|
|
114
|
+
if (worker) return worker;
|
|
115
|
+
try {
|
|
116
|
+
workerUrl = URL.createObjectURL(new Blob([`(${renderBorders.toString()})()`], { type: "text/javascript" }));
|
|
117
|
+
worker = new Worker(workerUrl);
|
|
118
|
+
} catch {
|
|
119
|
+
unavailable = true;
|
|
120
|
+
stopWorker();
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
worker.onmessage = ({ data }) => clients.get(data.id)?.ready(data);
|
|
124
|
+
worker.onerror = () => {
|
|
125
|
+
unavailable = true;
|
|
126
|
+
const pending = [...clients.values()];
|
|
127
|
+
stopWorker();
|
|
128
|
+
for (const client of pending) client.fail();
|
|
129
|
+
};
|
|
130
|
+
worker.postMessage({ type: "rate", fps: frameRate });
|
|
131
|
+
document.addEventListener("visibilitychange", visibilityChanged);
|
|
132
|
+
window.addEventListener("resize", resized);
|
|
133
|
+
return worker;
|
|
134
|
+
}
|
|
135
|
+
function createBorderWorker(item) {
|
|
136
|
+
if (unavailable || typeof Worker === "undefined" || typeof OffscreenCanvas === "undefined" || typeof createImageBitmap === "undefined" || typeof HTMLCanvasElement === "undefined" || !HTMLCanvasElement.prototype.transferControlToOffscreen || typeof IntersectionObserver === "undefined" || typeof MutationObserver === "undefined") return null;
|
|
137
|
+
const thread = startWorker();
|
|
138
|
+
if (!thread) return null;
|
|
139
|
+
const id = ++serial, host = item.element;
|
|
140
|
+
const groups = [...item.overlay.querySelectorAll(".ad-border-aura, .ad-border-core")];
|
|
141
|
+
const originalVisibility = groups.map((group) => group.style.visibility);
|
|
142
|
+
const canvas = document.createElement("canvas");
|
|
143
|
+
canvas.style.cssText = "position:absolute;left:-16px;top:-16px;pointer-events:none;visibility:hidden";
|
|
144
|
+
item.overlay.append(canvas);
|
|
145
|
+
let revision = 0, disposed = false, queued = false, signature = "", transferred = false;
|
|
146
|
+
let inView = false, visible = false, elapsed = item.elapsed, since = performance.now();
|
|
147
|
+
const renderer = { ready: false, update: queue, dispose };
|
|
148
|
+
const visibility = () => {
|
|
149
|
+
const motion = host.closest("[data-ad-motion]")?.dataset.adMotion !== "off";
|
|
150
|
+
const next = inView && motion && !document.hidden && !host.closest("[data-ad-offscreen], [data-ad-paused]");
|
|
151
|
+
canvas.style.display = motion ? "" : "none";
|
|
152
|
+
if (next === visible) return;
|
|
153
|
+
if (visible && renderer.ready) elapsed += (performance.now() - since) / 1e3;
|
|
154
|
+
since = performance.now();
|
|
155
|
+
visible = next;
|
|
156
|
+
thread.postMessage({ type: "visible", id, visible });
|
|
157
|
+
};
|
|
158
|
+
const observer = new IntersectionObserver((entries) => {
|
|
159
|
+
inView = entries[0].isIntersecting;
|
|
160
|
+
visibility();
|
|
161
|
+
}, { rootMargin: "16px" });
|
|
162
|
+
observer.observe(host);
|
|
163
|
+
const tokens = new MutationObserver((records) => {
|
|
164
|
+
visibility();
|
|
165
|
+
if (records.some((record) => ["style", "class", "data-ad-theme", "data-ad-color-scheme"].includes(record.attributeName))) queue();
|
|
166
|
+
});
|
|
167
|
+
for (let node = host; node; node = node.parentElement)
|
|
168
|
+
tokens.observe(node, { attributes: true, attributeFilter: ["style", "class", "data-ad-theme", "data-ad-color-scheme", "data-ad-motion", "data-ad-offscreen", "data-ad-paused"] });
|
|
169
|
+
clients.set(id, {
|
|
170
|
+
visibility,
|
|
171
|
+
update: queue,
|
|
172
|
+
ready(data) {
|
|
173
|
+
if (disposed || data.revision !== revision) return;
|
|
174
|
+
elapsed = data.elapsed;
|
|
175
|
+
since = performance.now();
|
|
176
|
+
renderer.ready = true;
|
|
177
|
+
groups.forEach((group) => {
|
|
178
|
+
group.style.visibility = "hidden";
|
|
179
|
+
});
|
|
180
|
+
canvas.style.visibility = "";
|
|
181
|
+
visibility();
|
|
182
|
+
},
|
|
183
|
+
fail() {
|
|
184
|
+
item.elapsed = elapsed + (visible && renderer.ready ? (performance.now() - since) / 1e3 : 0);
|
|
185
|
+
item.previousTime = null;
|
|
186
|
+
dispose();
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
function dispose() {
|
|
190
|
+
if (disposed) return;
|
|
191
|
+
disposed = true;
|
|
192
|
+
renderer.ready = false;
|
|
193
|
+
revision++;
|
|
194
|
+
observer.disconnect();
|
|
195
|
+
tokens.disconnect();
|
|
196
|
+
groups.forEach((group, index) => {
|
|
197
|
+
group.style.visibility = originalVisibility[index];
|
|
198
|
+
});
|
|
199
|
+
canvas.remove();
|
|
200
|
+
clients.delete(id);
|
|
201
|
+
if (worker === thread) thread.postMessage({ type: "remove", id });
|
|
202
|
+
if (!clients.size) stopWorker();
|
|
203
|
+
}
|
|
204
|
+
function queue() {
|
|
205
|
+
if (disposed || queued) return;
|
|
206
|
+
queued = true;
|
|
207
|
+
queueMicrotask(() => {
|
|
208
|
+
queued = false;
|
|
209
|
+
if (!disposed) void update();
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
async function update() {
|
|
213
|
+
const dpr = devicePixelRatio || 1;
|
|
214
|
+
const width = item.overlay.clientWidth + 32, height = item.overlay.clientHeight + 32;
|
|
215
|
+
const radius = item.lights[0].radius;
|
|
216
|
+
const styles = groups.map((group) => ({
|
|
217
|
+
mask: group.style.maskImage,
|
|
218
|
+
gradient: getComputedStyle(group.firstElementChild).backgroundImage,
|
|
219
|
+
opacity: Number(getComputedStyle(group).opacity)
|
|
220
|
+
}));
|
|
221
|
+
const key = JSON.stringify([item.geometry, dpr, styles]);
|
|
222
|
+
if (!item.length || key === signature) return;
|
|
223
|
+
signature = key;
|
|
224
|
+
const current = ++revision, images = [];
|
|
225
|
+
try {
|
|
226
|
+
const layers = [];
|
|
227
|
+
for (const style of styles) {
|
|
228
|
+
const mask = new Image();
|
|
229
|
+
mask.src = JSON.parse(style.mask.slice(4, -1));
|
|
230
|
+
await mask.decode();
|
|
231
|
+
const maskCanvas = document.createElement("canvas");
|
|
232
|
+
maskCanvas.width = Math.ceil(width * dpr);
|
|
233
|
+
maskCanvas.height = Math.ceil(height * dpr);
|
|
234
|
+
maskCanvas.getContext("2d").drawImage(mask, 0, 0, maskCanvas.width, maskCanvas.height);
|
|
235
|
+
const bitmap = await createImageBitmap(maskCanvas);
|
|
236
|
+
images.push(bitmap);
|
|
237
|
+
const texture = document.createElement("canvas");
|
|
238
|
+
texture.width = texture.height = Math.ceil(radius * 2 * dpr);
|
|
239
|
+
const ctx = texture.getContext("2d");
|
|
240
|
+
ctx.scale(dpr, dpr);
|
|
241
|
+
const gradient = ctx.createRadialGradient(radius, radius, 0, radius, radius, radius);
|
|
242
|
+
for (const stop of style.gradient.slice(style.gradient.indexOf(",") + 1, -1).split(/,\s*(?![^()]*\))/)) {
|
|
243
|
+
const match = stop.trim().match(/^(.*)\s+([\d.]+)%$/);
|
|
244
|
+
if (!match) throw new Error("Invalid border gradient");
|
|
245
|
+
gradient.addColorStop(Number(match[2]) / 100, match[1]);
|
|
246
|
+
}
|
|
247
|
+
ctx.fillStyle = gradient;
|
|
248
|
+
ctx.fillRect(0, 0, radius * 2, radius * 2);
|
|
249
|
+
const spot = await createImageBitmap(texture);
|
|
250
|
+
images.push(spot);
|
|
251
|
+
layers.push({ mask: bitmap, texture: spot, opacity: style.opacity });
|
|
252
|
+
}
|
|
253
|
+
if (disposed || current !== revision) {
|
|
254
|
+
images.forEach((image) => image.close());
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const points = new Float32Array(2048);
|
|
258
|
+
for (let index = 0; index < 1024; index++) {
|
|
259
|
+
const point = item.contour.point(index / 1024);
|
|
260
|
+
points[index * 2] = point.x;
|
|
261
|
+
points[index * 2 + 1] = point.y;
|
|
262
|
+
}
|
|
263
|
+
canvas.style.width = `${width}px`;
|
|
264
|
+
canvas.style.height = `${height}px`;
|
|
265
|
+
const surface = transferred ? void 0 : canvas.transferControlToOffscreen();
|
|
266
|
+
transferred = true;
|
|
267
|
+
thread.postMessage({
|
|
268
|
+
type: "update",
|
|
269
|
+
id,
|
|
270
|
+
revision: current,
|
|
271
|
+
canvas: surface,
|
|
272
|
+
width,
|
|
273
|
+
height,
|
|
274
|
+
dpr,
|
|
275
|
+
radius,
|
|
276
|
+
lights: item.lights.map(({ phase, speed }) => ({ phase, speed })),
|
|
277
|
+
points,
|
|
278
|
+
length: item.length,
|
|
279
|
+
layers,
|
|
280
|
+
elapsed: item.elapsed,
|
|
281
|
+
visible
|
|
282
|
+
}, [...images, points.buffer, ...surface ? [surface] : []]);
|
|
283
|
+
} catch {
|
|
284
|
+
images.forEach((image) => image.close());
|
|
285
|
+
if (!disposed) clients.get(id)?.fail();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
visibility();
|
|
289
|
+
queue();
|
|
290
|
+
return renderer;
|
|
291
|
+
}
|
|
292
|
+
|
|
12
293
|
// src/core/motion-engine.js
|
|
13
294
|
var uid = 0;
|
|
14
295
|
var U = {
|
|
@@ -27,8 +308,18 @@ var timer = null;
|
|
|
27
308
|
var last = 0;
|
|
28
309
|
var weakDevice = typeof navigator !== "undefined" && ((navigator.hardwareConcurrency || 8) <= 4 || (navigator.deviceMemory || 8) <= 4);
|
|
29
310
|
var FRAME = 1e3 / (weakDevice ? 20 : 30);
|
|
311
|
+
setBorderFrameRate(1e3 / FRAME);
|
|
30
312
|
U.setMotionFrameRate = (fps) => {
|
|
31
313
|
FRAME = 1e3 / Math.max(1, Math.min(120, fps));
|
|
314
|
+
setBorderFrameRate(1e3 / FRAME);
|
|
315
|
+
const now = performance.now();
|
|
316
|
+
for (const animation of looping) {
|
|
317
|
+
animation.__adStart = now - (animation.currentTime || 0);
|
|
318
|
+
if (FRAME > 1e3 / 60) animation.pause();
|
|
319
|
+
}
|
|
320
|
+
if (timer !== null) clearTimeout(timer);
|
|
321
|
+
timer = null;
|
|
322
|
+
refreshMotion();
|
|
32
323
|
};
|
|
33
324
|
var looping = /* @__PURE__ */ new Set();
|
|
34
325
|
var pendingAnimations = /* @__PURE__ */ new Set();
|
|
@@ -60,7 +351,7 @@ function scan(now, animations = pendingAnimations) {
|
|
|
60
351
|
for (const animation of animations)
|
|
61
352
|
if (!looping.has(animation) && animation.playState === "running" && isLoop(animation)) {
|
|
62
353
|
animation.__adStart = now - (animation.currentTime || 0);
|
|
63
|
-
animation.pause();
|
|
354
|
+
if (FRAME > 1e3 / 60) animation.pause();
|
|
64
355
|
looping.add(animation);
|
|
65
356
|
}
|
|
66
357
|
pendingAnimations.clear();
|
|
@@ -74,6 +365,7 @@ function scan(now, animations = pendingAnimations) {
|
|
|
74
365
|
}
|
|
75
366
|
const hidden = document.hidden || target.closest("[data-ad-offscreen], [data-ad-paused]");
|
|
76
367
|
if (hidden) {
|
|
368
|
+
if (FRAME <= 1e3 / 60 && animation.playState === "running") animation.pause();
|
|
77
369
|
animation.__adHeld = true;
|
|
78
370
|
continue;
|
|
79
371
|
}
|
|
@@ -81,6 +373,7 @@ function scan(now, animations = pendingAnimations) {
|
|
|
81
373
|
animation.__adStart = now - (animation.currentTime || 0);
|
|
82
374
|
animation.__adHeld = false;
|
|
83
375
|
}
|
|
376
|
+
if (FRAME <= 1e3 / 60 && animation.playState === "paused") animation.play();
|
|
84
377
|
active.push(animation);
|
|
85
378
|
}
|
|
86
379
|
}
|
|
@@ -109,7 +402,8 @@ function tick(now) {
|
|
|
109
402
|
item.sync();
|
|
110
403
|
}
|
|
111
404
|
if (now - last >= FRAME - 6) {
|
|
112
|
-
|
|
405
|
+
if (FRAME > 1e3 / 60)
|
|
406
|
+
for (const animation of active) animation.currentTime = now - animation.__adStart;
|
|
113
407
|
for (const scope of running) scope.tick(now);
|
|
114
408
|
for (const listener of tickers) listener(now);
|
|
115
409
|
last = now;
|
|
@@ -122,7 +416,7 @@ function tick(now) {
|
|
|
122
416
|
}
|
|
123
417
|
}
|
|
124
418
|
function hasVisibleWork() {
|
|
125
|
-
if (needsScan || tickers.size || active.length) return true;
|
|
419
|
+
if (needsScan || tickers.size || active.length && FRAME > 1e3 / 60) return true;
|
|
126
420
|
for (const item of measurements)
|
|
127
421
|
if (item.element.isConnected && item.element._adInView !== false) return true;
|
|
128
422
|
for (const scope of running)
|
|
@@ -432,7 +726,7 @@ U.attachBorder = (element, { shell = false, round = false, scope, defer = false
|
|
|
432
726
|
previousInlinePosition
|
|
433
727
|
};
|
|
434
728
|
item.paint = (time) => {
|
|
435
|
-
if (!item.length) return;
|
|
729
|
+
if (!item.length || item.worker?.ready) return;
|
|
436
730
|
if (item.previousTime !== null)
|
|
437
731
|
item.elapsed += Math.min(0.1, Math.max(0, time - item.previousTime));
|
|
438
732
|
item.previousTime = time;
|
|
@@ -488,6 +782,10 @@ U.attachBorder = (element, { shell = false, round = false, scope, defer = false
|
|
|
488
782
|
}
|
|
489
783
|
}
|
|
490
784
|
item.paint(scope?.time || 0);
|
|
785
|
+
if (scope) {
|
|
786
|
+
item.worker ??= createBorderWorker(item);
|
|
787
|
+
item.worker?.update();
|
|
788
|
+
}
|
|
491
789
|
};
|
|
492
790
|
const queueMeasurement = () => {
|
|
493
791
|
if (item.destroyed) return;
|
|
@@ -504,6 +802,7 @@ U.attachBorder = (element, { shell = false, round = false, scope, defer = false
|
|
|
504
802
|
measurements.delete(item);
|
|
505
803
|
unsubscribe?.();
|
|
506
804
|
item.observer.disconnect();
|
|
805
|
+
item.worker?.dispose();
|
|
507
806
|
overlay.remove();
|
|
508
807
|
if (item.patchedPosition) element.style.position = item.previousInlinePosition;
|
|
509
808
|
borders.delete(element);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function setBorderFrameRate(fps: any): void;
|
|
2
|
+
/** The SVG/CSS border remains intact until its replacement has painted, and is the fallback. */
|
|
3
|
+
export function createBorderWorker(item: any): {
|
|
4
|
+
ready: boolean;
|
|
5
|
+
update: () => void;
|
|
6
|
+
dispose: () => void;
|
|
7
|
+
} | null;
|
package/dist/core.js
CHANGED
package/dist/forms.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
defaultFieldRegistry,
|
|
5
5
|
useForm,
|
|
6
6
|
useFormContext
|
|
7
|
-
} from "./chunks/chunk-
|
|
8
|
-
import "./chunks/chunk-
|
|
7
|
+
} from "./chunks/chunk-X7KO7G4S.js";
|
|
8
|
+
import "./chunks/chunk-6VBE5UOI.js";
|
|
9
9
|
import "./chunks/chunk-BJSFN52W.js";
|
|
10
10
|
import "./chunks/chunk-FCOU3ODR.js";
|
|
11
11
|
export {
|
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
useSvgId,
|
|
62
62
|
variantMaterial,
|
|
63
63
|
vectorElement
|
|
64
|
-
} from "./chunks/chunk-
|
|
64
|
+
} from "./chunks/chunk-X7KO7G4S.js";
|
|
65
65
|
import {
|
|
66
66
|
ThemeProvider,
|
|
67
67
|
getMotionStats,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
useTabShape,
|
|
77
77
|
useThemePalette,
|
|
78
78
|
useTick
|
|
79
|
-
} from "./chunks/chunk-
|
|
79
|
+
} from "./chunks/chunk-6VBE5UOI.js";
|
|
80
80
|
import {
|
|
81
81
|
LocaleProvider,
|
|
82
82
|
addMessages,
|
|
@@ -3839,15 +3839,15 @@ var planet = {
|
|
|
3839
3839
|
const pixel = (y * width + x) * 4;
|
|
3840
3840
|
if (radial > 1.12) continue;
|
|
3841
3841
|
const light = clamp01(0.48 - dx * 0.8 - dy * 0.3, 0.08, 1.2);
|
|
3842
|
-
if (
|
|
3843
|
-
const
|
|
3842
|
+
if (edge <= -0.5) {
|
|
3843
|
+
const alpha2 = Math.exp(-(radial - 1) * 88) * 0.58 * light;
|
|
3844
3844
|
image.data[pixel] = 255;
|
|
3845
3845
|
image.data[pixel + 1] = 40;
|
|
3846
3846
|
image.data[pixel + 2] = 82;
|
|
3847
|
-
image.data[pixel + 3] = 255 *
|
|
3847
|
+
image.data[pixel + 3] = 255 * alpha2;
|
|
3848
3848
|
continue;
|
|
3849
3849
|
}
|
|
3850
|
-
const z = Math.sqrt(1 - dx * dx - dy * dy);
|
|
3850
|
+
const z = Math.sqrt(Math.max(0, 1 - dx * dx - dy * dy));
|
|
3851
3851
|
const terrainNoise = fbm(dx * 18 + z * 7, dy * 21 + z * 5, 6);
|
|
3852
3852
|
const crust = Math.pow(
|
|
3853
3853
|
1 - Math.abs(
|
|
@@ -3860,10 +3860,14 @@ var planet = {
|
|
|
3860
3860
|
const bloom = Math.exp(-Math.max(0, edge) / (15 * scale)) * light;
|
|
3861
3861
|
const shade = clamp01(0.48 - dx * 0.78 - z * 0.55, 0.07, 0.95);
|
|
3862
3862
|
const terrain = (10 + 61 * ridge + 26 * terrainNoise) * shade;
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3863
|
+
const coverage = clamp01(edge + 0.5);
|
|
3864
|
+
const alpha = coverage === 1 ? 1 : coverage + (1 - coverage) * Math.exp(-Math.max(0, radial - 1) * 88) * 0.58 * light;
|
|
3865
|
+
const surface = coverage / alpha;
|
|
3866
|
+
const atmosphere = 1 - surface;
|
|
3867
|
+
image.data[pixel] = (terrain + rim * 239 + bloom * 75) * surface + 255 * atmosphere;
|
|
3868
|
+
image.data[pixel + 1] = (terrain * 0.14 + rim * 165 + bloom * 8) * surface + 40 * atmosphere;
|
|
3869
|
+
image.data[pixel + 2] = (terrain * 0.34 + rim * 183 + bloom * 25) * surface + 82 * atmosphere;
|
|
3870
|
+
image.data[pixel + 3] = 255 * alpha;
|
|
3867
3871
|
}
|
|
3868
3872
|
}
|
|
3869
3873
|
};
|