@plumeria/core 7.2.4 → 7.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "7.2.4",
3
+ "version": "7.3.1",
4
4
  "description": "A type-only atomic CSS framework.",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -22,9 +22,9 @@
22
22
  "stylex",
23
23
  "react-native-web"
24
24
  ],
25
- "types": "lib/css.d.ts",
25
+ "types": "types/css.d.ts",
26
26
  "files": [
27
- "lib"
27
+ "types"
28
28
  ],
29
29
  "dependencies": {
30
30
  "csstype": "^3.2.3"
package/types/css.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Type definitions only. Configure the bundler plugin for extraction.
3
+ *```ts
4
+ * type create = <const T extends Record<string, CSSProperties>>(_rule: CreateStyleType<T>)=> ReturnType<T>;
5
+ * type props = (..._rules: (false | CSSProperties | null | undefined)[])=> string;
6
+ * type createTheme = <const T extends CreateTheme>(_rule: T)=> ReturnVariableType<T>;
7
+ * type createStatic = <const T extends CreateStatic>(_rule: T)=> T;
8
+ * type keyframes = (_rule: Keyframes) => string;
9
+ * type viewTransition = (_rule: ViewTransition) => string;
10
+ * type variants = <T extends Variants>(_rule: T) => (_props: { [K in keyof T]?: keyof T[K] }) => CSSProperties;
11
+ * type marker = (_id: string, _pseudo: string) => Marker;
12
+ * type extended = <I extends string, P extends string>(_id: I, _pseudo: P) => Extended<I, P>;
13
+ * ```
14
+ */
15
+ declare module '@plumeria/core' {
16
+ export type CSSProperties = import('./definitions').CSSProperties;
17
+ export type CreateStyle = import('./definitions').CreateStyle;
18
+ export type CreateStyleType<T> = import('./definitions').CreateStyleType<T>;
19
+ export type CreateStatic = import('./definitions').CreateStatic;
20
+ export type CreateTheme = import('./definitions').CreateTheme;
21
+ export type Keyframes = import('./definitions').Keyframes;
22
+ export type ViewTransition = import('./definitions').ViewTransition;
23
+ export type ReturnType<T> = import('./definitions').ReturnType<T>;
24
+ export type ReturnVariableType<T> = import('./definitions').ReturnVariableType<T>;
25
+ export type Variants = import('./definitions').Variants;
26
+ export type Marker = import('./definitions').Marker;
27
+ export type Extended<I extends string, P extends string> = import('./definitions').Extended<I, P>;
28
+ export type ContainerStyleQuery = import('./definitions').ContainerStyleQuery;
29
+ export type create = <const T extends Record<string, CSSProperties>>(_rule: CreateStyleType<T>)=> ReturnType<T>;
30
+ export type props = (..._rules: (false | CSSProperties | null | undefined)[])=> string;
31
+ export type createTheme = <const T extends CreateTheme>(_rule: T)=> ReturnVariableType<T>;
32
+ export type createStatic = <const T extends CreateStatic>(_rule: T)=> T;
33
+ export type keyframes = (_rule: Keyframes) => string;
34
+ export type viewTransition = (_rule: ViewTransition) => string;
35
+ export type variants = <T extends Variants>(_rule: T) => (_props: { [K in keyof T]?: keyof T[K] }) => CSSProperties;
36
+ export type marker = (_id: string, _pseudo: string) => Marker;
37
+ export type extended = <I extends string, P extends string>(_id: I, _pseudo: P) => Extended<I, P>;
38
+ export const create: create;
39
+ export const props: props;
40
+ export const createTheme: createTheme;
41
+ export const createStatic: createStatic;
42
+ export const keyframes: keyframes;
43
+ export const viewTransition: viewTransition;
44
+ export const variants: variants;
45
+ export const marker: marker;
46
+ export const extended: extended;
47
+ }
@@ -103,19 +103,9 @@ type CreateStyle = {
103
103
  [key: string]: CSSProperties;
104
104
  };
105
105
 
106
- type Selector<Properties> = {
107
- readonly properties: Properties;
108
- };
109
-
110
106
  type ReturnType<T> = {
111
107
  [K in keyof T]: Readonly<{
112
- [P in keyof T[K]]: P extends
113
- | `@media ${string}`
114
- | `@container ${string}`
115
- | `:${string}`
116
- | `[${string}`
117
- ? Selector<keyof T[K][P]>
118
- : T[K][P];
108
+ [P in keyof T[K]]: T[K][P];
119
109
  }>;
120
110
  };
121
111
 
@@ -138,7 +128,13 @@ type ViewTransition = {
138
128
 
139
129
  type Variants = Record<string, Record<string, CSSProperties>>;
140
130
 
141
- type ContainerStyleQuery = `@container style(--${string}: 1)`;
131
+ type Marker = Record<string, CSSProperties>;
132
+
133
+ type StripColon<T extends string> = T extends `:${infer R}`
134
+ ? StripColon<R>
135
+ : T;
136
+
137
+ type Extended<I extends string, P extends string> = `@container style(--${I}-${StripColon<P>}: 1)`;
142
138
 
143
139
  export type {
144
140
  CSSProperties,
@@ -151,5 +147,6 @@ export type {
151
147
  ReturnType,
152
148
  ReturnVariableType,
153
149
  Variants,
154
- ContainerStyleQuery,
150
+ Marker,
151
+ Extended,
155
152
  };
package/lib/css.d.ts DELETED
@@ -1,36 +0,0 @@
1
- /**
2
- * ```ts
3
- * function create<const T extends Record<string, CSSProperties>>(_rule: CreateStyleType<T>): ReturnType<T>;
4
- * function props(..._rules: (false | CSSProperties | null | undefined)[]): string;
5
- * function createTheme<const T extends CreateTheme>(_rule: T): ReturnVariableType<T>;
6
- * function createStatic<const T extends CreateStatic>(_rule: T): T;
7
- * function keyframes(_rule: Keyframes): string;
8
- * function viewTransition(_rule: ViewTransition): string;
9
- * function variants<T extends Variant>(_rule: T): (_props: { [K in keyof T]?: keyof T[K] }) => CSSProperties;
10
- * function marker(_id: string, _pseudo: string): CSSProperties;
11
- * function extended(_id: string, _pseudo: string): ContainerStyleQuery;
12
- * ```
13
- * Type definitions only. Configure the bundler plugin for extraction.
14
- */
15
- declare module '@plumeria/core' {
16
- export type CSSProperties = import('./definition').CSSProperties;
17
- export type CreateStyle = import('./definition').CreateStyle;
18
- export type CreateStyleType<T> = import('./definition').CreateStyleType<T>;
19
- export type CreateStatic = import('./definition').CreateStatic;
20
- export type CreateTheme = import('./definition').CreateTheme;
21
- export type Keyframes = import('./definition').Keyframes;
22
- export type ViewTransition = import('./definition').ViewTransition;
23
- export type ReturnType<T> = import('./definition').ReturnType<T>;
24
- export type ReturnVariableType<T> = import('./definition').ReturnVariableType<T>;
25
- export type Variants = import('./definition').Variants;
26
- export type ContainerStyleQuery = import('./definition').ContainerStyleQuery;
27
- export function create<const T extends Record<string, CSSProperties>>(_rule: CreateStyleType<T>): ReturnType<T>;
28
- export function props(..._rules: (false | CSSProperties | null | undefined)[]): string;
29
- export function createTheme<const T extends CreateTheme>(_rule: T): ReturnVariableType<T>;
30
- export function createStatic<const T extends CreateStatic>(_rule: T): T;
31
- export function keyframes(_rule: Keyframes): string;
32
- export function viewTransition(_rule: ViewTransition): string;
33
- export function variants<T extends Variants>(_rule: T): (_props: { [K in keyof T]?: keyof T[K] }) => CSSProperties;
34
- export function marker(_id: string, _pseudo: string): CSSProperties;
35
- export function extended(_id: string, _pseudo: string): ContainerStyleQuery;
36
- }