@lowdefy/server-dev 5.0.0 → 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.
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server-dev",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -36,33 +36,33 @@
36
36
  ".npmrc"
37
37
  ],
38
38
  "dependencies": {
39
- "@lowdefy/actions-core": "5.0.0",
40
- "@lowdefy/api": "5.0.0",
41
- "@lowdefy/block-utils": "5.0.0",
42
- "@lowdefy/blocks-aggrid": "5.0.0",
43
- "@lowdefy/blocks-antd": "5.0.0",
44
- "@lowdefy/blocks-basic": "5.0.0",
45
- "@lowdefy/blocks-echarts": "5.0.0",
46
- "@lowdefy/blocks-loaders": "5.0.0",
47
- "@lowdefy/blocks-markdown": "5.0.0",
48
- "@lowdefy/build": "5.0.0",
49
- "@lowdefy/client": "5.0.0",
50
- "@lowdefy/connection-axios-http": "5.0.0",
51
- "@lowdefy/engine": "5.0.0",
52
- "@lowdefy/errors": "5.0.0",
53
- "@lowdefy/helpers": "5.0.0",
54
- "@lowdefy/layout": "5.0.0",
55
- "@lowdefy/logger": "5.0.0",
56
- "@lowdefy/node-utils": "5.0.0",
57
- "@lowdefy/operators-change-case": "5.0.0",
58
- "@lowdefy/operators-dayjs": "5.0.0",
59
- "@lowdefy/operators-diff": "5.0.0",
60
- "@lowdefy/operators-js": "5.0.0",
61
- "@lowdefy/operators-mql": "5.0.0",
62
- "@lowdefy/operators-nunjucks": "5.0.0",
63
- "@lowdefy/operators-uuid": "5.0.0",
64
- "@lowdefy/operators-yaml": "5.0.0",
65
- "@lowdefy/plugin-next-auth": "5.0.0",
39
+ "@lowdefy/actions-core": "5.1.0",
40
+ "@lowdefy/api": "5.1.0",
41
+ "@lowdefy/block-utils": "5.1.0",
42
+ "@lowdefy/blocks-aggrid": "5.1.0",
43
+ "@lowdefy/blocks-antd": "5.1.0",
44
+ "@lowdefy/blocks-basic": "5.1.0",
45
+ "@lowdefy/blocks-echarts": "5.1.0",
46
+ "@lowdefy/blocks-loaders": "5.1.0",
47
+ "@lowdefy/blocks-markdown": "5.1.0",
48
+ "@lowdefy/build": "5.1.0",
49
+ "@lowdefy/client": "5.1.0",
50
+ "@lowdefy/connection-axios-http": "5.1.0",
51
+ "@lowdefy/engine": "5.1.0",
52
+ "@lowdefy/errors": "5.1.0",
53
+ "@lowdefy/helpers": "5.1.0",
54
+ "@lowdefy/layout": "5.1.0",
55
+ "@lowdefy/logger": "5.1.0",
56
+ "@lowdefy/node-utils": "5.1.0",
57
+ "@lowdefy/operators-change-case": "5.1.0",
58
+ "@lowdefy/operators-dayjs": "5.1.0",
59
+ "@lowdefy/operators-diff": "5.1.0",
60
+ "@lowdefy/operators-js": "5.1.0",
61
+ "@lowdefy/operators-mql": "5.1.0",
62
+ "@lowdefy/operators-nunjucks": "5.1.0",
63
+ "@lowdefy/operators-uuid": "5.1.0",
64
+ "@lowdefy/operators-yaml": "5.1.0",
65
+ "@lowdefy/plugin-next-auth": "5.1.0",
66
66
  "@ant-design/cssinjs": "2.1.2",
67
67
  "antd": "6.3.1",
68
68
  "dayjs": "1.11.19",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/server-dev",
3
- "version": "5.0.0",
3
+ "version": "5.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -44,33 +44,33 @@
44
44
  "prepublishOnly": "pnpm build"
45
45
  },
