@primitiv-ui/harmoni-wasm 0.1.31 → 0.1.33

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/harmoni_wasm.d.ts CHANGED
@@ -11,6 +11,8 @@ export interface AlphaSwatch {
11
11
  alpha: number;
12
12
  step: number;
13
13
  oklch: string;
14
+ hex: string;
15
+ rgb: Rgb;
14
16
  }
15
17
 
16
18
  export interface ChromaHeadroom {
@@ -205,8 +207,32 @@ export function describe_oklch(l: number, c: number, h: number): OklchTriple;
205
207
  */
206
208
  export function generate_alpha_ramp(anchor: string): AlphaRamp;
207
209
 
210
+ /**
211
+ * Builds an alpha ramp of `steps` steps, so an alpha ramp can match the
212
+ * length of the solid ramp it accompanies — a seven-step ramp and a ten-step
213
+ * alpha companion would otherwise carry two different label sets for one
214
+ * ramp. `steps` outside the range `supported_step_range` reports is rejected
215
+ * rather than clamped.
216
+ */
217
+ export function generate_alpha_ramp_with_steps(anchor: string, steps: number): AlphaRamp;
218
+
208
219
  export function generate_neutral_ramp(white: string, black: string, tint: TintMode, bow: number): Palette;
209
220
 
221
+ /**
222
+ * Builds a neutral ramp of `steps` steps, so the neutral ramp can match the
223
+ * length of the solid ramps it sits beside — a ten-step neutral against a
224
+ * seven-step brand would otherwise carry two different label sets for one
225
+ * palette. Labels come from the same ladder `generate_palette_with_steps`
226
+ * walks. `steps` outside the range `supported_step_range` reports is rejected
227
+ * rather than clamped.
228
+ *
229
+ * Like every `palette_to_js` entry point, this has no native test:
230
+ * `serde_wasm_bindgen::to_value` needs a JS runtime, so the whole function is
231
+ * unreachable off-target. The step-count and label decisions it forwards are
232
+ * covered where they are actually made — `api::neutral_tests`.
233
+ */
234
+ export function generate_neutral_ramp_with_steps(white: string, black: string, tint: TintMode, bow: number, steps: number): Palette;
235
+
210
236
  export function generate_palette(hex: string, light_padding: number, dark_padding: number): Palette;
211
237
 
212
238
  export function generate_palette_pair(hex: string, light_lightness: Array<any>, dark_lightness: Array<any>, light_padding: number, dark_padding: number): PaletteSet;
@@ -338,7 +364,9 @@ export interface InitOutput {
338
364
  readonly derive_soft_neutrals: (a: number, b: number, c: number) => [number, number, number];
339
365
  readonly describe_oklch: (a: number, b: number, c: number) => any;
340
366
  readonly generate_alpha_ramp: (a: number, b: number) => [number, number, number];
367
+ readonly generate_alpha_ramp_with_steps: (a: number, b: number, c: number) => [number, number, number];
341
368
  readonly generate_neutral_ramp: (a: number, b: number, c: number, d: number, e: any, f: number) => [number, number, number];
369
+ readonly generate_neutral_ramp_with_steps: (a: number, b: number, c: number, d: number, e: any, f: number, g: number) => [number, number, number];
342
370
  readonly generate_palette: (a: number, b: number, c: number, d: number) => [number, number, number];
343
371
  readonly generate_palette_pair: (a: number, b: number, c: any, d: any, e: number, f: number) => [number, number, number];
344
372
  readonly generate_palette_pair_with_curve: (a: number, b: number, c: number, d: number, e: number, f: any) => [number, number, number];
package/harmoni_wasm.js CHANGED
@@ -120,6 +120,26 @@ export function generate_alpha_ramp(anchor) {
120
120
  return takeFromExternrefTable0(ret[0]);
121
121
  }
122
122
 
123
+ /**
124
+ * Builds an alpha ramp of `steps` steps, so an alpha ramp can match the
125
+ * length of the solid ramp it accompanies — a seven-step ramp and a ten-step
126
+ * alpha companion would otherwise carry two different label sets for one
127
+ * ramp. `steps` outside the range `supported_step_range` reports is rejected
128
+ * rather than clamped.
129
+ * @param {string} anchor
130
+ * @param {number} steps
131
+ * @returns {AlphaRamp}
132
+ */
133
+ export function generate_alpha_ramp_with_steps(anchor, steps) {
134
+ const ptr0 = passStringToWasm0(anchor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
135
+ const len0 = WASM_VECTOR_LEN;
136
+ const ret = wasm.generate_alpha_ramp_with_steps(ptr0, len0, steps);
137
+ if (ret[2]) {
138
+ throw takeFromExternrefTable0(ret[1]);
139
+ }
140
+ return takeFromExternrefTable0(ret[0]);
141
+ }
142
+
123
143
  /**
124
144
  * @param {string} white
125
145
  * @param {string} black
@@ -139,6 +159,37 @@ export function generate_neutral_ramp(white, black, tint, bow) {
139
159
  return takeFromExternrefTable0(ret[0]);
140
160
  }
141
161
 
162
+ /**
163
+ * Builds a neutral ramp of `steps` steps, so the neutral ramp can match the
164
+ * length of the solid ramps it sits beside — a ten-step neutral against a
165
+ * seven-step brand would otherwise carry two different label sets for one
166
+ * palette. Labels come from the same ladder `generate_palette_with_steps`
167
+ * walks. `steps` outside the range `supported_step_range` reports is rejected
168
+ * rather than clamped.
169
+ *
170
+ * Like every `palette_to_js` entry point, this has no native test:
171
+ * `serde_wasm_bindgen::to_value` needs a JS runtime, so the whole function is
172
+ * unreachable off-target. The step-count and label decisions it forwards are
173
+ * covered where they are actually made — `api::neutral_tests`.
174
+ * @param {string} white
175
+ * @param {string} black
176
+ * @param {TintMode} tint
177
+ * @param {number} bow
178
+ * @param {number} steps
179
+ * @returns {Palette}
180
+ */
181
+ export function generate_neutral_ramp_with_steps(white, black, tint, bow, steps) {
182
+ const ptr0 = passStringToWasm0(white, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
183
+ const len0 = WASM_VECTOR_LEN;
184
+ const ptr1 = passStringToWasm0(black, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
185
+ const len1 = WASM_VECTOR_LEN;
186
+ const ret = wasm.generate_neutral_ramp_with_steps(ptr0, len0, ptr1, len1, tint, bow, steps);
187
+ if (ret[2]) {
188
+ throw takeFromExternrefTable0(ret[1]);
189
+ }
190
+ return takeFromExternrefTable0(ret[0]);
191
+ }
192
+
142
193
  /**
143
194
  * @param {string} hex
144
195
  * @param {number} light_padding
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@primitiv-ui/harmoni-wasm",
3
3
  "type": "module",
4
4
  "description": "Public wasm-pack build of harmoni-core, the Primitiv palette engine.",
5
- "version": "0.1.31",
5
+ "version": "0.1.33",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",