@nexart/ui-renderer 0.8.7 → 0.8.8
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @nexart/ui-renderer v0.8.
|
|
2
|
+
* @nexart/ui-renderer v0.8.8 - Code Mode Renderer
|
|
3
3
|
*
|
|
4
4
|
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
5
5
|
* ║ PREVIEW RENDERER — LIGHTWEIGHT, NON-AUTHORITATIVE ║
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* ║ This renderer is a preview-only runtime. ║
|
|
8
8
|
* ║ It does not guarantee determinism or protocol compliance. ║
|
|
9
9
|
* ║ ║
|
|
10
|
-
* ║ Performance:
|
|
10
|
+
* ║ Performance: Native requestAnimationFrame (~60 FPS), canvas max 900px ║
|
|
11
11
|
* ║ Animation: Runs continuously until stop() is called ║
|
|
12
12
|
* ║ ║
|
|
13
13
|
* ║ For minting, export, or validation: use @nexart/codemode-sdk ║
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-renderer.d.ts","sourceRoot":"","sources":["../../src/preview/code-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"code-renderer.d.ts","sourceRoot":"","sources":["../../src/preview/code-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAiBjE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC;CACnB;AAwBD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,cAAmB,GAC3B,YAAY,CA4Sd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @nexart/ui-renderer v0.8.
|
|
2
|
+
* @nexart/ui-renderer v0.8.8 - Code Mode Renderer
|
|
3
3
|
*
|
|
4
4
|
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
5
5
|
* ║ PREVIEW RENDERER — LIGHTWEIGHT, NON-AUTHORITATIVE ║
|
|
@@ -7,14 +7,13 @@
|
|
|
7
7
|
* ║ This renderer is a preview-only runtime. ║
|
|
8
8
|
* ║ It does not guarantee determinism or protocol compliance. ║
|
|
9
9
|
* ║ ║
|
|
10
|
-
* ║ Performance:
|
|
10
|
+
* ║ Performance: Native requestAnimationFrame (~60 FPS), canvas max 900px ║
|
|
11
11
|
* ║ Animation: Runs continuously until stop() is called ║
|
|
12
12
|
* ║ ║
|
|
13
13
|
* ║ For minting, export, or validation: use @nexart/codemode-sdk ║
|
|
14
14
|
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import { createFpsThrottle, shouldRenderFrame, recordFrame, resetThrottle, } from './frame-budget';
|
|
16
|
+
import { CANVAS_LIMITS, } from './preview-types';
|
|
18
17
|
import { calculateScaledDimensions, applyScaledDimensions, reapplyContextScale, clearCanvasIgnoringTransform, } from './canvas-scaler';
|
|
19
18
|
import { createPreviewRuntime } from './preview-runtime';
|
|
20
19
|
const PROTOCOL_VERSION = '1.2.0';
|
|
@@ -42,8 +41,8 @@ function normalizeVars(vars) {
|
|
|
42
41
|
return result;
|
|
43
42
|
}
|
|
44
43
|
export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
45
|
-
console.log('[UIRenderer] Preview mode →
|
|
46
|
-
console.log(`[UIRenderer]
|
|
44
|
+
console.log('[UIRenderer] Preview mode → native requestAnimationFrame (~60 FPS)');
|
|
45
|
+
console.log(`[UIRenderer] Canvas max ${CANVAS_LIMITS.MAX_DIMENSION}px`);
|
|
47
46
|
if (activeRendererInstance) {
|
|
48
47
|
activeRendererInstance.destroy();
|
|
49
48
|
activeRendererInstance = null;
|
|
@@ -61,7 +60,6 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
61
60
|
let animationId = null;
|
|
62
61
|
let isRunning = false;
|
|
63
62
|
let isDestroyed = false;
|
|
64
|
-
const throttle = createFpsThrottle();
|
|
65
63
|
const normalizedVars = normalizeVars(system.vars);
|
|
66
64
|
let runtime = null;
|
|
67
65
|
let setupFn = null;
|
|
@@ -217,15 +215,14 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
217
215
|
if (setupFn) {
|
|
218
216
|
setupFn();
|
|
219
217
|
}
|
|
220
|
-
resetThrottle(throttle);
|
|
221
218
|
isRunning = true;
|
|
222
219
|
// ╔═══════════════════════════════════════════════════════════════════════╗
|
|
223
|
-
// ║ ANIMATION LOOP —
|
|
220
|
+
// ║ ANIMATION LOOP — NATIVE requestAnimationFrame (~60 FPS) ║
|
|
224
221
|
// ║ ║
|
|
225
|
-
// ║
|
|
226
|
-
// ║
|
|
222
|
+
// ║ v0.8.8: Removed FPS throttle for smooth rendering matching NexArt. ║
|
|
223
|
+
// ║ Browser handles frame pacing naturally via requestAnimationFrame. ║
|
|
227
224
|
// ║ Looping uses modulo math: t = (frame % total) / total ║
|
|
228
|
-
// ║ Canvas cleared before each draw
|
|
225
|
+
// ║ Canvas cleared before each draw() call. ║
|
|
229
226
|
// ╚═══════════════════════════════════════════════════════════════════════╝
|
|
230
227
|
const loop = () => {
|
|
231
228
|
// Schedule next frame first — loop runs until stop()
|
|
@@ -233,10 +230,6 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
233
230
|
// Exit if stopped or destroyed
|
|
234
231
|
if (!isRunning || isDestroyed)
|
|
235
232
|
return;
|
|
236
|
-
// FPS throttle — skip if not enough time has passed
|
|
237
|
-
if (!shouldRenderFrame(throttle)) {
|
|
238
|
-
return; // Preserve current canvas
|
|
239
|
-
}
|
|
240
233
|
frameCount++;
|
|
241
234
|
// Update runtime timing using modulo for natural looping
|
|
242
235
|
if (runtime) {
|
|
@@ -251,7 +244,6 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
251
244
|
if (drawFn)
|
|
252
245
|
drawFn();
|
|
253
246
|
drawBadge();
|
|
254
|
-
recordFrame(throttle);
|
|
255
247
|
}
|
|
256
248
|
catch (error) {
|
|
257
249
|
console.warn('[UIRenderer] Draw error:', error);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexart/ui-renderer",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"description": "Lightweight Preview Runtime for NexArt Protocol. Non-canonical,
|
|
3
|
+
"version": "0.8.8",
|
|
4
|
+
"description": "Lightweight Preview Runtime for NexArt Protocol. Non-canonical, native requestAnimationFrame (~60 FPS, max 900px canvas).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|