@perkyzz/emvb 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/README.md +4 -0
  2. package/THIRD_PARTY_NOTICES.md +23 -1
  3. package/licenses/exif-js.LICENSE +21 -0
  4. package/licenses/fflate.LICENSE +21 -0
  5. package/licenses/glfx.js.LICENSE +19 -0
  6. package/licenses/mini-photo-editor.LICENSE +21 -0
  7. package/licenses/photocn.LICENSE +21 -0
  8. package/package.json +2 -1
  9. package/src/admin/access/RequireEditor.tsx +7 -7
  10. package/src/admin/access/role.ts +5 -2
  11. package/src/admin/content-api.ts +10 -3
  12. package/src/admin/content-item.ts +1 -1
  13. package/src/admin/editor/A11yCopilot.tsx +104 -56
  14. package/src/admin/editor/CommandPalette.tsx +29 -13
  15. package/src/admin/editor/Editor.tsx +88 -20
  16. package/src/admin/editor/EditorToasts.tsx +26 -0
  17. package/src/admin/editor/PerfMeter.tsx +97 -72
  18. package/src/admin/editor/ShareLink.tsx +107 -72
  19. package/src/admin/editor/ShortcutsDialog.tsx +27 -16
  20. package/src/admin/editor/Timeline.tsx +255 -160
  21. package/src/admin/editor/TopBar.tsx +71 -14
  22. package/src/admin/editor/canvas/CanvasFrame.tsx +10 -1
  23. package/src/admin/editor/canvas/CanvasTextEdit.tsx +8 -2
  24. package/src/admin/editor/canvas/drop-line.ts +11 -3
  25. package/src/admin/editor/canvas/frame-focus-ring.ts +37 -0
  26. package/src/admin/editor/canvas/use-canvas-dnd.ts +32 -3
  27. package/src/admin/editor/canvas/vnode-react.tsx +7 -0
  28. package/src/admin/editor/collection-previews.ts +16 -1
  29. package/src/admin/editor/dialogs.tsx +38 -14
  30. package/src/admin/editor/dnd/drop-target.ts +26 -1
  31. package/src/admin/editor/edited-noun.ts +15 -0
  32. package/src/admin/editor/editor-chrome.tsx +108 -7
  33. package/src/admin/editor/editor-commands.ts +15 -1
  34. package/src/admin/editor/editor-css.ts +75 -22
  35. package/src/admin/editor/element-chrome.ts +21 -11
  36. package/src/admin/editor/feature-css.ts +45 -13
  37. package/src/admin/editor/icons/IconLibraryDialog.tsx +52 -11
  38. package/src/admin/editor/icons/library.ts +1 -1
  39. package/src/admin/editor/icons/use-icon-library.ts +5 -2
  40. package/src/admin/editor/ime.ts +29 -0
  41. package/src/admin/editor/palette-items.ts +10 -3
  42. package/src/admin/editor/panels/AddPanel.tsx +35 -10
  43. package/src/admin/editor/panels/ClassesSection.tsx +18 -7
  44. package/src/admin/editor/panels/ColorControl.tsx +135 -27
  45. package/src/admin/editor/panels/ConditionsEditor.tsx +52 -26
  46. package/src/admin/editor/panels/ElementPanel.tsx +134 -24
  47. package/src/admin/editor/panels/LayersPanel.tsx +68 -22
  48. package/src/admin/editor/panels/PageSettings.tsx +66 -35
  49. package/src/admin/editor/panels/SiteStylesDrawer.tsx +170 -32
  50. package/src/admin/editor/panels/TokenScales.tsx +76 -36
  51. package/src/admin/editor/panels/TriggerSettings.tsx +50 -12
  52. package/src/admin/editor/panels/TriggersEditor.tsx +2 -1
  53. package/src/admin/editor/panels/VariableSection.tsx +53 -21
  54. package/src/admin/editor/panels/color-space.ts +9 -3
  55. package/src/admin/editor/panels/settings/AdvancedFields.tsx +12 -2
  56. package/src/admin/editor/panels/settings/AudienceEditor.tsx +51 -35
  57. package/src/admin/editor/panels/settings/BackgroundControls.tsx +55 -11
  58. package/src/admin/editor/panels/settings/BackgroundFill.tsx +3 -2
  59. package/src/admin/editor/panels/settings/BindingsEditor.tsx +15 -18
  60. package/src/admin/editor/panels/settings/BoxControl.tsx +2 -1
  61. package/src/admin/editor/panels/settings/ClassChip.tsx +21 -9
  62. package/src/admin/editor/panels/settings/ClassChipInput.tsx +24 -16
  63. package/src/admin/editor/panels/settings/DraftTextField.tsx +41 -3
  64. package/src/admin/editor/panels/settings/EffectsControls.tsx +38 -14
  65. package/src/admin/editor/panels/settings/FieldBindControl.tsx +46 -28
  66. package/src/admin/editor/panels/settings/FieldControl.tsx +38 -15
  67. package/src/admin/editor/panels/settings/FormBindControl.tsx +2 -2
  68. package/src/admin/editor/panels/settings/HintedSwitch.tsx +33 -0
  69. package/src/admin/editor/panels/settings/IconControls.tsx +12 -8
  70. package/src/admin/editor/panels/settings/IconPicker.tsx +2 -0
  71. package/src/admin/editor/panels/settings/ImageSourcesField.tsx +3 -1
  72. package/src/admin/editor/panels/settings/ItemList.tsx +15 -2
  73. package/src/admin/editor/panels/settings/LengthRow.tsx +8 -6
  74. package/src/admin/editor/panels/settings/MediaPicker.tsx +274 -20
  75. package/src/admin/editor/panels/settings/MotionControl.tsx +28 -15
  76. package/src/admin/editor/panels/settings/NumberRow.tsx +9 -3
  77. package/src/admin/editor/panels/settings/PanelSelect.tsx +50 -0
  78. package/src/admin/editor/panels/settings/QueryStyleRows.tsx +25 -18
  79. package/src/admin/editor/panels/settings/RequiredFieldsNotice.tsx +141 -0
  80. package/src/admin/editor/panels/settings/StyleRow.tsx +10 -3
  81. package/src/admin/editor/panels/settings/StyleSources.tsx +4 -1
  82. package/src/admin/editor/panels/settings/VariantEditor.tsx +10 -1
  83. package/src/admin/editor/panels/settings/box-link-name.ts +6 -2
  84. package/src/admin/editor/panels/settings/class-suggest.ts +7 -7
  85. package/src/admin/editor/panels/settings/query-style.ts +38 -9
  86. package/src/admin/editor/panels/settings/svg-images.ts +13 -0
  87. package/src/admin/editor/panels/site-list.tsx +20 -6
  88. package/src/admin/editor/panels/variable-values.ts +25 -4
  89. package/src/admin/editor/restore-deleted.ts +21 -2
  90. package/src/admin/editor/section-templates.ts +81 -12
  91. package/src/admin/editor/shortcuts.ts +17 -2
  92. package/src/admin/editor/store.ts +14 -3
  93. package/src/admin/editor/useEditorCommands.ts +61 -15
  94. package/src/admin/editor/useEditorData.ts +4 -2
  95. package/src/admin/editor/useEditorShortcuts.ts +17 -7
  96. package/src/admin/editor/useNodeActions.ts +61 -6
  97. package/src/admin/editor/useSave.ts +22 -7
  98. package/src/admin/forms-api.ts +2 -0
  99. package/src/admin/image-editor/BlurFocus.tsx +112 -0
  100. package/src/admin/image-editor/Canvas.tsx +261 -0
  101. package/src/admin/image-editor/CropOverlay.tsx +390 -0
  102. package/src/admin/image-editor/CurvesPanel.tsx +395 -0
  103. package/src/admin/image-editor/ExportDialog.tsx +384 -0
  104. package/src/admin/image-editor/ImageEditButton.tsx +83 -0
  105. package/src/admin/image-editor/ImageEditorDialog.tsx +828 -0
  106. package/src/admin/image-editor/MetadataPanel.tsx +194 -0
  107. package/src/admin/image-editor/announce.tsx +65 -0
  108. package/src/admin/image-editor/crop-geometry.ts +162 -0
  109. package/src/admin/image-editor/curve-math.ts +177 -0
  110. package/src/admin/image-editor/data-url-fetch.ts +59 -0
  111. package/src/admin/image-editor/engine.ts +55 -0
  112. package/src/admin/image-editor/exif.ts +82 -0
  113. package/src/admin/image-editor/flatten.ts +54 -0
  114. package/src/admin/image-editor/gpu-fit.ts +81 -0
  115. package/src/admin/image-editor/image-editor-css.ts +400 -0
  116. package/src/admin/image-editor/load.ts +116 -0
  117. package/src/admin/image-editor/panels.tsx +287 -0
  118. package/src/admin/image-editor/parts.tsx +614 -0
  119. package/src/admin/image-editor/save.ts +141 -0
  120. package/src/admin/image-editor/tone-panels.tsx +338 -0
  121. package/src/admin/image-editor/tools.ts +59 -0
  122. package/src/admin/image-editor/worker.ts +111 -0
  123. package/src/admin/media-api.ts +114 -3
  124. package/src/admin/pages/AgentsPage.tsx +138 -27
  125. package/src/admin/pages/CreateDialog.tsx +97 -30
  126. package/src/admin/pages/NewPageDialog.tsx +21 -3
  127. package/src/admin/pages/NewThemePartDialog.tsx +11 -3
  128. package/src/admin/pages/PageList.tsx +14 -6
  129. package/src/admin/pages/SetupShell.tsx +28 -12
  130. package/src/admin/pages/ThemePartList.tsx +27 -7
  131. package/src/admin/pages/list-kit.tsx +106 -24
  132. package/src/admin/search.ts +15 -0
  133. package/src/admin/setup/useSetupStatus.ts +1 -1
  134. package/src/admin/theme-api.ts +13 -3
  135. package/src/admin/ui.ts +78 -22
  136. package/src/astro/EmVBPage.astro +11 -2
  137. package/src/astro/floats/runtime.ts +21 -0
  138. package/src/astro/menu/runtime.ts +34 -1
  139. package/src/astro/popups/runtime.ts +33 -3
  140. package/src/astro/render.ts +6 -0
  141. package/src/astro/resolve-theme.ts +67 -14
  142. package/src/astro/resolve.ts +9 -1
  143. package/src/astro/tabs/runtime.ts +12 -0
  144. package/src/astro/theme-posts.ts +2 -2
  145. package/src/astro/visitor.ts +6 -3
  146. package/src/constants.ts +1 -1
  147. package/src/core/a11y/audit.ts +171 -24
  148. package/src/core/arrange.ts +29 -6
  149. package/src/core/audience/rules.ts +5 -1
  150. package/src/core/audience/variants.ts +29 -3
  151. package/src/core/clipboard.ts +7 -0
  152. package/src/core/css/generate.ts +31 -6
  153. package/src/core/data/bindings.ts +19 -6
  154. package/src/core/design/classes.ts +20 -9
  155. package/src/core/design/diff.ts +9 -1
  156. package/src/core/design/merge.ts +93 -3
  157. package/src/core/design/tokens.ts +16 -2
  158. package/src/core/design/transfer.ts +46 -8
  159. package/src/core/design/variables.ts +32 -10
  160. package/src/core/elements/dynamic-elements.ts +53 -6
  161. package/src/core/elements/form-elements.ts +68 -30
  162. package/src/core/elements/index.ts +83 -38
  163. package/src/core/elements/menu.ts +37 -19
  164. package/src/core/elements/plain-text.ts +2 -2
  165. package/src/core/elements/select-prompt.ts +3 -0
  166. package/src/core/elements/svg-ids.ts +39 -0
  167. package/src/core/forms/binding.ts +190 -2
  168. package/src/core/forms/definition.ts +72 -0
  169. package/src/core/history/diff.ts +49 -4
  170. package/src/core/icons/catalog.ts +3 -2
  171. package/src/core/image-edit/schema.ts +155 -0
  172. package/src/core/image-edit/summary.ts +61 -0
  173. package/src/core/index.ts +29 -1
  174. package/src/core/limits.ts +21 -0
  175. package/src/core/migrate/index.ts +3 -1
  176. package/src/core/perf/meter.ts +51 -8
  177. package/src/core/recipes/index.ts +5 -4
  178. package/src/core/render/context.ts +8 -0
  179. package/src/core/render/dynamic-post.ts +71 -13
  180. package/src/core/render/extras.ts +77 -4
  181. package/src/core/render/form.ts +164 -12
  182. package/src/core/render/index.ts +179 -22
  183. package/src/core/render/loop.ts +43 -7
  184. package/src/core/render/pagination.ts +18 -4
  185. package/src/core/render/section.ts +27 -0
  186. package/src/core/render/tabs.ts +12 -3
  187. package/src/core/render/vnode.ts +1 -1
  188. package/src/core/sanitize/css.ts +15 -2
  189. package/src/core/sanitize/embed-url.ts +42 -5
  190. package/src/core/sanitize/url.ts +2 -1
  191. package/src/core/schema/layout.ts +26 -7
  192. package/src/core/share/link.ts +5 -2
  193. package/src/core/stable-json.ts +15 -0
  194. package/src/core/stats.ts +2 -1
  195. package/src/core/theme/conditions.ts +3 -1
  196. package/src/core/theme/dynamic.ts +57 -23
  197. package/src/core/theme/float.ts +9 -2
  198. package/src/core/theme/pagination.ts +57 -10
  199. package/src/core/theme/popup-markup.ts +23 -5
  200. package/src/core/theme/popup-rules.ts +11 -5
  201. package/src/core/theme/triggers.ts +3 -2
  202. package/src/core/tree-ops.ts +27 -0
  203. package/src/mcp/ports.ts +8 -1
  204. package/src/mcp/rate-limit.ts +2 -1
  205. package/src/mcp/read.ts +82 -3
  206. package/src/mcp/refs.ts +18 -0
  207. package/src/mcp/tools.ts +1 -1
  208. package/src/mcp/write.ts +271 -25
  209. package/src/server/agent-settings.ts +29 -4
  210. package/src/server/hooks.ts +5 -3
  211. package/src/server/icon-routes.ts +33 -9
  212. package/src/server/mcp-routes.ts +74 -11
