efficient-easel 0.97.0 → 0.99.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 +13 -5
- package/dist/autosave/index.d.ts +4 -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-YIMRTIBN.js → chunk-IBOFSS56.js} +1 -1
- package/dist/{chunk-OGZFDJ6G.js → chunk-JE63JHKO.js} +1 -1
- package/dist/{chunk-CERTFXCV.js → chunk-JYPOOHII.js} +3 -3
- package/dist/chunk-PI26YXYD.js +462 -0
- package/dist/chunk-SJQG5ENJ.js +1 -0
- package/dist/{chunk-2LUSK32B.js → chunk-ZT7M24XD.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/drag/drag.css +15 -15
- package/dist/drag/index.js +5 -5
- package/dist/edit-lock/index.d.ts +1 -1
- package/dist/editor/index.d.ts +2 -2
- package/dist/fields/fields.css +126 -12
- package/dist/fields/index.d.ts +59 -11
- package/dist/fields/index.js +40 -33
- package/dist/gold/index.d.ts +1 -1
- package/dist/gold/index.js +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/markup/index.d.ts +97 -21
- package/dist/markup/index.js +1 -1
- package/dist/menu/menu.css +4 -4
- 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/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 +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/catalogue.js +1 -1
- package/dist/strings/index.d.ts +4 -4
- package/dist/strings/index.js +1 -1
- 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-CEqUFH2j.d.ts → types-C7HFvdtk.d.ts} +26 -4
- package/dist/{types-CuNiSnX6.d.ts → types-CnRzp9oc.d.ts} +1 -1
- 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-6OPSJGAI.js +0 -1
- package/dist/chunk-FI23ALVJ.js +0 -1
- package/dist/chunk-YNZZYHA4.js +0 -450
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};function t(e){return/^[a-z][a-z0-9-]*$/.test(e)}function n(e,t){const n=/^\{(underline|sup|sub|color=([a-z][a-z0-9-]*))\}/.exec(e.slice(t,t+64));return n?void 0===n[2]?{kind:n[1],length:n[0].length}:{kind:"color",color:n[2],length:n[0].length}:null}var l={bold:e.bold.placeholder,italic:e.italic.placeholder,strike:e.strike.placeholder,code:e.code.placeholder,highlight:e.highlight.placeholder,quiet:e.quiet.placeholder,link:"link text",underline:e.underline.placeholder,sup:e.sup.placeholder,sub:e.sub.placeholder,color:"colored text"},o={bullet:()=>"- ",number:e=>`${e+1}. `,quote:()=>"> "};function r(t,n,r,i,c=p,u=l){if("clear"===i)return M(t,n,r,c);const a=t.slice(n,r);if("link"===i){const e=a||u.link,l=`[${e}](https://)`;return{text:t.slice(0,n)+l+t.slice(r),selectionStart:n+e.length+3,selectionEnd:n+l.length-1}}const d=o[i];if(d){const e=t.lastIndexOf("\n",Math.max(n-1,0))+1,l=t.indexOf("\n",r),o=-1===l?t.length:l,i=t.slice(e,o).split("\n"),s=i.every((e,t)=>e.startsWith(d(t))),c=i.map((e,t)=>s?e.slice(d(t).length):d(t)+e).join("\n");return{text:t.slice(0,e)+c+t.slice(o),selectionStart:e,selectionEnd:e+c.length}}const{open:h,close:f}=e[i],k=i,g=u[k]??l[k];if(s(t,n,r,i))return{text:t.slice(0,n-h.length)+a+t.slice(r+f.length),selectionStart:n-h.length,selectionEnd:n-h.length+a.length};const m=a||g;return{text:t.slice(0,n)+h+m+f+t.slice(r),selectionStart:n+h.length,selectionEnd:n+h.length+m.length}}function i(e,o,r,i,s=l){const c={text:e,selectionStart:o,selectionEnd:r};if(null!==i&&!t(i))return c;const u=e.slice(o,r),a=o>=1&&"["===e[o-1]&&"]"===e[r]?n(e,r+1):null;if("color"===a?.kind){const t=o-1,n=e.slice(r+1+a.length);return null===i?{text:e.slice(0,t)+u+n,selectionStart:t,selectionEnd:t+u.length}:{text:`${e.slice(0,r)}]{color=${i}}${n}`,selectionStart:o,selectionEnd:r}}if(null===i)return c;const d=u||(s.color??l.color);return{text:`${e.slice(0,o)}[${d}]{color=${i}}${e.slice(r)}`,selectionStart:o+1,selectionEnd:o+1+d.length}}function s(t,n,l,o){const r=e[o];if(!r)return!1;const{open:i,close:s}=r;return n>=i.length&&t.slice(n-i.length,n)===i&&t.slice(l,l+s.length)===s}function c(e,t,n){const l=0===t?0:e.lastIndexOf("\n",t-1)+1;for(let o=e.lastIndexOf("[",t);o>=l;o=0===o?-1:e.lastIndexOf("[",o-1)){const t=$(e,o);if(t&&n<=t.end)return{start:o,end:t.end,label:t.label,href:t.href}}return null}function u(e,t,n,l){const o=c(e,t,n),r=o?o.start:t,i=o?o.end:n,s=`[${o?o.label:e.slice(t,n)||l}](${l})`,u=r+s.length;return{text:e.slice(0,r)+s+e.slice(i),selectionStart:u,selectionEnd:u}}function a(e,t){return{text:e.slice(0,t.start)+t.label+e.slice(t.end),selectionStart:t.start,selectionEnd:t.start+t.label.length}}var d=[{style:"bold",label:"B",name:"Strong",title:"Strong · **words** · ⌘B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic · _words_ · ⌘I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough · ~~words~~"},{style:"highlight",label:"◆",name:"Emphasis",title:"Emphasis · ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet · ^^words^^"},{style:"code",label:"‹›",name:"Code",title:"Code"},{style:"link",label:"🔗",name:"Link",title:"Link · [words](https://…) · ⌘K",shortcut:"k"},{style:"bullet",label:"•",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"❝",name:"Quote",title:"Quote"},{style:"clear",label:"T×",name:"Clear marks",title:"Clear marks · ⌘⇧X",shortcut:"shift+x"}],h={bold:"Strong",highlight:"Emphasis",quiet:"Quiet"};function f(e){return d.filter(t=>e.includes(t.style))}var p=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold"}],k=d.map(e=>e.style).filter(e=>p.some(t=>t.kind===e)),g=[...p,{open:"*",close:"*",kind:"accent"}],m=[...p,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];function b(e){return!/\s/.test(e)&&!/[!-\/:-@[-`{-~]/.test(e)}function x(e,t){const n=[];let l="",o=0;for(;o<e.length;){const r=S(e,o,t);r?(n.push({kind:"text",text:l}),l="",n.push({kind:r.rule.kind,text:r.inner}),o=r.end):(l+=e[o],o+=1)}return n.push({kind:"text",text:l}),n}function S(e,t,l){for(const o of l){if(!e.startsWith(o.open,t))continue;if(o.wordBoundary&&t>0&&b(e[t-1]))continue;const l=t+o.open.length,r=e.indexOf(o.close,l);if(r<l+1)continue;const i=e.slice(l,r);if(i.includes(o.close[0]))continue;if(i.includes("\n"))continue;const s=r+o.close.length,c=e[s];if((!o.notBefore||void 0===c||!o.notBefore.includes(c))&&!(o.notBeforeBlock&&n(e,s)||o.wordBoundary&&void 0!==c&&b(c)))return{rule:o,inner:i,end:s}}return null}function y(e,t){return x(e,t).map(e=>e.text).join("")}var v=["http","https","mailto","tel"];function E(e){if(""===e||/[\s\u0000-\u001f\u007f]/.test(e))return!1;const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||v.includes(t[1].toLowerCase())}function $(e,t){if("["!==e[t])return null;const n=e.indexOf("]",t+1);if(n<t+2||"("!==e[n+1])return null;const l=e.slice(t+1,n);if(l.includes("["))return null;const o=e.indexOf(")",n+2);if(-1===o)return null;const r=e.slice(n+2,o);return E(r)?{label:l,href:r,end:o+1}:null}function B(e,t){if("["!==e[t])return null;let l=0;for(let o=t;o<e.length;o+=1){const r=e[o];if("\n"===r)return null;if("["===r)l+=1;else if("]"===r){if(l-=1,l>0)continue;if(o===t+1)return null;const r=n(e,o+1);return r?{kind:r.kind,color:r.color,label:e.slice(t+1,o),close:e.slice(o,o+1+r.length),end:o+1+r.length}:null}}return null}var w=4;function q(e,t,n){const l=[];let o="";const r=()=>{o&&l.push({kind:"text",text:o}),o=""},i=e=>n+1<w?q(e,t,n+1):[{kind:"text",text:e}];let s=0;for(;s<e.length;){const n=$(e,s);if(n){r(),l.push({kind:"link",href:n.href,children:i(n.label)}),s=n.end;continue}const c=B(e,s);if(c){r(),l.push({kind:c.kind,open:"[",close:c.close,...void 0===c.color?{}:{color:c.color},children:i(c.label)}),s=c.end;continue}const u=S(e,s,t);u?(r(),l.push({kind:u.rule.kind,open:u.rule.open,close:u.rule.close,children:i(u.inner)}),s=u.end):(o+=e[s],s+=1)}return r(),l}function O(e,t){return e.split("\n").map(e=>{const{bullet:n,number:l,rest:o}=function(e){if(e.startsWith("- ")&&""!==e.slice(2).trim())return{bullet:!0,number:null,rest:e.slice(2)};const t=/^([0-9]{1,3})\. /.exec(e);return t&&""!==e.slice(t[0].length).trim()?{bullet:!1,number:t[1],rest:e.slice(t[0].length)}:{bullet:!1,number:null,rest:e}}(e);return{bullet:n,number:l,children:q(o,t,0)}})}function I(e){return null!=e.number?`${e.number}. `:e.bullet?"- ":""}function z(e){return e.map(e=>"text"===e.kind?e.text:"link"===e.kind?`[${z(e.children)}](${e.href})`:e.open+z(e.children)+e.close).join("")}function _(e){return e.map(e=>I(e)+z(e.children)).join("\n")}function C(n,l,o){if("link"===l)return void 0===o?null:{id:n,kind:"link",open:"[",close:`](${o})`,href:o};if("color"===l)return void 0!==o&&t(o)?{id:n,kind:"color",open:"[",close:`]{color=${o}}`,color:o}:null;const r=e[l];return r&&"code"!==l?{id:n,kind:l,open:r.open,close:r.close}:null}function Q(e,t){let n=0,l=0;return e.split("\n").map(e=>{const[o]=O(e,t);let r=l+I(o).length;l+=e.length+1;const i=[],s=(e,t)=>{for(const l of e){if("text"===l.kind){for(const e of l.text)i.push({ch:e,marks:t,at:r}),r+=e.length;continue}const e="link"===l.kind?C(++n,"link",l.href):{id:++n,kind:l.kind,open:l.open,close:l.close,...void 0===l.color?{}:{color:l.color}};r+=e.open.length,s(l.children,[...t,e]),r+=e.close.length}};return s(o.children,[]),{bullet:o.bullet,number:o.number??null,chars:i}})}function j(e){let t="";const n=[];return e.forEach((e,l)=>{l>0&&(t+="\n"),t+=I(e);const o=[],r=[];for(const n of e.chars){let e=0;for(;e<o.length&&e<n.marks.length&&o[e].id===n.marks[e].id;)e+=1;for(;o.length>e;)t+=o.pop().close;for(let l=e;l<n.marks.length;l+=1)t+=n.marks[l].open,o.push(n.marks[l]);r.push(t.length),t+=n.ch}for(;o.length>0;)t+=o.pop().close;n.push(r)}),{text:t,at:n}}function L(e,t){return e.length===t.length&&e.every((e,n)=>{const l=t[n];return e.bullet===l.bullet&&(e.number??null)===(l.number??null)&&(e.chars.length===l.chars.length&&e.chars.every((e,t)=>{const n=l.chars[t];return e.ch===n.ch&&e.marks.length===n.marks.length&&e.marks.every((e,t)=>e.kind===n.marks[t].kind&&e.href===n.marks[t].href&&e.color===n.marks[t].color)}))})}function M(e,t,n,l=p){const o=Q(e,l),r=o.flatMap(e=>e.chars),i={text:e,selectionStart:t,selectionEnd:n},s=e=>o.map(t=>({bullet:t.bullet,number:t.number,chars:t.chars.map(t=>({...t,marks:t.marks.filter(n=>"link"===n.kind||!e(t,n))}))})),c=e=>{const t=j(e);return L(e,Q(t.text,l))?t:null},u=(e,t)=>{let n=r.indexOf(t);for(let t=0;t<e.at.length;t+=1){if(n<e.at[t].length)return e.at[t][n];n-=e.at[t].length}return 0};if(t===n){const e=[...r].reverse().find(e=>e.at<t),n=r.find(e=>e.at>=t),l=new Set([...e?.marks??[],...n?.marks??[]].map(e=>e.id));if(![...l].some(e=>r.some(t=>t.marks.some(t=>t.id===e&&"link"!==t.kind))))return i;const o=c(s((e,t)=>l.has(t.id)));if(!o)return i;const a=n?u(o,n):e?u(o,e)+e.ch.length:0;return{text:o.text,selectionStart:a,selectionEnd:a}}const a=new Set(r.filter(e=>e.at>=t&&e.at<n));if(0===a.size)return i;const d=new Set([...a].flatMap(e=>e.marks.map(e=>e.id))),h=c(s(e=>a.has(e)))??c(s((e,t)=>d.has(t.id)));if(!h)return i;const f=r.find(e=>a.has(e)),k=[...r].reverse().find(e=>a.has(e));return{text:h.text,selectionStart:u(h,f),selectionEnd:u(h,k)+k.ch.length}}export{m as CAMPAIGN_MARKUP,k as COPY_FIELD_TOOLS,d as MARKUP_TOOLS,h as MARK_NAMES,l as MARK_PLACEHOLDERS,p as STANDARD_MARKUP,g as STOREFRONT_MARKUP,i as applyColor,r as applyMark,M as clearMarks,c as findLink,t as isColorName,E as isSafeLinkHref,s as markedAt,Q as markedLines,f as markupTools,O as parseMarkup,a as removeLink,L as sameMarks,_ as serializeMarkup,C as spanFor,y as stripInline,x as tokenizeInline,u as writeLink,j as writeMarkedLines};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"./chunk-
|
|
1
|
+
import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"./chunk-SJQG5ENJ.js";var i={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},link:{title:"Link",label:"Link to",placeholder:"https://… or /page",refused:"Use a web address (https://…), a page on this site (/…), mailto: or tel:.",remove:"Remove link",apply:"Apply"},marks:Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),placeholders:t};export{i as DEFAULT_COPY_WORDS};
|
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-
|
|
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-ZT7M24XD.js";import{SettingsSegmented as t}from"../chunk-QB3BZIRA.js";import{GoldTextInput as n}from"../chunk-JYPOOHII.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-SJQG5ENJ.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 w,EmphasisIcon as C,StrikeIcon as D,ItalicIcon as N,BoldIcon as S}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 $}from"react/jsx-runtime";var A=["left","center","right","justify"],B=e.align,M={left:/* @__PURE__ */T(k,{}),center:/* @__PURE__ */T(g,{}),right:/* @__PURE__ */T(b,{}),justify:/* @__PURE__ */T(y,{})},R={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function I(e,t=B){return A.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:M[e],title:t[e]}))}var Y=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function F(e){if(e.every(e=>e.label===B[e.id]))return e.length>3?R.four:R.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(Y.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function O(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function Z(e,t,n,r=l){const{start:o,end:i}=O(e,n);return r(e,o,i,t)}function q(e,t,n){const{start:l,end:r}=O(e,n),o=l+t.length;return{text:e.slice(0,l)+t+e.slice(r),selectionStart:o,selectionEnd:o}}var H=1e3;function J(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 X({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 G=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),Q=/* @__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 U(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(G.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=Q.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=W(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 W(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(S,{size:16}),italic:/* @__PURE__ */T(N,{size:16}),strike:/* @__PURE__ */T(D,{size:16}),highlight:/* @__PURE__ */T(C,{size:16}),quiet:/* @__PURE__ */T(w,{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($,{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:w,actions:C,align:D,glyphs:N,barLabel:S,renderFooter:E,inputRef:K,barShows:$="always"}){const A=m("copy",e),B=j(null),M=K??B,[R,Y]=L(!1),[O,H]=L(null),G=j(J()).current,Q=j(null);P(()=>{const e=Q.current;e&&o===e.to?Q.current=null:e&&o===e.from||(Q.current=null,G.reset())},[o,G]);const W=e=>{Q.current={from:Q.current?.from??o,to:e},i(e)},V=e=>({text:o,start:e?.selectionStart??O?.start??o.length,end:e?.selectionEnd??O?.end??o.length}),_=ne({target:M,onChange:W}),ee=e=>(H({start:e.selectionStart,end:e.selectionEnd}),e),le=e=>_(t=>(G.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(O)for(const e of se)ce[e]="link"===e?null!==u(o,O.start,O.end):d(o,O.start,O.end,e);const ue=e=>{if("clear"===e)return void le(t=>Z(o,e,t,(e,t,n)=>l(e,t,n,"clear",ie)));if("link"!==e){const t=w??((e,t,n,o)=>l(e,t,n,o,r,A.placeholders));return void le(n=>Z(o,e,n,t))}const t=M.current,n=t?.selectionStart??o.length,i=t?.selectionEnd??n;oe({start:n,end:i,link:u(o,n,i)})},de=D?I(D.allow,A.align):[];/* @__PURE__ */
|
|
9
|
+
return z("div",{className:"es-copy"+(g?` ${g}`:""),onFocus:()=>Y(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||Y(!1)},onKeyDown:e=>{if(k||e.target!==M.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=G[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=M.current;if(k||!t||e.target!==t)return;e.preventDefault();const n=U({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:t.ownerDocument,multiline:f,rules:ie});le(e=>q(o,n,e))},onSelect:()=>{const e=M.current;e&&e.ownerDocument.activeElement===e&&H({start:e.selectionStart??o.length,end:e.selectionEnd??o.length})},children:["always"===$||R||null!==re?/* @__PURE__ */T(te,{tools:x,disabled:k,actions:C,glyphs:N,ariaLabel:S,pressed:ce,open:re?"link":null,onApply:ue,align:D?/* @__PURE__ */T(t,{options:de,value:D.value,onChange:D.onChange,ariaLabel:A.alignment,disabled:k||D.disabled,fit:F(de)}):null}):null,
|
|
10
|
+
/* @__PURE__ */T(n,{value:o,onInput:e=>{G.record(V(null),"type",Date.now()),W(e)},onCommit:a,onCancel:s,multiline:f,placeholder:y,ariaLabel:b,rules:v,disabled:k,inputRef:M,className:"es-copy-box"}),re?/* @__PURE__ */T(X,{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),M.current?.focus()}}):null,E?E({focused:R,insert:e=>le(t=>q(o,e,t))}):null]})}export{A as COPY_ALIGNS,R as COPY_ALIGN_FIT,M as COPY_ALIGN_GLYPHS,B as COPY_ALIGN_LABELS,le as CopyBox,te as MarkBar,H as TYPING_BURST_MS,_ as ariaShortcut,I as copyAlignOptions,J as createHistory,q as insertSelection,Z as markSelection,U as pasteToMarkup,ne as useCaretEdit};
|
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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
2
|
-
return x("div",{ref:N,className:"es-canvas-layer",children:[X||!i.onSeamAdd||h?null:
|
|
3
|
-
/* @__PURE__ */x("div",{className:["es-canvas-handle"
|
|
4
|
-
/* @__PURE__ */k("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"})
|
|
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
6
|
/* @__PURE__ */k("span",{children:r.label}),
|
|
7
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,
|
|
@@ -15,4 +15,4 @@ return x("div",{className:"es-add",children:[r?/* @__PURE__ */x("div",{className
|
|
|
15
15
|
/* @__PURE__ */k("span",{className:"es-add-group-title",children:e.title}),
|
|
16
16
|
/* @__PURE__ */k("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
17
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{
|
|
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
|
@@ -8,8 +8,8 @@ import { c as ResolveTrigger, a as ResolveCache, R as ResolvableItem } from '../
|
|
|
8
8
|
import * as react from 'react';
|
|
9
9
|
import { ReactNode, CSSProperties, ComponentType, ReactElement } from 'react';
|
|
10
10
|
import { b as NodeOpsHost, C as ClipboardEntry } from '../useNodeOps-BF0fQsif.js';
|
|
11
|
-
import { I as InspectorFields } from '../types-
|
|
12
|
-
import '../buckets-
|
|
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;
|
package/dist/fields/fields.css
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
width: 100%;
|
|
19
19
|
min-width: 0;
|
|
20
20
|
height: 32px;
|
|
21
|
-
padding: 0
|
|
21
|
+
padding: 0 12px;
|
|
22
22
|
border: 1px solid var(--es-input-border);
|
|
23
23
|
border-radius: var(--es-field-radius);
|
|
24
24
|
background: var(--es-field-bg);
|
|
@@ -41,22 +41,136 @@
|
|
|
41
41
|
.es-fin--area {
|
|
42
42
|
height: auto;
|
|
43
43
|
min-height: 64px;
|
|
44
|
-
padding: 8px
|
|
44
|
+
padding: 8px 12px;
|
|
45
45
|
resize: vertical;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
/* ── a number: the
|
|
48
|
+
/* ── a number: the cell (plan step E4) ─────────────────────────────────────
|
|
49
|
+
icon · number · unit · two stacked arrows, in ONE box with react-os-shell's
|
|
50
|
+
Input look (32px tall, the shell's border and radius, 14px text). The ring
|
|
51
|
+
is on the whole cell while the number inside has focus, as the design draws
|
|
52
|
+
it: react-os-shell's blue-400 line and a 2px ring at 30%.
|
|
53
|
+
|
|
54
|
+
SPACING IS THE SCALE ONLY (2 / 4 / 8 / 12 / 16 / 32), read from the
|
|
55
|
+
`--es-space-*` tokens. The fallback after each is the same step, for a host
|
|
56
|
+
whose sheet is older than the scale. */
|
|
49
57
|
|
|
50
58
|
.es-fnum {
|
|
59
|
+
box-sizing: border-box;
|
|
51
60
|
display: flex;
|
|
52
|
-
align-items:
|
|
53
|
-
gap:
|
|
61
|
+
align-items: stretch;
|
|
62
|
+
gap: var(--es-space-4, 4px);
|
|
54
63
|
width: 100%;
|
|
55
64
|
min-width: 0;
|
|
65
|
+
height: 32px;
|
|
66
|
+
padding-inline: var(--es-space-8, 8px);
|
|
67
|
+
border: 1px solid var(--es-input-border);
|
|
68
|
+
border-radius: var(--es-field-radius);
|
|
69
|
+
background: var(--es-field-bg);
|
|
70
|
+
color: var(--es-field-text);
|
|
71
|
+
}
|
|
72
|
+
.es-fnum--arrows { padding-inline-end: 0; }
|
|
73
|
+
.es-fnum:hover:not(.is-readonly):not(:focus-within) { border-color: var(--es-muted); }
|
|
74
|
+
.es-fnum:focus-within {
|
|
75
|
+
border-color: var(--es-focus-line, #60a5fa);
|
|
76
|
+
box-shadow: 0 0 0 2px var(--es-focus-ring, rgba(96, 165, 250, 0.3));
|
|
77
|
+
}
|
|
78
|
+
.es-fnum.is-readonly { background: var(--es-track-bg); color: var(--es-muted); }
|
|
79
|
+
|
|
80
|
+
.es-fnum-icon { display: flex; align-items: center; flex: none; color: var(--es-field-placeholder); }
|
|
81
|
+
.es-fnum-icon svg { width: 14px; height: 14px; }
|
|
82
|
+
|
|
83
|
+
.es-fnum-box {
|
|
84
|
+
flex: 1 1 auto;
|
|
85
|
+
min-width: 0;
|
|
86
|
+
width: 100%;
|
|
87
|
+
padding: 0;
|
|
88
|
+
border: 0;
|
|
89
|
+
outline: none;
|
|
90
|
+
background: none;
|
|
91
|
+
color: inherit;
|
|
92
|
+
font: inherit;
|
|
93
|
+
font-size: 14px;
|
|
94
|
+
font-variant-numeric: tabular-nums;
|
|
95
|
+
}
|
|
96
|
+
.es-fnum-box::placeholder { color: var(--es-field-placeholder); opacity: 1; }
|
|
97
|
+
/* A grey number follows the style: what shows is the style's, not the cell's. */
|
|
98
|
+
.es-fnum.is-style .es-fnum-box { color: var(--es-field-placeholder); }
|
|
99
|
+
|
|
100
|
+
.es-fnum-unit { align-self: center; flex: none; font-size: 12px; color: var(--es-muted); white-space: nowrap; }
|
|
101
|
+
|
|
102
|
+
.es-fnum-arrows {
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
flex: none;
|
|
106
|
+
width: 18px;
|
|
107
|
+
border-left: 1px solid var(--es-line);
|
|
108
|
+
}
|
|
109
|
+
.es-fnum-arrow {
|
|
110
|
+
flex: 1 1 0;
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
min-height: 0;
|
|
115
|
+
padding: 0;
|
|
116
|
+
border: 0;
|
|
117
|
+
background: none;
|
|
118
|
+
color: var(--es-icon);
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
touch-action: none;
|
|
121
|
+
}
|
|
122
|
+
.es-fnum-arrow--up {
|
|
123
|
+
border-bottom: 1px solid var(--es-line);
|
|
124
|
+
border-top-right-radius: calc(var(--es-field-radius) - 1px);
|
|
125
|
+
}
|
|
126
|
+
.es-fnum-arrow--down { border-bottom-right-radius: calc(var(--es-field-radius) - 1px); }
|
|
127
|
+
.es-fnum-arrow:hover:not(:disabled) { background: var(--es-hover); color: var(--es-text); }
|
|
128
|
+
.es-fnum-arrow:disabled { color: var(--es-disabled); cursor: default; }
|
|
129
|
+
.es-fnum-arrow svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
|
|
130
|
+
|
|
131
|
+
/* ── a slider row (Site styles, Email styles; plan step E4) ────────────────
|
|
132
|
+
The name left and the value right on one line, the slider under them. The
|
|
133
|
+
value is a quiet box until it is hovered or has focus. */
|
|
134
|
+
|
|
135
|
+
.es-fslider { display: flex; flex-direction: column; gap: var(--es-space-4, 4px); min-width: 0; }
|
|
136
|
+
.es-fslider-top {
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: baseline;
|
|
139
|
+
justify-content: space-between;
|
|
140
|
+
gap: var(--es-space-8, 8px);
|
|
141
|
+
min-width: 0;
|
|
56
142
|
}
|
|
57
|
-
.es-
|
|
58
|
-
|
|
59
|
-
|
|
143
|
+
.es-fslider-name {
|
|
144
|
+
min-width: 0;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
text-overflow: ellipsis;
|
|
147
|
+
white-space: nowrap;
|
|
148
|
+
font-size: 12px;
|
|
149
|
+
font-weight: 500;
|
|
150
|
+
color: var(--es-text-secondary);
|
|
151
|
+
}
|
|
152
|
+
.es-fslider-read { display: inline-flex; align-items: baseline; gap: var(--es-space-2, 2px); flex: none; }
|
|
153
|
+
.es-fslider-value {
|
|
154
|
+
box-sizing: content-box;
|
|
155
|
+
width: 5ch;
|
|
156
|
+
padding: var(--es-space-2, 2px) var(--es-space-4, 4px);
|
|
157
|
+
border: 0;
|
|
158
|
+
border-radius: 4px;
|
|
159
|
+
outline: none;
|
|
160
|
+
background: none;
|
|
161
|
+
color: var(--es-field-text);
|
|
162
|
+
font: inherit;
|
|
163
|
+
font-size: 12.5px;
|
|
164
|
+
font-variant-numeric: tabular-nums;
|
|
165
|
+
text-align: right;
|
|
166
|
+
cursor: text;
|
|
167
|
+
}
|
|
168
|
+
.es-fslider-value:hover { background: var(--es-hover); }
|
|
169
|
+
.es-fslider-value:focus { background: var(--es-field-bg); box-shadow: inset 0 0 0 1px var(--es-focus-line, #60a5fa); }
|
|
170
|
+
.es-fslider-value::placeholder { color: var(--es-field-placeholder); opacity: 1; }
|
|
171
|
+
.es-fslider.is-style .es-fslider-value { color: var(--es-field-placeholder); }
|
|
172
|
+
.es-fslider-unit { font-size: 12px; color: var(--es-field-placeholder); }
|
|
173
|
+
.es-fslider-range { width: 100%; height: 18px; margin: 0; accent-color: var(--es-accent); }
|
|
60
174
|
|
|
61
175
|
.es-fbtn {
|
|
62
176
|
height: 28px;
|
|
@@ -116,7 +230,7 @@
|
|
|
116
230
|
}
|
|
117
231
|
.es-fsel-list:focus { outline: none; }
|
|
118
232
|
.es-fsel-option {
|
|
119
|
-
padding:
|
|
233
|
+
padding: 8px;
|
|
120
234
|
border-radius: var(--es-field-radius);
|
|
121
235
|
font-size: 12px;
|
|
122
236
|
color: var(--es-text);
|
|
@@ -155,7 +269,7 @@
|
|
|
155
269
|
justify-content: space-between;
|
|
156
270
|
gap: 8px;
|
|
157
271
|
}
|
|
158
|
-
.es-list-label { display: inline-flex; align-items: center; gap:
|
|
272
|
+
.es-list-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--es-text); }
|
|
159
273
|
.es-list-count { font-size: 11px; color: var(--es-muted); }
|
|
160
274
|
/* The rows are Layers' rows (tree.css); the list lets them reach the panel's
|
|
161
275
|
edges the way Layers' do, so a row's hover reads as the same row. */
|
|
@@ -181,9 +295,9 @@
|
|
|
181
295
|
align-self: flex-start;
|
|
182
296
|
display: inline-flex;
|
|
183
297
|
align-items: center;
|
|
184
|
-
gap:
|
|
298
|
+
gap: 8px;
|
|
185
299
|
height: 28px;
|
|
186
|
-
padding: 0 8px
|
|
300
|
+
padding: 0 8px;
|
|
187
301
|
border: 0;
|
|
188
302
|
border-radius: var(--es-field-radius);
|
|
189
303
|
background: var(--es-hover);
|