@ankhorage/zora 25.8.14 → 25.8.16

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/features/button/utils/resolveButtonThemeRecipe.d.ts +1 -1
  4. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts +4 -0
  5. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts.map +1 -0
  6. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js +187 -0
  7. package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js.map +1 -0
  8. package/dist/features/registry/ZORA_COMPONENT_REGISTRY.d.ts +1 -0
  9. package/dist/features/registry/ZORA_COMPONENT_REGISTRY.d.ts.map +1 -1
  10. package/dist/features/registry/ZORA_COMPONENT_REGISTRY.js +4 -185
  11. package/dist/features/registry/ZORA_COMPONENT_REGISTRY.js.map +1 -1
  12. package/dist/features/registry/createZoraComponentRegistry.d.ts +4 -0
  13. package/dist/features/registry/createZoraComponentRegistry.d.ts.map +1 -0
  14. package/dist/features/registry/createZoraComponentRegistry.js +6 -0
  15. package/dist/features/registry/createZoraComponentRegistry.js.map +1 -0
  16. package/dist/features/registry/public.d.ts +2 -0
  17. package/dist/features/registry/public.d.ts.map +1 -1
  18. package/dist/features/registry/public.js +2 -0
  19. package/dist/features/registry/public.js.map +1 -1
  20. package/dist/features/registry/readerFreeRegistry.d.ts +3 -0
  21. package/dist/features/registry/readerFreeRegistry.d.ts.map +1 -0
  22. package/dist/features/registry/readerFreeRegistry.js +3 -0
  23. package/dist/features/registry/readerFreeRegistry.js.map +1 -0
  24. package/dist/index.d.ts +1 -126
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1 -77
  27. package/dist/index.js.map +1 -1
  28. package/dist/readerFree.d.ts +129 -0
  29. package/dist/readerFree.d.ts.map +1 -0
  30. package/dist/readerFree.js +79 -0
  31. package/dist/readerFree.js.map +1 -0
  32. package/package.json +26 -11
  33. package/src/expo57Migration.test.ts +50 -0
  34. package/src/features/layout/public.test.ts +2 -1
  35. package/src/features/progress/adapters/inbound/ProgressRing.test.ts +6 -4
  36. package/src/features/reader/adapters/inbound/Reader.test.ts +1 -1
  37. package/src/features/reader/utils/resolveReaderProgress.test.ts +1 -1
  38. package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +236 -0
  39. package/src/features/registry/ZORA_COMPONENT_REGISTRY.ts +4 -233
  40. package/src/features/registry/createZoraComponentRegistry.ts +9 -0
  41. package/src/features/registry/public.ts +2 -0
  42. package/src/features/registry/readerFreeRegistry.ts +2 -0
  43. package/src/features/registry/registry.test.ts +36 -5
  44. package/src/features/uploader/public.test.ts +3 -2
  45. package/src/index.ts +1 -533
  46. package/src/interactionPolicy.test.ts +1 -1
  47. package/src/readerFree.ts +538 -0
@@ -1,237 +1,8 @@
1
- import type { InteractionPolicyProps } from '@ankhorage/surface';
2
- import type React from 'react';
3
-
4
1
  import type { ZoraComponentRegistry } from '../../types/registry';
