kerfjs 5.0.0-beta.110 → 5.0.0-beta.111
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/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/ai/manifest.json +1 -1
- package/dist/{chunk-NVNTUHAA.js → chunk-YVBK73GU.js} +53 -3
- package/dist/chunk-YVBK73GU.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/list.js +1 -1
- package/dist/overlay.js +1 -1
- package/dist/remount.js +1 -1
- package/dist/scope.js +1 -1
- package/llms.txt +2 -1
- package/package.json +1 -1
- package/dist/chunk-NVNTUHAA.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
8
8
|
|
|
9
9
|
### Added
|
|
10
10
|
|
|
11
|
+
- **`DialogSurface` `closeEmphasis`.** Set it to `quiet` for a smaller, quieter close glyph within the existing 40px native button. Accessible naming, focus, forced colors, and close requests remain intact; `normal` keeps the established default (`KF-GJ4GTJ`).
|
|
12
|
+
- **`Button` `currentStep`.** A setup or progress step can mark its native button or link with `aria-current="step"` through a typed prop, including when disabled, without changing its label or visual state (`KF-TGEW3B`).
|
|
13
|
+
- **`each()` keeps a uniquely keyed row across item-object replacement.** Replacing an item with a new object that renders the same unique `id` or `data-key` now morphs its same-tag row in place, including during a reorder, so live children such as an open popover anchor stay connected. Ambiguous keys and tag changes still replace the row; the per-item HTML cache remains based on object identity (`KF-GS850A`).
|
|
11
14
|
- **Kerf Button in TabBar action zones.** The published TabBar composition contract now accepts one standalone Kerf `Button` in either `trailing` or `end`, alongside the existing `ToolbarControlGroup` and `wa-button` cases. The catalog, doctor, and examples agree with the already supported rendering and fixed action placement (`KF-535H1M`: TabBar Kerf Button composition).
|
|
12
15
|
- **`--kui-color-brand`.** An application sets one opt-in token on `:root` to change its brand: Kerf derives the brand fill (and the quiet and normal fills and borders mixed from it), on-loud text, brand text and links, brand text on brand fills, and the focus ring, clamping lightness so every pair keeps WCAG AA for any hue and chroma; Web Awesome's `--wa-color-brand-*` and `--wa-color-focus` follow. Unset, every brand token keeps its tuned default exactly. Previously an app that overrode only the brand fill kept the default blue brand text and focus ring (`KF-EM1T5S`).
|
|
13
16
|
- **A wrapped `Toolbar` keeps its height beside a long scroller.** In a `List` shell (a filling List holding a `Toolbar` above a `flex` `scrollable` List), a toolbar that wraps or stacks onto two rows at a phone width no longer shrinks to one control band when the scroller below holds a long page, which clipped its second row. A Toolbar in a List no longer shrinks; the app wrapper (`List flex="none"`) is unnecessary (`KF-0A7B8D`).
|
|
@@ -150,6 +153,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
150
153
|
|
|
151
154
|
### Fixed
|
|
152
155
|
|
|
156
|
+
- **Quiet and danger Text contrast on lowered surfaces.** The shared light quiet and dark danger colors now clear WCAG AA when `Text` appears in a lowered `ValueTableRow` or `ListHeader` status over the document baseline, in both the foundation fallback and Web Awesome theme (`KF-CQWA7G`).
|
|
157
|
+
- **`require-data-key-in-each` recognizes component `rootAttributes` keys.** A statically named `"data-key"` or `id` in a component row's `rootAttributes` object now satisfies the rule. Dynamic objects and ambiguous later spreads remain diagnostic; native and fragment roots retain their checks (`KF-PD9ZGA`).
|
|
153
158
|
- **Web Awesome Carousel specimens show full slides in Firefox.** A `wa-carousel`'s scroll container is a `grid-auto-columns: 100%` track under an aspect ratio, so it has no definite intrinsic width. In the catalog's shrink-to-fit specimen column Chromium and WebKit resolved it from the aspect ratio (a 457px carousel at 1100px), but Firefox sized it to the first slide's text: a 191px carousel with a 103×34px track that clipped "Foundation" and "Focused carousel item" at every width. The Carousel and Carousel Item specimens now take the medium width tier, as the Zoomable Frame specimen does, so every engine renders the same full slides. A three-engine check asserts the track holds the whole slide at 1100px and 320px (`KF-0TGNQG`).
|
|
154
159
|
- **Web Awesome OTP Input cells render whole.** Upstream caps the OTP Input's segments box, which reserves its focus-ring bleed with 4px padding and an equal negative margin, at 100% of the host. In a shrink-to-fit host (the catalog's start-aligned example grid, any start-aligned grid or flex item) the host is only the cells' width minus that bleed, so the padded box was 8px too narrow and silently clipped the last cell's inline-end edge inside its scroll container at every width. `@kerfjs/ui/webawesome.css` caps it at the host's width plus the bleed its negative margins reserve: a host narrower than the code still scrolls, and the `contained` appearance keeps upstream's cap. The catalog's phone-width check now measures the cells inside the shadow root (`KF-SPEQPY`).
|
|
155
160
|
- **Row and Grid catalog specimens fit a 320px phone.** The Row catalog's vertical-alignment rows now `wrap`, so the Baseline Alignment row's taller chips move the third chip to a second line instead of running 13px past the example, and the non-wrapping Default, Distribution, and Side-Selectable Insets rows use short `One` / `Two` / `Three` chips, which fit 320px with room to spare even in Linux's wider fallback font (the prefixed `Default three` ran about 15px past the example there) (`KF-JWT4QZ`). The Grid catalog's Four Columns example shows short quarter tiles (`Q1` … `Q4 est.`) that fit a phone-width track instead of process-stage words that ran past their own tiles and up to 11px past the example; its note now says a fixed count suits short content and points longer labels at `minColumnWidth`. Both catalogs join the phone-width overrun check (`KF-37ERTC`).
|
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ Write plain `.tsx` and build with your existing esbuild / Vite / tsup — no ext
|
|
|
76
76
|
|
|
77
77
|
## Why Kerf
|
|
78
78
|
|
|
79
|
-
1. **~15 KB in the browser.** ~15 KB minified + gzipped including `@preact/signals-core` (~
|
|
79
|
+
1. **~15 KB in the browser.** ~15 KB minified + gzipped including `@preact/signals-core` (~16 KB with `arraySignal`). The optional setup CLI has its own npm dependencies; they stay out of the browser bundle. No virtual DOM, no scheduler, no concurrent-mode machinery. On the official [krausest benchmark](https://krausest.github.io/js-framework-benchmark/current.html) kerf sits in the same cluster as Vue, Lit, and vanjs; Solid's compiler leads the update-path benchmarks, which kerf doesn't try to match by design — no compiler.
|
|
80
80
|
|
|
81
81
|
2. **No virtual DOM, no compiler.** JSX → HTML strings → native diff. DevTools shows the real DOM because it _is_ the DOM.
|
|
82
82
|
|
package/ai/manifest.json
CHANGED
|
@@ -1002,7 +1002,7 @@ function tryInPlaceContentUpdate(binding, listSeg) {
|
|
|
1002
1002
|
devHooks.missingRowKey?.(newRecord[0].node, newRecord[0].html, binding);
|
|
1003
1003
|
return true;
|
|
1004
1004
|
}
|
|
1005
|
-
function updateRowInPlace(liveParent, old, ni, index) {
|
|
1005
|
+
function updateRowInPlace(liveParent, old, ni, index, parsedNode) {
|
|
1006
1006
|
if (old.html === ni.html || tryAttributeOnlyFastPath(old.node, old.html, ni.html) || tryTextContentFastPath(old.node, old.html, ni.html)) {
|
|
1007
1007
|
const kept = carryOrRewireRowBindings(
|
|
1008
1008
|
old.node,
|
|
@@ -1019,7 +1019,7 @@ function updateRowInPlace(liveParent, old, ni, index) {
|
|
|
1019
1019
|
bindingDisposers: kept.bindingDisposers
|
|
1020
1020
|
};
|
|
1021
1021
|
}
|
|
1022
|
-
const newNode = parseSingleRow(ni.html, index, liveParent);
|
|
1022
|
+
const newNode = parsedNode ?? parseSingleRow(ni.html, index, liveParent);
|
|
1023
1023
|
if (old.node.tagName === newNode.tagName) {
|
|
1024
1024
|
_morphElement(old.node, newNode);
|
|
1025
1025
|
const kept = carryOrRewireRowBindings(
|
|
@@ -1063,6 +1063,15 @@ function reconcileSnapshot(binding, listSeg) {
|
|
|
1063
1063
|
const tailAnchor = endAnchor(binding);
|
|
1064
1064
|
buildFreshNodes(newRecord, freshIndices, freshHtmls, liveParent);
|
|
1065
1065
|
const focusSnap = captureFocus(liveParent);
|
|
1066
|
+
reuseKeyedRows(
|
|
1067
|
+
binding.items,
|
|
1068
|
+
listSeg,
|
|
1069
|
+
newRecord,
|
|
1070
|
+
prevIdx,
|
|
1071
|
+
removedItems,
|
|
1072
|
+
freshIndices,
|
|
1073
|
+
liveParent
|
|
1074
|
+
);
|
|
1066
1075
|
removeOldNodes(liveParent, removedItems);
|
|
1067
1076
|
applyMoves(liveParent, newRecord, prevIdx, lis(prevIdx), tailAnchor);
|
|
1068
1077
|
if (focusSnap !== null) restoreFocus(focusSnap);
|
|
@@ -1071,6 +1080,47 @@ function reconcileSnapshot(binding, listSeg) {
|
|
|
1071
1080
|
devHooks.missingRowKey?.(newRecord[0].node, newRecord[0].html, binding);
|
|
1072
1081
|
}
|
|
1073
1082
|
}
|
|
1083
|
+
function reuseKeyedRows(oldItems, listSeg, newRecord, prevIdx, removedItems, freshIndices, liveParent) {
|
|
1084
|
+
if (freshIndices.length === 0 || removedItems.length === 0) return;
|
|
1085
|
+
const oldByKey = /* @__PURE__ */ new Map();
|
|
1086
|
+
for (let index = 0; index < oldItems.length; index++) {
|
|
1087
|
+
const key = getNodeKey(oldItems[index].node);
|
|
1088
|
+
if (key === void 0) continue;
|
|
1089
|
+
oldByKey.set(
|
|
1090
|
+
key,
|
|
1091
|
+
oldByKey.has(key) ? null : { item: oldItems[index], index }
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
const newKeyCounts = /* @__PURE__ */ new Map();
|
|
1095
|
+
for (const item of newRecord) {
|
|
1096
|
+
const key = getNodeKey(item.node);
|
|
1097
|
+
if (key !== void 0)
|
|
1098
|
+
newKeyCounts.set(key, (newKeyCounts.get(key) ?? 0) + 1);
|
|
1099
|
+
}
|
|
1100
|
+
const removedSet = new Set(removedItems);
|
|
1101
|
+
const reused = /* @__PURE__ */ new Set();
|
|
1102
|
+
for (const index of freshIndices) {
|
|
1103
|
+
const fresh = newRecord[index];
|
|
1104
|
+
const key = getNodeKey(fresh.node);
|
|
1105
|
+
if (key === void 0 || newKeyCounts.get(key) !== 1) continue;
|
|
1106
|
+
const prior = oldByKey.get(key);
|
|
1107
|
+
if (prior === void 0 || prior === null || !removedSet.has(prior.item) || prior.item.node.tagName !== fresh.node.tagName)
|
|
1108
|
+
continue;
|
|
1109
|
+
disposeRowBindings(fresh.bindingDisposers);
|
|
1110
|
+
newRecord[index] = updateRowInPlace(
|
|
1111
|
+
liveParent,
|
|
1112
|
+
prior.item,
|
|
1113
|
+
listSeg.items[index],
|
|
1114
|
+
index,
|
|
1115
|
+
fresh.node
|
|
1116
|
+
);
|
|
1117
|
+
prevIdx[index] = prior.index;
|
|
1118
|
+
reused.add(prior.item);
|
|
1119
|
+
}
|
|
1120
|
+
for (let i = removedItems.length - 1; i >= 0; i--) {
|
|
1121
|
+
if (reused.has(removedItems[i])) removedItems.splice(i, 1);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1074
1124
|
function classifyItems(oldItems, listSeg) {
|
|
1075
1125
|
const oldByRef = /* @__PURE__ */ new Map();
|
|
1076
1126
|
for (let i = 0; i < oldItems.length; i++) {
|
|
@@ -1809,4 +1859,4 @@ function resultToSegment(result) {
|
|
|
1809
1859
|
|
|
1810
1860
|
export { captureFocus, each, morph, mount, moveNode, restoreFocus };
|
|
1811
1861
|
|
|
1812
|
-
//# sourceMappingURL=chunk-
|
|
1862
|
+
//# sourceMappingURL=chunk-YVBK73GU.js.map
|