create-octane-xplat 0.18.0 → 0.20.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.
Files changed (77) hide show
  1. package/README.md +2 -144
  2. package/compatibility.json +97 -19
  3. package/compatibility.ts +141 -72
  4. package/dist/compatibility.js +66 -26
  5. package/dist/index.js +127 -64
  6. package/dist/package-manager.js +62 -0
  7. package/dist/scaffold.js +377 -127
  8. package/index.ts +256 -154
  9. package/library-template/AGENTS.md +6 -4
  10. package/library-template/README.md +22 -18
  11. package/library-template/bunfig +4 -0
  12. package/library-template/package.json +115 -18
  13. package/library-template/patches/@nativescript-community__octane@0.2.5.patch +1018 -0
  14. package/library-template/patches/@nativescript-community__sqlite-bridge@4.1.1.patch +30 -0
  15. package/library-template/patches/@nativescript-community__vite-octane@0.2.1.patch +72 -0
  16. package/library-template/patches/@nativescript__core@9.1.3.patch +1280 -0
  17. package/library-template/patches/@nativescript__doctor@2.0.18.patch +13 -0
  18. package/library-template/patches/@nativescript__vite@8.0.20.patch +2019 -0
  19. package/library-template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
  20. package/library-template/patches/@octanejs__tiptap@0.0.62.patch +12 -0
  21. package/library-template/patches/@sveltejs__acorn-typescript@1.0.13.patch +16 -0
  22. package/library-template/patches/css@3.0.0.patch +52 -0
  23. package/library-template/patches/octane@0.16.3.patch +1479 -0
  24. package/library-template/src/Badge.tsx +7 -6
  25. package/library-template/src/Badge.web.tsx +7 -6
  26. package/library-template/src/Welcome.stories.tsx +12 -0
  27. package/library-template/src/normalizeBadgeLabel.ts +1 -1
  28. package/library-template/src/props.ts +11 -11
  29. package/library-template/tests/normalizeBadgeLabel.test.ts +1 -1
  30. package/library-template/tests/packed-consumer.mjs +140 -123
  31. package/library-template/tsconfig.envs.json +1 -0
  32. package/library-template/tsconfig.json +1 -0
  33. package/library-template/tsconfig.types.json +15 -1
  34. package/library-template/tsrx-typegen.json +1 -1
  35. package/library-template/workshop.config.ts +3 -0
  36. package/package-manager.ts +93 -0
  37. package/package.json +70 -58
  38. package/scaffold.ts +1056 -526
  39. package/template/.agents/skills/xplat/SKILL.md +6 -6
  40. package/template/.agents/skills/xplat/references/components.md +1 -1
  41. package/template/.agents/skills/xplat/references/navigation.md +1 -1
  42. package/template/.agents/skills/xplat/references/styling.md +14 -14
  43. package/template/AGENTS.md +10 -10
  44. package/template/bunfig +4 -0
  45. package/template/gitignore +1 -0
  46. package/template/nativescript.config.ts +13 -16
  47. package/template/package.json +119 -10
  48. package/template/patches/@nativescript-community__octane@0.2.5.patch +1018 -0
  49. package/template/patches/@nativescript-community__sqlite-bridge@4.1.1.patch +30 -0
  50. package/template/patches/@nativescript-community__vite-octane@0.2.1.patch +72 -0
  51. package/template/patches/@nativescript__core@9.1.3.patch +1280 -0
  52. package/template/patches/@nativescript__doctor@2.0.18.patch +13 -0
  53. package/template/patches/@nativescript__vite@8.0.20.patch +2019 -0
  54. package/template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
  55. package/template/patches/@octanejs__tiptap@0.0.62.patch +12 -0
  56. package/template/patches/@sveltejs__acorn-typescript@1.0.13.patch +16 -0
  57. package/template/patches/css@3.0.0.patch +52 -0
  58. package/template/patches/octane@0.16.3.patch +1479 -0
  59. package/template/src/App.tsrx +77 -42
  60. package/template/src/Welcome.stories.tsx +22 -0
  61. package/template/src/app.spec.tsrx +169 -163
  62. package/template/src/app.web.test.tsx +18 -13
  63. package/template/src/failure-reporting.spec.ts +3 -3
  64. package/template/src/main.ts +14 -13
  65. package/template/src/main.tsrx +2 -0
  66. package/template/src/main.web.tsrx +5 -5
  67. package/template/src/native-runtime.spec.ts +13 -11
  68. package/template/src/test-setup.web.ts +9 -8
  69. package/template/src/test.ts +6 -6
  70. package/template/tsconfig.json +17 -1
  71. package/template/vite.config.native.mts +1 -2
  72. package/template/vite.config.ts +29 -23
  73. package/template/vitest.config.mts +18 -18
  74. package/template/vitest.web.config.mts +7 -7
  75. package/template/workshop.config.ts +3 -0
  76. package/library-template/pnpm-workspace.yaml +0 -171
  77. package/template/pnpm-workspace.yaml +0 -192
