efficient-easel 4.0.0 → 5.0.1
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/README.md +13 -0
- package/dist/buckets-Tj-nkBpg.d.ts +28 -0
- package/dist/chrome/chrome.css +33 -5
- package/dist/chrome/index.js +1 -1
- package/dist/chunk-3FZAGTQE.js +5 -0
- package/dist/chunk-3ZJSLHHI.js +8 -0
- package/dist/chunk-5QSFLWAJ.js +65 -0
- package/dist/{chunk-42TMLDSQ.js → chunk-6TOYXESC.js} +1 -1
- package/dist/chunk-7EWFXVDJ.js +21 -0
- package/dist/chunk-7YMO6R3V.js +1 -0
- package/dist/chunk-BXQBCW3P.js +1 -0
- package/dist/{chunk-ZHTQCAQ2.js → chunk-F7BYSWRR.js} +1 -1
- package/dist/{chunk-TJOUAFJE.js → chunk-G4OCSMYY.js} +1 -1
- package/dist/{chunk-D4BUPPPV.js → chunk-H6NYEMLS.js} +3 -3
- package/dist/{chunk-2I7MAA2U.js → chunk-HQWQLDCB.js} +1 -1
- package/dist/{chunk-XJPNW26S.js → chunk-ITAQX3HT.js} +1 -1
- package/dist/{chunk-7GVPKRW2.js → chunk-KEHLCWTG.js} +4 -4
- package/dist/chunk-KFV7N2DJ.js +1 -0
- package/dist/chunk-MQNBD6AB.js +1 -0
- package/dist/chunk-PCMGFPFU.js +5 -0
- package/dist/{chunk-5SOSVTVI.js → chunk-PFNIVZPN.js} +1 -1
- package/dist/{chunk-QBJJVMVB.js → chunk-R5GKLOIP.js} +1 -1
- package/dist/chunk-SF4DL63U.js +1 -0
- package/dist/{chunk-GTDLBUOC.js → chunk-UB4TLWVJ.js} +6 -6
- package/dist/{chunk-SNMCF2ZD.js → chunk-XHHS6SDM.js} +1 -1
- package/dist/copy/copy.css +7 -7
- package/dist/copy/index.js +5 -5
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +2 -2
- package/dist/fields/fields.css +4 -0
- package/dist/fields/index.d.ts +103 -51
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +8 -2
- package/dist/panel/index.js +19 -12
- package/dist/panel/panel.css +23 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +14 -14
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/puck/field-buckets.d.ts +20 -6
- package/dist/screen/lib/puck/field-buckets.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +14 -5
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +4 -4
- package/dist/strings/catalogue.d.ts +2 -2
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +11 -11
- package/dist/text-styles/text-styles.css +2 -2
- package/dist/{types-CWxUxPGO.d.ts → types-OUl0mK1k.d.ts} +5 -2
- package/dist/{words-BGrHZAJJ.d.ts → words-zH1H0WFw.d.ts} +8 -3
- package/package.json +2 -2
- package/dist/buckets-CuLM47h9.d.ts +0 -13
- package/dist/chunk-4YBMSUPL.js +0 -1
- package/dist/chunk-7P6IFCR4.js +0 -1
- package/dist/chunk-KFMJ4IM4.js +0 -5
- package/dist/chunk-LJOYIXO4.js +0 -65
- package/dist/chunk-NJOPEWYN.js +0 -20
- package/dist/chunk-QEWRHH6R.js +0 -5
- package/dist/chunk-QTLAVDJE.js +0 -1
- package/dist/chunk-R2HLPNQF.js +0 -1
- package/dist/chunk-WSNVBUPL.js +0 -1
- package/dist/chunk-YNOZ5NXW.js +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PanelToggleIcon as e}from"./chunk-KQMML6JM.js";import{InspectorHead as n}from"./chunk-
|
|
1
|
+
import{PanelToggleIcon as e}from"./chunk-KQMML6JM.js";import{InspectorHead as n}from"./chunk-UB4TLWVJ.js";import{DEFAULT_CHROME_WORDS as i}from"./chunk-Y2G7CU6A.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{Tooltip as s,IconButton as t,Button as c}from"efficient-shell/ui";import{jsx as r,jsxs as l,Fragment as d}from"react/jsx-runtime";function a({icon:e,title:i,context:o,actions:s,side:t="left",onHide:c}){/* @__PURE__ */
|
|
2
2
|
return r(n,{icon:e,name:i,kind:o,actions:s||c?/* @__PURE__ */l(d,{children:[s,c?/* @__PURE__ */r(m,{side:t,onHide:c,divider:Boolean(s)}):null]}):void 0})}function m({side:n,onHide:c,divider:a=!1}){const m=o("chrome",i);/* @__PURE__ */
|
|
3
3
|
return l(d,{children:[a?/* @__PURE__ */r("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
|
|
4
4
|
/* @__PURE__ */r(s,{content:m.hidePanel,side:"bottom",children:/* @__PURE__ */r(t,{className:"es-insp-iconbtn","aria-label":m.hidePanelLabel({side:n}),onClick:c,children:/* @__PURE__ */r(e,{side:n})})})]})}function h({side:n,onShow:c}){const l=o("chrome",i);/* @__PURE__ */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-
|
|
1
|
+
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-3FZAGTQE.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
|
|
2
2
|
/* @__PURE__ */o("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(a,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
|
|
3
3
|
return o(n,{align:"start",triggerClassName:"sf-add-card",items:u,trigger:/* @__PURE__ */c(i,{children:[
|
|
4
4
|
/* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),m.addBlockMenu]})})}export{l as AddBlockRow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useSectionOps as o}from"./chunk-XHHS6SDM.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-3FZAGTQE.js";import{useEasel as p}from"./chunk-FUOZKV7A.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),a?.(t)):i(o=>"part"===o.kind?n:o)},[i,a]);c(()=>{k(l)},[k,l]);const h=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>n);const e=u(o);e&&I.select(e)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{DEFAULT_NOTICE_WORDS as e,DEFAULT_CHROME_WORDS as n}from"./chunk-Y2G7CU6A.js";import{holderOf as i,describeAge as a,nameOrSomeone as s}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as t}from"./chunk-RE4LP46F.js";import{EaselRail as l}from"./chunk-MJM6SFD3.js";import{DEFAULT_RAIL_WORDS as r}from"./chunk-2OAZYSWJ.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d,Fragment as u}from"react/jsx-runtime";import{Tooltip as h,IconButton as m,Segmented as v,Switch as f,ResizeHandle as
|
|
1
|
+
import{DEFAULT_NOTICE_WORDS as e,DEFAULT_CHROME_WORDS as n}from"./chunk-Y2G7CU6A.js";import{holderOf as i,describeAge as a,nameOrSomeone as s}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as t}from"./chunk-RE4LP46F.js";import{EaselRail as l}from"./chunk-MJM6SFD3.js";import{DEFAULT_RAIL_WORDS as r}from"./chunk-2OAZYSWJ.js";import{useWords as o}from"./chunk-MFIRYGHW.js";import{jsx as c,jsxs as d,Fragment as u}from"react/jsx-runtime";import{Tooltip as h,IconButton as m,Segmented as v,Switch as f,ResizeHandle as p,Button as k,Banner as b}from"efficient-shell/ui";import{PanelLeftIcon as g,PanelRightIcon as y,MediaIcon as N,ImageIcon as w}from"efficient-shell/icons/efficient";function C({children:e}){/* @__PURE__ */
|
|
2
2
|
return c("div",{className:"es-topbar",children:e})}function O({kind:e,style:n,children:i}){/* @__PURE__ */
|
|
3
3
|
return c("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:i})}function x(){/* @__PURE__ */
|
|
4
4
|
return c("div",{className:"es-divider-v","aria-hidden":"true"})}function z({items:e,ariaLabel:n,onWords:i}){const a=o("rail",r);/* @__PURE__ */
|
|
@@ -7,15 +7,15 @@ return c(h,{content:e,side:"bottom",children:/* @__PURE__ */c(m,{ref:s,"aria-lab
|
|
|
7
7
|
return c(v,{className:"es-devseg",size:"sm",label:s??t.device,value:i,onChange:e=>{e!==i&&a(e)},options:e.map(e=>({value:e.id,icon:/* @__PURE__ */c(h,{content:e.label,side:"bottom",children:/* @__PURE__ */c("span",{className:"es-devseg-glyph","aria-hidden":"true",children:e.icon})}),label:/* @__PURE__ */c("span",{className:"es-vh",children:e.label})}))})}var L={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function $({tone:e,label:n,counting:i,waitMs:a,ringRef:s,role:t}){/* @__PURE__ */
|
|
8
8
|
return d("span",{className:`es-savestate ${L[e]}`,role:t,"aria-live":"polite",children:[/* @__PURE__ */c("span",i?{ref:s,className:"es-savestate-ring is-counting",style:void 0!==a?{"--es-savewait":`${a}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function W({pressed:e,title:n,onToggle:i,children:a}){/* @__PURE__ */
|
|
9
9
|
return c("span",{className:"es-savestate-toggle",children:/* @__PURE__ */c(h,{content:n,side:"bottom",children:/* @__PURE__ */c(f,{size:"sm",checked:!e,"aria-label":n,label:a,onChange:()=>i()})})})}function j({side:e,width:i,min:a,max:s,defaultWidth:t,label:l,onResize:r}){const d=o("chrome",n);/* @__PURE__ */
|
|
10
|
-
return c(
|
|
10
|
+
return c(p,{side:e,width:i,min:a,max:s,defaultWidth:t,label:l,hint:d.resize,onResize:e=>r(e),className:`es-resizer es-resizer--${e}`})}function M({icon:e,name:n,kind:i,actions:a}){/* @__PURE__ */
|
|
11
11
|
return d("div",{className:"es-insp-head",children:[
|
|
12
12
|
/* @__PURE__ */c("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
|
|
13
13
|
/* @__PURE__ */d("div",{className:"es-insp-titles",children:[
|
|
14
|
-
/* @__PURE__ */c("h2",{className:"es-insp-name",children:n}),
|
|
14
|
+
/* @__PURE__ */c(h,{content:n,describe:!1,side:"bottom",className:"es-insp-name-tip",children:/* @__PURE__ */c("h2",{className:"es-insp-name",children:n})}),
|
|
15
15
|
/* @__PURE__ */c("div",{className:"es-insp-kind",children:i})]}),a?/* @__PURE__ */c("div",{className:"es-insp-actions",children:a}):null]})}function S({label:e,title:n,hasPopup:i,onClick:a,disabled:s,danger:t,expanded:l,buttonRef:r,children:o}){/* @__PURE__ */
|
|
16
|
-
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:r,variant:t?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:s,onClick:a,children:o})})}function P({name:e,onSelect:i,label:a,inline:s}){const t=o("chrome",n),l=a??t.upLevel,r=/* @__PURE__ */c(h,{content:l,side:"bottom",children:/* @__PURE__ */c(
|
|
16
|
+
return c(h,{content:n??e,side:"bottom",children:/* @__PURE__ */c(m,{ref:r,variant:t?"ghost-danger":"ghost",className:"es-insp-iconbtn","aria-label":e,"aria-haspopup":i,"aria-expanded":l,disabled:s,onClick:a,children:o})})}function P({name:e,onSelect:i,label:a,inline:s}){const t=o("chrome",n),l=a??t.upLevel,r=/* @__PURE__ */c(h,{content:l,side:"bottom",children:/* @__PURE__ */c(k,{variant:"link",size:"sm",className:"es-insp-up-btn","aria-label":t.upLevelTo({label:l,name:e}),leftIcon:/* @__PURE__ */c("span",{className:"es-insp-up-arrow","aria-hidden":"true",children:"←"}),onClick:i,children:/* @__PURE__ */c("span",{className:"es-insp-up-name",children:e})})});return s?r:/* @__PURE__ */c("div",{className:"es-insp-up",children:r})}function Y({context:e,pick:i,onCancel:a,onHide:s,side:t="left"}){const l=o("chrome",n),r=s?/* @__PURE__ */c(S,{label:l.hidePanelLabel({side:t}),title:l.hidePanel,onClick:s,children:/* @__PURE__ */c("left"===t?g:y,{size:16})}):null;if(!i)/* @__PURE__ */
|
|
17
17
|
return c(M,{icon:/* @__PURE__ */c(N,{}),name:l.mediaLibrary,kind:e,actions:r??void 0});const m=l.mediaKinds[i.kind];/* @__PURE__ */
|
|
18
18
|
return c(M,{icon:/* @__PURE__ */c(w,{size:15}),name:l.mediaChoose({kind:m}),kind:i.field?l.mediaFor({field:i.field}):e,actions:/* @__PURE__ */d(u,{children:[
|
|
19
|
-
/* @__PURE__ */c(h,{content:l.mediaKeep({kind:m}),side:"bottom",children:/* @__PURE__ */c(
|
|
20
|
-
/* @__PURE__ */c("span",{className:"es-insp-divider","aria-hidden":"true"}),r]}):null]})})}function T(e){return/svg/i.test(e)?"svg":e.startsWith("video")?"video":"image"}var F={notice:e,lock:t};function H(e,n,t,l=F){const r=l.notice,o=i(e),c={kind:"reload",label:r.reload};if(n){const e=a(n.secondsAgo,l.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:t,when:e}):r.savedByOther({name:s(n.savedBy,l.lock),noun:t,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=s(o.name,l.lock),u=a(o.secondsSinceSeen,l.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:t,when:a(o.secondsSinceHeld,l.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:t,seen:u}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:t}),body:r.editingBody({seen:u}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function A({access:n,conflict:i,noun:a,onTakeOver:s,onViewReadOnly:l,onReload:r}){const d=H(n,i,a,{notice:o("notice",e),lock:o("lock",t)});if(!d)return null;const u={reload:r,"take-over":s,"take-back":s,"view-read-only":l},m=d.actions.map(e=>e.title?/* @__PURE__ */c(h,{content:e.title,side:"bottom",children:/* @__PURE__ */c(
|
|
19
|
+
/* @__PURE__ */c(h,{content:l.mediaKeep({kind:m}),side:"bottom",children:/* @__PURE__ */c(k,{variant:"secondary",size:"sm",className:"es-insp-textbtn",onClick:a,children:l.mediaCancel})}),r?/* @__PURE__ */d(u,{children:[
|
|
20
|
+
/* @__PURE__ */c("span",{className:"es-insp-divider","aria-hidden":"true"}),r]}):null]})})}function T(e){return/svg/i.test(e)?"svg":e.startsWith("video")?"video":"image"}var F={notice:e,lock:t};function H(e,n,t,l=F){const r=l.notice,o=i(e),c={kind:"reload",label:r.reload};if(n){const e=a(n.secondsAgo,l.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?r.savedByYou({noun:t,when:e}):r.savedByOther({name:s(n.savedBy,l.lock),noun:t,when:e}),body:r.conflictBody,actions:o?[c,{kind:"take-over",label:r.takeOver,title:r.takeOverWhileDeciding}]:[c]}}if(!o)return null;const d=s(o.name,l.lock),u=a(o.secondsSinceSeen,l.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:r.tookOver({name:d,noun:t,when:a(o.secondsSinceHeld,l.lock)}),body:r.tookOverBody,actions:[{kind:"take-back",label:r.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:r.viewingOnly,body:r.viewingOnlyBody({name:d,noun:t,seen:u}),actions:[{kind:"take-over",label:r.takeOver}]};default:return{tone:"warning",urgent:!1,lead:r.editing({name:d,noun:t}),body:r.editingBody({seen:u}),actions:[{kind:"view-read-only",label:r.viewReadOnly},{kind:"take-over",label:r.takeOver,title:r.takeOverTold}]}}}function A({access:n,conflict:i,noun:a,onTakeOver:s,onViewReadOnly:l,onReload:r}){const d=H(n,i,a,{notice:o("notice",e),lock:o("lock",t)});if(!d)return null;const u={reload:r,"take-over":s,"take-back":s,"view-read-only":l},m=d.actions.map(e=>e.title?/* @__PURE__ */c(h,{content:e.title,side:"bottom",children:/* @__PURE__ */c(k,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label})},e.kind):/* @__PURE__ */c(k,{variant:"secondary",size:"sm",onClick:u[e.kind],children:e.label},e.kind));/* @__PURE__ */
|
|
21
21
|
return c("div",{className:`es-notice is-${d.tone}`,role:d.urgent?"alert":"status",children:/* @__PURE__ */c(b,{tone:"warning"===d.tone?"warning":"info",title:d.lead,action:/* @__PURE__ */c("span",{className:"es-notice-actions",children:m}),children:d.body})})}var q={left:288,right:320},D=220,G=560;function I(e){return Math.min(560,Math.max(220,Math.round(e)))}function J(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}function K(e,n){e.style.setProperty("--es-left-w",`${n.left}px`),e.style.setProperty("--es-right-w",`${n.right}px`)}export{q as DEFAULT_PANEL_W,B as DeviceSwitch,R as EaselIconButton,C as EaselTopBar,A as EditNotice,M as InspectorHead,S as InspectorIconButton,P as InspectorUpLevel,G as MAX_PANEL_W,D as MIN_PANEL_W,Y as MediaPanelHead,j as PanelResizeHandle,$ as SaveState,W as SaveStateToggle,O as TopBarCluster,x as TopBarDivider,z as TopBarRail,I as clampPanelWidth,H as editNotice,T as mediaPickKind,J as panelWidthVars,K as setPanelWidthVars};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-3FZAGTQE.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-FUOZKV7A.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
|
package/dist/copy/copy.css
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
.es-copy {
|
|
18
18
|
--es-copy-gap: var(--es-space-8, 8px);
|
|
19
19
|
/* efficient-shell's IconButton at its default size, md (design v5, 0.94.0). */
|
|
20
|
-
--es-copy-mark-size: 32px;
|
|
20
|
+
--es-copy-mark-size: var(--control-height-md, 32px);
|
|
21
21
|
--es-copy-rule: var(--es-border, var(--line));
|
|
22
22
|
--es-copy-field-border: var(--es-field-border, var(--line-strong));
|
|
23
23
|
--es-copy-field-bg: var(--es-field-bg, var(--surface));
|
|
@@ -341,7 +341,7 @@
|
|
|
341
341
|
/* Words never break inside: in a narrow box (a 220px panel) Clear style
|
|
342
342
|
moves to a line of its own, still at the right end. */
|
|
343
343
|
.es-copy-marks-label {
|
|
344
|
-
font-size:
|
|
344
|
+
font-size: 14px;
|
|
345
345
|
white-space: nowrap;
|
|
346
346
|
color: var(--es-text-secondary, var(--ink));
|
|
347
347
|
}
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
*/
|
|
500
500
|
@container (width < 268px) {
|
|
501
501
|
.es-tb-wrap {
|
|
502
|
-
--es-tb-size: min(24px, calc(100cqw / 9));
|
|
502
|
+
--es-tb-size: min(var(--control-height-sm, 24px), calc(100cqw / 9));
|
|
503
503
|
}
|
|
504
504
|
|
|
505
505
|
.es-tb-btn svg {
|
|
@@ -515,14 +515,14 @@
|
|
|
515
515
|
* words being coloured). `CopyBox` measures that and writes `top`, `left`,
|
|
516
516
|
* `--es-pop-point` and `data-side` on the window (./place). The `top` here is
|
|
517
517
|
* only the unmeasured fallback: under the first row, as first drawn.
|
|
518
|
-
* DatePicker's popover: 288px,
|
|
519
|
-
* shadow; never wider than the box.
|
|
518
|
+
* DatePicker's popover: 288px, the shell's popup corners (16), a 12px inset,
|
|
519
|
+
* react-os-shell's shadow; never wider than the box.
|
|
520
520
|
*/
|
|
521
521
|
.es-copy-pop {
|
|
522
522
|
position: absolute;
|
|
523
523
|
z-index: 5;
|
|
524
524
|
left: 0;
|
|
525
|
-
top: calc(var(--es-tb-size) +
|
|
525
|
+
top: calc(var(--es-tb-size) + var(--es-space-8));
|
|
526
526
|
box-sizing: border-box;
|
|
527
527
|
width: 288px;
|
|
528
528
|
max-width: 100%;
|
|
@@ -532,7 +532,7 @@
|
|
|
532
532
|
gap: var(--es-space-8, 8px);
|
|
533
533
|
padding: 12px;
|
|
534
534
|
border: 1px solid var(--es-border, var(--line));
|
|
535
|
-
border-radius: var(--radius-
|
|
535
|
+
border-radius: var(--radius-popup);
|
|
536
536
|
background: var(--es-raised, var(--surface));
|
|
537
537
|
box-shadow: var(--rosh-glass-solid-shadow);
|
|
538
538
|
}
|
package/dist/copy/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{DEFAULT_COPY_WORDS as e}from"../chunk-JZDEIRH4.js";import{FieldNumber as t}from"../chunk-66LWADFP.js";import{SettingsSegmented as n,SettingsSwitch as r}from"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as l}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as o,applyMark as a,STANDARD_MARKUP as s,writeMarkedLines as i,sameMarks as c,markedLines as u,spanFor as d,markupTools as h,marksIn as p,findLink as f,markedAt as m,listIn as g,colorIn as b,clearStyle as v,isSafeLinkHref as y,toggleMark as k,colorOver as w,setList as x,unlinkAt as C,removeLink as D,linkOver as S,writeLink as E}from"../chunk-546BBOPE.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{withTip as M}from"../chunk-P2VEMZH5.js";import{Tooltip as L,ColorSwatch as T,ColorPickerPanel as B,Button as R,IconButton as j,registerModalEscapeInterceptor as P,LinkPicker as z}from"efficient-shell/ui";import{useRef as O,useState as F,useLayoutEffect as K,useEffect as W,useId as $}from"react";import{AlignJustifyIcon as H,AlignRightIcon as A,AlignCenterIcon as I,AlignLeftIcon as U,ParagraphSpacingIcon as q,LetterSpacingIcon as V,TextLinesIcon as Y,TextSizeIcon as Z,CaseNormalIcon as G,CaseUpperIcon as J,CaseLowerIcon as X,TextColorIcon as Q,ListIcon as _,NumberedListIcon as ee,ClearMarksIcon as te,BoldIcon as ne,ItalicIcon as re,UnderlineIcon as le,StrikeIcon as oe,LinkIcon as ae,SuperscriptIcon as se,SubscriptIcon as ie,QuietIcon as ce,EmphasisIcon as ue}from"efficient-shell/icons/efficient";import{jsx as de,jsxs as he,Fragment as pe}from"react/jsx-runtime";var fe=["left","center","right","justify"],me=e.align,ge={left:/* @__PURE__ */de(U,{}),center:/* @__PURE__ */de(I,{}),right:/* @__PURE__ */de(A,{}),justify:/* @__PURE__ */de(H,{})},be={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function ve(e,t=me){return fe.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:ge[e],title:t[e]}))}var ye=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function ke(e){if(e.every(e=>e.label===me[e.id]))return e.length>3?be.four:be.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(ye.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function we(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function xe(e,t,n,r=a){const{start:l,end:o}=we(e,n);return r(e,l,o,t)}function Ce(e,t,n){const{start:r,end:l}=we(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}var De=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),Se=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function Ee(e,t){const n=t.rules??s,r=e.html&&""!==e.html.trim()?function(e,t,n){const r=t.createElement("template");r.innerHTML=e;const l=[[]],o=()=>l[l.length-1],a=()=>{const e=o();for(;e.length>0&&" "===e[e.length-1].ch;)e.pop();e.length>0&&l.push([])},s=(e,t,n,r)=>{if(3===e.nodeType){for(const a of e.textContent??""){const e=/\s/.test(a)?" ":a,s=o();" "===e&&(0===s.length&&l.length>1||" "===s[s.length-1]?.ch)||s.push({ch:e,bold:t,italic:n,href:r})}return}if(1!==e.nodeType&&11!==e.nodeType)return;const i=e,c=1===e.nodeType?i.localName:"";if(De.has(c))return;if("br"===c)return void l.push([]);let u=t,d=n,h=r;if("b"!==c&&"strong"!==c||(u=!0),"i"!==c&&"em"!==c||(d=!0),"a"===c){const e=(i.getAttribute("href")??"").trim();h=y(e)?e:null}const p=1===e.nodeType?i.style:null;if(p){const e=p.fontWeight;"bold"===e||"bolder"===e||Number(e)>=600?u=!0:("normal"===e||"lighter"===e||""!==e&&Number(e)<600)&&(u=!1),"italic"===p.fontStyle||"oblique"===p.fontStyle?d=!0:"normal"===p.fontStyle&&(d=!1)}const f=Se.has(c);f&&a();for(const t of[...e.childNodes])s(t,u,d,h);f&&a()};s(r.content,!1,!1,null);for(;l.length>1&&0===l[l.length-1].length;)l.pop();return l.map(e=>function(e,t){const n=t=>e.map((n,r)=>n[t]&&(" "!==n.ch||Boolean(e[r-1]?.[t])&&Boolean(e[r+1]?.[t]))),r=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const l of r){const r=Ne(e,l.bold?n("bold"):null,l.italic?n("italic"):null,l.links),o=i([r]).text;if(c([r],u(o,t)))return o}return e.map(e=>e.ch).join("")}(e,n))}(e.html,t.doc,n):(e.text??"").replace(/\r\n?/g,"\n").split("\n");return t.multiline?r.join("\n"):1===r.length?r[0]:r.map(e=>e.trim()).filter(e=>""!==e).join(" ")}function Ne(e,t,n,r){let l=0,o=null,a=null,s=null;return{bullet:!1,chars:e.map((e,i)=>{const c=r?e.href:null;return o=null===c?null:o&&o.href===c?o:d(++l,"link",c),a=t?.[i]?a??d(++l,"bold"):null,s=n?.[i]?s??d(++l,"italic"):null,{ch:e.ch,at:-1,marks:[o,a,s].filter(e=>null!==e)}})}}var Me=/^([0-9]{1,3})\. $/;function Le(e,t){const n=e.split("\n"),r=u(e,t);let l=0,o=0;const a=r.map((e,t)=>{const r=!e.bullet&&null==e.number&&"- "===n[t],a=null!=e.number||e.bullet?null:Me.exec(n[t]),s=e.bullet||r,i=a?a[1]:e.number??null,c=r||a?[]:e.chars,u=c.map(e=>e.ch).join(""),d=null!=i?i.length+2:s?2:0,h={bullet:s,number:i,chars:c,start:l,src:l+d,vis:o,text:u};return l+=n[t].length+1,o+=u.length+1,h});return{lines:a,text:a.map(e=>e.text).join("\n")}}function Te(e,t){const{lines:n}=e;for(let e=0;e<n.length;e+=1){const r=n[e];if(t<=r.vis+r.text.length||e===n.length-1)return[r,Math.max(0,Math.min(t-r.vis,r.text.length)),e]}return[n[0],0,0]}function Be(e,t){const[n,r]=Te(e,t);if(0===r)return n.src;let l=0;for(const e of n.chars){if(r<=l+e.ch.length)return e.at+(r-l);l+=e.ch.length}return n.src}function Re(e,t){const[n,r]=Te(e,t);let l=0;for(const e of n.chars){if(r===l)return e.at;l+=e.ch.length}return Be(e,t)}function je(e,t){const{lines:n}=e;let r=n[0];for(const e of n)t>=e.start&&(r=e);let l=0;for(const e of r.chars){if(!(t>=e.at+e.ch.length)){t>e.at&&(l+=t-e.at);break}l+=e.ch.length}return r.vis+l}function Pe(e,t,n){return[je(e,t),je(e,n)]}function ze(e,t,n){return t===n?[Be(e,t),Be(e,t)]:[Re(e,t),Be(e,n)]}function Oe(e,t){let n=0;for(let r=0;r<e.chars.length;r+=1){if(n>=t)return r;n+=e.chars[r].ch.length}return e.chars.length}function Fe(e,t,n,r,l){const o=Le(e,t),[a,s,h]=Te(o,Math.min(n,r)),[p,f,m]=Te(o,Math.max(n,r)),g=Oe(a,s),b=Oe(p,f),v=a.chars.slice(0,g),y=p.chars.slice(b),k=n!==r&&a.chars[g]&&(h!==m||g<b)?a.chars[g].marks:function(e,t){const n=e.chars[t-1],r=e.chars[t],l=(e,t)=>{const n=e.findIndex(e=>"link"===e.kind);return-1===n||t?e:e.slice(0,n)};if(n){const e=n.marks.find(e=>"link"===e.kind),t=Boolean(e&&r?.marks.some(t=>t.id===e.id));return l(n.marks,t)}return r?l(r.marks,!1):[]}(a,g);let w=(x=o.lines,Math.max(0,...x.flatMap(e=>e.chars.flatMap(e=>e.marks.map(e=>e.id))))+1);var x;const C=e=>{let n;if(void 0!==l.markup){const e=w;n=u(l.markup,t).map(t=>({bullet:t.bullet,number:t.number??null,chars:t.chars.map(t=>({...t,at:-1,marks:t.marks.map(t=>({...t,id:t.id+e}))}))}))}else{let t=a.number??null;n=(l.text??"").split("\n").map((n,r)=>(r>0&&null!=t&&(t=function(e){return String(Number(e)+1).padStart(e.length,"0")}(t)),{bullet:a.bullet,number:t,chars:[...n].map(t=>({ch:t,at:-1,marks:e??[]}))}))}const r=n.map(e=>e.chars.map(e=>e.ch).join("")).join("\n"),s={bullet:a.bullet,number:a.number??null,chars:[...v,...n[0].chars]},i=n.slice(1);if(i.length>0){const e=i[i.length-1];i[i.length-1]={...e,chars:[...e.chars,...y]}}else s.chars.push(...y);return{lines:[...o.lines.slice(0,h).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n})),s,...i,...o.lines.slice(m+1).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n}))],shown:r}},D=void 0!==l.markup?[null]:[(e=>{let t=e.filter(e=>!l.drop?.some(t=>e.kind===t||"highlight"===t&&"accent"===e.kind));for(const e of l.add??[]){if(t.some(t=>t.kind===e))continue;const n=d(w++,e);n&&(t=[...t,n])}if(void 0!==l.color){t=t.filter(e=>"color"!==e.kind);const e=null===l.color?null:d(w++,"color",l.color);e&&(t=[...t,e])}return t})(k),k,[]];let S="",E="";for(const e of D){const n=C(e),r=i(n.lines).text;if(S=r,E=n.shown,c(n.lines,Le(r,t).lines))break}return{text:S,caret:Math.min(n,r)+E.length}}function Ke(e,t,n,r){const l=Le(e,t),[o,,a]=Te(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?Fe(e,t,n,r,{text:"\n"}):We(e,t,a,!1,n)}function We(e,t,n,r,l){const o=Le(e,t).lines.map(({bullet:e,number:t,chars:l},o)=>o===n?{bullet:r,number:null,chars:l}:{bullet:e,number:t,chars:l});return{text:i(o).text,caret:l}}function $e(e,t,n,r){const l=Le(e,t),[o,a,s]=Te(l,Math.min(n,r)),[c,u,d]=Te(l,Math.max(n,r)),h=l.lines.slice(s,d+1).map(({bullet:e,number:t,chars:n},r)=>{const l=0===r?Oe(o,a):0,i=r===d-s?Oe(c,u):n.length;return{bullet:e,number:t,chars:n.slice(l,i)}});return i(h).text}var He="application/x-efficient-markup";function Ae(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Ie(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Ue(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function qe(e,t,n){if(n<0){const n=e.charCodeAt(t-1);return t-(n>=56320&&n<=57343&&t>=2?2:1)}const r=e.charCodeAt(t);return t+(r>=55296&&r<=56319?2:1)}function Ve({value:e,rules:t,multiline:n,readOnly:r=!1,placeholder:l,ariaLabel:o,handle:a,onEdit:s,onSelect:i,onHistory:c,onFormat:u,pending:d,onCommit:h,onCancel:p}){const f=O(null),m=O(null),g=O(null),b=O(null),v=O(null),y=O(e),[k,w]=F(0),x=O({value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u});x.current={value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u};const C=()=>{const e=f.current,t=m.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Ie(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ie(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},D=(e,t)=>{const n=f.current,r=m.current;if(!n||!r)return;const[l,o]=Ue(r,e),[a,s]=Ue(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};a.current={getSource(){const e=C(),t=m.current;if(!e||!t)return null;const[n,r]=ze(t.layout,e[0],e[1]);return{start:n,end:r}},setSource(e,t,n){b.current={text:n,src:[e,t]},w(e=>e+1)},focus(){f.current?.focus()},rangeOf(e,t){const n=f.current,r=m.current;if(!n||!r)return null;const[l,o]=Pe(r.layout,e,t),[a,s]=Ue(r,l),[i,c]=Ue(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},K(()=>{const n=f.current;if(!n||v.current)return;const r=b.current?null:C();m.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Ae(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(n,Le(e,t)),g.current=e;const l=b.current;if(!l||l.text!==e)return void(r&&n.ownerDocument.activeElement===n&&D(r[0],Math.min(r[1],m.current.layout.text.length)));b.current=null;const o=m.current.layout,[a,s]=l.vis??Pe(o,l.src[0],l.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),D(a,s)},[e,t,k]);const S=(e,t,n)=>{const r=m.current,[l,o]=ze(r.layout,t[0],t[1]);b.current={text:e.text,vis:[e.caret,e.caret]},e.text!==x.current.value?x.current.onEdit(e.text,{start:l,end:o},n):w(e=>e+1)};W(()=>{const e=f.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=x.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=m.current,i=C();if(!s||!i)return;let[c,u]=i;const d="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0;d&&!d.collapsed&&t.inputType.startsWith("delete")&&(c=Ie(s,e,d.startContainer,d.startOffset),u=Ie(s,e,d.endContainer,d.endOffset));const h=s.layout.text,p=t.inputType;if("historyUndo"!==p&&"historyRedo"!==p)if("formatBold"!==p&&"formatItalic"!==p&&"formatStrikeThrough"!==p)if("insertParagraph"!==p&&"insertLineBreak"!==p){if(p.startsWith("insert")){let o=t.data??t.dataTransfer?.getData("text/plain")??"";if("insertFromDrop"===p||"insertFromPaste"===p){const a=Ee({html:t.dataTransfer?.getData("text/html"),text:o},{doc:e.ownerDocument,multiline:l,rules:r});return void S(Fe(n,r,c,u,{markup:a}),[c,u],"edit")}return l||(o=o.replace(/\s*\r?\n\s*/g," ")),void S(Fe(n,r,c,u,{text:o,add:a?.add,drop:a?.drop,color:a?.color}),[c,u],"type")}if(p.startsWith("delete")){if(c===u){const e=p.includes("Backward"),t=s.layout.lines.findIndex(e=>c>=e.vis&&c<=e.vis+e.text.length),l=s.layout.lines[t];if(e&&l&&c===l.vis&&(l.bullet||null!=l.number))return void S(We(n,r,t,!1,c),[c,u],"edit");if(e?0===c:c===h.length)return;e?c=qe(h,c,-1):u=qe(h,u,1)}S(Fe(n,r,c,u,{text:""}),[c,u],"type")}}else l&&S(Ke(n,r,c,u),[c,u],"edit");else x.current.onFormat("formatBold"===p?"bold":"formatItalic"===p?"italic":"strike");else x.current.onHistory("historyUndo"===p?"undo":"redo")},n=()=>{v.current||w(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),W(()=>{const e=f.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=a.current?.getSource();e&&i(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const E=(n,l=!1)=>{const o=C();if(!o||o[0]===o[1])return;n.preventDefault();const a=m.current;n.clipboardData.setData("text/plain",a.layout.text.slice(o[0],o[1])),n.clipboardData.setData(He,$e(e,t,o[0],o[1])),l&&!r&&S(Fe(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
|
|
1
|
+
import{DEFAULT_COPY_WORDS as e}from"../chunk-JZDEIRH4.js";import{FieldNumber as t}from"../chunk-66LWADFP.js";import{SettingsSegmented as n,SettingsSwitch as r}from"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as l}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as o,applyMark as a,STANDARD_MARKUP as s,writeMarkedLines as i,sameMarks as c,markedLines as u,spanFor as d,markupTools as h,marksIn as p,findLink as f,markedAt as m,listIn as g,colorIn as b,clearStyle as v,isSafeLinkHref as y,toggleMark as k,colorOver as w,setList as x,unlinkAt as C,removeLink as D,linkOver as S,writeLink as E}from"../chunk-546BBOPE.js";import{withTip as N}from"../chunk-P2VEMZH5.js";import{useWords as M}from"../chunk-MFIRYGHW.js";import{Tooltip as L,ColorSwatch as T,ColorPickerPanel as B,Button as R,IconButton as j,registerModalEscapeInterceptor as P,LinkPicker as z}from"efficient-shell/ui";import{useRef as O,useState as F,useLayoutEffect as K,useEffect as W,useId as $}from"react";import{AlignJustifyIcon as H,AlignRightIcon as A,AlignCenterIcon as I,AlignLeftIcon as U,ParagraphSpacingIcon as q,LetterSpacingIcon as V,TextLinesIcon as Y,TextSizeIcon as Z,CaseNormalIcon as G,CaseUpperIcon as J,CaseLowerIcon as X,TextColorIcon as Q,ListIcon as _,NumberedListIcon as ee,ClearMarksIcon as te,BoldIcon as ne,ItalicIcon as re,UnderlineIcon as le,StrikeIcon as oe,LinkIcon as ae,SuperscriptIcon as se,SubscriptIcon as ie,QuietIcon as ce,EmphasisIcon as ue}from"efficient-shell/icons/efficient";import{jsx as de,jsxs as he,Fragment as pe}from"react/jsx-runtime";var fe=["left","center","right","justify"],me=e.align,ge={left:/* @__PURE__ */de(U,{}),center:/* @__PURE__ */de(I,{}),right:/* @__PURE__ */de(A,{}),justify:/* @__PURE__ */de(H,{})},be={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function ve(e,t=me){return fe.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:ge[e],title:t[e]}))}var ye=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function ke(e){if(e.every(e=>e.label===me[e.id]))return e.length>3?be.four:be.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(ye.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function we(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function xe(e,t,n,r=a){const{start:l,end:o}=we(e,n);return r(e,l,o,t)}function Ce(e,t,n){const{start:r,end:l}=we(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}var De=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),Se=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function Ee(e,t){const n=t.rules??s,r=e.html&&""!==e.html.trim()?function(e,t,n){const r=t.createElement("template");r.innerHTML=e;const l=[[]],o=()=>l[l.length-1],a=()=>{const e=o();for(;e.length>0&&" "===e[e.length-1].ch;)e.pop();e.length>0&&l.push([])},s=(e,t,n,r)=>{if(3===e.nodeType){for(const a of e.textContent??""){const e=/\s/.test(a)?" ":a,s=o();" "===e&&(0===s.length&&l.length>1||" "===s[s.length-1]?.ch)||s.push({ch:e,bold:t,italic:n,href:r})}return}if(1!==e.nodeType&&11!==e.nodeType)return;const i=e,c=1===e.nodeType?i.localName:"";if(De.has(c))return;if("br"===c)return void l.push([]);let u=t,d=n,h=r;if("b"!==c&&"strong"!==c||(u=!0),"i"!==c&&"em"!==c||(d=!0),"a"===c){const e=(i.getAttribute("href")??"").trim();h=y(e)?e:null}const p=1===e.nodeType?i.style:null;if(p){const e=p.fontWeight;"bold"===e||"bolder"===e||Number(e)>=600?u=!0:("normal"===e||"lighter"===e||""!==e&&Number(e)<600)&&(u=!1),"italic"===p.fontStyle||"oblique"===p.fontStyle?d=!0:"normal"===p.fontStyle&&(d=!1)}const f=Se.has(c);f&&a();for(const t of[...e.childNodes])s(t,u,d,h);f&&a()};s(r.content,!1,!1,null);for(;l.length>1&&0===l[l.length-1].length;)l.pop();return l.map(e=>function(e,t){const n=t=>e.map((n,r)=>n[t]&&(" "!==n.ch||Boolean(e[r-1]?.[t])&&Boolean(e[r+1]?.[t]))),r=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const l of r){const r=Ne(e,l.bold?n("bold"):null,l.italic?n("italic"):null,l.links),o=i([r]).text;if(c([r],u(o,t)))return o}return e.map(e=>e.ch).join("")}(e,n))}(e.html,t.doc,n):(e.text??"").replace(/\r\n?/g,"\n").split("\n");return t.multiline?r.join("\n"):1===r.length?r[0]:r.map(e=>e.trim()).filter(e=>""!==e).join(" ")}function Ne(e,t,n,r){let l=0,o=null,a=null,s=null;return{bullet:!1,chars:e.map((e,i)=>{const c=r?e.href:null;return o=null===c?null:o&&o.href===c?o:d(++l,"link",c),a=t?.[i]?a??d(++l,"bold"):null,s=n?.[i]?s??d(++l,"italic"):null,{ch:e.ch,at:-1,marks:[o,a,s].filter(e=>null!==e)}})}}var Me=/^([0-9]{1,3})\. $/;function Le(e,t){const n=e.split("\n"),r=u(e,t);let l=0,o=0;const a=r.map((e,t)=>{const r=!e.bullet&&null==e.number&&"- "===n[t],a=null!=e.number||e.bullet?null:Me.exec(n[t]),s=e.bullet||r,i=a?a[1]:e.number??null,c=r||a?[]:e.chars,u=c.map(e=>e.ch).join(""),d=null!=i?i.length+2:s?2:0,h={bullet:s,number:i,chars:c,start:l,src:l+d,vis:o,text:u};return l+=n[t].length+1,o+=u.length+1,h});return{lines:a,text:a.map(e=>e.text).join("\n")}}function Te(e,t){const{lines:n}=e;for(let e=0;e<n.length;e+=1){const r=n[e];if(t<=r.vis+r.text.length||e===n.length-1)return[r,Math.max(0,Math.min(t-r.vis,r.text.length)),e]}return[n[0],0,0]}function Be(e,t){const[n,r]=Te(e,t);if(0===r)return n.src;let l=0;for(const e of n.chars){if(r<=l+e.ch.length)return e.at+(r-l);l+=e.ch.length}return n.src}function Re(e,t){const[n,r]=Te(e,t);let l=0;for(const e of n.chars){if(r===l)return e.at;l+=e.ch.length}return Be(e,t)}function je(e,t){const{lines:n}=e;let r=n[0];for(const e of n)t>=e.start&&(r=e);let l=0;for(const e of r.chars){if(!(t>=e.at+e.ch.length)){t>e.at&&(l+=t-e.at);break}l+=e.ch.length}return r.vis+l}function Pe(e,t,n){return[je(e,t),je(e,n)]}function ze(e,t,n){return t===n?[Be(e,t),Be(e,t)]:[Re(e,t),Be(e,n)]}function Oe(e,t){let n=0;for(let r=0;r<e.chars.length;r+=1){if(n>=t)return r;n+=e.chars[r].ch.length}return e.chars.length}function Fe(e,t,n,r,l){const o=Le(e,t),[a,s,h]=Te(o,Math.min(n,r)),[p,f,m]=Te(o,Math.max(n,r)),g=Oe(a,s),b=Oe(p,f),v=a.chars.slice(0,g),y=p.chars.slice(b),k=n!==r&&a.chars[g]&&(h!==m||g<b)?a.chars[g].marks:function(e,t){const n=e.chars[t-1],r=e.chars[t],l=(e,t)=>{const n=e.findIndex(e=>"link"===e.kind);return-1===n||t?e:e.slice(0,n)};if(n){const e=n.marks.find(e=>"link"===e.kind),t=Boolean(e&&r?.marks.some(t=>t.id===e.id));return l(n.marks,t)}return r?l(r.marks,!1):[]}(a,g);let w=(x=o.lines,Math.max(0,...x.flatMap(e=>e.chars.flatMap(e=>e.marks.map(e=>e.id))))+1);var x;const C=e=>{let n;if(void 0!==l.markup){const e=w;n=u(l.markup,t).map(t=>({bullet:t.bullet,number:t.number??null,chars:t.chars.map(t=>({...t,at:-1,marks:t.marks.map(t=>({...t,id:t.id+e}))}))}))}else{let t=a.number??null;n=(l.text??"").split("\n").map((n,r)=>(r>0&&null!=t&&(t=function(e){return String(Number(e)+1).padStart(e.length,"0")}(t)),{bullet:a.bullet,number:t,chars:[...n].map(t=>({ch:t,at:-1,marks:e??[]}))}))}const r=n.map(e=>e.chars.map(e=>e.ch).join("")).join("\n"),s={bullet:a.bullet,number:a.number??null,chars:[...v,...n[0].chars]},i=n.slice(1);if(i.length>0){const e=i[i.length-1];i[i.length-1]={...e,chars:[...e.chars,...y]}}else s.chars.push(...y);return{lines:[...o.lines.slice(0,h).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n})),s,...i,...o.lines.slice(m+1).map(({bullet:e,number:t,chars:n})=>({bullet:e,number:t,chars:n}))],shown:r}},D=void 0!==l.markup?[null]:[(e=>{let t=e.filter(e=>!l.drop?.some(t=>e.kind===t||"highlight"===t&&"accent"===e.kind));for(const e of l.add??[]){if(t.some(t=>t.kind===e))continue;const n=d(w++,e);n&&(t=[...t,n])}if(void 0!==l.color){t=t.filter(e=>"color"!==e.kind);const e=null===l.color?null:d(w++,"color",l.color);e&&(t=[...t,e])}return t})(k),k,[]];let S="",E="";for(const e of D){const n=C(e),r=i(n.lines).text;if(S=r,E=n.shown,c(n.lines,Le(r,t).lines))break}return{text:S,caret:Math.min(n,r)+E.length}}function Ke(e,t,n,r){const l=Le(e,t),[o,,a]=Te(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?Fe(e,t,n,r,{text:"\n"}):We(e,t,a,!1,n)}function We(e,t,n,r,l){const o=Le(e,t).lines.map(({bullet:e,number:t,chars:l},o)=>o===n?{bullet:r,number:null,chars:l}:{bullet:e,number:t,chars:l});return{text:i(o).text,caret:l}}function $e(e,t,n,r){const l=Le(e,t),[o,a,s]=Te(l,Math.min(n,r)),[c,u,d]=Te(l,Math.max(n,r)),h=l.lines.slice(s,d+1).map(({bullet:e,number:t,chars:n},r)=>{const l=0===r?Oe(o,a):0,i=r===d-s?Oe(c,u):n.length;return{bullet:e,number:t,chars:n.slice(l,i)}});return i(h).text}var He="application/x-efficient-markup";function Ae(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Ie(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function Ue(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function qe(e,t,n){if(n<0){const n=e.charCodeAt(t-1);return t-(n>=56320&&n<=57343&&t>=2?2:1)}const r=e.charCodeAt(t);return t+(r>=55296&&r<=56319?2:1)}function Ve({value:e,rules:t,multiline:n,readOnly:r=!1,placeholder:l,ariaLabel:o,handle:a,onEdit:s,onSelect:i,onHistory:c,onFormat:u,pending:d,onCommit:h,onCancel:p}){const f=O(null),m=O(null),g=O(null),b=O(null),v=O(null),y=O(e),[k,w]=F(0),x=O({value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u});x.current={value:e,rules:t,multiline:n,readOnly:r,pending:d,onEdit:s,onHistory:c,onFormat:u};const C=()=>{const e=f.current,t=m.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Ie(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ie(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},D=(e,t)=>{const n=f.current,r=m.current;if(!n||!r)return;const[l,o]=Ue(r,e),[a,s]=Ue(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};a.current={getSource(){const e=C(),t=m.current;if(!e||!t)return null;const[n,r]=ze(t.layout,e[0],e[1]);return{start:n,end:r}},setSource(e,t,n){b.current={text:n,src:[e,t]},w(e=>e+1)},focus(){f.current?.focus()},rangeOf(e,t){const n=f.current,r=m.current;if(!n||!r)return null;const[l,o]=Pe(r.layout,e,t),[a,s]=Ue(r,l),[i,c]=Ue(r,o),u=n.ownerDocument.createRange();return u.setStart(a,s),u.setEnd(i,c),u}},K(()=>{const n=f.current;if(!n||v.current)return;const r=b.current?null:C();m.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Ae(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(n,Le(e,t)),g.current=e;const l=b.current;if(!l||l.text!==e)return void(r&&n.ownerDocument.activeElement===n&&D(r[0],Math.min(r[1],m.current.layout.text.length)));b.current=null;const o=m.current.layout,[a,s]=l.vis??Pe(o,l.src[0],l.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),D(a,s)},[e,t,k]);const S=(e,t,n)=>{const r=m.current,[l,o]=ze(r.layout,t[0],t[1]);b.current={text:e.text,vis:[e.caret,e.caret]},e.text!==x.current.value?x.current.onEdit(e.text,{start:l,end:o},n):w(e=>e+1)};W(()=>{const e=f.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=x.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=m.current,i=C();if(!s||!i)return;let[c,u]=i;const d="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0;d&&!d.collapsed&&t.inputType.startsWith("delete")&&(c=Ie(s,e,d.startContainer,d.startOffset),u=Ie(s,e,d.endContainer,d.endOffset));const h=s.layout.text,p=t.inputType;if("historyUndo"!==p&&"historyRedo"!==p)if("formatBold"!==p&&"formatItalic"!==p&&"formatStrikeThrough"!==p)if("insertParagraph"!==p&&"insertLineBreak"!==p){if(p.startsWith("insert")){let o=t.data??t.dataTransfer?.getData("text/plain")??"";if("insertFromDrop"===p||"insertFromPaste"===p){const a=Ee({html:t.dataTransfer?.getData("text/html"),text:o},{doc:e.ownerDocument,multiline:l,rules:r});return void S(Fe(n,r,c,u,{markup:a}),[c,u],"edit")}return l||(o=o.replace(/\s*\r?\n\s*/g," ")),void S(Fe(n,r,c,u,{text:o,add:a?.add,drop:a?.drop,color:a?.color}),[c,u],"type")}if(p.startsWith("delete")){if(c===u){const e=p.includes("Backward"),t=s.layout.lines.findIndex(e=>c>=e.vis&&c<=e.vis+e.text.length),l=s.layout.lines[t];if(e&&l&&c===l.vis&&(l.bullet||null!=l.number))return void S(We(n,r,t,!1,c),[c,u],"edit");if(e?0===c:c===h.length)return;e?c=qe(h,c,-1):u=qe(h,u,1)}S(Fe(n,r,c,u,{text:""}),[c,u],"type")}}else l&&S(Ke(n,r,c,u),[c,u],"edit");else x.current.onFormat("formatBold"===p?"bold":"formatItalic"===p?"italic":"strike");else x.current.onHistory("historyUndo"===p?"undo":"redo")},n=()=>{v.current||w(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),W(()=>{const e=f.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=a.current?.getSource();e&&i(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const E=(n,l=!1)=>{const o=C();if(!o||o[0]===o[1])return;n.preventDefault();const a=m.current;n.clipboardData.setData("text/plain",a.layout.text.slice(o[0],o[1])),n.clipboardData.setData(He,$e(e,t,o[0],o[1])),l&&!r&&S(Fe(e,t,o[0],o[1],{text:""}),o,"edit")};/* @__PURE__ */
|
|
2
2
|
return he("div",{className:"es-rich-wrap",children:[l&&""===e?/* @__PURE__ */de("div",{className:"es-rich-placeholder","aria-hidden":"true",children:l}):null,
|
|
3
3
|
/* @__PURE__ */de("div",{ref:f,className:`es-rich${n?" is-multiline":" is-single"}${r?" is-off":""}`,contentEditable:!r,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":n,"aria-label":o,"aria-readonly":r||void 0,"aria-placeholder":l,tabIndex:r?-1:0,spellCheck:!0,onFocus:()=>{y.current=e},onBlur:()=>{e!==y.current&&h?.(e),y.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),p?.(y.current),void(y.current=e);"Enter"!==t.key||n||(t.preventDefault(),e!==y.current&&h?.(e),y.current=e)},onCompositionStart:()=>{const e=C()??[0,0];v.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=v.current;if(v.current=null,!t)return;const{value:n,rules:r,pending:l}=x.current;e.data?S(Fe(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):w(e=>e+1)},onCopy:e=>E(e),onCut:e=>E(e,!0),onPaste:l=>{if(l.preventDefault(),r)return;const o=C();if(!o)return;const a=l.clipboardData.getData(He),s=a?n?a:a.replace(/\s*\r?\n\s*/g," "):Ee({html:l.clipboardData.getData("text/html"),text:l.clipboardData.getData("text/plain")},{doc:l.currentTarget.ownerDocument,multiline:n,rules:t});S(Fe(e,t,o[0],o[1],{markup:s}),o,"edit")}})]})}var Ye=1e3;function Ze(e=200){let t=[],n=[],r=null,l=0;return{record(o,a,s){const i="type"===a&&"type"===r&&s-l<1e3;r=a,l=s,n=[],i||(t.push(o),t.length>e&&t.shift())},undo(e){const l=t.pop();return l?(n.push(e),r=null,l):null},redo(e){const l=n.pop();return l?(t.push(e),r=null,l):null},reset(){t=[],n=[],r=null}}}var Ge={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */de(Z,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */de(Y,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */de(V,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */de(q,{}),unit:"px",step:1,shiftStep:10,min:0}};function Je(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Xe({cells:n,words:r,readOnly:l=!1}){const o=r??e.cells;/* @__PURE__ */
|
|
4
4
|
return de("div",{className:"es-copy-cells",children:n.map(e=>{const n=e.scale??1,r=e.name??(e.nameKey?o[e.nameKey]:e.key),a=e.unit??"",s=e.step??1;/* @__PURE__ */
|
|
@@ -8,14 +8,14 @@ return he("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-labe
|
|
|
8
8
|
/* @__PURE__ */de("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:e.map(e=>/* @__PURE__ */de(L,{content:`${e.label} · ${e.value.toUpperCase()}`,children:/* @__PURE__ */de(T,{color:e.value,size:"sm",className:"es-copy-theme-swatch","data-color":e.name,"aria-label":e.label,selected:t===e.name,onMouseDown:Qe,onClick:()=>r(e.name)})},e.name))}),
|
|
9
9
|
/* @__PURE__ */de("span",{className:"es-copy-pop-label",children:n.any}),
|
|
10
10
|
/* @__PURE__ */de(B,{className:"es-copy-any",value:l??"",onChange:e=>{e!==t&&r(e)},label:n.title,dragWrites:"end"}),
|
|
11
|
-
/* @__PURE__ */de("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */de(R,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Qe,onClick:()=>r(null),children:n.remove})})]})}var et=e=>e.preventDefault();function tt(e,t,n){const r={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1,Home:"first",End:"last"}[e.key];if(void 0===r||0===t.length)return;const l=[...e.currentTarget.querySelectorAll('[role="radio"]')],o=l.findIndex(t=>t===e.target||t.contains(e.target));if(o<0)return;e.preventDefault();const a=l.length,s="first"===r?0:"last"===r?a-1:(o+r+a)%a;l[s].disabled||(n(t[s]),l[s].focus())}var nt=["bold","italic","underline","strike","link","sup","sub"],rt=["left","center","right","justify"],lt=e=>null!=e&&!1!==e;function ot({offered:e,color:t,last:n,alignment:r,list:l,letterCase:o}){const a=nt.filter(t=>e.has(t)).length+(t?1:0)+(lt(n)?1:0),s=(r?rt.filter(e=>r.allow.includes(e)).length:0)+(l&&e.has("bullet")?1:0)+(l&&e.has("number")?1:0)+(o?3:0);return{words:a>0,paragraph:s>0,oneRow:a>0&&s>0&&a+1+s<=9,flow:a>0&&s>0&&a+1+s>9&&a<=7}}function at({words:e,align:t,alignmentLabel:n,offered:r,pressed:l,onMark:o,color:a,linkOpen:s,last:i,alignment:c,list:u,letterCase:d,disabled:h=!1,ariaLabel:p="Formatting"}){const f=e=>"es-tb-cell es-tb-btn"+(e?" is-on":""),m=(e,t,n,a)=>r.has(e)?
|
|
11
|
+
/* @__PURE__ */de("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */de(R,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:Qe,onClick:()=>r(null),children:n.remove})})]})}var et=e=>e.preventDefault();function tt(e,t,n){const r={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1,Home:"first",End:"last"}[e.key];if(void 0===r||0===t.length)return;const l=[...e.currentTarget.querySelectorAll('[role="radio"]')],o=l.findIndex(t=>t===e.target||t.contains(e.target));if(o<0)return;e.preventDefault();const a=l.length,s="first"===r?0:"last"===r?a-1:(o+r+a)%a;l[s].disabled||(n(t[s]),l[s].focus())}var nt=["bold","italic","underline","strike","link","sup","sub"],rt=["left","center","right","justify"],lt=e=>null!=e&&!1!==e;function ot({offered:e,color:t,last:n,alignment:r,list:l,letterCase:o}){const a=nt.filter(t=>e.has(t)).length+(t?1:0)+(lt(n)?1:0),s=(r?rt.filter(e=>r.allow.includes(e)).length:0)+(l&&e.has("bullet")?1:0)+(l&&e.has("number")?1:0)+(o?3:0);return{words:a>0,paragraph:s>0,oneRow:a>0&&s>0&&a+1+s<=9,flow:a>0&&s>0&&a+1+s>9&&a<=7}}function at({words:e,align:t,alignmentLabel:n,offered:r,pressed:l,onMark:o,color:a,linkOpen:s,last:i,alignment:c,list:u,letterCase:d,disabled:h=!1,ariaLabel:p="Formatting"}){const f=e=>"es-tb-cell es-tb-btn"+(e?" is-on":""),m=(e,t,n,a)=>r.has(e)?N(t,/* @__PURE__ */de(j,"link"===e?{pressed:Boolean(s),className:f(Boolean(s)),"aria-label":t,"aria-haspopup":"dialog","aria-expanded":s,"aria-keyshortcuts":a,disabled:h,onMouseDown:et,onClick:()=>o(e),children:n}:{className:"es-tb-cell es-tb-btn"+(l[e]?" is-on":""),"aria-label":t,"aria-pressed":Boolean(l[e]),"aria-keyshortcuts":a,disabled:h,onMouseDown:et,onClick:()=>o(e),children:n},e)):null,g=ot({offered:r,color:a,last:i,alignment:c,list:u,letterCase:d});if(!g.words&&!g.paragraph)return null;const b=[["left",/* @__PURE__ */de(U,{},"l")],["center",/* @__PURE__ */de(I,{},"c")],["right",/* @__PURE__ */de(A,{},"r")],["justify",/* @__PURE__ */de(H,{},"j")]],v=c?rt.filter(e=>c.allow.includes(e)):[],y=c&&v.includes(c.value)?c.value:v[0],k=[["none",e.caseNone,/* @__PURE__ */de(G,{},"n")],["upper",e.caseUpper,/* @__PURE__ */de(J,{},"u")],["lower",e.caseLower,/* @__PURE__ */de(X,{},"w")]],w=/* @__PURE__ */he(pe,{children:[m("bold",e.bold,/* @__PURE__ */de(ne,{}),"Meta+B"),m("italic",e.italic,/* @__PURE__ */de(re,{}),"Meta+I"),m("underline",e.underline,/* @__PURE__ */de(le,{}),"Meta+U"),m("strike",e.strike,/* @__PURE__ */de(oe,{})),a?N(e.color,/* @__PURE__ */de(j,{pressed:a.open,className:`${f(a.open)} es-tb-color`,"aria-label":e.color,"aria-haspopup":"dialog","aria-expanded":a.open,disabled:h,style:a.run?{"--es-tb-run":a.run}:void 0,onMouseDown:et,onClick:a.onToggle,children:/* @__PURE__ */de(Q,{})},"color")):null,m("link",e.link,/* @__PURE__ */de(ae,{}),"Meta+K"),m("sup",e.sup,/* @__PURE__ */de(se,{})),m("sub",e.sub,/* @__PURE__ */de(ie,{})),lt(i)?i:null]}),x=/* @__PURE__ */he(pe,{children:[c&&b.some(([e])=>c.allow.includes(e))?/* @__PURE__ */de("div",{className:"es-tb-group",role:"radiogroup","aria-label":n,onKeyDown:e=>tt(e,v,e=>c.onChange(e)),children:b.map(([e,n])=>c&&c.allow.includes(e)?N(t[e],/* @__PURE__ */de(j,{role:"radio",pressed:c.value===e,className:f(c.value===e),"aria-checked":c.value===e,"aria-label":t[e],tabIndex:e===y?0:-1,disabled:h||c.disabled,onMouseDown:et,onClick:()=>c.onChange(e),children:n},e)):null)}):null,u&&r.has("bullet")?N(e.bullet,/* @__PURE__ */de(j,{className:"es-tb-cell es-tb-btn"+("bullet"===u.pressed?" is-on":""),"aria-label":e.bullet,"aria-pressed":"bullet"===u.pressed,disabled:h,onMouseDown:et,onClick:()=>u.onList("bullet"),children:/* @__PURE__ */de(_,{})})):null,u&&r.has("number")?N(e.number,/* @__PURE__ */de(j,{className:"es-tb-cell es-tb-btn"+("number"===u.pressed?" is-on":""),"aria-label":e.number,"aria-pressed":"number"===u.pressed,disabled:h,onMouseDown:et,onClick:()=>u.onList("number"),children:/* @__PURE__ */de(ee,{})})):null,d?/* @__PURE__ */de("div",{className:"es-tb-group",role:"radiogroup","aria-label":e.letterCase,onKeyDown:e=>tt(e,k.map(([e])=>e),e=>d.onChange(e)),children:k.map(([e,t,n])=>N(t,/* @__PURE__ */de(j,{role:"radio",pressed:d.value===e,className:f(d.value===e),"aria-checked":d.value===e,"aria-label":t,tabIndex:e===(d.value||"none")?0:-1,disabled:h||d.disabled,onMouseDown:et,onClick:()=>d.onChange(d.value===e?"":e),children:n},e)))}):null]});return g.flow?/* @__PURE__ */de("div",{className:"es-tb",role:"toolbar","aria-label":p,children:/* @__PURE__ */he("div",{className:"es-tb-row is-flow",children:[w,
|
|
12
12
|
/* @__PURE__ */de("span",{className:"es-tb-flowgap","aria-hidden":"true"}),x]})}):g.oneRow?/* @__PURE__ */de("div",{className:"es-tb",role:"toolbar","aria-label":p,children:/* @__PURE__ */he("div",{className:"es-tb-row is-one-row",children:[
|
|
13
13
|
/* @__PURE__ */de("div",{className:"es-tb-words",children:w}),
|
|
14
|
-
/* @__PURE__ */de("div",{className:"es-tb-para",children:x})]})}):/* @__PURE__ */he("div",{className:"es-tb",role:"toolbar","aria-label":p,children:[g.words?/* @__PURE__ */de("div",{className:"es-tb-row"+(void 0===i?" is-eight":""),children:w}):null,g.paragraph?/* @__PURE__ */de("div",{className:"es-tb-row",children:x}):null]})}var st=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var it=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function ct(e){const t=e.ownerDocument,n=t.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=t.defaultView?.getComputedStyle.bind(t.defaultView);for(let o=e.parentElement;o&&o!==n&&o!==t.body;o=o.parentElement){const e=l?.(o);if(!e||"visible"===e.overflowX&&"visible"===e.overflowY)continue;const t=o.getBoundingClientRect();if(0===t.width&&0===t.height)continue;const n=t.left+o.clientLeft,a=t.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,a),r.right=Math.min(r.right,n+(o.clientWidth||t.width)),r.bottom=Math.min(r.bottom,a+(o.clientHeight||t.height))}return r}function ut(e){const t=e.offsetParent??e.parentElement;if(!t)return{left:0,top:0};const n=t.getBoundingClientRect();return{left:n.left+t.clientLeft-t.scrollLeft,top:n.top+t.clientTop-t.scrollTop}}var dt=/* @__PURE__ */new Set([...o,"clear"]),ht={bold:/* @__PURE__ */de(ne,{size:16}),italic:/* @__PURE__ */de(re,{size:16}),strike:/* @__PURE__ */de(oe,{size:16}),highlight:/* @__PURE__ */de(ue,{size:16}),quiet:/* @__PURE__ */de(ce,{size:16}),link:/* @__PURE__ */de(ae,{size:16}),clear:/* @__PURE__ */de(te,{size:16})};function pt(e){if(!e)return;const t=e.split("+"),n=t.pop().toUpperCase();return["Meta",...t.map(e=>e[0].toUpperCase()+e.slice(1)),n].join("+")}var ft={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function mt({tools:t,onApply:n,disabled:r=!1,actions:l,align:o,glyphs:a,ariaLabel:s,pressed:i,open:c=null}){const u=
|
|
15
|
-
/* @__PURE__ */de("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */de("span",{className:"es-copy-bar-end",children:o}):null]}):null}function gt({target:e,onChange:t}){const n=O(null);return K(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var bt=["bold","italic","underline","strike","sup","sub"];function vt({value:t,onChange:o,onCommit:i,onCancel:c,multiline:u=!1,placeholder:y,ariaLabel:L,className:T,readOnly:B=!1,rules:j,tools:H=[],writeMark:A,actions:I,align:U,glyphs:q,barLabel:V,renderFooter:Y,inputRef:Z,barShows:G="always",richText:J=!0,defaultShowMarks:X=!1,toolbar:Q="final",colors:_,cells:ee,letterCase:ne,lastTool:re}){const le="final"===Q,oe=
|
|
14
|
+
/* @__PURE__ */de("div",{className:"es-tb-para",children:x})]})}):/* @__PURE__ */he("div",{className:"es-tb",role:"toolbar","aria-label":p,children:[g.words?/* @__PURE__ */de("div",{className:"es-tb-row"+(void 0===i?" is-eight":""),children:w}):null,g.paragraph?/* @__PURE__ */de("div",{className:"es-tb-row",children:x}):null]})}var st=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));var it=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom});function ct(e){const t=e.ownerDocument,n=t.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=t.defaultView?.getComputedStyle.bind(t.defaultView);for(let o=e.parentElement;o&&o!==n&&o!==t.body;o=o.parentElement){const e=l?.(o);if(!e||"visible"===e.overflowX&&"visible"===e.overflowY)continue;const t=o.getBoundingClientRect();if(0===t.width&&0===t.height)continue;const n=t.left+o.clientLeft,a=t.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,a),r.right=Math.min(r.right,n+(o.clientWidth||t.width)),r.bottom=Math.min(r.bottom,a+(o.clientHeight||t.height))}return r}function ut(e){const t=e.offsetParent??e.parentElement;if(!t)return{left:0,top:0};const n=t.getBoundingClientRect();return{left:n.left+t.clientLeft-t.scrollLeft,top:n.top+t.clientTop-t.scrollTop}}var dt=/* @__PURE__ */new Set([...o,"clear"]),ht={bold:/* @__PURE__ */de(ne,{size:16}),italic:/* @__PURE__ */de(re,{size:16}),strike:/* @__PURE__ */de(oe,{size:16}),highlight:/* @__PURE__ */de(ue,{size:16}),quiet:/* @__PURE__ */de(ce,{size:16}),link:/* @__PURE__ */de(ae,{size:16}),clear:/* @__PURE__ */de(te,{size:16})};function pt(e){if(!e)return;const t=e.split("+"),n=t.pop().toUpperCase();return["Meta",...t.map(e=>e[0].toUpperCase()+e.slice(1)),n].join("+")}var ft={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function mt({tools:t,onApply:n,disabled:r=!1,actions:l,align:o,glyphs:a,ariaLabel:s,pressed:i,open:c=null}){const u=M("copy",e),d=("string"==typeof t[0]?h(t).map(e=>({...e,...u.marks[e.style]})):t).filter(e=>!dt.has(e.style));return 0!==d.length||l||o?/* @__PURE__ */he("div",{className:"es-copy-bar",role:"group","aria-label":s??u.formatting,children:[d.map(e=>{const t=a?.[e.style]??ht[e.style],l=c===e.style||Boolean(i?.[e.style]),o="link"===e.style&&Boolean(i);return N(e.title,/* @__PURE__ */de(j,{onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:r,"aria-label":e.name??e.title,"aria-keyshortcuts":pt(e.shortcut),"aria-pressed":o||!i&&!c?void 0:l,pressed:o?l:void 0,"aria-haspopup":o?"dialog":void 0,"aria-expanded":o?"link"===c:void 0,className:`es-copy-mark${t?" has-glyph":ft[e.style]?` ${ft[e.style]}`:""}${l?" is-active":""}`,children:t??e.label},e.style))}),l?/* @__PURE__ */he(pe,{children:[
|
|
15
|
+
/* @__PURE__ */de("span",{className:"es-copy-bar-split","aria-hidden":"true"}),l]}):null,o?/* @__PURE__ */de("span",{className:"es-copy-bar-end",children:o}):null]}):null}function gt({target:e,onChange:t}){const n=O(null);return K(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var bt=["bold","italic","underline","strike","sup","sub"];function vt({value:t,onChange:o,onCommit:i,onCancel:c,multiline:u=!1,placeholder:y,ariaLabel:L,className:T,readOnly:B=!1,rules:j,tools:H=[],writeMark:A,actions:I,align:U,glyphs:q,barLabel:V,renderFooter:Y,inputRef:Z,barShows:G="always",richText:J=!0,defaultShowMarks:X=!1,toolbar:Q="final",colors:_,cells:ee,letterCase:ne,lastTool:re}){const le="final"===Q,oe=M("copy",e),ae=O(null),se=Z??ae,[ie,ce]=F(!1),[ue,fe]=F(null),me=O(Ze()).current,ge=O(null);W(()=>{const e=ge.current;e&&t===e.to?ge.current=null:e&&t===e.from||(ge.current=null,me.reset())},[t,me]);const be=e=>{ge.current={from:ge.current?.from??t,to:e},o(e)},ye=e=>({text:t,start:e?.selectionStart??ue?.start??t.length,end:e?.selectionEnd??ue?.end??t.length}),[we,De]=F(X),Se=J&&!(u&&we),Ne=O(null),Me=$(),[Le,Te]=F(null),[Be,Re]=F(!1),je=()=>{if(!Se)return se.current;const e=Ne.current?.getSource()??ue;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Pe=gt({target:se,onChange:be}),ze=e=>(fe({start:e.selectionStart,end:e.selectionEnd}),e),Oe=(e,n)=>{if(!Se)return void Pe(t=>(n&&me.record(ye(t),"edit",Date.now()),ze(e(t))));const r=je(),l=ze(e(r));n&&me.record(ye(r),"edit",Date.now()),Te(null),l.text!==t&&be(l.text),Ne.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Fe=e=>Oe(e,!0),Ke=e=>Oe(t=>{const n=ye(t),r=me[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),We=O(null);K(()=>{const e=We.current;e&&(We.current=null,Se?Ne.current?.setSource(e.start,e.end,t):(se.current?.focus(),se.current?.setSelectionRange(e.start,e.end),fe(e)))},[Se]);const[$e,He]=F(null),Ae=j??s,Ie=("string"==typeof H[0]?h(H):H).filter(e=>!dt.has(e.style)),Ue=le?("string"==typeof H[0]?H:H.map(e=>e.style)).filter(e=>!dt.has(e)):Ie.map(e=>e.style),qe={};if(ue&&(Se||le)){const e=p(t,ue.start,ue.end,Ae);for(const t of Ue){const n=e.has(t)||"highlight"===t&&e.has("accent");qe[t]=!!Le?.add.includes(t)||!Le?.drop.includes(t)&&n}le&&(qe.link=e.has("link"))}else if(ue)for(const e of Ue)qe[e]="link"===e?null!==f(t,ue.start,ue.end):m(t,ue.start,ue.end,e);const Ye=()=>{const e=je(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Ge={sup:"sub",sub:"sup"},Je=e=>{if(le&&"link"!==e&&d(0,e)){const{start:n,end:r}=Ye(),l=Ge[e];if(n===r){if(!Se)return void Fe(n=>xe(t,e,n,(e,t,n,r)=>a(e,t,n,r,Ae,oe.placeholders)));const o=p(t,n,r,Ae),s=Le&&Le.at===n?Le:null,i=o.has(e),c=!!s?.add.includes(e)||!s?.drop.includes(e)&&i;let u=(s?.add??[]).filter(t=>t!==e),d=(s?.drop??[]).filter(t=>t!==e);return c&&i?d.push(e):c||i||u.push(e),!c&&l&&(u=u.filter(e=>e!==l),o.has(l)&&(d=[...d.filter(e=>e!==l),l])),void Te(u.length||d.length||void 0!==s?.color?{add:u,drop:d,color:s?.color,at:n}:null)}return void Fe(()=>{let o=t,a=n,s=r;if(l&&!p(o,a,s,Ae).has(e)&&p(o,a,s,Ae).has(l)){const e=k(o,a,s,l,Ae);({text:o,selectionStart:a,selectionEnd:s}=e)}return k(o,a,s,e,Ae)})}if("clear"===e)return void Fe(n=>xe(t,e,n,(e,t,n)=>a(e,t,n,"clear",Ae)));if("link"!==e&&Se&&d(0,e)){const n=je(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;if(r===l){const n=p(t,r,l,Ae),o=n.has(e)||"highlight"===e&&n.has("accent"),a=Le&&Le.at===r?Le:null,s=!!a?.add.includes(e)||!a?.drop.includes(e)&&o,i=(a?.add??[]).filter(t=>t!==e),c=(a?.drop??[]).filter(t=>t!==e);return s&&o?c.push(e):s||o||i.push(e),void Te(i.length||c.length?{add:i,drop:c,at:r}:null)}return void Fe(n=>k(t,n?.selectionStart??r,n?.selectionEnd??l,e,Ae))}if("link"!==e){const n=A??((e,t,n,r)=>a(e,t,n,r,s,oe.placeholders));return void Fe(r=>xe(t,e,r,n))}const n=je(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Re(!1),He({start:r,end:l,link:f(t,r,l)})},Qe=Boolean(ue&&ue.start!==ue.end),et=ue?g(t,ue.start,ue.end,Ae):null,tt=ue?Le&&void 0!==Le.color&&Le.at===ue.start?Le.color:b(t,ue.start,ue.end,Ae):null,nt=tt?tt.startsWith("#")?tt:_?.find(e=>e.name===tt)?.value:void 0,rt=e=>{Se?e?Ne.current?.setSource(e.start,e.end,t):Ne.current?.focus():(se.current?.focus(),e&&se.current?.setSelectionRange(e.start,e.end))},lt=()=>{const e=$e;He(null),rt(e?{start:e.start,end:e.end}:ue)},ht=()=>{const e=ft.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Re(!1),t&&rt(ue)},pt=O(ht);pt.current=ht,W(()=>{if(Be)return P(e=>{const t=ft.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(pt.current(),!0)},()=>ft.current?.querySelector(".es-copy-colors"))},[Be]);const ft=O(null),vt=Be||null!==$e;W(()=>{const e=ft.current;if(!vt||!e)return;const t=e.ownerDocument,n=()=>{Re(!1),He(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[vt]);const yt=$e??(Be?ue??{start:t.length,end:t.length}:null),kt=O(()=>{});kt.current=()=>{const e=ft.current,t=e?.querySelector(".es-tb-wrap > .es-copy-pop");if(!e||!t||!yt)return;const n=Se?null:e.querySelector(".es-gold-layer"),r=Se?Ne.current?.rangeOf(yt.start,yt.end)??null:n?function(e,t,n){const r=e.ownerDocument,l=r.createTreeWalker(e,4),o=e=>{let t=e,n=null;for(let e=l.nextNode();e;e=l.nextNode()){if(t<=e.data.length)return[e,t];t-=e.data.length,n=e}return n?[n,n.data.length]:null},a=o(t);l.currentNode=e;const s=o(n);if(!a||!s)return null;const i=r.createRange();return i.setStart(a[0],a[1]),i.setEnd(s[0],s[1]),i}(n,yt.start,yt.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,a=r?function(e,t){const n=("function"==typeof e.getClientRects?[...e.getClientRects()]:[]).filter(e=>e.height>0);if(n.length>0){const t="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():n[0];return t.height>0?it(t):it(n[0])}if(!t)return null;const r=t.getBoundingClientRect();return{left:r.left,top:r.top,right:r.left,bottom:r.bottom}}(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const s=function({anchor:e,size:t,within:n,clip:r,parent:l,gap:o=8}){const a=Math.max(n.left,r.left),s=Math.min(n.right,r.right)-t.width,i=st(e.left,a,s),c=r.bottom-(e.bottom+o),u=e.top-o-r.top,d=t.height>c&&(t.height<=u||u>c),h=d?e.top-o-t.height:e.bottom+o,p=e.left+Math.min((e.right-e.left)/2,10),f=st(p-5-i,10,t.width-10-10);return{top:h-l.top,left:i-l.left,above:d,point:f}}({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:ct(e),parent:ut(t)});t.style.top=`${s.top}px`,t.style.left=`${s.left}px`,t.style.setProperty("--es-pop-point",`${s.point}px`),t.dataset.side=s.above?"above":"below"},K(()=>{const e=ft.current;if(!vt||!e)return;const t=()=>kt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".es-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[vt,Be,$e,yt?.start,yt?.end,Se]);const wt=e=>$e&&/* @__PURE__ */de(z,{className:e?"es-copy-link es-copy-pop":"es-copy-link",value:$e.link?.href??"",onApply:e=>{const n=$e;He(null),Fe(()=>Se?S(t,n.start,n.end,e,Ae):E(t,n.start,n.end,e))},onRemove:$e.link?()=>{const e=$e.link,n=$e;He(null),e&&Fe(()=>Se?C(t,n.start,n.end,Ae):D(t,e))}:void 0,onCancel:lt}),xt=U?ve(U.allow,oe.align):[],Ct="always"===G||ie||null!==$e||Be,Dt=_&&_.length>0?{run:nt,open:Be,onToggle:()=>{He(null),Be?ht():Re(!0)}}:void 0,St=Ct&&le&&re?re({className:"es-tb-cell es-tb-btn",disabled:B,selected:Qe,keepCaret:e=>e.preventDefault(),insert:e=>Fe(n=>Ce(t,e,n))}):void 0,Et=new Set(Ue),Nt=U?{value:U.value,allow:U.allow,onChange:U.onChange,disabled:U.disabled}:void 0,Mt={pressed:et,onList:e=>{const{start:n,end:r}=Ye(),l=g(t,n,r,Ae);Fe(()=>x(t,n,r,l===e?null:e,Ae))}},Lt=ot({offered:Et,color:Dt,last:St,alignment:Nt,list:Mt,letterCase:ne}),Tt=function(e,t){const n=["bold","italic","underline","strike"].filter(t=>e.has(t)).length;return{color:n,link:n+(t?1:0)}}(Et,Boolean(Dt)),Bt=le&&Ct&&(bt.some(e=>Et.has(e))||Boolean(Dt));/* @__PURE__ */
|
|
16
16
|
return he("div",{ref:ft,className:"es-copy"+(T?` ${T}`:""),onFocus:()=>ce(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ce(!1)},onKeyDown:e=>{const t=e.target===se.current||Boolean(e.target.closest?.(".es-rich"));if(B||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void Ke(l||e.shiftKey?"redo":"undo");const o=`${e.shiftKey?"shift+":""}${n}`;if(le){const t={b:"bold",i:"italic",u:"underline",k:"link"}[o];if(!t||!Ue.includes(t))return;return e.preventDefault(),e.stopPropagation(),void Je(t)}const a=Ie.find(e=>e.shortcut===o);a&&(e.preventDefault(),e.stopPropagation(),Je(a.style))},onPaste:e=>{const n=se.current;if(B||!n||e.target!==n)return;e.preventDefault();const r=Ee({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:u,rules:Ae});Fe(e=>Ce(t,r,e))},style:_&&_.length>0?Object.fromEntries(_.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=se.current;e&&e.ownerDocument.activeElement===e&&fe({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[Ct&&le&&(Lt.words||Lt.paragraph)?/* @__PURE__ */he("div",{className:"es-tb-wrap"+(Lt.oneRow?" is-one-row":Lt.flow?" is-flow":re?"":" is-eight"),style:{"--es-tb-color-col":Tt.color,"--es-tb-link-col":Tt.link},children:[
|
|
17
17
|
/* @__PURE__ */de(at,{words:oe.toolbar??e.toolbar,align:oe.align,alignmentLabel:oe.alignment,ariaLabel:V??oe.formatting,offered:Et,pressed:qe,onMark:e=>Je(e),color:Dt,linkOpen:null!==$e,last:St,alignment:Nt,list:Mt,letterCase:ne,disabled:B}),Be&&_&&_.length>0?/* @__PURE__ */de(_e,{colors:_,current:tt,words:oe.colors??e.colors,onPick:e=>{const{start:n,end:r}=Ye();if(n!==r)Fe(()=>w(t,n,r,e,Ae));else{if(!Se)return;Te({add:Le?.add??[],drop:Le?.drop??[],color:e,at:n})}}}):null,$e?wt(!0):null]}):null,le&&ee&&ee.length>0?/* @__PURE__ */de(Xe,{cells:ee,words:oe.cells??e.cells,readOnly:B}):null,Ct&&!le?/* @__PURE__ */de(mt,{tools:H,disabled:B,actions:I,glyphs:q,ariaLabel:V,pressed:qe,open:$e?"link":null,onApply:Je,align:U?/* @__PURE__ */de(n,{options:xt,value:U.value,onChange:U.onChange,ariaLabel:oe.alignment,disabled:B||U.disabled,fit:ke(xt)}):null}):null,Se?/* @__PURE__ */de(Ve,{value:t,rules:Ae,multiline:u,readOnly:B,placeholder:y,ariaLabel:L,handle:Ne,pending:Le??void 0,onEdit:(e,n,r)=>{me.record({text:t,start:n.start,end:n.end},r,Date.now()),Te(null),be(e)},onSelect:e=>{fe(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Le||e.start===Le.at&&e.end===Le.at||Te(null)},onHistory:Ke,onFormat:e=>{Ue.includes(e)&&Je(e)},onCommit:i,onCancel:c}):/* @__PURE__ */de(l,{value:t,onInput:e=>{me.record(ye(null),"type",Date.now()),be(e)},onCommit:i,onCancel:c,multiline:u,placeholder:y,ariaLabel:L,rules:j,disabled:B,inputRef:se,className:"es-copy-box"}),$e&&!le?wt(!1):null,Y?Y({focused:ie,insert:e=>Fe(n=>Ce(t,e,n))}):null,J&&u||Bt?
|
|
18
18
|
/* @__PURE__ */he("div",{className:"es-copy-marks",children:[J&&u?/* @__PURE__ */he(pe,{children:[
|
|
19
19
|
/* @__PURE__ */de(r,{checked:we,onChange:()=>{const e=je();We.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ue,Te(null),De(e=>!e)},ariaLabelledBy:Me,disabled:B}),
|
|
20
|
-
/* @__PURE__ */de("span",{id:Me,className:"es-copy-marks-label",children:oe.showMarks??"Show marks"})]}):null,Bt?
|
|
20
|
+
/* @__PURE__ */de("span",{id:Me,className:"es-copy-marks-label",children:oe.showMarks??"Show marks"})]}):null,Bt?N(Qe?void 0:oe.clearStyleEmpty??"Select words first",/* @__PURE__ */he(R,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:B||!Qe,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:e,end:n}=Ye();if(e===n)return;const r=v(t,e,n,Ae);r.text!==t&&Fe(()=>r)},children:[
|
|
21
21
|
/* @__PURE__ */de(te,{size:16}),oe.clearStyle??"Clear style"]})):null]}):null]})}export{fe as COPY_ALIGNS,be as COPY_ALIGN_FIT,ge as COPY_ALIGN_GLYPHS,me as COPY_ALIGN_LABELS,Ge as COPY_CELLS,_e as ColorWindow,vt as CopyBox,Xe as CopyCells,He as MARKUP_CLIPBOARD_TYPE,mt as MarkBar,Ve as RichBox,Ye as TYPING_BURST_MS,at as TextToolbar,pt as ariaShortcut,ve as copyAlignOptions,Ze as createHistory,Fe as editVisible,Ce as insertSelection,xe as markSelection,$e as markupOfRange,Ke as newLine,Ee as pasteToMarkup,Le as richLayout,ze as selectionToSource,Pe as selectionToVisible,We as setBullet,Be as toSource,Re as toSourceStart,je as toVisible,gt as useCaretEdit};
|
package/dist/drag/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddPanel,CanvasDragLayer,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-
|
|
1
|
+
export{AddPanel,CanvasDragLayer,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-KEHLCWTG.js";import"../chunk-O2NLQBFX.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-67GNT6PF.js";import"../chunk-PAELDYYS.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";import"../chunk-ZNCEOSXO.js";
|
package/dist/easel/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ import { c as ResolveTrigger, a as ResolveCache, R as ResolvableItem } from '../
|
|
|
8
8
|
import * as react from 'react';
|
|
9
9
|
import { ReactNode, CSSProperties, ComponentType, ReactElement } from 'react';
|
|
10
10
|
import { b as NodeOpsHost, C as ClipboardEntry } from '../useNodeOps-CLbZyd43.js';
|
|
11
|
-
import { I as InspectorFields } from '../types-
|
|
12
|
-
import '../buckets-
|
|
11
|
+
import { I as InspectorFields } from '../types-OUl0mK1k.js';
|
|
12
|
+
import '../buckets-Tj-nkBpg.js';
|
|
13
13
|
|
|
14
14
|
interface EaselOptions<C extends EaselConfig = EaselConfig> {
|
|
15
15
|
config: C;
|
package/dist/fields/fields.css
CHANGED
|
@@ -79,6 +79,10 @@ span:has(> .es-fnum) { display: flex; min-width: 0; }
|
|
|
79
79
|
.es-insp-row { min-width: 0; }
|
|
80
80
|
.es-insp-row:empty,
|
|
81
81
|
.es-insp-row[hidden] { display: none; }
|
|
82
|
+
/* A folding band (Inspector, 4.0.0): a plain wrapper round easel's
|
|
83
|
+
`SettingsGroup`, out of the layout on another tab but still mounted. */
|
|
84
|
+
.es-insp-band { min-width: 0; }
|
|
85
|
+
.es-insp-band[hidden] { display: none; }
|
|
82
86
|
|
|
83
87
|
/* ── a list (ListField): ONE look in both editors (owner, 2026-10-06) ────────
|
|
84
88
|
The website ticker's rows: one row per item, a × at its end, "+ Add <noun>"
|
package/dist/fields/index.d.ts
CHANGED
|
@@ -1,13 +1,79 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { S as SettingsBucket } from '../buckets-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { S as SettingsBucket } from '../buckets-Tj-nkBpg.js';
|
|
4
|
+
export { D as DesignGroup } from '../buckets-Tj-nkBpg.js';
|
|
5
|
+
import { a as InspectorFieldDef, I as InspectorFields, F as FieldRenderer, b as FieldTextProps, c as FieldNumberProps, d as FieldSliderProps, e as FieldSelectManyProps, f as FieldSelectOneProps, g as FieldOption } from '../types-OUl0mK1k.js';
|
|
6
|
+
export { A as ArrayFieldDef, C as CustomFieldDef, h as CustomFieldRenderProps, i as FieldSelectProps, N as NumberFieldDef, O as ObjectFieldDef, R as RadioFieldDef, S as SelectFieldDef, j as SlotFieldDef, T as TextFieldDef, k as TextareaFieldDef } from '../types-OUl0mK1k.js';
|
|
6
7
|
import { R as ResolvableItem } from '../resolve-D68pb3Bx.js';
|
|
7
8
|
export { F as FieldsWords } from '../words-vhnV8sM7.js';
|
|
8
9
|
export { LinkFilter, LinkFilterField, LinkKindChoice, LinkOption, LinkOptionGroup, LinkPicker, LinkPickerProps, LinkRules, LinkTarget } from 'efficient-shell/ui';
|
|
9
10
|
import '../types-41704JE4.js';
|
|
10
11
|
|
|
12
|
+
/** The folding band a row sits in: the fold marker's name and its title. */
|
|
13
|
+
interface PlannedFold {
|
|
14
|
+
key: string;
|
|
15
|
+
title: string;
|
|
16
|
+
}
|
|
17
|
+
/** One drawn row: a field, its name, the tab it opens, and its band if any. */
|
|
18
|
+
interface PlannedRow {
|
|
19
|
+
name: string;
|
|
20
|
+
field: InspectorFieldDef;
|
|
21
|
+
bucket: SettingsBucket;
|
|
22
|
+
/** The band the row sits in (a `fold` marker above it); none before the first. */
|
|
23
|
+
fold?: PlannedFold;
|
|
24
|
+
}
|
|
25
|
+
interface FieldPlan {
|
|
26
|
+
/**
|
|
27
|
+
* Every field that is not a marker and not hidden, in the order declared.
|
|
28
|
+
*
|
|
29
|
+
* ⚠️ A `slot` field is among them and draws NOTHING: it is here so its name
|
|
30
|
+
* has a bucket (`bucketsOf`), and `Inspector` leaves it mounted but empty.
|
|
31
|
+
* A host that draws rows of its own, or counts them ("3 settings"), filters
|
|
32
|
+
* `row.field.type !== 'slot'` first. `buckets` already leaves slots out.
|
|
33
|
+
*/
|
|
34
|
+
rows: PlannedRow[];
|
|
35
|
+
/** The tabs to offer: the buckets that hold a row, in the owner's order. */
|
|
36
|
+
buckets: SettingsBucket[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* WHICH TAB EACH FIELD OPENS — read off the fields themselves (blueprint 4.1:
|
|
40
|
+
* "the tab is declared by the field, never found by hashed class names").
|
|
41
|
+
*
|
|
42
|
+
* In declaration order, a field's own `bucket` starts that bucket, and every
|
|
43
|
+
* field after it without one stays in it; the panel starts in Design, the first
|
|
44
|
+
* bucket (`SETTINGS_BUCKETS`: Design, Animation since 4.0.0), so the rows that
|
|
45
|
+
* were the Content tab — declared first — sit at the top of Design. That one
|
|
46
|
+
* rule covers both editors: the email designer puts a mark in front of each
|
|
47
|
+
* tab's run (its `FIELD_BUCKETS` map), the website puts a heading there (its
|
|
48
|
+
* `group(...)` headers), and a mark is just a field with `marker: true` that
|
|
49
|
+
* draws nothing. A bucket name that is not in the list — the 3.x names
|
|
50
|
+
* `Content`, `Style` and `Layout` included — changes nothing.
|
|
51
|
+
*
|
|
52
|
+
* The Design GROUPS (`DESIGN_GROUPS`: Content, Size, Design, Layout, Position,
|
|
53
|
+
* Anchor) are not tabs and are not read here: they are the host's headings
|
|
54
|
+
* inside Design, in that order.
|
|
55
|
+
*
|
|
56
|
+
* A slot counts for no tab — it draws nothing in the panel — and a field with
|
|
57
|
+
* `visible: false` neither draws nor counts, so a tab whose fields are all
|
|
58
|
+
* hidden is not offered (the owner's rule: an empty tab is hidden, never drawn).
|
|
59
|
+
*
|
|
60
|
+
* BANDS (Lewis, 2026-10-13: one kind of group heading per panel, and it folds).
|
|
61
|
+
* A marker with `fold` starts a band titled with it; the rows after it are in
|
|
62
|
+
* that band until the next fold marker or the next tab marker (a band never
|
|
63
|
+
* crosses a tab). A marker with `fold: false` ends the band above and starts
|
|
64
|
+
* none, so the rows after it stand alone. A marker with neither `fold` nor
|
|
65
|
+
* `bucket` ends nothing: it is a key the host keeps and nothing more. One level only — a band in a band
|
|
66
|
+
* cannot be said. A band whose rows are all hidden draws nothing
|
|
67
|
+
* (`Inspector`).
|
|
68
|
+
*/
|
|
69
|
+
declare function planFields(fields: InspectorFields): FieldPlan;
|
|
70
|
+
/**
|
|
71
|
+
* Every field's bucket, by name — what "copy style" asks (a look is never
|
|
72
|
+
* Animation). The walk both editors did on their own (the website's
|
|
73
|
+
* `style-clipboard.ts`, the email designer's `FIELD_BUCKETS`) is this one.
|
|
74
|
+
*/
|
|
75
|
+
declare function bucketsOf(fields: InspectorFields): Map<string, SettingsBucket>;
|
|
76
|
+
|
|
11
77
|
interface InspectorProps {
|
|
12
78
|
/** The selected node's fields, already resolved by the host. */
|
|
13
79
|
fields: InspectorFields;
|
|
@@ -23,7 +89,8 @@ interface InspectorProps {
|
|
|
23
89
|
onTab?: (tab: SettingsBucket) => void;
|
|
24
90
|
/** False: no tab strip, every row in one list (the email designer's phone view). */
|
|
25
91
|
tabs?: boolean;
|
|
26
|
-
/** A glyph per tab (both editors draw one).
|
|
92
|
+
/** A glyph per tab (both editors draw one). A tab with a glyph is
|
|
93
|
+
* icon-only: its word is its accessible name and its Tooltip. */
|
|
27
94
|
tabIcons?: Partial<Record<SettingsBucket, ReactNode>>;
|
|
28
95
|
/** A field type's drawing, swapped in by the host. */
|
|
29
96
|
renderers?: Partial<Record<InspectorFieldDef['type'], FieldRenderer>>;
|
|
@@ -31,8 +98,20 @@ interface InspectorProps {
|
|
|
31
98
|
idPrefix?: string;
|
|
32
99
|
/** The tab strip's name. Default "Settings" (`EaselStrings.panel.settings`). */
|
|
33
100
|
ariaLabel?: string;
|
|
101
|
+
/** Drawn inside the rows panel BEFORE the rows, on every tab (4.0.0). The
|
|
102
|
+
* website editor puts its text box here, so it sits at the top of Design. */
|
|
103
|
+
lead?: ReactNode;
|
|
34
104
|
/** Drawn after the rows, on every tab (an app's own trailing rows). */
|
|
35
105
|
children?: ReactNode;
|
|
106
|
+
/** Put `lead` in a folding band of its own, with this key and title, the
|
|
107
|
+
* first band of the panel (4.0.0). Absent: `lead` stands without a band. */
|
|
108
|
+
leadFold?: PlannedFold;
|
|
109
|
+
/** The bands that are CLOSED, by key (a fold marker's name, or
|
|
110
|
+
* `leadFold.key`). Absent: the Inspector keeps its own; every band starts
|
|
111
|
+
* open. */
|
|
112
|
+
closedFolds?: ReadonlySet<string>;
|
|
113
|
+
/** A band opened (`true`) or closed (`false`). */
|
|
114
|
+
onFold?: (key: string, open: boolean) => void;
|
|
36
115
|
}
|
|
37
116
|
/**
|
|
38
117
|
* THE SETTINGS PANEL'S BODY (blueprint step 4.1) — what `<Puck.Fields>` was in
|
|
@@ -40,7 +119,14 @@ interface InspectorProps {
|
|
|
40
119
|
*
|
|
41
120
|
* - THE TABS ARE THE FIELDS' OWN. Which tab a field opens is said on the field
|
|
42
121
|
* (`bucket`, ./plan); the strip offers only the tabs that hold a row, in the
|
|
43
|
-
* owner's order, and none at all when there is only one.
|
|
122
|
+
* owner's order (Design, Animation), and none at all when there is only one.
|
|
123
|
+
* - THE STRIP IS THE SHELL'S `Tabs` (4.0.0, harness UI-24). Owner, final
|
|
124
|
+
* 2026-10-10: two icon-only tabs of EQUAL width, the chosen one a blue icon
|
|
125
|
+
* over a blue underline — the shell's `underline` look with `block`. A tab
|
|
126
|
+
* with a glyph keeps its word visually hidden in its label (the shell's
|
|
127
|
+
* documented icon-only pattern, `sr-only`), so the word is still its name,
|
|
128
|
+
* and says the word in the tab's own Tooltip. A tab with no glyph shows its
|
|
129
|
+
* word. Easel's `SettingsTabs` is no longer drawn here.
|
|
44
130
|
* - A ROW ON ANOTHER TAB IS HIDDEN, NOT UNMOUNTED. The email designer's Logo
|
|
45
131
|
* re-bakes its colours from a field on a tab you are not looking at; taking
|
|
46
132
|
* the row out of the tree would stop that.
|
|
@@ -49,10 +135,18 @@ interface InspectorProps {
|
|
|
49
135
|
* that draws nothing takes no space (`:empty`).
|
|
50
136
|
* - THE SPACING IS THE PANEL'S (panel.css `--es-rhythm-*`): a row adds none of
|
|
51
137
|
* its own, so the rhythm is defined once for both editors.
|
|
52
|
-
* - A TAB'S KEY IS NOT ITS WORD. `bucket: '
|
|
53
|
-
* says is `EaselStrings.panel.buckets.
|
|
138
|
+
* - A TAB'S KEY IS NOT ITS WORD. `bucket: 'Design'` names the tab; what the tab
|
|
139
|
+
* says is `EaselStrings.panel.buckets.Design`, from the strings provider.
|
|
140
|
+
* - `lead` OPENS THE ROWS, `children` CLOSE THEM. Both sit inside the rows
|
|
141
|
+
* panel and show on every tab.
|
|
142
|
+
* - ONE KIND OF GROUP, AND IT FOLDS (Lewis, 2026-10-13). A run of rows under a
|
|
143
|
+
* `fold` marker (./plan) is drawn inside ONE easel `SettingsGroup`, the grey
|
|
144
|
+
* band with − / + on its right, open until it is closed. `leadFold` puts
|
|
145
|
+
* `lead` in a band of its own. A closed band's rows stay MOUNTED (the body
|
|
146
|
+
* is `hidden`), as a row on another tab does. Which bands are closed is the
|
|
147
|
+
* host's when it passes `closedFolds` + `onFold`, else the Inspector's own.
|
|
54
148
|
*/
|
|
55
|
-
declare function Inspector({ fields, values, onChange, readOnly, context, tab, onTab, tabs, tabIcons, renderers, idPrefix, ariaLabel, children, }: InspectorProps): react.JSX.Element;
|
|
149
|
+
declare function Inspector({ fields, values, onChange, readOnly, context, tab, onTab, tabs, tabIcons, renderers, idPrefix, ariaLabel, lead, children, leadFold, closedFolds, onFold, }: InspectorProps): react.JSX.Element;
|
|
56
150
|
|
|
57
151
|
interface InspectorFieldProps {
|
|
58
152
|
field: InspectorFieldDef;
|
|
@@ -92,48 +186,6 @@ declare const labelOf: (field: InspectorFieldDef, name: string) => string;
|
|
|
92
186
|
*/
|
|
93
187
|
declare function InspectorField(props: InspectorFieldProps): ReactNode;
|
|
94
188
|
|
|
95
|
-
/** One drawn row: a field, its name, and the tab it opens. */
|
|
96
|
-
interface PlannedRow {
|
|
97
|
-
name: string;
|
|
98
|
-
field: InspectorFieldDef;
|
|
99
|
-
bucket: SettingsBucket;
|
|
100
|
-
}
|
|
101
|
-
interface FieldPlan {
|
|
102
|
-
/**
|
|
103
|
-
* Every field that is not a marker and not hidden, in the order declared.
|
|
104
|
-
*
|
|
105
|
-
* ⚠️ A `slot` field is among them and draws NOTHING: it is here so its name
|
|
106
|
-
* has a bucket (`bucketsOf`), and `Inspector` leaves it mounted but empty.
|
|
107
|
-
* A host that draws rows of its own, or counts them ("3 settings"), filters
|
|
108
|
-
* `row.field.type !== 'slot'` first. `buckets` already leaves slots out.
|
|
109
|
-
*/
|
|
110
|
-
rows: PlannedRow[];
|
|
111
|
-
/** The tabs to offer: the buckets that hold a row, in the owner's order. */
|
|
112
|
-
buckets: SettingsBucket[];
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* WHICH TAB EACH FIELD OPENS — read off the fields themselves (blueprint 4.1:
|
|
116
|
-
* "the tab is declared by the field, never found by hashed class names").
|
|
117
|
-
*
|
|
118
|
-
* In declaration order, a field's own `bucket` starts that bucket, and every
|
|
119
|
-
* field after it without one stays in it; the panel starts in Content. That one
|
|
120
|
-
* rule covers both editors as they are written today: the email designer puts a
|
|
121
|
-
* mark in front of each tab's run (its `FIELD_BUCKETS` map), the website puts a
|
|
122
|
-
* heading there (its `group(...)` headers), and a mark is just a field with
|
|
123
|
-
* `marker: true` that draws nothing.
|
|
124
|
-
*
|
|
125
|
-
* A slot counts for no tab — it draws nothing in the panel — and a field with
|
|
126
|
-
* `visible: false` neither draws nor counts, so a tab whose fields are all
|
|
127
|
-
* hidden is not offered (the owner's rule: an empty tab is hidden, never drawn).
|
|
128
|
-
*/
|
|
129
|
-
declare function planFields(fields: InspectorFields): FieldPlan;
|
|
130
|
-
/**
|
|
131
|
-
* Every field's bucket, by name — what "copy style" asks (a look is what is not
|
|
132
|
-
* Content). The walk both editors did on their own (the website's
|
|
133
|
-
* `style-clipboard.ts`, the email designer's `FIELD_BUCKETS`) is this one.
|
|
134
|
-
*/
|
|
135
|
-
declare function bucketsOf(fields: InspectorFields): Map<string, SettingsBucket>;
|
|
136
|
-
|
|
137
189
|
/** What a block may declare about its fields. */
|
|
138
190
|
interface FieldsBlock {
|
|
139
191
|
fields?: object;
|
|
@@ -393,4 +445,4 @@ declare function optionFor<V>(options: readonly FieldOption<V>[], value: V | und
|
|
|
393
445
|
declare function FieldSelect<V>(props: FieldSelectManyProps<V>): ReactNode;
|
|
394
446
|
declare function FieldSelect<V>(props: FieldSelectOneProps<V>): ReactNode;
|
|
395
447
|
|
|
396
|
-
export { FieldNumber, FieldNumberProps, FieldOption, type FieldPlan, FieldRenderer, FieldSelect, FieldSelectManyProps, FieldSelectOneProps, FieldSlider, FieldSliderProps, FieldText, FieldTextProps, type FieldsBlock, Inspector, InspectorField, InspectorFieldDef, type InspectorFieldProps, InspectorFields, type InspectorProps, ListField, type ListFieldProps, type PlannedRow, type ResolvedFieldsInput, SettingsBucket, bucketsOf, copyItem, insertAt, labelOf, moveTo, optionFor, planFields, removeAt, useResolvedFields };
|
|
448
|
+
export { FieldNumber, FieldNumberProps, FieldOption, type FieldPlan, FieldRenderer, FieldSelect, FieldSelectManyProps, FieldSelectOneProps, FieldSlider, FieldSliderProps, FieldText, FieldTextProps, type FieldsBlock, Inspector, InspectorField, InspectorFieldDef, type InspectorFieldProps, InspectorFields, type InspectorProps, ListField, type ListFieldProps, type PlannedFold, type PlannedRow, type ResolvedFieldsInput, SettingsBucket, bucketsOf, copyItem, insertAt, labelOf, moveTo, optionFor, planFields, removeAt, useResolvedFields };
|
package/dist/fields/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-
|
|
1
|
+
export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-7EWFXVDJ.js";export{FieldSelect,FieldSlider,optionFor}from"../chunk-OZ72A6MY.js";import"../chunk-4JSBIW5H.js";import"../chunk-3ZJSLHHI.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";import"../chunk-EA2HTX37.js";export{FieldNumber}from"../chunk-66LWADFP.js";import"../chunk-QLD57GBB.js";import"../chunk-FFYXVAAL.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import"../chunk-MFIRYGHW.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|