From e90455ff08efa08a05aabb919a6f9b2adf9299b8 Mon Sep 17 00:00:00 2001 From: maximedub Date: Tue, 25 Aug 2026 18:28:57 +0200 Subject: [PATCH] Revert "Use manifest as single package version source" This reverts commit 3b9c0034498505be289e0234b26ca2a7a00dda6b. --- .github/workflows/version-consistency.yml | 85 ------------------ .../lotus_view_studio/__init__.py | 88 +++++-------------- custom_components/lotus_view_studio/const.py | 4 +- .../frontend/lotus-card-picker-bridge.js | 4 +- .../frontend/lotus-card-registry.js | 2 +- .../lotus_view_studio/frontend/lotus-core.js | 5 +- .../frontend/lotus-digicode-card.js | 4 +- .../frontend/lotus-direct-create-bridge.js | 5 +- .../frontend/lotus-edit-dialog-bridge.js | 7 +- .../frontend/lotus-i18n-europe.js | 5 +- .../frontend/lotus-i18n-extra.js | 3 +- .../lotus_view_studio/frontend/lotus-i18n.js | 7 +- .../frontend/lotus-icon-size-bridge.js | 7 +- .../frontend/lotus-iconset.js | 3 +- .../frontend/lotus-image-fit-bridge.js | 5 +- .../frontend/lotus-slide-card.js | 4 +- ...ide-editor.js => lotus-slide-editor-b1.js} | 4 +- ...ect.js => lotus-slide-editor-direct-b1.js} | 2 +- ...js => lotus-slide-editor-direct-fix-b1.js} | 4 +- .../frontend/lotus-tabs-editor.js | 4 +- .../frontend/lotus-version.js | 8 -- .../frontend/lotus-view-editor-bridge.js | 2 +- .../frontend/lotus-visual-layout.js | 8 +- .../frontend/lotus-visual-manager.js | 8 +- .../frontend/lotus-visual-stack.js | 4 +- .../frontend/lotus-visual.js | 43 +++++---- .../lotus_view_studio/manifest.json | 2 +- 27 files changed, 92 insertions(+), 235 deletions(-) delete mode 100644 .github/workflows/version-consistency.yml rename custom_components/lotus_view_studio/frontend/{lotus-slide-editor.js => lotus-slide-editor-b1.js} (99%) rename custom_components/lotus_view_studio/frontend/{lotus-slide-editor-direct.js => lotus-slide-editor-direct-b1.js} (99%) rename custom_components/lotus_view_studio/frontend/{lotus-slide-editor-direct-fix.js => lotus-slide-editor-direct-fix-b1.js} (98%) delete mode 100644 custom_components/lotus_view_studio/frontend/lotus-version.js diff --git a/.github/workflows/version-consistency.yml b/.github/workflows/version-consistency.yml deleted file mode 100644 index d4eec0b..0000000 --- a/.github/workflows/version-consistency.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Validate package version architecture - -on: - push: - pull_request: - workflow_dispatch: - -permissions: {} - -jobs: - version-consistency: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - - name: Verify manifest is the single package version source - shell: python - run: | - from pathlib import Path - import json - import re - import sys - - component = Path("custom_components/lotus_view_studio") - frontend = component / "frontend" - manifest = json.loads((component / "manifest.json").read_text(encoding="utf-8")) - version = str(manifest.get("version", "")).strip() - errors = [] - - if not version: - errors.append("manifest.json does not declare a package version") - - const_text = (component / "const.py").read_text(encoding="utf-8") - if re.search(r"^VERSION\s*=", const_text, flags=re.MULTILINE): - errors.append("const.py must not duplicate the package VERSION") - if re.search(r"^MODULE_URL\s*=", const_text, flags=re.MULTILINE): - errors.append("const.py must not duplicate a versioned MODULE_URL") - - version_module = frontend / "lotus-version.js" - if not version_module.exists(): - errors.append("frontend/lotus-version.js is missing") - - forbidden_assignments = ( - r"LOTUS_VISUAL_BOOTSTRAP_VERSION\s*=", - r"LOTUS_VISUAL_VERSION\s*=\s*['\"]", - r"LOTUS_I18N_VERSION\s*=\s*['\"]", - r"LOTUS_I18N_EXTRA_VERSION\s*=\s*['\"]", - r"LOTUS_EUROPE_VERSION\s*=\s*['\"]", - r"LOTUS_ICONSET_VERSION\s*=\s*['\"]", - r"directCreateBridge\s*:\s*['\"]\d", - r"editDialogBridge\s*:\s*['\"]\d", - r"iconSizeBridge\s*:\s*['\"]\d", - r"stackResponsiveBridge\s*:\s*['\"]\d", - r"imageFitBridge\s*:\s*['\"]\d", - ) - - for path in sorted(frontend.glob("*.js")): - text = path.read_text(encoding="utf-8") - if version and version in text: - errors.append(f"{path}: current package version {version} is hardcoded") - if re.search(r"0\.13\.0b\d+", text): - errors.append(f"{path}: historical package beta version is hardcoded") - if "?v=" in text: - errors.append(f"{path}: manual ?v= cache busting is forbidden") - if re.search(r"-b\d+\.js$", path.name): - errors.append(f"{path}: beta number is encoded in an implementation filename") - for pattern in forbidden_assignments: - if re.search(pattern, text): - errors.append(f"{path}: package version diagnostic is hardcoded ({pattern})") - - core_text = (frontend / "lotus-core.js").read_text(encoding="utf-8") - if "LOTUS_VISUAL_VERSION = LOTUS_PACKAGE_VERSION" not in core_text: - errors.append("lotus-core.js must derive LOTUS_VISUAL_VERSION from LOTUS_PACKAGE_VERSION") - - init_text = (component / "__init__.py").read_text(encoding="utf-8") - if "_MANIFEST_PATH" not in init_text or "def _package_version()" not in init_text: - errors.append("backend must derive the package version from manifest.json") - - if errors: - print("Version architecture validation failed:") - for error in errors: - print(f"- {error}") - sys.exit(1) - - print(f"Single package version source validated: manifest.json -> {version}") diff --git a/custom_components/lotus_view_studio/__init__.py b/custom_components/lotus_view_studio/__init__.py index 107797b..1a2ed9e 100644 --- a/custom_components/lotus_view_studio/__init__.py +++ b/custom_components/lotus_view_studio/__init__.py @@ -1,6 +1,5 @@ """Lotus View Studio: visual dashboard editing suite for Home Assistant.""" -import json from inspect import signature from pathlib import Path @@ -16,30 +15,17 @@ DOMAIN, LEGACY_BRAND_URL, LEGACY_URL_BASE, + MODULE_URL, PANEL_ICON, PANEL_PATH, PANEL_TITLE, URL_BASE, - VERSIONED_BRAND_URL, - VERSIONED_URL_BASE, ) from .digicode_security import DigicodeSecurityManager, register_websocket_commands from .preferences import LotusVisualPreferences, register_preference_websocket_commands -_COMPONENT_DIR = Path(__file__).parent -_FRONTEND_DIR = _COMPONENT_DIR / "frontend" -_BRAND_DIR = _COMPONENT_DIR / "brand" -_MANIFEST_PATH = _COMPONENT_DIR / "manifest.json" - - -def _package_version() -> str: - """Return the integration version declared by manifest.json.""" - manifest = json.loads(_MANIFEST_PATH.read_text(encoding="utf-8")) - version = str(manifest.get("version", "")).strip() - if not version: - raise ValueError("Lotus View Studio manifest.json does not declare a version") - return version - +_FRONTEND_DIR = Path(__file__).parent / "frontend" +_BRAND_DIR = Path(__file__).parent / "brand" CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) @@ -55,11 +41,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: hass.config_entries.async_update_entry(entry, title=PANEL_TITLE) data = hass.data.setdefault(DOMAIN, {}) - package_version = _package_version() - versioned_url_base = f"{VERSIONED_URL_BASE}/{package_version}" - versioned_brand_url = f"{VERSIONED_BRAND_URL}/{package_version}" - module_url = f"{versioned_url_base}/lotus-visual.js" - if not data.get("digicode_security"): digicode_security = DigicodeSecurityManager(hass) await digicode_security.async_load() @@ -70,42 +51,20 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: await preferences.async_load() register_preference_websocket_commands(hass, preferences) data["preferences"] = preferences - - registered_versions = data.setdefault("static_versions", set()) - if package_version not in registered_versions: - static_paths = [ - # Versioned routes use their own namespace, so they never overlap - # compatibility routes left by an earlier Lotus release. - StaticPathConfig(versioned_url_base, str(_FRONTEND_DIR), cache_headers=True), - StaticPathConfig(versioned_brand_url, str(_BRAND_DIR), cache_headers=True), - ] - - # Releases before 0.13.0b4 used a single static_registered flag and - # registered these aliases already. Honor that state during an in-place - # integration reload so routes are never registered twice. - compat_registered = bool( - data.get("compat_static_registered") or data.get("static_registered") + if not data.get("static_registered"): + await hass.http.async_register_static_paths( + [ + StaticPathConfig(URL_BASE, str(_FRONTEND_DIR), cache_headers=False), + StaticPathConfig(BRAND_URL, str(_BRAND_DIR), cache_headers=False), + # Compatibility aliases for browser caches / manually registered + # resources from Lotus Visual releases prior to 0.12.0. + StaticPathConfig(LEGACY_URL_BASE, str(_FRONTEND_DIR), cache_headers=False), + StaticPathConfig(LEGACY_BRAND_URL, str(_BRAND_DIR), cache_headers=False), + ] ) - if not compat_registered: - static_paths.extend( - [ - StaticPathConfig(URL_BASE, str(_FRONTEND_DIR), cache_headers=False), - StaticPathConfig(BRAND_URL, str(_BRAND_DIR), cache_headers=False), - StaticPathConfig( - LEGACY_URL_BASE, str(_FRONTEND_DIR), cache_headers=False - ), - StaticPathConfig( - LEGACY_BRAND_URL, str(_BRAND_DIR), cache_headers=False - ), - ] - ) - - await hass.http.async_register_static_paths(static_paths) - registered_versions.add(package_version) - data["compat_static_registered"] = True - data.pop("static_registered", None) - - frontend.add_extra_js_url(hass, module_url) + data["static_registered"] = True + + frontend.add_extra_js_url(hass, MODULE_URL) panel_kwargs = { "hass": hass, @@ -113,7 +72,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: "webcomponent_name": "lotus-visual-manager", "sidebar_title": PANEL_TITLE, "sidebar_icon": PANEL_ICON, - "module_url": module_url, + "module_url": MODULE_URL, "require_admin": True, } @@ -125,19 +84,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: await panel_custom.async_register_panel(**panel_kwargs) - data[entry.entry_id] = {"module_url": module_url} + data[entry.entry_id] = {"module_url": MODULE_URL} return True async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload Lotus View Studio.""" frontend.async_remove_panel(hass, PANEL_PATH, warn_if_unknown=False) - entry_data = hass.data.get(DOMAIN, {}).get(entry.entry_id, {}) - module_url = entry_data.get("module_url") - if module_url: - try: - frontend.remove_extra_js_url(hass, module_url) - except (KeyError, ValueError): - pass + try: + frontend.remove_extra_js_url(hass, MODULE_URL) + except (KeyError, ValueError): + pass hass.data.get(DOMAIN, {}).pop(entry.entry_id, None) return True diff --git a/custom_components/lotus_view_studio/const.py b/custom_components/lotus_view_studio/const.py index 1158134..fee8758 100644 --- a/custom_components/lotus_view_studio/const.py +++ b/custom_components/lotus_view_studio/const.py @@ -2,12 +2,12 @@ DOMAIN = "lotus_view_studio" LEGACY_DOMAIN = "lotus_visual" +VERSION = "0.13.0b3" URL_BASE = "/lotus_view_studio_static" BRAND_URL = "/lotus_view_studio_brand" -VERSIONED_URL_BASE = "/lotus_view_studio_static_v" -VERSIONED_BRAND_URL = "/lotus_view_studio_brand_v" LEGACY_URL_BASE = "/lotus_visual_static" LEGACY_BRAND_URL = "/lotus_visual_brand" PANEL_PATH = "lotus-view-studio" PANEL_TITLE = "Lotus View Studio" PANEL_ICON = "lotus:lotus" +MODULE_URL = f"{URL_BASE}/lotus-visual.js?v={VERSION}" \ No newline at end of file diff --git a/custom_components/lotus_view_studio/frontend/lotus-card-picker-bridge.js b/custom_components/lotus_view_studio/frontend/lotus-card-picker-bridge.js index 9db8a51..71baf9c 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-card-picker-bridge.js +++ b/custom_components/lotus_view_studio/frontend/lotus-card-picker-bridge.js @@ -8,8 +8,8 @@ * and already-mounted pickers are rebuilt once. */ -import { registerLotusCards } from "./lotus-card-registry.js"; -import { lotusDebug, lotusSetHass } from "./lotus-i18n.js"; +import { registerLotusCards } from "./lotus-card-registry.js?v=0.13.0b3"; +import { lotusDebug, lotusSetHass } from "./lotus-i18n.js?v=0.13.0b3"; const PATCHED = Symbol.for("lotusVisual.cardPickerPatched.v1"); diff --git a/custom_components/lotus_view_studio/frontend/lotus-card-registry.js b/custom_components/lotus_view_studio/frontend/lotus-card-registry.js index 1c73d87..5be88d2 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-card-registry.js +++ b/custom_components/lotus_view_studio/frontend/lotus-card-registry.js @@ -1,7 +1,7 @@ /* * Lotus View Studio custom-card registry. */ -import { lotusT } from "./lotus-i18n.js"; +import { lotusT } from "./lotus-i18n.js?v=0.13.0b3"; export const LOTUS_STACK_CARD_ENTRY = Object.freeze({ type: "lotus-visual-stack", diff --git a/custom_components/lotus_view_studio/frontend/lotus-core.js b/custom_components/lotus_view_studio/frontend/lotus-core.js index 284ee5f..5552982 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-core.js +++ b/custom_components/lotus_view_studio/frontend/lotus-core.js @@ -1,7 +1,6 @@ -import { LOTUS_PACKAGE_VERSION } from "./lotus-version.js"; -import { lotusT } from "./lotus-i18n.js"; +import { lotusT } from "./lotus-i18n.js?v=0.13.0b3"; -export const LOTUS_VISUAL_VERSION = LOTUS_PACKAGE_VERSION; +export const LOTUS_VISUAL_VERSION = "0.13.0b3"; export const LOTUS_LAYOUT_KEY = "lotus"; export const LOTUS_LEGACY_LAYOUT_KEYS = Object.freeze(["lotus_visual_layout"]); diff --git a/custom_components/lotus_view_studio/frontend/lotus-digicode-card.js b/custom_components/lotus_view_studio/frontend/lotus-digicode-card.js index c4a88cf..21a09a2 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-digicode-card.js +++ b/custom_components/lotus_view_studio/frontend/lotus-digicode-card.js @@ -8,8 +8,8 @@ * 3) application-layer RSA-OAEP transport + server-side salted PIN hash. */ -import { deepClone, clamp } from "./lotus-core.js"; -import { lotusDebug, lotusSetHass, lotusT } from "./lotus-i18n.js"; +import { deepClone, clamp } from "./lotus-core.js?v=0.13.0b3"; +import { lotusDebug, lotusSetHass, lotusT } from "./lotus-i18n.js?v=0.13.0b3"; const LOTUS_DIGICODE_VERSION = "1.3.7"; const LOTUS_DIGICODE_TYPE = "custom:lotus-digicode-card"; diff --git a/custom_components/lotus_view_studio/frontend/lotus-direct-create-bridge.js b/custom_components/lotus_view_studio/frontend/lotus-direct-create-bridge.js index 85efccd..d830d4e 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-direct-create-bridge.js +++ b/custom_components/lotus_view_studio/frontend/lotus-direct-create-bridge.js @@ -1,6 +1,5 @@ -import { LOTUS_PACKAGE_VERSION } from "./lotus-version.js"; /* - * Lotus View Studio direct-create bridge + * Lotus View Studio direct-create bridge — v0.13.0b3 * * Goal * ---- @@ -204,7 +203,7 @@ function installCaptureBridge() { .catch(() => {}); window.LotusVisual = Object.assign(window.LotusVisual || {}, { - directCreateBridge: LOTUS_PACKAGE_VERSION, + directCreateBridge: "0.13.0b3", directCreateMode: "capture-import-before-dialog", }); } diff --git a/custom_components/lotus_view_studio/frontend/lotus-edit-dialog-bridge.js b/custom_components/lotus_view_studio/frontend/lotus-edit-dialog-bridge.js index 43b178e..7c2070e 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-edit-dialog-bridge.js +++ b/custom_components/lotus_view_studio/frontend/lotus-edit-dialog-bridge.js @@ -1,6 +1,5 @@ -import { LOTUS_PACKAGE_VERSION } from "./lotus-version.js"; /* - * Lotus View Studio edit-dialog bridge + * Lotus View Studio edit-dialog bridge — v0.13.0b3 * * Home Assistant's native hui-dialog-edit-card owns two columns on desktop: * - .element-editor (ha-scrollbar) @@ -26,7 +25,7 @@ import { LOTUS_PACKAGE_VERSION } from "./lotus-version.js"; * frontend. Non-Lotus cards are not changed. */ -import { lotusDebug, lotusSetHass, lotusT } from "./lotus-i18n.js"; +import { lotusDebug, lotusSetHass, lotusT } from "./lotus-i18n.js?v=0.13.0b3"; const PATCHED = Symbol.for("lotusVisual.editDialogBridge.v0837"); const CAPTURE_INSTALLED = Symbol.for("lotusVisual.editDialogCapture.v0837"); @@ -935,7 +934,7 @@ function installBridge() { .catch(() => {}); window.LotusVisual = Object.assign(window.LotusVisual || {}, { - editDialogBridge: LOTUS_PACKAGE_VERSION, + editDialogBridge: "0.13.0b3", editDialogMode: "visual-preview-yaml-code-only", }); } diff --git a/custom_components/lotus_view_studio/frontend/lotus-i18n-europe.js b/custom_components/lotus_view_studio/frontend/lotus-i18n-europe.js index 794ef06..a15b4ef 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-i18n-europe.js +++ b/custom_components/lotus_view_studio/frontend/lotus-i18n-europe.js @@ -1,6 +1,5 @@ -import { LOTUS_PACKAGE_VERSION } from "./lotus-version.js"; -/* European language pack for Lotus View Studio. */ -export const LOTUS_EUROPE_VERSION = LOTUS_PACKAGE_VERSION; +/* European language pack for Lotus View Studio 0.13.0b3. */ +export const LOTUS_EUROPE_VERSION = "0.13.0b3"; export const LOTUS_EUROPE_LANGUAGES = Object.freeze([ { value: "nl", nativeName: "Nederlands", englishName: "Dutch" }, { value: "pl", nativeName: "Polski", englishName: "Polish" }, diff --git a/custom_components/lotus_view_studio/frontend/lotus-i18n-extra.js b/custom_components/lotus_view_studio/frontend/lotus-i18n-extra.js index a1112fc..e1b2c4a 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-i18n-extra.js +++ b/custom_components/lotus_view_studio/frontend/lotus-i18n-extra.js @@ -1,11 +1,10 @@ -import { LOTUS_PACKAGE_VERSION } from "./lotus-version.js"; /* Additional Lotus View Studio language packs introduced in 0.9.1. * English remains the safety fallback for any diagnostic string which has not * yet received a dedicated translation. User-facing controls are translated * here so every advertised language remains usable. */ -export const LOTUS_I18N_EXTRA_VERSION = LOTUS_PACKAGE_VERSION; +export const LOTUS_I18N_EXTRA_VERSION = "0.13.0b3"; export const LOTUS_EXTRA_LANGUAGES = Object.freeze([ { value: "it", nativeName: "Italiano", englishName: "Italian" }, diff --git a/custom_components/lotus_view_studio/frontend/lotus-i18n.js b/custom_components/lotus_view_studio/frontend/lotus-i18n.js index 79aee8b..cb7a800 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-i18n.js +++ b/custom_components/lotus_view_studio/frontend/lotus-i18n.js @@ -1,17 +1,16 @@ -import { LOTUS_PACKAGE_VERSION } from "./lotus-version.js"; import { LOTUS_EXTRA_LANGUAGES, LOTUS_EXTRA_EXACT, LOTUS_EXTRA_REPLACEMENTS, LOTUS_EXTRA_SELECTOR_LABELS, LOTUS_RTL_LANGUAGES, -} from "./lotus-i18n-extra.js"; +} from "./lotus-i18n-extra.js?v=0.13.0b3"; import { LOTUS_EUROPE_LANGUAGES, LOTUS_EUROPE_EXACT, LOTUS_EUROPE_REPLACEMENTS, LOTUS_EUROPE_SELECTOR_LABELS, -} from "./lotus-i18n-europe.js"; +} from "./lotus-i18n-europe.js?v=0.13.0b3"; /* * Lotus View Studio internationalization core. @@ -19,7 +18,7 @@ import { * a per-user manual override persisted by the Lotus View Studio backend. */ -export const LOTUS_I18N_VERSION = LOTUS_PACKAGE_VERSION; +export const LOTUS_I18N_VERSION = "0.13.0b3"; export const LOTUS_LANGUAGES = Object.freeze([ { value: "auto", nativeName: "Automatique — Home Assistant", englishName: "Automatic — Home Assistant" }, diff --git a/custom_components/lotus_view_studio/frontend/lotus-icon-size-bridge.js b/custom_components/lotus_view_studio/frontend/lotus-icon-size-bridge.js index fe7fb71..15393e0 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-icon-size-bridge.js +++ b/custom_components/lotus_view_studio/frontend/lotus-icon-size-bridge.js @@ -1,6 +1,5 @@ -import { LOTUS_PACKAGE_VERSION } from "./lotus-version.js"; /* - * Lotus View Studio native picture-elements responsive bridge + * Lotus View Studio native picture-elements responsive bridge — v0.13.0b3 * * Lotus Stack is deliberately saved as a native Home Assistant picture-elements * card. Native state-icon/state-label elements do not know the logical Lotus @@ -198,6 +197,6 @@ if (labelClass) installLabelBridge(labelClass); else customElements.whenDefined("hui-state-label-element").then(() => installLabelBridge(customElements.get("hui-state-label-element"))); window.LotusVisual = Object.assign(window.LotusVisual || {}, { - iconSizeBridge: LOTUS_PACKAGE_VERSION, - stackResponsiveBridge: LOTUS_PACKAGE_VERSION, + iconSizeBridge: "0.13.0b3", + stackResponsiveBridge: "0.13.0b3", }); diff --git a/custom_components/lotus_view_studio/frontend/lotus-iconset.js b/custom_components/lotus_view_studio/frontend/lotus-iconset.js index 7f87233..ec1fb2b 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-iconset.js +++ b/custom_components/lotus_view_studio/frontend/lotus-iconset.js @@ -1,10 +1,9 @@ -import { LOTUS_PACKAGE_VERSION } from "./lotus-version.js"; /* Lotus View Studio custom icon set. * Registered globally so the Home Assistant sidebar can use the Lotus brand * mark without requiring an external custom-icons integration. */ -const LOTUS_ICONSET_VERSION = LOTUS_PACKAGE_VERSION; +const LOTUS_ICONSET_VERSION = "0.13.0b3"; // 24x24 monochrome sidebar icon: a simplified Lotus inside a window frame. // It follows currentColor so Home Assistant controls selected/unselected colors. diff --git a/custom_components/lotus_view_studio/frontend/lotus-image-fit-bridge.js b/custom_components/lotus_view_studio/frontend/lotus-image-fit-bridge.js index 693c2e7..8cddff8 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-image-fit-bridge.js +++ b/custom_components/lotus_view_studio/frontend/lotus-image-fit-bridge.js @@ -1,6 +1,5 @@ -import { LOTUS_PACKAGE_VERSION } from "./lotus-version.js"; /* - * Lotus View Studio native picture-elements image-fit bridge + * Lotus View Studio native picture-elements image-fit bridge — v0.13.0b3 * * Home Assistant's hui-image component supports fitMode (cover/contain/fill), * but hui-image-element currently does not forward such a property to it. @@ -62,5 +61,5 @@ if (existing) { } window.LotusVisual = Object.assign(window.LotusVisual || {}, { - imageFitBridge: LOTUS_PACKAGE_VERSION, + imageFitBridge: "0.13.0b3", }); diff --git a/custom_components/lotus_view_studio/frontend/lotus-slide-card.js b/custom_components/lotus_view_studio/frontend/lotus-slide-card.js index 37ed57b..04410dc 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-slide-card.js +++ b/custom_components/lotus_view_studio/frontend/lotus-slide-card.js @@ -6,8 +6,8 @@ * executed once the handle reaches the validation threshold and is released. */ -import { deepClone, clamp } from "./lotus-core.js"; -import { lotusLocalizeSelector, lotusSetHass, lotusT } from "./lotus-i18n.js"; +import { deepClone, clamp } from "./lotus-core.js?v=0.13.0b3"; +import { lotusLocalizeSelector, lotusSetHass, lotusT } from "./lotus-i18n.js?v=0.13.0b3"; const LOTUS_SLIDE_VERSION = "1.3.0"; const LOTUS_SLIDE_TYPE = "custom:lotus-slide-card"; diff --git a/custom_components/lotus_view_studio/frontend/lotus-slide-editor.js b/custom_components/lotus_view_studio/frontend/lotus-slide-editor-b1.js similarity index 99% rename from custom_components/lotus_view_studio/frontend/lotus-slide-editor.js rename to custom_components/lotus_view_studio/frontend/lotus-slide-editor-b1.js index eb905b0..641f2a2 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-slide-editor.js +++ b/custom_components/lotus_view_studio/frontend/lotus-slide-editor-b1.js @@ -1,5 +1,5 @@ /* - * Lotus Slide editor UX patch for Lotus View Studio. + * Lotus Slide editor UX patch for Lotus View Studio 0.13.0b3. * * Goals: * - allow each side/end position to explicitly have no icon or image; @@ -9,7 +9,7 @@ * This module is loaded after lotus-slide-card.js and only patches the editor. */ -import { lotusT } from "./lotus-i18n.js"; +import { lotusT } from "./lotus-i18n.js?v=0.13.0b3"; const MAX_SIDE_VISUAL_VALUES = 20; const DEFERRED_SIZE_KEYS = new Set([ diff --git a/custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct.js b/custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct-b1.js similarity index 99% rename from custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct.js rename to custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct-b1.js index 510c405..8237672 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct.js +++ b/custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct-b1.js @@ -1,5 +1,5 @@ /* - * Lotus Slide direct preview editor. + * Lotus Slide direct preview editor — 0.13.0b3. * * The live preview is also a context selector: clicking an element reveals only * the relevant configuration section. Selected visual elements can be resized diff --git a/custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct-fix.js b/custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct-fix-b1.js similarity index 98% rename from custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct-fix.js rename to custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct-fix-b1.js index e8eb3ca..5ce7eea 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct-fix.js +++ b/custom_components/lotus_view_studio/frontend/lotus-slide-editor-direct-fix-b1.js @@ -1,6 +1,6 @@ -/* Refinements for the direct Lotus Slide preview editor. */ +/* Refinements for the 0.13.0b3 direct Lotus Slide preview editor. */ -import { lotusT } from "./lotus-i18n.js"; +import { lotusT } from "./lotus-i18n.js?v=0.13.0b3"; const editorClass = customElements.get("lotus-slide-card-editor"); diff --git a/custom_components/lotus_view_studio/frontend/lotus-tabs-editor.js b/custom_components/lotus_view_studio/frontend/lotus-tabs-editor.js index 8d7e825..0f08e31 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-tabs-editor.js +++ b/custom_components/lotus_view_studio/frontend/lotus-tabs-editor.js @@ -5,13 +5,13 @@ import { lotusSlugify, lotusThemeCss, lotusTabEdgeBorderPath, -} from "./lotus-core.js"; +} from "./lotus-core.js?v=0.13.0b3"; import { lotusDebug, lotusLocalizeSelector, lotusSetHass, lotusT, -} from "./lotus-i18n.js"; +} from "./lotus-i18n.js?v=0.13.0b3"; const LOTUS_VIEW_META_KEY = "lotus_visual"; const LOTUS_TABS_KEY = "tabs"; diff --git a/custom_components/lotus_view_studio/frontend/lotus-version.js b/custom_components/lotus_view_studio/frontend/lotus-version.js deleted file mode 100644 index de8aedd..0000000 --- a/custom_components/lotus_view_studio/frontend/lotus-version.js +++ /dev/null @@ -1,8 +0,0 @@ -/* Package version derived from the versioned static URL registered by Home Assistant. */ -const moduleUrl = new URL(import.meta.url); -const pathParts = moduleUrl.pathname.split("/").filter(Boolean); -const candidate = decodeURIComponent(pathParts.at(-2) || ""); -const VERSION_PATTERN = /^\d+\.\d+\.\d+[0-9A-Za-z.+-]*$/; - -export const LOTUS_PACKAGE_VERSION = VERSION_PATTERN.test(candidate) ? candidate : "dev"; -export const LOTUS_PACKAGE_IS_VERSIONED = LOTUS_PACKAGE_VERSION !== "dev"; diff --git a/custom_components/lotus_view_studio/frontend/lotus-view-editor-bridge.js b/custom_components/lotus_view_studio/frontend/lotus-view-editor-bridge.js index 80cb777..feac235 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-view-editor-bridge.js +++ b/custom_components/lotus_view_studio/frontend/lotus-view-editor-bridge.js @@ -1,4 +1,4 @@ -import { lotusDebug, lotusSetHass, lotusT } from "./lotus-i18n.js"; +import { lotusDebug, lotusSetHass, lotusT } from "./lotus-i18n.js?v=0.13.0b3"; const LOTUS_VIEW_TYPE = "custom:lotus-visual-layout"; const LOTUS_VIEW_LABEL = "Lotus View Studio"; diff --git a/custom_components/lotus_view_studio/frontend/lotus-visual-layout.js b/custom_components/lotus_view_studio/frontend/lotus-visual-layout.js index 6df17e2..b485424 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-visual-layout.js +++ b/custom_components/lotus_view_studio/frontend/lotus-visual-layout.js @@ -9,10 +9,10 @@ import { makeIconButton, fireEvent, lotusTabEdgeBorderPath, -} from "./lotus-core.js"; -import { lotusDebug, lotusSetHass, lotusT } from "./lotus-i18n.js"; -import { registerLotusStackCard, registerLotusSlideCard, registerLotusDigicodeCard } from "./lotus-card-registry.js"; -import { openLotusTabsEditor } from "./lotus-tabs-editor.js"; +} from "./lotus-core.js?v=0.13.0b3"; +import { lotusDebug, lotusSetHass, lotusT } from "./lotus-i18n.js?v=0.13.0b3"; +import { registerLotusStackCard, registerLotusSlideCard, registerLotusDigicodeCard } from "./lotus-card-registry.js?v=0.13.0b3"; +import { openLotusTabsEditor } from "./lotus-tabs-editor.js?v=0.13.0b3"; const DEFAULT_LAYOUT = Object.freeze({ x: 2, y: 2, width: 30, height: 18, locked: false, z: 1 }); diff --git a/custom_components/lotus_view_studio/frontend/lotus-visual-manager.js b/custom_components/lotus_view_studio/frontend/lotus-visual-manager.js index 6320042..5a7ab8c 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-visual-manager.js +++ b/custom_components/lotus_view_studio/frontend/lotus-visual-manager.js @@ -4,7 +4,7 @@ import { lotusSlugify, lotusThemeCss, makeIconButton, -} from "./lotus-core.js"; +} from "./lotus-core.js?v=0.13.0b3"; import { LOTUS_LANGUAGES, lotusGetAutomaticLanguage, @@ -13,11 +13,9 @@ import { lotusSetHass, lotusSetLanguagePreference, lotusT, -} from "./lotus-i18n.js"; +} from "./lotus-i18n.js?v=0.13.0b3"; -const LOTUS_BRAND_ICON_URL = LOTUS_VISUAL_VERSION === "dev" - ? "/lotus_view_studio_brand/icon.png" - : `/lotus_view_studio_brand_v/${encodeURIComponent(LOTUS_VISUAL_VERSION)}/icon.png`; +const LOTUS_BRAND_ICON_URL = `/lotus_view_studio_brand/icon.png?v=${LOTUS_VISUAL_VERSION}`; const DEFAULT_VIEW_ICON = "mdi:view-dashboard-outline"; const LOTUS_VIEW_TYPE = "custom:lotus-visual-layout"; diff --git a/custom_components/lotus_view_studio/frontend/lotus-visual-stack.js b/custom_components/lotus_view_studio/frontend/lotus-visual-stack.js index 7661f0c..8b87546 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-visual-stack.js +++ b/custom_components/lotus_view_studio/frontend/lotus-visual-stack.js @@ -1,5 +1,5 @@ -import { registerLotusStackCard } from "./lotus-card-registry.js"; -import { lotusDebug, lotusLocalizeSelector, lotusSetHass, lotusT } from "./lotus-i18n.js"; +import { registerLotusStackCard } from "./lotus-card-registry.js?v=0.13.0b3"; +import { lotusDebug, lotusLocalizeSelector, lotusSetHass, lotusT } from "./lotus-i18n.js?v=0.13.0b3"; /* diff --git a/custom_components/lotus_view_studio/frontend/lotus-visual.js b/custom_components/lotus_view_studio/frontend/lotus-visual.js index 798ec5d..3565391 100644 --- a/custom_components/lotus_view_studio/frontend/lotus-visual.js +++ b/custom_components/lotus_view_studio/frontend/lotus-visual.js @@ -1,36 +1,41 @@ -await import("./lotus-iconset.js"); -const { LOTUS_VISUAL_VERSION } = await import("./lotus-core.js"); +// Bootstrap version is intentionally local: the first import must itself be +// cache-busted. A static import of lotus-core.js could otherwise survive an +// integration upgrade in the browser ESM module map. +const LOTUS_VISUAL_BOOTSTRAP_VERSION = "0.13.0b3"; +await import(`./lotus-iconset.js?v=${LOTUS_VISUAL_BOOTSTRAP_VERSION}`); +const { LOTUS_VISUAL_VERSION } = await import(`./lotus-core.js?v=${LOTUS_VISUAL_BOOTSTRAP_VERSION}`); // Load integration bridges with the package version in the URL. This matters // especially for direct-create compatibility fixes: an old cached bridge must // never survive an integration upgrade while the main module is new. -await import("./lotus-card-registry.js"); -await import("./lotus-card-picker-bridge.js"); -await import("./lotus-direct-create-bridge.js"); -await import("./lotus-edit-dialog-bridge.js"); -await import("./lotus-view-editor-bridge.js"); -await import("./lotus-image-fit-bridge.js"); -await import("./lotus-icon-size-bridge.js"); +await import(`./lotus-card-registry.js?v=${LOTUS_VISUAL_VERSION}`); +await import(`./lotus-card-picker-bridge.js?v=${LOTUS_VISUAL_VERSION}`); +await import(`./lotus-direct-create-bridge.js?v=${LOTUS_VISUAL_VERSION}`); +await import(`./lotus-edit-dialog-bridge.js?v=${LOTUS_VISUAL_VERSION}`); +await import(`./lotus-view-editor-bridge.js?v=${LOTUS_VISUAL_VERSION}`); +await import(`./lotus-image-fit-bridge.js?v=${LOTUS_VISUAL_VERSION}`); +await import(`./lotus-icon-size-bridge.js?v=${LOTUS_VISUAL_VERSION}`); // Components may already be loaded as legacy Lovelace resources. Avoid // redefining custom elements during migration; users can then remove the old // resources. Always execute Stack and Slide so their Home Assistant card-picker // registrations are repaired even when a legacy element was loaded first. -await import("./lotus-visual-stack.js"); -await import("./lotus-slide-card.js"); -// Load the stable Lotus Slide runtime and its visual editor refinements. -await import("./lotus-slide-editor.js"); -await import("./lotus-slide-editor-direct.js"); -await import("./lotus-slide-editor-direct-fix.js"); -await import("./lotus-digicode-card.js"); +await import(`./lotus-visual-stack.js?v=${LOTUS_VISUAL_VERSION}`); +await import(`./lotus-slide-card.js?v=${LOTUS_VISUAL_VERSION}`); +// 0.13.0b3 keeps the stable 1.3.0 runtime and the editor UX refinements +// introduced during the 0.13.0 beta cycle. +await import(`./lotus-slide-editor-b1.js?v=${LOTUS_VISUAL_VERSION}`); +await import(`./lotus-slide-editor-direct-b1.js?v=${LOTUS_VISUAL_VERSION}`); +await import(`./lotus-slide-editor-direct-fix-b1.js?v=${LOTUS_VISUAL_VERSION}`); +await import(`./lotus-digicode-card.js?v=${LOTUS_VISUAL_VERSION}`); if (!customElements.get("lotus-layers-card")) { - await import("./lotus-layers.js"); + await import(`./lotus-layers.js?v=${LOTUS_VISUAL_VERSION}`); } if (!customElements.get("lotus-visual-layout")) { - await import("./lotus-visual-layout.js"); + await import(`./lotus-visual-layout.js?v=${LOTUS_VISUAL_VERSION}`); } if (!customElements.get("lotus-visual-manager")) { - await import("./lotus-visual-manager.js"); + await import(`./lotus-visual-manager.js?v=${LOTUS_VISUAL_VERSION}`); } const lotusViewStudioApi = { diff --git a/custom_components/lotus_view_studio/manifest.json b/custom_components/lotus_view_studio/manifest.json index 3c99b5c..fc4ffda 100644 --- a/custom_components/lotus_view_studio/manifest.json +++ b/custom_components/lotus_view_studio/manifest.json @@ -18,5 +18,5 @@ "issue_tracker": "https://github.com/NALINFORGE/LotusViewStudio/issues", "requirements": [], "single_config_entry": true, - "version": "0.13.0b4" + "version": "0.13.0b3" }