efficient-easel 0.96.0 → 0.98.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 +98 -3
- package/dist/autosave/index.d.ts +4 -4
- package/dist/blocks/index.d.ts +15 -4
- package/dist/{buckets-1vRlQceY.d.ts → buckets-CuLM47h9.d.ts} +1 -1
- package/dist/chrome/chrome.css +25 -16
- package/dist/chrome/index.d.ts +6 -6
- package/dist/chrome/index.js +6 -6
- package/dist/chunk-2UX75JDP.js +1 -0
- package/dist/{chunk-STFMZJKU.js → chunk-66CKSTXP.js} +6 -6
- package/dist/{chunk-6JDII7N3.js → chunk-6PS6STGA.js} +1 -1
- package/dist/{chunk-EFTTSIMK.js → chunk-D2BCHTQR.js} +1 -1
- package/dist/{chunk-YIMRTIBN.js → chunk-IBOFSS56.js} +1 -1
- package/dist/chunk-KRXQM65X.js +1 -0
- package/dist/chunk-PI26YXYD.js +462 -0
- package/dist/{chunk-FJE4IDBQ.js → chunk-YRLPFZW3.js} +1 -1
- package/dist/copy/copy.css +5 -5
- package/dist/copy/index.d.ts +5 -5
- package/dist/copy/index.js +10 -10
- package/dist/data/index.d.ts +171 -4
- package/dist/data/index.js +1 -1
- package/dist/drag/drag.css +15 -15
- package/dist/drag/index.d.ts +1 -1
- package/dist/drag/index.js +15 -15
- package/dist/edit-lock/index.d.ts +1 -1
- package/dist/editor/index.d.ts +9 -9
- package/dist/editor/index.js +6 -6
- package/dist/fields/fields.css +126 -12
- package/dist/fields/index.d.ts +61 -13
- package/dist/fields/index.js +41 -34
- package/dist/gold/index.d.ts +1 -1
- package/dist/icons/index.d.ts +26 -5
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/menu/menu.css +4 -4
- package/dist/node-ops/index.d.ts +3 -3
- package/dist/node-ops/index.js +1 -1
- package/dist/panel/index.d.ts +10 -10
- package/dist/panel/panel.css +34 -25
- package/dist/pick/pick.css +8 -8
- package/dist/{plan-DtNw2VuI.d.ts → plan-DChbUXdS.d.ts} +1 -1
- package/dist/rail/index.d.ts +2 -2
- package/dist/rail/index.js +1 -1
- package/dist/rail/rail.css +1 -1
- package/dist/render/index.d.ts +2 -2
- package/dist/{resolve-DpH8YQOA.d.ts → resolve-D68pb3Bx.d.ts} +1 -1
- package/dist/shell/index.d.ts +24 -4
- package/dist/shell/index.js +1 -1
- package/dist/shell/shell.css +12 -2
- package/dist/strings/catalogue.d.ts +4 -4
- package/dist/strings/index.d.ts +4 -4
- package/dist/style-clipboard/index.js +1 -1
- package/dist/tree/index.d.ts +1 -1
- package/dist/tree/index.js +1 -1
- package/dist/tree/tree.css +11 -11
- package/dist/{types-DziKCwsN.d.ts → types-41704JE4.d.ts} +8 -1
- package/dist/{types-CEqUFH2j.d.ts → types-C7HFvdtk.d.ts} +26 -4
- package/dist/{types-CuNiSnX6.d.ts → types-CnRzp9oc.d.ts} +1 -1
- package/dist/{types-_Vayx8ov.d.ts → types-Dy6oR6Z2.d.ts} +2 -2
- package/dist/{useNodeOps-6IAej9jy.d.ts → useNodeOps-BF0fQsif.d.ts} +2 -2
- package/dist/{words-CsRWXkY4.d.ts → words-Cqmyey0s.d.ts} +2 -2
- package/dist/{words-DfxEp_RH.d.ts → words-bOMsUJk9.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-FI23ALVJ.js +0 -1
- package/dist/chunk-LPRQDDQO.js +0 -1
- package/dist/chunk-YNZZYHA4.js +0 -450
|
@@ -1 +1 @@
|
|
|
1
|
-
import{changedProps as e}from"./chunk-
|
|
1
|
+
import{changedProps as e}from"./chunk-KRXQM65X.js";import{useState as t,useRef as r,useEffect as n}from"react";function i({id:i,node:l,block:d,parent:o=null,appState:a=null}){const u=d?.fields??{},[s,c]=t(()=>({id:i,fields:u,loading:!1})),p=r(null),f=r(null),g=r({parent:o,appState:a,id:i});return g.current={parent:o,appState:a,id:i},n(()=>{if(!l||!d)return;const t=f.current!==i;f.current=i;let r=s.fields;t&&(r=u,p.current=null,c({id:i,fields:u,loading:!1}));const n=d.resolveFields;if(!n)return void(t||c(e=>({...e,fields:u})));let o=!1;const a=p.current&&(p.current.props?.id??"root")===(l.props?.id??"root")?p.current:null,m=setTimeout(()=>{o||c(e=>e.id===i?{...e,loading:!0}:e)},50);return Promise.resolve(n(l,{changed:e(l,a),fields:u,lastFields:r,lastData:a,appState:g.current.appState,parent:g.current.parent})).then(e=>{clearTimeout(m),o||g.current.id!==i||(p.current=l,c({id:i,fields:e,loading:!1}))}),()=>{o=!0,clearTimeout(m)}},[i,l,d]),s.id===i?{fields:s.fields,loading:s.loading}:{fields:u,loading:!1}}export{i as useResolvedFields};
|
package/dist/copy/copy.css
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
.es-copy {
|
|
18
|
-
--es-copy-gap:
|
|
18
|
+
--es-copy-gap: var(--es-space-8, 8px);
|
|
19
19
|
/* efficient-shell's IconButton at its default size, md (design v5, 0.94.0). */
|
|
20
20
|
--es-copy-mark-size: 32px;
|
|
21
21
|
--es-copy-mark-ink: var(--es-text-muted, #6b7280);
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
--es-copy-field-bg: var(--es-field-bg, #ffffff);
|
|
27
27
|
/** The field's inner inset. On the SURFACES, never on the box — see
|
|
28
28
|
* `.es-copy-box` below for the caret bug that rule exists to stop. */
|
|
29
|
-
--es-copy-field-pad: 4px
|
|
29
|
+
--es-copy-field-pad: 4px 8px;
|
|
30
30
|
--es-copy-field-ring: var(--es-accent, #2563eb);
|
|
31
31
|
--es-copy-radius: 4px;
|
|
32
32
|
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
.es-copy-mark {
|
|
93
93
|
height: var(--es-copy-mark-size);
|
|
94
94
|
min-width: var(--es-copy-mark-size);
|
|
95
|
-
padding: 0
|
|
95
|
+
padding: 0 4px;
|
|
96
96
|
border: 0;
|
|
97
97
|
border-radius: 6px;
|
|
98
98
|
background: transparent;
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
box-sizing: border-box;
|
|
228
228
|
width: 100%;
|
|
229
229
|
height: 32px;
|
|
230
|
-
padding: 0
|
|
230
|
+
padding: 0 12px;
|
|
231
231
|
border: 1px solid var(--es-copy-field-border);
|
|
232
232
|
border-radius: var(--es-field-radius, 6px);
|
|
233
233
|
background: var(--es-copy-field-bg);
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
|
|
261
261
|
.es-copy-link-btn {
|
|
262
262
|
height: 28px;
|
|
263
|
-
padding: 0
|
|
263
|
+
padding: 0 12px;
|
|
264
264
|
border: 1px solid var(--es-btn-border, var(--es-copy-field-border));
|
|
265
265
|
border-radius: var(--es-field-radius, 6px);
|
|
266
266
|
background: var(--es-raised, #fff);
|
package/dist/copy/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { MarkStyle, MarkupTool, WrapResult, InlineRule } from '../markup/index.js';
|
|
4
|
-
import { a as CopyAlign } from '../words-
|
|
5
|
-
export { b as COPY_ALIGNS, c as COPY_ALIGN_FIT, d as COPY_ALIGN_GLYPHS, e as COPY_ALIGN_LABELS, C as CopyWords, f as copyAlignOptions } from '../words-
|
|
4
|
+
import { a as CopyAlign } from '../words-bOMsUJk9.js';
|
|
5
|
+
export { b as COPY_ALIGNS, c as COPY_ALIGN_FIT, d as COPY_ALIGN_GLYPHS, e as COPY_ALIGN_LABELS, C as CopyWords, f as copyAlignOptions } from '../words-bOMsUJk9.js';
|
|
6
6
|
|
|
7
7
|
/** `'b'` → `Meta+B`, `'shift+x'` → `Meta+Shift+X` — the ARIA spelling of a
|
|
8
8
|
* shortcut. Meta is what the tooltips promise (⌘); Ctrl works too. */
|
|
@@ -16,7 +16,7 @@ interface MarkBarProps {
|
|
|
16
16
|
*
|
|
17
17
|
* `MarkStyle[]` resolved against the shared grammar's `MARKUP_TOOLS`, in
|
|
18
18
|
* that order. What the campaign designer passes.
|
|
19
|
-
* `MarkupTool[]` used verbatim. What `efficient-
|
|
19
|
+
* `MarkupTool[]` used verbatim. What `efficient-storefront` passes.
|
|
20
20
|
*
|
|
21
21
|
* ⚠️ WHY VERBATIM DESCRIPTORS HAD TO EXIST. The storefront offered SEVEN
|
|
22
22
|
* marks: the grammar's four, plus its three word styles (`@@`, `++`, `^^`),
|
|
@@ -49,7 +49,7 @@ interface MarkBarProps {
|
|
|
49
49
|
* how they LOOK is the host's, "because this bar has to belong to the
|
|
50
50
|
* storefront inspector's chrome and the campaign designer's bar has to belong
|
|
51
51
|
* to the portal's". Colour was delegated by tokens on day one; the DRAWING was
|
|
52
|
-
* not, and a letter is a drawing. `efficient-
|
|
52
|
+
* not, and a letter is a drawing. `efficient-storefront` renders each mark as a 14px
|
|
53
53
|
* stroked SVG at the weight of its other inspector glyphs, on the stated
|
|
54
54
|
* ground that the row should read "as part of the field rather than as
|
|
55
55
|
* pasted-in icons" — so without this it could not adopt the bar without losing
|
|
@@ -69,7 +69,7 @@ interface MarkBarProps {
|
|
|
69
69
|
*
|
|
70
70
|
* A bar bound to one box needs nothing more. A bar SHARED by several rows has
|
|
71
71
|
* to say which row it is aimed at, because the visible cue — the marked row —
|
|
72
|
-
* is not readable. `efficient-
|
|
72
|
+
* is not readable. `efficient-storefront` has that case today.
|
|
73
73
|
*/
|
|
74
74
|
ariaLabel?: string;
|
|
75
75
|
/**
|
package/dist/copy/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{DEFAULT_COPY_WORDS as e}from"../chunk-2LUSK32B.js";import{SettingsSegmented as t}from"../chunk-QB3BZIRA.js";import{GoldTextInput as n}from"../chunk-CERTFXCV.js";import{applyMark as l,STANDARD_MARKUP as r,writeMarkedLines as o,sameMarks as i,markedLines as a,spanFor as s,markupTools as c,findLink as u,markedAt as d,removeLink as p,writeLink as h,isSafeLinkHref as f}from"../chunk-6OPSJGAI.js";import{useWords as m}from"../chunk-MFIRYGHW.js";import"../chunk-BZ5ASXOL.js";import{AlignSeparateIcon as y,AlignRightIcon as b,AlignCenterIcon as g,AlignLeftIcon as k,ClearMarksIcon as v,LinkIcon as x,QuietIcon as C,EmphasisIcon as w,StrikeIcon as S,ItalicIcon as
|
|
2
|
-
return
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
return
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
return
|
|
10
|
-
/* @__PURE__ */
|
|
1
|
+
import{DEFAULT_COPY_WORDS as e}from"../chunk-2LUSK32B.js";import{SettingsSegmented as t}from"../chunk-QB3BZIRA.js";import{GoldTextInput as n}from"../chunk-CERTFXCV.js";import{applyMark as l,STANDARD_MARKUP as r,writeMarkedLines as o,sameMarks as i,markedLines as a,spanFor as s,markupTools as c,findLink as u,markedAt as d,removeLink as p,writeLink as h,isSafeLinkHref as f}from"../chunk-6OPSJGAI.js";import{useWords as m}from"../chunk-MFIRYGHW.js";import"../chunk-BZ5ASXOL.js";import{AlignSeparateIcon as y,AlignRightIcon as b,AlignCenterIcon as g,AlignLeftIcon as k,ClearMarksIcon as v,LinkIcon as x,QuietIcon as C,EmphasisIcon as w,StrikeIcon as S,ItalicIcon as D,BoldIcon as N}from"../chunk-PI26YXYD.js";import{useRef as j,useLayoutEffect as E,useState as L,useEffect as P,useId as K}from"react";import{jsx as T,jsxs as z,Fragment as A}from"react/jsx-runtime";var B=["left","center","right","justify"],R=e.align,$={left:/* @__PURE__ */T(k,{}),center:/* @__PURE__ */T(g,{}),right:/* @__PURE__ */T(b,{}),justify:/* @__PURE__ */T(y,{})},M={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function F(e,t=R){return B.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:$[e],title:t[e]}))}var I=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function Y(e){if(e.every(e=>e.label===R[e.id]))return e.length>3?M.four:M.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(I.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function q(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function O(e,t,n,r=l){const{start:o,end:i}=q(e,n);return r(e,o,i,t)}function U(e,t,n){const{start:l,end:r}=q(e,n),o=l+t.length;return{text:e.slice(0,l)+t+e.slice(r),selectionStart:o,selectionEnd:o}}var X=1e3;function Z(e=200){let t=[],n=[],l=null,r=0;return{record(o,i,a){const s="type"===i&&"type"===l&&a-r<1e3;l=i,r=a,n=[],s||(t.push(o),t.length>e&&t.shift())},undo(e){const r=t.pop();return r?(n.push(e),l=null,r):null},redo(e){const r=n.pop();return r?(t.push(e),l=null,r):null},reset(){t=[],n=[],l=null}}}function G({href:t,editing:n,onApply:l,onRemove:r,onClose:o}){const i=m("copy",e).link,a=K(),[s,c]=L(t),[u,d]=L(!1),p=j(null);P(()=>{p.current?.focus(),p.current?.select()},[]);const h=()=>{const e=s.trim();f(e)?l(e):d(!0)};/* @__PURE__ */
|
|
2
|
+
return z("div",{role:"dialog","aria-label":i.title,className:"es-copy-link",onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),h()):"Escape"===e.key&&(e.preventDefault(),e.stopPropagation(),o())},children:[
|
|
3
|
+
/* @__PURE__ */T("label",{htmlFor:a,className:"es-copy-link-label",children:i.label}),
|
|
4
|
+
/* @__PURE__ */T("input",{ref:p,id:a,type:"text",className:"es-copy-link-input",value:s,placeholder:i.placeholder,spellCheck:!1,autoComplete:"off","aria-invalid":u||void 0,"aria-describedby":u?`${a}-why`:void 0,onChange:e=>{c(e.target.value),d(!1)}}),u?/* @__PURE__ */T("p",{id:`${a}-why`,role:"alert",className:"es-copy-link-why",children:i.refused}):null,
|
|
5
|
+
/* @__PURE__ */z("div",{className:"es-copy-link-actions",children:[n?/* @__PURE__ */T("button",{type:"button",className:"es-copy-link-btn",onClick:r,children:i.remove}):null,
|
|
6
|
+
/* @__PURE__ */T("button",{type:"button",className:"es-copy-link-btn is-primary",onClick:h,disabled:""===s.trim(),children:i.apply})]})]})}var H=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),W=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function J(e,t){const n=t.rules??r,l=e.html&&""!==e.html.trim()?function(e,t,n){const l=t.createElement("template");l.innerHTML=e;const r=[[]],s=()=>r[r.length-1],c=()=>{const e=s();for(;e.length>0&&" "===e[e.length-1].ch;)e.pop();e.length>0&&r.push([])},u=(e,t,n,l)=>{if(3===e.nodeType){for(const r of e.textContent??""){const e=/\s/.test(r)?" ":r,o=s();(" "!==e||0!==o.length&&" "!==o[o.length-1].ch)&&o.push({ch:e,bold:t,italic:n,href:l})}return}if(1!==e.nodeType&&11!==e.nodeType)return;const o=e,i=1===e.nodeType?o.localName:"";if(H.has(i))return;if("br"===i)return void r.push([]);let a=t,d=n,p=l;if("b"!==i&&"strong"!==i||(a=!0),"i"!==i&&"em"!==i||(d=!0),"a"===i){const e=(o.getAttribute("href")??"").trim();p=f(e)?e:null}const h=1===e.nodeType?o.style:null;if(h){const e=h.fontWeight;"bold"===e||"bolder"===e||Number(e)>=600?a=!0:("normal"===e||"lighter"===e||""!==e&&Number(e)<600)&&(a=!1),"italic"===h.fontStyle||"oblique"===h.fontStyle?d=!0:"normal"===h.fontStyle&&(d=!1)}const m=W.has(i);m&&c();for(const t of[...e.childNodes])u(t,a,d,p);m&&c()};u(l.content,!1,!1,null);for(;r.length>1&&0===r[r.length-1].length;)r.pop();return r.map(e=>function(e,t){const n=t=>e.map((n,l)=>n[t]&&(" "!==n.ch||Boolean(e[l-1]?.[t])&&Boolean(e[l+1]?.[t]))),l=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const r of l){const l=Q(e,r.bold?n("bold"):null,r.italic?n("italic"):null,r.links),s=o([l]).text;if(i([l],a(s,t)))return s}return e.map(e=>e.ch).join("")}(e,n))}(e.html,t.doc,n):(e.text??"").replace(/\r\n?/g,"\n").split("\n");return t.multiline?l.join("\n"):l.map(e=>e.trim()).filter(e=>""!==e).join(" ")}function Q(e,t,n,l){let r=0,o=null,i=null,a=null;return{bullet:!1,chars:e.map((e,c)=>{const u=l?e.href:null;return o=null===u?null:o&&o.href===u?o:s(++r,"link",u),i=t?.[c]?i??s(++r,"bold"):null,a=n?.[c]?a??s(++r,"italic"):null,{ch:e.ch,at:-1,marks:[o,i,a].filter(e=>null!==e)}})}}var V={bold:/* @__PURE__ */T(N,{size:16}),italic:/* @__PURE__ */T(D,{size:16}),strike:/* @__PURE__ */T(S,{size:16}),highlight:/* @__PURE__ */T(w,{size:16}),quiet:/* @__PURE__ */T(C,{size:16}),link:/* @__PURE__ */T(x,{size:16}),clear:/* @__PURE__ */T(v,{size:16})};function _(e){if(!e)return;const t=e.split("+"),n=t.pop().toUpperCase();return["Meta",...t.map(e=>e[0].toUpperCase()+e.slice(1)),n].join("+")}var ee={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function te({tools:t,onApply:n,disabled:l=!1,actions:r,align:o,glyphs:i,ariaLabel:a,pressed:s,open:u=null}){const d=m("copy",e),p="string"==typeof t[0]?c(t).map(e=>({...e,...d.marks[e.style]})):t;return 0!==p.length||r||o?/* @__PURE__ */z("div",{className:"es-copy-bar",role:"group","aria-label":a??d.formatting,children:[p.map(e=>{const t=i?.[e.style]??V[e.style],r=u===e.style||Boolean(s?.[e.style]);/* @__PURE__ */
|
|
7
|
+
return T("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:()=>n(e.style),disabled:l,title:e.title,"aria-label":e.name??e.title,"aria-keyshortcuts":_(e.shortcut),"aria-pressed":s||u?r:void 0,"aria-haspopup":"link"===e.style&&s?"dialog":void 0,"aria-expanded":"link"===e.style&&s?"link"===u:void 0,className:`es-copy-mark${t?" has-glyph":ee[e.style]?` ${ee[e.style]}`:""}${r?" is-active":""}`,children:t??e.label},e.style)}),r?/* @__PURE__ */z(A,{children:[
|
|
8
|
+
/* @__PURE__ */T("span",{className:"es-copy-bar-split","aria-hidden":"true"}),r]}):null,o?/* @__PURE__ */T("span",{className:"es-copy-bar-end",children:o}):null]}):null}function ne({target:e,onChange:t}){const n=j(null);return E(()=>{const t=n.current,l=e.current;t&&l&&l.value===t.text&&(n.current=null,l.focus(),l.setSelectionRange(t.start,t.end))}),l=>{const r=l(e.current);t(r.text),n.current={start:r.selectionStart,end:r.selectionEnd,text:r.text}}}function le({value:o,onChange:i,onCommit:a,onCancel:s,multiline:f=!1,placeholder:y,ariaLabel:b,className:g,readOnly:k=!1,rules:v,tools:x=[],writeMark:C,actions:w,align:S,glyphs:D,barLabel:N,renderFooter:E,inputRef:K,barShows:A="always"}){const B=m("copy",e),R=j(null),$=K??R,[M,I]=L(!1),[q,X]=L(null),H=j(Z()).current,W=j(null);P(()=>{const e=W.current;e&&o===e.to?W.current=null:e&&o===e.from||(W.current=null,H.reset())},[o,H]);const Q=e=>{W.current={from:W.current?.from??o,to:e},i(e)},V=e=>({text:o,start:e?.selectionStart??q?.start??o.length,end:e?.selectionEnd??q?.end??o.length}),_=ne({target:$,onChange:Q}),ee=e=>(X({start:e.selectionStart,end:e.selectionEnd}),e),le=e=>_(t=>(H.record(V(t),"edit",Date.now()),ee(e(t)))),[re,oe]=L(null),ie=v??r,ae="string"==typeof x[0]?c(x):x,se=ae.map(e=>e.style),ce={};if(q)for(const e of se)ce[e]="link"===e?null!==u(o,q.start,q.end):d(o,q.start,q.end,e);const ue=e=>{if("clear"===e)return void le(t=>O(o,e,t,(e,t,n)=>l(e,t,n,"clear",ie)));if("link"!==e){const t=C??((e,t,n,o)=>l(e,t,n,o,r,B.placeholders));return void le(n=>O(o,e,n,t))}const t=$.current,n=t?.selectionStart??o.length,i=t?.selectionEnd??n;oe({start:n,end:i,link:u(o,n,i)})},de=S?F(S.allow,B.align):[];/* @__PURE__ */
|
|
9
|
+
return z("div",{className:"es-copy"+(g?` ${g}`:""),onFocus:()=>I(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||I(!1)},onKeyDown:e=>{if(k||e.target!==$.current)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const t=e.key.toLowerCase(),n="KeyZ"===e.code||"z"===t,l=("KeyY"===e.code||"y"===t)&&!e.shiftKey;if(n||l)return e.preventDefault(),e.stopPropagation(),r=l||e.shiftKey?"redo":"undo",void _(e=>{const t=V(e),n=H[r](t);return ee(n?{text:n.text,selectionStart:n.start,selectionEnd:n.end}:{text:t.text,selectionStart:t.start,selectionEnd:t.end})});var r;const o=`${e.shiftKey?"shift+":""}${t}`,i=ae.find(e=>e.shortcut===o);i&&(e.preventDefault(),e.stopPropagation(),ue(i.style))},onPaste:e=>{const t=$.current;if(k||!t||e.target!==t)return;e.preventDefault();const n=J({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:t.ownerDocument,multiline:f,rules:ie});le(e=>U(o,n,e))},onSelect:()=>{const e=$.current;e&&e.ownerDocument.activeElement===e&&X({start:e.selectionStart??o.length,end:e.selectionEnd??o.length})},children:["always"===A||M||null!==re?/* @__PURE__ */T(te,{tools:x,disabled:k,actions:w,glyphs:D,ariaLabel:N,pressed:ce,open:re?"link":null,onApply:ue,align:S?/* @__PURE__ */T(t,{options:de,value:S.value,onChange:S.onChange,ariaLabel:B.alignment,disabled:k||S.disabled,fit:Y(de)}):null}):null,
|
|
10
|
+
/* @__PURE__ */T(n,{value:o,onInput:e=>{H.record(V(null),"type",Date.now()),Q(e)},onCommit:a,onCancel:s,multiline:f,placeholder:y,ariaLabel:b,rules:v,disabled:k,inputRef:$,className:"es-copy-box"}),re?/* @__PURE__ */T(G,{href:re.link?.href??"",editing:null!==re.link,onApply:e=>{const t=re;oe(null),le(()=>h(o,t.start,t.end,e))},onRemove:()=>{const e=re.link;oe(null),e&&le(()=>p(o,e))},onClose:()=>{oe(null),$.current?.focus()}}):null,E?E({focused:M,insert:e=>le(t=>U(o,e,t))}):null]})}export{B as COPY_ALIGNS,M as COPY_ALIGN_FIT,$ as COPY_ALIGN_GLYPHS,R as COPY_ALIGN_LABELS,le as CopyBox,te as MarkBar,X as TYPING_BURST_MS,_ as ariaShortcut,F as copyAlignOptions,Z as createHistory,U as insertSelection,O as markSelection,J as pasteToMarkup,ne as useCaretEdit};
|
package/dist/data/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { B as BlockShape, c as FieldShape, d as FieldsShape, e as NodeProps, R as RootData } from '../types-
|
|
3
|
-
export { R as ResolvableItem, a as ResolveCache, b as ResolveOptions, c as ResolveTrigger, d as changedProps, e as createResolveCache, f as deepEqual, r as resolveNodeData } from '../resolve-
|
|
1
|
+
import { D as Data, a as DataConfig, N as Node, S as SlotAddress, F as Found, P as Place, b as SlotEntry, W as WalkInfo } from '../types-41704JE4.js';
|
|
2
|
+
export { B as BlockShape, c as FieldShape, d as FieldsShape, e as NodeProps, R as RootData } from '../types-41704JE4.js';
|
|
3
|
+
export { R as ResolvableItem, a as ResolveCache, b as ResolveOptions, c as ResolveTrigger, d as changedProps, e as createResolveCache, f as deepEqual, r as resolveNodeData } from '../resolve-D68pb3Bx.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Finding a node's slots, and reading or writing a value at a prop path.
|
|
@@ -26,6 +26,172 @@ export { R as ResolvableItem, a as ResolveCache, b as ResolveOptions, c as Resol
|
|
|
26
26
|
type Segment = string | number;
|
|
27
27
|
declare function getIn(value: unknown, segments: readonly Segment[]): unknown;
|
|
28
28
|
|
|
29
|
+
/** One translated value, and the fingerprint of the base value it was made from. */
|
|
30
|
+
interface TranslatedValue {
|
|
31
|
+
v: unknown;
|
|
32
|
+
src: string;
|
|
33
|
+
}
|
|
34
|
+
/** One node's translated values, by prop path. */
|
|
35
|
+
type TranslationEntries = Record<string, TranslatedValue>;
|
|
36
|
+
/** One language's values, beside the document — never inside it. Keyed by node id, or `"root"`. */
|
|
37
|
+
type TranslationOverlay = Record<string, TranslationEntries>;
|
|
38
|
+
/** One translatable value in a document: whose it is, and where in its props. */
|
|
39
|
+
interface TranslationRef {
|
|
40
|
+
id: string;
|
|
41
|
+
path: string;
|
|
42
|
+
}
|
|
43
|
+
interface TranslationStatus {
|
|
44
|
+
/** Values that want a translation (the base is not blank) or have one. */
|
|
45
|
+
total: number;
|
|
46
|
+
/** Values with words in the base and no translation: drawn in the base language. */
|
|
47
|
+
missing: TranslationRef[];
|
|
48
|
+
/** Values whose translation was made from a base value that has since changed. */
|
|
49
|
+
stale: TranslationRef[];
|
|
50
|
+
}
|
|
51
|
+
interface TranslatablePath {
|
|
52
|
+
path: string;
|
|
53
|
+
/** The value there now; `undefined` when the props hold none. */
|
|
54
|
+
value: unknown;
|
|
55
|
+
}
|
|
56
|
+
/** A node, or the root (`{ props }`, no type) — what `resolveNodeData` takes too. */
|
|
57
|
+
interface TranslatableItem {
|
|
58
|
+
type?: string;
|
|
59
|
+
props: Record<string, unknown>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A short, stable mark of a base value, kept beside its translation as `src`.
|
|
63
|
+
*
|
|
64
|
+
* a string `s<length>.<hash>` the string itself is hashed
|
|
65
|
+
* anything else `j<length>.<hash>` its JSON is hashed, keys sorted at
|
|
66
|
+
* every level, because a document's key
|
|
67
|
+
* order is not kept by the database
|
|
68
|
+
* no value `u`
|
|
69
|
+
*
|
|
70
|
+
* `<length>` is in UTF-16 code units and `<hash>` is FNV-1a (32 bits) over
|
|
71
|
+
* those units, both written in base 36. It is not a secret and not a proof:
|
|
72
|
+
* two values of the same length and the same 32-bit hash read as one, which is
|
|
73
|
+
* enough to notice that words were edited.
|
|
74
|
+
*
|
|
75
|
+
* The first letter names the scheme. These marks are STORED, so the function
|
|
76
|
+
* must go on giving the same answer for the same value; a better scheme takes
|
|
77
|
+
* a new letter rather than changing what `s` and `j` mean.
|
|
78
|
+
*/
|
|
79
|
+
declare function translationFingerprint(value: unknown): string;
|
|
80
|
+
/**
|
|
81
|
+
* The props of a node (or of the root) that may be translated, in the order
|
|
82
|
+
* the fields declare them, each with the value it holds now.
|
|
83
|
+
*
|
|
84
|
+
* A top-level value, and one inside an `object` field, is listed whether or
|
|
85
|
+
* not the props hold it (`value: undefined`). One inside an `array` field is
|
|
86
|
+
* listed per item that is there.
|
|
87
|
+
*/
|
|
88
|
+
declare function translatablePaths(item: TranslatableItem, config: DataConfig): TranslatablePath[];
|
|
89
|
+
/**
|
|
90
|
+
* The document in one language: every translated value laid over the base,
|
|
91
|
+
* every other value the base's.
|
|
92
|
+
*
|
|
93
|
+
* With no overlay, or an empty one, it is `data` ITSELF. Otherwise only the
|
|
94
|
+
* nodes that took a value are copied, along with what holds them; a block
|
|
95
|
+
* nothing was translated in is the same object before and after, and so is a
|
|
96
|
+
* document no entry lands in.
|
|
97
|
+
*
|
|
98
|
+
* An entry for a node that is not in the document (deleted, or not on this
|
|
99
|
+
* page), for a path the fields no longer declare, or for a block type the
|
|
100
|
+
* config does not know, is passed over — never an error.
|
|
101
|
+
*/
|
|
102
|
+
declare function applyTranslation(data: Data, config: DataConfig, overlay?: TranslationOverlay | null): Data;
|
|
103
|
+
/**
|
|
104
|
+
* How far a language has got: how many values want a translation, which have
|
|
105
|
+
* none (`missing`) and which were translated from words that have since
|
|
106
|
+
* changed (`stale`). Both lists are in document order — the root, then the
|
|
107
|
+
* nodes as `walk` visits them — and name the place in the BASE document.
|
|
108
|
+
*
|
|
109
|
+
* A value the base leaves blank wants nothing and is not counted, unless the
|
|
110
|
+
* language has an entry for it. A stale entry under an array that was not
|
|
111
|
+
* found again is reported at the index it is stored under.
|
|
112
|
+
*/
|
|
113
|
+
declare function translationStatus(data: Data, config: DataConfig, overlay?: TranslationOverlay | null): TranslationStatus;
|
|
114
|
+
/**
|
|
115
|
+
* The overlay a language's edit comes to. `edited` is the page as it was
|
|
116
|
+
* changed while it was shown in that language — `applyTranslation(base,
|
|
117
|
+
* previous)`, then words typed over it — and the answer holds an entry for
|
|
118
|
+
* every translatable value that differs from the base, with `src` the base
|
|
119
|
+
* value's fingerprint as it is now.
|
|
120
|
+
*
|
|
121
|
+
* - A value equal to the base's makes NO entry: falling back is the absence
|
|
122
|
+
* of one. So does a value that is not there (`undefined`).
|
|
123
|
+
* - Only translatable values are read. A block added, removed or moved in
|
|
124
|
+
* `edited`, an array of another length, a changed number or colour — the
|
|
125
|
+
* structure is the base's alone while a language is being written, and a
|
|
126
|
+
* difference there is passed over, never an error.
|
|
127
|
+
* - `previous` is the overlay the edit started from. An entry the edit did
|
|
128
|
+
* not touch is kept AS IT WAS, old `src` and all, so a save does not
|
|
129
|
+
* quietly turn a stale translation into a current one; and what `previous`
|
|
130
|
+
* holds for nodes that are not on the page is carried over (only
|
|
131
|
+
* `pruneTranslation` drops). Where nothing changed, the answer is
|
|
132
|
+
* `previous` itself.
|
|
133
|
+
*/
|
|
134
|
+
declare function extractTranslation(base: Data, edited: Data, config: DataConfig, previous?: TranslationOverlay | null): TranslationOverlay;
|
|
135
|
+
/**
|
|
136
|
+
* Drop what no longer has a place: the entries of a node that is not in the
|
|
137
|
+
* document, and — in a node whose type the config knows — an entry at a path
|
|
138
|
+
* its fields no longer declare or its props no longer reach. An entry whose
|
|
139
|
+
* array item moved is written at the index it is drawn at.
|
|
140
|
+
*
|
|
141
|
+
* A node whose type the config does NOT know keeps its entries untouched for
|
|
142
|
+
* as long as the node is there, and so does any node found inside it: with no
|
|
143
|
+
* fields there is no telling which of its paths are gone, and a block's
|
|
144
|
+
* content is allowed to land before its code.
|
|
145
|
+
*
|
|
146
|
+
* Until a host calls this, the entries of a deleted node stay in the overlay —
|
|
147
|
+
* which is what lets undoing the delete bring its translations back. An
|
|
148
|
+
* overlay with nothing to drop comes back as itself.
|
|
149
|
+
*/
|
|
150
|
+
declare function pruneTranslation(data: Data, config: DataConfig, overlay: TranslationOverlay): TranslationOverlay;
|
|
151
|
+
/**
|
|
152
|
+
* Carry an overlay across an edit of the BASE. `previousBase` is the document
|
|
153
|
+
* the overlay was in step with, `nextBase` the document after the edit.
|
|
154
|
+
*
|
|
155
|
+
* Only arrays need it. A node keeps its id wherever it goes, so moving one
|
|
156
|
+
* changes nothing here, and a node that was deleted keeps its entries (see
|
|
157
|
+
* `pruneTranslation`). An array item has no id, so its entries are stored
|
|
158
|
+
* under its INDEX, and this moves them to where the item went:
|
|
159
|
+
*
|
|
160
|
+
* - an item that reads the same before and after keeps its entries, at its
|
|
161
|
+
* new index (in place first; then the lowest unclaimed index before to the
|
|
162
|
+
* lowest after, so identical items keep their order);
|
|
163
|
+
* - an item that is at the same index on both sides but reads differently
|
|
164
|
+
* was edited where it stands: its entries stay, and are stale wherever a
|
|
165
|
+
* base value changed;
|
|
166
|
+
* - an item that is new but reads the same as one that was there (a
|
|
167
|
+
* duplicate) takes a COPY of that item's entries;
|
|
168
|
+
* - an item that is gone takes its entries with it. An item cannot be
|
|
169
|
+
* recognised again once it is out of the array, so a host that must bring
|
|
170
|
+
* them back on undo keeps the overlay in the same history step as the base.
|
|
171
|
+
*
|
|
172
|
+
* Stale entries travel with their item, which reading the overlay later, with
|
|
173
|
+
* `nextBase` alone, could not do: it finds a moved item by its base
|
|
174
|
+
* fingerprint, and a stale entry no longer has one that matches.
|
|
175
|
+
*
|
|
176
|
+
* An overlay the edit does not disturb comes back as itself.
|
|
177
|
+
*/
|
|
178
|
+
declare function rebaseTranslation(previousBase: Data, nextBase: Data, config: DataConfig, overlay: TranslationOverlay): TranslationOverlay;
|
|
179
|
+
/**
|
|
180
|
+
* Old id → new id, for a node and its copy: `duplicate` and `copyNode` give
|
|
181
|
+
* every copied node a fresh id, and an overlay is keyed by id. The two are
|
|
182
|
+
* walked side by side, slot by slot and child by child, for as far as they
|
|
183
|
+
* keep the same shape (a `strip` that drops a child ends the pairing there).
|
|
184
|
+
*/
|
|
185
|
+
declare function mapIds(source: Node, copy: Node, config: DataConfig): Record<string, string>;
|
|
186
|
+
/**
|
|
187
|
+
* The entries a copied subtree starts with: for every old id in `ids` that the
|
|
188
|
+
* overlay has entries for, the same entries under the new id. ONLY those — lay
|
|
189
|
+
* them over the language's overlay (`{ ...overlay, ...copyTranslation(overlay,
|
|
190
|
+
* ids) }`), or carry them to another page with the clipboard. An entry whose
|
|
191
|
+
* base value the copy changed (`strip`) is stale there, as it should be.
|
|
192
|
+
*/
|
|
193
|
+
declare function copyTranslation(overlay: TranslationOverlay | null | undefined, ids: Record<string, string>): TranslationOverlay;
|
|
194
|
+
|
|
29
195
|
/**
|
|
30
196
|
* efficient-easel/data — the document, as pure functions.
|
|
31
197
|
*
|
|
@@ -40,6 +206,7 @@ declare function getIn(value: unknown, segments: readonly Segment[]): unknown;
|
|
|
40
206
|
* setProps · setRoot change one node's props, or the root's
|
|
41
207
|
* normalizeData what the editor does to a document it opens
|
|
42
208
|
* createNode · newId make a block the way the Add panel does
|
|
209
|
+
* applyTranslation · … a page's other languages, kept beside it (./translate)
|
|
43
210
|
*
|
|
44
211
|
* THE FORMAT DOES NOT CHANGE. A document goes in and comes out in exactly the
|
|
45
212
|
* shape Puck 0.20 saves (see ./types). Four rules keep it that way, and the
|
|
@@ -205,4 +372,4 @@ declare function replaceNode(data: Data, config: DataConfig, id: string, node: N
|
|
|
205
372
|
/** Merge `patch` into the root's props, the same way `setProps` does. */
|
|
206
373
|
declare function setRoot(data: Data, config: DataConfig, patch: Record<string, unknown>): Data;
|
|
207
374
|
|
|
208
|
-
export { Data, DataConfig, DataError, type DataErrorCode, type DataInput, Found, Node, Place, ROOT_ID, ROOT_LIST, ROOT_SLOT, type Segment, SlotAddress, SlotEntry, WalkInfo, copyNode, createNode, duplicate, find, getIn, getList, insert, move, newId, normalizeData, parseZoneKey, remove, replaceNode, setProps, setRoot, slotsOf, walk, zoneKey };
|
|
375
|
+
export { Data, DataConfig, DataError, type DataErrorCode, type DataInput, Found, Node, Place, ROOT_ID, ROOT_LIST, ROOT_SLOT, type Segment, SlotAddress, SlotEntry, type TranslatableItem, type TranslatablePath, type TranslatedValue, type TranslationEntries, type TranslationOverlay, type TranslationRef, type TranslationStatus, WalkInfo, applyTranslation, copyNode, copyTranslation, createNode, duplicate, extractTranslation, find, getIn, getList, insert, mapIds, move, newId, normalizeData, parseZoneKey, pruneTranslation, rebaseTranslation, remove, replaceNode, setProps, setRoot, slotsOf, translatablePaths, translationFingerprint, translationStatus, walk, zoneKey };
|
package/dist/data/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DataError,ROOT_ID,ROOT_LIST,ROOT_SLOT,changedProps,copyNode,createNode,createResolveCache,deepEqual,duplicate,find,getList,insert,move,newId,normalizeData,parseZoneKey,remove,replaceNode,resolveNodeData,setProps,setRoot,slotsOf,walk,zoneKey}from"../chunk-
|
|
1
|
+
export{DataError,ROOT_ID,ROOT_LIST,ROOT_SLOT,applyTranslation,changedProps,copyNode,copyTranslation,createNode,createResolveCache,deepEqual,duplicate,extractTranslation,find,getList,insert,mapIds,move,newId,normalizeData,parseZoneKey,pruneTranslation,rebaseTranslation,remove,replaceNode,resolveNodeData,setProps,setRoot,slotsOf,translatablePaths,translationFingerprint,translationStatus,walk,zoneKey}from"../chunk-KRXQM65X.js";export{getIn}from"../chunk-NKB3KVAB.js";
|
package/dist/drag/drag.css
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
align-items: center;
|
|
24
24
|
gap: 4px;
|
|
25
25
|
height: 22px;
|
|
26
|
-
padding: 0 8px
|
|
26
|
+
padding: 0 8px;
|
|
27
27
|
border-radius: 11px;
|
|
28
28
|
background: var(--es-toast-bg);
|
|
29
29
|
color: var(--es-on-accent);
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
}
|
|
92
92
|
.es-canvas-seam-add {
|
|
93
93
|
position: relative;
|
|
94
|
-
padding: 2px
|
|
94
|
+
padding: 2px 12px;
|
|
95
95
|
border: none;
|
|
96
96
|
border-radius: 999px;
|
|
97
97
|
background: var(--es-accent);
|
|
@@ -150,8 +150,8 @@
|
|
|
150
150
|
align-items: center;
|
|
151
151
|
justify-content: space-between;
|
|
152
152
|
gap: 8px;
|
|
153
|
-
margin: 0 0
|
|
154
|
-
padding:
|
|
153
|
+
margin: 0 0 12px;
|
|
154
|
+
padding: 8px 8px 8px 12px;
|
|
155
155
|
border-radius: 8px;
|
|
156
156
|
background: var(--es-accent-tint);
|
|
157
157
|
color: var(--es-accent-text);
|
|
@@ -175,14 +175,14 @@
|
|
|
175
175
|
background: var(--es-accent-tint-strong);
|
|
176
176
|
}
|
|
177
177
|
.es-add-hint {
|
|
178
|
-
margin: 0 0
|
|
178
|
+
margin: 0 0 12px;
|
|
179
179
|
font-size: 12.5px;
|
|
180
180
|
color: var(--es-muted);
|
|
181
181
|
}
|
|
182
182
|
.es-add-search {
|
|
183
183
|
display: flex;
|
|
184
184
|
align-items: center;
|
|
185
|
-
gap:
|
|
185
|
+
gap: 8px;
|
|
186
186
|
margin-bottom: 16px;
|
|
187
187
|
padding: 0 12px;
|
|
188
188
|
height: 38px;
|
|
@@ -237,13 +237,13 @@
|
|
|
237
237
|
color: var(--es-text);
|
|
238
238
|
}
|
|
239
239
|
.es-add-group + .es-add-group {
|
|
240
|
-
margin-top:
|
|
240
|
+
margin-top: 16px;
|
|
241
241
|
}
|
|
242
242
|
.es-add-group-head {
|
|
243
243
|
display: flex;
|
|
244
244
|
align-items: baseline;
|
|
245
245
|
gap: 8px;
|
|
246
|
-
margin-bottom:
|
|
246
|
+
margin-bottom: 12px;
|
|
247
247
|
}
|
|
248
248
|
.es-add-group-title {
|
|
249
249
|
font-size: 11px;
|
|
@@ -259,16 +259,16 @@
|
|
|
259
259
|
.es-add-grid {
|
|
260
260
|
display: grid;
|
|
261
261
|
grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
|
|
262
|
-
gap:
|
|
262
|
+
gap: 8px;
|
|
263
263
|
}
|
|
264
264
|
.es-add-tile {
|
|
265
265
|
display: flex;
|
|
266
266
|
flex-direction: column;
|
|
267
267
|
align-items: center;
|
|
268
268
|
justify-content: center;
|
|
269
|
-
gap:
|
|
269
|
+
gap: 8px;
|
|
270
270
|
min-height: 64px;
|
|
271
|
-
padding:
|
|
271
|
+
padding: 8px;
|
|
272
272
|
border: 1px solid var(--es-line);
|
|
273
273
|
border-radius: 7px;
|
|
274
274
|
background: var(--es-panel);
|
|
@@ -317,9 +317,9 @@
|
|
|
317
317
|
.es-add-tile.has-cover {
|
|
318
318
|
align-items: stretch;
|
|
319
319
|
justify-content: flex-start;
|
|
320
|
-
gap:
|
|
320
|
+
gap: 4px;
|
|
321
321
|
min-height: 0;
|
|
322
|
-
padding:
|
|
322
|
+
padding: 4px 4px 8px;
|
|
323
323
|
text-align: left;
|
|
324
324
|
}
|
|
325
325
|
/* The containing block for the host's picture: a cover drawn to FILL its box
|
|
@@ -345,8 +345,8 @@
|
|
|
345
345
|
display: flex;
|
|
346
346
|
flex-direction: column;
|
|
347
347
|
align-items: center;
|
|
348
|
-
gap:
|
|
349
|
-
padding:
|
|
348
|
+
gap: 8px;
|
|
349
|
+
padding: 32px 12px;
|
|
350
350
|
text-align: center;
|
|
351
351
|
color: var(--es-muted);
|
|
352
352
|
}
|
package/dist/drag/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
-
import { P as Place, S as SlotAddress } from '../types-
|
|
3
|
+
import { P as Place, S as SlotAddress } from '../types-41704JE4.js';
|
|
4
4
|
import { C as CanvasTarget$1 } from '../watch-DmasQA61.js';
|
|
5
5
|
import { D as DragWords } from '../words-D9ChvbNC.js';
|
|
6
6
|
|
package/dist/drag/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"../chunk-O2NLQBFX.js";import{scrollBoxOf as t,startAutoScroll as n,isNoOpDrop as l}from"../chunk-
|
|
2
|
-
return x("div",{ref:
|
|
3
|
-
/* @__PURE__ */x("div",{className:["es-canvas-handle",
|
|
4
|
-
/* @__PURE__ */
|
|
1
|
+
import{DEFAULT_DRAG_WORDS as e}from"../chunk-O2NLQBFX.js";import{scrollBoxOf as t,startAutoScroll as n,isNoOpDrop as l}from"../chunk-6PS6STGA.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropOnRow,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-6PS6STGA.js";import{useCanvasLayout as a,useCanvasEvent as r}from"../chunk-MCLBHENY.js";import{framePointToHost as o,elementScale as s,frameRectToLayer as i,clientPointToLayer as c}from"../chunk-ZNCEOSXO.js";import{CloseIcon as d,SearchIcon as u}from"../chunk-PI26YXYD.js";import{parseZoneKey as h}from"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";import{useRef as p,useEffect as m,useState as f,useCallback as g,useMemo as b,useSyncExternalStore as y,useId as v}from"react";import{jsxs as x,jsx as k}from"react/jsx-runtime";var w=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,N=e=>e.width*e.height;function D(e,t,n){let l=null;for(const a of e)w(a.box,t,n)&&(!l||N(a.box)<=N(l.box))&&(l=a);return l}function S(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function A(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,o=a??l??e.box;return{left:r-1,top:o.top,width:2,height:o.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function T(e,t,n,l,a=()=>!1){const r=e.filter(e=>w(e.box,t,n)).sort((e,t)=>N(e.box)-N(t.box));for(const e of r){const r=S(e,t,n),o={...e.list,index:r};if(a(o))return null;if(l(o))return{zone:e,to:o,line:A(e,r)}}return null}function z(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],o=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(r.top-o,0)}})}return n}var C={nodes:[],zones:[]},E="data-puck-dropzone",L="data-puck-component";function O(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function j(e,t){const{frame:n,document:l}=e,a=e=>i(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],o=[];for(const e of l.querySelectorAll(`[${E}]`)){const t=e.getAttribute(E)??"";let n;try{n=h(t)}catch{continue}const l=[...e.querySelectorAll(`[${L}]`)].filter(t=>t.parentElement?.closest(`[${E}]`)===e),s=l.map(a);o.push({key:t,list:n,box:a(e),axis:O(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(L);l&&r.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:r,zones:o}}var B=140,M=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function K(i){const{canvas:d,session:u,readOnly:h,words:v=e.canvas}=i,w=p(i);m(()=>{w.current=i});const N=p(null),S=a(d),[A,z]=f(0),E=g(()=>z(e=>e+1),[]),[L,O]=f(C);m(()=>{const e=N.current;d&&e&&O((w.current.measure??j)(d,e))},[d,S,i.revision,A]);const B=i.model,K=b(()=>B(L),[B,L]),X=y(u.subscribe,u.shown,u.shown),[P,$]=f(null),[R,Y]=f(null),_=p(null),G=()=>{_.current&&clearTimeout(_.current),_.current=null},q=()=>{G(),_.current=setTimeout(()=>{u.get()||$(null)},140)};m(()=>G,[]),r(d,"mousemove",e=>{const t=N.current;if(!d||!t||w.current.readOnly||u.get())return;G();const n=o(d.frame,e.clientX,e.clientY,t),l=s(t),a=D(K.sources,n.x/l,n.y/l);$(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),r(d,"mouseout",e=>{e.relatedTarget||q()}),r(d,"mouseover",e=>{e.relatedTarget||E()});const I=p(null),Z=g(()=>{I.current?.(),I.current=null,Y(null)},[]);m(()=>u.subscribe(()=>{u.get()?E():Z()}),[u,Z,E]),m(()=>Z,[Z]);const F=e=>{const t=u.get(),n=N.current;if(!t||!n)return null;const a=c(n,e.clientX,e.clientY),r=T(K.zones,a.x,a.y,e=>w.current.canDrop(t.item,e),e=>!!t.from&&l(t.from,e));return r?{h:t,t:r}:null},Q={onDragEnter:e=>{if(I.current)return;const l=t(e.currentTarget.parentElement?.parentElement??null);I.current=l?n(l):null},onDragOver:e=>{const t=F(e);if(!t)return void Y(null);e.preventDefault(),e.dataTransfer.dropEffect=/move|all|uninitialized/i.test(e.dataTransfer.effectAllowed)?"move":"copy";const n={zoneKey:t.t.zone.key,line:t.t.line,axis:t.t.zone.axis};Y(e=>e&&e.zoneKey===n.zoneKey&&e.line.left===n.line.left&&e.line.top===n.line.top?e:n)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||Y(null)},onDrop:e=>{const t=F(e);t&&(e.preventDefault(),u.end(),Z(),w.current.onDrop(t.h.item,t.t.to))}},U={draggable:!h&&!!P,onMouseEnter:G,onMouseLeave:()=>!u.get()&&q(),onDragStart:e=>{if(P&&!h){u.start({key:P.key,item:P.item,from:P.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",P.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{u.end(),Z()},onClick:()=>{P&&!h&&w.current.onPick?.(P.item)}},{seams:V=[]}=K,H=K.zones.filter(e=>0===e.children.length);/* @__PURE__ */
|
|
2
|
+
return x("div",{ref:N,className:"es-canvas-layer",children:[X||!i.onSeamAdd||h?null:V.map(e=>/* @__PURE__ */k("div",{className:"es-canvas-seam",style:{left:e.box.left,top:e.box.top+e.box.height/2-8,width:e.box.width,height:16},children:/* @__PURE__ */k("button",{type:"button",className:"es-canvas-seam-add",onClick:()=>i.onSeamAdd?.(e.place),children:v.addButton({label:i.seamLabel??v.addSection})})},e.key)),i.onZoneAdd&&!h?H.map(e=>/* @__PURE__ */k("button",{type:"button",className:R?.zoneKey===e.key?"es-canvas-empty is-over":"es-canvas-empty",style:M(e.box),onClick:()=>i.onZoneAdd?.({...e.list,index:0}),children:v.addButton({label:i.zoneAddLabel??v.addBlock})},e.key)):null,X?/* @__PURE__ */k("div",{className:"es-canvas-catch",...Q}):null,R&&!H.some(e=>e.key===R.zoneKey)?/* @__PURE__ */k("div",{className:`es-canvas-line is-${R.axis}`,style:M(R.line)}):null,
|
|
3
|
+
/* @__PURE__ */x("div",{className:["es-canvas-handle",P&&!h?"is-shown":"",X?"is-dragging":""].filter(Boolean).join(" "),style:P?{left:P.box.left+2,top:Math.max(P.box.top-11,0)}:void 0,title:P?P.title??v.handle({label:P.label}):void 0,...U,children:[
|
|
4
|
+
/* @__PURE__ */k("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),P?.label]})]})}var X=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function P({groups:t,session:n,itemFor:l,onInsert:a,at:r,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const h=o??c.hint,p=s??c.search,[m,g]=f(""),b=v(),y=m.trim().toLowerCase(),w=t.map(e=>({...e,tiles:y?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,y)):e.tiles})).filter(e=>e.tiles.length>0);/* @__PURE__ */
|
|
5
5
|
return x("div",{className:"es-add",children:[r?/* @__PURE__ */x("div",{className:"es-add-at",role:"status",children:[
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
/* @__PURE__ */
|
|
8
|
-
/* @__PURE__ */
|
|
6
|
+
/* @__PURE__ */k("span",{children:r.label}),
|
|
7
|
+
/* @__PURE__ */k("button",{type:"button",className:"es-add-at-clear","aria-label":c.stop,title:c.stop,onClick:r.onClear,children:/* @__PURE__ */k(d,{size:12,"aria-hidden":"true"})})]}):null,
|
|
8
|
+
/* @__PURE__ */k("p",{className:"es-add-hint",children:h}),
|
|
9
9
|
/* @__PURE__ */x("div",{className:"es-add-search",children:[
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
10
|
+
/* @__PURE__ */k(u,{size:16,"aria-hidden":"true"}),
|
|
11
|
+
/* @__PURE__ */k("input",{id:b,type:"search","aria-label":p,placeholder:c.searchPlaceholder({label:p}),value:m,onChange:e=>g(e.target.value)}),m?/* @__PURE__ */k("button",{type:"button",className:"es-add-search-clear","aria-label":c.clearSearch,onClick:()=>g(""),children:/* @__PURE__ */k(d,{size:12,"aria-hidden":"true"})}):null]}),0===w.length?/* @__PURE__ */x("div",{className:"es-add-empty",role:"status",children:[
|
|
12
|
+
/* @__PURE__ */k("div",{className:"es-add-empty-title",children:c.nothing({query:m.trim()})}),
|
|
13
|
+
/* @__PURE__ */k("div",{className:"es-add-empty-sub",children:c.tryAnother})]}):w.map(e=>/* @__PURE__ */x("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
14
14
|
/* @__PURE__ */x("div",{className:"es-add-group-head",children:[
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
15
|
+
/* @__PURE__ */k("span",{className:"es-add-group-title",children:e.title}),
|
|
16
|
+
/* @__PURE__ */k("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
17
|
+
/* @__PURE__ */k("div",{className:X(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{/* @__PURE__ */return x("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!i,"aria-disabled":i||void 0,"aria-label":c.tile({label:e.label}),title:i?void 0:e.title??c.tile({label:e.label}),onDragStart:(t=e.type,e=>{if(i)e.preventDefault();else{n.start({key:`new:${t}`,item:l(t)}),e.dataTransfer.effectAllowed="copy";try{e.dataTransfer.setData("text/plain",t)}catch{}}}),onDragEnd:()=>n.end(),onClick:()=>!i&&a(e.type),children:[null!=e.cover?/* @__PURE__ */k("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */k("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
18
|
+
/* @__PURE__ */k("span",{className:"es-add-tile-label",children:e.label})]},e.type);var t})})]},e.title))]})}export{P as AddPanel,K as CanvasDragLayer,C as EMPTY_MEASURE,B as HANDLE_GRACE_MS,T as canvasTarget,w as contains,S as gapInZone,A as gapLine,j as measureCanvas,D as pickSource,z as seamsBetween};
|
|
@@ -29,7 +29,7 @@ type LockWords = {
|
|
|
29
29
|
*
|
|
30
30
|
* * `efficient-admin-portal/src/components/email/campaignEditLock.ts` — the
|
|
31
31
|
* campaign designer's copy, which alone had the TAKE-OVER half;
|
|
32
|
-
* * `efficient-
|
|
32
|
+
* * `efficient-storefront/lib/editor-page-lock.ts` — the storefront editor's copy,
|
|
33
33
|
* which alone had the claim/heartbeat driver, the auth-rejection rule and
|
|
34
34
|
* the "a template has no lock" rule.
|
|
35
35
|
*
|
package/dist/editor/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { DataInput } from '../data/index.js';
|
|
2
|
-
import { N as NodeSelection } from '../plan-
|
|
3
|
-
export { I as ItemSelector } from '../plan-
|
|
4
|
-
import { E as EditorConfig, a as EditorView, b as EditorAction, P as Permissions, c as EditorCore, d as EditorUi } from '../types-
|
|
5
|
-
export { A as AppState, e as EditorHistory, H as HistoryEntry, S as SetDataPatch } from '../types-
|
|
6
|
-
import { S as SlotAddress, D as Data, P as Place } from '../types-
|
|
7
|
-
import { c as ResolveTrigger, a as ResolveCache, R as ResolvableItem } from '../resolve-
|
|
2
|
+
import { N as NodeSelection } from '../plan-DChbUXdS.js';
|
|
3
|
+
export { I as ItemSelector } from '../plan-DChbUXdS.js';
|
|
4
|
+
import { E as EditorConfig, a as EditorView, b as EditorAction, P as Permissions, c as EditorCore, d as EditorUi } from '../types-Dy6oR6Z2.js';
|
|
5
|
+
export { A as AppState, e as EditorHistory, H as HistoryEntry, S as SetDataPatch } from '../types-Dy6oR6Z2.js';
|
|
6
|
+
import { S as SlotAddress, D as Data, P as Place } from '../types-41704JE4.js';
|
|
7
|
+
import { c as ResolveTrigger, a as ResolveCache, R as ResolvableItem } from '../resolve-D68pb3Bx.js';
|
|
8
8
|
import * as react from 'react';
|
|
9
9
|
import { ReactNode, CSSProperties, ComponentType, ReactElement } from 'react';
|
|
10
|
-
import { b as NodeOpsHost, C as ClipboardEntry } from '../useNodeOps-
|
|
11
|
-
import { I as InspectorFields } from '../types-
|
|
12
|
-
import '../buckets-
|
|
10
|
+
import { b as NodeOpsHost, C as ClipboardEntry } from '../useNodeOps-BF0fQsif.js';
|
|
11
|
+
import { I as InspectorFields } from '../types-C7HFvdtk.js';
|
|
12
|
+
import '../buckets-CuLM47h9.js';
|
|
13
13
|
|
|
14
14
|
interface EditorOptions<C extends EditorConfig = EditorConfig> {
|
|
15
15
|
config: C;
|