@plumeria/core 0.9.10 → 0.10.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/README.md CHANGED
@@ -35,7 +35,7 @@ import '@plumeria/core/stylesheet.css';
35
35
  Define a set of styles:
36
36
 
37
37
  ```ts
38
- import { css } from '@plumeria/core';
38
+ import { css, cx, ps, px } from '@plumeria/core';
39
39
 
40
40
  const styles = css.create({
41
41
  box: {
@@ -59,7 +59,7 @@ const styles = css.create({
59
59
  },
60
60
  text: {
61
61
  color: '#333',
62
- [css.pseudo.hover]: {
62
+ [ps.hover]: {
63
63
  color: 'skyblue',
64
64
  opacity: 0.9,
65
65
  },
@@ -82,13 +82,13 @@ const styles = css.create({
82
82
 
83
83
  const composed = css.createComposite(styles.flexBox, {
84
84
  hover: {
85
- [css.pseudo.hover]: {
85
+ [ps.hover]: {
86
86
  scale: 1.5,
87
87
  },
88
88
  },
89
89
  active: {
90
- [css.pseudo.active]: {
91
- color: css.color.gray,
90
+ [ps.active]: {
91
+ color: color.gray,
92
92
  },
93
93
  },
94
94
  });
@@ -214,7 +214,7 @@ const themes = css.defineTheme({
214
214
 
215
215
  ### `css.color`
216
216
 
217
- Color utilities:
217
+ Color utility:
218
218
 
219
219
  ```ts
220
220
  color: css.color.darken('skyblue', 0.12),
@@ -230,7 +230,7 @@ color: css.color.aqua,
230
230
  Classname merging helper:
231
231
 
