efficient-easel 25.0.0 → 26.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.
Files changed (79) hide show
  1. package/README.md +3 -4
  2. package/dist/chunk-2T22IY3J.js +2 -0
  3. package/dist/chunk-4FFDGEWA.js +1 -0
  4. package/dist/{chunk-KFV7N2DJ.js → chunk-56ID6FKZ.js} +1 -1
  5. package/dist/chunk-5OKOCRXT.js +11 -0
  6. package/dist/{chunk-4Y3TK65H.js → chunk-5QUIXGQU.js} +1 -1
  7. package/dist/{chunk-ZYOQXBJF.js → chunk-6BOOYHHK.js} +4 -4
  8. package/dist/{chunk-OXOUGEAT.js → chunk-7GGNFLHT.js} +1 -1
  9. package/dist/{chunk-VIUES5R6.js → chunk-7PGO4K5M.js} +7 -7
  10. package/dist/chunk-BA5X67LQ.js +1 -0
  11. package/dist/{chunk-53ME3GAI.js → chunk-BBD3FLU3.js} +14 -14
  12. package/dist/chunk-BYONFJVQ.js +2 -0
  13. package/dist/chunk-CLAADE4J.js +14 -0
  14. package/dist/chunk-IMAN6IP5.js +4 -0
  15. package/dist/chunk-JQQFB7EZ.js +1 -0
  16. package/dist/chunk-LSGKADNV.js +5 -0
  17. package/dist/chunk-O4DQ6O6W.js +1 -0
  18. package/dist/{chunk-S6YOIRXQ.js → chunk-Q3VAJMXS.js} +1 -1
  19. package/dist/{chunk-YFHKE54W.js → chunk-QAVA4V2C.js} +1 -1
  20. package/dist/{chunk-U3LTJSBU.js → chunk-R76XMEKT.js} +11 -11
  21. package/dist/{chunk-MBEUSPIN.js → chunk-SQTVXE5D.js} +4 -4
  22. package/dist/{chunk-GEPSJJWW.js → chunk-STQDOTHF.js} +1 -1
  23. package/dist/{chunk-62UGN7VM.js → chunk-TOEJCZUO.js} +1 -1
  24. package/dist/chunk-TTCUC2Q3.js +1 -0
  25. package/dist/{chunk-FYV6GZXP.js → chunk-UCZQWQNS.js} +1 -1
  26. package/dist/{chunk-KTV7ORWF.js → chunk-VXAGXHKI.js} +38 -38
  27. package/dist/{chunk-M4THI4OO.js → chunk-WOA775T4.js} +1 -1
  28. package/dist/drag/index.js +1 -1
  29. package/dist/easel/index.js +1 -1
  30. package/dist/fields/index.js +1 -1
  31. package/dist/panel/index.d.ts +63 -2
  32. package/dist/panel/index.js +1 -1
  33. package/dist/panel/panel.css +46 -0
  34. package/dist/pick/index.d.ts +16 -195
  35. package/dist/pick/index.js +1 -1
  36. package/dist/pick/pick.css +6 -196
  37. package/dist/screen/components/AddBlockRow.js +1 -1
  38. package/dist/screen/components/AddSidePanel.js +1 -1
  39. package/dist/screen/components/NodeContextMenu.js +1 -1
  40. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  41. package/dist/screen/components/ScreenChrome.js +1 -1
  42. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  43. package/dist/screen/components/ScreenMount.js +1 -1
  44. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  45. package/dist/screen/components/SectionScreenShell.js +17 -17
  46. package/dist/screen/components/usePartBridge.js +1 -1
  47. package/dist/screen/index.js +1 -1
  48. package/dist/screen/lib/document/block-set-host.js +1 -1
  49. package/dist/screen/lib/document/box-fields.d.ts +129 -3
  50. package/dist/screen/lib/document/box-fields.js +1 -1
  51. package/dist/screen/lib/document/button-fields.d.ts +97 -0
  52. package/dist/screen/lib/document/button-fields.js +1 -0
  53. package/dist/screen/lib/document/device-fields.js +1 -1
  54. package/dist/screen/lib/document/image-fields.d.ts +118 -0
  55. package/dist/screen/lib/document/image-fields.js +5 -0
  56. package/dist/screen/lib/document/style-clipboard.js +1 -1
  57. package/dist/screen/lib/document/style-fields.d.ts +109 -0
  58. package/dist/screen/lib/document/style-fields.js +1 -0
  59. package/dist/screen/lib/document/use-section-ops.js +1 -1
  60. package/dist/screen/lib/key-scope.js +1 -1
  61. package/dist/screen/lib/screen-parts.js +1 -1
  62. package/dist/screen/words.d.ts +22 -1
  63. package/dist/screen/words.js +1 -1
  64. package/dist/strings/index.d.ts +12 -9
  65. package/dist/strings/index.js +2 -2
  66. package/dist/text-styles/index.d.ts +3 -3
  67. package/dist/text-styles/index.js +37 -37
  68. package/dist/{words-fbR9IwxH.d.ts → words-BrN08Fup.d.ts} +16 -1
  69. package/package.json +19 -1
  70. package/dist/chunk-4OMAA45Q.js +0 -5
  71. package/dist/chunk-ERB6FAZT.js +0 -2
  72. package/dist/chunk-H6BER2EU.js +0 -1
  73. package/dist/chunk-LUG22U5L.js +0 -1
  74. package/dist/chunk-OFBZOI6W.js +0 -1
  75. package/dist/chunk-SC6E3UUS.js +0 -13
  76. package/dist/chunk-SSDKT4AY.js +0 -9
  77. package/dist/chunk-U6LJ5UKD.js +0 -6
  78. package/dist/chunk-ZLOMH2PD.js +0 -1
  79. package/dist/words-DWvCJXwR.d.ts +0 -51
