@pyreon/rocketstyle 0.11.5 → 0.11.7

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 (51) hide show
  1. package/README.md +32 -32
  2. package/lib/index.d.ts +25 -6
  3. package/lib/index.js +122 -97
  4. package/package.json +25 -24
  5. package/src/__tests__/attrs.test.ts +49 -49
  6. package/src/__tests__/chaining.test.ts +27 -27
  7. package/src/__tests__/collection.test.ts +12 -12
  8. package/src/__tests__/compose.test.ts +10 -10
  9. package/src/__tests__/context.test.ts +65 -65
  10. package/src/__tests__/createLocalProvider.test.ts +53 -53
  11. package/src/__tests__/dimensions.test.ts +54 -54
  12. package/src/__tests__/e2e-styler.test.ts +142 -136
  13. package/src/__tests__/hooks.test.ts +41 -70
  14. package/src/__tests__/isRocketComponent.test.ts +11 -11
  15. package/src/__tests__/misc.test.ts +91 -91
  16. package/src/__tests__/providerConsumer.test.ts +54 -126
  17. package/src/__tests__/rocketstyleIntegration.test.ts +182 -255
  18. package/src/__tests__/themeUtils.test.ts +173 -173
  19. package/src/cache/index.ts +1 -1
  20. package/src/constants/booleanTags.ts +25 -25
  21. package/src/constants/defaultDimensions.ts +5 -5
  22. package/src/constants/index.ts +16 -16
  23. package/src/context/context.ts +13 -10
  24. package/src/context/createLocalProvider.ts +26 -13
  25. package/src/context/localContext.ts +2 -2
  26. package/src/hoc/index.ts +1 -1
  27. package/src/hoc/rocketstyleAttrsHoc.ts +26 -29
  28. package/src/hooks/index.ts +2 -2
  29. package/src/hooks/usePseudoState.ts +3 -3
  30. package/src/hooks/useTheme.ts +14 -17
  31. package/src/index.ts +32 -15
  32. package/src/init.ts +12 -12
  33. package/src/isRocketComponent.ts +2 -2
  34. package/src/rocketstyle.ts +125 -112
  35. package/src/types/attrs.ts +2 -2
  36. package/src/types/config.ts +4 -4
  37. package/src/types/configuration.ts +5 -5
  38. package/src/types/dimensions.ts +5 -5
  39. package/src/types/hoc.ts +1 -1
  40. package/src/types/rocketComponent.ts +4 -4
  41. package/src/types/rocketstyle.ts +10 -10
  42. package/src/types/styles.ts +9 -4
  43. package/src/types/theme.ts +4 -4
  44. package/src/types/utils.ts +1 -1
  45. package/src/utils/attrs.ts +2 -2
  46. package/src/utils/chaining.ts +2 -2
  47. package/src/utils/compose.ts +1 -1
  48. package/src/utils/dimensions.ts +6 -6
  49. package/src/utils/statics.ts +2 -2
  50. package/src/utils/styles.ts +2 -2
  51. package/src/utils/theme.ts +10 -10
@@ -5,119 +5,119 @@ import {
5
5
  getThemeByMode,
6
6
  getThemeFromChain,
7
7
  themeModeCallback,
8
- } from "../utils/theme"
8
+ } from '../utils/theme'
9
9
 
