@quilted/create 0.3.2 → 0.3.4

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 (42) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/build/esnext/_virtual/index7.esnext +2 -2
  3. package/build/esnext/_virtual/index8.esnext +2 -2
  4. package/build/esnext/node_modules/.pnpm/dir-glob@3.0.1/node_modules/dir-glob/index.esnext +1 -1
  5. package/build/esnext/node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/stream.esnext +1 -1
  6. package/build/esnext/node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/index.esnext +1 -1
  7. package/build/esnext/node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/stream.esnext +1 -1
  8. package/package.json +1 -1
  9. package/templates/app-basic/App.tsx +8 -13
  10. package/templates/app-basic/browser.tsx +20 -39
  11. package/templates/app-basic/context/browser.ts +7 -3
  12. package/templates/app-basic/context/navigation.ts +6 -13
  13. package/templates/app-basic/context/preact.ts +9 -0
  14. package/templates/app-basic/context/server.ts +10 -3
  15. package/templates/app-basic/context/types.ts +20 -1
  16. package/templates/app-basic/package.json +1 -1
  17. package/templates/app-basic/tests/render/render.tsx +17 -22
  18. package/templates/app-basic/tests/render/types.ts +17 -13
  19. package/templates/app-basic/tests/render.ts +1 -1
  20. package/templates/app-empty/package.json +1 -1
  21. package/templates/app-graphql/App.tsx +10 -16
  22. package/templates/app-graphql/browser.tsx +20 -39
  23. package/templates/app-graphql/context/browser.ts +9 -13
  24. package/templates/app-graphql/context/navigation.ts +6 -13
  25. package/templates/app-graphql/context/preact.ts +9 -0
  26. package/templates/app-graphql/context/server.ts +13 -12
  27. package/templates/app-graphql/context/types.ts +23 -6
  28. package/templates/app-graphql/package.json +1 -1
  29. package/templates/app-graphql/tests/render/render.tsx +17 -37
  30. package/templates/app-graphql/tests/render/types.ts +20 -45
  31. package/templates/app-graphql/tests/render.ts +1 -1
  32. package/templates/app-trpc/App.tsx +15 -17
  33. package/templates/app-trpc/browser.tsx +20 -39
  34. package/templates/app-trpc/context/browser.ts +8 -4
  35. package/templates/app-trpc/context/navigation.ts +6 -13
  36. package/templates/app-trpc/context/preact.ts +9 -0
  37. package/templates/app-trpc/context/server.ts +11 -4
  38. package/templates/app-trpc/context/types.ts +27 -3
  39. package/templates/app-trpc/package.json +1 -1
  40. package/templates/app-trpc/tests/render/render.tsx +25 -29
  41. package/templates/app-trpc/tests/render/types.ts +17 -16
  42. package/templates/app-trpc/tests/render.ts +1 -1
@@ -1,21 +1,17 @@
1
- import {createGraphQLFetch, GraphQLCache} from '@quilted/quilt/graphql';
1
+ import {Navigation} from '@quilted/quilt/navigation';
2
+ import {Localization} from '@quilted/quilt/localize';
3
+ import {createGraphQLFetch, GraphQLClient} from '@quilted/quilt/graphql';
2
4
 
3
5
  import type {AppContext} from './types.ts';
4
- import {NavigationForApp} from './navigation.ts';
5
6
 
6
7
  export class BrowserAppContext implements AppContext {
7
- readonly navigation: NavigationForApp;
8
- readonly graphql: AppContext['graphql'];
8
+ readonly navigation: Navigation;
9
+ readonly localization: Localization;
10
+ readonly graphql: GraphQLClient;
9
11
 
10
12
  constructor() {
11
- this.navigation = new NavigationForApp();
12
-
13
- const graphQLFetch = createGraphQLFetch({url: '/api/graphql'});
14
- const graphQLCache = new GraphQLCache({fetch: graphQLFetch});
15
-
16
- this.graphql = {
17
- fetch: graphQLFetch,
18
- cache: graphQLCache,
19
- };
13
+ this.navigation = new Navigation();
14
+ this.localization = new Localization(navigator.language);
15
+ this.graphql = new GraphQLClient(createGraphQLFetch({url: '/api/graphql'}));
20
16
  }
21
17
  }
@@ -1,17 +1,10 @@
1
- import {createContextRouteFunction, Router} from '@quilted/quilt/navigation';
1
+ import {
2
+ createContextRouteFunction,
3
+ Navigation,
4
+ } from '@quilted/quilt/navigation';
2
5
 
