@ankhorage/studio 8.0.0 → 8.0.2

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 (65) hide show
  1. package/README.md +1 -1
  2. package/apm/update.json +1 -1
  3. package/dist/features/project-updates/domain/applyGeneratedPackagePolicy.d.ts.map +1 -1
  4. package/dist/features/project-updates/domain/applyGeneratedPackagePolicy.js +2 -2
  5. package/dist/features/project-updates/domain/applyGeneratedPackagePolicy.js.map +1 -1
  6. package/dist/host/layout/layoutGenerator.d.ts +1 -1
  7. package/dist/host/layout/layoutGenerator.d.ts.map +1 -1
  8. package/dist/host/layout/layoutGenerator.js +61 -123
  9. package/dist/host/layout/layoutGenerator.js.map +1 -1
  10. package/dist/host/layout/navigator/createNavigatorGenerationBindings.js +38 -3
  11. package/dist/host/layout/navigator/createNavigatorGenerationBindings.js.map +1 -1
  12. package/dist/host/layout/templates/auth/adapter.d.ts.map +1 -1
  13. package/dist/host/layout/templates/auth/adapter.js +1 -2
  14. package/dist/host/layout/templates/auth/adapter.js.map +1 -1
  15. package/dist/host/layout/templates/auth/screenController.d.ts.map +1 -1
  16. package/dist/host/layout/templates/auth/screenController.js +4 -1
  17. package/dist/host/layout/templates/auth/screenController.js.map +1 -1
  18. package/dist/host/layout/templates/auth/session.js +1 -1
  19. package/dist/host/layout/templates/index.d.ts +4 -0
  20. package/dist/host/layout/templates/index.d.ts.map +1 -1
  21. package/dist/host/layout/templates/index.js +4 -0
  22. package/dist/host/layout/templates/index.js.map +1 -1
  23. package/dist/host/layout/templates/rootLayout.d.ts +1 -4
  24. package/dist/host/layout/templates/rootLayout.d.ts.map +1 -1
  25. package/dist/host/layout/templates/rootLayout.js +82 -436
  26. package/dist/host/layout/templates/rootLayout.js.map +1 -1
  27. package/dist/host/layout/templates/rootShell.d.ts +6 -0
  28. package/dist/host/layout/templates/rootShell.d.ts.map +1 -0
  29. package/dist/host/layout/templates/rootShell.js +109 -0
  30. package/dist/host/layout/templates/rootShell.js.map +1 -0
  31. package/dist/host/layout/templates/runtimeShell.d.ts +12 -0
  32. package/dist/host/layout/templates/runtimeShell.d.ts.map +1 -0
  33. package/dist/host/layout/templates/runtimeShell.js +184 -0
  34. package/dist/host/layout/templates/runtimeShell.js.map +1 -0
  35. package/dist/host/layout/templates/studioAppHeader.d.ts +6 -0
  36. package/dist/host/layout/templates/studioAppHeader.d.ts.map +1 -0
  37. package/dist/host/layout/templates/studioAppHeader.js +101 -0
  38. package/dist/host/layout/templates/studioAppHeader.js.map +1 -0
  39. package/dist/host/layout/templates/studioShell.d.ts +13 -0
  40. package/dist/host/layout/templates/studioShell.d.ts.map +1 -0
  41. package/dist/host/layout/templates/studioShell.js +317 -0
  42. package/dist/host/layout/templates/studioShell.js.map +1 -0
  43. package/dist/host/orchestrator/GeneratedRouteFileOwnership.d.ts.map +1 -1
  44. package/dist/host/orchestrator/GeneratedRouteFileOwnership.js +8 -1
  45. package/dist/host/orchestrator/GeneratedRouteFileOwnership.js.map +1 -1
  46. package/dist/host/orchestrator/generatedAppFiles.d.ts +2 -0
  47. package/dist/host/orchestrator/generatedAppFiles.d.ts.map +1 -1
  48. package/dist/host/orchestrator/generatedAppFiles.js +5 -3
  49. package/dist/host/orchestrator/generatedAppFiles.js.map +1 -1
  50. package/dist/host/orchestrator/projectManager.d.ts.map +1 -1
  51. package/dist/host/orchestrator/projectManager.js +8 -0
  52. package/dist/host/orchestrator/projectManager.js.map +1 -1
  53. package/dist/host/orchestrator/scaffolder.d.ts +3 -0
  54. package/dist/host/orchestrator/scaffolder.d.ts.map +1 -1
  55. package/dist/host/orchestrator/scaffolder.js +20 -10
  56. package/dist/host/orchestrator/scaffolder.js.map +1 -1
  57. package/dist/host/orchestrator/templateSources.d.ts +5 -1
  58. package/dist/host/orchestrator/templateSources.d.ts.map +1 -1
  59. package/dist/host/orchestrator/templateSources.js +98 -8
  60. package/dist/host/orchestrator/templateSources.js.map +1 -1
  61. package/dist/host/orchestrator/templates.d.ts +3 -2
  62. package/dist/host/orchestrator/templates.d.ts.map +1 -1
  63. package/dist/host/orchestrator/templates.js +1 -1
  64. package/dist/host/orchestrator/templates.js.map +1 -1
  65. package/package.json +8 -7
