@nexart/codemode-sdk 1.4.0 → 1.5.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 +13 -3
- package/dist/engine.d.ts +39 -17
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +253 -52
- package/dist/index.d.ts +13 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -11
- package/dist/loop-engine.d.ts +5 -1
- package/dist/loop-engine.d.ts.map +1 -1
- package/dist/loop-engine.js +25 -14
- package/dist/p5-runtime.d.ts +56 -4
- package/dist/p5-runtime.d.ts.map +1 -1
- package/dist/p5-runtime.js +743 -32
- package/dist/static-engine.d.ts +4 -1
- package/dist/static-engine.d.ts.map +1 -1
- package/dist/static-engine.js +13 -8
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
package/dist/p5-runtime.d.ts
CHANGED
|
@@ -1,11 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NexArt Code Mode Runtime SDK - p5-like Runtime
|
|
3
|
-
* Version: 1.4.0 (Protocol v1.2.0)
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
5
|
+
* ║ CODE MODE PROTOCOL v1.2.0 (Phase 3) — STABLE ║
|
|
6
|
+
* ║ ║
|
|
7
|
+
* ║ Status: HARD PROTOCOL ENFORCEMENT ║
|
|
8
|
+
* ║ This is the stable, canonical execution surface. ║
|
|
9
|
+
* ║ SDKs, ByX, and external builders can depend on this API. ║
|
|
10
|
+
* ║ ║
|
|
11
|
+
* ║ Phase 1 Surface: ║
|
|
12
|
+
* ║ - VAR[0..9]: 10 read-only protocol variables (0-100 range) ║
|
|
13
|
+
* ║ - Drawing: line, rect, ellipse, circle, triangle, quad, arc, etc. ║
|
|
14
|
+
* ║ - Style: fill, stroke, colorMode, strokeWeight ║
|
|
15
|
+
* ║ - Transform: push, pop, translate, rotate, scale ║
|
|
16
|
+
* ║ - Random: random(), randomSeed(), randomGaussian() (seeded) ║
|
|
17
|
+
* ║ - Noise: noise(), noiseSeed(), noiseDetail() (seeded) ║
|
|
18
|
+
* ║ - Math: map, constrain, lerp, lerpColor, dist, mag, norm ║
|
|
19
|
+
* ║ - Color: Full CSS format support, color extraction functions ║
|
|
20
|
+
* ║ - Time: frameCount, t, time, tGlobal ║
|
|
21
|
+
* ║ ║
|
|
22
|
+
* ║ Determinism Guarantees: ║
|
|
23
|
+
* ║ - Same code + same seed + same VARs = identical output ║
|
|
24
|
+
* ║ - No external state, no browser entropy, no time-based drift ║
|
|
25
|
+
* ║ - Randomness ONLY from: random(), noise() (both seeded) ║
|
|
26
|
+
* ║ ║
|
|
27
|
+
* ║ ⚠️ Future changes require Phase 2+ ║
|
|
28
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
7
29
|
*/
|
|
8
30
|
import type { TimeVariables } from './types';
|
|
31
|
+
/**
|
|
32
|
+
* Code Mode Protocol Version
|
|
33
|
+
* This constant defines the locked protocol version.
|
|
34
|
+
* Changes to the execution surface require a version bump.
|
|
35
|
+
*/
|
|
36
|
+
export declare const CODE_MODE_PROTOCOL_VERSION = "1.2.0";
|
|
37
|
+
export declare const CODE_MODE_PROTOCOL_PHASE = 3;
|
|
38
|
+
export declare const CODE_MODE_ENFORCEMENT: "HARD";
|
|
9
39
|
export interface P5Runtime {
|
|
10
40
|
[key: string]: any;
|
|
11
41
|
width: number;
|
|
@@ -16,6 +46,28 @@ export interface P5Runtime {
|
|
|
16
46
|
HALF_PI: number;
|
|
17
47
|
QUARTER_PI: number;
|
|
18
48
|
}
|
|
19
|
-
export
|
|
49
|
+
export interface P5RuntimeConfig {
|
|
50
|
+
seed?: number;
|
|
51
|
+
}
|
|
52
|
+
export declare function createP5Runtime(canvas: HTMLCanvasElement, width: number, height: number, config?: P5RuntimeConfig): P5Runtime;
|
|
20
53
|
export declare function injectTimeVariables(p: P5Runtime, time: TimeVariables): void;
|
|
54
|
+
/**
|
|
55
|
+
* VAR Protocol Constants (Phase 1 — Protocol v1.0.0)
|
|
56
|
+
* SDK v1.0.2: VAR input is optional (0-10 elements), but runtime always has 10
|
|
57
|
+
*/
|
|
58
|
+
export declare const VAR_COUNT = 10;
|
|
59
|
+
export declare const VAR_MIN = 0;
|
|
60
|
+
export declare const VAR_MAX = 100;
|
|
61
|
+
/**
|
|
62
|
+
* Create a protected, read-only VAR array for protocol execution.
|
|
63
|
+
*
|
|
64
|
+
* SDK v1.0.2 Rules (Protocol v1.0.0):
|
|
65
|
+
* - Input accepts 0-10 elements
|
|
66
|
+
* - Runtime VAR is ALWAYS 10 elements (padded with zeros)
|
|
67
|
+
* - Values are numeric, must be in 0-100 range (validated upstream)
|
|
68
|
+
* - Read-only: writes throw descriptive errors
|
|
69
|
+
* - Available in both setup() and draw()
|
|
70
|
+
*/
|
|
71
|
+
export declare function createProtocolVAR(vars?: number[]): readonly number[];
|
|
72
|
+
export declare function injectProtocolVariables(p: P5Runtime, vars?: number[]): void;
|
|
21
73
|
//# sourceMappingURL=p5-runtime.d.ts.map
|
package/dist/p5-runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"p5-runtime.d.ts","sourceRoot":"","sources":["../p5-runtime.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"p5-runtime.d.ts","sourceRoot":"","sources":["../p5-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,UAAU,CAAC;AAClD,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAC1C,eAAO,MAAM,qBAAqB,EAAG,MAAe,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EA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