@admin-layout/tailwind-design-pro 12.0.16-alpha.44 → 12.0.16-alpha.46

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 (46) hide show
  1. package/lib/components/Layout/BasicLayout/index.d.ts.map +1 -1
  2. package/lib/components/Layout/BasicLayout/index.js +14 -2
  3. package/lib/components/Layout/BasicLayout/index.js.map +1 -1
  4. package/lib/components/SettingDrawer/InvitationSettings.d.ts.map +1 -1
  5. package/lib/components/SettingDrawer/InvitationSettings.js +4 -2
  6. package/lib/components/SettingDrawer/InvitationSettings.js.map +1 -1
  7. package/lib/components/SettingDrawer/LayoutChange.d.ts.map +1 -1
  8. package/lib/components/SettingDrawer/LayoutChange.js +26 -14
  9. package/lib/components/SettingDrawer/LayoutChange.js.map +1 -1
  10. package/lib/components/SettingDrawer/NavigationsModes.d.ts.map +1 -1
  11. package/lib/components/SettingDrawer/NavigationsModes.js +22 -13
  12. package/lib/components/SettingDrawer/NavigationsModes.js.map +1 -1
  13. package/lib/components/SettingDrawer/RegionalSettings.d.ts.map +1 -1
  14. package/lib/components/SettingDrawer/RegionalSettings.js +78 -31
  15. package/lib/components/SettingDrawer/RegionalSettings.js.map +1 -1
  16. package/lib/components/SettingDrawer/SettingDrawer.d.ts.map +1 -1
  17. package/lib/components/SettingDrawer/SettingDrawer.js +51 -7
  18. package/lib/components/SettingDrawer/SettingDrawer.js.map +1 -1
  19. package/lib/components/SettingDrawer/types.d.ts +1 -0
  20. package/lib/components/SettingDrawer/types.d.ts.map +1 -1
  21. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.d.ts +1 -2
  22. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.d.ts.map +1 -1
  23. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.js +1 -3
  24. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.js.map +1 -1
  25. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.d.ts.map +1 -1
  26. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.js +4 -9
  27. package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.js.map +1 -1
  28. package/lib/compute.d.ts.map +1 -1
  29. package/lib/compute.js +4 -2
  30. package/lib/compute.js.map +1 -1
  31. package/lib/config/env-config.d.ts +1 -0
  32. package/lib/config/env-config.d.ts.map +1 -1
  33. package/lib/config/env-config.js +3 -0
  34. package/lib/config/env-config.js.map +1 -1
  35. package/lib/machines/settingsMachine.d.ts.map +1 -1
  36. package/lib/machines/settingsMachine.js +65 -18
  37. package/lib/machines/settingsMachine.js.map +1 -1
  38. package/lib/machines/types.d.ts +8 -0
  39. package/lib/machines/types.d.ts.map +1 -1
  40. package/lib/utils/__tests__/configOverrides.test.d.ts +2 -0
  41. package/lib/utils/__tests__/configOverrides.test.d.ts.map +1 -0
  42. package/lib/utils/configOverrides.d.ts +213 -0
  43. package/lib/utils/configOverrides.d.ts.map +1 -0
  44. package/lib/utils/configOverrides.js +355 -0
  45. package/lib/utils/configOverrides.js.map +1 -0
  46. package/package.json +4 -4
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Configuration Override System
3
+ *
4
+ * This module implements a VS Code-style configuration override pattern.
5
+ * Instead of deeply nested route and device-specific settings, we use a nested
6
+ * structure with context keys for overrides.
7
+ *
8
+ * ## Pattern
9
+ *
10
+ * Base configuration:
11
+ * ```
12
+ * uilayout.regions.header.showLogo = true
13
+ * ```
14
+ *
15
+ * Override for specific route and device:
16
+ * ```
17
+ * [route=/dashboard][device=mobile]: {
18
+ * uilayout: {
19
+ * regions: {
20
+ * header: {
21
+ * showLogo: false
22
+ * }
23
+ * }
24
+ * }
25
+ * }
26
+ * ```
27
+ *
28
+ * ## Benefits
29
+ *
30
+ * 1. **Flat Schema**: Configuration schema is defined once, not duplicated per route/device
31
+ * 2. **Clear Inheritance**: Easy to see what's overridden and what uses defaults
32
+ * 3. **Flexibility**: Can add new context dimensions (e.g., [user=admin], [theme=dark])
33
+ * 4. **Database Friendly**: Nested structure is natural for MongoDB
34
+ * 5. **Type Safe**: TypeScript can enforce config keys
35
+ *
36
+ * ## Usage in MongoDB
37
+ *
38
+ * ```json
39
+ * {
40
+ * "uiSettings": {
41
+ * "uilayout": {
42
+ * "regions": {
43
+ * "header": {
44
+ * "showLogo": true
45
+ * }
46
+ * }
47
+ * },
48
+ * "[route=/dashboard][device=mobile]": {
49
+ * "uilayout": {
50
+ * "regions": {
51
+ * "header": {
52
+ * "showLogo": false
53
+ * }
54
+ * }
55
+ * }
56
+ * }
57
+ * }
58
+ * }
59
+ * ```
60
+ */
61
+ export interface OverrideContext {
62
+ route?: string;
63
+ device?: 'desktop' | 'mobile';
64
+ theme?: string;
65
+ user?: string;
66
+ [key: string]: string | undefined;
67
+ }
68
+ /**
69
+ * Parse multiple bracket pattern into array of identifiers
70
+ * Supports both single bracket [/route.mobile] and multiple bracket [/route][mobile] patterns
71
+ *
72
+ * @example
73
+ * parseMultipleBracketIdentifiers("[/dashboard][mobile]")
74
+ * // Returns: ['/dashboard', 'mobile']
75
+ *
76
+ * parseMultipleBracketIdentifiers("[mobile]")
77
+ * // Returns: ['mobile']
78
+ *
79
+ * parseMultipleBracketIdentifiers("[/dashboard.mobile]") // Backward compatibility
80
+ * // Returns: ['/dashboard', 'mobile']
81
+ */
82
+ export declare function parseMultipleBracketIdentifiers(overrideKey: string): string[];
83
+ /**
84
+ * Build multiple bracket pattern from identifiers array
85
+ *
86
+ * @example
87
+ * buildMultipleBracketKey(['/dashboard', 'mobile'])
88
+ * // Returns: "[/dashboard][mobile]"
89
+ *
90
+ * buildMultipleBracketKey(['mobile'])
91
+ * // Returns: "[mobile]"
92
+ */
93
+ export declare function buildMultipleBracketKey(identifiers: string[]): string;
94
+ /**
95
+ * Build multiple bracket pattern from context object
96
+ * Uses the new multiple bracket format: [/route][device]
97
+ *
98
+ * @example
99
+ * buildMultipleBracketKeyFromContext({ route: '/dashboard', device: 'mobile' })
100
+ * // Returns: "[/dashboard][mobile]"
101
+ *
102
+ * buildMultipleBracketKeyFromContext({ device: 'mobile' })
103
+ * // Returns: "[mobile]"
104
+ */
105
+ export declare function buildMultipleBracketKeyFromContext(context: OverrideContext): string;
106
+ /**
107
+ * Convert multiple bracket pattern to context object
108
+ *
109
+ * @example
110
+ * multipleBracketToContext("[/dashboard][mobile]")
111
+ * // Returns: { route: '/dashboard', device: 'mobile' }
112
+ */
113
+ export declare function multipleBracketToContext(overrideKey: string): OverrideContext;
114
+ /**
115
+ * Convert a dot-notation path to a nested object
116
+ * @example
117
+ * setNestedValue({}, 'uilayout.regions.header.showLogo', false)
118
+ * // Returns: { uilayout: { regions: { header: { showLogo: false } } } }
119
+ */
120
+ export declare function setNestedValue(obj: any, path: string, value: any): any;
121
+ /**
122
+ * Get a value from a nested object using dot notation
123
+ * @example
124
+ * getNestedValue({ uilayout: { regions: { header: { showLogo: false } } } }, 'uilayout.regions.header.showLogo')
125
+ * // Returns: false
126
+ */
127
+ export declare function getNestedValue(obj: any, path: string, defaultValue?: any): any;
128
+ /**
129
+ * Deep merge two objects
130
+ */
131
+ export declare function deepMerge(target: any, source: any): any;
132
+ /**
133
+ * Build an override context key from context
134
+ *
135
+ * Format: [route][device] or [route] or [device]
136
+ *
137
+ * @example
138
+ * buildOverrideKey({ route: '/dashboard', device: 'mobile' })
139
+ * // Returns: "[/dashboard][mobile]"
140
+ *
141
+ * buildOverrideKey({ route: '/dashboard' })
142
+ * // Returns: "[/dashboard]"
143
+ *
144
+ * buildOverrideKey({ device: 'mobile' })
145
+ * // Returns: "[mobile]"
146
+ */
147
+ export declare function buildOverrideKey(context: OverrideContext): string;
148
+ /**
149
+ * Parse an override key into its components
150
+ * Supports both new multiple bracket format and legacy dot notation
151
+ *
152
+ * @example
153
+ * parseOverrideKey("[/dashboard][mobile]") // New format
154
+ * // Returns: { route: '/dashboard', device: 'mobile' }
155
+ *
156
+ * parseOverrideKey("[/dashboard.mobile]") // Legacy format
157
+ * // Returns: { route: '/dashboard', device: 'mobile' }
158
+ *
159
+ * parseOverrideKey("[/dashboard]")
160
+ * // Returns: { route: '/dashboard' }
161
+ *
162
+ * parseOverrideKey("[mobile]")
163
+ * // Returns: { device: 'mobile' }
164
+ *
165
+ * parseOverrideKey("[.mobile]") // Legacy device-only format
166
+ * // Returns: { device: 'mobile' }
167
+ */
168
+ export declare function parseOverrideKey(overrideKey: string): OverrideContext;
169
+ /**
170
+ * Get a configuration value with override support
171
+ *
172
+ * Priority:
173
+ * 1. Most specific override (all context matches)
174
+ * 2. Partial overrides (some context matches)
175
+ * 3. Base configuration value
176
+ * 4. Default value
177
+ *
178
+ * Works with nested storage where overrides are stored as:
179
+ * { "[route=/dashboard][device=mobile]": { uilayout: { regions: { header: { showLogo: false } } } } }
180
+ */
181
+ export declare function getConfigValue<T = any>(settings: any, configKey: string, context: OverrideContext, defaultValue?: T): T;
182
+ /**
183
+ * Set a configuration value as an override
184
+ *
185
+ * Returns the context key and nested value structure.
186
+ * The service layer will merge this into the settings object.
187
+ *
188
+ * @example
189
+ * const result = setConfigOverride('regions.header.showLogo', false, { route: '/dashboard', device: 'mobile' });
190
+ * // Returns: {
191
+ * // contextKey: '[device=mobile][route=/dashboard]',
192
+ * // path: 'uilayout.regions.header.showLogo',
193
+ * // value: false,
194
+ * // nestedValue: { uilayout: { regions: { header: { showLogo: false } } } }
195
+ * // }
196
+ */
197
+ export declare function setConfigOverride(configKey: string, value: any, context: OverrideContext): {
198
+ contextKey: string;
199
+ path: string;
200
+ value: any;
201
+ nestedValue: any;
202
+ };
203
+ /**
204
+ * Get all overrides for a specific context
205
+ * Works with nested storage format
206
+ */
207
+ export declare function getContextOverrides(settings: any, context: OverrideContext): Record<string, any>;
208
+ /**
209
+ * Remove all overrides for a specific context
210
+ * Returns the context key to remove from settings
211
+ */
212
+ export declare function clearContextOverrides(settings: any, context: OverrideContext): string | null;
213
+ //# sourceMappingURL=configOverrides.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configOverrides.d.ts","s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gB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,CAiDrE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EAClC,QAAQ,EAAE,GAAG,EACb,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,eAAe,EACxB,YAAY,CAAC,EAAE,CAAC,GACjB,CAAC,CAoEH;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAC7B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,eAAe,GACzB;IACC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,WAAW,EAAE,GAAG,CAAC;CACpB,CAWA;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAShG;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAQ5F"}
@@ -0,0 +1,355 @@
1
+ /**
2
+ * Configuration Override System
3
+ *
4
+ * This module implements a VS Code-style configuration override pattern.
5
+ * Instead of deeply nested route and device-specific settings, we use a nested
6
+ * structure with context keys for overrides.
7
+ *
8
+ * ## Pattern
9
+ *
10
+ * Base configuration:
11
+ * ```
12
+ * uilayout.regions.header.showLogo = true
13
+ * ```
14
+ *
15
+ * Override for specific route and device:
16
+ * ```
17
+ * [route=/dashboard][device=mobile]: {
18
+ * uilayout: {
19
+ * regions: {
20
+ * header: {
21
+ * showLogo: false
22
+ * }
23
+ * }
24
+ * }
25
+ * }
26
+ * ```
27
+ *
28
+ * ## Benefits
29
+ *
30
+ * 1. **Flat Schema**: Configuration schema is defined once, not duplicated per route/device
31
+ * 2. **Clear Inheritance**: Easy to see what's overridden and what uses defaults
32
+ * 3. **Flexibility**: Can add new context dimensions (e.g., [user=admin], [theme=dark])
33
+ * 4. **Database Friendly**: Nested structure is natural for MongoDB
34
+ * 5. **Type Safe**: TypeScript can enforce config keys
35
+ *
36
+ * ## Usage in MongoDB
37
+ *
38
+ * ```json
39
+ * {
40
+ * "uiSettings": {
41
+ * "uilayout": {
42
+ * "regions": {
43
+ * "header": {
44
+ * "showLogo": true
45
+ * }
46
+ * }
47
+ * },
48
+ * "[route=/dashboard][device=mobile]": {
49
+ * "uilayout": {
50
+ * "regions": {
51
+ * "header": {
52
+ * "showLogo": false
53
+ * }
54
+ * }
55
+ * }
56
+ * }
57
+ * }
58
+ * }
59
+ * ```
60
+ */
61
+ /**
62
+ * Parse multiple bracket pattern into array of identifiers
63
+ * Supports both single bracket [/route.mobile] and multiple bracket [/route][mobile] patterns
64
+ *
65
+ * @example
66
+ * parseMultipleBracketIdentifiers("[/dashboard][mobile]")
67
+ * // Returns: ['/dashboard', 'mobile']
68
+ *
69
+ * parseMultipleBracketIdentifiers("[mobile]")
70
+ * // Returns: ['mobile']
71
+ *
72
+ * parseMultipleBracketIdentifiers("[/dashboard.mobile]") // Backward compatibility
73
+ * // Returns: ['/dashboard', 'mobile']
74
+ */
75
+ function parseMultipleBracketIdentifiers(overrideKey) {
76
+ const identifiers = [];
77
+ // Match all bracket pairs: [something]
78
+ const bracketMatches = overrideKey.match(/\[([^\]]+)\]/g);
79
+ if (!bracketMatches) {
80
+ return identifiers;
81
+ }
82
+ // If there's only one bracket, check if it contains a dot (old format)
83
+ if (bracketMatches.length === 1) {
84
+ const content = bracketMatches[0].slice(1, -1); // Remove brackets
85
+ // Check if it's the old format with dot notation
86
+ if (content.includes('.')) {
87
+ const parts = content.split('.');
88
+ // Handle [.device] pattern
89
+ if (parts[0] === '' && parts[1]) {
90
+ identifiers.push(parts[1]);
91
+ }
92
+ // Handle [route.device] pattern
93
+ else {
94
+ parts.forEach(part => {
95
+ if (part) identifiers.push(part);
96
+ });
97
+ }
98
+ } else {
99
+ // Single identifier without dot
100
+ identifiers.push(content);
101
+ }
102
+ } else {
103
+ // Multiple brackets: extract content from each
104
+ bracketMatches.forEach(match => {
105
+ const content = match.slice(1, -1); // Remove brackets
106
+ if (content) {
107
+ identifiers.push(content);
108
+ }
109
+ });
110
+ }
111
+ return identifiers;
112
+ }
113
+ /**
114
+ * Convert a dot-notation path to a nested object
115
+ * @example
116
+ * setNestedValue({}, 'uilayout.regions.header.showLogo', false)
117
+ * // Returns: { uilayout: { regions: { header: { showLogo: false } } } }
118
+ */
119
+ function setNestedValue(obj, path, value) {
120
+ const keys = path.split('.');
121
+ const result = {
122
+ ...obj
123
+ };
124
+ let current = result;
125
+ for (let i = 0; i < keys.length - 1; i++) {
126
+ const key = keys[i];
127
+ if (!current[key] || typeof current[key] !== 'object') {
128
+ current[key] = {};
129
+ } else {
130
+ current[key] = {
131
+ ...current[key]
132
+ };
133
+ }
134
+ current = current[key];
135
+ }
136
+ current[keys[keys.length - 1]] = value;
137
+ return result;
138
+ }
139
+ /**
140
+ * Get a value from a nested object using dot notation
141
+ * @example
142
+ * getNestedValue({ uilayout: { regions: { header: { showLogo: false } } } }, 'uilayout.regions.header.showLogo')
143
+ * // Returns: false
144
+ */
145
+ function getNestedValue(obj, path, defaultValue) {
146
+ const keys = path.split('.');
147
+ let current = obj;
148
+ for (const key of keys) {
149
+ if (current === null || current === undefined || typeof current !== 'object') {
150
+ return defaultValue;
151
+ }
152
+ current = current[key];
153
+ }
154
+ return current !== undefined ? current : defaultValue;
155
+ }
156
+ /**
157
+ * Build an override context key from context
158
+ *
159
+ * Format: [route][device] or [route] or [device]
160
+ *
161
+ * @example
162
+ * buildOverrideKey({ route: '/dashboard', device: 'mobile' })
163
+ * // Returns: "[/dashboard][mobile]"
164
+ *
165
+ * buildOverrideKey({ route: '/dashboard' })
166
+ * // Returns: "[/dashboard]"
167
+ *
168
+ * buildOverrideKey({ device: 'mobile' })
169
+ * // Returns: "[mobile]"
170
+ */
171
+ function buildOverrideKey(context) {
172
+ const {
173
+ route,
174
+ device,
175
+ ...rest
176
+ } = context;
177
+ // Handle route and device specifically - use multiple bracket format
178
+ if (route && device) {
179
+ return `[${route}][${device}]`;
180
+ } else if (route) {
181
+ return `[${route}]`;
182
+ } else if (device) {
183
+ return `[${device}]`;
184
+ }
185
+ // Fallback for other context keys (future extensibility)
186
+ const parts = [];
187
+ for (const [key, value] of Object.entries(rest)) {
188
+ if (value !== undefined && value !== null) {
189
+ parts.push(`${key}=${value}`);
190
+ }
191
+ }
192
+ if (parts.length > 0) {
193
+ return `[${parts.join(',')}]`;
194
+ }
195
+ return '';
196
+ }
197
+ /**
198
+ * Parse an override key into its components
199
+ * Supports both new multiple bracket format and legacy dot notation
200
+ *
201
+ * @example
202
+ * parseOverrideKey("[/dashboard][mobile]") // New format
203
+ * // Returns: { route: '/dashboard', device: 'mobile' }
204
+ *
205
+ * parseOverrideKey("[/dashboard.mobile]") // Legacy format
206
+ * // Returns: { route: '/dashboard', device: 'mobile' }
207
+ *
208
+ * parseOverrideKey("[/dashboard]")
209
+ * // Returns: { route: '/dashboard' }
210
+ *
211
+ * parseOverrideKey("[mobile]")
212
+ * // Returns: { device: 'mobile' }
213
+ *
214
+ * parseOverrideKey("[.mobile]") // Legacy device-only format
215
+ * // Returns: { device: 'mobile' }
216
+ */
217
+ function parseOverrideKey(overrideKey) {
218
+ const context = {};
219
+ // First try multiple bracket pattern: [/route][device]
220
+ const multipleBracketMatch = overrideKey.match(/^(\[[^\]]+\])+$/);
221
+ if (multipleBracketMatch) {
222
+ const identifiers = parseMultipleBracketIdentifiers(overrideKey);
223
+ identifiers.forEach(identifier => {
224
+ if (identifier.startsWith('/')) {
225
+ context.route = identifier;
226
+ } else if (identifier === 'mobile' || identifier === 'desktop') {
227
+ context.device = identifier;
228
+ }
229
+ });
230
+ return context;
231
+ }
232
+ // Fallback to legacy single bracket pattern: [route.device] or [route] or [.device]
233
+ const match = overrideKey.match(/^\[([^\]]+)\]$/);
234
+ if (!match) {
235
+ return context;
236
+ }
237
+ const content = match[1];
238
+ // Check if it contains a dot
239
+ if (content.includes('.')) {
240
+ const parts = content.split('.');
241
+ // Handle [.device] pattern
242
+ if (parts[0] === '') {
243
+ context.device = parts[1];
244
+ }
245
+ // Handle [route.device] pattern
246
+ else {
247
+ context.route = parts[0];
248
+ if (parts[1]) {
249
+ context.device = parts[1];
250
+ }
251
+ }
252
+ } else {
253
+ // Handle [route] pattern (no dot means route only)
254
+ context.route = content;
255
+ }
256
+ return context;
257
+ }
258
+ /**
259
+ * Get a configuration value with override support
260
+ *
261
+ * Priority:
262
+ * 1. Most specific override (all context matches)
263
+ * 2. Partial overrides (some context matches)
264
+ * 3. Base configuration value
265
+ * 4. Default value
266
+ *
267
+ * Works with nested storage where overrides are stored as:
268
+ * { "[route=/dashboard][device=mobile]": { uilayout: { regions: { header: { showLogo: false } } } } }
269
+ */
270
+ function getConfigValue(settings, configKey, context, defaultValue) {
271
+ // Build the context key
272
+ const contextKey = buildOverrideKey(context);
273
+ // Check for exact override in nested structure
274
+ if (contextKey && settings?.[contextKey]) {
275
+ const overrideValue = getNestedValue(settings[contextKey], `uilayout.${configKey}`);
276
+ if (overrideValue !== undefined) {
277
+ return overrideValue;
278
+ }
279
+ }
280
+ // Check for partial overrides with priority:
281
+ // 1. [route.device] (most specific)
282
+ // 2. [route] (route only)
283
+ // 3. [.device] (device only)
284
+ if (settings) {
285
+ const partialMatches = [];
286
+ for (const key of Object.keys(settings)) {
287
+ // Only check keys that look like context keys (start with '[')
288
+ if (!key.startsWith('[')) continue;
289
+ const parsed = parseOverrideKey(key);
290
+ // Check if this override matches current context
291
+ let matches = true;
292
+ let specificity = 0;
293
+ if (parsed.route !== undefined) {
294
+ if (parsed.route === context.route) {
295
+ specificity += 2; // Route match is worth 2 points
296
+ } else {
297
+ matches = false;
298
+ }
299
+ }
300
+ if (parsed.device !== undefined) {
301
+ if (parsed.device === context.device) {
302
+ specificity += 1; // Device match is worth 1 point
303
+ } else {
304
+ matches = false;
305
+ }
306
+ }
307
+ if (matches && specificity > 0) {
308
+ partialMatches.push({
309
+ key,
310
+ specificity
311
+ });
312
+ }
313
+ }
314
+ // Use the most specific override
315
+ if (partialMatches.length > 0) {
316
+ const mostSpecific = partialMatches.reduce((a, b) => a.specificity > b.specificity ? a : b);
317
+ const overrideValue = getNestedValue(settings[mostSpecific.key], `uilayout.${configKey}`);
318
+ if (overrideValue !== undefined) {
319
+ return overrideValue;
320
+ }
321
+ }
322
+ }
323
+ // Check base configuration
324
+ const baseValue = getNestedValue(settings, `uilayout.${configKey}`);
325
+ if (baseValue !== undefined) {
326
+ return baseValue;
327
+ }
328
+ return defaultValue;
329
+ }
330
+ /**
331
+ * Set a configuration value as an override
332
+ *
333
+ * Returns the context key and nested value structure.
334
+ * The service layer will merge this into the settings object.
335
+ *
336
+ * @example
337
+ * const result = setConfigOverride('regions.header.showLogo', false, { route: '/dashboard', device: 'mobile' });
338
+ * // Returns: {
339
+ * // contextKey: '[device=mobile][route=/dashboard]',
340
+ * // path: 'uilayout.regions.header.showLogo',
341
+ * // value: false,
342
+ * // nestedValue: { uilayout: { regions: { header: { showLogo: false } } } }
343
+ * // }
344
+ */
345
+ function setConfigOverride(configKey, value, context) {
346
+ const contextKey = buildOverrideKey(context);
347
+ const path = `uilayout.${configKey}`;
348
+ const nestedValue = setNestedValue({}, path, value);
349
+ return {
350
+ contextKey,
351
+ path,
352
+ value,
353
+ nestedValue
354
+ };
355
+ }export{buildOverrideKey,getConfigValue,getNestedValue,parseMultipleBracketIdentifiers,parseOverrideKey,setConfigOverride,setNestedValue};//# sourceMappingURL=configOverrides.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configOverrides.js","sources":["../../src/utils/configOverrides.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DG;AAUH;;;;;;;;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A,GAAA,CAAA,CAAA;MACJ,MAAA,aAAA,GAAA,cAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,CAAA,EAAA,CAAA,SAAA,EAAA,SAAA,CAAA,CAAA,CAAA;MAED,IAAA,aAAA,KAAA,SAA2B,EAAA;QAC3B,OAAM,aAAY;AAClB,MAAA;AACI,IAAA;;AAGJ;AACJ,EAAC,MAAA,SAAA,GAAA,cAAA,CAAA,QAAA,EAAA,CAAA,SAAA,EAAA,SAAA,CAAA,CAAA,CAAA;AAED,EAAA,IAAA,SAAA,KAAA,SAAA,EAAA;;;;;;;;;;;;;;AAcG;AACH;AAUI;AACA;;;SAII,iBAAU,CAAA,SAAA,EAAA,KAAA,EAAA,OAAA,EAAA;QACV,UAAI,GAAA,gBAAA,CAAA,OAAA,CAAA;QACJ,IAAA,GAAK,CAAA,SAAA,EAAA,SAAA,CAAA,CAAA;QACL,WAAW,GAAA,cAAA,CAAA,EAAA,EAAA,IAAA,EAAA,KAAA,CAAA;SACb;AACN,IAAC,UAAA;AAED,IAAA,IAAA;;;AAGG,GAAA;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admin-layout/tailwind-design-pro",
3
- "version": "12.0.16-alpha.44",
3
+ "version": "12.0.16-alpha.46",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@admin-layout/assets": "12.0.16-alpha.36",
25
- "@admin-layout/client": "12.0.16-alpha.44",
26
- "@admin-layout/tailwind-ui": "12.0.16-alpha.44",
25
+ "@admin-layout/client": "12.0.16-alpha.46",
26
+ "@admin-layout/tailwind-ui": "12.0.16-alpha.46",
27
27
  "react-favicon": "^0.0.23",
28
28
  "react-intl": "^6.1.1",
29
29
  "react-responsive": "^10.0.0"
@@ -53,5 +53,5 @@
53
53
  "typescript": {
54
54
  "definition": "lib/index.d.ts"
55
55
  },
56
- "gitHead": "81709761b697730903123a9d1d79d2d907a3edc5"
56
+ "gitHead": "ce30e2742a315175f9ec774fe3422976b5d7110f"
57
57
  }