vasille-css 7.0.0-rc.2 → 7.0.0-rc.4
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 +7 -4
- package/lib/dev.js +32 -1
- package/lib/index.js +1 -1
- package/lib/lib.js +7 -11
- package/package.json +1 -1
- package/types/dev.d.ts +3 -0
- package/types/index.d.ts +1 -1
- package/types/lib.d.ts +6 -1
package/README.md
CHANGED
|
@@ -130,9 +130,12 @@ We respect semantic versioning:
|
|
|
130
130
|
- A minor version is increased when we add functionality.
|
|
131
131
|
- Patch version is increased when we fix bugs.
|
|
132
132
|
|
|
133
|
-
### 7.0
|
|
133
|
+
### 7.0 RC (WIP)
|
|
134
134
|
|
|
135
|
-
-
|
|
135
|
+
- Add `debounceRef`, `edgeRef` and `fieldRef` functions, which extend the reativity system.
|
|
136
|
+
- Add `Zombie` component, it keeps HTML elements alive some time after destruction.
|
|
137
|
+
- Add `abortSignal` to cancel fetch requests and timers when component is destroyed.
|
|
138
|
+
- Add `safeRef`, `safeExpr`, `safeInit` functions, they make the JSX much safer.
|
|
136
139
|
|
|
137
140
|
### 6.0 RC (never released)
|
|
138
141
|
|
|
@@ -161,12 +164,12 @@ We respect semantic versioning:
|
|
|
161
164
|
|
|
162
165
|
- Switch to a babel plugin to compile components code. **[API change]**
|
|
163
166
|
- 100% of the code has been covered with unit tests.
|
|
164
|
-
- New
|
|
167
|
+
- New development direction: `keep it simple`.
|
|
165
168
|
|
|
166
169
|
### 2.0 - 2.3
|
|
167
170
|
|
|
168
171
|
- Introduces components compilation via a typescript plugin. **[API change]**
|
|
169
|
-
- New
|
|
172
|
+
- New development direction: `write less, do more`.
|
|
170
173
|
|
|
171
174
|
### 1.0 - 1.2
|
|
172
175
|
|
package/lib/dev.js
CHANGED
|
@@ -1,4 +1,35 @@
|
|
|
1
|
-
import { CssStyleInjector } from "./index.js";
|
|
1
|
+
import { CssStyleInjector, setLaptopMaxWidth, setMobileMaxWidth, setTabletMaxWidth } from "./index.js";
|
|
2
|
+
import { desktop, laptopMaxWidth, mobile, mobileMaxWidth, tablet, tabletMaxWidth } from "./lib.js";
|
|
3
|
+
function warn(device) {
|
|
4
|
+
console.warn(`[vasille-css] Setting of ${device} max width in production mode is not supported.`);
|
|
5
|
+
}
|
|
6
|
+
export function devSetMobileMaxWidth(value) {
|
|
7
|
+
setMobileMaxWidth(value);
|
|
8
|
+
if (mobile) {
|
|
9
|
+
mobile.media = `(max-width:${mobileMaxWidth}px)`;
|
|
10
|
+
}
|
|
11
|
+
if (tablet) {
|
|
12
|
+
tablet.media = `(min-width:${mobileMaxWidth}px) and (max-width:${tabletMaxWidth}px)`;
|
|
13
|
+
}
|
|
14
|
+
warn("mobile");
|
|
15
|
+
}
|
|
16
|
+
export function devSetTabletMaxWidth(value) {
|
|
17
|
+
setTabletMaxWidth(value);
|
|
18
|
+
if (tablet) {
|
|
19
|
+
tablet.media = `(min-width:${mobileMaxWidth}px) and (max-width:${tabletMaxWidth}px)`;
|
|
20
|
+
}
|
|
21
|
+
if (desktop) {
|
|
22
|
+
desktop.media = `(min-width:${tabletMaxWidth}px) and (max-width:${laptopMaxWidth}px)`;
|
|
23
|
+
}
|
|
24
|
+
warn("tablet");
|
|
25
|
+
}
|
|
26
|
+
export function devSetLaptopMaxWidth(value) {
|
|
27
|
+
setLaptopMaxWidth(value);
|
|
28
|
+
if (desktop) {
|
|
29
|
+
desktop.media = `(min-width:${tabletMaxWidth}px) and (max-width:${laptopMaxWidth}px)`;
|
|
30
|
+
}
|
|
31
|
+
warn("laptop");
|
|
32
|
+
}
|
|
2
33
|
export class DevCssStyleInjector extends CssStyleInjector {
|
|
3
34
|
constructor(key, styles) {
|
|
4
35
|
super(styles);
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { insertRule } from "./lib.js";
|
|
2
|
-
export { setMobileMaxWidth, setTabletMaxWidth, setLaptopMaxWidth } from "./lib.js";
|
|
2
|
+
export { setMobileMaxWidth, setTabletMaxWidth, setLaptopMaxWidth, mobileMaxWidth, tabletMaxWidth, laptopMaxWidth, } from "./lib.js";
|
|
3
3
|
let index = 1;
|
|
4
4
|
export class CssStyleInjector {
|
|
5
5
|
constructor(styles) {
|
package/lib/lib.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
let common;
|
|
2
|
-
let mobile;
|
|
3
|
-
let tablet;
|
|
4
|
-
let desktop;
|
|
2
|
+
export let mobile;
|
|
3
|
+
export let tablet;
|
|
4
|
+
export let desktop;
|
|
5
5
|
let dark;
|
|
6
6
|
let light;
|
|
7
|
-
let mobileMaxWidth = 440;
|
|
8
|
-
let tabletMaxWidth = 880;
|
|
9
|
-
let laptopMaxWidth = 1320;
|
|
7
|
+
export let mobileMaxWidth = 440;
|
|
8
|
+
export let tabletMaxWidth = 880;
|
|
9
|
+
export let laptopMaxWidth = 1320;
|
|
10
10
|
export function setMobileMaxWidth(value) {
|
|
11
11
|
mobileMaxWidth = value;
|
|
12
12
|
}
|
|
@@ -22,7 +22,7 @@ function createStyleSheet(media) {
|
|
|
22
22
|
document.head.append(style);
|
|
23
23
|
return style.sheet;
|
|
24
24
|
}
|
|
25
|
-
export function
|
|
25
|
+
export function insertRule(target, rule) {
|
|
26
26
|
let sheet;
|
|
27
27
|
switch (target) {
|
|
28
28
|
case 0:
|
|
@@ -68,10 +68,6 @@ export function getStyleSheet(target) {
|
|
|
68
68
|
sheet = light;
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
|
-
return sheet;
|
|
72
|
-
}
|
|
73
|
-
export function insertRule(target, rule) {
|
|
74
|
-
const sheet = getStyleSheet(target);
|
|
75
71
|
/* istanbul ignore else */
|
|
76
72
|
if (sheet) {
|
|
77
73
|
sheet.insertRule(rule, sheet.cssRules.length);
|
package/package.json
CHANGED
package/types/dev.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { CssStyleInjector } from "./index.js";
|
|
2
|
+
export declare function devSetMobileMaxWidth(value: number): void;
|
|
3
|
+
export declare function devSetTabletMaxWidth(value: number): void;
|
|
4
|
+
export declare function devSetLaptopMaxWidth(value: number): void;
|
|
2
5
|
export declare class DevCssStyleInjector extends CssStyleInjector {
|
|
3
6
|
protected key: string;
|
|
4
7
|
constructor(key: string, styles: (string | [number, string])[]);
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { setMobileMaxWidth, setTabletMaxWidth, setLaptopMaxWidth } from "./lib.js";
|
|
1
|
+
export { setMobileMaxWidth, setTabletMaxWidth, setLaptopMaxWidth, mobileMaxWidth, tabletMaxWidth, laptopMaxWidth, } from "./lib.js";
|
|
2
2
|
export declare class CssStyleInjector {
|
|
3
3
|
protected className: string | null;
|
|
4
4
|
protected styles: (string | [number, string])[];
|
package/types/lib.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
export declare let mobile: CSSStyleSheet | undefined;
|
|
2
|
+
export declare let tablet: CSSStyleSheet | undefined;
|
|
3
|
+
export declare let desktop: CSSStyleSheet | undefined;
|
|
4
|
+
export declare let mobileMaxWidth: number;
|
|
5
|
+
export declare let tabletMaxWidth: number;
|
|
6
|
+
export declare let laptopMaxWidth: number;
|
|
1
7
|
export declare function setMobileMaxWidth(value: number): void;
|
|
2
8
|
export declare function setTabletMaxWidth(value: number): void;
|
|
3
9
|
export declare function setLaptopMaxWidth(value: number): void;
|
|
4
|
-
export declare function getStyleSheet(target: number): CSSStyleSheet | undefined;
|
|
5
10
|
export declare function insertRule(target: number, rule: string): void;
|