@gtkx/css 0.17.2 → 0.18.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 +7 -7
- package/dist/style-sheet.d.ts +2 -0
- package/dist/style-sheet.js +15 -4
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
12
|
<a href="https://www.npmjs.com/package/@gtkx/react"><img src="https://img.shields.io/npm/v/@gtkx/react.svg" alt="npm version"></a>
|
|
13
|
-
<a href="https://github.com/
|
|
14
|
-
<a href="https://github.com/
|
|
15
|
-
<a href="https://github.com/
|
|
13
|
+
<a href="https://github.com/gtkx-org/gtkx/actions"><img src="https://img.shields.io/github/actions/workflow/status/eugeniodepalo/gtkx/ci.yml" alt="CI"></a>
|
|
14
|
+
<a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License"></a>
|
|
15
|
+
<a href="https://github.com/gtkx-org/gtkx/discussions"><img src="https://img.shields.io/badge/discussions-GitHub-blue" alt="GitHub Discussions"></a>
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
---
|
|
@@ -90,16 +90,16 @@ Explore complete applications in the [`examples/`](./examples) directory:
|
|
|
90
90
|
|
|
91
91
|
## Documentation
|
|
92
92
|
|
|
93
|
-
Visit [https://
|
|
93
|
+
Visit [https://gtkx.dev](https://gtkx.dev) for the full documentation.
|
|
94
94
|
|
|
95
95
|
## Contributing
|
|
96
96
|
|
|
97
|
-
Contributions are welcome! Please see the [contributing guidelines](./CONTRIBUTING.md) and check out the [good first issues](https://github.com/
|
|
97
|
+
Contributions are welcome! Please see the [contributing guidelines](./CONTRIBUTING.md) and check out the [good first issues](https://github.com/gtkx-org/gtkx/labels/good%20first%20issue).
|
|
98
98
|
|
|
99
99
|
## Community
|
|
100
100
|
|
|
101
|
-
- [GitHub Discussions](https://github.com/
|
|
102
|
-
- [Issue Tracker](https://github.com/
|
|
101
|
+
- [GitHub Discussions](https://github.com/gtkx-org/gtkx/discussions) — Questions, ideas, and general discussion
|
|
102
|
+
- [Issue Tracker](https://github.com/gtkx-org/gtkx/issues) — Bug reports and feature requests
|
|
103
103
|
|
|
104
104
|
## License
|
|
105
105
|
|
package/dist/style-sheet.d.ts
CHANGED
|
@@ -12,9 +12,11 @@ export declare class StyleSheet {
|
|
|
12
12
|
private display;
|
|
13
13
|
private isRegistered;
|
|
14
14
|
private hasPendingRules;
|
|
15
|
+
private updateScheduled;
|
|
15
16
|
constructor(options: StyleSheetOptions);
|
|
16
17
|
private ensureProvider;
|
|
17
18
|
private updateProvider;
|
|
19
|
+
private scheduleUpdate;
|
|
18
20
|
insert(rule: string): void;
|
|
19
21
|
applyQueuedRules(): void;
|
|
20
22
|
flush(): void;
|
package/dist/style-sheet.js
CHANGED
|
@@ -12,7 +12,7 @@ const flushPendingStyles = () => {
|
|
|
12
12
|
const registerStartListener = () => {
|
|
13
13
|
events.once("start", flushPendingStyles);
|
|
14
14
|
};
|
|
15
|
-
if (!isStarted) {
|
|
15
|
+
if (!isStarted()) {
|
|
16
16
|
registerStartListener();
|
|
17
17
|
}
|
|
18
18
|
export class StyleSheet {
|
|
@@ -22,6 +22,7 @@ export class StyleSheet {
|
|
|
22
22
|
display = null;
|
|
23
23
|
isRegistered = false;
|
|
24
24
|
hasPendingRules = false;
|
|
25
|
+
updateScheduled = false;
|
|
25
26
|
constructor(options) {
|
|
26
27
|
this.key = options.key;
|
|
27
28
|
}
|
|
@@ -41,11 +42,20 @@ export class StyleSheet {
|
|
|
41
42
|
this.provider.loadFromString(css);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
|
|
45
|
+
scheduleUpdate() {
|
|
46
|
+
if (this.updateScheduled)
|
|
47
|
+
return;
|
|
48
|
+
this.updateScheduled = true;
|
|
49
|
+
queueMicrotask(() => {
|
|
50
|
+
this.updateScheduled = false;
|
|
47
51
|
this.ensureProvider();
|
|
48
52
|
this.updateProvider();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
insert(rule) {
|
|
56
|
+
this.rules.push(rule);
|
|
57
|
+
if (isStarted()) {
|
|
58
|
+
this.scheduleUpdate();
|
|
49
59
|
}
|
|
50
60
|
else if (!this.hasPendingRules) {
|
|
51
61
|
this.hasPendingRules = true;
|
|
@@ -68,6 +78,7 @@ export class StyleSheet {
|
|
|
68
78
|
this.provider = null;
|
|
69
79
|
this.display = null;
|
|
70
80
|
this.hasPendingRules = false;
|
|
81
|
+
this.updateScheduled = false;
|
|
71
82
|
}
|
|
72
83
|
hydrate(_elements) { }
|
|
73
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Emotion-based CSS-in-JS for GTKX applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"linux",
|
|
15
15
|
"desktop"
|
|
16
16
|
],
|
|
17
|
-
"homepage": "https://
|
|
17
|
+
"homepage": "https://gtkx.dev",
|
|
18
18
|
"bugs": {
|
|
19
|
-
"url": "https://github.com/
|
|
19
|
+
"url": "https://github.com/gtkx-org/gtkx/issues"
|
|
20
20
|
},
|
|
21
21
|
"repository": {
|
|
22
22
|
"type": "git",
|
|
23
|
-
"url": "https://github.com/
|
|
23
|
+
"url": "https://github.com/gtkx-org/gtkx.git",
|
|
24
24
|
"directory": "packages/css"
|
|
25
25
|
},
|
|
26
26
|
"license": "MPL-2.0",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@emotion/cache": "^11.14.0",
|
|
41
41
|
"@emotion/serialize": "^1.3.3",
|
|
42
|
-
"@gtkx/ffi": "0.
|
|
42
|
+
"@gtkx/ffi": "0.18.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@gtkx/vitest": "0.
|
|
45
|
+
"@gtkx/vitest": "0.18.0"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsc -b && cp ../../README.md .",
|