@admin-layout/client 11.0.4-alpha.4 → 12.0.16-alpha.2

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.
Files changed (162) hide show
  1. package/lib/{antd-themes/colors.d.ts → colors/colorsList.d.ts} +1 -1
  2. package/lib/colors/colorsList.d.ts.map +1 -0
  3. package/lib/{antd-themes/colors.js → colors/colorsList.js} +1 -1
  4. package/lib/colors/colorsList.js.map +1 -0
  5. package/lib/colors/index.d.ts +1 -0
  6. package/lib/colors/index.d.ts.map +1 -1
  7. package/lib/colors/presets/brinkPink.js +11 -0
  8. package/lib/colors/presets/brinkPink.js.map +1 -0
  9. package/lib/colors/presets/cyan.js +11 -0
  10. package/lib/colors/presets/cyan.js.map +1 -0
  11. package/lib/colors/presets/lime.js +11 -0
  12. package/lib/colors/presets/lime.js.map +1 -0
  13. package/lib/colors/presets/pink.js +11 -0
  14. package/lib/colors/presets/pink.js.map +1 -0
  15. package/lib/colors/presets/purple.js +11 -0
  16. package/lib/colors/presets/purple.js.map +1 -0
  17. package/lib/colors/presets/skyBlue.js +11 -0
  18. package/lib/colors/presets/skyBlue.js.map +1 -0
  19. package/lib/colors/presets/turquoise.js +11 -0
  20. package/lib/colors/presets/turquoise.js.map +1 -0
  21. package/lib/components/ApplicationErrorFillWrapper.d.ts.map +1 -1
  22. package/lib/components/ApplicationErrorHandlerCommon.d.ts.map +1 -1
  23. package/lib/components/LayoutCookieProvider.d.ts.map +1 -1
  24. package/lib/components/LayoutCookieProvider.js +15 -9
  25. package/lib/components/LayoutCookieProvider.js.map +1 -1
  26. package/lib/components/UpdateSettings/SettingsConfigurationModel.test.d.ts +2 -0
  27. package/lib/components/UpdateSettings/SettingsConfigurationModel.test.d.ts.map +1 -0
  28. package/lib/components/UpdateSettings/UpdateSettings.server.d.ts +24 -0
  29. package/lib/components/UpdateSettings/UpdateSettings.server.d.ts.map +1 -0
  30. package/lib/components/UpdateSettings/UpdateSettings.server.js +121 -28
  31. package/lib/components/UpdateSettings/UpdateSettings.server.js.map +1 -1
  32. package/lib/config/defaultSettings.d.ts +108 -1
  33. package/lib/config/defaultSettings.d.ts.map +1 -1
  34. package/lib/config/defaultSettings.js +160 -15
  35. package/lib/config/defaultSettings.js.map +1 -1
  36. package/lib/config/env-config.d.ts.map +1 -1
  37. package/lib/config/env-config.js +11 -4
  38. package/lib/config/env-config.js.map +1 -1
  39. package/lib/graphql/link/error-link.d.ts.map +1 -1
  40. package/lib/graphql/link/error-link.js.map +1 -1
  41. package/lib/hooks/Client-only.d.ts +28 -0
  42. package/lib/hooks/Client-only.d.ts.map +1 -0
  43. package/lib/hooks/Client-only.js +18 -0
  44. package/lib/hooks/Client-only.js.map +1 -0
  45. package/lib/hooks/hooks.d.ts +4 -0
  46. package/lib/hooks/hooks.d.ts.map +1 -0
  47. package/lib/hooks/index.d.ts +1 -0
  48. package/lib/hooks/index.d.ts.map +1 -1
  49. package/lib/hooks/use-hydrated.d.ts +19 -0
  50. package/lib/hooks/use-hydrated.d.ts.map +1 -0
  51. package/lib/hooks/use-hydrated.js +24 -0
  52. package/lib/hooks/use-hydrated.js.map +1 -0
  53. package/lib/hooks/useLayoutSettings.d.ts +1 -0
  54. package/lib/hooks/useLayoutSettings.d.ts.map +1 -1
  55. package/lib/hooks/useLayoutSettings.js +21 -26
  56. package/lib/hooks/useLayoutSettings.js.map +1 -1
  57. package/lib/index.d.ts +1 -1
  58. package/lib/index.d.ts.map +1 -1
  59. package/lib/index.js +1 -1
  60. package/lib/index.native.js +1 -1
  61. package/lib/interfaces/default-settings.d.ts +1 -0
  62. package/lib/interfaces/default-settings.d.ts.map +1 -1
  63. package/lib/interfaces/index.d.ts +2 -0
  64. package/lib/interfaces/index.d.ts.map +1 -1
  65. package/lib/interfaces/pure-settings.d.ts +9 -1
  66. package/lib/interfaces/pure-settings.d.ts.map +1 -1
  67. package/lib/interfaces/searchbar-settings.d.ts +61 -0
  68. package/lib/interfaces/searchbar-settings.d.ts.map +1 -0
  69. package/lib/interfaces/settings.d.ts +166 -0
  70. package/lib/interfaces/settings.d.ts.map +1 -0
  71. package/lib/interfaces/settings.js +5 -0
  72. package/lib/interfaces/settings.js.map +1 -0
  73. package/lib/redux/actions/error-actions.d.ts.map +1 -1
  74. package/lib/redux/reducers/settings.d.ts.map +1 -1
  75. package/lib/redux/reducers/settings.js +3 -7
  76. package/lib/redux/reducers/settings.js.map +1 -1
  77. package/lib/redux/store.js +1 -1
  78. package/lib/themes/templates/darkLayoutTheme.d.ts +1 -1
  79. package/lib/themes/templates/darkLayoutTheme.d.ts.map +1 -1
  80. package/lib/utils/assignDefaults.d.ts +11 -0
  81. package/lib/utils/assignDefaults.d.ts.map +1 -0
  82. package/lib/utils/assignDefaults.js +166 -0
  83. package/lib/utils/assignDefaults.js.map +1 -0
  84. package/lib/utils/assignDefaults.test.d.ts +2 -0
  85. package/lib/utils/assignDefaults.test.d.ts.map +1 -0
  86. package/lib/utils/generateMenuLink.d.ts.map +1 -1
  87. package/lib/utils/generateMenuLink.js +13 -1
  88. package/lib/utils/generateMenuLink.js.map +1 -1
  89. package/lib/utils/generateMenuLink.test.d.ts +2 -0
  90. package/lib/utils/generateMenuLink.test.d.ts.map +1 -0
  91. package/lib/utils/index.d.ts +1 -1
  92. package/lib/utils/index.d.ts.map +1 -1
  93. package/lib/utils/matchMenuKeys.d.ts.map +1 -1
  94. package/lib/utils/matchMenuKeys.js.map +1 -1
  95. package/lib/utils/menuUtils.d.ts.map +1 -1
  96. package/lib/utils/menuUtils.js.map +1 -1
  97. package/lib/utils/parentRoute.d.ts.map +1 -1
  98. package/lib/utils/settingsDiff.test.d.ts +2 -0
  99. package/lib/utils/settingsDiff.test.d.ts.map +1 -0
  100. package/lib/utils/settingsDifference.d.ts +5 -0
  101. package/lib/utils/settingsDifference.d.ts.map +1 -0
  102. package/lib/utils/settingsDifference.js +207 -0
  103. package/lib/utils/settingsDifference.js.map +1 -0
  104. package/lib/utils/settingsDifference.test.d.ts +2 -0
  105. package/lib/utils/settingsDifference.test.d.ts.map +1 -0
  106. package/package.json +5 -4
  107. package/lib/antd-themes/ThemeProvider.d.ts +0 -10
  108. package/lib/antd-themes/ThemeProvider.d.ts.map +0 -1
  109. package/lib/antd-themes/ThemeProvider.js +0 -34
  110. package/lib/antd-themes/ThemeProvider.js.map +0 -1
  111. package/lib/antd-themes/airbnb-dark-theme.d.ts +0 -2
  112. package/lib/antd-themes/airbnb-dark-theme.d.ts.map +0 -1
  113. package/lib/antd-themes/airbnb-dark-theme.js +0 -168
  114. package/lib/antd-themes/airbnb-dark-theme.js.map +0 -1
  115. package/lib/antd-themes/airbnb-light-theme.d.ts +0 -230
  116. package/lib/antd-themes/airbnb-light-theme.d.ts.map +0 -1
  117. package/lib/antd-themes/airbnb-light-theme.js +0 -168
  118. package/lib/antd-themes/airbnb-light-theme.js.map +0 -1
  119. package/lib/antd-themes/colors.d.ts.map +0 -1
  120. package/lib/antd-themes/colors.js.map +0 -1
  121. package/lib/antd-themes/default-dark-theme.d.ts +0 -2
  122. package/lib/antd-themes/default-dark-theme.d.ts.map +0 -1
  123. package/lib/antd-themes/default-dark-theme.js +0 -136
  124. package/lib/antd-themes/default-dark-theme.js.map +0 -1
  125. package/lib/antd-themes/default-light-theme.d.ts +0 -199
  126. package/lib/antd-themes/default-light-theme.d.ts.map +0 -1
  127. package/lib/antd-themes/default-light-theme.js +0 -136
  128. package/lib/antd-themes/default-light-theme.js.map +0 -1
  129. package/lib/antd-themes/github-dark-theme.d.ts +0 -2
  130. package/lib/antd-themes/github-dark-theme.d.ts.map +0 -1
  131. package/lib/antd-themes/github-dark-theme.js +0 -168
  132. package/lib/antd-themes/github-dark-theme.js.map +0 -1
  133. package/lib/antd-themes/github-light-theme.d.ts +0 -230
  134. package/lib/antd-themes/github-light-theme.d.ts.map +0 -1
  135. package/lib/antd-themes/github-light-theme.js +0 -168
  136. package/lib/antd-themes/github-light-theme.js.map +0 -1
  137. package/lib/antd-themes/index.d.ts +0 -14
  138. package/lib/antd-themes/index.d.ts.map +0 -1
  139. package/lib/antd-themes/slack-dark-theme.d.ts +0 -2
  140. package/lib/antd-themes/slack-dark-theme.d.ts.map +0 -1
  141. package/lib/antd-themes/slack-dark-theme.js +0 -167
  142. package/lib/antd-themes/slack-dark-theme.js.map +0 -1
  143. package/lib/antd-themes/slack-light-theme.d.ts +0 -229
  144. package/lib/antd-themes/slack-light-theme.d.ts.map +0 -1
  145. package/lib/antd-themes/slack-light-theme.js +0 -167
  146. package/lib/antd-themes/slack-light-theme.js.map +0 -1
  147. package/lib/antd-themes/spotify-dark-theme.d.ts +0 -2
  148. package/lib/antd-themes/spotify-dark-theme.d.ts.map +0 -1
  149. package/lib/antd-themes/spotify-dark-theme.js +0 -168
  150. package/lib/antd-themes/spotify-dark-theme.js.map +0 -1
  151. package/lib/antd-themes/spotify-light-theme.d.ts +0 -230
  152. package/lib/antd-themes/spotify-light-theme.d.ts.map +0 -1
  153. package/lib/antd-themes/spotify-light-theme.js +0 -168
  154. package/lib/antd-themes/spotify-light-theme.js.map +0 -1
  155. package/lib/antd-themes/themeRegistry.d.ts +0 -2
  156. package/lib/antd-themes/themeRegistry.d.ts.map +0 -1
  157. package/lib/antd-themes/themeRegistry.js +0 -12
  158. package/lib/antd-themes/themeRegistry.js.map +0 -1
  159. package/lib/utils/getAntdLocale.d.ts +0 -3
  160. package/lib/utils/getAntdLocale.d.ts.map +0 -1
  161. package/lib/utils/getAntdLocale.js +0 -18
  162. package/lib/utils/getAntdLocale.js.map +0 -1
