domma-cms 1.76.0 → 1.78.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 (114) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/admin/js/lib/shortcode-registry.js +1 -1
  3. package/admin/js/lib/site-settings-arrange.js +3 -3
  4. package/admin/js/templates/docs/usage-shortcodes-content.html +3 -2
  5. package/admin/js/templates/settings.html +26 -0
  6. package/admin/js/views/settings.js +3 -3
  7. package/docs/DommaFeatures.md +2 -2
  8. package/docs/markdown-shortcodes.md +18 -3
  9. package/docs/screenshots/email-branding-gallery.png +0 -0
  10. package/docs/screenshots/email-branding-waypoint.png +0 -0
  11. package/package.json +1 -1
  12. package/plugins/_lib/admin/mail/body-menu.js +1 -1
  13. package/plugins/_lib/admin/mail/cms-host.js +1 -1
  14. package/plugins/_lib/admin/mail/compose-window.js +1 -1
  15. package/plugins/_lib/admin/mail/contacts.js +1 -1
  16. package/plugins/_lib/admin/mail/diagnostics-section.js +1 -1
  17. package/plugins/_lib/admin/mail/drag-drop.js +1 -1
  18. package/plugins/_lib/admin/mail/folder-tree.js +1 -1
  19. package/plugins/_lib/admin/mail/font-controls.js +1 -1
  20. package/plugins/_lib/admin/mail/fonts.js +1 -1
  21. package/plugins/_lib/admin/mail/host-context.js +1 -1
  22. package/plugins/_lib/admin/mail/identity.js +1 -1
  23. package/plugins/_lib/admin/mail/image-senders-section.js +1 -1
  24. package/plugins/_lib/admin/mail/keyboard.js +1 -1
  25. package/plugins/_lib/admin/mail/mail.html +1 -1
  26. package/plugins/_lib/admin/mail/message-actions.js +1 -1
  27. package/plugins/_lib/admin/mail/oauth-panel.js +1 -1
  28. package/plugins/_lib/admin/mail/panes.js +1 -1
  29. package/plugins/_lib/admin/mail/reader-kit.js +1 -1
  30. package/plugins/_lib/admin/mail/reader-runtime.js +1 -1
  31. package/plugins/_lib/admin/mail/reader-view.js +1 -1
  32. package/plugins/_lib/admin/mail/resizable.js +1 -1
  33. package/plugins/_lib/admin/mail/restore-spam.js +1 -1
  34. package/plugins/_lib/admin/mail/rules.js +1 -1
  35. package/plugins/_lib/admin/mail/scheduling.js +1 -1
  36. package/plugins/_lib/admin/mail/section-kit.js +1 -1
  37. package/plugins/_lib/admin/mail/security-note.js +1 -1
  38. package/plugins/_lib/admin/mail/settings-section.js +1 -1
  39. package/plugins/_lib/admin/mail/templates.js +1 -1
  40. package/plugins/_lib/admin/mail/threads.js +1 -1
  41. package/plugins/_lib/admin/mail/vacation.js +1 -1
  42. package/plugins/_lib/admin/mail/when-closed.js +1 -1
  43. package/plugins/_lib/admin/ui/dates.js +1 -1
  44. package/plugins/_lib/admin/ui/resizable.js +1 -1
  45. package/plugins/_lib/admin/ui/rich-field.js +1 -1
  46. package/plugins/_lib/domma-mail.lock.json +83 -83
  47. package/plugins/_lib/mail/accountFileStore.js +1 -1
  48. package/plugins/_lib/mail/accountRepository.js +1 -1
  49. package/plugins/_lib/mail/accountRoutes.js +1 -1
  50. package/plugins/_lib/mail/bodyTokenProvider.js +1 -1
  51. package/plugins/_lib/mail/bodyTokens.js +1 -1
  52. package/plugins/_lib/mail/compose.js +1 -1
  53. package/plugins/_lib/mail/defaults.js +1 -1
  54. package/plugins/_lib/mail/envelope.js +1 -1
  55. package/plugins/_lib/mail/folderActions.js +1 -1
  56. package/plugins/_lib/mail/folderRuntime.js +1 -1
  57. package/plugins/_lib/mail/folders.js +1 -1
  58. package/plugins/_lib/mail/imapPoolRuntime.js +1 -1
  59. package/plugins/_lib/mail/mbox.js +1 -1
  60. package/plugins/_lib/mail/message-action.js +1 -1
  61. package/plugins/_lib/mail/messageSecurity.js +1 -1
  62. package/plugins/_lib/mail/messageSecurityProvider.js +1 -1
  63. package/plugins/_lib/mail/networkAddresses.js +1 -1
  64. package/plugins/_lib/mail/networkPolicy.js +1 -1
  65. package/plugins/_lib/mail/oauthAccounts.js +1 -1
  66. package/plugins/_lib/mail/oauthRouteRuntime.js +1 -1
  67. package/plugins/_lib/mail/oauthRuntime.js +1 -1
  68. package/plugins/_lib/mail/pollSchedule.js +1 -1
  69. package/plugins/_lib/mail/poller.js +1 -1
  70. package/plugins/_lib/mail/pollerRuntime.js +1 -1
  71. package/plugins/_lib/mail/priority.js +1 -1
  72. package/plugins/_lib/mail/publicMailbox.js +1 -1
  73. package/plugins/_lib/mail/readRuntime.js +1 -1
  74. package/plugins/_lib/mail/render.js +1 -1
  75. package/plugins/_lib/mail/ruleRunner.js +1 -1
  76. package/plugins/_lib/mail/schedulerRuntime.js +1 -1
  77. package/plugins/_lib/mail/secretProvider.js +1 -1
  78. package/plugins/_lib/mail/secretbox.js +1 -1
  79. package/plugins/_lib/mail/senderAuth.js +1 -1
  80. package/plugins/_lib/mail/sieve.js +1 -1
  81. package/plugins/_lib/mail/smtpService.js +1 -1
  82. package/plugins/_lib/mail/snoozeRuntime.js +1 -1
  83. package/plugins/_lib/mail/store.js +1 -1
  84. package/plugins/_lib/mail/subscriptions.js +1 -1
  85. package/plugins/_lib/mail/syncPlan.js +1 -1
  86. package/plugins/_lib/mail/syncRuntime.js +1 -1
  87. package/plugins/_lib/mail/syncSelection.js +1 -1
  88. package/plugins/_lib/mail/unreadBadge.js +1 -1
  89. package/plugins/_lib/mail/unsubscribe.js +1 -1
  90. package/plugins/_lib/mail/vacationRunner.js +14 -2
  91. package/plugins/_lib/mail/vacationRuntime.js +23 -5
  92. package/plugins/_lib/mail/write.js +1 -1
  93. package/plugins/_lib/outreach/sending.js +3 -1
  94. package/plugins/_lib/public/rich-text.mjs +1 -1
  95. package/plugins/_lib/rich-text.js +1 -1
  96. package/plugins/docs/CHANGELOG.md +5 -0
  97. package/plugins/docs/plugin.js +2 -2
  98. package/plugins/free-tier.lock.json +7 -7
  99. package/plugins/shopping-cart/CHANGELOG.md +5 -0
  100. package/plugins/shopping-cart/lib/accounts.js +1 -1
  101. package/plugins/support/CHANGELOG.md +5 -0
  102. package/plugins/support/lib/mail.js +2 -2
  103. package/server/routes/api/settings.js +45 -8
  104. package/server/services/actions.js +2 -1
  105. package/server/services/callInvites.js +1 -1
  106. package/server/services/content.js +5 -0
  107. package/server/services/email.js +10 -4
  108. package/server/services/emailBrand.js +126 -0
  109. package/server/services/emailExamples.js +37 -0
  110. package/server/services/geocode.js +158 -0
  111. package/server/services/instantCalls.js +1 -1
  112. package/server/services/mapPins.js +45 -11
  113. package/server/services/markdown.js +13 -4
  114. package/server/services/passwordReset.js +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.78.0] - 2026-11-19
