@quilted/create 0.2.30 → 0.2.31

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @quilted/create
2
2
 
3
+ ## 0.2.31
4
+
5
+ ### Patch Changes
6
+
7
+ - [`36ad8b1`](https://github.com/lemonmade/quilt/commit/36ad8b15df3dbad465b4f324dcaa26ea9892f234) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix incorrect style import in basic app template
8
+
9
+ - [#757](https://github.com/lemonmade/quilt/pull/757) [`00cac4b`](https://github.com/lemonmade/quilt/commit/00cac4b4d01831ba654e94152d7a67a0ef75043b) Thanks [@lemonmade](https://github.com/lemonmade)! - Simplify routing library
10
+
3
11
  ## 0.2.30
4
12
 
5
13
  ### Patch Changes
@@ -2,9 +2,9 @@ import { __exports as out } from '../../../../../../../_virtual/index5.esnext';
2
2
  import './providers/async.esnext';
3
3
  import './providers/sync.esnext';
4
4
  import './settings.esnext';
5
- import { __exports as settings } from '../../../../../../../_virtual/settings2.esnext';
6
- import { __exports as async$1 } from '../../../../../../../_virtual/async3.esnext';
7
- import { __exports as sync$1 } from '../../../../../../../_virtual/sync3.esnext';
5
+ import { __exports as settings } from '../../../../../../../_virtual/settings3.esnext';
6
+ import { __exports as async$1 } from '../../../../../../../_virtual/async4.esnext';
7
+ import { __exports as sync$1 } from '../../../../../../../_virtual/sync4.esnext';
8
8
 
9
9
  Object.defineProperty(out, "__esModule", { value: true });
10
10
  out.statSync = out.stat = out.Settings = void 0;
@@ -1,4 +1,4 @@
1
- import { __exports as async } from '../../../../../../../../_virtual/async3.esnext';
1
+ import { __exports as async } from '../../../../../../../../_virtual/async4.esnext';
2
2
 
3
3
  Object.defineProperty(async, "__esModule", { value: true });
4
4
  async.read = void 0;
@@ -1,4 +1,4 @@
1
- import { __exports as sync } from '../../../../../../../../_virtual/sync3.esnext';
1
+ import { __exports as sync } from '../../../../../../../../_virtual/sync4.esnext';
2
2
 
3
3
  Object.defineProperty(sync, "__esModule", { value: true });
4
4
  sync.read = void 0;
@@ -1,4 +1,4 @@
1
- import { __exports as settings } from '../../../../../../../_virtual/settings2.esnext';
1
+ import { __exports as settings } from '../../../../../../../_virtual/settings3.esnext';
2
2
  import './adapters/fs.esnext';
3
3
  import { __exports as fs$1 } from '../../../../../../../_virtual/fs2.esnext';
4
4
 
@@ -3,10 +3,10 @@ import './providers/async.esnext';
3
3
  import './providers/stream.esnext';
4
4
  import './providers/sync.esnext';
5
5
  import './settings.esnext';
6
- import { __exports as settings } from '../../../../../../../_virtual/settings3.esnext';
7
- import { __exports as async } from '../../../../../../../_virtual/async4.esnext';
6
+ import { __exports as settings } from '../../../../../../../_virtual/settings2.esnext';
7
+ import { __exports as async } from '../../../../../../../_virtual/async3.esnext';
8
8
  import { __exports as stream } from '../../../../../../../_virtual/stream4.esnext';
9
- import { __exports as sync } from '../../../../../../../_virtual/sync4.esnext';
9
+ import { __exports as sync } from '../../../../../../../_virtual/sync3.esnext';
10
10
 
11
11
  Object.defineProperty(out, "__esModule", { value: true });
12
12
  out.Settings = out.walkStream = out.walkSync = out.walk = void 0;
@@ -1,4 +1,4 @@
1
- import { __exports as async } from '../../../../../../../../_virtual/async4.esnext';
1
+ import { __exports as async } from '../../../../../../../../_virtual/async3.esnext';
2
2
  import '../readers/async.esnext';
3
3
  import { __exports as async$1 } from '../../../../../../../../_virtual/async5.esnext';
4
4
 
@@ -1,4 +1,4 @@
1
- import { __exports as sync } from '../../../../../../../../_virtual/sync4.esnext';
1
+ import { __exports as sync } from '../../../../../../../../_virtual/sync3.esnext';
2
2
  import '../readers/sync.esnext';
3
3
  import { __exports as sync$1 } from '../../../../../../../../_virtual/sync5.esnext';
4
4
 
@@ -1,4 +1,4 @@
1
- import { __exports as settings } from '../../../../../../../_virtual/settings3.esnext';
1
+ import { __exports as settings } from '../../../../../../../_virtual/settings2.esnext';
2
2
  import path__default from 'node:path';
3
3
  import '../../../../../@nodelib_fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/index.esnext';
4
4
  import { __exports as out } from '../../../../../../../_virtual/index6.esnext';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quilted/create",
3
3
  "type": "module",
4
- "version": "0.2.30",
4
+ "version": "0.2.31",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,6 +1,7 @@
1
1
  import type {RenderableProps} from 'preact';
2
2
 
3
- import {Routing, useRoutes} from '@quilted/quilt/navigate';
3
+ import {NotFound} from '@quilted/quilt/server';
4
+ import {Navigation, route} from '@quilted/quilt/navigate';
4
5
  import {Localization, useLocaleFromEnvironment} from '@quilted/quilt/localize';
5
6
 
6
7
  import {HTML} from './foundation/html.ts';
@@ -17,15 +18,30 @@ export interface AppProps {
17
18
  context: AppContextType;
18
19
  }
19
20
 
21
+ // Define the routes for your application. If you have a lot of routes, you
22
+ // might want to split this into a separate file.
23
+ const routes = [
24
+ route('*', {
25
+ render: (children) => <Frame>{children}</Frame>,
26
+ children: [
27
+ route('/', {
28
+ async load() {
29
+ await Promise.all([Home.load()]);
30
+ },
31
+ render: <Home />,
32
+ }),
33
+ route('*', {render: <NotFound />}),
34
+ ],
35
+ }),
36
+ ];
37
+
20
38
  // The root component for your application. You will typically render any
21
39
  // app-wide context in this component.
22
40
  export function App({context}: AppProps) {
23
41
  return (
24
42
  <AppContext context={context}>
25
43
  <HTML>
26
- <Frame>
27
- <Routes />
28
- </Frame>
44
+ <Navigation routes={routes} context={context} />
29
45
  </HTML>
30
46
  </AppContext>
31
47
  );
@@ -33,23 +49,13 @@ export function App({context}: AppProps) {
33
49
 
34
50
  export default App;
35
51
 
36
- // This component renders the routes for your application. If you have a lot
37
- // of routes, you may want to split this component into its own file.
38
- function Routes() {
39
- return useRoutes([
40
- {match: '/', render: <Home />, renderPreload: <Home.Preload />},
41
- ]);
42
- }
43
-
44
52
  // This component renders any app-wide context.
45
53
  function AppContext({children, context}: RenderableProps<AppProps>) {
46
54
  const locale = useLocaleFromEnvironment() ?? 'en';
47
55
 
48
56
  return (
49
57
  <AppContextReact.Provider value={context}>
50
- <Localization locale={locale}>
51
- <Routing>{children}</Routing>
52
- </Localization>
58
+ <Localization locale={locale}>{children}</Localization>
53
59
  </AppContextReact.Provider>
54
60
  );
55
61
  }
@@ -1,5 +1,5 @@
1
- import styles from './Start.module.css';
1
+ import styles from './Home.module.css';
2
2
 
3
- export default function Start() {
4
- return <div className={styles.Start}>Hello world!</div>;
3
+ export default function Home() {
4
+ return <div className={styles.Home}>Hello world!</div>;
5
5
  }
@@ -1,13 +1,14 @@
1
1
  import type {RenderableProps} from 'preact';
2
2
 
3
+ import {NotFound} from '@quilted/quilt/server';
3
4
  import {GraphQLContext} from '@quilted/quilt/graphql';
4
- import {Routing, useRoutes} from '@quilted/quilt/navigate';
5
+ import {Navigation, route} from '@quilted/quilt/navigate';
5
6
  import {Localization, useLocaleFromEnvironment} from '@quilted/quilt/localize';
6
7
 
7
8
  import {HTML} from './foundation/html.ts';
8
9
  import {Frame} from './foundation/frame.ts';
9
10
 
10
- import {Home} from './features/home.ts';
11
+ import {Home, homeQuery} from './features/home.ts';
11
12
 
12
13
  import {
13
14
  AppContextReact,
@@ -18,15 +19,30 @@ export interface AppProps {
18
19
  context: AppContextType;
19
20
  }
20
21
 
22
+ // Define the routes for your application. If you have a lot of routes, you
23
+ // might want to split this into a separate file.
24
+ const routes = [
25
+ route('*', {
26
+ render: (children) => <Frame>{children}</Frame>,
27
+ children: [
28
+ route('/', {
29
+ async load(_navigation, {graphql}: AppContextType) {
30
+ await Promise.all([Home.load(), graphql.cache.query(homeQuery)]);
31
+ },
32
+ render: <Home />,
33
+ }),
34
+ route('*', {render: <NotFound />}),
35
+ ],
36
+ }),
37
+ ];
38
+
21
39
  // The root component for your application. You will typically render any
22
40
  // app-wide context in this component.
23
41
  export function App({context}: AppProps) {
24
42
  return (
25
43
  <AppContext context={context}>
26
44
  <HTML>
27
- <Frame>
28
- <Routes />
29
- </Frame>
45
+ <Navigation routes={routes} context={context} />
30
46
  </HTML>
31
47
  </AppContext>
32
48
  );
@@ -34,14 +50,6 @@ export function App({context}: AppProps) {
34
50
 
35
51
  export default App;
36
52
 
37
- // This component renders the routes for your application. If you have a lot
38
- // of routes, you may want to split this component into its own file.
39
- function Routes() {
40
- return useRoutes([
41
- {match: '/', render: <Home />, renderPreload: <Home.Preload />},
42
- ]);
43
- }
44
-
45
53
  // This component renders any app-wide context.
46
54
  function AppContext({children, context}: RenderableProps<AppProps>) {
47
55
  const locale = useLocaleFromEnvironment() ?? 'en';
@@ -52,9 +60,7 @@ function AppContext({children, context}: RenderableProps<AppProps>) {
52
60
  fetch={context.graphql.fetch}
53
61
  cache={context.graphql.cache}
54
62
  >
55
- <Localization locale={locale}>
56
- <Routing>{children}</Routing>
57
- </Localization>
63
+ <Localization locale={locale}>{children}</Localization>
58
64
  </GraphQLContext>
59
65
  </AppContextReact.Provider>
60
66
  );
@@ -1,3 +1,5 @@
1
1
  import {AsyncComponent} from '@quilted/quilt/async';
2
2
 
3
+ export {default as homeQuery} from './home/HomeQuery.graphql';
4
+
3
5
  export const Home = AsyncComponent.from(() => import('./home/Home.tsx'));
@@ -1,6 +1,7 @@
1
1
  import type {RenderableProps} from 'preact';
2
2
 
3
- import {Routing, useRoutes} from '@quilted/quilt/navigate';
3
+ import {NotFound} from '@quilted/quilt/server';
4
+ import {Navigation, route} from '@quilted/quilt/navigate';
4
5
  import {Localization, useLocaleFromEnvironment} from '@quilted/quilt/localize';
5
6
 
6
7
  import {ReactQueryContext} from '@quilted/react-query';
@@ -20,15 +21,30 @@ export interface AppProps {
20
21
  context: AppContextType;
21
22
  }
22
23
 
24
+ // Define the routes for your application. If you have a lot of routes, you
25
+ // might want to split this into a separate file.
26
+ const routes = [
27
+ route('*', {
28
+ render: (children) => <Frame>{children}</Frame>,
29
+ children: [
30
+ route('/', {
31
+ async load() {
32
+ await Promise.all([Home.load()]);
33
+ },
34
+ render: <Home />,
35
+ }),
36
+ route('*', {render: <NotFound />}),
37
+ ],
38
+ }),
39
+ ];
40
+
23
41
  // The root component for your application. You will typically render any
24
42
  // app-wide context in this component.
25
43
  export function App({context}: AppProps) {
26
44
  return (
27
45
  <AppContext context={context}>
28
46
  <HTML>
29
- <Frame>
30
- <Routes />
31
- </Frame>
47
+ <Navigation routes={routes} context={context} />
32
48
  </HTML>
33
49
  </AppContext>
34
50
  );
@@ -36,14 +52,6 @@ export function App({context}: AppProps) {
36
52
 
37
53
  export default App;
38
54
 
39
- // This component renders the routes for your application. If you have a lot
40
- // of routes, you may want to split this component into its own file.
41
- function Routes() {
42
- return useRoutes([
43
- {match: '/', render: <Home />, renderPreload: <Home.Preload />},
44
- ]);
45
- }
46
-
47
55
  // This component renders any app-wide context.
48
56
  function AppContext({children, context}: RenderableProps<AppProps>) {
49
57
  const locale = useLocaleFromEnvironment() ?? 'en';
@@ -51,16 +59,11 @@ function AppContext({children, context}: RenderableProps<AppProps>) {
51
59
  return (
52
60
  <AppContextReact.Provider value={context}>
53
61
  <Localization locale={locale}>
54
- <Routing>
55
- <trpc.Provider
56
- client={context.trpc}
57
- queryClient={context.queryClient}
58
- >
59
- <ReactQueryContext client={context.queryClient}>
60
- {children}
61
- </ReactQueryContext>
62
- </trpc.Provider>
63
- </Routing>
62
+ <trpc.Provider client={context.trpc} queryClient={context.queryClient}>
63
+ <ReactQueryContext client={context.queryClient}>
64
+ {children}
65
+ </ReactQueryContext>
66
+ </trpc.Provider>
64
67
  </Localization>
65
68
  </AppContextReact.Provider>
66
69
  );