@@ -0,0 +1,207 @@
1
+ import {cloneDeep,get,isObject,isEqual,transform}from'lodash-es';/**
2
+ * Gets the deep differences between two objects
3
+ * Returns only the values that differ from obj2
4
+ */
5
+ const getDifference = (obj1, obj2) => {
6
+ // Create copies to avoid modifying the original objects
7
+ const source = cloneDeep(obj1);
8
+ const target = cloneDeep(obj2);
9
+ // If obj1 is undefined or null, return undefined to avoid adding to result
10
+ if (source === undefined || source === null) {
11
+ // Only include null/undefined if they differ from obj2
12
+ return source !== target ? source : undefined;
13
+ }
14
+ // If we're comparing different types, or if obj2 is null/undefined, return obj1
15
+ if (typeof source !== typeof target || target === undefined || target === null) {
16
+ return source;
17
+ }
18
+ // Handle non-object comparisons (primitives, functions, etc.)
19
+ if (!isObject(source) || !isObject(target)) {
20
+ // Case-insensitive string comparison
21
+ if (typeof source === 'string' && typeof target === 'string') {
22
+ return source.toLowerCase() !== target.toLowerCase() ? source : undefined;
23
+ }
24
+ return !isEqual(source, target) ? source : undefined;
25
+ }
26
+ // For arrays, do a simple equality check and return the full array if different
27
+ if (Array.isArray(source) && Array.isArray(target)) {
28
+ return !isEqual(source, target) ? source : undefined;
29
+ }
30
+ // For objects, do deep comparison
31
+ const result = transform(source, (result, value, key) => {
32
+ // Skip keys that are in source but have the exact same value in target
33
+ if (key in target && isEqual(value, target[key])) {
34
+ return;
35
+ }
36
+ // If the key doesn't exist in target, add it to the result
37
+ if (!(key in target)) {
38
+ result[key] = value;
39
+ return;
40
+ }
41
+ // For nested objects, recursively get differences
42
+ if (isObject(value) && isObject(target[key])) {
43
+ const nestedDiff = getDifference(value, target[key]);
44
+ if (nestedDiff !== undefined && (Array.isArray(nestedDiff) || Object.keys(nestedDiff).length > 0)) {
45
+ result[key] = nestedDiff;
46
+ }
47
+ return;
48
+ }
49
+ // For non-objects (primitives, etc.), only add if different
50
+ if (!isEqual(value, target[key])) {
51
+ result[key] = value;
52
+ }
53
+ });
54
+ // Return undefined if the resulting object is empty
55
+ return Object.keys(result).length > 0 ? result : undefined;
56
+ };
57
+ /**
58
+ * Special handler for route settings differences with improved nested comparison
59
+ */
60
+ const getRouteSettingsDifferences = (currentRouteSettings, defaultRouteSettings) => {
61
+ const differences = {};
62
+ // Get the default route template (typically from '/')
63
+ const defaultRouteTemplate = defaultRouteSettings['/'] || Object.values(defaultRouteSettings)[0];
64
+ if (!defaultRouteTemplate) {
65
+ console.warn('No default route template found for comparison');
66
+ return currentRouteSettings;
67
+ }
68
+ // Compare each route's settings
69
+ Object.keys(currentRouteSettings).forEach((route) => {
70
+ const currentRouteConfig = currentRouteSettings[route];
71
+ // Use the specific route config if it exists, otherwise use the default template
72
+ const defaultRouteConfig = defaultRouteSettings[route] || defaultRouteTemplate;
73
+ // Compare each section separately (layout, regions, etc)
74
+ const routeDiff = {};
75
+ Object.keys(currentRouteConfig).forEach((section) => {
76
+ if (section === 'layout' || section === 'regions') {
77
+ const sectionDiff = {};
78
+ // Compare desktop and mobile separately
79
+ ['desktop', 'mobile'].forEach((device) => {
80
+ if (!currentRouteConfig[section][device]) {
81
+ return;
82
+ }
83
+ // For regions section with header/footer/background
84
+ if (section === 'regions') {
85
+ const regionsDiff = {};
86
+ ['header', 'footer', 'background'].forEach((region) => {
87
+ if (!currentRouteConfig[section][device][region]) {
88
+ return;
89
+ }
90
+ // Get default path for comparison
91
+ const defaultRegionPath = `${section}.${device}.${region}`;
92
+ const defaultRegion = get(defaultRouteConfig, defaultRegionPath);
93
+ if (defaultRegion) {
94
+ const regionDiff = getDifference(currentRouteConfig[section][device][region], defaultRegion);
95
+ if (regionDiff !== undefined &&
96
+ (Array.isArray(regionDiff) || Object.keys(regionDiff).length > 0)) {
97
+ regionsDiff[region] = regionDiff;
98
+ }
99
+ }
100
+ });
101
+ if (Object.keys(regionsDiff).length > 0) {
102
+ sectionDiff[device] = regionsDiff;
103
+ }
104
+ }
105
+ else {
106
+ // For other sections (like layout)
107
+ const defaultDevicePath = `${section}.${device}`;
108
+ const defaultDevice = get(defaultRouteConfig, defaultDevicePath);
109
+ if (defaultDevice) {
110
+ const deviceDiff = getDifference(currentRouteConfig[section][device], defaultDevice);
111
+ if (deviceDiff !== undefined && Object.keys(deviceDiff).length > 0) {
112
+ sectionDiff[device] = deviceDiff;
113
+ }
114
+ }
115
+ }
116
+ });
117
+ if (Object.keys(sectionDiff).length > 0) {
118
+ routeDiff[section] = sectionDiff;
119
+ }
120
+ }
121
+ else {
122
+ const sectionDiff = getDifference(currentRouteConfig[section], defaultRouteConfig[section]);
123
+ if (sectionDiff !== undefined && Object.keys(sectionDiff).length > 0) {
124
+ routeDiff[section] = sectionDiff;
125
+ }
126
+ }
127
+ });
128
+ // Only include the route if there are actual differences
129
+ if (Object.keys(routeDiff).length > 0) {
130
+ differences[route] = routeDiff;
131
+ }
132
+ });
133
+ return Object.keys(differences).length > 0 ? differences : undefined;
134
+ };
135
+ /**
136
+ * Compares settings objects and saves only the differences
137
+ */
138
+ const compareAndSaveSettingsDifferences = (currentSettings, defaultSettings) => {
139
+ try {
140
+ if (!currentSettings || !defaultSettings) {
141
+ console.warn('Missing settings objects for comparison');
142
+ return null;
143
+ }
144
+ // Make deep clones to avoid modifying the original objects
145
+ const current = cloneDeep(currentSettings);
146
+ const defaults = cloneDeep(defaultSettings);
147
+ // Handle route settings separately
148
+ const routeSettingsDiff = current.routeSettings
149
+ ? getRouteSettingsDifferences(current.routeSettings, defaults?.routeSettings || {})
150
+ : undefined;
151
+ // Make a copy of settings without routeSettings to compare separately
152
+ const currentWithoutRoutes = { ...current };
153
+ const defaultWithoutRoutes = { ...defaults };
154
+ delete currentWithoutRoutes.routeSettings;
155
+ delete defaultWithoutRoutes.routeSettings;
156
+ // Get differences for all other settings
157
+ const otherSettingsDiff = getDifference(currentWithoutRoutes, defaultWithoutRoutes);
158
+ // Combine the differences
159
+ const diffSettings = {};
160
+ // Add other settings differences if any exist and are not empty objects
161
+ if (otherSettingsDiff && Object.keys(otherSettingsDiff).length > 0) {
162
+ Object.assign(diffSettings, otherSettingsDiff);
163
+ }
164
+ // Add route settings differences if any exist
165
+ if (routeSettingsDiff && Object.keys(routeSettingsDiff).length > 0) {
166
+ diffSettings.routeSettings = routeSettingsDiff;
167
+ }
168
+ // If there are no differences at all, return early
169
+ if (Object.keys(diffSettings).length === 0) {
170
+ return {};
171
+ }
172
+ // Remove empty objects from the diff
173
+ // This helps prevent unnecessary properties in the payload
174
+ const cleanDiffSettings = removeEmptyObjects(diffSettings);
175
+ return cleanDiffSettings;
176
+ }
177
+ catch (error) {
178
+ console.error('Error comparing settings differences:', error);
179
+ return null;
180
+ }
181
+ };
182
+ /**
183
+ * Recursively removes empty objects from an object
184
+ * This helps clean up the diff payload
185
+ */
186
+ function removeEmptyObjects(obj) {
187
+ if (!isObject(obj) || Array.isArray(obj)) {
188
+ return obj;
189
+ }
190
+ const result = {};
191
+ let hasKeys = false;
192
+ Object.keys(obj).forEach((key) => {
193
+ const value = obj[key];
194
+ if (isObject(value) && !Array.isArray(value)) {
195
+ const cleanValue = removeEmptyObjects(value);
196
+ if (Object.keys(cleanValue).length > 0) {
197
+ result[key] = cleanValue;
198
+ hasKeys = true;
199
+ }
200
+ }
201
+ else if (value !== undefined) {
202
+ result[key] = value;
203
+ hasKeys = true;
204
+ }
205
+ });
206
+ return hasKeys ? result : {};
207
+ }export{compareAndSaveSettingsDifferences};//# sourceMappingURL=settingsDifference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsDifference.js","sources":["../../src/utils/settingsDifference.ts"],"sourcesContent":[null],"names":[],"mappings":";AAyKG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=settingsDifference.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settingsDifference.test.d.ts","sourceRoot":"","sources":["../../src/utils/settingsDifference.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admin-layout/client",
3
- "version": "11.0.4-alpha.4",
3
+ "version": "12.0.16-alpha.2",
4
4
  "description": "Sample client for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -19,11 +19,12 @@
