efficient-easel 10.0.0 → 10.2.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 +6 -0
- package/dist/canvas-typing-CJodefPO.d.ts +478 -0
- package/dist/{chunk-OWW44DVK.js → chunk-74ZFATLG.js} +1 -1
- package/dist/{chunk-LGDQLTJW.js → chunk-7O6MDCDU.js} +3 -3
- package/dist/{chunk-U5RF4USK.js → chunk-A5OEGP7B.js} +4 -4
- package/dist/{chunk-K2YSFVOJ.js → chunk-ERA3XM2U.js} +1 -1
- package/dist/{chunk-BPLCMQ6S.js → chunk-FJ3ZJJ5Z.js} +45 -45
- package/dist/chunk-ICN6COBK.js +5 -0
- package/dist/{chunk-WQASXLXS.js → chunk-IL6QCPO6.js} +1 -1
- package/dist/{chunk-GKGBKSZ7.js → chunk-IZ2QRXSE.js} +1 -1
- package/dist/{chunk-XF2AIO46.js → chunk-JSPZU7X2.js} +1 -1
- package/dist/{chunk-K5744MTM.js → chunk-M32O2WRM.js} +10 -10
- package/dist/{chunk-M6F6LS3H.js → chunk-OGH6CC3E.js} +1 -1
- package/dist/{chunk-XO7OUCZV.js → chunk-OWK7DGWG.js} +1 -1
- package/dist/{chunk-4CE7XFCE.js → chunk-TROOTMAD.js} +1 -1
- package/dist/{chunk-2AKW6UXX.js → chunk-YMEN4KVE.js} +1 -1
- package/dist/copy/index.d.ts +20 -399
- package/dist/copy/index.js +17 -15
- package/dist/easel/index.d.ts +19 -2
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.d.ts +2 -2
- 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 +15 -15
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.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/strings/catalogue.d.ts +1 -1
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.d.ts +3 -3
- package/dist/text-styles/index.js +33 -33
- package/dist/{types-C97TAUKi.d.ts → types-Dkx1VAIQ.d.ts} +1 -1
- package/dist/{words-CRYvAiHX.d.ts → words-gIDCeRv3.d.ts} +1 -0
- package/package.json +1 -1
- package/dist/canvas-typing-Cnvlsh_V.d.ts +0 -69
- package/dist/chunk-XTDBTCVO.js +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { T as TextStylesWords } from '../words-
|
|
4
|
-
export { D as DEFAULT_TEXT_STYLES_WORDS } from '../words-
|
|
3
|
+
import { T as TextStylesWords } from '../words-gIDCeRv3.js';
|
|
4
|
+
export { D as DEFAULT_TEXT_STYLES_WORDS } from '../words-gIDCeRv3.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The text styles as data (plan step E6): what a style is, the list both
|
|
@@ -17,7 +17,7 @@ export { D as DEFAULT_TEXT_STYLES_WORDS } from '../words-CRYvAiHX.js';
|
|
|
17
17
|
|
|
18
18
|
type TextStyleKind = 'heading' | 'body';
|
|
19
19
|
/** As typed · Uppercase · Lowercase. No value = Auto where the host offers it, As typed where not. */
|
|
20
|
-
type TextStyleCase = 'none' | 'upper' | 'lower';
|
|
20
|
+
type TextStyleCase = 'none' | 'upper' | 'capitalize' | 'lower';
|
|
21
21
|
/**
|
|
22
22
|
* One style's own settings. A missing key has nothing of its own: it is Auto
|
|
23
23
|
* where the host offers Auto for that setting, and otherwise shows the host's
|
|
@@ -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-
|
|
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-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-ZAOM6PFH.js";import{FieldSlider as i}from"../chunk-XWFH2NHZ.js";import{FieldSelect as a}from"../chunk-65Z5FSAW.js";import"../chunk-FFYXVAAL.js";import{useWords as l}from"../chunk-MFIRYGHW.js";import{withTip as r}from"../chunk-P2VEMZH5.js";import{hsvToHex as o,Tooltip as d,ColorSwatch as c,IconButton as u}from"efficient-shell/ui";import{useState as m,useRef as f,useId as h,useEffect as p,Fragment as v}from"react";import{ChevronIcon as g,TrashIcon as k,BoldIcon as y,ItalicIcon as b,CaseLowerIcon as x,CaseCapitalizedIcon as w,CaseUpperIcon as N,CaseNormalIcon as S}from"efficient-shell/icons/efficient";import{jsxs as C,jsx as z,Fragment as M}from"react/jsx-runtime";var O=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],$=["font","color","size","weight","lineSpacing","letterSpacing","paragraphSpacing","letterCase"],A=["heading","body"],j=7,F={heading:3,body:5},E={min:5,max:void 0,sliderMin:12,sliderMax:72,step:1,shiftStep:10,unit:"px"},W={size:E,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:E},H=(e,n)=>`${"heading"===e?"Heading":"Body"} ${n}`;function L(e=({kind:e,n:n})=>H(e,n)){return A.flatMap(n=>Array.from({length:F[n]},(t,s)=>({id:`${n}-${s+1}`,kind:n,name:e({kind:n,n:s+1}),values:{}})))}function B(e,n,t=j){return e.filter(e=>e.kind===n).length<t}function D(e,n){const t=new RegExp(`^${n}-([1-9]\\d*)$`).exec(e);return t?Number(t[1]):void 0}function I(e){const n=D(e.id,e.kind);return void 0!==n&&n<=F[e.kind]}function R(e,n,t={}){const{max:s=j,name:i=({kind:e,n:n})=>H(e,n),make:a}=t;if(!B(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(i({kind:n,n:r}));)r+=1;const d=new Set(e.map(e=>e.id));let c=Math.max(r,...l.map(e=>(D(e.id,n)??0)+1));for(;d.has(`${n}-${c}`);)c+=1;const u=l.at(-1),m=a?a(n,r):{id:`${n}-${c}`,kind:n,name:i({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 T(e,n,t={}){const{name:s=({kind:e,n:n})=>H(e,n)}=t,i=e.find(e=>e.id===n);if(!i||I(i))return null;const a=e.filter(e=>e.kind===i.kind),l=a.indexOf(i),r=/* @__PURE__ */new Map;return a.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!==i).map(e=>r.has(e)?{...e,name:r.get(e)}:e),removed:i}}function V(e,n){const t=e.find(e=>e.id===n);if(t)return t;for(const t of A){const s=D(n,t);if(void 0===s)continue;let i;for(const n of e){const e=n.kind===t?D(n.id,t):void 0;void 0!==e&&e<s&&(!i||e>i.n)&&(i={n:e,style:n})}return i?.style}}function X(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 Y(e){return Math.min(20,Math.max(12,Math.round(.5*e+6)))}function Z(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 q(e,n,t,s={}){const i=n.find(n=>n.value===e.font)?.label??e.font??"",a=void 0===e.size?s.autoSize?t.auto:"":t.px({n:e.size});return t.summary({font:i,size:a,weight:Z(e.weight??400,t)})}var G=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>o({h:e,s:1,v:1})).join(", ")})`;function P({value:t,hex:s,colours:i,label:a,followsWord:l,anyWord:r,onChange:o,readOnly:u=!1}){const[v,g]=m(!1),k=f(null),y=f(null),b=h(),x=void 0!==t&&i.some(e=>e.key===t),w=void 0!==t&&!x;return p(()=>{if(!v)return;const e=k.current?.ownerDocument;if(!e)return;const n=e=>{k.current&&!k.current.contains(e.target)&&g(!1)};return e.addEventListener("click",n,!0),()=>e.removeEventListener("click",n,!0)},[v]),/* @__PURE__ */C("div",{ref:k,className:"es-ts-set","data-ts-setting":"color",children:[
|
|
2
|
+
/* @__PURE__ */C("div",{className:"es-ts-top",children:[
|
|
3
|
+
/* @__PURE__ */z("span",{className:"es-ts-sub",children:a}),
|
|
4
|
+
/* @__PURE__ */z("span",{className:"es-ts-colour-read",children:s?e(s):l})]}),
|
|
5
|
+
/* @__PURE__ */C("div",{className:"es-ts-swatches",role:"group","aria-label":a,children:[i.map(n=>/* @__PURE__ */z(d,{content:`${n.name} · ${e(n.value)}`,children:/* @__PURE__ */z(c,{color:n.value,size:"sm",className:"es-ts-swatch","aria-label":n.name,selected:t===n.key,disabled:u,onClick:()=>o(n.key)})},n.key)),
|
|
6
|
+
/* @__PURE__ */z(d,{content:r,children:/* @__PURE__ */z(c,{ref:y,color:G,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:w,"aria-expanded":v,"aria-controls":v?b:void 0,disabled:u,onClick:()=>g(e=>!e)})})]}),v?/* @__PURE__ */z(n,{id:b,value:s??"",onChange:e=>o(e),label:a,readOnly:u,onClose:()=>{g(!1),y.current?.focus()}}):null]})}function _({styles:e,onChange:n,fonts:t,colours:i=[],settings:a=$,auto:o=[],fallback:d,sample:c,openId:u,defaultOpenId:y=null,onOpenChange:b,onAdd:x,rowActions:w,onRemove:N,max:S=j,readOnly:M=!1}){const F=l("textStyles",s),E=h(),[W,H]=m(y),L=void 0!==u?u:W,D=e=>{void 0===u&&H(e),b?.(e)},V=new Set(o),Z=O.filter(e=>a.includes(e)),G=f(null),[P,_]=m(null);p(()=>{if(!P||!G.current)return;const e=[...G.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===P.id),n=e?e.querySelector(".es-ts-row"):G.current.querySelector(`.es-ts-add[data-ts-kind="${P.kind}"]`);n?.focus(),_(null)},[P]);/* @__PURE__ */
|
|
7
|
+
return z("div",{className:"es-ts",ref:G,children:A.map(s=>{const a=e.filter(e=>e.kind===s),l=`${E}-${s}`,o=!B(e,s,S),u=!M&&!o;/* @__PURE__ */
|
|
8
|
+
return C("section",{className:"es-ts-section","aria-labelledby":l,children:[
|
|
9
|
+
/* @__PURE__ */z("div",{className:"es-ts-group",id:l,children:F.groups[s]}),a.map(s=>{const a=L===s.id,l={...d?.(s)??{},...s.values},o=t.find(e=>e.value===l.font),u=`${E}-open-${s.id}`,m=w?.(s),f=null!=m&&!1!==m,h=Boolean(N)&&!M&&!I(s),p={fontFamily:o?.family,fontSize:`${Y(l.size??16)}px`,fontWeight:l.weight,fontStyle:l.italic?"italic":void 0};/* @__PURE__ */
|
|
10
|
+
return C(v,{children:[
|
|
11
|
+
/* @__PURE__ */C("div",{className:"es-ts-item","data-ts-id":s.id,children:[
|
|
12
|
+
/* @__PURE__ */C("button",{type:"button",className:"es-ts-row","aria-expanded":a,"aria-controls":a?u:void 0,onClick:()=>D(a?null:s.id),children:[
|
|
13
|
+
/* @__PURE__ */z("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */z(g,{size:12})}),
|
|
14
|
+
/* @__PURE__ */z("span",{className:"es-ts-name",style:p,children:s.name}),
|
|
15
|
+
/* @__PURE__ */z("span",{className:"es-ts-meta",children:q(l,t,F,{autoSize:V.has("size")&&void 0===s.values.size})})]}),h||f?/* @__PURE__ */C("div",{className:"es-ts-actions",children:[h?r(F.remove,/* @__PURE__ */z("button",{type:"button",className:"es-ts-del","aria-label":F.removeNamed({name:s.name}),onClick:()=>(t=>{if(M||!N)return;const s=T(e,t.id,{name:F.styleName});if(!s)return;const i=e.filter(e=>e.kind===t.kind),a=i[i.indexOf(t)+1];L===t.id&&D(null),n(s.styles),N(s.removed),_({id:a?.id??null,kind:t.kind})})(s),children:/* @__PURE__ */z(k,{size:14,"aria-hidden":"true"})})):null,f?m:null]}):null]}),a?/* @__PURE__ */z("div",{className:"es-ts-open",id:u,children:/* @__PURE__ */z(J,{style:s,values:l,fonts:t,colours:i,settings:Z,autoSet:V,sample:c??F.sample,words:F,readOnly:M,set:t=>n(X(e,s.id,t))})}):null]},s.id)}),r(!M&&o?F.full({kind:s,max:S}):void 0,/* @__PURE__ */C("button",{type:"button",className:"es-ts-add","data-ts-kind":s,disabled:M,"aria-disabled":!(M||!o)||void 0,"aria-describedby":!M&&o?`${E}-full-${s}`:void 0,onClick:()=>{u&&(t=>{if(M)return;const s=R(e,t,{max:S,name:F.styleName,make:x});s&&n(s.styles)})(s)},children:[
|
|
16
|
+
/* @__PURE__ */z("span",{className:"es-ts-add-word",children:F.add[s]}),
|
|
17
|
+
/* @__PURE__ */z("span",{className:"es-ts-count",children:F.count({n:a.length,max:S})})]})),M||!o?null:/* @__PURE__ */z("span",{id:`${E}-full-${s}`,className:"es-vh",children:F.full({kind:s,max:S})})]},s)})})}var U={none:S,upper:N,capitalize:w,lower:x},K={none:"none",upper:"uppercase",capitalize:"capitalize",lower:"lowercase"};function J({style:e,values:n,fonts:s,colours:a,settings:l,autoSet:o,sample:d,words:c,readOnly:m,set:f}){const h=e.values,p=s.find(e=>e.value===n.font),v=function(e,n){return e?n.find(n=>n.key===e)?.value??t(e)??void 0:void 0}(n.color,a),g=e=>"largestSize"===e||o.has(e),k=e=>g(e)?h[e]:n[e],x=k("size"),w=k("lineSpacing"),N=k("letterSpacing"),S=g("letterCase")?h.letterCase:n.letterCase,O={fontFamily:p?.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===N?void 0:`${N}px`,color:v,textTransform:S?K[S]:void 0},$=e=>{const t=W[e],s=g(e);/* @__PURE__ */
|
|
18
|
+
return z("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */z(i,{label:c.settings[e],value:h[e],onChange:n=>f({[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?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
|
|
19
|
+
return C(M,{children:[
|
|
20
|
+
/* @__PURE__ */z("div",{className:"es-ts-preview",style:O,"aria-label":c.preview,children:d}),l.map(t=>{switch(t){case"font":/* @__PURE__ */
|
|
21
|
+
return z(Q,{value:h.font,fonts:s,words:c,readOnly:m,set:f},t);case"color":/* @__PURE__ */
|
|
22
|
+
return z(ee,{value:h.color,hex:v,colours:a,words:c,readOnly:m,set:f},t);case"emphasis":{const e=(n.weight??400)>=600,s=!1!==p?.italic;/* @__PURE__ */
|
|
23
|
+
return C("div",{className:"es-ts-set","data-ts-setting":t,children:[
|
|
24
|
+
/* @__PURE__ */z("span",{className:"es-ts-sub",children:c.settings.emphasis}),
|
|
25
|
+
/* @__PURE__ */C("div",{className:"es-ts-icons",children:[r(c.bold,/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>f({weight:e?400:700}),children:/* @__PURE__ */z(y,{size:16})})),m||s?r(c.italic,/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),disabled:m,onClick:()=>f({italic:!n.italic||void 0}),children:/* @__PURE__ */z(b,{size:16})})):/* @__PURE__ */z(u,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(n.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */z(b,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
|
|
26
|
+
return z(ne,{value:h.letterCase??n.letterCase,auto:g("letterCase"),words:c,readOnly:m,set:f},t);case"largestSize":return"heading"===e.kind?$(t):null;default:return $(t)}})]})}function Q({value:e,fonts:n,words:t,readOnly:s,set:i}){const l=h();/* @__PURE__ */
|
|
27
|
+
return C("div",{className:"es-ts-set","data-ts-setting":"font",children:[
|
|
28
|
+
/* @__PURE__ */z("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
|
|
29
|
+
/* @__PURE__ */z(a,{value:e,options:n.map(e=>({label:e.label,value:e.value})),onChange:e=>i({font:e}),ariaLabelledBy:l,readOnly:s})]})}function ee({value:e,hex:n,colours:t,words:s,readOnly:i,set:a}){/* @__PURE__ */
|
|
30
|
+
return z(P,{value:e,hex:n,colours:t,label:s.settings.color,followsWord:s.colour.follows,anyWord:s.colour.any,readOnly:i,onChange:e=>a({color:e})})}function ne({value:e,auto:n,words:t,readOnly:s,set:i}){const a=n?["auto","none","upper","capitalize","lower"]:["none","upper","capitalize","lower"],l=e??(n?"auto":"none"),o=f([]),d=e=>i({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
|
|
31
|
+
return C("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
|
|
32
|
+
/* @__PURE__ */z("span",{className:"es-ts-sub",children:t.settings.letterCase}),
|
|
33
|
+
/* @__PURE__ */z("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=(a.indexOf(l)+n+a.length)%a.length;d(a[t]),o.current[t]?.focus()},children:a.map((e,n)=>{const i=e===l;if("auto"===e)return r(t.case.autoTitle,/* @__PURE__ */z(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:i,className:"es-ts-icon es-ts-icon--word","aria-checked":i,"aria-label":t.case.auto,tabIndex:i?0:-1,disabled:s,onClick:()=>d(e),children:t.case.auto},e));const a=U[e];return r(t.case[e],/* @__PURE__ */z(u,{ref:e=>{o.current[n]=e},role:"radio",pressed:i,className:"es-ts-icon","aria-checked":i,"aria-label":t.case[e],tabIndex:i?0:-1,disabled:s,onClick:()=>d(e),children:/* @__PURE__ */z(a,{size:16})},e))})})]})}export{$ as CAMPAIGN_TEXT_STYLE_SETTINGS,P as ColourSwatchRow,F as TEXT_STYLE_DEFAULT_COUNT,A as TEXT_STYLE_KINDS,j as TEXT_STYLE_MAX,W as TEXT_STYLE_RANGES,O as TEXT_STYLE_SETTINGS,_ as TextStylesList,R as addTextStyle,B as canAddTextStyle,L as defaultTextStyles,q as describeTextStyle,I as isDefaultTextStyle,T as removeTextStyle,V as resolveTextStyle,Y as textStyleRowSize,X as updateTextStyle,Z as weightWord};
|
|
@@ -257,4 +257,4 @@ type FieldRenderer = (props: {
|
|
|
257
257
|
readOnly?: boolean;
|
|
258
258
|
}) => ReactNode;
|
|
259
259
|
|
|
260
|
-
export type { ArrayFieldDef as A, CustomFieldDef as C,
|
|
260
|
+
export type { ArrayFieldDef as A, CustomFieldDef as C, FieldOption as F, InspectorFields as I, NumberFieldDef as N, ObjectFieldDef as O, RadioFieldDef as R, SelectFieldDef as S, TextFieldDef as T, InspectorFieldDef as a, FieldRenderer as b, FieldTextProps as c, FieldNumberProps as d, FieldSliderProps as e, FieldSelectManyProps as f, FieldSelectOneProps as g, CustomFieldRenderProps as h, FieldSelectProps as i, SlotFieldDef as j, TextareaFieldDef as k };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
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",
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { InlineRule, MarkStyle } from './markup/index.js';
|
|
2
|
-
|
|
3
|
-
interface TextMap {
|
|
4
|
-
/** The words as drawn: text in order, a `<br>` or a new block line as `\n`. */
|
|
5
|
-
text: string;
|
|
6
|
-
/** The visible offset of a DOM point inside the root. */
|
|
7
|
-
at: (node: Node, offset: number) => number;
|
|
8
|
-
/** The DOM point of a visible offset. */
|
|
9
|
-
dom: (v: number) => [Node, number];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Read the words a renderer drew, whatever its markup: text nodes in order;
|
|
13
|
-
* a `<br>` is a line break, and so is the start of a block-level child after
|
|
14
|
-
* some words (a line the renderer drew as its own block). An element matching
|
|
15
|
-
* `skip` is drawn among the words but is not words (the email's paragraph
|
|
16
|
-
* gap): it adds nothing, and a caret inside it reads as the place it stands.
|
|
17
|
-
*/
|
|
18
|
-
declare function textMap(root: HTMLElement, skip?: string): TextMap;
|
|
19
|
-
/** Why typing ended. */
|
|
20
|
-
type CanvasTypingEnd = 'escape' | 'enter' | 'blur' | 'outside' | 'stop';
|
|
21
|
-
interface CanvasTypingOptions {
|
|
22
|
-
/** The element the page drew the words in. Read again after every redraw:
|
|
23
|
-
* a host that draws them afresh may hand back a new one. */
|
|
24
|
-
element: () => HTMLElement | null;
|
|
25
|
-
/** The saved string. */
|
|
26
|
-
value: string;
|
|
27
|
-
rules: readonly InlineRule[];
|
|
28
|
-
/** The field has lines: Shift+Enter makes one. */
|
|
29
|
-
multiline: boolean;
|
|
30
|
-
/** A selector for elements drawn among the words that are not words (a
|
|
31
|
-
* paragraph's gap): {@link textMap} leaves them out. */
|
|
32
|
-
skip?: string;
|
|
33
|
-
/** The visible selection to start with. */
|
|
34
|
-
caret: [number, number];
|
|
35
|
-
/** The host's ONE writer — the same the panel's text box writes through. */
|
|
36
|
-
write: (next: string) => void;
|
|
37
|
-
/** Typing ended; the words are what was last written. */
|
|
38
|
-
end: (why: CanvasTypingEnd) => void;
|
|
39
|
-
/** The browser wrote into the words (a composition): draw them afresh. */
|
|
40
|
-
remount?: () => void;
|
|
41
|
-
/** What the toolbar shows may have changed (the selection moved, a press, a
|
|
42
|
-
* write): a host draws its buttons again from `pressed()`. */
|
|
43
|
-
onSelect?: () => void;
|
|
44
|
-
now?: () => number;
|
|
45
|
-
}
|
|
46
|
-
interface CanvasTypingSession {
|
|
47
|
-
/** The string as the session last wrote or was told. */
|
|
48
|
-
readonly value: string;
|
|
49
|
-
/** The host wrote the string from elsewhere (the panel's text box). */
|
|
50
|
-
update: (next: string) => void;
|
|
51
|
-
/** End typing. Once: a second call does nothing. */
|
|
52
|
-
stop: (why?: CanvasTypingEnd) => void;
|
|
53
|
-
/** What the selection wears, for the toolbar's pressed buttons (a pending
|
|
54
|
-
* press included), and the list its lines are in. */
|
|
55
|
-
pressed: () => {
|
|
56
|
-
marks: Partial<Record<string, boolean>>;
|
|
57
|
-
list: 'bullet' | 'number' | null;
|
|
58
|
-
};
|
|
59
|
-
/** A mark button pressed (B, I, U, S, superscript, subscript): on the
|
|
60
|
-
* selected words, or for the words typed next — `markPress`, as the panel
|
|
61
|
-
* box presses. */
|
|
62
|
-
press: (style: MarkStyle) => void;
|
|
63
|
-
/** A list button pressed: the selection's lines become that list, or stop being one. */
|
|
64
|
-
list: (kind: 'bullet' | 'number') => void;
|
|
65
|
-
}
|
|
66
|
-
/** Start typing in the words `element()` drew, or `null` where they are not the string's. */
|
|
67
|
-
declare function startCanvasTyping(o: CanvasTypingOptions): CanvasTypingSession | null;
|
|
68
|
-
|
|
69
|
-
export { type CanvasTypingEnd as C, type TextMap as T, type CanvasTypingOptions as a, type CanvasTypingSession as b, startCanvasTyping as s, textMap as t };
|
package/dist/chunk-XTDBTCVO.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,paletteWithoutPinned as o,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as i}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PPL7GB7D.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-LGDQLTJW.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-JTUUIVBZ.js";import{useEasel as f}from"./chunk-K5744MTM.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-FCLW4LEN.js";import{DEFAULT_DRAG_WORDS as y}from"./chunk-O2NLQBFX.js";import{useState as h,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as B,jsxs as L,Fragment as $}from"react/jsx-runtime";var O=e=>`section:${e}`,v=e=>`block:${e}`,x=e=>`template:${e}`;function I({blocks:I,blocksOnly:N,at:T,sectionAccepts:V,onAdd:A,itemFor:D,session:F,siteWide:C,onClose:H,onHide:P,readOnly:Q}){const W=f(e=>e.config),w=p(),{labelAtLevel:G,categoryLabel:J,firstSection:M,Icon:R,Thumbnail:z}=w,{blockIsOffered:E}=m(),K=u("screen",d).add,S=u("drag",y).add,U=l(),[Y,Z]=h([]);b(()=>{let e=!1;const t=e=>E(e,U);return s(U).list().then(o=>{if(e)return;const n=W.components;Z(o.filter(e=>e.node?.type&&n[e.node.type]&&i(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[W,U]);const X=j(()=>e(W,w),[W]),q=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */B(z,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:K.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),_=j(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${K.inside({name:I.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:v(e.type),label:e.label,icon:/* @__PURE__ */B(R,{type:e.type,size:18}),title:K.tile({name:e.label})}))})}),N)return e;const i=e=>!V||V(e),s=t(X,M);s&&i(s.type)&&e.push({key:"start",title:K.startBlank,tiles:[q(s)]});const r=Y.filter(e=>i(e.node.type));r.length>0&&e.push({key:"templates",title:K.templates,tiles:r.map(e=>{return{type:x(e.id),label:e.name,cover:/* @__PURE__ */B(z,{type:e.node.type}),keywords:[(t=e.node.type,G(t,"section",W.components[t]?.label??t)),e.node.type]};var t})});const c=o(X,M);for(const t of Object.keys(W.categories??{})){const o=c.filter(e=>e.cat===t&&i(e.type));0!==o.length&&e.push({key:`category:${t}`,title:n(W,t,J),tiles:o.map(q)})}return e},[I,N,Y,X,W,K,V]),ee=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=Y.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
-
return L($,{children:[
|
|
3
|
-
/* @__PURE__ */B(r,{icon:/* @__PURE__ */B(g,{size:15}),title:K.title,context:N?K.contextBlocks:K.contextAll,actions:/* @__PURE__ */B(c,{label:K.done,description:K.doneDescription,onClick:H}),onHide:P}),
|
|
4
|
-
/* @__PURE__ */L("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */B(k,{groups:_,session:F,itemFor:e=>D(ee(e)??{kind:"section",type:e}),onInsert:e=>{const t=ee(e);t&&A(t)},at:T,hint:N?K.hintBlocks:K.hint,searchLabel:N?K.searchBlocks:K.searchSections,readOnly:Q,words:S}),C&&!N?C:null]})]})}export{I as AddSidePanel,v as blockKey,O as sectionKey,x as templateKey};
|