@plumeria/core 19.0.0 → 19.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
@@ -15,6 +15,8 @@
15
15
  declare module '@plumeria/core' {
16
16
  import type {
17
17
  AtomicClassNameFor,
18
+ AtomicStyle,
19
+ AtomicDynamicStyle,
18
20
  Style,
19
21
  StyleProps,
20
22
  StaticStyles,
@@ -34,6 +36,8 @@ declare module '@plumeria/core' {
34
36
 
35
37
  export type {
36
38
  AtomicClassNameFor,
39
+ AtomicStyle,
40
+ AtomicDynamicStyle,
37
41
  Style,
38
42
  StyleProps,
39
43
  StaticStyles,
package/lib/types.d.ts CHANGED
@@ -24,12 +24,8 @@ type ColonSelector = {
24
24
  [key in ColonString]: CommonProperties | CSSVariableProperty;
25
25
  };
26
26
 
27
- type AtRule =
28
- | `@media ${string}`
29
- | `@container ${string}`
30
- | `@supports ${string}`
31
- | `@layer ${string}`
32
- | `@scope ${string}`;
27
+ type AtKeyword = '@media' | '@container' | '@supports' | '@layer' | '@scope';
28
+ type AtRule = `${AtKeyword} ${string}` | `${AtKeyword}(${string}`;
33
29
 
34
30
  type StyleKey = keyof CSSTypes;
35
31
  type NestedKey = ColonString | ArrayString | AtRule;
@@ -59,26 +55,30 @@ type AtomicClassNameFor<P extends string, V> = string & {
59
55
  readonly _value: V;
60
56
  };
61
57
 
62
- type MapNamespace<T> = Readonly<{
58
+ declare const StyleTag: unique symbol;
59
+
60
+ type AtomicStyle<T> = Readonly<{
63
61
  [key in keyof T]: T[key] extends Record<string, unknown>
64
62
  ? key extends NestedKey
65
- ? MapNamespace<T[key]>
63
+ ? AtomicStyle<T[key]>
66
64
  : AtomicClassNameFor<key & string, T[key]>
67
65
  : key extends string
68
66
  ? AtomicClassNameFor<key, T[key]>
69
67
  : never;
70
- }>;
68
+ }> & {
69
+ readonly [StyleTag]: true;
70
+ };
71
71
 
72
72
  declare const DynamicTag: unique symbol;
73
73
 
74
- type DynamicNamespace<T> = MapNamespace<T> & {
74
+ type AtomicDynamicStyle<T> = AtomicStyle<T> & {
75
75
  readonly [DynamicTag]: true;
76
76
  };
77
77
 
78
78
  type CreateReturnType<T> = Readonly<{
79
79
  [K in keyof T]: T[K] extends (...args: infer A) => infer R
80
- ? (...args: A) => DynamicNamespace<R>
81
- : MapNamespace<T[K]>;
80
+ ? (...args: A) => AtomicDynamicStyle<R>
81
+ : AtomicStyle<T[K]>;
82
82
  }>;
83
83
  type FlatNamespace<K extends StyleKey> = {
84
84
  readonly [P in StyleKey]?: P extends K
@@ -91,7 +91,9 @@ interface NestedNamespace<K extends StyleKey> {
91
91
  }
92
92
 
93
93
  type AllowedNamespace<K extends StyleKey> = FlatNamespace<K> &
94
- NestedNamespace<K>;
94
+ NestedNamespace<K> & {
95
+ readonly [StyleTag]: true;
96
+ };
95
97
 
96
98
  type StyleList<T> = T | false | null | undefined | StyleList<T>[];
97
99
 
@@ -141,10 +143,12 @@ type Extended<
141
143
  P extends string,
142
144
  > = `@container style(--${I}-${StripColon<P>}: 1)`;
143
145
 
144
- type Marker = Record<Extended<string, string>, CSSProperties>;
146
+ type Marker = Readonly<Record<ColonString, CSSVariableProperty>>;
145
147
 
146
148
  export type {
147
149
  AtomicClassNameFor,
150
+ AtomicStyle,
151
+ AtomicDynamicStyle,
148
152
  Style,
149
153
  StyleProps,
150
154
  StaticStyles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "19.0.0",
3
+ "version": "19.1.0",
4
4
  "description": "Zero-cost abstraction layer for styling React components.",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",