@labpics/colors 0.10.0 → 1.0.3

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.js CHANGED
@@ -1,21 +1,499 @@
1
- // Public entry for @labpics/colors.
1
+ // Terminal C7c public entry for @labpics/colors.
2
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`).
3
+ // One runtime root: canonical Program wire -> ProgramRuntime -> ProgramSnapshot.
4
+ // Retired recipe engines and browser helper
5
+ // roots are intentionally not exported.
8
6
 
9
- export { default, default as init, initSync, LabColors } from "./pkg/labcolors.js";
7
+ import initWasm, {
8
+ initSync as initWasmSync,
9
+ compileProgramWire as compileProgramWireWasm,
10
+ attachProgramWire as attachProgramWireWasm,
11
+ decodeCertificateEnvelope as decodeCertificateEnvelopeWasm,
12
+ issueSourceCertificateEnvelope as issueSourceCertificateEnvelopeWasm,
13
+ ProgramAttachment,
14
+ ProgramRuntime,
15
+ } from "./pkg/labcolors.js";
16
+
17
+ let initState = "idle";
18
+ let initFlight;
10
19
 
11
- export { applyTheme } from "./apply-theme.js";
12
- export { watchTheme } from "./watch-theme.js";
13
- export { adaptTheme } from "./adapt-theme.js";
14
20
  export {
15
- effectiveBackground,
16
- parseCssColor,
17
- compositeOver,
18
- compositeStackToHex,
19
- toHex,
20
- oklabLerp,
21
- } from "./effective-bg.js";
21
+ evaluateWcag22,
22
+ numericalCapabilityManifest,
23
+ ProgramRuntime,
24
+ ProgramSnapshot,
25
+ ProgramAttachment,
26
+ ProgramAttachedSnapshot,
27
+ ProgramAttachedRender,
28
+ AttachedMaterializationAuthority,
29
+ } from "./pkg/labcolors.js";
30
+
31
+ export const MAX_CERTIFICATE_ENVELOPE_BYTES = 2_097_152;
32
+
33
+ const typedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype);
34
+ const intrinsicBufferGetter = Object.getOwnPropertyDescriptor(typedArrayPrototype, "buffer").get;
35
+ const intrinsicArrayBufferByteLengthGetter = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength").get;
36
+ const intrinsicByteLengthGetter = Object.getOwnPropertyDescriptor(
37
+ typedArrayPrototype,
38
+ "byteLength",
39
+ ).get;
40
+ const intrinsicLengthGetter = Object.getOwnPropertyDescriptor(
41
+ typedArrayPrototype,
42
+ "length",
43
+ ).get;
44
+ const intrinsicSet = Object.getOwnPropertyDescriptor(
45
+ typedArrayPrototype,
46
+ "set",
47
+ ).value;
48
+ const intrinsicAt = Object.getOwnPropertyDescriptor(typedArrayPrototype, "at").value;
49
+ const intrinsicTypedArrayTagGetter = Object.getOwnPropertyDescriptor(
50
+ typedArrayPrototype,
51
+ Symbol.toStringTag,
52
+ ).get;
53
+ const byteStorage = { Type: Uint8Array, tag: "Uint8Array", bytesPerElement: 1 };
54
+ const scenarioStorage = { Type: Uint32Array, tag: "Uint32Array", bytesPerElement: 4 };
55
+
56
+ const CERTIFICATE_ERROR_CODES = new Set([
57
+ "certificate_invalid_magic",
58
+ "certificate_unsupported_schema",
59
+ "certificate_unknown_operation",
60
+ "certificate_unknown_authority_kind",
61
+ "certificate_unsupported_authority_version",
62
+ "certificate_invalid_utf8",
63
+ "certificate_invalid_length",
64
+ "certificate_truncated_input",
65
+ "certificate_trailing_bytes",
66
+ "certificate_non_canonical_revision",
67
+ "certificate_invalid_payload_type",
68
+ "certificate_unsupported_payload_version",
69
+ "certificate_payload_digest_mismatch",
70
+ "certificate_binding_digest_mismatch",
71
+ "certificate_missing_producer_attestation",
72
+ "certificate_producer_binding_mismatch",
73
+ "certificate_runtime_artifact_mismatch",
74
+ "certificate_producer_revision_mismatch",
75
+ "certificate_content_identity_mismatch",
76
+ "certificate_context_mismatch",
77
+ "certificate_resource_limit_exceeded",
78
+ "certificate_admission_capacity_exceeded",
79
+ "certificate_unsupported_opaque",
80
+ "certificate_binding_conflict",
81
+ "certificate_invalid_input",
82
+ ]);
83
+
84
+ function certificateIngressError(code) {
85
+ const error = new Error("Certificate envelope input was refused");
86
+ error.code = code;
87
+ error.operation = "decodeCertificateEnvelope";
88
+ return error;
89
+ }
90
+
91
+ // Generated bindings копируют массив до Rust. Проверяем реальный storage,
92
+ // не вызывая пользовательские getters, instanceof hooks или prototype traps,
93
+ // и передаём copier-у только собственный fixed-length snapshot.
94
+ function inspectTypedArrayStorage(value, storage, invalid) {
95
+ let byteLength, length;
96
+ try {
97
+ if (Reflect.apply(intrinsicTypedArrayTagGetter, value, []) !== storage.tag) {
98
+ throw invalid();
99
+ }
100
+ // ValidateTypedArrayBounds rejects detached and out-of-bounds views even
101
+ // when intrinsic byteLength/length both report zero. at(0) is read-only.
102
+ Reflect.apply(intrinsicAt, value, [0]);
103
+ // A concurrent writer cannot participate in an atomic input snapshot.
104
+ // ArrayBuffer's intrinsic getter rejects shared storage, including other realms.
105
+ Reflect.apply(intrinsicArrayBufferByteLengthGetter,
106
+ Reflect.apply(intrinsicBufferGetter, value, []), []);
107
+ byteLength = Reflect.apply(intrinsicByteLengthGetter, value, []);
108
+ length = Reflect.apply(intrinsicLengthGetter, value, []);
109
+ if (
110
+ !Number.isSafeInteger(byteLength) || byteLength < 0 ||
111
+ length * storage.bytesPerElement !== byteLength ||
112
+ Object.getOwnPropertyDescriptor(value, "byteLength") !== undefined ||
113
+ Object.getOwnPropertyDescriptor(value, "length") !== undefined
114
+ ) {
115
+ throw invalid();
116
+ }
117
+ } catch {
118
+ throw invalid();
119
+ }
120
+ return { byteLength, length };
121
+ }
122
+
123
+ function copyTypedArrayStorage(value, storage, invalid, {
124
+ requiredLength,
125
+ maximumBytes,
126
+ tooLarge = invalid,
127
+ allocation = invalid,
128
+ } = {}, inspected = inspectTypedArrayStorage(value, storage, invalid)) {
129
+ const { byteLength, length } = inspected;
130
+ if (requiredLength !== undefined && length !== requiredLength) throw invalid();
131
+ if (maximumBytes !== undefined && byteLength > maximumBytes) throw tooLarge();
132
+ try {
133
+ if (
134
+ Reflect.apply(intrinsicByteLengthGetter, value, []) !== byteLength ||
135
+ Reflect.apply(intrinsicLengthGetter, value, []) !== length
136
+ ) {
137
+ throw invalid();
138
+ }
139
+ } catch {
140
+ throw invalid();
141
+ }
142
+ let normalized;
143
+ try {
144
+ normalized = new storage.Type(length);
145
+ } catch {
146
+ throw allocation();
147
+ }
148
+ try {
149
+ // Даже пустой detached/OOB view обязан пройти intrinsic set и получить отказ.
150
+ Reflect.apply(intrinsicSet, normalized, [value, 0]);
151
+ return normalized;
152
+ } catch {
153
+ throw invalid();
154
+ }
155
+ }
156
+
157
+ export function decodeCertificateEnvelope(bytes) {
158
+ return decodeCertificateEnvelopeWasm(copyTypedArrayStorage(
159
+ bytes, byteStorage, () => certificateIngressError("certificate_invalid_input"), {
160
+ maximumBytes: MAX_CERTIFICATE_ENVELOPE_BYTES,
161
+ tooLarge: () => certificateIngressError("certificate_resource_limit_exceeded"),
162
+ },
163
+ ));
164
+ }
165
+
166
+ function programIngressError(operation, code) {
167
+ const error = new Error("Program input was refused");
168
+ error.operation = operation;
169
+ error.code = code;
170
+ return error;
171
+ }
172
+
173
+ function copyProgramInput(value, storage, operation, code, requiredLength, inspected) {
174
+ const resource = operation === "attachmentUpdateObserved" || operation === "materializationAuthority"
175
+ ? "program_attachment_resource_exhausted" : "program_resource_exhausted";
176
+ return copyTypedArrayStorage(value, storage, () => programIngressError(operation, code), {
177
+ requiredLength,
178
+ allocation: () => programIngressError(operation, resource),
179
+ }, inspected);
180
+ }
181
+
182
+ // The two arrays describe one observation matrix. Admit both shapes before
183
+ // either snapshot allocation or the generated WASM copier can run.
184
+ function copyObservedInputs(scenarioIds, surfaces, surfaceCount, operation) {
185
+ const code = operation === "updateObserved" ? "program_update" : "program_attachment_update";
186
+ const invalid = () => programIngressError(operation, code);
187
+ if (
188
+ typeof surfaceCount !== "number" ||
189
+ !Number.isInteger(surfaceCount) ||
190
+ surfaceCount < 0 ||
191
+ surfaceCount > 0xffff_ffff
192
+ ) {
193
+ throw invalid();
194
+ }
195
+ const scenarios = inspectTypedArrayStorage(scenarioIds, scenarioStorage, invalid);
196
+ const pixels = inspectTypedArrayStorage(surfaces, byteStorage, invalid);
197
+ const expectedBytes = scenarios.length * surfaceCount * 3;
198
+ if (!Number.isSafeInteger(expectedBytes) || expectedBytes !== pixels.byteLength) {
199
+ throw invalid();
200
+ }
201
+ return [
202
+ copyProgramInput(scenarioIds, scenarioStorage, operation, code, undefined, scenarios),
203
+ copyProgramInput(surfaces, byteStorage, operation, code, undefined, pixels),
204
+ ];
205
+ }
206
+
207
+ export function compileProgramWire(bytes, streamId) {
208
+ return compileProgramWireWasm(copyProgramInput(
209
+ bytes, byteStorage, "compileProgramWire", "program_wire",
210
+ ), streamId);
211
+ }
212
+
213
+ const runtimeUpdateObserved = ProgramRuntime.prototype.updateObserved;
214
+ ProgramRuntime.prototype.updateObserved = function updateObserved(revision, scenarioIds, surfaces, surfaceCount) {
215
+ const [ownedIds, ownedSurfaces] = copyObservedInputs(scenarioIds, surfaces, surfaceCount, "updateObserved");
216
+ return runtimeUpdateObserved.call(this, revision, ownedIds, ownedSurfaces, surfaceCount);
217
+ };
218
+
219
+ // Идентичность и тело принадлежат Core; аргументы вызывающего кода не передаются.
220
+ export function issueSourceCertificateEnvelope() {
221
+ return issueSourceCertificateEnvelopeWasm();
222
+ }
223
+
224
+ export function isCertificateError(error) {
225
+ try {
226
+ if (!(error instanceof Error)) return false;
227
+ const operation = error.operation;
228
+ const code = error.code;
229
+ if (operation === "decodeCertificateEnvelope") return CERTIFICATE_ERROR_CODES.has(code);
230
+ if (operation === "issueSourceCertificateEnvelope") {
231
+ return code === "certificate_producer_identity_unavailable" ||
232
+ (code !== "certificate_invalid_input" && CERTIFICATE_ERROR_CODES.has(code));
233
+ }
234
+ return false;
235
+ } catch {
236
+ return false;
237
+ }
238
+ }
239
+
240
+ // wasm-bindgen выставляет `free()` как потребляющий метод JavaScript.
241
+ // Синхронный host callback может повторно войти в тот же объект, поэтому
242
+ // facade пакета держит небольшой JS-шлюз для каждой публичной операции
243
+ // attachment, включая освобождение. Rust-шлюз остаётся авторитетной
244
+ // отказоустойчивой границей внутри WASM.
245
+ const attachmentStates = new WeakMap();
246
+
247
+ function attachmentBusyError(operation) {
248
+ const error = new Error("Program attachment operation is already in progress");
249
+ error.code = "program_attachment_busy";
250
+ error.operation = operation;
251
+ return error;
252
+ }
253
+
254
+ function attachmentFreeBeforeDisposeError() {
255
+ const error = new Error("Program attachment must be disposed after external revoke before free");
256
+ error.code = "program_attachment_revoke_unconfirmed";
257
+ error.operation = "attachmentFree";
258
+ return error;
259
+ }
260
+
261
+ function withAttachmentOperation(attachment, operation, callback) {
262
+ const state = attachmentStates.get(attachment);
263
+ if (state === undefined) return callback();
264
+ if (state.busy) throw attachmentBusyError(operation);
265
+ state.busy = true;
266
+ try {
267
+ return callback();
268
+ } finally {
269
+ state.busy = false;
270
+ }
271
+ }
272
+
273
+ for (const [method, operation] of [
274
+ ["updateObserved", "attachmentUpdateObserved"],
275
+ ["updateUnknown", "attachmentUpdateUnknown"],
276
+ ["materializationAuthority", "materializationAuthority"],
277
+ ["materializationAuthorityFor", "materializationAuthority"],
278
+ ["dispose", "attachmentDispose"],
279
+ ]) {
280
+ const original = ProgramAttachment.prototype[method];
281
+ ProgramAttachment.prototype[method] = function guardedAttachmentOperation(...args) {
282
+ const result = withAttachmentOperation(this, operation, () => {
283
+ if (method === "updateObserved") {
284
+ [args[1], args[2]] = copyObservedInputs(args[1], args[2], args[3], operation);
285
+ } else if (method === "materializationAuthorityFor") {
286
+ args[1] = copyProgramInput(args[1], byteStorage, operation, "program_materialization_stale_identity", 32);
287
+ }
288
+ return original.apply(this, args);
289
+ });
290
+ if (method === "dispose") {
291
+ const state = attachmentStates.get(this);
292
+ if (state !== undefined) state.disposed = true;
293
+ }
294
+ return result;
295
+ };
296
+ }
297
+
298
+ const originalAttachmentFree = ProgramAttachment.prototype.free;
299
+ ProgramAttachment.prototype.free = function guardedAttachmentFree(...args) {
300
+ const state = attachmentStates.get(this);
301
+ if (state === undefined) return originalAttachmentFree.apply(this, args);
302
+ if (state.busy) throw attachmentBusyError("attachmentFree");
303
+ if (!state.disposed) throw attachmentFreeBeforeDisposeError();
304
+ state.busy = true;
305
+ try {
306
+ const result = originalAttachmentFree.apply(this, args);
307
+ attachmentStates.delete(this);
308
+ return result;
309
+ } finally {
310
+ state.busy = false;
311
+ }
312
+ };
313
+
314
+ // Generated alias захватывает исходный free до установки шлюза. Оба способа
315
+ // освобождения обязаны проверять busy и подтверждённый внешний revoke.
316
+ if (Symbol.dispose) {
317
+ ProgramAttachment.prototype[Symbol.dispose] = ProgramAttachment.prototype.free;
318
+ }
319
+
320
+ export function attachProgramWire(...args) {
321
+ args[0] = copyProgramInput(args[0], byteStorage, "attachProgramWire", "program_wire");
322
+ const attachment = attachProgramWireWasm(...args);
323
+ attachmentStates.set(attachment, { busy: false, disposed: false });
324
+ return attachment;
325
+ }
326
+
327
+ // wasm-bindgen returns every raw export from its loaders. The public facade
328
+ // deliberately erases that value: initialization is an effect, not a second
329
+ // uncurated ABI beside the typed package surface.
330
+ const PROGRAM_INFRASTRUCTURE_ERROR_CODES = [
331
+ "program_resource_exhausted",
332
+ "program_internal_invariant",
333
+ ];
334
+ const COMPILE_PROGRAM_ERROR_CODES = new Set([
335
+ ...PROGRAM_INFRASTRUCTURE_ERROR_CODES,
336
+ "program_wire",
337
+ "program_compile",
338
+ "program_family_artifacts_required",
339
+ "program_instantiate",
340
+ ]);
341
+ const UPDATE_PROGRAM_ERROR_CODES = new Set([
342
+ "program_update",
343
+ ...PROGRAM_INFRASTRUCTURE_ERROR_CODES,
344
+ ]);
345
+ const ATTACHMENT_ERROR_CODES = new Set([
346
+ ...COMPILE_PROGRAM_ERROR_CODES,
347
+ "program_attachment_binding",
348
+ "program_attachment_instantiate",
349
+ "program_attachment_sink_admission",
350
+ "program_attachment_resource_exhausted",
351
+ "program_attachment_internal_invariant",
352
+ "program_attachment_non_terminal_target",
353
+ ]);
354
+ const ATTACHMENT_UPDATE_ERROR_CODES = new Set([
355
+ "program_attachment_update",
356
+ "program_attachment_resource_exhausted",
357
+ "program_attachment_internal_invariant",
358
+ "program_attachment_already_disposed",
359
+ "program_attachment_patch_scope_mismatch",
360
+ "program_attachment_stamp_mismatch",
361
+ "program_attachment_revision_mismatch",
362
+ "program_attachment_already_installed",
363
+ "program_attachment_host_rejected",
364
+ "program_attachment_host_protocol",
365
+ "program_attachment_busy",
366
+ ]);
367
+ const ATTACHMENT_DISPOSE_ERROR_CODES = new Set([
368
+ "program_attachment_already_disposed",
369
+ "program_attachment_revoke_unconfirmed",
370
+ "program_attachment_dispose",
371
+ "program_attachment_busy",
372
+ ]);
373
+ const ATTACHMENT_FREE_ERROR_CODES = new Set([
374
+ "program_attachment_revoke_unconfirmed",
375
+ "program_attachment_busy",
376
+ ]);
377
+ const MATERIALIZATION_ERROR_CODES = new Set([
378
+ "program_attachment_resource_exhausted",
379
+ "program_materialization_not_ready",
380
+ "program_materialization_paint_not_authority",
381
+ "program_materialization_stale_revision",
382
+ "program_materialization_stale_identity",
383
+ "program_materialization_stale_sink_stamp",
384
+ "program_materialization_foreign_binding_epoch",
385
+ "program_materialization_terminal_binding_mismatch",
386
+ "program_materialization_missing_point_absence_proof",
387
+ "program_materialization_ambiguous_observation_cases",
388
+ "program_attachment_busy",
389
+ ]);
390
+ const PHYSICAL_IDENTITY_ERROR_CODES = new Set([
391
+ "program_physical_identity",
392
+ ]);
393
+
394
+ export function isProgramError(error) {
395
+ // A caught value may be a revoked Proxy or expose throwing/stateful getters.
396
+ // Classify one observation; never replace the original failure with a probe error.
397
+ try {
398
+ if (!(error instanceof Error)) return false;
399
+ const operation = error.operation;
400
+ const code = error.code;
401
+ if (operation === "compileProgramWire") return COMPILE_PROGRAM_ERROR_CODES.has(code);
402
+ if (operation === "updateObserved" || operation === "updateUnknown") {
403
+ return UPDATE_PROGRAM_ERROR_CODES.has(code);
404
+ }
405
+ if (operation === "attachProgramWire") return ATTACHMENT_ERROR_CODES.has(code);
406
+ if (operation === "attachmentUpdateObserved" || operation === "attachmentUpdateUnknown") {
407
+ return ATTACHMENT_UPDATE_ERROR_CODES.has(code);
408
+ }
409
+ if (operation === "attachmentDispose") return ATTACHMENT_DISPOSE_ERROR_CODES.has(code);
410
+ if (operation === "attachmentFree") return ATTACHMENT_FREE_ERROR_CODES.has(code);
411
+ if (operation === "materializationAuthority") return MATERIALIZATION_ERROR_CODES.has(code);
412
+ if (operation === "physicalIdentity") return PHYSICAL_IDENTITY_ERROR_CODES.has(code);
413
+ return false;
414
+ } catch {
415
+ return false;
416
+ }
417
+ }
418
+
419
+ export function init(input) {
420
+ if (initState === "ready") return Promise.resolve();
421
+ if (initState === "async") return initFlight;
422
+ if (initState === "starting") {
423
+ throw new Error("Lab Colors: initialization input admission is in progress");
424
+ }
425
+ if (initState === "sync") {
426
+ throw new Error("Lab Colors: synchronous initialization is in progress");
427
+ }
428
+
429
+ let resolveFlight;
430
+ let rejectFlight;
431
+ initFlight = new Promise((resolve, reject) => {
432
+ resolveFlight = resolve;
433
+ rejectFlight = reject;
434
+ });
435
+ const flight = initFlight;
436
+ initState = "starting";
437
+
438
+ let pending;
439
+ try {
440
+ pending = initWasm(input);
441
+ } catch (error) {
442
+ initState = "idle";
443
+ initFlight = undefined;
444
+ rejectFlight(error);
445
+ return flight;
446
+ }
447
+ initState = "async";
448
+ Promise.resolve(pending).then(
449
+ () => {
450
+ initState = "ready";
451
+ resolveFlight();
452
+ },
453
+ (error) => {
454
+ initState = "idle";
455
+ initFlight = undefined;
456
+ rejectFlight(error);
457
+ },
458
+ );
459
+ return flight;
460
+ }
461
+
462
+ export function initSync(input) {
463
+ if (initState === "ready") return;
464
+ if (initState === "async") throw new Error("Lab Colors: asynchronous initialization is in progress");
465
+ if (initState === "starting") throw new Error("Lab Colors: initialization input admission is in progress");
466
+ if (initState === "sync") throw new Error("Lab Colors: synchronous initialization is in progress");
467
+ initState = "sync";
468
+ try {
469
+ initWasmSync(input);
470
+ initState = "ready";
471
+ } catch (error) {
472
+ initState = "idle";
473
+ throw error;
474
+ }
475
+ }
476
+
477
+ export default init;
478
+
479
+
480
+ /** Читает закрытую пару операции и причины без преобразований и разбора message. */
481
+ export function isBindingError(error) {
482
+ try {
483
+ if (!(error instanceof Error)) return false;
484
+ const operation = error.operation;
485
+ const code = error.code;
486
+ switch (operation) {
487
+ case "evaluateWcag22":
488
+ return code === "invalid_color" || code === "unknown_wcag22_criterion" || code === "internal_error";
489
+ case "numericalCapabilityManifest":
490
+ return code === "internal_error";
491
+ case "readProgramOutput":
492
+ return code === "invalid_output_index";
493
+ default:
494
+ return false;
495
+ }
496
+ } catch {
497
+ return false;
498
+ }
499
+ }
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@labpics/colors",
3
- "version": "0.10.0",
3
+ "version": "1.0.3",
4
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
+ "description": "Библиотека адаптивных цветов для интерфейсов и дизайн-систем.",
6
6
  "type": "module",
7
- "license": "MIT",
7
+ "license": "MIT AND CC-BY-4.0 AND CC-BY-SA-4.0",
8
8
  "publishConfig": {
9
- "access": "public",
10
- "provenance": false
9
+ "access": "public"
11
10
  },
12
11
  "repository": {
13
12
  "type": "git",
@@ -19,67 +18,67 @@
19
18
  "types": "./index.d.ts",
20
19
  "default": "./index.js"
21
20
  },
22
- "./apply-theme": {
23
- "types": "./apply-theme.d.ts",
24
- "default": "./apply-theme.js"
25
- },
26
- "./watch-theme": {
27
- "types": "./watch-theme.d.ts",
28
- "default": "./watch-theme.js"
29
- },
30
- "./adapt-theme": {
31
- "types": "./adapt-theme.d.ts",
32
- "default": "./adapt-theme.js"
33
- },
34
- "./effective-bg": {
35
- "types": "./effective-bg.d.ts",
36
- "default": "./effective-bg.js"
37
- },
38
21
  "./pkg/labcolors_bg.wasm": "./pkg/labcolors_bg.wasm",
22
+ "./program-wire/abi-v1.js": {
23
+ "types": "./program-wire/abi-v1.d.ts",
24
+ "default": "./program-wire/abi-v1.js"
25
+ },
39
26
  "./build-metadata.json": "./build-metadata.json",
40
- "./package.json": "./package.json"
27
+ "./package.json": "./package.json",
28
+ "./program-wire/abi-v2.js": {
29
+ "types": "./program-wire/abi-v2.d.ts",
30
+ "default": "./program-wire/abi-v2.js"
31
+ }
41
32
  },
42
33
  "files": [
43
34
  "LICENSE",
35
+ "NOTICE.md",
36
+ "LICENSES/CC-BY-4.0.txt",
37
+ "LICENSES/CC-BY-SA-4.0.txt",
44
38
  "build-metadata.json",
45
39
  "index.js",
46
40
  "index.d.ts",
47
- "apply-theme.js",
48
- "apply-theme.d.ts",
49
- "watch-theme.js",
50
- "watch-theme.d.ts",
51
- "adapt-theme.js",
52
- "adapt-theme.d.ts",
53
- "effective-bg.js",
54
- "effective-bg.d.ts",
41
+ "wcag22.d.ts",
42
+ "program-wire/abi-v1.js",
43
+ "program-wire/abi-v1.d.ts",
44
+ "program-wire/encoding.js",
45
+ "program-wire/abi-v2.js",
46
+ "program-wire/abi-v2.d.ts",
47
+ "evidence/wcag22-srgb8-v1.json",
48
+ "evidence/wcag22-srgb8-q55-v1.bin",
49
+ "evidence/wcag22-srgb8-q55-proof-v1.json",
50
+ "evidence/point-support-reference-surplus-q55-bps-proof-v1.json",
55
51
  "pkg/labcolors.js",
56
52
  "pkg/labcolors.d.ts",
57
53
  "pkg/labcolors_bg.wasm",
58
- "pkg/labcolors_bg.wasm.d.ts"
54
+ "pkg/labcolors_bg.wasm.d.ts",
55
+ "pkg/snippets/labcolors-wasm-[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/inline0.js"
59
56
  ],
60
57
  "scripts": {
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.",
62
58
  "build": "wasm-pack build ../../crates/labcolors-wasm --release --target web --out-dir ../../packages/colors/pkg --out-name labcolors --locked",
63
59
  "typecheck": "tsc --noEmit -p tsconfig.json",
64
60
  "test": "node --test",
65
61
  "prepack": "npm run build && node ../../scripts/prepare-npm-package.mjs",
66
- "release:verify": "node ../../scripts/verify-package-release.mjs"
62
+ "release:verify": "node ../../scripts/verify-publication.mjs"
67
63
  },
68
64
  "devDependencies": {
69
- "typescript": "^5.5.0"
65
+ "es-module-lexer": "1.7.0",
66
+ "typescript": "^5.5.0",
67
+ "typescript-floor": "npm:typescript@5.2.2",
68
+ "yaml": "2.9.1"
70
69
  },
71
70
  "types": "./index.d.ts",
72
71
  "sideEffects": false,
73
72
  "keywords": [
74
73
  "color",
75
- "oklch",
76
74
  "contrast",
77
- "apca",
78
- "wcag",
79
- "theme",
75
+ "accessibility",
76
+ "design-system",
80
77
  "design-tokens",
78
+ "rust",
79
+ "typescript",
81
80
  "wasm",
82
- "labpics"
81
+ "wcag"
83
82
  ],
84
83
  "engines": {
85
84
  "node": ">=22.11.0"