@@ -1,50 +1,85 @@
1
- import { useState } from 'octane';
2
- import { View, HStack, Text, Pressable, ScrollableArea, SafeArea, useColorScheme } from '@octane-xplat/ui';
3
- import { storage } from '@octane-xplat/platform';
1
+ import { useState } from 'octane'
2
+ import {
3
+ View,
4
+ HStack,
5
+ Text,
6
+ Pressable,
7
+ ScrollableArea,
8
+ SafeArea,
9
+ useColorScheme,
10
+ } from '@octane-xplat/ui'
11
+
12
+ import { storage } from '@octane-xplat/platform'
4
13
 
5
14
  const FEATURES = [
6
- 'shared components',
7
- 'platform leaves (.web / .mobile)',
8
- 'design tokens + dark mode',
9
- 'native navigation',
10
- ];
15
+ 'shared components',
16
+ 'platform leaves (.web / .mobile)',
17
+ 'design tokens + dark mode',
18
+ 'native navigation',
19
+ ]
11
20
 
12
21
  /** Every element here compiles for web AND for NativeScript iOS/Android —
13
22
  * the same file, no branches. Platform divergence lives in leaf files
14
23
  * (.web.tsrx / .mobile.tsrx), never inside a component. */
15
24
  export function App() @{
16
- const [count, setCount] = useState(0);
17
- // null = follow the system until the user chooses a mode.
18
- const [override, setOverride] = useState<boolean | null>(() => {
19
- const saved = storage.getString('theme-preference');
20
- return saved === 'light' ? false : saved === 'dark' ? true : null;
21
- });
22
-
23
- const scheme = useColorScheme();
24
- const dark = override ?? scheme === 'dark';
25
-
26
- <SafeArea>
27
- <View className={['app', dark ? 'dark' : 'light']}>
28
- <Text className="title">octane-xplat</Text>
29
- <Text className="muted">one codebase — web · iOS · android</Text>
30
-
31
- <HStack className="counter">
32
- <Pressable testID="counter.decrement" accessibilityLabel="Decrease count" className="btn" onPress={() => setCount(count - 1)}><Text>−</Text></Pressable>
33
- <Text testID="counter.value" className="count">{count}</Text>
34
- <Pressable testID="counter.increment" accessibilityLabel="Increase count" className="btn" onPress={() => setCount(count + 1)}><Text>+</Text></Pressable>
35
- </HStack>
36
-
37
- <ScrollableArea>
38
- {FEATURES.map((f) => <Text className="chip">{f}</Text>)}
39
- </ScrollableArea>
40
-
41
- <Pressable testID="settings.toggle-theme" className="link" onPress={() => {
42
- const next = !dark;
43
- storage.setString('theme-preference', next ? 'dark' : 'light');
44
- setOverride(next);
45
- }}>
46
- <Text>{dark ? 'light' : 'dark'} mode (system: {scheme})</Text>
47
- </Pressable>
48
- </View>
49
- </SafeArea>
25
+ const [count, setCount] = useState(0)
26
+ // null = follow the system until the user chooses a mode.
27
+ const [override, setOverride] = useState<boolean | null>(() => {
28
+ const saved = storage.getString('theme-preference')
29
+
30
+ return saved === 'light' ? false : saved === 'dark' ? true : null
31
+ })
32
+
33
+ const scheme = useColorScheme()
34
+ const dark = override ?? scheme === 'dark'
35
+
36
+ <SafeArea>
37
+ <View className={['app', dark ? 'dark' : 'light']}>
38
+ <Text className="title">octane-xplat</Text>
39
+ <Text className="muted">one codebase — web · iOS · android</Text>
40
+
41
+ <HStack className="counter">
42
+ <Pressable
43
+ testID="counter.decrement"
44
+ accessibilityLabel="Decrease count"
45
+ className="btn"
46
+ onPress={() => setCount(count - 1)}
47
+ >
48
+ <Text>−</Text>
49
+ </Pressable>
50
+ <Text testID="counter.value" className="count">
51
+ {count}
52
+ </Text>
53
+ <Pressable
54
+ testID="counter.increment"
55
+ accessibilityLabel="Increase count"
56
+ className="btn"
57
+ onPress={() => setCount(count + 1)}
58
+ >
59
+ <Text>+</Text>
60
+ </Pressable>
61
+ </HStack>
62
+
63
+ <ScrollableArea>
64
+ {FEATURES.map((f) => (
65
+ <Text className="chip">{f}</Text>
66
+ ))}
67
+ </ScrollableArea>
68
+
69
+ <Pressable
70
+ testID="settings.toggle-theme"
71
+ className="link"
72
+ onPress={() => {
73
+ const next = !dark
74
+
75
+ storage.setString('theme-preference', next ? 'dark' : 'light')
76
+ setOverride(next)
77
+ }}
78
+ >
79
+ <Text>
80
+ {dark ? 'light' : 'dark'} mode (system: {scheme})
81
+ </Text>
82
+ </Pressable>
83
+ </View>
84
+ </SafeArea>
50
85
  }