3
6
  import type {AppContext} from './types.ts';
4
7
 
5
- export interface Navigation {
6
- readonly router: Router;
7
- }
8
-
9
- export class NavigationForApp implements Navigation {
10
- readonly router: Router;
11
-
12
- constructor(url?: string | URL) {
13
- this.router = new Router(url);
14
- }
15
- }
16
-
17
8
  export const routeWithAppContext = createContextRouteFunction<AppContext>();
9
+
10
+ export {Navigation};
@@ -2,5 +2,14 @@ import {createOptionalContext} from '@quilted/quilt/context';
2
2
 
3
3
  import type {AppContext} from './types.ts';
4
4
 
5
+ /**
6
+ * The Preact context object for this application's shared context.
7
+ * Provide it in `App.tsx` via `<AppContextPreact.Provider value={context}>`.
8
+ */
5
9
  export const AppContextPreact = createOptionalContext<AppContext>();
10
+
11
+ /**
12
+ * Returns the app's shared context. All fields in `AppContext` are required
13
+ * and will be available anywhere inside `<AppContextPreact.Provider>`.
14
+ */
6
15
  export const useAppContext = AppContextPreact.use;
@@ -1,23 +1,24 @@
1
- import {GraphQLCache} from '@quilted/quilt/graphql';
1
+ import {Navigation} from '@quilted/quilt/navigation';
2
+ import {Localization, parseAcceptLanguageHeader} from '@quilted/quilt/localize';
3
+ import {GraphQLClient} from '@quilted/quilt/graphql';
2
4
 
3
5
  import type {AppContext} from './types.ts';
4
- import {NavigationForApp} from './navigation.ts';
5
6
 
6
7
  export class ServerAppContext implements AppContext {
7
- readonly navigation: NavigationForApp;
8
- readonly graphql: AppContext['graphql'];
8
+ readonly navigation: Navigation;
9
+ readonly localization: Localization;
10
+ readonly graphql: GraphQLClient;
9
11
 
10
12
  constructor(request: Request) {
11
- this.navigation = new NavigationForApp(request.url);
13
+ this.navigation = new Navigation(request.url);
14
+ this.localization = new Localization(
15
+ parseAcceptLanguageHeader(request.headers.get('Accept-Language') ?? '') ??
16
+ 'en',
17
+ );
12
18
 
13
- const graphQLFetch: AppContext['graphql']['fetch'] = async (...args) => {
19
+ this.graphql = new GraphQLClient(async (...args) => {
14
20
  const {performGraphQLOperation} = await import('../server/graphql.ts');
15
21
  return performGraphQLOperation(...args);
16
- };
17
-
18
- this.graphql = {
19
- fetch: graphQLFetch,
20
- cache: new GraphQLCache({fetch: graphQLFetch}),
21
- };
22
+ });
22
23
  }
23
24
  }
@@ -1,10 +1,27 @@
1
- import type {Navigation} from './navigation.ts';
2
- import type {GraphQLFetch, GraphQLCache} from '@quilted/quilt/graphql';
1
+ import type {GraphQLClient} from '@quilted/quilt/graphql';
2
+ import type {Navigation} from '@quilted/quilt/navigation';
3
+ import type {Localization} from '@quilted/quilt/localize';
3
4
 
5
+ /**
6
+ * The shared context for this application. Values in this object are
7
+ * available to all components in the app via `useAppContext()`.
8
+ */
4
9
  export interface AppContext {
10
+ /**
11
+ * The navigation instance for this application. Manages the current URL,
12
+ * browser history, and programmatic navigation.
13
+ */
5
14
  readonly navigation: Navigation;
6
- readonly graphql: {
7
- readonly fetch: GraphQLFetch;
8
- readonly cache: GraphQLCache;
9
- };
15
+
16
+ /**
17
+ * The localization instance for this application. Contains the active
18
+ * locale and formatting utilities for numbers, dates, currencies, and more.
19
+ */
20
+ readonly localization: Localization;
21
+
22
+ /**
23
+ * The GraphQL client for this application. Provides the fetch function
24
+ * used to execute operations and the cache used to store results.
25
+ */
26
+ readonly graphql: GraphQLClient;
10
27
  }
@@ -20,7 +20,7 @@
20
20
  "graphql": "^16.8.0",
21
21
  "hono": "^4.8.0",
22
22
  "jsdom": "^26.0.0",
