@plumeria/core 13.0.1 → 13.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/css.d.ts CHANGED
@@ -19,12 +19,12 @@ declare module '@plumeria/core' {
19
19
  CSSProperties,
20
20
  CreateStyleValue,
21
21
  CreateReturnType,
22
- CreateStatic,
23
22
  CreateTheme,
24
23
  CreateThemeReturnType,
24
+ CreateStatic,
25
+ Variants,
25
26
  Keyframes,
26
27
  ViewTransition,
27
- Variants,
28
28
  Marker,
29
29
  Extended,
30
30
  } from '#types';
package/lib/types.d.ts CHANGED
@@ -42,23 +42,39 @@ type CSSProperties =
42
42
 
43
43
  type CreateStyleValue = CSSProperties | ((...args: any[]) => CSSProperties);
44
44
 
45
- type CreateReturnType<T> = {
46
- [K in keyof T]: T[K] extends (...args: infer A) => infer R
47
- ? (...args: A) => Readonly<R>
48
- : Readonly<T[K]>;
45
+ const ClassNameTag: unique symbol;
46
+
47
+ type AtomicClassNameFor<out P extends string, out V> = string & {
48
+ readonly _ident: typeof ClassNameTag;
49
+ readonly _key: P;
50
+ readonly _value: V;
49
51
  };
50
52
 
53
+ type MapNamespace<T> = Readonly<{
54
+ [key in keyof T]: T[key] extends Record<string, unknown>
55
+ ? key extends `:${string}` | `@${string}` | `[${string}`
56
+ ? MapNamespace<T[key]>
57
+ : AtomicClassNameFor<key & string, T[key]>
58
+ : key extends string
59
+ ? AtomicClassNameFor<key, T[key]>
60
+ : never;
61
+ }>;
62
+
63
+ type CreateReturnType<T> = Readonly<{
64
+ [K in keyof T]: T[K] extends (...args: infer A) => infer R
65
+ ? (...args: A) => MapNamespace<R>
66
+ : MapNamespace<T[K]>;
67
+ }>;
68
+
51
69
  type StyleName = CSSProperties | (false | CSSProperties | null | undefined)[];
52
70
 
53
71
  type CreateStatic = Record<string, string | number>;
54
72
 
55
- type ReadonlyTheme<T> = Readonly<T> & CSSVariableValue;
56
-
57
73
  type CreateTheme = {
58
74
  [key: string]: ThemeValue;
59
75
  };
60
76
  type CreateThemeReturnType<T> = {
61
- readonly [K in keyof T]: ReadonlyTheme<T[K]>;
77
+ readonly [K in keyof T]: Readonly<T[K]>;
62
78
  };
63
79
 
64
80
  type KeyframesInSelector = 'from' | 'to' | `${number}%`;
@@ -89,12 +105,13 @@ export type {
89
105
  StyleName,
90
106
  CreateStyleValue,
91
107
  CreateReturnType,
92
- CreateStatic,
93
108
  CreateTheme,
94
- Keyframes,
95
- ViewTransition,
96
109
  CreateThemeReturnType,
110
+ CreateStatic,
97
111
  Variants,
112
+ Keyframes,
113
+ ViewTransition,
98
114
  Marker,
99
115
  Extended,
116
+ AtomicClassNameFor,
100
117
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "13.0.1",
3
+ "version": "13.1.0",
4
4
  "description": "Zero-cost abstraction layer for styling React components.",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",