@plumeria/core 0.9.2 → 0.9.4
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/dist/css.js +135 -0
- package/dist/css.mjs +58 -0
- package/dist/index.d.ts +295 -0
- package/dist/index.js +116 -0
- package/dist/index.mjs +113 -0
- package/dist/processors/css.d.ts +12 -0
- package/dist/processors/css.js +30 -0
- package/dist/processors/css.mjs +3 -0
- package/package.json +12 -13
- package/dist/cjs/css.js +0 -95
- package/dist/cjs/cx.js +0 -22
- package/dist/cjs/index.js +0 -12
- package/dist/cjs/processors/css.js +0 -64
- package/dist/cjs/rx.js +0 -7
- package/dist/esm/css.js +0 -93
- package/dist/esm/cx.js +0 -20
- package/dist/esm/index.js +0 -3
- package/dist/esm/processors/css.js +0 -59
- package/dist/esm/rx.js +0 -5
- package/types/css.d.ts +0 -279
- package/types/cx.d.ts +0 -2
- package/types/index.d.ts +0 -4
- package/types/processors/css.d.ts +0 -10
- package/types/rx.d.ts +0 -9
package/dist/css.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region rolldown:runtime
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
const zss_engine = __toESM(require("zss-engine"));
|
|
26
|
+
|
|
27
|
+
//#region src/processors/css.ts
|
|
28
|
+
let resolvePromise_1;
|
|
29
|
+
let globalPromise_1;
|
|
30
|
+
const sheetQueue_1 = [];
|
|
31
|
+
let isProcessing_1 = false;
|
|
32
|
+
function initPromise_1() {
|
|
33
|
+
globalPromise_1 = new Promise((resolve) => {
|
|
34
|
+
resolvePromise_1 = (value) => {
|
|
35
|
+
sheetQueue_1.push(value);
|
|
36
|
+
resolve(value);
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async function processQueue_1(filePath) {
|
|
41
|
+
while (sheetQueue_1.length > 0) {
|
|
42
|
+
const styleSheet = sheetQueue_1.shift();
|
|
43
|
+
if (!zss_engine.isDevelopment && styleSheet) (0, zss_engine.build)(styleSheet, filePath);
|
|
44
|
+
}
|
|
45
|
+
isProcessing_1 = false;
|
|
46
|
+
}
|
|
47
|
+
async function buildCreate(filePath) {
|
|
48
|
+
if (typeof globalPromise_1 === "undefined") initPromise_1();
|
|
49
|
+
if (!isProcessing_1 && sheetQueue_1.length > 0) {
|
|
50
|
+
isProcessing_1 = true;
|
|
51
|
+
processQueue_1(filePath);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
let resolvePromise_2;
|
|
55
|
+
let globalPromise_2;
|
|
56
|
+
const sheetQueue_2 = [];
|
|
57
|
+
let isProcessing_2 = false;
|
|
58
|
+
function initPromise_2() {
|
|
59
|
+
globalPromise_2 = new Promise((resolve) => {
|
|
60
|
+
resolvePromise_2 = (value) => {
|
|
61
|
+
sheetQueue_2.push(value);
|
|
62
|
+
resolve(value);
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async function processQueue_2(filePath) {
|
|
67
|
+
while (sheetQueue_2.length > 0) {
|
|
68
|
+
const styleSheet = sheetQueue_2.shift();
|
|
69
|
+
if (!zss_engine.isDevelopment && styleSheet) (0, zss_engine.build)(styleSheet, filePath, "--global");
|
|
70
|
+
}
|
|
71
|
+
isProcessing_2 = false;
|
|
72
|
+
}
|
|
73
|
+
async function buildGlobal(filePath) {
|
|
74
|
+
if (typeof globalPromise_2 === "undefined") initPromise_2();
|
|
75
|
+
if (!isProcessing_2 && sheetQueue_2.length > 0) {
|
|
76
|
+
isProcessing_2 = true;
|
|
77
|
+
processQueue_2(filePath);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
Object.defineProperty(exports, '__toESM', {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function () {
|
|
85
|
+
return __toESM;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, 'buildCreate', {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () {
|
|
91
|
+
return buildCreate;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
Object.defineProperty(exports, 'buildGlobal', {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function () {
|
|
97
|
+
return buildGlobal;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
Object.defineProperty(exports, 'globalPromise_1', {
|
|
101
|
+
enumerable: true,
|
|
102
|
+
get: function () {
|
|
103
|
+
return globalPromise_1;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(exports, 'globalPromise_2', {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
get: function () {
|
|
109
|
+
return globalPromise_2;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
Object.defineProperty(exports, 'initPromise_1', {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
get: function () {
|
|
115
|
+
return initPromise_1;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
Object.defineProperty(exports, 'initPromise_2', {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
get: function () {
|
|
121
|
+
return initPromise_2;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
Object.defineProperty(exports, 'resolvePromise_1', {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function () {
|
|
127
|
+
return resolvePromise_1;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
Object.defineProperty(exports, 'resolvePromise_2', {
|
|
131
|
+
enumerable: true,
|
|
132
|
+
get: function () {
|
|
133
|
+
return resolvePromise_2;
|
|
134
|
+
}
|
|
135
|
+
});
|
package/dist/css.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { build, isDevelopment } from "zss-engine";
|
|
2
|
+
|
|
3
|
+
//#region src/processors/css.ts
|
|
4
|
+
let resolvePromise_1;
|
|
5
|
+
let globalPromise_1;
|
|
6
|
+
const sheetQueue_1 = [];
|
|
7
|
+
let isProcessing_1 = false;
|
|
8
|
+
function initPromise_1() {
|
|
9
|
+
globalPromise_1 = new Promise((resolve) => {
|
|
10
|
+
resolvePromise_1 = (value) => {
|
|
11
|
+
sheetQueue_1.push(value);
|
|
12
|
+
resolve(value);
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async function processQueue_1(filePath) {
|
|
17
|
+
while (sheetQueue_1.length > 0) {
|
|
18
|
+
const styleSheet = sheetQueue_1.shift();
|
|
19
|
+
if (!isDevelopment && styleSheet) build(styleSheet, filePath);
|
|
20
|
+
}
|
|
21
|
+
isProcessing_1 = false;
|
|
22
|
+
}
|
|
23
|
+
async function buildCreate(filePath) {
|
|
24
|
+
if (typeof globalPromise_1 === "undefined") initPromise_1();
|
|
25
|
+
if (!isProcessing_1 && sheetQueue_1.length > 0) {
|
|
26
|
+
isProcessing_1 = true;
|
|
27
|
+
processQueue_1(filePath);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
let resolvePromise_2;
|
|
31
|
+
let globalPromise_2;
|
|
32
|
+
const sheetQueue_2 = [];
|
|
33
|
+
let isProcessing_2 = false;
|
|
34
|
+
function initPromise_2() {
|
|
35
|
+
globalPromise_2 = new Promise((resolve) => {
|
|
36
|
+
resolvePromise_2 = (value) => {
|
|
37
|
+
sheetQueue_2.push(value);
|
|
38
|
+
resolve(value);
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
async function processQueue_2(filePath) {
|
|
43
|
+
while (sheetQueue_2.length > 0) {
|
|
44
|
+
const styleSheet = sheetQueue_2.shift();
|
|
45
|
+
if (!isDevelopment && styleSheet) build(styleSheet, filePath, "--global");
|
|
46
|
+
}
|
|
47
|
+
isProcessing_2 = false;
|
|
48
|
+
}
|
|
49
|
+
async function buildGlobal(filePath) {
|
|
50
|
+
if (typeof globalPromise_2 === "undefined") initPromise_2();
|
|
51
|
+
if (!isProcessing_2 && sheetQueue_2.length > 0) {
|
|
52
|
+
isProcessing_2 = true;
|
|
53
|
+
processQueue_2(filePath);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { buildCreate, buildGlobal, globalPromise_1, globalPromise_2, initPromise_1, initPromise_2, resolvePromise_1, resolvePromise_2 };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { CSSHTML, CSSProperties, CreateKeyframes, CreateStyle, CreateStyleType, CreateTheme, CreateVars, ReturnType } from "zss-engine";
|
|
2
|
+
|
|
3
|
+
//#region src/css.d.ts
|
|
4
|
+
declare class css {
|
|
5
|
+
static create<T extends Record<string, CSSProperties>>(object: CreateStyleType<T>): ReturnType<T>;
|
|
6
|
+
static global(object: CSSHTML): void;
|
|
7
|
+
static defineVars<const T extends CreateVars>(object: T): { [K in keyof T]: `var(--${string})` };
|
|
8
|
+
static defineTheme<const T extends CreateTheme>(object: T): { [K in keyof T]: `var(--${string})` };
|
|
9
|
+
static keyframes(object: CreateKeyframes): string;
|
|
10
|
+
static media: {
|
|
11
|
+
dark: "@media (prefers-color-scheme: dark)";
|
|
12
|
+
light: "@media (prefers-color-scheme: light)";
|
|
13
|
+
range: <S extends string>(range: S) => `@media (${S})`;
|
|
14
|
+
maxWidth: <V extends string | number>(value: V) => `@media (max-width: ${V}px)`;
|
|
15
|
+
maxHeight: <V extends string | number>(value: V) => `@media (max-height: ${V}px)`;
|
|
16
|
+
minWidth: <V extends string | number>(value: V) => `@media (min-width: ${V}px)`;
|
|
17
|
+
minHeight: <V extends string | number>(value: V) => `@media (min-height: ${V}px)`;
|
|
18
|
+
};
|
|
19
|
+
static container: {
|
|
20
|
+
range: <S extends string>(range: S) => `@container (${S})`;
|
|
21
|
+
maxWidth: <V extends string | number>(value: V) => V extends number ? `@container (max-width: ${V}px)` : `@container (max-width: ${V})`;
|
|
22
|
+
maxHeight: <V extends string | number>(value: V) => V extends number ? `@container (max-height: ${V}px)` : `@container (max-height: ${V})`;
|
|
23
|
+
minWidth: <V extends string | number>(value: V) => V extends number ? `@container (min-width: ${V}px)` : `@container (min-width: ${V})`;
|
|
24
|
+
minHeight: <V extends string | number>(value: V) => V extends number ? `@container (min-height: ${V}px)` : `@container (min-height: ${V})`;
|
|
25
|
+
};
|
|
26
|
+
static pseudo: {
|
|
27
|
+
fn: {
|
|
28
|
+
cue: <S extends string>(str: S) => `::cue(${S})`;
|
|
29
|
+
dir: <S extends string>(str: S) => `:dir(${S})`;
|
|
30
|
+
has: <S extends string>(str: S) => `:has(${S})`;
|
|
31
|
+
host: <S extends string>(str: S) => `:host(${S})`;
|
|
32
|
+
hostContext: <S extends string>(str: S) => `:host-context(${S})`;
|
|
33
|
+
is: <S extends string>(str: S) => `:is(${S})`;
|
|
34
|
+
lang: <S extends string>(str: S) => `:lang(${S})`;
|
|
35
|
+
nthChild: <S extends string>(str: S) => `:nth-child(${S})`;
|
|
36
|
+
nthLastChild: <S extends string>(str: S) => `:nth-last-child(${S})`;
|
|
37
|
+
nthLastOfType: <S extends string>(str: S) => `:nth-last-of-type(${S})`;
|
|
38
|
+
nthOfType: <S extends string>(str: S) => `:nth-of-type(${S})`;
|
|
39
|
+
not: <S extends string>(str: S) => `:not(${S})`;
|
|
40
|
+
state: <S extends string>(str: S) => `:state(${S})`;
|
|
41
|
+
where: <S extends string>(str: S) => `:where(${S})`;
|
|
42
|
+
highlight: <S extends string>(str: S) => `::highlight(${S})`;
|
|
43
|
+
part: <S extends string>(str: S) => `::part(${S})`;
|
|
44
|
+
slotted: <S extends string>(str: S) => `::slotted(${S})`;
|
|
45
|
+
viewTransitionImagePair: <S extends string>(str: S) => `::view-transition-image-pair(${S})`;
|
|
46
|
+
viewTransitionGroup: <S extends string>(str: S) => `::view-transition-group(${S})`;
|
|
47
|
+
viewTransitionOld: <S extends string>(str: S) => `::view-transition-old(${S})`;
|
|
48
|
+
viewTransitionNew: <S extends string>(str: S) => `::view-transition-new(${S})`;
|
|
49
|
+
};
|
|
50
|
+
active: ":active";
|
|
51
|
+
anyLink: ":any-link";
|
|
52
|
+
autoFill: ":autofill";
|
|
53
|
+
buffering: ":buffering";
|
|
54
|
+
checked: ":checked";
|
|
55
|
+
default: ":default";
|
|
56
|
+
defined: ":defined";
|
|
57
|
+
disabled: ":disabled";
|
|
58
|
+
empty: ":empty";
|
|
59
|
+
enabled: ":enabled";
|
|
60
|
+
first: ":first";
|
|
61
|
+
firstChild: ":first-child";
|
|
62
|
+
firstOfType: ":first-of-type";
|
|
63
|
+
focus: ":focus";
|
|
64
|
+
focusVisible: ":focus-visible";
|
|
65
|
+
focusWithin: ":focus-within";
|
|
66
|
+
fullscreen: ":fullscreen";
|
|
67
|
+
future: ":future";
|
|
68
|
+
hasSlotted: ":has-slotted";
|
|
69
|
+
host: ":host";
|
|
70
|
+
hover: ":hover";
|
|
71
|
+
inRange: ":in-range";
|
|
72
|
+
indeterminate: ":indeterminate";
|
|
73
|
+
invalid: ":invalid";
|
|
74
|
+
lastChild: ":last-child";
|
|
75
|
+
lastOfType: ":last-of-type";
|
|
76
|
+
left: ":left";
|
|
77
|
+
link: ":link";
|
|
78
|
+
modal: ":modal";
|
|
79
|
+
muted: ":muted";
|
|
80
|
+
onlyChild: ":only-child";
|
|
81
|
+
onlyOfType: ":only-of-type";
|
|
82
|
+
open: ":open";
|
|
83
|
+
optional: ":optional";
|
|
84
|
+
outOfRange: ":out-of-range";
|
|
85
|
+
past: ":past";
|
|
86
|
+
paused: ":paused";
|
|
87
|
+
pictureInPicture: ":picture-in-picture";
|
|
88
|
+
placeholderShown: ":placeholder-shown";
|
|
89
|
+
playing: ":playing";
|
|
90
|
+
popoverOpen: ":popover-open";
|
|
91
|
+
readOnly: ":read-only";
|
|
92
|
+
readWrite: ":read-write";
|
|
93
|
+
required: ":required";
|
|
94
|
+
right: ":right";
|
|
95
|
+
root: ":root";
|
|
96
|
+
scope: ":scope";
|
|
97
|
+
seeking: ":seeking";
|
|
98
|
+
stalled: ":stalled";
|
|
99
|
+
target: ":target";
|
|
100
|
+
userInvalid: ":user-invalid";
|
|
101
|
+
userValid: ":user-valid";
|
|
102
|
+
valid: ":valid";
|
|
103
|
+
visited: ":visited";
|
|
104
|
+
volumeLocked: ":volume-locked";
|
|
105
|
+
after: "::after";
|
|
106
|
+
backdrop: "::backdrop";
|
|
107
|
+
before: "::before";
|
|
108
|
+
cue: "::cue";
|
|
109
|
+
detailsContent: "::details-content";
|
|
110
|
+
firstSelectorButton: "::first-selector-button";
|
|
111
|
+
firstLetter: "::first-letter";
|
|
112
|
+
firstLine: "::first-line";
|
|
113
|
+
grammarError: "::grammar-error";
|
|
114
|
+
marker: "::marker";
|
|
115
|
+
placeholder: "::placeholder";
|
|
116
|
+
selection: "::selection";
|
|
117
|
+
spellingError: "::spellingError";
|
|
118
|
+
targetText: "::target-text";
|
|
119
|
+
viewTransition: "::view-transition";
|
|
120
|
+
};
|
|
121
|
+
static color: {
|
|
122
|
+
lighten: (color: string, amount: string | number) => `color-mix(in srgb, ${string}, white ${number}%)`;
|
|
123
|
+
darken: (color: string, amount: string | number) => `color-mix(in srgb, ${string}, black ${number}%)`;
|
|
124
|
+
primary: "#0070f3";
|
|
125
|
+
secondary: "#ff4081";
|
|
126
|
+
success: "#2e7d32";
|
|
127
|
+
warning: "#ed6c02";
|
|
128
|
+
error: "#d32f2f";
|
|
129
|
+
aliceblue: "aliceblue";
|
|
130
|
+
antiquewhite: "antiquewhite";
|
|
131
|
+
aqua: "aqua";
|
|
132
|
+
aquamarine: "aquamarine";
|
|
133
|
+
azure: "azure";
|
|
134
|
+
beige: "beige";
|
|
135
|
+
bisque: "bisque";
|
|
136
|
+
black: "black";
|
|
137
|
+
blanchedalmond: "blanchedalmond";
|
|
138
|
+
blue: "blue";
|
|
139
|
+
blueviolet: "blueviolet";
|
|
140
|
+
brown: "brown";
|
|
141
|
+
burlywood: "burlywood";
|
|
142
|
+
cadetblue: "cadetblue";
|
|
143
|
+
chartreuse: "chartreuse";
|
|
144
|
+
chocolate: "chocolate";
|
|
145
|
+
coral: "coral";
|
|
146
|
+
cornflowerblue: "cornflowerblue";
|
|
147
|
+
cornsilk: "cornsilk";
|
|
148
|
+
crimson: "crimson";
|
|
149
|
+
cyan: "cyan";
|
|
150
|
+
darkblue: "darkblue";
|
|
151
|
+
darkcyan: "darkcyan";
|
|
152
|
+
darkgoldenrod: "darkgoldenrod";
|
|
153
|
+
darkgray: "darkgray";
|
|
154
|
+
darkgreen: "darkgreen";
|
|
155
|
+
darkgrey: "darkgrey";
|
|
156
|
+
darkkhaki: "darkkhaki";
|
|
157
|
+
darkmagenta: "darkmagenta";
|
|
158
|
+
darkolivegreen: "darkolivegreen";
|
|
159
|
+
darkorange: "darkorange";
|
|
160
|
+
darkorchid: "darkorchid";
|
|
161
|
+
darkred: "darkred";
|
|
162
|
+
darksalmon: "darksalmon";
|
|
163
|
+
darkseagreen: "darkseagreen";
|
|
164
|
+
darkslateblue: "darkslateblue";
|
|
165
|
+
darkslategray: "darkslategray";
|
|
166
|
+
darkslategrey: "darkslategrey";
|
|
167
|
+
darkturquoise: "darkturquoise";
|
|
168
|
+
darkviolet: "darkviolet";
|
|
169
|
+
deeppink: "deeppink";
|
|
170
|
+
deepskyblue: "deepskyblue";
|
|
171
|
+
dimgray: "dimgray";
|
|
172
|
+
dimgrey: "dimgrey";
|
|
173
|
+
dodgerblue: "dodgerblue";
|
|
174
|
+
firebrick: "firebrick";
|
|
175
|
+
floralwhite: "floralwhite";
|
|
176
|
+
forestgreen: "forestgreen";
|
|
177
|
+
fuchsia: "fuchsia";
|
|
178
|
+
gainsboro: "gainsboro";
|
|
179
|
+
ghostwhite: "ghostwhite";
|
|
180
|
+
gold: "gold";
|
|
181
|
+
goldenrod: "goldenrod";
|
|
182
|
+
gray: "gray";
|
|
183
|
+
green: "green";
|
|
184
|
+
greenyellow: "greenyellow";
|
|
185
|
+
grey: "grey";
|
|
186
|
+
honeydew: "honeydew";
|
|
187
|
+
hotpink: "hotpink";
|
|
188
|
+
indianred: "indianred";
|
|
189
|
+
indigo: "indigo";
|
|
190
|
+
ivory: "ivory";
|
|
191
|
+
khaki: "khaki";
|
|
192
|
+
lavender: "lavender";
|
|
193
|
+
lavenderblush: "lavenderblush";
|
|
194
|
+
lawngreen: "lawngreen";
|
|
195
|
+
lemonchiffon: "lemonchiffon";
|
|
196
|
+
lightblue: "lightblue";
|
|
197
|
+
lightcoral: "lightcoral";
|
|
198
|
+
lightcyan: "lightcyan";
|
|
199
|
+
lightgoldenrodyellow: "lightgoldenrodyellow";
|
|
200
|
+
lightgray: "lightgray";
|
|
201
|
+
lightgreen: "lightgreen";
|
|
202
|
+
lightgrey: "lightgrey";
|
|
203
|
+
lightpink: "lightpink";
|
|
204
|
+
lightsalmon: "lightsalmon";
|
|
205
|
+
lightseagreen: "lightseagreen";
|
|
206
|
+
lightskyblue: "lightskyblue";
|
|
207
|
+
lightslategray: "lightslategray";
|
|
208
|
+
lightslategrey: "lightslategrey";
|
|
209
|
+
lightsteelblue: "lightsteelblue";
|
|
210
|
+
lightyellow: "lightyellow";
|
|
211
|
+
lime: "lime";
|
|
212
|
+
limegreen: "limegreen";
|
|
213
|
+
linen: "linen";
|
|
214
|
+
magenta: "magenta";
|
|
215
|
+
maroon: "maroon";
|
|
216
|
+
mediumaquamarine: "mediumaquamarine";
|
|
217
|
+
mediumblue: "mediumblue";
|
|
218
|
+
mediumorchid: "mediumorchid";
|
|
219
|
+
mediumpurple: "mediumpurple";
|
|
220
|
+
mediumseagreen: "mediumseagreen";
|
|
221
|
+
mediumslateblue: "mediumslateblue";
|
|
222
|
+
mediumspringgreen: "mediumspringgreen";
|
|
223
|
+
mediumturquoise: "mediumturquoise";
|
|
224
|
+
mediumvioletred: "mediumvioletred";
|
|
225
|
+
midnightblue: "midnightblue";
|
|
226
|
+
mintcream: "mintcream";
|
|
227
|
+
mistyrose: "mistyrose";
|
|
228
|
+
moccasin: "moccasin";
|
|
229
|
+
navajowhite: "navajowhite";
|
|
230
|
+
navy: "navy";
|
|
231
|
+
oldlace: "oldlace";
|
|
232
|
+
olive: "olive";
|
|
233
|
+
olivedrab: "olivedrab";
|
|
234
|
+
orange: "orange";
|
|
235
|
+
orangered: "orangered";
|
|
236
|
+
orchid: "orchid";
|
|
237
|
+
palegoldenrod: "palegoldenrod";
|
|
238
|
+
palegreen: "palegreen";
|
|
239
|
+
paleturquoise: "paleturquoise";
|
|
240
|
+
palevioletred: "palevioletred";
|
|
241
|
+
papayawhip: "papayawhip";
|
|
242
|
+
peachpuff: "peachpuff";
|
|
243
|
+
peru: "peru";
|
|
244
|
+
pink: "pink";
|
|
245
|
+
plum: "plum";
|
|
246
|
+
powderblue: "powderblue";
|
|
247
|
+
purple: "purple";
|
|
248
|
+
rebeccapurple: "rebeccapurple";
|
|
249
|
+
red: "red";
|
|
250
|
+
rosybrown: "rosybrown";
|
|
251
|
+
royalblue: "royalblue";
|
|
252
|
+
saddlebrown: "saddlebrown";
|
|
253
|
+
salmon: "salmon";
|
|
254
|
+
sandybrown: "sandybrown";
|
|
255
|
+
seagreen: "seagreen";
|
|
256
|
+
seashell: "seashell";
|
|
257
|
+
sienna: "sienna";
|
|
258
|
+
silver: "silver";
|
|
259
|
+
skyblue: "skyblue";
|
|
260
|
+
slateblue: "slateblue";
|
|
261
|
+
slategray: "slategray";
|
|
262
|
+
slategrey: "slategrey";
|
|
263
|
+
snow: "snow";
|
|
264
|
+
springgreen: "springgreen";
|
|
265
|
+
steelblue: "steelblue";
|
|
266
|
+
tan: "tan";
|
|
267
|
+
teal: "teal";
|
|
268
|
+
thistle: "thistle";
|
|
269
|
+
tomato: "tomato";
|
|
270
|
+
transparent: "transparent";
|
|
271
|
+
turquoise: "turquoise";
|
|
272
|
+
violet: "violet";
|
|
273
|
+
wheat: "wheat";
|
|
274
|
+
white: "white";
|
|
275
|
+
whitesmoke: "whitesmoke";
|
|
276
|
+
yellow: "yellow";
|
|
277
|
+
yellowgreen: "yellowgreen";
|
|
278
|
+
};
|
|
279
|
+
} //#endregion
|
|
280
|
+
//#region src/cx.d.ts
|
|
281
|
+
declare const cx: (...strings: Array<string | null | undefined | false>) => string & ":";
|
|
282
|
+
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/rx.d.ts
|
|
285
|
+
declare const rx: (className: string, varSet: {
|
|
286
|
+
[key: `--${string}`]: string;
|
|
287
|
+
}) => {
|
|
288
|
+
className: string;
|
|
289
|
+
style: {
|
|
290
|
+
[k: string]: string;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
//#endregion
|
|
295
|
+
export { CSSHTML, CSSProperties, CreateStyle, css, cx, rx };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const require_css = require('./css.js');
|
|
3
|
+
const zss_engine = require_css.__toESM(require("zss-engine"));
|
|
4
|
+
const zss_utils = require_css.__toESM(require("zss-utils"));
|
|
5
|
+
|
|
6
|
+
//#region src/css.ts
|
|
7
|
+
function create(object) {
|
|
8
|
+
const base36Hash = (0, zss_engine.genBase36Hash)(object, 6);
|
|
9
|
+
const { styleSheet } = (0, zss_engine.transpiler)(object, base36Hash);
|
|
10
|
+
const injectCSS = zss_engine.isServer ? zss_engine.injectServerCSS : zss_engine.injectClientCSS;
|
|
11
|
+
if (typeof require_css.globalPromise_1 === "undefined") require_css.initPromise_1();
|
|
12
|
+
require_css.resolvePromise_1(styleSheet);
|
|
13
|
+
Object.keys(object).forEach((key) => {
|
|
14
|
+
Object.defineProperty(object, key, { get: () => {
|
|
15
|
+
const className = key + "_" + base36Hash;
|
|
16
|
+
if (zss_engine.isDevAndTest) injectCSS(base36Hash, styleSheet);
|
|
17
|
+
return className;
|
|
18
|
+
} });
|
|
19
|
+
});
|
|
20
|
+
return Object.freeze(object);
|
|
21
|
+
}
|
|
22
|
+
function global(object) {
|
|
23
|
+
const base36Hash = (0, zss_engine.genBase36Hash)(object, 8);
|
|
24
|
+
const { styleSheet } = (0, zss_engine.transpiler)(object, void 0, "--global");
|
|
25
|
+
if (typeof require_css.globalPromise_2 === "undefined") require_css.initPromise_2();
|
|
26
|
+
require_css.resolvePromise_2(styleSheet);
|
|
27
|
+
if (zss_engine.isDevAndTest) zss_engine.isServer ? (0, zss_engine.injectServerCSS)(base36Hash, styleSheet) : (0, zss_engine.injectClientGlobalCSS)(styleSheet);
|
|
28
|
+
}
|
|
29
|
+
const defineVars = (object) => {
|
|
30
|
+
const styles = { ":root": {} };
|
|
31
|
+
const result = {};
|
|
32
|
+
Object.entries(object).forEach(([key, value]) => {
|
|
33
|
+
const kebabKey = (0, zss_engine.camelToKebabCase)(key);
|
|
34
|
+
result[key] = `var(--${kebabKey})`;
|
|
35
|
+
styles[":root"][`--${key}`] = value;
|
|
36
|
+
});
|
|
37
|
+
global(styles);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
const defineTheme = (object) => {
|
|
41
|
+
const styles = {};
|
|
42
|
+
const result = {};
|
|
43
|
+
Object.entries(object).forEach(([key, value]) => {
|
|
44
|
+
const kebabKey = (0, zss_engine.camelToKebabCase)(key);
|
|
45
|
+
result[key] = `var(--${kebabKey})`;
|
|
46
|
+
Object.entries(value).forEach(([subKey, subValue]) => {
|
|
47
|
+
if (subKey.startsWith("@media")) {
|
|
48
|
+
styles[":root"] ||= {};
|
|
49
|
+
styles[":root"][subKey] ||= {};
|
|
50
|
+
styles[":root"][subKey][`--${key}`] = subValue;
|
|
51
|
+
} else {
|
|
52
|
+
const themeSelector = subKey === "default" ? ":root" : `:root[data-theme="${subKey}"]`;
|
|
53
|
+
styles[themeSelector] ||= {};
|
|
54
|
+
styles[themeSelector][`--${key}`] = subValue;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
global(styles);
|
|
59
|
+
return result;
|
|
60
|
+
};
|
|
61
|
+
const keyframes = (object) => {
|
|
62
|
+
const prefix = (0, zss_engine.genBase36Hash)(object, 8);
|
|
63
|
+
global({ [`@keyframes ${prefix}`]: object });
|
|
64
|
+
return prefix;
|
|
65
|
+
};
|
|
66
|
+
var css = class {
|
|
67
|
+
static create(object) {
|
|
68
|
+
return create(object);
|
|
69
|
+
}
|
|
70
|
+
static global(object) {
|
|
71
|
+
return global(object);
|
|
72
|
+
}
|
|
73
|
+
static defineVars(object) {
|
|
74
|
+
return defineVars(object);
|
|
75
|
+
}
|
|
76
|
+
static defineTheme(object) {
|
|
77
|
+
return defineTheme(object);
|
|
78
|
+
}
|
|
79
|
+
static keyframes(object) {
|
|
80
|
+
return keyframes(object);
|
|
81
|
+
}
|
|
82
|
+
static media = zss_utils.media;
|
|
83
|
+
static container = zss_utils.container;
|
|
84
|
+
static pseudo = zss_utils.pseudo;
|
|
85
|
+
static color = zss_utils.color;
|
|
86
|
+
};
|
|
87
|
+
var css_default = css;
|
|
88
|
+
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/cx.ts
|
|
91
|
+
const cx = (...strings) => {
|
|
92
|
+
let result = "";
|
|
93
|
+
let isFirst = true;
|
|
94
|
+
strings.filter(Boolean).forEach((str) => {
|
|
95
|
+
if (str?.toString().startsWith(":")) result += str.toString();
|
|
96
|
+
else if (typeof str === "string") if (isFirst) {
|
|
97
|
+
result += str;
|
|
98
|
+
isFirst = false;
|
|
99
|
+
} else result += ` ${str}`;
|
|
100
|
+
});
|
|
101
|
+
return result;
|
|
102
|
+
};
|
|
103
|
+
var cx_default = cx;
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/rx.ts
|
|
107
|
+
const rx = (className, varSet) => ({
|
|
108
|
+
className,
|
|
109
|
+
style: Object.fromEntries(Object.entries(varSet).map(([key, value]) => [key, value]))
|
|
110
|
+
});
|
|
111
|
+
var rx_default = rx;
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
exports.css = css_default;
|
|
115
|
+
exports.cx = cx_default;
|
|
116
|
+
exports.rx = rx_default;
|