@@ -1,5 +1,9 @@
1
1
  /*** Audit coverage: exports-only entrypoint for generated layout and auth template sources. */
2
2
  export { getRootLayoutImportRequirements, getRootLayoutTsx } from './rootLayout';
3
+ export { getRootShellImportRequirements, getRootShellTsx } from './rootShell';
4
+ export { getRuntimeShellImportRequirements, getRuntimeShellTsx } from './runtimeShell';
5
+ export { getStudioAppHeaderImportRequirements, getStudioAppHeaderTsx } from './studioAppHeader';
6
+ export { getStudioShellImportRequirements, getStudioShellTsx } from './studioShell';
3
7
  export type { RootNavigationContent } from './rootLayout';
4
8
  export { getScreenTsx } from './screen';
5
9
  export { getAuthSessionTs } from './auth/session';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/host/layout/templates/index.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjF,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;A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AAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC"}
@@ -1,5 +1,9 @@
1
1
  /*** Audit coverage: exports-only entrypoint for generated layout and auth template sources. */
2
2
  export { getRootLayoutImportRequirements, getRootLayoutTsx } from './rootLayout';
3
+ export { getRootShellImportRequirements, getRootShellTsx } from './rootShell';
4
+ export { getRuntimeShellImportRequirements, getRuntimeShellTsx } from './runtimeShell';
5
+ export { getStudioAppHeaderImportRequirements, getStudioAppHeaderTsx } from './studioAppHeader';
6
+ export { getStudioShellImportRequirements, getStudioShellTsx } from './studioShell';
3
7
  export { getScreenTsx } from './screen';
4
8
  export { getAuthSessionTs } from './auth/session';
5
9
  export { getSignOutScreenTsx } from './auth/signOut';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/host/layout/templates/index.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAA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ACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC"}
@@ -23,14 +23,11 @@ interface GetRootLayoutTsxArgs {
23
23
  includeStudio: boolean;
24
24
  authRuntime?: RootLayoutAuthRuntimeConfig;
25
25
  initialRouteNameOverride?: string;
26
- runtimeModuleDeclarations?: string;
27
- runtimeCapabilityExecutorHookName?: string;
28
26
  runtimeProviderEnd?: string[];
29
27
  runtimeProviderStart?: string[];
30
- useStoredAuthSessionCredentialResolver?: boolean;
31
28
  }
32
29
  /***
33
- * Describe the generated root-layout import requirements, including Studio-only runtime and media-picker dependencies when authoring is enabled.
30
+ * Describe generated root-layout imports for splash-screen lifecycle and Studio media-picker ownership.
34
31
  */
35
32
  export declare function getRootLayoutImportRequirements(includeStudio: boolean): GeneratedImportRequirement[];
36
33
  /***
@@ -1 +1 @@
1
- {"version":3,"file":"rootLayout.d.ts","sourceRoot":"","sources":["../../../../src/host/layout/templates/rootLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,2BAA2B;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,WAAW,CAAC;IACtB,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,UAAU,EAAE,MAAM,CAA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;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,qBAAqB,CAAC;IACvC,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,2BAA2B,CAAC;IAC1C,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,OAAO,GACrB,0BAA0B,EAAE,CAmB9B;AAaD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,UA8M1D"}
@@ -1,5 +1,5 @@
1
1
  /***
2
- * Describe the generated root-layout import requirements, including Studio-only runtime and media-picker dependencies when authoring is enabled.
2
+ * Describe generated root-layout imports for splash-screen lifecycle and Studio media-picker ownership.
3
3
  */
