elements-kit 0.18.2 → 0.20.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 +14 -0
- package/dist/await.d.mts +53 -0
- package/dist/await.mjs +70 -0
- package/dist/custom-elements.d.mts +1 -1
- package/dist/{element-xQwq4ulc.mjs → element-D3om9yA6.mjs} +71 -4
- package/dist/for.d.mts +20 -26
- package/dist/for.mjs +29 -4
- package/dist/fragment-ROPRBJQd.mjs +61 -0
- package/dist/hydrate/index.d.mts +41 -0
- package/dist/hydrate/index.mjs +2 -0
- package/dist/hydrate-6Qx4n4Su.mjs +380 -0
- package/dist/integrations/astro-client.d.mts +17 -0
- package/dist/integrations/astro-client.mjs +23 -0
- package/dist/integrations/astro-server.d.mts +15 -0
- package/dist/integrations/astro-server.mjs +39 -0
- package/dist/integrations/astro-slots.d.mts +12 -0
- package/dist/integrations/astro-slots.mjs +30 -0
- package/dist/integrations/astro.d.mts +46 -0
- package/dist/integrations/astro.mjs +64 -0
- package/dist/integrations/react.d.mts +1 -1
- package/dist/integrations/react.mjs +2 -2
- package/dist/jsx-runtime/index.d.mts +1 -1
- package/dist/jsx-runtime/index.mjs +2 -20
- package/dist/{lib-Dkc7cV5F.mjs → lib-DYypKhxk.mjs} +63 -5
- package/dist/render.mjs +1 -1
- package/dist/{scope-CnEvL9Nd.mjs → scope-zbEG299F.mjs} +1 -1
- package/dist/server/index.d.mts +43 -0
- package/dist/server/index.mjs +2 -0
- package/dist/server-iFSng50i.mjs +385 -0
- package/dist/signals/index.d.mts +2 -2
- package/dist/signals/index.mjs +5 -3
- package/dist/{slot-B8y0aEoz.d.mts → slot-BFWXeFRl.d.mts} +6 -0
- package/dist/{slot-Cne__au7.mjs → slot-Dvf30O0B.mjs} +12 -1
- package/dist/slot.d.mts +1 -1
- package/dist/slot.mjs +1 -1
- package/dist/{infer-B7T5hi_D.d.mts → types-ncUK9rki.d.mts} +140 -141
- package/dist/ui/overlay/index.css +70 -0
- package/dist/ui/overlay/index.d.mts +209 -0
- package/dist/ui/overlay/index.mjs +1001 -0
- package/dist/ui/overlay/overlay.css +332 -0
- package/dist/utilities/_observe.mjs +1 -1
- package/dist/utilities/active-element.d.mts +1 -1
- package/dist/utilities/active-element.mjs +1 -1
- package/dist/utilities/async.d.mts +19 -2
- package/dist/utilities/async.mjs +49 -2
- package/dist/utilities/context.mjs +1 -1
- package/dist/utilities/debounced.d.mts +1 -1
- package/dist/utilities/debounced.mjs +1 -1
- package/dist/utilities/dom-lifecycle.bench.mjs +3255 -1
- package/dist/utilities/dom-lifecycle.mjs +1 -1
- package/dist/utilities/element-rect.d.mts +1 -1
- package/dist/utilities/element-rect.mjs +1 -1
- package/dist/utilities/element-scroll.d.mts +1 -1
- package/dist/utilities/event-driven.d.mts +1 -1
- package/dist/utilities/event-driven.mjs +1 -1
- package/dist/utilities/event-listener.d.mts +1 -1
- package/dist/utilities/event-listener.mjs +1 -1
- package/dist/utilities/focus-within.d.mts +1 -1
- package/dist/utilities/focus-within.mjs +1 -1
- package/dist/utilities/form-object.d.mts +96 -0
- package/dist/utilities/form-object.mjs +285 -0
- package/dist/utilities/hover.d.mts +1 -1
- package/dist/utilities/hover.mjs +1 -1
- package/dist/utilities/interval.d.mts +1 -1
- package/dist/utilities/interval.mjs +1 -1
- package/dist/utilities/location.d.mts +1 -1
- package/dist/utilities/location.mjs +1 -1
- package/dist/utilities/media-devices.d.mts +1 -1
- package/dist/utilities/media-devices.mjs +1 -1
- package/dist/utilities/media-player.d.mts +1 -1
- package/dist/utilities/media-query.d.mts +1 -1
- package/dist/utilities/media-query.mjs +1 -1
- package/dist/utilities/network.d.mts +1 -1
- package/dist/utilities/network.mjs +1 -1
- package/dist/utilities/orientation.d.mts +1 -1
- package/dist/utilities/orientation.mjs +1 -1
- package/dist/utilities/previous.d.mts +1 -1
- package/dist/utilities/previous.mjs +1 -1
- package/dist/utilities/promise.d.mts +19 -2
- package/dist/utilities/promise.mjs +33 -3
- package/dist/utilities/retry.mjs +1 -1
- package/dist/utilities/routing.d.mts +1 -1
- package/dist/utilities/routing.mjs +1 -1
- package/dist/utilities/search-params.d.mts +1 -1
- package/dist/utilities/storage.d.mts +1 -1
- package/dist/utilities/throttled.d.mts +1 -1
- package/dist/utilities/throttled.mjs +1 -1
- package/dist/utilities/timeout.d.mts +1 -1
- package/dist/utilities/timeout.mjs +1 -1
- package/dist/utilities/window-focus.d.mts +1 -1
- package/dist/utilities/window-focus.mjs +1 -1
- package/dist/utilities/window-size.d.mts +1 -1
- package/dist/utilities/window-size.mjs +1 -1
- package/package.json +20 -5
- package/dist/benchmark.CX_oY03V-CSLAXL5f.mjs +0 -5145
- package/dist/magic-string.es-CXefOmkB.mjs +0 -1011
- package/dist/test.BmQO5GaM-Ddz9cDxc.mjs +0 -8266
- package/dist/utilities/active-element.test.d.mts +0 -1
- package/dist/utilities/active-element.test.mjs +0 -25
- package/dist/utilities/async.test.d.mts +0 -1
- package/dist/utilities/async.test.mjs +0 -275
- package/dist/utilities/context.test.d.mts +0 -1
- package/dist/utilities/context.test.mjs +0 -171
- package/dist/utilities/debounced.test.d.mts +0 -1
- package/dist/utilities/debounced.test.mjs +0 -68
- package/dist/utilities/dom-lifecycle.test.d.mts +0 -1
- package/dist/utilities/dom-lifecycle.test.mjs +0 -228
- package/dist/utilities/element-rect.test.d.mts +0 -1
- package/dist/utilities/element-rect.test.mjs +0 -101
- package/dist/utilities/element-scroll.test.d.mts +0 -1
- package/dist/utilities/element-scroll.test.mjs +0 -27
- package/dist/utilities/event-listener.test.d.mts +0 -1
- package/dist/utilities/event-listener.test.mjs +0 -60
- package/dist/utilities/focus-within.test.d.mts +0 -1
- package/dist/utilities/focus-within.test.mjs +0 -51
- package/dist/utilities/hover.test.d.mts +0 -1
- package/dist/utilities/hover.test.mjs +0 -54
- package/dist/utilities/intersection-observer.test.d.mts +0 -1
- package/dist/utilities/intersection-observer.test.mjs +0 -46
- package/dist/utilities/interval.test.d.mts +0 -1
- package/dist/utilities/interval.test.mjs +0 -115
- package/dist/utilities/location.test.d.mts +0 -1
- package/dist/utilities/location.test.mjs +0 -61
- package/dist/utilities/long-press.test.d.mts +0 -1
- package/dist/utilities/long-press.test.mjs +0 -54
- package/dist/utilities/media-devices.test.d.mts +0 -1
- package/dist/utilities/media-devices.test.mjs +0 -44
- package/dist/utilities/media-player.test.d.mts +0 -1
- package/dist/utilities/media-player.test.mjs +0 -102
- package/dist/utilities/mutation-observer.test.d.mts +0 -1
- package/dist/utilities/mutation-observer.test.mjs +0 -48
- package/dist/utilities/network.test.d.mts +0 -1
- package/dist/utilities/network.test.mjs +0 -30
- package/dist/utilities/on-click-outside.test.d.mts +0 -1
- package/dist/utilities/on-click-outside.test.mjs +0 -45
- package/dist/utilities/previous.test.d.mts +0 -1
- package/dist/utilities/previous.test.mjs +0 -90
- package/dist/utilities/promise.test.d.mts +0 -1
- package/dist/utilities/promise.test.mjs +0 -158
- package/dist/utilities/retry.test.d.mts +0 -1
- package/dist/utilities/retry.test.mjs +0 -85
- package/dist/utilities/routing.test.d.mts +0 -1
- package/dist/utilities/routing.test.mjs +0 -129
- package/dist/utilities/search-params.test.d.mts +0 -1
- package/dist/utilities/search-params.test.mjs +0 -37
- package/dist/utilities/ssr.test.d.mts +0 -1
- package/dist/utilities/ssr.test.mjs +0 -65
- package/dist/utilities/storage.test.d.mts +0 -1
- package/dist/utilities/storage.test.mjs +0 -139
- package/dist/utilities/throttled.test.d.mts +0 -1
- package/dist/utilities/throttled.test.mjs +0 -58
- package/dist/utilities/timeout.test.d.mts +0 -1
- package/dist/utilities/timeout.test.mjs +0 -121
- package/dist/utilities/window-size.test.d.mts +0 -1
- package/dist/utilities/window-size.test.mjs +0 -43
- /package/dist/{custom-elements-D5CgfNKc.d.mts → custom-elements-DK5VUcWA.d.mts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { c as effectScope } from "../lib-Dkc7cV5F.mjs";
|
|
2
|
-
import "../signals/index.mjs";
|
|
3
|
-
import { f as it, l as describe, o as afterEach } from "../benchmark.CX_oY03V-CSLAXL5f.mjs";
|
|
4
|
-
import { n as vi, t as globalExpect } from "../test.BmQO5GaM-Ddz9cDxc.mjs";
|
|
5
|
-
import { createTimeout } from "./timeout.mjs";
|
|
6
|
-
//#region src/utilities/timeout.test.ts
|
|
7
|
-
afterEach(() => {
|
|
8
|
-
document.body.innerHTML = "";
|
|
9
|
-
vi.useRealTimers();
|
|
10
|
-
});
|
|
11
|
-
describe("createTimeout", () => {
|
|
12
|
-
it("starts as running", () => {
|
|
13
|
-
vi.useFakeTimers();
|
|
14
|
-
let t;
|
|
15
|
-
const cb = vi.fn();
|
|
16
|
-
effectScope(() => {
|
|
17
|
-
t = createTimeout(cb, 500);
|
|
18
|
-
});
|
|
19
|
-
globalExpect(t.pending()).toBe(true);
|
|
20
|
-
});
|
|
21
|
-
it("fires callback after delay", () => {
|
|
22
|
-
vi.useFakeTimers();
|
|
23
|
-
const cb = vi.fn();
|
|
24
|
-
effectScope(() => {
|
|
25
|
-
createTimeout(cb, 500);
|
|
26
|
-
});
|
|
27
|
-
vi.advanceTimersByTime(600);
|
|
28
|
-
globalExpect(cb).toHaveBeenCalledOnce();
|
|
29
|
-
});
|
|
30
|
-
it("pending becomes false after firing", () => {
|
|
31
|
-
vi.useFakeTimers();
|
|
32
|
-
let t;
|
|
33
|
-
effectScope(() => {
|
|
34
|
-
t = createTimeout(vi.fn(), 200);
|
|
35
|
-
});
|
|
36
|
-
vi.advanceTimersByTime(300);
|
|
37
|
-
globalExpect(t.pending()).toBe(false);
|
|
38
|
-
});
|
|
39
|
-
it("stop() cancels the timeout", () => {
|
|
40
|
-
vi.useFakeTimers();
|
|
41
|
-
const cb = vi.fn();
|
|
42
|
-
let t;
|
|
43
|
-
effectScope(() => {
|
|
44
|
-
t = createTimeout(cb, 500);
|
|
45
|
-
});
|
|
46
|
-
t.stop();
|
|
47
|
-
vi.advanceTimersByTime(1e3);
|
|
48
|
-
globalExpect(cb).not.toHaveBeenCalled();
|
|
49
|
-
});
|
|
50
|
-
it("reset() restarts the timer", () => {
|
|
51
|
-
vi.useFakeTimers();
|
|
52
|
-
const cb = vi.fn();
|
|
53
|
-
let t;
|
|
54
|
-
effectScope(() => {
|
|
55
|
-
t = createTimeout(cb, 500);
|
|
56
|
-
});
|
|
57
|
-
vi.advanceTimersByTime(300);
|
|
58
|
-
t.reset();
|
|
59
|
-
vi.advanceTimersByTime(300);
|
|
60
|
-
globalExpect(cb).not.toHaveBeenCalled();
|
|
61
|
-
vi.advanceTimersByTime(300);
|
|
62
|
-
globalExpect(cb).toHaveBeenCalledOnce();
|
|
63
|
-
});
|
|
64
|
-
it("immediate=false does not start automatically", () => {
|
|
65
|
-
vi.useFakeTimers();
|
|
66
|
-
const cb = vi.fn();
|
|
67
|
-
let t;
|
|
68
|
-
effectScope(() => {
|
|
69
|
-
t = createTimeout(cb, 200, false);
|
|
70
|
-
});
|
|
71
|
-
globalExpect(t.pending()).toBe(false);
|
|
72
|
-
vi.advanceTimersByTime(300);
|
|
73
|
-
globalExpect(cb).not.toHaveBeenCalled();
|
|
74
|
-
});
|
|
75
|
-
it("start() fires after delay when called manually", () => {
|
|
76
|
-
vi.useFakeTimers();
|
|
77
|
-
const cb = vi.fn();
|
|
78
|
-
let t;
|
|
79
|
-
effectScope(() => {
|
|
80
|
-
t = createTimeout(cb, 200, false);
|
|
81
|
-
});
|
|
82
|
-
t.start();
|
|
83
|
-
globalExpect(t.pending()).toBe(true);
|
|
84
|
-
vi.advanceTimersByTime(200);
|
|
85
|
-
globalExpect(cb).toHaveBeenCalledOnce();
|
|
86
|
-
globalExpect(t.pending()).toBe(false);
|
|
87
|
-
});
|
|
88
|
-
it("Symbol.dispose cancels the timeout", () => {
|
|
89
|
-
vi.useFakeTimers();
|
|
90
|
-
const cb = vi.fn();
|
|
91
|
-
let t;
|
|
92
|
-
effectScope(() => {
|
|
93
|
-
t = createTimeout(cb, 500);
|
|
94
|
-
});
|
|
95
|
-
t[Symbol.dispose]();
|
|
96
|
-
vi.advanceTimersByTime(1e3);
|
|
97
|
-
globalExpect(cb).not.toHaveBeenCalled();
|
|
98
|
-
});
|
|
99
|
-
it("stops when scope is disposed", () => {
|
|
100
|
-
vi.useFakeTimers();
|
|
101
|
-
const cb = vi.fn();
|
|
102
|
-
effectScope(() => {
|
|
103
|
-
createTimeout(cb, 200);
|
|
104
|
-
})();
|
|
105
|
-
vi.advanceTimersByTime(500);
|
|
106
|
-
globalExpect(cb).not.toHaveBeenCalled();
|
|
107
|
-
});
|
|
108
|
-
it("dynamic delay function is called at start", () => {
|
|
109
|
-
vi.useFakeTimers();
|
|
110
|
-
const cb = vi.fn();
|
|
111
|
-
const getDelay = vi.fn().mockReturnValue(300);
|
|
112
|
-
effectScope(() => {
|
|
113
|
-
createTimeout(cb, getDelay);
|
|
114
|
-
});
|
|
115
|
-
vi.advanceTimersByTime(300);
|
|
116
|
-
globalExpect(cb).toHaveBeenCalledOnce();
|
|
117
|
-
globalExpect(getDelay).toHaveBeenCalledOnce();
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
//#endregion
|
|
121
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { f as it, l as describe } from "../benchmark.CX_oY03V-CSLAXL5f.mjs";
|
|
2
|
-
import { t as globalExpect } from "../test.BmQO5GaM-Ddz9cDxc.mjs";
|
|
3
|
-
import { windowSize } from "./window-size.mjs";
|
|
4
|
-
//#region src/utilities/window-size.test.ts
|
|
5
|
-
describe("windowSize (singleton)", () => {
|
|
6
|
-
it("starts with current window dimensions", () => {
|
|
7
|
-
globalExpect(windowSize.width()).toBe(window.innerWidth);
|
|
8
|
-
globalExpect(windowSize.height()).toBe(window.innerHeight);
|
|
9
|
-
});
|
|
10
|
-
it("updates on resize event", () => {
|
|
11
|
-
const origWidth = window.innerWidth;
|
|
12
|
-
const origHeight = window.innerHeight;
|
|
13
|
-
Object.defineProperty(window, "innerWidth", {
|
|
14
|
-
value: 1234,
|
|
15
|
-
configurable: true
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(window, "innerHeight", {
|
|
18
|
-
value: 5678,
|
|
19
|
-
configurable: true
|
|
20
|
-
});
|
|
21
|
-
window.dispatchEvent(new Event("resize"));
|
|
22
|
-
globalExpect(windowSize.width()).toBe(1234);
|
|
23
|
-
globalExpect(windowSize.height()).toBe(5678);
|
|
24
|
-
Object.defineProperty(window, "innerWidth", {
|
|
25
|
-
value: origWidth,
|
|
26
|
-
configurable: true
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(window, "innerHeight", {
|
|
29
|
-
value: origHeight,
|
|
30
|
-
configurable: true
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
it("remains reactive after Symbol.dispose", () => {
|
|
34
|
-
Object.defineProperty(window, "innerWidth", {
|
|
35
|
-
value: 42,
|
|
36
|
-
configurable: true
|
|
37
|
-
});
|
|
38
|
-
window.dispatchEvent(new Event("resize"));
|
|
39
|
-
globalExpect(windowSize.width()).toBe(42);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
//#endregion
|
|
43
|
-
export {};
|
|
File without changes
|