@@ -0,0 +1,22 @@
1
+ import { useState } from 'octane'
2
+ import { Pressable, Text } from '@octane-xplat/ui'
3
+ import { defineStory } from '@octane-xplat/workshop'
4
+
5
+ function Welcome() {
6
+ const [count, setCount] = useState(0)
7
+
8
+ return (
9
+ <Pressable onPress={() => setCount(count + 1)}>
10
+ <Text>Hello from Workshop: {count}</Text>
11
+ </Pressable>
12
+ )
13
+ }
14
+
15
+ export const Basic = defineStory({
16
+ id: 'welcome/basic',
17
+ title: 'Welcome / Basic',
18
+ componentId: 'app/Welcome',
19
+ targets: 'all',
20
+ component: Welcome,
21
+ args: {},
22
+ })
@@ -1,4 +1,4 @@
1
- // Starter spec — `pnpm test:ios` / `pnpm test:android` run in the real mobile runtime
1
+ // Starter spec — `bun run test:ios` / `bun run test:android` run in the real mobile runtime
2
2
  // (same renderer, native views, and services your app uses).
3
3
  //
4
4
  // mountXplat() renders a component onto the test host page and unmounts it
@@ -9,14 +9,14 @@ import { describe, expect, it } from 'vitest'
9
9
  import { useEffect, useState, useSyncExternalStore } from 'octane'
10
10
  import { Pressable, Text, TextInput, View } from '@octane-xplat/ui'
11
11
  import {
12
- type TextInputView,
13
- enterText,
14
- findByTestId,
15
- mountXplat,
16
- nextRenderPass,
17
- tap,
18
- viewText,
19
- waitUntil,
12
+ type TextInputView,
13
+ enterText,
14
+ findByTestId,
15
+ mountXplat,
16
+ nextRenderPass,
17
+ tap,
18
+ viewText,
19
+ waitUntil,
20
20
  } from '@octane-xplat/platform/testing'
21
21
 
22
22
  import { App } from './App.tsrx'
@@ -24,111 +24,114 @@ import { App } from './App.tsrx'
24
24
  // Controlled input — typing flows up through onChange and back down as the
25
25
  // rendered value, and parent writes reach the native field.
