@labpics/colors 0.9.1 → 0.10.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/index.d.ts CHANGED
@@ -1,37 +1,70 @@
1
- // Public types for @labpics/colors.
2
- //
3
- // Re-exports the wasm-bindgen-generated types (the rich `ResolvedTheme` /
4
- // `RoleResult` union and the `LabColors` engine) and the vanilla `applyTheme`
5
- // helper, so a consumer gets full typing from the package root.
6
-
7
- export {
8
- default,
9
- default as init,
10
- initSync,
11
- LabColors,
12
- } from "./pkg/labcolors.js";
13
-
14
- export type {
15
- ThemeName,
16
- SolvedColor,
17
- TranslucentRole,
18
- NoneRole,
19
- UnreachableRole,
20
- RoleResult,
21
- ResolvedTheme,
22
- } from "./pkg/labcolors.js";
23
-
24
- export { applyTheme } from "./apply-theme.js";
25
- export { watchTheme } from "./watch-theme.js";
26
- export type { WatchThemeOptions, WatchController } from "./watch-theme.js";
27
- export { adaptTheme } from "./adapt-theme.js";
28
- export type { AdaptThemeOptions, AdaptController } from "./adapt-theme.js";
29
- export {
30
- effectiveBackground,
31
- parseCssColor,
32
- compositeOver,
33
- compositeStackToHex,
34
- toHex,
35
- oklabLerp,
36
- } from "./effective-bg.js";
37
- export type { Rgba, EffectiveBackgroundOptions, StyleLike } from "./effective-bg.js";
1
+ // Public types for @labpics/colors.
2
+ //
3
+ // Re-exports the wasm-bindgen-generated types (the rich `ResolvedTheme` /
4
+ // `RoleResult` union and the `LabColors` engine) and the vanilla `applyTheme`
5
+ // helper, so a consumer gets full typing from the package root.
6
+
7
+ export {
8
+ default,
9
+ default as init,
10
+ initSync,
11
+ LabColors,
12
+ } from "./pkg/labcolors.js";
13
+
14
+ // Curated public schema/result surface. wasm-bindgen's InitOutput and raw
15
+ // __wbg_* ABI helpers remain implementation details.
16
+ export type {
17
+ ThemeName,
18
+ SolvedColor,
19
+ NoneRole,
20
+ UnreachableRole,
21
+ TranslucentRole,
22
+ GlowDecisionProfileV1,
23
+ GlowLayerRecipeProfileV1,
24
+ GlowDiagnosticProfileV1,
25
+ GlowTargetStatusV1,
26
+ NumericalIndeterminacyV1,
27
+ GlowBitExactDecisionGuaranteeV1,
28
+ GlowLegacyDecisionGuaranteeV1,
29
+ GlowDecisionGuaranteeV1,
30
+ GlowDeterminateRoleBase,
31
+ GlowStableExactNoopRole,
32
+ GlowLegacyReachedRole,
33
+ GlowLegacyUnreachableRole,
34
+ GlowDeterminateRole,
35
+ GlowIndeterminateRoleBase,
36
+ GlowIndeterminateRole,
37
+ GlowRole,
38
+ MaterialAlphaGuaranteeBaseV1,
39
+ MaterialBisectionBracketGuaranteeV1,
40
+ MaterialTransparentEndpointGuaranteeV1,
41
+ MaterialOpaqueEndpointGuaranteeV1,
42
+ MaterialAlphaGuaranteeV1,
43
+ MaterialRoleBase,
44
+ MaterialSatisfiedTransparentRole,
45
+ MaterialSatisfiedBracketRole,
46
+ MaterialDegradedOpaqueRole,
47
+ MaterialRole,
48
+ RoleResult,
49
+ ThemeAnchors,
50
+ LadderSource,
51
+ LadderPositionV1,
52
+ RoleRecipe,
53
+ ThemeConfig,
54
+ ResolvedTheme,
55
+ } from "./pkg/labcolors.js";
56
+
57
+ export { applyTheme } from "./apply-theme.js";
58
+ export { watchTheme } from "./watch-theme.js";
59
+ export type { WatchThemeOptions, WatchController } from "./watch-theme.js";
60
+ export { adaptTheme } from "./adapt-theme.js";
61
+ export type { AdaptThemeOptions, AdaptController } from "./adapt-theme.js";
62
+ export {
63
+ effectiveBackground,
64
+ parseCssColor,
65
+ compositeOver,
66
+ compositeStackToHex,
67
+ toHex,
68
+ oklabLerp,
69
+ } from "./effective-bg.js";
70
+ export type { Rgba, EffectiveBackgroundOptions, StyleLike } from "./effective-bg.js";
package/index.js CHANGED
@@ -1,21 +1,21 @@
1
- // Public entry for @labpics/colors.
2
- //
3
- // Re-exports the wasm-bindgen surface (the default `init` loader, `initSync`,
4
- // and the `LabColors` engine class) plus the vanilla DOM runtime helpers:
5
- // `applyTheme` (one-shot apply), `watchTheme` (reactive sync), and the
6
- // effective-background resolver. The wasm glue is the generated `pkg/` artifact
7
- // (built by `npm run build`).
8
-
9
- export { default, default as init, initSync, LabColors } from "./pkg/labcolors.js";
10
-
11
- export { applyTheme } from "./apply-theme.js";
12
- export { watchTheme } from "./watch-theme.js";
13
- export { adaptTheme } from "./adapt-theme.js";
14
- export {
15
- effectiveBackground,
16
- parseCssColor,
17
- compositeOver,
18
- compositeStackToHex,
19
- toHex,
20
- oklabLerp,
21
- } from "./effective-bg.js";
1
+ // Public entry for @labpics/colors.
2
+ //
3
+ // Re-exports the wasm-bindgen surface (the default `init` loader, `initSync`,
4
+ // and the `LabColors` engine class) plus the vanilla DOM runtime helpers:
5
+ // `applyTheme` (one-shot apply), `watchTheme` (reactive sync), and the
6
+ // effective-background resolver. The wasm glue is the generated `pkg/` artifact
7
+ // (built by `npm run build`).
8
+
9
+ export { default, default as init, initSync, LabColors } from "./pkg/labcolors.js";
10
+
11
+ export { applyTheme } from "./apply-theme.js";
12
+ export { watchTheme } from "./watch-theme.js";
13
+ export { adaptTheme } from "./adapt-theme.js";
14
+ export {
15
+ effectiveBackground,
16
+ parseCssColor,
17
+ compositeOver,
18
+ compositeStackToHex,
19
+ toHex,
20
+ oklabLerp,
21
+ } from "./effective-bg.js";
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@labpics/colors",
3
- "version": "0.9.1",
4
- "description": "Framework-agnostic contrast engine: resolve accessible, perceptually-anchored colour roles for any background. WASM core, zero runtime dependencies.",
3
+ "version": "0.10.0",
4
+ "packageManager": "npm@11.9.0",
5
+ "description": "Contextual compiler and runtime resolver for client-owned color-token contracts. WASM core, zero runtime dependencies.",
5
6
  "type": "module",