5
- import { Accordion, AccordionItem } from '../accordion/public';
6
- import { ActivityIndicator } from '../activity-indicator/public';
7
- import { AppBar } from '../app-bar/public';
8
- import { AppHeader } from '../app-header/public';
9
- import {
10
- AuthScreen,
11
- ForgotPasswordForm,
12
- OAuthProviderButton,
13
- OAuthProviderList,
14
- OtpForm,
15
- SignInForm,
16
- SignUpForm,
17
- } from '../auth/public';
18
- import { Avatar, AvatarGroup } from '../avatar/public';
19
- import { Badge } from '../badge/public';
20
- import { BottomSheet } from '../bottom-sheet/public';
21
- import { Breadcrumbs } from '../breadcrumbs/public';
22
- import { Button, ButtonGroup, IconButton } from '../button/public';
23
- import { Card, MediaCard, MetricCard, PostCard, ProductCard } from '../card/public';
24
- import { ChatListItem, MessageBubble } from '../chat/public';
25
- import { ChessBoard, OpeningBook } from '../chess/public';
26
- import { Chip, ChipGroup } from '../chip/public';
27
- import { CollectionEditor } from '../collection-editor/public';
28
- import { ContentRail } from '../content-rail/public';
29
- import { DataTable } from '../data-table/public';
30
- import { DatePicker } from '../date-picker/public';
31
- import { Dialog } from '../dialog/public';
32
- import { EmptyState } from '../empty-state/public';
33
- import { Explorer, FileExplorer, MediaExplorer } from '../explorer/public';
34
- import { Checkbox, CheckboxGroup } from '../form/checkbox/public';
35
- import { Field, Form, FormActions, FormError } from '../form/public';
36
- import { Radio, RadioGroup } from '../form/radio/public';
37
- import { SearchInput } from '../form/search-input/public';
38
- import { Select } from '../form/select/public';
39
- import { Switch } from '../form/switch/public';
40
- import { TextInput } from '../form/text-input/public';
41
- import {
42
- Game,
43
- GameEntity,
44
- GameField,
45
- GameInputZone,
46
- GameMeasurementProbe,
47
- GameOverlay,
48
- } from '../game/public';
49
- import { Gradient } from '../gradient/public';
50
- import { GridInteractions } from '../grid-interactions/public';
51
- import { GridLineOverlay, GridRuler } from '../grid-rulers/public';
52
- import { GridView, TileGrid } from '../grid-view/public';
53
- import { Hero } from '../hero/public';
54
- import { Icon } from '../icon/public';
55
- import { Image } from '../image/public';
56
- import { KeyboardAvoidingView } from '../keyboard-avoiding-view/public';
57
- import { AppShell, Divider, Grid, Screen, ScrollView, View } from '../layout/public';
58
- import { FlatList, List, ListItem, ListSection, SectionList } from '../list/public';
59
- import { MatrixGrid } from '../matrix-grid/public';
60
- import { MissingElement } from '../missing-element/public';
61
- import { Pagination } from '../pagination/public';
62
- import { PaletteItem } from '../palette-item/public';
63
- import { PopoverMenu } from '../popover-menu/public';
64
- import { Progress, ProgressRing } from '../progress/public';
65
- import { Rating } from '../rating/public';
66
2
  import { Reader } from '../reader/public';
67
- import { BarcodeScannerView, CameraPermissionView, ScanOverlay } from '../scanner/public';
68
- import { ScreenSection, SectionHeader } from '../section/public';
69
- import { SelectableItem } from '../selection/public';
70
- import { Skeleton, SkeletonCard, SkeletonList, SkeletonText } from '../skeleton/public';
71
- import { SpatialGrid } from '../spatial-grid/public';
72
- import { Surface } from '../surface/public';
73
- import {
74
- CardBack,
75
- CardHand,
76
- PlayingCard,
77
- PokerTrainingTable,
78
- TabletopTable,
79
- } from '../tabletop/public';
80
- import { Tab, TabList, TabPanel, Tabs } from '../tabs/public';
81
- import { ThemeModeToggle } from '../theme/adapters/inbound/ThemeModeToggle';
82
- import { TimeGrid } from '../time-grid/public';
83
- import { TimePicker } from '../time-picker/public';
84
- import { Timeline } from '../timeline/public';
85
- import { Toast } from '../toast/public';
86
- import { Toolbar } from '../toolbar/public';
87
- import { TreeItem, TreeView } from '../tree-view/public';
88
- import { Heading, Text } from '../typography/public';
89
- import { Uploader } from '../uploader/public';
90
-
91
- type ComponentPropsFor<K extends keyof typeof _ZORA_COMPONENT_REGISTRY> = React.ComponentProps<
92
- (typeof _ZORA_COMPONENT_REGISTRY)[K]
93
- >;
94
-
95
- type AcceptsSurfaceInteractionPolicyProps<P> = 'interactionPolicy' extends keyof P
96
- ? InteractionPolicyProps extends Pick<P, 'interactionPolicy'>
97
- ? Pick<P, 'interactionPolicy'> extends InteractionPolicyProps
98
- ? true
99
- : false
100
- : false
101
- : false;
3
+ import { createZoraComponentRegistry } from './createZoraComponentRegistry';
102
4
 