26
26
  function NameForm() @{
27
- const [name, setName] = useState('')
28
-
29
- <View>
30
- <TextInput
31
- testID="greeting.name"
32
- value={name}
33
- onChange={setName}
34
- placeholder="Your name"
35
- />
36
- <Pressable testID="greeting.reset" onPress={() => setName('Bob')}>
37
- <Text>set bob</Text>
38
- </Pressable>
39
- <Text>{'greeting: ' + (name || 'stranger')}</Text>
40
- </View>
27
+ const [name, setName] = useState('')
28
+
29
+ <View>
30
+ <TextInput testID="greeting.name" value={name} onChange={setName} placeholder="Your name" />
31
+ <Pressable testID="greeting.reset" onPress={() => setName('Bob')}>
32
+ <Text>set bob</Text>
33
+ </Pressable>
34
+ <Text>{'greeting: ' + (name || 'stranger')}</Text>
35
+ </View>
41
36
  }
42
37
 
43
38
  // Conditional mount — a subtree exists only while its state says so.
44
39
  function Details() @{
45
- const [open, setOpen] = useState(false)
46
-
47
- <View>
48
- <Pressable testID="details.toggle" onPress={() => setOpen(!open)}>
49
- <Text>toggle</Text>
50
- </Pressable>
51
- @if (open) {
52
- <Text>detail: open</Text>
53
- }
54
- </View>
40
+ const [open, setOpen] = useState(false)
41
+
42
+ <View>
43
+ <Pressable testID="details.toggle" onPress={() => setOpen(!open)}>
44
+ <Text>toggle</Text>
45
+ </Pressable>
46
+ @if (open) {
47
+ <Text>detail: open</Text>
48
+ }
49
+ </View>
55
50
  }
56
51
 
57
52
  // Async states — loading first, then a settled value or an error. The
58
53
  // cleanup flag keeps a late timer from writing into an unmounted tree.
59
54
  function FetchLabel(props: { fail?: boolean }) @{
60
- const [state, setState] = useState('loading')
61
- useEffect(() => {
62
- let live = true
63
- const timer = setTimeout(() => {
64
- if (live) setState(props.fail ? 'error' : 'ready')
65
- }, 30)
66
-
67
- return () => {
68
- live = false
69
- clearTimeout(timer)
70
- }
71
- }, [])
72
-
73
- <Text>{'fetch: ' + state}</Text>
55
+ const [state, setState] = useState('loading')
56
+
57
+ useEffect(() => {
58
+ let live = true
59
+ const timer = setTimeout(() => {
60
+ if (live) {
61
+ setState(props.fail ? 'error' : 'ready')
62
+ }
63
+ }, 30)
64
+
65
+ return () => {
66
+ live = false
67
+ clearTimeout(timer)
68
+ }
69
+ }, [])
70
+
71
+ <Text>{'fetch: ' + state}</Text>
74
72
  }
75
73
 
