Commit Graph
62 Commits
Author SHA1 Message Date
Dermot Duffy 06bcfd58ba refactor: Stamp build information in as "defines" (#2654) 2026-08-03 22:36:32 -07:00
Dermot Duffy e590f72783 test: Add a browser based test harness (#2641) 2026-07-31 10:16:58 -07:00
Dermot Duffy b6e1de5999 feat: Modernize the visual card editor. (#2586) 2026-07-20 20:44:16 -07:00
Dermot Duffy c3d3dd3934 chore: Update ha-nunjucks to 1.6.2 (#2549)
- Replaces:
https://github.com/dermotduffy/advanced-camera-card/pull/2515
2026-06-30 17:45:13 -07:00
Dermot Duffy ea251ca988 perf(bundle): lazy-load the nunjucks template engine (#2535)
Closes #2531.

## Summary

The full `nunjucks` templating engine (~226KB) plus `ha-nunjucks`
(~46KB) — roughly **272KB, ~13% of the eager entry chunk** — was
statically imported and downloaded by every card on initial load, even
though templates only apply when a config value contains a `{{ … }}` /
`{% … %}` delimiter. Most cards use no templates and never need the
engine.

This defers the engine behind a dynamic `import('ha-nunjucks/dist')` so
it ships in a separate, on-demand chunk instead of the eager
`card-*.js`.

## Approach

The render path (`TemplateRenderer.renderRecursively`) is **kept
synchronous** — it is called from many synchronous hot paths
(condition/trigger evaluators, picture-elements rendering, actions,
folder matchers), and making it async would be a large, high-risk
refactor of the evaluation core.

Instead:

- **New `src/card-controller/templates/engine.ts`** — a module-level
singleton lazy loader (`loadTemplateEngine()` / `getTemplateEngine()`)
shared across all `TemplateRenderer` instances, plus a
`containsTemplate()` delimiter helper.
- **Delimiter gating** — strings without a delimiter never touch the
engine (the overwhelming majority of renders).
- **Pre-warm at config time** — because every template string originates
in the config, a new mandatory `TEMPLATE_ENGINE` initialization aspect
loads the engine before first render whenever the config contains a
delimiter. This **guarantees no raw `{{ … }}` flash**: content/condition
rendering is blocked until the engine is present for template-using
cards. Cards without templates never load it.

## Result

- nunjucks + ha-nunjucks move out of the eager chunk into a separate
chunk fetched only when a card actually uses templates.
- No change to the synchronous public render API; condition/trigger
evaluation core untouched.

## Tests

- New `engine.ts` loader coverage (concurrent load, cached reuse,
not-loaded fallback).
- The 11 existing test files that render real (delimiter-bearing)
templates declare their dependency explicitly via
`beforeAll(loadTemplateEngine)` — no global/implicit setup hook.
- Full suite green (4764 tests), lint and ts-prune clean, per-file 100%
coverage maintained for the affected directories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_016ykWemdkZrgywvC71pHc6c

---
_Generated by [Claude
Code](https://claude.ai/code/session_016ykWemdkZrgywvC71pHc6c)_
2026-06-30 17:45:13 -07:00
Dermot Duffy 04059920bb chore: Don't use rollup serving by default (#2495) 2026-06-30 17:45:13 -07:00
Dermot Duffy 529500ed94 refactor: Migrate config schema from Zod v3 to Zod v4 (#2357) 2026-02-18 21:47:43 -08:00
Dermot Duffy 78dee9194f feat: Add timeline support for folder media (#2197)
- Closes #2106
2025-10-04 15:47:39 -07:00
Dermot Duffy 7fb710d45d feat: Add support for templates in actions (#1891)
- Closes #1878
2025-02-14 07:23:19 -08:00
Dermot Duffy cc376a8be1 feat: Rename the card to advanced-camera-card (#1873)
Whilst the Frigate support in this card is the best among camera
engines, the name incorrectly suggests that Frigate is a requirement.
Instead, to broaden the appeal, change to more camera agnostic name.
This does not suggest any change in priority, role or support for
Frigate.

This change is likely to be bug prone, due to the size of the rename --
the code contains 1500+ references to "Frigate" most of which make sense
to rename, some which do not, all of which needed human assessment.

- Closes #1298


BREAKING CHANGE: References to `frigate-card` in all kinds of
configuration need to be updated to `advanced-camera-card`. An automated
config upgrade should take care of the majority of usecases (click `Edit
-> Upgrade -> Save`), though may not be perfect.
2025-02-06 19:32:32 -08:00
Dermot Duffy 278560b5ac feat: Add richer card theme support (#1809) 2025-01-07 19:54:13 -08:00
Dermot Duffy 716a33fb96 fix: Use pkg version until semantic-release is used (#1565)
* fix: Use pkg version until semantic-release is used

* Make istanbul happy with coverage
2024-09-22 12:55:44 -07:00
Dermot Duffy f944dee82c ci: Add initial semantic-release configuration (#1528) 2024-09-14 15:47:42 -07:00
Dermot Duffy a0283c35c1 Add support for perform-action calls. 2024-09-09 22:05:49 -07:00
Dermot Duffy 1a0e219c61 Move automatic media actions out of carousels 2024-09-07 15:04:23 -07:00
Dermot Duffy ef7b4b0ddf Formatting pass. 2024-07-30 02:23:51 -07:00
Dermot Duffy d5c4e56c45 Refactor views to support dynamic updates. 2024-07-26 19:15:38 -07:00
Dermot Duffy afb9af5eb4 Rename several view variables for clarity. 2024-06-11 19:48:39 -07:00
Felipe Santos 7356044a08 Update rollup to v3 and also its plugins 2024-06-11 23:31:42 -03:00
Felipe Santos 1a36ce0894 Update date-fns and date-fns-tz to v3 2024-06-05 22:37:54 -03:00
Dermot Duffy f67511c6c1 Enforce coverage %. 2023-10-31 14:06:10 -07:00
Dermot Duffy 8c606b296f Add datepicker to timeline. 2023-03-28 19:57:26 -07:00
Dermot Duffy c35fdc56d5 Add a hover-card menu style. 2022-10-10 20:43:35 -07:00
Dermot Duffy da7895903e Use lodash cloneDeep and generate facade chunk. 2022-10-10 19:04:29 -07:00
Dermot Duffy 9af8eedb8a Dynamically load non-fallback languages. 2022-10-09 12:37:24 -07:00
Dermot Duffy 0d09286c8c Split live providers into chunks. 2022-10-09 08:39:04 -07:00
Dermot Duffy 5d7a7b7f6e Add bundle size analyser. 2022-09-27 20:34:27 -07:00
Dermot Duffy 059f171578 Use a higher port number for rollup. 2022-07-23 15:58:47 -07:00
Felipe Santos cbb25cd334 Change Rollup port to 1000 2022-07-06 03:39:27 +00:00
Dermot Duffy 7b8078aeb8 Add git information to diagnostics 2022-06-20 17:10:22 +00:00
Felipe Santos 5da1c5e0cf Bump to high ports 2022-06-17 04:25:13 +00:00
Felipe Santos dd9a19d179 Reuse the Frigate integration devcontainer 2022-06-17 03:45:11 +00:00
Felipe Santos 258ed150cd Configure VS Code debug and tasks 2022-06-15 21:10:49 +00:00
Felipe Santos b4f5f98ed1 Remove uneeded list construction for plugins 2022-06-09 13:41:08 -03:00
Felipe Santos e4dd0e2c66 Add type hints to rollup.config.js 2022-06-09 13:27:38 -03:00
Dermot Duffy 28292483fc Add native select entity support. 2022-05-08 15:58:56 -07:00
Dermot Duffy 0f11a938fb Fix rollup warnings. 2022-05-08 08:24:09 -07:00
Felix Leupold 5befdfbbf4 fix: replace process.env.NODE_ENV in bundled files 2022-05-06 12:30:26 +02:00
Dermot Duffy d0b40f46e8 Add terser back. 2022-05-01 13:39:59 -07:00
Dermot Duffy c7c1ac990b Remove attempt to serve in prod env. 2022-05-01 13:34:50 -07:00
Dermot Duffy 0125d32951 Address build warning fixes. 2022-04-23 16:43:59 -07:00
Dermot Duffy 983aff4dd8 Initial skeleton timeline. 2022-03-19 09:00:21 -07:00
Felipe Santos 07636710c8 Refresh dependencies and fix warnings 2022-03-06 17:40:46 -03:00
Dermot Duffy c40c63862e Initial editor support. 2022-01-14 21:31:16 -08:00
Dermot Duffy e6e3e7e51e Put babel back. 2021-10-24 08:06:08 -07:00
Dermot Duffy e5b1deb334 Various build extension fixes. 2021-10-24 07:57:28 -07:00
Dermot Duffy 0d7c20b550 Add 'image' view. 2021-10-16 21:02:07 -07:00
Dermot Duffy e3ccbb0787 Dynamically extract dimensions from loaded media. 2021-09-23 20:38:39 -07:00
Dermot Duffy 023c66b137 Convert menu to a separate component file. 2021-09-20 21:33:37 -07:00
Dermot Duffy 63a5a93eeb Componentize messages, error messages and progress indicator. 2021-09-20 21:33:37 -07:00