efficient-easel 2.1.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -4
- package/dist/chrome/index.d.ts +2 -2
- package/dist/chrome/index.js +1 -1
- package/dist/{chunk-2JIWFFXA.js → chunk-42TMLDSQ.js} +1 -1
- package/dist/{chunk-6OY2THZH.js → chunk-4LD4KA27.js} +1 -1
- package/dist/chunk-53NZMIRT.js +1 -0
- package/dist/chunk-5SOSVTVI.js +5 -0
- package/dist/{chunk-7SQF6LZL.js → chunk-66LWADFP.js} +1 -1
- package/dist/chunk-7HGVGKWU.js +64 -0
- package/dist/{chunk-VB5LRSGJ.js → chunk-BVUPKIM3.js} +1 -1
- package/dist/chunk-CRPJGCSO.js +20 -0
- package/dist/{chunk-35Q5HMJZ.js → chunk-EF3YSWT5.js} +1 -1
- package/dist/chunk-EJ6QAWRH.js +5 -0
- package/dist/chunk-FFYXVAAL.js +1 -0
- package/dist/{chunk-OXYGFK2B.js → chunk-GTDLBUOC.js} +6 -6
- package/dist/chunk-JVUGLF5I.js +7 -0
- package/dist/chunk-JZDEIRH4.js +1 -0
- package/dist/{chunk-UAVNI3BU.js → chunk-LHZIMK3M.js} +1 -1
- package/dist/chunk-LYALMY55.js +1 -0
- package/dist/{chunk-ZV6OYSZ7.js → chunk-MYC3AVG2.js} +1 -1
- package/dist/{chunk-FOBGSFFS.js → chunk-OZ72A6MY.js} +7 -7
- package/dist/{chunk-ZNNATBDC.js → chunk-QMBB7SU5.js} +1 -1
- package/dist/chunk-TCNPQKY6.js +4 -0
- package/dist/{chunk-AAT3O7PK.js → chunk-TGF7KEO7.js} +1 -1
- package/dist/chunk-UV4D7CDX.js +5 -0
- package/dist/{chunk-ONRYLR2D.js → chunk-VGV5D667.js} +2 -2
- package/dist/chunk-VX5GDBRI.js +2 -0
- package/dist/chunk-Y2G7CU6A.js +1 -0
- package/dist/copy/copy.css +79 -82
- package/dist/copy/index.d.ts +9 -7
- package/dist/copy/index.js +21 -31
- package/dist/fields/fields.css +0 -28
- package/dist/fields/index.d.ts +2 -2
- package/dist/fields/index.js +1 -1
- package/dist/panel/index.d.ts +4 -222
- package/dist/panel/index.js +12 -15
- package/dist/panel/panel.css +0 -165
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.d.ts +1 -1
- package/dist/screen/components/MediaSidePanel.js +1 -1
- package/dist/screen/components/NodeContextMenu.d.ts +16 -14
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/PageEditGuardNotices.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
- package/dist/screen/components/ScreenDocumentContext.js +1 -1
- package/dist/screen/components/ScreenMount.d.ts +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +16 -16
- package/dist/screen/components/SidePanelHead.js +1 -1
- package/dist/screen/components/UiIcon.js +1 -1
- package/dist/screen/components/panel-widths.js +1 -1
- package/dist/screen/components/usePartBridge.d.ts +1 -1
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.d.ts +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/admin-bridge.d.ts +1 -1
- package/dist/screen/lib/document-addressing.d.ts +1 -1
- package/dist/screen/lib/host-chrome.d.ts +1 -1
- package/dist/screen/lib/host.d.ts +1 -1
- package/dist/screen/lib/links/link-filters.d.ts +1 -2
- package/dist/screen/lib/media-panel.d.ts +1 -1
- package/dist/screen/lib/media-picker.d.ts +1 -1
- package/dist/screen/lib/page-lock.d.ts +1 -1
- package/dist/screen/lib/puck/device-fields.js +1 -1
- package/dist/screen/lib/puck/style-clipboard.d.ts +8 -4
- package/dist/screen/lib/puck/style-clipboard.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.d.ts +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/screen/lib/section-templates.d.ts +1 -1
- package/dist/screen/lib/session-context.d.ts +1 -1
- package/dist/screen/lib/session.d.ts +1 -1
- package/dist/screen/words.d.ts +123 -1
- package/dist/screen/words.js +1 -1
- package/dist/strings/catalogue.d.ts +3 -3
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +3 -3
- package/dist/strings/index.js +1 -1
- package/dist/text-styles/index.js +11 -11
- package/dist/{words-AHHfiaRY.d.ts → words-C1U_dLBh.d.ts} +7 -0
- package/dist/{words-XH0TvZPg.d.ts → words-lpvYzf5U.d.ts} +4 -19
- package/dist/{words-D8kf071T.d.ts → words-vhnV8sM7.d.ts} +4 -26
- package/package.json +3 -3
- package/dist/LinkPicker-hPEr1MJx.d.ts +0 -113
- package/dist/chunk-4TMMEBAG.js +0 -4
- package/dist/chunk-5TRBCPRB.js +0 -5
- package/dist/chunk-BSSKAEFF.js +0 -5
- package/dist/chunk-E2O2MRZR.js +0 -1
- package/dist/chunk-FPOKPNO4.js +0 -1
- package/dist/chunk-HGTPLCTQ.js +0 -1
- package/dist/chunk-PWZOS45R.js +0 -2
- package/dist/chunk-RC6DD4XP.js +0 -7
- package/dist/chunk-TSQUEJZB.js +0 -5
- package/dist/chunk-UEM66O42.js +0 -64
- package/dist/chunk-UH7IGZKF.js +0 -1
- package/dist/chunk-VETFIYQR.js +0 -23
- package/dist/chunk-ZJEBF4NB.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -517,7 +517,7 @@
|
|
|
517
517
|
"dist"
|
|
518
518
|
],
|
|
519
519
|
"peerDependencies": {
|
|
520
|
-
"efficient-shell": "^4.
|
|
520
|
+
"efficient-shell": "^5.6.0 || ^6.4.0 || ^7.7.0",
|
|
521
521
|
"react": ">=18",
|
|
522
522
|
"react-dom": ">=18"
|
|
523
523
|
},
|
|
@@ -527,7 +527,7 @@
|
|
|
527
527
|
"@types/node": "^22.0.0",
|
|
528
528
|
"@types/react": "^18.2.0",
|
|
529
529
|
"@types/react-dom": "^18.2.0",
|
|
530
|
-
"efficient-shell": "^
|
|
530
|
+
"efficient-shell": "^7.7.0",
|
|
531
531
|
"esbuild": "^0.27.0",
|
|
532
532
|
"jsdom": "^26.1.0",
|
|
533
533
|
"react": "^18.2.0",
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
|
|
3
|
-
/** One thing a link can point at: the URL it writes and the name it shows. */
|
|
4
|
-
type LinkOption = {
|
|
5
|
-
value: string;
|
|
6
|
-
label: string;
|
|
7
|
-
};
|
|
8
|
-
/** Options under one heading — the anchors of one page. */
|
|
9
|
-
type LinkOptionGroup = {
|
|
10
|
-
label: string;
|
|
11
|
-
options: readonly LinkOption[];
|
|
12
|
-
};
|
|
13
|
-
/** One filter on a link onto the product listing, or none. */
|
|
14
|
-
type LinkFilter = {
|
|
15
|
-
param: string;
|
|
16
|
-
value: string;
|
|
17
|
-
} | null;
|
|
18
|
-
/** A filter a listing link may offer, with the values it may take. */
|
|
19
|
-
type LinkFilterField = {
|
|
20
|
-
param: string;
|
|
21
|
-
label: string;
|
|
22
|
-
values: readonly LinkOption[];
|
|
23
|
-
};
|
|
24
|
-
/** What a kind's target box is: a list, a list in groups, or a typed address. */
|
|
25
|
-
type LinkTarget = {
|
|
26
|
-
type: 'select';
|
|
27
|
-
options: readonly LinkOption[];
|
|
28
|
-
placeholder: string;
|
|
29
|
-
} | {
|
|
30
|
-
type: 'groups';
|
|
31
|
-
groups: readonly LinkOptionGroup[];
|
|
32
|
-
placeholder: string;
|
|
33
|
-
} | {
|
|
34
|
-
type: 'text';
|
|
35
|
-
};
|
|
36
|
-
/** One entry of the Link type list, with everything its target box offers. */
|
|
37
|
-
type LinkKindChoice = {
|
|
38
|
-
/** The kind's key — what `rules.kindOf` answers. */
|
|
39
|
-
value: string;
|
|
40
|
-
/** Its name in the list ("Page", "Blog post"), and its target box's name. */
|
|
41
|
-
label: string;
|
|
42
|
-
target: LinkTarget;
|
|
43
|
-
/** A quiet line under the boxes while this kind is chosen. */
|
|
44
|
-
hint?: string;
|
|
45
|
-
/** Left out of the list while its target has nothing to pick — unless the
|
|
46
|
-
* saved link is this kind, so a link is never shown as something it is not. */
|
|
47
|
-
hideWhenEmpty?: boolean;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Everything the picker needs to know about a URL — and it knows nothing else.
|
|
51
|
-
* A host hands in its own rules (the storefront's come from
|
|
52
|
-
* `efficient-web-builder/links`), so a new kind or a new filter never changes
|
|
53
|
-
* this file.
|
|
54
|
-
*/
|
|
55
|
-
type LinkRules = {
|
|
56
|
-
/** Which kind a saved URL is. */
|
|
57
|
-
kindOf: (url: string) => string;
|
|
58
|
-
/** The target a URL points at, with any listing filter taken off. */
|
|
59
|
-
targetOf: (url: string) => string;
|
|
60
|
-
/** The filter a URL carries onto the listing, or null. */
|
|
61
|
-
readFilter: (url: string) => LinkFilter;
|
|
62
|
-
/** The URL of a target with this filter written on (or cleared). */
|
|
63
|
-
withFilter: (url: string, filter: LinkFilter) => string;
|
|
64
|
-
/** May this typed address be saved? */
|
|
65
|
-
isSafe: (url: string) => boolean;
|
|
66
|
-
};
|
|
67
|
-
type LinkPickerProps = {
|
|
68
|
-
/** The saved link, or `''`. */
|
|
69
|
-
value: string;
|
|
70
|
-
/**
|
|
71
|
-
* The new link, and — when a thing was PICKED — its name, so a host can fill
|
|
72
|
-
* its own label with it (the admin's menu item does). No name when the link
|
|
73
|
-
* was typed or cleared.
|
|
74
|
-
*/
|
|
75
|
-
onChange: (url: string, name?: string) => void;
|
|
76
|
-
/** The Link type list, in order, each with what its target box offers. */
|
|
77
|
-
kinds: readonly LinkKindChoice[];
|
|
78
|
-
rules: LinkRules;
|
|
79
|
-
/**
|
|
80
|
-
* The filters a link onto this target may carry, or null when the target is
|
|
81
|
-
* not the product listing. Asked only for a kind whose target is a list.
|
|
82
|
-
*/
|
|
83
|
-
filtersFor?: (target: string) => readonly LinkFilterField[] | null;
|
|
84
|
-
/** The whole control's accessible name — "Button link", "Where “Wheels” goes". */
|
|
85
|
-
label?: string;
|
|
86
|
-
readOnly?: boolean;
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* ONE LINK PICKER ([MERGE] One Link Picker For Both Editors, owner
|
|
90
|
-
* 2026-10-06; mockup https://claude.ai/artifact/6mVmY5787gnXdSWP3syqhu v4): a
|
|
91
|
-
* type — Page / Anchor / Blog post / Product / Custom URL — then which one; on
|
|
92
|
-
* the product listing a Filter and then a Value. The website editor's Link
|
|
93
|
-
* field and the admin's menu item draw this same control.
|
|
94
|
-
*
|
|
95
|
-
* IT HOLDS NO URL RULE. Which kind a link is, which page it points at, what
|
|
96
|
-
* filter it carries and how one is written, which typed address is unsafe —
|
|
97
|
-
* all of it is `rules`, and every option and every name is the host's. Only
|
|
98
|
-
* the order of the boxes and how they answer each other is decided here.
|
|
99
|
-
*
|
|
100
|
-
* It never writes on its own. Opening a saved link writes nothing; a target,
|
|
101
|
-
* filter or value the host no longer offers is shown as "(unavailable)" and
|
|
102
|
-
* kept, never silently replaced.
|
|
103
|
-
*
|
|
104
|
-
* Every box is the shell's (harness UI-24, efficient-easel#199): `Select`
|
|
105
|
-
* for a list — the anchors under one heading per page (`SelectOptionGroup`) —
|
|
106
|
-
* `SearchableSelect` for a long one, and `Input` for a typed address; never
|
|
107
|
-
* the browser's `<select>`. The boxes stack, one under the next, at every
|
|
108
|
-
* panel width. A long list of anchors names each one's page as its quiet
|
|
109
|
-
* second line: the shell's `SearchableSelect` takes no groups.
|
|
110
|
-
*/
|
|
111
|
-
declare function LinkPicker({ value, onChange, kinds, rules, filtersFor, label, readOnly }: LinkPickerProps): react.JSX.Element | null;
|
|
112
|
-
|
|
113
|
-
export { type LinkOption as L, type LinkFilterField as a, type LinkFilter as b, type LinkKindChoice as c, type LinkOptionGroup as d, LinkPicker as e, type LinkPickerProps as f, type LinkRules as g, type LinkTarget as h };
|
package/dist/chunk-4TMMEBAG.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as s}from"./chunk-5TRBCPRB.js";import{DropdownMenu as r}from"efficient-shell/ui";import{jsxs as t,Fragment as l,jsx as i}from"react/jsx-runtime";function c({choices:c,onPick:n}){const{Icon:a}=s(),o=e(c).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */t(l,{children:[e.group," ",
|
|
2
|
-
/* @__PURE__ */i("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */i("span",{className:"sf-chip",children:/* @__PURE__ */i(a,{type:e.type,size:13})}),onSelect:()=>n(e.type)}))]);/* @__PURE__ */
|
|
3
|
-
return i(r,{align:"start",triggerClassName:"sf-add-card",items:o,trigger:/* @__PURE__ */t(l,{children:[
|
|
4
|
-
/* @__PURE__ */i("span",{className:"sf-plus sf-plus--sm",children:"+"}),"Add block"]})})}export{c as AddBlockRow};
|
package/dist/chunk-5TRBCPRB.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{slotFieldsOf as n}from"./chunk-PLVEGYK6.js";import{usePickFollowsSelection as e}from"./chunk-R6WTQWAC.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-PYCLHOSA.js";import{Inspector as i}from"./chunk-VETFIYQR.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(e,t,r){const i=e.slotsOf?.(r);return i||n(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h={},v=()=>k,g=()=>"",y=()=>null,b=()=>{},O={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},w={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},S={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function P(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var D=o({});function G({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(D.Provider,{value:n,children:e})}function I(){return u(D)}function N(){return(I().useOwnerName??g)()}function T(){return(I().useDocumentLabel??y)()}function x(n,e,t,r){return(I().useBridges??v)(n,e,t,r)}function A(n){return(I().useStandaloneBridges??v)(n)}function B(n,e){(I().useDocumentPass??b)(n,e)}function F(){return I().blockRules??O}function R(){return I().blockLook??L}function V(){return I().devices??j}function Y(){return I().leftView??w}function E(){return I().pinned??S}function H(){return I().saveSwitch??!0}function K(n){e(!0===I().pickFollowsSelection,n)}function Q(){return I().add??h}function W(){return I().storageNamespace||void 0}function Z(){return I().styleClipboard??null}function q(){return I().nodeKeys??!0}function z(){return I().notify??null}function J(){return I().Canvas??C}function M(){return I().CanvasHead??null}function U(){return I().canvasDrag??null}var X=o(null);function $({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(X.Provider,{value:n,children:e})}function _(){return u(X)}function nn(){return I().Inspector??P}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,G as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,Q as useScreenAdd,R as useScreenBlockLook,F as useScreenBlockRules,x as useScreenBridges,U as useScreenCanvasDrag,J as useScreenCanvasFrame,M as useScreenCanvasHead,_ as useScreenCanvasTarget,V as useScreenDevices,T as useScreenDocumentLabel,B as useScreenDocumentPass,nn as useScreenInspectorPanel,Y as useScreenLeftView,q as useScreenNodeKeys,z as useScreenNotify,N as useScreenOwnerName,I as useScreenParts,K as useScreenPickFollowsSelection,E as useScreenPinned,H as useScreenSaveSwitch,W as useScreenStorageNamespace,Z as useScreenStyleClipboard,A as useStandaloneScreenBridges};
|
package/dist/chunk-BSSKAEFF.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{PanelToggleIcon as e}from"./chunk-KQMML6JM.js";import{InspectorHead as n}from"./chunk-OXYGFK2B.js";import{Tooltip as i,IconButton as t,Button as o}from"efficient-shell/ui";import{jsx as s,jsxs as l,Fragment as c}from"react/jsx-runtime";function d({icon:e,title:i,context:t,actions:o,side:d="left",onHide:a}){/* @__PURE__ */
|
|
2
|
-
return s(n,{icon:e,name:i,kind:t,actions:o||a?/* @__PURE__ */l(c,{children:[o,a?/* @__PURE__ */s(r,{side:d,onHide:a,divider:Boolean(o)}):null]}):void 0})}function r({side:n,onHide:o,divider:d=!1}){/* @__PURE__ */
|
|
3
|
-
return l(c,{children:[d?/* @__PURE__ */s("span",{className:"sf-head-divider","aria-hidden":"true"}):null,
|
|
4
|
-
/* @__PURE__ */s(i,{content:"Hide panel",side:"bottom",children:/* @__PURE__ */s(t,{className:"es-insp-iconbtn","aria-label":`Hide the ${n} panel`,onClick:o,children:/* @__PURE__ */s(e,{side:n})})})]})}function a({side:n,onShow:o}){/* @__PURE__ */
|
|
5
|
-
return s("div",{className:`es-sidepanel es-sidepanel--${n} sf-panel-strip`,children:/* @__PURE__ */s(i,{content:"Show panel",side:"bottom",children:/* @__PURE__ */s(t,{className:"es-insp-iconbtn","aria-label":`Show the ${n} panel`,onClick:o,children:/* @__PURE__ */s(e,{side:n})})})})}function h({label:e,onClick:n,description:t}){const l=/* @__PURE__ */s(o,{variant:"secondary",size:"sm",className:"es-insp-textbtn",onClick:n,children:e});return t?/* @__PURE__ */s(i,{content:t,side:"bottom",children:l}):l}export{r as PanelHideButton,h as PanelModeExit,a as PanelShowStrip,d as SidePanelHead};
|
package/dist/chunk-E2O2MRZR.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={title:"Add",contextBlocks:"Blocks for this place",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",startBlank:"Start blank",templates:"Your templates",inside:({name:e})=>`Inside ${e}`,tile:({name:e})=>`Add ${e}`,hintBlocks:"Drag into the page, or click to add.",hint:"Drag onto the page, or click to add.",searchBlocks:"Search blocks",searchSections:"Search sections",addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"},t={loading:"Loading…",waitingForAuthorization:"Waiting for editor authorization…",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No storefront page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageSettings:"Page settings",header:"Header",footer:"Footer",pageSections:"Template · Home page",templateSections:"Template · Template",addSection:"Add section",addSectionBefore:({name:e})=>`Add section before ${e}`,addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,canvasAddBlock:"Add block",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel"};export{e as DEFAULT_SCREEN_ADD_WORDS,t as DEFAULT_SCREEN_WORDS};
|
package/dist/chunk-FPOKPNO4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={less:"Less",more:"More",choose:"Choose…",search:"Search…",noMatches:"No matches",list:{item:"item",itemName:({noun:e,n:t})=>{return`${o=e,o?o[0].toUpperCase()+o.slice(1):o} ${t}`;var o},position:({n:e,total:t})=>`${e} of ${t}`,duplicate:"Duplicate",duplicateItem:({noun:e})=>`Duplicate ${e}`,deleteItem:({noun:e})=>`Delete ${e}`,add:({noun:e})=>`+ Add ${e}`,addHere:({noun:e})=>`Add ${e} here`,moveUp:"Move up",moveDown:"Move down",delete:"Delete",locked:"This one cannot be removed",moved:({n:e,total:t})=>`Moved to ${e} of ${t}`},link:{linkType:"Link type",address:"Link address",addressPlaceholder:"Link (e.g. /wheels or https://…)",unsafe:"Use a web address (https://…), a page on this site (/…), mailto: or tel:.",unavailable:({value:e})=>`${e} (unavailable)`,filter:"Filter",noFilter:"No filter (all products)",value:"Value",filterHint:"Filters come from Product Types. Only values in this site's catalogue are listed."}};export{e as DEFAULT_FIELDS_WORDS};
|
package/dist/chunk-HGTPLCTQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{EaselMenuItems as l,menuLabel as r}from"./chunk-EA2HTX37.js";import{createNodeClipboard as i,nodeMenuItems as c}from"./chunk-OSPUG6S6.js";import{useCanvasEvent as s}from"./chunk-PAELDYYS.js";import{isTypingTarget as a,framePointToHost as u}from"./chunk-ZNCEOSXO.js";import{zoneKey as d,ROOT_SLOT as p,ROOT_ID as f}from"./chunk-KRXQM65X.js";import{useState as m,useCallback as h,useRef as y,useEffect as k}from"react";import{ContextMenu as b}from"efficient-shell/ui";import{UndoIcon as v,RedoIcon as g,AddIcon as x,PasteIcon as C,SettingsIcon as w,LayersIcon as P,CopyIcon as z}from"efficient-shell/icons/efficient";import{jsx as O}from"react/jsx-runtime";function A(e,n){const o=[],l=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===t)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var S=i(),D=/* @__PURE__ */new WeakMap;function E(e){if(e.claimsPage)return S;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",i);let t=D.get(n);return t||(t=i(),D.set(n,t)),t}function K(){return E(n())}function M(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:f,slot:p,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function T(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete}}function j(e,n,t){const o=e.canPasteAt;if(!o)return d(n.from)===t.zone?M(e,t.zone,t.index+1):null;for(const l of A(e,t)){const t=M(e,l.zone,l.index+1);if(o(n,t))return t}return null}function X(e){if(e.defaultPrevented||e.altKey||e.shiftKey||!e.metaKey&&!e.ctrlKey)return null;if(a(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function L(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=T(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:j(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const s=i.props.id,a=n.labelOf(i.type,l),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,l),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=T(n,i,l),k=A(n,o),b=d.held,v=b&&!p?j(n,b,o):null,g=!n.readOnly,x=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,l),onCopy:()=>n.style?.copy(i,l),onPaste:()=>n.style?.paste(l,r,i)}):[];return c({title:a,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===t?null:n.slotRung?.(e.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{addInside:g&&n.canAddTo(i.type)?()=>n.openAddInside(l,r):void 0,duplicate:g&&m&&h.duplicate?()=>d.duplicate(s):void 0,moveUp:g&&d.canStep(s,-1)?()=>d.step(s,-1):void 0,moveDown:g&&d.canStep(s,1)?()=>d.step(s,1):void 0,copy:y.copy?()=>d.copy(s,a):void 0,cut:g&&y.cut?()=>d.cut(s,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,l)?()=>n.beginRename(l,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(s,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(s):void 0},style:x,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?"Pinned — can’t be moved or deleted":void 0})}function R(e){const n=!e.readOnly,o=[];n&&e.history.hasPast&&o.push({label:"Undo",icon:/* @__PURE__ */O(v,{}),shortcut:"⌘Z",onClick:e.history.back}),n&&e.history.hasFuture&&o.push({label:"Redo",icon:/* @__PURE__ */O(g,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const l=n?[{label:"Add section",icon:/* @__PURE__ */O(x,{}),onClick:e.openAddSection}]:[],r=e.nodeOps.held,i=M(e,t,e.sectionBand().cap);if(n&&r&&(e.canPasteAt?e.canPasteAt(r,i):d(r.from)===t)){const n=i;l.push({label:`Paste ${r.label}`,icon:/* @__PURE__ */O(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const c=[o,l,[{label:e.pageSettingsLabel??"Page settings",icon:/* @__PURE__ */O(w,{}),onClick:e.openPageSettings},{label:"Collapse all layers",icon:/* @__PURE__ */O(P,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),s={label:"—",onClick:()=>{}};return c.flatMap((e,n)=>n?[s,...e]:e)}function Y(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=[];l&&(i.push({label:"Copy",icon:/* @__PURE__ */O(z,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),i.push({label:"Cut",icon:/* @__PURE__ */O(z,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),i.push({label:"Paste",icon:/* @__PURE__ */O(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const c=[i,n.value?[{label:"Select all",shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),s={label:"—",onClick:()=>{}};return c.flatMap((e,n)=>n?[s,...e]:e)}function U(e){return e.shiftKey}function V(e,n){const[t,l]=m(null),r=h(()=>l(null),[]);o(null!==t,r);const i=y(e);i.current=e;const c=h(e=>{const n=i.current,t=n.keys;if(!t)return;const o=X(e);if(!o)return;const l=t.selected();if(!l)return;const r=L(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),a=e.keys?.target??null;k(()=>{if(!a)return;const e=e=>c(e);return a.addEventListener("keydown",e),()=>a.removeEventListener("keydown",e)},[a,c]),s(n,"keydown",c);const d=h(n=>{if(U(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n?n instanceof HTMLInputElement&&!["text","search","url","email","tel","number",""].includes(n.type)?null:n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);s(n,"contextmenu",t=>{if(U(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=u(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),s(n,"mousedown",r),s(n,"scroll",r,{on:"window"});return{onEditorContextMenu:d,menu:t?/* @__PURE__ */O(B,{host:e,target:t,onClose:r}):null,closeMenu:r}}function B({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?Y(e,n.el):R(e);return 0===o.length?null:/* @__PURE__ */O(b,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":r(o),children:/* @__PURE__ */O(l,{items:o,onClose:t})})}export{S as EASEL_NODE_CLIPBOARD,A as ancestorChain,E as nodeClipboardOf,T as nodeClipboardRules,I as nodeMenuItems,X as nodeShortcut,R as pageMenuItems,j as pastePlace,L as runNodeShortcut,Y as textMenuItems,K as useNodeClipboard,V as useNodeContextMenu};
|
package/dist/chunk-PWZOS45R.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{noControlField as e}from"./chunk-7F52SZOI.js";import{usePreviewDevice as n}from"./chunk-BSPCSC45.js";import{jsx as t}from"react/jsx-runtime";function r(e){return"mobile"===e?"mobile":"desktop"}var i={desktop:null,tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."},o="data-sf-device-hidden";function s(){/* @__PURE__ */
|
|
2
|
-
return t("span",{hidden:!0,[o]:""})}function u({tier:e,render:i,...o}){return r(n())===e?/* @__PURE__ */t(i,{...o}):/* @__PURE__ */t(s,{})}var c="__device";function d(e){const n=e?.[c];return n??null}function f(e){return d(e)?.inner??e}function a(e,n){const r=n.render;return{...n,[c]:{tier:e,inner:n},render:n=>/* @__PURE__ */t(u,{tier:e,render:r,...n})}}function l(){const e=i[n()];return e?/* @__PURE__ */t("div",{className:"sf-device-scope",children:e}):/* @__PURE__ */t(s,{})}function m(){return e({type:"custom",render:()=>/* @__PURE__ */t(l,{})},"always")}export{c as DEVICE_FIELD_MARKER,o as DEVICE_HIDDEN_ATTR,i as DEVICE_NOTE,a as deviceField,d as deviceMetaOf,m as deviceNote,r as shownTier,f as withoutDeviceGate};
|
package/dist/chunk-RC6DD4XP.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as e}from"./chunk-AAT3O7PK.js";import{ScreenChrome as r}from"./chunk-UEM66O42.js";import{ScreenDocumentProvider as a,useScreenDocument as i}from"./chunk-ONRYLR2D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-E2O2MRZR.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{useMemo as c}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var v=n(e),f=n(r);function p({saving:n,onCancel:e,onDiscard:r,onSave:a}){/* @__PURE__ */
|
|
2
|
-
return m(d,{open:!0,role:"alertdialog",size:"sm",title:"Unsaved changes",onClose:e,footer:/* @__PURE__ */g(h,{children:[
|
|
3
|
-
/* @__PURE__ */m(l,{variant:"secondary",onClick:e,children:"Cancel"}),
|
|
4
|
-
/* @__PURE__ */m(l,{variant:"ghost-danger",onClick:r,children:"Discard & leave"}),
|
|
5
|
-
/* @__PURE__ */m(l,{variant:"primary",loading:n,onClick:a,children:n?"Saving…":"Save & leave"})]}),children:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them."})}function u({target:n,addressing:e,onHostMessage:r,children:i}){/* @__PURE__ */
|
|
6
|
-
return m(a,{target:n,addressing:e,onHostMessage:r,children:i})}var k=(n,e)=>/* @__PURE__ */g(h,{children:[n,e]});function C({config:n,parts:e,wrap:r=k}){const{data:a,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:C,pendingNav:N,cancelPendingNav:j,discardAndNavigate:O,saveAndNavigate:S}=i(),y=c(()=>o(!u),[u]),A=t("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:A.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?a?r(
|
|
7
|
-
/* @__PURE__ */m(v,{config:n,data:a,onChange:C,permissions:y,parts:e,children:/* @__PURE__ */m(f,{})}),N&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:j,onDiscard:O,onSave:()=>{S()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:A.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:A.waitingForAuthorization})}export{C as DocumentScreen,u as ScreenMount};
|
package/dist/chunk-TSQUEJZB.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-BSSKAEFF.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-5TRBCPRB.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-E2O2MRZR.js";import{useEasel as f}from"./chunk-PYCLHOSA.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-6HHHBBSY.js";import{useState as h,useEffect as y,useMemo as b}from"react";import{AddIcon as j}from"efficient-shell/icons/efficient";import{jsx as B,jsxs as g,Fragment as $}from"react/jsx-runtime";var O=e=>`section:${e}`,H=e=>`block:${e}`,v=e=>`template:${e}`;function R({blocks:R,blocksOnly:x,at:A,onAdd:S,itemFor:C,session:F,siteWide:I,onClose:L,onHide:V,readOnly:N}){const P=f(e=>e.config),T=p(),{labelAtLevel:Y,categoryLabel:D,firstSection:E,Icon:w,Thumbnail:z}=T,{blockIsOffered:K}=m(),M=u("screen",d).add,Q=l(),[W,Z]=h([]);y(()=>{let t=!1;const o=e=>K(e,Q);return s(Q).list().then(n=>{if(t)return;const i=P.components;Z(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[P,Q]);const G=b(()=>t(P,T),[P]),J=e=>({type:O(e.type),label:e.name,cover:/* @__PURE__ */B(z,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:M.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=b(()=>{const e=[];if(R&&R.choices.length>0&&a(R.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${M.inside({name:R.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:H(e.type),label:e.label,icon:/* @__PURE__ */B(w,{type:e.type,size:18}),title:M.tile({name:e.label})}))})}),x)return e;const t=o(G,E);t&&e.push({key:"start",title:M.startBlank,tiles:[J(t)]}),W.length>0&&e.push({key:"templates",title:M.templates,tiles:W.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */B(z,{type:e.node.type}),keywords:[(t=e.node.type,Y(t,"section",P.components[t]?.label??t)),e.node.type]};var t})});const s=n(G,E);for(const t of Object.keys(P.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(P,t,D),tiles:o.map(J)})}return e},[R,x,W,G,P,M]),U=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=W.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
|
|
2
|
-
return g($,{children:[
|
|
3
|
-
/* @__PURE__ */B(r,{icon:/* @__PURE__ */B(j,{size:15}),title:M.title,context:x?M.contextBlocks:M.contextAll,actions:/* @__PURE__ */B(c,{label:M.done,description:M.doneDescription,onClick:L}),onHide:V}),
|
|
4
|
-
/* @__PURE__ */g("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */B(k,{groups:q,session:F,itemFor:e=>C(U(e)??{kind:"section",type:e}),onInsert:e=>{const t=U(e);t&&S(t)},at:A,hint:x?M.hintBlocks:M.hint,searchLabel:x?M.searchBlocks:M.searchSections,readOnly:N}),I&&!x?I:null]})]})}export{R as AddSidePanel,H as blockKey,O as sectionKey,v as templateKey};
|
package/dist/chunk-UEM66O42.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-ZV6OYSZ7.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-PT6V53OO.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-2JIWFFXA.js";import{usePartBridge as v}from"./chunk-VB5LRSGJ.js";import{useSectionOps as x}from"./chunk-UAVNI3BU.js";import{useNodeClipboard as b,useNodeContextMenu as w}from"./chunk-HGTPLCTQ.js";import{PageEditGuardNotices as z}from"./chunk-35Q5HMJZ.js";import{useScreenDocument as B}from"./chunk-ONRYLR2D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{heldStyle as O,styleShortcut as $}from"./chunk-V7U33NF2.js";import{AddChildRow as N}from"./chunk-5545A3PC.js";import{AddSidePanel as I}from"./chunk-TSQUEJZB.js";import{SidePanelHead as T,PanelShowStrip as P}from"./chunk-BSSKAEFF.js";import{MediaSidePanel as A}from"./chunk-6OY2THZH.js";import{useScreenSaveSwitch as R,useScreenNodeKeys as M,useScreenPinned as j,useScreenDocumentLabel as E,useScreenCanvasFrame as L,useScreenInspectorPanel as V,useScreenDevices as H,useScreenPickFollowsSelection as F,useScreenLeftView as D,useScreenAdd as U,SELECTION_MODE as G,sameInspectorMode as W,useScreenBridges as Y,useScreenBlockRules as J,useScreenBlockLook as _,useScreenStorageNamespace as K,useScreenNotify as X,useScreenCanvasHead as Z,isSlotMode as q,useScreenStyleClipboard as Q,useScreenDocumentPass as ee,useScreenCanvasDrag as ne,ScreenCanvasTargetProvider as te,isPinnedFirst as oe,isPinnedLast as re,screenSlotsOf as ie}from"./chunk-5TRBCPRB.js";import{ROOT_ZONE as le,blockNodeActions as se,TREE_MAX_DEPTH as de,childSlotsOf as ce,slotFieldsOf as ae,slotChildrenIn as pe,nestsInTree as ue,newNodeId as fe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as he,usePanelPick as me,useCancelPanelPick as ge}from"./chunk-R6WTQWAC.js";import{useEaselHost as ye,useHostEscape as ke}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as Se}from"./chunk-E2O2MRZR.js";import{useEasel as ve,useEaselApi as xe}from"./chunk-PYCLHOSA.js";import{TreeRow as be,Subtree as we,LayersTree as ze,TreeGroupLabel as Be,TreeRowAction as Ce,TreeSeam as Oe}from"./chunk-UFY6RNMT.js";import{toItemSelector as $e,useNodeOps as Ne}from"./chunk-D2BCHTQR.js";import{LayersIcon as Ie,MediaIcon as Te}from"./chunk-4VJATVVR.js";import{saveIndicator as Pe}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Ae,TopBarRail as Re,TopBarCluster as Me,EaselIconButton as je,TopBarDivider as Ee,DeviceSwitch as Le,InspectorIconButton as Ve,PanelResizeHandle as He,MAX_PANEL_W as Fe,MIN_PANEL_W as De,panelWidthVars as Ue,SaveState as Ge,SaveStateToggle as We}from"./chunk-OXYGFK2B.js";import{useWords as Ye}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Je}from"./chunk-6HHHBBSY.js";import{createDragSession as _e,useTreeDrag as Ke,gapToMoveIndex as Xe}from"./chunk-67GNT6PF.js";import{useCanvasFrame as Ze,BLOCK_SELECTOR as qe,useCanvasEvent as Qe}from"./chunk-PAELDYYS.js";import{zoneKey as en,ROOT_ID as nn,ROOT_SLOT as tn,parseZoneKey as on,DataError as rn}from"./chunk-KRXQM65X.js";import{useRef as ln,useMemo as sn,useState as dn,useEffect as cn,useCallback as an,useLayoutEffect as pn,Fragment as un}from"react";import{Tooltip as fn,Button as hn,toast as mn}from"efficient-shell/ui";import{UndoIcon as gn,RedoIcon as yn,TrashIcon as kn,EyeOffIcon as Sn,EyeIcon as vn,DuplicateIcon as xn}from"efficient-shell/icons/efficient";import{jsx as bn,jsxs as wn,Fragment as zn}from"react/jsx-runtime";function Bn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i}){if(null!==t)/* @__PURE__ */return bn(Ge,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
|
|
2
|
-
return bn(Ge,{tone:e.pending?"off-unsaved":"off",label:"Not saving — see the notice above",role:"status"});const{tone:l,label:s}=Pe(e),d=e.failed&&!e.paused&&/* @__PURE__ */bn(hn,{variant:"secondary",size:"sm",onClick:i,children:"Retry now"});/* @__PURE__ */
|
|
3
|
-
return wn(zn,o?{children:[
|
|
4
|
-
/* @__PURE__ */bn(We,{pressed:e.paused,onToggle:r,title:e.paused?"Auto-save is off — click to turn it back on (saves your held edits)":"Auto-save is on — click to pause it",children:/* @__PURE__ */bn(Ge,{tone:l,label:s})}),d]}:{children:[
|
|
5
|
-
/* @__PURE__ */bn(Ge,{tone:l,label:s,role:"status"}),d]})}function Cn({expand:e}){/* @__PURE__ */
|
|
6
|
-
return bn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */wn(zn,e?{children:[
|
|
7
|
-
/* @__PURE__ */bn("path",{d:"M8 9l4-4 4 4"}),
|
|
8
|
-
/* @__PURE__ */bn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
9
|
-
/* @__PURE__ */bn("path",{d:"M8 4l4 4 4-4"}),
|
|
10
|
-
/* @__PURE__ */bn("path",{d:"M8 20l4-4 4 4"}),
|
|
11
|
-
/* @__PURE__ */bn("path",{d:"M5 12h14"})]})})}function On(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var $n="__rungs";var Nn="screen:band",In={duplicate:!0,delete:!0};function Tn(){const Pe=ye(),{target:Ge,docId:We,capabilities:Tn,currentSlug:Pn,siteId:An,onPublish:Rn,saveState:Mn,saveConflict:jn,retrySave:En,toggleAutoSave:Ln,readOnly:Vn,readOnlyReason:Hn=null}=B(),Fn=R(),Dn=M(),{mediaEditing:Un,hasEditGuard:Gn,hasPinnedChrome:Wn}=Tn,{appState:Yn,dispatch:Jn,history:_n,selectedItem:Kn,getSelectorForId:Xn,config:Zn}=ve(e=>e),qn=j(),{first:Qn,firstGroup:et,lastGroup:nt,isSectionGroup:tt,sectionGroupZone:ot,panelOf:rt}=qn,it=rt(Qn),lt=e=>oe(qn,e),st=e=>re(qn,e),dt="node"===qn.firstRow,ct=qn.band??null,at=Ye("screen",Se),pt=E()??`/${Pn}`,ut=L(),ft=V(),ht=x({readOnly:Vn}),mt=x({readOnly:Vn,foldIntoHistory:!0}),gt=ln(null),yt=xe(),kt=sn(()=>({...ht,select:e=>{gt.current=e,ht.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=yt.config;gt.current=$e(e,t,n)}ht.commitDocument(e,n)}}),[ht,yt]),St=Yn.ui,vt=St.leftSideBarVisible,xt=St.rightSideBarVisible,{options:bt,widths:wt,initial:zt,fluid:Bt,fit:Ct}=H(),[Ot,$t]=dn(zt),Nt=he(),It=Un&&null!==Nt,Tt=me(),Pt=ge();F(Kn?.props.id);const{read:At,write:Rt,forSelection:Mt}=D(),[jt,Et]=dn(At);cn(()=>{Rt(jt)},[jt]);const[Lt,Vt]=dn(0),Ht=ln(null),Ft=ln(null),Dt=Ze(Ft,{readySelector:qe}),Ut=f(Ft);h(Ft,Dt);const[Gt,Wt]=dn(!1),Yt=ln(!1),Jt=ln(!1),[_t,Kt]=dn(null),Xt=U(),Zt=e=>Kt(null===e?null:{zone:le,index:e}),[qt,Qt]=dn([]),[eo,no]=dn(G),to="puck"===eo.kind,oo=Gt&&!_t&&Xt.railTarget?Xt.railTarget(Yn.data,{node:Kn??null,mode:eo}):null,ro=oo?{zone:en(oo),index:oo.index}:null,io=_t??ro,lo=io&&io.zone===le?io.index:null,so=t(eo,Kn?.props.id),[co,ao]=dn(null);cn(()=>{co&&(o(),ao(null))},[co]);const po=ln(Xn);po.current=Xn;const uo=an((e,{scroll:n})=>{Et(n=>Mt(e,n)),n&&ao(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=po.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Do(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),fo=ln(null);cn(()=>{const e=fo.current;fo.current=null;const n=null==Kn?.props.id?null:String(Kn.props.id);no(e&&e.id===n?e.mode:rt(Kn?.type)??G);const t=Kn?.props.id,o=gt.current;if(gt.current=null,!t)return;const i=Xn(t);uo(String(t),{scroll:!r(o,i??null,le)})},[Kn?.props.id,uo]);const ho=an(e=>{no(n=>W(n,e)?n:e),Jn({type:"setUi",ui:{rightSideBarVisible:!0}})},[Jn]),mo=ln(()=>{});mo.current=(e,n)=>{const t=e?Ar(e.zone??le)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Kn?.props.id?null:String(Kn.props.id);no(e=>W(e,n)?e:n),o!==r&&(fo.current={id:o,mode:n},kt.select(e))};const go=an((e,n)=>mo.current(e,n),[]),yo={kind:eo.kind,mode:eo,open:ho,show:e=>no(e),reveal:()=>{xt||Jn({type:"setUi",ui:{rightSideBarVisible:!0}})},select:go},ko=Y(yo,{data:Yn.data,selected:Kn??null,zoneOf:e=>Xn(e)?.zone,readOnly:Boolean(Vn),select:e=>{no(G),kt.select({index:e})},replace:(e,n)=>kt.replaceComponent(le,e,n),scrollTo:e=>ri(e)},{device:Ot,refreshes:Lt},{setView:Et,reveal:()=>{vt||Jn({type:"setUi",ui:{leftSideBarVisible:!0}})}}),So=ko.pinnedSource??!1,vo=ko.resolveLeftView?ko.resolveLeftView(jt,It):"media"===jt&&It?jt:"sections",xo=J(),{isLockedBlock:bo,duplicateBlocked:wo,nestDepth:zo,newSectionNode:Bo,canAddTo:Co,blockIsOffered:Oo}=xo,$o=_(),{labelAtLevel:No,Icon:Io,useProducts:To}=$o,Po=$o.rowName?(e,n,t)=>$o.rowName(e,n,t):void 0,Ao=an(e=>{Jn({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),uo(e,{scroll:!0})},[Jn,uo]),{selectNode:Ro,openPartId:Mo}=v({mode:eo,setMode:no,onOpenPart:Ao}),[jo,Eo]=dn(null);ke(null!==jo,()=>Eo(null));const Lo=y(K()),Vo=Lo.collapsed,Ho=Lo.panelWidths,[Fo,Do]=dn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Vo);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
12
|
-
return new Set}});cn(()=>{try{window.localStorage.setItem(Vo,JSON.stringify([...Fo]))}catch{}},[Fo]);const[Uo,Go]=dn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(Ho);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});cn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Ho,JSON.stringify(Uo))}catch{}},300);return()=>clearTimeout(e)},[Uo]);const Wo=an((e,n)=>Go(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Yo=an(e=>Wo("left",e),[Wo]),Jo=an(e=>Wo("right",e),[Wo]),_o=e=>Fo.has(e),Ko=e=>Do(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Xo=ln(!1),Zo=ln(null);cn(()=>{if(Xo.current&&!Gt){const e=Zo.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Ft.current?.querySelector(`button[aria-label="${CSS.escape(at.add.title)}"]`))?.focus(),Zo.current=null}Xo.current=Gt},[Gt]),cn(()=>{if(!Gt||!Ut)return;const e=e=>{"Escape"===e.key&&fi()};return Ut.addEventListener("keydown",e),()=>Ut.removeEventListener("keydown",e)},[Gt,Ut]),ke(Gt,()=>fi()),cn(()=>{!vt&&Gt&&(Wt(!1),Kt(null),Yt.current=!1)},[vt]),cn(()=>{if(!Tt)return Jt.current&&Jn({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Jt.current=!1);Gt&&(Wt(!1),Kt(null),Jt.current=Yt.current,Yt.current=!1),vt||(Jt.current=!0,Jn({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Tt]),cn(()=>{!vt&&Tt&&(Jt.current=!1,Pt())},[vt]),cn(()=>{if(!Tt||!Ut)return;const e=e=>{"Escape"===e.key&&Pt()};return Ut.addEventListener("keydown",e),()=>Ut.removeEventListener("keydown",e)},[Tt,Ut]),ke(null!==Tt,()=>Pt());const qo=X(),Qo=(e,n="success")=>{qo?qo(e,"error"===n?"error":"info"):"error"===n?mn.error(e,{duration:3200,sound:!1}):mn.success(e,{duration:1900,sound:!1})},er=ln(null),[nr,tr]=dn(0),[or,rr]=dn(0),ir=Z(),lr=ln(null),sr=e=>Math.max(0,e.clientHeight-(lr.current?.offsetHeight??0));cn(()=>{const e=er.current;if(!e)return;const n=()=>{tr(e.clientWidth),rr(sr(e))};n();const t=new ResizeObserver(n);return t.observe(e),lr.current&&t.observe(lr.current),()=>t.disconnect()},[]),pn(()=>{er.current&&(tr(er.current.clientWidth),rr(sr(er.current)))},[Uo,vt,xt]);const dr=Ot===Bt?nr>0?nr:wt[Bt]:wt[Ot],cr=nr>0?Math.min(nr/dr,"shrink"===Ct?1:2):1,ar=dr*cr,pr=nr>0&&ar>nr+1,ur={width:ar,height:or||"100%",flex:"none",position:"relative"},fr={width:dr,height:or?or/cr:"100%",maxHeight:"none",transform:1!==cr?`scale(${cr})`:void 0,transformOrigin:"top left"},hr=()=>Jn({type:"setUi",ui:{leftSideBarVisible:!vt}}),mr=()=>Jn({type:"setUi",ui:{rightSideBarVisible:!xt}}),gr=e=>{Gt&&(Wt(!1),Kt(null),Yt.current=!1,vt&&jt===e)||Tt&&(Jt.current=!1,Pt(),vt&&jt===e)||(vt&&jt===e?hr():(Et(e),vt||Jn({type:"setUi",ui:{leftSideBarVisible:!0}})))},yr=()=>{C(Pe,{accept:"image/*",title:"Media library"})},kr=()=>{no(G),kt.select(null),u()},Sr=()=>{no(it??G),xt||Jn({type:"setUi",ui:{rightSideBarVisible:!0}})},vr=Yn.data.content??[],xr=()=>{const e=vr.findIndex(lt),n=vr.findIndex(st);return{floor:e>=0?e+1:0,cap:n>=0?n:vr.length}},br=Zn,wr=xo.stripCopy,zr=e=>i(e,wr),Br=b(),Cr=Ne({data:Yn.data,config:br,readOnly:Boolean(Vn),clipboard:Br,strip:wr?e=>wr(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==nn||e.slot!==tn)return{min:0,max:n-1};const{floor:t,cap:o}=xr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&no(G);const t=void 0===n||"node"===n?.kind?n:null;kt.commitDocument(e,t)}}),Or=e=>Zn.components[e]?.label??e,$r=an(e=>Zn.components[e]?.defaultProps??{},[Zn]),Nr=e=>No(e,"section",Or(e)),Ir=e=>l({type:e.type,props:e.props??{}},Nr(e.type),Po),{nodeAddresses:Tr,zoneItems:Pr}=sn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=de)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of ce(Zn,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(vr,le,0),{nodeAddresses:e,zoneItems:n}},[vr,Zn]),Ar=an(e=>Pr.get(e)??[],[Pr]),Rr=e=>{const n=Tr.get(e);return n?Ar(n.zone)[n.index]:void 0},Mr=e=>ie(xo,Zn,e),jr=e=>{if(!xo.slotsOf||e===le)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Rr(e.slice(0,n));if(!t)return null;const o=Mr(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Er=(()=>{if(!q(eo))return null;const e=`${eo.nodeId}:${eo.slot}`;return jr(e)?.slot.panel===eo.kind?e:null})(),Lr=ln(null);cn(()=>{const e=Lr.current;if(Lr.current=null,!Er||!q(eo))return;const n=eo.nodeId;uo(n,{scroll:e!==Er}),Do(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[eo]);const Vr=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Tr.get(e);n&&(n.zone===le?ii(n.index):Mi(n.zone,n.index,e,Rr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Er!==i&&(Lr.current=i),go(null,r),xt||Jn({type:"setUi",ui:{rightSideBarVisible:!0}}),ri(o)},Hr=(e,n,t)=>{const o=`${e}:${n}`;if(Do(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;Er!==o&&(Lr.current=o);go(null,{kind:t,nodeId:e,slot:n})},Fr=(e,n,t)=>{if(Vn||!xo.moveSlot)return;const o=Rr(e),r=o?Mr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:$n,index:n},s=Xe(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=xo.moveSlot(e,n,s);"string"==typeof d&&Hr(e,d,i.panel)},Dr=To(),Ur=sn(()=>{const e=/* @__PURE__ */new Map;for(const n of Dr??[])e.set(n.slug,n.name);return e},[Dr]),Gr=e=>s(e,Or,$o.plainText,e=>Ur.get(e),$o.rowName),Wr=(e,n)=>{const t=Zn.components[e.type]?.fields,o=n===le||Qi(n)?"section":"block",r=n===le&&(lt(e)||st(e)||tt(e.type)),i="block"===o?d(t):r?null:c(t);return $o.renamePropOf?$o.renamePropOf(e,o,i):i},Yr=(e,n,t,o)=>{if(!(!Vn&&jo?.zone===e&&jo.index===n))return;const r=(t,o)=>{Eo(null),o&&((e,n,t)=>{const o=Ar(e)[n];if(!o)return;const r=Wr(o,e);r&&kt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
13
|
-
return bn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":"Rename",onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Jr=n(Q()),_r=Jr.scope({target:Ge,siteId:An,docId:We}),Kr=Zn,Xr=(e,n)=>n===le?Nr(e):Or(e),Zr=(e,n,t)=>{const o=Jr.plan(_r,t,Xr(t.type,e),Kr);o&&(o.changed&&kt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Qo(o.message))},qr=w({nodesIn:Ar,nodeAt:(e,n)=>Ar(e)[n]??null,labelOf:(e,n)=>n===le?Nr(e):Or(e),renamePropOf:Wr,beginRename:(e,n)=>Eo({zone:e,index:n}),history:{hasPast:_n.hasPast,hasFuture:_n.hasFuture,back:()=>_n.back(),forward:()=>_n.forward()},openAddSection:()=>{kt.select(null),pi(null)},openPageSettings:()=>{kt.select(null),no(G)},pageSettingsLabel:at.pageSettings,readOnly:Boolean(Vn),collapseAll:()=>Do(new Set(Ar(le).map(e=>String(e.props.id)))),onPasteRefused:e=>Qo(e?at.pasteRefused({name:e.label}):"Your browser won’t let us read the clipboard — press ⌘V","error"),canPasteAt:(e,n)=>nl(e,n),menuRows:ko.menuRows,isLocked:e=>bo(e.type),duplicateBlocked:e=>wo(Yn.data,e),permits:e=>se(Zn,e.type),canAddTo:Co,nodeOps:Cr,isPinned:(e,n)=>n===le&&(lt(e)||st(e)),sectionBand:xr,openAddInside:(e,n)=>{e===le?ii(n):kt.select({zone:e,index:n}),pi(null)},locate:e=>Tr.get(e)??null,rowNameOf:(e,n)=>n===le?Ir(e):Gr(e),selectAt:(e,n,t,o)=>{e===le?ii(n):Mi(e,n,t,o??"")},slotRung:e=>{const n=jr(e);return n?.slot.panel?{label:n.slot.label,select:()=>Vr(n.node,n.slot,!1)}:null},style:{held:()=>O(_r),canCopy:e=>Jr.rows(Kr,e).some(e=>!1!==e.counted),copy:(e,n)=>Jr.copy(_r,e,Xr(e.type,n),Kr),paste:(e,n,t)=>Zr(e,n,t)},keys:Dn?{target:Ut,selected:()=>{const e=Yn.ui.itemSelector;return e?{zone:e.zone??le,index:e.index}:null},held:()=>Br.get(),readOnly:Boolean(Vn),onDone:({done:e,name:n})=>{"copied"===e&&Qo(at.copied({name:n}))}}:void 0},Dt),Qr=ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});cn(()=>{Qr.current={copy:(e,n)=>Jr.copy(_r,e,Xr(e.type,n),Kr),paste:Zr,at:()=>{const e=Yn.ui.itemSelector;if(!e)return null;const n=e.zone??le,t=Ar(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Vn)}});const ei=an(e=>{const n=$(e);if(!n)return;const t=Qr.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);cn(()=>{if(!Ut)return;const e=e=>ei(e);return Ut.addEventListener("keydown",e),()=>Ut.removeEventListener("keydown",e)},[ei,Ut]),Qe(Dt,"keydown",ei);const ni=vr.map(e=>e.props.id).join("|");cn(()=>{const e=Dt?.document??null,n=Dt?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Qt(e=>e.length?[]:e);const n=vr.findIndex(st),t=n>=0?n:vr.length,o=n=>{const t=vr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(qe)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=On(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Qt(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Dt,ni,Ot,cr,vt,xt,Kn?.props.id]);const ti=Dt?.document??null,oi=Dt?.window??null;cn(()=>{const e=Ht.current;if(!e||!ti||!oi)return;const n=[],t=()=>{const n=ti.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&oi.scrollTo({left:oi.scrollX,top:oi.scrollY+t,behavior:"instant"}),!0};return Ht.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ti,oi]);const ri=e=>{ko.holdCanvasOn?ko.holdCanvasOn(e):a(e)},ii=e=>{no(G),kt.select({index:e}),ko.sectionPressed?.(vr[e]);const n=vr[e]?.props?.id;n&&ri(n)},li=e=>{const{floor:n,cap:t}=xr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Kn&&eo.kind!==it?.kind?vr.findIndex(e=>e.props.id===Kn.props.id):-1;return o(r>=0?r+1:t)},si=(e,n)=>{const{floor:t,cap:o}=xr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(kt.reorderComponent(le,e,i),kt.select({index:i}),{moved:!0,dest:i})},di=(e,n,t,o)=>{no(G),kt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Qo(`Added “${t}” section`)},ci=(e,n)=>{const t=li(n),o=Bo(e,{nodeDefaults:$r,newNodeId:fe,sectionLabel:Nr,blockIsOffered:Oo}),r=o?kt.insertNode(le,t,o):kt.insertSection(e,t);return di(t,r,Nr(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of ce(Zn,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Co(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},ai=(e,n,t)=>{const o=li(t),r=kt.insertNode(le,o,n);return di(o,r,e),o},pi=e=>ui(le,e),ui=(e,n)=>{Zo.current=document.activeElement??null,Tt&&(Yt.current=Jt.current,Jt.current=!1,Pt()),Kt(null===n?null:{zone:e,index:n}),Wt(!0),vt||(Yt.current=!0,Jn({type:"setUi",ui:{leftSideBarVisible:!0}}))},fi=()=>{Wt(!1),Kt(null),Yt.current&&Jn({type:"setUi",ui:{leftSideBarVisible:!1}}),Yt.current=!1},hi=(e,n,t)=>{if("section"===e.kind)kt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;kt.insertNode(n,t,zr(e.template.node))}no(G),kt.select({index:t,zone:n})},mi=(e,n)=>$o.rowName?n?lt(e)?$o.rowName(e,"section",at.header):st(e)?$o.rowName(e,"section",at.footer):tt(e.type)?$o.rowName(e,"section",Or(e.type)):Ir(e):Gr(e):n?Nr(e.type):Or(e.type),gi=e=>n=>{e()},yi=()=>ko.editPinnedSource?.(),ki=(e,n,t)=>{if(Vn)return null;const o=Ar(e)[n];return o&&!se(Zn,o.type).delete?null:/* @__PURE__ */bn(Ce,{kind:"delete",label:`Delete ${t}`,onClick:()=>((e,n)=>{const t=Ar(e)[n]?.props?.id;null!=t&&Cr.remove(String(t))})(e,n),children:/* @__PURE__ */bn(kn,{size:15})})},Si=e=>$o.rowPreview?.(e)||void 0,vi=e=>$o.rowMarks?.(e)??void 0,xi=(e,n,t)=>$o.rowActions?.(e,n,t)??null,bi=(e,n,t,o)=>{if(Vn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
14
|
-
return bn(Ce,{kind:"eye",label:r?`Show ${o}`:`Hide ${o}`,onClick:()=>zi(e,n,t),children:/* @__PURE__ */bn(r?Sn:vn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},wi=e=>{const n=Nr(vr[e]?.type??""),t=n?at.addSectionBefore({name:n}):at.addSectionHere;return xl(le,e,()=>pi(e),t)},zi=(e,n,t)=>{kt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Bi=e=>ae(Zn,e),Ci=e=>ce(Zn,e),Oi=e=>xo.slotsOf?Mr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:pe(e,n.slot)})):[{slot:null,rung:null,kids:Ci(e)}],$i=e=>xo.slotsOf?Oi(e).flatMap(e=>e.kids):Ci(e),Ni=e=>Boolean(xo.slotsOf)&&Mr(e).some(e=>e.rung),Ii=(e,n,t)=>null===t?void 0===n?Co(e):Co(e,n):Co(e,n,t),Ti=(e,n,t)=>{const o=ue(Zn,e.type,n)&&(t||$i(e).length>0||Ni(e));return{collapsible:o,folded:o&&_o(String(e.props.id))}},Pi=(e,n,t)=>Oi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ti(e,r,t(e.type)).collapsible?[String(e.props.id),...Pi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ai=e=>$i(e).length>0||Ni(e)||Boolean(Co(e.type)),Ri=e=>Boolean(Co(e)),Mi=(e,n,t,o)=>{if(no(G),Co(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),kt.select({index:n,zone:e}),a(t)}else kt.select({index:n,zone:e}),ri(t)},ji=(e,n,t,o,r)=>{const i=`${e}:${n}`;kt.insertComponent(i,t,o),Co(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),kt.select({index:o,zone:i})}):kt.select({index:o,zone:i})},Ei=(e,n,t)=>{kt.insertComponent(e,n,t),no(G),kt.select({index:t,zone:e})},Li=ln(/* @__PURE__ */new Set);cn(()=>{vr.forEach(e=>{const n=Co(e.type)?.spec;if(!n)return;const t=e.props.id;if(Li.current.has(t))return;Li.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds($r)).forEach((e,t)=>mt.seedChild(o,t,n.childType,e))})},[vr,mt,$r]);const Vi=ln(/* @__PURE__ */new Set);cn(()=>{vr.forEach((n,t)=>{const o=n.props.id;if(Vi.current.has(o))return;const r=e(n,Bi(n.type));Vi.current.add(o),r&&mt.replaceComponent(le,t,{...n,props:r})})},[vr,mt]),ee(mt,Zn);const Hi=vr.findIndex(st),Fi=Hi>=0?vr[Hi]:null,Di=dt?vr.findIndex(lt):-1,Ui=Di>=0?vr[Di]:null,Gi=vr.find(e=>e.type===et)??null,Wi=vr.find(e=>e.type===nt)??null,Yi=Hi>=0?Hi:vr.length,Ji=[];vr.forEach(e=>{st(e)||(Ai(e)&&Ji.push(String(e.props.id)),Ji.push(...Pi(e,1,Ri)))}),Fi&&(Ji.push(String(Fi.props.id)),Ji.push(...Pi(Fi,1,Ri)));const _i=Ji.length>0&&Ji.every(e=>Fo.has(e)),Ki=e=>{const n=$o.blockRowName(e,Or);return $o.rowName?$o.rowName(e,"block",n):n},Xi=(e,n,t,o)=>{const r=Ar(e)[t];if(!r)return;const i={...on(e),index:t},l={...on(n),index:Math.min(Math.max(o,0),Ar(n).length)},s=Xe(i,l);if(e!==n||s!==t)try{Cr.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof rn))throw e}},Zi=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Ci(e))n.add(r),t(o)};for(const t of Bi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},qi=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Tr.get(n);if(!e)return null;if(e.zone===le)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Qi=e=>{const n=e.slice(0,e.indexOf(":")),t=vr.find(e=>tt(e.type)&&String(e.props.id)===n);return t&&ot(n)===e?t:null},el=(e,n,t)=>{if(e.rung){const t=Rr(e.rung.nodeId),o=t?Mr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===$n&&n.index>=0&&n.index<=o}if(n.slot===$n)return!1;if(e.add)return ol(e.add,n);const o=en(n);if(tt(e.type))return!1;const r=Qi(o),i=Qi(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Ar(o).length);if(e.zone===le||o===le){if(e.zone!==o)return!1;const{floor:t,cap:r}=xr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ar(o).length)return!1;if(e.zone===o)return!0;const l=Fi&&!qn.lastIsOpen?String(Fi.props.id):null;return(!l||qi(e.zone)!==l&&qi(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ar(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Tr.get(i),s=l?Ar(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Zi(r).has(n))return!1;const d=Co(s.type,zo(Yn?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Ar(n),r))})(e.zone,o,e.index,t)},nl=(e,n)=>{const t=en(e.from);if(t===en(n))return!0;const o=e.node;return el({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},tl=e=>{const n=e.slice(0,e.indexOf(":")),t=Tr.get(n),o=t?Ar(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Co(o.type,zo(Yn?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=r.choices??(r.spec?[{type:r.spec.childType,label:Or(r.spec.childType)}]:[]),l=jr(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:mi(o,t.zone===le)}},ol=(e,n)=>{const t=en(n);if("block"!==e.kind){if(Qi(t))return n.index>=0&&n.index<=Ar(t).length;if(t!==le)return!1;const{floor:e,cap:o}=xr();return n.index>=e&&n.index<=o}if(t===le)return!1;const o=tl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Ar(t))},rl=(e,n)=>{e.rung?Fr(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&Qi(en(n)))return void hi(e,en(n),n.index);if("section"===e.kind)return void ci(e.type,n.index);if("template"===e.kind)return void ai(e.template.name,zr(e.template.node),n.index);const t=en(n),o=tl(t);o&&(o.target.spec?ji(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ei(t,e.type,n.index))})(e.add,n):e.zone===le?si(e.index,n.index):Xi(e.zone,en(n),e.index,n.index)},[il]=dn(()=>_e()),ll=Ke({keyOf:e=>e.id,readOnly:Boolean(Vn),session:il,canDrop:el,onDrop:rl,onStep:(e,n)=>{e.rung?Fr(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===le?((e,n)=>{const t=Nr(vr[e]?.type??""),o=si(e,n<0?e-1:e+2);if(!o.moved)return void Qo(`“${t}” is already ${n<0?"first":"last"}`);const{floor:r,cap:i}=xr();Qo(`Moved “${t}” to position ${o.dest-r+1} of ${i-r}`)})(e.index,n):Xi(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),sl=an(e=>{const{floor:n,cap:t}=xr(),o=[];for(const r of e.nodes){const e=en(r.place),i=Ar(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(lt(i)||st(i)||bo(i.type))continue;if(tt(i.type))continue;const l=Boolean(Qi(e)),s=e===le||l;e===le&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Nr(i.type):Gr(i),from:r.place})}return{sources:o,zones:e.zones.filter(e=>e.children.length>0||Boolean(tl(en(e.list))?.choices.length)||Boolean(Qi(en(e.list))))}},[Yn.data]),dl=e=>{no(G),kt.select(e.zone===le?{index:e.index}:{index:e.index,zone:e.zone})},cl=ne(),al=()=>({data:Yn.data,device:Ot,ops:kt,inspector:yo}),pl=cl?.model,ul=sn(()=>pl?e=>pl(e,sl(e),al()):sl,[pl,sl,Ot]),fl=cl?.measure,hl=fl?(e,n)=>fl(e,n,al()):void 0,ml=cl?.canDrop,gl=ml?(e,n)=>ml(e,n,el,al()):el,yl=cl?.drop,kl=yl?(e,n)=>yl(e,n,rl,al()):rl,Sl=cl?.pick,vl=Sl?e=>Sl(e,dl,al()):dl,xl=(e,n,t,o)=>/* @__PURE__ */bn(Oe,{...Vn?{}:ll.seam({place:{...on(e),index:n}}),onAdd:Vn?void 0:t,label:o},`seam:${e}:${n}`),bl={rowClick:gi,isCollapsed:_o,toggleCollapse:Ko},wl=e=>{const n=String(e.props.id),t=vr.findIndex(e=>String(e.props.id)===n),o=ot(n),r=Ar(o),i=_o(n),l=Or(e.type),s=$o.rowName?$o.rowName(e,"section",l):l,d=e=>xl(o,e,()=>ui(o,e),at.addSectionHere);/* @__PURE__ */
|
|
15
|
-
return wn(zn,{children:[
|
|
16
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:e.type,size:13}),name:s,preview:Si(e),marks:vi(e),onSelect:()=>ii(t),nameSlot:Yr(le,t,n,s),selected:so===n,actions:xi(e,le,t)??void 0,rowProps:{"data-node-id":n,onClick:gi(()=>ii(t))},fold:{open:!i,label:"section",onToggle:()=>Ko(n)}}),!i&&/* @__PURE__ */wn(we,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ir(n),l=Ai(n),s=l&&_o(r),c=()=>Mi(o,t,r,e.type),{rowProps:a,...p}=ll.row({item:{id:r,zone:o,index:t,type:n.type},place:{...on(o),index:t}},{"data-node-id":r,onClick:gi(c)});/* @__PURE__ */
|
|
17
|
-
return wn(un,{children:[d(t),
|
|
18
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:n.type,size:13}),name:i,preview:Si(n),marks:vi(n),onSelect:c,nameSlot:Yr(o,t,r,i),selected:so===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Ko(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(o,t,i),xi(n,o,t),bi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */bn(we,{children:Cl(n,2)})]},r)}),d(r.length)]})]})},zl=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ll.dragging,d=!_o(l)&&s?.rung?.nodeId!==i,c={...on(l),index:0},a=s&&!s.rung&&el(s,c)?c:void 0,p=()=>Vr(e,n,!0),{rowProps:u,...f}=ll.row({item:{id:`rung:${l}`,zone:`${i}:${$n}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:$n,index:t},into:a,canDrag:Boolean(xo.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:gi(p)}),h=Vn?null:xo.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
19
|
-
return wn(un,{children:[n.heading,
|
|
20
|
-
/* @__PURE__ */bn(be,{icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Er===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Ko(l)},actions:h&&h.length>0?/* @__PURE__ */bn(zn,{children:h.map((t,o)=>/* @__PURE__ */bn(Ce,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Vn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Hr(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */bn(kn,{size:15}):/* @__PURE__ */bn(xn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */bn(we,{children:r})]},l)},Bl=(e,n)=>{const t=Oi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
21
|
-
return bn(zn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Ii(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=null!==c&&Boolean(tl(c)?.choices.length),p=(e,n)=>a?xl(e,n,()=>ui(e,n),"Add block here"):xl(e,n),u=/* @__PURE__ */wn(zn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=so===String(n.props.id),{collapsible:i,folded:s}=Ti(n,l,Ri(n.type)),d=String(n.props.id),c=Ki(n),a=()=>Mi(t,o,d,e.type),{rowProps:u,...f}=ll.row({item:{id:d,zone:t,index:o,type:n.type},place:{...on(t),index:o}},{"data-node-id":d,onClick:gi(a)});/* @__PURE__ */
|
|
22
|
-
return wn(un,{children:[0===o&&p(t,0),
|
|
23
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:n.type,size:13}),name:c,preview:Si(n),marks:vi(n),onSelect:a,nameSlot:Yr(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Ko(d)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(t,o,c),xi(n,t,o),bi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */bn(we,{children:Bl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==c?null:p(c,0)]});return t.rung?zl(e,t.rung,r++,o,u):/* @__PURE__ */bn(un,{children:u},t.slot??"")})})},Cl=(e,n)=>{const t=zo(Yn?.data,e.type,String(e.props.id)),o=Oi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
24
|
-
return bn(zn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Ii(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&c&&!c.addBlocked?.(a)?()=>ji(e.props.id,c.slot,c.childType,t,e.type):n===h?()=>ui(n,t):void 0;return xl(n,t,o,n===f&&c?c.addLabel:"Add block here")},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),k=/* @__PURE__ */wn(zn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=so===String(n.props.id),i=Gr(n),l=String(n.props.id),{collapsible:d,folded:c}=Ti(n,s,Ri(n.type)),a=Bi(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...on(p),index:Ar(p).length}:void 0,f=ll.dragging,h=u&&f&&el(f,u)?u:void 0,g=()=>Mi(t,o,l,e.type),{rowProps:y,...k}=ll.row({item:{id:l,zone:t,index:o,type:n.type},place:{...on(t),index:o},into:h,canDrag:!bo(n.type)},{"data-node-id":l,onClick:gi(g)});/* @__PURE__ */
|
|
25
|
-
return wn(un,{children:[0===o&&m(t,0),
|
|
26
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:n.type,size:13}),name:i,preview:Si(n),marks:vi(n),onSelect:g,nameSlot:Yr(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Ko(l)}:void 0,actions:bo(n.type)?xi(n,t,o)??void 0:/* @__PURE__ */wn(zn,{children:[ki(t,o,i),xi(n,t,o),bi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */bn(we,{children:Cl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
27
|
-
/* @__PURE__ */bn(N,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>ji(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?zl(e,o.rung,i++,r,k):/* @__PURE__ */bn(un,{children:k},o.slot??"")})})},Ol=(()=>{if(!Kn||!to)return null;const e=String(Kn.type),n=String(Kn.props.id),t=Co(e,zo(Yn?.data,e,n));if(!t||"footer"===t.source)return null;const o=vr.some(e=>String(e.props?.id)===n),r=Array.isArray(Kn.props[t.slot])?Kn.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Or(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:mi(Kn,o),choices:i,onPick:o=>{t.spec?ji(n,t.slot,o,r.length,e):Ei(`${n}:${t.slot}`,o,r.length)}}})(),$l=io&&io.zone!==le&&!Qi(io.zone)?io.zone:null,Nl=!0===Xt.blocksFirst,Il=$l?tl($l):Nl&&io?null:Ol,Tl=Boolean(_t&&$l)||Nl&&Boolean(Il&&Il.choices.length>0),Pl=Gt||null!==Tt,Al=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:vt&&!Pl&&vo===e.id,onSelect:()=>gr(e.id)}:e,Rl=[{id:"add",label:at.add.title,icon:/* @__PURE__ */bn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:Gt,onSelect:()=>Gt?fi():pi(null)},...(ko.railLead??[]).map(Al),{id:"sections",label:"Layers",icon:/* @__PURE__ */bn(Ie,{}),active:vt&&!Pl&&"sections"===vo,onSelect:()=>gr("sections")},...(ko.railTrail??[]).map(Al)];It?Rl.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Te,{}),active:vt&&!Gt&&(null!==Tt||"media"===vo),onSelect:()=>gr("media")}):Un&&Rl.push({id:"media",label:at.railMedia,icon:/* @__PURE__ */bn(Te,{}),onSelect:yr});const Ml=[...ko.railLead??[],...ko.railTrail??[]].find(e=>"panel"in e&&e.id===vo),jl=Boolean(ct?.foldable)&&!So,El=ct?.label??(Gn?at.pageSections:at.templateSections),Ll=jl&&_o(Nn),Vl=/* @__PURE__ */wn(zn,{children:[vr.map((e,n)=>{if(lt(e)||st(e)||tt(e.type))return null;const t=so===String(e.props.id),o=Boolean(e.props._hidden);Ci(e);const r=String(e.props.id),i=ko.hasOwnRows?.(e)??!1,l=Ai(e)||i,s=l&&_o(r),{rowProps:d,...c}=ll.row({item:{id:r,zone:le,index:n,type:e.type},place:{...on(le),index:n}},{"data-node-id":r,onClick:gi(()=>ii(n))});/* @__PURE__ */
|
|
28
|
-
return wn(un,{children:[n>0&&wi(n),
|
|
29
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:e.type,size:13}),name:Ir(e),preview:Si(e),marks:vi(e),onSelect:()=>ii(n),nameSlot:Yr(le,n,r,Ir(e)),selected:t,hidden:o,...c,fold:l?{open:!s,label:"section",onToggle:()=>Ko(r)}:void 0,actions:/* @__PURE__ */wn(zn,{children:[ki(le,n,Ir(e)),xi(e,le,n),bi(le,n,e,Ir(e))]}),rowProps:d}),Ai(e)&&!s&&/* @__PURE__ */wn(we,{children:[Cl(e,1),ko.partRows?.(e,bl)]}),i&&!s&&/* @__PURE__ */bn(we,{children:ko.ownRows?.(e,n,bl)})]},String(e.props.id??n))}),!So&&Yi>0&&wi(Yi),ct?.addAtEnd&&!So&&!Vn&&/* @__PURE__ */bn(N,{small:!0,label:at.addSection,blocked:null,onAdd:()=>pi(Yi)})]}),Hl=(e,n,t)=>{const o=String(e.props.id),r=$i(e).length>0||Ni(e)||Boolean(Co(e.type)),i=r&&_o(o),l="header"===t?at.header:at.footer,s=$o.rowName?$o.rowName(e,"section",l):l;/* @__PURE__ */
|
|
30
|
-
return wn(zn,{children:[
|
|
31
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:t,size:13}),name:s,preview:Si(e),marks:vi(e),onSelect:()=>ii(n),nameSlot:Yr(le,n,o,s),selected:so===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Ko(o)}:void 0,actions:xi(e,le,n)??void 0,rowProps:{"data-node-id":o,onClick:gi(()=>ii(n))}}),r&&!i&&/* @__PURE__ */bn(we,{children:Bl(e,1)})]})};return(ko.wrap??(e=>e))(
|
|
32
|
-
/* @__PURE__ */bn(te,{target:Dt,children:/* @__PURE__ */wn("div",{ref:Ft,className:"sf-editor es-editor",style:Ue(Uo),onContextMenu:qr.onEditorContextMenu,...m(Pe),children:[
|
|
33
|
-
/* @__PURE__ */wn(Ae,{children:[
|
|
34
|
-
/* @__PURE__ */bn(Re,{items:Rl,ariaLabel:"Left panel views"}),
|
|
35
|
-
/* @__PURE__ */wn(Me,{children:[
|
|
36
|
-
/* @__PURE__ */bn(je,{label:"Undo",disabled:Boolean(Vn)||!_n.hasPast,onClick:()=>_n.back(),children:/* @__PURE__ */bn(gn,{})}),
|
|
37
|
-
/* @__PURE__ */bn(je,{label:"Redo",disabled:Boolean(Vn)||!_n.hasFuture,onClick:()=>_n.forward(),children:/* @__PURE__ */bn(yn,{})}),
|
|
38
|
-
/* @__PURE__ */bn(Ee,{}),
|
|
39
|
-
/* @__PURE__ */bn(Le,{devices:bt,value:Ot,onChange:$t})]}),
|
|
40
|
-
/* @__PURE__ */wn(Me,{kind:"right",style:{minWidth:300},children:[
|
|
41
|
-
/* @__PURE__ */bn(Bn,{saveState:Mn,notSaving:Boolean(Vn)||null!=jn,readOnlyReason:Hn,toggle:Fn,onToggle:Ln,onRetry:En}),ko.barLead?.(),
|
|
42
|
-
/* @__PURE__ */bn(fn,{content:"Refresh the preview (reloads the canvas, keeps your place)",side:"bottom",children:/* @__PURE__ */bn(hn,{variant:"secondary",onClick:()=>{Ht.current=(()=>{const e=Dt?.document;if(!e)return null;const n=vr.findIndex(st),t=n>=0?n:vr.length;let o=null;for(let n=0;n<t;n++){const t=vr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Kn?.props?.id??vr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Vt(e=>e+1)},children:"Refresh"})}),ko.barTrail?.(),ko.barMain?ko.barMain():/* @__PURE__ */bn(hn,{variant:"primary",disabled:null!==Hn,onClick:()=>{Rn(Yn.data)},children:at.done})]})]}),
|
|
43
|
-
/* @__PURE__ */bn(z,{}),
|
|
44
|
-
/* @__PURE__ */wn("div",{className:"sf-body",children:[vt?/* @__PURE__ */wn(zn,{children:[
|
|
45
|
-
/* @__PURE__ */bn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":at.leftPanel,children:Gt?/* @__PURE__ */bn(I,{blocks:Il,blocksOnly:Tl,at:_t?{label:(e=>{const n=Qi(e.zone);if(n)return at.add.addingTo({name:$o.rowName?mi(n,!0):Or(n.type)});if(e.zone===le){const n=vr[e.index];return n&&!st(n)?at.add.addingBefore({name:mi(n,!0)}):at.add.addingAtEnd}const t=tl(e.zone);return t?at.add.addingTo({name:t.parentName}):at.add.addingHere})(_t),onClear:()=>Kt(null)}:void 0,onAdd:e=>{const n=io,t=(e,n)=>{_t&&Kt({zone:e,index:n})};if(n&&"block"!==e.kind&&Qi(n.zone))return hi(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===lo)return void ci(e);const n=ci(e,lo);_t&&Zt(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===lo)return void ai(e,n);const t=ai(e,n,lo);_t&&Zt(t+1)})(e.template.name,zr(e.template.node));if(n&&n.zone!==le){const o=tl(n.zone);if(!o)return;return o.target.spec?ji(o.parentId,o.target.slot,e.type,n.index,o.parent.type):Ei(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Ol?.onPick(e.type)},itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:il,siteWide:ko.addPanelRow?.(fi),onClose:fi,onHide:hr,readOnly:Boolean(Vn)}):Tt&&Nt?
|
|
46
|
-
/* @__PURE__ */bn(A,{panel:Nt,pick:Tt,onHide:hr}):Ml?Ml.panel({onHide:hr,notify:Qo}):"media"===vo&&Nt?/* @__PURE__ */bn(A,{panel:Nt,pick:null,onHide:hr}):/* @__PURE__ */wn(zn,{children:[
|
|
47
|
-
/* @__PURE__ */bn(T,{icon:/* @__PURE__ */bn(Ie,{}),title:"Layers",context:pt,actions:Ji.length>0?/* @__PURE__ */bn(Ve,{label:_i?"Expand all sections":"Collapse all sections",onClick:()=>Do(e=>{const n=new Set(Ji);return _i?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ji])}),children:/* @__PURE__ */bn(Cn,{expand:_i})}):void 0,onHide:hr}),
|
|
48
|
-
/* @__PURE__ */wn(ze,{className:"sf-tree sf-scroll",children:[
|
|
49
|
-
/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:"page",size:13}),name:at.pageSettings,onSelect:kr,selected:!Kn&&to,rowProps:{onClick:gi(kr)}}),Gi&&/* @__PURE__ */wn(zn,{children:[
|
|
50
|
-
/* @__PURE__ */bn(Be,{children:at.header}),wl(Gi)]}),!So&&Wn&&/* @__PURE__ */wn(zn,{children:[
|
|
51
|
-
/* @__PURE__ */bn(Be,{children:at.header}),!dt&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:"header",size:13}),name:at.header,onSelect:Sr,selected:eo.kind===it?.kind,rowProps:{onClick:gi(Sr)}})]}),!So&&Ui&&Hl(Ui,Di,"header"),!So&&!jl&&/* @__PURE__ */bn(Be,{children:El}),jl?/* @__PURE__ */wn(zn,{children:[
|
|
52
|
-
/* @__PURE__ */bn(be,{icon:null,name:El,fold:{open:!Ll,label:El,onToggle:()=>Ko(Nn)}}),!Ll&&/* @__PURE__ */bn(we,{children:Vl})]}):Vl,Wn&&/* @__PURE__ */bn(Be,{children:at.footer}),Fi&&Hl(Fi,Hi,"footer"),!So&&!Fi&&Wn&&/* @__PURE__ */bn(be,{icon:/* @__PURE__ */bn(Io,{type:"footer",size:13}),name:at.footer,onSelect:yi,rowProps:{onClick:gi(yi),title:"Edit the site footer"}}),Wi&&wl(Wi),ko.treeFoot?.()]})]})}),
|
|
53
|
-
/* @__PURE__ */bn(He,{side:"left",width:Uo.left,min:De,max:Fe,defaultWidth:k.left,label:at.resizeLeftPanel,onResize:Yo})]}):/* @__PURE__ */bn(P,{side:"left",onShow:hr}),
|
|
54
|
-
/* @__PURE__ */wn("div",{ref:er,className:"sf-center sf-scroll","data-sf-canvas-head":ir?"":void 0,style:{overflowX:pr?"auto":"hidden",overflowY:"hidden"},children:[ir&&/* @__PURE__ */bn("div",{ref:lr,className:"sf-canvas-head",children:/* @__PURE__ */bn(ir,{device:Ot})}),
|
|
55
|
-
/* @__PURE__ */bn("div",{className:"sf-frame-scaler",style:ur,children:/* @__PURE__ */bn("div",{className:"sf-frame "+(Ot===Bt?"":`sf-frame--${Ot}`),style:fr,children:/* @__PURE__ */wn("div",{className:"sf-preview-host",children:[
|
|
56
|
-
/* @__PURE__ */bn(ut,{},Lt),
|
|
57
|
-
/* @__PURE__ */bn(Je,{canvas:Dt,session:il,model:ul,measure:hl,canDrop:gl,onDrop:kl,onPick:vl,onZoneAdd:e=>{const n=en(e),t=jr(n);t&&Vr(t.node,t.slot,!1),ui(n,0)},zoneAddLabel:at.canvasAddBlock,readOnly:Boolean(Vn),revision:Yn.data}),qt.length>0&&/* @__PURE__ */bn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:qt.map(e=>/* @__PURE__ */wn("button",{type:"button",tabIndex:-1,className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height},onClick:()=>pi(e.index),children:[
|
|
58
|
-
/* @__PURE__ */bn("span",{className:"sf-preview-gap-line"}),
|
|
59
|
-
/* @__PURE__ */wn("span",{className:"sf-preview-gap-pill",children:[
|
|
60
|
-
/* @__PURE__ */bn("span",{className:"sf-preview-gap-plus",children:"+"}),
|
|
61
|
-
/* @__PURE__ */bn("span",{className:"sf-preview-gap-label",children:"Add section"})]})]},e.index))})]})})})]}),xt?/* @__PURE__ */wn(zn,{children:[
|
|
62
|
-
/* @__PURE__ */bn(g,{value:{selectChild:Mi,addChild:ji,childRowName:Gr,blockRowName:Ki},children:/* @__PURE__ */bn(ft,{mode:eo,onOpenWebsiteSettings:ko.openSettings??(()=>{}),onOpenSiteStyles:ko.openStyles,onSelectNode:Ro,onNotify:Qo,onHidePanel:mr,nodeActions:Kn?se(Zn,Kn.type):In})}),
|
|
63
|
-
/* @__PURE__ */bn(He,{side:"right",width:Uo.right,min:De,max:Fe,defaultWidth:k.right,label:"Resize settings panel",onResize:Jo})]}):
|
|
64
|
-
/* @__PURE__ */bn(P,{side:"right",onShow:mr})]}),qr.menu]})}))}export{Tn as ScreenChrome};
|
package/dist/chunk-UH7IGZKF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"./chunk-546BBOPE.js";var r={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},link:{title:"Link",label:"Link",placeholder:"https://… or /page",refused:"Use a web address (https://…), a page on this site (/…), mailto: or tel:.",remove:"Remove",cancel:"Cancel",apply:"Apply"},marks:Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),placeholders:t,showMarks:"Show marks",clearStyle:"Clear style",clearStyleEmpty:"Select words first",toolbar:{bold:"Bold",italic:"Italic",underline:"Underline",strike:"Strikethrough",color:"Color",link:"Link",sup:"Superscript",sub:"Subscript",bullet:"Bulleted list",number:"Numbered list",letterCase:"Letter case",caseNone:"Normal",caseUpper:"Uppercase",caseLower:"Lowercase"},colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:r})=>`${e} · step ${t} ${r} · Shift ×10`}};export{r as DEFAULT_COPY_WORDS};
|
package/dist/chunk-VETFIYQR.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import{FieldSelect as e}from"./chunk-FOBGSFFS.js";import{TreeSeam as n}from"./chunk-UFY6RNMT.js";import{SettingsField as l,SETTINGS_BUCKETS as t,SettingsTabs as a,SettingsGroup as r}from"./chunk-YNOZ5NXW.js";import{DEFAULT_TREE_WORDS as i}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as o}from"./chunk-QTLAVDJE.js";import{EaselMenuItems as s}from"./chunk-EA2HTX37.js";import{FieldNumber as c}from"./chunk-7SQF6LZL.js";import{SettingsSegmented as u}from"./chunk-QLD57GBB.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-FPOKPNO4.js";import{useWords as m}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as h}from"./chunk-67GNT6PF.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{Textarea as f,Input as g,SortableList as v,ListRow as y,ContextMenu as x,tabPanelId as k,tabButtonId as w,SearchableSelect as N,Select as O}from"efficient-shell/ui";import{useRef as C,useState as S,useLayoutEffect as j,useId as D}from"react";import{jsx as F,jsxs as I}from"react/jsx-runtime";import{ChevronIcon as $,LockIcon as P,MoveUpIcon as M,MoveDownIcon as T,DuplicateIcon as L,TrashIcon as E}from"efficient-shell/icons/efficient";function z({id:e,value:n,onChange:l,placeholder:t,multiline:a=!1,rows:r=3,readOnly:i=!1,ariaLabel:o,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */F(f,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:t,readOnly:i,"aria-label":o,"aria-labelledby":s,onChange:e=>l(e.target.value)}):/* @__PURE__ */F(g,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:t,readOnly:i,"aria-label":o,"aria-labelledby":s,onChange:e=>l(e.target.value)})}function R(e,n,l){const t=e.slice();return t.splice(Math.max(0,Math.min(n,t.length)),0,l),t}function H(e,n,l){const t=e.slice(),[a]=t.splice(n,1);return t.splice(Math.max(0,Math.min(l,t.length)),0,a),t}function A(e,n){return e.filter((e,l)=>l!==n)}function B(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var Y='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',K={parentId:"list",slot:"items"};function G({label:e,icon:l,noun:t,items:a,onChange:r,newItem:o,summary:c,itemName:u,thumb:f,min:g=0,max:k,readOnly:w=!1,open:N,onOpen:O,renderItem:D,renderRow:z,canRemove:G,lockedReason:Q,fixed:J=!1,removeOnRow:V=!0,canDuplicate:W,above:X,head:Z=!0}){const q=m("fields",d).list,U=m("tree",i),_=t??q.item,ee=!w&&!J&&("number"!=typeof k||a.length<k),ne=a.length<=g,le=e=>!!G&&!G(a[e],e),te=e=>!w&&!J&&V&&!ne&&!le(e),ae=e=>ee&&(!W||W(a[e],e)),re=(e,n)=>u?u(e,n):q.itemName({noun:_,n:n+1}),ie=C([]),oe=C(null),[se,ce]=S(null),ue=C(null),[de,me]=S(null),[pe,he]=S("");j(()=>{const e=oe.current;if(!e)return;oe.current=null;const n=ie.current[e.index]?.querySelectorAll(Y)[e.nth]??ie.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const be=(e,n)=>{if(n<0||n>=a.length||n===e)return;const l=ie.current[e],t=l?.ownerDocument.activeElement;if(l&&t&&l.contains(t)){const e=[...l.querySelectorAll(Y)].indexOf(t),a=t;oe.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}r(H(a,e,n));const i=function(e,n,l){return null===e?null:e===n?l:n<e&&l>=e?e-1:n>e&&l<=e?e+1:e}(N,e,n);i!==N&&O(i),he(q.moved({n:n+1,total:a.length}))},fe=e=>{ee&&(r(R(a,e,o())),z?(oe.current={index:e,nth:0,start:null,end:null},null!==N&&N>=e&&O(N+1)):O(e))},ge=e=>{te(e)&&(r(A(a,e)),N===e?O(null):null!==N&&N>e&&O(N-1))},ve=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===K.parentId&&n.slot===K.slot,onDrop:(e,n)=>{const l=h({...K,index:e},n);l!==e&&be(e,l)},onStep:(e,n)=>be(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<a.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:q.moveUp,icon:/* @__PURE__ */F(M,{size:14}),shortcut:"⌥↑",onClick:()=>be(e,e-1)}),e<a.length-1&&n.push({label:q.moveDown,icon:/* @__PURE__ */F(T,{size:14}),shortcut:"⌥↓",onClick:()=>be(e,e+1)}),ae(e)&&n.push({label:q.duplicate,icon:/* @__PURE__ */F(L,{size:14}),onClick:()=>(e=>{ae(e)&&(r(R(a,e+1,B(a[e]))),null!==N&&N>e&&O(N+1))})(e)}),te(e)&&n.push({label:q.delete,icon:/* @__PURE__ */F(E,{size:14}),danger:!0,onClick:()=>ge(e)}),n},xe=(e,n,l,t)=>{w||0===ye(e).length||me({index:e,x:n,y:l,owner:t})},ke=e=>n=>{const l=a.slice();l[e]=n,r(l)};/* @__PURE__ */
|
|
2
|
-
return I("div",{className:"es-list",children:[Z?/* @__PURE__ */I("div",{className:"es-list-head",children:[
|
|
3
|
-
/* @__PURE__ */I("span",{className:"es-list-label",children:[l?/* @__PURE__ */F("span",{className:"es-field-icon","aria-hidden":"true",children:l}):null,e]}),
|
|
4
|
-
/* @__PURE__ */F("span",{className:"es-list-count",children:a.length})]}):null,X?/* @__PURE__ */F("div",{className:"es-list-above",children:X}):null,a.length?/* @__PURE__ */I(v,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[a.map((e,l)=>{const t=ve.row({item:l,place:{...K,index:l}}),a=t.draggable&&se!==l,r=!z&&N===l,i=!w&&!J&&V&&le(l),o=["es-list-row",z?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[l>0?/* @__PURE__ */F(n,{...ve.seam({place:{...K,index:l}}),onAdd:ee?()=>fe(l):void 0,label:q.addHere({noun:_})},`seam-${l}`):null,
|
|
5
|
-
/* @__PURE__ */F(y,{className:o,flat:!!z,active:r,draggable:t.draggable,dragHint:U.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>be(l,"up"===e?l-1:l+1):void 0,rowRef:e=>{ie.current[l]=e},rowProps:{...t.rowProps,draggable:a||void 0,onPointerDown:e=>{const n=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!n&&n===n.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!a,ue.current=n&&!a?n:null,ce(a?l:null)},onDragStart:e=>{const n=ue.current;ue.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),xe(l,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const n=e.currentTarget.ownerDocument,t=e=>e.preventDefault();n.addEventListener("contextmenu",t,{capture:!0,once:!0}),n.defaultView?.setTimeout(()=>n.removeEventListener("contextmenu",t,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void xe(l,a.left+24,a.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:w||J||!V?void 0:i?b(Q?Q(e,l):q.locked,/* @__PURE__ */F("span",{className:"es-list-lock",role:"img","aria-label":Q?Q(e,l):q.locked,children:/* @__PURE__ */F(P,{size:13})})):b(q.deleteItem({noun:_}),/* @__PURE__ */F("button",{type:"button",className:"es-list-x","aria-label":q.deleteItem({noun:_}),disabled:!te(l),onClick:()=>ge(l),children:"×"})),below:r?/* @__PURE__ */F("div",{className:"es-list-item",children:D(e,l,ke(l))}):void 0,children:z?/* @__PURE__ */F("div",{className:"es-list-row-main",children:z(e,l,ke(l))}):/* @__PURE__ */I("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>O(r?null:l),children:[f?/* @__PURE__ */F("span",{className:"es-list-thumb","aria-hidden":"true",children:f(e,l)}):null,
|
|
6
|
-
/* @__PURE__ */F("span",{className:"es-list-row-name",children:re(e,l)}),/* @__PURE__ */F("span",c?{className:"es-list-row-summary",children:c(e,l)}:{className:"es-list-row-summary"}),
|
|
7
|
-
/* @__PURE__ */F($,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},l)]}),
|
|
8
|
-
/* @__PURE__ */F(n,{...ve.seam({place:{...K,index:a.length}})})]}):null,w||J?null:/* @__PURE__ */F("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>fe(a.length),children:q.add({noun:_})}),
|
|
9
|
-
/* @__PURE__ */F("span",{className:"es-list-said","aria-live":"polite",children:pe}),de&&de.index<a.length?
|
|
10
|
-
/* @__PURE__ */F(x,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>me(null),children:/* @__PURE__ */F(s,{items:ye(de.index),onClose:()=>me(null)})}):null]})}var Q=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function J({field:e,name:n,id:l,value:t,onChange:a,readOnly:i,context:o,renderers:s}){const[c,u]=S(!0),d=t&&"object"==typeof t?t:{};/* @__PURE__ */
|
|
11
|
-
return F(r,{id:`${l}-group`,title:Q(e,n),open:c,onToggle:u,children:Object.entries(e.objectFields).map(([e,t])=>/* @__PURE__ */F(W,{field:t,name:`${n}.${e}`,id:`${l}-${e}`,value:d[e],onChange:n=>a({...d,[e]:n}),readOnly:i,context:o,renderers:s},e))})}function V({field:e,name:n,id:l,value:t,onChange:a,readOnly:r,context:i,renderers:o,openItem:s,onOpenItem:c}){const[u,d]=S(null),m=c?s??null:u,p=c??d,h=Array.isArray(t)?t:[],b=e.getItemSummary;/* @__PURE__ */
|
|
12
|
-
return F(G,{label:Q(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:h,onChange:a,newItem:()=>B({...e.defaultItemProps??{}}),summary:b?(e,n)=>b(e,n):void 0,min:e.min,max:e.max,readOnly:r,open:m,onOpen:p,renderItem:(t,a,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */F(W,{field:c,name:`${n}[${a}].${e}`,id:`${l}-${a}-${e}`,value:t?.[e],onChange:n=>s({...t,[e]:n}),readOnly:r,context:i,renderers:o},e))})}function W(n){const{field:t,name:a,id:r,value:i,onChange:o,readOnly:s,context:d,renderers:m}=n;if(!t||t.marker||!1===t.visible)return null;const p=m?.[t.type];if(p)return p({field:t,name:a,id:r,value:i,onChange:o,readOnly:s});switch(t.type){case"custom":{const e={...d,field:t,name:a,id:r,value:i,onChange:o,readOnly:s};return t.render(e)}case"text":case"textarea":/* @__PURE__ */
|
|
13
|
-
return F(l,{label:Q(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */F(z,{id:r,value:"string"==typeof i?i:null==i?"":String(i),onChange:o,placeholder:t.placeholder,multiline:"textarea"===t.type,readOnly:s})});case"number":/* @__PURE__ */
|
|
14
|
-
return F(l,{label:Q(t,a),htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */F(c,{id:r,value:"number"==typeof i?i:void 0,onChange:o,min:t.min,max:t.max,step:t.step,placeholder:t.placeholder,readOnly:s})});case"select":{const n=`${r}-label`;/* @__PURE__ */
|
|
15
|
-
return F(l,{label:Q(t,a),labelId:n,htmlFor:r,icon:t.icon,hint:t.hint,children:/* @__PURE__ */F(e,{id:r,value:i,options:t.options,onChange:o,readOnly:s,ariaLabelledBy:n})})}case"radio":/* @__PURE__ */
|
|
16
|
-
return F(l,{label:Q(t,a),icon:t.icon,hint:t.hint,children:/* @__PURE__ */F(u,{ariaLabel:Q(t,a),value:i,options:t.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||s})),onChange:e=>{s||o(e)}})});case"object":/* @__PURE__ */
|
|
17
|
-
return F(J,{...n,field:t});case"array":/* @__PURE__ */
|
|
18
|
-
return F(V,{...n,field:t});case"slot":return null}}var X=e=>t.includes(e);function Z(e){let n=t[0];const l=[],a=/* @__PURE__ */new Set;for(const[t,r]of Object.entries(e))r&&(X(r.bucket)&&(n=r.bucket),r.marker||!1===r.visible||(l.push({name:t,field:r,bucket:n}),"slot"!==r.type&&a.add(n)));return{rows:l,buckets:t.filter(e=>a.has(e))}}function q(e){return new Map(Z(e).rows.map(e=>[e.name,e.bucket]))}function U({fields:e,values:n,onChange:l,readOnly:t=!1,context:r,tab:i,onTab:s,tabs:c=!0,tabIcons:u,renderers:d,idPrefix:p,ariaLabel:h,children:b}){const f=m("panel",o),g=D(),v=p??`es-insp${g.replace(/:/g,"")}`,y=Z(e),[x,N]=S(void 0),O=i??x,C=O&&y.buckets.includes(O)?O:y.buckets[0],[j,$]=S(null),P=j&&j.panel===v&&y.rows.some(e=>e.name===j.name)?j:null,M=c&&y.buckets.length>1,T=M&&C?k(v,C):`${v}-rows`;/* @__PURE__ */
|
|
19
|
-
return I("div",{className:"es-insp",children:[M?/* @__PURE__ */F("div",{className:"es-insp-tabs",children:/* @__PURE__ */F(a,{ariaLabel:h??f.settings,activeId:C,onSelect:e=>{const n=e;void 0===i&&N(n),s?.(n)},items:y.buckets.map(e=>({id:e,label:f.buckets[e],icon:u?.[e]})),idPrefix:v})}):null,
|
|
20
|
-
/* @__PURE__ */I("div",{className:"es-insp-rows",id:T,role:M?"tabpanel":void 0,"aria-labelledby":M&&C?w(v,C):void 0,children:[y.rows.map(({name:e,field:a,bucket:i})=>/* @__PURE__ */F("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!(!M||i===C)||void 0,children:/* @__PURE__ */F(W,{field:a,name:e,id:`${v}-${e}`,value:n[e],onChange:n=>l(e,n),readOnly:t,context:r,renderers:d,openItem:P&&P.name===e?P.index:null,onOpenItem:n=>$(null===n?null:{panel:v,name:e,index:n})})},e)),b]})]})}function _(e){return"select"===e.type?e.options:"groups"===e.type?e.groups.flatMap(e=>e.options):[]}function ee({value:e,onChange:n,kinds:l,rules:t,filtersFor:a,label:r,readOnly:i}){const o=m("fields",d).link??d.link,[s,c]=S(null),[u,p]=S(null),h=s&&s.against===e?s.kind:t.kindOf(e),b=l.filter(e=>!e.hideWhenEmpty||_(e.target).length>0||e.value===h),f=b.find(e=>"text"===e.target.type),v=b.find(e=>e.value===h)??f??b[0];if(!v)return null;const y="text"!==v.target.type,x=y?t.targetOf(e):e,k=_(v.target),w=k.find(e=>e.value===x),C=e=>({value:e,label:o.unavailable({value:e})}),j="select"===v.target.type&&x&&a?a(x):null,D=j?t.readFilter(e):null,$=D?j?.find(e=>e.param===D.param):void 0,P=u&&u.against===e?u.text:e,M=!y&&""!==P.trim()&&!t.isSafe(P),T=(e,l)=>{c(n=>n?{...n,against:e}:n),void 0===l?n(e):n(e,l)},L=e=>{if(!e)return T("");const n=k.find(n=>n.value===e);T(e,n?.label)},E=(e,n)=>n&&!e.some(e=>e.value===n)?[C(n),...e]:[...e],z=(e,n,l,t,a)=>{const r=[];for(const e of l){const n=r[r.length-1],l={value:e.value,label:e.label};e.group?n&&"options"in n&&n.label===e.group?n.options.push(l):r.push({label:e.group,options:[l]}):r.push(l)}if(a){const a=l.some(e=>""===e.value);/* @__PURE__ */
|
|
21
|
-
return F(N,{"aria-label":e,value:n,options:r,disabled:i,clearable:a,placeholder:l.find(e=>""===e.value)?.label,onChange:t})}/* @__PURE__ */
|
|
22
|
-
return F(O,{size:"sm","aria-label":e,value:n,options:r,readOnly:i,onChange:t})};let R;if("text"===v.target.type)R=/* @__PURE__ */F(g,{size:"sm",type:"text",className:"es-fin",invalid:M,"aria-label":o.address,placeholder:o.addressPlaceholder,value:P,readOnly:i,onChange:n=>(n=>{const l=n.trim();l?t.isSafe(n)?(p({text:n,against:l}),T(l)):p({text:n,against:e}):(p({text:n,against:""}),T(""))})(n.target.value)});else{const e="groups"===v.target.type?v.target.groups.flatMap(e=>e.options.map(n=>({value:n.value,label:n.label,group:e.label}))):v.target.options.map(e=>({value:e.value,label:e.label})),n=[{value:"",label:v.target.placeholder},...E(e,x)];R=z(v.label,x,n,L,e.length>10)}/* @__PURE__ */
|
|
23
|
-
return I("div",{className:"es-flink",role:r?"group":void 0,"aria-label":r,children:[z(o.linkType,v.value,b.map(e=>({value:e.value,label:e.label})),l=>{p(null);const t=b.find(e=>e.value===l);if(!t||"text"===t.target.type)return void c({kind:l,against:e});const a=_(t.target)[0];c({kind:l,against:a?a.value:""}),a?n(a.value,a.label):n("")},!1),R,j&&z(o.filter,D?.param??"",[{value:"",label:o.noFilter},...D&&!$?[C(D.param)]:[],...j.map(e=>({value:e.param,label:e.label}))],e=>{if(!e)return T(x,w?.label);const n=j?.find(n=>n.param===e),l=n?.values[0];l&&T(t.withFilter(x,{param:e,value:l.value}),l.label)},!1),j&&D&&z(o.value,D.value,E(($?.values??[]).map(e=>({value:e.value,label:e.label})),D.value),e=>{if(!D)return;const n=$?.values.find(n=>n.value===e);T(t.withFilter(x,{param:D.param,value:e}),n?.label)},($?.values.length??0)>10),M&&/* @__PURE__ */F("p",{className:"es-flink-error",role:"alert",children:o.unsafe}),v.hint&&/* @__PURE__ */F("p",{className:"es-flink-hint",children:v.hint}),j&&/* @__PURE__ */F("p",{className:"es-flink-hint",children:o.filterHint})]})}export{z as FieldText,U as Inspector,W as InspectorField,ee as LinkPicker,G as ListField,q as bucketsOf,B as copyItem,R as insertAt,Q as labelOf,H as moveTo,Z as planFields,A as removeAt};
|
package/dist/chunk-ZJEBF4NB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={reload:"Reload the saved version",takeOver:"Take over editing",takeBack:"Take it back",viewReadOnly:"View read-only",savedByYou:({noun:e,when:i})=>`You saved this ${e} in another tab or window ${i}.`,savedByOther:({name:e,noun:i,when:n})=>`${e} saved this ${i} ${n}.`,conflictBody:"Your last change was not saved. It is still on screen here, but this copy is out of date — copy anything you need, then reload to carry on from the saved version.",takeOverWhileDeciding:"Nobody else can save while you decide. Nothing on your screen is lost.",tookOver:({name:e,noun:i,when:n})=>`${e} took over this ${i} ${n}.`,tookOverBody:"Your changes since then are still on screen but are no longer being saved.",viewingOnly:"Viewing only.",viewingOnlyBody:({name:e,noun:i,seen:n})=>`${e} is editing this ${i} (last seen ${n}). Nothing you change here is saved.`,editing:({name:e,noun:i})=>`${e} is editing this ${i}`,editingBody:({seen:e})=>`(last seen ${e}). Nothing you change here will be saved while they are in it.`,takeOverTold:"They are told straight away and stop being able to save."},i={device:"Preview device",upLevel:"Go up one level",upLevelTo:({label:e,name:i})=>`${e} to ${i}`,resize:"Drag to resize · double-click to reset",mediaLibrary:"Media library",mediaChoose:({kind:e})=>`Choose ${e}`,mediaFor:({field:e})=>`For ${e}`,mediaKinds:{image:"image",video:"video",svg:"SVG logo"},mediaCancel:"Cancel",mediaKeep:({kind:e})=>`Keep the current ${e}`,hidePanel:"Hide panel",hidePanelLabel:({side:e})=>`Hide the ${e} panel`};export{i as DEFAULT_CHROME_WORDS,e as DEFAULT_NOTICE_WORDS};
|