10
- describe("themeModeCallback", () => {
11
- it("returns light value for light mode", () => {
12
- const cb = themeModeCallback("lightVal", "darkVal")
13
- expect(cb("light")).toBe("lightVal")
10
+ describe('themeModeCallback', () => {
11
+ it('returns light value for light mode', () => {
12
+ const cb = themeModeCallback('lightVal', 'darkVal')
13
+ expect(cb('light')).toBe('lightVal')
14
14
  })
15
15
 
16
- it("returns light value when mode is falsy", () => {
17
- const cb = themeModeCallback("lightVal", "darkVal")
18
- expect(cb(undefined as any)).toBe("lightVal")
19
- expect(cb("" as any)).toBe("lightVal")
16
+ it('returns light value when mode is falsy', () => {
17
+ const cb = themeModeCallback('lightVal', 'darkVal')
18
+ expect(cb(undefined as any)).toBe('lightVal')
19
+ expect(cb('' as any)).toBe('lightVal')
20
20
  })
21
21
 
22
- it("returns dark value for dark mode", () => {
23
- const cb = themeModeCallback("lightVal", "darkVal")
24
- expect(cb("dark")).toBe("darkVal")
22
+ it('returns dark value for dark mode', () => {
23
+ const cb = themeModeCallback('lightVal', 'darkVal')
24
+ expect(cb('dark')).toBe('darkVal')
25
25
  })
26
26
  })
27
27
 
28
- describe("getThemeFromChain", () => {
29
- it("returns empty for empty array", () => {
28
+ describe('getThemeFromChain', () => {
29
+ it('returns empty for empty array', () => {
30
30
  expect(getThemeFromChain([], {})).toEqual({})
31
31
  })
32
32
 
33
- it("returns empty for null", () => {
33
+ it('returns empty for null', () => {
34
34
  expect(getThemeFromChain(null, {})).toEqual({})
35
35
  })
36
36
 
37
- it("returns empty for undefined", () => {
37
+ it('returns empty for undefined', () => {
38
38
  expect(getThemeFromChain(undefined, {})).toEqual({})
39
39
  })
40
40
 
41
- it("evaluates chain of callbacks and deep-merges results", () => {
42
- const fn1 = (_theme: any) => ({ color: "blue" })
41
+ it('evaluates chain of callbacks and deep-merges results', () => {
42
+ const fn1 = (_theme: any) => ({ color: 'blue' })
43
43
  const fn2 = (theme: any) => ({ bg: theme.primary })
44
- const result = getThemeFromChain([fn1, fn2], { primary: "red" })
45
- expect(result).toEqual({ color: "blue", bg: "red" })
44
+ const result = getThemeFromChain([fn1, fn2], { primary: 'red' })
45
+ expect(result).toEqual({ color: 'blue', bg: 'red' })
46
46
  })
47
47
 
48
- it("later callbacks override earlier ones", () => {
49
- const fn1 = () => ({ color: "blue" })
50
- const fn2 = () => ({ color: "red" })
48
+ it('later callbacks override earlier ones', () => {
49
+ const fn1 = () => ({ color: 'blue' })
50
+ const fn2 = () => ({ color: 'red' })
51
51
  const result = getThemeFromChain([fn1, fn2], {})
52
- expect(result).toEqual({ color: "red" })
52
+ expect(result).toEqual({ color: 'red' })
53
53
  })
54
54
 
55
- it("passes themeModeCallback and config.css to each callback", () => {
55
+ it('passes themeModeCallback and config.css to each callback', () => {
56
56
  const fn = vi.fn(() => ({}))
57
57
  getThemeFromChain([fn], { rootSize: 16 })
58
58
  expect(fn).toHaveBeenCalledWith({ rootSize: 16 }, expect.any(Function), expect.anything())
59
59
  })
60
60
  })
61
61
 
62
- describe("getDimensionThemes", () => {
63
- it("returns empty for empty dimensions", () => {
62
+ describe('getDimensionThemes', () => {
63
+ it('returns empty for empty dimensions', () => {
64
64
  expect(getDimensionThemes({}, { dimensions: {} })).toEqual({})
65
65
  })
66
66
 
67
- it("returns empty when dimensions is falsy", () => {
67
+ it('returns empty when dimensions is falsy', () => {
68
68
  expect(getDimensionThemes({}, { dimensions: undefined })).toEqual({})
69
69
  })
70
70
 
71
- it("processes dimension theme chains", () => {
72
- const theme = { primaryColor: "blue" }
71
+ it('processes dimension theme chains', () => {
72
+ const theme = { primaryColor: 'blue' }
73
73
  const options = {
74
- dimensions: { states: "state" },
74
+ dimensions: { states: 'state' },
75
75
  states: [
76
76
  (t: any) => ({
77
77
  primary: { color: t.primaryColor },
78
- secondary: { color: "green" },
78
+ secondary: { color: 'green' },
79
79
  }),
80
80
  ],
81
81
  }
82
82
  const result = getDimensionThemes(theme, options)
83
83
  expect(result.state).toEqual({
84
- primary: { color: "blue" },
85
- secondary: { color: "green" },
84
+ primary: { color: 'blue' },
85
+ secondary: { color: 'green' },
86
86
  })
87
87
  })
88
88
 
89
- it("skips dimensions without callback arrays", () => {
89
+ it('skips dimensions without callback arrays', () => {
90
90
  const options = {
91
- dimensions: { states: "state", sizes: "size" },
92
- states: [() => ({ primary: { color: "red" } })],
91
+ dimensions: { states: 'state', sizes: 'size' },
92
+ states: [() => ({ primary: { color: 'red' } })],
93
93
  }
94
94
  const result = getDimensionThemes({}, options)
95
- expect(result.state).toEqual({ primary: { color: "red" } })
95
+ expect(result.state).toEqual({ primary: { color: 'red' } })
96
96
  expect(result.size).toBeUndefined()
97
97
  })
98
98
 
99
- it("strips nullable values from results", () => {
99
+ it('strips nullable values from results', () => {
100
100
  const options = {
101
- dimensions: { states: "state" },
102
- states: [() => ({ primary: { color: "red" }, secondary: null })],
101
+ dimensions: { states: 'state' },
102
+ states: [() => ({ primary: { color: 'red' }, secondary: null })],
103
103
  }
104
104
  const result = getDimensionThemes({}, options)
105
- expect(result.state.primary).toEqual({ color: "red" })
105
+ expect(result.state.primary).toEqual({ color: 'red' })
106
106
  expect(result.state.secondary).toBeUndefined()
107
107
  })
108
108
 
109
- it("handles multi-key dimensions", () => {
109
+ it('handles multi-key dimensions', () => {
110
110
  const options = {
111
- dimensions: { multiple: { propName: "multiple", multi: true } },
112
- multiple: [() => ({ a: { weight: "bold" } })],
111
+ dimensions: { multiple: { propName: 'multiple', multi: true } },
112
+ multiple: [() => ({ a: { weight: 'bold' } })],
113
113
  }
114
114
  const result = getDimensionThemes({}, options)
115
- expect(result.multiple).toEqual({ a: { weight: "bold" } })
115
+ expect(result.multiple).toEqual({ a: { weight: 'bold' } })
116
116
  })
117
117
 
118
- it("skips empty callback arrays", () => {
118
+ it('skips empty callback arrays', () => {
119
119
  const options = {
120
- dimensions: { states: "state" },
120
+ dimensions: { states: 'state' },
121
121
  states: [],
122
122
  }
123
123
  const result = getDimensionThemes({}, options)
@@ -125,68 +125,68 @@ describe("getDimensionThemes", () => {
125
125
  })
126
126
  })
127
127
 
128
- describe("calculateChainOptions (theme)", () => {
129
- it("returns empty for null", () => {
128
+ describe('calculateChainOptions (theme)', () => {
129
+ it('returns empty for null', () => {
130
130
  expect(calculateChainOptions(null, [])).toEqual({})
131
131
  })
132
132
 
133
- it("returns empty for undefined", () => {
133
+ it('returns empty for undefined', () => {
134
134
  expect(calculateChainOptions(undefined, [])).toEqual({})
135
135
  })
136
136
 
137
- it("returns empty for empty array", () => {
137
+ it('returns empty for empty array', () => {
138
138
  expect(calculateChainOptions([], [])).toEqual({})
139
139
  })
140
140
 
141
- it("evaluates chain and deep-merges results", () => {
141
+ it('evaluates chain and deep-merges results', () => {
142
142
  const fn1 = () => ({ nested: { a: 1 } })
143
143
  const fn2 = () => ({ nested: { b: 2 } })
144
144
  const result = calculateChainOptions([fn1, fn2], [])
145
145
  expect(result).toEqual({ nested: { a: 1, b: 2 } })
146
146
  })
147
147
 
148
- it("passes args to each function", () => {
148
+ it('passes args to each function', () => {
149
149
  const fn = vi.fn(() => ({}))
150
- calculateChainOptions([fn], ["arg1", "arg2"])
151
- expect(fn).toHaveBeenCalledWith("arg1", "arg2")
150
+ calculateChainOptions([fn], ['arg1', 'arg2'])
151
+ expect(fn).toHaveBeenCalledWith('arg1', 'arg2')
152
152
  })
153
153
  })
154
154
 
155
- describe("getTheme", () => {
156
- it("returns baseTheme when rocketstate has no matching dimension themes", () => {
155
+ describe('getTheme', () => {
156
+ it('returns baseTheme when rocketstate has no matching dimension themes', () => {
157
157
  const result = getTheme({
158
- rocketstate: { state: "unknown" },
158
+ rocketstate: { state: 'unknown' },
159
159
  themes: { state: {} },
160
- baseTheme: { color: "blue" },
160
+ baseTheme: { color: 'blue' },
161
161
  })
162
- expect(result.color).toBe("blue")
162
+ expect(result.color).toBe('blue')
163
163
  })
164
164
 
165
- it("merges dimension theme into baseTheme", () => {
165
+ it('merges dimension theme into baseTheme', () => {
166
166
  const result = getTheme({
167
- rocketstate: { state: "primary" },
168
- themes: { state: { primary: { color: "red" } } },
169
- baseTheme: { color: "blue", bg: "white" },
167
+ rocketstate: { state: 'primary' },
168
+ themes: { state: { primary: { color: 'red' } } },
169
+ baseTheme: { color: 'blue', bg: 'white' },
170
170
  })
171
- expect(result.color).toBe("red")
172
- expect(result.bg).toBe("white")
171
+ expect(result.color).toBe('red')
172
+ expect(result.bg).toBe('white')
173
173
  })
174
174
 
175
- it("handles array values for multi-key dimensions", () => {
175
+ it('handles array values for multi-key dimensions', () => {
176
176
  const result = getTheme({
177
- rocketstate: { multiple: ["a", "b"] },
177
+ rocketstate: { multiple: ['a', 'b'] },
178
178
  themes: {
179
- multiple: { a: { weight: "bold" }, b: { style: "italic" } },
179
+ multiple: { a: { weight: 'bold' }, b: { style: 'italic' } },
180
180
  },
181
181
  baseTheme: {},
182
182
  })
183
- expect(result.weight).toBe("bold")
184
- expect(result.style).toBe("italic")
183
+ expect(result.weight).toBe('bold')
184
+ expect(result.style).toBe('italic')
185
185
  })
186
186
 
187
- it("later dimensions override earlier ones", () => {
187
+ it('later dimensions override earlier ones', () => {
188
188
  const result = getTheme({
189
- rocketstate: { state: "primary", size: "large" },
189
+ rocketstate: { state: 'primary', size: 'large' },
190
190
  themes: {
191
191
  state: { primary: { fontSize: 14 } },
192
192
  size: { large: { fontSize: 20 } },
@@ -196,63 +196,63 @@ describe("getTheme", () => {
196
196
  expect(result.fontSize).toBe(20)
197
197
  })
198
198
 
199
- it("does not mutate baseTheme", () => {
200
- const baseTheme = { color: "blue" }
199
+ it('does not mutate baseTheme', () => {
200
+ const baseTheme = { color: 'blue' }
201
201
  getTheme({
202
- rocketstate: { state: "primary" },
203
- themes: { state: { primary: { color: "red" } } },
202
+ rocketstate: { state: 'primary' },
203
+ themes: { state: { primary: { color: 'red' } } },
204
204
  baseTheme,
205
205
  })
206
- expect(baseTheme.color).toBe("blue")
206
+ expect(baseTheme.color).toBe('blue')
207
207
  })
208
208
  })
209
209
 
210
- describe("getTheme with transform dimensions", () => {
211
- it("applies transform function values after all static dimensions", () => {
210
+ describe('getTheme with transform dimensions', () => {
211
+ it('applies transform function values after all static dimensions', () => {
212
212
  const result = getTheme({
213
- rocketstate: { state: "primary", modifier: "outlined" },
213
+ rocketstate: { state: 'primary', modifier: 'outlined' },
214
214
  themes: {
215
- state: { primary: { backgroundColor: "blue", color: "white" } },
215
+ state: { primary: { backgroundColor: 'blue', color: 'white' } },
216
216
  modifier: {
217
217
  outlined: (theme: any) => ({
218
218
  color: theme.backgroundColor,
219
- backgroundColor: "transparent",
219
+ backgroundColor: 'transparent',
220
220
  }),
221
221
  },
222
222
  },
223
- baseTheme: { border: "none" },
223
+ baseTheme: { border: 'none' },
224
224
  transformKeys: { modifier: true },
225
225
  })
226
- expect(result.color).toBe("blue")
227
- expect(result.backgroundColor).toBe("transparent")
228
- expect(result.border).toBe("none")
226
+ expect(result.color).toBe('blue')
227
+ expect(result.backgroundColor).toBe('transparent')
228
+ expect(result.border).toBe('none')
229
229
  })
230
230
 
231
- it("transform receives accumulated theme, appTheme, mode, and css", () => {
231
+ it('transform receives accumulated theme, appTheme, mode, and css', () => {
232
232
  const transformFn = vi.fn((theme: any) => ({ derived: theme.color }))
233
- const appTheme = { colors: { primary: "blue" } }
233
+ const appTheme = { colors: { primary: 'blue' } }
234
234
  getTheme({
235
- rocketstate: { state: "primary", modifier: "test" },
235
+ rocketstate: { state: 'primary', modifier: 'test' },
236
236
  themes: {
237
- state: { primary: { color: "red" } },
237
+ state: { primary: { color: 'red' } },
238
238
  modifier: { test: transformFn },
239
239
  },
240
- baseTheme: { bg: "white" },
240
+ baseTheme: { bg: 'white' },
241
241
  transformKeys: { modifier: true },
242
242
  appTheme,
243
243
  })
244
244
  expect(transformFn).toHaveBeenCalledWith(
245
- expect.objectContaining({ bg: "white", color: "red" }),
245
+ expect.objectContaining({ bg: 'white', color: 'red' }),
246
246
  appTheme,
247
247
  expect.any(Function),
248
248
  expect.anything(),
249
249
  )
250
250
  })
251
251
 
252
- it("transform can use appTheme values", () => {
253
- const appTheme = { spacing: { lg: "2rem" } }
252
+ it('transform can use appTheme values', () => {
253
+ const appTheme = { spacing: { lg: '2rem' } }
254
254
  const result = getTheme({
255
- rocketstate: { modifier: "withSpacing" },
255
+ rocketstate: { modifier: 'withSpacing' },
256
256
  themes: {
257
257
  modifier: {
258
258
  withSpacing: (_theme: any, app: any) => ({
@@ -260,64 +260,64 @@ describe("getTheme with transform dimensions", () => {
260
260
  }),
261
261
  },
262
262
  },
263
- baseTheme: { color: "red" },
263
+ baseTheme: { color: 'red' },
264
264
  transformKeys: { modifier: true },
265
265
  appTheme,
266
266
  })
267
- expect(result.padding).toBe("2rem")
268
- expect(result.color).toBe("red")
267
+ expect(result.padding).toBe('2rem')
268
+ expect(result.color).toBe('red')
269
269
  })
270
270
 
271
- it("supports multiple transform values (multi dimension)", () => {
271
+ it('supports multiple transform values (multi dimension)', () => {
272
272
  const result = getTheme({
273
- rocketstate: { modifier: ["outlined", "rounded"] },
273
+ rocketstate: { modifier: ['outlined', 'rounded'] },
274
274
  themes: {
275
275
  modifier: {
276
276
  outlined: (theme: any) => ({
277
277
  color: theme.backgroundColor,
278
- backgroundColor: "transparent",
278
+ backgroundColor: 'transparent',
279
279
  }),
280
- rounded: () => ({ borderRadius: "999px" }),
280
+ rounded: () => ({ borderRadius: '999px' }),
281
281
  },
282
282
  },
283
- baseTheme: { backgroundColor: "blue", color: "white" },
283
+ baseTheme: { backgroundColor: 'blue', color: 'white' },
284
284
  transformKeys: { modifier: true },
285
285
  })
286
- expect(result.color).toBe("blue")
287
- expect(result.backgroundColor).toBe("transparent")
288
- expect(result.borderRadius).toBe("999px")
286
+ expect(result.color).toBe('blue')
287
+ expect(result.backgroundColor).toBe('transparent')
288
+ expect(result.borderRadius).toBe('999px')
289
289
  })
290
290
 
291
- it("transforms compose — later transform sees earlier transform results", () => {
291
+ it('transforms compose — later transform sees earlier transform results', () => {
292
292
  const result = getTheme({
293
- rocketstate: { modifier: ["first", "second"] },
293
+ rocketstate: { modifier: ['first', 'second'] },
294
294
  themes: {
295
295
  modifier: {
296
- first: () => ({ step: "one" }),
296
+ first: () => ({ step: 'one' }),
297
297
  second: (theme: any) => ({ sawStep: theme.step }),
298
298
  },
299
299
  },
300
300
  baseTheme: {},
301
301
  transformKeys: { modifier: true },
302
302
  })
303
- expect(result.step).toBe("one")
304
- expect(result.sawStep).toBe("one")
303
+ expect(result.step).toBe('one')
304
+ expect(result.sawStep).toBe('one')
305
305
  })
306
306
 
307
- it("works without transformKeys (backward compatible)", () => {
307
+ it('works without transformKeys (backward compatible)', () => {
308
308
  const result = getTheme({
309
- rocketstate: { state: "primary" },
310
- themes: { state: { primary: { color: "red" } } },
311
- baseTheme: { bg: "white" },
309
+ rocketstate: { state: 'primary' },
310
+ themes: { state: { primary: { color: 'red' } } },
311
+ baseTheme: { bg: 'white' },
312
312
  })
313
- expect(result.color).toBe("red")
314
- expect(result.bg).toBe("white")
313
+ expect(result.color).toBe('red')
314
+ expect(result.bg).toBe('white')
315
315
  })
316
316
 
317
- it("non-transform dimension treats function values as regular merge (not called as transform)", () => {
318
- const fn = vi.fn(() => ({ color: "red" }))
317
+ it('non-transform dimension treats function values as regular merge (not called as transform)', () => {
318
+ const fn = vi.fn(() => ({ color: 'red' }))
319
319
  getTheme({
320
- rocketstate: { state: "primary" },
320
+ rocketstate: { state: 'primary' },
321
321
  themes: { state: { primary: fn } },
322
322
  baseTheme: {},
323
323
  transformKeys: {},
@@ -325,25 +325,25 @@ describe("getTheme with transform dimensions", () => {
325
325
  expect(fn).not.toHaveBeenCalled()
326
326
  })
327
327
 
328
- it("transform dimension not in rocketstate is ignored", () => {
329
- const transformFn = vi.fn(() => ({ color: "red" }))
328
+ it('transform dimension not in rocketstate is ignored', () => {
329
+ const transformFn = vi.fn(() => ({ color: 'red' }))
330
330
  const result = getTheme({
331
- rocketstate: { state: "primary" },
331
+ rocketstate: { state: 'primary' },
332
332
  themes: {
333
- state: { primary: { color: "blue" } },
333
+ state: { primary: { color: 'blue' } },
334
334
  modifier: { outlined: transformFn },
335
335
  },
336
336
  baseTheme: {},
337
337
  transformKeys: { modifier: true },
338
338
  })
339
339
  expect(transformFn).not.toHaveBeenCalled()
340
- expect(result.color).toBe("blue")
340
+ expect(result.color).toBe('blue')
341
341
  })
342
342
 
343
- it("transform does not mutate baseTheme", () => {
344
- const baseTheme = { color: "blue", bg: "white" }
343
+ it('transform does not mutate baseTheme', () => {
344
+ const baseTheme = { color: 'blue', bg: 'white' }
345
345
  getTheme({
346
- rocketstate: { modifier: "flip" },
346
+ rocketstate: { modifier: 'flip' },
347
347
  themes: {
348
348
  modifier: {
349
349
  flip: (theme: any) => ({ color: theme.bg, bg: theme.color }),
@@ -352,25 +352,25 @@ describe("getTheme with transform dimensions", () => {
352
352
  baseTheme,
353
353
  transformKeys: { modifier: true },
354
354
  })
355
- expect(baseTheme.color).toBe("blue")
356
- expect(baseTheme.bg).toBe("white")
355
+ expect(baseTheme.color).toBe('blue')
356
+ expect(baseTheme.bg).toBe('white')
357
357
  })
358
358
 
359
- it("transform with deep nested theme values", () => {
359
+ it('transform with deep nested theme values', () => {
360
360
  const result = getTheme({
361
- rocketstate: { state: "primary", modifier: "outlined" },
361
+ rocketstate: { state: 'primary', modifier: 'outlined' },
362
362
  themes: {
363
363
  state: {
364
364
  primary: {
365
- backgroundColor: "blue",
366
- color: "white",
367
- hover: { backgroundColor: "darkblue" },
365
+ backgroundColor: 'blue',
366
+ color: 'white',
367
+ hover: { backgroundColor: 'darkblue' },
368
368
  },
369
369
  },
370
370
  modifier: {
371
371
  outlined: (theme: any) => ({
372
372
  color: theme.backgroundColor,
373
- backgroundColor: "transparent",
373
+ backgroundColor: 'transparent',
374
374
  hover: {
375
375
  backgroundColor: theme.backgroundColor,
376
376
  color: theme.color,
@@ -381,17 +381,17 @@ describe("getTheme with transform dimensions", () => {
381
381
  baseTheme: {},
382
382
  transformKeys: { modifier: true },
383
383
  })
384
- expect(result.color).toBe("blue")
385
- expect(result.backgroundColor).toBe("transparent")
384
+ expect(result.color).toBe('blue')
385
+ expect(result.backgroundColor).toBe('transparent')
386
386
  const hover = result.hover as Record<string, any>
387
- expect(hover.backgroundColor).toBe("blue")
388
- expect(hover.color).toBe("white")
387
+ expect(hover.backgroundColor).toBe('blue')
388
+ expect(hover.color).toBe('white')
389
389
  })
390
390
 
391
- it("appTheme defaults to empty object when not provided", () => {
391
+ it('appTheme defaults to empty object when not provided', () => {
392
392
  const transformFn = vi.fn(() => ({}))
393
393
  getTheme({
394
- rocketstate: { modifier: "test" },
394
+ rocketstate: { modifier: 'test' },
395
395
  themes: { modifier: { test: transformFn } },
396
396
  baseTheme: {},
397
397
  transformKeys: { modifier: true },
@@ -404,60 +404,60 @@ describe("getTheme with transform dimensions", () => {
404
404
  )
405
405
  })
406
406
 
407
- it("transform with mode callback produces light/dark values", () => {
407
+ it('transform with mode callback produces light/dark values', () => {
408
408
  const result = getTheme({
409
- rocketstate: { modifier: "themed" },
409
+ rocketstate: { modifier: 'themed' },
410
410
  themes: {
411
411
  modifier: {
412
412
  themed: (_theme: any, _app: any, mode: any) => ({
413
- shadow: mode("0 2px 4px rgba(0,0,0,0.1)", "none"),
413
+ shadow: mode('0 2px 4px rgba(0,0,0,0.1)', 'none'),
414
414
  }),
415
415
  },
416
416
  },
417
417
  baseTheme: {},
418
418
  transformKeys: { modifier: true },
419
419
  })
420
- expect(typeof result.shadow).toBe("function")
420
+ expect(typeof result.shadow).toBe('function')
421
421
  })
422
422
  })
423
423
 
424
- describe("getThemeByMode", () => {
425
- it("returns scalar values as-is", () => {
426
- const result = getThemeByMode({ color: "red", size: 16 }, "light")
427
- expect(result).toEqual({ color: "red", size: 16 })
424
+ describe('getThemeByMode', () => {
425
+ it('returns scalar values as-is', () => {
426
+ const result = getThemeByMode({ color: 'red', size: 16 }, 'light')
427
+ expect(result).toEqual({ color: 'red', size: 16 })
428
428
  })
429
429
 
430
- it("recursively processes nested objects", () => {
431
- const result = getThemeByMode({ nested: { color: "red" } }, "light")
432
- expect(result).toEqual({ nested: { color: "red" } })
430
+ it('recursively processes nested objects', () => {
431
+ const result = getThemeByMode({ nested: { color: 'red' } }, 'light')
432
+ expect(result).toEqual({ nested: { color: 'red' } })
433
433
  })
434
434
 
435
- it("resolves mode callbacks for light", () => {
436
- const cb = themeModeCallback("lightColor", "darkColor")
437
- const result: any = getThemeByMode({ color: cb }, "light")
438
- expect(result.color).toBe("lightColor")
435
+ it('resolves mode callbacks for light', () => {
436
+ const cb = themeModeCallback('lightColor', 'darkColor')
437
+ const result: any = getThemeByMode({ color: cb }, 'light')
438
+ expect(result.color).toBe('lightColor')
439
439
  })
440
440
 
441
- it("resolves mode callbacks for dark", () => {
442
- const cb = themeModeCallback("lightColor", "darkColor")
443
- const result: any = getThemeByMode({ color: cb }, "dark")
444
- expect(result.color).toBe("darkColor")
441
+ it('resolves mode callbacks for dark', () => {
442
+ const cb = themeModeCallback('lightColor', 'darkColor')
443
+ const result: any = getThemeByMode({ color: cb }, 'dark')
444
+ expect(result.color).toBe('darkColor')
445
445
  })
446
446
 
447
- it("resolves nested mode callbacks", () => {
448
- const cb = themeModeCallback("lightBg", "darkBg")
449
- const result: any = getThemeByMode({ nested: { bg: cb } }, "light")
450
- expect(result.nested.bg).toBe("lightBg")
447
+ it('resolves nested mode callbacks', () => {
448
+ const cb = themeModeCallback('lightBg', 'darkBg')
449
+ const result: any = getThemeByMode({ nested: { bg: cb } }, 'light')
450
+ expect(result.nested.bg).toBe('lightBg')
451
451
  })
452
452
 
453
- it("handles mixed values and mode callbacks", () => {
454
- const cb = themeModeCallback("#fff", "#000")
453
+ it('handles mixed values and mode callbacks', () => {
454
+ const cb = themeModeCallback('#fff', '#000')
455
455
  const result: any = getThemeByMode(
456
- { bg: cb, fontSize: 16, nested: { color: "static" } },
457
- "dark",
456
+ { bg: cb, fontSize: 16, nested: { color: 'static' } },
457
+ 'dark',
458
458
  )
459
- expect(result.bg).toBe("#000")
459
+ expect(result.bg).toBe('#000')
460
460
  expect(result.fontSize).toBe(16)
461
- expect(result.nested.color).toBe("static")
461
+ expect(result.nested.color).toBe('static')
462
462
  })
463
463
  })
@@ -1,3 +1,3 @@
1
- import LocalThemeManager from "./LocalThemeManager"
1
+ import LocalThemeManager from './LocalThemeManager'
2
2
 
3
3
  export { LocalThemeManager }