76
74
  describe('starter app on device', () => {
77
- it('mounts, reacts to a tap, and unmounts cleanly', async () => {
78
- const { view, host, unmount } = await mountXplat(App)
79
-
80
- const increment = findByTestId(view, 'counter.increment')
81
- const count = findByTestId<TextInputView>(view, 'counter.value')
82
- expect(increment?.isLoaded, 'counter.increment resolves to a loaded native view').toBe(true)
83
-
84
- await tap(increment!)
85
- await waitUntil(() => count?.text === '1', {
86
- message: 'tap did not reach the increment Pressable',
87
- })
88
-
89
- await unmount()
90
- await nextRenderPass()
91
- expect(host.content).toBe(null)
92
- })
93
-
94
- it('round-trips a controlled TextInput', async () => {
95
- const { view } = await mountXplat(NameForm)
96
- const field = findByTestId<TextInputView>(view, 'greeting.name')
97
- expect(field?.isLoaded).toBe(true)
98
-
99
- await enterText(field!, 'Ada')
100
- await waitUntil(() => viewText(view).includes('greeting: Ada'), {
101
- message: 'onChange did not deliver the typed text',
102
- })
103
-
104
- await tap(findByTestId(view, 'greeting.reset')!)
105
- await waitUntil(() => field?.text === 'Bob', {
106
- message: 'parent write did not reach the native field',
107
- })
108
- })
109
-
110
- it('mounts and unmounts a conditional subtree', async () => {
111
- const { view } = await mountXplat(Details)
112
- expect(viewText(view).includes('detail: open')).toBe(false)
113
-
114
- await tap(findByTestId(view, 'details.toggle')!)
115
- await waitUntil(() => viewText(view).includes('detail: open'))
116
-
117
- await tap(findByTestId(view, 'details.toggle')!)
118
- await waitUntil(() => !viewText(view).includes('detail: open'))
119
- })
120
-
121
- it('settles async loading and error states', async () => {
122
- const ready = await mountXplat(FetchLabel)
123
- await waitUntil(() => viewText(ready.view).includes('fetch: ready'), {
124
- message: 'loading state never settled',
125
- })
126
-
127
- const failed = await mountXplat(FetchLabel, { fail: true })
128
- await waitUntil(() => viewText(failed.view).includes('fetch: error'), {
129
- message: 'error state never surfaced',
130
- })
131
- })
75
+ it('mounts, reacts to a tap, and unmounts cleanly', async () => {
76
+ const { view, host, unmount } = await mountXplat(App)
77
+
78
+ const increment = findByTestId(view, 'counter.increment')
79
+ const count = findByTestId<TextInputView>(view, 'counter.value')
80
+
81
+ expect(increment?.isLoaded, 'counter.increment resolves to a loaded native view').toBe(true)
82
+
83
+ await tap(increment!)
84
+ await waitUntil(() => count?.text === '1', {
85
+ message: 'tap did not reach the increment Pressable',
86
+ })
87
+
88
+ await unmount()
89
+ await nextRenderPass()
90
+ expect(host.content).toBe(null)
91
+ })
92
+
93
+ it('round-trips a controlled TextInput', async () => {
94
+ const { view } = await mountXplat(NameForm)
95
+ const field = findByTestId<TextInputView>(view, 'greeting.name')
96
+
97
+ expect(field?.isLoaded).toBe(true)
98
+
99
+ await enterText(field!, 'Ada')
100
+ await waitUntil(() => viewText(view).includes('greeting: Ada'), {
101
+ message: 'onChange did not deliver the typed text',
102
+ })
103
+
104
+ await tap(findByTestId(view, 'greeting.reset')!)
105
+ await waitUntil(() => field?.text === 'Bob', {
106
+ message: 'parent write did not reach the native field',
107
+ })
108
+ })
109
+
110
+ it('mounts and unmounts a conditional subtree', async () => {
111
+ const { view } = await mountXplat(Details)
112
+
113
+ expect(viewText(view).includes('detail: open')).toBe(false)
114
+
115
+ await tap(findByTestId(view, 'details.toggle')!)
116
+ await waitUntil(() => viewText(view).includes('detail: open'))
117
+
118
+ await tap(findByTestId(view, 'details.toggle')!)
119
+ await waitUntil(() => !viewText(view).includes('detail: open'))
120
+ })
121
+
122
+ it('settles async loading and error states', async () => {
123
+ const ready = await mountXplat(FetchLabel)
124
+
125
+ await waitUntil(() => viewText(ready.view).includes('fetch: ready'), {
126
+ message: 'loading state never settled',
127
+ })
128
+
129
+ const failed = await mountXplat(FetchLabel, { fail: true })
130
+
131
+ await waitUntil(() => viewText(failed.view).includes('fetch: error'), {
132
+ message: 'error state never surfaced',
133
+ })
134
+ })
132
135
  })
133
136
 
134
137
  // Observable cleanup contracts: every effect subscribe must pair with a
@@ -138,73 +141,76 @@ let activeEffects = 0
138
141
  let ticks = 0
139
142
 
140
143
  function IntervalCounter() @{
141
- useEffect(() => {
142
- activeEffects += 1
143
- const timer = setInterval(() => {
144
- ticks += 1
145
- }, 15)
146
-
147
- return () => {
148
- activeEffects -= 1
149
- clearInterval(timer)
150
- }
151
- }, [])
152
-
153
- <Text>interval</Text>
144
+ useEffect(() => {
145
+ activeEffects += 1
146
+
147
+ const timer = setInterval(() => {
148
+ ticks += 1
149
+ }, 15)
150
+
151
+ return () => {
152
+ activeEffects -= 1
153
+ clearInterval(timer)
154
+ }
155
+ }, [])
156
+
157
+ <Text>interval</Text>
154
158
  }
155
159
 
156
160
  const listeners = new Set<() => void>()
157
161
 