23
- "preact": "^10.26.0",
23
+ "preact": "^10.29.0",
24
24
  "react": "npm:@quilted/react@^19.0.0",
25
25
  "react-dom": "npm:@quilted/react-dom@^19.0.0"
26
26
  },
@@ -1,15 +1,10 @@
1
1
  import {Suspense} from 'preact/compat';
2
2
 
3
3
  import {createRender} from '@quilted/quilt/testing';
4
- import {
5
- BrowserDetailsContext,
6
- BrowserTestMock,
7
- } from '@quilted/quilt/browser/testing';
8
- import {Navigation, TestRouter} from '@quilted/quilt/navigation/testing';
4
+ import {TestBrowser} from '@quilted/quilt/browser/testing';
5
+ import {TestNavigation} from '@quilted/quilt/navigation/testing';
9
6
  import {Localization} from '@quilted/quilt/localize';
10
- import {GraphQLCache} from '@quilted/quilt/graphql';
11
-
12
- import {AppContextPreact} from '~/context/preact.ts';
7
+ import {QuiltFrameworkTestContext} from '@quilted/quilt/context/testing';
13
8
 
14
9
  import {GraphQLTesting, GraphQLController} from '../graphql.ts';
15
10
 
@@ -29,40 +24,25 @@ export const renderApp = createRender<
29
24
  // authors on the `root.context` property. Context is used to share data between your
30
25
  // React tree and your test code, and is ideal for mocking out global context providers.
31
26
  context({
32
- router = new TestRouter(),
33
- browser = new BrowserTestMock(),
27
+ navigation = new TestNavigation(),
28
+ browser = new TestBrowser(),
29
+ localization = new Localization('en'),
34
30
  graphql = new GraphQLController(),
35
- graphQLCache = new GraphQLCache({fetch: graphql.fetch}),
36
31
  }) {
37
- return {
38
- navigation: {router},
39
- browser,
40
- graphql: {fetch: graphql.fetch, cache: graphQLCache, controller: graphql},
41
- };
32
+ return {navigation, browser, localization, graphql: {controller: graphql}};
42
33
  },
43
34
  // Render all of our app-wide context providers around each component under test.
