@nexart/ui-renderer 0.3.1 → 0.6.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/README.md +343 -192
- package/dist/capabilities.d.ts +29 -8
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +120 -269
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/presets/primitives.d.ts.map +1 -1
- package/dist/presets/primitives.js +651 -0
- package/dist/preview/code-renderer.d.ts +31 -10
- package/dist/preview/code-renderer.d.ts.map +1 -1
- package/dist/preview/code-renderer.js +167 -27
- package/dist/system.d.ts +2 -1
- package/dist/system.d.ts.map +1 -1
- package/dist/system.js +35 -3
- package/dist/types.d.ts +6 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -2
- package/package.json +5 -2
- package/dist/preview/primitives/sketch.d.ts +0 -14
- package/dist/preview/primitives/sketch.d.ts.map +0 -1
- package/dist/preview/primitives/sketch.js +0 -407
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-renderer.d.ts","sourceRoot":"","sources":["../../src/preview/code-renderer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"code-renderer.d.ts","sourceRoot":"","sources":["../../src/preview/code-renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAMjE,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;AAuDD,UAAU,SAAS;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;CACxB;AA+GD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,EAAmC,GAC9C,SAAS,CA0eX;AAsCD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,iBAAiB,EACzB,OAAO,GAAE,cAAmB,GAC3B,YAAY,CA4Md"}
|
|
@@ -1,10 +1,72 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @nexart/ui-renderer v0.
|
|
2
|
+
* @nexart/ui-renderer v0.6.0 - Code Mode Renderer
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
5
|
+
* ║ PREVIEW RENDERER — MIRRORS @nexart/codemode-sdk BEHAVIOR ║
|
|
6
|
+
* ║ ║
|
|
7
|
+
* ║ This file is a MIRROR, not an authority. ║
|
|
8
|
+
* ║ ║
|
|
9
|
+
* ║ Authority: @nexart/codemode-sdk (Protocol v1.0.0) ║
|
|
10
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
11
|
+
*
|
|
12
|
+
* ARCHITECTURAL NOTE:
|
|
13
|
+
* -------------------
|
|
14
|
+
* Live preview animation requires local p5 runtime execution because:
|
|
15
|
+
* - @nexart/codemode-sdk.executeCodeMode() returns blobs (PNG/MP4), not frames
|
|
16
|
+
* - Real-time animation in the browser requires frame-by-frame canvas updates
|
|
17
|
+
* - The SDK's loop mode produces video files, not real-time rendering
|
|
18
|
+
*
|
|
19
|
+
* To ensure faithful mirroring, this renderer:
|
|
20
|
+
* 1. Uses identical forbidden pattern validation as the SDK
|
|
21
|
+
* 2. Uses identical VAR handling (read-only, 0-10 input → 10 runtime, 0-100 strict, errors not clamps)
|
|
22
|
+
* 3. Uses identical seeded RNG (Mulberry32) and Perlin noise
|
|
23
|
+
* 4. Uses identical time variable semantics (frameCount, t, time, tGlobal)
|
|
24
|
+
*
|
|
25
|
+
* For archival/canonical output, use @nexart/codemode-sdk directly.
|
|
6
26
|
*/
|
|
27
|
+
const PROTOCOL_VERSION = '1.0.0';
|
|
7
28
|
let activeRendererInstance = null;
|
|
29
|
+
/**
|
|
30
|
+
* Validate and normalize VAR array to 10 elements.
|
|
31
|
+
*
|
|
32
|
+
* ╔════════════════════════════════════════════════════════════════════════════╗
|
|
33
|
+
* ║ MUST MATCH @nexart/codemode-sdk v1.1.0 EXACTLY ║
|
|
34
|
+
* ║ Any change here requires updating codemode-sdk's normalizeVars() too. ║
|
|
35
|
+
* ╚════════════════════════════════════════════════════════════════════════════╝
|
|
36
|
+
*
|
|
37
|
+
* Rules (SDK v1.1.0, Protocol v1.0.0):
|
|
38
|
+
* - VAR is OPTIONAL: omit or pass [] for empty (defaults to all zeros)
|
|
39
|
+
* - VAR input length MUST be 0-10 elements (protocol error if > 10)
|
|
40
|
+
* - VAR values MUST be finite numbers (protocol error if not)
|
|
41
|
+
* - VAR values MUST be in range 0-100 (protocol error if out of range, NO clamping)
|
|
42
|
+
* - VAR is read-only inside sketches
|
|
43
|
+
* - Output is ALWAYS 10 elements (padded with zeros) for protocol consistency
|
|
44
|
+
*/
|
|
45
|
+
function normalizeVars(vars) {
|
|
46
|
+
if (!vars || !Array.isArray(vars)) {
|
|
47
|
+
console.log('[UIRenderer] No vars provided, using defaults [0,0,0,0,0,0,0,0,0,0]');
|
|
48
|
+
return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
49
|
+
}
|
|
50
|
+
if (vars.length > 10) {
|
|
51
|
+
throw new Error(`[Code Mode Protocol Error] VAR array must have at most 10 elements, got ${vars.length}`);
|
|
52
|
+
}
|
|
53
|
+
const result = [];
|
|
54
|
+
for (let i = 0; i < vars.length; i++) {
|
|
55
|
+
const v = vars[i];
|
|
56
|
+
if (typeof v !== 'number' || !Number.isFinite(v)) {
|
|
57
|
+
throw new Error(`[Code Mode Protocol Error] VAR[${i}] must be a finite number, got ${typeof v === 'number' ? v : typeof v}`);
|
|
58
|
+
}
|
|
59
|
+
if (v < 0 || v > 100) {
|
|
60
|
+
throw new Error(`[Code Mode Protocol Error] VAR[${i}] = ${v} is out of range. Values must be 0-100.`);
|
|
61
|
+
}
|
|
62
|
+
result.push(v);
|
|
63
|
+
}
|
|
64
|
+
// Pad with zeros to always have 10 elements for protocol consistency
|
|
65
|
+
while (result.length < 10) {
|
|
66
|
+
result.push(0);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
8
70
|
function createSeededRNG(seed = 123456) {
|
|
9
71
|
let a = seed >>> 0;
|
|
10
72
|
return () => {
|
|
@@ -54,7 +116,49 @@ function createSeededNoise(seed = 0) {
|
|
|
54
116
|
return (lerp(lerp(lerp(grad(permutation[AA], x, y, z), grad(permutation[BA], x - 1, y, z), u), lerp(grad(permutation[AB], x, y - 1, z), grad(permutation[BB], x - 1, y - 1, z), u), v), lerp(lerp(grad(permutation[AA + 1], x, y, z - 1), grad(permutation[BA + 1], x - 1, y, z - 1), u), lerp(grad(permutation[AB + 1], x, y - 1, z - 1), grad(permutation[BB + 1], x - 1, y - 1, z - 1), u), v), w) + 1) / 2;
|
|
55
117
|
};
|
|
56
118
|
}
|
|
57
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Create a protected, read-only VAR array for protocol execution.
|
|
121
|
+
*
|
|
122
|
+
* ╔════════════════════════════════════════════════════════════════════════════╗
|
|
123
|
+
* ║ MUST MATCH @nexart/codemode-sdk v1.1.0 EXACTLY ║
|
|
124
|
+
* ║ Any change here requires updating codemode-sdk's createProtocolVAR() too. ║
|
|
125
|
+
* ╚════════════════════════════════════════════════════════════════════════════╝
|
|
126
|
+
*
|
|
127
|
+
* SDK v1.1.0 Rules (Protocol v1.0.0):
|
|
128
|
+
* - Input accepts 0-10 elements
|
|
129
|
+
* - Runtime VAR is ALWAYS 10 elements (padded with zeros)
|
|
130
|
+
* - Values are numeric, must be in 0-100 range (validated upstream)
|
|
131
|
+
* - Read-only: writes throw descriptive errors
|
|
132
|
+
*/
|
|
133
|
+
function createProtectedVAR(vars) {
|
|
134
|
+
// Create frozen 10-element array (upstream normalizeVars ensures this)
|
|
135
|
+
const normalizedVars = [];
|
|
136
|
+
for (let i = 0; i < 10; i++) {
|
|
137
|
+
normalizedVars[i] = vars?.[i] ?? 0;
|
|
138
|
+
}
|
|
139
|
+
// Freeze the array to prevent modifications
|
|
140
|
+
const frozenVars = Object.freeze(normalizedVars);
|
|
141
|
+
// Wrap in Proxy for descriptive error messages on write attempts
|
|
142
|
+
return new Proxy(frozenVars, {
|
|
143
|
+
set(_target, prop, _value) {
|
|
144
|
+
const propName = typeof prop === 'symbol' ? prop.toString() : prop;
|
|
145
|
+
throw new Error(`[Code Mode Protocol Error] VAR is read-only. ` +
|
|
146
|
+
`Cannot write to VAR[${propName}]. ` +
|
|
147
|
+
`VAR[0..9] are protocol inputs, not sketch state.`);
|
|
148
|
+
},
|
|
149
|
+
deleteProperty(_target, prop) {
|
|
150
|
+
const propName = typeof prop === 'symbol' ? prop.toString() : prop;
|
|
151
|
+
throw new Error(`[Code Mode Protocol Error] VAR is read-only. ` +
|
|
152
|
+
`Cannot delete VAR[${propName}].`);
|
|
153
|
+
},
|
|
154
|
+
defineProperty(_target, prop) {
|
|
155
|
+
const propName = typeof prop === 'symbol' ? prop.toString() : prop;
|
|
156
|
+
throw new Error(`[Code Mode Protocol Error] Cannot define new VAR properties. ` +
|
|
157
|
+
`VAR is fixed at 10 elements (VAR[0..9]). Attempted: ${propName}`);
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
export function createP5Runtime(canvas, width, height, seed, vars = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) {
|
|
58
162
|
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
|
59
163
|
let currentFill = 'rgba(255, 255, 255, 1)';
|
|
60
164
|
let currentStroke = 'rgba(0, 0, 0, 1)';
|
|
@@ -105,10 +209,12 @@ export function createP5Runtime(canvas, width, height, seed) {
|
|
|
105
209
|
}
|
|
106
210
|
return 'rgba(0, 0, 0, 1)';
|
|
107
211
|
};
|
|
212
|
+
const protectedVAR = createProtectedVAR(vars);
|
|
108
213
|
const p = {
|
|
109
214
|
width,
|
|
110
215
|
height,
|
|
111
216
|
frameCount: 0,
|
|
217
|
+
VAR: protectedVAR,
|
|
112
218
|
PI: Math.PI,
|
|
113
219
|
TWO_PI: Math.PI * 2,
|
|
114
220
|
HALF_PI: Math.PI / 2,
|
|
@@ -492,7 +598,37 @@ function injectTimeVariables(p, time) {
|
|
|
492
598
|
p.time = time.time;
|
|
493
599
|
p.tGlobal = time.tGlobal;
|
|
494
600
|
}
|
|
601
|
+
/**
|
|
602
|
+
* Validate forbidden patterns in code.
|
|
603
|
+
* MIRRORS @nexart/codemode-sdk forbidden patterns exactly.
|
|
604
|
+
* Error messages match SDK wording for consistency.
|
|
605
|
+
*/
|
|
606
|
+
function validateForbiddenPatterns(code) {
|
|
607
|
+
const forbiddenPatterns = [
|
|
608
|
+
{ pattern: /setTimeout\s*\(/, name: 'setTimeout' },
|
|
609
|
+
{ pattern: /setInterval\s*\(/, name: 'setInterval' },
|
|
610
|
+
{ pattern: /requestAnimationFrame\s*\(/, name: 'requestAnimationFrame' },
|
|
611
|
+
{ pattern: /Date\.now\s*\(/, name: 'Date.now() — use time variable instead' },
|
|
612
|
+
{ pattern: /new\s+Date\s*\(/, name: 'new Date() — use time variable instead' },
|
|
613
|
+
{ pattern: /Math\.random\s*\(/, name: 'Math.random() — use random() instead (seeded)' },
|
|
614
|
+
{ pattern: /fetch\s*\(/, name: 'fetch() — external IO forbidden' },
|
|
615
|
+
{ pattern: /XMLHttpRequest/, name: 'XMLHttpRequest — external IO forbidden' },
|
|
616
|
+
{ pattern: /createCanvas\s*\(/, name: 'createCanvas() — canvas is pre-initialized' },
|
|
617
|
+
{ pattern: /document\./, name: 'DOM access — document.* forbidden' },
|
|
618
|
+
{ pattern: /window\./, name: 'DOM access — window.* forbidden' },
|
|
619
|
+
{ pattern: /\bimport\s+/, name: 'import — external imports forbidden' },
|
|
620
|
+
{ pattern: /\brequire\s*\(/, name: 'require() — external imports forbidden' },
|
|
621
|
+
];
|
|
622
|
+
for (const { pattern, name } of forbiddenPatterns) {
|
|
623
|
+
if (pattern.test(code)) {
|
|
624
|
+
throw new Error(`[Code Mode Protocol Error] Forbidden pattern: ${name}`);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
495
628
|
export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
629
|
+
console.log('[UIRenderer] Preview delegation → @nexart/codemode-sdk');
|
|
630
|
+
console.log(`[UIRenderer] Protocol version: ${PROTOCOL_VERSION}`);
|
|
631
|
+
console.log(`[UIRenderer] Mode: ${system.mode}`);
|
|
496
632
|
if (activeRendererInstance) {
|
|
497
633
|
activeRendererInstance.destroy();
|
|
498
634
|
activeRendererInstance = null;
|
|
@@ -504,6 +640,7 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
504
640
|
let animationId = null;
|
|
505
641
|
let isRunning = false;
|
|
506
642
|
let isDestroyed = false;
|
|
643
|
+
const normalizedVars = normalizeVars(system.vars);
|
|
507
644
|
const extractFunctions = (code) => {
|
|
508
645
|
const setupMatch = code.match(/function\s+setup\s*\(\s*\)\s*\{([\s\S]*?)\}(?=\s*function|\s*$)/);
|
|
509
646
|
const drawMatch = code.match(/function\s+draw\s*\(\s*\)\s*\{([\s\S]*?)\}(?=\s*function|\s*$)/);
|
|
@@ -512,18 +649,10 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
512
649
|
drawCode: drawMatch ? drawMatch[1].trim() : null,
|
|
513
650
|
};
|
|
514
651
|
};
|
|
515
|
-
const validateCode = (code) => {
|
|
516
|
-
const forbiddenPatterns = ['setTimeout', 'setInterval', 'requestAnimationFrame'];
|
|
517
|
-
for (const pattern of forbiddenPatterns) {
|
|
518
|
-
if (code.includes(pattern)) {
|
|
519
|
-
throw new Error(`Forbidden async timing function: ${pattern}`);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
};
|
|
523
652
|
const drawBadge = () => {
|
|
524
653
|
if (!showBadge)
|
|
525
654
|
return;
|
|
526
|
-
const text = '⚠️ Preview
|
|
655
|
+
const text = '⚠️ Preview (mirrors @nexart/codemode-sdk)';
|
|
527
656
|
ctx.font = '12px -apple-system, sans-serif';
|
|
528
657
|
const metrics = ctx.measureText(text);
|
|
529
658
|
const padding = 8;
|
|
@@ -541,14 +670,23 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
541
670
|
ctx.fillStyle = '#ff9999';
|
|
542
671
|
ctx.fillText(text, x + padding, y + 16);
|
|
543
672
|
};
|
|
673
|
+
const renderBlackCanvas = (error) => {
|
|
674
|
+
ctx.fillStyle = '#000000';
|
|
675
|
+
ctx.fillRect(0, 0, system.width, system.height);
|
|
676
|
+
ctx.fillStyle = '#ff6666';
|
|
677
|
+
ctx.font = '14px monospace';
|
|
678
|
+
ctx.fillText('[Protocol Error]', 20, 30);
|
|
679
|
+
ctx.fillText(error.message, 20, 50);
|
|
680
|
+
};
|
|
544
681
|
const renderStatic = () => {
|
|
545
682
|
try {
|
|
546
|
-
|
|
683
|
+
console.log('[UIRenderer] Delegating static render via protocol-aligned runtime');
|
|
684
|
+
validateForbiddenPatterns(system.source);
|
|
547
685
|
const { setupCode } = extractFunctions(system.source);
|
|
548
|
-
const p = createP5Runtime(canvas, system.width, system.height, system.seed);
|
|
686
|
+
const p = createP5Runtime(canvas, system.width, system.height, system.seed, normalizedVars);
|
|
549
687
|
injectTimeVariables(p, { frameCount: 0, t: 0, time: 0, tGlobal: 0 });
|
|
550
|
-
const wrappedSetup = new Function('p', 'frameCount', 't', 'time', 'tGlobal', `with(p) { ${setupCode} }`);
|
|
551
|
-
wrappedSetup(p, 0, 0, 0, 0);
|
|
688
|
+
const wrappedSetup = new Function('p', 'frameCount', 't', 'time', 'tGlobal', 'VAR', `with(p) { ${setupCode} }`);
|
|
689
|
+
wrappedSetup(p, 0, 0, 0, 0, p.VAR);
|
|
552
690
|
drawBadge();
|
|
553
691
|
onPreview?.(canvas);
|
|
554
692
|
canvas.toBlob((blob) => {
|
|
@@ -559,26 +697,27 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
559
697
|
}
|
|
560
698
|
catch (error) {
|
|
561
699
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
700
|
+
console.error('[UIRenderer Protocol Error]', err.message);
|
|
701
|
+
renderBlackCanvas(err);
|
|
562
702
|
onError?.(err);
|
|
563
|
-
throw err;
|
|
564
703
|
}
|
|
565
704
|
};
|
|
566
705
|
const renderLoop = () => {
|
|
567
706
|
if (isDestroyed)
|
|
568
707
|
return;
|
|
569
708
|
try {
|
|
570
|
-
|
|
709
|
+
console.log('[UIRenderer] Delegating loop render via protocol-aligned runtime');
|
|
710
|
+
validateForbiddenPatterns(system.source);
|
|
571
711
|
const { setupCode, drawCode } = extractFunctions(system.source);
|
|
572
712
|
if (!drawCode) {
|
|
573
|
-
throw new Error('Loop mode requires a draw() function');
|
|
713
|
+
throw new Error('[Protocol Error] Loop mode requires a draw() function');
|
|
574
714
|
}
|
|
575
715
|
const totalFrames = system.totalFrames ?? 60;
|
|
576
716
|
let frame = 0;
|
|
577
|
-
const p = createP5Runtime(canvas, system.width, system.height, system.seed);
|
|
578
|
-
const
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
wrappedSetup(p, 0, 0, 0, 0);
|
|
717
|
+
const p = createP5Runtime(canvas, system.width, system.height, system.seed, normalizedVars);
|
|
718
|
+
const wrappedSetup = new Function('p', 'frameCount', 't', 'time', 'tGlobal', 'VAR', `with(p) { ${setupCode} }`);
|
|
719
|
+
const wrappedDraw = new Function('p', 'frameCount', 't', 'time', 'tGlobal', 'VAR', `with(p) { ${drawCode} }`);
|
|
720
|
+
wrappedSetup(p, 0, 0, 0, 0, p.VAR);
|
|
582
721
|
const loop = () => {
|
|
583
722
|
if (!isRunning || isDestroyed)
|
|
584
723
|
return;
|
|
@@ -588,7 +727,7 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
588
727
|
injectTimeVariables(p, { frameCount: frame, t, time, tGlobal: t });
|
|
589
728
|
p.randomSeed(system.seed);
|
|
590
729
|
p.noiseSeed(system.seed);
|
|
591
|
-
wrappedDraw(p, frame, t, time, t);
|
|
730
|
+
wrappedDraw(p, frame, t, time, t, p.VAR);
|
|
592
731
|
drawBadge();
|
|
593
732
|
frame = (frame + 1) % totalFrames;
|
|
594
733
|
animationId = requestAnimationFrame(loop);
|
|
@@ -598,8 +737,9 @@ export function renderCodeModeSystem(system, canvas, options = {}) {
|
|
|
598
737
|
}
|
|
599
738
|
catch (error) {
|
|
600
739
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
740
|
+
console.error('[UIRenderer Protocol Error]', err.message);
|
|
741
|
+
renderBlackCanvas(err);
|
|
601
742
|
onError?.(err);
|
|
602
|
-
throw err;
|
|
603
743
|
}
|
|
604
744
|
};
|
|
605
745
|
const render = () => {
|
package/dist/system.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @nexart/ui-renderer v0.
|
|
2
|
+
* @nexart/ui-renderer v0.6.0 - System Creation & Validation
|
|
3
3
|
*
|
|
4
4
|
* Opinionated generative design system with aesthetic guardrails.
|
|
5
5
|
* Supports background, primitive, and sketch element types.
|
|
6
|
+
* Mirrors @nexart/codemode-sdk v1.1.0 VAR semantics.
|
|
6
7
|
*/
|
|
7
8
|
import type { NexArtSystemInput, NexArtSystem, DeclarativeSystem, NexArtCodeSystem, UnifiedSystem, ValidationResult } from './types';
|
|
8
9
|
export declare function validateSystem(input: NexArtSystemInput): ValidationResult;
|
package/dist/system.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EAEZ,iBAAiB,EAEjB,gBAAgB,EAEhB,aAAa,EAGb,gBAAgB,EAKjB,MAAM,SAAS,CAAC;AA6UjB,wBAAgB,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,gBAAgB,CAiBzE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,YAAY,CA8DnE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,gBAAgB,CAEjF;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,aAAa,CAEjF;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,iBAAiB,CAErF"}
|
package/dist/system.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @nexart/ui-renderer v0.
|
|
2
|
+
* @nexart/ui-renderer v0.6.0 - System Creation & Validation
|
|
3
3
|
*
|
|
4
4
|
* Opinionated generative design system with aesthetic guardrails.
|
|
5
5
|
* Supports background, primitive, and sketch element types.
|
|
6
|
+
* Mirrors @nexart/codemode-sdk v1.1.0 VAR semantics.
|
|
6
7
|
*/
|
|
7
|
-
const CURRENT_VERSION = '0.
|
|
8
|
+
const CURRENT_VERSION = '0.6';
|
|
8
9
|
function isCodeSystem(input) {
|
|
9
10
|
return 'type' in input && input.type === 'code';
|
|
10
11
|
}
|
|
@@ -22,7 +23,14 @@ const VALID_ELEMENT_TYPES = ['dots', 'lines', 'waves', 'grid', 'flowField', 'orb
|
|
|
22
23
|
const VALID_MOTION_SOURCES = ['none', 'time', 'seed'];
|
|
23
24
|
const VALID_TEXTURES = ['none', 'noise', 'grain'];
|
|
24
25
|
const VALID_BACKGROUND_PRESETS = ['layered-waves', 'soft-noise-field', 'orbital-lines', 'flowing-stripes', 'minimal-grid'];
|
|
25
|
-
const VALID_PRIMITIVE_NAMES = [
|
|
26
|
+
const VALID_PRIMITIVE_NAMES = [
|
|
27
|
+
'dots', 'lines', 'waves', 'stripes', 'circles', 'grid',
|
|
28
|
+
'polygons', 'diamonds', 'hexgrid', 'stars', 'concentricSquares',
|
|
29
|
+
'spirals', 'rays', 'orbits', 'rings', 'arcs', 'radialLines', 'petals',
|
|
30
|
+
'flow', 'particles', 'bubbles',
|
|
31
|
+
'crosshatch', 'chevrons', 'zigzag', 'weave', 'moire',
|
|
32
|
+
'curves', 'noise', 'mesh', 'branches',
|
|
33
|
+
];
|
|
26
34
|
const VALID_PALETTES = ['offwhite-dark', 'midnight', 'warm-neutral', 'ocean', 'sunset', 'forest'];
|
|
27
35
|
function validateUnifiedElement(el, index) {
|
|
28
36
|
const errors = [];
|
|
@@ -228,6 +236,29 @@ function validateCodeSystem(input) {
|
|
|
228
236
|
if (input.seed !== undefined && typeof input.seed !== 'number') {
|
|
229
237
|
errors.push('seed must be a number');
|
|
230
238
|
}
|
|
239
|
+
// VAR validation: matches @nexart/codemode-sdk v1.1.0 exactly
|
|
240
|
+
// - Input is optional (0-10 elements)
|
|
241
|
+
// - Values must be finite numbers in 0-100 range
|
|
242
|
+
// - Runtime is always 10 elements (padded with zeros)
|
|
243
|
+
if (input.vars !== undefined) {
|
|
244
|
+
if (!Array.isArray(input.vars)) {
|
|
245
|
+
errors.push('vars must be an array');
|
|
246
|
+
}
|
|
247
|
+
else if (input.vars.length > 10) {
|
|
248
|
+
errors.push(`[Code Mode Protocol Error] VAR array must have at most 10 elements, got ${input.vars.length}`);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
for (let i = 0; i < input.vars.length; i++) {
|
|
252
|
+
const v = input.vars[i];
|
|
253
|
+
if (typeof v !== 'number' || !Number.isFinite(v)) {
|
|
254
|
+
errors.push(`[Code Mode Protocol Error] VAR[${i}] must be a finite number, got ${typeof v === 'number' ? v : typeof v}`);
|
|
255
|
+
}
|
|
256
|
+
else if (v < 0 || v > 100) {
|
|
257
|
+
errors.push(`[Code Mode Protocol Error] VAR[${i}] = ${v} is out of range. Values must be 0-100.`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
231
262
|
return errors;
|
|
232
263
|
}
|
|
233
264
|
function validateDeclarativeSystem(input) {
|
|
@@ -289,6 +320,7 @@ export function createSystem(input) {
|
|
|
289
320
|
height: input.height,
|
|
290
321
|
seed: input.seed ?? Math.floor(Math.random() * 2147483647),
|
|
291
322
|
totalFrames: input.totalFrames,
|
|
323
|
+
vars: input.vars,
|
|
292
324
|
deterministic: true,
|
|
293
325
|
createdAt: new Date().toISOString(),
|
|
294
326
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @nexart/ui-renderer v0.
|
|
2
|
+
* @nexart/ui-renderer v0.6.0 - Type Definitions
|
|
3
3
|
*
|
|
4
4
|
* Opinionated generative design system with aesthetic guardrails.
|
|
5
5
|
* This SDK is non-canonical and for authoring/preview only.
|
|
6
|
+
* Mirrors @nexart/codemode-sdk v1.1.0 VAR semantics.
|
|
6
7
|
*/
|
|
7
|
-
export declare const SDK_VERSION = "0.
|
|
8
|
+
export declare const SDK_VERSION = "0.6.0";
|
|
8
9
|
export declare const AESTHETIC_DEFAULTS: {
|
|
9
10
|
readonly background: {
|
|
10
11
|
readonly r: 246;
|
|
@@ -52,7 +53,7 @@ export interface BackgroundElement {
|
|
|
52
53
|
loop?: LoopConfig;
|
|
53
54
|
seed?: number;
|
|
54
55
|
}
|
|
55
|
-
export type PrimitiveName = 'waves' | 'dots' | 'lines' | 'grid' | 'flow' | 'orbits' | 'circles' | 'stripes';
|
|
56
|
+
export type PrimitiveName = 'waves' | 'dots' | 'lines' | 'grid' | 'flow' | 'orbits' | 'circles' | 'stripes' | 'spirals' | 'rays' | 'stars' | 'polygons' | 'hexgrid' | 'arcs' | 'crosshatch' | 'chevrons' | 'zigzag' | 'rings' | 'diamonds' | 'bubbles' | 'mesh' | 'curves' | 'noise' | 'particles' | 'petals' | 'branches' | 'weave' | 'moire' | 'radialLines' | 'concentricSquares';
|
|
56
57
|
export interface PrimitiveElement {
|
|
57
58
|
type: 'primitive';
|
|
58
59
|
name: PrimitiveName;
|
|
@@ -101,6 +102,7 @@ export interface CodeSystem {
|
|
|
101
102
|
height: number;
|
|
102
103
|
seed?: number;
|
|
103
104
|
totalFrames?: number;
|
|
105
|
+
vars?: number[];
|
|
104
106
|
}
|
|
105
107
|
export interface BackgroundConfig {
|
|
106
108
|
color: string;
|
|
@@ -197,6 +199,7 @@ export interface NexArtCodeSystem {
|
|
|
197
199
|
height: number;
|
|
198
200
|
seed: number;
|
|
199
201
|
totalFrames?: number;
|
|
202
|
+
vars?: number[];
|
|
200
203
|
deterministic: boolean;
|
|
201
204
|
createdAt: string;
|
|
202
205
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQrB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AACrD,MAAM,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,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
package/dist/types.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @nexart/ui-renderer v0.
|
|
2
|
+
* @nexart/ui-renderer v0.6.0 - Type Definitions
|
|
3
3
|
*
|
|
4
4
|
* Opinionated generative design system with aesthetic guardrails.
|
|
5
5
|
* This SDK is non-canonical and for authoring/preview only.
|
|
6
|
+
* Mirrors @nexart/codemode-sdk v1.1.0 VAR semantics.
|
|
6
7
|
*/
|
|
7
|
-
export const SDK_VERSION = '0.
|
|
8
|
+
export const SDK_VERSION = '0.6.0';
|
|
8
9
|
export const AESTHETIC_DEFAULTS = {
|
|
9
10
|
background: { r: 246, g: 245, b: 242 },
|
|
10
11
|
foreground: { r: 45, g: 45, b: 45 },
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexart/ui-renderer",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Declarative and Code Mode system authoring SDK for NexArt Protocol (non-canonical, preview only)",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Declarative and Code Mode system authoring SDK for NexArt Protocol (non-canonical, preview only). Mirrors @nexart/codemode-sdk v1.1.0 VAR semantics.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
"build": "tsc",
|
|
21
21
|
"prepublishOnly": "npm run build"
|
|
22
22
|
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@nexart/codemode-sdk": "^1.0.0"
|
|
25
|
+
},
|
|
23
26
|
"devDependencies": {
|
|
24
27
|
"typescript": "^5.0.0"
|
|
25
28
|
},
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @nexart/ui-renderer v0.2.1 - Sketch Primitive Renderer
|
|
3
|
-
*
|
|
4
|
-
* Executes raw Code Mode p5-like sketches.
|
|
5
|
-
* This is NOT canonical output - for preview/exploration only.
|
|
6
|
-
*/
|
|
7
|
-
import type { SketchElement } from '../../types';
|
|
8
|
-
export interface SketchRenderer {
|
|
9
|
-
render: (frameCount: number) => void;
|
|
10
|
-
hasSetup: boolean;
|
|
11
|
-
hasDraw: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare function createSketchRenderer(element: SketchElement, ctx: CanvasRenderingContext2D, width: number, height: number, seed: number): SketchRenderer;
|
|
14
|
-
//# sourceMappingURL=sketch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sketch.d.ts","sourceRoot":"","sources":["../../../src/preview/primitives/sketch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA2ajD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,wBAAwB,EAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,cAAc,CAwChB"}
|