elements-kit 0.0.15 → 0.0.17
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 +138 -31
- package/dist/attributes-Dtn68R1u.d.mts +94 -0
- package/dist/attributes.d.mts +1 -93
- package/dist/custom-elements.d.mts +74 -0
- package/dist/custom-elements.mjs +100 -0
- package/dist/define-CjbTZ3VG.d.mts +23 -0
- package/dist/{element-ChF24-2z.mjs → element-CGVy_8TW.mjs} +11 -12
- package/dist/for.d.mts +45 -0
- package/dist/for.mjs +136 -0
- package/dist/{index-DUshSQ_6.d.mts → index-DydGTqZU.d.mts} +60 -10
- package/dist/index.d.mts +1 -36
- package/dist/index.mjs +1 -144
- package/dist/infer-BfzRJoCn.d.mts +203 -0
- package/dist/integrations/react.d.mts +1 -1
- package/dist/integrations/react.mjs +1 -1
- package/dist/jsx-runtime/index.d.mts +11 -20
- package/dist/jsx-runtime/index.mjs +2 -2
- package/dist/signals/index.d.mts +2 -2
- package/dist/signals/index.mjs +2 -2
- package/dist/{signals-BHmWX6ox.mjs → signals-J8dK_rA4.mjs} +57 -17
- package/dist/slot-C7GQZe-r.d.mts +104 -0
- package/dist/{slot-Cydy7-0L.mjs → slot-Kb61AcgW.mjs} +21 -2
- package/dist/slot.d.mts +2 -84
- package/dist/slot.mjs +2 -2
- package/dist/{test.BmQO5GaM-ANkhHvbr.mjs → test.BmQO5GaM-DfGStnii.mjs} +1 -1
- package/dist/utilities/_observe.d.mts +11 -0
- package/dist/utilities/_observe.mjs +15 -0
- package/dist/utilities/active-element.d.mts +1 -1
- package/dist/utilities/active-element.mjs +6 -2
- package/dist/utilities/active-element.test.mjs +1 -1
- package/dist/utilities/async.d.mts +1 -1
- package/dist/utilities/async.mjs +1 -1
- package/dist/utilities/async.test.mjs +2 -2
- package/dist/utilities/debounced.d.mts +1 -1
- package/dist/utilities/debounced.mjs +1 -1
- package/dist/utilities/debounced.test.mjs +2 -2
- package/dist/utilities/element-rect.d.mts +1 -1
- package/dist/utilities/element-rect.mjs +1 -1
- package/dist/utilities/element-rect.test.mjs +2 -2
- package/dist/utilities/element-scroll.d.mts +1 -1
- package/dist/utilities/element-scroll.mjs +7 -34
- package/dist/utilities/element-scroll.test.mjs +2 -2
- package/dist/utilities/environment.d.mts +5 -0
- package/dist/utilities/environment.mjs +5 -0
- package/dist/utilities/event-driven.d.mts +1 -1
- package/dist/utilities/event-driven.mjs +2 -2
- package/dist/utilities/event-listener.d.mts +1 -1
- package/dist/utilities/event-listener.mjs +1 -1
- package/dist/utilities/event-listener.test.mjs +2 -2
- package/dist/utilities/focus-within.d.mts +1 -1
- package/dist/utilities/focus-within.mjs +1 -1
- package/dist/utilities/focus-within.test.mjs +2 -2
- package/dist/utilities/hover.d.mts +1 -1
- package/dist/utilities/hover.mjs +1 -1
- package/dist/utilities/hover.test.mjs +2 -2
- package/dist/utilities/intersection-observer.mjs +4 -6
- package/dist/utilities/intersection-observer.test.mjs +2 -2
- package/dist/utilities/interval.d.mts +1 -1
- package/dist/utilities/interval.mjs +1 -1
- package/dist/utilities/interval.test.mjs +2 -2
- package/dist/utilities/location.d.mts +2 -14
- package/dist/utilities/location.mjs +12 -3
- package/dist/utilities/location.test.mjs +5 -5
- package/dist/utilities/long-press.mjs +1 -1
- package/dist/utilities/long-press.test.mjs +2 -2
- package/dist/utilities/media-devices.d.mts +1 -1
- package/dist/utilities/media-devices.mjs +1 -1
- package/dist/utilities/media-devices.test.mjs +2 -2
- package/dist/utilities/media-player.d.mts +1 -1
- package/dist/utilities/media-player.test.mjs +2 -2
- package/dist/utilities/media-query.d.mts +2 -3
- package/dist/utilities/media-query.mjs +3 -3
- package/dist/utilities/mutation-observer.mjs +4 -7
- package/dist/utilities/mutation-observer.test.mjs +2 -2
- package/dist/utilities/network.d.mts +2 -2
- package/dist/utilities/network.mjs +5 -3
- package/dist/utilities/network.test.mjs +1 -1
- package/dist/utilities/on-click-outside.test.mjs +2 -2
- package/dist/utilities/orientation.d.mts +1 -1
- package/dist/utilities/orientation.mjs +9 -1
- package/dist/utilities/previous.d.mts +1 -1
- package/dist/utilities/previous.mjs +1 -1
- package/dist/utilities/previous.test.mjs +2 -2
- package/dist/utilities/promise.d.mts +1 -1
- package/dist/utilities/promise.mjs +1 -1
- package/dist/utilities/promise.test.mjs +2 -2
- package/dist/utilities/resize-observer.mjs +4 -6
- package/dist/utilities/retry.mjs +1 -1
- package/dist/utilities/retry.test.mjs +2 -2
- package/dist/utilities/routing.d.mts +1 -1
- package/dist/utilities/routing.mjs +1 -1
- package/dist/utilities/routing.test.mjs +1 -1
- package/dist/utilities/search-params.d.mts +1 -1
- package/dist/utilities/search-params.test.mjs +2 -2
- package/dist/utilities/ssr.test.d.mts +1 -0
- package/dist/utilities/ssr.test.mjs +64 -0
- package/dist/utilities/storage.d.mts +1 -1
- package/dist/utilities/storage.test.mjs +2 -2
- package/dist/utilities/throttled.d.mts +1 -1
- package/dist/utilities/throttled.mjs +1 -1
- package/dist/utilities/throttled.test.mjs +2 -2
- package/dist/utilities/timeout.d.mts +1 -1
- package/dist/utilities/timeout.mjs +1 -1
- package/dist/utilities/timeout.test.mjs +2 -2
- package/dist/utilities/window-focus.d.mts +2 -2
- package/dist/utilities/window-focus.mjs +5 -3
- package/dist/utilities/window-size.d.mts +1 -1
- package/dist/utilities/window-size.mjs +10 -5
- package/dist/utilities/window-size.test.mjs +1 -1
- package/package.json +20 -10
- package/dist/lib-JA05lzCN.d.mts +0 -4
- /package/dist/{polyfill-DR5XVnh_.d.mts → polyfill-BVNd6ogU.d.mts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as beforeAll, n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-
|
|
1
|
+
import { i as beforeAll, n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
|
|
2
2
|
import { isLocalNavigationEvent, match, matches, navigate, patchHistory } from "./routing.mjs";
|
|
3
3
|
//#region src/utilities/routing.test.ts
|
|
4
4
|
beforeAll(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-
|
|
1
|
+
import { f as effectScope } from "../signals-J8dK_rA4.mjs";
|
|
2
|
+
import { o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
|
|
3
3
|
import { createSearchParam } from "./search-params.mjs";
|
|
4
4
|
//#region src/utilities/search-params.test.ts
|
|
5
5
|
afterEach(() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { c as test, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
|
|
2
|
+
//#region src/utilities/ssr.test.ts
|
|
3
|
+
// @vitest-environment node
|
|
4
|
+
test.each([
|
|
5
|
+
"./active-element.ts",
|
|
6
|
+
"./async.ts",
|
|
7
|
+
"./debounced.ts",
|
|
8
|
+
"./element-rect.ts",
|
|
9
|
+
"./element-scroll.ts",
|
|
10
|
+
"./environment.ts",
|
|
11
|
+
"./event-driven.ts",
|
|
12
|
+
"./event-listener.ts",
|
|
13
|
+
"./focus-within.ts",
|
|
14
|
+
"./hover.ts",
|
|
15
|
+
"./intersection-observer.ts",
|
|
16
|
+
"./interval.ts",
|
|
17
|
+
"./location.ts",
|
|
18
|
+
"./long-press.ts",
|
|
19
|
+
"./media-devices.ts",
|
|
20
|
+
"./media-player.ts",
|
|
21
|
+
"./media-query.ts",
|
|
22
|
+
"./mutation-observer.ts",
|
|
23
|
+
"./network.ts",
|
|
24
|
+
"./on-click-outside.ts",
|
|
25
|
+
"./orientation.ts",
|
|
26
|
+
"./previous.ts",
|
|
27
|
+
"./promise.ts",
|
|
28
|
+
"./resize-observer.ts",
|
|
29
|
+
"./retry.ts",
|
|
30
|
+
"./routing.ts",
|
|
31
|
+
"./search-params.ts",
|
|
32
|
+
"./storage.ts",
|
|
33
|
+
"./throttled.ts",
|
|
34
|
+
"./timeout.ts",
|
|
35
|
+
"./window-focus.ts",
|
|
36
|
+
"./window-size.ts"
|
|
37
|
+
])("imports %s in Node without crashing", async (path) => {
|
|
38
|
+
await globalExpect(import(path)).resolves.toBeDefined();
|
|
39
|
+
});
|
|
40
|
+
test("singletons return neutral values in Node", async () => {
|
|
41
|
+
const { windowSize } = await import("./window-size.mjs");
|
|
42
|
+
globalExpect(windowSize.width()).toBe(0);
|
|
43
|
+
globalExpect(windowSize.height()).toBe(0);
|
|
44
|
+
const { online } = await import("./network.mjs");
|
|
45
|
+
globalExpect(online()).toBe(true);
|
|
46
|
+
const { windowFocused } = await import("./window-focus.mjs");
|
|
47
|
+
globalExpect(windowFocused()).toBe(true);
|
|
48
|
+
const { activeElement } = await import("./active-element.mjs");
|
|
49
|
+
globalExpect(activeElement()).toBe(null);
|
|
50
|
+
const { orientation } = await import("./orientation.mjs");
|
|
51
|
+
globalExpect(orientation.angle()).toBe(0);
|
|
52
|
+
globalExpect(orientation.type()).toBe("portrait-primary");
|
|
53
|
+
const { currentLocation } = await import("./location.mjs");
|
|
54
|
+
globalExpect(currentLocation.href()).toBe("");
|
|
55
|
+
globalExpect(currentLocation.pathname()).toBe("");
|
|
56
|
+
globalExpect(currentLocation.search()).toBe("");
|
|
57
|
+
globalExpect(currentLocation.hash()).toBe("");
|
|
58
|
+
});
|
|
59
|
+
test("isBrowser is false in Node", async () => {
|
|
60
|
+
const { isBrowser } = await import("./environment.mjs");
|
|
61
|
+
globalExpect(isBrowser).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
//#endregion
|
|
64
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-
|
|
1
|
+
import { f as effectScope } from "../signals-J8dK_rA4.mjs";
|
|
2
|
+
import { o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
|
|
3
3
|
import { createLocalStorage, createSessionStorage } from "./storage.mjs";
|
|
4
4
|
//#region src/utilities/storage.test.ts
|
|
5
5
|
describe("createLocalStorage", () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as beforeEach, n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-
|
|
1
|
+
import { f as effectScope, v as signal } from "../signals-J8dK_rA4.mjs";
|
|
2
|
+
import { a as beforeEach, n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
|
|
3
3
|
import { createThrottled } from "./throttled.mjs";
|
|
4
4
|
//#region src/utilities/throttled.test.ts
|
|
5
5
|
beforeEach(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-
|
|
1
|
+
import { f as effectScope } from "../signals-J8dK_rA4.mjs";
|
|
2
|
+
import { n as vi, o as describe, r as afterEach, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
|
|
3
3
|
import { createTimeout } from "./timeout.mjs";
|
|
4
4
|
//#region src/utilities/timeout.test.ts
|
|
5
5
|
afterEach(() => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as Computed } from "../index-
|
|
1
|
+
import { t as Computed } from "../index-DydGTqZU.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/utilities/window-focus.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Singleton `Computed<boolean>` — `true` while the browser window has focus.
|
|
6
|
-
* Reacts to `focus` / `blur` window events.
|
|
6
|
+
* Reacts to `focus` / `blur` window events. Outside a browser, always `true`.
|
|
7
7
|
*/
|
|
8
8
|
declare const windowFocused: Computed<boolean>;
|
|
9
9
|
//#endregion
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v as signal } from "../signals-J8dK_rA4.mjs";
|
|
2
2
|
import { on } from "./event-listener.mjs";
|
|
3
|
+
import { isBrowser } from "./environment.mjs";
|
|
3
4
|
//#region src/utilities/window-focus.ts
|
|
4
5
|
function createWindowFocused() {
|
|
5
|
-
|
|
6
|
+
if (!isBrowser) return signal(true);
|
|
7
|
+
const value = signal(document.hasFocus());
|
|
6
8
|
on(window, "focus", () => value(true));
|
|
7
9
|
on(window, "blur", () => value(false));
|
|
8
10
|
return value;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Singleton `Computed<boolean>` — `true` while the browser window has focus.
|
|
12
|
-
* Reacts to `focus` / `blur` window events.
|
|
14
|
+
* Reacts to `focus` / `blur` window events. Outside a browser, always `true`.
|
|
13
15
|
*/
|
|
14
16
|
const windowFocused = createWindowFocused();
|
|
15
17
|
//#endregion
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { u as computed } from "../signals-J8dK_rA4.mjs";
|
|
2
2
|
import { fromEvent, sync } from "./event-driven.mjs";
|
|
3
|
+
import { isBrowser } from "./environment.mjs";
|
|
3
4
|
//#region src/utilities/window-size.ts
|
|
4
5
|
/**
|
|
5
6
|
* Returns reactive `width` and `height` signals tracking the browser window
|
|
6
|
-
* inner dimensions.
|
|
7
|
+
* inner dimensions. Outside a browser, returns zeros and a no-op disposer.
|
|
7
8
|
*/
|
|
8
9
|
function createWindowSize() {
|
|
9
|
-
|
|
10
|
+
if (!isBrowser) return {
|
|
11
|
+
width: computed(() => 0),
|
|
12
|
+
height: computed(() => 0),
|
|
13
|
+
[Symbol.dispose]() {}
|
|
14
|
+
};
|
|
10
15
|
const [size, stop] = sync(fromEvent(window, "resize"), () => ({
|
|
11
|
-
w:
|
|
12
|
-
h:
|
|
16
|
+
w: window.innerWidth,
|
|
17
|
+
h: window.innerHeight
|
|
13
18
|
}));
|
|
14
19
|
return {
|
|
15
20
|
width: computed(() => size().w),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-
|
|
1
|
+
import { o as describe, s as it, t as globalExpect } from "../test.BmQO5GaM-DfGStnii.mjs";
|
|
2
2
|
import { windowSize } from "./window-size.mjs";
|
|
3
3
|
//#region src/utilities/window-size.test.ts
|
|
4
4
|
describe("windowSize (singleton)", () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elements-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.17",
|
|
5
5
|
"description": "A lightweight reactive UI library that transforms native HTMLElements into reactive components with signals. Ideal for framework-agnostic applications and web components.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"webcomponents",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"author": "@waelbettayeb",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"main": "./dist/index.mjs",
|
|
21
|
-
"types": "./dist/index.d.
|
|
21
|
+
"types": "./dist/index.d.mts",
|
|
22
22
|
"files": [
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
@@ -26,42 +26,52 @@
|
|
|
26
26
|
".": {
|
|
27
27
|
"source": "./src/index.ts",
|
|
28
28
|
"import": "./dist/index.mjs",
|
|
29
|
-
"types": "./dist/index.d.
|
|
29
|
+
"types": "./dist/index.d.mts"
|
|
30
30
|
},
|
|
31
31
|
"./signals": {
|
|
32
32
|
"source": "./src/signals/index.ts",
|
|
33
33
|
"import": "./dist/signals/index.mjs",
|
|
34
|
-
"types": "./dist/signals/index.d.
|
|
34
|
+
"types": "./dist/signals/index.d.mts"
|
|
35
35
|
},
|
|
36
36
|
"./slot": {
|
|
37
37
|
"source": "./src/slot.ts",
|
|
38
38
|
"import": "./dist/slot.mjs",
|
|
39
|
-
"types": "./dist/slot.d.
|
|
39
|
+
"types": "./dist/slot.d.mts"
|
|
40
|
+
},
|
|
41
|
+
"./for": {
|
|
42
|
+
"source": "./src/for.ts",
|
|
43
|
+
"import": "./dist/for.mjs",
|
|
44
|
+
"types": "./dist/for.d.mts"
|
|
40
45
|
},
|
|
41
46
|
"./attributes": {
|
|
42
47
|
"source": "./src/attributes.ts",
|
|
43
48
|
"import": "./dist/attributes.mjs",
|
|
44
|
-
"types": "./dist/attributes.d.
|
|
49
|
+
"types": "./dist/attributes.d.mts"
|
|
50
|
+
},
|
|
51
|
+
"./custom-elements": {
|
|
52
|
+
"source": "./src/custom-elements.ts",
|
|
53
|
+
"import": "./dist/custom-elements.mjs",
|
|
54
|
+
"types": "./dist/custom-elements.d.mts"
|
|
45
55
|
},
|
|
46
56
|
"./jsx-runtime": {
|
|
47
57
|
"source": "./src/jsx-runtime/index.ts",
|
|
48
58
|
"import": "./dist/jsx-runtime/index.mjs",
|
|
49
|
-
"types": "./dist/jsx-runtime/index.d.
|
|
59
|
+
"types": "./dist/jsx-runtime/index.d.mts"
|
|
50
60
|
},
|
|
51
61
|
"./jsx-dev-runtime": {
|
|
52
62
|
"source": "./src/jsx-runtime/index.ts",
|
|
53
63
|
"import": "./dist/jsx-runtime/index.mjs",
|
|
54
|
-
"types": "./dist/jsx-runtime/index.d.
|
|
64
|
+
"types": "./dist/jsx-runtime/index.d.mts"
|
|
55
65
|
},
|
|
56
66
|
"./integrations/*": {
|
|
57
67
|
"source": "./src/integrations/*.ts",
|
|
58
68
|
"import": "./dist/integrations/*.mjs",
|
|
59
|
-
"types": "./dist/integrations/*.d.
|
|
69
|
+
"types": "./dist/integrations/*.d.mts"
|
|
60
70
|
},
|
|
61
71
|
"./utilities/*": {
|
|
62
72
|
"source": "./src/utilities/*.ts",
|
|
63
73
|
"import": "./dist/utilities/*.mjs",
|
|
64
|
-
"types": "./dist/utilities/*.d.
|
|
74
|
+
"types": "./dist/utilities/*.d.mts"
|
|
65
75
|
}
|
|
66
76
|
},
|
|
67
77
|
"scripts": {
|
package/dist/lib-JA05lzCN.d.mts
DELETED
|
File without changes
|