@ankhorage/surface 9.3.3 → 9.4.1
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 +12 -0
- package/README.md +1 -1
- package/dist/capabilities/index.d.ts +23 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +25 -0
- package/dist/capabilities/index.js.map +1 -0
- package/package.json +47 -5
- package/src/capabilities/index.test.ts +50 -0
- package/src/capabilities/index.ts +26 -0
- package/src/index.test.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/surface
|
|
2
2
|
|
|
3
|
+
## 9.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f9002c2: Update dependencies: `@ankhorage/contracts`.
|
|
8
|
+
|
|
9
|
+
## 9.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 3d9d961: Publish the canonical `theme.setMode` capability for portable theme-mode invocation.
|
|
14
|
+
|
|
3
15
|
## 9.3.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/surface
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Cross-platform UI foundation for React Native and React Native Web. Provides theming, layout primitives, and core building blocks for modern apps.
|
|
9
9
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const CAPABILITIES: readonly [{
|
|
2
|
+
readonly id: "theme.setMode";
|
|
3
|
+
readonly owner: "@ankhorage/surface";
|
|
4
|
+
readonly access: readonly ["invoke"];
|
|
5
|
+
readonly binding: {
|
|
6
|
+
readonly kind: "action";
|
|
7
|
+
readonly bindableAs: readonly ["target"];
|
|
8
|
+
};
|
|
9
|
+
readonly input: {
|
|
10
|
+
readonly schema: {
|
|
11
|
+
readonly type: "object";
|
|
12
|
+
readonly required: readonly ["mode"];
|
|
13
|
+
readonly properties: {
|
|
14
|
+
readonly mode: {
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
readonly enum: readonly ["light", "dark"];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly additionalProperties: false;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}];
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;EAuBiB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const CAPABILITIES = [
|
|
2
|
+
{
|
|
3
|
+
id: 'theme.setMode',
|
|
4
|
+
owner: '@ankhorage/surface',
|
|
5
|
+
access: ['invoke'],
|
|
6
|
+
binding: {
|
|
7
|
+
kind: 'action',
|
|
8
|
+
bindableAs: ['target'],
|
|
9
|
+
},
|
|
10
|
+
input: {
|
|
11
|
+
schema: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
required: ['mode'],
|
|
14
|
+
properties: {
|
|
15
|
+
mode: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
enum: ['light', 'dark'],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
additionalProperties: false,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,oBAAoB;QAC3B,MAAM,EAAE,CAAC,QAAQ,CAAC;QAClB,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,CAAC,QAAQ,CAAC;SACvB;QACD,KAAK,EAAE;YACL,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,CAAC,MAAM,CAAC;gBAClB,UAAU,EAAE;oBACV,IAAI,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;qBACxB;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;KACF;CACuC,CAAC","sourcesContent":["import type { Capability } from '@ankhorage/contracts/capabilities';\n\nexport const CAPABILITIES = [\n {\n id: 'theme.setMode',\n owner: '@ankhorage/surface',\n access: ['invoke'],\n binding: {\n kind: 'action',\n bindableAs: ['target'],\n },\n input: {\n schema: {\n type: 'object',\n required: ['mode'],\n properties: {\n mode: {\n type: 'string',\n enum: ['light', 'dark'],\n },\n },\n additionalProperties: false,\n },\n },\n },\n] as const satisfies readonly Capability[];\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/surface",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.4.1",
|
|
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": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@ankhorage/color-theory": "^0.3.1",
|
|
47
|
-
"@ankhorage/contracts": "^24.
|
|
47
|
+
"@ankhorage/contracts": "^24.2.0",
|
|
48
48
|
"@ankhorage/utility": "^1.9.85",
|
|
49
49
|
"@gorhom/bottom-sheet": "^5.2.14"
|
|
50
50
|
},
|
|
@@ -78,6 +78,11 @@
|
|
|
78
78
|
"import": "./dist/constants/surfaceColor.js",
|
|
79
79
|
"default": "./dist/constants/surfaceColor.js"
|
|
80
80
|
},
|
|
81
|
+
"./capabilities": {
|
|
82
|
+
"types": "./dist/capabilities/index.d.ts",
|
|
83
|
+
"import": "./dist/capabilities/index.js",
|
|
84
|
+
"default": "./dist/capabilities/index.js"
|
|
85
|
+
},
|
|
81
86
|
"./theme": {
|
|
82
87
|
"bun": "./src/features/theme/public.ts",
|
|
83
88
|
"react-native": "./src/features/theme/public.ts",
|
|
@@ -107,8 +112,8 @@
|
|
|
107
112
|
"version-packages": "ankhorage-changeset version"
|
|
108
113
|
},
|
|
109
114
|
"devDependencies": {
|
|
110
|
-
"@ankhorage/devtools": "^2.
|
|
111
|
-
"@ankhorage/paradox": "^0.
|
|
115
|
+
"@ankhorage/devtools": "^2.2.2",
|
|
116
|
+
"@ankhorage/paradox": "^0.3.1",
|
|
112
117
|
"@react-native-vector-icons/fontawesome": "^13.1.4",
|
|
113
118
|
"@react-native-vector-icons/fontawesome5": "^13.1.4",
|
|
114
119
|
"@react-native-vector-icons/fontawesome6": "^13.1.4",
|
|
@@ -131,5 +136,42 @@
|
|
|
131
136
|
"react-native-worklets": "0.13.0",
|
|
132
137
|
"typescript": "~6.0.3"
|
|
133
138
|
},
|
|
134
|
-
"packageManager": "bun@1.4.2"
|
|
139
|
+
"packageManager": "bun@1.4.2",
|
|
140
|
+
"ankh": {
|
|
141
|
+
"category": "surface",
|
|
142
|
+
"provider": null,
|
|
143
|
+
"capabilities": [
|
|
144
|
+
{
|
|
145
|
+
"id": "theme.setMode",
|
|
146
|
+
"owner": "@ankhorage/surface",
|
|
147
|
+
"access": [
|
|
148
|
+
"invoke"
|
|
149
|
+
],
|
|
150
|
+
"binding": {
|
|
151
|
+
"kind": "action",
|
|
152
|
+
"bindableAs": [
|
|
153
|
+
"target"
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
"input": {
|
|
157
|
+
"schema": {
|
|
158
|
+
"type": "object",
|
|
159
|
+
"required": [
|
|
160
|
+
"mode"
|
|
161
|
+
],
|
|
162
|
+
"properties": {
|
|
163
|
+
"mode": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"enum": [
|
|
166
|
+
"light",
|
|
167
|
+
"dark"
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"additionalProperties": false
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
135
177
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
|
|
3
|
+
import { isCapability } from '@ankhorage/contracts/capabilities';
|
|
4
|
+
import { expect, test } from 'bun:test';
|
|
5
|
+
|
|
6
|
+
import { CAPABILITIES } from './index';
|
|
7
|
+
|
|
8
|
+
const packageMetadata = (
|
|
9
|
+
JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8')) as {
|
|
10
|
+
readonly ankh?: {
|
|
11
|
+
readonly capabilities?: unknown;
|
|
12
|
+
readonly category?: unknown;
|
|
13
|
+
readonly provider?: unknown;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
).ankh;
|
|
17
|
+
|
|
18
|
+
test('publishes a valid and uniquely identified canonical Surface theme capability', () => {
|
|
19
|
+
expect(CAPABILITIES).toHaveLength(1);
|
|
20
|
+
expect(CAPABILITIES.every(isCapability)).toBe(true);
|
|
21
|
+
expect(new Set(CAPABILITIES.map((capability) => capability.id)).size).toBe(CAPABILITIES.length);
|
|
22
|
+
expect(CAPABILITIES).toEqual([
|
|
23
|
+
{
|
|
24
|
+
id: 'theme.setMode',
|
|
25
|
+
owner: '@ankhorage/surface',
|
|
26
|
+
access: ['invoke'],
|
|
27
|
+
binding: { kind: 'action', bindableAs: ['target'] },
|
|
28
|
+
input: {
|
|
29
|
+
schema: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
required: ['mode'],
|
|
32
|
+
properties: { mode: { type: 'string', enum: ['light', 'dark'] } },
|
|
33
|
+
additionalProperties: false,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
]);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('keeps Ankh package metadata identical to the canonical Surface catalog', () => {
|
|
41
|
+
expect(packageMetadata?.category).toBe('surface');
|
|
42
|
+
expect(packageMetadata?.provider).toBeNull();
|
|
43
|
+
expect(packageMetadata?.capabilities).toEqual(CAPABILITIES);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('exports the catalog from the public capabilities subpath', async () => {
|
|
47
|
+
const capabilities = await import('@ankhorage/surface/capabilities');
|
|
48
|
+
|
|
49
|
+
expect(capabilities.CAPABILITIES).toEqual(CAPABILITIES);
|
|
50
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Capability } from '@ankhorage/contracts/capabilities';
|
|
2
|
+
|
|
3
|
+
export const CAPABILITIES = [
|
|
4
|
+
{
|
|
5
|
+
id: 'theme.setMode',
|
|
6
|
+
owner: '@ankhorage/surface',
|
|
7
|
+
access: ['invoke'],
|
|
8
|
+
binding: {
|
|
9
|
+
kind: 'action',
|
|
10
|
+
bindableAs: ['target'],
|
|
11
|
+
},
|
|
12
|
+
input: {
|
|
13
|
+
schema: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
required: ['mode'],
|
|
16
|
+
properties: {
|
|
17
|
+
mode: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
enum: ['light', 'dark'],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
additionalProperties: false,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
] as const satisfies readonly Capability[];
|
package/src/index.test.ts
CHANGED
|
@@ -16,6 +16,14 @@ const packageJson = JSON.parse(
|
|
|
16
16
|
peerDependencies: Record<string, string>;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
const capabilitiesExport = {
|
|
20
|
+
'./capabilities': {
|
|
21
|
+
default: './dist/capabilities/index.js',
|
|
22
|
+
import: './dist/capabilities/index.js',
|
|
23
|
+
types: './dist/capabilities/index.d.ts',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
19
27
|
const expectedFeatureRootExports = [
|
|
20
28
|
"export { AppBar } from './features/app-bar/public';",
|
|
21
29
|
"export { Badge } from './features/badge/public';",
|
|
@@ -137,6 +145,7 @@ describe('public package metadata contract', () => {
|
|
|
137
145
|
import: './dist/constants/surfaceColor.js',
|
|
138
146
|
types: './dist/constants/surfaceColor.d.ts',
|
|
139
147
|
},
|
|
148
|
+
...capabilitiesExport,
|
|
140
149
|
'./theme': {
|
|
141
150
|
bun: './src/features/theme/public.ts',
|
|
142
151
|
'react-native': './src/features/theme/public.ts',
|