efficient-easel 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/dist/{chunk-RG7PFKCA.js → chunk-5LGAIELC.js} +3 -3
- package/dist/chunk-63GQKLJI.js +5 -0
- package/dist/{chunk-O5F46JWM.js → chunk-CG4OPQQX.js} +40 -40
- package/dist/{chunk-QTPJMJOJ.js → chunk-DCPFE4IO.js} +1 -1
- package/dist/{chunk-I64QM6DU.js → chunk-EOUMA3QT.js} +1 -1
- package/dist/{chunk-QFMJBBKM.js → chunk-FODNRCCO.js} +4 -4
- package/dist/chunk-K6ELD7N5.js +23 -0
- package/dist/{chunk-QRKKQGUO.js → chunk-P3GORPR4.js} +1 -1
- package/dist/chunk-PJP46U5L.js +9 -0
- package/dist/{chunk-FER7FCAG.js → chunk-THQB37AA.js} +1 -1
- package/dist/chunk-U4MJQAVH.js +1 -0
- package/dist/{chunk-XWR5YVA7.js → chunk-UFY6RNMT.js} +2 -2
- package/dist/chunk-YNOZ5NXW.js +14 -0
- package/dist/copy/copy.css +16 -1
- package/dist/copy/index.js +31 -31
- package/dist/easel/index.d.ts +1 -1
- package/dist/fields/fields.css +23 -74
- package/dist/fields/index.d.ts +48 -44
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.js +14 -16
- package/dist/panel/panel.css +34 -22
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/text-styles/index.js +33 -33
- package/dist/text-styles/text-styles.css +3 -3
- package/dist/tree/index.js +1 -1
- package/dist/tree/tree.css +9 -10
- package/dist/{types-VqL6t5HH.d.ts → types-DQp_i3dE.d.ts} +6 -2
- package/package.json +3 -3
- package/dist/chunk-4SWZAYKI.js +0 -5
- package/dist/chunk-GXFAQ7JN.js +0 -1
- package/dist/chunk-NLRW4BGG.js +0 -8
- package/dist/chunk-Q27BB5ZC.js +0 -14
- package/dist/chunk-WDXPWSP7.js +0 -24
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import{hexReadout as e,ColourWindow as n,typedHex as t}from"../chunk-FPAVNX3Y.js";import{DEFAULT_TEXT_STYLES_WORDS as s}from"../chunk-M6F6LS3H.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import{FieldSelect as
|
|
2
|
-
/* @__PURE__ */
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
return
|
|
8
|
-
return
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
return
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
return
|
|
19
|
-
return
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
return
|
|
22
|
-
return
|
|
23
|
-
return
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
return
|
|
27
|
-
return
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
return
|
|
31
|
-
return
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
1
|
+
import{hexReadout as e,ColourWindow as n,typedHex as t}from"../chunk-FPAVNX3Y.js";import{DEFAULT_TEXT_STYLES_WORDS as s}from"../chunk-M6F6LS3H.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-M6F6LS3H.js";import"../chunk-ZAOM6PFH.js";import{FieldSelect as a,FieldSlider as i}from"../chunk-PJP46U5L.js";import"../chunk-FPOKPNO4.js";import{useWords as l}from"../chunk-MFIRYGHW.js";import{withTip as r}from"../chunk-P2VEMZH5.js";import{ChevronIcon as o,TrashIcon as d,BoldIcon as c,ItalicIcon as u,CaseLowerIcon as m,CaseUpperIcon as f,CaseNormalIcon as h}from"../chunk-L5KW4HG5.js";import{hsvToHex as p,Tooltip as v,ColorSwatch as g,IconButton as k}from"efficient-shell/ui";import{useState as y,useRef as b,useId as x,useEffect as w,Fragment as S}from"react";import{jsxs as N,jsx as C,Fragment as M}from"react/jsx-runtime";var z=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],O=["font","color","size","weight","lineSpacing","letterSpacing","paragraphSpacing","letterCase"],$=["heading","body"],j=7,A={heading:3,body:5},L={min:5,max:void 0,sliderMin:12,sliderMax:72,step:1,shiftStep:10,unit:"px"},F={size:L,weight:{min:100,max:900,sliderMin:300,sliderMax:900,step:100,shiftStep:100,unit:""},lineSpacing:{min:50,max:250,sliderMin:50,sliderMax:250,step:1,shiftStep:10,unit:"%"},letterSpacing:{min:-10,max:void 0,sliderMin:-5,sliderMax:10,step:.1,shiftStep:1,unit:"px"},paragraphSpacing:{min:0,max:void 0,sliderMin:0,sliderMax:48,step:1,shiftStep:10,unit:"px"},largestSize:L},W=(e,n)=>`${"heading"===e?"Heading":"Body"} ${n}`;function E(e=({kind:e,n:n})=>W(e,n)){return $.flatMap(n=>Array.from({length:A[n]},(t,s)=>({id:`${n}-${s+1}`,kind:n,name:e({kind:n,n:s+1}),values:{}})))}function H(e,n,t=j){return e.filter(e=>e.kind===n).length<t}function P(e,n){const t=new RegExp(`^${n}-([1-9]\\d*)$`).exec(e);return t?Number(t[1]):void 0}function B(e){const n=P(e.id,e.kind);return void 0!==n&&n<=A[e.kind]}function D(e,n,t={}){const{max:s=j,name:a=({kind:e,n:n})=>W(e,n),make:i}=t;if(!H(e,n,s))return null;const l=e.filter(e=>e.kind===n);let r=l.length+1;const o=new Set(e.map(e=>e.name));for(;o.has(a({kind:n,n:r}));)r+=1;const d=new Set(e.map(e=>e.id));let c=Math.max(r,...l.map(e=>(P(e.id,n)??0)+1));for(;d.has(`${n}-${c}`);)c+=1;const u=l.at(-1),m=i?i(n,r):{id:`${n}-${c}`,kind:n,name:a({kind:n,n:r}),values:{...u?.values??{}}},f=u?e.indexOf(u)+1:"heading"===n?0:e.length;return{styles:[...e.slice(0,f),m,...e.slice(f)],added:m}}function I(e,n,t={}){const{name:s=({kind:e,n:n})=>W(e,n)}=t,a=e.find(e=>e.id===n);if(!a||B(a))return null;const i=e.filter(e=>e.kind===a.kind),l=i.indexOf(a),r=/* @__PURE__ */new Map;return i.forEach((e,n)=>{n>l&&e.name===s({kind:e.kind,n:n+1})&&r.set(e,s({kind:e.kind,n:n}))}),{styles:e.filter(e=>e!==a).map(e=>r.has(e)?{...e,name:r.get(e)}:e),removed:a}}function R(e,n){const t=e.find(e=>e.id===n);if(t)return t;for(const t of $){const s=P(n,t);if(void 0===s)continue;let a;for(const n of e){const e=n.kind===t?P(n.id,t):void 0;void 0!==e&&e<s&&(!a||e>a.n)&&(a={n:e,style:n})}return a?.style}}function T(e,n,t){return e.map(e=>{if(e.id!==n)return e;const s={...e.values};for(const[e,n]of Object.entries(t))void 0===n?delete s[e]:s[e]=n;return{...e,values:s}})}function q(e){return Math.min(20,Math.max(12,Math.round(.5*e+6)))}function K(e,n){const t=n.weights;return[t.thin,t.extraLight,t.light,t.regular,t.medium,t.semibold,t.bold,t.extraBold,t.black][Math.min(8,Math.max(0,Math.round(e/100)-1))]}function U(e,n,t,s={}){const a=n.find(n=>n.value===e.font)?.label??e.font??"",i=void 0===e.size?s.autoSize?t.auto:"":t.px({n:e.size});return t.summary({font:a,size:i,weight:K(e.weight??400,t)})}var V=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>p({h:e,s:1,v:1})).join(", ")})`;function Y({value:t,hex:s,colours:a,label:i,followsWord:l,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=y(!1),m=b(null),f=b(null),h=x(),p=void 0!==t&&a.some(e=>e.key===t),k=void 0!==t&&!p;return w(()=>{if(!c)return;const e=m.current?.ownerDocument;if(!e)return;const n=e=>{m.current&&!m.current.contains(e.target)&&u(!1)};return e.addEventListener("click",n,!0),()=>e.removeEventListener("click",n,!0)},[c]),/* @__PURE__ */N("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
|
|
2
|
+
/* @__PURE__ */N("div",{className:"es-ts-top",children:[
|
|
3
|
+
/* @__PURE__ */C("span",{className:"es-ts-sub",children:i}),
|
|
4
|
+
/* @__PURE__ */C("span",{className:"es-ts-colour-read",children:s?e(s):l})]}),
|
|
5
|
+
/* @__PURE__ */N("div",{className:"es-ts-swatches",role:"group","aria-label":i,children:[a.map(n=>/* @__PURE__ */C(v,{content:`${n.name} · ${e(n.value)}`,children:/* @__PURE__ */C(g,{color:n.value,size:"sm",className:"es-ts-swatch","aria-label":n.name,selected:t===n.key,disabled:d,onClick:()=>o(n.key)})},n.key)),
|
|
6
|
+
/* @__PURE__ */C(v,{content:r,children:/* @__PURE__ */C(g,{ref:f,color:V,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:k,"aria-expanded":c,"aria-controls":c?h:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */C(n,{id:h,value:s??"",onChange:e=>o(e),label:i,readOnly:d,onClose:()=>{u(!1),f.current?.focus()}}):null]})}function _({styles:e,onChange:n,fonts:t,colours:a=[],settings:i=O,auto:c=[],fallback:u,sample:m,openId:f,defaultOpenId:h=null,onOpenChange:p,onAdd:v,rowActions:g,onRemove:k,max:M=j,readOnly:A=!1}){const L=l("textStyles",s),F=x(),[W,E]=y(h),P=void 0!==f?f:W,R=e=>{void 0===f&&E(e),p?.(e)},K=new Set(c),V=z.filter(e=>i.includes(e)),Y=b(null),[_,G]=y(null);w(()=>{if(!_||!Y.current)return;const e=[...Y.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===_.id),n=e?e.querySelector(".es-ts-row"):Y.current.querySelector(`.es-ts-add[data-ts-kind="${_.kind}"]`);n?.focus(),G(null)},[_]);/* @__PURE__ */
|
|
7
|
+
return C("div",{className:"es-ts",ref:Y,children:$.map(s=>{const i=e.filter(e=>e.kind===s),l=`${F}-${s}`,c=!H(e,s,M),f=!A&&!c;/* @__PURE__ */
|
|
8
|
+
return N("section",{className:"es-ts-section","aria-labelledby":l,children:[
|
|
9
|
+
/* @__PURE__ */C("div",{className:"es-ts-group",id:l,children:L.groups[s]}),i.map(s=>{const i=P===s.id,l={...u?.(s)??{},...s.values},c=t.find(e=>e.value===l.font),f=`${F}-open-${s.id}`,h=g?.(s),p=null!=h&&!1!==h,v=Boolean(k)&&!A&&!B(s),y={fontFamily:c?.family,fontSize:`${q(l.size??16)}px`,fontWeight:l.weight,fontStyle:l.italic?"italic":void 0};/* @__PURE__ */
|
|
10
|
+
return N(S,{children:[
|
|
11
|
+
/* @__PURE__ */N("div",{className:"es-ts-item","data-ts-id":s.id,children:[
|
|
12
|
+
/* @__PURE__ */N("button",{type:"button",className:"es-ts-row","aria-expanded":i,"aria-controls":i?f:void 0,onClick:()=>R(i?null:s.id),children:[
|
|
13
|
+
/* @__PURE__ */C("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */C(o,{size:12})}),
|
|
14
|
+
/* @__PURE__ */C("span",{className:"es-ts-name",style:y,children:s.name}),
|
|
15
|
+
/* @__PURE__ */C("span",{className:"es-ts-meta",children:U(l,t,L,{autoSize:K.has("size")&&void 0===s.values.size})})]}),v||p?/* @__PURE__ */N("div",{className:"es-ts-actions",children:[v?r(L.remove,/* @__PURE__ */C("button",{type:"button",className:"es-ts-del","aria-label":L.removeNamed({name:s.name}),onClick:()=>(t=>{if(A||!k)return;const s=I(e,t.id,{name:L.styleName});if(!s)return;const a=e.filter(e=>e.kind===t.kind),i=a[a.indexOf(t)+1];P===t.id&&R(null),n(s.styles),k(s.removed),G({id:i?.id??null,kind:t.kind})})(s),children:/* @__PURE__ */C(d,{size:14,"aria-hidden":"true"})})):null,p?h:null]}):null]}),i?/* @__PURE__ */C("div",{className:"es-ts-open",id:f,children:/* @__PURE__ */C(Z,{style:s,values:l,fonts:t,colours:a,settings:V,autoSet:K,sample:m??L.sample,words:L,readOnly:A,set:t=>n(T(e,s.id,t))})}):null]},s.id)}),r(!A&&c?L.full({kind:s,max:M}):void 0,/* @__PURE__ */N("button",{type:"button",className:"es-ts-add","data-ts-kind":s,disabled:A,"aria-disabled":!(A||!c)||void 0,"aria-describedby":!A&&c?`${F}-full-${s}`:void 0,onClick:()=>{f&&(t=>{if(A)return;const s=D(e,t,{max:M,name:L.styleName,make:v});s&&n(s.styles)})(s)},children:[
|
|
16
|
+
/* @__PURE__ */C("span",{className:"es-ts-add-word",children:L.add[s]}),
|
|
17
|
+
/* @__PURE__ */C("span",{className:"es-ts-count",children:L.count({n:i.length,max:M})})]})),A||!c?null:/* @__PURE__ */C("span",{id:`${F}-full-${s}`,className:"es-vh",children:L.full({kind:s,max:M})})]},s)})})}var G={none:h,upper:f,lower:m},X={none:"none",upper:"uppercase",lower:"lowercase"};function Z({style:e,values:n,fonts:s,colours:a,settings:l,autoSet:o,sample:d,words:m,readOnly:f,set:h}){const p=e.values,v=s.find(e=>e.value===n.font),g=function(e,n){return e?n.find(n=>n.key===e)?.value??t(e)??void 0:void 0}(n.color,a),y=e=>"largestSize"===e||o.has(e),b=e=>y(e)?p[e]:n[e],x=b("size"),w=b("lineSpacing"),S=b("letterSpacing"),z=y("letterCase")?p.letterCase:n.letterCase,O={fontFamily:v?.family,fontSize:void 0===x?void 0:`${x}px`,fontWeight:n.weight,fontStyle:n.italic?"italic":void 0,lineHeight:void 0===w?void 0:String(w/100),letterSpacing:void 0===S?void 0:`${S}px`,color:g,textTransform:z?X[z]:void 0},$=e=>{const t=F[e],s=y(e);/* @__PURE__ */
|
|
18
|
+
return C("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */C(i,{label:m.settings[e],value:p[e],onChange:n=>h({[e]:n}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:s?void 0:n[e],auto:s?m.auto:void 0,readOnly:f})},e)};/* @__PURE__ */
|
|
19
|
+
return N(M,{children:[
|
|
20
|
+
/* @__PURE__ */C("div",{className:"es-ts-preview",style:O,"aria-label":m.preview,children:d}),l.map(t=>{switch(t){case"font":/* @__PURE__ */
|
|
21
|
+
return C(J,{value:p.font,fonts:s,words:m,readOnly:f,set:h},t);case"color":/* @__PURE__ */
|
|
22
|
+
return C(Q,{value:p.color,hex:g,colours:a,words:m,readOnly:f,set:h},t);case"emphasis":{const e=(n.weight??400)>=600,s=!1!==v?.italic;/* @__PURE__ */
|
|
23
|
+
return N("div",{className:"es-ts-set","data-ts-setting":t,children:[
|
|
24
|
+
/* @__PURE__ */C("span",{className:"es-ts-sub",children:m.settings.emphasis}),
|
|
25
|
+
/* @__PURE__ */N("div",{className:"es-ts-icons",children:[r(m.bold,/* @__PURE__ */C(k,{className:"es-ts-icon","aria-label":m.bold,"aria-pressed":e,disabled:f,onClick:()=>h({weight:e?400:700}),children:/* @__PURE__ */C(c,{size:16})})),f||s?r(m.italic,/* @__PURE__ */C(k,{className:"es-ts-icon","aria-label":m.italic,"aria-pressed":Boolean(n.italic),disabled:f,onClick:()=>h({italic:!n.italic||void 0}),children:/* @__PURE__ */C(u,{size:16})})):/* @__PURE__ */C(k,{className:"es-ts-icon","aria-label":m.italic,"aria-pressed":Boolean(n.italic),"aria-disabled":!0,disabledReason:m.italicMissing,children:/* @__PURE__ */C(u,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
|
|
26
|
+
return C(ee,{value:p.letterCase??n.letterCase,auto:y("letterCase"),words:m,readOnly:f,set:h},t);case"largestSize":return"heading"===e.kind?$(t):null;default:return $(t)}})]})}function J({value:e,fonts:n,words:t,readOnly:s,set:i}){const l=x();/* @__PURE__ */
|
|
27
|
+
return N("div",{className:"es-ts-set","data-ts-setting":"font",children:[
|
|
28
|
+
/* @__PURE__ */C("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
|
|
29
|
+
/* @__PURE__ */C(a,{value:e,options:n.map(e=>({label:e.label,value:e.value})),onChange:e=>i({font:e}),ariaLabelledBy:l,readOnly:s})]})}function Q({value:e,hex:n,colours:t,words:s,readOnly:a,set:i}){/* @__PURE__ */
|
|
30
|
+
return C(Y,{value:e,hex:n,colours:t,label:s.settings.color,followsWord:s.colour.follows,anyWord:s.colour.any,readOnly:a,onChange:e=>i({color:e})})}function ee({value:e,auto:n,words:t,readOnly:s,set:a}){const i=n?["auto","none","upper","lower"]:["none","upper","lower"],l=e??(n?"auto":"none"),o=b([]),d=e=>a({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
|
|
31
|
+
return N("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
|
|
32
|
+
/* @__PURE__ */C("span",{className:"es-ts-sub",children:t.settings.letterCase}),
|
|
33
|
+
/* @__PURE__ */C("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const n="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!n||s)return;e.preventDefault();const t=(i.indexOf(l)+n+i.length)%i.length;d(i[t]),o.current[t]?.focus()},children:i.map((e,n)=>{const a=e===l;if("auto"===e)return r(t.case.autoTitle,/* @__PURE__ */C(k,{ref:e=>{o.current[n]=e},role:"radio",pressed:a,className:"es-ts-icon es-ts-icon--word","aria-checked":a,"aria-label":t.case.auto,tabIndex:a?0:-1,disabled:s,onClick:()=>d(e),children:t.case.auto},e));const i=G[e];return r(t.case[e],/* @__PURE__ */C(k,{ref:e=>{o.current[n]=e},role:"radio",pressed:a,className:"es-ts-icon","aria-checked":a,"aria-label":t.case[e],tabIndex:a?0:-1,disabled:s,onClick:()=>d(e),children:/* @__PURE__ */C(i,{size:16})},e))})})]})}export{O as CAMPAIGN_TEXT_STYLE_SETTINGS,Y as ColourSwatchRow,A as TEXT_STYLE_DEFAULT_COUNT,$ as TEXT_STYLE_KINDS,j as TEXT_STYLE_MAX,F as TEXT_STYLE_RANGES,z as TEXT_STYLE_SETTINGS,_ as TextStylesList,D as addTextStyle,H as canAddTextStyle,E as defaultTextStyles,U as describeTextStyle,B as isDefaultTextStyle,I as removeTextStyle,R as resolveTextStyle,q as textStyleRowSize,T as updateTextStyle,K as weightWord};
|
|
@@ -234,9 +234,9 @@
|
|
|
234
234
|
flex-wrap: wrap;
|
|
235
235
|
gap: var(--es-space-2, 2px);
|
|
236
236
|
}
|
|
237
|
-
/* An icon is efficient-shell's IconButton
|
|
238
|
-
`
|
|
239
|
-
|
|
237
|
+
/* An icon is efficient-shell's IconButton (harness UI-24): a toggle lit from
|
|
238
|
+
`aria-pressed`, a case radio from `pressed` (it says `aria-checked`). What
|
|
239
|
+
stays is the word button's width. */
|
|
240
240
|
.es-ts-icon--word {
|
|
241
241
|
width: auto;
|
|
242
242
|
padding: 0 var(--es-space-8, 8px);
|
package/dist/tree/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{LayersTree,Subtree,TREE_DRAG_HINT,TreeEmptySlot,TreeGroupLabel,TreeRow,TreeRowAction,TreeSeam}from"../chunk-
|
|
1
|
+
export{LayersTree,Subtree,TREE_DRAG_HINT,TreeEmptySlot,TreeGroupLabel,TreeRow,TreeRowAction,TreeSeam}from"../chunk-UFY6RNMT.js";import"../chunk-K56YDHYQ.js";
|
package/dist/tree/tree.css
CHANGED
|
@@ -8,10 +8,13 @@
|
|
|
8
8
|
*
|
|
9
9
|
* · the scroll box round the tree (the shell's `Tree` does not scroll);
|
|
10
10
|
* · the lift of a row at the instant the browser takes its drag picture;
|
|
11
|
-
* · the size of the marks a row carries after its name, and the rename box
|
|
11
|
+
* · the size of the marks a row carries after its name, and the rename box;
|
|
12
|
+
* · the ground the row actions' scrim is painted over (`--rosh-tree-ground`).
|
|
12
13
|
*
|
|
13
14
|
* The seam, and a draggable row's grip, hint and cursor, are the shell's since
|
|
14
|
-
* efficient-shell 4.165.0 (`TreeSeam`; `TreeRow`'s `draggable` / `dragHint`)
|
|
15
|
+
* efficient-shell 4.165.0 (`TreeSeam`; `TreeRow`'s `draggable` / `dragHint`);
|
|
16
|
+
* the row actions laid over the end of the name, and a row action that is off
|
|
17
|
+
* with a reason, since 4.166.0.
|
|
15
18
|
*
|
|
16
19
|
* Shell tokens only (`--es-*` resolve to them, `--spacing` is the shell's step).
|
|
17
20
|
*/
|
|
@@ -22,6 +25,10 @@
|
|
|
22
25
|
/* LEFT 8 — the inset a rounded row needs. RIGHT 12 — the room a real,
|
|
23
26
|
space-taking scrollbar takes, so nothing at a row's end sits under the thumb. */
|
|
24
27
|
padding: 0 12px 12px 8px;
|
|
28
|
+
/* The row actions lie over the end of the name on a scrim of the row's own
|
|
29
|
+
tone over the PANEL's ground (efficient-shell 4.166.0). The shell assumes
|
|
30
|
+
`--surface`; the tree sits on easel's panel, so it says which. */
|
|
31
|
+
--rosh-tree-ground: var(--es-panel);
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
/* On for the instant the browser takes the drag picture: the row that follows
|
|
@@ -57,11 +64,3 @@
|
|
|
57
64
|
color: inherit;
|
|
58
65
|
outline: none;
|
|
59
66
|
}
|
|
60
|
-
|
|
61
|
-
/* A row action off WITH A REASON (`aria-disabled`, so the keyboard reaches it
|
|
62
|
-
and its Tooltip says why): the shell IconButton's own disabled fade, which
|
|
63
|
-
only `:disabled` draws. SHELL GAP: the kit has no focusable-disabled look. */
|
|
64
|
-
.es-tree-act-off {
|
|
65
|
-
opacity: 0.6;
|
|
66
|
-
cursor: not-allowed;
|
|
67
|
-
}
|
|
@@ -35,8 +35,12 @@ interface FieldNumberProps extends ControlBase {
|
|
|
35
35
|
icon?: ReactNode;
|
|
36
36
|
/** Shown after the number, inside the cell, e.g. `px`. */
|
|
37
37
|
unit?: string;
|
|
38
|
-
/**
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The shell's arrows at the box's end: `true` the side-by-side pair,
|
|
40
|
+
* `'compact'` the two stacked in one 16px column, for a narrow cell
|
|
41
|
+
* (efficient-shell 4.166.0).
|
|
42
|
+
*/
|
|
43
|
+
steppers?: boolean | 'compact';
|
|
40
44
|
placeholder?: string;
|
|
41
45
|
/** The cell's tooltip — the text box's cells say their name and step here
|
|
42
46
|
* (E5b), since the cell draws no name. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -517,7 +517,7 @@
|
|
|
517
517
|
"dist"
|
|
518
518
|
],
|
|
519
519
|
"peerDependencies": {
|
|
520
|
-
"efficient-shell": "^4.
|
|
520
|
+
"efficient-shell": "^4.167.0",
|
|
521
521
|
"react": ">=18",
|
|
522
522
|
"react-dom": ">=18"
|
|
523
523
|
},
|
|
@@ -527,7 +527,7 @@
|
|
|
527
527
|
"@types/node": "^22.0.0",
|
|
528
528
|
"@types/react": "^18.2.0",
|
|
529
529
|
"@types/react-dom": "^18.2.0",
|
|
530
|
-
"efficient-shell": "^4.
|
|
530
|
+
"efficient-shell": "^4.167.0",
|
|
531
531
|
"esbuild": "^0.27.0",
|
|
532
532
|
"jsdom": "^26.1.0",
|
|
533
533
|
"react": "^18.2.0",
|
package/dist/chunk-4SWZAYKI.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as s}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as i}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-QR4DLZ3P.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-QFMJBBKM.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-E2O2MRZR.js";import{useEasel as u}from"./chunk-PYCLHOSA.js";import{useWords as k}from"./chunk-MFIRYGHW.js";import{AddPanel as f}from"./chunk-W3XX2CNW.js";import{AddIcon as h}from"./chunk-L5KW4HG5.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{jsx as g,jsxs as $,Fragment as B}from"react/jsx-runtime";var O=e=>`section:${e}`,v=e=>`block:${e}`,L=e=>`template:${e}`;function x({blocks:x,blocksOnly:H,at:R,onAdd:A,itemFor:C,session:I,siteWide:N,onClose:V,onHide:W,readOnly:D}){const F=u(e=>e.config),M=p(),{labelAtLevel:P,categoryLabel:Q,firstSection:K,Icon:S,Thumbnail:T}=M,{blockIsOffered:Y}=m(),Z=k("screen",d).add,w=l(),[z,E]=y([]);b(()=>{let t=!1;const o=e=>Y(e,w);return i(w).list().then(n=>{if(t)return;const s=F.components;E(n.filter(t=>t.node?.type&&s[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[F,w]);const G=j(()=>t(F,M),[F]),J=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */g(T,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),X=j(()=>{const e=[];if(x&&x.choices.length>0&&a(x.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${Z.inside({name:x.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */g(S,{type:e.type,size:18}),title:Z.tile({name:e.label})}))})}),H)return e;const t=o(G,K);t&&e.push({key:"start",title:Z.startBlank,tiles:[J(t)]}),z.length>0&&e.push({key:"templates",title:Z.templates,tiles:z.map(e=>{return{type:L(e.id),label:e.name,cover:/* @__PURE__ */g(T,{type:e.node.type}),keywords:[(t=e.node.type,P(t,"section",F.components[t]?.label??t)),e.node.type]};var t})});const i=n(G,K);for(const t of Object.keys(F.categories??{})){const o=i.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:s(F,t,Q),tiles:o.map(J)})}return e},[x,H,z,G,F,Z]),q=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=z.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
-
return $(B,{children:[
|
|
3
|
-
/* @__PURE__ */g(r,{icon:/* @__PURE__ */g(h,{size:15}),title:Z.title,context:H?Z.contextBlocks:Z.contextAll,actions:/* @__PURE__ */g(c,{label:Z.done,description:Z.doneDescription,onClick:V}),onHide:W}),
|
|
4
|
-
/* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */g(f,{groups:X,session:I,itemFor:e=>C(q(e)??{kind:"section",type:e}),onInsert:e=>{const t=q(e);t&&A(t)},at:R,hint:H?Z.hintBlocks:Z.hint,searchLabel:H?Z.searchBlocks:Z.searchSections,readOnly:D}),N&&!H?N:null]})]})}export{x as AddSidePanel,v as blockKey,O as sectionKey,L as templateKey};
|
package/dist/chunk-GXFAQ7JN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-QTPJMJOJ.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-QFMJBBKM.js";import{useEasel as p}from"./chunk-PYCLHOSA.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),a?.(t)):i(o=>"part"===o.kind?n:o)},[i,a]);c(()=>{k(l)},[k,l]);const h=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>n);const e=u(o);e&&I.select(e)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
|
package/dist/chunk-NLRW4BGG.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_FIELDS_WORDS as e}from"./chunk-FPOKPNO4.js";import{useWords as l}from"./chunk-MFIRYGHW.js";import{SearchableSelect as a,Select as i,Slider as n}from"efficient-shell/ui";import{jsx as s,jsxs as o}from"react/jsx-runtime";import{useId as r,useRef as t}from"react";function u(e,l){return e.find(e=>Object.is(e.value,l))}var d=e=>String(e);function c(n){const{id:r,options:t,placeholder:u,readOnly:c=!1,ariaLabel:m,ariaLabelledBy:v,searchable:b=!1,searchPlaceholder:h,groupCount:p=!1,renderOption:f}=n,g=l("fields",e),N=v?{"aria-labelledby":v}:m?{"aria-label":m}:{},O=t.some(e=>void 0!==e.thumb),y=O||void 0!==f||t.some(e=>void 0!==e.meta),C=e=>""===e?void 0:t[Number(e)],x=(e,l)=>{const a=C(e.value);return a?/* @__PURE__ */o("span",{className:"es-fsel-row",children:[O?/* @__PURE__ */s("span",{className:"es-fsel-thumb","aria-hidden":"true",children:a.thumb?/* @__PURE__ */s("img",{src:a.thumb,alt:"",loading:"lazy"}):null}):null,
|
|
2
|
-
/* @__PURE__ */s("span",{className:"es-fsel-label",children:f?f(a,{active:l.active??!1,chosen:l.selected}):a.label}),void 0===a.meta||b?null:/* @__PURE__ */s("span",{className:"es-fsel-meta","aria-hidden":"true",children:a.meta})]}):e.label};if(b&&!0!==n.multiple){const l=t.findIndex(e=>Object.is(e.value,n.value)),i=[];t.forEach((e,l)=>{if(e.disabled)return;const a=e.meta??e.group;i.push({value:d(l),label:e.label,...a?{sublabel:a}:{}})});const o=n.onChange;/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(a,{id:r,value:l>=0?d(l):"",options:i,placeholder:h??u??g.search??e.search,disabled:c,renderOption:y?x:void 0,onChange:e=>{const l=C(e);l&&!Object.is(l.value,n.value)&&o(l.value)},...N})})}const j=[];let I=null;if(t.forEach((e,l)=>{const a={value:d(l),label:e.label,...e.disabled?{disabled:!0}:{}};void 0===e.group?(I=null,j.push(a)):I&&I.label===e.group?I.options.push(a):(I={label:e.group,options:[a]},j.push(I))}),p)for(const e of j)"options"in e&&(e.label=`${e.label} ${e.options.length}`);const F={id:r,size:"sm",className:"es-fsel-button",options:j,placeholder:u??g.choose,disabled:c,renderOption:y?x:void 0,...N};if(!0===n.multiple){const e=Array.isArray(n.value)?n.value:[],l=l=>e.some(e=>Object.is(e,l.value)),a=t.flatMap((e,a)=>l(e)?[d(a)]:[]),o=n.onChange;/* @__PURE__ */
|
|
4
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(i,{...F,multiple:!0,value:a,onChange:e=>o(t.filter((l,a)=>e.includes(d(a))).map(e=>e.value))})})}const M=t.findIndex(e=>Object.is(e.value,n.value)),P=n.onChange;/* @__PURE__ */
|
|
5
|
-
return s("div",{className:"es-fsel",children:/* @__PURE__ */s(i,{...F,value:M>=0?d(M):"",onChange:e=>{const l=C(e);l&&!Object.is(l.value,n.value)&&P(l.value)}})})}function m({id:e,label:l,value:a,onChange:i,min:u,max:d,step:c=1,styleValue:m,unit:v,sliderMin:b,sliderMax:h,auto:p,readOnly:f=!1}){const g=r(),N=e??g,O="number"==typeof a&&Number.isFinite(a)?a:void 0,y=void 0!==p&&void 0===O,C=!y&&void 0===O&&void 0!==m,x=Number((b-c).toFixed(6)),j=t(!1),I=e=>{f||e===O||i(e)};/* @__PURE__ */
|
|
6
|
-
return o("div",{className:"es-fslider"+(C||y?" is-style":""),onChangeCapture:e=>{j.current="range"===e.target.type},children:[
|
|
7
|
-
/* @__PURE__ */s("label",{className:"es-fslider-name",htmlFor:N,children:l}),
|
|
8
|
-
/* @__PURE__ */s(n,{id:N,label:l,value:O??null,onChange:e=>{if(null===e)return I(void 0);I(void 0!==p&&j.current&&e<b?void 0:e)},min:void 0!==p?x:b,max:h,inputMin:u??-1e9,inputMax:d??Number.POSITIVE_INFINITY,step:c,suffix:v&&!y?v:void 0,emptyLabel:p??(void 0!==m?String(m):""),disabled:f,size:"sm"})]})}export{c as FieldSelect,m as FieldSlider,u as optionFor};
|
package/dist/chunk-Q27BB5ZC.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_PANEL_WORDS as e}from"./chunk-QTLAVDJE.js";import{SettingsSwitch as a}from"./chunk-QLD57GBB.js";import{Tabs as l,CountBadge as n,Tooltip as i}from"efficient-shell/ui";import{jsx as s,jsxs as r,Fragment as t}from"react/jsx-runtime";import{isValidElement as c,cloneElement as d}from"react";function o(e){const a=e[0];if(!a?.htmlId||!a.htmlId.endsWith(`-tab-${a.id}`))return;const l=a.htmlId.slice(0,-`-tab-${a.id}`.length);return e.every(e=>e.htmlId===`${l}-tab-${e.id}`)?l:void 0}function u({items:a,activeId:c,onSelect:d,ariaLabel:u=e.settings,idPrefix:h,className:m}){
|
|
2
|
-
/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-tabs-fit",children:/* @__PURE__ */s(l,{variant:"pill","aria-label":u,idPrefix:h??o(a),className:m?`es-tabs ${m}`:"es-tabs",value:c,onChange:d,items:a.map(e=>{const a="number"==typeof e.badge&&e.badge>0?/* @__PURE__ */s(n,{count:e.badge,tone:"accent"}):null;return e.icon?{id:e.id,label:/* @__PURE__ */r(t,{children:[
|
|
4
|
-
/* @__PURE__ */r(i,{content:e.label,className:"es-tab-tip",children:[
|
|
5
|
-
/* @__PURE__ */s("span",{className:"es-tab-icon","aria-hidden":"true",children:e.icon}),
|
|
6
|
-
/* @__PURE__ */s("span",{className:"es-tab-word has-icon",children:e.label})]}),a]})}:{id:e.id,label:/* @__PURE__ */r(t,{children:[
|
|
7
|
-
/* @__PURE__ */s("span",{className:"es-tab-word",children:e.label}),a]})}})})})}function h(e){return Array.isArray(e)?e.some(h):c(e)}function m(e,l,n){if(!c(e)||e.type!==a)return e;const i=e.props;return i.ariaLabel||i.ariaLabelledBy?e:d(e,n?{ariaLabelledBy:n}:{ariaLabel:l})}function p({label:e,labelId:a,icon:l,value:n,hint:i,changed:c,htmlFor:d,action:o,children:u,className:p}){const b=h(u),f=h(o);if(!b&&!f)return null;const N=["es-field"];b||N.push("is-inline"),c&&N.push("is-changed"),p&&N.push(p);const g=/* @__PURE__ */r(t,{children:[l?/* @__PURE__ */s("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,
|
|
8
|
-
/* @__PURE__ */s("span",{className:"es-field-label",id:a,children:e})]});/* @__PURE__ */
|
|
9
|
-
return r("div",{className:N.join(" "),children:[
|
|
10
|
-
/* @__PURE__ */r("div",{className:"es-field-head",children:[d?/* @__PURE__ */s("label",{className:"es-field-name",htmlFor:d,children:g}):/* @__PURE__ */s("span",{className:"es-field-name",children:g}),null!=n?/* @__PURE__ */s("span",{className:"es-field-value",children:n}):null,f?m(o,e,a):null]}),b?/* @__PURE__ */s("div",{className:"es-field-ctl",children:u}):null,i?/* @__PURE__ */s("p",{className:"es-field-hint",children:i}):null]})}function b({title:e,open:a,onToggle:l,count:n,id:i,children:t,className:c}){const d=i?`${i}-body`:void 0;/* @__PURE__ */
|
|
11
|
-
return r("div",{className:c?`es-group ${c}`:"es-group",children:[
|
|
12
|
-
/* @__PURE__ */r("button",{type:"button",id:i,"aria-expanded":a,"aria-controls":d,className:"es-group-head",onClick:()=>l(!a),children:[e,"number"==typeof n&&n>0?/* @__PURE__ */s("span",{className:"es-group-count",children:n}):null,
|
|
13
|
-
/* @__PURE__ */s("span",{className:"es-group-sign","aria-hidden":"true"})]}),
|
|
14
|
-
/* @__PURE__ */s("div",{id:d,className:"es-group-body",hidden:!a,children:t})]})}var f=Object.freeze(["Content","Style","Layout","Animation"]);export{f as SETTINGS_BUCKETS,p as SettingsField,b as SettingsGroup,u as SettingsTabs};
|
package/dist/chunk-WDXPWSP7.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import{FieldSelect as e}from"./chunk-NLRW4BGG.js";import{TreeSeam as n}from"./chunk-XWR5YVA7.js";import{SettingsField as l,SETTINGS_BUCKETS as t,SettingsTabs as a,SettingsGroup as r}from"./chunk-Q27BB5ZC.js";import{DEFAULT_TREE_WORDS as i}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as o}from"./chunk-QTLAVDJE.js";import{EaselMenuItems as s}from"./chunk-EA2HTX37.js";import{FieldNumber as c}from"./chunk-7SQF6LZL.js";import{SettingsSegmented as u}from"./chunk-QLD57GBB.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-FPOKPNO4.js";import{useWords as m}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as h}from"./chunk-67GNT6PF.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{ChevronIcon as f,LockIcon as g,MoveUpIcon as v,MoveDownIcon as y,DuplicateIcon as x,TrashIcon as k}from"./chunk-L5KW4HG5.js";import{Textarea as w,Input as N,ContextMenu as O,tabPanelId as C,tabButtonId as j,SearchableSelect as S,Select as D}from"efficient-shell/ui";import{useRef as I,useState as $,useLayoutEffect as F,useId as L}from"react";import{jsx as P,jsxs as A}from"react/jsx-runtime";function T({id:e,value:n,onChange:l,placeholder:t,multiline:a=!1,rows:r=3,readOnly:i=!1,ariaLabel:o,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */P(w,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:t,readOnly:i,"aria-label":o,"aria-labelledby":s,onChange:e=>l(e.target.value)}):/* @__PURE__ */P(N,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:t,readOnly:i,"aria-label":o,"aria-labelledby":s,onChange:e=>l(e.target.value)})}function E(e,n,l){const t=e.slice();return t.splice(Math.max(0,Math.min(n,t.length)),0,l),t}function M(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 z(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 B='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',H={parentId:"list",slot:"items"};function G({label:e,icon:l,noun:t,items:a,onChange:r,newItem:o,summary:c,itemName:u,thumb:w,min:N=0,max:C,readOnly:j=!1,open:S,onOpen:D,renderItem:L,renderRow:T,canRemove:G,lockedReason:K,fixed:Q=!1,removeOnRow:W=!0,canDuplicate:Y,above:V,head:q=!0}){const J=m("fields",d).list,X=m("tree",i),Z=t??J.item,U=!j&&!Q&&("number"!=typeof C||a.length<C),_=a.length<=N,ee=e=>!!G&&!G(a[e],e),ne=e=>!j&&!Q&&W&&!_&&!ee(e),le=e=>U&&(!Y||Y(a[e],e)),te=(e,n)=>u?u(e,n):J.itemName({noun:Z,n:n+1}),ae=I([]),re=I(null),[ie,oe]=$(null),se=I(null),[ce,ue]=$(null),[de,me]=$("");F(()=>{for(const e of ae.current){if(!e)continue;null!==e.querySelector(B)||j?e.removeAttribute("tabindex"):e.tabIndex=0}}),F(()=>{const e=re.current;if(!e)return;re.current=null;const n=ae.current[e.index]?.querySelectorAll(B)[e.nth]??ae.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const pe=(e,n)=>{if(n<0||n>=a.length||n===e)return;const l=ae.current[e],t=l?.ownerDocument.activeElement;if(l&&t&&l.contains(t)){const e=[...l.querySelectorAll(B)].indexOf(t),a=t;re.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}r(M(a,e,n));const i=function(e,n,l){return null===e?null:e===n?l:n<e&&l>=e?e-1:n>e&&l<=e?e+1:e}(S,e,n);i!==S&&D(i),me(J.moved({n:n+1,total:a.length}))},he=e=>{U&&(r(E(a,e,o())),T?(re.current={index:e,nth:0,start:null,end:null},null!==S&&S>=e&&D(S+1)):D(e))},be=e=>{ne(e)&&(r(z(a,e)),S===e?D(null):null!==S&&S>e&&D(S-1))},fe=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===H.parentId&&n.slot===H.slot,onDrop:(e,n)=>{const l=h({...H,index:e},n);l!==e&&pe(e,l)},onStep:(e,n)=>pe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<a.length,readOnly:j}),ge=e=>{const n=[];return e>0&&n.push({label:J.moveUp,icon:/* @__PURE__ */P(v,{size:14}),shortcut:"⌥↑",onClick:()=>pe(e,e-1)}),e<a.length-1&&n.push({label:J.moveDown,icon:/* @__PURE__ */P(y,{size:14}),shortcut:"⌥↓",onClick:()=>pe(e,e+1)}),le(e)&&n.push({label:J.duplicate,icon:/* @__PURE__ */P(x,{size:14}),onClick:()=>(e=>{le(e)&&(r(E(a,e+1,R(a[e]))),null!==S&&S>e&&D(S+1))})(e)}),ne(e)&&n.push({label:J.delete,icon:/* @__PURE__ */P(k,{size:14}),danger:!0,onClick:()=>be(e)}),n},ve=(e,n,l,t)=>{j||0===ge(e).length||ue({index:e,x:n,y:l,owner:t})},ye=e=>n=>{const l=a.slice();l[e]=n,r(l)};/* @__PURE__ */
|
|
2
|
-
return A("div",{className:"es-list",children:[q?/* @__PURE__ */A("div",{className:"es-list-head",children:[
|
|
3
|
-
/* @__PURE__ */A("span",{className:"es-list-label",children:[l?/* @__PURE__ */P("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,e]}),
|
|
4
|
-
/* @__PURE__ */P("span",{className:"es-list-count",children:a.length})]}):null,V?/* @__PURE__ */P("div",{className:"es-list-above",children:V}):null,a.length?/* @__PURE__ */A("div",{className:"es-list-rows",...fe.rootProps(),children:[a.map((e,l)=>{const t=fe.row({item:l,place:{...H,index:l}}),a=t.draggable&&ie!==l,r=!T&&S===l,i=!j&&!Q&&W&&ee(l),o=["es-list-row",T?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
5
|
-
return A("div",{className:"es-list-entry",children:[l>0?/* @__PURE__ */P("div",{className:"es-list-gap",children:/* @__PURE__ */P(n,{...fe.seam({place:{...H,index:l}}),onAdd:U?()=>he(l):void 0,label:J.addHere({noun:Z})})}):null,
|
|
6
|
-
/* @__PURE__ */A("div",{...t.rowProps,ref:e=>{ae.current[l]=e},className:o,draggable:a||void 0,"aria-keyshortcuts":t.draggable?"Alt+ArrowUp Alt+ArrowDown":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,se.current=n&&!a?n:null,oe(a?l:null)},onDragStart:e=>{const n=se.current;se.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{j||(e.preventDefault(),e.stopPropagation(),ve(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 ve(l,a.left+24,a.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)},children:[a?/* @__PURE__ */P("span",{className:"es-list-hint","aria-hidden":"true",children:X.dragHint}):null,T?/* @__PURE__ */P("div",{className:"es-list-row-main",children:T(e,l,ye(l))}):/* @__PURE__ */A("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>D(r?null:l),children:[w?/* @__PURE__ */P("span",{className:"es-list-thumb","aria-hidden":"true",children:w(e,l)}):null,
|
|
7
|
-
/* @__PURE__ */P("span",{className:"es-list-row-name",children:te(e,l)}),/* @__PURE__ */P("span",c?{className:"es-list-row-summary",children:c(e,l)}:{className:"es-list-row-summary"}),
|
|
8
|
-
/* @__PURE__ */P(f,{size:14,className:"es-list-chev","aria-hidden":"true"})]}),j||Q||!W?null:i?b(K?K(e,l):J.locked,/* @__PURE__ */P("span",{className:"es-list-lock",role:"img","aria-label":K?K(e,l):J.locked,children:/* @__PURE__ */P(g,{size:13})})):b(J.deleteItem({noun:Z}),/* @__PURE__ */P("button",{type:"button",className:"es-list-x","aria-label":J.deleteItem({noun:Z}),disabled:!ne(l),onClick:()=>be(l),children:"×"}))]}),r?/* @__PURE__ */P("div",{className:"es-list-item",children:L(e,l,ye(l))}):null]},l)}),
|
|
9
|
-
/* @__PURE__ */P("div",{className:"es-list-gap",children:/* @__PURE__ */P(n,{...fe.seam({place:{...H,index:a.length}})})})]}):null,j||Q?null:/* @__PURE__ */P("button",{type:"button",className:"es-list-add",disabled:!U,onClick:()=>he(a.length),children:J.add({noun:Z})}),
|
|
10
|
-
/* @__PURE__ */P("span",{className:"es-list-said","aria-live":"polite",children:de}),ce&&ce.index<a.length?
|
|
11
|
-
/* @__PURE__ */P(O,{at:{x:ce.x,y:ce.y},owner:ce.owner,onClose:()=>ue(null),children:/* @__PURE__ */P(s,{items:ge(ce.index),onClose:()=>ue(null)})}):null]})}var K=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function Q({field:e,name:n,id:l,value:t,onChange:a,readOnly:i,context:o,renderers:s}){const[c,u]=$(!0),d=t&&"object"==typeof t?t:{};/* @__PURE__ */
|
|
12
|
-
return P(r,{id:`${l}-group`,title:K(e,n),open:c,onToggle:u,children:Object.entries(e.objectFields).map(([e,t])=>/* @__PURE__ */P(Y,{field:t,name:`${n}.${e}`,id:`${l}-${e}`,value:d[e],onChange:n=>a({...d,[e]:n}),readOnly:i,context:o,renderers:s},e))})}function W({field:e,name:n,id:l,value:t,onChange:a,readOnly:r,context:i,renderers:o,openItem:s,onOpenItem:c}){const[u,d]=$(null),m=c?s??null:u,p=c??d,h=Array.isArray(t)?t:[],b=e.getItemSummary;/* @__PURE__ */
|
|
13
|
-
return P(G,{label:K(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:h,onChange:a,newItem:()=>R({...e.defaultItemProps??{}}),summary:b?(e,n)=>b(e,n):void 0,min:e.min,max:e.max,readOnly:r,open:m,onOpen:p,renderItem:(t,a,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */P(Y,{field:c,name:`${n}[${a}].${e}`,id:`${l}-${a}-${e}`,value:t?.[e],onChange:n=>s({...t,[e]:n}),readOnly:r,context:i,renderers:o},e))})}function Y(n){const{field:t,name:a,id:r,value:i,onChange:o,readOnly:s,context:d,renderers:m}=n;if(!t||t.marker||!1===t.visible)return null;const p=m?.[t.type];if(p)return p({field:t,name:a,id:r,value:i,onChange:o,readOnly:s});switch(t.type){case"custom":{const e={...d,field:t,name:a,id:r,value:i,onChange:o,readOnly:s};return t.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
14
|
-
return P(l,{label:K(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */P(T,{id:r,value:"string"==typeof i?i:null==i?"":String(i),onChange:o,placeholder:t.placeholder,multiline:"textarea"===t.type,readOnly:s})});case"number":/* @__PURE__ */
|
|
15
|
-
return P(l,{label:K(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */P(c,{id:r,value:"number"==typeof i?i:void 0,onChange:o,min:t.min,max:t.max,step:t.step,placeholder:t.placeholder,readOnly:s})});case"select":{const n=`${r}-label`;/* @__PURE__ */
|
|
16
|
-
return P(l,{label:K(t,a),labelId:n,htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */P(e,{id:r,value:i,options:t.options,onChange:o,readOnly:s,ariaLabelledBy:n})})}case"radio":/* @__PURE__ */
|
|
17
|
-
return P(l,{label:K(t,a),icon:t.icon,hint:t.hint,children:/* @__PURE__ */P(u,{ariaLabel:K(t,a),value:i,options:t.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||s})),onChange:e=>{s||o(e)}})});case"object":/* @__PURE__ */
|
|
18
|
-
return P(Q,{...n,field:t});case"array":/* @__PURE__ */
|
|
19
|
-
return P(W,{...n,field:t});case"slot":return null}}var V=e=>t.includes(e);function q(e){let n=t[0];const l=[],a=/* @__PURE__ */new Set;for(const[t,r]of Object.entries(e))r&&(V(r.bucket)&&(n=r.bucket),r.marker||!1===r.visible||(l.push({name:t,field:r,bucket:n}),"slot"!==r.type&&a.add(n)));return{rows:l,buckets:t.filter(e=>a.has(e))}}function J(e){return new Map(q(e).rows.map(e=>[e.name,e.bucket]))}function X({fields:e,values:n,onChange:l,readOnly:t=!1,context:r,tab:i,onTab:s,tabs:c=!0,tabIcons:u,renderers:d,idPrefix:p,ariaLabel:h,children:b}){const f=m("panel",o),g=L(),v=p??`es-insp${g.replace(/:/g,"")}`,y=q(e),[x,k]=$(void 0),w=i??x,N=w&&y.buckets.includes(w)?w:y.buckets[0],[O,S]=$(null),D=O&&O.panel===v&&y.rows.some(e=>e.name===O.name)?O:null,I=c&&y.buckets.length>1,F=I&&N?C(v,N):`${v}-rows`;/* @__PURE__ */
|
|
20
|
-
return A("div",{className:"es-insp",children:[I?/* @__PURE__ */P("div",{className:"es-insp-tabs",children:/* @__PURE__ */P(a,{ariaLabel:h??f.settings,activeId:N,onSelect:e=>{const n=e;void 0===i&&k(n),s?.(n)},items:y.buckets.map(e=>({id:e,label:f.buckets[e],icon:u?.[e]})),idPrefix:v})}):null,
|
|
21
|
-
/* @__PURE__ */A("div",{className:"es-insp-rows",id:F,role:I?"tabpanel":void 0,"aria-labelledby":I&&N?j(v,N):void 0,children:[y.rows.map(({name:e,field:a,bucket:i})=>/* @__PURE__ */P("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!(!I||i===N)||void 0,children:/* @__PURE__ */P(Y,{field:a,name:e,id:`${v}-${e}`,value:n[e],onChange:n=>l(e,n),readOnly:t,context:r,renderers:d,openItem:D&&D.name===e?D.index:null,onOpenItem:n=>S(null===n?null:{panel:v,name:e,index:n})})},e)),b]})]})}function Z(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}function U({value:e,onChange:n,kinds:l,rules:t,filtersFor:a,label:r,readOnly:i}){const o=m("fields",d).link??d.link,[s,c]=$(null),[u,p]=$(null),h=s&&s.against===e?s.kind:t.kindOf(e),b=l.filter(e=>!e.hideWhenEmpty||Z(e.target).length>0||e.value===h),f=b.find(e=>"text"===e.target.type),g=b.find(e=>e.value===h)??f??b[0];if(!g)return null;const v="text"!==g.target.type,y=v?t.targetOf(e):e,x=Z(g.target),k=x.find(e=>e.value===y),w=e=>({value:e,label:o.unavailable({value:e})}),O="select"===g.target.type&&y&&a?a(y):null,C=O?t.readFilter(e):null,j=C?O?.find(e=>e.param===C.param):void 0,I=u&&u.against===e?u.text:e,F=!v&&""!==I.trim()&&!t.isSafe(I),L=(e,l)=>{c(n=>n?{...n,against:e}:n),void 0===l?n(e):n(e,l)},T=e=>{if(!e)return L("");const n=x.find(n=>n.value===e);L(e,n?.label)},E=(e,n)=>n&&!e.some(e=>e.value===n)?[w(n),...e]:[...e],M=(e,n,l,t,a)=>{if(a){const a=l.map(e=>({value:e.value,label:e.label,...e.group?{sublabel:e.group}:{}}));/* @__PURE__ */
|
|
22
|
-
return P(S,{"aria-label":e,value:n,options:a,disabled:i,placeholder:l.find(e=>""===e.value)?.label,onChange:e=>""!==e||l.some(e=>""===e.value)?t(e):void 0})}const r=[];for(const e of l){const n=r[r.length-1],l={value:e.value,label:e.label};e.group?n&&"options"in n&&n.label===e.group?n.options.push(l):r.push({label:e.group,options:[l]}):r.push(l)}/* @__PURE__ */
|
|
23
|
-
return P(D,{size:"sm","aria-label":e,value:n,options:r,disabled:i,onChange:t})};let z;if("text"===g.target.type)z=/* @__PURE__ */P(N,{size:"sm",type:"text",className:"es-fin",invalid:F,"aria-label":o.address,placeholder:o.addressPlaceholder,value:I,readOnly:i,onChange:n=>(n=>{const l=n.trim();l?t.isSafe(n)?(p({text:n,against:l}),L(l)):p({text:n,against:e}):(p({text:n,against:""}),L(""))})(n.target.value)});else{const e="groups"===g.target.type?g.target.groups.flatMap(e=>e.options.map(n=>({value:n.value,label:n.label,group:e.label}))):g.target.options.map(e=>({value:e.value,label:e.label})),n=[{value:"",label:g.target.placeholder},...E(e,y)];z=M(g.label,y,n,T,e.length>10)}/* @__PURE__ */
|
|
24
|
-
return A("div",{className:"es-flink",role:r?"group":void 0,"aria-label":r,children:[M(o.linkType,g.value,b.map(e=>({value:e.value,label:e.label})),l=>{p(null);const t=b.find(e=>e.value===l);if(!t||"text"===t.target.type)return void c({kind:l,against:e});const a=Z(t.target)[0];c({kind:l,against:a?a.value:""}),a?n(a.value,a.label):n("")},!1),z,O&&M(o.filter,C?.param??"",[{value:"",label:o.noFilter},...C&&!j?[w(C.param)]:[],...O.map(e=>({value:e.param,label:e.label}))],e=>{if(!e)return L(y,k?.label);const n=O?.find(n=>n.param===e),l=n?.values[0];l&&L(t.withFilter(y,{param:e,value:l.value}),l.label)},!1),O&&C&&M(o.value,C.value,E((j?.values??[]).map(e=>({value:e.value,label:e.label})),C.value),e=>{if(!C)return;const n=j?.values.find(n=>n.value===e);L(t.withFilter(y,{param:C.param,value:e}),n?.label)},(j?.values.length??0)>10),F&&/* @__PURE__ */P("p",{className:"es-flink-error",role:"alert",children:o.unsafe}),g.hint&&/* @__PURE__ */P("p",{className:"es-flink-hint",children:g.hint}),O&&/* @__PURE__ */P("p",{className:"es-flink-hint",children:o.filterHint})]})}export{T as FieldText,X as Inspector,Y as InspectorField,U as LinkPicker,G as ListField,J as bucketsOf,R as copyItem,E as insertAt,K as labelOf,M as moveTo,q as planFields,z as removeAt};
|