vasille-css 3.1.0 → 3.2.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
@@ -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
 
@@ -44,6 +44,7 @@ $ npx degit vasille-js/example-javascript my-project
44
44
 
45
45
  ### Full documentation:
46
46
  * [Learn `Vasille` in 5 minutes](https://github.com/vasille-js/vasille-js/blob/v3/doc/V3-API.md)
47
+ * [Vasille Router Documentation](https://github.com/vasille-js/vasille-js/blob/v3/doc/Router-API.md)
47
48
 
48
49
  ### Examples
49
50
  * [TypeScript Example](https://github.com/vasille-js/example-typescript)
@@ -60,7 +61,7 @@ The safe of your application is ensured by
60
61
  * `strong typing` makes your javascript/typescript code safe as C++ code.
61
62
  All entities of `vasille` core library are strongly typed, including:
62
63
  * data fields & properties.
63
- * computed properties (function parameters & result).
64
+ * computed properties (function parameters and result).
64
65
  * methods.
65
66
  * events (defined handlers & event emit).
66
67
  * DOM events & DOM operation (attributing, styling, etc.).
@@ -68,7 +69,7 @@ All entities of `vasille` core library are strongly typed, including:
68
69
  * references to children.
69
70
  * No asynchronous code, when the line of code is executed, the DOM and reactive things are already synced.
70
71
 
71
- ## How SIMPLE is Vasille
72
+ ## How INTUITIVE is Vasille
72
73
 
73
74
  There is the "Hello World":
74
75
  ```typescript jsx
@@ -105,7 +106,7 @@ All of these are supported:
105
106
  * [x] Develop the `Vasille Babel Plugin`.
106
107
  * [x] `100%` Test Coverage fot babel plugin.
107
108
  * [x] Add CSS support (define styles in components).
108
- * [ ] Add router.
109
+ * [x] Add router.
109
110
  * [ ] Add SSR (server side rendering).
110
111
  * [ ] Develop tools extension for debugging.
111
112
 
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": "3.2.1",
4
+ "description": "The first Developer eXperience Orientated front-end framework (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",
16
17
  "build": "tsc --build tsconfig.json",
17
- "test-types": "tsc --noEmit ./fake-types/index.d.ts",
18
+ "build-types": "tsc --build tsconfig-types.json",
18
19
  "test": "jest",
19
20
  "test-coverage": "jest --coverage"
20
21
  },
@@ -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 {};