@webstudio-is/css-engine 0.56.0 → 0.58.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.
@@ -1,6 +1,10 @@
1
- import type { CssRule } from "@webstudio-is/css-data";
1
+ import type { Style } from "@webstudio-is/css-data";
2
2
  import { MediaRule, PlaintextRule, StyleRule, type FontFaceOptions, type MediaRuleOptions } from "./rules";
3
3
  import type { TransformValue } from "./to-value";
4
+ type CssRule = {
5
+ style: Style;
6
+ breakpoint?: string;
7
+ };
4
8
  export type CssEngineOptions = {
5
9
  name?: string;
6
10
  };
@@ -18,3 +22,4 @@ export declare class CssEngine {
18
22
  getAttribute(name: string): string | null | undefined;
19
23
  get cssText(): string;
20
24
  }
25
+ export {};
package/package.json CHANGED
@@ -1,30 +1,29 @@
1
1
  {
2
2
  "name": "@webstudio-is/css-engine",
3
- "version": "0.56.0",
3
+ "version": "0.58.0",
4
4
  "description": "CSS Renderer for Webstudio",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
7
7
  "type": "module",
8
8
  "dependencies": {
9
9
  "hyphenate-style-name": "^1.0.4",
10
- "react": "^17.0.2",
11
- "react-dom": "^17.0.2",
12
- "@webstudio-is/fonts": "^0.56.0"
10
+ "react": "^18.2.0",
11
+ "react-dom": "^18.2.0",
12
+ "@webstudio-is/css-data": "^0.58.0",
13
+ "@webstudio-is/fonts": "^0.58.0"
13
14
  },
14
15
  "devDependencies": {
15
16
  "@jest/globals": "^29.3.1",
16
17
  "@storybook/react": "^6.5.16",
17
18
  "@types/hyphenate-style-name": "^1.0.0",
18
- "@types/react": "^17.0.24",
19
- "@types/react-dom": "^17.0.9",
19
+ "@types/react": "^18.0.35",
20
+ "@types/react-dom": "^18.0.11",
20
21
  "jest": "^29.3.1",
21
22
  "typescript": "5.0.3",
22
- "@webstudio-is/asset-uploader": "^0.56.0",
23
- "@webstudio-is/css-data": "^0.56.0",
24
- "@webstudio-is/jest-config": "^1.0.2",
23
+ "@webstudio-is/jest-config": "^1.0.5",
25
24
  "@webstudio-is/scripts": "^0.0.0",
26
25
  "@webstudio-is/storybook-config": "^0.0.0",
27
- "@webstudio-is/tsconfig": "^1.0.3"
26
+ "@webstudio-is/tsconfig": "^1.0.5"
28
27
  },
29
28
  "exports": {
30
29
  "source": "./src/index.ts",
@@ -40,11 +39,11 @@
40
39
  "private": false,
41
40
  "sideEffects": false,
42
41
  "scripts": {
43
- "typecheck": "tsc --noEmit",
42
+ "typecheck": "tsc --noEmit --emitDeclarationOnly false",
44
43
  "checks": "pnpm typecheck && pnpm lint && pnpm test",
45
44
  "dev": "build-package --watch",
46
45
  "build": "build-package",
47
- "dts": "tsc --emitDeclarationOnly --declaration --declarationDir lib/types",
46
+ "dts": "tsc --declarationDir lib/types",
48
47
  "test": "NODE_OPTIONS=--experimental-vm-modules jest",
49
48
  "lint": "eslint ./src --ext .ts,.tsx --max-warnings 0",
50
49
  "storybook:run": "start-storybook -p 6006",
@@ -34,7 +34,7 @@ export const Basic = () => {
34
34
  onClick={() => {
35
35
  engine.addStyleRule(".test", {
36
36
  style: {
37
- background: { type: "keyword", value: "yellow" },
37
+ backgroundColor: { type: "keyword", value: "yellow" },
38
38
  },
39
39
  breakpoint: "0",
40
40
  });
@@ -1,5 +1,4 @@
1
1
  import { describe, beforeEach, test, expect } from "@jest/globals";
2
- import type { Assets } from "@webstudio-is/asset-uploader";
3
2
  import { CssEngine } from "./css-engine";
4
3
 
5
4
  const style0 = {
@@ -352,23 +351,8 @@ describe("CssEngine", () => {
352
351
  });
353
352
 
354
353
  test("render images with injected asset url", () => {
355
- const assets: Assets = new Map([
356
- [
357
- "1234",
358
- {
359
- type: "image",
360
- path: "foo.png",
361
- id: "1234567890",
362
- projectId: "",
363
- format: "",
364
- size: 1212,
365
- name: "img",
366
- description: "",
367
- location: "REMOTE",
368
- createdAt: "",
369
- meta: { width: 1, height: 2 },
370
- },
371
- ],
354
+ const assets = new Map<string, { path: string }>([
355
+ ["1234", { path: "foo.png" }],
372
356
  ]);
373
357
  const rule = engine.addStyleRule(
374
358
  ".c",
@@ -1,4 +1,4 @@
1
- import type { CssRule } from "@webstudio-is/css-data";
1
+ import type { Style } from "@webstudio-is/css-data";
2
2
  import {
3
3
  FontFaceRule,
4
4
  MediaRule,
@@ -14,6 +14,11 @@ import type { TransformValue } from "./to-value";
14
14
 
15
15
  const defaultMediaRuleId = "__default-media-rule__";
16
16
 
17
+ type CssRule = {
18
+ style: Style;
19
+ breakpoint?: string;
20
+ };
21
+
17
22
  export type CssEngineOptions = { name?: string };
18
23
 
19
24
  export class CssEngine {
@@ -1,5 +1,4 @@
1
1
  import { describe, test, expect } from "@jest/globals";
2
- import type { Assets } from "@webstudio-is/asset-uploader";
3
2
  import { toValue } from "./to-value";
4
3
 
5
4
  describe("Convert WS CSS Values to native CSS strings", () => {
@@ -74,24 +73,8 @@ describe("Convert WS CSS Values to native CSS strings", () => {
74
73
  });
75
74
 
76
75
  test("array", () => {
77
- const assets: Assets = new Map([
78
- [
79
- "1234567890",
80
- {
81
- type: "image",
82
- path: "foo.png",
83
-
84
- id: "1234567890",
85
- projectId: "",
86
- format: "",
87
- size: 1212,
88
- name: "img",
89
- description: "",
90
- location: "REMOTE",
91
- createdAt: "",
92
- meta: { width: 1, height: 2 },
93
- },
94
- ],
76
+ const assets = new Map<string, { path: string }>([
77
+ ["1234567890", { path: "foo.png" }],
95
78
  ]);
96
79
 
97
80
  const value = toValue(