diff --git a/.backlog/ideas/pending/PLN-008-built-in-sprite-groups-several-sprites.md b/.backlog/ideas/pending/PLN-008-built-in-sprite-groups-several-sprites.md index 8cd79b7..5bd3b58 100644 --- a/.backlog/ideas/pending/PLN-008-built-in-sprite-groups-several-sprites.md +++ b/.backlog/ideas/pending/PLN-008-built-in-sprite-groups-several-sprites.md @@ -61,3 +61,4 @@ Let one `svgworm.config.json` build several sprites (for example `app` and `mark - [2026-11-09] Backlog grooming: trigger re-checked and still unmet (`gh issue list -R jmlweb/svgworm --state all` returns no issues; `docs/metrics/manual.json` has no starters and no user request). Every path in Files to Modify exists on main b9e1150, `OWNED_FILE` still at `packages/svgworm/src/core/write.ts:11`. Left pending. - [2026-11-12] Backlog grooming: trigger re-checked and still unmet (`gh issue list -R jmlweb/svgworm --state all` returns no issues; `docs/metrics/manual.json` has no starters and no user request). Every path in Files to Modify exists on main 73024f2, `OWNED_FILE` still at `packages/svgworm/src/core/write.ts:11`. Left pending. - [2026-11-18] Backlog grooming: trigger re-checked and still unmet (`gh issue list -R jmlweb/svgworm --state all` returns no issues; `docs/metrics/manual.json` has no starters and no user request). Every path in Files to Modify exists on main b79816f, `OWNED_FILE` still at `packages/svgworm/src/core/write.ts:11`. Note for later: TSK-110 may change the base that config paths resolve against, which a `sprites` map would inherit. Left pending. +- [2026-11-24] Backlog grooming: trigger re-checked and still unmet (`gh issue list -R jmlweb/svgworm --state all` returns no issues; `docs/metrics/manual.json` has no starters and no user request). Every path in Files to Modify exists on main f561905, `OWNED_FILE` still at `packages/svgworm/src/core/write.ts:11`. The 2026-11-18 note is closed: TSK-110 (413df5d) only reworded the path descriptions, config paths still resolve against the working directory, so a `sprites` map inherits no new base. Left pending. diff --git a/.backlog/ideas/pending/PLN-009-css-icon-output-mask-classes.md b/.backlog/ideas/pending/PLN-009-css-icon-output-mask-classes.md index 50d3484..935eede 100644 --- a/.backlog/ideas/pending/PLN-009-css-icon-output-mask-classes.md +++ b/.backlog/ideas/pending/PLN-009-css-icon-output-mask-classes.md @@ -56,3 +56,4 @@ Emit an optional CSS file with one class per mono icon (`.svgworm-home { mask: u - [2026-11-09] Backlog grooming: demand re-checked and still none (`gh issue list -R jmlweb/svgworm --state all` returns no issues; `docs/metrics/manual.json` records no request). Every existing path in Files to Modify verified on main b9e1150 (`scripts/render-check.mjs`, `tests/render/matrix.json`, `src/core/emit/`, `write.ts`). Left pending. - [2026-11-12] Backlog grooming: demand re-checked and still none (`gh issue list -R jmlweb/svgworm --state all` returns no issues; `docs/metrics/manual.json` records no request). Every existing path in Files to Modify verified on main 73024f2 (`scripts/render-check.mjs`, `tests/render/matrix.json`, `src/core/emit/`, `write.ts`). Left pending. - [2026-11-18] Backlog grooming: demand re-checked and still none (`gh issue list -R jmlweb/svgworm --state all` returns no issues; `docs/metrics/manual.json` records no request). Every existing path in Files to Modify verified on main b79816f (`scripts/render-check.mjs`, `tests/render/matrix.json`, `src/core/emit/`, `write.ts`). Left pending. +- [2026-11-24] Backlog grooming: demand re-checked and still none (`gh issue list -R jmlweb/svgworm --state all` returns no issues; `docs/metrics/manual.json` records no request). Every existing path in Files to Modify verified on main f561905 (`scripts/render-check.mjs`, `tests/render/matrix.json`, `src/core/emit/`, `write.ts`). Related: TSK-113 changes how the img delivery is sized in the adapters; a CSS output would not use that path. Left pending. diff --git a/.backlog/reports/complete/RPT-019-img-delivery-icons-render-at-1x1.md b/.backlog/reports/complete/RPT-019-img-delivery-icons-render-at-1x1.md new file mode 100644 index 0000000..957b6c3 --- /dev/null +++ b/.backlog/reports/complete/RPT-019-img-delivery-icons-render-at-1x1.md @@ -0,0 +1,42 @@ +--- +id: RPT-019 +title: img-delivery icons render at 1x1 px by default because width="1em" is not a valid img dimension +type: bug +severity: high +status: triaged +created: 2026-11-24 +triaged: 2026-11-24 +task-id: TSK-113 +--- + +## What happens + +Icons with `delivery: "img"` (multicolor icons that need gradients, masks, clip paths or filters) render at **1 x 1 CSS px** when no `width`/`height` prop is given, so they are effectively invisible. + +The React adapter defaults the size to `'1em'` (`packages/react/src/create-icon.tsx:71`, `DEFAULT_SIZE = '1em'`) and passes it as the HTML attributes of the `` (`packages/react/src/create-icon.tsx:164-171`). On `` the attribute is a CSS length, so `1em` works. On ``, `width`/`height` are HTML dimension attributes: the HTML "rules for parsing dimension values" read the leading digits and stop at `e`, so `width="1em"` means 1 px. + +The generated `Icon.astro`, `Icon.vue` and `Icon.svelte` templates render the same markup (`packages/svgworm/src/cli/init/plan.ts:968-969` and `:1054`, `:1254-1255` and `:1315`, and the site copy `apps/site/src/components/Icon.astro:51-52` and `:137`), so every adapter has the bug. The documented markup in `apps/site/src/content/docs/icon.md:57-62` shows the same `height="1em"` / `width="1em"`. + +## Reproduction + +Observed on 2026-11-24 with the repo's Playwright browsers: + +```js +const html = `
`; +// getBoundingClientRect() of #a +``` + +Output: + +``` +chromium 1x1 +firefox 1x1 +``` + +(WebKit could not start on this host because of missing system libraries.) The expected size is 32 x 32, as the `` and `mask` deliveries give at `font-size: 32px`. + +The unit test `packages/react/src/create-icon.test.tsx:87` asserts the markup string ``, and the render matrix (`pnpm render:check`) renders the delivery forms with its own markup, so no check exercises the adapter's default size in a browser. + +## Suggested fix + +Give the `` its default size through CSS instead of the dimension attributes, for example `style={{ width, height, ...style }}` (or keep numeric `width`/`height` props as attributes and move string lengths into the style), in `createIcon` and in all three templates, which the conformance tests keep in sync. Add a browser check that renders a default-size `img` icon from the adapter output and expects it to be 1em square. diff --git a/.backlog/tasks/index.md b/.backlog/tasks/index.md index 9190054..859d8bb 100644 --- a/.backlog/tasks/index.md +++ b/.backlog/tasks/index.md @@ -4,7 +4,7 @@ | Status | Count | |--------|-------| -| Pending | 5 | +| Pending | 6 | | Active | 3 | | Blocked | 2 | | Complete | 102 | @@ -26,6 +26,7 @@ | TSK-107 | Fix: An absolute --config path is reported as not found although the file exists | P4 | | 2026-11-06 | | TSK-108 | Fix: A config file saved with a UTF-8 BOM is rejected as not valid JSON | P4 | | 2026-11-06 | | TSK-112 | Fix: check reports a directory or symlink with a sprite-like name as stale, but build never removes it, so check can never pass | P4 | | 2026-11-21 | +| TSK-113 | Fix: img-delivery icons render at 1x1 px by default because width="1em" is not a valid img dimension | P2 | | 2026-11-24 | ## Recently Completed diff --git a/.backlog/tasks/pending/TSK-113-fix-img-delivery-icons-render-at.md b/.backlog/tasks/pending/TSK-113-fix-img-delivery-icons-render-at.md new file mode 100644 index 0000000..4ed4525 --- /dev/null +++ b/.backlog/tasks/pending/TSK-113-fix-img-delivery-icons-render-at.md @@ -0,0 +1,33 @@ +--- +id: TSK-113 +title: Fix: img-delivery icons render at 1x1 px by default because width="1em" is not a valid img dimension +status: pending +priority: P2 +tags: [] +created: 2026-11-24 +source: report/RPT-019 +depends-on: [] +--- + +# Fix: img-delivery icons render at 1x1 px by default because width="1em" is not a valid img dimension + +## Description + +From RPT-019. The adapters default `width`/`height` to `'1em'` and pass them as HTML attributes of the `` used for `delivery: "img"` icons (`packages/react/src/create-icon.tsx:71` and `:164`; the templates in `packages/svgworm/src/cli/init/plan.ts` and `apps/site/src/components/Icon.astro:137`). HTML dimension attributes parse `1em` as 1 px, so multicolor img icons are 1 x 1 px by default (observed in Chromium and Firefox). Move the default size into CSS. Note the trade-off: inline style beats a class rule, which `icon.md` says resizes img icons. Change touches the adapters and the generated templates: run the core/adapter gate set from `.claude/rules/agent-workflow.md`. + +## Acceptance Criteria + +- [ ] A failing test first shows that the default-size img delivery of createIcon renders an img that is not 1em square in a browser (or asserts the size moves out of the HTML width/height attributes) +- [ ] createIcon in packages/react/src/create-icon.tsx, the Icon.astro, Icon.vue and Icon.svelte templates in packages/svgworm/src/cli/init/plan.ts and apps/site/src/components/Icon.astro render a default-size img icon at 1em x 1em, and the conformance tests stay green +- [ ] Explicit numeric and string width/height props still size img icons as documented +- [ ] A CSS class rule still resizes img icons, or the sizing section of apps/site/src/content/docs/icon.md is updated to say otherwise; the img markup example in icon.md matches the new output +- [ ] Changesets record the fix for svgworm and @svgworm/react +- [ ] pnpm verify, pnpm determinism:fingerprint, pnpm example:check, pnpm example:vite:check, pnpm site:check and pnpm render:check pass + +## Notes + +## Learnings + +## Progress Log + +- [2026-11-24] Created \ No newline at end of file