@plumeria/core 7.2.1 → 7.2.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @plumeria/core
2
2
 
3
- An atomic CSS runtime designed to disappear.
3
+ Atomic CSS framework with type definitions only.
4
4
 
5
5
  ```ts
6
6
  import * as css from '@plumeria/core';
package/lib/css.d.ts ADDED
@@ -0,0 +1,40 @@
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
+
16
+
17
+
18
+
19
+ declare module '@plumeria/core' {
20
+ export type CSSProperties = import('./definition').CSSProperties;
21
+ export type CreateStyle = import('./definition').CreateStyle;
22
+ export type CreateStyleType<T> = import('./definition').CreateStyleType<T>;
23
+ export type CreateStatic = import('./definition').CreateStatic;
24
+ export type CreateTheme = import('./definition').CreateTheme;
25
+ export type Keyframes = import('./definition').Keyframes;
26
+ export type ViewTransition = import('./definition').ViewTransition;
27
+ export type ReturnType<T> = import('./definition').ReturnType<T>;
28
+ export type ReturnVariableType<T> = import('./definition').ReturnVariableType<T>;
29
+ export type Variants = import('./definition').Variants;
30
+ export type ContainerStyleQuery = import('./definition').ContainerStyleQuery;
31
+ export function create<const T extends Record<string, CSSProperties>>(_rule: CreateStyleType<T>): ReturnType<T>;
32
+ export function props(..._rules: (false | CSSProperties | null | undefined)[]): string;
33
+ export function createTheme<const T extends CreateTheme>(_rule: T): ReturnVariableType<T>;
34
+ export function createStatic<const T extends CreateStatic>(_rule: T): T;
35
+ export function keyframes(_rule: Keyframes): string;
36
+ export function viewTransition(_rule: ViewTransition): string;
37
+ export function variants<T extends Variants>(_rule: T): (_props: { [K in keyof T]?: keyof T[K] }) => CSSProperties;
38
+ export function marker(_id: string, _pseudo: string): CSSProperties;
39
+ export function extended(_id: string, _pseudo: string): ContainerStyleQuery;
40
+ }
@@ -0,0 +1,155 @@
1
+ import type { Properties, Property } from 'csstype';
2
+
3
+ type CSSVariableKey = `--${string}`;
4
+ type CSSVariableValue = `var(${CSSVariableKey})`;
5
+ type CSSVariableProperty = { [key: CSSVariableKey]: string | number };
6
+
7
+ type ColorValue = Exclude<Property.Color, '-moz-initial'> | (string & {});
8
+ type CSSColorProperty = Exclude<ColorValue, SystemColorKeyword>;
9
+
10
+ type SystemColorKeyword =
11
+ | 'ActiveBorder'
12
+ | 'ActiveCaption'
13
+ | 'AppWorkspace'
14
+ | 'Background'
15
+ | 'ButtonFace'
16
+ | 'ButtonHighlight'
17
+ | 'ButtonShadow'
18
+ | 'ButtonText'
19
+ | 'CaptionText'
20
+ | 'GrayText'
21
+ | 'Highlight'
22
+ | 'HighlightText'
23
+ | 'InactiveBorder'
24
+ | 'InactiveCaption'
25
+ | 'InactiveCaptionText'
26
+ | 'InfoBackground'
27
+ | 'InfoText'
28
+ | 'Menu'
29
+ | 'MenuText'
30
+ | 'Scrollbar'
31
+ | 'ThreeDDarkShadow'
32
+ | 'ThreeDFace'
33
+ | 'ThreeDHighlight'
34
+ | 'ThreeDLightShadow'
35
+ | 'ThreeDShadow'
36
+ | 'Window'
37
+ | 'WindowFrame'
38
+ | 'WindowText';
39
+
40
+ type ExcludeMozInitial<T> = Exclude<T, '-moz-initial'>;
41
+
42
+ type CSSTypeProperties = Properties<number | (string & {})>;
43
+
44
+ type CustomProperties = {
45
+ [K in keyof CSSTypeProperties]: ExcludeMozInitial<CSSTypeProperties[K]>;
46
+ };
47
+
48
+ type BaseCSSProperties = {
49
+ [K in keyof CustomProperties]: CustomProperties[K] | CSSVariableValue;
50
+ };
51
+
52
+ interface CommonProperties extends BaseCSSProperties {
53
+ accentColor?: CSSColorProperty;
54
+ color?: CSSColorProperty;
55
+ borderLeftColor?: CSSColorProperty;
56
+ borderRightColor?: CSSColorProperty;
57
+ borderTopColor?: CSSColorProperty;
58
+ borderBottomColor?: CSSColorProperty;
59
+ borderBlockColor?: CSSColorProperty;
60
+ borderBlockStartColor?: CSSColorProperty;
61
+ borderBlockEndColor?: CSSColorProperty;
62
+ borderInlineColor?: CSSColorProperty;
63
+ borderInlineStartColor?: CSSColorProperty;
64
+ borderInlineEndColor?: CSSColorProperty;
65
+ backgroundColor?: CSSColorProperty;
66
+ outlineColor?: CSSColorProperty;
67
+ textDecorationColor?: CSSColorProperty;
68
+ caretColor?: CSSColorProperty;
69
+ columnRuleColor?: CSSColorProperty;
70
+ }
71
+
72
+ type ArrayString = `[${string}`;
73
+ type ArraySelector = {
74
+ [key in ArrayString]: CommonProperties | CSSVariableProperty;
75
+ };
76
+
77
+ type ColonString = `:${string}`;
78
+ type ColonSelector = {
79
+ [key in ColonString]: CommonProperties | CSSVariableProperty;
80
+ };
81
+
82
+ type Query = `@media ${string}` | `@container ${string}`;
83
+ type QuerySelector = {
84
+ [K in Query]:
85
+ | CommonProperties
86
+ | ColonSelector
87
+ | ArraySelector
88
+ | CSSVariableProperty;
89
+ };
90
+
91
+ type CSSProperties =
92
+ | CommonProperties
93
+ | ArraySelector
94
+ | ColonSelector
95
+ | QuerySelector
96
+ | CSSVariableProperty;
97
+
98
+ type CreateStyleType<T> = {
99
+ readonly [K in keyof T]: T[K] extends CSSProperties ? CSSProperties : T[K];
100
+ };
101
+
102
+ type CreateStyle = {
103
+ [key: string]: CSSProperties;
104
+ };
105
+
106
+ type Selector<Properties> = {
107
+ readonly properties: Properties;
108
+ };
109
+
110
+ type ReturnType<T> = {
111
+ [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];
119
+ }>;
120
+ };
121
+
122
+ type CreateStatic = Record<string, string | number>;
123
+
124
+ type CreateTheme = Record<string, Record<string, string | number>>;
125
+ type ReturnVariableType<T> = { [K in keyof T]: CSSVariableValue };
126
+
127
+ type KeyframesInSelector = 'from' | 'to' | `${number}%`;
128
+ type Keyframes = {
129
+ [K in KeyframesInSelector]?: CSSProperties;
130
+ };
131
+
132
+ type ViewTransition = {
133
+ group?: CSSProperties;
134
+ imagePair?: CSSProperties;
135
+ new?: CSSProperties;
136
+ old?: CSSProperties;
137
+ };
138
+
139
+ type Variants = Record<string, Record<string, CSSProperties>>;
140
+
141
+ type ContainerStyleQuery = `@container style(--${string}: 1)`;
142
+
143
+ export type {
144
+ CSSProperties,
145
+ CreateStyle,
146
+ CreateStyleType,
147
+ CreateStatic,
148
+ CreateTheme,
149
+ Keyframes,
150
+ ViewTransition,
151
+ ReturnType,
152
+ ReturnVariableType,
153
+ Variants,
154
+ ContainerStyleQuery,
155
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "7.2.1",
4
- "description": "An atomic CSS runtime designed to disappear.",
3
+ "version": "7.2.3",
4
+ "description": "Atomic CSS framework with type definitions only.",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/refirst11",
@@ -17,19 +17,14 @@
17
17
  "keywords": [
18
18
  "plumeria",
19
19
  "atomic-css",
20
- "css-in-js",
21
- "css",
20
+ "atomic-css-types",
22
21
  "linaria",
23
22
  "stylex",
24
23
  "react-native-web"
25
24
  ],
26
- "sideEffects": false,
27
- "type": "module",
28
- "main": "dist/index.js",
29
- "module": "dist/index.js",
30
- "types": "dist/index.d.ts",
25
+ "types": "lib/css.d.ts",
31
26
  "files": [
32
- "dist/"
27
+ "lib"
33
28
  ],
34
29
  "dependencies": {
35
30
  "csstype": "^3.2.3"
@@ -37,9 +32,5 @@
37
32
  "publishConfig": {
38
33
  "access": "public",
39
34
  "provenance": true
40
- },
41
- "scripts": {
42
- "build": "rimraf dist && pnpm esm",
43
- "esm": "tsc --project tsconfig.esm.json"
44
35
  }
45
36
  }
package/dist/css.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import type { CSSProperties, CreateStyleType, CreateStatic, CreateTheme, Keyframes, ViewTransition, ReturnType, ReturnVariableType, Variant, ContainerStyleQuery } from './types';
2
- export type create = typeof create;
3
- export type props = typeof props;
4
- export type createTheme = typeof createTheme;
5
- export type createStatic = typeof createStatic;
6
- export type keyframes = typeof keyframes;
7
- export type viewTransition = typeof viewTransition;
8
- export type variants = typeof variants;
9
- export type marker = typeof marker;
10
- export type extended = typeof extended;
11
- export declare const create: <const T extends Record<string, CSSProperties>>(_rule: CreateStyleType<T>) => ReturnType<T>;
12
- export declare const props: (..._rules: (false | CSSProperties | null | undefined)[]) => string;
13
- export declare const createTheme: <const T extends CreateTheme>(_rule: T) => ReturnVariableType<T>;
14
- export declare const createStatic: <const T extends CreateStatic>(_rule: T) => T;
15
- export declare const keyframes: (_rule: Keyframes) => string;
16
- export declare const viewTransition: (_rule: ViewTransition) => string;
17
- export declare const variants: <T extends Variant>(_rule: T) => (_props: { [K in keyof T]?: keyof T[K]; }) => CSSProperties;
18
- export declare const marker: (_id: string, _pseudo: string) => CSSProperties;
19
- export declare const extended: (_id: string, _pseudo: string) => ContainerStyleQuery;
20
- export type { CreateStyle, CSSProperties } from './types';
package/dist/css.js DELETED
@@ -1,12 +0,0 @@
1
- const runtimeNotSupported = () => {
2
- throw new Error('Runtime is not supported. Configure the bundler plugin.');
3
- };
4
- export const create = (_rule) => runtimeNotSupported();
5
- export const props = (..._rules) => runtimeNotSupported();
6
- export const createTheme = (_rule) => runtimeNotSupported();
7
- export const createStatic = (_rule) => runtimeNotSupported();
8
- export const keyframes = (_rule) => runtimeNotSupported();
9
- export const viewTransition = (_rule) => runtimeNotSupported();
10
- export const variants = (_rule) => (_props) => runtimeNotSupported();
11
- export const marker = (_id, _pseudo) => runtimeNotSupported();
12
- export const extended = (_id, _pseudo) => runtimeNotSupported();
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import * as css from './css';
2
- import type { StaticDefault } from './types';
3
- type css = StaticDefault;
4
- export * from './css';
5
- export default css;
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- import * as css from './css';
2
- export * from './css';
3
- export default css;
package/dist/types.d.ts DELETED
@@ -1,94 +0,0 @@
1
- import type { Properties, Property } from 'csstype';
2
- type CSSVariableKey = `--${string}`;
3
- type CSSVariableValue = `var(${CSSVariableKey})`;
4
- type CSSVariableProperty = {
5
- [key: CSSVariableKey]: string | number;
6
- };
7
- type ColorValue = Exclude<Property.Color, '-moz-initial'> | (string & {});
8
- type CSSColorProperty = Exclude<ColorValue, SystemColorKeyword>;
9
- type SystemColorKeyword = 'ActiveBorder' | 'ActiveCaption' | 'AppWorkspace' | 'Background' | 'ButtonFace' | 'ButtonHighlight' | 'ButtonShadow' | 'ButtonText' | 'CaptionText' | 'GrayText' | 'Highlight' | 'HighlightText' | 'InactiveBorder' | 'InactiveCaption' | 'InactiveCaptionText' | 'InfoBackground' | 'InfoText' | 'Menu' | 'MenuText' | 'Scrollbar' | 'ThreeDDarkShadow' | 'ThreeDFace' | 'ThreeDHighlight' | 'ThreeDLightShadow' | 'ThreeDShadow' | 'Window' | 'WindowFrame' | 'WindowText';
10
- type ExcludeMozInitial<T> = Exclude<T, '-moz-initial'>;
11
- type CSSTypeProperties = Properties<number | (string & {})>;
12
- type CustomProperties = {
13
- [K in keyof CSSTypeProperties]: ExcludeMozInitial<CSSTypeProperties[K]>;
14
- };
15
- type BaseCSSProperties = {
16
- [K in keyof CustomProperties]: CustomProperties[K] | CSSVariableValue;
17
- };
18
- interface CommonProperties extends BaseCSSProperties {
19
- accentColor?: CSSColorProperty;
20
- color?: CSSColorProperty;
21
- borderLeftColor?: CSSColorProperty;
22
- borderRightColor?: CSSColorProperty;
23
- borderTopColor?: CSSColorProperty;
24
- borderBottomColor?: CSSColorProperty;
25
- borderBlockColor?: CSSColorProperty;
26
- borderBlockStartColor?: CSSColorProperty;
27
- borderBlockEndColor?: CSSColorProperty;
28
- borderInlineColor?: CSSColorProperty;
29
- borderInlineStartColor?: CSSColorProperty;
30
- borderInlineEndColor?: CSSColorProperty;
31
- backgroundColor?: CSSColorProperty;
32
- outlineColor?: CSSColorProperty;
33
- textDecorationColor?: CSSColorProperty;
34
- caretColor?: CSSColorProperty;
35
- columnRuleColor?: CSSColorProperty;
36
- }
37
- type ArrayString = `[${string}`;
38
- type ArraySelector = {
39
- [key in ArrayString]: CommonProperties | CSSVariableProperty;
40
- };
41
- type ColonString = `:${string}`;
42
- type ColonSelector = {
43
- [key in ColonString]: CommonProperties | CSSVariableProperty;
44
- };
45
- type Query = `@media ${string}` | `@container ${string}`;
46
- type QuerySelector = {
47
- [K in Query]: CommonProperties | ColonSelector | ArraySelector | CSSVariableProperty;
48
- };
49
- type CSSProperties = CommonProperties | ArraySelector | ColonSelector | QuerySelector | CSSVariableProperty;
50
- type CreateStyleType<T> = {
51
- readonly [K in keyof T]: T[K] extends CSSProperties ? CSSProperties : T[K];
52
- };
53
- type CreateStyle = {
54
- [key: string]: CSSProperties;
55
- };
56
- type Selector<Properties> = {
57
- readonly properties: Properties;
58
- };
59
- type ReturnType<T> = {
60
- [K in keyof T]: Readonly<{
61
- [P in keyof T[K]]: P extends `@media ${string}` | `@container ${string}` | `:${string}` | `[${string}` ? Selector<keyof T[K][P]> : T[K][P];
62
- }>;
63
- };
64
- type CreateStatic = Record<string, string | number>;
65
- type CreateTheme = Record<string, Record<string, string | number>>;
66
- type ReturnVariableType<T> = {
67
- [K in keyof T]: CSSVariableValue;
68
- };
69
- type KeyframesInSelector = 'from' | 'to' | `${number}%`;
70
- type Keyframes = {
71
- [K in KeyframesInSelector]?: CSSProperties;
72
- };
73
- type ViewTransition = {
74
- group?: CSSProperties;
75
- imagePair?: CSSProperties;
76
- new?: CSSProperties;
77
- old?: CSSProperties;
78
- };
79
- type Variant = Record<string, Record<string, CSSProperties>>;
80
- type ContainerStyleQuery = `@container style(--${string}: 1)`;
81
- type StaticDefault = {
82
- create: <const T extends Record<string, CSSProperties>>(_rule: CreateStyleType<T>) => ReturnType<T>;
83
- props: (..._rules: (false | CSSProperties | null | undefined)[]) => string;
84
- createTheme: <const T extends CreateTheme>(_rule: T) => ReturnVariableType<T>;
85
- createStatic: <const T extends CreateStatic>(_rule: T) => T;
86
- keyframes: (_rule: Keyframes) => string;
87
- viewTransition: (_rule: ViewTransition) => string;
88
- variants: <T extends Variant>(_rule: T) => (_props: {
89
- [K in keyof T]?: keyof T[K];
90
- }) => CSSProperties;
91
- marker: (_id: string, _pseudo: string) => CSSProperties;
92
- extended: (_id: string, _pseudo: string) => ContainerStyleQuery;
93
- };
94
- export { StaticDefault, CSSProperties, CreateStyle, CreateStyleType, CreateStatic, CreateTheme, Keyframes, ViewTransition, ReturnType, ReturnVariableType, Variant, ContainerStyleQuery, };
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- export {};