6
7
  "license": "MIT",
7
8
  "publishConfig": {
@@ -35,9 +36,12 @@
35
36
  "default": "./effective-bg.js"
36
37
  },
37
38
  "./pkg/labcolors_bg.wasm": "./pkg/labcolors_bg.wasm",
39
+ "./build-metadata.json": "./build-metadata.json",
38
40
  "./package.json": "./package.json"
39
41
  },
40
42
  "files": [
43
+ "LICENSE",
44
+ "build-metadata.json",
41
45
  "index.js",
42
46
  "index.d.ts",
43
47
  "apply-theme.js",
@@ -55,9 +59,11 @@
55
59
  ],
56
60
  "scripts": {
57
61
  "//build": "wasm-pack resolves --out-dir relative to the CRATE dir (crates/labcolors-wasm), not the cwd, so the ../../packages path is correct and unambiguous regardless of where npm runs it.",
58
- "build": "wasm-pack build ../../crates/labcolors-wasm --release --target web --out-dir ../../packages/colors/pkg --out-name labcolors",
62
+ "build": "wasm-pack build ../../crates/labcolors-wasm --release --target web --out-dir ../../packages/colors/pkg --out-name labcolors --locked",
59
63
  "typecheck": "tsc --noEmit -p tsconfig.json",
60
- "test": "node --test"
64
+ "test": "node --test",
65
+ "prepack": "npm run build && node ../../scripts/prepare-npm-package.mjs",
66
+ "release:verify": "node ../../scripts/verify-package-release.mjs"
61
67
  },
