@just-web/css 0.6.1 → 0.7.0

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.
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Converts pixel values to numbers.
3
+ *
4
+ * @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
5
+ * @returns The numeric value
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * px2num(16) // 16
10
+ * px2num('32px') // 32
11
+ * px2num('12.5px') // 12.5
12
+ * px2num('0px') // 0
13
+ * ```
14
+ */
15
+ export declare function px2num(px: number | string | undefined): number;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.px2num = px2num;
7
+ function px2num(px) {
8
+ return typeof px === "string" ? Number.parseFloat(px.replace(/px$/, "")) : Number(px);
9
+ }
package/cjs/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './convertors/px_2_num.ts';
1
2
  export * from './convertors/px_2_rem.ts';
2
3
  export * from './convertors/rem_2_px.ts';
3
4
  export * from './css-properties/css-properties.ts';
package/cjs/index.js CHANGED
@@ -3,6 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _px_2_num = require("./convertors/px_2_num.ts");
7
+ Object.keys(_px_2_num).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _px_2_num[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _px_2_num[key];
14
+ }
15
+ });
16
+ });
6
17
  var _px_2_rem = require("./convertors/px_2_rem.ts");
7
18
  Object.keys(_px_2_rem).forEach(function (key) {
8
19
  if (key === "default" || key === "__esModule") return;
@@ -6,6 +6,6 @@
6
6
  * Interface for component props that include a className property.
7
7
  * The className property accepts a string value for CSS class names.
8
8
  */
9
- export interface ClassNameProps {
9
+ export type ClassNameProps = {
10
10
  className?: string | undefined;
11
- }
11
+ };
@@ -2,6 +2,6 @@ import type { CSSProperties } from '../css-properties/css-properties.ts';
2
2
  /**
3
3
  * Interface for component props that include a style property.
4
4
  */
5
- export interface StyleProps {
5
+ export type StyleProps = {
6
6
  style?: CSSProperties | undefined;
7
- }
7
+ };
@@ -30,4 +30,4 @@ export declare function observePrefersColorScheme<T extends string>(themes: Reco
30
30
  * // Returns 'light', 'dark', or null
31
31
  * ```
32
32
  */
33
- export declare function getPrefersColorTheme<T extends string>(...themes: T[]): any;
33
+ export declare function getPrefersColorTheme<T extends string>(...themes: T[]): T | null;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Converts pixel values to numbers.
3
+ *
4
+ * @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
5
+ * @returns The numeric value
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * px2num(16) // 16
10
+ * px2num('32px') // 32
11
+ * px2num('12.5px') // 12.5
12
+ * px2num('0px') // 0
13
+ * ```
14
+ */
15
+ export declare function px2num(px: number | string | undefined): number;
16
+ //# sourceMappingURL=px_2_num.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"px_2_num.d.ts","sourceRoot":"","sources":["../../src/convertors/px_2_num.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAE9D"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Converts pixel values to numbers.
3
+ *
4
+ * @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
5
+ * @returns The numeric value
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * px2num(16) // 16
10
+ * px2num('32px') // 32
11
+ * px2num('12.5px') // 12.5
12
+ * px2num('0px') // 0
13
+ * ```
14
+ */
15
+ export function px2num(px) {
16
+ return typeof px === 'string' ? Number.parseFloat(px.replace(/px$/, '')) : Number(px);
17
+ }
18
+ //# sourceMappingURL=px_2_num.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"px_2_num.js","sourceRoot":"","sources":["../../src/convertors/px_2_num.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,MAAM,CAAC,EAA+B;IACrD,OAAO,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AACtF,CAAC"}
package/esm/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './convertors/px_2_num.ts';
1
2
  export * from './convertors/px_2_rem.ts';
2
3
  export * from './convertors/rem_2_px.ts';
3
4
  export * from './css-properties/css-properties.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oCAAoC,CAAA;AAClD,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oCAAoC,CAAA;AAClD,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA"}
package/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./convertors/px_2_num.js";
1
2
  export * from "./convertors/px_2_rem.js";
2
3
  export * from "./convertors/rem_2_px.js";
3
4
  export * from "./css-properties/css-properties.js";
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oCAAoC,CAAA;AAClD,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oCAAoC,CAAA;AAClD,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA"}
@@ -6,7 +6,7 @@
6
6
  * Interface for component props that include a className property.
7
7
  * The className property accepts a string value for CSS class names.
8
8
  */
9
- export interface ClassNameProps {
9
+ export type ClassNameProps = {
10
10
  className?: string | undefined;
11
- }
11
+ };
12
12
  //# sourceMappingURL=class-name.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"class-name.d.ts","sourceRoot":"","sources":["../../src/props/class-name.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9B"}