4
4
  export function getRootLayoutImportRequirements(includeStudio) {
5
5
  return [
@@ -7,30 +7,10 @@ export function getRootLayoutImportRequirements(includeStudio) {
7
7
  source: 'react',
8
8
  namedImports: [{ imported: 'ReactNode', typeOnly: true }, { imported: 'useEffect' }],
9
9
  },
10
- {
11
- source: 'react-native',
12
- namedImports: !includeStudio ? [{ imported: 'Alert' }] : [],
13
- },
14
- {
15
- source: '@ankhorage/expo-runtime/bundled-media',
16
- namedImports: [{ imported: 'createExpoBundledMediaResolver' }],
17
- },
18
- {
19
- source: '@ankhorage/utility/object',
20
- namedImports: [{ imported: 'readOwnProperty' }],
21
- },
22
- {
23
- source: '@ankhorage/expo-runtime/icon-fonts',
24
- namedImports: [{ imported: 'ExpoZoraIconFontProvider' }],
25
- },
26
10
  {
27
11
  source: 'expo-splash-screen',
28
12
  namespaceImport: 'SplashScreen',
29
13
  },
30
- {
31
- source: '@/generated/bundledMediaRegistry',
32
- namedImports: [{ imported: 'bundledMediaRegistry' }],
33
- },
34
14
  ...(includeStudio
35
15
  ? [
36
16
  {
@@ -39,19 +19,6 @@ export function getRootLayoutImportRequirements(includeStudio) {
39
19
  },
40
20
  ]
41
21
  : []),
42
- ...(includeStudio
43
- ? [
44
- {
45
- source: '@ankhorage/studio/runtime',
46
- namedImports: [
47
- { imported: 'createStudioActionSuppressionConfig' },
48
- { imported: 'createStudioInteractionPolicyResolver' },
49
- { imported: 'createStudioStationarySelectionWrapNode' },
50
- { imported: 'StationaryTapSelector' },
51
- ],
52
- },
53
- ]
54
- : []),
55
22
  ];
56
23
  }
57
24
  /***
@@ -69,86 +36,19 @@ function indentGeneratedBlock(content, indent = ' ') {
69
36
  * TODO: Move generated application-shell template ownership out of the generic host/layout bucket into the project/template generation domain.
70
37
  */
71
38
  export function getRootLayoutTsx(args) {
72
- const { manifest, mutations, allImports, allHooks, innerNavigation, includeStudio, authRuntime, initialRouteNameOverride, runtimeModuleDeclarations, runtimeCapabilityExecutorHookName, runtimeProviderEnd = [], runtimeProviderStart = [], useStoredAuthSessionCredentialResolver = false, } = args;
39
+ const { manifest, mutations, allImports, allHooks, innerNavigation, includeStudio, authRuntime, initialRouteNameOverride, runtimeProviderEnd = [], runtimeProviderStart = [], } = args;
73
40
  const moduleProvidersStart = mutations.flatMap((m) => m.providerStart);
74
41
  const moduleProvidersEnd = mutations.flatMap((m) => m.providerEnd).reverse();
75
42
  const innerThemeHook = innerNavigation.usesTheme ? ' const { theme } = useZoraTheme();\n' : '';
76
- const resolvedRuntimeCapabilityExecutorHookName = runtimeCapabilityExecutorHookName ??
77
- (includeStudio
78
- ? 'useStudioRuntimeCapabilityExecutor'
79
- : 'useGeneratedRuntimeCapabilityExecutor');
80
43
  const providersStart = [...runtimeProviderStart, ...moduleProvidersStart].join('\n ');
81
44
  const providersEnd = [...moduleProvidersEnd, ...runtimeProviderEnd].join('\n ');
82
45
  const finalJsx = providersStart ? `{${providersStart}{output}${providersEnd}}` : '{output}';
83
46
  const studioFinalJsx = finalJsx.replace('{output}', '{studioOutput}');
84
- const appHeaderHelpers = `
85
- function findRouteByScreenId(navigator: NavigatorNode, screenId: string): RouteDefinition | null {
86
- for (const route of navigator.routes) {
87
- if (route.screenId === screenId) {
88
- return route;
89
- }
90
-
91
- if (route.navigator) {
92
- const nestedRoute = findRouteByScreenId(route.navigator, screenId);
93
- if (nestedRoute) {
94
- return nestedRoute;
95
- }
96
- }
97
- }
98
-
99
- return null;
100
- }
101
-
102
- function resolveAppHeaderTitle(manifest: AppManifest, pathname: string): string {
103
- const screenId = resolveScreenIdForPathname(manifest.navigator, pathname, manifest.screens);
104
- const route = screenId ? findRouteByScreenId(manifest.navigator, screenId) : null;
105
- const screen = screenId ? manifest.screens[screenId] : undefined;
106
- return route?.label ?? screen?.title ?? screen?.name ?? route?.name ?? 'App';
107
- }
108
-
109
- function resolveAppHeaderTitleForScreenId(
110
- manifest: AppManifest,
111
- screenId: string | null | undefined,
112
- ): string | null {
113
- if (!screenId) return null;
114
-
115
- const screen = manifest.screens[screenId];
116
- if (!screen) return null;
117
-
118
- const route = findRouteByScreenId(manifest.navigator, screenId);
119
- return route?.label ?? screen.title ?? screen.name;
120
- }
121
-
122
- function resolveStudioAppHeaderTitle(args: {
123
- runtimeManifest: AppManifest;
124
- studioManifest: AppManifest | null;
125
- previewMode: boolean;
126
- activeScreenId: string | null;
127
- pathname: string;
128
- }): string {
129
- const { runtimeManifest, studioManifest, previewMode, activeScreenId, pathname } = args;
130
-
131
- if (previewMode) {
132
- const previewTitle = resolveAppHeaderTitleForScreenId(
133
- studioManifest ?? runtimeManifest,
134
- activeScreenId,
135
- );
136
- if (previewTitle) return previewTitle;
137
- }
138
-
139
- return resolveAppHeaderTitle(runtimeManifest, pathname);
140
- }
141
- `;
142
47
  const authRuntimeHook = authRuntime
143
48
  ? includeStudio
144
49
  ? `
145
- const {
146
- authState,
147
- canAccessStudioAdmin,
148
- handleInnerContentReady,
149
- isAuthRuntimeReady,
150
- pathname,
151
- } = useGeneratedAuthNavigation();
50
+ const { authState, canAccessStudioAdmin, handleInnerContentReady, isAuthRuntimeReady, pathname } =
51
+ useGeneratedAuthNavigation();
152
52
  `
153
53
  : `
154
54
  const { authState, handleInnerContentReady } = useGeneratedAuthNavigation();
@@ -158,7 +58,13 @@ const { authState, handleInnerContentReady } = useGeneratedAuthNavigation();
158
58
  const indentedRootHookBlock = rootHookBlock.length > 0 ? `${indentGeneratedBlock(rootHookBlock)}\n\n` : '';
159
59
  const innerContentNode = authRuntime
160
60
  ? includeStudio
161
- ? '<InnerContent authState={authState} canAccessStudioAdmin={canAccessStudioAdmin} onReady={handleInnerContentReady} />'
61
+ ? `(
62
+ <InnerContent
63
+ authState={authState}
64
+ canAccessStudioAdmin={canAccessStudioAdmin}
65
+ onReady={handleInnerContentReady}
66
+ />
67
+ )`
162
68
  : '<InnerContent authState={authState} onReady={handleInnerContentReady} />'
163
69
  : '<InnerContent />';
164
70
  const innerContentSignature = authRuntime
@@ -184,130 +90,43 @@ const { authState, handleInnerContentReady } = useGeneratedAuthNavigation();
184
90
  }
185
91
  `
186
92
  : '';
187
- const runtimeCredentialResolver = useStoredAuthSessionCredentialResolver
188
- ? '\n credentialResolver: resolveRuntimeOperationCredential,'
189
- : '';
190
- const runtimeOperationHelpers = `
191
- async function runtimeApiFetch(
192
- url: string,
193
- init: {
194
- readonly method: string;
195
- readonly headers: Readonly<Record<string, string>>;
196
- readonly body?: string;
197
- },
198
- ) {
199
- const response = await fetch(url, {
200
- method: init.method,
201
- headers: init.headers,
202
- body: init.body,
203
- });
204
-
205
- return {
206
- status: response.status,
207
- headers: Object.fromEntries(response.headers.entries()),
208
- text: () => response.text(),
209
- };
210
- }
211
- ${useStoredAuthSessionCredentialResolver
212
- ? `
213
- function resolveRuntimeOperationCredential(credential: { readonly kind?: string } | undefined) {
214
- if (credential?.kind !== 'bearer' && credential?.kind !== 'oauth2') return undefined;
215
-
216
- const session = getStoredAuthSession();
217
- if (!session?.accessToken) return undefined;
218
-
219
- return {
220
- headers: {
221
- Authorization: \`Bearer \${session.accessToken}\`,
222
- },
223
- };
224
- }
225
- `
226
- : ''}
227
- `;
228
93
  const runtimeContentDeclaration = `const runtimeContent = (
229
- <GeneratedRuntimeContent runtimeManifest={runtimeManifest}>
230
- {appContent}
231
- </GeneratedRuntimeContent>
94
+ <GeneratedRuntimeShell runtimeManifest={runtimeManifest}>{appContent}</GeneratedRuntimeShell>
232
95
  );`;
233
- const generatedRuntimeContent = `function GeneratedRuntimeContent({
234
- children,
96
+ const outputDeclaration = includeStudio
97
+ ? `const output = getGeneratedAppOutput({ appContent, appPathname, runtimeManifest });`
98
+ : `${runtimeContentDeclaration}
99
+ const output = runtimeContent;`;
100
+ const generatedAppOutput = includeStudio
101
+ ? `function getGeneratedAppOutput({
102
+ appContent,
103
+ appPathname,
235
104
  runtimeManifest,
236
105
  }: {
237
- children: ReactNode;
238
- runtimeManifest: AppManifest;
239
- }) {${includeStudio ? '\n const { setMode } = useZoraTheme();' : ''}
240
- const { executeCapability: executeApplicationCapability } =
241
- ${resolvedRuntimeCapabilityExecutorHookName}(${includeStudio ? '{ setThemeMode: setMode }' : ''});
242
- const executeCapability = useMemo(
243
- () =>
244
- composeRuntimeCapabilityExecutor({
245
- apiCapabilityExecutor: createRuntimeApiCapabilityExecutor({
246
- apis: runtimeManifest.infra.apis ?? {},
247
- fetch: runtimeApiFetch,${runtimeCredentialResolver}
248
- }),
249
- capabilityExecutor: executeApplicationCapability,
250
- }),
251
- [executeApplicationCapability, runtimeManifest.infra.apis],
252
- );
253
-
254
- const generatedRuntimeConfig = useMemo(
255
- () => ({
256
- executeCapability,
257
- registry: runtimeComponentRegistry,
258
- mediaAssets: runtimeManifest.media?.assets,
259
- resolveMediaAsset: bundledMediaResolver,
260
- }),
261
- [executeCapability, runtimeManifest.media?.assets],
106
+ readonly appContent: ReactNode;
107
+ readonly appPathname: string;
108
+ readonly runtimeManifest: AppManifest;
109
+ }) {
110
+ const runtimeContent = (
111
+ <GeneratedRuntimeShell runtimeManifest={runtimeManifest}>{appContent}</GeneratedRuntimeShell>
262
112
  );
263
-
113
+ if (!__DEV__ || isStudioAdminPath(appPathname)) return runtimeContent;
264
114
  return (
265
- <RuntimeRendererConfigProvider value={generatedRuntimeConfig}>
266
- {children}
267
- </RuntimeRendererConfigProvider>
115
+ <AnkhStudio
116
+ runtimeRegistry={runtimeComponentRegistry}
117
+ bundledMediaRegistry={bundledMediaRegistry}
118
+ >
119
+ {runtimeContent}
120
+ </AnkhStudio>
268
121
  );
269
- }`;
270
- const outputDeclaration = includeStudio
271
- ? `${runtimeContentDeclaration}
272
- const output = __DEV__ ? (
273
- isStudioAdminPath(appPathname) ? (
274
- runtimeContent
275
- ) : (
276
- <AnkhStudio
277
- runtimeRegistry={runtimeComponentRegistry}
278
- bundledMediaRegistry={bundledMediaRegistry}
279
- >
280
- {runtimeContent}
281
- </AnkhStudio>
282
- )
283
- ) : (
284
- runtimeContent
285
- );`
286
- : `${runtimeContentDeclaration}
287
- const output = runtimeContent;`;
122
+ }`
123
+ : '';
288
124
  const moduleLevelDeclarations = [
289
- runtimeModuleDeclarations?.trim(),
290
- 'const bundledMediaResolver = createExpoBundledMediaResolver(bundledMediaRegistry);',
291
- runtimeOperationHelpers.trim(),
292
- includeStudio ? appHeaderHelpers.trim() : '',
293
125
  includeStudio ? 'const studioMediaPicker = createExpoMediaPickerAdapter();' : '',
294
126
  innerNavigation.declarations.trim(),
295
127
  ]
296
128
  .filter(Boolean)
297
129
  .join('\n\n');
298
- const studioRuntimeLines = includeStudio
299
- ? `const appPathname = ${authRuntime ? 'pathname' : 'usePathname()'};
300
- const appRouteSearchParams = useGlobalSearchParams();
301
- const appRouteSearchParamsKey = JSON.stringify(appRouteSearchParams);
302
- const appLocation = useMemo(
303
- () => resolveStudioNavigableLocation(appPathname),
304
- [appPathname, appRouteSearchParamsKey],
305
- );
306
- const shouldMountAppHeader =
307
- !isStudioAdminPath(appPathname) &&
308
- ${authRuntime ? 'shouldMountAuthenticatedAppHeader(appPathname, isAuthRuntimeReady)' : 'true'};`
309
- : '';
310
- const indentedStudioRuntimeLines = studioRuntimeLines.length > 0 ? `\n${indentGeneratedBlock(studioRuntimeLines)}\n` : '\n';
311
130
  const handleInnerContentReadyDeclaration = '';
312
131
  const indentedHandleInnerContentReadyDeclaration = handleInnerContentReadyDeclaration.length > 0
313
132
  ? `${indentGeneratedBlock(handleInnerContentReadyDeclaration)}\n\n`
@@ -315,7 +134,7 @@ const shouldMountAppHeader =
315
134
  const studioShellBlock = includeStudio
316
135
  ? `if (__DEV__) {
317
136
  return (
318
- <GeneratedRootView>
137
+ <GeneratedRootShell>
319
138
  <StudioProvider
320
139
  projectId={ankhConfig.metadata.slug}
321
140
  initialManifest={runtimeManifest}
@@ -331,9 +150,10 @@ const shouldMountAppHeader =
331
150
  appPathname={appPathname}
332
151
  appLocation={appLocation}
333
152
  shouldMountAppHeader={shouldMountAppHeader}
153
+ wrapOutput={(studioOutput) => <>${studioFinalJsx}</>}
334
154
  />
335
155
  </StudioProvider>
336
- </GeneratedRootView>
156
+ </GeneratedRootShell>
337
157
  );
338
158
  }`
339
159
  : '';
@@ -344,232 +164,58 @@ const shouldMountAppHeader =
344
164
  const generatedAppShell = finalJsx === '{output}'
345
165
  ? '<AppShell>{output}</AppShell>'
346
166
  : `<AppShell>
347
- ${finalJsx}
348
- </AppShell>`;
349
- const runtimeComponentRegistryDeclaration = 'const runtimeComponentRegistry = APP_COMPONENT_REGISTRY;';
350
- return `
351
- ${allImports}
352
-
353
- void SplashScreen.preventAutoHideAsync();
354
-
355
- ${moduleLevelDeclarations}
356
-
357
- const fallbackManifest = ankhConfig as unknown as AppManifest;
358
- ${runtimeComponentRegistryDeclaration}
359
- const rootViewStyle = { flex: 1 } as const;
360
-
361
- function GeneratedRootView({ children }: { children: ReactNode }) {
362
- return (
363
- <ExpoZoraIconFontProvider>
364
- <GestureHandlerRootView style={rootViewStyle}>{children}</GestureHandlerRootView>
365
- </ExpoZoraIconFontProvider>
366
- );
367
- }
368
-
369
- function resolveZoraSurfaceThemeConfig(\n theme: AppManifest['themes'][string],\n): AppManifest['themes'][string] {
370
- return {
371
- id: theme.id,
372
- name: theme.name,
373
- light: { ...theme.light },
374
- dark: { ...theme.dark },
375
- ...(theme.tokens === undefined ? {} : { tokens: theme.tokens }),
376
- ...(theme.recipes === undefined ? {} : { recipes: theme.recipes }),
377
- };
378
- }
379
-
380
- function resolveManifestActiveTheme(manifest: AppManifest): AppManifest['themes'][string] {
381
- const theme = readOwnProperty<AppManifest['themes'][string]>(\n manifest.themes,\n manifest.activeThemeId,\n );
382
- if (!theme) {
383
- throw new Error("Manifest active theme '" + manifest.activeThemeId + "' is missing.");
384
- }
385
- return theme;
386
- }
387
-
388
- function resolveThemeMode(
389
- mode: AppManifest['activeThemeMode'],
390
- fallback: NonNullable<AppManifest['activeThemeMode']>,
391
- ): NonNullable<AppManifest['activeThemeMode']> {
392
- if (mode === 'dark' || mode === 'light') return mode;
393
- return fallback;
394
- }
395
-
396
- export const unstable_settings = {
397
- initialRouteName: '${initialRouteNameOverride ?? manifest.navigator.initialRouteName ?? 'index'}',
398
- };
399
-
400
- export default function RootLayout() {
401
- ${indentedRootHookBlock} const manifestContext = useOptionalManifestContext();
402
- const runtimeManifest = manifestContext?.manifest ?? fallbackManifest;${indentedStudioRuntimeLines}
167
+ ${finalJsx}
168
+ </AppShell>`;
169
+ const generatedAppRoot = `function GeneratedAppRoot({
170
+ appContent,
171
+ ${includeStudio ? 'appLocation,\n appPathname,\n shouldMountAppHeader,\n ' : ''}runtimeManifest,
172
+ }: {
173
+ readonly appContent: ReactNode;
174
+ ${includeStudio ? 'readonly appLocation: string;\n readonly appPathname: string;\n readonly shouldMountAppHeader: boolean;\n ' : ''}readonly runtimeManifest: AppManifest;
175
+ }) {
403
176
  const activeTheme = resolveManifestActiveTheme(runtimeManifest);
404
177
  const activeThemeMode = resolveThemeMode(runtimeManifest.activeThemeMode, 'light');
405
- ${indentedHandleInnerContentReadyDeclaration} const appContent = ${innerContentNode};
406
-
407
178
  ${outputDeclaration}
408
179
 
409
180
  const shell = (
410
- <GeneratedZoraProvider theme={activeTheme} initialMode={activeThemeMode}>
411
- <SafeAreaProvider>
412
- ${generatedAppShell}
413
- <GeneratedStatusBar />
414
- </SafeAreaProvider>
415
- </GeneratedZoraProvider>
416
- );
417
- ${indentedStudioShellBlock} return <GeneratedRootView>{shell}</GeneratedRootView>;
418
- }${includeStudio
419
- ? `
420
- function StudioShell({
421
- output,
422
- activeThemeMode,
423
- runtimeManifest,
424
- appPathname,
425
- appLocation,
426
- shouldMountAppHeader,
427
- }: {
428
- output: ReactNode;
429
- activeThemeMode: NonNullable<AppManifest['activeThemeMode']>;
430
- runtimeManifest: AppManifest;
431
- appPathname: string;
432
- appLocation: string;
433
- shouldMountAppHeader: boolean;
434
- }) {
435
- const {
436
- activeCanvasDragNodeId,
437
- activeScreenId,
438
- componentMeta,
439
- manifest: studioManifest,
440
- moveNodeToPlacement,
441
- previewMode,
442
- rootNode,
443
- selectedNodeId,
444
- selectNode,
445
- setActiveCanvasDragNodeId,
446
- setLastNonAdminLocation,
447
- } = useStudio();
448
- const { theme } = useZoraTheme();
449
- useEffect(() => {
450
- const nextAppLocation = resolveStudioLastNonAdminLocation({
451
- pathname: appPathname,
452
- navigableLocation: appLocation,
453
- });
454
- if (nextAppLocation) setLastNonAdminLocation(nextAppLocation);
455
- }, [appLocation, appPathname, setLastNonAdminLocation]);
456
-
457
- const studioWrapNode = useMemo(
458
- () =>
459
- createStudioStationarySelectionWrapNode({
460
- builtInComponentRegistry: studioInteractionPolicyComponentRegistry,
461
- previewMode,
462
- thirdPartySupport: APP_EXTENSION_INTERACTION_POLICY_SUPPORT,
463
- }),
464
- [previewMode],
465
- );
466
- const studioResolveNodeProps = useMemo(
467
- () =>
468
- createStudioInteractionPolicyResolver({
469
- builtInComponentRegistry: studioInteractionPolicyComponentRegistry,
470
- previewMode,
471
- thirdPartySupport: APP_EXTENSION_INTERACTION_POLICY_SUPPORT,
472
- }),
473
- [previewMode],
474
- );
475
- const appHeaderTitle = resolveStudioAppHeaderTitle({
476
- runtimeManifest,
477
- studioManifest,
478
- previewMode,
479
- activeScreenId,
480
- pathname: appPathname,
481
- });
482
- const header = shouldMountAppHeader ? (
483
- <StudioAppHeader appHeaderTitle={appHeaderTitle} />
484
- ) : undefined;
485
- const studioRuntimeManifest = studioManifest ?? runtimeManifest;
486
- const activeStudioTheme = resolveManifestActiveTheme(studioRuntimeManifest);
487
- const activeStudioThemeMode = resolveThemeMode(
488
- studioRuntimeManifest.activeThemeMode,
489
- activeThemeMode,
490
- );
491
- const studioRuntimeConfig = useMemo(
492
- () => ({
493
- ...createStudioActionSuppressionConfig(previewMode),
494
- wrapNode: studioWrapNode,
495
- resolveNodeProps: studioResolveNodeProps,
496
- }),
497
- [previewMode, studioWrapNode, studioResolveNodeProps],
498
- );
499
- const studioOutput = isStudioAdminPath(appPathname) ? (
500
- output
501
- ) : (
502
- <StationaryTapSelector
503
- canvasInteraction={{
504
- activeDragNodeId: activeCanvasDragNodeId,
505
- componentMeta,
506
- moveNodeToPlacement,
507
- rootNode,
508
- setActiveDragNodeId: setActiveCanvasDragNodeId,
509
- }}
510
- isEditMode={!previewMode}
511
- selectionColor={theme.semantics.action.primary.base}
512
- selectedNodeId={selectedNodeId}
513
- selectNode={selectNode}
514
- >
515
- <RuntimeRendererConfigProvider value={studioRuntimeConfig}>
516
- {output}
517
- </RuntimeRendererConfigProvider>
518
- </StationaryTapSelector>
519
- );
520
-
521
- return (
522
- <GeneratedZoraProvider theme={activeStudioTheme} initialMode={activeStudioThemeMode}>
523
- <SafeAreaProvider>
524
- <AppShell header={header}>
525
- ${studioFinalJsx}
526
- </AppShell>
527
- <GeneratedStatusBar />
528
- </SafeAreaProvider>
529
- </GeneratedZoraProvider>
530
- );
531
- }
532
-
533
- function StudioAppHeader({ appHeaderTitle }: { appHeaderTitle: string }) {
534
- const studioAppBar = useStudioAppBarAugmentation();
535
-
536
- return (
537
- <>
538
- <AppBar title={appHeaderTitle} actions={studioAppBar.actions} />
539
- {studioAppBar.overlays}
540
- </>
541
- );
542
- }`
543
- : ''}
544
-
545
- ${generatedRuntimeContent}
546
-
547
- function GeneratedZoraProvider({
548
- children,
549
- theme,
550
- initialMode,
551
- }: {
552
- children: ReactNode;
553
- theme: AppManifest['themes'][string];
554
- initialMode: NonNullable<AppManifest['activeThemeMode']>;
555
- }) {
556
- const themeConfig = useMemo(() => resolveZoraSurfaceThemeConfig(theme), [theme]);
557
-
558
- return (
559
- <ZoraProvider themeConfig={themeConfig} initialMode={initialMode}>
560
- {children}
561
- </ZoraProvider>
562
- );
563
- }
564
-
565
- function GeneratedStatusBar() {
566
- const { mode } = useZoraTheme();
567
- return <StatusBar style={mode === 'dark' ? 'light' : 'dark'} />;
181
+ <GeneratedThemeShell theme={activeTheme} initialMode={activeThemeMode}>
182
+ ${generatedAppShell}
183
+ <GeneratedStatusBar />
184
+ </GeneratedThemeShell>
185
+ );${indentedStudioShellBlock} return <GeneratedRootShell>{shell}</GeneratedRootShell>;
186
+ }`;
187
+ return [
188
+ allImports,
189
+ 'void SplashScreen.preventAutoHideAsync();',
190
+ moduleLevelDeclarations,
191
+ `const fallbackManifest = ankhConfig as unknown as AppManifest;
192
+ export const unstable_settings = {
193
+ initialRouteName: '${initialRouteNameOverride ?? manifest.navigator.initialRouteName ?? 'index'}',
194
+ };`,
195
+ generatedAppOutput,
196
+ generatedAppRoot,
197
+ `export default function RootLayout() {
198
+ ${indentedRootHookBlock} const manifestContext = useOptionalManifestContext();
199
+ const runtimeManifest = manifestContext?.manifest ?? fallbackManifest;
200
+ ${indentedHandleInnerContentReadyDeclaration} const appContent = ${innerContentNode};
201
+ ${includeStudio
202
+ ? `const appPathname = ${authRuntime ? 'pathname' : 'usePathname()'};
203
+ const appLocation = resolveStudioNavigableLocation(appPathname);
204
+ const shouldMountAppHeader =
205
+ !isStudioAdminPath(appPathname) &&
206
+ ${authRuntime ? 'shouldMountAuthenticatedAppHeader(appPathname, isAuthRuntimeReady)' : 'true'};
207
+ `
208
+ : ''}return ${includeStudio
209
+ ? `(\n <GeneratedAppRoot\n appContent={appContent}\n appLocation={appLocation}\n appPathname={appPathname}\n shouldMountAppHeader={shouldMountAppHeader}\n runtimeManifest={runtimeManifest}\n />\n )`
210
+ : '<GeneratedAppRoot appContent={appContent} runtimeManifest={runtimeManifest} />'};
568
211
  }
569
212
 
570
213
  function InnerContent(${innerContentSignature}) {${innerContentReadyHook}
571
214
  ${innerThemeHook}${innerContentPendingBoundary} ${innerContentReturn}
572
- }
573
- `.trimStart();
215
+ }`,
216
+ ]
217
+ .filter(Boolean)
218
+ .join('\n\n')
219
+ .concat('\n');
574
220
  }
575
221
  //# sourceMappingURL=rootLayout.js.map