vasille-css 3.1.0 → 4.0.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.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Vasille
2
2
 
3
- ![Vasille.js logo](https://gitlab.com/vasille-js/vasille-js/-/raw/v2/doc/img/logo.png)
3
+ ![Vasille.js logo](https://raw.githubusercontent.com/vasille-js/vasille-js/refs/heads/v4/doc/img/logo.png)
4
4
 
5
- `Vasille Web` is a front-end framework, which is developed to provide the best `developer experience` ever. **Our goal is to keep is as simple as possible.** Developing web applications using Vasille must be *as fast as possible*.
5
+ `Vasille Web` is a front-end framework, which is developed to provide bulletproof frontends.
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/vasille?style=flat-square)](https://www.npmjs.com/package/vasille)
8
8
 
@@ -11,7 +11,7 @@
11
11
  * [Installation](#installation)
12
12
  * [How to use Vasille](#how-to-use-vasille)
13
13
  * [How SAFE is Vasille](#how-safe-is-vasille)
14
- * [How SIMPLE is Vasille](#how-simple-is-vasille)
14
+ * [How INTUITIVE is Vasille](#how-intuitive-is-vasille)
15
15
  * [How POWERFUL is Vasille](#how-powerful-is-vasille)
16
16
  * [Road Map](#road-map)
17
17
 
@@ -32,18 +32,9 @@ Create an app from a template
32
32
  $ npm create vasille
33
33
  ```
34
34
 
35
- Alternative method to create a TypeScript app.
36
- ```bash
37
- $ npx degit vasille-js/example-typescript my-project
38
- ```
39
-
40
- Alternative method to create a JavaScript app.
41
- ```bash
42
- $ npx degit vasille-js/example-javascript my-project
43
- ```
44
-
45
35
  ### Full documentation:
46
- * [Learn `Vasille` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v3/doc/V3-API.md)
36
+ * [Learn `Vasille` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v4/doc/V4-API.md)
37
+ * [Vasille Router Documentation](https://github.com/vasille-js/vasille-js/blob/v4/doc/Router-API.md)
47
38
 
48
39
  ### Examples
49
40
  * [TypeScript Example](https://github.com/vasille-js/example-typescript)
@@ -60,7 +51,7 @@ The safe of your application is ensured by
60
51
  * `strong typing` makes your javascript/typescript code safe as C++ code.
61
52
  All entities of `vasille` core library are strongly typed, including:
62
53
  * data fields & properties.
63
- * computed properties (function parameters & result).
54
+ * computed properties (function parameters and result).
64
55
  * methods.
65
56
  * events (defined handlers & event emit).
66
57
  * DOM events & DOM operation (attributing, styling, etc.).
@@ -68,7 +59,7 @@ All entities of `vasille` core library are strongly typed, including:
68
59
  * references to children.
69
60
  * No asynchronous code, when the line of code is executed, the DOM and reactive things are already synced.
70
61
 
71
- ## How SIMPLE is Vasille
62
+ ## How INTUITIVE is Vasille
72
63
 
73
64
  There is the "Hello World":
74
65
  ```typescript jsx
@@ -105,7 +96,8 @@ All of these are supported:
105
96
  * [x] Develop the `Vasille Babel Plugin`.
106
97
  * [x] `100%` Test Coverage fot babel plugin.
107
98
  * [x] Add CSS support (define styles in components).
108
- * [ ] Add router.
99
+ * [x] Add router.
100
+ * [ ] Add SSG (static site generation).
109
101
  * [ ] Add SSR (server side rendering).
110
102
  * [ ] Develop tools extension for debugging.
111
103
 
@@ -0,0 +1,25 @@
1
+ import compat from "eslint-plugin-compat";
2
+ import tseslint from "typescript-eslint";
3
+ import { globalIgnores } from "eslint/config";
4
+
5
+ export default tseslint.config(
6
+ tseslint.configs.base,
7
+ {
8
+ name: "compat check",
9
+ files: ["src/**/*.ts", "src/**/*.tsx"],
10
+ plugins: { compat },
11
+ rules: {
12
+ "compat/compat": "error",
13
+ },
14
+ settings: {
15
+ polyfills: [],
16
+ },
17
+ languageOptions: {
18
+ parserOptions: {
19
+ projectService: false,
20
+ tsconfigRootDir: import.meta.dirname,
21
+ },
22
+ },
23
+ },
24
+ globalIgnores(["node_modules", "lib/**/*", "types", "coverage/**/*"]),
25
+ );
package/lib/index.js CHANGED
@@ -30,40 +30,50 @@ function insertRule(target, rule) {
30
30
  let sheet;
31
31
  switch (target) {
32
32
  case 1:
33
+ /* istanbul ignore else */
33
34
  if (!mobile) {
34
35
  mobile = createStyleSheet(`(max-width:${mobileMaxWidth}px)`);
35
36
  }
36
37
  sheet = mobile;
37
38
  break;
38
39
  case 2:
40
+ /* istanbul ignore else */
39
41
  if (!tablet) {
40
42
  tablet = createStyleSheet(`(min-width:${mobileMaxWidth}px) and (max-width:${tabletMaxWidth}px)`);
41
43
  }
42
44
  sheet = tablet;
43
45
  break;
44
46
  case 3:
47
+ /* istanbul ignore else */
45
48
  if (!desktop) {
46
49
  desktop = createStyleSheet(`(min-width:${tabletMaxWidth}px) and (max-width:${laptopMaxWidth}px)`);
47
50
  }
48
51
  sheet = desktop;
49
52
  break;
50
53
  case 4:
54
+ /* istanbul ignore else */
51
55
  if (!dark) {
52
56
  dark = createStyleSheet("(prefers-color-scheme:dark)");
53
57
  }
54
58
  sheet = dark;
55
59
  break;
56
60
  case 5:
61
+ /* istanbul ignore else */
57
62
  if (!light) {
58
63
  light = createStyleSheet("(prefers-color-scheme:light)");
59
64
  }
60
65
  sheet = light;
61
66
  break;
62
67
  }
68
+ /* istanbul ignore else */
63
69
  if (sheet) {
64
70
  sheet.insertRule(rule, sheet.cssRules.length);
65
71
  }
66
72
  }
73
+ /**
74
+ * Inserts stylesheet to document
75
+ * @param styles CSS styles based on classes
76
+ */
67
77
  export function styleSheet(styles) {
68
78
  const result = {};
69
79
  for (const key in styles) {
@@ -76,6 +86,7 @@ export function styleSheet(styles) {
76
86
  insertRule(target, rule.replace("{}", className));
77
87
  }
78
88
  else {
89
+ /* istanbul ignore else */
79
90
  if (!common) {
80
91
  common = createStyleSheet("");
81
92
  }
package/package.json CHANGED
@@ -1,20 +1,21 @@
1
1
  {
2
2
  "name": "vasille-css",
3
- "version": "3.1.0",
4
- "description": "The first Developer eXperience orientated front-end framework (style library)",
3
+ "version": "4.0.0",
4
+ "description": "The framework designed to build bulletproof frontends (CSS style library)",
5
5
  "main": "./lib/index.js",
6
- "types": "./fake-types/index.d.ts",
6
+ "types": "./types/index.d.ts",
7
7
  "exports": {
8
- "types": "./fake-types/index.d.ts",
8
+ "types": "./types/index.d.ts",
9
9
  "import": "./lib/index.js",
10
10
  "browser": "./lib/index.js",
11
11
  "node": "./lib/index.js"
12
12
  },
13
+ "type": "module",
13
14
  "scripts": {
14
15
  "prepack": "cp -f ../README.md ./README.md",
15
16
  "prettier": "prettier src test --write",
17
+ "prebuild": "rm -rf lib types",
16
18
  "build": "tsc --build tsconfig.json",
17
- "test-types": "tsc --noEmit ./fake-types/index.d.ts",
18
19
  "test": "jest",
19
20
  "test-coverage": "jest --coverage"
20
21
  },
@@ -34,13 +35,23 @@
34
35
  "type": "git",
35
36
  "url": "git+https://github.com/vasille-js/vasille-js.git"
36
37
  },
38
+ "browserslist": [
39
+ "safari 6",
40
+ "ie 10",
41
+ "chrome 23",
42
+ "firefox 21",
43
+ "opera 15"
44
+ ],
37
45
  "devDependencies": {
38
46
  "@types/jest": "^30.0.0",
39
47
  "@types/jsdom": "^21.1.7",
48
+ "eslint": "^9.33.0",
49
+ "eslint-plugin-compat": "^6.0.2",
40
50
  "jest": "^30.0.5",
41
51
  "jsdom": "^26.1.0",
42
52
  "prettier": "^3.6.2",
43
53
  "ts-jest": "^29.4.0",
44
- "typescript": "^5.8.3"
54
+ "typescript": "^5.8.3",
55
+ "typescript-eslint": "^8.39.0"
45
56
  }
46
57
  }
@@ -0,0 +1,13 @@
1
+ export declare function setMobileMaxWidth(value: number): void;
2
+ export declare function setTabletMaxWidth(value: number): void;
3
+ export declare function setLaptopMaxWidth(value: number): void;
4
+ export declare function setIndex(value: number): void;
5
+ /**
6
+ * Inserts stylesheet to document
7
+ * @param styles CSS styles based on classes
8
+ */
9
+ export declare function styleSheet<T extends {
10
+ [k: string]: (string | [number, string])[];
11
+ }>(styles: T): {
12
+ [K in keyof T]: string;
13
+ };
@@ -1,21 +0,0 @@
1
- export declare function setMobileMaxWidth(value: number): void;
2
- export declare function setTabletMaxWidth(value: number): void;
3
- export declare function setLaptopMaxWidth(value: number): void;
4
-
5
- export declare function styleSheet<T extends {
6
- [className: string]: unknown;
7
- }>(styles: T): {
8
- [K in keyof T]: string;
9
- };
10
-
11
- // fake functions
12
- export declare function theme<T>(name: string, value: T): T;
13
- export declare function dark<T>($: T): T;
14
- // rules with target
15
- export declare function mobile<T>($: T): T;
16
- export declare function tablet<T>($: T): T;
17
- export declare function laptop<T>($: T): T;
18
- export declare function prefersDark<T>($: T): T;
19
- export declare function prefersLight<T>($: T): T;
20
-
21
- export {};