@bigbinary/neeto-themes-frontend 3.1.4 → 3.1.6
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/dist/NeetoThemesBuilder.js +8 -3
- package/dist/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/NeetoThemesBuilder.js +8 -3
- package/dist/cjs/NeetoThemesBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +2 -1
- package/dist/cjs/hooks.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/hooks.js +2 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{useThemeUtils-D6iAqGU2.js → useThemeUtils-B_bPCE4d.js} +11 -5
- package/dist/useThemeUtils-B_bPCE4d.js.map +1 -0
- package/dist/{useThemeUtils-DbsrDPEp.js → useThemeUtils-CMF6rI88.js} +14 -8
- package/dist/useThemeUtils-CMF6rI88.js.map +1 -0
- package/package.json +15 -13
- package/dist/useThemeUtils-D6iAqGU2.js.map +0 -1
- package/dist/useThemeUtils-DbsrDPEp.js.map +0 -1
package/dist/cjs/hooks.js
CHANGED
package/dist/cjs/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var NeetoThemesBuilder = require('./NeetoThemesBuilder.js');
|
|
4
|
-
var useThemeUtils = require('../useThemeUtils-
|
|
4
|
+
var useThemeUtils = require('../useThemeUtils-B_bPCE4d.js');
|
|
5
5
|
var utils = require('../index-BCC98npS.js');
|
|
6
6
|
require('zustand/shallow');
|
|
7
7
|
require('react');
|
package/dist/hooks.js
CHANGED
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as NeetoThemesBuilder } from './NeetoThemesBuilder.js';
|
|
2
|
-
export { u as useThemeUtils } from './useThemeUtils-
|
|
2
|
+
export { u as useThemeUtils } from './useThemeUtils-CMF6rI88.js';
|
|
3
3
|
export { s as setTheme } from './index-i8lxlWVz.js';
|
|
4
4
|
import 'zustand/shallow';
|
|
5
5
|
import 'react';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
3
4
|
var shallow = require('zustand/shallow');
|
|
4
5
|
var react = require('react');
|
|
5
6
|
var ramda = require('ramda');
|
|
@@ -56,6 +57,10 @@ var useListSchema = function useListSchema() {
|
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
var useThemeUtils = function useThemeUtils() {
|
|
60
|
+
var _useState = react.useState(null),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
themeToBeApplied = _useState2[0],
|
|
63
|
+
setThemeToBeApplied = _useState2[1];
|
|
59
64
|
var setConfigState = useConfigStore(ramda.prop("setConfigState"));
|
|
60
65
|
var _useThemeStore = useThemeStore(function (store) {
|
|
61
66
|
return {
|
|
@@ -87,14 +92,15 @@ var useThemeUtils = function useThemeUtils() {
|
|
|
87
92
|
isFetchingSchema: isFetchingSchema
|
|
88
93
|
});
|
|
89
94
|
}, [isFetchingSchema]);
|
|
95
|
+
react.useEffect(function () {
|
|
96
|
+
if (ramda.isNil(themeToBeApplied) || isFetchingSchema) return;
|
|
97
|
+
utils.setTheme(themeToBeApplied, variableNamesMap, themePropertiesSchema);
|
|
98
|
+
}, [themeToBeApplied, isFetchingSchema]);
|
|
90
99
|
var setVariable = function setVariable(name, value) {
|
|
91
100
|
return utils.setVariable(name, value, variableNamesMap);
|
|
92
101
|
};
|
|
93
|
-
var setTheme = function setTheme(theme) {
|
|
94
|
-
return utils.setTheme(theme, variableNamesMap, themePropertiesSchema);
|
|
95
|
-
};
|
|
96
102
|
return {
|
|
97
|
-
setTheme:
|
|
103
|
+
setTheme: setThemeToBeApplied,
|
|
98
104
|
setVariable: setVariable,
|
|
99
105
|
previewingTheme: previewingTheme,
|
|
100
106
|
currentTheme: currentTheme,
|
|
@@ -106,4 +112,4 @@ exports.QUERY_KEYS = QUERY_KEYS;
|
|
|
106
112
|
exports.useConfigStore = useConfigStore;
|
|
107
113
|
exports.useThemeStore = useThemeStore;
|
|
108
114
|
exports.useThemeUtils = useThemeUtils;
|
|
109
|
-
//# sourceMappingURL=useThemeUtils-
|
|
115
|
+
//# sourceMappingURL=useThemeUtils-B_bPCE4d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThemeUtils-B_bPCE4d.js","sources":["../app/javascript/src/constants/query.js","../app/javascript/src/stores/useConfigStore.js","../app/javascript/src/stores/useThemeStore.js","../app/javascript/src/apis/schemas.js","../app/javascript/src/hooks/reactQuery/useSchemasApi.js","../app/javascript/src/hooks/useThemeUtils.js"],"sourcesContent":["export const QUERY_KEYS = {\n THEMES_LIST: \"themes-list\",\n THEME_DETAILS: \"theme-details\",\n SCHEMA_DETAILS: \"schema-details\",\n THEME_ENTITY_DETAILS: \"theme-entity-details\",\n GLOBAL_THEME_DETAILS: \"global-theme-details\",\n};\n","import { withImmutableActions } from \"neetocommons/react-utils\";\nimport { create } from \"zustand\";\n\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useConfigStore = create(\n withImmutableActions(set => ({\n themePropertiesSchema: [],\n entityType: \"\",\n entityId: \"\",\n variableNamesMap: {},\n defaultThemeName: \"Plain blue\",\n isFetchingSchema: true,\n isTemplateThemesEnabled: false,\n\n setConfigState: set,\n }))\n);\n\nexport default useConfigStore;\n","import { withImmutableActions } from \"neetocommons/react-utils\";\nimport { create } from \"zustand\";\n\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useThemeStore = create(\n withImmutableActions(set => ({\n currentTheme: {},\n isCurrentThemeLoading: true,\n previewingTheme: {},\n\n setThemeState: set,\n }))\n);\n\nexport default useThemeStore;\n","import axios from \"axios\";\n\nimport { BASE_URL } from \"src/constants\";\n\nconst list = () => axios.get(`${BASE_URL}/api/v1/schema`);\n\nconst schemasApi = { list };\n\nexport default schemasApi;\n","import { useQuery } from \"@tanstack/react-query\";\n\nimport schemasApi from \"apis/schemas\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useListSchema = () =>\n useQuery({\n queryKey: [QUERY_KEYS.SCHEMA_DETAILS],\n queryFn: schemasApi.list,\n });\n","import { useEffect, useState } from \"react\";\n\nimport { isNil, prop } from \"ramda\";\n\nimport useConfigStore from \"src/stores/useConfigStore\";\nimport useThemeStore from \"src/stores/useThemeStore\";\nimport {\n setVariable as setVariableUtil,\n setTheme as setThemeUtil,\n} from \"utils\";\n\nimport { useListSchema } from \"./reactQuery/useSchemasApi\";\n\nconst useThemeUtils = () => {\n const [themeToBeApplied, setThemeToBeApplied] = useState(null);\n const setConfigState = useConfigStore(prop(\"setConfigState\"));\n const { previewingTheme, currentTheme } = useThemeStore.pick();\n\n const { isLoading: isFetchingSchema, data } = useListSchema();\n\n const { schema: themePropertiesSchema = [], variableNamesMap = {} } =\n data || {};\n\n useEffect(() => {\n if (data) {\n setConfigState({\n themePropertiesSchema: data?.schema,\n variableNamesMap: data?.variableNamesMap,\n defaultThemeName: data?.defaultThemeName,\n });\n }\n }, [data]);\n\n useEffect(() => setConfigState({ isFetchingSchema }), [isFetchingSchema]);\n\n useEffect(() => {\n if (isNil(themeToBeApplied) || isFetchingSchema) return;\n\n setThemeUtil(themeToBeApplied, variableNamesMap, themePropertiesSchema);\n }, [themeToBeApplied, isFetchingSchema]);\n\n const setVariable = (name, value) =>\n setVariableUtil(name, value, variableNamesMap);\n\n return {\n setTheme: setThemeToBeApplied,\n setVariable,\n previewingTheme,\n currentTheme,\n isFetchingSchema,\n };\n};\n\nexport default useThemeUtils;\n"],"names":["QUERY_KEYS","THEMES_LIST","THEME_DETAILS","SCHEMA_DETAILS","THEME_ENTITY_DETAILS","GLOBAL_THEME_DETAILS","useConfigStore","create","withImmutableActions","set","themePropertiesSchema","entityType","entityId","variableNamesMap","defaultThemeName","isFetchingSchema","isTemplateThemesEnabled","setConfigState","useThemeStore","currentTheme","isCurrentThemeLoading","previewingTheme","setThemeState","list","axios","get","concat","BASE_URL","schemasApi","useListSchema","useQuery","queryKey","queryFn","useThemeUtils","_useState","useState","_useState2","_slicedToArray","themeToBeApplied","setThemeToBeApplied","prop","_useThemeStore","store","shallow","_useListSchema","isLoading","data","_ref","_ref$schema","schema","_ref$variableNamesMap","useEffect","isNil","setThemeUtil","setVariable","name","value","setVariableUtil","setTheme"],"mappings":";;;;;;;;;;;;AAAO,IAAMA,UAAU,GAAG;AACxBC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,aAAa,EAAE,eAAe;AAC9BC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,oBAAoB,EAAE,sBAAsB;AAC5CC,EAAAA,oBAAoB,EAAE;AACxB;;ACHA;AACA,IAAMC,cAAc,GAAGC,cAAM,CAC3BC,+BAAoB,CAAC,UAAAC,GAAG,EAAA;EAAA,OAAK;AAC3BC,IAAAA,qBAAqB,EAAE,EAAE;AACzBC,IAAAA,UAAU,EAAE,EAAE;AACdC,IAAAA,QAAQ,EAAE,EAAE;IACZC,gBAAgB,EAAE,EAAE;AACpBC,IAAAA,gBAAgB,EAAE,YAAY;AAC9BC,IAAAA,gBAAgB,EAAE,IAAI;AACtBC,IAAAA,uBAAuB,EAAE,KAAK;AAE9BC,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EAAA,CAACA,gBAAgB,CAAC,CAAC;AAEzEoC,EAAAA,eAAS,CAAC,YAAM;AACd,IAAA,IAAIC,WAAK,CAACd,gBAAgB,CAAC,IAAIvB,gBAAgB,EAAE;AAEjDsC,IAAAA,cAAY,CAACf,gBAAgB,EAAEzB,gBAAgB,EAAEH,qBAAqB,CAAC;AACzE,GAAC,EAAE,CAAC4B,gBAAgB,EAAEvB,gBAAgB,CAAC,CAAC;AAExC,EAAA,IAAMuC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAAI,EAAEC,KAAK,EAAA;AAAA,IAAA,OAC9BC,iBAAe,CAACF,IAAI,EAAEC,KAAK,EAAE3C,gBAAgB,CAAC;AAAA,GAAA;EAEhD,OAAO;AACL6C,IAAAA,QAAQ,EAAEnB,mBAAmB;AAC7Be,IAAAA,WAAW,EAAXA,WAAW;AACXjC,IAAAA,eAAe,EAAfA,eAAe;AACfF,IAAAA,YAAY,EAAZA,YAAY;AACZJ,IAAAA,gBAAgB,EAAhBA;GACD;AACH;;;;;;;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
1
2
|
import { shallow } from 'zustand/shallow';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { prop } from 'ramda';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { prop, isNil } from 'ramda';
|
|
4
5
|
import { withImmutableActions } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
6
|
import { create } from 'zustand';
|
|
6
|
-
import { B as BASE_URL,
|
|
7
|
+
import { B as BASE_URL, s as setTheme, a as setVariable } from './index-i8lxlWVz.js';
|
|
7
8
|
import { useQuery } from '@tanstack/react-query';
|
|
8
9
|
import axios from 'axios';
|
|
9
10
|
|
|
@@ -54,6 +55,10 @@ var useListSchema = function useListSchema() {
|
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
var useThemeUtils = function useThemeUtils() {
|
|
58
|
+
var _useState = useState(null),
|
|
59
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
+
themeToBeApplied = _useState2[0],
|
|
61
|
+
setThemeToBeApplied = _useState2[1];
|
|
57
62
|
var setConfigState = useConfigStore(prop("setConfigState"));
|
|
58
63
|
var _useThemeStore = useThemeStore(function (store) {
|
|
59
64
|
return {
|
|
@@ -85,14 +90,15 @@ var useThemeUtils = function useThemeUtils() {
|
|
|
85
90
|
isFetchingSchema: isFetchingSchema
|
|
86
91
|
});
|
|
87
92
|
}, [isFetchingSchema]);
|
|
93
|
+
useEffect(function () {
|
|
94
|
+
if (isNil(themeToBeApplied) || isFetchingSchema) return;
|
|
95
|
+
setTheme(themeToBeApplied, variableNamesMap, themePropertiesSchema);
|
|
96
|
+
}, [themeToBeApplied, isFetchingSchema]);
|
|
88
97
|
var setVariable$1 = function setVariable$1(name, value) {
|
|
89
98
|
return setVariable(name, value, variableNamesMap);
|
|
90
99
|
};
|
|
91
|
-
var setTheme$1 = function setTheme$1(theme) {
|
|
92
|
-
return setTheme(theme, variableNamesMap, themePropertiesSchema);
|
|
93
|
-
};
|
|
94
100
|
return {
|
|
95
|
-
setTheme:
|
|
101
|
+
setTheme: setThemeToBeApplied,
|
|
96
102
|
setVariable: setVariable$1,
|
|
97
103
|
previewingTheme: previewingTheme,
|
|
98
104
|
currentTheme: currentTheme,
|
|
@@ -101,4 +107,4 @@ var useThemeUtils = function useThemeUtils() {
|
|
|
101
107
|
};
|
|
102
108
|
|
|
103
109
|
export { QUERY_KEYS as Q, useConfigStore as a, useThemeStore as b, useThemeUtils as u };
|
|
104
|
-
//# sourceMappingURL=useThemeUtils-
|
|
110
|
+
//# sourceMappingURL=useThemeUtils-CMF6rI88.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThemeUtils-CMF6rI88.js","sources":["../app/javascript/src/constants/query.js","../app/javascript/src/stores/useConfigStore.js","../app/javascript/src/stores/useThemeStore.js","../app/javascript/src/apis/schemas.js","../app/javascript/src/hooks/reactQuery/useSchemasApi.js","../app/javascript/src/hooks/useThemeUtils.js"],"sourcesContent":["export const QUERY_KEYS = {\n THEMES_LIST: \"themes-list\",\n THEME_DETAILS: \"theme-details\",\n SCHEMA_DETAILS: \"schema-details\",\n THEME_ENTITY_DETAILS: \"theme-entity-details\",\n GLOBAL_THEME_DETAILS: \"global-theme-details\",\n};\n","import { withImmutableActions } from \"neetocommons/react-utils\";\nimport { create } from \"zustand\";\n\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useConfigStore = create(\n withImmutableActions(set => ({\n themePropertiesSchema: [],\n entityType: \"\",\n entityId: \"\",\n variableNamesMap: {},\n defaultThemeName: \"Plain blue\",\n isFetchingSchema: true,\n isTemplateThemesEnabled: false,\n\n setConfigState: set,\n }))\n);\n\nexport default useConfigStore;\n","import { withImmutableActions } from \"neetocommons/react-utils\";\nimport { create } from \"zustand\";\n\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useThemeStore = create(\n withImmutableActions(set => ({\n currentTheme: {},\n isCurrentThemeLoading: true,\n previewingTheme: {},\n\n setThemeState: set,\n }))\n);\n\nexport default useThemeStore;\n","import axios from \"axios\";\n\nimport { BASE_URL } from \"src/constants\";\n\nconst list = () => axios.get(`${BASE_URL}/api/v1/schema`);\n\nconst schemasApi = { list };\n\nexport default schemasApi;\n","import { useQuery } from \"@tanstack/react-query\";\n\nimport schemasApi from \"apis/schemas\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useListSchema = () =>\n useQuery({\n queryKey: [QUERY_KEYS.SCHEMA_DETAILS],\n queryFn: schemasApi.list,\n });\n","import { useEffect, useState } from \"react\";\n\nimport { isNil, prop } from \"ramda\";\n\nimport useConfigStore from \"src/stores/useConfigStore\";\nimport useThemeStore from \"src/stores/useThemeStore\";\nimport {\n setVariable as setVariableUtil,\n setTheme as setThemeUtil,\n} from \"utils\";\n\nimport { useListSchema } from \"./reactQuery/useSchemasApi\";\n\nconst useThemeUtils = () => {\n const [themeToBeApplied, setThemeToBeApplied] = useState(null);\n const setConfigState = useConfigStore(prop(\"setConfigState\"));\n const { previewingTheme, currentTheme } = useThemeStore.pick();\n\n const { isLoading: isFetchingSchema, data } = useListSchema();\n\n const { schema: themePropertiesSchema = [], variableNamesMap = {} } =\n data || {};\n\n useEffect(() => {\n if (data) {\n setConfigState({\n themePropertiesSchema: data?.schema,\n variableNamesMap: data?.variableNamesMap,\n defaultThemeName: data?.defaultThemeName,\n });\n }\n }, [data]);\n\n useEffect(() => setConfigState({ isFetchingSchema }), [isFetchingSchema]);\n\n useEffect(() => {\n if (isNil(themeToBeApplied) || isFetchingSchema) return;\n\n setThemeUtil(themeToBeApplied, variableNamesMap, themePropertiesSchema);\n }, [themeToBeApplied, isFetchingSchema]);\n\n const setVariable = (name, value) =>\n setVariableUtil(name, value, variableNamesMap);\n\n return {\n setTheme: setThemeToBeApplied,\n setVariable,\n previewingTheme,\n currentTheme,\n isFetchingSchema,\n };\n};\n\nexport default useThemeUtils;\n"],"names":["QUERY_KEYS","THEMES_LIST","THEME_DETAILS","SCHEMA_DETAILS","THEME_ENTITY_DETAILS","GLOBAL_THEME_DETAILS","useConfigStore","create","withImmutableActions","set","themePropertiesSchema","entityType","entityId","variableNamesMap","defaultThemeName","isFetchingSchema","isTemplateThemesEnabled","setConfigState","useThemeStore","currentTheme","isCurrentThemeLoading","previewingTheme","setThemeState","list","axios","get","concat","BASE_URL","schemasApi","useListSchema","useQuery","queryKey","queryFn","useThemeUtils","_useState","useState","_useState2","_slicedToArray","themeToBeApplied","setThemeToBeApplied","prop","_useThemeStore","store","shallow","_useListSchema","isLoading","data","_ref","_ref$schema","schema","_ref$variableNamesMap","useEffect","isNil","setThemeUtil","setVariable","name","value","setVariableUtil","setTheme"],"mappings":";;;;;;;;;;AAAO,IAAMA,UAAU,GAAG;AACxBC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,aAAa,EAAE,eAAe;AA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4
|
"description": "A repo acts as the source of truth for the new nano's structure, configs, data etc.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://github.com/bigbinary/neeto-themes-nano",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
"@babel/runtime": "7.26.0",
|
|
63
63
|
"@bigbinary/babel-preset-neeto": "^1.0.3",
|
|
64
64
|
"@bigbinary/eslint-plugin-neeto": "1.5.6",
|
|
65
|
-
"@bigbinary/neeto-cist": "1.0.
|
|
66
|
-
"@bigbinary/neeto-commons-frontend": "4.12.
|
|
67
|
-
"@bigbinary/neeto-filters-frontend": "4.3.
|
|
68
|
-
"@bigbinary/neeto-icons": "1.20.
|
|
65
|
+
"@bigbinary/neeto-cist": "1.0.14",
|
|
66
|
+
"@bigbinary/neeto-commons-frontend": "4.12.6",
|
|
67
|
+
"@bigbinary/neeto-filters-frontend": "4.3.10",
|
|
68
|
+
"@bigbinary/neeto-icons": "1.20.21",
|
|
69
69
|
"@bigbinary/neeto-image-uploader-frontend": "2.3.11",
|
|
70
|
-
"@bigbinary/neeto-molecules": "3.
|
|
71
|
-
"@bigbinary/neetoui": "8.2.
|
|
70
|
+
"@bigbinary/neeto-molecules": "3.13.5",
|
|
71
|
+
"@bigbinary/neetoui": "8.2.42",
|
|
72
72
|
"@emotion/is-prop-valid": "1.2.0",
|
|
73
73
|
"@faker-js/faker": "8.2.0",
|
|
74
74
|
"@honeybadger-io/js": "6.10.1",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"@rollup/plugin-node-resolve": "15.3.0",
|
|
82
82
|
"@rollup/plugin-replace": "5.0.4",
|
|
83
83
|
"@svgr/rollup": "8.1.0",
|
|
84
|
+
"@tailwindcss/container-queries": "^0.1.1",
|
|
84
85
|
"@tanstack/react-query": "5.59.20",
|
|
85
86
|
"@tanstack/react-query-devtools": "5.59.20",
|
|
86
87
|
"antd": "5.22.0",
|
|
@@ -171,16 +172,17 @@
|
|
|
171
172
|
},
|
|
172
173
|
"peerDependencies": {
|
|
173
174
|
"@babel/runtime": "7.26.0",
|
|
174
|
-
"@bigbinary/neeto-cist": "1.0.
|
|
175
|
-
"@bigbinary/neeto-commons-frontend": "4.12.
|
|
176
|
-
"@bigbinary/neeto-filters-frontend": "4.3.
|
|
177
|
-
"@bigbinary/neeto-icons": "1.20.
|
|
175
|
+
"@bigbinary/neeto-cist": "1.0.14",
|
|
176
|
+
"@bigbinary/neeto-commons-frontend": "4.12.6",
|
|
177
|
+
"@bigbinary/neeto-filters-frontend": "4.3.10",
|
|
178
|
+
"@bigbinary/neeto-icons": "1.20.21",
|
|
178
179
|
"@bigbinary/neeto-image-uploader-frontend": "2.3.11",
|
|
179
|
-
"@bigbinary/neeto-molecules": "3.
|
|
180
|
-
"@bigbinary/neetoui": "8.2.
|
|
180
|
+
"@bigbinary/neeto-molecules": "3.13.5",
|
|
181
|
+
"@bigbinary/neetoui": "8.2.42",
|
|
181
182
|
"@honeybadger-io/js": "6.10.1",
|
|
182
183
|
"@honeybadger-io/react": "6.1.25",
|
|
183
184
|
"@monaco-editor/react": "4.6.0",
|
|
185
|
+
"@tailwindcss/container-queries": "^0.1.1",
|
|
184
186
|
"@tanstack/react-query": "5.59.20",
|
|
185
187
|
"@tanstack/react-query-devtools": "5.59.20",
|
|
186
188
|
"antd": "5.22.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeUtils-D6iAqGU2.js","sources":["../app/javascript/src/constants/query.js","../app/javascript/src/stores/useConfigStore.js","../app/javascript/src/stores/useThemeStore.js","../app/javascript/src/apis/schemas.js","../app/javascript/src/hooks/reactQuery/useSchemasApi.js","../app/javascript/src/hooks/useThemeUtils.js"],"sourcesContent":["export const QUERY_KEYS = {\n THEMES_LIST: \"themes-list\",\n THEME_DETAILS: \"theme-details\",\n SCHEMA_DETAILS: \"schema-details\",\n THEME_ENTITY_DETAILS: \"theme-entity-details\",\n GLOBAL_THEME_DETAILS: \"global-theme-details\",\n};\n","import { withImmutableActions } from \"neetocommons/react-utils\";\nimport { create } from \"zustand\";\n\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useConfigStore = create(\n withImmutableActions(set => ({\n themePropertiesSchema: [],\n entityType: \"\",\n entityId: \"\",\n variableNamesMap: {},\n defaultThemeName: \"Plain blue\",\n isFetchingSchema: true,\n isTemplateThemesEnabled: false,\n\n setConfigState: set,\n }))\n);\n\nexport default useConfigStore;\n","import { withImmutableActions } from \"neetocommons/react-utils\";\nimport { create } from \"zustand\";\n\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useThemeStore = create(\n withImmutableActions(set => ({\n currentTheme: {},\n isCurrentThemeLoading: true,\n previewingTheme: {},\n\n setThemeState: set,\n }))\n);\n\nexport default useThemeStore;\n","import axios from \"axios\";\n\nimport { BASE_URL } from \"src/constants\";\n\nconst list = () => axios.get(`${BASE_URL}/api/v1/schema`);\n\nconst schemasApi = { list };\n\nexport default schemasApi;\n","import { useQuery } from \"@tanstack/react-query\";\n\nimport schemasApi from \"apis/schemas\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useListSchema = () =>\n useQuery({\n queryKey: [QUERY_KEYS.SCHEMA_DETAILS],\n queryFn: schemasApi.list,\n });\n","import { useEffect } from \"react\";\n\nimport { prop } from \"ramda\";\n\nimport useConfigStore from \"src/stores/useConfigStore\";\nimport useThemeStore from \"src/stores/useThemeStore\";\nimport {\n setTheme as setThemeUtil,\n setVariable as setVariableUtil,\n} from \"utils\";\n\nimport { useListSchema } from \"./reactQuery/useSchemasApi\";\n\nconst useThemeUtils = () => {\n const setConfigState = useConfigStore(prop(\"setConfigState\"));\n const { previewingTheme, currentTheme } = useThemeStore.pick();\n\n const { isLoading: isFetchingSchema, data } = useListSchema();\n\n const { schema: themePropertiesSchema = [], variableNamesMap = {} } =\n data || {};\n\n useEffect(() => {\n if (data) {\n setConfigState({\n themePropertiesSchema: data?.schema,\n variableNamesMap: data?.variableNamesMap,\n defaultThemeName: data?.defaultThemeName,\n });\n }\n }, [data]);\n\n useEffect(() => setConfigState({ isFetchingSchema }), [isFetchingSchema]);\n\n const setVariable = (name, value) =>\n setVariableUtil(name, value, variableNamesMap);\n\n const setTheme = theme =>\n setThemeUtil(theme, variableNamesMap, themePropertiesSchema);\n\n return {\n setTheme,\n setVariable,\n previewingTheme,\n currentTheme,\n isFetchingSchema,\n };\n};\n\nexport default useThemeUtils;\n"],"names":["QUERY_KEYS","THEMES_LIST","THEME_DETAILS","SCHEMA_DETAILS","THEME_ENTITY_DETAILS","GLOBAL_THEME_DETAILS","useConfigStore","create","withImmutableActions","set","themePropertiesSchema","entityType","entityId","variableNamesMap","defaultThemeName","isFetchingSchema","isTemplateThemesEnabled","setConfigState","useThemeStore","currentTheme","isCurrentThemeLoading","previewingTheme","setThemeState","list","axios","get","concat","BASE_URL","schemasApi","useListSchema","useQuery","queryKey","queryFn","useThemeUtils","prop","_useThemeStore","store","shallow","_useListSchema","isLoading","data","_ref","_ref$schema","schema","_ref$variableNamesMap","useEffect","setVariable","name","value","setVariableUtil","setTheme","theme","setThemeUtil"],"mappings":";;;;;;;;;;;AAAO,IAAMA,UAAU,GAAG;AACxBC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,aAAa,EAAE,eAAe;AAC9BC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,oBAAoB,EAAE,sBAAsB;AAC5CC,EAAAA,oBAAoB,EAAE;AACxB;;ACHA;AACA,IAAMC,cAAc,GAAGC,cAAM,CAC3BC,+BAAoB,CAAC,UAAAC,GAAG,EAAA;EAAA,OAAK;AAC3BC,IAAAA,qBAAqB,EAAE,EAAE;AACzBC,IAAAA,UAAU,EAAE,EAAE;AACdC,IAAAA,QAAQ,EAAE,EAAE;IACZC,gBAAgB,EAAE,EAAE;AACpBC,IAAAA,gBAAgB,EAAE,YAAY;AAC9BC,IAAAA,gBAAgB,EAAE,IAAI;AACtBC,IAAAA,uBAAuB,EAAE,KAAK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C,QAAQ,GAAG,SAAXA,QAAQA,CAAGC,KAAK,EAAA;AAAA,IAAA,OACpBC,cAAY,CAACD,KAAK,EAAEtC,gBAAgB,EAAEH,qBAAqB,CAAC;AAAA,GAAA;EAE9D,OAAO;AACLwC,IAAAA,QAAQ,EAARA,QAAQ;AACRJ,IAAAA,WAAW,EAAXA,WAAW;AACXzB,IAAAA,eAAe,EAAfA,eAAe;AACfF,IAAAA,YAAY,EAAZA,YAAY;AACZJ,IAAAA,gBAAgB,EAAhBA;GACD;AACH;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeUtils-DbsrDPEp.js","sources":["../app/javascript/src/constants/query.js","../app/javascript/src/stores/useConfigStore.js","../app/javascript/src/stores/useThemeStore.js","../app/javascript/src/apis/schemas.js","../app/javascript/src/hooks/reactQuery/useSchemasApi.js","../app/javascript/src/hooks/useThemeUtils.js"],"sourcesContent":["export const QUERY_KEYS = {\n THEMES_LIST: \"themes-list\",\n THEME_DETAILS: \"theme-details\",\n SCHEMA_DETAILS: \"schema-details\",\n THEME_ENTITY_DETAILS: \"theme-entity-details\",\n GLOBAL_THEME_DETAILS: \"global-theme-details\",\n};\n","import { withImmutableActions } from \"neetocommons/react-utils\";\nimport { create } from \"zustand\";\n\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useConfigStore = create(\n withImmutableActions(set => ({\n themePropertiesSchema: [],\n entityType: \"\",\n entityId: \"\",\n variableNamesMap: {},\n defaultThemeName: \"Plain blue\",\n isFetchingSchema: true,\n isTemplateThemesEnabled: false,\n\n setConfigState: set,\n }))\n);\n\nexport default useConfigStore;\n","import { withImmutableActions } from \"neetocommons/react-utils\";\nimport { create } from \"zustand\";\n\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useThemeStore = create(\n withImmutableActions(set => ({\n currentTheme: {},\n isCurrentThemeLoading: true,\n previewingTheme: {},\n\n setThemeState: set,\n }))\n);\n\nexport default useThemeStore;\n","import axios from \"axios\";\n\nimport { BASE_URL } from \"src/constants\";\n\nconst list = () => axios.get(`${BASE_URL}/api/v1/schema`);\n\nconst schemasApi = { list };\n\nexport default schemasApi;\n","import { useQuery } from \"@tanstack/react-query\";\n\nimport schemasApi from \"apis/schemas\";\nimport { QUERY_KEYS } from \"src/constants/query\";\n\nexport const useListSchema = () =>\n useQuery({\n queryKey: [QUERY_KEYS.SCHEMA_DETAILS],\n queryFn: schemasApi.list,\n });\n","import { useEffect } from \"react\";\n\nimport { prop } from \"ramda\";\n\nimport useConfigStore from \"src/stores/useConfigStore\";\nimport useThemeStore from \"src/stores/useThemeStore\";\nimport {\n setTheme as setThemeUtil,\n setVariable as setVariableUtil,\n} from \"utils\";\n\nimport { useListSchema } from \"./reactQuery/useSchemasApi\";\n\nconst useThemeUtils = () => {\n const setConfigState = useConfigStore(prop(\"setConfigState\"));\n const { previewingTheme, currentTheme } = useThemeStore.pick();\n\n const { isLoading: isFetchingSchema, data } = useListSchema();\n\n const { schema: themePropertiesSchema = [], variableNamesMap = {} } =\n data || {};\n\n useEffect(() => {\n if (data) {\n setConfigState({\n themePropertiesSchema: data?.schema,\n variableNamesMap: data?.variableNamesMap,\n defaultThemeName: data?.defaultThemeName,\n });\n }\n }, [data]);\n\n useEffect(() => setConfigState({ isFetchingSchema }), [isFetchingSchema]);\n\n const setVariable = (name, value) =>\n setVariableUtil(name, value, variableNamesMap);\n\n const setTheme = theme =>\n setThemeUtil(theme, variableNamesMap, themePropertiesSchema);\n\n return {\n setTheme,\n setVariable,\n previewingTheme,\n currentTheme,\n isFetchingSchema,\n };\n};\n\nexport default useThemeUtils;\n"],"names":["QUERY_KEYS","THEMES_LIST","THEME_DETAILS","SCHEMA_DETAILS","THEME_ENTITY_DETAILS","GLOBAL_THEME_DETAILS","useConfigStore","create","withImmutableActions","set","themePropertiesSchema","entityType","entityId","variableNamesMap","defaultThemeName","isFetchingSchema","isTemplateThemesEnabled","setConfigState","useThemeStore","currentTheme","isCurrentThemeLoading","previewingTheme","setThemeState","list","axios","get","concat","BASE_URL","schemasApi","useListSchema","useQuery","queryKey","queryFn","useThemeUtils","prop","_useThemeStore","store","shallow","_useListSchema","isLoading","data","_ref","_ref$schema","schema","_ref$variableNamesMap","useEffect","setVariable","name","value","setVariableUtil","setTheme","theme","setThemeUtil"],"mappings":";;;;;;;;;AAAO,IAAMA,UAAU,GAAG;AACxBC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,aAAa,EAAE,eAAe;AAC9BC,EAAAA,cAAc,EAAE,gBAAgB;AAChCC,EAAAA,oBAAoB,EAAE,sBAAsB;AAC5CC,EAAAA,oBAAoB,EAAE;AACxB;;ACHA;AACA,IAAMC,cAAc,GAAGC,MAAM,CAC3BC,oBAAoB,CAAC,UAAAC,GAAG,EAAA;EAAA,OAAK;AAC3BC,IAAAA,qBAAqB,EAAE,EAAE;AACzBC,IAAAA,UAAU,EAAE,EAAE;AACdC,IAAAA,QAAQ,EAAE,EAAE;IACZC,gBAAgB,EAAE,EAAE;AACpBC,IAAAA,gBAAgB,EAAE,YAAY;AAC9BC,IAAAA,gBAAgB,EAAE,IAAI;AACtBC,IAAAA,uBAAuB,EAAE,KAAK;AAE9BC,IAAAA,cAAc,EAAER;GACjB;AAAA,CAAC,CACJ;;ACbA;AACA,IAAMS,aAAa,GAAGX,MAAM,CAC1BC,oBAAoB,CAAC,UAAAC,GAAG,EAAA;EAAA,OAAK;IAC3BU,YAAY,EAAE,EAAE;AAChBC,IAAAA,qBAAqB,EAAE,IAAI;IAC3BC,eAAe,EAAE,EAAE;AAEnBC,IAAAA,aAAa,EAAEb;GAChB;AAAA,CAAC,CACJ;;ACRA,IAAMc,IAAI,GAAG,SAAPA,IAAIA,GAAA;EAAA,OAASC,KAAK,CAACC,GAAG,CAAA,EAAA,CAAAC,MAAA,CAAIC,QAAQ,mBAAgB,CAAC;AAAA,CAAA;AAEzD,IAAMC,UAAU,GAAG;AAAEL,EAAAA,IAAI,EAAJA;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