nucleation 0.3.6 → 0.3.7
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/Palette.d.ts +14 -1
- package/Palette.mjs +35 -1
- package/RenderConfig.d.ts +9 -0
- package/RenderConfig.mjs +17 -0
- package/nucleation.wasm +0 -0
- package/package.json +1 -1
package/Palette.d.ts
CHANGED
|
@@ -55,7 +55,9 @@ export class Palette {
|
|
|
55
55
|
static terracotta(): Palette;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Genuinely gray blocks: opaque full cubes whose measured color
|
|
59
|
+
* is near-neutral (low Oklab chroma) — judged from color data,
|
|
60
|
+
* not names.
|
|
59
61
|
*/
|
|
60
62
|
static grayscale(): Palette;
|
|
61
63
|
|
|
@@ -71,6 +73,17 @@ export class Palette {
|
|
|
71
73
|
*/
|
|
72
74
|
sortedByLightness(): Palette;
|
|
73
75
|
|
|
76
|
+
/**
|
|
77
|
+
* JSON array of exactly `steps` DISTINCT block ids forming the
|
|
78
|
+
* smoothest ramp this palette can make from (`r1`,`g1`,`b1`) to
|
|
79
|
+
* (`r2`,`g2`,`b2`): targets are evenly spaced along the Oklab line
|
|
80
|
+
* and blocks are chosen by a minimum-cost monotonic matching, so
|
|
81
|
+
* off-hue blocks are penalized and no block repeats. Errors with
|
|
82
|
+
* `InvalidArgument` when the palette has fewer than `steps` blocks,
|
|
83
|
+
* `steps` is 0, or start equals end.
|
|
84
|
+
*/
|
|
85
|
+
rampIdsJson(r1: number, g1: number, b1: number, r2: number, g2: number, b2: number, steps: number): string;
|
|
86
|
+
|
|
74
87
|
/**
|
|
75
88
|
* JSON array of exactly `steps` block ids sampling the color
|
|
76
89
|
* gradient from (`r1`,`g1`,`b1`) to (`r2`,`g2`,`b2`) in Oklab
|
package/Palette.mjs
CHANGED
|
@@ -157,7 +157,9 @@ export class Palette {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
|
-
*
|
|
160
|
+
* Genuinely gray blocks: opaque full cubes whose measured color
|
|
161
|
+
* is near-neutral (low Oklab chroma) — judged from color data,
|
|
162
|
+
* not names.
|
|
161
163
|
*/
|
|
162
164
|
static grayscale() {
|
|
163
165
|
|
|
@@ -206,6 +208,38 @@ export class Palette {
|
|
|
206
208
|
}
|
|
207
209
|
}
|
|
208
210
|
|
|
211
|
+
/**
|
|
212
|
+
* JSON array of exactly `steps` DISTINCT block ids forming the
|
|
213
|
+
* smoothest ramp this palette can make from (`r1`,`g1`,`b1`) to
|
|
214
|
+
* (`r2`,`g2`,`b2`): targets are evenly spaced along the Oklab line
|
|
215
|
+
* and blocks are chosen by a minimum-cost monotonic matching, so
|
|
216
|
+
* off-hue blocks are penalized and no block repeats. Errors with
|
|
217
|
+
* `InvalidArgument` when the palette has fewer than `steps` blocks,
|
|
218
|
+
* `steps` is 0, or start equals end.
|
|
219
|
+
*/
|
|
220
|
+
rampIdsJson(r1, g1, b1, r2, g2, b2, steps) {
|
|
221
|
+
const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
|
|
222
|
+
|
|
223
|
+
const write = new diplomatRuntime.DiplomatWriteBuf(wasm);
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
const result = wasm.Palette_ramp_ids_json(diplomatReceive.buffer, this.ffiValue, r1, g1, b1, r2, g2, b2, steps, write.buffer);
|
|
227
|
+
|
|
228
|
+
try {
|
|
229
|
+
if (!diplomatReceive.resultFlag) {
|
|
230
|
+
const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
|
|
231
|
+
throw new globalThis.Error('NucleationError.' + cause.value, { cause });
|
|
232
|
+
}
|
|
233
|
+
return write.readString8();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
finally {
|
|
237
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
238
|
+
diplomatReceive.free();
|
|
239
|
+
write.free();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
209
243
|
/**
|
|
210
244
|
* JSON array of exactly `steps` block ids sampling the color
|
|
211
245
|
* gradient from (`r1`,`g1`,`b1`) to (`r2`,`g2`,`b2`) in Oklab
|
package/RenderConfig.d.ts
CHANGED
|
@@ -37,6 +37,15 @@ export class RenderConfig {
|
|
|
37
37
|
*/
|
|
38
38
|
setZoom(zoom: number): void;
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Fit the camera to the model's bounding sphere instead of its
|
|
42
|
+
* yaw-dependent silhouette. The sphere is rotation invariant, so
|
|
43
|
+
* orbiting cameras (turntables) keep a constant distance instead
|
|
44
|
+
* of pulsing as the silhouette changes. Frames slightly looser
|
|
45
|
+
* than the default fit. Default: false.
|
|
46
|
+
*/
|
|
47
|
+
setSphereFit(sphereFit: boolean): void;
|
|
48
|
+
|
|
40
49
|
/**
|
|
41
50
|
* Set the vertical field of view in degrees (perspective projection
|
|
42
51
|
* only). Default: 45.
|
package/RenderConfig.mjs
CHANGED
|
@@ -97,6 +97,23 @@ export class RenderConfig {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Fit the camera to the model's bounding sphere instead of its
|
|
102
|
+
* yaw-dependent silhouette. The sphere is rotation invariant, so
|
|
103
|
+
* orbiting cameras (turntables) keep a constant distance instead
|
|
104
|
+
* of pulsing as the silhouette changes. Frames slightly looser
|
|
105
|
+
* than the default fit. Default: false.
|
|
106
|
+
*/
|
|
107
|
+
setSphereFit(sphereFit) {
|
|
108
|
+
wasm.RenderConfig_set_sphere_fit(this.ffiValue, sphereFit);
|
|
109
|
+
|
|
110
|
+
try {}
|
|
111
|
+
|
|
112
|
+
finally {
|
|
113
|
+
diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
100
117
|
/**
|
|
101
118
|
* Set the vertical field of view in degrees (perspective projection
|
|
102
119
|
* only). Default: 45.
|
package/nucleation.wasm
CHANGED
|
Binary file
|