@quilted/quilt 0.5.119 → 0.5.121
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 +14 -0
- package/build/cjs/App.cjs +77 -0
- package/build/cjs/TestApp.cjs +20 -0
- package/build/cjs/index.cjs +18 -10
- package/build/cjs/server/request-router.cjs +23 -7
- package/build/cjs/testing.cjs +4 -2
- package/build/esm/App.mjs +75 -0
- package/build/esm/TestApp.mjs +18 -0
- package/build/esm/index.mjs +4 -4
- package/build/esm/server/request-router.mjs +23 -7
- package/build/esm/testing.mjs +2 -1
- package/build/esnext/App.esnext +75 -0
- package/build/esnext/TestApp.esnext +18 -0
- package/build/esnext/index.esnext +4 -4
- package/build/esnext/server/request-router.esnext +23 -7
- package/build/esnext/testing.esnext +2 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/App.d.ts +48 -0
- package/build/typescript/App.d.ts.map +1 -0
- package/build/typescript/TestApp.d.ts +17 -0
- package/build/typescript/TestApp.d.ts.map +1 -0
- package/build/typescript/index.d.ts +5 -5
- package/build/typescript/index.d.ts.map +1 -1
- package/build/typescript/server/render.d.ts +8 -8
- package/build/typescript/server/render.d.ts.map +1 -1
- package/build/typescript/server/request-router.d.ts +8 -2
- package/build/typescript/server/request-router.d.ts.map +1 -1
- package/build/typescript/testing.d.ts +2 -1
- package/build/typescript/testing.d.ts.map +1 -1
- package/package.json +1 -1
- package/source/App.tsx +171 -0
- package/source/TestApp.tsx +33 -0
- package/source/index.ts +12 -5
- package/source/server/render.tsx +9 -2
- package/source/server/request-router.tsx +56 -21
- package/source/testing.ts +3 -1
- package/build/cjs/AppContext.cjs +0 -20
- package/build/esm/AppContext.mjs +0 -18
- package/build/esnext/AppContext.esnext +0 -18
- package/source/AppContext.tsx +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @quilted/quilt
|
|
2
2
|
|
|
3
|
+
## 0.5.121
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`98c6aa4b`](https://github.com/lemonmade/quilt/commit/98c6aa4b9b5f45cc947f25446e1f05e2145d64a7) Thanks [@lemonmade](https://github.com/lemonmade)! - Improve HTML customization
|
|
8
|
+
|
|
9
|
+
- [#447](https://github.com/lemonmade/quilt/pull/447) [`6ad741b2`](https://github.com/lemonmade/quilt/commit/6ad741b241027c8d7612e206497935ad938ea6c9) Thanks [@lemonmade](https://github.com/lemonmade)! - Simplify app templates
|
|
10
|
+
|
|
11
|
+
## 0.5.120
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`b4848099`](https://github.com/lemonmade/quilt/commit/b48480993d6d98a0d563a365f1d10b5bba3ad4c7) Thanks [@lemonmade](https://github.com/lemonmade)! - Add `usePerformanceNavigationEvent` hook
|
|
16
|
+
|
|
3
17
|
## 0.5.119
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactHttp = require('@quilted/react-http');
|
|
4
|
+
var reactHtml = require('@quilted/react-html');
|
|
5
|
+
var reactRouter = require('@quilted/react-router');
|
|
6
|
+
var reactPerformance = require('@quilted/react-performance');
|
|
7
|
+
var reactLocalize = require('@quilted/react-localize');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
// TODO: have craft options to remove the bundle impact of parts of this that are
|
|
11
|
+
// unused.
|
|
12
|
+
function QuiltApp({
|
|
13
|
+
http = true,
|
|
14
|
+
html = true,
|
|
15
|
+
routes,
|
|
16
|
+
routing = true,
|
|
17
|
+
localization = true,
|
|
18
|
+
children,
|
|
19
|
+
performance = true
|
|
20
|
+
}) {
|
|
21
|
+
const routesContent = routing !== false && routes ? /*#__PURE__*/jsxRuntime.jsx(StaticRoutes, {
|
|
22
|
+
routes: routes
|
|
23
|
+
}) : null;
|
|
24
|
+
const htmlContent = typeof html === 'boolean' ? html ? /*#__PURE__*/jsxRuntime.jsx(HtmlUpdater, {}) : null : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
25
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(HtmlUpdater, {}), html]
|
|
26
|
+
});
|
|
27
|
+
const httpContent = typeof http === 'boolean' ? null : http;
|
|
28
|
+
const content = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
29
|
+
children: [httpContent, htmlContent, routesContent, children]
|
|
30
|
+
});
|
|
31
|
+
const withMaybeRouting = typeof routing === 'boolean' ? routing ? /*#__PURE__*/jsxRuntime.jsx(reactRouter.Routing, {
|
|
32
|
+
children: content
|
|
33
|
+
}) : content : 'navigate' in routing ? /*#__PURE__*/jsxRuntime.jsx(reactRouter.Routing, {
|
|
34
|
+
router: routing,
|
|
35
|
+
children: content
|
|
36
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(reactRouter.Routing, {
|
|
37
|
+
...routing,
|
|
38
|
+
children: content
|
|
39
|
+
});
|
|
40
|
+
const withMaybePerformance = typeof performance === 'boolean' ? performance ? /*#__PURE__*/jsxRuntime.jsx(reactPerformance.PerformanceContext, {
|
|
41
|
+
children: withMaybeRouting
|
|
42
|
+
}) : withMaybeRouting : /*#__PURE__*/jsxRuntime.jsx(reactPerformance.PerformanceContext, {
|
|
43
|
+
performance: performance,
|
|
44
|
+
children: withMaybeRouting
|
|
45
|
+
});
|
|
46
|
+
const withMaybeHttp = typeof http === 'boolean' ? http ? /*#__PURE__*/jsxRuntime.jsx(reactHttp.HttpContext, {
|
|
47
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactHttp.CookieContext, {
|
|
48
|
+
children: withMaybePerformance
|
|
49
|
+
})
|
|
50
|
+
}) : withMaybePerformance : /*#__PURE__*/jsxRuntime.jsx(reactHttp.HttpContext, {
|
|
51
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactHttp.CookieContext, {
|
|
52
|
+
children: withMaybePerformance
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
const withMaybeLocalization = typeof localization === 'boolean' ? localization ? /*#__PURE__*/jsxRuntime.jsx(reactLocalize.Localization, {
|
|
56
|
+
locale: "en",
|
|
57
|
+
children: withMaybeHttp
|
|
58
|
+
}) : withMaybeHttp : typeof localization === 'string' ? /*#__PURE__*/jsxRuntime.jsx(reactLocalize.Localization, {
|
|
59
|
+
locale: localization,
|
|
60
|
+
children: withMaybeHttp
|
|
61
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(reactLocalize.Localization, {
|
|
62
|
+
...localization,
|
|
63
|
+
children: withMaybeHttp
|
|
64
|
+
});
|
|
65
|
+
return withMaybeLocalization;
|
|
66
|
+
}
|
|
67
|
+
function HtmlUpdater() {
|
|
68
|
+
reactHtml.useHtmlUpdater();
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
function StaticRoutes({
|
|
72
|
+
routes
|
|
73
|
+
}) {
|
|
74
|
+
return reactRouter.useRoutes(routes);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
exports.QuiltApp = QuiltApp;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var App = require('./App.cjs');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
// TODO: have craft options to remove the bundle impact of parts of this that are
|
|
7
|
+
// unused.
|
|
8
|
+
function QuiltAppTesting({
|
|
9
|
+
routing = true,
|
|
10
|
+
localization = true,
|
|
11
|
+
children
|
|
12
|
+
}) {
|
|
13
|
+
return /*#__PURE__*/jsxRuntime.jsx(App.QuiltApp, {
|
|
14
|
+
routing: routing,
|
|
15
|
+
localization: localization,
|
|
16
|
+
children: children
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.QuiltAppTesting = QuiltAppTesting;
|
package/build/cjs/index.cjs
CHANGED
|
@@ -12,7 +12,7 @@ var reactRouter = require('@quilted/react-router');
|
|
|
12
12
|
var reactHttp = require('@quilted/react-http');
|
|
13
13
|
var reactUtilities = require('@quilted/react-utilities');
|
|
14
14
|
var reactSignals = require('@quilted/react-signals');
|
|
15
|
-
var
|
|
15
|
+
var App = require('./App.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -100,9 +100,9 @@ Object.defineProperty(exports, 'LocalizedLink', {
|
|
|
100
100
|
enumerable: true,
|
|
101
101
|
get: function () { return reactLocalize.LocalizedLink; }
|
|
102
102
|
});
|
|
103
|
-
Object.defineProperty(exports, '
|
|
103
|
+
Object.defineProperty(exports, 'LocalizedRouting', {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return reactLocalize.
|
|
105
|
+
get: function () { return reactLocalize.LocalizedRouting; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, 'createRouteLocalization', {
|
|
108
108
|
enumerable: true,
|
|
@@ -136,6 +136,10 @@ Object.defineProperty(exports, 'PerformanceContext', {
|
|
|
136
136
|
enumerable: true,
|
|
137
137
|
get: function () { return reactPerformance.PerformanceContext; }
|
|
138
138
|
});
|
|
139
|
+
Object.defineProperty(exports, 'createPerformance', {
|
|
140
|
+
enumerable: true,
|
|
141
|
+
get: function () { return reactPerformance.createPerformance; }
|
|
142
|
+
});
|
|
139
143
|
Object.defineProperty(exports, 'usePerformance', {
|
|
140
144
|
enumerable: true,
|
|
141
145
|
get: function () { return reactPerformance.usePerformance; }
|
|
@@ -144,6 +148,10 @@ Object.defineProperty(exports, 'usePerformanceNavigation', {
|
|
|
144
148
|
enumerable: true,
|
|
145
149
|
get: function () { return reactPerformance.usePerformanceNavigation; }
|
|
146
150
|
});
|
|
151
|
+
Object.defineProperty(exports, 'usePerformanceNavigationEvent', {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
get: function () { return reactPerformance.usePerformanceNavigationEvent; }
|
|
154
|
+
});
|
|
147
155
|
Object.defineProperty(exports, 'Link', {
|
|
148
156
|
enumerable: true,
|
|
149
157
|
get: function () { return reactRouter.Link; }
|
|
@@ -152,17 +160,17 @@ Object.defineProperty(exports, 'NavigationBlock', {
|
|
|
152
160
|
enumerable: true,
|
|
153
161
|
get: function () { return reactRouter.NavigationBlock; }
|
|
154
162
|
});
|
|
155
|
-
Object.defineProperty(exports, 'Preloader', {
|
|
156
|
-
enumerable: true,
|
|
157
|
-
get: function () { return reactRouter.Preloader; }
|
|
158
|
-
});
|
|
159
163
|
Object.defineProperty(exports, 'Redirect', {
|
|
160
164
|
enumerable: true,
|
|
161
165
|
get: function () { return reactRouter.Redirect; }
|
|
162
166
|
});
|
|
163
|
-
Object.defineProperty(exports, '
|
|
167
|
+
Object.defineProperty(exports, 'RoutePreloading', {
|
|
168
|
+
enumerable: true,
|
|
169
|
+
get: function () { return reactRouter.RoutePreloading; }
|
|
170
|
+
});
|
|
171
|
+
Object.defineProperty(exports, 'Routing', {
|
|
164
172
|
enumerable: true,
|
|
165
|
-
get: function () { return reactRouter.
|
|
173
|
+
get: function () { return reactRouter.Routing; }
|
|
166
174
|
});
|
|
167
175
|
Object.defineProperty(exports, 'useCurrentUrl', {
|
|
168
176
|
enumerable: true,
|
|
@@ -268,4 +276,4 @@ Object.defineProperty(exports, 'useSignalEffect', {
|
|
|
268
276
|
enumerable: true,
|
|
269
277
|
get: function () { return reactSignals.useSignalEffect; }
|
|
270
278
|
});
|
|
271
|
-
exports.
|
|
279
|
+
exports.QuiltApp = App.QuiltApp;
|
|
@@ -26,6 +26,7 @@ function createServerRenderingRequestHandler(render, {
|
|
|
26
26
|
}
|
|
27
27
|
async function renderToResponse(app, request, {
|
|
28
28
|
assets,
|
|
29
|
+
renderHtml = defaultRenderHtml,
|
|
29
30
|
...options
|
|
30
31
|
} = {}) {
|
|
31
32
|
const accepts = request.headers.get('Accept');
|
|
@@ -67,17 +68,32 @@ async function renderToResponse(app, request, {
|
|
|
67
68
|
timing: 'preload'
|
|
68
69
|
}), {
|
|
69
70
|
options: assetOptions
|
|
70
|
-
})]) : [];
|
|
71
|
-
|
|
71
|
+
})]) : [[], [], []];
|
|
72
|
+
const htmlElement = await renderHtml(markup, request, {
|
|
73
|
+
html: htmlManager,
|
|
74
|
+
http,
|
|
75
|
+
styles,
|
|
76
|
+
scripts,
|
|
77
|
+
preload
|
|
78
|
+
});
|
|
79
|
+
return requestRouter.html(server.render(htmlElement), {
|
|
80
|
+
headers,
|
|
81
|
+
status: statusCode
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function defaultRenderHtml(content, request, {
|
|
85
|
+
html,
|
|
86
|
+
styles,
|
|
87
|
+
scripts,
|
|
88
|
+
preload
|
|
89
|
+
}) {
|
|
90
|
+
return /*#__PURE__*/jsxRuntime.jsx(server.Html, {
|
|
72
91
|
url: new URL(request.url),
|
|
73
|
-
manager:
|
|
92
|
+
manager: html,
|
|
74
93
|
styles: styles,
|
|
75
94
|
scripts: scripts,
|
|
76
95
|
preloadAssets: preload,
|
|
77
|
-
children:
|
|
78
|
-
})), {
|
|
79
|
-
headers,
|
|
80
|
-
status: statusCode
|
|
96
|
+
children: content
|
|
81
97
|
});
|
|
82
98
|
}
|
|
83
99
|
|
package/build/cjs/testing.cjs
CHANGED
|
@@ -4,6 +4,7 @@ var testing$2 = require('@quilted/testing');
|
|
|
4
4
|
var reactTesting = require('@quilted/react-testing');
|
|
5
5
|
var testing = require('@quilted/react-router/testing');
|
|
6
6
|
var testing$1 = require('@quilted/react-graphql/testing');
|
|
7
|
+
var TestApp = require('./TestApp.cjs');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
@@ -23,9 +24,9 @@ Object.defineProperty(exports, 'unmountAll', {
|
|
|
23
24
|
enumerable: true,
|
|
24
25
|
get: function () { return reactTesting.unmountAll; }
|
|
25
26
|
});
|
|
26
|
-
Object.defineProperty(exports, '
|
|
27
|
+
Object.defineProperty(exports, 'TestRouting', {
|
|
27
28
|
enumerable: true,
|
|
28
|
-
get: function () { return testing.
|
|
29
|
+
get: function () { return testing.TestRouting; }
|
|
29
30
|
});
|
|
30
31
|
Object.defineProperty(exports, 'createTestRouter', {
|
|
31
32
|
enumerable: true,
|
|
@@ -51,6 +52,7 @@ Object.defineProperty(exports, 'createSchema', {
|
|
|
51
52
|
enumerable: true,
|
|
52
53
|
get: function () { return testing$1.createSchema; }
|
|
53
54
|
});
|
|
55
|
+
exports.QuiltAppTesting = TestApp.QuiltAppTesting;
|
|
54
56
|
Object.keys(testing$2).forEach(function (k) {
|
|
55
57
|
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
56
58
|
enumerable: true,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { HttpContext, CookieContext } from '@quilted/react-http';
|
|
2
|
+
import { useHtmlUpdater } from '@quilted/react-html';
|
|
3
|
+
import { Routing, useRoutes } from '@quilted/react-router';
|
|
4
|
+
import { PerformanceContext } from '@quilted/react-performance';
|
|
5
|
+
import { Localization } from '@quilted/react-localize';
|
|
6
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// TODO: have craft options to remove the bundle impact of parts of this that are
|
|
9
|
+
// unused.
|
|
10
|
+
function QuiltApp({
|
|
11
|
+
http = true,
|
|
12
|
+
html = true,
|
|
13
|
+
routes,
|
|
14
|
+
routing = true,
|
|
15
|
+
localization = true,
|
|
16
|
+
children,
|
|
17
|
+
performance = true
|
|
18
|
+
}) {
|
|
19
|
+
const routesContent = routing !== false && routes ? /*#__PURE__*/jsx(StaticRoutes, {
|
|
20
|
+
routes: routes
|
|
21
|
+
}) : null;
|
|
22
|
+
const htmlContent = typeof html === 'boolean' ? html ? /*#__PURE__*/jsx(HtmlUpdater, {}) : null : /*#__PURE__*/jsxs(Fragment, {
|
|
23
|
+
children: [/*#__PURE__*/jsx(HtmlUpdater, {}), html]
|
|
24
|
+
});
|
|
25
|
+
const httpContent = typeof http === 'boolean' ? null : http;
|
|
26
|
+
const content = /*#__PURE__*/jsxs(Fragment, {
|
|
27
|
+
children: [httpContent, htmlContent, routesContent, children]
|
|
28
|
+
});
|
|
29
|
+
const withMaybeRouting = typeof routing === 'boolean' ? routing ? /*#__PURE__*/jsx(Routing, {
|
|
30
|
+
children: content
|
|
31
|
+
}) : content : 'navigate' in routing ? /*#__PURE__*/jsx(Routing, {
|
|
32
|
+
router: routing,
|
|
33
|
+
children: content
|
|
34
|
+
}) : /*#__PURE__*/jsx(Routing, {
|
|
35
|
+
...routing,
|
|
36
|
+
children: content
|
|
37
|
+
});
|
|
38
|
+
const withMaybePerformance = typeof performance === 'boolean' ? performance ? /*#__PURE__*/jsx(PerformanceContext, {
|
|
39
|
+
children: withMaybeRouting
|
|
40
|
+
}) : withMaybeRouting : /*#__PURE__*/jsx(PerformanceContext, {
|
|
41
|
+
performance: performance,
|
|
42
|
+
children: withMaybeRouting
|
|
43
|
+
});
|
|
44
|
+
const withMaybeHttp = typeof http === 'boolean' ? http ? /*#__PURE__*/jsx(HttpContext, {
|
|
45
|
+
children: /*#__PURE__*/jsx(CookieContext, {
|
|
46
|
+
children: withMaybePerformance
|
|
47
|
+
})
|
|
48
|
+
}) : withMaybePerformance : /*#__PURE__*/jsx(HttpContext, {
|
|
49
|
+
children: /*#__PURE__*/jsx(CookieContext, {
|
|
50
|
+
children: withMaybePerformance
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
const withMaybeLocalization = typeof localization === 'boolean' ? localization ? /*#__PURE__*/jsx(Localization, {
|
|
54
|
+
locale: "en",
|
|
55
|
+
children: withMaybeHttp
|
|
56
|
+
}) : withMaybeHttp : typeof localization === 'string' ? /*#__PURE__*/jsx(Localization, {
|
|
57
|
+
locale: localization,
|
|
58
|
+
children: withMaybeHttp
|
|
59
|
+
}) : /*#__PURE__*/jsx(Localization, {
|
|
60
|
+
...localization,
|
|
61
|
+
children: withMaybeHttp
|
|
62
|
+
});
|
|
63
|
+
return withMaybeLocalization;
|
|
64
|
+
}
|
|
65
|
+
function HtmlUpdater() {
|
|
66
|
+
useHtmlUpdater();
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
function StaticRoutes({
|
|
70
|
+
routes
|
|
71
|
+
}) {
|
|
72
|
+
return useRoutes(routes);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { QuiltApp };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { QuiltApp } from './App.mjs';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// TODO: have craft options to remove the bundle impact of parts of this that are
|
|
5
|
+
// unused.
|
|
6
|
+
function QuiltAppTesting({
|
|
7
|
+
routing = true,
|
|
8
|
+
localization = true,
|
|
9
|
+
children
|
|
10
|
+
}) {
|
|
11
|
+
return /*#__PURE__*/jsx(QuiltApp, {
|
|
12
|
+
routing: routing,
|
|
13
|
+
localization: localization,
|
|
14
|
+
children: children
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { QuiltAppTesting };
|
package/build/esm/index.mjs
CHANGED
|
@@ -4,10 +4,10 @@ export { createAsyncComponent, useAsync, useAsyncAsset, usePreload } from '@quil
|
|
|
4
4
|
export { GraphQLContext, createGraphQLHttpFetch, useGraphQLFetch } from '@quilted/react-graphql';
|
|
5
5
|
export { useIdleCallback } from '@quilted/react-idle';
|
|
6
6
|
export { ServerAction, useServerAction, useServerContext } from '@quilted/react-server-render';
|
|
7
|
-
export { Localization, LocalizedLink,
|
|
8
|
-
export { PerformanceContext, usePerformance, usePerformanceNavigation } from '@quilted/react-performance';
|
|
9
|
-
export { Link, NavigationBlock,
|
|
7
|
+
export { Localization, LocalizedLink, LocalizedRouting, createRouteLocalization, createRoutePathLocalization, createRouteSubdomainLocalization, useLocale, useLocaleFromEnvironment, useLocalizedFormatting, useRouteLocalization } from '@quilted/react-localize';
|
|
8
|
+
export { PerformanceContext, createPerformance, usePerformance, usePerformanceNavigation, usePerformanceNavigationEvent } from '@quilted/react-performance';
|
|
9
|
+
export { Link, NavigationBlock, Redirect, RoutePreloading, Routing, useCurrentUrl, useInitialUrl, useMatch, useNavigate, useNavigationBlock, useRedirect, useRouteChangeFocusRef, useRouter, useRoutes, useScrollRestoration } from '@quilted/react-router';
|
|
10
10
|
export { CookieContext, useCookie, useCookies } from '@quilted/react-http';
|
|
11
11
|
export { createOptionalContext, createUseContextHook, createUseOptionalValueHook } from '@quilted/react-utilities';
|
|
12
12
|
export { Signal, computed as computedSignal, isSignal, resolveSignalOrValue, signal, batch as signalBatch, effect as signalEffect, useComputed, useSignal, useSignalEffect } from '@quilted/react-signals';
|
|
13
|
-
export {
|
|
13
|
+
export { QuiltApp } from './App.mjs';
|
|
@@ -24,6 +24,7 @@ function createServerRenderingRequestHandler(render, {
|
|
|
24
24
|
}
|
|
25
25
|
async function renderToResponse(app, request, {
|
|
26
26
|
assets,
|
|
27
|
+
renderHtml = defaultRenderHtml,
|
|
27
28
|
...options
|
|
28
29
|
} = {}) {
|
|
29
30
|
const accepts = request.headers.get('Accept');
|
|
@@ -65,17 +66,32 @@ async function renderToResponse(app, request, {
|
|
|
65
66
|
timing: 'preload'
|
|
66
67
|
}), {
|
|
67
68
|
options: assetOptions
|
|
68
|
-
})]) : [];
|
|
69
|
-
|
|
69
|
+
})]) : [[], [], []];
|
|
70
|
+
const htmlElement = await renderHtml(markup, request, {
|
|
71
|
+
html: htmlManager,
|
|
72
|
+
http,
|
|
73
|
+
styles,
|
|
74
|
+
scripts,
|
|
75
|
+
preload
|
|
76
|
+
});
|
|
77
|
+
return html(render(htmlElement), {
|
|
78
|
+
headers,
|
|
79
|
+
status: statusCode
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function defaultRenderHtml(content, request, {
|
|
83
|
+
html,
|
|
84
|
+
styles,
|
|
85
|
+
scripts,
|
|
86
|
+
preload
|
|
87
|
+
}) {
|
|
88
|
+
return /*#__PURE__*/jsx(Html, {
|
|
70
89
|
url: new URL(request.url),
|
|
71
|
-
manager:
|
|
90
|
+
manager: html,
|
|
72
91
|
styles: styles,
|
|
73
92
|
scripts: scripts,
|
|
74
93
|
preloadAssets: preload,
|
|
75
|
-
children:
|
|
76
|
-
})), {
|
|
77
|
-
headers,
|
|
78
|
-
status: statusCode
|
|
94
|
+
children: content
|
|
79
95
|
});
|
|
80
96
|
}
|
|
81
97
|
|
package/build/esm/testing.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from '@quilted/testing';
|
|
2
2
|
export { createMount, mount, mounted, unmountAll } from '@quilted/react-testing';
|
|
3
|
-
export {
|
|
3
|
+
export { TestRouting, createTestRouter } from '@quilted/react-router/testing';
|
|
4
4
|
export { GraphQLController, TestGraphQL, createFiller, createGraphQLController, createSchema } from '@quilted/react-graphql/testing';
|
|
5
|
+
export { QuiltAppTesting } from './TestApp.mjs';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { HttpContext, CookieContext } from '@quilted/react-http';
|
|
2
|
+
import { useHtmlUpdater } from '@quilted/react-html';
|
|
3
|
+
import { Routing, useRoutes } from '@quilted/react-router';
|
|
4
|
+
import { PerformanceContext } from '@quilted/react-performance';
|
|
5
|
+
import { Localization } from '@quilted/react-localize';
|
|
6
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// TODO: have craft options to remove the bundle impact of parts of this that are
|
|
9
|
+
// unused.
|
|
10
|
+
function QuiltApp({
|
|
11
|
+
http = true,
|
|
12
|
+
html = true,
|
|
13
|
+
routes,
|
|
14
|
+
routing = true,
|
|
15
|
+
localization = true,
|
|
16
|
+
children,
|
|
17
|
+
performance = true
|
|
18
|
+
}) {
|
|
19
|
+
const routesContent = routing !== false && routes ? /*#__PURE__*/jsx(StaticRoutes, {
|
|
20
|
+
routes: routes
|
|
21
|
+
}) : null;
|
|
22
|
+
const htmlContent = typeof html === 'boolean' ? html ? /*#__PURE__*/jsx(HtmlUpdater, {}) : null : /*#__PURE__*/jsxs(Fragment, {
|
|
23
|
+
children: [/*#__PURE__*/jsx(HtmlUpdater, {}), html]
|
|
24
|
+
});
|
|
25
|
+
const httpContent = typeof http === 'boolean' ? null : http;
|
|
26
|
+
const content = /*#__PURE__*/jsxs(Fragment, {
|
|
27
|
+
children: [httpContent, htmlContent, routesContent, children]
|
|
28
|
+
});
|
|
29
|
+
const withMaybeRouting = typeof routing === 'boolean' ? routing ? /*#__PURE__*/jsx(Routing, {
|
|
30
|
+
children: content
|
|
31
|
+
}) : content : 'navigate' in routing ? /*#__PURE__*/jsx(Routing, {
|
|
32
|
+
router: routing,
|
|
33
|
+
children: content
|
|
34
|
+
}) : /*#__PURE__*/jsx(Routing, {
|
|
35
|
+
...routing,
|
|
36
|
+
children: content
|
|
37
|
+
});
|
|
38
|
+
const withMaybePerformance = typeof performance === 'boolean' ? performance ? /*#__PURE__*/jsx(PerformanceContext, {
|
|
39
|
+
children: withMaybeRouting
|
|
40
|
+
}) : withMaybeRouting : /*#__PURE__*/jsx(PerformanceContext, {
|
|
41
|
+
performance: performance,
|
|
42
|
+
children: withMaybeRouting
|
|
43
|
+
});
|
|
44
|
+
const withMaybeHttp = typeof http === 'boolean' ? http ? /*#__PURE__*/jsx(HttpContext, {
|
|
45
|
+
children: /*#__PURE__*/jsx(CookieContext, {
|
|
46
|
+
children: withMaybePerformance
|
|
47
|
+
})
|
|
48
|
+
}) : withMaybePerformance : /*#__PURE__*/jsx(HttpContext, {
|
|
49
|
+
children: /*#__PURE__*/jsx(CookieContext, {
|
|
50
|
+
children: withMaybePerformance
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
const withMaybeLocalization = typeof localization === 'boolean' ? localization ? /*#__PURE__*/jsx(Localization, {
|
|
54
|
+
locale: "en",
|
|
55
|
+
children: withMaybeHttp
|
|
56
|
+
}) : withMaybeHttp : typeof localization === 'string' ? /*#__PURE__*/jsx(Localization, {
|
|
57
|
+
locale: localization,
|
|
58
|
+
children: withMaybeHttp
|
|
59
|
+
}) : /*#__PURE__*/jsx(Localization, {
|
|
60
|
+
...localization,
|
|
61
|
+
children: withMaybeHttp
|
|
62
|
+
});
|
|
63
|
+
return withMaybeLocalization;
|
|
64
|
+
}
|
|
65
|
+
function HtmlUpdater() {
|
|
66
|
+
useHtmlUpdater();
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
function StaticRoutes({
|
|
70
|
+
routes
|
|
71
|
+
}) {
|
|
72
|
+
return useRoutes(routes);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { QuiltApp };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { QuiltApp } from './App.esnext';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// TODO: have craft options to remove the bundle impact of parts of this that are
|
|
5
|
+
// unused.
|
|
6
|
+
function QuiltAppTesting({
|
|
7
|
+
routing = true,
|
|
8
|
+
localization = true,
|
|
9
|
+
children
|
|
10
|
+
}) {
|
|
11
|
+
return /*#__PURE__*/jsx(QuiltApp, {
|
|
12
|
+
routing: routing,
|
|
13
|
+
localization: localization,
|
|
14
|
+
children: children
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { QuiltAppTesting };
|
|
@@ -4,10 +4,10 @@ export { createAsyncComponent, useAsync, useAsyncAsset, usePreload } from '@quil
|
|
|
4
4
|
export { GraphQLContext, createGraphQLHttpFetch, useGraphQLFetch } from '@quilted/react-graphql';
|
|
5
5
|
export { useIdleCallback } from '@quilted/react-idle';
|
|
6
6
|
export { ServerAction, useServerAction, useServerContext } from '@quilted/react-server-render';
|
|
7
|
-
export { Localization, LocalizedLink,
|
|
8
|
-
export { PerformanceContext, usePerformance, usePerformanceNavigation } from '@quilted/react-performance';
|
|
9
|
-
export { Link, NavigationBlock,
|
|
7
|
+
export { Localization, LocalizedLink, LocalizedRouting, createRouteLocalization, createRoutePathLocalization, createRouteSubdomainLocalization, useLocale, useLocaleFromEnvironment, useLocalizedFormatting, useRouteLocalization } from '@quilted/react-localize';
|
|
8
|
+
export { PerformanceContext, createPerformance, usePerformance, usePerformanceNavigation, usePerformanceNavigationEvent } from '@quilted/react-performance';
|
|
9
|
+
export { Link, NavigationBlock, Redirect, RoutePreloading, Routing, useCurrentUrl, useInitialUrl, useMatch, useNavigate, useNavigationBlock, useRedirect, useRouteChangeFocusRef, useRouter, useRoutes, useScrollRestoration } from '@quilted/react-router';
|
|
10
10
|
export { CookieContext, useCookie, useCookies } from '@quilted/react-http';
|
|
11
11
|
export { createOptionalContext, createUseContextHook, createUseOptionalValueHook } from '@quilted/react-utilities';
|
|
12
12
|
export { Signal, computed as computedSignal, isSignal, resolveSignalOrValue, signal, batch as signalBatch, effect as signalEffect, useComputed, useSignal, useSignalEffect } from '@quilted/react-signals';
|
|
13
|
-
export {
|
|
13
|
+
export { QuiltApp } from './App.esnext';
|
|
@@ -24,6 +24,7 @@ function createServerRenderingRequestHandler(render, {
|
|
|
24
24
|
}
|
|
25
25
|
async function renderToResponse(app, request, {
|
|
26
26
|
assets,
|
|
27
|
+
renderHtml = defaultRenderHtml,
|
|
27
28
|
...options
|
|
28
29
|
} = {}) {
|
|
29
30
|
const accepts = request.headers.get('Accept');
|
|
@@ -65,17 +66,32 @@ async function renderToResponse(app, request, {
|
|
|
65
66
|
timing: 'preload'
|
|
66
67
|
}), {
|
|
67
68
|
options: assetOptions
|
|
68
|
-
})]) : [];
|
|
69
|
-
|
|
69
|
+
})]) : [[], [], []];
|
|
70
|
+
const htmlElement = await renderHtml(markup, request, {
|
|
71
|
+
html: htmlManager,
|
|
72
|
+
http,
|
|
73
|
+
styles,
|
|
74
|
+
scripts,
|
|
75
|
+
preload
|
|
76
|
+
});
|
|
77
|
+
return html(render(htmlElement), {
|
|
78
|
+
headers,
|
|
79
|
+
status: statusCode
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function defaultRenderHtml(content, request, {
|
|
83
|
+
html,
|
|
84
|
+
styles,
|
|
85
|
+
scripts,
|
|
86
|
+
preload
|
|
87
|
+
}) {
|
|
88
|
+
return /*#__PURE__*/jsx(Html, {
|
|
70
89
|
url: new URL(request.url),
|
|
71
|
-
manager:
|
|
90
|
+
manager: html,
|
|
72
91
|
styles: styles,
|
|
73
92
|
scripts: scripts,
|
|
74
93
|
preloadAssets: preload,
|
|
75
|
-
children:
|
|
76
|
-
})), {
|
|
77
|
-
headers,
|
|
78
|
-
status: statusCode
|
|
94
|
+
children: content
|
|
79
95
|
});
|
|
80
96
|
}
|
|
81
97
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from '@quilted/testing';
|
|
2
2
|
export { createMount, mount, mounted, unmountAll } from '@quilted/react-testing';
|
|
3
|
-
export {
|
|
3
|
+
export { TestRouting, createTestRouter } from '@quilted/react-router/testing';
|
|
4
4
|
export { GraphQLController, TestGraphQL, createFiller, createGraphQLController, createSchema } from '@quilted/react-graphql/testing';
|
|
5
|
+
export { QuiltAppTesting } from './TestApp.esnext';
|