19
19
  "test": "cross-env ENV_FILE=../../config/test/test.env jest",
20
20
  "test:debug": "npm test -- --runInBand",
21
21
  "test:watch": "npm test -- --watch",
22
+ "vitest": "cross-env ENV_FILE=../../config/test/test.env vitest",
22
23
  "watch": "yarn build:lib:watch"
23
24
  },
24
25
  "dependencies": {
25
- "@common-stack/client-core": "8.0.2-alpha.0",
26
- "common": "11.0.4-alpha.4",
26
+ "@common-stack/client-core": "7.1.1-alpha.32",
27
+ "common": "10.1.1-alpha.28",
27
28
  "serialize-error": "^8.0.0"
28
29
  },
29
30
  "peerDependencies": {
@@ -39,5 +40,5 @@
39
40
  "typescript": {
40
41
  "definition": "lib/index.d.ts"
41
42
  },
42
- "gitHead": "eff06b5e432bf05a97fdd61eb30af62ad219b617"
43
+ "gitHead": "f048296e4be0a0dc1c85237ac29b90089a933f0f"
43
44
  }
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { ISettings } from '../config/defaultSettings';
3
- interface ThemeProviderProps {
4
- settings: ISettings;
5
- children: React.ReactNode;
6
- }
7
- export declare const getTheme: any;
8
- export declare const ThemeProvider: React.FC<ThemeProviderProps>;
9
- export {};
10
- //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/antd-themes/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,UAAU,kBAAkB;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,eAAO,MAAM,QAAQ,EAAE,GAQtB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgCtD,CAAC"}
@@ -1,34 +0,0 @@
1
- import {jsx}from'react/jsx-runtime';import {ConfigProvider}from'antd';import {themeRegistry}from'./themeRegistry.js';const getTheme = (themeType, themeName) => {
2
- const key = `${themeName}${themeType === 'realDark' ? 'Dark' : 'Light'}Theme`;
3
- if (key in themeRegistry) {
4
- return themeRegistry[key];
5
- }
6
- else {
7
- return themeRegistry?.defaultLightTheme;
8
- }
9
- };
10
- const ThemeProvider = ({ settings, children }) => {
11
- const { theme, themeType } = settings;
12
- const selectedTheme = getTheme(themeType, theme);
13
- const applyScopedStyles = (components) => {
14
- selectedTheme?.scopes?.forEach((scope) => {
15
- scope.scope.forEach((componentName) => {
16
- if (!components[componentName]) {
17
- components[componentName] = {};
18
- }
19
- Object.assign(components[componentName], scope.settings);
20
- });
21
- });
22
- return components;
23
- };
24
- return (jsx(ConfigProvider, { theme: {
25
- algorithm: selectedTheme?.algorithm,
26
- token: selectedTheme?.token,
27
- components: {
28
- ...applyScopedStyles(selectedTheme?.components || {}),
29
- Layout: {
30
- siderBg: settings?.themeType == 'dark' ? `${settings?.siderBgColor} !important` : null,
31
- },
32
- },
33
- }, children: children }));
34
- };export{ThemeProvider,getTheme};//# sourceMappingURL=ThemeProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemeProvider.js","sources":["../../src/antd-themes/ThemeProvider.tsx"],"sourcesContent":[null],"names":[],"mappings":"qHAMY,MAAA,WAAY,CAAA,SAAA,EAAA,SAAA,KAAA;AACpB,IAAA,MAAA,GAAU,GAAA,CAAA,EAAK,SAAC,CAAS,EAAC,SAAA,KAAA,UAAA,GAAA,MAAA,GAAA,OAAA,CAAA,KAAA,CAAA;AAC7B,IAAA,IAAA,GAAA,IAAA,aAAA,EAAA;AAED,QAAA,OAAO,aAAM,CAAQ,GAAE,CAAA;AAUvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- export declare const airbnbDarkTheme: any;
2
- //# sourceMappingURL=airbnb-dark-theme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"airbnb-dark-theme.d.ts","sourceRoot":"","sources":["../../src/antd-themes/airbnb-dark-theme.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,eAAe,EAAE,GAsK7B,CAAC"}
@@ -1,168 +0,0 @@
1
- import {theme}from'antd';const { defaultAlgorithm, darkAlgorithm } = theme;
2
- const airbnbDarkTheme = {
3
- algorithm: darkAlgorithm,
4
- token: {
5
- colorPrimary: '#FF385C',
6
- colorBgContainer: '#121212',
7
- colorText: '#E0E0E0',
8
- colorTextSecondary: '#A0A0A0',
9
- fontFamily: 'Circular, -apple-system, BlinkMacSystemFont, Roboto, Helvetica Neue, sans-serif',
10
- borderRadius: 8,
11
- colorLink: '#00A699',
12
- colorLinkHover: '#00C2B3',
13
- colorLinkActive: '#00C2B3',
14
- },
15
- components: {
16
- Button: {
17
- // colorPrimary: '#FF385C',
18
- algorithm: true,
19
- borderRadius: 8,
20
- controlHeight: 48,
21
- controlHeightLG: 56,
22
- controlHeightSM: 40,
23
- paddingContentHorizontal: 24,
24
- },
25
- Menu: {
26
- itemBg: 'transparent',
27
- itemColor: '#E0E0E0',
28
- itemHoverColor: '#FF385C',
29
- itemSelectedColor: '#FF385C',
30
- itemSelectedBg: '#2C2C2C',
31
- itemHoverBg: '#2C2C2C',
32
- activeBarWidth: 0,
33
- activeBarHeight: 2,
34
- activeBarBorderWidth: 0,
35
- colorActiveBarColor: '#FF385C',
36
- },
37
- Typography: {
38
- fontSizeHeading1: 44,
39
- fontSizeHeading2: 32,
40
- fontSizeHeading3: 24,
41
- fontSizeHeading4: 20,
42
- fontSizeHeading5: 16,
43
- },
44
- Form: {
45
- labelColor: '#E0E0E0',
46
- colorError: '#FF5A5F',
47
- colorWarning: '#FFB400',
48
- colorSuccess: '#00A699',
49
- },
50
- Input: {
51
- controlHeight: 48,
52
- controlHeightLG: 56,
53
- controlHeightSM: 40,
54
- paddingHorizontal: 16,
55
- borderRadius: 8,
56
- },
57
- },
58
- scopes: [
59
- {
60
- scope: ['Button'],
61
- settings: {
62
- default: {
63
- background: '#2C2C2C',
64
- foreground: '#E0E0E0',
65
- border: '#4A4A4A',
66
- },
67
- primary: {
68
- background: '#FF385C',
69
- foreground: '#FFFFFF',
70
- border: '#FF385C',
71
- },
72
- hover: {
73
- background: '#E31C5F',
74
- foreground: '#FFFFFF',
75
- border: '#E31C5F',
76
- },
77
- active: {
78
- background: '#D70466',
79
- foreground: '#FFFFFF',
80
- border: '#D70466',
81
- },
82
- disabled: {
83
- background: '#2C2C2C',
84
- foreground: '#6E6E6E',
85
- border: '#4A4A4A',
86
- },
87
- },
88
- },
89
- {
90
- scope: ['Input'],
91
- settings: {
92
- default: {
93
- background: '#2C2C2C',
94
- foreground: '#E0E0E0',
95
- border: '#4A4A4A',
96
- },
97
- focus: {
98
- border: '#00A699',
99
- boxShadow: '0 0 0 1px #00A699',
100
- },
101
- hover: {
102
- border: '#A0A0A0',
103
- },
104
- disabled: {
105
- background: '#1E1E1E',
106
- foreground: '#6E6E6E',
107
- border: '#4A4A4A',
108
- },
109
- },
110
- },
111
- {
112
- scope: ['Menu'],
113
- settings: {
114
- background: '#121212',
115
- item: {
116
- default: {
117
- background: 'transparent',
118
- foreground: '#E0E0E0',
119
- },
120
- hover: {
121
- background: '#2C2C2C',
122
- foreground: '#E0E0E0',
123
- },
124
- active: {
125
- background: '#2C2C2C',
126
- foreground: '#FF385C',
127
- },
128
- },
129
- },
130
- },
131
- {
132
- scope: ['Table'],
133
- settings: {
134
- header: {
135
- background: '#2C2C2C',
136
- foreground: '#E0E0E0',
137
- },
138
- row: {
139
- odd: {
140
- background: '#121212',
141
- },
142
- even: {
143
- background: '#1E1E1E',
144
- },
145
- hover: {
146
- background: '#2C2C2C',
147
- },
148
- },
149
- },
150
- },
151
- {
152
- scope: ['Typography'],
153
- settings: {
154
- heading: {
155
- 1: { fontSize: 32, fontWeight: 800 },
156
- 2: { fontSize: 24, fontWeight: 600 },
157
- 3: { fontSize: 20, fontWeight: 600 },
158
- 4: { fontSize: 18, fontWeight: 600 },
159
- 5: { fontSize: 16, fontWeight: 600 },
160
- },
161
- text: {
162
- default: { fontSize: 16, fontWeight: 400 },
163
- secondary: { fontSize: 14, fontWeight: 400, foreground: '#A0A0A0' },
164
- },
165
- },
166
- },
167
- ],
168
- };export{airbnbDarkTheme};//# sourceMappingURL=airbnb-dark-theme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"airbnb-dark-theme.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}