@@ -1,9 +0,0 @@
1
- import{SettingsDefaultReset as e,sidesStartEach as n,SidesInput as t,SidesEachToggle as l}from"./chunk-SC6E3UUS.js";import{deviceField as a}from"./chunk-OXOUGEAT.js";import{noControlField as o,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as u}from"./chunk-CWELHADJ.js";import{phoneKey as s}from"./chunk-E52W3M5I.js";import{foldMetaOf as c,FOLD_FIELD_MARKER as d}from"./chunk-ANPOR6EY.js";import{useEasel as p,useSelectedHost as m}from"./chunk-53ME3GAI.js";import{DEFAULT_PANEL_WORDS as b}from"./chunk-KFV7N2DJ.js";import{SettingsSwitch as f}from"./chunk-OECWLNKJ.js";import{FieldSelect as h}from"./chunk-KFWNGPW3.js";import{SettingsField as g}from"./chunk-MIX7EGRG.js";import{SettingsSegmented as v}from"./chunk-DX3VILZ3.js";import{useWords as y}from"./chunk-MFIRYGHW.js";import{useState as k}from"react";import{AlignmentIcon as C,BoxJustifyIcon as x,WrapIcon as w,GapIcon as F,WidthIcon as j,PlacementIcon as S,NudgeIcon as L,DesktopIcon as P,BoxXEndIcon as E,BoxXCenterIcon as O,BoxXStartIcon as A,PaddingAllIcon as I,BoxYBetweenIcon as W,BoxYStretchIcon as B,BoxYEndIcon as G,BoxYCenterIcon as N,BoxYStartIcon as T,BoxXBetweenIcon as R,BoxXStretchIcon as K,BoxItemAlignmentIcon as M}from"efficient-shell/icons/efficient";import{Slider as V,textAlignOptions as D,AlignmentGrid as J,PositionInput as X}from"efficient-shell/ui";import{jsx as U,Fragment as z,jsxs as Y}from"react/jsx-runtime";var _=e=>e;function H(){return null}function $(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");/* @__PURE__ */
2
- return U(H,{},e)}function Z(e){return e.type===H}function q(e){return Z(e)?void 0:e}function Q(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!c(t)&&u(t,`section:${n}`);return e}function ee(e,n){return{type:"custom",[d]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */U(z,{})}}function ne(e){return ee(e,2)}function te(e){return ee(e,1)}var le=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],ae=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],oe="Wrap",ie=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],re="Direction",ue=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],se={min:-32,max:64,step:2,builtIn:0},ce={min:30,max:100,step:5,fallback:60},de=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],pe="bottom-left",me={"top-left":"Top left","top-center":"Top center","top-right":"Top right",left:"Left",center:"Center",right:"Right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},be=de.map(e=>({value:e,label:me[e]}));function fe(e,n=pe){return de.includes(e)?e:n}var he=40,ge=e=>"number"==typeof e?e:null;function ve(e,n,t){const l={};for(const a of["x","y"])t[a]!==n[a]&&(l[e[a]]=t[a]??void 0);return l}var ye=["top","right","bottom","left"],ke={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},Ce=e=>"number"==typeof e?e:null;function xe(e,n,t){const l={};for(const a of ye)t[a]!==n[a]&&(l[e[a]]=t[a]??void 0);return l}var we=["left","center","right"];function Fe(e,{options:n,value:t,onChange:l,ariaLabel:a,disabled:o=!1}){/* @__PURE__ */
3
- return U(v,{options:n.map(n=>n.picture?{id:n.value,label:n.picture,title:e(n.title??n.label)}:{id:n.value,label:e(n.label),title:void 0===n.title?void 0:e(n.title)}),value:t,onChange:l,ariaLabel:e(a),disabled:o})}function je(e,{label:n,value:t,onChange:l,points:a}){const o=a.find(e=>e.disabled),i=a.map(n=>({...n,label:e(n.label),...n.title?{title:e(n.title)}:null}));/* @__PURE__ */
4
- return U(g,{label:e(n),icon:/* @__PURE__ */U(S,{}),hint:o?.title?e(o.title):void 0,children:/* @__PURE__ */U(J,{label:e(n),value:t,points:i,onChange:l})})}function Se({say:e,label:n,value:t,onChange:l,pointsFor:a}){const{appState:o,selectedItem:i}=p(e=>e),r=i?.props?.id?String(i.props.id):void 0;return je(e,{label:n,value:t,onChange:l,points:a(o?.data,r)})}function Le({say:n,o:t}){const l=m(),a=y("panel",b),o=l?.values??{},i={x:ge(o[t.keys.x]),y:ge(o[t.keys.y])},r=n(t.label??"Position"),u=Boolean(i.x||i.y),s=e=>{const n=ve(t.keys,i,e);Object.keys(n).length&&l?.onChangeMany(n)},c=/* @__PURE__ */U(X,{label:r,value:i,onChange:s,words:{x:n("Left and right"),y:n("Up and down"),unit:"px"},placeholder:{x:"0",y:"0"},min:t.min,max:t.max,step:t.step??1}),d=/* @__PURE__ */U(e,{words:a,label:r,changed:u,detail:"0 px, 0 px",onReset:()=>s({x:null,y:null})});return null===t.label?/* @__PURE__ */Y("div",{className:"sf-position-line",children:[c,d]}):/* @__PURE__ */U(g,{label:r,icon:/* @__PURE__ */U(L,{}),changed:u,action:d,children:c})}var Pe={x:{start:/* @__PURE__ */U(A,{}),center:/* @__PURE__ */U(O,{}),end:/* @__PURE__ */U(E,{}),stretch:/* @__PURE__ */U(K,{}),between:/* @__PURE__ */U(R,{})},y:{start:/* @__PURE__ */U(T,{}),center:/* @__PURE__ */U(N,{}),end:/* @__PURE__ */U(G,{}),stretch:/* @__PURE__ */U(B,{}),between:/* @__PURE__ */U(W,{})}},Ee=e=>"row"===e?"row":"column";function Oe({say:e,kind:n,label:t,options:l,value:a,onChange:o,o:i}){const r=m(),u="justify"===n==("row"===(i.runs??Ee)(r?.values?.[i.directionKey??"direction"]))?"x":"y";return Fe(e,{options:l.map(e=>({label:e.label,value:e.value,picture:Pe[u][e.value]})),value:a,onChange:o,ariaLabel:t})}function Ae({say:e,tier:a,o:o}){const i=m(),r=i?.values??{},u="mobile"===a?o.phoneKeys:o.keys,s=Object.fromEntries(ye.map(e=>[e,Ce(r[u[e]])])),c=Object.fromEntries(ye.map(e=>[e,String("mobile"===a?Ce(r[o.keys[e]])??o.fallback[e]:o.fallback[e])])),[d,p]=k(()=>n(s,c));/* @__PURE__ */
5
- return U(g,{label:e("Padding"),icon:/* @__PURE__ */U(I,{}),action:/* @__PURE__ */U(l,{each:d,label:e("Each side"),onChange:p}),children:/* @__PURE__ */U(t,{label:e("Padding"),each:d,value:s,placeholder:c,min:o.min,max:o.max,step:o.step,onChange:e=>{const n=xe(u,s,e);Object.keys(n).length&&i?.onChangeMany(n)},words:{sides:{top:e("Padding top"),right:e("Padding right"),bottom:e("Padding bottom"),left:e("Padding left")},vertical:e("Top and bottom"),horizontal:e("Left and right"),unit:"px"}})})}function Ie(e=_){function n(n,t,l,a,o,i,u="",s){return{type:"custom",...r({},{type:"number",label:n}),render:r=>{const c="number"==typeof r.value?r.value:i;/* @__PURE__ */
6
- return U(g,{label:e(n),icon:q(t),action:s?s("storedValue"in r?r.storedValue:r.value,r.onChange):void 0,children:/* @__PURE__ */U("div",{className:"sf-slider",children:/* @__PURE__ */U(V,{min:l,max:a,step:o,value:c,suffix:u||void 0,showInput:!0,label:e(n),disabled:!1,size:"sm",boxSize:"md",className:"sf-slider-track",onChange:e=>{null!==e&&e!==c&&r.onChange(e)}})})})}}}function t(n){return Fe(e,n)}function l(n,l,a,o){const i=a.map(e=>"string"==typeof e?{label:e,value:e}:e);return{type:"custom",...r({},{type:"radio",label:n,options:i.map(e=>({value:e.value,label:e.label}))}),render:({value:a,onChange:r,field:u})=>/* @__PURE__ */U(g,{label:e(n),icon:q(l),children:t({options:i,value:i.some(e=>e.value===a)?a:a||u?.currentValue||o,onChange:r,ariaLabel:n})})}}function u(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */U(P,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function c(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function d(e,n,t){return{[e]:a("desktop",n(t)),[s(e)]:a("mobile",n({...t,phone:!0},""))}}function p(e){return u(D(e.allow??we).map(e=>({label:e.label,value:e.value,picture:e.icon})),e)}function m(e={},n=e.fallback??"left"){return c(l(e.label??"Text alignment",/* @__PURE__ */U(C,{}),p(e),n),e)}function b(e){const n={left:Pe.x.start,center:Pe.x.center,right:Pe.x.end};return u(D((e.allow??we).filter(e=>e in n)).map(e=>({label:e.label,value:e.value,picture:n[e.value]})),e)}function v(e={},n=e.fallback??"left"){return c(l(e.label??"Block alignment",/* @__PURE__ */U(x,{}),b(e),n),e)}function y(n,t,l,a,o,i){return{type:"custom",options:a,fallback:o,...r({},{type:"radio",label:t,options:a.map(e=>({value:e.value,label:e.label}))}),render:({value:r,onChange:u,field:s})=>{const c=s.options??a,d=s.fallback??o,p=c.some(e=>e.value===r)?r:d;/* @__PURE__ */
7
- return U(g,{label:e(t),icon:q(l),children:/* @__PURE__ */U(Oe,{say:e,kind:n,label:t,options:c,value:p,onChange:u,o:i})})}}}function k(e={}){return y("justify","Justify",/* @__PURE__ */U(x,{}),le,le[0].value,e)}function S(e={}){return y("align","Item alignment",/* @__PURE__ */U(M,{}),ae,"stretch",e)}function L(){const n=oe;return{type:"custom",options:ie,fallback:ie[1].value,...r({},{type:"radio",label:n,options:ie.map(e=>({value:e.value,label:e.label}))}),render:({value:t,onChange:l,id:a,name:o})=>{const i=`${a??o??n}-label`;/* @__PURE__ */
8
- return U(g,{label:e(n),labelId:i,icon:/* @__PURE__ */U(w,{}),action:/* @__PURE__ */U(f,{checked:(r=t,!0===r||"wrap"===r),onChange:e=>l(e?ie[0].value:ie[1].value),ariaLabelledBy:i})});var r}}}function E({offered:e,fallback:n,resolve:t}){const a=t??(t=>e.some(e=>e.value===t)?t:n),o=l(re,$("`Direction` names how a container’s children run — a MODIFIER, not a thing. doc/naming.md N10.1 gives the idea a dash in its Glyph column; the shell’s own `direction` meaning says the bare row is CORRECT and not an omission (SS seat, 2026-09-11)."),e.map(e=>({label:e.label,value:e.value})),a(void 0));return{type:"custom",render:e=>o.render({...e,value:a(e.value),onChange:n=>e.onChange(n)})}}function O({min:e,max:t,step:l,builtIn:a,resolve:o,action:i,mark:r}){const u=n("Gap",/* @__PURE__ */U(F,{}),e,t,l,a,"px",i),s=o??(e=>"number"==typeof e?e:a);return{...r,type:"custom",render:e=>u.render({...e,value:s(e.value,e.field),storedValue:e.value,onChange:n=>e.onChange(n)})}}function A(n,{fallback:t=pe,pointsFor:l}={}){return{type:"custom",render:({value:a,onChange:o})=>{const i=fe(a,t);return l?/* @__PURE__ */U(Se,{say:e,label:n,value:i,onChange:o,pointsFor:l}):je(e,{label:n,value:i,onChange:o,points:be})}}}function I(n){return{[n.keys.x]:{type:"custom",render:()=>/* @__PURE__ */U(Le,{say:e,o:n})},[n.keys.y]:{...o({type:"custom",render:()=>/* @__PURE__ */U(i,{})},"always"),reachedBy:n.keys.x}}}function W(n={}){const t={...ke,...n.keys},l={keys:t,phoneKeys:Object.fromEntries(ye.map(e=>[e,s(t[e])])),fallback:{top:0,right:0,bottom:0,left:0,...n.fallback},min:n.min??0,max:n.max??200,step:n.step??4},r=!1!==n.phone,u=n=>{const t={type:"custom",render:()=>/* @__PURE__ */U(Ae,{say:e,tier:n,o:l})};return r?a(n,t):t},c=()=>o({type:"custom",render:()=>/* @__PURE__ */U(i,{})},"always"),d=ye.filter(e=>"top"!==e);return Q({...!1===n.group?{}:{_gSpacing:ne("Padding")},[l.keys.top]:u("desktop"),...r?{[l.phoneKeys.top]:u("mobile")}:{},...Object.fromEntries(d.map(e=>[l.keys[e],{...c(),reachedBy:l.keys.top}])),...r?Object.fromEntries(d.map(e=>[l.phoneKeys[e],a("mobile",c())])):{}})}return{slider:n,select:function(n,t,l,a,o){return{type:"custom",options:l,fallback:a,...o?{note:o}:{},...r({},{type:"select",label:n}),render:({value:i,onChange:r,field:u})=>{const s=u.options??l,c=u.fallback??a,d=s.some(e=>e.value===i)?i:c;/* @__PURE__ */
9
- return U(g,{label:e(n),icon:q(t),children:/* @__PURE__ */U(h,{value:d,ariaLabel:e(n),onChange:r,options:[...o?[{label:e(o),value:"\0note",disabled:!0}]:[],...s.map(n=>({label:e(n.label),value:n.value}))]})})}}},Segmented:t,segmented:l,boxJustifyField:k,boxAlignField:S,boxWrapField:L,directionField:E,gapField:O,placementField:A,PlacementGridView:function(n){return je(e,n)},positionFields:I,sidesPaddingFields:W,alignmentField:m,alignmentFields:function(e="align",n={}){return d(e,m,n)},AlignmentStrip:function({opts:e={},value:n,onChange:l,ariaLabel:a,disabled:o=!1}){return t({options:p(e),value:n,onChange:l,ariaLabel:a,disabled:o})},blockAlignmentField:v,blockAlignmentFields:function(e="align",n={}){return d(e,v,n)},BlockAlignmentStrip:function({opts:e={},value:n,onChange:l,ariaLabel:a,disabled:o=!1}){return t({options:b(e),value:n,onChange:l,ariaLabel:a,disabled:o})},boxFieldSet:function(e={}){const t=e.width??ce,l=e.nudge?.limit??40,a=e.direction??{offered:ue,fallback:"column"},o=a.resolve??(e=>a.offered.some(n=>n.value===e)?e:a.fallback),i={runs:e=>"row"===o(e)?"row":"column"};return{_gLayout:ne("Layout"),placement:A("Placement",e.placement),width:n("Width",/* @__PURE__ */U(j,{}),t.min,t.max,t.step,t.fallback,"%"),direction:E(a),gap:O(e.gap??se),justify:k(i),align:S(i),wrap:L(),_gNudge:ne("Nudge"),...I({keys:e.nudge?.keys??{x:"nudgeX",y:"nudgeY"},min:-l,max:l,label:null}),...W(e.padding)}}}}var{slider:We,select:Be,Segmented:Ge,segmented:Ne,boxJustifyField:Te,boxAlignField:Re,boxWrapField:Ke,directionField:Me,gapField:Ve,placementField:De,PlacementGridView:Je,positionFields:Xe,sidesPaddingFields:Ue,alignmentField:ze,alignmentFields:Ye,AlignmentStrip:_e,blockAlignmentField:He,blockAlignmentFields:$e,BlockAlignmentStrip:Ze,boxFieldSet:qe}=Ie();export{me as ANCHOR_LABELS,_e as AlignmentStrip,ae as BOX_ALIGN_POINTS,ue as BOX_DIRECTIONS,re as BOX_DIRECTION_LABEL,se as BOX_GAP,le as BOX_JUSTIFY_POINTS,he as BOX_NUDGE_LIMIT,de as BOX_PLACEMENTS,pe as BOX_PLACEMENT_DEFAULT,ce as BOX_WIDTH,oe as BOX_WRAP_LABEL,ie as BOX_WRAP_POINTS,Ze as BlockAlignmentStrip,be as OPEN_PLACEMENT_POINTS,Je as PlacementGridView,ke as SIDE_PAD_KEYS,Ge as Segmented,ze as alignmentField,Ye as alignmentFields,He as blockAlignmentField,$e as blockAlignmentFields,Re as boxAlignField,Ie as boxFieldBuilders,qe as boxFieldSet,Te as boxJustifyField,Ke as boxWrapField,Me as directionField,Ve as gapField,ne as group,q as iconOf,Z as isNoGlyph,$ as noGlyph,fe as normaliseBoxPlacement,De as placementField,Xe as positionFields,ve as positionPatch,te as section,Ne as segmented,Be as select,Q as sharedStyleKinds,Ue as sidesPaddingFields,xe as sidesPaddingPatch,We as slider};
@@ -1,6 +0,0 @@
1
- import{DEFAULT_PICK_WORDS as e}from"./chunk-OFBZOI6W.js";import{parseHexColor as t,Popover as n,colorSwatchClasses as r,colorFill as l,ColorPickerPanel as i}from"efficient-shell/ui";export{hexToHsv,hsvToHex}from"efficient-shell/ui";import{useRef as a,useState as s,useLayoutEffect as o,useEffect as c}from"react";import{jsx as u,jsxs as p}from"react/jsx-runtime";var d=t,h=7,m=e=>e.toUpperCase(),g=(e,t,n)=>Math.min(n,Math.max(t,e));function f(e,t,n){return{s:n.width>0?g((e-n.left)/n.width,0,1):0,v:n.height>0?1-g((t-n.top)/n.height,0,1):0}}function v(e,t){return t.width>0?360*g((e-t.left)/t.width,0,1):0}function w({value:t,onChange:i,label:h,theme:g,caption:f,inherited:v,after:w,id:x,readOnly:C,words:y=e.colour}){const E=a(null),L=a(null),N=()=>{const e=E.current?.parentElement;return e?.classList.contains("es-field-head")?e.querySelector(":scope > .es-field-name .es-field-label"):e?.classList.contains("es-pick-line")?e.querySelector(":scope > .es-pick-line-label"):null},O=()=>L.current?.querySelector(".es-pick-hexwrap > *")??null,B=e=>e.scrollWidth>e.clientWidth+1,R=e=>{e&&(B(e)?e.dataset.clipped="true":delete e.dataset.clipped)},D=a(()=>{});D.current=()=>{R(N()),W||R(O())};const[T,S]=s(null),[W,M]=s(null);o(()=>D.current()),c(()=>{const e=E.current?.parentElement,t=e?.ownerDocument.defaultView;if(!e||!t?.ResizeObserver)return;const n=new t.ResizeObserver(()=>D.current());return n.observe(e),()=>n.disconnect()},[]),c(()=>{const e=E.current?.parentElement;if(!e)return;const t=e=>{const t=e;if(!t)return null;const n=N(),r=O();return n&&(t===n||n.contains(t))?n:r&&t===r?r:null},n=e=>{const n=t(e.target),r=P();if(!n||!r||n.ownerDocument.activeElement===n||!B(n))return;const l=n.getBoundingClientRect(),i=r.getBoundingClientRect(),a="INPUT"===n.tagName?n.value:n.textContent??"";S({text:a,left:l.left-i.left,top:l.top-i.top})},r=e=>{t(e.target)&&S(null)};return e.addEventListener("pointerover",n),e.addEventListener("pointerout",r),()=>{e.removeEventListener("pointerover",n),e.removeEventListener("pointerout",r)}},[]);const P=()=>{const e=E.current?.parentElement;return e&&(e.classList.contains("es-field-head")||e.classList.contains("es-pick-line"))?e:L.current},q=t?null:d(v??""),F=void 0===f||t&&d(f)===d(t)?null:f,U=F??(t?m(t):q?m(q):y.notSet);/* @__PURE__ */
2
- return u("div",{ref:E,className:"es-pick-colour",children:/* @__PURE__ */p("div",{ref:L,className:"es-pick-colour-row","data-editing":W??void 0,onFocus:e=>{const t=e.target,n=P();if(!n||!t.classList.contains("es-pick-hex"))return;S(null),t.style.setProperty("--es-pick-edit-room",n.getBoundingClientRect().right-t.getBoundingClientRect().left+"px");const r=t.parentElement?.nextElementSibling,l=!!r&&t.getBoundingClientRect().right>r.getBoundingClientRect().left-2;M(l?"over":"room")},onBlur:e=>{const t=e.target;t.classList.contains("es-pick-hex")&&(t.style.removeProperty("--es-pick-edit-room"),M(null))},children:[
3
- /* @__PURE__ */u(n,{id:x,className:"es-pick-swatch-wrap",trigger:/* @__PURE__ */u("span",{"aria-hidden":"true",style:{position:"absolute",inset:0,...l(t||q)}}),triggerLabel:y.swatch({label:h,shown:U}),triggerClassName:r({className:t?"es-pick-swatch":q?"es-pick-swatch is-inherited":"es-pick-swatch is-unset"}),"aria-label":y.dialog({label:h}),disabled:C,children:/* @__PURE__ */u(k,{value:t,onChange:i,label:h,theme:g,inherited:v,readOnly:C})}),
4
- /* @__PURE__ */u("span",{className:"es-pick-hexwrap",children:null===F?/* @__PURE__ */u(b,{value:t,follows:q?m(q):void 0,onChange:e=>{C||e===t||i(e)},name:y.hex({label:h}),readOnly:C}):/* @__PURE__ */u("span",{className:"es-pick-caption",children:F})}),w,T?/* @__PURE__ */u("span",{className:"es-pick-tag","aria-hidden":"true",style:{left:T.left,top:T.top},children:T.text}):null]})})}function k({value:e,onChange:t,label:n,theme:r,onClose:l,id:a,inherited:s,readOnly:o,words:c,swatch:p,dragWrites:d="live"}){/* @__PURE__ */
5
- return u(i,{id:a,className:"es-pick-window",value:e,onChange:t,label:n,presets:r?.map(e=>({value:e.value,label:e.name})),fallback:s,dragWrites:d,disabled:o,onClose:l})}function b({value:e,follows:t,onChange:n,name:r,readOnly:l}){const[i,o]=s(null),c=a(!1);/* @__PURE__ */
6
- return u("input",{type:"text",className:!e&&t?"es-pick-hex is-inherited":"es-pick-hex",value:i??(e?m(e):t??""),"aria-label":r,maxLength:7,spellCheck:!1,autoComplete:"off",readOnly:l,onChange:t=>{o(t.target.value);const r=d(t.target.value);null!==r&&r!==e&&n(r)},onFocus:e=>e.currentTarget.select(),onMouseDown:e=>{c.current=e.currentTarget.ownerDocument.activeElement!==e.currentTarget},onMouseUp:e=>{c.current&&e.preventDefault(),c.current=!1},onKeyDown:e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),e.stopPropagation(),o(null),e.currentTarget.blur())},onBlur:()=>o(null)})}export{w as ColourPicker,k as ColourWindow,h as HEX_MAX_LENGTH,m as hexReadout,v as hueFromPoint,f as svFromPoint,d as typedHex};
@@ -1 +0,0 @@
1
- import{useSectionOps as o}from"./chunk-M4THI4OO.js";import{SELECTION_MODE as e}from"./chunk-4OMAA45Q.js";import{decodePartId as r,encodePartId as t}from"./chunk-R4AUZVA3.js";import{useEasel as n}from"./chunk-53ME3GAI.js";import{usePreviewParts as p}from"./chunk-467WWV4I.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}=n(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),I?.(n)):i(o=>"part"===o.kind?e:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=a(o);r&&u.select(r)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
@@ -1,51 +0,0 @@
1
- /**
2
- * The pickers' own words (`efficient-easel/strings`, 0.95.0). The row's name
3
- * (`label`) and a theme colour's name are the host's.
4
- *
5
- * A plain module with no import, in the pickers' own folder: they may reach
6
- * nothing else (`tests/pick-leaf-safety.test.ts`), so they do NOT read the
7
- * strings provider. `ColourPicker` takes its group as `words`, and a host
8
- * passes `useEaselStrings().pick.colour`.
9
- */
10
- type PickWords = {
11
- colour: {
12
- /** What the row says while the setting has no colour. */
13
- notSet: string;
14
- /** The swatch's accessible name. `shown` is the hex, the caption or `notSet`. */
15
- swatch: (v: {
16
- label: string;
17
- shown: string;
18
- }) => string;
19
- /** The accessible name of the box the swatch opens. */
20
- dialog: (v: {
21
- label: string;
22
- }) => string;
23
- /** The group of theme colours at the top of that box. */
24
- theme: string;
25
- /** A theme colour's tooltip. */
26
- themeSwatchTitle: (v: {
27
- name: string;
28
- hex: string;
29
- }) => string;
30
- /** A theme colour's accessible name. */
31
- themeSwatch: (v: {
32
- name: string;
33
- hex: string;
34
- }) => string;
35
- /** The square's accessible name. */
36
- square: string;
37
- /** The square's value, read out. Both are percentages: "40%". */
38
- squareValue: (v: {
39
- saturation: string;
40
- brightness: string;
41
- }) => string;
42
- /** The strip's accessible name. */
43
- hue: string;
44
- /** The hex box's accessible name. */
45
- hex: (v: {
46
- label: string;
47
- }) => string;
48
- };
49
- };
50
-
51
- export type { PickWords as P };