efficient-easel 10.3.1 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -6
- package/dist/{canvas-typing-CJodefPO.d.ts → canvas-typing-DvoqQINU.d.ts} +43 -1
- package/dist/chunk-2PTAR4TA.js +56 -0
- package/dist/{chunk-BJNZKYK7.js → chunk-3KAQXJVI.js} +1 -1
- package/dist/{chunk-FCLW4LEN.js → chunk-47RGVCPH.js} +7 -7
- package/dist/{chunk-BGY4Q2SL.js → chunk-4MPCFKFG.js} +1 -1
- package/dist/{chunk-JSPZU7X2.js → chunk-7GYJG6CL.js} +1 -1
- package/dist/{chunk-P4CL4YQI.js → chunk-AFSSKGTD.js} +1 -1
- package/dist/{chunk-OGCROOTI.js → chunk-DGAXQTDW.js} +1 -1
- package/dist/chunk-FGJSCWUN.js +7 -0
- package/dist/chunk-GCCBEY2W.js +2 -0
- package/dist/chunk-GG4FGBFR.js +1 -0
- package/dist/chunk-HUI44HA5.js +5 -0
- package/dist/chunk-I55LUW3C.js +12 -0
- package/dist/{chunk-BRDCD4LK.js → chunk-IFS5P7CO.js} +1 -1
- package/dist/chunk-IOZKOGFR.js +1 -0
- package/dist/{chunk-545BRJIU.js → chunk-O66SKO3J.js} +1 -1
- package/dist/chunk-OHRS7Q3E.js +5 -0
- package/dist/{chunk-BPMLHWWM.js → chunk-PQMCHTVE.js} +1 -1
- package/dist/{chunk-535CJ7J4.js → chunk-UB5JFMRN.js} +1 -1
- package/dist/chunk-VWXUMVCD.js +1 -0
- package/dist/{chunk-26GHWMNN.js → chunk-XAF6J6TB.js} +12 -12
- package/dist/{chunk-QDAJKEG3.js → chunk-YJQYO6TA.js} +1 -1
- package/dist/{chunk-VYHA6EA6.js → chunk-YXIR3EI3.js} +4 -4
- package/dist/copy/index.d.ts +2 -2
- package/dist/copy/index.js +19 -25
- package/dist/drag/drag.css +11 -1
- package/dist/drag/index.d.ts +9 -3
- package/dist/drag/index.js +1 -1
- package/dist/easel/index.d.ts +8 -1
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddChildRow.js +4 -1
- package/dist/screen/components/AddSidePanel.d.ts +13 -17
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +3 -15
- 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/ScreenDocumentContext.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 +16 -16
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.js +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- 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.d.ts +6 -62
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/screen.css +2 -8
- package/dist/screen/words.d.ts +16 -23
- package/dist/screen/words.js +1 -1
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +19 -19
- package/package.json +1 -1
- package/dist/chunk-5545A3PC.js +0 -4
- package/dist/chunk-D6N77AOS.js +0 -1
- package/dist/chunk-EVY5SXFW.js +0 -5
- package/dist/chunk-G5MRFCCW.js +0 -5
- package/dist/chunk-JTUUIVBZ.js +0 -1
- package/dist/chunk-MMAC2VER.js +0 -57
- package/dist/chunk-O2NLQBFX.js +0 -1
- package/dist/chunk-PE6ZY5IW.js +0 -11
- package/dist/chunk-THZ46DC5.js +0 -2
- package/dist/chunk-TJ6NRHYF.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-
|
|
1
|
+
import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-DGAXQTDW.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-MQNBD6AB.js";import{ANCHOR_FIELD_KEYS as s,foldMetaOf as c,MEDIA_FIELD_MARKER as i,TEXT_FIELD_MARKER as p,LINK_FIELD_MARKER as u}from"./chunk-DUVRZ456.js";import{STYLE_KIND as a,fieldKind as f,copyStyle as l,heldStyle as m,planPaste as h,pasteMessage as y}from"./chunk-V7U33NF2.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(s),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[i,p,u];function D(t){return`site:${t??""}`}function v(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[a]??e[a];if("string"==typeof r)return r;const s=n.options??e.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(e)}function A(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function d(o,e){const s=t(o,e)??{},i=[];let p=!0,u=!1;for(const[t,o]of Object.entries(s))b.has(t)?(p=t===r.Design,u=!1):w.has(t)?p&&(u=j.has(t)):u&&o&&"object"==typeof o&&!t.startsWith("_")&&(c(o)||S.has(t)||g.has(t)||A(o)||"slot"!==o.type&&i.push({path:[t],kind:v(o),counted:"mobile"!==n(o)?.tier}));return i}function L(t,o,n,e,r){l({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function O(t,o,n,e,r,s){const c=m(n);if(!c)return null;const i=h(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:y(i,c.sourceLabel,r,s)}}function B(t,o,n,e){L(d,t,o,n,e)}function F(t,o,n,e,r){return O(d,t,o,n,e,r)}var I={scope:t=>D(t.siteId),rows:(t,o)=>d(t,o),copy:(t,o,n,e)=>B(e,t,o,n),plan:(t,o,n,e)=>F(e,t,o,n)};function N(t,o){if(!t&&!o)return I;const n=t?.rows,e=n?(t,o)=>n(t,o):d;return{scope:t?.scope??I.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>L(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>O(e,s,t,n,r,o))}}export{B as copyNodeStyle,d as nodeStyleRows,F as planNodePaste,v as shopFieldKind,D as siteStyleScope,N as styleClipboardOf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useHostEscape as t}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VWXUMVCD.js";import{styleMenuItems as l}from"./chunk-V7U33NF2.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-ILXP5VX5.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as z,LayersIcon as P,CopyIcon as O}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,t){const o=[],l=/* @__PURE__ */new Set;let r={zone:t.zone,index:t.index};for(;r;){const t=e.nodeAt(r.zone,r.index);if(!t||l.has(t.props.id))break;if(l.add(t.props.id),o.push({zone:r.zone,index:r.index,node:t,parentType:null}),r.zone===n)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var X=c(),K=/* @__PURE__ */new WeakMap;function j(e){if(e.claimsPage)return X;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=K.get(n);return t||(t=c(),K.set(n,t)),t}function M(){return j(e())}function S(e,t,o){if(t===n){const{floor:n,cap:t}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(o,n),t)}}const l=t.lastIndexOf(":");return{parentId:t.slice(0,l),slot:t.slice(l+1),index:o}}function T(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function V(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?S(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=S(e,l.zone,l.index+1);if(o(n,t))return t}return null}function E(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key||"Backspace"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function L(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=T(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:V(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(e,t){const{zone:o,index:r}=t,i=e.nodeAt(o,r);if(!i)return[];const c=i.props.id,a=e.labelOf(i.type,o),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,o),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),h=e.permits?.(i)??{duplicate:!0,delete:!0},y=T(e,i,o),k=D(e,t),b=d.held,v=b&&!p?V(e,b,t):null,g=!e.readOnly,w=e.style?l({held:g?e.style.held():null,canCopy:e.style.canCopy(i,o),onCopy:()=>e.style?.copy(i,o),onPaste:()=>e.style?.paste(o,r,i),words:e.words?.styleClipboard}):[];return s({title:a,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((t,o)=>{const l={label:e.rowNameOf(t.node,t.zone),checked:0===o,onClick:()=>e.selectAt(t.zone,t.index,t.node.props.id,t.parentType)},r=t.zone===n?null:e.slotRung?.(t.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&e.renamePropOf(i,o)?()=>e.beginRename(o,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:e.menuRows?.(i,o,r)??void 0,pinnedLine:p?R(e).pinned:void 0})}var R=e=>e.words?.screen??o.menu;function U(e){const t=R(e),l=!e.readOnly,r=[];l&&e.history.hasPast&&r.push({label:t.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),l&&e.history.hasFuture&&r.push({label:t.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=S(e,n,e.sectionBand().cap);if(l&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===n)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??o.pageSettings,icon:/* @__PURE__ */A(z,{}),onClick:e.openPageSettings},{label:t.collapseAll,icon:/* @__PURE__ */A(P,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function B(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=R(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function Y(e){return e.shiftKey}function N(e,n){const[o,l]=y(null),r=k(()=>l(null),[]);t(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=E(e);if(!o)return;const l=t.selected();if(!l)return;const r=L(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(n,"keydown",c);const a=k(n=>{if(Y(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(n,"contextmenu",t=>{if(Y(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(n,"mousedown",r),d(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */A(F,{host:e,target:o,onClose:r}):null,closeMenu:r}}function F({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?B(e,n.el):U(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),children:/* @__PURE__ */A(r,{items:o,onClose:t})})}export{X as EASEL_NODE_CLIPBOARD,D as ancestorChain,j as nodeClipboardOf,T as nodeClipboardRules,I as nodeMenuItems,E as nodeShortcut,U as pageMenuItems,V as pastePlace,L as runNodeShortcut,B as textMenuItems,M as useNodeClipboard,N as useNodeContextMenu};
|
|
@@ -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-OHRS7Q3E.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VWXUMVCD.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,5 @@
|
|
|
1
|
+
import{slotFieldsOf as n}from"./chunk-PLVEGYK6.js";import{usePickFollowsSelection as e}from"./chunk-R6WTQWAC.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-I55LUW3C.js";import{Inspector as i}from"./chunk-XAF6J6TB.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const i=e.slotsOf?.(r);return i||n(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
|
|
2
|
+
return s(t,{height:"fill"})}function S(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
+
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var P=o({});function B({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
+
return s(P.Provider,{value:n,children:e})}function D(){return u(P)}function G(){return(D().useOwnerName??v)()}function I(){return(D().useDocumentLabel??g)()}function N(n,e,t,r){return(D().useBridges??h)(n,e,t,r)}function T(n){return(D().useStandaloneBridges??h)(n)}function x(n,e){(D().useDocumentPass??y)(n,e)}function A(){return D().blockRules??b}function F(){return D().blockLook??L}function R(){return D().devices??O}function W(){return D().leftView??j}function K(){return D().pinned??w}function V(){return D().saveSwitch??!0}function E(n){e(!0===D().pickFollowsSelection,n)}function H(){return D().storageNamespace||void 0}function J(){return D().styleClipboard??null}function Q(){return D().nodeKeys??!0}function U(){return D().notify??null}function X(){return D().Canvas??C}function Y(){return D().CanvasHead??null}function Z(){return D().canvasDrag??null}var q=o(null);function z({target:n,children:e}){/* @__PURE__ */
|
|
5
|
+
return s(q.Provider,{value:n,children:e})}function M(){return u(q)}function $(){return D().Inspector??S}export{c as SELECTION_MODE,z as ScreenCanvasTargetProvider,B as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,A as useScreenBlockRules,N as useScreenBridges,Z as useScreenCanvasDrag,X as useScreenCanvasFrame,Y as useScreenCanvasHead,M as useScreenCanvasTarget,R as useScreenDevices,I as useScreenDocumentLabel,x as useScreenDocumentPass,$ as useScreenInspectorPanel,W as useScreenLeftView,Q as useScreenNodeKeys,U as useScreenNotify,G as useScreenOwnerName,D as useScreenParts,E as useScreenPickFollowsSelection,K as useScreenPinned,V as useScreenSaveSwitch,H as useScreenStorageNamespace,J as useScreenStyleClipboard,T as useStandaloneScreenBridges};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useScreenBlockRules as e}from"./chunk-
|
|
1
|
+
import{useScreenBlockRules as e}from"./chunk-OHRS7Q3E.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-I55LUW3C.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScreenPartsProvider as t}from"./chunk-
|
|
1
|
+
import{ScreenPartsProvider as t}from"./chunk-OHRS7Q3E.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-I55LUW3C.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
|
|
2
2
|
return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"};var a={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const o=Math.floor(a/60);if(o<60)return`Saved ${o} minute${1===o?"":"s"} ago`;const n=Math.floor(o/60);return`Saved ${n} hour${1===n?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},o={loading:"Loading…",waitingForAuthorization:"Waiting for editor authorization…",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,canvasAddBlock:"Add block",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving…"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:a,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",editFooter:"Edit the site footer",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:o})=>`Moved “${e}” to position ${a} of ${o}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,a as DEFAULT_SCREEN_SAVE_STATUS_WORDS,o as DEFAULT_SCREEN_WORDS};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import{TreeSeam as e}from"./chunk-4JSBIW5H.js";import{
|
|
1
|
+
import{TreeSeam as e}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-K56YDHYQ.js";import{SETTINGS_BUCKETS as l,SettingsGroup as t}from"./chunk-RC25EGHD.js";import{DEFAULT_PANEL_WORDS as a}from"./chunk-KFV7N2DJ.js";import{EaselMenuItems as r}from"./chunk-EA2HTX37.js";import{FieldNumber as o}from"./chunk-66LWADFP.js";import{FieldSelect as i}from"./chunk-65Z5FSAW.js";import{DEFAULT_FIELDS_WORDS as s}from"./chunk-FFYXVAAL.js";import{SettingsField as c,SettingsSegmented as d}from"./chunk-XJCMEEBH.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{useTreeDrag as m,gapToMoveIndex as p}from"./chunk-67GNT6PF.js";import{withTip as h}from"./chunk-P2VEMZH5.js";import{Textarea as f,Input as b,SortableList as g,ListRow as v,ContextMenu as y,tabPanelId as k,Tabs as x,tabButtonId as w}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as N,useState as C,useLayoutEffect as O,useId as $}from"react";import{jsx as j,jsxs as S}from"react/jsx-runtime";import{ChevronIcon as D,LockIcon as I,MoveUpIcon as F,MoveDownIcon as L,DuplicateIcon as P,TrashIcon as A}from"efficient-shell/icons/efficient";function E({id:e,value:n,onChange:l,placeholder:t,multiline:a=!1,rows:r=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */j(f,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:t,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>l(e.target.value)}):/* @__PURE__ */j(b,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:t,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>l(e.target.value)})}function M(e,n,l){const t=e.slice();return t.splice(Math.max(0,Math.min(n,t.length)),0,l),t}function T(e,n,l){const t=e.slice(),[a]=t.splice(n,1);return t.splice(Math.max(0,Math.min(l,t.length)),0,a),t}function H(e,n){return e.filter((e,l)=>l!==n)}function R(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var z='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',B={parentId:"list",slot:"items"};function J({label:l,icon:t,noun:a,items:o,onChange:i,newItem:c,summary:d,itemName:f,thumb:b,min:k=0,max:x,readOnly:w=!1,open:$,onOpen:E,renderItem:J,renderRow:K,canRemove:Y,lockedReason:V,fixed:W=!1,removeOnRow:X=!0,canDuplicate:G,above:Z,head:q=!0}){const Q=u("fields",s).list,U=u("tree",n),_=a??Q.item,ee=!w&&!W&&("number"!=typeof x||o.length<x),ne=o.length<=k,le=e=>!!Y&&!Y(o[e],e),te=e=>!w&&!W&&X&&!ne&&!le(e),ae=e=>ee&&(!G||G(o[e],e)),re=(e,n)=>f?f(e,n):Q.itemName({noun:_,n:n+1}),oe=N([]),ie=N(null),[se,ce]=C(null),de=N(null),[ue,me]=C(null),[pe,he]=C("");O(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(z)[e.nth]??oe.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const fe=(e,n)=>{if(n<0||n>=o.length||n===e)return;const l=oe.current[e],t=l?.ownerDocument.activeElement;if(l&&t&&l.contains(t)){const e=[...l.querySelectorAll(z)].indexOf(t),a=t;ie.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}i(T(o,e,n));const a=function(e,n,l){return null===e?null:e===n?l:n<e&&l>=e?e-1:n>e&&l<=e?e+1:e}($,e,n);a!==$&&E(a),he(Q.moved({n:n+1,total:o.length}))},be=e=>{ee&&(i(M(o,e,c())),K?(ie.current={index:e,nth:0,start:null,end:null},null!==$&&$>=e&&E($+1)):E(e))},ge=e=>{te(e)&&(i(H(o,e)),$===e?E(null):null!==$&&$>e&&E($-1))},ve=m({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===B.parentId&&n.slot===B.slot,onDrop:(e,n)=>{const l=p({...B,index:e},n);l!==e&&fe(e,l)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<o.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Q.moveUp,icon:/* @__PURE__ */j(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<o.length-1&&n.push({label:Q.moveDown,icon:/* @__PURE__ */j(L,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),ae(e)&&n.push({label:Q.duplicate,icon:/* @__PURE__ */j(P,{size:14}),onClick:()=>(e=>{ae(e)&&(i(M(o,e+1,R(o[e]))),null!==$&&$>e&&E($+1))})(e)}),te(e)&&n.push({label:Q.delete,icon:/* @__PURE__ */j(A,{size:14}),danger:!0,onClick:()=>ge(e)}),n},ke=(e,n,l,t)=>{w||0===ye(e).length||me({index:e,x:n,y:l,owner:t})},xe=e=>n=>{const l=o.slice();l[e]=n,i(l)};/* @__PURE__ */
|
|
2
2
|
return S("div",{className:"es-list",children:[q?/* @__PURE__ */S("div",{className:"es-list-head",children:[
|
|
3
|
-
/* @__PURE__ */S("span",{className:"es-list-label",children:[
|
|
4
|
-
/* @__PURE__ */j("span",{className:"es-list-count",children:o.length})]}):null,Z?/* @__PURE__ */j("div",{className:"es-list-above",children:Z}):null,o.length?/* @__PURE__ */S(g,{"aria-label":
|
|
3
|
+
/* @__PURE__ */S("span",{className:"es-list-label",children:[t?/* @__PURE__ */j("span",{className:"es-field-icon","aria-hidden":"true",children:t}):null,l]}),
|
|
4
|
+
/* @__PURE__ */j("span",{className:"es-list-count",children:o.length})]}):null,Z?/* @__PURE__ */j("div",{className:"es-list-above",children:Z}):null,o.length?/* @__PURE__ */S(g,{"aria-label":l,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[o.map((n,l)=>{const t=ve.row({item:l,place:{...B,index:l}}),a=t.draggable&&se!==l,r=!K&&$===l,o=!w&&!W&&X&&le(l),i=["es-list-row",K?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[l>0?/* @__PURE__ */j(e,{...ve.seam({place:{...B,index:l}}),onAdd:ee?()=>be(l):void 0,label:Q.addHere({noun:_})},`seam-${l}`):null,
|
|
5
5
|
/* @__PURE__ */j(v,{className:i,flat:!!K,active:r,draggable:t.draggable,dragHint:U.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>fe(l,"up"===e?l-1:l+1):void 0,rowRef:e=>{oe.current[l]=e},rowProps:{...t.rowProps,draggable:a||void 0,onPointerDown:e=>{const n=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!n&&n===n.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!a,de.current=n&&!a?n:null,ce(a?l:null)},onDragStart:e=>{const n=de.current;de.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),ke(l,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const n=e.currentTarget.ownerDocument,t=e=>e.preventDefault();n.addEventListener("contextmenu",t,{capture:!0,once:!0}),n.defaultView?.setTimeout(()=>n.removeEventListener("contextmenu",t,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ke(l,a.left+24,a.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:w||W||!X?void 0:o?h(V?V(n,l):Q.locked,/* @__PURE__ */j("span",{className:"es-list-lock",role:"img","aria-label":V?V(n,l):Q.locked,children:/* @__PURE__ */j(I,{size:13})})):h(Q.deleteItem({noun:_}),/* @__PURE__ */j("button",{type:"button",className:"es-list-x","aria-label":Q.deleteItem({noun:_}),disabled:!te(l),onClick:()=>ge(l),children:"×"})),below:r?/* @__PURE__ */j("div",{className:"es-list-item",children:J(n,l,xe(l))}):void 0,children:K?/* @__PURE__ */j("div",{className:"es-list-row-main",children:K(n,l,xe(l))}):/* @__PURE__ */S("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>E(r?null:l),children:[b?/* @__PURE__ */j("span",{className:"es-list-thumb","aria-hidden":"true",children:b(n,l)}):null,
|
|
6
|
-
/* @__PURE__ */j("span",{className:"es-list-row-name",children:re(n,l)}),/* @__PURE__ */j("span",
|
|
6
|
+
/* @__PURE__ */j("span",{className:"es-list-row-name",children:re(n,l)}),/* @__PURE__ */j("span",d?{className:"es-list-row-summary",children:d(n,l)}:{className:"es-list-row-summary"}),
|
|
7
7
|
/* @__PURE__ */j(D,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},l)]}),
|
|
8
8
|
/* @__PURE__ */j(e,{...ve.seam({place:{...B,index:o.length}})})]}):null,w||W?null:/* @__PURE__ */j("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(o.length),children:Q.add({noun:_})}),
|
|
9
9
|
/* @__PURE__ */j("span",{className:"es-list-said","aria-live":"polite",children:pe}),ue&&ue.index<o.length?
|
|
10
|
-
/* @__PURE__ */j(y,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),children:/* @__PURE__ */j(r,{items:ye(ue.index),onClose:()=>me(null)})}):null]})}var K=e=>e<6?e+1:6,Y=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function V({field:e,name:n,id:
|
|
11
|
-
return j(
|
|
12
|
-
return j(J,{label:Y(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:f,onChange:a,newItem:()=>R({...e.defaultItemProps??{}}),summary:b?(e,n)=>b(e,n):void 0,min:e.min,max:e.max,readOnly:r,open:p,onOpen:h,renderItem:(t,a,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */j(X,{field:c,name:`${n}[${a}].${e}`,id:`${l}-${a}-${e}`,value:t?.[e],onChange:n=>s({...t,[e]:n}),readOnly:r,context:o,renderers:i,headingLevel:d},e))})}function X(e){const{field:n,name:l,id:t,value:a,onChange:r,readOnly:
|
|
13
|
-
return j(
|
|
14
|
-
return j(
|
|
15
|
-
return j(
|
|
16
|
-
return j(
|
|
10
|
+
/* @__PURE__ */j(y,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),children:/* @__PURE__ */j(r,{items:ye(ue.index),onClose:()=>me(null)})}):null]})}var K=e=>e<6?e+1:6,Y=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function V({field:e,name:n,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:s,headingLevel:c=3}){const[d,u]=C(!0),m=a&&"object"==typeof a?a:{};/* @__PURE__ */
|
|
11
|
+
return j(t,{id:`${l}-group`,title:Y(e,n),open:d,onToggle:u,level:c,children:Object.entries(e.objectFields).map(([e,t])=>/* @__PURE__ */j(X,{field:t,name:`${n}.${e}`,id:`${l}-${e}`,value:m[e],onChange:n=>r({...m,[e]:n}),readOnly:o,context:i,renderers:s,headingLevel:K(c)},e))})}function W({field:e,name:n,id:l,value:t,onChange:a,readOnly:r,context:o,renderers:i,openItem:s,onOpenItem:c,headingLevel:d}){const[u,m]=C(null),p=c?s??null:u,h=c??m,f=Array.isArray(t)?t:[],b=e.getItemSummary;/* @__PURE__ */
|
|
12
|
+
return j(J,{label:Y(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:f,onChange:a,newItem:()=>R({...e.defaultItemProps??{}}),summary:b?(e,n)=>b(e,n):void 0,min:e.min,max:e.max,readOnly:r,open:p,onOpen:h,renderItem:(t,a,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */j(X,{field:c,name:`${n}[${a}].${e}`,id:`${l}-${a}-${e}`,value:t?.[e],onChange:n=>s({...t,[e]:n}),readOnly:r,context:o,renderers:i,headingLevel:d},e))})}function X(e){const{field:n,name:l,id:t,value:a,onChange:r,readOnly:s,context:u,renderers:m}=e;if(!n||n.marker||!1===n.visible)return null;const p=m?.[n.type];if(p)return p({field:n,name:l,id:t,value:a,onChange:r,readOnly:s});switch(n.type){case"custom":{const e={...u,field:n,name:l,id:t,value:a,onChange:r,readOnly:s};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
+
return j(c,{label:Y(n,l),htmlFor:t,icon:n.icon,hint:n.hint,children:/* @__PURE__ */j(E,{id:t,value:"string"==typeof a?a:null==a?"":String(a),onChange:r,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:s})});case"number":/* @__PURE__ */
|
|
14
|
+
return j(c,{label:Y(n,l),htmlFor:t,icon:n.icon,hint:n.hint,children:/* @__PURE__ */j(o,{id:t,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:s})});case"select":{const e=`${t}-label`;/* @__PURE__ */
|
|
15
|
+
return j(c,{label:Y(n,l),labelId:e,htmlFor:t,icon:n.icon,hint:n.hint,children:/* @__PURE__ */j(i,{id:t,value:a,options:n.options,onChange:r,readOnly:s,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
|
|
16
|
+
return j(c,{label:Y(n,l),icon:n.icon,hint:n.hint,children:/* @__PURE__ */j(d,{ariaLabel:Y(n,l),value:a,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||s})),onChange:e=>{s||r(e)}})});case"object":/* @__PURE__ */
|
|
17
17
|
return j(V,{...e,field:n});case"array":/* @__PURE__ */
|
|
18
|
-
return j(W,{...e,field:n});case"slot":return null}}var G=e=>
|
|
18
|
+
return j(W,{...e,field:n});case"slot":return null}}var G=e=>l.includes(e);function Z(e){let n,t=l[0];const a=[],r=/* @__PURE__ */new Set;for(const[l,o]of Object.entries(e))o&&(G(o.bucket)&&((o.marker||o.bucket!==t)&&(n=void 0),t=o.bucket),o.marker&&"string"==typeof o.fold?n={key:l,title:o.fold}:o.marker&&!1===o.fold&&(n=void 0),o.marker||!1===o.visible||(a.push(n?{name:l,field:o,bucket:t,fold:n}:{name:l,field:o,bucket:t}),"slot"!==o.type&&r.add(t)));return{rows:a,buckets:l.filter(e=>r.has(e))}}function q(e){return new Map(Z(e).rows.map(e=>[e.name,e.bucket]))}function Q(e){const n=[];for(const l of e){const e=n[n.length-1];e&&e.fold?.key===l.fold?.key?e.rows.push(l):n.push({fold:l.fold,rows:[l]})}return n}function U({fields:e,values:n,onChange:l,readOnly:r=!1,context:o,tab:i,onTab:s,tabs:c=!0,tabIcons:d,renderers:m,idPrefix:p,ariaLabel:h,lead:f,children:b,leadFold:g,closedFolds:v,onFold:y,headingLevel:N=3}){const O=u("panel",a),D=$(),I=p??`es-insp${D.replace(/:/g,"")}`,F=Z(e),[L,P]=C(void 0),A=i??L,E=A&&F.buckets.includes(A)?A:F.buckets[0],[M,T]=C(null),H=M&&M.panel===I&&F.rows.some(e=>e.name===M.name)?M:null,R=c&&F.buckets.length>1,z=R&&E?k(I,E):`${I}-rows`,[B,J]=C(()=>/* @__PURE__ */new Set),Y=v??B,V=(e,n)=>{/* @__PURE__ */return j(t,{title:e.title,open:!Y.has(e.key),onToggle:n=>((e,n)=>{void 0===v&&J(l=>{const t=new Set(l);return n?t.delete(e):t.add(e),t}),y?.(e,n)})(e.key,n),id:`${I}-fold-${l=e.key,[...l].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:N,children:n});var l},W=e=>R&&e!==E,G=({name:e,field:t,bucket:a,fold:i})=>/* @__PURE__ */j("div",{className:"es-insp-row","data-field":e,"data-bucket":a,hidden:!!W(a)||void 0,children:/* @__PURE__ */j(X,{field:t,name:e,id:`${I}-${e}`,value:n[e],onChange:n=>l(e,n),readOnly:r,context:o,renderers:m,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>T(null===n?null:{panel:I,name:e,index:n}),headingLevel:i?K(N):N})},e);/* @__PURE__ */
|
|
19
19
|
return S("div",{className:"es-insp",children:[R?/* @__PURE__ */j("div",{className:"es-insp-tabs",children:/* @__PURE__ */j(x,{variant:"underline",block:!0,"aria-label":h??O.settings,idPrefix:I,value:E,onChange:e=>{const n=e;void 0===i&&P(n),s?.(n)},items:F.buckets.map(e=>{const n=O.buckets[e],l=d?.[e];return l?{id:e,icon:l,label:/* @__PURE__ */j("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
|
|
20
20
|
/* @__PURE__ */S("div",{className:"es-insp-rows",id:z,role:R?"tabpanel":void 0,"aria-labelledby":R&&E?w(I,E):void 0,children:[f?g?/* @__PURE__ */j("div",{className:"es-insp-band","data-fold":g.key,children:V(g,f)}):f:null,Q(F.rows).map((e,n)=>{if(!e.fold)return e.rows.map(G);const l=e.rows[0].bucket,t=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
|
|
21
21
|
return j("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":l,hidden:!(!W(l)&&!t)||void 0,children:V(e.fold,e.rows.map(G))},`fold-${e.fold.key}-${n}`)}),b]})]})}export{E as FieldText,U as Inspector,X as InspectorField,J as ListField,q as bucketsOf,R as copyItem,M as insertAt,Y as labelOf,T as moveTo,Z as planFields,H as removeAt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-
|
|
1
|
+
import{useSectionOps as o}from"./chunk-PQMCHTVE.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-OHRS7Q3E.js";import{useEasel as p}from"./chunk-I55LUW3C.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=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}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);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=a(o);e&&u.select(e)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as n}from"./chunk-UB5JFMRN.js";import{ScreenChrome as e}from"./chunk-2PTAR4TA.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-GCCBEY2W.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VWXUMVCD.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var C=r(n),k=r(e);function N({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const C=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
2
|
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
3
|
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
4
|
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
|
-
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},children:i.save})]}),children:i.body})}function
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var
|
|
7
|
-
/* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:
|
|
5
|
+
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},children:i.save})]}),children:i.body})}function j({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function A({config:r,parts:n,wrap:e=y}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:j}=a(),A=t(()=>s(!g),[g]),M=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:M.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:A,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(N,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:M.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:M.waitingForAuthorization})}export{A as DocumentScreen,j as ScreenMount};
|
package/dist/copy/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { c as CopyBoxProps, d as CopyCell, T as TextBoxHandle } from '../canvas-typing-DvoqQINU.js';
|
|
3
|
+
export { e as COPY_CELLS, b as CanvasTypingEnd, f as CanvasTypingOptions, g as CanvasTypingSession, h as ColorWindow, i as CopyBoxAlign, j as CopyBoxFooter, C as CopyBoxLastTool, k as CopyCase, l as CopyCellPreset, m as CopyCells, a as CopyThemeColor, M as MarkBar, n as MarkBarProps, o as MarkWriter, S as SelectionSource, p as TextAreaHandle, q as TextMap, r as ToolbarMark, s as ariaShortcut, t as colorRunOf, u as insertSelection, v as markSelection, w as startCanvasTyping, x as textMap } from '../canvas-typing-DvoqQINU.js';
|
|
4
4
|
export { TextToolbar, TextToolbarProps } from 'efficient-shell/ui';
|
|
5
5
|
import { F as FieldOption } from '../types-Dkx1VAIQ.js';
|
|
6
6
|
import { a as CopyAlign } from '../words-dsex49Jh.js';
|
package/dist/copy/index.js
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import{
|
|
2
|
-
return
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
return
|
|
5
|
-
return
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
/* @__PURE__ */
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */Ce(oe,{size:16}),ue.clearStyle??e.clearStyle]})):null]}):null]})}var lt=["none","bullet","number"],ot=["none","upper","capitalize","lower"],at={none:/* @__PURE__ */Ce(be,{}),bullet:/* @__PURE__ */Ce(ve,{}),number:/* @__PURE__ */Ce(ye,{})},st={none:/* @__PURE__ */Ce(xe,{}),upper:/* @__PURE__ */Ce(Se,{}),capitalize:/* @__PURE__ */Ce(ke,{}),lower:/* @__PURE__ */Ce(we,{})};function it({label:e,icon:t,answers:n,names:r,glyphs:l,row:o,readOnly:a}){const s=o.value||o.styleValue||"";/* @__PURE__ */
|
|
21
|
-
return Ce(m,{label:e,icon:t,children:/* @__PURE__ */Ce(h,{ariaLabel:e,value:s,disabled:a,onChange:e=>{a||o.onChange(function(e,t){return t===e.value||""===e.value&&t===e.styleValue?"":t}(o,e))},options:n.map(e=>({id:e,label:l[e],title:r[e]}))})})}function ct({kept:t,keptHint:n,readOnly:r=!1,style:l,font:o,italic:a,cells:s,align:i,list:c,letterCase:u}){const d=B("copy",e),h={...e.panel,...d.panel},f=d.clearStyle??e.clearStyle,g=l&&!r?[l.onClearChanges&&{label:f,onSelect:l.onClearChanges},l.onEditStyles&&{label:h.editStyles,onSelect:l.onEditStyles},l.onUpdateStyle&&{label:h.updateStyle,onSelect:l.onUpdateStyle}].filter(e=>!!e):[],y=!!a&&(a.value??a.styleValue??!1),v=a?/* @__PURE__ */Ce(H,{content:h.italic,children:/* @__PURE__ */Ce(V,{size:"sm",variant:"ghost","aria-label":h.italic,"aria-pressed":y,disabled:r,onClick:()=>{if(r)return;const e=!y;a.onChange(e===(a.styleValue??!1)?void 0:e)},children:/* @__PURE__ */Ce(de,{})})}):null;/* @__PURE__ */
|
|
22
|
-
return Ee("div",{className:"es-tpp",children:[t?/* @__PURE__ */Ee("div",{className:"es-tpp-kept",children:[
|
|
23
|
-
/* @__PURE__ */Ce(rt,{...t,readOnly:r||t.readOnly}),n?/* @__PURE__ */Ce("p",{className:"es-field-hint",children:n}):null]}):null,l?/* @__PURE__ */Ce(m,{label:h.style,icon:/* @__PURE__ */Ce(ae,{}),children:/* @__PURE__ */Ce(p,{ariaLabel:h.style,value:l.value,options:l.options,onChange:l.onChange,changed:l.changed,footer:g,readOnly:r})}):null,o?/* @__PURE__ */Ce(m,{label:h.font,icon:/* @__PURE__ */Ce(se,{}),children:/* @__PURE__ */Ee("div",{className:"es-tpp-font",children:[
|
|
24
|
-
/* @__PURE__ */Ce("div",{className:"es-tpp-font-select",children:/* @__PURE__ */Ce(p,{ariaLabel:h.font,value:o.value||void 0,placeholder:o.styleValue,options:o.options,onChange:o.onChange,searchable:o.searchable,readOnly:r})}),v]})}):v?
|
|
25
|
-
/* @__PURE__ */Ce(m,{label:h.italic,icon:/* @__PURE__ */Ce(se,{}),children:/* @__PURE__ */Ce("div",{className:"es-tpp-font",children:v})}):null,s?.length?/* @__PURE__ */Ce(Ae,{cells:s,words:d.cells,readOnly:r}):null,i?/* @__PURE__ */Ce(it,{label:d.alignment,icon:/* @__PURE__ */Ce(ie,{}),answers:Ne.filter(e=>!i.allow||i.allow.includes(e)),names:d.align,glyphs:Te,row:i,readOnly:r}):null,c?/* @__PURE__ */Ce(it,{label:h.list,icon:/* @__PURE__ */Ce(ce,{}),answers:lt,names:h.lists,glyphs:at,row:c,readOnly:r}):null,u?/* @__PURE__ */Ce(it,{label:h.capitalization,icon:/* @__PURE__ */Ce(ue,{}),answers:ot,names:h.cases,glyphs:st,row:u,readOnly:r}):null]})}export{Ne as COPY_ALIGNS,Me as COPY_ALIGN_FIT,Te as COPY_ALIGN_GLYPHS,Le as COPY_ALIGN_LABELS,Ve as COPY_CELLS,Ie as ColorWindow,rt as CopyBox,Ae as CopyCells,et as MarkBar,je as RichBox,ct as TextPartPanel,Ge as ariaShortcut,Oe as copyAlignOptions,Fe as insertSelection,Be as markSelection,tt as useCaretEdit};
|
|
1
|
+
import{selectionToVisible as e,selectionToSource as t,richLayout as n,createHistory as r,colorRunOf as l,textRange as a,selectionBox as o,placeWindow as s,offsetOrigin as i,visibleArea as c,ColorWindow as u,markPress as d,pasteToMarkup as p,richInput as h,editVisible as f,MARKUP_CLIPBOARD_TYPE as m,markupOfRange as g}from"../chunk-FGJSCWUN.js";export{ColorWindow,MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,colorRunOf,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-FGJSCWUN.js";import{DEFAULT_COPY_WORDS as y}from"../chunk-Q6AM43CA.js";import{FieldNumber as v}from"../chunk-66LWADFP.js";import{FieldSelect as b}from"../chunk-65Z5FSAW.js";import"../chunk-FFYXVAAL.js";import{SettingsSegmented as k,SettingsSwitch as S,SettingsField as x}from"../chunk-XJCMEEBH.js";import{GoldTextInput as w}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as E,applyMark as C,markupTools as D,marksIn as N,STANDARD_MARKUP as L,findLink as O,markedAt as T,listIn as z,colorIn as F,spanFor as P,clearStyle as M,toggleMark as R,colorOver as B,setList as K,unlinkAt as j,removeLink as $,linkOver as H,writeLink as V}from"../chunk-546BBOPE.js";import{useWords as A}from"../chunk-MFIRYGHW.js";import{withTip as W}from"../chunk-P2VEMZH5.js";import{IconButton as U,registerModalEscapeInterceptor as I,textToolbarRows as q,TextToolbar as Y,Button as G,LinkPicker as J,Tooltip as Z}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as _,useState as X,useLayoutEffect as Q,useEffect as ee,useId as te}from"react";import{AlignJustifyIcon as ne,AlignRightIcon as re,AlignCenterIcon as le,AlignLeftIcon as ae,ParagraphSpacingIcon as oe,LetterSpacingIcon as se,LineSpacingIcon as ie,TextSizeIcon as ce,ClearMarksIcon as ue,StylesIcon as de,TypeIcon as pe,AlignmentIcon as he,ListFormatIcon as fe,CaseIcon as me,ItalicIcon as ge,LinkIcon as ye,QuietIcon as ve,EmphasisIcon as be,StrikeIcon as ke,BoldIcon as Se,NumberedListIcon as xe,ListIcon as we,ListNoneIcon as Ee,CaseLowerIcon as Ce,CaseCapitalizedIcon as De,CaseUpperIcon as Ne,CaseNormalIcon as Le}from"efficient-shell/icons/efficient";import{jsx as Oe,jsxs as Te,Fragment as ze}from"react/jsx-runtime";var Fe=["left","center","right","justify"],Pe=y.align,Me={left:/* @__PURE__ */Oe(ae,{}),center:/* @__PURE__ */Oe(le,{}),right:/* @__PURE__ */Oe(re,{}),justify:/* @__PURE__ */Oe(ne,{})},Re={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function Be(e,t=Pe){return Fe.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:Me[e],title:t[e]}))}var Ke=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function je(e){if(e.every(e=>e.label===Pe[e.id]))return e.length>3?Re.four:Re.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(Ke.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function $e(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function He(e,t,n,r=C){const{start:l,end:a}=$e(e,n);return r(e,l,a,t)}function Ve(e,t,n){const{start:r,end:l}=$e(e,n),a=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:a,selectionEnd:a}}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 We(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 a=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===a)return 0;const o=t.ownerDocument.createRange();o.setStart(e.lines[a],0);try{o.setEnd(n,r)}catch{return l[a].vis}return l[a].vis+Math.min(o.toString().length,l[a].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 a=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let o=a.nextNode(),s=null;for(;o;){if(l<=o.data.length)return[o,l];l-=o.data.length,s=o,o=a.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function Ie({value:r,rules:l,multiline:a,readOnly:o=!1,placeholder:s,ariaLabel:i,handle:c,onEdit:u,onSelect:d,onHistory:y,onFormat:v,pending:b,onCommit:k,onCancel:S}){const x=_(null),w=_(null),E=_(null),C=_(null),D=_(null),N=_(r),[L,O]=X(0),T=_({value:r,rules:l,multiline:a,readOnly:o,pending:b,onEdit:u,onHistory:y,onFormat:v});T.current={value:r,rules:l,multiline:a,readOnly:o,pending:b,onEdit:u,onHistory:y,onFormat:v};const z=()=>{const e=x.current,t=w.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=We(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?We(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},F=(e,t)=>{const n=x.current,r=w.current;if(!n||!r)return;const[l,a]=Ue(r,e),[o,s]=Ue(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,a,o,s)};c.current={getSource(){const e=z(),n=w.current;if(!e||!n)return null;const[r,l]=t(n.layout,e[0],e[1]);return{start:r,end:l}},setSource(e,t,n){C.current={text:n,src:[e,t]},O(e=>e+1)},focus(){x.current?.focus()},rangeOf(t,n){const r=x.current,l=w.current;if(!r||!l)return null;const[a,o]=e(l.layout,t,n),[s,i]=Ue(l,a),[c,u]=Ue(l,o),d=r.ownerDocument.createRange();return d.setStart(s,i),d.setEnd(c,u),d}},Q(()=>{const t=x.current;if(!t||D.current)return;const a=C.current?null:z();w.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=[],a=()=>l.length?l[l.length-1].el:r;let o=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)&&(o=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);a().appendChild(t),l.push({id:e.marks[r].id,el:t})}o||(o=n.createTextNode(""),a().appendChild(o)),o.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(t,n(r,l)),E.current=r;const o=C.current;if(!o||o.text!==r)return void(a&&t.ownerDocument.activeElement===t&&F(a[0],Math.min(a[1],w.current.layout.text.length)));C.current=null;const s=w.current.layout,[i,c]=o.vis??e(s,o.src[0],o.src[1]);t.ownerDocument.activeElement!==t&&t.focus(),F(i,c)},[r,l,L]);const P=(e,n,r)=>{const l=w.current,[a,o]=t(l.layout,n[0],n[1]);C.current={text:e.text,vis:[e.caret,e.caret]},e.text!==T.current.value?T.current.onEdit(e.text,{start:a,end:o},r):O(e=>e+1)};ee(()=>{const e=x.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:a,pending:o}=T.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),a)return;const s=w.current,i=z();if(!s||!i)return;const c="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,u=c&&!c.collapsed?[We(s,e,c.startContainer,c.startOffset),We(s,e,c.endContainer,c.endOffset)]:null,d=h({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:i,target:u,pending:o});d&&("history"!==d.kind?"format"!==d.kind?P(d.edit,d.range,d.kind):T.current.onFormat(d.style):T.current.onHistory(d.dir))},n=()=>{D.current||O(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),ee(()=>{const e=x.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=c.current?.getSource();e&&d(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const M=(e,t=!1)=>{const n=z();if(!n||n[0]===n[1])return;e.preventDefault();const a=w.current;e.clipboardData.setData("text/plain",a.layout.text.slice(n[0],n[1])),e.clipboardData.setData(m,g(r,l,n[0],n[1])),t&&!o&&P(f(r,l,n[0],n[1],{text:""}),n,"edit")};/* @__PURE__ */
|
|
2
|
+
return Te("div",{className:"es-rich-wrap",children:[s&&""===r?/* @__PURE__ */Oe("div",{className:"es-rich-placeholder","aria-hidden":"true",children:s}):null,
|
|
3
|
+
/* @__PURE__ */Oe("div",{ref:x,className:`es-rich${a?" is-multiline":" is-single"}${o?" is-off":""}`,contentEditable:!o,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":a,"aria-label":i,"aria-readonly":o||void 0,"aria-placeholder":s,tabIndex:o?-1:0,spellCheck:!0,onFocus:()=>{N.current=r},onBlur:()=>{r!==N.current&&k?.(r),N.current=r},onKeyDown:e=>{if("Escape"===e.key)return e.preventDefault(),S?.(N.current),void(N.current=r);"Enter"!==e.key||a||(e.preventDefault(),r!==N.current&&k?.(r),N.current=r)},onCompositionStart:()=>{const e=z()??[0,0];D.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=D.current;if(D.current=null,!t)return;const{value:n,rules:r,pending:l}=T.current;e.data?P(f(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):O(e=>e+1)},onCopy:e=>M(e),onCut:e=>M(e,!0),onPaste:e=>{if(e.preventDefault(),o)return;const t=z();if(!t)return;const n=e.clipboardData.getData(m),s=n?a?n:n.replace(/\s*\r?\n\s*/g," "):p({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:e.currentTarget.ownerDocument,multiline:a,rules:l});P(f(r,l,t[0],t[1],{markup:s}),t,"edit")}})]})}var qe={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */Oe(ce,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */Oe(ie,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */Oe(se,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */Oe(oe,{}),unit:"px",step:1,shiftStep:10,min:0}};function Ye(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Ge({cells:e,words:t,readOnly:n=!1}){const r=t??y.cells,l=te();/* @__PURE__ */
|
|
4
|
+
return Oe("div",{className:"es-copy-cells-fit",children:/* @__PURE__ */Oe("div",{className:"es-copy-cells",children:e.map(e=>{const t=e.scale??1,a=e.name??(e.nameKey?r[e.nameKey]:e.key),o=e.unit??"",s=e.step??1,i=`${l}-${e.key}`;/* @__PURE__ */
|
|
5
|
+
return Te("div",{className:"es-copy-cell",children:[
|
|
6
|
+
/* @__PURE__ */Oe("label",{className:"es-field-label es-copy-cell-name",htmlFor:i,children:a}),
|
|
7
|
+
/* @__PURE__ */Oe(v,{id:i,value:Ye(e.value,t),styleValue:Ye(e.styleValue,t),onChange:n=>e.onChange(void 0===n?void 0:Number((n/t).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:o||void 0,steppers:"compact",readOnly:n,ariaLabel:a,title:r.tip({name:a,step:s,unit:o})})]},e.key)})})})}var Je=/* @__PURE__ */new Set([...E,"clear"]),Ze={bold:/* @__PURE__ */Oe(Se,{size:16}),italic:/* @__PURE__ */Oe(ge,{size:16}),strike:/* @__PURE__ */Oe(ke,{size:16}),highlight:/* @__PURE__ */Oe(be,{size:16}),quiet:/* @__PURE__ */Oe(ve,{size:16}),link:/* @__PURE__ */Oe(ye,{size:16}),clear:/* @__PURE__ */Oe(ue,{size:16})};function _e(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 Xe={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function Qe({tools:e,onApply:t,disabled:n=!1,actions:r,align:l,glyphs:a,ariaLabel:o,pressed:s,open:i=null}){const c=A("copy",y),u=("string"==typeof e[0]?D(e).map(e=>({...e,...c.marks[e.style]})):e).filter(e=>!Je.has(e.style));return 0!==u.length||r||l?/* @__PURE__ */Te("div",{className:"es-copy-bar",role:"group","aria-label":o??c.formatting,children:[u.map(e=>{const r=a?.[e.style]??Ze[e.style],l=i===e.style||Boolean(s?.[e.style]),o="link"===e.style&&Boolean(s);return W(e.title,/* @__PURE__ */Oe(U,{onMouseDown:e=>e.preventDefault(),onClick:()=>t(e.style),disabled:n,"aria-label":e.name??e.title,"aria-keyshortcuts":_e(e.shortcut),"aria-pressed":o||!s&&!i?void 0:l,pressed:o?l:void 0,"aria-haspopup":o?"dialog":void 0,"aria-expanded":o?"link"===i:void 0,className:`es-copy-mark${r?" has-glyph":Xe[e.style]?` ${Xe[e.style]}`:""}${l?" is-active":""}`,children:r??e.label},e.style))}),r?/* @__PURE__ */Te(ze,{children:[
|
|
8
|
+
/* @__PURE__ */Oe("span",{className:"es-copy-bar-split","aria-hidden":"true"}),r]}):null,l?/* @__PURE__ */Oe("span",{className:"es-copy-bar-end",children:l}):null]}):null}function et({target:e,onChange:t}){const n=_(null);return Q(()=>{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 tt=["bold","italic","underline","strike","sup","sub"];function nt({value:e,onChange:t,onCommit:n,onCancel:h,multiline:f=!1,placeholder:m,ariaLabel:g,className:v,readOnly:b=!1,rules:x,tools:E=[],writeMark:U,actions:Z,align:ne,glyphs:re,barLabel:le,renderFooter:ae,inputRef:oe,barShows:se="always",richText:ie=!0,defaultShowMarks:ce=!1,toolbar:de="final",colors:pe,cells:he,letterCase:fe,lastTool:me}){const ge="final"===de,ye=A("copy",y),ve=_(null),be=oe??ve,[ke,Se]=X(!1),[xe,we]=X(null),Ee=_(r()).current,Ce=_(null);ee(()=>{const t=Ce.current;t&&e===t.to?Ce.current=null:t&&e===t.from||(Ce.current=null,Ee.reset())},[e,Ee]);const De=n=>{Ce.current={from:Ce.current?.from??e,to:n},t(n)},Ne=t=>({text:e,start:t?.selectionStart??xe?.start??e.length,end:t?.selectionEnd??xe?.end??e.length}),[Le,Fe]=X(ce),Pe=ie&&!(f&&Le),Me=_(null),Re=te(),[Ke,$e]=X(null),[Ae,We]=X(!1),Ue=()=>{if(!Pe)return be.current;const e=Me.current?.getSource()??xe;return e?{selectionStart:e.start,selectionEnd:e.end}:null},qe=et({target:be,onChange:De}),Ye=e=>(we({start:e.selectionStart,end:e.selectionEnd}),e),Ze=(t,n)=>{if(!Pe)return void qe(e=>(n&&Ee.record(Ne(e),"edit",Date.now()),Ye(t(e))));const r=Ue(),l=Ye(t(r));n&&Ee.record(Ne(r),"edit",Date.now()),$e(null),l.text!==e&&De(l.text),Me.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},_e=e=>Ze(e,!0),Xe=e=>Ze(t=>{const n=Ne(t),r=Ee[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),nt=_(null);Q(()=>{const t=nt.current;t&&(nt.current=null,Pe?Me.current?.setSource(t.start,t.end,e):(be.current?.focus(),be.current?.setSelectionRange(t.start,t.end),we(t)))},[Pe]);const[rt,lt]=X(null),at=x??L,ot=("string"==typeof E[0]?D(E):E).filter(e=>!Je.has(e.style)),st=ge?("string"==typeof E[0]?E:E.map(e=>e.style)).filter(e=>!Je.has(e)):ot.map(e=>e.style),it={};if(xe&&(Pe||ge)){const t=N(e,xe.start,xe.end,at);for(const e of st){const n=t.has(e)||"highlight"===e&&t.has("accent");it[e]=!!Ke?.add.includes(e)||!Ke?.drop.includes(e)&&n}ge&&(it.link=t.has("link"))}else if(xe)for(const t of st)it[t]="link"===t?null!==O(e,xe.start,xe.end):T(e,xe.start,xe.end,t);const ct=()=>{const t=Ue(),n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}},ut=t=>{if(ge&&"link"!==t&&P(0,t)){const{start:n,end:r}=ct();if(n===r&&!Pe)return void _e(n=>He(e,t,n,(e,t,n,r)=>C(e,t,n,r,at,ye.placeholders)));const l=d({value:e,rules:at,start:n,end:r,style:t,pending:Ke});return void("pending"===l.kind?$e(l.pending):_e(()=>l.result))}if("clear"===t)return void _e(n=>He(e,t,n,(e,t,n)=>C(e,t,n,"clear",at)));if("link"!==t&&Pe&&P(0,t)){const n=Ue(),r=n?.selectionStart??e.length,l=n?.selectionEnd??r;if(r===l){const n=N(e,r,l,at),a=n.has(t)||"highlight"===t&&n.has("accent"),o=Ke&&Ke.at===r?Ke:null,s=!!o?.add.includes(t)||!o?.drop.includes(t)&&a,i=(o?.add??[]).filter(e=>e!==t),c=(o?.drop??[]).filter(e=>e!==t);return s&&a?c.push(t):s||a||i.push(t),void $e(i.length||c.length?{add:i,drop:c,at:r}:null)}return void _e(n=>R(e,n?.selectionStart??r,n?.selectionEnd??l,t,at))}if("link"!==t){const n=U??((e,t,n,r)=>C(e,t,n,r,L,ye.placeholders));return void _e(r=>He(e,t,r,n))}const n=Ue(),r=n?.selectionStart??e.length,l=n?.selectionEnd??r;We(!1),lt({start:r,end:l,link:O(e,r,l)})},dt=Boolean(xe&&xe.start!==xe.end),pt=xe?z(e,xe.start,xe.end,at):null,ht=xe?Ke&&void 0!==Ke.color&&Ke.at===xe.start?Ke.color:F(e,xe.start,xe.end,at):null,ft=l(ht,pe),mt=t=>{Pe?t?Me.current?.setSource(t.start,t.end,e):Me.current?.focus():(be.current?.focus(),t&&be.current?.setSelectionRange(t.start,t.end))},gt=()=>{const e=rt;lt(null),mt(e?{start:e.start,end:e.end}:xe)},yt=()=>{const e=bt.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));We(!1),t&&mt(xe)},vt=_(yt);vt.current=yt,ee(()=>{if(Ae)return I(e=>{const t=bt.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(vt.current(),!0)},()=>bt.current?.querySelector(".es-copy-colors"))},[Ae]);const bt=_(null),kt=Ae||null!==rt;ee(()=>{const e=bt.current;if(!kt||!e)return;const t=e.ownerDocument,n=()=>{We(!1),lt(null)},r=t=>{e.contains(t.target)||n()};let l;const a=r=>{const a=r.relatedTarget;a?e.contains(a)||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",a),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",a)}},[kt]);const St=rt??(Ae?xe??{start:e.length,end:e.length}:null),xt=_(()=>{});xt.current=()=>{const e=bt.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!St)return;const n=Pe?null:e.querySelector(".es-gold-layer"),r=Pe?Me.current?.rangeOf(St.start,St.end)??null:n?a(n,St.start,St.end):null,l=r?.endContainer,u=l?1===l.nodeType?l:l.parentElement:null,d=r?o(r,u?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!d)return;const p=s({anchor:d,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:c(e),parent:i(t)});t.style.top=`${p.top}px`,t.style.left=`${p.left}px`,t.style.setProperty("--es-pop-point",`${p.point}px`),t.dataset.side=p.above?"above":"below"},Q(()=>{const e=bt.current;if(!kt||!e)return;const t=()=>xt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,a=l&&r?new l(t):null;return a&&r&&a.observe(r),()=>{n?.removeEventListener("resize",t),a?.disconnect()}},[kt,Ae,rt,St?.start,St?.end,Pe]);const wt=t=>rt&&/* @__PURE__ */Oe(J,{className:t?"es-copy-link es-copy-pop":"es-copy-link",value:rt.link?.href??"",onApply:t=>{const n=rt;lt(null),_e(()=>Pe?H(e,n.start,n.end,t,at):V(e,n.start,n.end,t))},onRemove:rt.link?()=>{const t=rt.link,n=rt;lt(null),t&&_e(()=>Pe?j(e,n.start,n.end,at):$(e,t))}:void 0,onCancel:gt}),Et=ne?Be(ne.allow,ye.align):[],Ct="always"===se||ke||null!==rt||Ae,Dt=pe&&pe.length>0?{run:ft,open:Ae,onToggle:()=>{lt(null),Ae?yt():We(!0)}}:void 0,Nt=Ct&&ge&&me?me({className:"rosh-tb-btn",disabled:b,selected:dt,keepCaret:e=>e.preventDefault(),insert:t=>_e(n=>Ve(e,t,n))}):void 0,Lt=new Set(st),Ot=ne?{value:ne.value,allow:ne.allow,onChange:ne.onChange,disabled:ne.disabled}:void 0,Tt={pressed:pt,onList:t=>{const{start:n,end:r}=ct(),l=z(e,n,r,at);_e(()=>K(e,n,r,l===t?null:t,at))}},zt=q({offered:Lt,color:Dt,last:Nt,alignment:Ot,list:Tt,letterCase:fe}),Ft=ge&&Ct&&(tt.some(e=>Lt.has(e))||Boolean(Dt));/* @__PURE__ */
|
|
9
|
+
return Te("div",{ref:bt,className:"es-copy"+(v?` ${v}`:""),onFocus:()=>Se(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||Se(!1)},onKeyDown:e=>{const t=e.target===be.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 Xe(l||e.shiftKey?"redo":"undo");const a=`${e.shiftKey?"shift+":""}${n}`;if(ge){const t={b:"bold",i:"italic",u:"underline",k:"link"}[a];if(!t||!st.includes(t))return;return e.preventDefault(),e.stopPropagation(),void ut(t)}const o=ot.find(e=>e.shortcut===a);o&&(e.preventDefault(),e.stopPropagation(),ut(o.style))},onPaste:t=>{const n=be.current;if(b||!n||t.target!==n)return;t.preventDefault();const r=p({html:t.clipboardData.getData("text/html"),text:t.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:f,rules:at});_e(t=>Ve(e,r,t))},style:pe&&pe.length>0?Object.fromEntries(pe.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const t=be.current;t&&t.ownerDocument.activeElement===t&&we({start:t.selectionStart??e.length,end:t.selectionEnd??e.length})},children:[Ct&&ge&&(zt.words||zt.paragraph)?
|
|
10
|
+
/* @__PURE__ */Oe(Y,{className:"es-copy-toolbar","aria-label":le??ye.formatting,offered:Lt,pressed:it,onMark:e=>ut(e),color:Dt,linkOpen:null!==rt,last:Nt,alignment:Ot,list:Tt,letterCase:fe,disabled:b,windows:/* @__PURE__ */Te(ze,{children:[Ae&&pe&&pe.length>0?/* @__PURE__ */Oe(u,{colors:pe,current:ht,words:ye.colors??y.colors,onPick:t=>{const{start:n,end:r}=ct();if(n!==r)_e(()=>B(e,n,r,t,at));else{if(!Pe)return;$e({add:Ke?.add??[],drop:Ke?.drop??[],color:t,at:n})}}}):null,rt?wt(!0):null]})}):null,ge&&he&&he.length>0?/* @__PURE__ */Oe(Ge,{cells:he,words:ye.cells??y.cells,readOnly:b}):null,Ct&&!ge?/* @__PURE__ */Oe(Qe,{tools:E,disabled:b,actions:Z,glyphs:re,ariaLabel:le,pressed:it,open:rt?"link":null,onApply:ut,align:ne?/* @__PURE__ */Oe(k,{options:Et,value:ne.value,onChange:ne.onChange,ariaLabel:ye.alignment,disabled:b||ne.disabled,fit:je(Et)}):null}):null,Pe?/* @__PURE__ */Oe(Ie,{value:e,rules:at,multiline:f,readOnly:b,placeholder:m,ariaLabel:g,handle:Me,pending:Ke??void 0,onEdit:(t,n,r)=>{Ee.record({text:e,start:n.start,end:n.end},r,Date.now()),$e(null),De(t)},onSelect:e=>{we(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Ke||e.start===Ke.at&&e.end===Ke.at||$e(null)},onHistory:Xe,onFormat:e=>{st.includes(e)&&ut(e)},onCommit:n,onCancel:h}):/* @__PURE__ */Oe(w,{value:e,onInput:e=>{Ee.record(Ne(null),"type",Date.now()),De(e)},onCommit:n,onCancel:h,multiline:f,placeholder:m,ariaLabel:g,rules:x,disabled:b,inputRef:be,className:"es-copy-box"}),rt&&!ge?wt(!1):null,ae?ae({focused:ke,insert:t=>_e(n=>Ve(e,t,n))}):null,ie&&f||Ft?
|
|
11
|
+
/* @__PURE__ */Te("div",{className:"es-copy-marks",children:[ie&&f?/* @__PURE__ */Te(ze,{children:[
|
|
12
|
+
/* @__PURE__ */Oe(S,{checked:Le,onChange:()=>{const e=Ue();nt.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:xe,$e(null),Fe(e=>!e)},ariaLabelledBy:Re,disabled:b}),
|
|
13
|
+
/* @__PURE__ */Oe("span",{id:Re,className:"es-copy-marks-label",children:ye.showMarks??"Show marks"})]}):null,Ft?W(dt?void 0:ye.clearStyleEmpty??"Select words first",/* @__PURE__ */Te(G,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:b||!dt,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:t,end:n}=ct();if(t===n)return;const r=M(e,t,n,at);r.text!==e&&_e(()=>r)},children:[
|
|
14
|
+
/* @__PURE__ */Oe(ue,{size:16}),ye.clearStyle??y.clearStyle]})):null]}):null]})}var rt=["none","bullet","number"],lt=["none","upper","capitalize","lower"],at={none:/* @__PURE__ */Oe(Ee,{}),bullet:/* @__PURE__ */Oe(we,{}),number:/* @__PURE__ */Oe(xe,{})},ot={none:/* @__PURE__ */Oe(Le,{}),upper:/* @__PURE__ */Oe(Ne,{}),capitalize:/* @__PURE__ */Oe(De,{}),lower:/* @__PURE__ */Oe(Ce,{})};function st({label:e,icon:t,answers:n,names:r,glyphs:l,row:a,readOnly:o}){const s=a.value||a.styleValue||"";/* @__PURE__ */
|
|
15
|
+
return Oe(x,{label:e,icon:t,children:/* @__PURE__ */Oe(k,{ariaLabel:e,value:s,disabled:o,onChange:e=>{o||a.onChange(function(e,t){return t===e.value||""===e.value&&t===e.styleValue?"":t}(a,e))},options:n.map(e=>({id:e,label:l[e],title:r[e]}))})})}function it({kept:e,keptHint:t,readOnly:n=!1,style:r,font:l,italic:a,cells:o,align:s,list:i,letterCase:c}){const u=A("copy",y),d={...y.panel,...u.panel},p=u.clearStyle??y.clearStyle,h=r&&!n?[r.onClearChanges&&{label:p,onSelect:r.onClearChanges},r.onEditStyles&&{label:d.editStyles,onSelect:r.onEditStyles},r.onUpdateStyle&&{label:d.updateStyle,onSelect:r.onUpdateStyle}].filter(e=>!!e):[],f=!!a&&(a.value??a.styleValue??!1),m=a?/* @__PURE__ */Oe(Z,{content:d.italic,children:/* @__PURE__ */Oe(U,{size:"sm",variant:"ghost","aria-label":d.italic,"aria-pressed":f,disabled:n,onClick:()=>{if(n)return;const e=!f;a.onChange(e===(a.styleValue??!1)?void 0:e)},children:/* @__PURE__ */Oe(ge,{})})}):null;/* @__PURE__ */
|
|
16
|
+
return Te("div",{className:"es-tpp",children:[e?/* @__PURE__ */Te("div",{className:"es-tpp-kept",children:[
|
|
17
|
+
/* @__PURE__ */Oe(nt,{...e,readOnly:n||e.readOnly}),t?/* @__PURE__ */Oe("p",{className:"es-field-hint",children:t}):null]}):null,r?/* @__PURE__ */Oe(x,{label:d.style,icon:/* @__PURE__ */Oe(de,{}),children:/* @__PURE__ */Oe(b,{ariaLabel:d.style,value:r.value,options:r.options,onChange:r.onChange,changed:r.changed,footer:h,readOnly:n})}):null,l?/* @__PURE__ */Oe(x,{label:d.font,icon:/* @__PURE__ */Oe(pe,{}),children:/* @__PURE__ */Te("div",{className:"es-tpp-font",children:[
|
|
18
|
+
/* @__PURE__ */Oe("div",{className:"es-tpp-font-select",children:/* @__PURE__ */Oe(b,{ariaLabel:d.font,value:l.value||void 0,placeholder:l.styleValue,options:l.options,onChange:l.onChange,searchable:l.searchable,readOnly:n})}),m]})}):m?
|
|
19
|
+
/* @__PURE__ */Oe(x,{label:d.italic,icon:/* @__PURE__ */Oe(pe,{}),children:/* @__PURE__ */Oe("div",{className:"es-tpp-font",children:m})}):null,o?.length?/* @__PURE__ */Oe(Ge,{cells:o,words:u.cells,readOnly:n}):null,s?/* @__PURE__ */Oe(st,{label:u.alignment,icon:/* @__PURE__ */Oe(he,{}),answers:Fe.filter(e=>!s.allow||s.allow.includes(e)),names:u.align,glyphs:Me,row:s,readOnly:n}):null,i?/* @__PURE__ */Oe(st,{label:d.list,icon:/* @__PURE__ */Oe(fe,{}),answers:rt,names:d.lists,glyphs:at,row:i,readOnly:n}):null,c?/* @__PURE__ */Oe(st,{label:d.capitalization,icon:/* @__PURE__ */Oe(me,{}),answers:lt,names:d.cases,glyphs:ot,row:c,readOnly:n}):null]})}export{Fe as COPY_ALIGNS,Re as COPY_ALIGN_FIT,Me as COPY_ALIGN_GLYPHS,Pe as COPY_ALIGN_LABELS,qe as COPY_CELLS,nt as CopyBox,Ge as CopyCells,Qe as MarkBar,Ie as RichBox,it as TextPartPanel,_e as ariaShortcut,Be as copyAlignOptions,Ve as insertSelection,He as markSelection,et as useCaretEdit};
|
package/dist/drag/drag.css
CHANGED
|
@@ -339,7 +339,9 @@
|
|
|
339
339
|
/* Cards (0.80.0): a group whose tiles all carry a cover — two across, the
|
|
340
340
|
picture above the name, so a section is chosen by how it looks. */
|
|
341
341
|
.es-add-grid.is-cards {
|
|
342
|
-
|
|
342
|
+
/* ONE card size for every tile (11.0.0, the Add picker Lewis approved
|
|
343
|
+
2026-10-16): three across at the left panel's 288px, two at its 220px. */
|
|
344
|
+
grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
|
|
343
345
|
gap: 8px;
|
|
344
346
|
}
|
|
345
347
|
.es-add-tile.has-cover {
|
|
@@ -366,6 +368,14 @@
|
|
|
366
368
|
width: 100%;
|
|
367
369
|
height: 100%;
|
|
368
370
|
}
|
|
371
|
+
/* A block's cover is its glyph, centred on the cover's ground, so a block is
|
|
372
|
+
the same card as a section beside it (11.0.0). */
|
|
373
|
+
.es-add-tile-cover > .es-add-glyph-cover {
|
|
374
|
+
display: flex;
|
|
375
|
+
align-items: center;
|
|
376
|
+
justify-content: center;
|
|
377
|
+
color: var(--es-icon);
|
|
378
|
+
}
|
|
369
379
|
.es-add-tile.has-cover .es-add-tile-label {
|
|
370
380
|
padding: 0 2px;
|
|
371
381
|
}
|
package/dist/drag/index.d.ts
CHANGED
|
@@ -221,14 +221,20 @@ type AddPanelProps<I> = {
|
|
|
221
221
|
session: DragSession<I>;
|
|
222
222
|
/** The drag item for a new block of `type`. */
|
|
223
223
|
itemFor: (type: string) => I;
|
|
224
|
-
/**
|
|
225
|
-
|
|
224
|
+
/**
|
|
225
|
+
* A tile pressed (a click, or Enter on a focused tile): add one at the place
|
|
226
|
+
* the panel was opened for. Left out, a press adds nothing and the tile is
|
|
227
|
+
* only dragged (11.0.0) — the owner's two ways to add (ruling A1,
|
|
228
|
+
* 2026-10-14): drag a tile to its place, or press one after opening the
|
|
229
|
+
* panel AT a place. A host hands it only while the panel has a place.
|
|
230
|
+
*/
|
|
231
|
+
onInsert?: (type: string) => void;
|
|
226
232
|
/** The panel was opened at a place — "Adding to Column 2" — and can stop being. */
|
|
227
233
|
at?: {
|
|
228
234
|
label: string;
|
|
229
235
|
onClear: () => void;
|
|
230
236
|
};
|
|
231
|
-
/** The line under the title. Default "Drag onto the page
|
|
237
|
+
/** The line under the title. Default "Drag onto the page." */
|
|
232
238
|
hint?: string;
|
|
233
239
|
/** The search field's name. Default "Search blocks". */
|
|
234
240
|
searchLabel?: string;
|
package/dist/drag/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-
|
|
1
|
+
export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-47RGVCPH.js";import"../chunk-GG4FGBFR.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-ILXP5VX5.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
package/dist/easel/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ 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 { TextToolbarProps } from 'efficient-shell/ui';
|
|
11
|
-
import { C as CopyBoxLastTool, a as CanvasTypingEnd } from '../canvas-typing-
|
|
11
|
+
import { C as CopyBoxLastTool, a as CopyThemeColor, b as CanvasTypingEnd } from '../canvas-typing-DvoqQINU.js';
|
|
12
12
|
import { InlineRule } from '../markup/index.js';
|
|
13
13
|
import { b as NodeOpsHost, C as ClipboardEntry } from '../useNodeOps-BHRkUFfG.js';
|
|
14
14
|
import { I as InspectorFields } from '../types-Dkx1VAIQ.js';
|
|
@@ -372,6 +372,13 @@ interface CanvasTypingTarget {
|
|
|
372
372
|
* the tool's menu take focus without ending typing.
|
|
373
373
|
*/
|
|
374
374
|
lastTool?: (slot: CopyBoxLastTool) => ReactNode;
|
|
375
|
+
/**
|
|
376
|
+
* The theme colours the words may wear — the panel box's `colors`
|
|
377
|
+
* (`CopyBox`), the same `CopyThemeColor[]`. Given (and not empty), the bar
|
|
378
|
+
* offers the colour window, the panel box's own (`ColorWindow`): a theme
|
|
379
|
+
* colour is written by NAME, any colour as a hex. Left out, no colour button.
|
|
380
|
+
*/
|
|
381
|
+
colors?: readonly CopyThemeColor[];
|
|
375
382
|
};
|
|
376
383
|
}
|
|
377
384
|
type CanvasTypingState = {
|
package/dist/easel/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{CanvasFrame,CanvasPassThroughContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-
|
|
1
|
+
export{CanvasFrame,CanvasPassThroughContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-I55LUW3C.js";import"../chunk-TBY3DFKS.js";import"../chunk-YRLPFZW3.js";import"../chunk-ECM5F6JJ.js";import"../chunk-FGJSCWUN.js";import"../chunk-Q6AM43CA.js";import"../chunk-546BBOPE.js";import"../chunk-MFIRYGHW.js";import"../chunk-ILXP5VX5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
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-XAF6J6TB.js";import"../chunk-4JSBIW5H.js";import"../chunk-K56YDHYQ.js";export{FieldSlider}from"../chunk-XWFH2NHZ.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import"../chunk-EA2HTX37.js";export{FieldNumber}from"../chunk-66LWADFP.js";export{FieldSelect,optionFor}from"../chunk-65Z5FSAW.js";import"../chunk-FFYXVAAL.js";import"../chunk-XJCMEEBH.js";import"../chunk-MFIRYGHW.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddBlockRow as default}from"../../chunk-
|
|
1
|
+
export{AddBlockRow as default}from"../../chunk-O66SKO3J.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-OHRS7Q3E.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VWXUMVCD.js";import"../../chunk-I55LUW3C.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-XAF6J6TB.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-EA2HTX37.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-FGJSCWUN.js";import"../../chunk-Q6AM43CA.js";import"../../chunk-66LWADFP.js";import"../../chunk-65Z5FSAW.js";import"../../chunk-FFYXVAAL.js";import"../../chunk-XJCMEEBH.js";import"../../chunk-546BBOPE.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import{Tooltip as e}from"efficient-shell/ui";import{useId as s}from"react";import{jsxs as l,Fragment as i,jsx as a}from"react/jsx-runtime";function r({label:r,blocked:d,onAdd:n,small:t=!1}){const c=null!==d,o=s(),m=/* @__PURE__ */l("button",{type:"button",className:"sf-add-card","aria-disabled":c||void 0,"aria-describedby":c?o:void 0,onClick:c?void 0:n,children:[
|
|
2
|
+
/* @__PURE__ */a("span",{className:t?"sf-plus sf-plus--sm":"sf-plus",children:"+"}),r]});return c?/* @__PURE__ */l(i,{children:[
|
|
3
|
+
/* @__PURE__ */a(e,{content:d,children:m}),
|
|
4
|
+
/* @__PURE__ */a("span",{id:o,className:"es-vh",children:d})]}):m}export{r as default};
|