158
162
  function StoreReader() @{
159
- const count = useSyncExternalStore(
160
- (callback) => {
161
- listeners.add(callback)
162
- return () => {
163
- listeners.delete(callback)
164
- }
165
- },
166
- () => listeners.size,
167
- )
168
-
169
- <Text>{'subs: ' + count}</Text>
163
+ const count = useSyncExternalStore(
164
+ (callback) => {
165
+ listeners.add(callback)
166
+ return () => {
167
+ listeners.delete(callback)
168
+ }
169
+ },
170
+ () => listeners.size,
171
+ )
172
+
173
+ <Text>{'subs: ' + count}</Text>
170
174
  }
171
175
 
172
176
  describe('mount/unmount cleanup', () => {
173
- it('runs effect cleanups and stops delayed work at unmount', async () => {
174
- ticks = 0
175
- for (let i = 0; i < 3; i++) {
176
- const { unmount } = await mountXplat(IntervalCounter)
177
- expect(activeEffects, 'each mount subscribes exactly once').toBe(1)
178
- await unmount()
179
- expect(activeEffects, 'unmount runs the effect cleanup').toBe(0)
180
- }
181
-
182
- // The cleared interval must not fire after the last unmount.
183
- const settled = ticks
184
- await new Promise((resolve) => setTimeout(resolve, 60))
185
- expect(ticks, 'interval work continued after unmount').toBe(settled)
186
- })
187
-
188
- it('releases external-store subscriptions at unmount', async () => {
189
- for (let i = 0; i < 3; i++) {
190
- const { unmount } = await mountXplat(StoreReader)
191
- expect(listeners.size, 'each mount subscribes exactly once').toBe(1)
192
- await unmount()
193
- expect(listeners.size, 'unmount releases the subscription').toBe(0)
194
- }
195
- })
196
-
197
- it('re-mounting replaces the previous root instead of leaking it', async () => {
198
- await mountXplat(IntervalCounter)
199
- expect(activeEffects).toBe(1)
200
- // mountXplat drops the previous root — its cleanup must already have run.
201
- await mountXplat(IntervalCounter)
202
- expect(activeEffects, 'previous root stayed subscribed after re-mount').toBe(1)
203
- })
204
-
205
- it('finishes automatic cleanup before the next case', () => {
206
- expect(activeEffects).toBe(0)
207
- expect(listeners.size).toBe(0)
208
- })
209
-
177
+ it('runs effect cleanups and stops delayed work at unmount', async () => {
178
+ ticks = 0
179
+ for (let i = 0; i < 3; i++) {
180
+ const { unmount } = await mountXplat(IntervalCounter)
181
+
182
+ expect(activeEffects, 'each mount subscribes exactly once').toBe(1)
183
+ await unmount()
184
+ expect(activeEffects, 'unmount runs the effect cleanup').toBe(0)
185
+ }
186
+
187
+ // The cleared interval must not fire after the last unmount.
188
+ const settled = ticks
189
+
190
+ await new Promise((resolve) => setTimeout(resolve, 60))
191
+ expect(ticks, 'interval work continued after unmount').toBe(settled)
192
+ })
193
+
194
+ it('releases external-store subscriptions at unmount', async () => {
195
+ for (let i = 0; i < 3; i++) {
196
+ const { unmount } = await mountXplat(StoreReader)
197
+
198
+ expect(listeners.size, 'each mount subscribes exactly once').toBe(1)
199
+ await unmount()
200
+ expect(listeners.size, 'unmount releases the subscription').toBe(0)
201
+ }
202
+ })
203
+
204
+ it('re-mounting replaces the previous root instead of leaking it', async () => {
205
+ await mountXplat(IntervalCounter)
206
+ expect(activeEffects).toBe(1)
207
+ // mountXplat drops the previous root — its cleanup must already have run.
208
+ await mountXplat(IntervalCounter)
209
+ expect(activeEffects, 'previous root stayed subscribed after re-mount').toBe(1)
210
+ })
211
+
212
+ it('finishes automatic cleanup before the next case', () => {
213
+ expect(activeEffects).toBe(0)
214
+ expect(listeners.size).toBe(0)
215
+ })
210
216
  })
@@ -4,17 +4,22 @@ import { createRoot } from 'octane'
4
4
  import { App } from './App.tsrx'
5
5
 