44
- render(element, context, {locale = 'en'}) {
45
- const {
46
- navigation: {router},
47
- browser,
48
- graphql,
49
- } = context;
50
-
35
+ render(element, {navigation, browser, localization, graphql}) {
51
36
  return (
52
- <AppContextPreact.Provider value={context}>
53
- <BrowserDetailsContext.Provider value={browser}>
54
- <Localization locale={locale}>
55
- <Navigation router={router}>
56
- <GraphQLTesting
57
- controller={graphql.controller}
58
- cache={graphql.cache}
59
- >
60
- <Suspense fallback={null}>{element}</Suspense>
61
- </GraphQLTesting>
62
- </Navigation>
63
- </Localization>
64
- </BrowserDetailsContext.Provider>
65
- </AppContextPreact.Provider>
37
+ <QuiltFrameworkTestContext
38
+ navigation={navigation}
39
+ browser={browser}
40
+ localization={localization}
41
+ >
42
+ <GraphQLTesting controller={graphql.controller}>
43
+ <Suspense fallback={null}>{element}</Suspense>
44
+ </GraphQLTesting>
45
+ </QuiltFrameworkTestContext>
66
46
  );
67
47
  },
68
48
  async afterRender(wrapper) {
@@ -1,77 +1,52 @@
1
- import type {TestRouter} from '@quilted/quilt/navigation/testing';
2
- import type {BrowserTestMock} from '@quilted/quilt/browser/testing';
3
- import type {GraphQLCache} from '@quilted/quilt/graphql';
4
-
5
- import type {AppContext} from '~/context/types.ts';
1
+ import type {TestNavigation} from '@quilted/quilt/navigation/testing';
2
+ import type {TestBrowser} from '@quilted/quilt/browser/testing';
3
+ import type {Localization} from '@quilted/quilt/localize';
6
4
 
7
5
  import type {GraphQLController} from '../graphql.ts';
8
6
 
9
7
  export interface RenderOptions {
10
8
  /**
11
- * A custom router to use for this component test. You can use a
12
- * custom router to simulate a particular URL, and you can spy on
13
- * its navigation method to check that components navigate as
14
- * you expect.
9
+ * A custom navigation to use for this component test.
15
10
  */
16
- readonly router?: TestRouter;
11
+ readonly navigation?: TestNavigation;
17
12
 
18
13
  /**
19
14
  * A custom environment for this component test.
20
15
  */
21
- readonly browser?: BrowserTestMock;
16
+ readonly browser?: TestBrowser;
22
17
 
23
18
  /**
24
- * An object that controls the responses to GraphQL queries and mutations
25
- * for the component under test. You can customize the responses using
26
- * the `fillGraphQL` and `createGraphQLController` utilities provided
27
- * by this module.
28
- *
29
- * ```tsx
30
- * import {renderApp} from '~/tests/render.ts';
31
- * import {fillGraphQL, GraphQLController} from '~/tests/graphql.ts';
32
- *
33
- * import {MyComponent} from './MyComponent.tsx';
34
- * import myComponentQuery from './MyComponentQuery.graphql';
35
- *
36
- * const myComponent = await renderApp(<MyComponent />, {
37
- * graphql: new GraphQLController([
38
- * fillGraphQL(myComponentQuery, {me: {name: 'Winston'}}),
39
- * ]),
40
- * });
41
- * ```
19
+ * A custom localization instance to use for this component test.
42
20
  */
43
- readonly graphql?: GraphQLController;
21
+ readonly localization?: Localization;
44
22
 
45
23
  /**
46
- * The cache of GraphQL query results. When not provided, an empty cache
47
- * will be used.
24
+ * An object that controls the responses to GraphQL queries and mutations
25
+ * for the component under test.
48
26
  */
49
- readonly graphQLCache?: GraphQLCache;
27
+ readonly graphql?: GraphQLController;
28
+ }
50
29
 
30
+ export interface RenderContext {
51
31
  /**
52
- * A custom locale to use for this component test.
32
+ * The navigation used for this component test.
53
33
  */
54
- readonly locale?: string;
55
- }
34
+ readonly navigation: TestNavigation;
56
35
 
57
- export interface RenderContext extends AppContext {
58
36
  /**
59
- * The router used for this component test.
37
+ * The browser environment for this component test.
60
38
  */
61
- readonly navigation: {router: TestRouter};
39
+ readonly browser: TestBrowser;
62
40
 
63
41
  /**
64
- * The browser environment for this component test.
42
+ * The localization used for this component test.
65
43
  */
66
- readonly browser: BrowserTestMock;
44
+ readonly localization: Localization;
67
45
 
68
46
  /**
69
47
  * The GraphQL context used for this component test.
70
48
  */
71
- readonly graphql: AppContext['graphql'] & {
72
- /**
73
- * The GraphQL controller used for this component test.
74
- */
49
+ readonly graphql: {
75
50
  readonly controller: GraphQLController;
76
51
  };
77
52
  }
@@ -1,6 +1,6 @@
1
1
  import '@quilted/quilt/testing';
2
2
 
3
- export {TestRouter} from '@quilted/quilt/navigation/testing';
3
+ export {TestNavigation} from '@quilted/quilt/navigation/testing';
4
4
 
5
5
  export * from './render/types.ts';
6
6
  export {renderApp} from './render/render.tsx';
@@ -1,7 +1,6 @@
1
1
  import {NotFound} from '@quilted/quilt/server';
2
- import {Navigation} from '@quilted/quilt/navigation';
3
- import {Localization} from '@quilted/quilt/localize';
4
-
2
+ import {Routes} from '@quilted/quilt/navigation';
3
+ import {QuiltFrameworkContext} from '@quilted/quilt/context';
5
4
  import {ReactQueryContext} from '@quilted/react-query';
6
5
 
7
6
  import {Head} from './foundation/html.ts';
@@ -9,13 +8,13 @@ import {Frame} from './foundation/frame.ts';
9
8
 
10
9
  import {Home} from './features/home.ts';
11
10
 
12
- import {trpc} from './context/trpc.ts';
13
- import type {AppContext as AppContextType} from './context/types.ts';
11
+ import type {AppContext} from './context/types.ts';
14
12
  import {AppContextPreact} from './context/preact.ts';
13
+ import {trpc} from './context/trpc.ts';
15
14
  import {routeWithAppContext} from './context/navigation.ts';
16
15
 
17
16
  export interface AppProps {
18
- context: AppContextType;
17
+ context: AppContext;
19
18
  }
20
19
 
21
20
  // Define the routes for your application. If you have a lot of routes, you
@@ -40,18 +39,17 @@ const routes = [
40
39
  export function App({context}: AppProps) {
41
40
  return (
42
41
  <AppContextPreact.Provider value={context}>
43
- <trpc.Provider client={context.trpc} queryClient={context.queryClient}>
44
- <ReactQueryContext client={context.queryClient}>
45
- <Localization>
42
+ <QuiltFrameworkContext
43
+ navigation={context.navigation}
44
+ localization={context.localization}
45
+ >
46
+ <trpc.Provider client={context.trpc} queryClient={context.queryClient}>
47
+ <ReactQueryContext client={context.queryClient}>
46
48
  <Head />
47
- <Navigation
48
- router={context.navigation.router}
49
- routes={routes}
50
- context={context}
51
- />
52
- </Localization>
53
- </ReactQueryContext>
54
- </trpc.Provider>
49
+ <Routes list={routes} context={context} />
50
+ </ReactQueryContext>
51
+ </trpc.Provider>
52
+ </QuiltFrameworkContext>
55
53
  </AppContextPreact.Provider>
56
54
  );
57
55
  }
@@ -1,46 +1,27 @@
1
1
  import './browser.css';
2
2
 
3
- import type {ComponentChild} from 'preact';
4
- import {hydrate} from '@quilted/quilt/browser';
3
+ import {BrowserApp} from '@quilted/quilt/browser';
5
4
 
6
5
  import {BrowserAppContext} from '~/context/browser.ts';
7
6
 
8
7
  import {App} from './App.tsx';
9
8
 
10
- class BrowserApp {
11
- /**
12
- * The app's globally-available context.
13
- */
14
- readonly context: BrowserAppContext;
15
-
16
- /**
17
- * The app's root JSX element, seeded with the necessary app context.
18
- */
19
- readonly rendered: ComponentChild;
20
-
21
- constructor() {
22
- this.context = new BrowserAppContext();
23
- this.rendered = <App context={this.context} />;
24
-
25
- // Makes key parts of the app available in the browser console.
26
- //
27
- // @example
28
- // ```js
29
- // // Log the current URL
30
- // console.log(globalThis.app.context.navigation.router.currentRequest.url);
31
- // ```
32
- Object.defineProperty(globalThis, 'app', {
33
- value: this,
34
- enumerable: false,
35
- configurable: true,
36
- writable: true,
37
- });
38
- }
39
-
40
- hydrate() {
41
- hydrate(this.rendered);
42
- }
43
- }
44
-
45
- const app = new BrowserApp();
46
- app.hydrate();
9
+ const context = new BrowserAppContext();
10
+
11
+ const app = new BrowserApp(<App context={context} />, {context});
12
+
13
+ // Makes key parts of the app available in the browser console.
14
+ //
15
+ // @example
16
+ // ```js
17
+ // // Log the current URL
18
+ // console.log(globalThis.app.context.navigation.currentRequest.url);
19
+ // ```
20
+ Object.defineProperty(globalThis, 'app', {
21
+ value: app,
22
+ enumerable: false,
23
+ configurable: true,
24
+ writable: true,
25
+ });
26
+
27
+ await app.hydrate();
@@ -1,17 +1,21 @@
1
1
  import {httpBatchLink} from '@trpc/client';
2
2
  import {QueryClient} from '@tanstack/react-query';
3
3
 
4
- import type {AppContext} from './types.ts';
5
- import {NavigationForApp} from './navigation.ts';
4
+ import {Navigation} from '@quilted/quilt/navigation';
5
+ import {Localization} from '@quilted/quilt/localize';
6
+
6
7
  import {trpc} from './trpc.ts';
8
+ import type {AppContext} from './types.ts';
7
9
 
8
10
  export class BrowserAppContext implements AppContext {
9
- readonly navigation: NavigationForApp;
11
+ readonly navigation: Navigation;
12
+ readonly localization: Localization;
10
13
  readonly trpc: AppContext['trpc'];
11
14
  readonly queryClient: QueryClient;
12
15
 
13
16
  constructor() {
14
- this.navigation = new NavigationForApp();
17
+ this.navigation = new Navigation();
18
+ this.localization = new Localization(navigator.language);
15
19
  this.queryClient = new QueryClient();
16
20
  this.trpc = trpc.createClient({
17
21
  links: [httpBatchLink({url: new URL('/api', window.location.href).href})],
@@ -1,17 +1,10 @@
1
- import {createContextRouteFunction, Router} from '@quilted/quilt/navigation';
1
+ import {
2
+ createContextRouteFunction,
3
+ Navigation,
4
+ } from '@quilted/quilt/navigation';
2
5
 
3
6
  import type {AppContext} from './types.ts';
4
7
 
5
- export interface Navigation {
6
- readonly router: Router;
7
- }
8
-
9
- export class NavigationForApp implements Navigation {
10
- readonly router: Router;
11
-
12
- constructor(url?: string | URL) {
13
- this.router = new Router(url);
14
- }
15
- }
16
-
17
8
  export const routeWithAppContext = createContextRouteFunction<AppContext>();
9
+
10
+ export {Navigation};
@@ -2,5 +2,14 @@ import {createOptionalContext} from '@quilted/quilt/context';
2
2
 
3
3
  import type {AppContext} from './types.ts';
4
4
 
5
+ /**
6
+ * The Preact context object for this application's shared context.
7
+ * Provide it in `App.tsx` via `<AppContextPreact.Provider value={context}>`.
8
+ */
5
9
  export const AppContextPreact = createOptionalContext<AppContext>();
10
+
11
+ /**
12
+ * Returns the app's shared context. All fields in `AppContext` are required
13
+ * and will be available anywhere inside `<AppContextPreact.Provider>`.
14
+ */
6
15
  export const useAppContext = AppContextPreact.use;
@@ -1,17 +1,24 @@
1
1
  import {createDirectClient} from '@quilted/trpc/server';
2
2
  import {QueryClient} from '@tanstack/react-query';
3
3
 
4
- import type {AppContext} from './types.ts';
5
- import {NavigationForApp} from './navigation.ts';
4
+ import {Navigation} from '@quilted/quilt/navigation';
5
+ import {Localization, parseAcceptLanguageHeader} from '@quilted/quilt/localize';
6
+
6
7
  import {appRouter} from '../trpc.ts';
8
+ import type {AppContext} from './types.ts';
7
9
 
8
10
  export class ServerAppContext implements AppContext {
9
- readonly navigation: NavigationForApp;
11
+ readonly navigation: Navigation;
12
+ readonly localization: Localization;
10
13
  readonly trpc: AppContext['trpc'];
11
14
  readonly queryClient: QueryClient;
12
15
 
13
16
  constructor(request: Request) {
14
- this.navigation = new NavigationForApp(request.url);
17
+ this.navigation = new Navigation(request.url);
18
+ this.localization = new Localization(
19
+ parseAcceptLanguageHeader(request.headers.get('Accept-Language') ?? '') ??
20
+ 'en',
21
+ );
15
22
  this.trpc = createDirectClient(appRouter);
16
23
  this.queryClient = new QueryClient();
17
24
  }
@@ -1,11 +1,35 @@
1
- import type {Navigation} from './navigation.ts';
2
- import type {TRPCUntypedClient} from '@trpc/client';
1
+ import type {TRPCClient} from '@trpc/client';
3
2
  import type {QueryClient} from '@tanstack/react-query';
3
+ import type {Navigation} from '@quilted/quilt/navigation';
4
+ import type {Localization} from '@quilted/quilt/localize';
4
5
 
5
6
  import type {AppRouter} from '../trpc.ts';
6
7
 
8
+ /**
9
+ * The shared context for this application. Values in this object are
10
+ * available to all components in the app via `useAppContext()`.
11
+ */
7
12
  export interface AppContext {
13
+ /**
14
+ * The navigation instance for this application. Manages the current URL,
15
+ * browser history, and programmatic navigation.
16
+ */
8
17
  readonly navigation: Navigation;
9
- readonly trpc: TRPCUntypedClient<AppRouter>;
18
+
19
+ /**
20
+ * The localization instance for this application. Contains the active
21
+ * locale and formatting utilities for numbers, dates, currencies, and more.
22
+ */
23
+ readonly localization: Localization;
24
+
25
+ /**
26
+ * The tRPC client for this application, used to call tRPC procedures.
27
+ */
28
+ readonly trpc: TRPCClient<AppRouter>;
29
+
30
+ /**
31
+ * The react-query client for this application, used by tRPC to manage
32
+ * request state and caching.
33
+ */
10
34
  readonly queryClient: QueryClient;
11
35
  }
@@ -24,7 +24,7 @@
24
24
  "@trpc/server": "next",
25
25
  "hono": "^4.8.0",
26
26
  "jsdom": "^26.0.0",
27
- "preact": "^10.26.0",
27
+ "preact": "^10.29.0",
28
28
  "react": "npm:@quilted/react@^19.0.0",
29
29
  "react-dom": "npm:@quilted/react-dom@^19.0.0",
30
30
  "zod": "^3.22.0"