package/README.md CHANGED
@@ -6,6 +6,10 @@ A visual page builder plugin for [EmDash CMS](https://github.com/emdash-cms/emda
6
6
 
7
7
  ![The EmVB editor](https://raw.githubusercontent.com/PerkyZZ999/EmVB/main/site/public/screenshots/editor-1600.webp)
8
8
 
9
+ ## Image editor
10
+
11
+ Library pictures can be cropped, adjusted, filtered and saved as a new media item from Image settings, the media library and the command palette. See [the image editor guide](../../docs/guides/image-editor.md). Third-party notices for the editor engine are in [`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md).
12
+
9
13
  ## Install
10
14
 
11
15
  ```bash
@@ -1,6 +1,8 @@
1
1
  # Third-party notices
2
2
 
3
- EmVB (<https://emvb.dev>) is MIT licensed. The editor's **Icon library** (`@perkyzz/emvb-icons`, the JSON sets) contains icons from the projects below. They keep their own licenses, copied in full in [`licenses/`](licenses/). `scripts/build-icon-sets.ts` in the EmVB repository builds the set files from the pinned npm packages. It refuses to build when a package's license file changes.
3
+ EmVB (<https://emvb.dev>) is MIT licensed. It includes or depends on the projects below, which keep their own licenses, copied in full in [`licenses/`](licenses/): the icon sets (Lucide, Font Awesome Free, Tabler, Remix) and the image editor's engine (photocn and the code photocn includes: mini-photo-editor, glfx.js and exif-js; and its dependency fflate).
4
+
5
+ The editor's **Icon library** (`@perkyzz/emvb-icons`, the JSON sets) contains icons from the projects below. They keep their own licenses, copied in full in [`licenses/`](licenses/). `scripts/build-icon-sets.ts` in the EmVB repository builds the set files from the pinned npm packages. It refuses to build when a package's license file changes.
4
6
 
5
7
  Changes made to every set: the SVG markup is reformatted into compact JSON, and only elements and attributes in EmVB's SVG allowlist are kept. Class attributes and comments are removed. Shared presentation attributes (stroke or fill, viewBox) move to the root `<svg>`. Set-specific changes are listed with each set.
6
8
 
@@ -30,3 +32,23 @@ When an editor picks an icon, its SVG is stored with the page and shown inline o
30
32
  - Package: `remixicon` 4.8.0, <https://remixicon.com>. 4.8.0 is the last release under Apache-2.0; 4.9.0 moved to the custom "Remix Icon License v1.0", which forbids competing icon libraries, so EmVB stays on 4.8.0.
31
33
  - License: Apache License 2.0, Copyright (c) Remix Design. Full text: [`licenses/remixicon.LICENSE`](licenses/remixicon.LICENSE).
32
34
  - Changes (Apache-2.0 §4(b)): path coordinates are rounded to two decimals. All Remix paths use absolute commands, so the error stays under 0.005 units on the 24-unit grid. The icon files are not otherwise modified.
35
+
36
+ ## photocn
37
+
38
+ - Package: `photocn` 0.1.2 (the image editor's engine, loaded only when the image editor opens), <https://photocn.dev>, <https://github.com/rbbydotdev/photocn>
39
+ - License: MIT, Copyright (c) 2026 rbbydotdev. Full text: [`licenses/photocn.LICENSE`](licenses/photocn.LICENSE).
40
+ - The image editor's layout and interactions are ported from photocn's shadcn editor components (`apps/www/src/registry/image-editor`: the editor, desktop and compact layouts, toolbar, canvas, crop overlay, crop panel, adjustments, filters, curves and blur panels, blur center overlay, panel header, histogram, the perspective icon, the export dialog and the metadata panel). Changes: rebuilt with Kumo components, Phosphor icons and EmVB's CSS tokens instead of shadcn/ui, Tailwind and Lucide; opening files and recipes left out; typed slider values, curve-point Input/Output fields and keyboard control of curve points and the blur spot added; the export dialog gets EmVB defaults (WebP 85 %, a 2560 px cap, removing a JPEG's GPS location) and saves to the media library. Each ported file names its source.
41
+ - The quarter-turn icons in the crop panel are Lucide's `rotate-ccw-square` and `rotate-cw-square` (ISC, see Lucide above).
42
+
43
+ ### Included in photocn
44
+
45
+ photocn's own [`THIRD_PARTY_NOTICES.md`](https://github.com/rbbydotdev/photocn) lists code it carries from these MIT projects. EmVB ships them only inside the lazy image editor chunk and its worker; published pages never load them.
46
+
47
+ - **mini-photo-editor**, <https://github.com/xdadda/mini-photo-editor>: photocn's WebGL renderer and filters, EXIF/ICC reading and the filter LUT textures, and the perspective "adjust corners" icon EmVB uses (`parts.tsx`). MIT, Copyright (c) 2025 xdadda. Full text: [`licenses/mini-photo-editor.LICENSE`](licenses/mini-photo-editor.LICENSE).
48
+ - **glfx.js**, <https://github.com/evanw/glfx.js>: the texture and shader core of photocn's renderer (via mini-photo-editor). MIT, Copyright (C) 2011 by Evan Wallace. Full text: [`licenses/glfx.js.LICENSE`](licenses/glfx.js.LICENSE).
49
+ - **exif-js**, <https://github.com/exif-js/exif-js>: EXIF parsing (via mini-photo-editor), shown in the Metadata tool. MIT, Copyright (c) 2008 Jacob Seidelin. Full text: [`licenses/exif-js.LICENSE`](licenses/exif-js.LICENSE).
50
+
51
+ ### fflate
52
+
53
+ - Package: `fflate` 0.8.3 (a dependency of photocn, installed with it), <https://github.com/101arrowz/fflate>
54
+ - License: MIT, Copyright (c) 2026 Arjun Barrett. Full text: [`licenses/fflate.LICENSE`](licenses/fflate.LICENSE).
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2008 Jacob Seidelin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Arjun Barrett
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2011 by Evan Wallace
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 xdadda
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rbbydotdev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perkyzz/emvb",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Visual page builder plugin for EmDash CMS",
5
5
  "keywords": [
6
6
  "astro",
@@ -50,6 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@perkyzz/emvb-icons": "0.1.1",
53
+ "photocn": "0.1.2",
53
54
  "zod": "~4.5.4"
54
55
  },
55
56
  "devDependencies": {
@@ -1,7 +1,8 @@
1
- import { Banner, Empty, Loader } from "@cloudflare/kumo";
2
- import { LockKeyIcon, WarningCircleIcon } from "@phosphor-icons/react";
1
+ import { Empty } from "@cloudflare/kumo";
2
+ import { LockKeyIcon } from "@phosphor-icons/react";
3
3
  import type * as React from "react";
4
4
  import type { Fetcher } from "../api.ts";
5
+ import { ListError, LoadingStatus } from "../pages/list-kit.tsx";
5
6
  import { canUseEmvb, useRole } from "./role.ts";
6
7
 
7
8
  /** Renders `children` for editors and above, and a "no access" state below (D-020, D-024). */
@@ -13,14 +14,13 @@ export function RequireEditor({
13
14
  children: (role: number) => React.ReactNode;
14
15
  }) {
15
16
  const status = useRole(fetcher);
16
- if (status.state === "loading") return <Loader />;
17
+ if (status.state === "loading") return <LoadingStatus label="Checking your access…" />;
17
18
  if (status.state === "error") {
18
19
  return (
19
- <Banner
20
- variant="error"
21
- icon={<WarningCircleIcon aria-hidden="true" />}
20
+ <ListError
22
21
  title="Couldn't check your access to EmVB"
23
- description={status.message}
22
+ message={status.message}
23
+ onRetry={status.retry}
24
24
  />
25
25
  );
26
26
  }
@@ -19,12 +19,14 @@ export const canUseEmvb = (role: number) => role >= EDITOR_ROLE;
19
19
  type RoleState =
20
20
  | { state: "loading" }
21
21
  | { state: "ready"; role: number }
22
- | { state: "error"; message: string };
22
+ | { state: "error"; message: string; retry: () => void };
23
23
 
24
24
  export function useRole(fetcher: Fetcher): RoleState {
25
25
  const [status, setStatus] = React.useState<RoleState>({ state: "loading" });
26
+ const [attempt, setAttempt] = React.useState(0);
26
27
  React.useEffect(() => {
27
28
  let active = true;
29
+ setStatus({ state: "loading" });
28
30
  readRole(fetcher).then(
29
31
  (role) => active && setStatus({ state: "ready", role }),
30
32
  (error: unknown) =>
@@ -32,11 +34,12 @@ export function useRole(fetcher: Fetcher): RoleState {
32
34
  setStatus({
33
35
  state: "error",
34
36
  message: error instanceof Error ? error.message : String(error),
37
+ retry: () => setAttempt((n) => n + 1),
35
38
  }),
36
39
  );
37
40
  return () => {
38
41
  active = false;
39
42
  };
40
- }, [fetcher]);
43
+ }, [fetcher, attempt]);
41
44
  return status;
42
45
  }
@@ -88,8 +88,10 @@ export function canonicalProblem(value: string): string | null {
88
88
  function seoBody(draft: PageDraft) {
89
89
  const canonical = draft.seoCanonical;
90
90
  return {
91
- title: draft.seoTitle || null,
92
- description: draft.seoDescription || null,
91
+ // W-663: a title or description of only spaces was saved as is, so search results and
92
+ // link previews showed a blank title instead of falling back to the page's own.
93
+ title: draft.seoTitle.trim() || null,
94
+ description: draft.seoDescription.trim() || null,
93
95
  ...(canonical !== undefined && !canonicalProblem(canonical)
94
96
  ? { canonical: canonical.trim() || null }
95
97
  : {}),
@@ -111,7 +113,12 @@ export async function savePage(
111
113
  {
112
114
  method: "PUT",
113
115
  body: {
114
- data: { title: draft.title, layout: draft.layout, canvas_mode: draft.canvasMode },
116
+ data: {
117
+ title: draft.title,
118
+ // UX-094: a page with no layout yet leaves the field alone; the server refuses null.
119
+ ...(draft.layout ? { layout: draft.layout } : {}),
120
+ canvas_mode: draft.canvasMode,
121
+ },
115
122
  slug: draft.slug,
116
123
  seo: seoBody(draft),
117
124
  ...(rev ? { _rev: rev } : {}),
@@ -18,5 +18,5 @@ export type ContentItem = {
18
18
  /** The stored title, or `fallback` when it is missing or blank. */
19
19
  export function titleOf(item: ContentItem, fallback: string): string {
20
20
  const title = item.data?.["title"];
21
- return typeof title === "string" && title ? title : fallback;
21
+ return typeof title === "string" && title.trim() ? title : fallback;
22
22
  }
@@ -1,4 +1,6 @@
1
1
  import { Button, Dialog } from "@cloudflare/kumo";
2
+ import { WarningCircleIcon, WarningIcon } from "@phosphor-icons/react";
3
+ import * as React from "react";
2
4
  import {
3
5
  applyA11yFix,
4
6
  applyAllA11yFixes,
@@ -7,6 +9,7 @@ import {
7
9
  type Layout,
8
10
  } from "../../core/index.ts";
9
11
  import { ELEMENT_NAMES } from "./element-chrome.ts";
12
+ import { BUTTON, SOLID_PRIMARY } from "../ui.ts";
10
13
 
11
14
  /** Score bands for the badge colour (W-317). */
12
15
  const scoreBand = (score: number) => (score >= 90 ? "good" : score >= 70 ? "fair" : "poor");
@@ -53,6 +56,25 @@ export function A11yDialog({
53
56
  onApply: (layout: Layout, note: string) => void;
54
57
  }) {
55
58
  const fixable = report.issues.filter((issue) => issue.fix);
59
+ // W-833: a fixed issue leaves the list with its focused Fix button, so focus fell back to the
60
+ // dialog itself. Move it to the next fix, else Fix all, else Close.
61
+ const refocusAfterFix = React.useRef(false);
62
+ React.useEffect(() => {
63
+ if (!refocusAfterFix.current) return;
64
+ refocusAfterFix.current = false;
65
+ const body = document.querySelector<HTMLElement>('[data-emvb-dialog="a11y"]');
66
+ const active = document.activeElement;
67
+ if (active instanceof HTMLElement && active !== body && body?.contains(active)) return;
68
+ const next =
69
+ body?.querySelector<HTMLElement>("[data-emvb-a11y-fix]") ??
70
+ body?.querySelector<HTMLElement>("[data-emvb-a11y-fix-all]") ??
71
+ body?.querySelector<HTMLElement>("[data-emvb-a11y-close]");
72
+ next?.focus();
73
+ });
74
+ const apply = (next: Layout, note: string) => {
75
+ refocusAfterFix.current = true;
76
+ onApply(next, note);
77
+ };
56
78
  const name = (id: string) => {
57
79
  const node = layout ? findNode(layout, id) : undefined;
58
80
  if (!node) return "Element";
@@ -62,63 +84,89 @@ export function A11yDialog({
62
84
  return (
63
85
  <Dialog.Root open={open} onOpenChange={onOpenChange}>
64
86
  <Dialog size="base" className="p-6 emvb-a11y" data-emvb-a11y="">
65
- <Dialog.Title>
66
- Accessibility · <span data-band={scoreBand(report.score)}>{report.score}</span>/100
67
- </Dialog.Title>
68
- {report.issues.length === 0 ? (
69
- <p className="emvb-helper" data-emvb-a11y-clean="">
70
- No issues found. Automated checks catch some problems, not all: try the page with a
71
- keyboard and a screen reader too.
72
- </p>
73
- ) : (
74
- <ul className="emvb-a11y-issues">
75
- {report.issues.map((issue) => (
76
- <li key={issue.id} data-emvb-a11y-issue={issue.id} data-severity={issue.severity}>
77
- <span className="emvb-a11y-what">
78
- <button
79
- type="button"
80
- className="emvb-link-button"
81
- onClick={() => {
82
- onSelect(issue.nodeId);
83
- onOpenChange(false);
84
- }}
85
- >
86
- {name(issue.nodeId)}
87
- </button>
88
- : {issue.message}
89
- </span>
90
- {issue.fix && layout && (
91
- <Button
92
- variant="secondary"
93
- size="sm"
94
- data-emvb-a11y-fix={issue.id}
95
- onClick={() =>
96
- onApply(applyA11yFix(layout, issue), `Fixed: ${issue.fixLabel ?? "issue"}`)
97
- }
98
- >
99
- {issue.fixLabel ?? "Fix"}
100
- </Button>
101
- )}
102
- </li>
103
- ))}
104
- </ul>
105
- )}
106
- <div className="emvb-a11y-actions">
107
- {fixable.length > 1 && layout && (
108
- <Button
109
- variant="primary"
110
- data-emvb-a11y-fix-all=""
111
- onClick={() =>
112
- onApply(
113
- applyAllA11yFixes(layout, fixable),
114
- `Fixed ${fixable.length} accessibility issues`,
115
- )
116
- }
117
- >
118
- Fix all {fixable.length}
119
- </Button>
87
+ <div className="emvb-dialog" data-emvb-dialog="a11y">
88
+ <Dialog.Title>
89
+ Accessibility · <span data-band={scoreBand(report.score)}>{report.score}</span>/100
90
+ </Dialog.Title>
91
+ {report.issues.length === 0 ? (
92
+ <p className="emvb-helper" data-emvb-a11y-clean="">
93
+ No issues found. Automated checks catch some problems, not all: try the page with a
94
+ keyboard and a screen reader too.
95
+ </p>
96
+ ) : (
97
+ <ul className="emvb-a11y-issues">
98
+ {report.issues.map((issue) => (
99
+ <li key={issue.id} data-emvb-a11y-issue={issue.id} data-severity={issue.severity}>
100
+ {/* UX-022: severity has a shape and a name, not only the bar's colour. */}
101
+ {issue.severity === "error" ? (
102
+ <WarningCircleIcon
103
+ className="emvb-a11y-severity"
104
+ size={16}
105
+ role="img"
106
+ aria-label="Error"
107
+ />
108
+ ) : (
109
+ <WarningIcon
110
+ className="emvb-a11y-severity"
111
+ size={16}
112
+ role="img"
113
+ aria-label="Warning"
114
+ />
115
+ )}
116
+ <span className="emvb-a11y-what">
117
+ <button
118
+ type="button"
119
+ className="emvb-link-button"
120
+ onClick={() => {
121
+ onSelect(issue.nodeId);
122
+ onOpenChange(false);
123
+ }}
124
+ >
125
+ {name(issue.nodeId)}
126
+ </button>
127
+ : {issue.message}
128
+ </span>
129
+ {issue.fix && layout && (
130
+ <Button
131
+ variant="secondary"
132
+ className={BUTTON}
133
+ data-emvb-a11y-fix={issue.id}
134
+ onClick={() =>
135
+ apply(applyA11yFix(layout, issue), `Fixed: ${issue.fixLabel ?? "issue"}`)
136
+ }
137
+ >
138
+ {issue.fixLabel ?? "Fix"}
139
+ </Button>
140
+ )}
141
+ </li>
142
+ ))}
143
+ </ul>
120
144
  )}
121
- <Dialog.Close render={(props) => <Button {...props}>Close</Button>} />
145
+ <div className="emvb-a11y-actions">
146
+ <Dialog.Close
147
+ render={(props) => (
148
+ <Button {...props} variant="secondary" className={BUTTON} data-emvb-a11y-close="">
149
+ Close
150
+ </Button>
151
+ )}
152
+ />
153
+ {fixable.length > 1 && layout && (
154
+ <Button
155
+ variant="primary"
156
+ className={BUTTON}
157
+ style={SOLID_PRIMARY}
158
+ data-emvb-a11y-fix-all=""
159
+ onClick={() =>
160
+ apply(
161
+ applyAllA11yFixes(layout, fixable),
162
+ `Fixed ${fixable.length} accessibility issues`,
163
+ )
164
+ }
165
+ >
166
+ Fix {fixable.length} issues
167
+ </Button>
168
+ )}
169
+ </div>
122
170
  </div>
123
171
  </Dialog>
124
172
  </Dialog.Root>
@@ -1,6 +1,7 @@
1
1
  import { Dialog } from "@cloudflare/kumo";
2
2
  import * as React from "react";
3
3
  import { filterPalette, type PaletteItem } from "./palette.ts";
4
+ import { isCommitEnter } from "./ime.ts";
4
5
 
5
6
  /**
6
7
  * Ctrl/Cmd+K (W-314): one box to insert an element, jump to a layer, apply a class, or run an
@@ -17,10 +18,12 @@ export function CommandPalette({
17
18
  }) {
18
19
  const [query, setQuery] = React.useState("");
19
20
  const [active, setActive] = React.useState(0);
20
- const listRef = React.useRef<HTMLUListElement>(null);
21
21
  // W-399: opened from a shortcut there is no trigger to return to, so focus fell to <body> on
22
22
  // close. Remember what had focus and go back to it when nothing else took focus.
23
23
  const wasOpen = React.useRef(false);
24
+ // A focus return still waiting when the palette goes away must not move focus later (W-533).
25
+ const settleTimer = React.useRef<number | undefined>(undefined);
26
+ React.useEffect(() => () => window.clearTimeout(settleTimer.current), []);
24
27
  const returnTo = React.useRef<HTMLElement | null>(null);
25
28
  if (open && !wasOpen.current && typeof document !== "undefined") {
26
29
  const focused = document.activeElement;
@@ -31,6 +34,7 @@ export function CommandPalette({
31
34
  const restoreFocus = (afterCommand = false) => {
32
35
  // The dialog lets go of focus only once its close animation ends, so wait for that.
33
36
  const started = Date.now();
37
+ window.clearTimeout(settleTimer.current);
34
38
  const settle = () => {
35
39
  const now = document.activeElement;
36
40
  // Kumo's Dialog doesn't pass data attributes through; find the palette by its input.
@@ -38,7 +42,7 @@ export function CommandPalette({
38
42
  const inPalette = now?.closest('[role="dialog"]')?.querySelector("[data-emvb-palette-input]");
39
43
  if (now && now !== document.body && !inPalette) return;
40
44
  if (stillOpen && Date.now() - started < 2000) {
41
- setTimeout(settle, 30);
45
+ settleTimer.current = window.setTimeout(settle, 30);
42
46
  return;
43
47
  }
44
48
  const selected = document.querySelector<HTMLElement>(
@@ -50,7 +54,7 @@ export function CommandPalette({
50
54
  document.querySelector<HTMLElement>("iframe[data-emvb-canvas]");
51
55
  target?.focus({ preventScroll: true });
52
56
  };
53
- setTimeout(settle, 30);
57
+ settleTimer.current = window.setTimeout(settle, 30);
54
58
  };
55
59
  const close = (next: boolean) => {
56
60
  onOpenChange(next);
@@ -64,11 +68,15 @@ export function CommandPalette({
64
68
  }, [open]);
65
69
  const shown = React.useMemo(() => filterPalette(items, query), [items, query]);
66
70
  const current = Math.min(active, Math.max(0, shown.length - 1));
67
- React.useEffect(() => {
68
- listRef.current
69
- ?.querySelector<HTMLElement>(`[data-index="${current}"]`)
70
- ?.scrollIntoView?.({ block: "nearest" });
71
- }, [current]);
71
+ const scrollSelected = React.useCallback(
72
+ (list: HTMLUListElement | null) => {
73
+ if (!shown[current]) return;
74
+ list
75
+ ?.querySelector<HTMLElement>(`[data-index="${current}"]`)
76
+ ?.scrollIntoView?.({ block: "nearest" });
77
+ },
78
+ [current, shown],
79
+ );
72
80
  const run = (item: PaletteItem | undefined) => {
73
81
  if (!item) return;
74
82
  onOpenChange(false);
@@ -83,7 +91,7 @@ export function CommandPalette({
83
91
  event.preventDefault();
84
92
  const step = event.key === "ArrowDown" ? 1 : -1;
85
93
  setActive((current + step + shown.length) % Math.max(1, shown.length));
86
- } else if (event.key === "Enter") {
94
+ } else if (isCommitEnter(event)) {
87
95
  event.preventDefault();
88
96
  run(shown[current]);
89
97
  } else if (event.key === "Home" && event.ctrlKey) {
@@ -94,7 +102,9 @@ export function CommandPalette({
94
102
  return (
95
103
  <Dialog.Root open={open} onOpenChange={close}>
96
104
  <Dialog size="base" className="emvb-palette" data-emvb-palette="">
97
- <Dialog.Title className="sr-only">Command palette</Dialog.Title>
105
+ <Dialog.Title className="sr-only" data-emvb-dialog="palette">
106
+ Command palette
107
+ </Dialog.Title>
98
108
  <input
99
109
  className="emvb-palette-input"
100
110
  role="combobox"
@@ -112,7 +122,12 @@ export function CommandPalette({
112
122
  }}
113
123
  onKeyDown={onKeyDown}
114
124
  />
115
- <ul className="emvb-palette-list" id="emvb-palette-list" role="listbox" ref={listRef}>
125
+ <ul
126
+ className="emvb-palette-list"
127
+ id="emvb-palette-list"
128
+ role="listbox"
129
+ ref={scrollSelected}
130
+ >
116
131
  {shown.length === 0 && (
117
132
  <li className="emvb-palette-empty" role="presentation">
118
133
  Nothing matches “{query}”.
@@ -141,8 +156,9 @@ export function CommandPalette({
141
156
  >
142
157
  <span className="emvb-palette-label">{item.label}</span>
143
158
  <span className="emvb-palette-hint">
144
- {query.trim() ? item.group : ""}
145
- {item.hint ? ` ${item.hint}` : ""}
159
+ {query.trim() ? <span className="emvb-palette-kind">{item.group}</span> : null}
160
+ {query.trim() && item.hint ? " " : null}
161
+ {item.hint ? <span className="emvb-palette-detail">{item.hint}</span> : null}
146
162
  </span>
147
163
  </li>
148
164
  </React.Fragment>