6
6
  it('updates the counter when its button is pressed', async () => {
7
- const container = document.createElement('div')
8
- document.body.append(container)
9
- const root = createRoot(container)
10
- try {
11
- root.render(<App />)
12
- const value = () => container.querySelector('[data-testid="counter.value"]')?.textContent
13
- await vi.waitFor(() => expect(value()).toBe('0'))
14
- container.querySelector<HTMLElement>('[data-testid="counter.increment"]')!.click()
15
- await vi.waitFor(() => expect(value()).toBe('1'))
16
- } finally {
17
- root.unmount()
18
- container.remove()
19
- }
7
+ const container = document.createElement('div')
8
+
9
+ document.body.append(container)
10
+
11
+ const root = createRoot(container)
12
+
13
+ try {
14
+ root.render(<App />)
15
+
16
+ const value = () => container.querySelector('[data-testid="counter.value"]')?.textContent
17
+
18
+ await vi.waitFor(() => expect(value()).toBe('0'))
19
+ container.querySelector<HTMLElement>('[data-testid="counter.increment"]')!.click()
20
+ await vi.waitFor(() => expect(value()).toBe('1'))
21
+ } finally {
22
+ root.unmount()
23
+ container.remove()
24
+ }
20
25
  })
@@ -5,7 +5,7 @@ import { describe, expect, it } from 'vitest'
5
5
  // real Vitest failures (it.fails inverts the outcome, keeping the committed
6
6
  // suite green while pinning the failure-reporting path).
7
7
  describe('failure reporting', () => {
8
- it.fails('a failed assertion on device is reported as a failure', () => {
9
- expect('octane-xplat').toBe('a different string entirely')
10
- })
8
+ it.fails('a failed assertion on device is reported as a failure', () => {
9
+ expect('octane-xplat').toBe('a different string entirely')
10
+ })
11
11
  })
@@ -8,17 +8,18 @@ import '@octane-xplat/ui/theme/tokens.css'
8
8
  import './style.css'
9
9
 
10
10
  const entry = {
11
- create: () => {
12
- // A Frame hosts the root Page. RouteOutlet binds canonical routing
13
- // to this Frame when the app adds generated routes.
14
- const frame = new Frame()
15
- // Full-screen page: SafeArea owns safe-area padding.
16
- const page = prepareFullScreenPage(new Page())
17
- page.actionBarHidden = true
18
- renderNativeScriptApp(page, App)
19
- frame.navigate({ create: () => page })
20
- return frame
21
- },
11
+ create: () => {
12
+ // A Frame hosts the root Page. RouteOutlet binds canonical routing
13
+ // to this Frame when the app adds generated routes.
14
+ const frame = new Frame()
15
+ // Full-screen page: SafeArea owns safe-area padding.
16
+ const page = prepareFullScreenPage(new Page())
17
+
18
+ page.actionBarHidden = true
19
+ renderNativeScriptApp(page, App)
20
+ frame.navigate({ create: () => page })
21
+ return frame
22
+ },
22
23
  }
23
24
 
24
25
  // Under the vite dev session the placeholder bootstrap has already run
@@ -27,7 +28,7 @@ const entry = {
27
28
  // (iOS core handles the placeholder handoff internally); resetRootView is
28
29
  // the documented way to swap the root of a running app.
29
30
  if (Application.started) {
30
- Application.resetRootView(entry)
31
+ Application.resetRootView(entry)
31
32
  } else {
32
- Application.run(entry)
33
+ Application.run(entry)
33
34
  }
@@ -0,0 +1,2 @@
1
+ // Type contract only.
2
+ export {}
@@ -1,7 +1,7 @@
1
1
  /** @jsxImportSource @octane-xplat/jsx/dom */
2
- import { createRoot } from 'octane';
3
- import { App } from './App.tsrx';
4
- import '@octane-xplat/ui/theme/tokens.css';
5
- import './style.css';
2
+ import { createRoot } from 'octane'
3
+ import { App } from './App.tsrx'
4
+ import '@octane-xplat/ui/theme/tokens.css'
5
+ import './style.css'
6
6
 
7
- createRoot(document.getElementById('root')!).render(<App />);
7
+ createRoot(document.getElementById('root')!).render(<App />)