elements-kit 0.27.3 → 0.27.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/dist/await.d.mts +1 -1
- package/dist/{children-CB8W0ANY.d.mts → children-_cMdyX7Q.d.mts} +1 -1
- package/dist/for.d.mts +1 -1
- package/dist/{index-B1FHAd5T.d.mts → index-BrVMftR8.d.mts} +4 -0
- package/dist/integrations/astro-client.mjs +1 -1
- package/dist/integrations/astro-server.mjs +1 -1
- package/dist/integrations/hmr-runtime.mjs +1 -1
- package/dist/integrations/react.d.mts +1 -1
- package/dist/jsx-runtime/dev.d.mts +2 -2
- package/dist/jsx-runtime/dev.mjs +1 -1
- package/dist/jsx-runtime/index.d.mts +2 -2
- package/dist/server/index.mjs +1 -1
- package/dist/signals/index.d.mts +1 -1
- package/dist/signals/index.mjs +4 -0
- package/dist/ui/overlay/index.d.mts +3 -3
- package/dist/ui/overlay/index.mjs +6 -1
- package/dist/utilities/active-element.d.mts +1 -1
- package/dist/utilities/async.d.mts +1 -1
- package/dist/utilities/debounced.d.mts +1 -1
- package/dist/utilities/element-rect.d.mts +15 -15
- package/dist/utilities/element-rect.mjs +39 -36
- package/dist/utilities/element-scroll.d.mts +1 -1
- package/dist/utilities/event-driven.d.mts +1 -1
- package/dist/utilities/event-listener.d.mts +1 -1
- package/dist/utilities/focus-within.d.mts +1 -1
- package/dist/utilities/hover.d.mts +1 -1
- package/dist/utilities/interval.d.mts +1 -1
- package/dist/utilities/location.d.mts +1 -1
- package/dist/utilities/media-devices.d.mts +1 -1
- package/dist/utilities/media-player.d.mts +1 -1
- package/dist/utilities/media-query.d.mts +1 -1
- package/dist/utilities/network.d.mts +1 -1
- package/dist/utilities/orientation.d.mts +1 -1
- package/dist/utilities/previous.d.mts +1 -1
- package/dist/utilities/promise.d.mts +1 -1
- package/dist/utilities/routing.d.mts +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/timeout.d.mts +1 -1
- package/dist/utilities/window-focus.d.mts +1 -1
- package/dist/utilities/window-size.d.mts +1 -1
- package/package.json +1 -1
- /package/dist/{hot-eP6QROpU.mjs → hot-Zl0s17uq.mjs} +0 -0
- /package/dist/{server-CoEm-C0I.mjs → server-Qm9JTZ-J.mjs} +0 -0
package/dist/await.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as AttrChangeHandler, t as ATTRIBUTES } from "./attributes-3r7Diua4.mjs";
|
|
2
2
|
import { i as PropertiesOf, n as CustomElementRegistry, r as EventsOf } from "./custom-elements-C7oiqw-y.mjs";
|
|
3
|
-
import { r as MaybeReactive } from "./index-
|
|
3
|
+
import { r as MaybeReactive } from "./index-BrVMftR8.mjs";
|
|
4
4
|
import * as CSS from "csstype";
|
|
5
5
|
import { JSX } from "dom-expressions/src/jsx";
|
|
6
6
|
|
package/dist/for.d.mts
CHANGED
|
@@ -333,6 +333,10 @@ type MaybeReactive<T> = T | Computed<T>;
|
|
|
333
333
|
* the runtime hands props over exactly as the caller wrote them, so the value
|
|
334
334
|
* may be either form. Reading inside an effect or a JSX getter subscribes.
|
|
335
335
|
*
|
|
336
|
+
* Only branded handles created by `signal`/`computed` are called — a
|
|
337
|
+
* plain function is treated as a static VALUE and returned as-is (so
|
|
338
|
+
* `T` itself may be a function type).
|
|
339
|
+
*
|
|
336
340
|
* @example
|
|
337
341
|
* ```ts
|
|
338
342
|
* resolve(5); // 5
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as createElement } from "../element-DgQvp-49.mjs";
|
|
2
2
|
import { render } from "../render.mjs";
|
|
3
3
|
import { t as hydrate } from "../hydrate-ICXw1FIY.mjs";
|
|
4
|
-
import { HMR_SLOT } from "./hmr-slot.mjs";
|
|
5
4
|
import { withSlotProps } from "./astro-slots.mjs";
|
|
5
|
+
import { HMR_SLOT } from "./hmr-slot.mjs";
|
|
6
6
|
//#region src/integrations/astro-client.ts
|
|
7
7
|
/**
|
|
8
8
|
* Astro client entrypoint: hydrate an elements-kit island.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { y as setInertEffects } from "../lib-DYypKhxk.mjs";
|
|
2
2
|
import { i as setRenderer, t as createElement } from "../element-DgQvp-49.mjs";
|
|
3
|
-
import { i as serverJsx, n as renderToString, r as SNode } from "../server-CoEm-C0I.mjs";
|
|
4
3
|
import { withSlotProps } from "./astro-slots.mjs";
|
|
4
|
+
import { i as serverJsx, n as renderToString, r as SNode } from "../server-Qm9JTZ-J.mjs";
|
|
5
5
|
//#region src/integrations/astro-server.ts
|
|
6
6
|
/**
|
|
7
7
|
* Decide whether `Component` is an elements-kit component. Invoked by Astro
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as createElement } from "../element-DgQvp-49.mjs";
|
|
2
2
|
import { render } from "../render.mjs";
|
|
3
3
|
import { HMR_SLOT } from "./hmr-slot.mjs";
|
|
4
|
-
import { n as updateCells } from "../hot-
|
|
4
|
+
import { n as updateCells } from "../hot-Zl0s17uq.mjs";
|
|
5
5
|
//#region src/integrations/hmr-runtime.ts
|
|
6
6
|
const slot = globalThis;
|
|
7
7
|
const records = /* @__PURE__ */ new Set();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Fragment, c as PropsOf, i as JSX, l as Require, n as ComponentClass, o as MaybeReactiveProps, r as ComponentFn, s as Props, t as Children } from "../children-
|
|
2
|
-
import { n as ComputedProps, r as MaybeReactive } from "../index-
|
|
1
|
+
import { a as Fragment, c as PropsOf, i as JSX, l as Require, n as ComponentClass, o as MaybeReactiveProps, r as ComponentFn, s as Props, t as Children } from "../children-_cMdyX7Q.mjs";
|
|
2
|
+
import { n as ComputedProps, r as MaybeReactive } from "../index-BrVMftR8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/jsx-runtime/hot.d.ts
|
|
5
5
|
/**
|
package/dist/jsx-runtime/dev.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { t as Fragment } from "../fragment-BJfcQdsL.mjs";
|
|
2
|
+
import { t as createHotElement } from "../hot-Zl0s17uq.mjs";
|
|
2
3
|
import "./index.mjs";
|
|
3
|
-
import { t as createHotElement } from "../hot-eP6QROpU.mjs";
|
|
4
4
|
export { Fragment, createHotElement as h, createHotElement as jsx, createHotElement as jsxDEV, createHotElement as jsxs };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as Fragment, c as PropsOf, i as JSX, l as Require, n as ComponentClass, o as MaybeReactiveProps, r as ComponentFn, s as Props, t as Children, u as createElement } from "../children-
|
|
2
|
-
import { n as ComputedProps, r as MaybeReactive } from "../index-
|
|
1
|
+
import { a as Fragment, c as PropsOf, i as JSX, l as Require, n as ComponentClass, o as MaybeReactiveProps, r as ComponentFn, s as Props, t as Children, u as createElement } from "../children-_cMdyX7Q.mjs";
|
|
2
|
+
import { n as ComputedProps, r as MaybeReactive } from "../index-BrVMftR8.mjs";
|
|
3
3
|
export { type Children, ComponentClass, ComponentFn, type ComputedProps, Fragment, JSX, type MaybeReactive, type MaybeReactiveProps, type Props, type PropsOf, type Require, createElement as h, createElement as jsx, createElement as jsxDEV, createElement as jsxs };
|
package/dist/server/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as renderToString, t as renderToStream } from "../server-
|
|
1
|
+
import { n as renderToString, t as renderToStream } from "../server-Qm9JTZ-J.mjs";
|
|
2
2
|
export { renderToStream, renderToString };
|
package/dist/signals/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as isSignal, D as untracked, E as trigger, S as isEffectScope, T as signal, _ as computed, a as Updater, b as isComputed, c as reactive, d as COMPUTED, f as EFFECT, g as batch, h as SIGNAL, i as Signal, l as resolve, m as SEED, n as ComputedProps, o as computedProps, p as EFFECT_SCOPE, r as MaybeReactive, s as isReactive, t as Computed, u as CLAIM, v as effect, w as onCleanup, x as isEffect, y as effectScope } from "../index-
|
|
1
|
+
import { C as isSignal, D as untracked, E as trigger, S as isEffectScope, T as signal, _ as computed, a as Updater, b as isComputed, c as reactive, d as COMPUTED, f as EFFECT, g as batch, h as SIGNAL, i as Signal, l as resolve, m as SEED, n as ComputedProps, o as computedProps, p as EFFECT_SCOPE, r as MaybeReactive, s as isReactive, t as Computed, u as CLAIM, v as effect, w as onCleanup, x as isEffect, y as effectScope } from "../index-BrVMftR8.mjs";
|
|
2
2
|
export { CLAIM, COMPUTED, Computed, ComputedProps, EFFECT, EFFECT_SCOPE, MaybeReactive, SEED, SIGNAL, Signal, Updater, batch, computed, computedProps, effect, effectScope, isComputed, isEffect, isEffectScope, isReactive, isSignal, onCleanup, reactive, resolve, signal, trigger, untracked };
|
package/dist/signals/index.mjs
CHANGED
|
@@ -83,6 +83,10 @@ function reactive(source) {
|
|
|
83
83
|
* the runtime hands props over exactly as the caller wrote them, so the value
|
|
84
84
|
* may be either form. Reading inside an effect or a JSX getter subscribes.
|
|
85
85
|
*
|
|
86
|
+
* Only branded handles created by `signal`/`computed` are called — a
|
|
87
|
+
* plain function is treated as a static VALUE and returned as-is (so
|
|
88
|
+
* `T` itself may be a function type).
|
|
89
|
+
*
|
|
86
90
|
* @example
|
|
87
91
|
* ```ts
|
|
88
92
|
* resolve(5); // 5
|
|
@@ -11,9 +11,9 @@ import { Placement } from "@floating-ui/dom";
|
|
|
11
11
|
* viewport defaults). Derived values build on regions — `detents()`
|
|
12
12
|
* quantizes one, `rubber()` resists at its edges.
|
|
13
13
|
*/
|
|
14
|
-
/** A reactive rect
|
|
15
|
-
*
|
|
16
|
-
* area) can be supplied too. */
|
|
14
|
+
/** A reactive rect. `createElementRect` returns one reactive `DOMRect`,
|
|
15
|
+
* so the element branch projects its fields onto this shape; custom
|
|
16
|
+
* rects (a static region, a virtual area) can be supplied too. */
|
|
17
17
|
interface Region {
|
|
18
18
|
top(): number;
|
|
19
19
|
left(): number;
|
|
@@ -19,7 +19,12 @@ function constraint(source) {
|
|
|
19
19
|
if (source instanceof Element) {
|
|
20
20
|
const rect = createElementRect(source);
|
|
21
21
|
onCleanup(() => rect[Symbol.dispose]());
|
|
22
|
-
return
|
|
22
|
+
return {
|
|
23
|
+
top: () => rect().top,
|
|
24
|
+
left: () => rect().left,
|
|
25
|
+
width: () => rect().width,
|
|
26
|
+
height: () => rect().height
|
|
27
|
+
};
|
|
23
28
|
}
|
|
24
29
|
return {
|
|
25
30
|
top: () => source.top,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { t as Computed } from "../index-
|
|
1
|
+
import { r as MaybeReactive, t as Computed } from "../index-BrVMftR8.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/utilities/element-rect.d.ts
|
|
4
|
-
type RectResult = {
|
|
5
|
-
x: Computed<number>;
|
|
6
|
-
y: Computed<number>;
|
|
7
|
-
width: Computed<number>;
|
|
8
|
-
height: Computed<number>;
|
|
9
|
-
top: Computed<number>;
|
|
10
|
-
right: Computed<number>;
|
|
11
|
-
bottom: Computed<number>;
|
|
12
|
-
left: Computed<number>;
|
|
13
|
-
} & Disposable;
|
|
14
4
|
/**
|
|
15
|
-
* Observes the full bounding rect of `target`
|
|
16
|
-
*
|
|
17
|
-
*
|
|
5
|
+
* Observes the full bounding rect of `target` and returns it as ONE reactive
|
|
6
|
+
* `DOMRect`, so every field a reader sees was measured at the same instant.
|
|
7
|
+
* Change sources: a `ResizeObserver` for size, plus capture-phase `scroll` and
|
|
8
|
+
* window `resize` for position — a `ResizeObserver` stays silent when an
|
|
9
|
+
* element merely moves.
|
|
10
|
+
*
|
|
11
|
+
* `target` may be a getter, in which case the observer follows it: the previous
|
|
12
|
+
* element is unobserved before the new one is observed. The returned computed
|
|
13
|
+
* keeps its identity across a swap, so consumers never rebind.
|
|
14
|
+
*
|
|
15
|
+
* The value is CACHED, not measured per read: it refreshes when one of the
|
|
16
|
+
* sources above fires, not at the moment you read it. Dispose explicitly, or
|
|
17
|
+
* let the enclosing scope do it.
|
|
18
18
|
*/
|
|
19
|
-
declare function createElementRect(target: Element):
|
|
19
|
+
declare function createElementRect(target: MaybeReactive<Element>): Computed<DOMRect> & Disposable;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { createElementRect };
|
|
@@ -1,47 +1,50 @@
|
|
|
1
|
-
import { x as signal } from "../lib-DYypKhxk.mjs";
|
|
2
|
-
import "../signals/index.mjs";
|
|
1
|
+
import { _ as onCleanup, d as effectScope, l as computed, u as effect, x as signal } from "../lib-DYypKhxk.mjs";
|
|
2
|
+
import { resolve } from "../signals/index.mjs";
|
|
3
3
|
import { createResizeObserver } from "./resize-observer.mjs";
|
|
4
4
|
//#region src/utilities/element-rect.ts
|
|
5
5
|
/**
|
|
6
|
-
* Observes the full bounding rect of `target`
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Observes the full bounding rect of `target` and returns it as ONE reactive
|
|
7
|
+
* `DOMRect`, so every field a reader sees was measured at the same instant.
|
|
8
|
+
* Change sources: a `ResizeObserver` for size, plus capture-phase `scroll` and
|
|
9
|
+
* window `resize` for position — a `ResizeObserver` stays silent when an
|
|
10
|
+
* element merely moves.
|
|
11
|
+
*
|
|
12
|
+
* `target` may be a getter, in which case the observer follows it: the previous
|
|
13
|
+
* element is unobserved before the new one is observed. The returned computed
|
|
14
|
+
* keeps its identity across a swap, so consumers never rebind.
|
|
15
|
+
*
|
|
16
|
+
* The value is CACHED, not measured per read: it refreshes when one of the
|
|
17
|
+
* sources above fires, not at the moment you read it. Dispose explicitly, or
|
|
18
|
+
* let the enclosing scope do it.
|
|
9
19
|
*/
|
|
10
20
|
function createElementRect(target) {
|
|
11
|
-
const
|
|
12
|
-
const y = signal(0);
|
|
13
|
-
const width = signal(0);
|
|
14
|
-
const height = signal(0);
|
|
15
|
-
const top = signal(0);
|
|
16
|
-
const right = signal(0);
|
|
17
|
-
const bottom = signal(0);
|
|
18
|
-
const left = signal(0);
|
|
21
|
+
const cache = signal(resolve(target).getBoundingClientRect());
|
|
19
22
|
const updateRect = (el) => {
|
|
20
|
-
|
|
21
|
-
x(rect.x);
|
|
22
|
-
y(rect.y);
|
|
23
|
-
width(rect.width);
|
|
24
|
-
height(rect.height);
|
|
25
|
-
top(rect.top);
|
|
26
|
-
right(rect.right);
|
|
27
|
-
bottom(rect.bottom);
|
|
28
|
-
left(rect.left);
|
|
23
|
+
cache(el.getBoundingClientRect());
|
|
29
24
|
};
|
|
30
|
-
const
|
|
31
|
-
|
|
25
|
+
const stop = effectScope(() => {
|
|
26
|
+
effect(() => {
|
|
27
|
+
const el = resolve(target);
|
|
28
|
+
createResizeObserver(el, (entries) => {
|
|
29
|
+
for (const entry of entries) updateRect(entry.target);
|
|
30
|
+
});
|
|
31
|
+
const remeasure = () => updateRect(el);
|
|
32
|
+
window.addEventListener("scroll", remeasure, {
|
|
33
|
+
capture: true,
|
|
34
|
+
passive: true
|
|
35
|
+
});
|
|
36
|
+
window.addEventListener("resize", remeasure, { passive: true });
|
|
37
|
+
onCleanup(() => {
|
|
38
|
+
window.removeEventListener("scroll", remeasure, { capture: true });
|
|
39
|
+
window.removeEventListener("resize", remeasure);
|
|
40
|
+
});
|
|
41
|
+
updateRect(el);
|
|
42
|
+
});
|
|
32
43
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
width,
|
|
38
|
-
height,
|
|
39
|
-
top,
|
|
40
|
-
right,
|
|
41
|
-
bottom,
|
|
42
|
-
left,
|
|
43
|
-
[Symbol.dispose]: observer[Symbol.dispose]
|
|
44
|
-
};
|
|
44
|
+
onCleanup(stop);
|
|
45
|
+
const rect = computed(() => cache());
|
|
46
|
+
rect[Symbol.dispose] = stop;
|
|
47
|
+
return rect;
|
|
45
48
|
}
|
|
46
49
|
//#endregion
|
|
47
50
|
export { createElementRect };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elements-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.27.
|
|
4
|
+
"version": "0.27.4",
|
|
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",
|
|
File without changes
|
|
File without changes
|