@unocss/vite 66.5.10 → 66.5.11

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/dist/client.d.mts CHANGED
@@ -1,2 +1 @@
1
-
2
- export { };
1
+ export { };
package/dist/client.mjs CHANGED
@@ -1,52 +1,46 @@
1
+ //#region src/client.ts
1
2
  function post(data, config) {
2
- return fetch("__POST_PATH__", {
3
- ...config,
4
- method: "POST",
5
- headers: {
6
- "Content-Type": "application/json"
7
- },
8
- body: JSON.stringify(data)
9
- });
3
+ return fetch("__POST_PATH__", {
4
+ ...config,
5
+ method: "POST",
6
+ headers: { "Content-Type": "application/json" },
7
+ body: JSON.stringify(data)
8
+ });
10
9
  }
11
10
  function include(set, v) {
12
- for (const i of v)
13
- set.add(i);
11
+ for (const i of v) set.add(i);
14
12
  }
15
- console.log(
16
- "%c[unocss] devtools support enabled %c\nread more at https://windicss.org",
17
- "background:#0ea5e9; color:white; padding: 1px 4px; border-radius: 3px;",
18
- ""
19
- );
13
+ console.log("%c[unocss] devtools support enabled %c\nread more at https://windicss.org", "background:#0ea5e9; color:white; padding: 1px 4px; border-radius: 3px;", "");
20
14
  const visitedClasses = /* @__PURE__ */ new Set();
21
15
  const pendingClasses = /* @__PURE__ */ new Set();
22
16
  let _timer;
23
17
  function schedule() {
24
- if (_timer != null)
25
- clearTimeout(_timer);
26
- _timer = setTimeout(() => {
27
- if (pendingClasses.size) {
28
- post(
29
- { type: "add-classes", data: Array.from(pendingClasses) },
30
- { mode: "__POST_FETCH_MODE__" }
31
- );
32
- include(visitedClasses, pendingClasses);
33
- pendingClasses.clear();
34
- }
35
- }, 10);
18
+ if (_timer != null) clearTimeout(_timer);
19
+ _timer = setTimeout(() => {
20
+ if (pendingClasses.size) {
21
+ post({
22
+ type: "add-classes",
23
+ data: Array.from(pendingClasses)
24
+ }, { mode: "__POST_FETCH_MODE__" });
25
+ include(visitedClasses, pendingClasses);
26
+ pendingClasses.clear();
27
+ }
28
+ }, 10);
36
29
  }
37
- const mutationObserver = new MutationObserver((mutations) => {
38
- mutations.forEach((mutation) => {
39
- if (mutation.attributeName === "class" && mutation.target) {
40
- Array.from(mutation.target.classList || []).forEach((i) => {
41
- if (!visitedClasses.has(i))
42
- pendingClasses.add(i);
43
- });
44
- schedule();
45
- }
46
- });
47
- });
48
- mutationObserver.observe(document.documentElement || document.body, {
49
- childList: true,
50
- subtree: true,
51
- attributes: true
30
+ new MutationObserver((mutations) => {
31
+ mutations.forEach((mutation) => {
32
+ if (mutation.attributeName === "class" && mutation.target) {
33
+ Array.from(mutation.target.classList || []).forEach((i) => {
34
+ if (!visitedClasses.has(i)) pendingClasses.add(i);
35
+ });
36
+ schedule();
37
+ }
38
+ });
39
+ }).observe(document.documentElement || document.body, {
40
+ childList: true,
41
+ subtree: true,
42
+ attributes: true
52
43
  });
44
+
45
+ //#endregion
46
+ export { };