232
232
  ```tsx
233
- cx(css.pseudo.hover, css.pseudo.after);
233
+ px(ps.hover, ps.after);
234
234
  // => ":hover::after"
235
235
  cx(styles.text, styles.box);
236
236
  // => "text_hash box_hash"
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { CSSHTML, CSSProperties, CreateKeyframes, CreateStyle, CreateStyleType, CreateTheme, CreateValues, ReturnType } from "zss-engine";
1
+ import { CSSHTML, CSSProperties, CreateKeyframes, CreateStyle, CreateStyleType, CreateTheme, CreateValues, Join, ReturnType } from "zss-engine";
2
+ import { ps } from "zss-utils";
2
3
 
3
4
  //#region src/css.d.ts
4
5
  declare class css {
@@ -25,101 +26,6 @@ declare class css {
25
26
  minWidth: <V extends string | number>(value: V) => V extends number ? `@container (min-width: ${V}px)` : `@container (min-width: ${V})`;
26
27
  minHeight: <V extends string | number>(value: V) => V extends number ? `@container (min-height: ${V}px)` : `@container (min-height: ${V})`;
27
28
  };
28
- static pseudo: {
29
- fn: {
30
- cue: <S extends string>(str: S) => `::cue(${S})`;
31
- dir: <S extends string>(str: S) => `:dir(${S})`;
32
- has: <S extends string>(str: S) => `:has(${S})`;
33
- host: <S extends string>(str: S) => `:host(${S})`;
34
- hostContext: <S extends string>(str: S) => `:host-context(${S})`;
35
- is: <S extends string>(str: S) => `:is(${S})`;
36
- lang: <S extends string>(str: S) => `:lang(${S})`;
37
- nthChild: <S extends string>(str: S) => `:nth-child(${S})`;
38
- nthLastChild: <S extends string>(str: S) => `:nth-last-child(${S})`;
39
- nthLastOfType: <S extends string>(str: S) => `:nth-last-of-type(${S})`;
40
- nthOfType: <S extends string>(str: S) => `:nth-of-type(${S})`;
41
- not: <S extends string>(str: S) => `:not(${S})`;
42
- state: <S extends string>(str: S) => `:state(${S})`;
43
- where: <S extends string>(str: S) => `:where(${S})`;
44
- highlight: <S extends string>(str: S) => `::highlight(${S})`;
45
- part: <S extends string>(str: S) => `::part(${S})`;
46
- slotted: <S extends string>(str: S) => `::slotted(${S})`;
47
- viewTransitionImagePair: <S extends string>(str: S) => `::view-transition-image-pair(${S})`;
48
- viewTransitionGroup: <S extends string>(str: S) => `::view-transition-group(${S})`;
49
- viewTransitionOld: <S extends string>(str: S) => `::view-transition-old(${S})`;
50
- viewTransitionNew: <S extends string>(str: S) => `::view-transition-new(${S})`;
51
- };
52
- active: ":active";
53
- anyLink: ":any-link";
54
- autoFill: ":autofill";
55
- buffering: ":buffering";
56
- checked: ":checked";
57
- default: ":default";
58
- defined: ":defined";
59
- disabled: ":disabled";
60
- empty: ":empty";
61
- enabled: ":enabled";
62
- first: ":first";
63
- firstChild: ":first-child";
64
- firstOfType: ":first-of-type";
65
- focus: ":focus";
66
- focusVisible: ":focus-visible";
67
- focusWithin: ":focus-within";
68
- fullscreen: ":fullscreen";
69
- future: ":future";
70
- hasSlotted: ":has-slotted";
71
- host: ":host";
72
- hover: ":hover";
73
- inRange: ":in-range";
74
- indeterminate: ":indeterminate";
75
- invalid: ":invalid";
76
- lastChild: ":last-child";
77
- lastOfType: ":last-of-type";
78
- left: ":left";
79
- link: ":link";
80
- modal: ":modal";
81
- muted: ":muted";
82
- onlyChild: ":only-child";
83
- onlyOfType: ":only-of-type";
84
- open: ":open";
85
- optional: ":optional";
86
- outOfRange: ":out-of-range";
87
- past: ":past";
88
- paused: ":paused";
89
- pictureInPicture: ":picture-in-picture";
90
- placeholderShown: ":placeholder-shown";
91
- playing: ":playing";
92
- popoverOpen: ":popover-open";
93
- readOnly: ":read-only";
94
- readWrite: ":read-write";
95
- required: ":required";
96
- right: ":right";
97
- root: ":root";
98
- scope: ":scope";
99
- seeking: ":seeking";
100
- stalled: ":stalled";
101
- target: ":target";
102
- userInvalid: ":user-invalid";
103
- userValid: ":user-valid";
104
- valid: ":valid";
105
- visited: ":visited";
106
- volumeLocked: ":volume-locked";
107
- after: "::after";
108
- backdrop: "::backdrop";
109
- before: "::before";
110
- cue: "::cue";
111
- detailsContent: "::details-content";
112
- firstSelectorButton: "::first-selector-button";
113
- firstLetter: "::first-letter";
114
- firstLine: "::first-line";
115
- grammarError: "::grammar-error";
116
- marker: "::marker";
117
- placeholder: "::placeholder";
118
- selection: "::selection";
119
- spellingError: "::spellingError";
120
- targetText: "::target-text";
121
- viewTransition: "::view-transition";
122
- };
123
29
  static color: {
124
30
  lighten: (color: string, amount: string | number) => `color-mix(in srgb, ${string}, white ${number}%)`;
125
31
  darken: (color: string, amount: string | number) => `color-mix(in srgb, ${string}, black ${number}%)`;
@@ -280,7 +186,11 @@ declare class css {
280
186
  };
281
187
  } //#endregion
282
188
  //#region src/cx.d.ts
283
- declare const cx: (...strings: Array<string | null | undefined | false>) => string & ":";
189
+ declare const cx: (...classes: Array<string | null | undefined | false>) => string;
190
+
191
+ //#endregion
192
+ //#region src/px.d.ts
193
+ declare const px: <T extends readonly string[]>(...pseudos: T) => Join<T>;
284
194
 
285
195
  //#endregion
286
196
  //#region src/rx.d.ts
@@ -294,4 +204,4 @@ declare const rx: (className: string, varSet: {
294
204
  };
295
205
 
296
206
  //#endregion
297
- export { CSSHTML, CSSProperties, CreateStyle, css, cx, rx };
207
+ export { CSSHTML, CSSProperties, CreateStyle, css, cx, ps, px, rx };
package/dist/index.js CHANGED
@@ -96,27 +96,26 @@ var css = class {
96
96
  }
97
97
  static media = zss_utils.media;
98
98
  static container = zss_utils.container;
99
- static pseudo = zss_utils.pseudo;
100
99
  static color = zss_utils.color;
101
100
  };
102
101
  var css_default = css;
103
102
 
104
103
  //#endregion
105
104
  //#region src/cx.ts
106
- const cx = (...strings) => {
107
- let result = "";
108
- let isFirst = true;
109
- strings.filter(Boolean).forEach((str) => {
110
- if (str?.toString().startsWith(":")) result += str.toString();
111
- else if (typeof str === "string") if (isFirst) {
112
- result += str;
113
- isFirst = false;
114
- } else result += ` ${str}`;
115
- });
116
- return result;
117
- };
105
+ const cx = (...classes) => classes.filter(Boolean).join(" ");
118
106
  var cx_default = cx;
119
107
 
108
+ //#endregion
109
+ //#region src/ps.ts
110
+ var ps_default = zss_utils.ps;
111
+
112
+ //#endregion
113
+ //#region src/px.ts
114
+ const px = (...pseudos) => {
115
+ return pseudos.filter(Boolean).join("");
116
+ };
117
+ var px_default = px;
118
+
120
119
  //#endregion
121
120
  //#region src/rx.ts
122
121
  const rx = (className, varSet) => ({
@@ -128,4 +127,6 @@ var rx_default = rx;
128
127
  //#endregion
129
128
  exports.css = css_default;
130
129
  exports.cx = cx_default;
130
+ exports.ps = ps_default;
131
+ exports.px = px_default;
131
132
  exports.rx = rx_default;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { globalPromise_1, globalPromise_2, initPromise_1, initPromise_2, resolvePromise_1, resolvePromise_2 } from "./css.mjs";
2
2
  import { camelToKebabCase, genBase36Hash, injectClientCSS, injectClientGlobalCSS, injectServerCSS, isDevAndTest, isServer, transpiler } from "zss-engine";
3
- import { color, container, media, pseudo } from "zss-utils";
3
+ import { color, container, media, ps } from "zss-utils";
4
4
 
5
5
  //#region src/css.ts
6
6
  function create(object) {
@@ -95,27 +95,26 @@ var css = class {
95
95
  }
96
96
  static media = media;
97
97
  static container = container;
98
- static pseudo = pseudo;
99
98
  static color = color;
100
99
  };
101
100
  var css_default = css;
102
101
 
103
102
  //#endregion
104
103
  //#region src/cx.ts
105
- const cx = (...strings) => {
106
- let result = "";
107
- let isFirst = true;
108
- strings.filter(Boolean).forEach((str) => {
109
- if (str?.toString().startsWith(":")) result += str.toString();
110
- else if (typeof str === "string") if (isFirst) {
111
- result += str;
112
- isFirst = false;
113
- } else result += ` ${str}`;
114
- });
115
- return result;
116
- };
104
+ const cx = (...classes) => classes.filter(Boolean).join(" ");
117
105
  var cx_default = cx;
118
106
 
107
+ //#endregion
108
+ //#region src/ps.ts
109
+ var ps_default = ps;
110
+
111
+ //#endregion
112
+ //#region src/px.ts
113
+ const px = (...pseudos) => {
114
+ return pseudos.filter(Boolean).join("");
115
+ };
116
+ var px_default = px;
117
+
119
118
  //#endregion
120
119
  //#region src/rx.ts
121
120
  const rx = (className, varSet) => ({
@@ -125,4 +124,4 @@ const rx = (className, varSet) => ({
125
124
  var rx_default = rx;
126
125
 
127
126
  //#endregion
128
- export { css_default as css, cx_default as cx, rx_default as rx };
127
+ export { css_default as css, cx_default as cx, ps_default as ps, px_default as px, rx_default as rx };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "0.9.10",
3
+ "version": "0.10.1",
4
4
  "description": "Zero-runtime, expressive CSS-in-JS library for TypeScript.",
5
5
  "keywords": [
6
6
  "css",
@@ -39,8 +39,8 @@
39
39
  "stylesheet.css"
40
40
  ],
41
41
  "dependencies": {
42
- "zss-engine": "0.2.40",
43
- "zss-utils": "0.2.3"
42
+ "zss-engine": "0.2.41",
43
+ "zss-utils": "0.2.4"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"