@ankhorage/surface 3.2.0 → 3.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ankhorage/surface
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 79e8f63: Add a pure `@ankhorage/surface/theme` package entrypoint so non-React tooling can resolve themes and inspect canonical color diagnostics without loading the component runtime.
8
+
3
9
  ## 3.2.0
4
10
 
5
11
  ### Minor Changes
@@ -1,6 +1,3 @@
1
- export * from './colorEngine';
2
- export * from './createTheme';
3
- export * from './resolveToken';
1
+ export * from './public';
4
2
  export * from './ThemeContext';
5
- export * from './types';
6
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
@@ -1,6 +1,3 @@
1
- export * from './colorEngine';
2
- export * from './createTheme';
3
- export * from './resolveToken';
1
+ export * from './public';
4
2
  export * from './ThemeContext';
5
- export * from './types';
6
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC","sourcesContent":["export * from './colorEngine';\nexport * from './createTheme';\nexport * from './resolveToken';\nexport * from './ThemeContext';\nexport * from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC","sourcesContent":["export * from './public';\nexport * from './ThemeContext';\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './colorEngine';
2
+ export * from './createTheme';
3
+ export * from './resolveToken';
4
+ export * from './types';
5
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/theme/public.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './colorEngine';
2
+ export * from './createTheme';
3
+ export * from './resolveToken';
4
+ export * from './types';
5
+ //# sourceMappingURL=public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../src/theme/public.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC","sourcesContent":["export * from './colorEngine';\nexport * from './createTheme';\nexport * from './resolveToken';\nexport * from './types';\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/surface",
3
3
  "type": "module",
4
- "version": "3.2.0",
4
+ "version": "3.3.0",
5
5
  "description": "Stable UI foundation for React Native and React Native Web.",
6
6
  "homepage": "https://github.com/ankhorage/surface#readme",
7
7
  "bugs": {
@@ -56,6 +56,14 @@
56
56
  "import": "./dist/index.js",
57
57
  "default": "./dist/index.js"
58
58
  },
59
+ "./theme": {
60
+ "bun": "./src/theme/public.ts",
61
+ "react-native": "./src/theme/public.ts",
62
+ "browser": "./src/theme/public.ts",
63
+ "types": "./dist/theme/public.d.ts",
64
+ "import": "./dist/theme/public.js",
65
+ "default": "./dist/theme/public.js"
66
+ },
59
67
  "./package.json": "./package.json"
60
68
  },
61
69
  "publishConfig": {
package/src/index.test.ts CHANGED
@@ -70,6 +70,14 @@ describe('public package contract', () => {
70
70
  import: './dist/index.js',
71
71
  types: './dist/index.d.ts',
72
72
  },
73
+ './theme': {
74
+ bun: './src/theme/public.ts',
75
+ 'react-native': './src/theme/public.ts',
76
+ browser: './src/theme/public.ts',
77
+ default: './dist/theme/public.js',
78
+ import: './dist/theme/public.js',
79
+ types: './dist/theme/public.d.ts',
80
+ },
73
81
  './package.json': './package.json',
74
82
  });
75
83
  });
@@ -1,5 +1,2 @@
1
- export * from './colorEngine';
2
- export * from './createTheme';
3
- export * from './resolveToken';
1
+ export * from './public';
4
2
  export * from './ThemeContext';
5
- export * from './types';
@@ -0,0 +1,43 @@
1
+ import { readFileSync } from 'node:fs';
2
+
3
+ import { describe, expect, test } from 'bun:test';
4
+
5
+ import { createTheme, type SurfaceTheme } from './public';
6
+
7
+ describe('public theme subpath', () => {
8
+ test('resolves a complete theme through the pure owner entrypoint', () => {
9
+ const theme: SurfaceTheme = createTheme();
10
+
11
+ expect(theme.colorDiagnostics.generated.swatches).toBe(theme.swatches);
12
+ expect(theme.semantics.selection.background).toBeDefined();
13
+ });
14
+
15
+ test('keeps React and React Native outside the public module graph root', () => {
16
+ const source = readFileSync(new URL('./public.ts', import.meta.url), 'utf8');
17
+
18
+ expect(source).not.toContain('ThemeContext');
19
+ expect(source).not.toMatch(/from ['"]react(?:-native)?['"]/);
20
+ expect(source).toContain("export * from './createTheme';");
21
+ });
22
+
23
+ test('imports and executes through the package subpath in plain Bun', async () => {
24
+ const script = [
25
+ "import { createTheme } from '@ankhorage/surface/theme';",
26
+ 'const theme = createTheme();',
27
+ 'process.stdout.write(`${theme.config.id}:${theme.colorDiagnostics.mode}`);',
28
+ ].join('\n');
29
+ const subprocess = Bun.spawn({
30
+ cmd: [process.execPath, '-e', script],
31
+ stdout: 'pipe',
32
+ stderr: 'pipe',
33
+ });
34
+ const [stdout, stderr, exitCode] = await Promise.all([
35
+ new Response(subprocess.stdout).text(),
36
+ new Response(subprocess.stderr).text(),
37
+ subprocess.exited,
38
+ ]);
39
+
40
+ expect(exitCode, stderr).toBe(0);
41
+ expect(stdout).toBe('default:light');
42
+ });
43
+ });
@@ -0,0 +1,4 @@
1
+ export * from './colorEngine';
2
+ export * from './createTheme';
3
+ export * from './resolveToken';
4
+ export * from './types';