103
- type RegistryInteractionPolicyContract = {
104
- [K in keyof typeof _ZORA_COMPONENT_REGISTRY]: AcceptsSurfaceInteractionPolicyProps<
105
- ComponentPropsFor<K>
106
- >;
107
- };
108
-
109
- type _AssertTrue<T extends true> = T;
110
- type _RegistryInteractionPolicyCheck = _AssertTrue<
111
- RegistryInteractionPolicyContract[keyof typeof _ZORA_COMPONENT_REGISTRY]
112
- >;
113
-
114
- const _ZORA_COMPONENT_REGISTRY = {
115
- Accordion,
116
- AccordionItem,
117
- ActivityIndicator,
118
- AppBar,
119
- AppHeader,
120
- Avatar,
121
- AvatarGroup,
122
- Badge,
123
- Breadcrumbs,
124
- Button,
125
- ButtonGroup,
126
- Card,
127
- Checkbox,
128
- CheckboxGroup,
129
- Chip,
130
- ChipGroup,
131
- DataTable,
132
- DatePicker,
133
- Dialog,
134
- Form,
135
- FormActions,
136
- FormError,
137
- Field,
138
- Gradient,
139
- Game,
140
- GameEntity,
141
- GameField,
142
- GameInputZone,
143
- GameMeasurementProbe,
144
- GameOverlay,
145
- Heading,
146
- Icon,
147
- IconButton,
148
- Image,
149
- KeyboardAvoidingView,
150
- TextInput,
151
- MediaCard,
152
- MetricCard,
153
- Pagination,
154
- PopoverMenu,
155
- Progress,
156
- ProgressRing,
157
- Radio,
158
- RadioGroup,
159
- Rating,
160
- SearchInput,
161
- Select,
162
- Switch,
163
- Skeleton,
164
- SkeletonCard,
165
- SkeletonList,
166
- SkeletonText,
167
- Tab,
168
- TabList,
169
- TabPanel,
170
- Tabs,
171
- Text,
172
- TimePicker,
173
- Toast,
174
- Toolbar,
175
- Uploader,
176
- BottomSheet,
177
- FlatList,
178
- SectionList,
179
- ScrollView,
180
- View,
181
- ThemeModeToggle,
182
- Divider,
183
- Grid,
184
- Surface,
185
- AppShell,
186
- Screen,
187
- ScreenSection,
188
- AuthScreen,
189
- ForgotPasswordForm,
190
- OAuthProviderButton,
191
- OAuthProviderList,
192
- OtpForm,
193
- SignInForm,
194
- SignUpForm,
195
- ChatListItem,
196
- ChessBoard,
197
- CollectionEditor,
198
- ContentRail,
199
- EmptyState,
200
- Explorer,
201
- FileExplorer,
202
- GridLineOverlay,
203
- GridRuler,
204
- GridInteractions,
205
- GridView,
206
- TileGrid,
207
- TimeGrid,
208
- MatrixGrid,
209
- MediaExplorer,
210
- Hero,
211
- List,
212
- ListItem,
213
- ListSection,
214
- MessageBubble,
215
- OpeningBook,
216
- MissingElement,
217
- PostCard,
218
- ProductCard,
5
+ /*** The complete ZORA runtime component registry, including the public Reader component. */
6
+ export const ZORA_COMPONENT_REGISTRY: ZoraComponentRegistry = createZoraComponentRegistry({
219
7
  Reader,
220
- BarcodeScannerView,
221
- CameraPermissionView,
222
- ScanOverlay,
223
- SectionHeader,
224
- SelectableItem,
225
- SpatialGrid,
226
- PaletteItem,
227
- CardBack,
228
- CardHand,
229
- PlayingCard,
230
- TabletopTable,
231
- PokerTrainingTable,
232
- Timeline,
233
- TreeItem,
234
- TreeView,
235
- } as const satisfies ZoraComponentRegistry;
236
-
237
- export const ZORA_COMPONENT_REGISTRY: ZoraComponentRegistry = _ZORA_COMPONENT_REGISTRY;
8
+ });
@@ -0,0 +1,9 @@
1
+ import type { ZoraComponentRegistry } from '../../types/registry';
2
+ import { ZORA_BASE_COMPONENT_REGISTRY } from './ZORA_BASE_COMPONENT_REGISTRY';
3
+
4
+ /*** Build a runtime component registry from ZORA's Reader-free base and explicitly selected feature entries. */
5
+ export function createZoraComponentRegistry(
6
+ extensions: ZoraComponentRegistry = {},
7
+ ): ZoraComponentRegistry {
8
+ return { ...ZORA_BASE_COMPONENT_REGISTRY, ...extensions };
9
+ }
@@ -1 +1,3 @@
1
+ export { createZoraComponentRegistry } from './createZoraComponentRegistry';
2
+ export { ZORA_BASE_COMPONENT_REGISTRY } from './ZORA_BASE_COMPONENT_REGISTRY';
1
3
  export { ZORA_COMPONENT_REGISTRY } from './ZORA_COMPONENT_REGISTRY';
@@ -0,0 +1,2 @@
1
+ export { createZoraComponentRegistry } from './createZoraComponentRegistry';
2
+ export { ZORA_BASE_COMPONENT_REGISTRY } from './ZORA_BASE_COMPONENT_REGISTRY';
@@ -53,7 +53,7 @@ async function listRuntimeRegistryEntries(): Promise<readonly string[]> {
53
53
  }
54
54
 
