Commit ddeea0c
feat(base64): add data URI image viewer and migrate to ts-common (#117)
* feat: improve loggers
* feat(orchestrator): [data_uri_parsing_utils] add pure data URI parsing utilities
Introduce src/utils/base64-image.utils.ts with three pure helpers:
- parseDataUri(input): regex-extracts { mimeType, base64, ext } from a
well-formed data URI, returns null for empty/plain/malformed input.
Pattern requires the `data:` prefix, a `type/subtype` MIME, and a
non-empty base64 payload after `;base64,`.
- isImageMimeType(mimeType): delegates to VALID_IMAGE_TYPES from
image.utils so the source of truth for valid image MIME stays in one
place.
- mimeToExt(mimeType): looks up a small MIME_TO_EXT_MAP for canonical
overrides (image/jpeg → jpg, image/svg+xml → svg) and otherwise
falls back to the MIME subtype with any `+suffix` stripped, which
gives sensible extensions for unmapped types (application/json →
json, audio/mp3 → mp3).
Co-located base64-image.utils.test.ts uses parametrised it.each blocks
with explicit Arrange / Act / Assert structure for all three functions,
including the negative cases listed in the acceptance criteria
(application/pdf and audio/mp3 for isImageMimeType, and empty / plain /
malformed inputs for parseDataUri).
Files changed:
- src/utils/base64-image.utils.ts (new)
- src/utils/base64-image.utils.test.ts (new)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(orchestrator): [route_and_tab_shell] register /base64/image route and Image URI tab
Add a placeholder Base64 Image URI screen wired into the Base64 tab shell:
- New `/base64/image` child route registered under the `/base64` parent,
rendering a placeholder `Base64Image` screen with a "Coming soon" body.
- New TAB_ITEMS entry `{ key: "/base64/image", label: "Image URI" }` in
the Base64 tab container; the existing `/base64` → `/base64/string`
index redirect is unchanged.
Key decisions:
- Export TAB_ITEMS from `src/screens/base64/base64.tsx` so the tab list
can be asserted from a colocated test (mirrors the MENU_ITEMS pattern
in app-side-menu.utils.tsx).
- Placeholder screen reuses ScreenContainer + ScreenHeader so the route
navigates cleanly today and leaves a natural slot for the upcoming
Image URI feature work.
Files changed:
- src/routes/router.tsx (register base64ImageRoute)
- src/screens/base64/base64.tsx (export TAB_ITEMS, add Image URI entry)
- src/screens/base64/base64.test.tsx (new: TAB_ITEMS includes Image URI)
- src/screens/base64/image/base64-image.tsx (new placeholder screen)
- src/screens/base64/image/base64-image.test.tsx (new: exported component)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* chore: merge route_and_tab_shell and data_uri_parsing_utils branches
- Register /base64/image route and Image URI tab entry
- Add pure data URI parsing utilities and unit tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(orchestrator): [persisted_textarea_input] wire textarea to persisted Zustand store
Add a Base64 Image URI screen input wired to a localStorage-persisted
Zustand store, mirroring the base64-string store pattern.
Key decisions:
- New `useBase64ImageStore` exposes a single `inputText` field plus
`setInputText`. Persisted under `etoolbox-base64-image` via
`zustand/middleware`'s `persist` + `createJSONStorage(() => localStorage)`,
so the value survives route navigation and full page refresh.
- Initial value is empty (`""`) — there is no encode/decode flow yet
for image data URIs, so a Chuck-Norris-style placeholder would be
misleading.
- `Base64Image` now renders a full-width antd `TextArea` bound to the
store with the same monospace style and `autoSize` ranges used by
`Base64String`, keeping the Base64 tabs visually consistent.
Files changed:
- src/screens/base64/image/base64-image.store.ts (new)
- src/screens/base64/image/base64-image.store.test.ts (new)
- src/screens/base64/image/base64-image.tsx (textarea + store wiring)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* chore: merge persisted_textarea_input branch
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(orchestrator): [live_image_preview] render live image from valid data URI
Wire parseDataUri + isImageMimeType into Base64Image so a valid image
data URI in the textarea renders an <img> live on every keystroke,
constrained to the viewport.
Key decisions:
- New pure helper `getImagePreviewSrc(input)` in base64-image.utils.ts
combines parseDataUri + isImageMimeType and returns the original
data URI string when safe to render, otherwise null. Keeps the
branching logic out of the component and fully unit-testable in
a codebase with no DOM test environment.
- The helper returns null for empty, plain, malformed, non-image
(application/pdf, audio/mp3, text/plain), and image/svg+xml input.
SVG is intentionally excluded because VALID_IMAGE_TYPES in
image.utils.ts is the single source of truth for renderable image
MIME types, and SVG can carry script payloads.
- Component reads the helper synchronously on every render, so the
preview updates immediately as the user types and disappears when
the textarea is cleared — no button press required.
- Preview styled with maxWidth: "100%" and maxHeight: "60vh" plus
objectFit: "contain" so the decoded image always fits the viewport
without distortion.
Files changed:
- src/utils/base64-image.utils.ts (add getImagePreviewSrc)
- src/utils/base64-image.utils.test.ts (positive + negative cases)
- src/screens/base64/image/base64-image.tsx (wire helper + <img>)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* chore: merge live_image_preview branch
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: improve logger infos
* feat: detect agent call failure (like max tokens usage limit reached)
* feat: usage of mime to detect extension
* feat: usage of mime to detect extension
* feat: mime and datauri scheme helpers
* refactor: usage of @lichens-innovation/ts-common to apply DRY
* chore: re-organize imports and usage of new 1.18 ts-common release
* fix: remove ternary overusage
* feat(orchestrator): [non_image_uri_link] render Open-in-new-tab link for non-image data URIs
Wire a parsed-but-non-image data URI in the Base64 Image URI textarea
into an antd Alert (type=info) containing an anchor that opens the
full data URI in a new tab.
Key decisions:
- New pure helper getNonImageDataUri(input) in base64-image.utils.ts
mirrors getImagePreviewSrc but inverts the MIME check: returns the
input string when parseDataUri succeeds AND isImageMimeType is
false, otherwise null. Keeps branching out of the component and
unit-testable without a DOM environment.
- The two helpers are mutually exclusive by construction, so the
component can render the <img> preview and the Alert as independent
siblings without an extra coordinator state — image data URIs only
ever resolve the preview branch and non-image data URIs only ever
resolve the alert branch.
- Anchor uses target="_blank" plus rel="noopener noreferrer" to keep
the new tab from gaining a window.opener reference back into the app.
- SVG (image/svg+xml) is intentionally treated as a non-image URI
here, matching getImagePreviewSrc — VALID_IMAGE_TYPES in
image.utils.ts stays the single source of truth for renderable
image MIME types.
Files changed:
- src/utils/base64-image.utils.ts (add getNonImageDataUri)
- src/utils/base64-image.utils.test.ts (positive + negative cases)
- src/screens/base64/image/base64-image.tsx (wire helper + Alert link)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat(orchestrator): [metadata_card_and_download] add metadata card with download and clear toolbar
Display a metadata Description list (Resolution, MIME, Extension, Size,
Download link) below the live image preview, plus a toolbar with Clear
and Download buttons.
Key decisions:
- New pure helpers in base64-image.utils.ts:
* `getImageMetadata(input)` derives { mimeType, ext, base64,
sizeBytes, sizeFormatted } from a data URI by composing
parseDataUri + isImageMimeType + getBase64ApproxSize +
pretty-bytes. Returns null for empty / malformed / non-image
input, mirroring getImagePreviewSrc.
* `getImageDownloadFilename(ext)` builds the canonical `image.{ext}`
name in one place so the metadata link and toolbar button share
the same filename.
* `downloadImageDataUri({ dataUri, ext })` wraps downloadDataUrl so
the toolbar download stays a one-liner in the component.
- New `useImageDimensions(src)` hook returns `{ status, width,
height }` and uses `new Image()` with onload / onerror to resolve
natural dimensions. Cleanup nulls handlers so a stale image load
cannot setState on an unmounted component.
- `ResolutionValue` renders the dimensions on `loaded`, a dash on
`error`, and a `<Spin size="small" />` for any other state (idle /
loading) — since the metadata card is only mounted when there is
a real image src, idle is effectively a transient "about to load"
and showing the spinner avoids a flash of dash on first render.
- Download link uses native `<a download="image.{ext}" href={dataUri}>`
so it works without JS; the toolbar Download button calls
downloadImageDataUri with the same filename so both paths produce
identical output.
- Clear button calls `setInputText("")`, which makes `getImagePreviewSrc`
and `getImageMetadata` both return null and unmounts the preview
image, the metadata card, and disables the toolbar download.
Files changed:
- src/utils/base64-image.utils.ts (add ImageMetadata, getImageMetadata,
getImageDownloadFilename, downloadImageDataUri, loadImageDimensions)
- src/utils/base64-image.utils.test.ts (cover new helpers)
- src/screens/base64/image/use-image-dimensions.ts (new hook)
- src/screens/base64/image/use-image-dimensions.test.ts (export smoke)
- src/screens/base64/image/base64-image-metadata.tsx (Descriptions card)
- src/screens/base64/image/base64-image-metadata.test.tsx (export smoke)
- src/screens/base64/image/base64-image-toolbar.tsx (Clear / Download)
- src/screens/base64/image/base64-image-toolbar.test.tsx (export smoke)
- src/screens/base64/image/base64-image.tsx (wire metadata + toolbar)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* feat: ability to cap parallel implementers
* feat: ability to cap parallel implementers
* refactor: ai orchrestration now review only at the very end
* chore: merge metadata_card_and_download and non_image_uri_link
Merges two orchestrator branches into feat/data-uri-scheme-viewer:
- metadata_card_and_download: adds Base64ImageMetadata card (resolution,
MIME, size), Base64ImageToolbar with download/clear, and
useImageDimensions hook; adapts utils to use ts-common for
parseDataUri, isImageMimeType, mimeToExt
- non_image_uri_link: adds getNonImageDataUri helper and renders an
Alert with an open-in-new-tab link for non-image data URIs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor(base64-image): [review] fix Alert message prop and remove redundant Space wrapper
- Alert: title → message so the "Open in new tab" link renders as visible content
- Toolbar: remove the Space wrapper around the single Tooltip/Button
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: open non image data uri
* refactor: generic renaming for data-uri schemes
* chore: release 4.6.0
---------
Co-authored-by: André Masson <amwebexpert@gmail.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 099608a commit ddeea0c
156 files changed
Lines changed: 1927 additions & 1711 deletions
File tree
- .claude/hooks
- ai-orchestrator
- utils
- docs
- assets
- src
- components
- layout
- settings
- ui
- hooks
- providers
- routes
- screens
- about
- components
- base64
- data-uri
- file
- string
- coding-standards
- components
- model-loading
- hooks
- utils
- colors
- named
- picker
- common-lists
- html-entities
- http-headers
- http-status-codes
- mime-types
- csv-parser
- components
- date-converter
- results
- diff-viewer
- github-user-projects
- columns
- home
- image-ocr
- json
- converter
- formatter
- repair
- jwt-decoder
- sections
- poker-planning
- qrcode
- decoder
- generator
- options
- regex-tester
- url
- curl
- encoder
- parser
- uuid-generator
- vr-3d-viewer
- canvas
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
4 | | - | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| 48 | + | |
| 49 | + | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
50 | | - | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| 74 | + | |
69 | 75 | | |
70 | 76 | | |
71 | 77 | | |
| |||
107 | 113 | | |
108 | 114 | | |
109 | 115 | | |
110 | | - | |
| 116 | + | |
111 | 117 | | |
112 | 118 | | |
113 | 119 | | |
| |||
119 | 125 | | |
120 | 126 | | |
121 | 127 | | |
122 | | - | |
| 128 | + | |
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
| |||
129 | 135 | | |
130 | 136 | | |
131 | 137 | | |
132 | | - | |
133 | 138 | | |
134 | 139 | | |
135 | 140 | | |
136 | | - | |
137 | | - | |
138 | 141 | | |
139 | 142 | | |
140 | 143 | | |
| |||
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
165 | | - | |
166 | | - | |
| 168 | + | |
| 169 | + | |
167 | 170 | | |
168 | 171 | | |
169 | 172 | | |
170 | 173 | | |
171 | | - | |
| 174 | + | |
172 | 175 | | |
173 | | - | |
| 176 | + | |
174 | 177 | | |
175 | | - | |
| 178 | + | |
176 | 179 | | |
177 | | - | |
| 180 | + | |
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
181 | 184 | | |
182 | 185 | | |
183 | 186 | | |
184 | | - | |
| 187 | + | |
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| |||
200 | 203 | | |
201 | 204 | | |
202 | 205 | | |
203 | | - | |
| 206 | + | |
204 | 207 | | |
205 | 208 | | |
206 | 209 | | |
| |||
215 | 218 | | |
216 | 219 | | |
217 | 220 | | |
218 | | - | |
| 221 | + | |
219 | 222 | | |
220 | 223 | | |
221 | 224 | | |
| |||
225 | 228 | | |
226 | 229 | | |
227 | 230 | | |
228 | | - | |
| 231 | + | |
229 | 232 | | |
230 | | - | |
| 233 | + | |
231 | 234 | | |
232 | 235 | | |
233 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
25 | 81 | | |
26 | 82 | | |
27 | | - | |
| 83 | + | |
28 | 84 | | |
29 | 85 | | |
30 | 86 | | |
31 | 87 | | |
32 | 88 | | |
33 | 89 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
37 | 93 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
42 | 98 | | |
43 | 99 | | |
44 | | - | |
| 100 | + | |
45 | 101 | | |
46 | 102 | | |
47 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
9 | 62 | | |
10 | 63 | | |
11 | 64 | | |
| |||
40 | 93 | | |
41 | 94 | | |
42 | 95 | | |
43 | | - | |
| 96 | + | |
44 | 97 | | |
45 | 98 | | |
46 | 99 | | |
0 commit comments