46
46
  "dependencies": {
47
- "@lowdefy/actions-core": "5.0.0",
48
- "@lowdefy/api": "5.0.0",
49
- "@lowdefy/block-utils": "5.0.0",
50
- "@lowdefy/blocks-aggrid": "5.0.0",
51
- "@lowdefy/blocks-antd": "5.0.0",
52
- "@lowdefy/blocks-basic": "5.0.0",
53
- "@lowdefy/blocks-echarts": "5.0.0",
54
- "@lowdefy/blocks-loaders": "5.0.0",
55
- "@lowdefy/blocks-markdown": "5.0.0",
56
- "@lowdefy/build": "5.0.0",
57
- "@lowdefy/client": "5.0.0",
58
- "@lowdefy/connection-axios-http": "5.0.0",
59
- "@lowdefy/engine": "5.0.0",
60
- "@lowdefy/errors": "5.0.0",
61
- "@lowdefy/helpers": "5.0.0",
62
- "@lowdefy/layout": "5.0.0",
63
- "@lowdefy/logger": "5.0.0",
64
- "@lowdefy/node-utils": "5.0.0",
65
- "@lowdefy/operators-change-case": "5.0.0",
66
- "@lowdefy/operators-dayjs": "5.0.0",
67
- "@lowdefy/operators-diff": "5.0.0",
68
- "@lowdefy/operators-js": "5.0.0",
69
- "@lowdefy/operators-mql": "5.0.0",
70
- "@lowdefy/operators-nunjucks": "5.0.0",
71
- "@lowdefy/operators-uuid": "5.0.0",
72
- "@lowdefy/operators-yaml": "5.0.0",
73
- "@lowdefy/plugin-next-auth": "5.0.0",
47
+ "@lowdefy/actions-core": "5.1.0",
48
+ "@lowdefy/api": "5.1.0",
49
+ "@lowdefy/block-utils": "5.1.0",
50
+ "@lowdefy/blocks-aggrid": "5.1.0",
51
+ "@lowdefy/blocks-antd": "5.1.0",
52
+ "@lowdefy/blocks-basic": "5.1.0",
53
+ "@lowdefy/blocks-echarts": "5.1.0",
54
+ "@lowdefy/blocks-loaders": "5.1.0",
55
+ "@lowdefy/blocks-markdown": "5.1.0",
56
+ "@lowdefy/build": "5.1.0",
57
+ "@lowdefy/client": "5.1.0",
58
+ "@lowdefy/connection-axios-http": "5.1.0",
59
+ "@lowdefy/engine": "5.1.0",
60
+ "@lowdefy/errors": "5.1.0",
61
+ "@lowdefy/helpers": "5.1.0",
62
+ "@lowdefy/layout": "5.1.0",
63
+ "@lowdefy/logger": "5.1.0",
64
+ "@lowdefy/node-utils": "5.1.0",
65
+ "@lowdefy/operators-change-case": "5.1.0",
66
+ "@lowdefy/operators-dayjs": "5.1.0",
67
+ "@lowdefy/operators-diff": "5.1.0",
68
+ "@lowdefy/operators-js": "5.1.0",
69
+ "@lowdefy/operators-mql": "5.1.0",
70
+ "@lowdefy/operators-nunjucks": "5.1.0",
71
+ "@lowdefy/operators-uuid": "5.1.0",
72
+ "@lowdefy/operators-yaml": "5.1.0",
73
+ "@lowdefy/plugin-next-auth": "5.1.0",
74
74
  "@ant-design/cssinjs": "2.1.2",
75
75
  "antd": "6.3.1",
76
76
  "dayjs": "1.11.19",
package/pages/_app.js CHANGED
@@ -57,11 +57,19 @@ function App({ Component }) {
57
57
  lowdefyRef.current.theme = rootConfig.theme;
58
58
  }
59
59
 
60
- const algorithm = useDarkMode({
61
- baseAlgorithm: lowdefyRef.current.theme?.antd?.algorithm,
60
+ const { algorithm, token, components } = useDarkMode({
61
+ antd: lowdefyRef.current.theme?.antd,
62
62
  configDarkMode: lowdefyRef.current.theme?.darkMode,
63
63
  });
64
64
 
65
+ const {
66
+ lightToken: _lightToken,
67
+ darkToken: _darkToken,
68
+ lightComponents: _lightComponents,
69
+ darkComponents: _darkComponents,
70
+ ...antdConfig
71
+ } = lowdefyRef.current.theme?.antd ?? {};
72
+
65
73
  // Runtime error callback — pushes errors to state for ErrorBar display.
66
74
  // Accepts Error objects (with .name) or plain objects (with .type) from build warnings.
67
75
  lowdefyRef.current._runtimeErrorCallback = useCallback((error) => {
@@ -95,7 +103,9 @@ function App({ Component }) {
95
103
  <StyleProvider layer>
96
104
  <ConfigProvider
97
105
  theme={{
98
- ...lowdefyRef.current.theme?.antd,
106
+ ...antdConfig,
107
+ token,
108
+ components,
99
109
  cssVar: { key: 'lowdefy' },
100
110
  hashed: false,
101
111
  algorithm,
@@ -19,8 +19,34 @@ 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() {
@@ -38,6 +64,21 @@ class LowdefyDocument extends Document {
38
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})})();`,
39
65
  }}
40
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
+ />
41
82
  <link rel="manifest" href={`${basePath}/manifest.webmanifest`} />
42
83
  <link rel="icon" type="image/svg+xml" href={`${basePath}/icon.svg`} />
43
84
  <link rel="apple-touch-icon" href={`${basePath}/apple-touch-icon.png`} />