domma-cms 0.34.1 → 0.36.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.
- package/CLAUDE.md +2 -1
- package/admin/js/lib/effect-defs.js +1 -1
- package/admin/js/lib/effects-builder.js +1 -1
- package/admin/js/lib/embed-builder.js +1 -0
- package/admin/js/lib/markdown-toolbar.js +17 -17
- package/admin/js/lib/shortcode-context-menu.js +9 -0
- package/admin/js/lib/shortcode-registry.js +45 -0
- package/admin/js/lib/shortcode-tags.js +1 -0
- package/admin/js/templates/effects.html +752 -752
- package/admin/js/templates/forms.html +17 -17
- package/admin/js/templates/my-profile.html +17 -17
- package/admin/js/templates/role-editor.html +70 -70
- package/admin/js/templates/roles.html +10 -10
- package/admin/js/views/page-editor.js +14 -14
- package/bin/lib/config-merge.js +44 -44
- package/config/connections.json.bak +9 -0
- package/config/embeds.json +9 -0
- package/package.json +1 -1
- package/public/css/site.css +1 -1
- package/public/js/effects.js +1 -1
- package/server/middleware/auth.js +253 -253
- package/server/routes/api/auth.js +309 -309
- package/server/routes/api/navigation.js +42 -42
- package/server/routes/api/settings.js +141 -141
- package/server/services/email.js +167 -167
- package/server/services/markdown.js +210 -4
- package/server/services/userProfiles.js +199 -199
- package/server/services/users.js +302 -302
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const SHORTCODES=[{name:"card",label:"Card",category:"Layout",selfClosing:!1,container:!0,wrappable:!0,template:`[card title="Title"]
|
|
2
|
+
Content
|
|
3
|
+
[/card]`,attrs:[{name:"title",type:"text",label:"Title"},{name:"subtitle",type:"text",label:"Subtitle"},{name:"icon",type:"icon",label:"Icon"},{name:"icon-layout",type:"select",label:"Icon layout",options:[["inline","Inline"],["stacked","Stacked"]]},{name:"footer",type:"text",label:"Footer"},{name:"variant",type:"select",label:"Variant",options:[["","Default"],["primary","Primary"]]},{name:"collapsible",type:"checkbox",label:"Collapsible"},{name:"hover",type:"checkbox",label:"Hover highlight"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"grid",label:"Grid",category:"Layout",selfClosing:!1,container:!0,wrappable:!1,template:`[grid cols="2" gap="3"]
|
|
4
|
+
[col]
|
|
5
|
+
Left
|
|
6
|
+
[/col]
|
|
7
|
+
[col]
|
|
8
|
+
Right
|
|
9
|
+
[/col]
|
|
10
|
+
[/grid]`,attrs:[{name:"cols",type:"number",label:"Columns"},{name:"gap",type:"number",label:"Gap"},{name:"responsive",type:"select",label:"Responsive stacking",options:[["","On (default)"],["false","Off"]]},{name:"fullwidth",type:"checkbox",label:"Break out full-width"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"row",label:"Row",category:"Layout",selfClosing:!1,container:!0,wrappable:!1,template:`[row gap="3"]
|
|
11
|
+
[col]
|
|
12
|
+
Left
|
|
13
|
+
[/col]
|
|
14
|
+
[col]
|
|
15
|
+
Right
|
|
16
|
+
[/col]
|
|
17
|
+
[/row]`,attrs:[{name:"gap",type:"number",label:"Gap"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"},{name:"reveal",type:"checkbox",label:"Scroll reveal"},{name:"reveal-mode",type:"select",label:"Reveal mode",options:[["stagger","Stagger"],["sequence","Sequence"]]},{name:"reveal-animation",type:"select",label:"Reveal animation",options:[["slide-up","Slide up"],["slide-down","Slide down"],["slide-left","Slide left"],["slide-right","Slide right"],["fade","Fade"],["zoom","Zoom"],["flip","Flip"]]},{name:"reveal-duration",type:"number",label:"Reveal duration (ms)"},{name:"reveal-stagger",type:"number",label:"Reveal stagger (ms)"},{name:"reveal-delay",type:"number",label:"Reveal delay (ms)"},{name:"reveal-direction",type:"select",label:"Reveal direction",options:[["ltr","Left to right"],["rtl","Right to left"]]}]},{name:"col",label:"Column",category:"Layout",child:!0,selfClosing:!1,container:!0,wrappable:!0,template:`[col]
|
|
18
|
+
Content
|
|
19
|
+
[/col]`,attrs:[{name:"span",type:"number",label:"Span"},{name:"id",type:"text",label:"ID"}]},{name:"slideover",label:"Slideover",category:"Layout",selfClosing:!1,container:!0,wrappable:!0,template:`[slideover title="More information" trigger="Read more"]
|
|
20
|
+
Content
|
|
21
|
+
[/slideover]`,attrs:[{name:"title",type:"text",label:"Title"},{name:"trigger",type:"text",label:"Trigger label"},{name:"size",type:"select",label:"Size",options:[["sm","Small"],["md","Medium"],["lg","Large"]]},{name:"position",type:"select",label:"Position",options:[["right","Right"],["left","Left"]]}]},{name:"center",label:"Centre",category:"Layout",selfClosing:!1,container:!0,wrappable:!0,template:`[center]
|
|
22
|
+
Centred content
|
|
23
|
+
[/center]`,attrs:[{name:"class",type:"text",label:"CSS class"}]},{name:"spacer",label:"Spacer",category:"Layout",selfClosing:!0,container:!1,wrappable:!1,template:'[spacer size="24" /]',attrs:[{name:"size",type:"number",label:"Height (px)"},{name:"class",type:"text",label:"CSS class"}]},{name:"banner",label:"Banner",category:"Layout",selfClosing:!1,container:!0,wrappable:!0,template:`[banner type="info" title="Note"]
|
|
24
|
+
Banner content
|
|
25
|
+
[/banner]`,attrs:[{name:"type",type:"select",label:"Type",options:[["info","Info"],["success","Success"],["warning","Warning"],["danger","Danger"],["neutral","Neutral"]]},{name:"title",type:"text",label:"Title"},{name:"icon",type:"icon",label:"Icon"},{name:"dismissible",type:"checkbox",label:"Dismissible"},{name:"class",type:"text",label:"CSS class"}]},{name:"tabs",label:"Tabs",category:"Components",selfClosing:!1,container:!0,wrappable:!1,template:`[tabs]
|
|
26
|
+
[tab title="First"]First tab content.[/tab]
|
|
27
|
+
[tab title="Second"]Second tab content.[/tab]
|
|
28
|
+
[/tabs]`,attrs:[{name:"style",type:"select",label:"Style",options:[["","Underline"],["pills","Pills"],["bordered","Bordered"]]},{name:"align",type:"select",label:"Alignment",options:[["","Left"],["center","Centre"],["right","Right"]]},{name:"fade",type:"checkbox",label:"Fade panels"},{name:"id",type:"text",label:"ID"}]},{name:"tab",label:"Tab",category:"Components",child:!0,selfClosing:!1,container:!0,wrappable:!1,template:'[tab title="Tab title"]Content[/tab]',attrs:[{name:"title",type:"text",label:"Title"},{name:"icon",type:"icon",label:"Icon"}]},{name:"accordion",label:"Accordion",category:"Components",selfClosing:!1,container:!0,wrappable:!1,template:`[accordion]
|
|
29
|
+
[item title="Question 1"]Answer 1.[/item]
|
|
30
|
+
[item title="Question 2"]Answer 2.[/item]
|
|
31
|
+
[/accordion]`,attrs:[{name:"multiple",type:"checkbox",label:"Allow multiple open"},{name:"id",type:"text",label:"ID"}]},{name:"item",label:"Item",category:"Components",child:!0,selfClosing:!1,container:!0,wrappable:!1,template:'[item title="Item title"]Content[/item]',attrs:[{name:"title",type:"text",label:"Title"}]},{name:"carousel",label:"Carousel",category:"Components",selfClosing:!1,container:!0,wrappable:!1,template:`[carousel autoplay="true" interval="5000"]
|
|
32
|
+
[slide title="Slide 1" image="/media/photo.jpg"]Caption.[/slide]
|
|
33
|
+
[slide title="Slide 2"]Text-only slide.[/slide]
|
|
34
|
+
[/carousel]`,attrs:[{name:"autoplay",type:"checkbox",label:"Autoplay"},{name:"interval",type:"number",label:"Interval (ms)"},{name:"loop",type:"checkbox",label:"Loop"},{name:"animation",type:"select",label:"Animation",options:[["slide","Slide"],["fade","Fade"],["crossfade","Crossfade"]]},{name:"animation-duration",type:"number",label:"Animation duration (ms)"},{name:"animation-easing",type:"text",label:"Animation easing"},{name:"id",type:"text",label:"ID"}]},{name:"slide",label:"Slide",category:"Components",child:!0,selfClosing:!1,container:!0,wrappable:!1,template:'[slide title="Slide title" image="/media/photo.jpg"]Caption[/slide]',attrs:[{name:"title",type:"text",label:"Title"},{name:"image",type:"url",label:"Image"}]},{name:"countdown",label:"Countdown",category:"Components",selfClosing:!0,container:!1,wrappable:!1,template:'[countdown to="2026-12-31" format="DD:HH:mm:ss" /]',attrs:[{name:"to",type:"text",label:"Target date (ISO)"},{name:"duration",type:"number",label:"Duration (seconds)"},{name:"format",type:"select",label:"Format",options:[["mm:ss","mm:ss"],["HH:mm:ss","HH:mm:ss"],["DD:HH:mm:ss","DD:HH:mm:ss"]]},{name:"id",type:"text",label:"ID"}]},{name:"timeline",label:"Timeline",category:"Components",selfClosing:!1,container:!0,wrappable:!1,template:`[timeline layout="vertical" theme="modern"]
|
|
35
|
+
[event title="Launch" date="2025-01-15" status="completed"]Launched.[/event]
|
|
36
|
+
[/timeline]`,attrs:[{name:"layout",type:"select",label:"Layout",options:[["vertical","Vertical"],["centred","Centred"],["horizontal","Horizontal"]]},{name:"theme",type:"select",label:"Theme",options:[["minimal","Minimal"],["corporate","Corporate"],["modern","Modern"]]},{name:"mode",type:"select",label:"Mode",options:[["timeline","Timeline"],["roadmap","Roadmap"]]},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"event",label:"Event",category:"Components",child:!0,selfClosing:!1,container:!0,wrappable:!1,template:'[event title="Milestone" date="2025-01-15" status="completed"]Description[/event]',attrs:[{name:"title",type:"text",label:"Title"},{name:"date",type:"text",label:"Date"},{name:"status",type:"select",label:"Status",options:[["planned","Planned"],["in-progress","In progress"],["completed","Completed"],["blocked","Blocked"]]},{name:"icon",type:"icon",label:"Icon"}]},{name:"hero",label:"Hero",category:"Content",selfClosing:!1,container:!0,wrappable:!0,template:`[hero title="Welcome" tagline="Build something great" size="lg" variant="gradient-blue"]
|
|
37
|
+
Optional body content.
|
|
38
|
+
[/hero]`,attrs:[{name:"title",type:"text",label:"Title"},{name:"tagline",type:"text",label:"Tagline"},{name:"size",type:"select",label:"Size",options:[["","Default"],["sm","Small"],["lg","Large"],["full","Full"]]},{name:"variant",type:"select",label:"Variant",options:[["","None"],["dark","Dark"],["primary","Primary"],["gradient-purple","Gradient purple"],["gradient-blue","Gradient blue"],["gradient-green","Gradient green"],["gradient-sunset","Gradient sunset"],["gradient-ocean","Gradient ocean"],["gradient-rose","Gradient rose"],["gradient-forest","Gradient forest"],["gradient-night","Gradient night"]]},{name:"image",type:"url",label:"Background image"},{name:"overlay",type:"select",label:"Overlay",options:[["","None"],["light","Light"],["dark","Dark"],["darker","Darker"],["gradient","Gradient"],["gradient-reverse","Gradient reverse"]]},{name:"align",type:"select",label:"Alignment",options:[["center","Centre"],["left","Left"]]},{name:"bg",type:"colour",label:"Background colour"},{name:"color",type:"colour",label:"Background colour (alias)"},{name:"min-height",type:"text",label:"Min height"},{name:"fullwidth",type:"checkbox",label:"Break out full-width"},{name:"twinkle",type:"checkbox",label:"Twinkle particles"},{name:"twinkle-count",type:"number",label:"Twinkle count"},{name:"twinkle-colour",type:"colour",label:"Twinkle colour"},{name:"blobs",type:"checkbox",label:"Ambient blobs"},{name:"blobs-type",type:"text",label:"Blobs type"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"table",label:"Table",category:"Content",selfClosing:!1,container:!1,wrappable:!1,template:`[table striped="true"]
|
|
39
|
+
| Product | Price |
|
|
40
|
+
| ------- | ----: |
|
|
41
|
+
| Widget | $9.99 |
|
|
42
|
+
[/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",category:"Content",selfClosing:!1,container:!1,wrappable:!1,template:'[badge variant="success"]New[/badge]',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",category:"Content",selfClosing:!1,container:!0,wrappable:!0,template:'[text size="xl" bold color="primary"]Styled text[/text]',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:"bold",type:"checkbox",label:"Bold"},{name:"italic",type:"checkbox",label:"Italic"},{name:"color",type:"colour",label:"Colour"},{name:"font",type:"select",label:"Font",options:[["Georgia","Georgia"],["Arial","Arial"],["Verdana","Verdana"],["Courier New","Courier New"],["Times New Roman","Times New Roman"],["Trebuchet MS","Trebuchet MS"]]},{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"]]},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"button",label:"Button",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",category:"Content",selfClosing:!0,container:!1,wrappable:!1,template:'[link href="/about" label="About us" /]',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",category:"Content",selfClosing:!1,container:!0,wrappable:!1,template:`[listgroup]
|
|
43
|
+
[item]First item[/item]
|
|
44
|
+
[item]Second item[/item]
|
|
45
|
+
[/listgroup]`,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",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[collection slug="enquiries" display="table" /]',attrs:[{name:"slug",type:"text",label:"Collection slug"},{name:"display",type:"select",label:"Display",options:[["table","Table"],["cards","Cards"],["list","List"],["accordion","Accordion"],["timeline","Timeline"],["block","Block"]]},{name:"fields",type:"text",label:"Fields (comma-separated)"},{name:"limit",type:"number",label:"Limit"},{name:"sort",type:"text",label:"Sort field"},{name:"order",type:"select",label:"Order",options:[["desc","Descending"],["asc","Ascending"]]},{name:"title-field",type:"text",label:"Title field"},{name:"columns",type:"number",label:"Card columns"},{name:"search",type:"checkbox",label:"Search (table)"},{name:"sortable",type:"checkbox",label:"Sortable (table)"},{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:"text",label:"CTA action slug"},{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",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[view slug="products" display="table" limit="50" /]',attrs:[{name:"slug",type:"text",label:"View slug"},{name:"display",type:"select",label:"Display",options:[["table","Table"],["cards","Cards"],["list","List"],["accordion","Accordion"],["timeline","Timeline"],["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:"columns",type:"number",label:"Card columns"},{name:"empty",type:"text",label:"Empty message"}]},{name:"block",label:"Block",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[block template="post-card" title="My Post" /]',attrs:[{name:"template",type:"text",label:"Template name"}]},{name:"form",label:"Form",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[form name="contact" /]',attrs:[{name:"name",type:"text",label:"Form slug"},{name:"class",type:"text",label:"CSS class"},{name:"id",type:"text",label:"ID"}]},{name:"cta",label:"CTA",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[cta action="send-welcome" entry="abc123" style="primary" label="Send" /]',attrs:[{name:"action",type:"text",label:"Action slug"},{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",category:"Data",selfClosing:!0,container:!1,wrappable:!1,template:'[menu slug="legal" /]',attrs:[{name:"slug",type:"text",label:"Menu slug"},{name:"location",type:"text",label:"Location slot"},{name:"variant",type:"text",label:"Variant"},{name:"class",type:"text",label:"CSS class"},{name:"depth",type:"number",label:"Max depth"}]},{name:"icon",label:"Icon",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:"embed",label:"Embed",category:"Media",selfClosing:!0,container:!1,wrappable:!1,template:'[embed url="https://youtu.be/dQw4w9WgXcQ" /]',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"}]}];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function parseAttrs(s){const e=String(s??""),o={};for(const[,i,c,n]of e.matchAll(/([\w-]+)=(?:"([^"]*)"|'([^']*)')/g))o[i]=c??n??"";const r=e.replace(/([\w-]+)=(?:"[^"]*"|'[^']*')/g,i=>" ".repeat(i.length));for(const[,i]of r.matchAll(/\b([\w-]+)\b/g))i in o||(o[i]=!0);return o}export function serialiseTag(s,e,o){const r=[];for(const[c,n]of Object.entries(e))if(n===!0)r.push(c);else{if(n===!1||n===null||n===void 0||n==="")continue;r.push(`${c}="${String(n).replace(/"/g,""")}"`)}const i=r.length?` ${r.join(" ")}`:"";return o?`[${s}${i} /]`:`[${s}${i}]`}function a(s,e,o,r){const i=s.slice(e,o),c=/\/\s*\]$/.test(i),n=i.match(new RegExp(`^\\[${r}([\\s\\S]*?)\\s*/?\\]$`)),t=n?n[1]:"";return{name:r,openTagStart:e,openTagEnd:o,attrStr:t,attrs:parseAttrs(t),selfClosing:c}}function u(s,e,o){const r=new RegExp(`\\[${o}(?=[\\s\\]/])([^\\]]*)\\]`,"g"),i=new RegExp(`\\[/${o}\\]`,"g"),c=[];for(const l of s.matchAll(r)){if(l.index>=e)break;c.push({type:"open",start:l.index,end:l.index+l[0].length})}for(const l of s.matchAll(i)){if(l.index>=e)break;c.push({type:"close",start:l.index})}c.sort((l,f)=>l.start-f.start);let n=0,t=null;for(const l of c)l.type==="open"?(n++,t=l):(n--,n<0&&(n=0,t=null));return n>0&&t&&new RegExp(`\\[/${o}\\]`).test(s.slice(e))?{start:t.start,end:t.end}:null}export function findEnclosingShortcode(s,e){const o=s.value,r=s.selectionStart,i=new Map(e.map(t=>[t.name,t]));let c=null;for(const t of o.matchAll(/\[(\/)?([a-zA-Z][\w-]*)((?:[^\]]*?))\]/g)){const l=t.index,f=l+t[0].length;r<l||r>f||i.has(t[2])&&(c={name:t[2],start:l,end:f,close:!!t[1]})}if(c)if(c.close){const t=u(o,c.start,c.name);if(t)return a(o,t.start,t.end,c.name)}else return a(o,c.start,c.end,c.name);let n=null;for(const t of e){if(t.selfClosing)continue;const l=u(o,r,t.name);l&&(!n||l.start>n.start)&&(n={...l,name:t.name})}return n?a(o,n.start,n.end,n.name):null}export function setAttr(s,e,o,r){return setAttrs(s,e,{[o]:r})}export function setAttrs(s,e,o){const r={...e.attrs};for(const[n,t]of Object.entries(o))t===!1||t===null||t===void 0||t===""?delete r[n]:r[n]=t;const i=serialiseTag(e.name,r,e.selfClosing);s.value=s.value.slice(0,e.openTagStart)+i+s.value.slice(e.openTagEnd);const c=e.openTagStart+i.length;return s.selectionStart=s.selectionEnd=c,s.dispatchEvent(new Event("input",{bubbles:!0})),a(s.value,e.openTagStart,c,e.name)}export function effectAttrKeys(s,e){const o=`${e}-`;return Object.keys(s).filter(r=>r===e||r.startsWith(o))}
|