62
68
  "devDependencies": {
63
69
  "typescript": "^5.5.0"
@@ -76,6 +82,6 @@
76
82
  "labpics"
77
83
  ],
78
84
  "engines": {
79
- "node": ">=18"
85
+ "node": ">=22.11.0"
80
86
  }
81
87
  }
@@ -72,12 +72,11 @@ export interface TranslucentRole {
72
72
  /** WCAG 2.1 ratio of the composite. */
73
73
  readonly compositeWcag: number;
74
74
  /**
75
- * `true` when the requested alpha was raised to the smallest resolvable value
76
- * (α_min) because the requested transparency is not reproducible in gamut — an
77
- * honest, flagged contract degradation (mirrors `SolvedColor.compressed` /
78
- * `GlowRole.degraded`). The colour never lies: the composite still equals the
79
- * target solid byte-for-byte; only `alpha` differs from what was asked. Always
80
- * `false` for a direct ladder emission.
75
+ * `true`, если запрошенная alpha не допускает ни одного byte-тинта,
76
+ * воспроизводящего цель в affine encoded-sRGB8 reference, и потому поднята до
77
+ * первого проходящего `binary64`. Композит остаётся побайтно равен целевому
78
+ * солиду; меняется только явно возвращённая `alpha`. У прямой лестницы всегда
79
+ * `false`.
81
80
  */
82
81
  readonly alphaCoerced: boolean;
83
82
  /**
@@ -95,24 +94,214 @@ export interface TranslucentRole {
95
94
  /** Свечение (kind glow, labui ADR-0002 §5): screen-слои + решённая интенсивность.
96
95
  * Потребитель красит слои с mix-blend-mode: screen; `vars` несёт
97
96
  * --lab-<role> (halo, oklch), --lab-<role>-core и --lab-<role>-alpha. */
98
- export interface GlowRole {
97
+ export type GlowDecisionProfileV1 = "stable-v1" | "legacy-platform-dependent-v1";
98
+ export type GlowLayerRecipeProfileV1 = "cam16-jprime-oklab-cusp-v1";
99
+ export type GlowDiagnosticProfileV1 = "cam16-ucs-jprime-li2017-v1";
100
+ export type GlowTargetStatusV1 =
101
+ | "exact-noop-unreachable"
102
+ | "legacy-reached"
103
+ | "legacy-unreachable";
104
+ export type NumericalIndeterminacyV1 =
105
+ | {
106
+ readonly reason: "sound-bound-unavailable";
107
+ readonly bounds: { readonly kind: "unavailable" };
108
+ }
109
+ | {
110
+ readonly reason: "interval-overlap";
111
+ readonly bounds: {
112
+ readonly kind: "outward";
113
+ readonly lower: number;
114
+ readonly upper: number;
115
+ };
116
+ };
117
+ export interface GlowBitExactDecisionGuaranteeV1 {
118
+ readonly kind: "bit-exact";
119
+ }
120
+ export interface GlowLegacyDecisionGuaranteeV1 {
121
+ readonly kind: "legacy-platform-dependent-v1";
122
+ }
123
+ export type GlowDecisionGuaranteeV1 =
124
+ | GlowBitExactDecisionGuaranteeV1
125
+ | GlowLegacyDecisionGuaranteeV1;
126
+
127
+ /** Поля, общие для трёх конструктивно допустимых определённых исходов Glow. */
128
+ export interface GlowDeterminateRoleBase {
99
129
  readonly kind: "glow";
100
130
  readonly cssVar: string;
101
- /** Слой пересвета (малый радиус), #RRGGBB. */
131
+ /** Core, предназначенный потребителем для меньшего blur; геометрия не моделируется. */
102
132
  readonly coreHex: string;
103
- /** Слой ореола — источник, #RRGGBB. */
133
+ /** Halo, предназначенный потребителем для большего blur; в recipe v1 это источник. */
104
134
  readonly haloHex: string;
105
135
  /** Интенсивность screen-слоя, (0, 1]. */
106
136
  readonly alpha: number;
107
- /** Фактический |ΔJ'| композита от фона. */
137
+ /** Каноническая CSS-запись той же alpha; vars использует буквально её. */
138
+ readonly alphaCss: string;
139
+ /** Exact reference-домен point-композита; не renderer/display certificate. */
140
+ readonly compositeProfile: "encoded-srgb8-screen-v1";
141
+ readonly compositeGuarantee: "bit-exact";
142
+ /** Версионированный алгоритм, построивший анатомию core/halo. */
143
+ readonly layerRecipeProfile: GlowLayerRecipeProfileV1;
144
+ /** Модель внешнего вида полного результата; обязательна, потому coreAchievedDj вычислен через CAM16. */
145
+ readonly appearanceDiagnosticProfile: GlowDiagnosticProfileV1;
146
+ /** Цель решается только по изолированному halo. */
147
+ readonly constraintLayer: "halo";
148
+ /** Запрошенный |ΔJ'| halo-композита. */
149
+ readonly targetDj: number;
150
+ /** Reference-композит изолированного halo на фоне резолва. */
151
+ readonly haloCompositeHex: string;
152
+ /** Фактический |ΔJ'| изолированного halo-композита. */
153
+ readonly haloAchievedDj: number;
154
+ /** Reference-композит изолированного core с той же alpha. */
155
+ readonly coreCompositeHex: string;
156
+ /** Фактический |ΔJ'| изолированного core-композита. */
157
+ readonly coreAchievedDj: number;
158
+ /** @deprecated Alias `haloAchievedDj` для совместимости. */
108
159
  readonly achievedDj: number;
109
- /** Цель недостижима — ближайший достижимый шаг (ADR-0002, закон 2). */
110
- readonly degraded: boolean;
111
- /** Ready-to-serve CSS value халo: "oklch(L% C H)". */
160
+ /** CSS-значение halo: `oklch(L% C H)`. */
112
161
  readonly css: string;
113
162
  }
114
163
 
115
- export type RoleResult = SolvedColor | TranslucentRole | GlowRole | NoneRole | UnreachableRole;
164
+ /** Точный no-op: выбор не вызывает CAM16 и не может достигнуть положительную цель. */
165
+ export interface GlowStableExactNoopRole extends GlowDeterminateRoleBase {
166
+ readonly decisionProfile: "stable-v1";
167
+ readonly decisionGuarantee: GlowBitExactDecisionGuaranteeV1;
168
+ readonly selectionDiagnosticProfile: null;
169
+ readonly targetStatus: "exact-noop-unreachable";
170
+ /** @deprecated Выведено из targetStatus. */
171
+ readonly degraded: true;
172
+ }
173
+
174
+ /** Legacy-выбор CAM16 достиг целевого |ΔJ'| в охарактеризованной среде исполнения. */
175
+ export interface GlowLegacyReachedRole extends GlowDeterminateRoleBase {
176
+ readonly decisionProfile: "legacy-platform-dependent-v1";
177
+ readonly decisionGuarantee: GlowLegacyDecisionGuaranteeV1;
178
+ readonly selectionDiagnosticProfile: GlowDiagnosticProfileV1;
179
+ readonly targetStatus: "legacy-reached";
180
+ /** @deprecated Выведено из targetStatus. */
181
+ readonly degraded: false;
182
+ }
183
+
184
+ /** Legacy-выбор CAM16 вернул максимум, не достигший целевого |ΔJ'|. */
185
+ export interface GlowLegacyUnreachableRole extends GlowDeterminateRoleBase {
186
+ readonly decisionProfile: "legacy-platform-dependent-v1";
187
+ readonly decisionGuarantee: GlowLegacyDecisionGuaranteeV1;
188
+ readonly selectionDiagnosticProfile: GlowDiagnosticProfileV1;
189
+ readonly targetStatus: "legacy-unreachable";
190
+ /** @deprecated Выведено из targetStatus. */
191
+ readonly degraded: true;
192
+ }
193
+
194
+ export type GlowDeterminateRole =
195
+ | GlowStableExactNoopRole
196
+ | GlowLegacyReachedRole
197
+ | GlowLegacyUnreachableRole;
198
+
199
+ /** Stable terminal outcome: no sound target/max decision, therefore no CSS vars. */
200
+ export interface GlowIndeterminateRoleBase {
201
+ readonly kind: "glow-indeterminate";
202
+ readonly cssVar: string;
203
+ readonly sourceHex: string;
204
+ readonly targetDj: number;
205
+ readonly constraintLayer: "halo";
206
+ readonly decisionProfile: "stable-v1";
207
+ readonly numericalSiteId: "glow-target-or-maximum-v1";
208
+ }
209
+
210
+ export type GlowIndeterminateRole = GlowIndeterminateRoleBase & NumericalIndeterminacyV1;
211
+
212
+ export type GlowRole = GlowDeterminateRole | GlowIndeterminateRole;
213
+
214
+ /** Численное свидетельство выбора material-alpha. Оно характеризует повторно
215
+ * проверенный результат профиля, а не строгую межплатформенную границу
216
+ * минимальной alpha. */
217
+ export interface MaterialAlphaGuaranteeBaseV1 {
218
+ /** Byte-scale affine binary64 compositor + original WCAG 2.1 (2018)
219
+ * `0.03928` EOTF, with a conservative channel envelope and both crossed seam
220
+ * sides. Platform-characterized because `powf` is not outward-bounded. */
221
+ readonly numericalProfile: "encoded-srgb-byte-scale-affine-platform-binary64-powf-v1";
222
+ }
223
+ /** Rechecked fail/pass endpoints from a fixed-step binary partition after the
224
+ * directed-search guard. No global-monotonicity, first-state or minimum claim. */
225
+ export interface MaterialBisectionBracketGuaranteeV1 extends MaterialAlphaGuaranteeBaseV1 {
226
+ readonly kind: "bisection-bracket-characterized-v1";
227
+ readonly iterations: number;
228
+ readonly lowerAlpha: number;
229
+ readonly upperAlpha: number;
230
+ }
231
+ export interface MaterialTransparentEndpointGuaranteeV1 extends MaterialAlphaGuaranteeBaseV1 {
232
+ readonly kind: "transparent-endpoint-characterized-v1";
233
+ }
234
+ export interface MaterialOpaqueEndpointGuaranteeV1 extends MaterialAlphaGuaranteeBaseV1 {
235
+ readonly kind: "opaque-endpoint-characterized-v1";
236
+ }
237
+ export type MaterialAlphaGuaranteeV1 =
238
+ | MaterialBisectionBracketGuaranteeV1
239
+ | MaterialTransparentEndpointGuaranteeV1
240
+ | MaterialOpaqueEndpointGuaranteeV1;
241
+
242
+ /** Двухслойный материал (kind material, #89): тинт `01` (с выведенной α) над
243
+ * опаковой базой `02`, обе — один тон. `vars` несёт --lab-<role> (солид-канон,
244
+ * опаковый), --lab-<role>-01 (тинт oklch/α) и --lab-<role>-02 (база, опаковая).
245
+ * Композит-гарантия читаемости пересчитываема из toneHex/alpha (α-граница). */
246
+ export interface MaterialRoleBase {
247
+ readonly kind: "material";
248
+ readonly cssVar: string;
249
+ /** Тон #RRGGBB: тинт 01, база 02 и солид-канон одновременно (равны). */
250
+ readonly toneHex: string;
251
+ /** Худший WCAG-контраст коммит-полюса по коридору [чёрный, белый]. */
252
+ readonly worstContrast: number;
253
+ /** Запрошенный WCAG-пол (4.5 / 3.0); держится только при `alphaStatus: "satisfied"`. */
254
+ readonly floor: number;
255
+ /** Коммит-полюс поверхности белый (true, тёмный тон) или чёрный (false). */
256
+ readonly poleWhite: boolean;
257
+ /** Фактический |ΔJ'| тона-базы от фона — различимость поверхности. */
258
+ readonly achievedDj: number;
259
+ /** Целевой |ΔJ'| тона был недостижим — ближайший достижимый (ADR-0002). */
260
+ readonly toneCompressed: boolean;
261
+ /** Оттенок семьи выродился у края гамута (честный флаг; false у нейтрали). */
262
+ readonly hueVanished: boolean;
263
+ /** Солид-канон отличим от фона резолва на 8-битной сетке. */
264
+ readonly distinct: boolean;
265
+ /** Ready-to-serve CSS value солид-канона: "oklch(L% C H)". */
266
+ readonly css: string;
267
+ }
268
+
269
+ /** Уже прозрачная граничная точка держит запрошенный пол. */
270
+ export interface MaterialSatisfiedTransparentRole extends MaterialRoleBase {
271
+ readonly alpha: 0;
272
+ readonly alphaGuarantee: MaterialTransparentEndpointGuaranteeV1;
273
+ readonly alphaStatus: "satisfied";
274
+ readonly guaranteed: true;
275
+ }
276
+
277
+ /** Повторно проверенная верхняя граница интервала держит запрошенный пол. */
278
+ export interface MaterialSatisfiedBracketRole extends MaterialRoleBase {
279
+ readonly alpha: number;
280
+ readonly alphaGuarantee: MaterialBisectionBracketGuaranteeV1;
281
+ readonly alphaStatus: "satisfied";
282
+ readonly guaranteed: true;
283
+ }
284
+
285
+ /** Даже непрозрачная граничная точка не держит запрошенный пол; возвращается alpha 1. */
286
+ export interface MaterialDegradedOpaqueRole extends MaterialRoleBase {
287
+ readonly alpha: 1;
288
+ readonly alphaGuarantee: MaterialOpaqueEndpointGuaranteeV1;
289
+ readonly alphaStatus: "degraded";
290
+ readonly guaranteed: false;
291
+ }
292
+
293
+ export type MaterialRole =
294
+ | MaterialSatisfiedTransparentRole
295
+ | MaterialSatisfiedBracketRole
296
+ | MaterialDegradedOpaqueRole;
297
+
298
+ export type RoleResult =
299
+ | SolvedColor
300
+ | TranslucentRole
301
+ | GlowRole
302
+ | MaterialRole
303
+ | NoneRole
304
+ | UnreachableRole;
116
305
 
117
306
  /** Пер-темная четвёрка якорных hex (light / dark / light-ic / dark-ic). */
118
307
  export interface ThemeAnchors {
@@ -129,16 +318,60 @@ export type LadderSource =
129
318
  | { kind: "sentiment"; name: string }
130
319
  | { kind: "neutral"; pick: "mid" | "edge" | "inverted" | "light" | "dark" };
131
320
 
321
+ /** Closed physical ladder menu accepted by the config compiler. */
322
+ export type LadderPositionV1 =
323
+ | "label-primary"
324
+ | "label-secondary"
325
+ | "label-tertiary"
326
+ | "label-quaternary"
327
+ | "fill-primary"
328
+ | "fill-secondary"
329
+ | "fill-tertiary"
330
+ | "fill-quaternary"
331
+ | "border-base"
332
+ | "border-soft"
333
+ | "border-strong"
334
+ | "focus-ring"
335
+ | "glow"
336
+ | "skeleton-base"
337
+ | "skeleton-highlight"
338
+ | "neutral-fill-primary"
339
+ | "neutral-fill-secondary"
340
+ | "neutral-fill-tertiary"
341
+ | "neutral-fill-quaternary"
342
+ | "neutral-border-base"
343
+ | "neutral-border-soft"
344
+ | "shadow-minor"
345
+ | "shadow-ambient"
346
+ | "shadow-penumbra"
347
+ | "shadow-major";
348
+
132
349
  /** Рецепт роли из физического меню движка. */
133
350
  export type RoleRecipe =
134
- | { kind: "text-anchor"; fraction: number; floor: "aa-text" | "aa-ui" | "none" }
351
+ | {
352
+ kind: "text-anchor";
353
+ fraction: number;
354
+ floor: "aa-text" | "aa-ui" | "none";
355
+ hue?: LadderSource;
356
+ }
135
357
  | { kind: "dj-anchor"; light: number; dark: number }
136
358
  | { kind: "decorative-lc"; magnitude: number }
137
- | { kind: "ladder"; source: LadderSource; position: string }
138
- | { kind: "glow"; source: LadderSource; step: "subtle" | "base" | "bloom" }
359
+ | {
360
+ kind: "ladder";
361
+ source: LadderSource;
362
+ position: LadderPositionV1;
363
+ floor?: "aa-text" | "aa-ui" | "none";
364
+ }
365
+ | {
366
+ kind: "glow";
367
+ source: LadderSource;
368
+ step: "subtle" | "base" | "bloom";
369
+ decision_profile: GlowDecisionProfileV1;
370
+ }
139
371
  | { kind: "pair-fill"; source: LadderSource }
140
372
  | { kind: "pair-label"; source: LadderSource; fraction: number; floor: "aa-text" | "aa-ui" | "none" }
141
373
  | { kind: "alpha-analog"; of: LadderSource; alpha: number }
374
+ | { kind: "material"; source: LadderSource; tone_light: number; tone_dark: number; floor: "aa-text" | "aa-ui" }
142
375
  | { kind: "zero" };
143
376
 
144
377
  /** Полный конфиг дизайн-системы клиента — вход loadConfig (JSON.stringify(config)). */
@@ -169,7 +402,7 @@ export interface ThemeConfig {
169
402
  readonly themes: ReadonlyArray<{ name: string; preset: "srgb" | "dim" | "srgb-ic" | "dim-ic" }>;
170
403
  /** Словарь ролей дизайн-системы. Конфиг обязан нести собственные роли; пустой
171
404
  * контракт (без `roles` и `aliases`) отклоняется на загрузке. */
172
- readonly roles?: ReadonlyArray<{ name: string; recipe: RoleRecipe }>;
405
+ readonly roles: ReadonlyArray<{ name: string; recipe: RoleRecipe }>;
173
406
  readonly aliases?: ReadonlyArray<{ alias: string; target: string }>;
174
407
  }
175
408
 
@@ -205,21 +438,13 @@ export class LabColors {
205
438
  free(): void;
206
439
  [Symbol.dispose](): void;
207
440
  /**
208
- * PROTOTYPE — NOT part of the public API (unlisted, `_`-prefixed; may change
209
- * or be removed without notice). Recheck one foreground set against MANY
210
- * background samples in a single call. The reactive controller's worst-case
211
- * loop rechecks the same foregrounds against every sample of a varying
212
- * backdrop; the dominant per-foreground CAM16 forward is background-
213
- * independent, so this shares it across all samples instead of recomputing it
214
- * per `recheckContrast` call.
215
- *
216
- * Returns a flat, background-major `Float64Array`: sample `s`, foreground `i`
217
- * is at `(s * fgHexes.length + i) * 2` (`lc`) and `+1` (`wcagRatio`). The
218
- * values are byte-identical to calling `recheckContrast(bgHexes[s], fgHexes,
219
- * theme)` for each `s`. Wiring the runtime to it is an OWNER decision (it
220
- * changes the controller↔engine call shape); it is measured, not adopted.
441
+ * Exact stable-Glow runtime recheck. Returns whether the point screen
442
+ * layer is a byte-for-byte no-op for every alpha under encoded sRGB8.
443
+ * `adaptTheme` uses this cheap core-owned predicate to detect the only
444
+ * stable determinate/indeterminate class transition without running CAM16
445
+ * or re-solving on every animated-background frame.
221
446
  */
222
- _recheckContrastMulti(bg_hexes: string[], fg_hexes: string[], theme: string): Float64Array;
447
+ isStableGlowPointNoop(tint_hex: string, bg_hex: string): boolean;
223
448
  /**
224
449
  * Загрузить конфиг дизайн-системы (JSON по типу `ThemeConfig` из `.d.ts`).
225
450
  *
@@ -232,7 +457,12 @@ export class LabColors {
232
457
  */
233
458
  loadConfig(json: string): string;
234
459
  /**
235
- * Calculate the muddiness score (0 to 1) of an sRGB hex colour.
460
+ * Return the frozen legacy `muddiness` coordinate for an sRGB hex colour.
461
+ *
462
+ * This is an experimental compatibility proxy: it reproduces the historic
463
+ * numeric API, but is not an observer-validated human clean/dirty verdict
464
+ * or a production decision. The legacy identifier is retained only for
465
+ * compatibility.
236
466
  */
237
467
  muddiness(hex: string): number;
238
468
  /**
@@ -256,6 +486,20 @@ export class LabColors {
256
486
  * an unknown theme.
257
487
  */
258
488
  recheckContrast(bg_hex: string, fg_hexes: string[], theme: string): Float64Array;
489
+ /**
490
+ * Recheck one foreground set against MANY background samples in a single
491
+ * call. The reactive controller's worst-case loop rechecks the same
492
+ * foregrounds against every sample of a varying backdrop (gradient / image /
493
+ * bg-blur / glass); the dominant per-foreground CAM16 forward is background-
494
+ * independent, so this shares it across all samples instead of recomputing it
495
+ * per `recheckContrast` call — a measured ~2.6x on the multi-sample recheck.
496
+ *
497
+ * Returns a flat, background-major `Float64Array`: sample `s`, foreground `i`
498
+ * is at `(s * fgHexes.length + i) * 2` (`lc`) and `+1` (`wcagRatio`). The
499
+ * values are byte-identical to calling `recheckContrast(bgHexes[s], fgHexes,
500
+ * theme)` for each `s`.
501
+ */
502
+ recheckContrastMulti(bg_hexes: string[], fg_hexes: string[], theme: string): Float64Array;
259
503
  /**
260
504
  * Resolve every role for `bgHex` under `theme` (`"light" | "dark" |
261
505
  * "light-ic" | "dark-ic"`).
@@ -263,9 +507,9 @@ export class LabColors {
263
507
  * Returns a `ResolvedTheme` object. Per-role unreachability is part of a
264
508
  * successful result (each role carries its own `kind`); only whole-call
265
509
  * failures reject (no config loaded yet as `config_required`, invalid hex,
266
- * unknown theme, and the by-construction-unreachable oklch serialisation
267
- * failure as `internal_error`) — as a structured `"<code>: <message>"`
268
- * error, never an unwound panic.
510
+ * unknown theme, a core invariant failure, and the by-construction-
511
+ * unreachable oklch serialisation failure as `internal_error`) — as a
512
+ * structured `"<code>: <message>"` error, never an unwound panic.
269
513
  */
270
514
  resolveTheme(bg_hex: string, theme: string): ResolvedTheme;
271
515
  }
@@ -275,11 +519,12 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
275
519
  export interface InitOutput {
276
520
  readonly memory: WebAssembly.Memory;
277
521
  readonly __wbg_labcolors_free: (a: number, b: number) => void;
278
- readonly labcolors__recheckContrastMulti: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
522
+ readonly labcolors_isStableGlowPointNoop: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
279
523
  readonly labcolors_loadConfig: (a: number, b: number, c: number, d: number) => void;
280
524
  readonly labcolors_muddiness: (a: number, b: number, c: number, d: number) => void;
281
525
  readonly labcolors_new: () => number;
282
526
  readonly labcolors_recheckContrast: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
527
+ readonly labcolors_recheckContrastMulti: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
283
528
  readonly labcolors_resolveTheme: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
284
529
  readonly __wbindgen_export: (a: number, b: number) => number;
285
530
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;