elements-kit 0.23.0 → 0.24.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/dist/await.d.mts +1 -1
- package/dist/{children-BbHF-Dew.d.mts → children-CYLVeDZc.d.mts} +1 -1
- package/dist/{element-w3nDE2S5.mjs → element-FFqOLWQu.mjs} +41 -3
- package/dist/for.d.mts +1 -1
- package/dist/for.mjs +1 -1
- package/dist/{fragment-DEhI5x0f.mjs → fragment-i-S0RyT4.mjs} +1 -1
- package/dist/hydrate/index.mjs +1 -1
- package/dist/{hydrate-CrVzu88K.mjs → hydrate-DZ_o7akg.mjs} +2 -2
- package/dist/{index-BR8XVkck.d.mts → index-CzKKJCCK.d.mts} +2 -2
- package/dist/integrations/astro-client.mjs +2 -2
- package/dist/integrations/astro-server.mjs +2 -2
- package/dist/integrations/astro-slots.mjs +2 -2
- package/dist/integrations/react.d.mts +1 -1
- package/dist/jsx-runtime/index.d.mts +2 -2
- package/dist/jsx-runtime/index.mjs +2 -2
- package/dist/server/index.mjs +1 -1
- package/dist/{server-D7ffi7b_.mjs → server-C5Ka5iG2.mjs} +2 -2
- package/dist/signals/index.d.mts +1 -1
- package/dist/signals/index.mjs +3 -3
- package/dist/ui/styles/index.css +1 -1
- package/dist/ui/styles/material.css +1 -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 +1 -1
- 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/await.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as AttrChangeHandler, t as ATTRIBUTES } from "./attributes-DILeh3-s.mjs";
|
|
2
2
|
import { i as PropertiesOf, n as CustomElementRegistry, r as EventsOf } from "./custom-elements-CdpilMDu.mjs";
|
|
3
|
-
import { r as MaybeReactive } from "./index-
|
|
3
|
+
import { r as MaybeReactive } from "./index-CzKKJCCK.mjs";
|
|
4
4
|
import * as CSS from "csstype";
|
|
5
5
|
import { JSX } from "dom-expressions/src/jsx";
|
|
6
6
|
|
|
@@ -396,6 +396,8 @@ function ensureFlatArray(raw) {
|
|
|
396
396
|
function applyProps(node, props) {
|
|
397
397
|
const entries = Object.entries(props);
|
|
398
398
|
if (entries.length === 0) return;
|
|
399
|
+
const base = (k) => k === "class" || k === "style" ? 0 : 1;
|
|
400
|
+
entries.sort((a, b) => base(a[0]) - base(b[0]));
|
|
399
401
|
for (const [key, value] of entries) {
|
|
400
402
|
if (isChildrenProperty(node, key)) {
|
|
401
403
|
applyChildren(node, key, value);
|
|
@@ -432,8 +434,9 @@ function setProp(node, key, value) {
|
|
|
432
434
|
return;
|
|
433
435
|
}
|
|
434
436
|
if (ns === "style") {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
+
const css = value == null || value === false ? null : String(value);
|
|
438
|
+
setStyleProperty(node, name, css);
|
|
439
|
+
nsStyles(node).set(name, css);
|
|
437
440
|
return;
|
|
438
441
|
}
|
|
439
442
|
return;
|
|
@@ -445,7 +448,7 @@ function setProp(node, key, value) {
|
|
|
445
448
|
}
|
|
446
449
|
}
|
|
447
450
|
if (key === "class") {
|
|
448
|
-
node
|
|
451
|
+
applyClass(node, value);
|
|
449
452
|
return;
|
|
450
453
|
}
|
|
451
454
|
if (key === "style") {
|
|
@@ -474,11 +477,46 @@ function setProp(node, key, value) {
|
|
|
474
477
|
}
|
|
475
478
|
setAttribute(node, key, value);
|
|
476
479
|
}
|
|
480
|
+
/** Tokens the bare `class` prop last wrote, per element. */
|
|
481
|
+
const ownedClasses = /* @__PURE__ */ new WeakMap();
|
|
482
|
+
/**
|
|
483
|
+
* Apply the bare `class` prop without clobbering `class:*` toggles. Assigning
|
|
484
|
+
* `className` would drop them — and drop them again on every reactive update —
|
|
485
|
+
* so only the tokens this prop owns are diffed. Matches the server renderer,
|
|
486
|
+
* which merges `class` and `class:*` into one attribute.
|
|
487
|
+
*/
|
|
488
|
+
function applyClass(el, value) {
|
|
489
|
+
const next = String(value ?? "").split(/\s+/).filter(Boolean);
|
|
490
|
+
const prev = ownedClasses.get(el);
|
|
491
|
+
if (prev) {
|
|
492
|
+
for (const c of prev) if (!next.includes(c)) el.classList.remove(c);
|
|
493
|
+
}
|
|
494
|
+
for (const c of next) el.classList.add(c);
|
|
495
|
+
ownedClasses.set(el, next);
|
|
496
|
+
}
|
|
497
|
+
/** Properties set through `style:*`, per element, so they can be re-applied. */
|
|
498
|
+
const styleNamespaces = /* @__PURE__ */ new WeakMap();
|
|
499
|
+
function nsStyles(el) {
|
|
500
|
+
let m = styleNamespaces.get(el);
|
|
501
|
+
if (!m) styleNamespaces.set(el, m = /* @__PURE__ */ new Map());
|
|
502
|
+
return m;
|
|
503
|
+
}
|
|
504
|
+
function setStyleProperty(el, name, css) {
|
|
505
|
+
if (css === null) el.style.removeProperty(name);
|
|
506
|
+
else el.style.setProperty(name, css);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Apply the bare `style` prop, then restore any `style:*` properties. The string
|
|
510
|
+
* form assigns `cssText`, which drops them — and would drop them again on every
|
|
511
|
+
* reactive update. Matches the server, which merges `style` and `style:*`.
|
|
512
|
+
*/
|
|
477
513
|
function applyStyle(el, value) {
|
|
478
514
|
const s = el.style;
|
|
479
515
|
if (!s) return;
|
|
480
516
|
if (typeof value === "string") s.cssText = value;
|
|
481
517
|
else if (value && typeof value === "object") Object.assign(s, value);
|
|
518
|
+
const ns = styleNamespaces.get(el);
|
|
519
|
+
if (ns) for (const [name, css] of ns) setStyleProperty(el, name, css);
|
|
482
520
|
}
|
|
483
521
|
function setAttribute(el, key, value) {
|
|
484
522
|
if (value == null || value === false) {
|
package/dist/for.d.mts
CHANGED
package/dist/for.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as untracked, S as trigger, _ as onCleanup, d as effectScope, u as effect, x as signal } from "./lib-DYypKhxk.mjs";
|
|
2
2
|
import "./signals/index.mjs";
|
|
3
|
-
import { n as disposeElement } from "./element-
|
|
3
|
+
import { n as disposeElement } from "./element-FFqOLWQu.mjs";
|
|
4
4
|
//#region src/for.ts
|
|
5
5
|
/**
|
|
6
6
|
* Keyed list renderer. See {@link ForProps} for prop details.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as onCleanup, u as effect } from "./lib-DYypKhxk.mjs";
|
|
2
2
|
import "./signals/index.mjs";
|
|
3
|
-
import { a as mountChild } from "./element-
|
|
3
|
+
import { a as mountChild } from "./element-FFqOLWQu.mjs";
|
|
4
4
|
import { Slot } from "./slot.mjs";
|
|
5
5
|
//#region src/jsx-runtime/fragment.ts
|
|
6
6
|
/**
|
package/dist/hydrate/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as hydrate } from "../hydrate-
|
|
1
|
+
import { t as hydrate } from "../hydrate-DZ_o7akg.mjs";
|
|
2
2
|
export { hydrate };
|
|
@@ -2,10 +2,10 @@ import { C as untracked, _ as onCleanup, d as effectScope, n as CLAIM, t as ASYN
|
|
|
2
2
|
import { isReactive } from "./signals/index.mjs";
|
|
3
3
|
import { isReactivePromiseLike } from "./utilities/promise.mjs";
|
|
4
4
|
import { flushDeferredAsyncRuns, isAsyncLike } from "./utilities/async.mjs";
|
|
5
|
-
import { i as applyProps, o as resolveChild, r as setRenderer, t as createElement } from "./element-
|
|
5
|
+
import { i as applyProps, o as resolveChild, r as setRenderer, t as createElement } from "./element-FFqOLWQu.mjs";
|
|
6
6
|
import { Slot } from "./slot.mjs";
|
|
7
7
|
import { For, isForComponent } from "./for.mjs";
|
|
8
|
-
import { n as isFragmentComponent, r as parseHtml, t as Fragment } from "./fragment-
|
|
8
|
+
import { n as isFragmentComponent, r as parseHtml, t as Fragment } from "./fragment-i-S0RyT4.mjs";
|
|
9
9
|
//#region src/hydrate/claim.ts
|
|
10
10
|
let hydrationContext = null;
|
|
11
11
|
function setHydrationContext(ctx) {
|
|
@@ -373,8 +373,8 @@ type NoArgFnProps<P> = { [K in keyof P]: ArgCount<P[K]> extends 0 ? P[K] : ArgFn
|
|
|
373
373
|
* components their props untouched.
|
|
374
374
|
*
|
|
375
375
|
* Every key is callable, including one the caller omitted. A getter is always
|
|
376
|
-
* truthy, so defaults go on the call: `props.excited() ?? "…"`.
|
|
377
|
-
*
|
|
376
|
+
* truthy, so defaults go on the call: `props.excited() ?? "…"`. Keys are
|
|
377
|
+
* branded sources, so they keep working when forwarded to a child component.
|
|
378
378
|
*
|
|
379
379
|
* Function props are the limit: a prop taking arguments is rejected, and a
|
|
380
380
|
* zero-arg one types as its return value. Read those off the raw props.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createElement } from "../element-
|
|
1
|
+
import { t as createElement } from "../element-FFqOLWQu.mjs";
|
|
2
2
|
import { render } from "../render.mjs";
|
|
3
|
-
import { t as hydrate } from "../hydrate-
|
|
3
|
+
import { t as hydrate } from "../hydrate-DZ_o7akg.mjs";
|
|
4
4
|
import { withSlotProps } from "./astro-slots.mjs";
|
|
5
5
|
//#region src/integrations/astro-client.ts
|
|
6
6
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { y as setInertEffects } from "../lib-DYypKhxk.mjs";
|
|
2
|
-
import { r as setRenderer, t as createElement } from "../element-
|
|
2
|
+
import { r as setRenderer, t as createElement } from "../element-FFqOLWQu.mjs";
|
|
3
3
|
import { withSlotProps } from "./astro-slots.mjs";
|
|
4
|
-
import { i as serverJsx, n as renderToString, r as SNode } from "../server-
|
|
4
|
+
import { i as serverJsx, n as renderToString, r as SNode } from "../server-C5Ka5iG2.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,5 +1,5 @@
|
|
|
1
|
-
import { t as createElement } from "../element-
|
|
2
|
-
import { t as Fragment } from "../fragment-
|
|
1
|
+
import { t as createElement } from "../element-FFqOLWQu.mjs";
|
|
2
|
+
import { t as Fragment } from "../fragment-i-S0RyT4.mjs";
|
|
3
3
|
//#region src/integrations/astro-slots.ts
|
|
4
4
|
/**
|
|
5
5
|
* @internal Map Astro's pre-rendered slot HTML (`Record<name, html>`) into
|
|
@@ -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-CYLVeDZc.mjs";
|
|
2
|
+
import { n as ComputedProps, r as MaybeReactive } from "../index-CzKKJCCK.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 };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as createElement } from "../element-
|
|
2
|
-
import { t as Fragment } from "../fragment-
|
|
1
|
+
import { t as createElement } from "../element-FFqOLWQu.mjs";
|
|
2
|
+
import { t as Fragment } from "../fragment-i-S0RyT4.mjs";
|
|
3
3
|
export { Fragment, 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-C5Ka5iG2.mjs";
|
|
2
2
|
export { renderToStream, renderToString };
|
|
@@ -2,9 +2,9 @@ import { C as untracked, y as setInertEffects } from "./lib-DYypKhxk.mjs";
|
|
|
2
2
|
import { isReactive } from "./signals/index.mjs";
|
|
3
3
|
import { isReactivePromiseLike } from "./utilities/promise.mjs";
|
|
4
4
|
import { isAsyncLike } from "./utilities/async.mjs";
|
|
5
|
-
import { c as BooleanAttributes, l as ChildProperties, r as setRenderer, s as AttrAliases, u as Properties } from "./element-
|
|
5
|
+
import { c as BooleanAttributes, l as ChildProperties, r as setRenderer, s as AttrAliases, u as Properties } from "./element-FFqOLWQu.mjs";
|
|
6
6
|
import { isForComponent } from "./for.mjs";
|
|
7
|
-
import { n as isFragmentComponent } from "./fragment-
|
|
7
|
+
import { n as isFragmentComponent } from "./fragment-i-S0RyT4.mjs";
|
|
8
8
|
//#region src/server/escape.ts
|
|
9
9
|
function escapeDelim(s, delim, escDelim) {
|
|
10
10
|
let iDelim = s.indexOf(delim);
|
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-CzKKJCCK.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
|
@@ -101,8 +101,8 @@ const COMPUTED_PROPS = Symbol.for("elements-kit.computed-props");
|
|
|
101
101
|
* components their props untouched.
|
|
102
102
|
*
|
|
103
103
|
* Every key is callable, including one the caller omitted. A getter is always
|
|
104
|
-
* truthy, so defaults go on the call: `props.excited() ?? "…"`.
|
|
105
|
-
*
|
|
104
|
+
* truthy, so defaults go on the call: `props.excited() ?? "…"`. Keys are
|
|
105
|
+
* branded sources, so they keep working when forwarded to a child component.
|
|
106
106
|
*
|
|
107
107
|
* Function props are the limit: a prop taking arguments is rejected, and a
|
|
108
108
|
* zero-arg one types as its return value. Read those off the raw props.
|
|
@@ -124,7 +124,7 @@ function computedProps(raw) {
|
|
|
124
124
|
let getter = cache.get(key);
|
|
125
125
|
if (!getter) {
|
|
126
126
|
const v = raw[key];
|
|
127
|
-
getter = isReactive(v) ? v : () => v;
|
|
127
|
+
getter = isReactive(v) ? v : computed(() => v);
|
|
128
128
|
cache.set(key, getter);
|
|
129
129
|
}
|
|
130
130
|
return getter;
|
package/dist/ui/styles/index.css
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "elements-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.24.0",
|
|
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",
|