@rafters/shared 0.5.4 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rafters/shared",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "description": "Shared W3C DTCG schemas, base types, and utilities for Rafters design system",
5
5
  "homepage": "https://rafters.studio",
6
6
  "license": "MIT",
@@ -24,11 +24,11 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "comment-parser": "^1.4.1",
27
- "zod": "^4.1.12"
27
+ "zod": "^4.6.5"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/node": "24.10.0",
31
- "typescript": "5.9.3",
30
+ "@types/node": "^24",
31
+ "typescript": "^7.0.2",
32
32
  "vitest": "^5.0.0",
33
33
  "zocker": "3.0.0"
34
34
  },
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './component-intelligence';
2
2
  export * from './import-pending';
3
+ export * from './studio-errors';
3
4
  export * from './types';
4
5
  export * from './version';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Studio error codes (#2876): every refusal from rafters studio's
3
+ * /__rafters/set and /__rafters/tokens names exactly one of these, so Studio
4
+ * and any agent writing through the endpoint can respond without parsing the
5
+ * message. The CLI README's Studio section gives each code's status, details
6
+ * and the response Studio should make.
7
+ */
8
+ export const STUDIO_ERROR_CODES = [
9
+ 'method-not-allowed',
10
+ 'origin-refused',
11
+ 'unsupported-media-type',
12
+ 'body-not-json',
13
+ 'body-invalid',
14
+ 'reason-required',
15
+ 'unknown-token',
16
+ 'token-invalid',
17
+ 'literal-color',
18
+ 'name-rejected',
19
+ 'name-taken',
20
+ 'token-in-use',
21
+ 'token-undeletable',
22
+ 'circular-dependency',
23
+ 'nothing-to-undo',
24
+ 'color-out-of-gamut',
25
+ 'internal',
26
+ ] as const;
27
+
28
+ export type StudioErrorCode = (typeof STUDIO_ERROR_CODES)[number];
package/src/types.ts CHANGED
@@ -464,6 +464,12 @@ export const ColorValueSchema = z.object({
464
464
  reason: z.enum(['lightness-bounds', 'gamut']),
465
465
  })
466
466
  .optional(),
467
+ // The lightness ladder a normalized scale was built on (createNormalizedScale);
468
+ // 'custom' when the caller supplied the ladder. Absent for buildColorValue.
469
+ scaleStyle: z.enum(['deep', 'compact', 'custom']).optional(),
470
+ // The scale position the source colour sits at, e.g. '200'. Absent for
471
+ // buildColorValue, whose seed always lands on '600'.
472
+ anchor: z.string().optional(),
467
473
  });
468
474
 
469
475
  export type ColorValue = z.infer<typeof ColorValueSchema>;
package/src/version.ts CHANGED
@@ -4,4 +4,4 @@
4
4
  * Written by packages/cli/scripts/sync-version.ts from the CLI's own
5
5
  * package.json version at build time -- do not edit by hand.
6
6
  */
7
- export const RAFTERS_VERSION = '0.5.4';
7
+ export const RAFTERS_VERSION = '0.6.0';