elements-kit 0.23.1 → 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/{element-w3nDE2S5.mjs → element-FFqOLWQu.mjs} +41 -3
- 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/integrations/astro-client.mjs +2 -2
- package/dist/integrations/astro-server.mjs +2 -2
- package/dist/integrations/astro-slots.mjs +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/ui/styles/index.css +1 -1
- package/dist/ui/styles/material.css +1 -1
- package/package.json +1 -1
|
@@ -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.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) {
|
|
@@ -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 { 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/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",
|