@lowdefy/server 4.7.3 → 5.1.0
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/lib/build/theme.js +19 -0
- package/lib/client/Page.js +2 -0
- package/lowdefy/createCustomPluginTypesMap.mjs +6 -6
- package/next.config.js +5 -22
- package/package.json +28 -29
- package/package.original.json +28 -29
- package/pages/_app.js +70 -20
- package/pages/_document.js +53 -1
- package/postcss.config.js +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { serializer } from '@lowdefy/helpers';
|
|
17
|
+
import raw from '../../build/theme.json';
|
|
18
|
+
|
|
19
|
+
export default serializer.deserialize(raw);
|
package/lib/client/Page.js
CHANGED
|
@@ -22,6 +22,7 @@ import Head from 'next/head';
|
|
|
22
22
|
import Link from 'next/link';
|
|
23
23
|
|
|
24
24
|
import actions from '../../build/plugins/actions.js';
|
|
25
|
+
import blockMetas from '../../build/plugins/blockMetas.json';
|
|
25
26
|
import blocks from '../../build/plugins/blocks.js';
|
|
26
27
|
import icons from '../../build/plugins/icons.js';
|
|
27
28
|
import operators from '../../build/plugins/operators/client.js';
|
|
@@ -42,6 +43,7 @@ const Page = ({ auth, lowdefy, pageConfig, rootConfig }) => {
|
|
|
42
43
|
router={router}
|
|
43
44
|
types={{
|
|
44
45
|
actions,
|
|
46
|
+
blockMetas,
|
|
45
47
|
blocks,
|
|
46
48
|
icons,
|
|
47
49
|
operators,
|
|
@@ -15,12 +15,15 @@
|
|
|
15
15
|
limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
import { createRequire } from 'node:module';
|
|
18
19
|
import path from 'path';
|
|
19
20
|
import { get } from '@lowdefy/helpers';
|
|
20
21
|
import { readFile } from '@lowdefy/node-utils';
|
|
21
22
|
import { createPluginTypesMap } from '@lowdefy/build';
|
|
22
23
|
import YAML from 'yaml';
|
|
23
24
|
|
|
25
|
+
const require = createRequire(import.meta.url);
|
|
26
|
+
|
|
24
27
|
async function getPluginDefinitions({ directories }) {
|
|
25
28
|
let lowdefyYaml = await readFile(path.join(directories.config, 'lowdefy.yaml'));
|
|
26
29
|
if (!lowdefyYaml) {
|
|
@@ -42,6 +45,7 @@ async function createCustomPluginTypesMap({ directories }) {
|
|
|
42
45
|
events: {},
|
|
43
46
|
providers: {},
|
|
44
47
|
},
|
|
48
|
+
blockMetas: {},
|
|
45
49
|
blocks: {},
|
|
46
50
|
connections: {},
|
|
47
51
|
icons: {},
|
|
@@ -50,18 +54,14 @@ async function createCustomPluginTypesMap({ directories }) {
|
|
|
50
54
|
server: {},
|
|
51
55
|
},
|
|
52
56
|
requests: {},
|
|
53
|
-
styles: {
|
|
54
|
-
packages: {},
|
|
55
|
-
blocks: {},
|
|
56
|
-
},
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const pluginDefinitions = await getPluginDefinitions({ directories });
|
|
60
60
|
|
|
61
61
|
for (const plugin of pluginDefinitions) {
|
|
62
|
-
const
|
|
62
|
+
const types = require(`${plugin.name}/types`);
|
|
63
63
|
createPluginTypesMap({
|
|
64
|
-
packageTypes: types,
|
|
64
|
+
packageTypes: types.default ?? types,
|
|
65
65
|
typesMap: customTypesMap,
|
|
66
66
|
packageName: plugin.name,
|
|
67
67
|
version: plugin.version,
|
package/next.config.js
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
const { withSentryConfig } = require('@sentry/nextjs');
|
|
2
|
-
const withLess = require('next-with-less');
|
|
3
2
|
const lowdefyConfig = require('./build/config.json');
|
|
3
|
+
const blockPackages = require('./build/blockPackages.json');
|
|
4
4
|
|
|
5
|
-
const nextConfig =
|
|
5
|
+
const nextConfig = {
|
|
6
6
|
basePath: lowdefyConfig.basePath,
|
|
7
7
|
reactStrictMode: true,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
config.resolve.fallback = {
|
|
11
|
-
assert: false,
|
|
12
|
-
buffer: false,
|
|
13
|
-
crypto: false,
|
|
14
|
-
events: false,
|
|
15
|
-
fs: false,
|
|
16
|
-
path: false,
|
|
17
|
-
process: require.resolve('process/browser'),
|
|
18
|
-
util: false,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
return config;
|
|
22
|
-
},
|
|
8
|
+
transpilePackages: ['@lowdefy/client', ...blockPackages],
|
|
9
|
+
turbopack: {},
|
|
23
10
|
poweredByHeader: false,
|
|
24
11
|
// productionBrowserSourceMaps: true
|
|
25
12
|
output: process.env.LOWDEFY_BUILD_OUTPUT_STANDALONE === '1' ? 'standalone' : undefined,
|
|
26
|
-
|
|
27
|
-
eslint: {
|
|
28
|
-
ignoreDuringBuilds: true,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
13
|
+
};
|
|
31
14
|
|
|
32
15
|
// Only wrap with Sentry if SENTRY_DSN is configured
|
|
33
16
|
// This enables source map uploads when SENTRY_AUTH_TOKEN is present
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -31,46 +31,45 @@
|
|
|
31
31
|
"pages/*",
|
|
32
32
|
"public_default/*",
|
|
33
33
|
"next.config.js",
|
|
34
|
+
"postcss.config.js",
|
|
34
35
|
"package.original.json",
|
|
35
36
|
".eslintrc.yaml",
|
|
36
37
|
".npmrc"
|
|
37
38
|
],
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@lowdefy/
|
|
41
|
-
"@lowdefy/
|
|
42
|
-
"@lowdefy/
|
|
43
|
-
"@lowdefy/blocks-
|
|
44
|
-
"@lowdefy/blocks-
|
|
45
|
-
"@lowdefy/blocks-
|
|
46
|
-
"@lowdefy/client": "
|
|
47
|
-
"@lowdefy/
|
|
48
|
-
"@lowdefy/
|
|
49
|
-
"@lowdefy/
|
|
50
|
-
"@lowdefy/
|
|
51
|
-
"@lowdefy/
|
|
52
|
-
"@lowdefy/
|
|
53
|
-
"@lowdefy/
|
|
54
|
-
"@lowdefy/operators-js": "4.7.3",
|
|
55
|
-
"@lowdefy/operators-nunjucks": "4.7.3",
|
|
56
|
-
"@lowdefy/operators-uuid": "4.7.3",
|
|
57
|
-
"@lowdefy/plugin-next-auth": "4.7.3",
|
|
40
|
+
"@ant-design/cssinjs": "2.1.2",
|
|
41
|
+
"@lowdefy/actions-core": "5.1.0",
|
|
42
|
+
"@lowdefy/api": "5.1.0",
|
|
43
|
+
"@lowdefy/block-utils": "5.1.0",
|
|
44
|
+
"@lowdefy/blocks-antd": "5.1.0",
|
|
45
|
+
"@lowdefy/blocks-basic": "5.1.0",
|
|
46
|
+
"@lowdefy/blocks-loaders": "5.1.0",
|
|
47
|
+
"@lowdefy/client": "5.1.0",
|
|
48
|
+
"@lowdefy/errors": "5.1.0",
|
|
49
|
+
"@lowdefy/helpers": "5.1.0",
|
|
50
|
+
"@lowdefy/layout": "5.1.0",
|
|
51
|
+
"@lowdefy/logger": "5.1.0",
|
|
52
|
+
"@lowdefy/node-utils": "5.1.0",
|
|
53
|
+
"@lowdefy/operators-js": "5.1.0",
|
|
54
|
+
"@lowdefy/plugin-next-auth": "5.1.0",
|
|
58
55
|
"@sentry/nextjs": "8.53.0",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
56
|
+
"@tailwindcss/postcss": "4.2.1",
|
|
57
|
+
"antd": "6.3.1",
|
|
58
|
+
"dayjs": "1.11.19",
|
|
59
|
+
"next": "16.1.6",
|
|
60
|
+
"next-auth": "4.24.10",
|
|
61
61
|
"pino": "8.16.2",
|
|
62
|
-
"process": "0.11.10",
|
|
63
62
|
"react": "18.2.0",
|
|
64
63
|
"react-dom": "18.2.0",
|
|
65
|
-
"react-icons": "
|
|
64
|
+
"react-icons": "5.6.0",
|
|
65
|
+
"tailwindcss": "4.2.1",
|
|
66
66
|
"uuid": "13.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@lowdefy/build": "
|
|
70
|
-
"@next/eslint-plugin-next": "
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"next-with-less": "3.0.1",
|
|
69
|
+
"@lowdefy/build": "5.1.0",
|
|
70
|
+
"@next/eslint-plugin-next": "16.1.6",
|
|
71
|
+
"@tailwindcss/postcss": "4.2.1",
|
|
72
|
+
"tailwindcss": "4.2.1",
|
|
74
73
|
"webpack": "5.94.0",
|
|
75
74
|
"yaml": "2.3.4",
|
|
76
75
|
"yargs": "17.7.2"
|
package/package.original.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"pages/*",
|
|
32
32
|
"public_default/*",
|
|
33
33
|
"next.config.js",
|
|
34
|
+
"postcss.config.js",
|
|
34
35
|
"package.original.json",
|
|
35
36
|
".eslintrc.yaml",
|
|
36
37
|
".npmrc"
|
|
@@ -46,41 +47,39 @@
|
|
|
46
47
|
"prepublishOnly": "pnpm build"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
|
-
"@
|
|
50
|
-
"@lowdefy/
|
|
51
|
-
"@lowdefy/
|
|
52
|
-
"@lowdefy/
|
|
53
|
-
"@lowdefy/blocks-
|
|
54
|
-
"@lowdefy/blocks-
|
|
55
|
-
"@lowdefy/blocks-
|
|
56
|
-
"@lowdefy/client": "
|
|
57
|
-
"@lowdefy/
|
|
58
|
-
"@lowdefy/
|
|
59
|
-
"@lowdefy/
|
|
60
|
-
"@lowdefy/
|
|
61
|
-
"@lowdefy/
|
|
62
|
-
"@lowdefy/
|
|
63
|
-
"@lowdefy/
|
|
64
|
-
"@lowdefy/operators-js": "4.7.3",
|
|
65
|
-
"@lowdefy/operators-nunjucks": "4.7.3",
|
|
66
|
-
"@lowdefy/operators-uuid": "4.7.3",
|
|
67
|
-
"@lowdefy/plugin-next-auth": "4.7.3",
|
|
50
|
+
"@ant-design/cssinjs": "2.1.2",
|
|
51
|
+
"@lowdefy/actions-core": "5.1.0",
|
|
52
|
+
"@lowdefy/api": "5.1.0",
|
|
53
|
+
"@lowdefy/block-utils": "5.1.0",
|
|
54
|
+
"@lowdefy/blocks-antd": "5.1.0",
|
|
55
|
+
"@lowdefy/blocks-basic": "5.1.0",
|
|
56
|
+
"@lowdefy/blocks-loaders": "5.1.0",
|
|
57
|
+
"@lowdefy/client": "5.1.0",
|
|
58
|
+
"@lowdefy/errors": "5.1.0",
|
|
59
|
+
"@lowdefy/helpers": "5.1.0",
|
|
60
|
+
"@lowdefy/layout": "5.1.0",
|
|
61
|
+
"@lowdefy/logger": "5.1.0",
|
|
62
|
+
"@lowdefy/node-utils": "5.1.0",
|
|
63
|
+
"@lowdefy/operators-js": "5.1.0",
|
|
64
|
+
"@lowdefy/plugin-next-auth": "5.1.0",
|
|
68
65
|
"@sentry/nextjs": "8.53.0",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
66
|
+
"@tailwindcss/postcss": "4.2.1",
|
|
67
|
+
"antd": "6.3.1",
|
|
68
|
+
"dayjs": "1.11.19",
|
|
69
|
+
"next": "16.1.6",
|
|
70
|
+
"next-auth": "4.24.10",
|
|
71
71
|
"pino": "8.16.2",
|
|
72
|
-
"process": "0.11.10",
|
|
73
72
|
"react": "18.2.0",
|
|
74
73
|
"react-dom": "18.2.0",
|
|
75
|
-
"react-icons": "
|
|
74
|
+
"react-icons": "5.6.0",
|
|
75
|
+
"tailwindcss": "4.2.1",
|
|
76
76
|
"uuid": "13.0.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@lowdefy/build": "
|
|
80
|
-
"@next/eslint-plugin-next": "
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"next-with-less": "3.0.1",
|
|
79
|
+
"@lowdefy/build": "5.1.0",
|
|
80
|
+
"@next/eslint-plugin-next": "16.1.6",
|
|
81
|
+
"@tailwindcss/postcss": "4.2.1",
|
|
82
|
+
"tailwindcss": "4.2.1",
|
|
84
83
|
"webpack": "5.94.0",
|
|
85
84
|
"yaml": "2.3.4",
|
|
86
85
|
"yargs": "17.7.2"
|
package/pages/_app.js
CHANGED
|
@@ -14,10 +14,18 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
// CSS layer order — MUST be the first CSS import. Next.js treats this as critical
|
|
18
|
+
// CSS that loads before hydration, locking the cascade priority (antd > base/preflight)
|
|
19
|
+
// before antd's StyleProvider injects @layer antd {} at runtime.
|
|
20
|
+
import '../build/layer-order.css';
|
|
21
|
+
|
|
17
22
|
import React, { useCallback, useRef } from 'react';
|
|
18
23
|
import dynamic from 'next/dynamic';
|
|
19
24
|
|
|
20
25
|
import { ErrorBoundary } from '@lowdefy/block-utils';
|
|
26
|
+
import { useDarkMode } from '@lowdefy/client';
|
|
27
|
+
import { StyleProvider } from '@ant-design/cssinjs';
|
|
28
|
+
import { App as AntdApp, ConfigProvider, theme as antdTheme } from 'antd';
|
|
21
29
|
|
|
22
30
|
import Auth from '../lib/client/auth/Auth.js';
|
|
23
31
|
import createLogUsage from '../lib/client/createLogUsage.js';
|
|
@@ -26,7 +34,7 @@ import loggerConfig from '../lib/build/logger.js';
|
|
|
26
34
|
import setSentryUser from '../lib/client/sentry/setSentryUser.js';
|
|
27
35
|
|
|
28
36
|
// Must be in _app due to next specifications.
|
|
29
|
-
import '../build/
|
|
37
|
+
import '../build/globals.css';
|
|
30
38
|
|
|
31
39
|
// Initialize Sentry client once on module load
|
|
32
40
|
initSentryClient({
|
|
@@ -34,9 +42,34 @@ initSentryClient({
|
|
|
34
42
|
sentryConfig: loggerConfig.sentry,
|
|
35
43
|
});
|
|
36
44
|
|
|
45
|
+
function ThemeTokenResolver({ lowdefyRef, children }) {
|
|
46
|
+
const { token } = antdTheme.useToken();
|
|
47
|
+
if (!lowdefyRef.current.theme) {
|
|
48
|
+
lowdefyRef.current.theme = {};
|
|
49
|
+
}
|
|
50
|
+
lowdefyRef.current.theme._resolvedAntdToken = token;
|
|
51
|
+
return children;
|
|
52
|
+
}
|
|
53
|
+
|
|
37
54
|
function App({ Component, pageProps: { session, rootConfig, pageConfig } }) {
|
|
38
55
|
const usageDataRef = useRef({});
|
|
39
56
|
const lowdefyRef = useRef({ eventCallback: createLogUsage({ usageDataRef }) });
|
|
57
|
+
if (rootConfig?.theme) {
|
|
58
|
+
lowdefyRef.current.theme = rootConfig.theme;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const { algorithm, token, components } = useDarkMode({
|
|
62
|
+
antd: lowdefyRef.current.theme?.antd,
|
|
63
|
+
configDarkMode: lowdefyRef.current.theme?.darkMode,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const {
|
|
67
|
+
lightToken: _lightToken,
|
|
68
|
+
darkToken: _darkToken,
|
|
69
|
+
lightComponents: _lightComponents,
|
|
70
|
+
darkComponents: _darkComponents,
|
|
71
|
+
...antdConfig
|
|
72
|
+
} = lowdefyRef.current.theme?.antd ?? {};
|
|
40
73
|
|
|
41
74
|
const handleError = useCallback((error) => {
|
|
42
75
|
if (lowdefyRef.current?._internal?.handleError) {
|
|
@@ -47,26 +80,43 @@ function App({ Component, pageProps: { session, rootConfig, pageConfig } }) {
|
|
|
47
80
|
}, []);
|
|
48
81
|
|
|
49
82
|
return (
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<Component
|
|
61
|
-
auth={auth}
|
|
62
|
-
lowdefy={lowdefyRef.current}
|
|
63
|
-
rootConfig={rootConfig}
|
|
64
|
-
pageConfig={pageConfig}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
83
|
+
<StyleProvider layer>
|
|
84
|
+
<ConfigProvider
|
|
85
|
+
theme={{
|
|
86
|
+
...antdConfig,
|
|
87
|
+
token,
|
|
88
|
+
components,
|
|
89
|
+
cssVar: { key: 'lowdefy' },
|
|
90
|
+
hashed: false,
|
|
91
|
+
algorithm,
|
|
67
92
|
}}
|
|
68
|
-
|
|
69
|
-
|
|
93
|
+
>
|
|
94
|
+
<AntdApp>
|
|
95
|
+
<ThemeTokenResolver lowdefyRef={lowdefyRef}>
|
|
96
|
+
<ErrorBoundary fullPage onError={handleError}>
|
|
97
|
+
<Auth session={session}>
|
|
98
|
+
{(auth) => {
|
|
99
|
+
usageDataRef.current.user = auth.session?.hashed_id;
|
|
100
|
+
// Set Sentry user context when auth changes
|
|
101
|
+
setSentryUser({
|
|
102
|
+
user: auth.session,
|
|
103
|
+
sentryConfig: loggerConfig.sentry,
|
|
104
|
+
});
|
|
105
|
+
return (
|
|
106
|
+
<Component
|
|
107
|
+
auth={auth}
|
|
108
|
+
lowdefy={lowdefyRef.current}
|
|
109
|
+
rootConfig={rootConfig}
|
|
110
|
+
pageConfig={pageConfig}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}}
|
|
114
|
+
</Auth>
|
|
115
|
+
</ErrorBoundary>
|
|
116
|
+
</ThemeTokenResolver>
|
|
117
|
+
</AntdApp>
|
|
118
|
+
</ConfigProvider>
|
|
119
|
+
</StyleProvider>
|
|
70
120
|
);
|
|
71
121
|
}
|
|
72
122
|
|
package/pages/_document.js
CHANGED
|
@@ -19,14 +19,66 @@ import Document, { Html, Head, Main, NextScript } from 'next/document';
|
|
|
19
19
|
|
|
20
20
|
import appJson from '../lib/build/app.js';
|
|
21
21
|
import lowdefyConfig from '../lib/build/config.js';
|
|
22
|
+
import themeConfig from '../lib/build/theme.js';
|
|
22
23
|
|
|
23
24
|
const basePath = lowdefyConfig.basePath ?? '';
|
|
25
|
+
const VALID_COLOR_MODES = ['system', 'light', 'dark'];
|
|
26
|
+
const configColorMode = VALID_COLOR_MODES.includes(themeConfig.darkMode)
|
|
27
|
+
? themeConfig.darkMode
|
|
28
|
+
: 'system';
|
|
29
|
+
const darkBg = themeConfig?.antd?.darkToken?.colorBgLayout ?? '#000';
|
|
30
|
+
const lightBg = themeConfig?.antd?.lightToken?.colorBgLayout ?? '';
|
|
31
|
+
|
|
32
|
+
// Escape characters that could break out of the enclosing <script> tag or
|
|
33
|
+
// terminate a JS string literal. Used to defuse the js/bad-code-sanitization
|
|
34
|
+
// class of injection for values embedded into the pre-hydration inline script.
|
|
35
|
+
const SCRIPT_ESCAPES = {
|
|
36
|
+
'<': '\\u003C',
|
|
37
|
+
'>': '\\u003E',
|
|
38
|
+
'\b': '\\b',
|
|
39
|
+
'\f': '\\f',
|
|
40
|
+
'\n': '\\n',
|
|
41
|
+
'\r': '\\r',
|
|
42
|
+
'\t': '\\t',
|
|
43
|
+
'\0': '\\0',
|
|
44
|
+
'\u2028': '\\u2028',
|
|
45
|
+
'\u2029': '\\u2029',
|
|
46
|
+
};
|
|
47
|
+
function safeScriptJson(value) {
|
|
48
|
+
return JSON.stringify(value).replace(/[<>\b\f\n\r\t\0\u2028\u2029]/g, (c) => SCRIPT_ESCAPES[c]);
|
|
49
|
+
}
|
|
24
50
|
|
|
25
51
|
class LowdefyDocument extends Document {
|
|
26
52
|
render() {
|
|
27
53
|
return (
|
|
28
|
-
<Html>
|
|
54
|
+
<Html className="lowdefy">
|
|
29
55
|
<Head>
|
|
56
|
+
{/* Synchronous script that creates the @layer order declaration and keeps
|
|
57
|
+
it as the first child of <head> via MutationObserver. antd's CSS-in-JS
|
|
58
|
+
uses prependQueue to inject <style> tags at the top of <head>, which
|
|
59
|
+
would otherwise make @layer antd the first (lowest priority) layer.
|
|
60
|
+
MutationObserver fires before paint, so the browser never sees the
|
|
61
|
+
wrong cascade order. */}
|
|
62
|
+
<script
|
|
63
|
+
dangerouslySetInnerHTML={{
|
|
64
|
+
__html: `(function(){var s=document.createElement("style");s.id="__lf-layer-order";s.textContent="@layer theme, base, antd, components, utilities;";document.head.prepend(s);new MutationObserver(function(){if(document.head.firstChild!==s)document.head.prepend(s)}).observe(document.head,{childList:true})})();`,
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
{/* Synchronous pre-hydration background script — prevents mode-mismatch
|
|
68
|
+
flash on page navigation. Mirrors useDarkMode.js resolution order:
|
|
69
|
+
configDarkMode → localStorage → prefers-color-scheme. Uses the user's
|
|
70
|
+
configured colorBgLayout tokens when present (theme.antd.darkToken and
|
|
71
|
+
theme.antd.lightToken), falling back to #000 in dark and no inline style
|
|
72
|
+
in light so default behavior is unchanged. */}
|
|
73
|
+
<script
|
|
74
|
+
dangerouslySetInnerHTML={{
|
|
75
|
+
__html: `(function(){var c=${safeScriptJson(configColorMode)};var db=${safeScriptJson(
|
|
76
|
+
darkBg
|
|
77
|
+
)};var lb=${safeScriptJson(
|
|
78
|
+
lightBg
|
|
79
|
+
)};var d;if(c==="dark")d=true;else if(c==="light")d=false;else{try{var p=localStorage.getItem("lowdefy_darkMode");if(p==="dark")d=true;else if(p==="light")d=false;else d=window.matchMedia("(prefers-color-scheme:dark)").matches}catch(e){d=window.matchMedia("(prefers-color-scheme:dark)").matches}}var bg=d?db:lb;if(bg)document.documentElement.style.backgroundColor=bg})();`,
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
30
82
|
<link rel="manifest" href={`${basePath}/manifest.webmanifest`} />
|
|
31
83
|
<link rel="icon" type="image/svg+xml" href={`${basePath}/icon.svg`} />
|
|
32
84
|
<link rel="apple-touch-icon" href={`${basePath}/apple-touch-icon.png`} />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = { plugins: { '@tailwindcss/postcss': {} } };
|