From aecee0fe1a479b584ccf1f097d18f61cb8acdb43 Mon Sep 17 00:00:00 2001 From: Adnaan Date: Sun, 14 Dec 2025 07:57:29 +0100 Subject: [PATCH 1/2] chore(release): v0.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Release @livetemplate/client v0.7.1 This release follows the core library version: 0.7.x 🤖 Generated with automated release script --- CHANGELOG.md | 11 +++++++++++ VERSION | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac52c43..960a2f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to @livetemplate/client will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v0.7.1] - 2025-12-14 + +### Changes + +- fix: apply differential ops to existing range structures (#9) (50a3ebc) +- fix: handle objects with only numeric keys in renderValue (#8) (b1c7827) +- feat: add lvt-focus-trap and lvt-autofocus attributes (#7) (7b14402) +- feat: add reactive attributes for action lifecycle events (#6) (46e2065) + + + ## [v0.7.0] - 2025-12-10 ### Changes diff --git a/VERSION b/VERSION index faef31a..39e898a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.7.0 +0.7.1 diff --git a/package-lock.json b/package-lock.json index 639b5fd..3d4912c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@livetemplate/client", - "version": "0.7.0", + "version": "0.7.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@livetemplate/client", - "version": "0.7.0", + "version": "0.7.1", "license": "MIT", "dependencies": { "@types/morphdom": "^2.3.0", diff --git a/package.json b/package.json index 1ce4aa6..ab0d6ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@livetemplate/client", - "version": "0.7.0", + "version": "0.7.1", "description": "TypeScript client for LiveTemplate tree-based updates", "main": "dist/livetemplate-client.js", "browser": "dist/livetemplate-client.browser.js", From c4730dae32facb8af46ba9e7901c6d83071db3b6 Mon Sep 17 00:00:00 2001 From: Adnaan Date: Fri, 19 Dec 2025 07:34:47 +0100 Subject: [PATCH 2/2] feat: client updates for livepage features MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- dom/event-delegation.ts | 16 +++++----------- livetemplate-client.ts | 2 ++ utils/confirm.ts | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 utils/confirm.ts diff --git a/dom/event-delegation.ts b/dom/event-delegation.ts index 2234f58..cf162b7 100644 --- a/dom/event-delegation.ts +++ b/dom/event-delegation.ts @@ -1,4 +1,5 @@ import { debounce, throttle } from "../utils/rate-limit"; +import { checkLvtConfirm } from "../utils/confirm"; import type { Logger } from "../utils/logger"; export interface EventDelegationContext { @@ -142,17 +143,10 @@ export class EventDelegator { targetElement, }); - if ( - action === "delete" && - targetElement.hasAttribute("lvt-confirm") - ) { - const confirmMessage = - targetElement.getAttribute("lvt-confirm") || - "Are you sure you want to delete this item?"; - if (!confirm(confirmMessage)) { - this.logger.debug("Delete action cancelled by user"); - return; - } + // Handle lvt-confirm for any action + if (!checkLvtConfirm(targetElement as HTMLElement)) { + this.logger.debug("Action cancelled by user:", action); + return; } const message: any = { action, data: {} }; diff --git a/livetemplate-client.ts b/livetemplate-client.ts index 78003ce..143aef5 100644 --- a/livetemplate-client.ts +++ b/livetemplate-client.ts @@ -35,6 +35,8 @@ import type { } from "./types"; import { createLogger, Logger } from "./utils/logger"; export { loadAndApplyUpdate, compareHTML } from "./utils/testing"; +export { setupReactiveAttributeListeners } from "./dom/reactive-attributes"; +export { checkLvtConfirm, extractLvtData } from "./utils/confirm"; export class LiveTemplateClient { private readonly treeRenderer: TreeRenderer; diff --git a/utils/confirm.ts b/utils/confirm.ts new file mode 100644 index 0000000..763781a --- /dev/null +++ b/utils/confirm.ts @@ -0,0 +1,33 @@ +/** + * Check if an element has lvt-confirm attribute and prompt user if needed. + * Returns true if action should proceed, false if cancelled. + */ +export function checkLvtConfirm(element: HTMLElement): boolean { + if (element.hasAttribute("lvt-confirm")) { + const confirmMessage = element.getAttribute("lvt-confirm"); + if (confirmMessage && !confirm(confirmMessage)) { + return false; // User cancelled + } + } + return true; // Proceed +} + +/** + * Extract lvt-data-* attributes from an element. + * lvt-data-id="123" becomes { id: "123" } + * lvt-data-user-name="john" becomes { "user-name": "john" } + */ +export function extractLvtData(element: HTMLElement): Record { + const data: Record = {}; + const attributes = element.attributes; + + for (let i = 0; i < attributes.length; i++) { + const attr = attributes[i]; + if (attr.name.startsWith("lvt-data-")) { + const key = attr.name.substring(9); // Remove "lvt-data-" prefix + data[key] = attr.value; + } + } + + return data; +}