4
+
5
+ ### Added
6
+
7
+ - Shared site-branded automated emails with public identity inheritance, email-specific name/logo/colour/support/footer overrides, reusable detail and action blocks, and complete plain-text versions.
8
+ - Email families for the Manager's own mail: `gift`, `offer` and `licence`.
9
+ - Settings > SMTP includes a sample gallery and branded test sends for account invitations, Waypoint updates, bookings, orders, reports and campaigns.
10
+ - **Away replies in your Email branding** (Domma Mail core 0.35.0). With Email Pro, an automatic away reply goes out in the mailbox's brand (a rule for the sender, else the mailbox's identity brand, else the default), in the compact reply form. Without Email Pro, or if branding fails, it goes out plain as before. Mail engine: the shared responder's new `brand` hook (domma-mail core, unreleased).
11
+
12
+ ### Changed
13
+
14
+ - Account, form, call and automation emails and the bundled Docs, Support and Shop account emails opt into the shared presentation. Personal email remains unchanged.
15
+ - Outreach layouts retain custom content, recipient links and unsubscribe controls. Site logos in SVG format fall back to a text brand; a separate raster email logo can be selected.
16
+
17
+ ## [1.77.0] - 2026-11-19
18
+
19
+ ### Added
20
+
21
+ - **Map pins by address.** `[map pins="Office = SW1A 2AA | Warehouse = 1 Dock Road, Hull" /]` - a pin can be an address or postcode as well as coordinates. Addresses are found when you save the page, so visitors never wait for them. Switch on **Address look-ups** in Site Settings > General > Maps first: it is off by default, because it sends the addresses (and the site's address) to OpenStreetMap's Nominatim service. Switching it on finds the addresses already in your pages.
22
+
3
23
  ## [1.76.0] - 2026-11-19
4
24
 
5
25
  ### Added
@@ -46,4 +46,4 @@ Optional body content.
46
46
  [/table]`,attrs:[{name:"striped",type:"checkbox",label:"Striped"},{name:"bordered",type:"checkbox",label:"Bordered"},{name:"compact",type:"checkbox",label:"Compact"},{name:"caption",type:"text",label:"Caption"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"badge",label:"Badge",icon:"badge",category:"Content",selfClosing:!1,container:!1,wrappable:!1,template:'[badge variant="success"]New[/badge]',inline:!0,attrs:[{name:"variant",type:"select",label:"Variant",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"],["light","Light"],["dark","Dark"]]},{name:"pill",type:"checkbox",label:"Pill"},{name:"outline",type:"checkbox",label:"Outline"},{name:"size",type:"select",label:"Size",options:[["","Default"],["small","Small"],["large","Large"]]}]},{name:"text",label:"Text",icon:"text-style",preview:"text",category:"Content",selfClosing:!1,container:!0,wrappable:!0,template:"[text]Styled text[/text]",inline:!0,actions:[{label:"Highlight - gradient with a shine",icon:"star",set:{gradient:"sunset",shine:"hover"}},{label:"Highlight that sweeps by itself",icon:"star",set:{gradient:"sunset",shine:"sweep"}},{label:"Light up as you read",icon:"eye",set:{"light-up":"true"}},{label:"Rise in word by word",icon:"arrow-up",set:{words:"true"}},{label:"Plain - no highlight or motion",icon:"minimize",set:{gradient:null,shine:null,"light-up":null,words:null}}],quickAttrs:["gradient","shine","align","size","bold","color"],attrs:[{name:"size",type:"select",label:"Size",options:[["xs","XS"],["sm","Small"],["base","Base"],["lg","Large"],["xl","XL"],["2xl","2XL"],["3xl","3XL"],["4xl","4XL"]]},{name:"weight",type:"select",label:"Weight",options:[["thin","Thin"],["light","Light"],["normal","Normal"],["medium","Medium"],["semibold","Semibold"],["bold","Bold"],["extrabold","Extra bold"],["black","Black"]]},{name:"point-size",type:"number",label:"Point size"},{name:"bold",type:"checkbox",label:"Bold"},{name:"italic",type:"checkbox",label:"Italic"},{name:"color",type:"colour",label:"Colour"},{name:"font",type:"select",label:"Font",options:Object.keys(n).map(e=>[e,o(e)?`${e} (licensed)`:e])},{name:"transform",type:"select",label:"Transform",options:[["upper","Uppercase"],["lower","Lowercase"],["capitalize","Capitalise"],["none","None"]]},{name:"decoration",type:"select",label:"Decoration",options:[["underline","Underline"],["line-through","Line through"],["none","None"]]},{name:"spacing",type:"select",label:"Letter spacing",options:[["tight","Tight"],["normal","Normal"],["wide","Wide"],["wider","Wider"]]},{name:"align",type:"select",label:"Align",options:[["","None"],["left","Left"],["center","Centre"],["right","Right"],["justify","Justify"]]},{name:"gradient",type:"select",label:"Gradient",options:[["","None"],["brand","Theme"],["sunset","Sunset"],["ocean","Ocean"],["forest","Forest"],["fire","Fire"],["candy","Candy"],["newspaper","Newspaper"],["grey-fire","Grey-fire"],["ice","Ice"],["summer","Summer"],["autumn","Autumn"],["spring","Spring"],["winter","Winter"],["aurora","Aurora"],["twilight","Twilight"],["rose-gold","Rose-gold"],["copper","Copper"],["amethyst","Amethyst"],["lagoon","Lagoon"],["cherry","Cherry"],["lavender","Lavender"],["midnight","Midnight"]]},{name:"shine",type:"select",label:"Shine (gradient)",options:[["","None"],["hover","Follows the pointer"],["sweep","Sweeps across"]]},{name:"light-up",type:"checkbox",label:"Words light up as you scroll"},{name:"words",type:"checkbox",label:"Rise in word by word"},{name:"style",type:"text",label:"Inline CSS"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"button",label:"Button",icon:"btn-insert",category:"Content",selfClosing:!0,container:!1,wrappable:!1,template:'[button href="/contact" variant="primary" label="Get in touch" /]',attrs:[{name:"href",type:"url",label:"Link"},{name:"label",type:"text",label:"Label"},{name:"variant",type:"select",label:"Variant",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"],["outline","Outline"],["ghost","Ghost"],["link","Link"],["outline-success","Outline success"],["outline-danger","Outline danger"],["outline-warning","Outline warning"],["outline-info","Outline info"]]},{name:"size",type:"select",label:"Size",options:[["","Default"],["sm","Small"],["lg","Large"]]},{name:"icon",type:"icon",label:"Icon (before)"},{name:"icon-after",type:"icon",label:"Icon (after)"},{name:"target",type:"text",label:"Target"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"link",label:"Link",icon:"link-shortcode",category:"Content",selfClosing:!0,container:!1,wrappable:!1,template:'[link href="/about" label="About us" /]',formats:[{value:"markdown",label:"Markdown link",emit:e=>Object.keys(e).some(t=>t!=="href"&&t!=="label"&&e[t])||!e.href?null:`[${e.label||e.href}](${e.href})`},{value:"shortcode",label:"Link shortcode"}],attrs:[{name:"href",type:"url",label:"Link"},{name:"label",type:"text",label:"Label"},{name:"target",type:"text",label:"Target"},{name:"class",type:"text",label:"CSS class"},{name:"icon",type:"icon",label:"Icon (before)"},{name:"icon-after",type:"icon",label:"Icon (after)"},{name:"id",type:"text",label:"ID"}]},{name:"listgroup",label:"List group",icon:"list",category:"Content",selfClosing:!1,container:!0,wrappable:!1,template:`[listgroup]
47
47
  [item]First item[/item]
48
48
  [item]Second item[/item]
49
- [/listgroup]`,children:{name:"item",min:1,max:20},attrs:[{name:"variant",type:"select",label:"Variant",options:[["","Default"],["flush","Flush"],["numbered","Numbered"],["horizontal","Horizontal"]]},{name:"size",type:"select",label:"Size",options:[["","Default"],["sm","Small"],["lg","Large"]]},{name:"itemvariant",type:"select",label:"Item variant",options:[["","Default"],["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"]]},{name:"action",type:"checkbox",label:"Actionable items"}]},{name:"collection",label:"Collection",icon:"database",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[collection slug="enquiries" display="table" /]',attrs:[{name:"slug",type:"lookup",source:"collections",label:"Collection"},{name:"display",type:"select",label:"Display",options:[["table","Table"],["cards","Cards"],["list","List"],["accordion","Accordion"],["timeline","Timeline"],["carousel","Carousel"],["block","Block"]]},{name:"fields",type:"text",label:"Fields (comma-separated)"},{name:"limit",type:"number",label:"Limit"},{name:"sort",type:"lookup",source:"collection-fields",label:"Sort field"},{name:"order",type:"select",label:"Order",options:[["desc","Descending"],["asc","Ascending"]]},{name:"title-field",type:"lookup",source:"collection-fields",label:"Title field"},{name:"image-field",type:"lookup",source:"collection-fields",label:"Image field"},{name:"body-field",type:"lookup",source:"collection-fields",label:"Body field"},{name:"mobile-popup",type:"checkbox",label:"Open carousel cards in a popup on mobile"},{name:"arrow-position",type:"select",label:"Arrow position",options:[["middle","Middle"],["top","Top"],["bottom","Bottom"]]},{name:"background",type:"colour",label:"Carousel background"},{name:"arrow-background",type:"colour",label:"Arrow background"},{name:"arrow-color",type:"colour",label:"Arrow colour"},{name:"autoplay",type:"checkbox",label:"Autoplay",domma:"carousel.autoplay"},{name:"interval",type:"number",label:"Interval (ms)",domma:"carousel.interval"},{name:"loop",type:"checkbox",label:"Loop",default:!0,domma:"carousel.loop"},{name:"animation",type:"select",label:"Animation",options:[["slide","Slide"],["fade","Fade"],["crossfade","Crossfade"]],domma:"carousel.animation"},{name:"animation-duration",type:"number",label:"Animation duration (ms)",domma:"carousel.animationDuration"},{name:"animation-easing",type:"text",label:"Animation easing",domma:"carousel.animationEasing"},{name:"height-mode",type:"select",label:"Image height",options:[["crop","Top-aligned crop (shortest image)"],["average","Average of shortest and tallest images"]],domma:"carousel.heightMode"},{name:"height",type:"number",label:"Fixed height (px, optional)",domma:"carousel.height"},{name:"columns",type:"number",label:"Card columns"},{name:"search",type:"checkbox",label:"Search (table)",default:!0},{name:"sortable",type:"checkbox",label:"Sortable (table)",default:!0},{name:"exportable",type:"checkbox",label:"CSV export"},{name:"page-size",type:"number",label:"Page size"},{name:"empty",type:"text",label:"Empty message"},{name:"scope",type:"select",label:"Scope",options:[["","All"],["mine","Current user"]]},{name:"cta",type:"lookup",source:"actions",label:"CTA action"},{name:"cta-label",type:"text",label:"CTA label"},{name:"cta-icon",type:"icon",label:"CTA icon"},{name:"cta-style",type:"select",label:"CTA style",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"]]},{name:"cta-confirm",type:"text",label:"CTA confirm text"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"view",label:"View",icon:"eye",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[view slug="products" display="table" limit="50" /]',attrs:[{name:"slug",type:"lookup",source:"views",label:"View"},{name:"display",type:"select",label:"Display",options:[["table","Table"],["cards","Cards"],["list","List"],["accordion","Accordion"],["timeline","Timeline"],["carousel","Carousel"],["block","Block"]]},{name:"limit",type:"number",label:"Limit"},{name:"fields",type:"text",label:"Fields (comma-separated)"},{name:"title-field",type:"text",label:"Title field"},{name:"image-field",type:"text",label:"Image field"},{name:"body-field",type:"text",label:"Body field"},{name:"mobile-popup",type:"checkbox",label:"Open carousel cards in a popup on mobile"},{name:"arrow-position",type:"select",label:"Arrow position",options:[["middle","Middle"],["top","Top"],["bottom","Bottom"]]},{name:"background",type:"colour",label:"Carousel background"},{name:"arrow-background",type:"colour",label:"Arrow background"},{name:"arrow-color",type:"colour",label:"Arrow colour"},{name:"autoplay",type:"checkbox",label:"Autoplay",domma:"carousel.autoplay"},{name:"interval",type:"number",label:"Interval (ms)",domma:"carousel.interval"},{name:"loop",type:"checkbox",label:"Loop",default:!0,domma:"carousel.loop"},{name:"animation",type:"select",label:"Animation",options:[["slide","Slide"],["fade","Fade"],["crossfade","Crossfade"]],domma:"carousel.animation"},{name:"animation-duration",type:"number",label:"Animation duration (ms)",domma:"carousel.animationDuration"},{name:"animation-easing",type:"text",label:"Animation easing",domma:"carousel.animationEasing"},{name:"height-mode",type:"select",label:"Image height",options:[["crop","Top-aligned crop (shortest image)"],["average","Average of shortest and tallest images"]],domma:"carousel.heightMode"},{name:"height",type:"number",label:"Fixed height (px, optional)",domma:"carousel.height"},{name:"columns",type:"number",label:"Card columns"},{name:"empty",type:"text",label:"Empty message"}]},{name:"block",label:"Block",icon:"layout",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[block template="post-card" title="My Post" /]',attrs:[{name:"template",type:"lookup",source:"blocks",label:"Template"}]},{name:"form",label:"Form",icon:"file-text",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[form name="contact" /]',attrs:[{name:"name",type:"lookup",source:"forms",label:"Form"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"cta",label:"CTA",icon:"mouse-pointer",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[cta action="send-welcome" entry="abc123" style="primary" label="Send" /]',attrs:[{name:"action",type:"lookup",source:"actions",label:"Action"},{name:"entry",type:"text",label:"Entry ID"},{name:"style",type:"select",label:"Style",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"]]},{name:"icon",type:"icon",label:"Icon"},{name:"size",type:"select",label:"Size",options:[["","Default"],["sm","Small"],["lg","Large"]]},{name:"confirm",type:"text",label:"Confirm text"},{name:"label",type:"text",label:"Label"}]},{name:"menu",label:"Menu",icon:"menu",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[menu slug="legal" /]',attrs:[{name:"slug",type:"lookup",source:"menus",label:"Menu"},{name:"location",type:"lookup",source:"menu-locations",label:"Location slot"},{name:"variant",type:"text",label:"Variant"},{name:"class",type:"text",label:"CSS class"},{name:"depth",type:"number",label:"Max depth"},{name:"orientation",type:"select",label:"Orientation",options:[["","Menu default"],["horizontal","Horizontal"],["vertical","Vertical"]]},{name:"float",type:"select",label:"Floating",options:[["","Menu default"],["no","Render inline here"]]}]},{name:"contents",label:"Page contents (this page)",icon:"list",category:"Layout",selfClosing:!0,container:!1,wrappable:!1,template:'[contents numbered="true" /]',actions:[{label:"Number the contents",icon:"hash",set:{numbered:"true"}},{label:"List H2 and H3 headings",icon:"list",set:{headings:"h2h3"}},{label:"Contents on the right",icon:"sidebar-right",set:{side:"right"}},{label:"Collapse the contents to a button",icon:"minimize",set:{collapsible:"true",collapsed:"true"}},{label:"Float the contents",icon:"move",set:{floating:"true","float-anchor":"TR",movable:"true"}},{label:"No contents on this page",icon:"eye-off",set:{hidden:"true"}},{label:"Remove this override",icon:"trash",remove:!0}],quickAttrs:["side","headings","numbered","title","collapsible","floating","hidden"],attrs:[{name:"side",type:"select",label:"Side",options:[["","Layout default"],["left","Left"],["right","Right"]]},{name:"width",type:"number",label:"Width (px, 160-480)"},{name:"headings",type:"select",label:"Headings",options:[["","Layout default"],["auto","Sections (H2s, else H3s)"],["h2","H2 only"],["h3","H3 only"],["h2h3","H2 and H3"]]},{name:"numbered",type:"select",label:"Numbered",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"title",type:"text",label:"Title above the list"},{name:"exclude",type:"text",label:"Leave out (headings, comma separated)"},{name:"sticky",type:"select",label:"Stays in view",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"scroll-spy",type:"select",label:"Marks the section being read",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"collapsible",type:"select",label:"Collapsible to a button",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"collapsed",type:"select",label:"Start collapsed",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"autohide",type:"select",label:"Autohide off its edge",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"floating",type:"select",label:"Floating panel",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"float-anchor",type:"select",label:"Float anchor",options:[["","Layout default"],["TL","Top left"],["TR","Top right"],["BL","Bottom left"],["BR","Bottom right"],["L","Left"],["R","Right"]]},{name:"movable",type:"select",label:"Visitors can move it",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"hidden",type:"select",label:"No contents on this page",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"hover",type:"text",label:"Hover effect"},{name:"selected",type:"text",label:"When selected"},{name:"accent",type:"colour",label:"Accent"},{name:"font",type:"text",label:"Font family"},{name:"font-size",type:"text",label:"Font size"},{name:"font-weight",type:"text",label:"Font weight"}]},{name:"navbar",label:"Navbar settings (this page)",icon:"sliders",category:"Layout",selfClosing:!0,container:!1,wrappable:!1,template:'[navbar collapsed="true" /]',actions:[{label:"Collapse the rail on this page",icon:"chevrons-right",set:{collapsible:"true",collapsed:"true",autohide:"false"}},{label:"Autohide the rail on this page",icon:"eye-off",set:{autohide:"true",collapsed:null}},{label:"Keep the rail open on this page",icon:"eye",set:{autohide:"false",collapsed:"false"}},{label:"Hide the bar on scroll on this page",icon:"arrow-up",set:{"hide-on-scroll":"true"}},{label:"Remove this override",icon:"trash",remove:!0}],quickAttrs:["position","width","collapsible","collapsed","autohide","hide-on-scroll"],attrs:[{name:"position",type:"select",label:"Position",options:[["","Menu default"],["sticky","Sticky"],["fixed","Fixed"],["static","Static"],["floating","Floating"]]},{name:"orientation",type:"select",label:"Orientation",options:[["","Menu default"],["horizontal","Horizontal"],["vertical","Vertical"]]},{name:"side",type:"select",label:"Rail side",options:[["","Menu default"],["left","Left"],["right","Right"]]},{name:"align",type:"select",label:"Alignment",options:[["","Menu default"],["left","Left"],["centre","Centre"],["right","Right"],["spread","Spread"]]},{name:"width",type:"number",label:"Rail width (px, 160-480)"},{name:"collapsible",type:"select",label:"Collapsible to icons",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"collapsed",type:"select",label:"Start collapsed",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"autohide",type:"select",label:"Autohide off-screen",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"hide-on-scroll",type:"select",label:"Hide on scroll (bar)",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"hover-open",type:"select",label:"Open dropdowns on hover",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"bar",type:"select",label:"Bar shape",options:[["","Menu default"],["pill","Pill"],["segmented","Segmented"],["underline","Underline glide"],["dock","Dock"],["neon","Neon"],["tabs","Tabs"],["tiles","Tiles"],["bubbles","Bubbles"],["brutalist","Brutalist"],["gradient","Gradient band"]]},{name:"shrink",type:"select",label:"Shrink on scroll",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"icons",type:"select",label:"Bar icons",options:[["","Menu default"],["rainbow","Rainbow"],["accent","Accent"]]},{name:"brand",type:"select",label:"Branding shape",options:[["","Menu default"],["pill","Pill"]]},{name:"strip",type:"select",label:"Bar background",options:[["","Menu default"],["none","None - floating pills"],["band","Strip - keep the band"]]},{name:"dropdown",type:"select",label:"Dropdown style",options:[["","Menu default"],["cards","Cards"]]},{name:"tiles",type:"select",label:"Icon tiles (cards)",options:[["","Menu default"],["rainbow","Rainbow"],["accent","Theme colour"],["neutral","Neutral"],["none","No tiles"]]},{name:"morph",type:"select",label:"Slide between cards",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"hover",type:"text",label:"Hover effect"},{name:"selected",type:"text",label:"When selected"},{name:"accent",type:"colour",label:"Highlight colour"},{name:"variant",type:"text",label:"Variant"},{name:"font",type:"text",label:"Font family"},{name:"font-size",type:"text",label:"Font size"},{name:"font-weight",type:"text",label:"Font weight"},{name:"letter-spacing",type:"text",label:"Letter spacing"},{name:"icon-size",type:"text",label:"Icon size"},{name:"float-anchor",type:"select",label:"Float anchor",options:[["","Menu default"],["TL","Top left"],["TR","Top right"],["BL","Bottom left"],["BR","Bottom right"],["L","Left"],["R","Right"]]},{name:"float-x",type:"number",label:"Float offset X (px)"},{name:"float-y",type:"number",label:"Float offset Y (px)"},{name:"float-width",type:"number",label:"Float width (px)"},{name:"float-collapsible",type:"select",label:"Float: collapsible",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"float-movable",type:"select",label:"Float: movable",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"class",type:"text",label:"CSS classes"}]},{name:"theme-switcher",label:"Theme switcher",icon:"palette",category:"Components",selfClosing:!0,container:!1,wrappable:!1,template:"[theme-switcher /]",attrs:[{name:"position",type:"select",label:"Position",options:[["","Inline - where the tag is"],["top-left","Top left"],["top-right","Top right"],["left-center","Left, centred"],["right-center","Right, centred"],["bottom-left","Bottom left"],["bottom-right","Bottom right"]]},{name:"offset-x",type:"number",label:"Offset from the side (px, pinned only)"},{name:"offset-y",type:"number",label:"Offset from the top/bottom (px, pinned only)"},{name:"themes",type:"text",label:"Themes (comma list - blank for the site's)"}]},{name:"icon",label:"Icon",icon:"icon-pick",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[icon name="arrow-right" /]',attrs:[{name:"name",type:"icon",label:"Icon name"},{name:"size",type:"number",label:"Size (px)"},{name:"color",type:"colour",label:"Colour"},{name:"class",type:"text",label:"CSS class"}]},{name:"image",label:"Image",icon:"image-add",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[image src="/media/photo.jpg" alt="" /]',custom:"image",quickAttrs:["zoom","align","width","shadow"],attrs:[{name:"src",type:"image",label:"Image",help:"The picture: choose it from Media, or type a /media/\u2026 path or an https:// address."},{name:"alt",type:"text",label:"Description (alt)",help:"What the picture shows, in a few words. Screen readers and search engines read it. Leave empty only for decoration."},{name:"caption",type:"text",label:"Caption",help:"Shown under the picture, and in the zoom view."},{name:"zoom",type:"checkbox",label:"Click to zoom",help:"Visitors click the picture to see it full size in a viewer: fitted first, then actual size with drag to pan. Best for screenshots with small text. Ignored when the picture has a link."},{name:"width",type:"text",label:"Width (480, 60%, 30rem)",help:"How wide the picture shows. A bare number is pixels. Empty: its own size, never wider than the column."},{name:"align",type:"select",label:"Alignment",options:[["","Default (left)"],["center","Centre"],["right","Right"],["float-left","Float left (text wraps)"],["float-right","Float right (text wraps)"]],help:"Floats let the text run beside the picture; on phones they stack."},{name:"group",type:"text",label:"Zoom group",help:"Give zoomable pictures the same group name and the viewer steps between them with arrows - a gallery or a tour."},{name:"zoom-src",type:"image",label:"Full-size file (zoom)",help:"Optional: a larger file for the zoom view, when the page shows a smaller copy."},{name:"title",type:"text",label:"Hover text (title)"},{name:"max-width",type:"text",label:"Max width (800, 50%)"},{name:"height",type:"text",label:"Height (240, 20rem)",help:"A set height crops the picture to fill the box (see Fit)."},{name:"fit",type:"select",label:"Fit (with a height)",options:[["","Fill and crop (default)"],["contain","Show it all"],["fill","Stretch"],["none","Actual size"],["scale-down","Shrink only"]]},{name:"radius",type:"select",label:"Corners",options:[["","Square"],["sm","Slightly rounded"],["md","Rounded"],["lg","Very rounded"],["full","Circle / pill"]]},{name:"border",type:"checkbox",label:"Border"},{name:"shadow",type:"select",label:"Shadow",options:[["","None"],["sm","Small"],["md","Medium"],["lg","Large"]]},{name:"link",type:"url",label:"Link to",help:"Clicking the picture goes here instead of zooming."},{name:"target",type:"select",label:"Open link in",options:[["","Same tab"],["_blank","New tab"]]},{name:"loading",type:"select",label:"Loading",options:[["","When scrolled near (lazy)"],["eager","Straight away (top of page)"]]},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"map",label:"Map",icon:"map-pin",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[map address="10 Downing Street, London" zoom="15" /]',attrs:[{name:"pin",type:"text",label:"Pin (latitude, longitude)"},{name:"pins",type:"text",label:"Several pins",help:"For a map of several places: latitude,longitude then a label, one pin after another split by | (51.5034,-0.1276 Office | 51.5007,-0.1246 Shop). Shown on OpenStreetMap; addresses are not looked up."},{name:"lat",type:"number",label:"Latitude"},{name:"lon",type:"number",label:"Longitude"},{name:"address",type:"text",label:"Address"},{name:"postcode",type:"text",label:"Postcode"},{name:"zoom",type:"number",label:"Zoom (1-20)"},{name:"title",type:"text",label:"Title"},{name:"caption",type:"text",label:"Caption"},{name:"directions",type:"checkbox",label:"Directions link"},{name:"ratio",type:"select",label:"Aspect ratio",options:[["16:9","16:9"],["4:3","4:3"],["1:1","1:1"],["21:9","21:9"]]},{name:"width",type:"text",label:"Width"},{name:"align",type:"select",label:"Alignment",options:[["left","Left"],["center","Centre"],["right","Right"]]}]},{name:"embed",label:"Embed",icon:"video",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[embed url="https://youtu.be/dQw4w9WgXcQ" /]',custom:"embed",attrs:[{name:"url",type:"url",label:"URL"},{name:"ratio",type:"select",label:"Aspect ratio",options:[["16:9","16:9"],["4:3","4:3"],["1:1","1:1"],["21:9","21:9"],["9:16","9:16"],["3:4","3:4"]]},{name:"title",type:"text",label:"Title / caption"},{name:"width",type:"text",label:"Width"},{name:"align",type:"select",label:"Alignment",options:[["left","Left"],["center","Centre"],["right","Right"]]},{name:"autoplay",type:"checkbox",label:"Autoplay"},{name:"loop",type:"checkbox",label:"Loop"},{name:"muted",type:"checkbox",label:"Muted"}]}];for(const e of SHORTCODES){e.attrs||(e.attrs=[]);for(const a of i)e.attrs.some(t=>t.name===a.name)||e.attrs.push(a)}export const EDITOR_TOOLS=[{name:"colourpick",label:"Colour picker",icon:"colour-picker",category:"Media",custom:"colourpick"},{name:"component",label:"Component",icon:"component",category:"Components",custom:"component"},{name:"scribe",label:"Scribe",icon:"scribe-insert",category:"Content",custom:"scribe"},{name:"highlight-text",label:"Highlight text",icon:"star",category:"Content",custom:"highlighttext",wrappable:!0}];
49
+ [/listgroup]`,children:{name:"item",min:1,max:20},attrs:[{name:"variant",type:"select",label:"Variant",options:[["","Default"],["flush","Flush"],["numbered","Numbered"],["horizontal","Horizontal"]]},{name:"size",type:"select",label:"Size",options:[["","Default"],["sm","Small"],["lg","Large"]]},{name:"itemvariant",type:"select",label:"Item variant",options:[["","Default"],["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"]]},{name:"action",type:"checkbox",label:"Actionable items"}]},{name:"collection",label:"Collection",icon:"database",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[collection slug="enquiries" display="table" /]',attrs:[{name:"slug",type:"lookup",source:"collections",label:"Collection"},{name:"display",type:"select",label:"Display",options:[["table","Table"],["cards","Cards"],["list","List"],["accordion","Accordion"],["timeline","Timeline"],["carousel","Carousel"],["block","Block"]]},{name:"fields",type:"text",label:"Fields (comma-separated)"},{name:"limit",type:"number",label:"Limit"},{name:"sort",type:"lookup",source:"collection-fields",label:"Sort field"},{name:"order",type:"select",label:"Order",options:[["desc","Descending"],["asc","Ascending"]]},{name:"title-field",type:"lookup",source:"collection-fields",label:"Title field"},{name:"image-field",type:"lookup",source:"collection-fields",label:"Image field"},{name:"body-field",type:"lookup",source:"collection-fields",label:"Body field"},{name:"mobile-popup",type:"checkbox",label:"Open carousel cards in a popup on mobile"},{name:"arrow-position",type:"select",label:"Arrow position",options:[["middle","Middle"],["top","Top"],["bottom","Bottom"]]},{name:"background",type:"colour",label:"Carousel background"},{name:"arrow-background",type:"colour",label:"Arrow background"},{name:"arrow-color",type:"colour",label:"Arrow colour"},{name:"autoplay",type:"checkbox",label:"Autoplay",domma:"carousel.autoplay"},{name:"interval",type:"number",label:"Interval (ms)",domma:"carousel.interval"},{name:"loop",type:"checkbox",label:"Loop",default:!0,domma:"carousel.loop"},{name:"animation",type:"select",label:"Animation",options:[["slide","Slide"],["fade","Fade"],["crossfade","Crossfade"]],domma:"carousel.animation"},{name:"animation-duration",type:"number",label:"Animation duration (ms)",domma:"carousel.animationDuration"},{name:"animation-easing",type:"text",label:"Animation easing",domma:"carousel.animationEasing"},{name:"height-mode",type:"select",label:"Image height",options:[["crop","Top-aligned crop (shortest image)"],["average","Average of shortest and tallest images"]],domma:"carousel.heightMode"},{name:"height",type:"number",label:"Fixed height (px, optional)",domma:"carousel.height"},{name:"columns",type:"number",label:"Card columns"},{name:"search",type:"checkbox",label:"Search (table)",default:!0},{name:"sortable",type:"checkbox",label:"Sortable (table)",default:!0},{name:"exportable",type:"checkbox",label:"CSV export"},{name:"page-size",type:"number",label:"Page size"},{name:"empty",type:"text",label:"Empty message"},{name:"scope",type:"select",label:"Scope",options:[["","All"],["mine","Current user"]]},{name:"cta",type:"lookup",source:"actions",label:"CTA action"},{name:"cta-label",type:"text",label:"CTA label"},{name:"cta-icon",type:"icon",label:"CTA icon"},{name:"cta-style",type:"select",label:"CTA style",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"]]},{name:"cta-confirm",type:"text",label:"CTA confirm text"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"view",label:"View",icon:"eye",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[view slug="products" display="table" limit="50" /]',attrs:[{name:"slug",type:"lookup",source:"views",label:"View"},{name:"display",type:"select",label:"Display",options:[["table","Table"],["cards","Cards"],["list","List"],["accordion","Accordion"],["timeline","Timeline"],["carousel","Carousel"],["block","Block"]]},{name:"limit",type:"number",label:"Limit"},{name:"fields",type:"text",label:"Fields (comma-separated)"},{name:"title-field",type:"text",label:"Title field"},{name:"image-field",type:"text",label:"Image field"},{name:"body-field",type:"text",label:"Body field"},{name:"mobile-popup",type:"checkbox",label:"Open carousel cards in a popup on mobile"},{name:"arrow-position",type:"select",label:"Arrow position",options:[["middle","Middle"],["top","Top"],["bottom","Bottom"]]},{name:"background",type:"colour",label:"Carousel background"},{name:"arrow-background",type:"colour",label:"Arrow background"},{name:"arrow-color",type:"colour",label:"Arrow colour"},{name:"autoplay",type:"checkbox",label:"Autoplay",domma:"carousel.autoplay"},{name:"interval",type:"number",label:"Interval (ms)",domma:"carousel.interval"},{name:"loop",type:"checkbox",label:"Loop",default:!0,domma:"carousel.loop"},{name:"animation",type:"select",label:"Animation",options:[["slide","Slide"],["fade","Fade"],["crossfade","Crossfade"]],domma:"carousel.animation"},{name:"animation-duration",type:"number",label:"Animation duration (ms)",domma:"carousel.animationDuration"},{name:"animation-easing",type:"text",label:"Animation easing",domma:"carousel.animationEasing"},{name:"height-mode",type:"select",label:"Image height",options:[["crop","Top-aligned crop (shortest image)"],["average","Average of shortest and tallest images"]],domma:"carousel.heightMode"},{name:"height",type:"number",label:"Fixed height (px, optional)",domma:"carousel.height"},{name:"columns",type:"number",label:"Card columns"},{name:"empty",type:"text",label:"Empty message"}]},{name:"block",label:"Block",icon:"layout",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[block template="post-card" title="My Post" /]',attrs:[{name:"template",type:"lookup",source:"blocks",label:"Template"}]},{name:"form",label:"Form",icon:"file-text",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[form name="contact" /]',attrs:[{name:"name",type:"lookup",source:"forms",label:"Form"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"cta",label:"CTA",icon:"mouse-pointer",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[cta action="send-welcome" entry="abc123" style="primary" label="Send" /]',attrs:[{name:"action",type:"lookup",source:"actions",label:"Action"},{name:"entry",type:"text",label:"Entry ID"},{name:"style",type:"select",label:"Style",options:[["primary","Primary"],["secondary","Secondary"],["success","Success"],["danger","Danger"],["warning","Warning"],["info","Info"]]},{name:"icon",type:"icon",label:"Icon"},{name:"size",type:"select",label:"Size",options:[["","Default"],["sm","Small"],["lg","Large"]]},{name:"confirm",type:"text",label:"Confirm text"},{name:"label",type:"text",label:"Label"}]},{name:"menu",label:"Menu",icon:"menu",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[menu slug="legal" /]',attrs:[{name:"slug",type:"lookup",source:"menus",label:"Menu"},{name:"location",type:"lookup",source:"menu-locations",label:"Location slot"},{name:"variant",type:"text",label:"Variant"},{name:"class",type:"text",label:"CSS class"},{name:"depth",type:"number",label:"Max depth"},{name:"orientation",type:"select",label:"Orientation",options:[["","Menu default"],["horizontal","Horizontal"],["vertical","Vertical"]]},{name:"float",type:"select",label:"Floating",options:[["","Menu default"],["no","Render inline here"]]}]},{name:"contents",label:"Page contents (this page)",icon:"list",category:"Layout",selfClosing:!0,container:!1,wrappable:!1,template:'[contents numbered="true" /]',actions:[{label:"Number the contents",icon:"hash",set:{numbered:"true"}},{label:"List H2 and H3 headings",icon:"list",set:{headings:"h2h3"}},{label:"Contents on the right",icon:"sidebar-right",set:{side:"right"}},{label:"Collapse the contents to a button",icon:"minimize",set:{collapsible:"true",collapsed:"true"}},{label:"Float the contents",icon:"move",set:{floating:"true","float-anchor":"TR",movable:"true"}},{label:"No contents on this page",icon:"eye-off",set:{hidden:"true"}},{label:"Remove this override",icon:"trash",remove:!0}],quickAttrs:["side","headings","numbered","title","collapsible","floating","hidden"],attrs:[{name:"side",type:"select",label:"Side",options:[["","Layout default"],["left","Left"],["right","Right"]]},{name:"width",type:"number",label:"Width (px, 160-480)"},{name:"headings",type:"select",label:"Headings",options:[["","Layout default"],["auto","Sections (H2s, else H3s)"],["h2","H2 only"],["h3","H3 only"],["h2h3","H2 and H3"]]},{name:"numbered",type:"select",label:"Numbered",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"title",type:"text",label:"Title above the list"},{name:"exclude",type:"text",label:"Leave out (headings, comma separated)"},{name:"sticky",type:"select",label:"Stays in view",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"scroll-spy",type:"select",label:"Marks the section being read",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"collapsible",type:"select",label:"Collapsible to a button",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"collapsed",type:"select",label:"Start collapsed",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"autohide",type:"select",label:"Autohide off its edge",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"floating",type:"select",label:"Floating panel",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"float-anchor",type:"select",label:"Float anchor",options:[["","Layout default"],["TL","Top left"],["TR","Top right"],["BL","Bottom left"],["BR","Bottom right"],["L","Left"],["R","Right"]]},{name:"movable",type:"select",label:"Visitors can move it",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"hidden",type:"select",label:"No contents on this page",options:[["","Layout default"],["true","On"],["false","Off"]]},{name:"hover",type:"text",label:"Hover effect"},{name:"selected",type:"text",label:"When selected"},{name:"accent",type:"colour",label:"Accent"},{name:"font",type:"text",label:"Font family"},{name:"font-size",type:"text",label:"Font size"},{name:"font-weight",type:"text",label:"Font weight"}]},{name:"navbar",label:"Navbar settings (this page)",icon:"sliders",category:"Layout",selfClosing:!0,container:!1,wrappable:!1,template:'[navbar collapsed="true" /]',actions:[{label:"Collapse the rail on this page",icon:"chevrons-right",set:{collapsible:"true",collapsed:"true",autohide:"false"}},{label:"Autohide the rail on this page",icon:"eye-off",set:{autohide:"true",collapsed:null}},{label:"Keep the rail open on this page",icon:"eye",set:{autohide:"false",collapsed:"false"}},{label:"Hide the bar on scroll on this page",icon:"arrow-up",set:{"hide-on-scroll":"true"}},{label:"Remove this override",icon:"trash",remove:!0}],quickAttrs:["position","width","collapsible","collapsed","autohide","hide-on-scroll"],attrs:[{name:"position",type:"select",label:"Position",options:[["","Menu default"],["sticky","Sticky"],["fixed","Fixed"],["static","Static"],["floating","Floating"]]},{name:"orientation",type:"select",label:"Orientation",options:[["","Menu default"],["horizontal","Horizontal"],["vertical","Vertical"]]},{name:"side",type:"select",label:"Rail side",options:[["","Menu default"],["left","Left"],["right","Right"]]},{name:"align",type:"select",label:"Alignment",options:[["","Menu default"],["left","Left"],["centre","Centre"],["right","Right"],["spread","Spread"]]},{name:"width",type:"number",label:"Rail width (px, 160-480)"},{name:"collapsible",type:"select",label:"Collapsible to icons",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"collapsed",type:"select",label:"Start collapsed",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"autohide",type:"select",label:"Autohide off-screen",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"hide-on-scroll",type:"select",label:"Hide on scroll (bar)",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"hover-open",type:"select",label:"Open dropdowns on hover",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"bar",type:"select",label:"Bar shape",options:[["","Menu default"],["pill","Pill"],["segmented","Segmented"],["underline","Underline glide"],["dock","Dock"],["neon","Neon"],["tabs","Tabs"],["tiles","Tiles"],["bubbles","Bubbles"],["brutalist","Brutalist"],["gradient","Gradient band"]]},{name:"shrink",type:"select",label:"Shrink on scroll",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"icons",type:"select",label:"Bar icons",options:[["","Menu default"],["rainbow","Rainbow"],["accent","Accent"]]},{name:"brand",type:"select",label:"Branding shape",options:[["","Menu default"],["pill","Pill"]]},{name:"strip",type:"select",label:"Bar background",options:[["","Menu default"],["none","None - floating pills"],["band","Strip - keep the band"]]},{name:"dropdown",type:"select",label:"Dropdown style",options:[["","Menu default"],["cards","Cards"]]},{name:"tiles",type:"select",label:"Icon tiles (cards)",options:[["","Menu default"],["rainbow","Rainbow"],["accent","Theme colour"],["neutral","Neutral"],["none","No tiles"]]},{name:"morph",type:"select",label:"Slide between cards",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"hover",type:"text",label:"Hover effect"},{name:"selected",type:"text",label:"When selected"},{name:"accent",type:"colour",label:"Highlight colour"},{name:"variant",type:"text",label:"Variant"},{name:"font",type:"text",label:"Font family"},{name:"font-size",type:"text",label:"Font size"},{name:"font-weight",type:"text",label:"Font weight"},{name:"letter-spacing",type:"text",label:"Letter spacing"},{name:"icon-size",type:"text",label:"Icon size"},{name:"float-anchor",type:"select",label:"Float anchor",options:[["","Menu default"],["TL","Top left"],["TR","Top right"],["BL","Bottom left"],["BR","Bottom right"],["L","Left"],["R","Right"]]},{name:"float-x",type:"number",label:"Float offset X (px)"},{name:"float-y",type:"number",label:"Float offset Y (px)"},{name:"float-width",type:"number",label:"Float width (px)"},{name:"float-collapsible",type:"select",label:"Float: collapsible",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"float-movable",type:"select",label:"Float: movable",options:[["","Menu default"],["true","On"],["false","Off"]]},{name:"class",type:"text",label:"CSS classes"}]},{name:"theme-switcher",label:"Theme switcher",icon:"palette",category:"Components",selfClosing:!0,container:!1,wrappable:!1,template:"[theme-switcher /]",attrs:[{name:"position",type:"select",label:"Position",options:[["","Inline - where the tag is"],["top-left","Top left"],["top-right","Top right"],["left-center","Left, centred"],["right-center","Right, centred"],["bottom-left","Bottom left"],["bottom-right","Bottom right"]]},{name:"offset-x",type:"number",label:"Offset from the side (px, pinned only)"},{name:"offset-y",type:"number",label:"Offset from the top/bottom (px, pinned only)"},{name:"themes",type:"text",label:"Themes (comma list - blank for the site's)"}]},{name:"icon",label:"Icon",icon:"icon-pick",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[icon name="arrow-right" /]',attrs:[{name:"name",type:"icon",label:"Icon name"},{name:"size",type:"number",label:"Size (px)"},{name:"color",type:"colour",label:"Colour"},{name:"class",type:"text",label:"CSS class"}]},{name:"image",label:"Image",icon:"image-add",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[image src="/media/photo.jpg" alt="" /]',custom:"image",quickAttrs:["zoom","align","width","shadow"],attrs:[{name:"src",type:"image",label:"Image",help:"The picture: choose it from Media, or type a /media/\u2026 path or an https:// address."},{name:"alt",type:"text",label:"Description (alt)",help:"What the picture shows, in a few words. Screen readers and search engines read it. Leave empty only for decoration."},{name:"caption",type:"text",label:"Caption",help:"Shown under the picture, and in the zoom view."},{name:"zoom",type:"checkbox",label:"Click to zoom",help:"Visitors click the picture to see it full size in a viewer: fitted first, then actual size with drag to pan. Best for screenshots with small text. Ignored when the picture has a link."},{name:"width",type:"text",label:"Width (480, 60%, 30rem)",help:"How wide the picture shows. A bare number is pixels. Empty: its own size, never wider than the column."},{name:"align",type:"select",label:"Alignment",options:[["","Default (left)"],["center","Centre"],["right","Right"],["float-left","Float left (text wraps)"],["float-right","Float right (text wraps)"]],help:"Floats let the text run beside the picture; on phones they stack."},{name:"group",type:"text",label:"Zoom group",help:"Give zoomable pictures the same group name and the viewer steps between them with arrows - a gallery or a tour."},{name:"zoom-src",type:"image",label:"Full-size file (zoom)",help:"Optional: a larger file for the zoom view, when the page shows a smaller copy."},{name:"title",type:"text",label:"Hover text (title)"},{name:"max-width",type:"text",label:"Max width (800, 50%)"},{name:"height",type:"text",label:"Height (240, 20rem)",help:"A set height crops the picture to fill the box (see Fit)."},{name:"fit",type:"select",label:"Fit (with a height)",options:[["","Fill and crop (default)"],["contain","Show it all"],["fill","Stretch"],["none","Actual size"],["scale-down","Shrink only"]]},{name:"radius",type:"select",label:"Corners",options:[["","Square"],["sm","Slightly rounded"],["md","Rounded"],["lg","Very rounded"],["full","Circle / pill"]]},{name:"border",type:"checkbox",label:"Border"},{name:"shadow",type:"select",label:"Shadow",options:[["","None"],["sm","Small"],["md","Medium"],["lg","Large"]]},{name:"link",type:"url",label:"Link to",help:"Clicking the picture goes here instead of zooming."},{name:"target",type:"select",label:"Open link in",options:[["","Same tab"],["_blank","New tab"]]},{name:"loading",type:"select",label:"Loading",options:[["","When scrolled near (lazy)"],["eager","Straight away (top of page)"]]},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"map",label:"Map",icon:"map-pin",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[map address="10 Downing Street, London" zoom="15" /]',attrs:[{name:"pin",type:"text",label:"Pin (latitude, longitude)"},{name:"pins",type:"text",label:"Several pins",help:"For a map of several places, split by |. Each is latitude,longitude then a label, or Label = an address (Office = SW1A 2AA | 51.5007,-0.1246 Big Ben). Addresses are found when the page is saved, once Address look-ups is on in Site Settings. Shown on OpenStreetMap."},{name:"lat",type:"number",label:"Latitude"},{name:"lon",type:"number",label:"Longitude"},{name:"address",type:"text",label:"Address"},{name:"postcode",type:"text",label:"Postcode"},{name:"zoom",type:"number",label:"Zoom (1-20)"},{name:"title",type:"text",label:"Title"},{name:"caption",type:"text",label:"Caption"},{name:"directions",type:"checkbox",label:"Directions link"},{name:"ratio",type:"select",label:"Aspect ratio",options:[["16:9","16:9"],["4:3","4:3"],["1:1","1:1"],["21:9","21:9"]]},{name:"width",type:"text",label:"Width"},{name:"align",type:"select",label:"Alignment",options:[["left","Left"],["center","Centre"],["right","Right"]]}]},{name:"embed",label:"Embed",icon:"video",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[embed url="https://youtu.be/dQw4w9WgXcQ" /]',custom:"embed",attrs:[{name:"url",type:"url",label:"URL"},{name:"ratio",type:"select",label:"Aspect ratio",options:[["16:9","16:9"],["4:3","4:3"],["1:1","1:1"],["21:9","21:9"],["9:16","9:16"],["3:4","3:4"]]},{name:"title",type:"text",label:"Title / caption"},{name:"width",type:"text",label:"Width"},{name:"align",type:"select",label:"Alignment",options:[["left","Left"],["center","Centre"],["right","Right"]]},{name:"autoplay",type:"checkbox",label:"Autoplay"},{name:"loop",type:"checkbox",label:"Loop"},{name:"muted",type:"checkbox",label:"Muted"}]}];for(const e of SHORTCODES){e.attrs||(e.attrs=[]);for(const a of i)e.attrs.some(t=>t.name===a.name)||e.attrs.push(a)}export const EDITOR_TOOLS=[{name:"colourpick",label:"Colour picker",icon:"colour-picker",category:"Media",custom:"colourpick"},{name:"component",label:"Component",icon:"component",category:"Components",custom:"component"},{name:"scribe",label:"Scribe",icon:"scribe-insert",category:"Content",custom:"scribe"},{name:"highlight-text",label:"Highlight text",icon:"star",category:"Content",custom:"highlighttext",wrappable:!0}];
@@ -1,3 +1,3 @@
1
- export const TAB_FIELDS={general:["title","tagline","siteUrl","adminHome","spacerSize","bodyClass","charactersEnabled","charactersAnimated","charactersLaunchers","charactersChats","charactersBuilders","charactersDot","charactersDaisy"],branding:["brandEnabled","brandText","brandLogo","brandIcon","brandUrl","adminBrandEnabled","adminBrandTitle","adminBrandLogo","adminBrandLogoDark","adminBrandIcon"],favicon:["favicon"],footer:["footerCopyright","footerLayout","footerBlurb","footerBlocks","footerClass","footerSocialClass","footerLook","footerCtaText","footerCtaHighlight","footerCtaUrl","footerCtaSub","footerWatermark","footerStatus","footerFacts","footerTagline","footerEmail","footerAddress","footerGradFrom","footerGradTo","socialTwitter","socialFacebook","socialInstagram","socialLinkedin","socialGithub","socialYoutube"],email:["smtpHost","smtpPort","smtpUser","smtpPass","smtpSecure","smtpInsecureTLS","smtpFromAddress","smtpFromName"],pageNavigation:["bttEnabled","bttSmooth","bttLabel","bttThreshold","bttPosition","bttOffset","bttBottomOffset","gtbEnabled","gtbSmooth","gtbLabel","gtbThreshold","gtbPosition","gtbOffset","gtbBottomOffset"],cookies:["ccEnabled","ccMessage","ccAcceptAll","ccRejectAll","ccCustomize","ccSavePrefs","ccPrivacyText","ccPrivacyUrl","ccCookieText","ccCookieUrl","ccPosition","ccLayout","ccTheme","ccShowFunctional","ccShowAnalytics","ccShowMarketing","ccVersion","ccSettingsLink","ccSettingsLinkText"],breadcrumbs:["bcEnabled","bcHomeLabel","bcPosition","bcOffsetX","bcOffsetY"],motion:["mtEnabled","mtLabel","mtDefault","mtControl","mtPlacement","mtTriggerStyle","mtPosition","mtOffsetX","mtOffsetY","mtIconSize","mtIconRadius","mtClass"]},SECRET_FIELDS=["smtpPass"],BREADCRUMB_POSITIONS=["TL","TR","BL","BR"],MOTION_PLACEMENTS=["footer","floating","navbar"],MOTION_LABEL="Reduce motion";const b=["system","off","on"],i=(t,r,a,o)=>{const n=Number.parseInt(t,10);return Number.isFinite(n)?Math.min(o,Math.max(a,n)):r};export function motionFromSettings(t={}){const r=t.motion&&typeof t.motion=="object"?t.motion:{},a=t.footer||{},o=m=>r[m]!==void 0&&r[m]!==null,n=o("default")?r.default:a.motionDefault,s=o("control")?r.control:a.motionControl,l=i(r.iconSize,52,32,96);return{mtEnabled:(o("enabled")?r.enabled:a.showMotionToggle)!==!1,mtLabel:typeof r.label=="string"&&r.label.trim()?r.label.trim():MOTION_LABEL,mtDefault:b.includes(n)?n:"system",mtControl:s==="checkbox"?"checkbox":"switch",mtPlacement:MOTION_PLACEMENTS.includes(r.placement)?r.placement:"footer",mtTriggerStyle:r.triggerStyle==="icon-text"?"icon-text":"icon",mtPosition:BREADCRUMB_POSITIONS.includes(r.position)?r.position:"BL",mtOffsetX:e(i(r.offsetX,32,0,500)),mtOffsetY:e(i(r.offsetY,32,0,500)),mtIconSize:e(l),mtIconRadius:e(i(r.iconRadius,26,0,Math.floor(l/2))),mtClass:e(r.class)}}export function motionFromForm(t){const r=i(t.mtIconSize,52,32,96);return{enabled:t.mtEnabled===!0,default:b.includes(t.mtDefault)?t.mtDefault:"system",placement:MOTION_PLACEMENTS.includes(t.mtPlacement)?t.mtPlacement:"footer",control:t.mtControl==="checkbox"?"checkbox":"switch",triggerStyle:t.mtTriggerStyle==="icon-text"?"icon-text":"icon",label:e(t.mtLabel).trim().replace(/\s+/g," ").slice(0,40)||MOTION_LABEL,position:BREADCRUMB_POSITIONS.includes(t.mtPosition)?t.mtPosition:"BL",offsetX:i(t.mtOffsetX,32,0,500),offsetY:i(t.mtOffsetY,32,0,500),iconSize:r,iconRadius:i(t.mtIconRadius,26,0,Math.floor(r/2)),class:e(t.mtClass).trim()}}export function footerBlockNames(t){return[...new Set(String(t??"").split(/[\s,]+/).map(r=>r.trim().toLowerCase()).filter(Boolean))]}export function gaIdError(t){const r=e(t).trim();return!r||/^G-[A-Z0-9]{4,20}$/i.test(r)?"":"A measurement ID looks like G-XXXXXXXXXX (Google Analytics > Admin > Data streams)."}export const FOOTER_LAYOUTS=["auto","columns","row"],FOOTER_LOOKS=["","showcase"],FOOTER_FACTS_MAX=4;const h=/^(\/|#|https?:\/\/|mailto:)/,p=/^#[0-9a-f]{6}$/i;export function footerShowcaseErrors(t){const r=[],a=e(t.footerCtaUrl).trim();a&&!h.test(a)&&r.push("The footer call to action link must start with /, #, https:// or mailto: (Footer tool).");for(const[o,n]of[["from",t.footerGradFrom],["to",t.footerGradTo]]){const s=e(n).trim();s&&!p.test(s)&&r.push(`The footer gradient "${o}" colour must look like #f26b3a (Footer tool).`)}return r}const e=(t,r="")=>t==null?r:String(t),c=(t,r)=>{const a=Number.parseInt(t,10);return Number.isFinite(a)?a:r};export function homeValue(t){return/^\/[A-Za-z0-9\-_/]*$/.test(t||"")&&String(t).replace(/\/+$/,"")||"/"}export function formFromSettings(t={}){const r=t.backToTop||{},a=t.goToBottom||{},o=t.cookieConsent||{},n=t.breadcrumbs||{};return{title:e(t.title),tagline:e(t.tagline),siteUrl:e(t.baseUrl),adminHome:homeValue(t.adminHome),spacerSize:e(t.layoutOptions?.spacerSize??40),bodyClass:e(t.bodyClass),charactersEnabled:t.characters?.enabled!==!1,charactersAnimated:t.characters?.animated!==!1,charactersLaunchers:t.characters?.launchers!==!1,charactersChats:t.characters?.chats!==!1,charactersBuilders:t.characters?.builders!==!1,charactersDot:t.characters?.dot!==!1,charactersDaisy:t.characters?.daisy!==!1,brandEnabled:t.brand?.enabled!==!1,brandText:e(t.brand?.text),brandLogo:e(t.brand?.logo),brandIcon:e(t.brand?.icon),brandUrl:e(t.brand?.url,"/"),favicon:e(t.favicon),adminBrandEnabled:t.adminBrand?.enabled!==!1,adminBrandTitle:e(t.adminBrand?.title),adminBrandLogo:e(t.adminBrand?.logo),adminBrandLogoDark:e(t.adminBrand?.logoDark),adminBrandIcon:e(t.adminBrand?.icon),footerCopyright:e(t.footer?.copyright),footerLayout:FOOTER_LAYOUTS.includes(t.footer?.layout)?t.footer.layout:"auto",footerBlurb:e(t.footer?.blurb),footerBlocks:Array.isArray(t.footer?.blocks)?t.footer.blocks.filter(s=>typeof s=="string").join(", "):"",footerClass:e(t.footer?.class),footerSocialClass:e(t.footer?.socialClass),footerLook:FOOTER_LOOKS.includes(t.footer?.look)?t.footer.look:"",footerCtaText:e(t.footer?.cta?.text),footerCtaHighlight:e(t.footer?.cta?.highlight),footerCtaUrl:e(t.footer?.cta?.url),footerCtaSub:e(t.footer?.cta?.sub),footerWatermark:e(t.footer?.watermark),footerStatus:e(t.footer?.status),footerFacts:Array.isArray(t.footer?.facts)?t.footer.facts.filter(s=>typeof s=="string").join(`
2
- `):"",footerTagline:e(t.footer?.tagline),footerEmail:e(t.footer?.email),footerAddress:e(t.footer?.address),footerGradFrom:e(t.footer?.gradient?.from),footerGradTo:e(t.footer?.gradient?.to),socialTwitter:e(t.social?.twitter),socialFacebook:e(t.social?.facebook),socialInstagram:e(t.social?.instagram),socialLinkedin:e(t.social?.linkedin),socialGithub:e(t.social?.github),socialYoutube:e(t.social?.youtube),smtpHost:e(t.smtp?.host),smtpPort:e(t.smtp?.port||587),smtpUser:e(t.smtp?.user),smtpPass:"",smtpSecure:t.smtp?.secure===!0,smtpInsecureTLS:t.smtp?.allowInsecureTLS===!0,smtpFromAddress:e(t.smtp?.fromAddress),smtpFromName:e(t.smtp?.fromName),bttEnabled:r.enabled!==!1,bttSmooth:r.smooth!==!1,bttLabel:e(r.label),bttThreshold:e(r.scrollThreshold??300),bttPosition:e(r.position,"bottom-right"),bttOffset:e(r.offset??32),bttBottomOffset:e(r.bottomOffset??r.offset??32),gtbEnabled:a.enabled===!0,gtbSmooth:a.smooth!==!1,gtbLabel:e(a.label),gtbThreshold:e(a.scrollThreshold??300),gtbPosition:e(a.position,"bottom-right"),gtbOffset:e(a.offset??32),gtbBottomOffset:e(a.bottomOffset??a.offset??32),ccEnabled:o.enabled!==!1,ccMessage:e(o.message),ccAcceptAll:e(o.acceptAllText,"Accept All"),ccRejectAll:e(o.rejectAllText,"Reject All"),ccCustomize:e(o.customizeText,"Customize"),ccSavePrefs:e(o.savePreferencesText,"Save Preferences"),ccPrivacyText:e(o.privacyPolicyText,"Privacy Policy"),ccPrivacyUrl:e(o.privacyPolicyUrl),ccCookieText:e(o.cookiePolicyText,"Cookie Policy"),ccCookieUrl:e(o.cookiePolicyUrl),ccPosition:e(o.position,"bottom"),ccLayout:e(o.layout,"bar"),ccTheme:e(o.theme,"dark"),ccShowFunctional:o.showFunctional!==!1,ccShowAnalytics:o.showAnalytics!==!1,ccShowMarketing:o.showMarketing!==!1,ccVersion:e(o.consentVersion,"1.0"),ccSettingsLink:o.showSettingsLink!==!1,ccSettingsLinkText:e(o.settingsLinkText,"Cookie settings"),bcEnabled:n.enabled===!0,bcHomeLabel:e(n.homeLabel,"Home"),bcPosition:BREADCRUMB_POSITIONS.includes(n.position)?n.position:"TL",bcOffsetX:e(n.offsetX??8),bcOffsetY:e(n.offsetY??8),...motionFromSettings(t)}}export function payloadFromForm(t,r={},{adminHomeReady:a=!0}={}){const o=s=>e(s).trim(),n=motionFromForm(t);return{title:o(t.title),tagline:o(t.tagline),baseUrl:o(t.siteUrl).replace(/\/+$/,""),...a&&{adminHome:o(t.adminHome)||"/"},layoutOptions:{spacerSize:c(t.spacerSize,40)||40},bodyClass:o(t.bodyClass),characters:{enabled:t.charactersEnabled!==!1,animated:t.charactersAnimated!==!1,launchers:t.charactersLaunchers!==!1,chats:t.charactersChats!==!1,builders:t.charactersBuilders!==!1,dot:t.charactersDot!==!1,daisy:t.charactersDaisy!==!1},brand:{...r.brand,enabled:t.brandEnabled!==!1,text:o(t.brandText),logo:o(t.brandLogo),icon:o(t.brandIcon),url:o(t.brandUrl)||"/"},favicon:o(t.favicon),adminBrand:{...r.adminBrand,enabled:t.adminBrandEnabled!==!1,title:o(t.adminBrandTitle),logo:o(t.adminBrandLogo),logoDark:o(t.adminBrandLogoDark),icon:o(t.adminBrandIcon)},footer:{copyright:o(t.footerCopyright),layout:FOOTER_LAYOUTS.includes(t.footerLayout)?t.footerLayout:"auto",blurb:o(t.footerBlurb),blocks:footerBlockNames(t.footerBlocks),links:r.footer?.links||[],showMotionToggle:n.enabled,motionDefault:n.default,motionControl:n.control,class:o(t.footerClass),socialClass:o(t.footerSocialClass),look:FOOTER_LOOKS.includes(t.footerLook)?t.footerLook:"",cta:{text:o(t.footerCtaText),highlight:o(t.footerCtaHighlight),url:o(t.footerCtaUrl),sub:o(t.footerCtaSub)},watermark:o(t.footerWatermark),status:o(t.footerStatus),facts:String(t.footerFacts??"").split(`
3
- `).map(s=>s.trim()).filter(Boolean).slice(0,FOOTER_FACTS_MAX),tagline:o(t.footerTagline),email:o(t.footerEmail),address:o(t.footerAddress),gradient:{from:o(t.footerGradFrom),to:o(t.footerGradTo)}},social:{twitter:o(t.socialTwitter),facebook:o(t.socialFacebook),instagram:o(t.socialInstagram),linkedin:o(t.socialLinkedin),github:o(t.socialGithub),youtube:o(t.socialYoutube)},smtp:{host:o(t.smtpHost),port:c(t.smtpPort,587)||587,user:o(t.smtpUser),pass:e(t.smtpPass),secure:t.smtpSecure===!0,allowInsecureTLS:t.smtpInsecureTLS===!0,fromAddress:o(t.smtpFromAddress),fromName:o(t.smtpFromName)},backToTop:{enabled:t.bttEnabled===!0,scrollThreshold:c(t.bttThreshold,300),position:e(t.bttPosition)||"bottom-right",offset:c(t.bttOffset,32),bottomOffset:c(t.bttBottomOffset,32),label:o(t.bttLabel),smooth:t.bttSmooth===!0},goToBottom:{enabled:t.gtbEnabled===!0,scrollThreshold:c(t.gtbThreshold,300),position:e(t.gtbPosition)||"bottom-right",offset:c(t.gtbOffset,32),bottomOffset:c(t.gtbBottomOffset,32),label:o(t.gtbLabel),smooth:t.gtbSmooth===!0},cookieConsent:{enabled:t.ccEnabled===!0,message:o(t.ccMessage),acceptAllText:o(t.ccAcceptAll),rejectAllText:o(t.ccRejectAll),customizeText:o(t.ccCustomize),savePreferencesText:o(t.ccSavePrefs),privacyPolicyText:o(t.ccPrivacyText),privacyPolicyUrl:o(t.ccPrivacyUrl),cookiePolicyText:o(t.ccCookieText),cookiePolicyUrl:o(t.ccCookieUrl),position:e(t.ccPosition)||"bottom",layout:e(t.ccLayout)||"bar",theme:e(t.ccTheme)||"dark",showFunctional:t.ccShowFunctional===!0,showAnalytics:t.ccShowAnalytics===!0,showMarketing:t.ccShowMarketing===!0,consentVersion:o(t.ccVersion)||"1.0",showSettingsLink:t.ccSettingsLink===!0,settingsLinkText:o(t.ccSettingsLinkText)||"Cookie settings"},breadcrumbs:{enabled:t.bcEnabled===!0,homeLabel:o(t.bcHomeLabel)||"Home",position:BREADCRUMB_POSITIONS.includes(t.bcPosition)?t.bcPosition:"TL",offsetX:c(t.bcOffsetX,8),offsetY:c(t.bcOffsetY,8)},motion:n}}export function siteUrlError(t){const r=e(t).trim().replace(/\/+$/,"");return r?/^https?:\/\//i.test(r)?/^https?:\/\/([a-z0-9.\-]+|\[[0-9a-f:.]+\])(:\d{1,5})?$/i.test(r)?"":"Just the address, like https://example.com - no page path after it.":"Start with https:// (or http://).":""}const d=t=>typeof t=="boolean"?t:e(t);export function snapshot(t){return JSON.stringify(Object.keys(t).sort().map(r=>[r,d(t[r])]))}export function changedTabs(t,r){const a=[];for(const[o,n]of Object.entries(TAB_FIELDS))n.some(s=>d(t[s])!==d(r[s]))&&a.push(o);return a}export function draftOf(t){return Object.fromEntries(Object.entries(t).filter(([r])=>!SECRET_FIELDS.includes(r)))}const g={footerMotionToggle:"mtEnabled",footerMotionDefault:"mtDefault",footerMotionControl:"mtControl"};export function formFromDraft(t,r={}){const a={...r};for(const[n,s]of Object.entries(g))n in a&&!(s in a)&&(a[s]=a[n]),delete a[n];const o={...t};for(const[n,s]of Object.entries(a))n in o&&!SECRET_FIELDS.includes(n)&&(o[n]=s);return o}export function settingsProblems(t,r={}){const a=[];return e(t.smtpHost).trim()?e(t.smtpFromAddress).trim()||a.push({tone:"warn",tab:"email",text:"No From address - mail has no sender and many servers refuse it."}):a.push({tone:"danger",tab:"email",text:"No SMTP host - mail goes to a throwaway test inbox and reaches no one (password resets, form notifications)."}),(t.ccEnabled===!0||e(r.googleAnalytics?.measurementId).trim())&&!e(t.ccPrivacyUrl).trim()&&a.push({tone:"warn",tab:"cookies",text:"The cookie banner is on but links to no privacy policy."}),a}export function describeCacheKey(t){const r=/^page:(.*?):m\d+:role([^:]*):/.exec(String(t||""));return r?{path:r[1]||"/",role:r[2]||"anon",page:!0}:{path:String(t||""),role:"",page:!1}}export function expiresIn(t,r=Date.now()){if(t==null)return"no expiry";const a=t-r;return a<=0?"expired":a<6e4?`${Math.round(a/1e3)}s`:a<36e5?`${Math.round(a/6e4)}m`:`${Math.round(a/36e5)}h`}export function footerForm(t={}){const r=formFromSettings(t);return Object.fromEntries(TAB_FIELDS.footer.map(a=>[a,r[a]]))}export function footerPayload(t){const{footer:r,social:a}=payloadFromForm(t);return delete r.links,delete r.showMotionToggle,delete r.motionDefault,delete r.motionControl,{footer:r,social:a}}export function siteSettingsForm(t={}){return Object.fromEntries(Object.entries(formFromSettings(t)).filter(([r])=>!TAB_FIELDS.footer.includes(r)&&!u.includes(r)))}export function siteSettingsPayload(...t){const{footer:r,social:a,favicon:o,backToTop:n,goToBottom:s,breadcrumbs:l,motion:m,...f}=payloadFromForm(...t);return f}export const APPEARANCE_TABS=["favicon","pageNavigation","breadcrumbs","motion","search"];const u=APPEARANCE_TABS.flatMap(t=>TAB_FIELDS[t]||[]);export function appearanceForm(t={}){const r=formFromSettings(t);return Object.fromEntries(u.map(a=>[a,r[a]]))}export function appearancePayload(t){const{favicon:r,backToTop:a,goToBottom:o,breadcrumbs:n,motion:s}=payloadFromForm(t);return{favicon:r,backToTop:a,goToBottom:o,breadcrumbs:n,motion:s}}
1
+ export const TAB_FIELDS={general:["title","tagline","siteUrl","adminHome","spacerSize","bodyClass","charactersEnabled","charactersAnimated","charactersLaunchers","charactersChats","charactersBuilders","charactersDot","charactersDaisy","mapLookups"],branding:["brandEnabled","brandText","brandLogo","brandIcon","brandUrl","adminBrandEnabled","adminBrandTitle","adminBrandLogo","adminBrandLogoDark","adminBrandIcon"],favicon:["favicon"],footer:["footerCopyright","footerLayout","footerBlurb","footerBlocks","footerClass","footerSocialClass","footerLook","footerCtaText","footerCtaHighlight","footerCtaUrl","footerCtaSub","footerWatermark","footerStatus","footerFacts","footerTagline","footerEmail","footerAddress","footerGradFrom","footerGradTo","socialTwitter","socialFacebook","socialInstagram","socialLinkedin","socialGithub","socialYoutube"],email:["emailBrandName","emailBrandLogo","emailBrandAccent","emailBrandSupport","emailBrandFooter","smtpHost","smtpPort","smtpUser","smtpPass","smtpSecure","smtpInsecureTLS","smtpFromAddress","smtpFromName"],pageNavigation:["bttEnabled","bttSmooth","bttLabel","bttThreshold","bttPosition","bttOffset","bttBottomOffset","gtbEnabled","gtbSmooth","gtbLabel","gtbThreshold","gtbPosition","gtbOffset","gtbBottomOffset"],cookies:["ccEnabled","ccMessage","ccAcceptAll","ccRejectAll","ccCustomize","ccSavePrefs","ccPrivacyText","ccPrivacyUrl","ccCookieText","ccCookieUrl","ccPosition","ccLayout","ccTheme","ccShowFunctional","ccShowAnalytics","ccShowMarketing","ccVersion","ccSettingsLink","ccSettingsLinkText"],breadcrumbs:["bcEnabled","bcHomeLabel","bcPosition","bcOffsetX","bcOffsetY"],motion:["mtEnabled","mtLabel","mtDefault","mtControl","mtPlacement","mtTriggerStyle","mtPosition","mtOffsetX","mtOffsetY","mtIconSize","mtIconRadius","mtClass"]},SECRET_FIELDS=["smtpPass"],BREADCRUMB_POSITIONS=["TL","TR","BL","BR"],MOTION_PLACEMENTS=["footer","floating","navbar"],MOTION_LABEL="Reduce motion";const b=["system","off","on"],c=(t,r,a,o)=>{const n=Number.parseInt(t,10);return Number.isFinite(n)?Math.min(o,Math.max(a,n)):r};export function motionFromSettings(t={}){const r=t.motion&&typeof t.motion=="object"?t.motion:{},a=t.footer||{},o=m=>r[m]!==void 0&&r[m]!==null,n=o("default")?r.default:a.motionDefault,s=o("control")?r.control:a.motionControl,l=c(r.iconSize,52,32,96);return{mtEnabled:(o("enabled")?r.enabled:a.showMotionToggle)!==!1,mtLabel:typeof r.label=="string"&&r.label.trim()?r.label.trim():MOTION_LABEL,mtDefault:b.includes(n)?n:"system",mtControl:s==="checkbox"?"checkbox":"switch",mtPlacement:MOTION_PLACEMENTS.includes(r.placement)?r.placement:"footer",mtTriggerStyle:r.triggerStyle==="icon-text"?"icon-text":"icon",mtPosition:BREADCRUMB_POSITIONS.includes(r.position)?r.position:"BL",mtOffsetX:e(c(r.offsetX,32,0,500)),mtOffsetY:e(c(r.offsetY,32,0,500)),mtIconSize:e(l),mtIconRadius:e(c(r.iconRadius,26,0,Math.floor(l/2))),mtClass:e(r.class)}}export function motionFromForm(t){const r=c(t.mtIconSize,52,32,96);return{enabled:t.mtEnabled===!0,default:b.includes(t.mtDefault)?t.mtDefault:"system",placement:MOTION_PLACEMENTS.includes(t.mtPlacement)?t.mtPlacement:"footer",control:t.mtControl==="checkbox"?"checkbox":"switch",triggerStyle:t.mtTriggerStyle==="icon-text"?"icon-text":"icon",label:e(t.mtLabel).trim().replace(/\s+/g," ").slice(0,40)||MOTION_LABEL,position:BREADCRUMB_POSITIONS.includes(t.mtPosition)?t.mtPosition:"BL",offsetX:c(t.mtOffsetX,32,0,500),offsetY:c(t.mtOffsetY,32,0,500),iconSize:r,iconRadius:c(t.mtIconRadius,26,0,Math.floor(r/2)),class:e(t.mtClass).trim()}}export function footerBlockNames(t){return[...new Set(String(t??"").split(/[\s,]+/).map(r=>r.trim().toLowerCase()).filter(Boolean))]}export function gaIdError(t){const r=e(t).trim();return!r||/^G-[A-Z0-9]{4,20}$/i.test(r)?"":"A measurement ID looks like G-XXXXXXXXXX (Google Analytics > Admin > Data streams)."}export const FOOTER_LAYOUTS=["auto","columns","row"],FOOTER_LOOKS=["","showcase"],FOOTER_FACTS_MAX=4;const p=/^(\/|#|https?:\/\/|mailto:)/,h=/^#[0-9a-f]{6}$/i;export function footerShowcaseErrors(t){const r=[],a=e(t.footerCtaUrl).trim();a&&!p.test(a)&&r.push("The footer call to action link must start with /, #, https:// or mailto: (Footer tool).");for(const[o,n]of[["from",t.footerGradFrom],["to",t.footerGradTo]]){const s=e(n).trim();s&&!h.test(s)&&r.push(`The footer gradient "${o}" colour must look like #f26b3a (Footer tool).`)}return r}const e=(t,r="")=>t==null?r:String(t),i=(t,r)=>{const a=Number.parseInt(t,10);return Number.isFinite(a)?a:r};export function homeValue(t){return/^\/[A-Za-z0-9\-_/]*$/.test(t||"")&&String(t).replace(/\/+$/,"")||"/"}export function formFromSettings(t={}){const r=t.backToTop||{},a=t.goToBottom||{},o=t.cookieConsent||{},n=t.breadcrumbs||{};return{title:e(t.title),tagline:e(t.tagline),siteUrl:e(t.baseUrl),adminHome:homeValue(t.adminHome),spacerSize:e(t.layoutOptions?.spacerSize??40),bodyClass:e(t.bodyClass),charactersEnabled:t.characters?.enabled!==!1,charactersAnimated:t.characters?.animated!==!1,charactersLaunchers:t.characters?.launchers!==!1,charactersChats:t.characters?.chats!==!1,charactersBuilders:t.characters?.builders!==!1,charactersDot:t.characters?.dot!==!1,charactersDaisy:t.characters?.daisy!==!1,mapLookups:t.maps?.lookupAddresses===!0,brandEnabled:t.brand?.enabled!==!1,brandText:e(t.brand?.text),brandLogo:e(t.brand?.logo),brandIcon:e(t.brand?.icon),brandUrl:e(t.brand?.url,"/"),favicon:e(t.favicon),adminBrandEnabled:t.adminBrand?.enabled!==!1,adminBrandTitle:e(t.adminBrand?.title),adminBrandLogo:e(t.adminBrand?.logo),adminBrandLogoDark:e(t.adminBrand?.logoDark),adminBrandIcon:e(t.adminBrand?.icon),footerCopyright:e(t.footer?.copyright),footerLayout:FOOTER_LAYOUTS.includes(t.footer?.layout)?t.footer.layout:"auto",footerBlurb:e(t.footer?.blurb),footerBlocks:Array.isArray(t.footer?.blocks)?t.footer.blocks.filter(s=>typeof s=="string").join(", "):"",footerClass:e(t.footer?.class),footerSocialClass:e(t.footer?.socialClass),footerLook:FOOTER_LOOKS.includes(t.footer?.look)?t.footer.look:"",footerCtaText:e(t.footer?.cta?.text),footerCtaHighlight:e(t.footer?.cta?.highlight),footerCtaUrl:e(t.footer?.cta?.url),footerCtaSub:e(t.footer?.cta?.sub),footerWatermark:e(t.footer?.watermark),footerStatus:e(t.footer?.status),footerFacts:Array.isArray(t.footer?.facts)?t.footer.facts.filter(s=>typeof s=="string").join(`
2
+ `):"",footerTagline:e(t.footer?.tagline),footerEmail:e(t.footer?.email),footerAddress:e(t.footer?.address),footerGradFrom:e(t.footer?.gradient?.from),footerGradTo:e(t.footer?.gradient?.to),socialTwitter:e(t.social?.twitter),socialFacebook:e(t.social?.facebook),socialInstagram:e(t.social?.instagram),socialLinkedin:e(t.social?.linkedin),socialGithub:e(t.social?.github),socialYoutube:e(t.social?.youtube),emailBrandName:e(t.emailBrand?.name),emailBrandLogo:e(t.emailBrand?.logo),emailBrandAccent:e(t.emailBrand?.accent),emailBrandSupport:e(t.emailBrand?.supportEmail),emailBrandFooter:e(t.emailBrand?.footer),smtpHost:e(t.smtp?.host),smtpPort:e(t.smtp?.port||587),smtpUser:e(t.smtp?.user),smtpPass:"",smtpSecure:t.smtp?.secure===!0,smtpInsecureTLS:t.smtp?.allowInsecureTLS===!0,smtpFromAddress:e(t.smtp?.fromAddress),smtpFromName:e(t.smtp?.fromName),bttEnabled:r.enabled!==!1,bttSmooth:r.smooth!==!1,bttLabel:e(r.label),bttThreshold:e(r.scrollThreshold??300),bttPosition:e(r.position,"bottom-right"),bttOffset:e(r.offset??32),bttBottomOffset:e(r.bottomOffset??r.offset??32),gtbEnabled:a.enabled===!0,gtbSmooth:a.smooth!==!1,gtbLabel:e(a.label),gtbThreshold:e(a.scrollThreshold??300),gtbPosition:e(a.position,"bottom-right"),gtbOffset:e(a.offset??32),gtbBottomOffset:e(a.bottomOffset??a.offset??32),ccEnabled:o.enabled!==!1,ccMessage:e(o.message),ccAcceptAll:e(o.acceptAllText,"Accept All"),ccRejectAll:e(o.rejectAllText,"Reject All"),ccCustomize:e(o.customizeText,"Customize"),ccSavePrefs:e(o.savePreferencesText,"Save Preferences"),ccPrivacyText:e(o.privacyPolicyText,"Privacy Policy"),ccPrivacyUrl:e(o.privacyPolicyUrl),ccCookieText:e(o.cookiePolicyText,"Cookie Policy"),ccCookieUrl:e(o.cookiePolicyUrl),ccPosition:e(o.position,"bottom"),ccLayout:e(o.layout,"bar"),ccTheme:e(o.theme,"dark"),ccShowFunctional:o.showFunctional!==!1,ccShowAnalytics:o.showAnalytics!==!1,ccShowMarketing:o.showMarketing!==!1,ccVersion:e(o.consentVersion,"1.0"),ccSettingsLink:o.showSettingsLink!==!1,ccSettingsLinkText:e(o.settingsLinkText,"Cookie settings"),bcEnabled:n.enabled===!0,bcHomeLabel:e(n.homeLabel,"Home"),bcPosition:BREADCRUMB_POSITIONS.includes(n.position)?n.position:"TL",bcOffsetX:e(n.offsetX??8),bcOffsetY:e(n.offsetY??8),...motionFromSettings(t)}}export function payloadFromForm(t,r={},{adminHomeReady:a=!0}={}){const o=s=>e(s).trim(),n=motionFromForm(t);return{title:o(t.title),tagline:o(t.tagline),baseUrl:o(t.siteUrl).replace(/\/+$/,""),...a&&{adminHome:o(t.adminHome)||"/"},layoutOptions:{spacerSize:i(t.spacerSize,40)||40},bodyClass:o(t.bodyClass),characters:{enabled:t.charactersEnabled!==!1,animated:t.charactersAnimated!==!1,launchers:t.charactersLaunchers!==!1,chats:t.charactersChats!==!1,builders:t.charactersBuilders!==!1,dot:t.charactersDot!==!1,daisy:t.charactersDaisy!==!1},maps:{lookupAddresses:t.mapLookups===!0},brand:{...r.brand,enabled:t.brandEnabled!==!1,text:o(t.brandText),logo:o(t.brandLogo),icon:o(t.brandIcon),url:o(t.brandUrl)||"/"},favicon:o(t.favicon),adminBrand:{...r.adminBrand,enabled:t.adminBrandEnabled!==!1,title:o(t.adminBrandTitle),logo:o(t.adminBrandLogo),logoDark:o(t.adminBrandLogoDark),icon:o(t.adminBrandIcon)},footer:{copyright:o(t.footerCopyright),layout:FOOTER_LAYOUTS.includes(t.footerLayout)?t.footerLayout:"auto",blurb:o(t.footerBlurb),blocks:footerBlockNames(t.footerBlocks),links:r.footer?.links||[],showMotionToggle:n.enabled,motionDefault:n.default,motionControl:n.control,class:o(t.footerClass),socialClass:o(t.footerSocialClass),look:FOOTER_LOOKS.includes(t.footerLook)?t.footerLook:"",cta:{text:o(t.footerCtaText),highlight:o(t.footerCtaHighlight),url:o(t.footerCtaUrl),sub:o(t.footerCtaSub)},watermark:o(t.footerWatermark),status:o(t.footerStatus),facts:String(t.footerFacts??"").split(`
3
+ `).map(s=>s.trim()).filter(Boolean).slice(0,FOOTER_FACTS_MAX),tagline:o(t.footerTagline),email:o(t.footerEmail),address:o(t.footerAddress),gradient:{from:o(t.footerGradFrom),to:o(t.footerGradTo)}},social:{twitter:o(t.socialTwitter),facebook:o(t.socialFacebook),instagram:o(t.socialInstagram),linkedin:o(t.socialLinkedin),github:o(t.socialGithub),youtube:o(t.socialYoutube)},emailBrand:{...r.emailBrand,name:o(t.emailBrandName),logo:o(t.emailBrandLogo),accent:o(t.emailBrandAccent),supportEmail:o(t.emailBrandSupport),footer:o(t.emailBrandFooter)},smtp:{host:o(t.smtpHost),port:i(t.smtpPort,587)||587,user:o(t.smtpUser),pass:e(t.smtpPass),secure:t.smtpSecure===!0,allowInsecureTLS:t.smtpInsecureTLS===!0,fromAddress:o(t.smtpFromAddress),fromName:o(t.smtpFromName)},backToTop:{enabled:t.bttEnabled===!0,scrollThreshold:i(t.bttThreshold,300),position:e(t.bttPosition)||"bottom-right",offset:i(t.bttOffset,32),bottomOffset:i(t.bttBottomOffset,32),label:o(t.bttLabel),smooth:t.bttSmooth===!0},goToBottom:{enabled:t.gtbEnabled===!0,scrollThreshold:i(t.gtbThreshold,300),position:e(t.gtbPosition)||"bottom-right",offset:i(t.gtbOffset,32),bottomOffset:i(t.gtbBottomOffset,32),label:o(t.gtbLabel),smooth:t.gtbSmooth===!0},cookieConsent:{enabled:t.ccEnabled===!0,message:o(t.ccMessage),acceptAllText:o(t.ccAcceptAll),rejectAllText:o(t.ccRejectAll),customizeText:o(t.ccCustomize),savePreferencesText:o(t.ccSavePrefs),privacyPolicyText:o(t.ccPrivacyText),privacyPolicyUrl:o(t.ccPrivacyUrl),cookiePolicyText:o(t.ccCookieText),cookiePolicyUrl:o(t.ccCookieUrl),position:e(t.ccPosition)||"bottom",layout:e(t.ccLayout)||"bar",theme:e(t.ccTheme)||"dark",showFunctional:t.ccShowFunctional===!0,showAnalytics:t.ccShowAnalytics===!0,showMarketing:t.ccShowMarketing===!0,consentVersion:o(t.ccVersion)||"1.0",showSettingsLink:t.ccSettingsLink===!0,settingsLinkText:o(t.ccSettingsLinkText)||"Cookie settings"},breadcrumbs:{enabled:t.bcEnabled===!0,homeLabel:o(t.bcHomeLabel)||"Home",position:BREADCRUMB_POSITIONS.includes(t.bcPosition)?t.bcPosition:"TL",offsetX:i(t.bcOffsetX,8),offsetY:i(t.bcOffsetY,8)},motion:n}}export function siteUrlError(t){const r=e(t).trim().replace(/\/+$/,"");return r?/^https?:\/\//i.test(r)?/^https?:\/\/([a-z0-9.\-]+|\[[0-9a-f:.]+\])(:\d{1,5})?$/i.test(r)?"":"Just the address, like https://example.com - no page path after it.":"Start with https:// (or http://).":""}const d=t=>typeof t=="boolean"?t:e(t);export function snapshot(t){return JSON.stringify(Object.keys(t).sort().map(r=>[r,d(t[r])]))}export function changedTabs(t,r){const a=[];for(const[o,n]of Object.entries(TAB_FIELDS))n.some(s=>d(t[s])!==d(r[s]))&&a.push(o);return a}export function draftOf(t){return Object.fromEntries(Object.entries(t).filter(([r])=>!SECRET_FIELDS.includes(r)))}const g={footerMotionToggle:"mtEnabled",footerMotionDefault:"mtDefault",footerMotionControl:"mtControl"};export function formFromDraft(t,r={}){const a={...r};for(const[n,s]of Object.entries(g))n in a&&!(s in a)&&(a[s]=a[n]),delete a[n];const o={...t};for(const[n,s]of Object.entries(a))n in o&&!SECRET_FIELDS.includes(n)&&(o[n]=s);return o}export function settingsProblems(t,r={}){const a=[];return e(t.smtpHost).trim()?e(t.smtpFromAddress).trim()||a.push({tone:"warn",tab:"email",text:"No From address - mail has no sender and many servers refuse it."}):a.push({tone:"danger",tab:"email",text:"No SMTP host - mail goes to a throwaway test inbox and reaches no one (password resets, form notifications)."}),(t.ccEnabled===!0||e(r.googleAnalytics?.measurementId).trim())&&!e(t.ccPrivacyUrl).trim()&&a.push({tone:"warn",tab:"cookies",text:"The cookie banner is on but links to no privacy policy."}),a}export function describeCacheKey(t){const r=/^page:(.*?):m\d+:role([^:]*):/.exec(String(t||""));return r?{path:r[1]||"/",role:r[2]||"anon",page:!0}:{path:String(t||""),role:"",page:!1}}export function expiresIn(t,r=Date.now()){if(t==null)return"no expiry";const a=t-r;return a<=0?"expired":a<6e4?`${Math.round(a/1e3)}s`:a<36e5?`${Math.round(a/6e4)}m`:`${Math.round(a/36e5)}h`}export function footerForm(t={}){const r=formFromSettings(t);return Object.fromEntries(TAB_FIELDS.footer.map(a=>[a,r[a]]))}export function footerPayload(t){const{footer:r,social:a}=payloadFromForm(t);return delete r.links,delete r.showMotionToggle,delete r.motionDefault,delete r.motionControl,{footer:r,social:a}}export function siteSettingsForm(t={}){return Object.fromEntries(Object.entries(formFromSettings(t)).filter(([r])=>!TAB_FIELDS.footer.includes(r)&&!u.includes(r)))}export function siteSettingsPayload(...t){const{footer:r,social:a,favicon:o,backToTop:n,goToBottom:s,breadcrumbs:l,motion:m,...f}=payloadFromForm(...t);return f}export const APPEARANCE_TABS=["favicon","pageNavigation","breadcrumbs","motion","search"];const u=APPEARANCE_TABS.flatMap(t=>TAB_FIELDS[t]||[]);export function appearanceForm(t={}){const r=formFromSettings(t);return Object.fromEntries(u.map(a=>[a,r[a]]))}export function appearancePayload(t){const{favicon:r,backToTop:a,goToBottom:o,breadcrumbs:n,motion:s}=payloadFromForm(t);return{favicon:r,backToTop:a,goToBottom:o,breadcrumbs:n,motion:s}}
@@ -394,6 +394,7 @@
394
394
  [map pin=&quot;51.5034,-0.1276&quot; zoom=&quot;14&quot; ratio=&quot;4:3&quot; width=&quot;640&quot; align=&quot;center&quot; /]
395
395
  [map address=&quot;10 Downing Street, London&quot; directions=&quot;true&quot; /]
396
396
  [map pins=&quot;51.5034,-0.1276 Downing Street | 51.5007,-0.1246 Big Ben&quot; directions=&quot;true&quot; /]
397
+ [map pins=&quot;Office = SW1A 2AA | Warehouse = 1 Dock Road, Hull&quot; /]
397
398
  </code></pre>
398
399
  <table class="table table-sm">
399
400
  <thead>
@@ -416,7 +417,7 @@
416
417
  </tr>
417
418
  <tr>
418
419
  <td><code>pins</code></td>
419
- <td>Several places: <code>latitude,longitude</code> then a label, each split by <code>|</code>. Up to 50. Shown on OpenStreetMap with every pin in view; click a pin for its label</td>
420
+ <td>Several places, split by <code>|</code>: <code>latitude,longitude Label</code>, or <code>Label = an address</code> (or just the address). Up to 50. Shown on OpenStreetMap with every pin in view; click a pin for its label</td>
420
421
  </tr>
421
422
  <tr>
422
423
  <td><code>lat</code>, <code>lon</code> (or <code>lng</code>)</td>
@@ -447,7 +448,7 @@
447
448
  <td><code>true</code> adds a &quot;Get directions&quot; link under the map (with <code>pins</code>, in each pin&#39;s label), opening Google&#39;s route planner to the place in a new tab. Give your own words instead of <code>true</code> for the link (<code>directions=&quot;Find us&quot;</code>)</td>
448
449
  </tr>
449
450
  </tbody></table>
450
- <p>Give one of <code>postcode</code>, <code>address</code>, <code>pin</code>, or <code>lat</code> with <code>lon</code>. Pins take coordinates only: addresses and postcodes are not looked up.</p>
451
+ <p>Give one of <code>postcode</code>, <code>address</code>, <code>pin</code>, or <code>lat</code> with <code>lon</code>. Addresses in <code>pins</code> need <strong>Address look-ups</strong> switched on in Site Settings &gt; General &gt; Maps (off at first). They are then found when you save the page, which can take a few seconds for many; until then those pins are left off. Pins in blocks or collection entries need coordinates.</p>
451
452
  <h3 id="sc-demo"><code>demo</code> - a demo page in a frame</h3>
452
453
  <p>Shows a demo page kept on this site inside a frame.</p>
453
454
  <pre><code>[demo src=&quot;elements/accordion&quot; /]
@@ -96,6 +96,13 @@
96
96
  </div>
97
97
  <small class="text-muted">Reduced-motion preferences always take priority. Changes apply when the page is next opened or refreshed.</small>
98
98
  </div>
99
+ <div class="stx-card dm-settings-section">
100
+ <div class="stx-card-title dm-settings-section-title"><span data-icon="map-pin" data-icon-size="16" aria-hidden="true"></span>Maps</div>
101
+ <p class="text-muted">Let map pins use addresses, as in <code>[map pins="Office = SW1A 2AA"]</code>. When you save a page, the site looks its map addresses up with OpenStreetMap's Nominatim service, sending it the address text and this site's address. Visitors are never sent there. Off: pins need latitude,longitude.</p>
102
+ <div class="stx-grid">
103
+ <div class="stx-setting"><label class="form-label" for="stx-map-lookups">Address look-ups</label><input id="stx-map-lookups" type="checkbox" class="form-switch" data-model="mapLookups.value"></div>
104
+ </div>
105
+ </div>
99
106
  <div class="stx-card stx-moved dm-settings-section">
100
107
  <span data-icon="droplet"></span>
101
108
  <div class="stx-moved-text">
@@ -159,6 +166,25 @@
159
166
 
160
167
  <!-- SMTP -->
161
168
  <div class="tab-panel">
169
+ <div class="stx-card dm-settings-section">
170
+ <div class="stx-card-title dm-settings-section-title">Email identity</div>
171
+ <p class="text-muted">Automated emails inherit your public site name and logo. Use a PNG or JPEG logo for email; SVG site marks fall back to the brand name. Set overrides below when your email identity differs. Save before sending a test.</p>
172
+ <div class="stx-grid">
173
+ <div><label class="form-label" for="stx-email-brand-name">Email brand name</label><input id="stx-email-brand-name" class="form-input" data-model="emailBrandName.value" placeholder="Inherit site name"></div>
174
+ <div><label class="form-label" for="stx-email-brand-logo">Email logo</label><input id="stx-email-brand-logo" class="form-input" data-model="emailBrandLogo.value" placeholder="Inherit site logo"><button type="button" class="btn btn-sm btn-ghost" data-on-click="pickBrandImage('emailBrandLogo')">Choose image</button><button type="button" class="btn btn-sm btn-ghost" data-on-click="clearBrandImage('emailBrandLogo')">Use site logo</button></div>
175
+ <div><label class="form-label" for="stx-email-accent">Accent colour</label><input id="stx-email-accent" class="form-input" data-model="emailBrandAccent.value" placeholder="#2563eb" pattern="#[0-9a-fA-F]{6}"></div>
176
+ <div><label class="form-label" for="stx-email-support">Support email</label><input id="stx-email-support" type="email" class="form-input" data-model="emailBrandSupport.value" placeholder="Inherit site contact email"></div>
177
+ <div class="stx-wide"><label class="form-label" for="stx-email-footer">Email footer</label><textarea id="stx-email-footer" class="form-input" rows="2" maxlength="600" data-model="emailBrandFooter.value" placeholder="Your business contact details or a short sign-off"></textarea></div>
178
+ </div>
179
+ </div>
180
+ <div class="stx-card dm-settings-section">
181
+ <div class="stx-card-title dm-settings-section-title">Email preview gallery</div>
182
+ <p class="text-muted">Preview the shared layouts with sample data and your current email identity. Previewing sends nothing.</p>
183
+ <div class="stx-inline"><label for="stx-email-example">Example</label><select id="stx-email-example" class="form-select"><option value="test">SMTP and branding check</option><option value="account">Account invitation</option><option value="waypoint">Waypoint update</option><option value="booking">Booking confirmation</option><option value="shop">Order confirmation</option><option value="report">Digest and report</option><option value="campaign">Campaign and invitation</option></select><button type="button" class="btn btn-sm btn-outline" data-on-click="previewEmail">Preview</button></div>
184
+ <iframe id="stx-email-preview" title="Email layout preview" sandbox="" referrerpolicy="no-referrer" hidden style="width:100%;height:720px;border:1px solid #cbd5e1;border-radius:8px;margin-top:16px;background:#edf1f6;"></iframe>
185
+ <details><summary>Plain-text version</summary><pre id="stx-email-preview-text" style="white-space:pre-wrap;"></pre></details>
186
+ </div>
187
+
162
188
  <!-- Without a host the CMS falls back to an Ethereal test inbox, which ACCEPTS the mail and reports
163
189
  success - so nothing anywhere else looks wrong. Follows the field, not only the saved value. -->
164
190
  <p class="stx-alert is-warn" data-bind-hidden="!noSmtp.value">
@@ -1,11 +1,11 @@
1
- import{api as $,apiRequest as g}from"../api.js";import{placeTools as Re,WITHHELD_URL as Ie}from"../lib/sidebar-grouping.js";import{addBannerAction as fe}from"../lib/plugin-chrome.js";import{helpPopovers as Ae}from"../lib/help-popover.js";import{openMenuAt as G,sidebarCount as he}from"../lib/tool-kit.js";import{changedTabs as De,describeCacheKey as J,draftOf as He,expiresIn as Pe,formFromDraft as $e,siteSettingsForm as Be,homeValue as je,siteSettingsPayload as Ue,siteUrlError as ve,settingsProblems as qe,snapshot as be,TAB_FIELDS as _e}from"../lib/site-settings-arrange.js";import{pickMedia as Ke}from"../lib/media-picker.js";import{makeIconInput as Fe}from"../lib/shortcode-modal.js";import{fmtDateTime as We}from"../lib/dates.js";const Q=/^\/settings(\?.*)?$/,ge="#/settings",y="settings.draft",ze=`
1
+ import{api as P,apiRequest as v}from"../api.js";import{placeTools as qe,WITHHELD_URL as Be}from"../lib/sidebar-grouping.js";import{addBannerAction as he}from"../lib/plugin-chrome.js";import{helpPopovers as Pe}from"../lib/help-popover.js";import{openMenuAt as G,sidebarCount as ve}from"../lib/tool-kit.js";import{changedTabs as De,describeCacheKey as Q,draftOf as He,expiresIn as $e,formFromDraft as je,siteSettingsForm as Ue,homeValue as _e,siteSettingsPayload as be,siteUrlError as ye,settingsProblems as Ke,snapshot as ge,TAB_FIELDS as Fe}from"../lib/site-settings-arrange.js";import{pickMedia as We}from"../lib/media-picker.js";import{makeIconInput as Ne}from"../lib/shortcode-modal.js";import{fmtDateTime as ze}from"../lib/dates.js";const X=/^\/settings(\?.*)?$/,we="#/settings",g="settings.draft",Ve=`
2
2
  <div class="stx-problem">
3
3
  <span class="stx-chip" data-bind-class="tone === 'danger' ? 'is-bad' : 'is-warn'">{{label}}</span>
4
4
  <span>{{text}}</span>
5
5
  <button type="button" class="btn btn-sm btn-ghost" data-go="{{tab}}">Go there</button>
6
- </div>`,Ne=`
6
+ </div>`,Ye=`
7
7
  <div class="stx-row" data-id="{{id}}" tabindex="0">
8
8
  <span class="stx-main"><strong>{{path}}</strong><small>{{meta}}</small></span>
9
9
  <span class="stx-chip">{{expires}}</span>
10
10
  <button type="button" class="stx-kebab" aria-label="Actions for {{path}}" title="Actions">\u22EE</button>
11
- </div>`,B=["general","branding","email","cookies","cache"];async function Ve(c,l){const[r,w]=await Promise.all([H.get("/api/sidebar/menu").catch(()=>({items:[]})),H.get("/api/sidebar/registered-items").catch(()=>[])]),n=new Map([["/","Dashboard (built in)"]]),i=(p,u)=>{for(const o of p||[]){if(!o||o.hidden||o.restricted)continue;const a=typeof o.url=="string"?o.url:"";a.startsWith(Ie)||(a.startsWith("#/")&&a.length>2&&!n.has(a.slice(1))&&n.set(a.slice(1),`${u?`${u} \u203A `:""}${o.text||a}`),i(o.items,o.url?u:o.text||u))}},k=(w||[]).filter(p=>!/^~\d+$/.test(String(p?.item?.text||"")));i(Re(r?.items||[],k),""),n.has(l)||n.set(l,`${l} (not in the sidebar)`),c.replaceChildren();for(const[p,u]of n){const o=document.createElement("option");o.value=p,o.textContent=u,c.appendChild(o)}}let f=null,ye=!1;function Ye(){ye||!window.R?.use||(ye=!0,R.use((c,l,r)=>!(Q.test(l?.path||"")&&!Q.test(c?.path||""))||!f?.dirty()?r():E.confirm("You have unsaved settings. Leave anyway? They are kept as a draft for your next visit (not the SMTP password).").then(n=>{n?r():history.replaceState(null,"","#/settings")})),M.subscribe("router:afterChange",({to:c}={})=>{if(f&&!Q.test(c?.path||"")){const l=f;f=null,l.dispose()}}))}export const settingsView={templateUrl:"/admin/js/templates/settings.html",async onMount(c){if(Ye(),f){const e=f;f=null,e.dispose()}const l=[],r=e=>(l.push(e),e);let w=!1;const n=c.get(0).querySelector(".stx")||c.get(0),i=()=>!w&&n.isConnected,k=E.loader(c.get(0),{type:"dots"});let p;try{p=await $.settings.get()}catch(e){k.destroy(),E.toast(`Could not load the settings: ${e.message||e}`,{type:"error"});return}if(k.destroy(),!n.isConnected)return;const u=M.observable(p||{}),o=Be(p||{}),a={};for(const[e,t]of Object.entries(o))a[e]=M.observable(t);const j=()=>Object.fromEntries(Object.keys(a).map(e=>[e,a[e].value])),X=()=>Object.fromEntries(Object.keys(a).map(e=>[e,a[e].peek()])),v=M.observable(o),U=M.computed(()=>be(v.value)),x=M.computed(()=>be(j())!==U.value),C=M.observable(!1),T=M.observable(""),Z=M.observable(!1);$.plugins.policy().then(e=>{i()&&(Z.value=e?.signedOnly===!1)}).catch(()=>{});const q=M.observable(!1),ee=M.computed(()=>{const e=new Set(De(j(),v.value));return Object.fromEntries(Object.keys(_e).map(t=>[t,e.has(t)]))}),_=M.observable([]);r(M.effect(()=>{_.value=qe(j(),u.value).map(e=>({...e,label:e.tone==="danger"?"Mail":"Check"}))}));const te=M.observable(""),L=M.observable(!1),O=M.observable(""),A=M.observable(""),m=M.observable(null),K=M.observable([]),F=M.observable(""),W=M.observable(!0),z=M.observable(""),se=M.observable([]);r(M.effect(()=>{const e=F.value.trim().toLowerCase(),t=Date.now();se.value=[...K.value].reverse().filter(s=>!e||String(s.key).toLowerCase().includes(e)||(s.tags||[]).some(d=>String(d).toLowerCase().includes(e))).map(s=>{const d=J(s.key);return{id:s.key,path:d.path,meta:[d.page?`as ${d.role}`:"not a page",(s.tags||[]).join(", ")].filter(Boolean).join(" \xB7 "),expires:Pe(s.expiresAt,t)}})}));const ae=M.observable(!1);g("/ai-assist").catch(()=>null).then(e=>{i()&&(ae.value=e?.on===!0)});const we={...a,saving:C,dirty:x,tabs:ee,problems:_,testTo:te,testing:L,testResult:O,testTone:A,aiAssistOn:ae,cacheQuery:F,cacheLoading:W,cacheError:z,cacheRows:se,errorText:T,problemsText:M.computed(()=>_.value.length?"yes":""),siteUrlError:M.computed(()=>ve(a.siteUrl.value)),noSmtp:M.computed(()=>!String(a.smtpHost.value||"").trim()),mayAllowInsecureTLS:Z,dirtyEmail:M.computed(()=>ee.value.email),cacheOn:M.computed(()=>m.value?.enabled===!0),cacheState:M.computed(()=>{const e=m.value;return e?e.enabled?`On (${e.driver})`:"Off":"Status unknown"}),cacheSize:M.computed(()=>{const e=m.value;return e?.enabled&&e.size!==null&&e.size!==void 0?`${e.size}${e.maxItems?` of ${e.maxItems}`:""} entries`:""}),cacheHits:M.computed(()=>{const e=m.value?.hitRate;return e==null?"":`${Math.round(e*100)}% served from the cache`}),cacheToggleText:M.computed(()=>m.value?.enabled?"Turn off":"Turn on"),cacheEmpty:M.computed(()=>F.value.trim()?"Nothing matches.":m.value?.enabled?"The cache is empty - pages are cached as visitors open them.":"The cache is off.")};async function N(){if(C.peek())return;const e=X(),t=v.peek(),s=ve(e.siteUrl);if(s){E.toast(`Site URL: ${s}`,{type:"error"});return}C.value=!0,T.value="";const d=String(e.title).trim()!==String(t.title).trim();try{await $.settings.save(Ue(e,u.peek(),{adminHomeReady:q.peek()})),window.dispatchEvent(new Event("admin-assistant:settings"));const P=await $.settings.get().catch(()=>null);if(!i())return;P&&(u.value=P);const Oe={...e,smtpPass:""};a.smtpPass.value="",v.value=Oe;try{S.remove?S.remove(y):S.set(y,null)}catch{}document.dispatchEvent(new CustomEvent("dm:admin-home-changed")),(d||["adminBrandEnabled","adminBrandTitle","adminBrandLogo","adminBrandLogoDark","adminBrandIcon"].some(me=>e[me]!==t[me]))&&document.dispatchEvent(new CustomEvent("dm:sidebar-rebuild")),he(ge),E.toast("Settings saved.",{type:"success"})}catch(P){T.value=P.message||"Could not save the settings.",E.toast("Settings not saved - see the message at the top.",{type:"error"})}finally{C.value=!1}}async function ke(){await E.confirm("Throw away your unsaved settings?")&&(ne(v.peek()),T.value="")}function ne(e){for(const[t,s]of Object.entries(e))a[t]&&(a[t].value=s)}async function Ee(){if(!L.peek()){L.value=!0,A.value="",O.value="Sending\u2026";try{const e=await g("/settings/test-email",{method:"POST",body:JSON.stringify({to:te.peek().trim()||void 0})});if(!i())return;O.value=e?.message||"Test email sent.",A.value="is-ok"}catch(e){if(!i())return;O.value=e.message||"Could not send the test email.",A.value="is-bad"}finally{L.value=!1}}}async function D(){W.value=!0;try{const[e,t]=await Promise.all([g("/cache/status").catch(()=>null),g("/cache/keys")]);if(!i())return;m.value=e,K.value=Array.isArray(t?.entries)?t.entries:[],z.value=""}catch(e){if(!i())return;z.value=`Could not read the cache: ${e.message||e}`}finally{W.value=!1}}async function Se(){if(await E.confirm("Clear the whole response cache? The next visitor to each page renders it afresh.")){try{await g("/cache/clear",{method:"POST"}),E.toast("Cache cleared.",{type:"success"})}catch(e){E.toast(e.message||"Could not clear the cache.",{type:"error"})}i()&&await D()}}async function Me(){const e=m.peek()?.enabled===!0;if(!(e&&!await E.confirm("Turn the response cache off? Every visit will render its page afresh until it is turned back on. The choice is saved (config/cache.json)."))){try{m.value=await g("/cache/toggle",{method:"POST",body:JSON.stringify({enabled:!e})}),E.toast(e?"Cache turned off.":"Cache turned on.",{type:"success"}),he(ge)}catch(t){E.toast(t.message||"Could not change the cache.",{type:"error"})}i()&&await D()}}const oe=e=>K.peek().find(t=>t.key===e);function xe(e){const t=oe(e);if(!t)return[];const s=J(t.key);return[{header:s.path},{label:"Open the page",icon:"external-link",disabled:!s.page,action:()=>window.open(s.path,"_blank","noopener")},{label:"Copy key",icon:"copy",action:async()=>{try{await navigator.clipboard.writeText(t.key),E.toast("Key copied.",{type:"success"})}catch{E.toast("Could not copy - your browser blocked the clipboard.",{type:"warning"})}}},...s.page?[{label:"Copy address",icon:"link",action:async()=>{try{await navigator.clipboard.writeText(new URL(s.path,location.origin).href),E.toast("Address copied.",{type:"success"})}catch{E.toast("Could not copy - your browser blocked the clipboard.",{type:"warning"})}}}]:[]]}n.querySelector(".stx-problems").innerHTML=ze;const b=n.querySelector(".stx-list");b.innerHTML=Ne;const V=E.tabs(n.querySelector(".stx-tabs"),{tabSelector:".tab-item",panelSelector:".tab-panel"}),re=new URLSearchParams(location.hash.split("?")[1]||"").get("tab");B.includes(re)&&V.activate(B.indexOf(re));const Ce=M.applyBindings(we,n,{methods:{save:N,discard:ke,sendTest:Ee,refreshCache:D,clearCache:Se,toggleCache:Me,pickBrandImage:async e=>{const t=await Ke({title:"Choose a branding image",current:a[e].peek()});t&&i()&&(a[e].value=t)},clearBrandImage:e=>{a[e].value=""},goTab:e=>{const t=B.indexOf(e);t>=0&&V.activate(t)}}});r(()=>Ce.dispose());for(const e of n.querySelectorAll("[data-brand-icon]")){const t=e.dataset.brandIcon,s=Fe("Choose an icon",a[t].peek());s.input.id=`stx-${t}`,s.input.classList.add("form-input");const d=()=>{a[t].value=s.input.value};s.input.addEventListener("input",d),r(()=>s.input.removeEventListener("input",d)),r(M.effect(()=>{s.input.value=a[t].value})),e.appendChild(s.el)}r(Ae(n,{position:"bottom"}));const Te=e=>{const t=e.target.closest("[data-go]");if(!t)return;const s=B.indexOf(t.dataset.go);s>=0&&V.activate(s)};n.querySelector(".stx-problems").addEventListener("click",Te);const Y=n.querySelector("#stx-admin-home");Ve(Y,je(a.adminHome.peek())).then(()=>{i()&&(Y.value=a.adminHome.peek(),q.value=!0)}).catch(()=>{});const Le=E.contextMenu(b,{cursor:"glyph",match:".stx-row",inherit:!1,density:"compact",items:e=>xe(e.dataset.id)});r(()=>Le?.destroy?.());const ie=e=>{const t=oe(e.dataset.id),s=t&&J(t.key);s?.page?window.open(s.path,"_blank","noopener"):G(e)},ce=e=>{const t=e.target.closest(".stx-row");if(!t)return;const s=e.target.closest(".stx-kebab");if(s){G(s);return}ie(t)},le=e=>{const t=e.target.closest(".stx-row");t&&(e.key==="F10"&&e.shiftKey?(e.preventDefault(),G(t)):e.key==="Enter"&&e.target===t&&ie(t))};b.addEventListener("click",ce),b.addEventListener("keydown",le),r(()=>{b.removeEventListener("click",ce),b.removeEventListener("keydown",le)}),fe(c,{id:"settings-view-site",icon:"external-link",title:"View site",onClick:()=>window.open("/","_blank","noopener")}),fe(c,{id:"settings-save",icon:"save",title:"Save (Ctrl+S)",onClick:()=>N()});const ue=e=>{!(e.ctrlKey||e.metaKey)||e.key!=="s"||(e.preventDefault(),e.stopImmediatePropagation(),N())};document.addEventListener("keydown",ue,!0),r(()=>document.removeEventListener("keydown",ue,!0));const de=()=>{if(x.peek())try{S.set(y,{form:He(X()),base:U.peek(),at:new Date().toISOString()})}catch{}},pe=e=>{x.peek()&&(de(),e.preventDefault(),e.returnValue="")};window.addEventListener("beforeunload",pe),r(()=>window.removeEventListener("beforeunload",pe)),f={dirty:()=>x.peek(),dispose(){w=!0,de(),l.splice(0).reverse().forEach(e=>{try{e()}catch{}})}},I.scan(n),D();let h=null;try{h=S.get(y)}catch{}if(h?.form){try{S.remove?S.remove(y):S.set(y,null)}catch{}const e=h.base&&h.base!==U.peek(),t=h.at?` (${We(h.at)})`:"",s=e?`You left unsaved settings${t}, but the saved settings have changed since. Restore your version anyway?`:`You left unsaved settings${t}. Restore them?`;await E.confirm(s)&&i()&&(ne($e(v.peek(),h.form)),q.peek()&&(Y.value=a.adminHome.peek()))}}};
11
+ </div>`,D=["general","branding","email","cookies","cache"];async function Je(l,d){const[i,w]=await Promise.all([H.get("/api/sidebar/menu").catch(()=>({items:[]})),H.get("/api/sidebar/registered-items").catch(()=>[])]),n=new Map([["/","Dashboard (built in)"]]),o=(p,u)=>{for(const r of p||[]){if(!r||r.hidden||r.restricted)continue;const s=typeof r.url=="string"?r.url:"";s.startsWith(Be)||(s.startsWith("#/")&&s.length>2&&!n.has(s.slice(1))&&n.set(s.slice(1),`${u?`${u} \u203A `:""}${r.text||s}`),o(r.items,r.url?u:r.text||u))}},k=(w||[]).filter(p=>!/^~\d+$/.test(String(p?.item?.text||"")));o(qe(i?.items||[],k),""),n.has(d)||n.set(d,`${d} (not in the sidebar)`),l.replaceChildren();for(const[p,u]of n){const r=document.createElement("option");r.value=p,r.textContent=u,l.appendChild(r)}}let f=null,ke=!1;function Ge(){ke||!window.R?.use||(ke=!0,R.use((l,d,i)=>!(X.test(d?.path||"")&&!X.test(l?.path||""))||!f?.dirty()?i():E.confirm("You have unsaved settings. Leave anyway? They are kept as a draft for your next visit (not the SMTP password).").then(n=>{n?i():history.replaceState(null,"","#/settings")})),M.subscribe("router:afterChange",({to:l}={})=>{if(f&&!X.test(l?.path||"")){const d=f;f=null,d.dispose()}}))}export const settingsView={templateUrl:"/admin/js/templates/settings.html",async onMount(l){if(Ge(),f){const e=f;f=null,e.dispose()}const d=[],i=e=>(d.push(e),e);let w=!1;const n=l.get(0).querySelector(".stx")||l.get(0),o=()=>!w&&n.isConnected,k=E.loader(l.get(0),{type:"dots"});let p;try{p=await P.settings.get()}catch(e){k.destroy(),E.toast(`Could not load the settings: ${e.message||e}`,{type:"error"});return}if(k.destroy(),!n.isConnected)return;const u=M.observable(p||{}),r=Ue(p||{}),s={};for(const[e,t]of Object.entries(r))s[e]=M.observable(t);const $=()=>Object.fromEntries(Object.keys(s).map(e=>[e,s[e].value])),j=()=>Object.fromEntries(Object.keys(s).map(e=>[e,s[e].peek()])),b=M.observable(r),U=M.computed(()=>ge(b.value)),x=M.computed(()=>ge($())!==U.value),C=M.observable(!1),T=M.observable(""),Z=M.observable(!1);P.plugins.policy().then(e=>{o()&&(Z.value=e?.signedOnly===!1)}).catch(()=>{});const _=M.observable(!1),ee=M.computed(()=>{const e=new Set(De($(),b.value));return Object.fromEntries(Object.keys(Fe).map(t=>[t,e.has(t)]))}),K=M.observable([]);i(M.effect(()=>{K.value=Ke($(),u.value).map(e=>({...e,label:e.tone==="danger"?"Mail":"Check"}))}));const te=M.observable(""),O=M.observable(!1),L=M.observable(""),A=M.observable(""),m=M.observable(null),F=M.observable([]),W=M.observable(""),N=M.observable(!0),z=M.observable(""),ae=M.observable([]);i(M.effect(()=>{const e=W.value.trim().toLowerCase(),t=Date.now();ae.value=[...F.value].reverse().filter(a=>!e||String(a.key).toLowerCase().includes(e)||(a.tags||[]).some(c=>String(c).toLowerCase().includes(e))).map(a=>{const c=Q(a.key);return{id:a.key,path:c.path,meta:[c.page?`as ${c.role}`:"not a page",(a.tags||[]).join(", ")].filter(Boolean).join(" \xB7 "),expires:$e(a.expiresAt,t)}})}));const se=M.observable(!1);v("/ai-assist").catch(()=>null).then(e=>{o()&&(se.value=e?.on===!0)});const Ee={...s,saving:C,dirty:x,tabs:ee,problems:K,testTo:te,testing:O,testResult:L,testTone:A,aiAssistOn:se,cacheQuery:W,cacheLoading:N,cacheError:z,cacheRows:ae,errorText:T,problemsText:M.computed(()=>K.value.length?"yes":""),siteUrlError:M.computed(()=>ye(s.siteUrl.value)),noSmtp:M.computed(()=>!String(s.smtpHost.value||"").trim()),mayAllowInsecureTLS:Z,dirtyEmail:M.computed(()=>ee.value.email),cacheOn:M.computed(()=>m.value?.enabled===!0),cacheState:M.computed(()=>{const e=m.value;return e?e.enabled?`On (${e.driver})`:"Off":"Status unknown"}),cacheSize:M.computed(()=>{const e=m.value;return e?.enabled&&e.size!==null&&e.size!==void 0?`${e.size}${e.maxItems?` of ${e.maxItems}`:""} entries`:""}),cacheHits:M.computed(()=>{const e=m.value?.hitRate;return e==null?"":`${Math.round(e*100)}% served from the cache`}),cacheToggleText:M.computed(()=>m.value?.enabled?"Turn off":"Turn on"),cacheEmpty:M.computed(()=>W.value.trim()?"Nothing matches.":m.value?.enabled?"The cache is empty - pages are cached as visitors open them.":"The cache is off.")};async function V(){if(C.peek())return;const e=j(),t=b.peek(),a=ye(e.siteUrl);if(a){E.toast(`Site URL: ${a}`,{type:"error"});return}C.value=!0,T.value="";const c=String(e.title).trim()!==String(t.title).trim();try{await P.settings.save(be(e,u.peek(),{adminHomeReady:_.peek()})),window.dispatchEvent(new Event("admin-assistant:settings"));const B=await P.settings.get().catch(()=>null);if(!o())return;B&&(u.value=B);const Ae={...e,smtpPass:""};s.smtpPass.value="",b.value=Ae;try{S.remove?S.remove(g):S.set(g,null)}catch{}document.dispatchEvent(new CustomEvent("dm:admin-home-changed")),(c||["adminBrandEnabled","adminBrandTitle","adminBrandLogo","adminBrandLogoDark","adminBrandIcon"].some(fe=>e[fe]!==t[fe]))&&document.dispatchEvent(new CustomEvent("dm:sidebar-rebuild")),ve(we),E.toast("Settings saved.",{type:"success"})}catch(B){T.value=B.message||"Could not save the settings.",E.toast("Settings not saved - see the message at the top.",{type:"error"})}finally{C.value=!1}}async function Se(){await E.confirm("Throw away your unsaved settings?")&&(ne(b.peek()),T.value="")}function ne(e){for(const[t,a]of Object.entries(e))s[t]&&(s[t].value=a)}async function xe(){if(!O.peek()){O.value=!0,A.value="",L.value="Sending\u2026";try{const e=await v("/settings/test-email",{method:"POST",body:JSON.stringify({to:te.peek().trim()||void 0,example:n.querySelector("#stx-email-example").value})});if(!o())return;L.value=e?.message||"Test email sent.",A.value="is-ok"}catch(e){if(!o())return;L.value=e.message||"Could not send the test email.",A.value="is-bad"}finally{O.value=!1}}}let oe=0;async function Me(){const e=++oe;try{const t=j(),a=await v("/settings/email-preview",{method:"POST",body:JSON.stringify({example:n.querySelector("#stx-email-example").value,emailBrand:be(t,u.peek()).emailBrand})});if(!o()||e!==oe)return;const c=n.querySelector("#stx-email-preview");c.srcdoc=a.html,c.hidden=!1,n.querySelector("#stx-email-preview-text").textContent=a.text}catch(t){o()&&E.toast(t.message||"Could not preview the email.",{type:"error"})}}async function q(){N.value=!0;try{const[e,t]=await Promise.all([v("/cache/status").catch(()=>null),v("/cache/keys")]);if(!o())return;m.value=e,F.value=Array.isArray(t?.entries)?t.entries:[],z.value=""}catch(e){if(!o())return;z.value=`Could not read the cache: ${e.message||e}`}finally{N.value=!1}}async function Ce(){if(await E.confirm("Clear the whole response cache? The next visitor to each page renders it afresh.")){try{await v("/cache/clear",{method:"POST"}),E.toast("Cache cleared.",{type:"success"})}catch(e){E.toast(e.message||"Could not clear the cache.",{type:"error"})}o()&&await q()}}async function Te(){const e=m.peek()?.enabled===!0;if(!(e&&!await E.confirm("Turn the response cache off? Every visit will render its page afresh until it is turned back on. The choice is saved (config/cache.json)."))){try{m.value=await v("/cache/toggle",{method:"POST",body:JSON.stringify({enabled:!e})}),E.toast(e?"Cache turned off.":"Cache turned on.",{type:"success"}),ve(we)}catch(t){E.toast(t.message||"Could not change the cache.",{type:"error"})}o()&&await q()}}const re=e=>F.peek().find(t=>t.key===e);function Oe(e){const t=re(e);if(!t)return[];const a=Q(t.key);return[{header:a.path},{label:"Open the page",icon:"external-link",disabled:!a.page,action:()=>window.open(a.path,"_blank","noopener")},{label:"Copy key",icon:"copy",action:async()=>{try{await navigator.clipboard.writeText(t.key),E.toast("Key copied.",{type:"success"})}catch{E.toast("Could not copy - your browser blocked the clipboard.",{type:"warning"})}}},...a.page?[{label:"Copy address",icon:"link",action:async()=>{try{await navigator.clipboard.writeText(new URL(a.path,location.origin).href),E.toast("Address copied.",{type:"success"})}catch{E.toast("Could not copy - your browser blocked the clipboard.",{type:"warning"})}}}]:[]]}n.querySelector(".stx-problems").innerHTML=Ve;const y=n.querySelector(".stx-list");y.innerHTML=Ye;const Y=E.tabs(n.querySelector(".stx-tabs"),{tabSelector:".tab-item",panelSelector:".tab-panel"}),ie=new URLSearchParams(location.hash.split("?")[1]||"").get("tab");D.includes(ie)&&Y.activate(D.indexOf(ie));const Le=M.applyBindings(Ee,n,{methods:{save:V,discard:Se,sendTest:xe,previewEmail:Me,refreshCache:q,clearCache:Ce,toggleCache:Te,pickBrandImage:async e=>{const t=await We({title:"Choose a branding image",current:s[e].peek()});t&&o()&&(s[e].value=t)},clearBrandImage:e=>{s[e].value=""},goTab:e=>{const t=D.indexOf(e);t>=0&&Y.activate(t)}}});i(()=>Le.dispose());for(const e of n.querySelectorAll("[data-brand-icon]")){const t=e.dataset.brandIcon,a=Ne("Choose an icon",s[t].peek());a.input.id=`stx-${t}`,a.input.classList.add("form-input");const c=()=>{s[t].value=a.input.value};a.input.addEventListener("input",c),i(()=>a.input.removeEventListener("input",c)),i(M.effect(()=>{a.input.value=s[t].value})),e.appendChild(a.el)}i(Pe(n,{position:"bottom"}));const Re=e=>{const t=e.target.closest("[data-go]");if(!t)return;const a=D.indexOf(t.dataset.go);a>=0&&Y.activate(a)};n.querySelector(".stx-problems").addEventListener("click",Re);const J=n.querySelector("#stx-admin-home");Je(J,_e(s.adminHome.peek())).then(()=>{o()&&(J.value=s.adminHome.peek(),_.value=!0)}).catch(()=>{});const Ie=E.contextMenu(y,{cursor:"glyph",match:".stx-row",inherit:!1,density:"compact",items:e=>Oe(e.dataset.id)});i(()=>Ie?.destroy?.());const ce=e=>{const t=re(e.dataset.id),a=t&&Q(t.key);a?.page?window.open(a.path,"_blank","noopener"):G(e)},le=e=>{const t=e.target.closest(".stx-row");if(!t)return;const a=e.target.closest(".stx-kebab");if(a){G(a);return}ce(t)},ue=e=>{const t=e.target.closest(".stx-row");t&&(e.key==="F10"&&e.shiftKey?(e.preventDefault(),G(t)):e.key==="Enter"&&e.target===t&&ce(t))};y.addEventListener("click",le),y.addEventListener("keydown",ue),i(()=>{y.removeEventListener("click",le),y.removeEventListener("keydown",ue)}),he(l,{id:"settings-view-site",icon:"external-link",title:"View site",onClick:()=>window.open("/","_blank","noopener")}),he(l,{id:"settings-save",icon:"save",title:"Save (Ctrl+S)",onClick:()=>V()});const de=e=>{!(e.ctrlKey||e.metaKey)||e.key!=="s"||(e.preventDefault(),e.stopImmediatePropagation(),V())};document.addEventListener("keydown",de,!0),i(()=>document.removeEventListener("keydown",de,!0));const pe=()=>{if(x.peek())try{S.set(g,{form:He(j()),base:U.peek(),at:new Date().toISOString()})}catch{}},me=e=>{x.peek()&&(pe(),e.preventDefault(),e.returnValue="")};window.addEventListener("beforeunload",me),i(()=>window.removeEventListener("beforeunload",me)),f={dirty:()=>x.peek(),dispose(){w=!0,pe(),d.splice(0).reverse().forEach(e=>{try{e()}catch{}})}},I.scan(n),q();let h=null;try{h=S.get(g)}catch{}if(h?.form){try{S.remove?S.remove(g):S.set(g,null)}catch{}const e=h.base&&h.base!==U.peek(),t=h.at?` (${ze(h.at)})`:"",a=e?`You left unsaved settings${t}, but the saved settings have changed since. Restore your version anyway?`:`You left unsaved settings${t}. Restore them?`;await E.confirm(a)&&o()&&(ne(je(b.peek(),h.form)),_.peek()&&(J.value=s.adminHome.peek()))}}};
@@ -279,8 +279,8 @@ Where: `server/services/markdown.js`; reference `docs/markdown-shortcodes.md`; a
279
279
  - Where: `server/services/markdown.js` (`renderImage`, `processImageBlocks`, also in `processInlineShortcodes`), `public/js/image-zoom.mjs` + `public/css/image-zoom.css` (loaded by `renderer.js` `imageZoomModule()` only when a page has a `data-dm-zoom` picture), `.dm-image*` in `public/css/site.css`, registry entry in `admin/js/lib/shortcode-registry.js` (attrs carry `help`, shown by shortcode-form.js)
280
280
  - **`[embed url ratio title width align autoplay loop muted /]`** - YouTube/Vimeo (privacy-friendly `youtube-nocookie`), self-hosted `.mp4`/`.webm`/`.ogg` as a native player, or any other URL as an iframe only if its host is on the allow-list. Since 0.36.0.
281
281
  - Where: `config/embeds.json` `allowedHosts`
282
- - **`[map pin|lat lon|address|postcode zoom title caption ratio width align directions /]`** - a Google Map of one place (keyless embed); `directions` adds a link to Google's route planner. **`[map pins="lat,lon Label | ..."]`** - several pins (up to 50) on OpenStreetMap via Leaflet, every pin in view, labels and per-pin directions in popups. Unreleased (after 1.75.3).
283
- - Where: `server/services/markdown.js` (`renderMap`, `renderPinsMap`, `mapFigure`), `server/services/mapPins.js` (`parsePins`, the `/_map` page and its own CSP), `server/routes/map-frame.js` (`GET /_map`), registry entry in `admin/js/lib/shortcode-registry.js`
282
+ - **`[map pin|lat lon|address|postcode zoom title caption ratio width align directions /]`** - a Google Map of one place (keyless embed); `directions` adds a link to Google's route planner. **`[map pins="lat,lon Label | Label = address | ..."]`** - several pins (up to 50) on OpenStreetMap via Leaflet, every pin in view, labels and per-pin directions in popups. Addresses (only with Site Settings > General > Maps `maps.lookupAddresses: true`, off by default; switching on sweeps every page) are geocoded on page save (Nominatim, 1/s, background via safeFetch) into `content/map-places.json`; rendering only reads that store. Unreleased (after 1.75.3).
283
+ - Where: `server/services/markdown.js` (`renderMap`, `renderPinsMap`, `mapFigure`), `server/services/mapPins.js` (`parsePins`, the `/_map` page and its own CSP), `server/routes/map-frame.js` (`GET /_map`), `server/services/geocode.js` (`queueMapAddresses` from content.js create/updatePage, `placeFor`), registry entry in `admin/js/lib/shortcode-registry.js`
284
284
  - **`[demo src height title base /]`** - embeds a same-origin demo page (default under `/public/demos`) in a captioned frame. Built in since 0.67.0 (was the `demo-viewer` plugin).
285
285
 
286
286
  #### Data, forms and reuse
@@ -1029,16 +1029,31 @@ right; `caption` (or `title`) is shown under the map. `directions="true"` adds a
1029
1029
  that opens Google's route planner to the place in a new tab; give text instead of `true` for your own label
1030
1030
  (`directions="Find us"`).
1031
1031
 
1032
- **Several pins.** `pins` takes several places, each `latitude,longitude` then an optional label, split by `|`:
1032
+ **Several pins.** `pins` takes several places split by `|`. Each is coordinates or an address:
1033
1033
 
1034
1034
  ```text
1035
1035
  [map pins="51.5034,-0.1276 Downing Street | 51.5007,-0.1246 Big Ben" directions="true" caption="Find us" /]
1036
+ [map pins="Office = SW1A 2AA | Warehouse = 1 Dock Road, Hull | 51.5007,-0.1246 Big Ben" /]
1036
1037
  ```
1037
1038
 
1039
+ | Pin | Means |
1040
+ |-----|-------|
1041
+ | `51.5,-0.12 Label` | coordinates, then an optional label |
1042
+ | `Label = 51.5,-0.12` | the same, label first |
1043
+ | `Label = an address` | an address or postcode, with a label |
1044
+ | `an address` | an address, which is also its label |
1045
+
1046
+ Addresses need **Address look-ups** switched on in Site Settings > General > Maps (off by default: it sends the
1047
+ address text and the site's address to a third party). With it on, addresses are looked up when the page is **saved** (OpenStreetMap's Nominatim, one a second, in the background) and
1048
+ kept in `content/map-places.json`, so a page never waits on a lookup and visitors' browsers never reach the lookup
1049
+ service. Until an address is found its pin is left off (a map with none found yet shows a notice); one that is not
1050
+ found is tried again on a save a day later. Switching it on looks up the addresses already in every page. With it
1051
+ off, address pins are left off and coordinates still work. Pins in blocks or collection entries are not looked up - use coordinates
1052
+ there.
1053
+
1038
1054
  Up to 50 pins, labels up to 80 characters. The map is OpenStreetMap, drawn on this site's own `/_map` page (framed by
1039
1055
  this site only, with its own Content-Security-Policy for the tile host). Every pin is in view unless `zoom` is given;
1040
- each pin's label shows when it is clicked, with the directions link to that pin when `directions` is set. Addresses
1041
- and postcodes are not looked up for pins - give coordinates. `ratio`, `width`, `align`, `title` and `caption` work as
1056
+ each pin's label shows when it is clicked, with the directions link to that pin when `directions` is set. `ratio`, `width`, `align`, `title` and `caption` work as
1042
1057
  above. Malformed coordinates show a notice instead of a map. Google's
1043
1058
  embed host is always allowed to frame, so no `config/embeds.json` entry is needed.
1044
1059
  ### `[form]`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domma-cms",
3
- "version": "1.76.0",
3
+ "version": "1.78.0",
4
4
  "description": "File-based CMS powered by Domma and Fastify. Run npx domma-cms my-site to create a new project.",
5
5
  "type": "module",
6
6
  "main": "server/server.js",
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.34.1, packages/core/src/admin/mail/body-menu.js.
1
+ // Source: @domma-mail/core 0.35.0, packages/core/src/admin/mail/body-menu.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * The reading pane's right-click menu - the pure parts.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.34.1, packages/core/src/admin/mail/cms-host.js.
1
+ // Source: @domma-mail/core 0.35.0, packages/core/src/admin/mail/cms-host.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /** The CMS shell boundary. Standalone never imports this adapter. */
4
4
  const version = new URL(import.meta.url).searchParams.get('v') ?? '1';
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.34.1, packages/core/src/admin/mail/compose-window.js.
1
+ // Source: @domma-mail/core 0.35.0, packages/core/src/admin/mail/compose-window.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
4
4
  const {createMailHost} = await import(new URL(`./host-context.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.34.1, packages/core/src/admin/mail/contacts.js.
1
+ // Source: @domma-mail/core 0.35.0, packages/core/src/admin/mail/contacts.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Recipient suggestions from the host address book.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.34.1, packages/core/src/admin/mail/diagnostics-section.js.
1
+ // Source: @domma-mail/core 0.35.0, packages/core/src/admin/mail/diagnostics-section.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * The settings section that answers "which build is this, and what went wrong".
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.34.1, packages/core/src/admin/mail/drag-drop.js.
1
+ // Source: @domma-mail/core 0.35.0, packages/core/src/admin/mail/drag-drop.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /** Drag identities include the mailbox and source folder: UIDs alone are not unique. */
4
4
  const PROTECTED_USES = new Set(['\\Inbox', '\\Sent', '\\Drafts', '\\Trash', '\\Junk', '\\Archive', '\\All', '\\Flagged']);
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.34.1, packages/core/src/admin/mail/folder-tree.js.
1
+ // Source: @domma-mail/core 0.35.0, packages/core/src/admin/mail/folder-tree.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * Mail folder presentation, shared by the Mail Reader and Email Pro.
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.34.1, packages/core/src/admin/mail/font-controls.js.
1
+ // Source: @domma-mail/core 0.35.0, packages/core/src/admin/mail/font-controls.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
4
4
  /**
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.34.1, packages/core/src/admin/mail/fonts.js.
1
+ // Source: @domma-mail/core 0.35.0, packages/core/src/admin/mail/fonts.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /**
4
4
  * The fonts and sizes the mail editor offers - pure, so both the compose
@@ -1,4 +1,4 @@
1
- // Source: @domma-mail/core 0.34.1, packages/core/src/admin/mail/host-context.js.
1
+ // Source: @domma-mail/core 0.35.0, packages/core/src/admin/mail/host-context.js.
2
2
  // Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
3
3
  /** Services supplied by the application that hosts the shared mail interface. */
4
4
  export function createMailApi({getToken, fetch: request = globalThis.fetch, onUnauthorized = () => {}}) {