@lowdefy/actions-core 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.
@@ -0,0 +1,28 @@
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
+ */ const cycleOrder = {
16
+ light: 'dark',
17
+ dark: 'system',
18
+ system: 'light'
19
+ };
20
+ function SetDarkMode({ globals, methods, params }) {
21
+ const { window } = globals;
22
+ const currentPreference = window.localStorage?.getItem('lowdefy_darkMode') ?? 'system';
23
+ const newPreference = params?.darkMode ?? cycleOrder[currentPreference] ?? 'light';
24
+ window.__lowdefy_setDarkMode?.(newPreference);
25
+ // Trigger engine update cascade so _media: darkMode re-evaluates in all blocks
26
+ methods.setGlobal({});
27
+ }
28
+ export default SetDarkMode;
@@ -0,0 +1,18 @@
1
+ export default {
2
+ type: 'object',
3
+ params: {
4
+ type: 'object',
5
+ properties: {
6
+ darkMode: {
7
+ type: 'string',
8
+ enum: [
9
+ 'system',
10
+ 'light',
11
+ 'dark'
12
+ ],
13
+ description: 'Set dark mode preference. When not provided, cycles through light, dark, and system.'
14
+ }
15
+ },
16
+ additionalProperties: false
17
+ }
18
+ };
package/dist/actions.js CHANGED
@@ -25,6 +25,7 @@ export { default as Request } from './actions/Request/Request.js';
25
25
  export { default as Reset } from './actions/Reset/Reset.js';
26
26
  export { default as ResetValidation } from './actions/ResetValidation/ResetValidation.js';
27
27
  export { default as ScrollTo } from './actions/ScrollTo/ScrollTo.js';
28
+ export { default as SetDarkMode } from './actions/SetDarkMode/SetDarkMode.js';
28
29
  export { default as SetFocus } from './actions/SetFocus/SetFocus.js';
29
30
  export { default as SetGlobal } from './actions/SetGlobal/SetGlobal.js';
30
31
  export { default as SetState } from './actions/SetState/SetState.js';
package/dist/schemas.js CHANGED
@@ -25,6 +25,7 @@ export { default as Request } from './actions/Request/schema.js';
25
25
  export { default as Reset } from './actions/Reset/schema.js';
26
26
  export { default as ResetValidation } from './actions/ResetValidation/schema.js';
27
27
  export { default as ScrollTo } from './actions/ScrollTo/schema.js';
28
+ export { default as SetDarkMode } from './actions/SetDarkMode/schema.js';
28
29
  export { default as SetFocus } from './actions/SetFocus/schema.js';
29
30
  export { default as SetGlobal } from './actions/SetGlobal/schema.js';
30
31
  export { default as SetState } from './actions/SetState/schema.js';
package/dist/types.js CHANGED
@@ -12,7 +12,28 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import * as actions from './actions.js';
16
- export default {
17
- actions: Object.keys(actions)
15
+ */ export default {
16
+ actions: [
17
+ 'CallAPI',
18
+ 'CallMethod',
19
+ 'CopyToClipboard',
20
+ 'DisplayMessage',
21
+ 'Fetch',
22
+ 'GeolocationCurrentPosition',
23
+ 'Link',
24
+ 'Login',
25
+ 'Logout',
26
+ 'Request',
27
+ 'Reset',
28
+ 'ResetValidation',
29
+ 'ScrollTo',
30
+ 'SetDarkMode',
31
+ 'SetFocus',
32
+ 'SetGlobal',
33
+ 'SetState',
34
+ 'Throw',
35
+ 'UpdateSession',
36
+ 'Validate',
37
+ 'Wait'
38
+ ]
18
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/actions-core",
3
- "version": "4.7.3",
3
+ "version": "5.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -44,14 +44,15 @@
44
44
  "dist/*"
45
45
  ],
46
46
  "dependencies": {
47
- "@lowdefy/errors": "4.7.3",
48
- "@lowdefy/helpers": "4.7.3"
47
+ "@lowdefy/errors": "5.1.0",
48
+ "@lowdefy/helpers": "5.1.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@jest/globals": "28.1.3",
52
- "@swc/cli": "0.1.63",
53
- "@swc/core": "1.3.99",
54
- "@swc/jest": "0.2.29",
52
+ "@lowdefy/node-utils": "5.1.0",
53
+ "@swc/cli": "0.8.0",
54
+ "@swc/core": "1.15.18",
55
+ "@swc/jest": "0.2.39",
55
56
  "jest": "28.1.3",
56
57
  "jest-environment-jsdom": "28.1.3"
57
58
  },
@@ -59,7 +60,7 @@
59
60
  "access": "public"
60
61
  },
61
62
  "scripts": {
62
- "build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start --copy-files",
63
+ "build": "swc src --out-dir dist --config-file ../../../../.swcrc --cli-config-file ../../../../.swc-cli.json --copy-files",
63
64
  "clean": "rm -rf dist",
64
65
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
65
66
  }