@quilted/create 0.2.25 → 0.2.26
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.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/templates/app-basic/browser.tsx +7 -1
- package/templates/app-basic/foundation/frame/Frame.tsx +6 -1
- package/templates/app-graphql/browser.tsx +12 -2
- package/templates/app-graphql/foundation/frame/Frame.tsx +6 -1
- package/templates/app-trpc/browser.tsx +10 -1
- package/templates/app-trpc/foundation/frame/Frame.tsx +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @quilted/create
|
|
2
2
|
|
|
3
|
+
## 0.2.26
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5c32e10`](https://github.com/lemonmade/quilt/commit/5c32e1022e5330a209817f7bfb49b09b301b36b7) Thanks [@lemonmade](https://github.com/lemonmade)! - Expose app context on browser console in template apps
|
|
8
|
+
|
|
3
9
|
## 0.2.25
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -2,14 +2,20 @@ import '@quilted/quilt/globals';
|
|
|
2
2
|
import {hydrate} from 'preact';
|
|
3
3
|
import {Browser, BrowserContext} from '@quilted/quilt/browser';
|
|
4
4
|
|
|
5
|
+
import type {AppContext} from '~/shared/context.ts';
|
|
5
6
|
import {App} from './App.tsx';
|
|
6
7
|
|
|
7
8
|
const element = document.querySelector('#app')!;
|
|
8
9
|
const browser = new Browser();
|
|
9
10
|
|
|
11
|
+
const context = {} satisfies AppContext;
|
|
12
|
+
|
|
13
|
+
// Makes key parts of the app available in the browser console
|
|
14
|
+
Object.assign(globalThis, {app: context});
|
|
15
|
+
|
|
10
16
|
hydrate(
|
|
11
17
|
<BrowserContext browser={browser}>
|
|
12
|
-
<App />
|
|
18
|
+
<App context={context} />
|
|
13
19
|
</BrowserContext>,
|
|
14
20
|
element,
|
|
15
21
|
);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type {RenderableProps} from 'preact';
|
|
2
|
+
import {Suspense} from 'preact/compat';
|
|
2
3
|
|
|
3
4
|
import styles from './Frame.module.css';
|
|
4
5
|
|
|
5
6
|
export function Frame({children}: RenderableProps<{}>) {
|
|
6
|
-
return
|
|
7
|
+
return (
|
|
8
|
+
<div className={styles.Frame}>
|
|
9
|
+
<Suspense fallback={null}>{children}</Suspense>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
7
12
|
}
|
|
@@ -5,17 +5,27 @@ import {QueryClient} from '@tanstack/react-query';
|
|
|
5
5
|
import {createGraphQLFetch} from '@quilted/quilt/graphql';
|
|
6
6
|
import {Browser, BrowserContext} from '@quilted/quilt/browser';
|
|
7
7
|
|
|
8
|
+
import type {AppContext} from '~/shared/context.ts';
|
|
9
|
+
|
|
8
10
|
import {App} from './App.tsx';
|
|
9
11
|
|
|
10
12
|
const element = document.querySelector('#app')!;
|
|
11
13
|
const browser = new Browser();
|
|
12
14
|
|
|
13
|
-
const queryClient = new QueryClient();
|
|
14
15
|
const fetchGraphQL = createGraphQLFetch({url: '/api/graphql'});
|
|
16
|
+
const queryClient = new QueryClient();
|
|
17
|
+
|
|
18
|
+
const context = {
|
|
19
|
+
fetchGraphQL,
|
|
20
|
+
queryClient,
|
|
21
|
+
} satisfies AppContext;
|
|
22
|
+
|
|
23
|
+
// Makes key parts of the app available in the browser console
|
|
24
|
+
Object.assign(globalThis, {app: context});
|
|
15
25
|
|
|
16
26
|
hydrate(
|
|
17
27
|
<BrowserContext browser={browser}>
|
|
18
|
-
<App context={
|
|
28
|
+
<App context={context} />
|
|
19
29
|
</BrowserContext>,
|
|
20
30
|
element,
|
|
21
31
|
);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type {RenderableProps} from 'preact';
|
|
2
|
+
import {Suspense} from 'preact/compat';
|
|
2
3
|
|
|
3
4
|
import styles from './Frame.module.css';
|
|
4
5
|
|
|
5
6
|
export function Frame({children}: RenderableProps<{}>) {
|
|
6
|
-
return
|
|
7
|
+
return (
|
|
8
|
+
<div className={styles.Frame}>
|
|
9
|
+
<Suspense fallback={null}>{children}</Suspense>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
7
12
|
}
|
|
@@ -5,6 +5,7 @@ import {httpBatchLink} from '@trpc/client';
|
|
|
5
5
|
import {QueryClient} from '@tanstack/react-query';
|
|
6
6
|
import {Browser, BrowserContext} from '@quilted/quilt/browser';
|
|
7
7
|
|
|
8
|
+
import type {AppContext} from '~/shared/context.ts';
|
|
8
9
|
import {trpc} from '~/shared/trpc.ts';
|
|
9
10
|
|
|
10
11
|
import {App} from './App.tsx';
|
|
@@ -17,9 +18,17 @@ const trpcClient = trpc.createClient({
|
|
|
17
18
|
links: [httpBatchLink({url: new URL('/api', window.location.href).href})],
|
|
18
19
|
});
|
|
19
20
|
|
|
21
|
+
const context = {
|
|
22
|
+
trpc: trpcClient,
|
|
23
|
+
queryClient,
|
|
24
|
+
} satisfies AppContext;
|
|
25
|
+
|
|
26
|
+
// Makes key parts of the app available in the browser console
|
|
27
|
+
Object.assign(globalThis, {app: context});
|
|
28
|
+
|
|
20
29
|
hydrate(
|
|
21
30
|
<BrowserContext browser={browser}>
|
|
22
|
-
<App context={
|
|
31
|
+
<App context={context} />
|
|
23
32
|
</BrowserContext>,
|
|
24
33
|
element,
|
|
25
34
|
);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type {RenderableProps} from 'preact';
|
|
2
|
+
import {Suspense} from 'preact/compat';
|
|
2
3
|
|
|
3
4
|
import styles from './Frame.module.css';
|
|
4
5
|
|
|
5
6
|
export function Frame({children}: RenderableProps<{}>) {
|
|
6
|
-
return
|
|
7
|
+
return (
|
|
8
|
+
<div className={styles.Frame}>
|
|
9
|
+
<Suspense fallback={null}>{children}</Suspense>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
7
12
|
}
|