@plumeria/core 0.24.3 → 0.24.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/index.d.ts +30 -0
- package/dist/index.js +1 -32
- package/dist/index.mjs +1 -32
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -9,11 +9,41 @@ declare const rx: (className: string, varSet: RxVariableSet) => {
|
|
|
9
9
|
|
|
10
10
|
declare class StyleSheet {
|
|
11
11
|
private constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Returns an object whose values can be used with `css.props`.
|
|
14
|
+
* @param object A style object containing CSS properties.
|
|
15
|
+
* @see https://plumeria.dev/docs/api-reference/create
|
|
16
|
+
*/
|
|
12
17
|
static create<const T extends Record<string, CSSProperties>>(object: CreateStyleType<T>): ReturnType<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns unique hashes based on properties.
|
|
20
|
+
* @param objects Style objects containing CSS properties.
|
|
21
|
+
* @see https://plumeria.dev/docs/api-reference/props
|
|
22
|
+
*/
|
|
13
23
|
static props(...objects: (false | Readonly<CSSProperties> | null | undefined)[]): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns a unique hash identifier that can be used in keyframes animation.
|
|
26
|
+
* @param object A style object containing keyframes properties.
|
|
27
|
+
* @see https://plumeria.dev/docs/api-reference/keyframes
|
|
28
|
+
*/
|
|
14
29
|
static keyframes(object: CreateKeyframes): string;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the unique name for the viewTransition.
|
|
32
|
+
* @param object A style object containing viewTransition properties.
|
|
33
|
+
* @see https://plumeria.dev/docs/api-reference/viewTransition
|
|
34
|
+
*/
|
|
15
35
|
static viewTransition(object: ViewTransitionOptions): string;
|
|
36
|
+
/**
|
|
37
|
+
* Returns the same object, with its type narrowed for better autocompletion.
|
|
38
|
+
* @param object A map of keys to constant string or number values.
|
|
39
|
+
* @see https://plumeria.dev/docs/api-reference/defineConsts
|
|
40
|
+
*/
|
|
16
41
|
static defineConsts<const T extends CreateValues>(object: T): T;
|
|
42
|
+
/**
|
|
43
|
+
* Returns an object containing CSS variable names and the original token values.
|
|
44
|
+
* @param object A nested object defining design tokens.
|
|
45
|
+
* @see https://plumeria.dev/docs/api-reference/defineTokens
|
|
46
|
+
*/
|
|
17
47
|
static defineTokens<const T extends CreateTokens>(object: T): ReturnVariableType<T>;
|
|
18
48
|
}
|
|
19
49
|
declare const css: typeof StyleSheet;
|
package/dist/index.js
CHANGED
|
@@ -8,38 +8,7 @@ function create(object) {
|
|
|
8
8
|
const flat = {};
|
|
9
9
|
const nonFlat = {};
|
|
10
10
|
(0, zss_engine.splitAtomicAndNested)(styleObj, flat, nonFlat);
|
|
11
|
-
const
|
|
12
|
-
const props$1 = Object.keys(style);
|
|
13
|
-
const propsToRemove = new Set();
|
|
14
|
-
const plainProps = [];
|
|
15
|
-
for (let i = 0; i < props$1.length; i++) if (!props$1[i].startsWith("@")) plainProps.push({
|
|
16
|
-
key: props$1[i],
|
|
17
|
-
index: i
|
|
18
|
-
});
|
|
19
|
-
const shorthandsInStyle = {};
|
|
20
|
-
for (const { key: key$1, index } of plainProps) {
|
|
21
|
-
const kebab = (0, zss_engine.camelToKebabCase)(key$1);
|
|
22
|
-
if (zss_engine.SHORTHAND_PROPERTIES[kebab]) shorthandsInStyle[kebab] = index;
|
|
23
|
-
}
|
|
24
|
-
for (const { key: key$1, index } of plainProps) {
|
|
25
|
-
const kebab = (0, zss_engine.camelToKebabCase)(key$1);
|
|
26
|
-
if (!zss_engine.SHORTHAND_PROPERTIES[kebab]) {
|
|
27
|
-
const longhands = zss_engine.LONG_TO_SHORT[kebab] || [];
|
|
28
|
-
for (const shorthand of longhands) if (shorthandsInStyle[shorthand] > index) {
|
|
29
|
-
propsToRemove.add(key$1);
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const finalStyle = {};
|
|
35
|
-
for (const prop of props$1) {
|
|
36
|
-
if (propsToRemove.has(prop)) continue;
|
|
37
|
-
if (prop.startsWith("@")) finalStyle[prop] = overrideLonghand(style[prop]);
|
|
38
|
-
else finalStyle[prop] = style[prop];
|
|
39
|
-
}
|
|
40
|
-
return finalStyle;
|
|
41
|
-
};
|
|
42
|
-
const finalFlat = overrideLonghand(flat);
|
|
11
|
+
const finalFlat = (0, zss_engine.overrideLonghand)(flat);
|
|
43
12
|
const records = [];
|
|
44
13
|
Object.entries(finalFlat).forEach(([prop, value]) => {
|
|
45
14
|
const hashes = new Set();
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { globalPromise_1, globalPromise_2, initPromise_1, initPromise_2, resolvePromise_1, resolvePromise_2 } from "./css.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { camelToKebabCase, genBase36Hash, injectClientCSS, injectClientGlobalCSS, injectClientQuery, isHashInStyleSheets, isServer, isTestingDevelopment, overrideLonghand, processAtomicProps, splitAtomicAndNested, transpile } from "zss-engine";
|
|
3
3
|
|
|
4
4
|
const styleAtomMap = new WeakMap();
|
|
5
5
|
function create(object) {
|
|
@@ -8,37 +8,6 @@ function create(object) {
|
|
|
8
8
|
const flat = {};
|
|
9
9
|
const nonFlat = {};
|
|
10
10
|
splitAtomicAndNested(styleObj, flat, nonFlat);
|
|
11
|
-
const overrideLonghand = (style) => {
|
|
12
|
-
const props$1 = Object.keys(style);
|
|
13
|
-
const propsToRemove = new Set();
|
|
14
|
-
const plainProps = [];
|
|
15
|
-
for (let i = 0; i < props$1.length; i++) if (!props$1[i].startsWith("@")) plainProps.push({
|
|
16
|
-
key: props$1[i],
|
|
17
|
-
index: i
|
|
18
|
-
});
|
|
19
|
-
const shorthandsInStyle = {};
|
|
20
|
-
for (const { key: key$1, index } of plainProps) {
|
|
21
|
-
const kebab = camelToKebabCase(key$1);
|
|
22
|
-
if (SHORTHAND_PROPERTIES[kebab]) shorthandsInStyle[kebab] = index;
|
|
23
|
-
}
|
|
24
|
-
for (const { key: key$1, index } of plainProps) {
|
|
25
|
-
const kebab = camelToKebabCase(key$1);
|
|
26
|
-
if (!SHORTHAND_PROPERTIES[kebab]) {
|
|
27
|
-
const longhands = LONG_TO_SHORT[kebab] || [];
|
|
28
|
-
for (const shorthand of longhands) if (shorthandsInStyle[shorthand] > index) {
|
|
29
|
-
propsToRemove.add(key$1);
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const finalStyle = {};
|
|
35
|
-
for (const prop of props$1) {
|
|
36
|
-
if (propsToRemove.has(prop)) continue;
|
|
37
|
-
if (prop.startsWith("@")) finalStyle[prop] = overrideLonghand(style[prop]);
|
|
38
|
-
else finalStyle[prop] = style[prop];
|
|
39
|
-
}
|
|
40
|
-
return finalStyle;
|
|
41
|
-
};
|
|
42
11
|
const finalFlat = overrideLonghand(flat);
|
|
43
12
|
const records = [];
|
|
44
13
|
Object.entries(finalFlat).forEach(([prop, value]) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/core",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.4",
|
|
4
4
|
"description": "The atomic on-demand CSS-in-JS.",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"stylesheet.css"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"zss-engine": "0.2.
|
|
48
|
+
"zss-engine": "0.2.96"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
|
-
"build": "tsdown && node strip-comments"
|
|
54
|
+
"build": "tsdown && node strip-comments.ts && node tsdocs.ts"
|
|
55
55
|
}
|
|
56
56
|
}
|