55
55
  async function listPublicConcreteComponentExports(): Promise<readonly string[]> {
56
- const source = await Bun.file('src/index.ts').text();
56
+ const source = await Bun.file('src/readerFree.ts').text();
57
57
  const componentExports = Array.from(
58
58
  source.matchAll(
59
59
  /export\s+\{([^}]+)\}\s+from '\.\/(components\/[^']+|features\/[^']+|foundation|layout\/[^']+|patterns\/[^']+)';/g,
@@ -64,7 +64,7 @@ async function listPublicConcreteComponentExports(): Promise<readonly string[]>
64
64
  .filter((name) => /^[A-Z][A-Za-z0-9]+$/.test(name))
65
65
  .filter((name) => !NON_RUNTIME_COMPONENT_EXPORTS.has(name));
66
66
 
67
- return [...componentExports, ...RUNTIME_THEME_COMPONENT_EXPORTS].sort();
67
+ return [...componentExports, 'Reader', ...RUNTIME_THEME_COMPONENT_EXPORTS].sort();
68
68
  }
69
69
 
70
70
  describe('ZORA_COMPONENT_REGISTRY', () => {
@@ -78,9 +78,40 @@ describe('ZORA_COMPONENT_REGISTRY', () => {
78
78
  expect(registryEntries).toContain('View');
79
79
  expect(registryEntries).toContain('AppHeader');
80
80
  expect(source).toContain("export type { ZoraComponentRegistry } from './types/registry';");
81
- expect(source).toContain(
82
- "export { ZORA_COMPONENT_REGISTRY } from './features/registry/public';",
83
- );
81
+ expect(source).toContain('ZORA_COMPONENT_REGISTRY');
82
+ });
83
+
84
+ test('publishes Reader-free registry and root-surface composition boundaries', async () => {
85
+ const [baseSource, compositionSource, packageJson, readerFreeSource, readerFreeRootSource] =
86
+ await Promise.all([
87
+ Bun.file('src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts').text(),
88
+ Bun.file('src/features/registry/createZoraComponentRegistry.ts').text(),
89
+ Bun.file('package.json').json() as Promise<{ readonly exports: Record<string, unknown> }>,
90
+ Bun.file('src/features/registry/readerFreeRegistry.ts').text(),
91
+ Bun.file('src/readerFree.ts').text(),
92
+ ]);
93
+
94
+ expect(baseSource).not.toContain("from '../reader/public'");
95
+ expect(compositionSource).toContain('ZORA_BASE_COMPONENT_REGISTRY');
96
+ expect(readerFreeSource).toContain('ZORA_BASE_COMPONENT_REGISTRY');
97
+ expect(readerFreeSource).toContain('createZoraComponentRegistry');
98
+ expect(readerFreeSource).not.toContain('ZORA_COMPONENT_REGISTRY');
99
+ expect(readerFreeRootSource).not.toContain("from './features/reader/public'");
100
+ expect(readerFreeRootSource).not.toContain('ZORA_COMPONENT_REGISTRY');
101
+ expect(packageJson.exports['./registry']).toEqual({
102
+ 'react-native': './src/features/registry/readerFreeRegistry.ts',
103
+ browser: './src/features/registry/readerFreeRegistry.ts',
104
+ types: './dist/features/registry/readerFreeRegistry.d.ts',
105
+ import: './dist/features/registry/readerFreeRegistry.js',
106
+ default: './dist/features/registry/readerFreeRegistry.js',
107
+ });
108
+ expect(packageJson.exports['./reader-free']).toEqual({
109
+ 'react-native': './src/readerFree.ts',
110
+ browser: './src/readerFree.ts',
111
+ types: './dist/readerFree.d.ts',
112
+ import: './dist/readerFree.js',
113
+ default: './dist/readerFree.js',
114
+ });
84
115
  });
85
116
 
86
117
  test('covers every public concrete ZORA component export supported for runtime rendering', async () => {
@@ -6,15 +6,16 @@ describe('ZORA Uploader public contract', () => {
6
6
  dependencies: Readonly<Record<string, string>>;
7
7
  exports: Readonly<Record<string, unknown>>;
8
8
  };
9
- const [rootSource, publicSource] = await Promise.all([
9
+ const [rootSource, readerFreeSource, publicSource] = await Promise.all([
10
10
  Bun.file('src/index.ts').text(),
11
+ Bun.file('src/readerFree.ts').text(),
11
12
  Bun.file('src/features/uploader/public.ts').text(),
12
13
  ]);
13
14
 
14
15
  expect(packageJson.exports['./uploader']).toBeDefined();
15
16
  expect(packageJson.dependencies['expo-image-picker']).toMatch(/^~57\./u);
16
17
  expect(packageJson.dependencies['expo-document-picker']).toMatch(/^~57\./u);
17
- expect(rootSource).toContain("from './features/uploader/public'");
18
+ expect(`${rootSource}\n${readerFreeSource}`).toContain("from './features/uploader/public'");
18
19
  expect(publicSource).toContain('export { Uploader }');
19
20
  expect(publicSource).toContain('export { validateUploadAsset }');
20
21
  });