1
+ {"version":3,"file":"class-name.d.ts","sourceRoot":"","sources":["../../src/props/class-name.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC9B,CAAA"}
@@ -2,7 +2,7 @@ import type { CSSProperties } from '../css-properties/css-properties.ts';
2
2
  /**
3
3
  * Interface for component props that include a style property.
4
4
  */
5
- export interface StyleProps {
5
+ export type StyleProps = {
6
6
  style?: CSSProperties | undefined;
7
- }
7
+ };
8
8
  //# sourceMappingURL=style.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/props/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AAExE;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;CACjC"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/props/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AAExE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACxB,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;CACjC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@just-web/css",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "CSS types and utilities",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,38 +24,30 @@
24
24
  "type-plus": "8.0.0-beta.7"
25
25
  },
26
26
  "devDependencies": {
27
- "@repobuddy/storybook": "^0.12.0",
27
+ "@repobuddy/storybook": "^1.0.0",
28
28
  "@repobuddy/vitest": "^1.2.2",
29
- "@storybook/addon-essentials": "^8.6.12",
30
- "@storybook/addon-storysource": "^8.6.12",
31
- "@storybook/blocks": "^8.6.12",
32
- "@storybook/experimental-addon-test": "^8.6.12",
33
- "@storybook/manager-api": "^8.6.12",
34
- "@storybook/preview-api": "^8.6.12",
35
- "@storybook/react": "^8.6.12",
36
- "@storybook/react-vite": "^8.6.12",
37
- "@storybook/test": "^8.6.12",
38
- "@storybook/theming": "^8.6.12",
29
+ "@storybook/addon-docs": "^9.0.3",
30
+ "@storybook/addon-vitest": "9.0.3",
31
+ "@storybook/react-vite": "^9.0.3",
39
32
  "@tailwindcss/cli": "^4.1.6",
40
33
  "@tailwindcss/vite": "^4.1.6",
41
- "@vitest/browser": "^3.1.3",
42
- "@vitest/coverage-v8": "^3.1.3",
34
+ "@vitest/browser": "^3.2.4",
35
+ "@vitest/coverage-v8": "^3.2.4",
43
36
  "dedent": "^1.6.0",
44
37
  "ncp": "^2.0.0",
45
- "playwright": "^1.52.0",
46
38
  "react": "^18.3.1",
47
39
  "react-dom": "^18.3.1",
48
40
  "rimraf": "^6.0.1",
49
- "storybook": "^8.6.12",
50
- "storybook-addon-code-editor": "^4.1.1",
51
- "storybook-addon-tag-badges": "^1.4.0",
52
- "storybook-addon-vis": "^0.19.4",
53
- "storybook-dark-mode": "^4.0.2",
41
+ "storybook": "^9.0.3",
42
+ "storybook-addon-code-editor": "^5.0.0",
43
+ "storybook-addon-tag-badges": "^2.0.0",
44
+ "storybook-addon-vis": "^2.1.0",
45
+ "storybook-dark-mode2": "^5.0.2",
54
46
  "tailwindcss": "^4.1.6",
55
47
  "typescript": "^5.8.3",
56
48
  "unbuild": "^3.5.0",
57
49
  "vite": "^6.3.5",
58
- "vitest": "^3.1.3",
50
+ "vitest": "^3.2.4",
59
51
  "vitest-browser-react": "^0.1.1",
60
52
  "@tools/typescript": "^0.0.1"
61
53
  },
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Converts pixel values to numbers.
3
+ *
4
+ * @param px - The pixel value to convert. Can be a number or string (e.g. '16px' or '16')
5
+ * @returns The numeric value
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * px2num(16) // 16
10
+ * px2num('32px') // 32
11
+ * px2num('12.5px') // 12.5
12
+ * px2num('0px') // 0
13
+ * ```
14
+ */
15
+ export function px2num(px: number | string | undefined): number {
16
+ return typeof px === 'string' ? Number.parseFloat(px.replace(/px$/, '')) : Number(px)
17
+ }
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './convertors/px_2_num.ts'
1
2
  export * from './convertors/px_2_rem.ts'
2
3
  export * from './convertors/rem_2_px.ts'
3
4
  export * from './css-properties/css-properties.ts'
@@ -7,6 +7,6 @@
7
7
  * Interface for component props that include a className property.
8
8
  * The className property accepts a string value for CSS class names.
9
9
  */
10
- export interface ClassNameProps {
10
+ export type ClassNameProps = {
11
11
  className?: string | undefined
12
12
  }
@@ -3,6 +3,6 @@ import type { CSSProperties } from '../css-properties/css-properties.ts'
3
3
  /**
4
4
  * Interface for component props that include a style property.
5
5
  */
6
- export interface StyleProps {
6
+ export type StyleProps = {
7
7
  style?: CSSProperties | undefined
8
8
  }