@astryxdesign/native 0.7.7-canary.f9ac85f → 0.7.8-canary.0588a13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/components/Icon.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,IAAI,EAAE,eAKlB,CAAC"}
1
+ {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/components/Icon.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,IAAI,EAAE,eAqBlB,CAAC"}
@@ -4,4 +4,20 @@ export const icon = {
4
4
  baseTarget: 'root',
5
5
  // A shared icon name (AST-082 FR17); an SVG component stays web-only.
6
6
  slots: { icon: 'icon' },
7
+ // The semantic colors every platform draws; the palette colors stay on the
8
+ // web.
9
+ projections: {
10
+ color: {
11
+ primary: 'primary',
12
+ secondary: 'secondary',
13
+ tertiary: 'tertiary',
14
+ disabled: 'disabled',
15
+ accent: 'accent',
16
+ info: 'info',
17
+ success: 'success',
18
+ error: 'error',
19
+ warning: 'warning',
20
+ inherit: 'inherit',
21
+ },
22
+ },
7
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/native",
3
- "version": "0.7.7-canary.f9ac85f",
3
+ "version": "0.7.8-canary.0588a13",
4
4
  "description": "Experimental native platforms for Astryx (iOS, Android, macOS, Windows) — published to npm only under the @canary dist-tag; never released as a stable (latest) version.",
5
5
  "author": "Meta Open Source",
6
6
  "license": "MIT",
@@ -70,10 +70,10 @@
70
70
  }
71
71
  },
72
72
  "peerDependencies": {
73
- "@astryxdesign/core": "0.7.7-canary.f9ac85f"
73
+ "@astryxdesign/core": "0.7.8-canary.0588a13"
74
74
  },
75
75
  "devDependencies": {
76
- "@astryxdesign/core": "0.7.7-canary.f9ac85f"
76
+ "@astryxdesign/core": "0.7.8-canary.0588a13"
77
77
  },
78
78
  "scripts": {
79
79
  "build": "node ../../scripts/clean-dist.mjs && tsc --project tsconfig.build.json && node scripts/generate.mjs --types",
@@ -15,4 +15,20 @@ export const icon: NativeAdditions = {
15
15
  baseTarget: 'root',
16
16
  // A shared icon name (AST-082 FR17); an SVG component stays web-only.
17
17
  slots: {icon: 'icon'},
18
+ // The semantic colors every platform draws; the palette colors stay on the
19
+ // web.
20
+ projections: {
21
+ color: {
22
+ primary: 'primary',
23
+ secondary: 'secondary',
24
+ tertiary: 'tertiary',
25
+ disabled: 'disabled',
26
+ accent: 'accent',
27
+ info: 'info',
28
+ success: 'success',
29
+ error: 'error',
30
+ warning: 'warning',
31
+ inherit: 'inherit',
32
+ },
33
+ },
18
34
  };
@@ -125,6 +125,12 @@ describe('native contracts', () => {
125
125
  reason: 'type "IconVariant" has no portable definition yet',
126
126
  },
127
127
  {name: 'xstyle', reason: 'web styling input'},
128
+ {
129
+ name: 'className',
130
+ reason: '"className" already means something else in web',
131
+ },
132
+ {name: 'style', reason: 'web styling input'},
133
+ {name: 'ref', reason: 'web element reference'},
128
134
  ]);
129
135
 
130
136
  const swift = generateSwift(contracts);
@@ -144,6 +150,28 @@ describe('native contracts', () => {
144
150
  expect(types['core.d.ts']).toContain('icon: IconName;');
145
151
  });
146
152
 
153
+ it('gives Icon its semantic colors, and leaves the palette colors on the web', async () => {
154
+ const {contracts} = await buildContracts(loadCoreDoc);
155
+ const icon = contracts.find(contract => contract.name === 'Icon');
156
+ const semantic = [
157
+ 'primary',
158
+ 'secondary',
159
+ 'tertiary',
160
+ 'disabled',
161
+ 'accent',
162
+ 'info',
163
+ 'success',
164
+ 'error',
165
+ 'warning',
166
+ 'inherit',
167
+ ];
168
+ expect(icon!.core.color.type).toEqual({kind: 'enum', values: semantic});
169
+ expect(Object.entries(icon!.projections?.color ?? {})).toEqual(
170
+ semantic.map(color => [color, color]),
171
+ );
172
+ expect(generateSwift(contracts)['Icon.swift']).not.toContain('case blue');
173
+ });
174
+
147
175
  it('gives Avatar its named sizes, a press, and a link, and leaves pixel sizes on the web', async () => {
148
176
  const {contracts} = await buildContracts(loadCoreDoc);
149
177
  const avatar = contracts.find(contract => contract.name === 'Avatar');