efficient-web-builder 70.3.0 → 71.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 71.0.0 - 2026-11-18
4
+
5
+ From main at `5d29f197`: #784. A major: #784 is `!`. The `efficient-easel` peer narrows to `^35.1.0`; `efficient-shell` stays `^13.17.0`. No export is removed. One new export and one new optional field. No stored key or value moves.
6
+
7
+ ### BREAKING
8
+
9
+ - **`efficient-easel` peer `^35.0.0` -> `^35.1.0`** (#784): the builder uses easel's `createRenderKeep` and `Render`'s `keep`.
10
+ - **The published-mounts rule now needs a keep on every published `Render` mount** (#784): `lib/source-rules/published-mounts` fails a published mount that draws `Render` with no `keep={keep}` from `useRenderKeep()`, and fails a file that reaches `Render` with no mount row.
11
+
12
+ **For hosts:**
13
+ - Install `efficient-easel` 35.1.0 or later with this release.
14
+ - In each published mount file that draws `Render`, import `useRenderKeep` from `efficient-web-builder/render/lib/document/render-keep`, set `const keep = useRenderKeep();` and pass `keep={keep}` to `Render`. In storefront-blocks these are `PublishedHeader` and `PublishedFooter`.
15
+ - Give each such mount row `keepFrom` (the module the hook is imported from) in the host's published-mounts test.
16
+
17
+ ### Fixed
18
+
19
+ - **A published page keeps its slots when it draws again** (#784): the page render passes one keep per mount, so a block that draws again (a product hero whose pick state sits above it) no longer gives every Box inside it a new slot type. Keyboard focus and held state (the gallery photo) stay. The HTML is the same.
20
+
21
+ ### Added
22
+
23
+ - **`useRenderKeep()`** (`render/lib/document/render-keep`, #784): the per-mount keep, made once and held in a ref. Never module-level.
24
+ - **`PublishedMount.keepFrom`** (optional, #784): where a mount imports `useRenderKeep`; left out, the builder's own module.
25
+
26
+ ## 70.4.0 - 2026-11-18
27
+
28
+ From main at `f6660eee`: #786. A minor: no `!`, no export is removed, no export changes its type, the peers stay `efficient-easel` `^35.0.0` and `efficient-shell` `^13.17.0`. One new export. No stored key or value moves.
29
+
30
+ **For hosts:**
31
+ - No step is required. A host that opens the editor with `openAddPage` now sees the Add page window open, whatever view the merchant left the editor on.
32
+
33
+ ### Fixed
34
+
35
+ - **`openAddPage` opens the Add page window** (#786): the Pages panel takes the request only while it is drawn, and the editor reopens on the view the merchant left (Layers, Site styles, or the left side closed), so the window did not open. The website screen now shows the Pages view and brings the left panel out while a request waits; the panel takes it as before. New export `useShowPagesForAddPage` (`components/AddPageOnOpen`).
36
+
3
37
  ## 70.3.0 - 2026-11-18
4
38
 
5
39
  From main at `43530778`: #782. A minor: no `!`, no export is removed, no export changes its type, the peers stay `efficient-easel` `^35.0.0` and `efficient-shell` `^13.17.0`. Two record entries are added. No stored key or value moves.
@@ -4,3 +4,7 @@ export declare function AddPageOnOpen({ open, children }: {
4
4
  children: ReactNode;
5
5
  }): import("react").JSX.Element;
6
6
  export declare function useTakeAddPageOnOpen(): () => boolean;
7
+ export declare function useShowPagesForAddPage(left: {
8
+ setView: (view: "pages") => void;
9
+ reveal: () => void;
10
+ }): void;
@@ -1 +1 @@
1
- "use client";import{jsx as o}from"react/jsx-runtime";import{createContext as u,useContext as s,useRef as a}from"react";const n=u(null);function f({open:e,children:t}){const r=a(!!e);return o(n.Provider,{value:r,children:t})}function i(){const e=s(n);return()=>e?.current?(e.current=!1,!0):!1}export{f as AddPageOnOpen,i as useTakeAddPageOnOpen};
1
+ "use client";import{jsx as s}from"react/jsx-runtime";import{createContext as c,useContext as u,useEffect as a,useRef as o}from"react";const n=c(null);function d({open:e,children:t}){const r=o(!!e);return s(n.Provider,{value:r,children:t})}function l(){const e=u(n);return()=>e?.current?(e.current=!1,!0):!1}function p(e){const t=u(n),r=o(e);r.current=e,a(()=>{t?.current&&(r.current.setView("pages"),r.current.reveal())},[t])}export{d as AddPageOnOpen,p as useShowPagesForAddPage,l as useTakeAddPageOnOpen};
@@ -1 +1 @@
1
- "use client";import{jsx as a,Fragment as y,jsxs as C}from"react/jsx-runtime";import{useCallback as v,useEffect as g,useRef as te,useState as B}from"react";import{SettingsSwitch as oe}from"efficient-easel/panel";import{PagesIcon as re,StylesIcon as ne}from"efficient-easel/rail";import{PaletteIcon as ie}from"efficient-shell/icons/efficient";import{Subtree as se,TreeRow as D}from"efficient-easel/tree";import{useEasel as N}from"efficient-easel/easel";import{toItemSelector as ae}from"efficient-easel/node-ops";import{useEaselStrings as H}from"efficient-easel/strings";import{LocationsTreeContext as ce}from"./LocationsTreeContext.js";import{usePartTypingDeps as de}from"./usePartTypingDeps.js";import{copyItemWrite as le}from"../lib/document/card-copy-rows.js";import pe from"./PagesPanel.js";import{usePreviewChat as me}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as ue}from"./preview-devices.js";import{PreviewDeviceContext as fe}from"efficient-easel/draw/client";import{usePreviewSocial as Se}from"../../render/components/PreviewSocialContext.js";import{usePreviewSurface as Ee}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as he,usePreviewTicker as Pe}from"../../render/components/PreviewTickerContext.js";import{heroStoresLegacyTicker as Te}from"../../format/lib/hero-ticker.js";import{usePreviewHeroPart as we}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as ge,HERO_PART_MODE as W,heroMediaRows as Ie,heroPartId as V,readHeroPartId as be}from"../../render/lib/document/hero-media-parts.js";import ve,{CHAT_MODE as _e,HEADER_MODE as ke,SOCIAL_MODE as Ce,WEBSITE_MODE as M,WEBSITE_PAGE_MODE as Re}from"./SectionEditor.js";import R from"./SectionIcon.js";import Le from"./SectionThumbnail.js";import{useScreenDocument as L}from"efficient-easel/screen/components/ScreenDocumentContext";import Oe from"./StylesPanel.js";import{LOCATIONS_TYPE as Ae,useLocationsTree as ye}from"./useLocationsTree.js";import{usePinnedChromeSeed as Be}from"./usePinnedChromeSeed.js";import{useHostDocumentBridge as De}from"./useHostDocumentBridge.js";import{usePreviewHref as Ne}from"./usePreviewHref.js";import{WebsitePreviewButton as He}from"./WebsitePreviewButton.js";import{SITE_STYLES_BASICS_TAB as We,SITE_STYLES_TABS as Ve,SITE_STYLES_TEXT_TAB as Me,useWebsiteName as xe}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as Ge}from"./useWebsiteMainAction.js";import{VersionHistory as Ye}from"./VersionHistoryDrawer.js";import{useEaselSession as x}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as Fe}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as ze,heroGroupNestDepth as Ke}from"../../format/lib/hero-group-placement.js";import{stripMarkup as je}from"../../format/lib/markup.js";import{categoryShortLabel as Ue,PINNED_SECTION_TYPE as Ze}from"../lib/document/add-palette.js";import{canAddTo as qe}from"../lib/document/add-target.js";import{cardTemplateSlotsOf as Xe}from"../../format/lib/document/card-template-layers.js";import{blockIsOffered as Je}from"../lib/document/block-offer.js";import{sectionIdOfBoxZone as Qe,setBookingPreview as $e}from"../../render/lib/document/booking-preview.js";import{footerBlockRowName as et}from"../../format/lib/document/footer-block-row-name.js";import{sourceRowName as tt}from"../../format/lib/document/source-row-name.js";import{FOOTER_TYPE as ot,HEADER_TYPE as G}from"../lib/document/footer-blocks.js";import{leftViewForSelection as rt,readLeftView as nt,resolveLeftView as it,writeLeftView as st}from"../../format/lib/document/left-view.js";import{websiteNodeIsLocked as at}from"../lib/document/locked-blocks.js";import{everyPageNotice as ct,noOwnTab as dt,pinnedReach as Y,websiteDuplicateBlocked as lt}from"../lib/document/every-page.js";import{sharedSectionReach as pt,WEBSITE_SHARED_SECTIONS as mt}from"../lib/shared-sections-layer.js";import{activeSharedSections as O,setSharedEditor as F}from"../../format/lib/shared-sections-active.js";import{sharedSectionsOf as ut}from"efficient-easel/screen/lib/shared-sections";import{pinnedChromeInPlace as _}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as ft,scrollPreviewToTop as z}from"efficient-easel/screen/lib/document/preview-dom";import{SiteCanvas as St}from"../lib/document/overrides.js";import{labelAtLevel as Et}from"../../format/lib/document/section-catalog.js";import{WEBSITE_MEDIA_DROP as ht}from"../../format/lib/document/media-drop.js";import{editorWords as Pt,say as f}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as Tt}from"../../format/lib/document/section-descriptions.js";import{groupAccepts as wt,isSectionGroupType as gt,sectionGroupZone as It,SITE_FOOTER_TYPE as K,SITE_HEADER_TYPE as bt}from"../../format/lib/document/section-groups.js";import{SaveAsTemplateButton as vt}from"./SaveAsTemplateButton.js";import{resolveSaveAsTemplateAction as _t,SAVE_AS_TEMPLATE_EVENT as kt}from"../../format/lib/save-as-template-action.js";import{menuPresets as Ct}from"../lib/sections/menu-presets.js";import{newSectionNode as Rt}from"../lib/sections/new-section-node.js";import{useHostProducts as Lt}from"../lib/use-host-products.js";import{backendOf as Ot}from"../lib/website-session.js";function j({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=Pe(),c=H().tree,d=e,n=d.kind==="ticker"?d.heroId:null,s=v(i=>{if(!i)return;t({kind:"ticker",heroId:i}),ft(i)},[t]);return g(()=>{o(n)},[n,o]),g(()=>{r(s)},[r,s]),{partRows:(i,{rowClick:m})=>{const S=String(i.props.id);return i.type==="Hero"&&Te(i.props)&&a(D,{icon:a(R,{type:"ticker",size:13}),name:f(he),onSelect:()=>s(S),selected:n===S,rowProps:{onClick:m(()=>s(S))},words:c})}}}function U({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=we(),c=H().tree,{appState:d,config:n}=N(p=>p),s=te({data:d.data,config:n});s.current={data:d.data,config:n};const i=e,m=ge.find(p=>W[p]===i.kind),S=m&&"nodeId"in i?V(String(i.nodeId),m):null,h=v(p=>{const l=be(p);if(!l)return;const{data:T,config:P}=s.current,u=ae(T,P,{kind:"node",id:l.nodeId});if(!u)return;const I={kind:W[l.part],nodeId:l.nodeId};t({index:u.index,zone:u.zone},I)},[t]);return g(()=>{o(S)},[S,o]),g(()=>{r(h)},[r,h]),{partRows:(p,{rowClick:l})=>{const T=String(p.props.id),P=Ie(p);if(P.length===0)return null;const u=E=>{const w=V(T,E.part);return a(D,{icon:a(R,{type:E.part==="media"?"heroMedia":"heroImage",size:13}),name:f(E.label),onSelect:()=>h(w),selected:S===w,rowProps:{onClick:l(()=>h(w))},words:c},w)},[I,...b]=P;return C(y,{children:[u(I),b.length>0&&a(se,{children:b.map(u)})]})}}}function Z(e,t){return{partRows:(o,r)=>C(y,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function At(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:c,docId:d,hasUnsavedEdits:n,bridgeCapabilities:s,notifyParent:i,token:m}=L(),{hasPreviewLink:S}=o,h=Ot(x()).preview?.draftLink,p=Ge(e.data),l=_t({hasTrustedConsole:!!m,canCreatePlatformTemplate:s.canCreatePlatformTemplate,capabilities:o,siteId:c,hasUnsavedEdits:n}),T=v(()=>{!c||!r||i(kt,{siteId:c,slug:r})},[i,c,r]),P=Ne({pageSlug:r,siteId:c,token:m}),u=t.previewHref?.(r)??P;return{barLead:()=>l.visible&&a(vt,{enabled:l.enabled,reason:l.enabled?"":l.disabledReason,onSaved:T}),barView:()=>S&&r&&a(He,{liveHref:u,pageId:d??null,draftLink:h}),mainAction:p}}function yt(e,t){const{capabilities:o,templateId:r,siteId:c,tokenRef:d,navigate:n}=L(),{hasSiteTheme:s,explainsSiteSettings:i}=o,m=E=>t.setView(E),[S,h]=B(Ve[0].id),[p,l]=B(!1),{surface:T,setSurface:P}=Ee(),u=()=>{if(s){m("styles"),t.reveal(),z();return}e.show(M),e.reveal(),z()},I={id:"pages",label:f("Pages"),icon:a(re,{}),panel:({onHide:E})=>a(pe,{activeSurface:T,onPreviewSurface:P,onNavigate:w=>{P(null),n(r?{kind:"template",id:r,pageSlug:w}:{kind:"page",slug:w,siteId:c??void 0})},onClose:E})},b=[];return!s&&i&&b.push({id:"appearance",label:f("Appearance"),icon:a(ie,{}),active:e.kind==="website",onSelect:u}),s&&b.push({id:"styles",label:f("Styles"),icon:a(ne,{}),panel:({onHide:E,notify:w})=>a(Oe,{tokenRef:d,siteId:c??void 0,onClose:E,onNotify:w,tab:S,onTabChange:h,revealPageGroup:p,onPageGroupRevealed:()=>l(!1)})}),{railLead:[I],railTrail:b,resolveLeftView:E=>it(E,s),openSettings:u,openStyles:()=>{h(Me),m("styles")},openPageStyles:s?()=>{h(We),l(!0),m("styles"),t.reveal()}:i?()=>{e.show(Re),e.reveal()}:void 0}}function Bt(){const{navigate:e,siteId:t,reloadFromServer:o,docId:r}=L(),c=N(n=>n.config),d=x();g(()=>(F({openPage:n=>e({kind:"page",slug:n.slug,siteId:t??void 0}),reload:()=>{o()},config:c}),()=>F(null)),[e,t,o,c]),g(()=>{const n=O();if(!n||!r)return;let s=!1;return ut(d).list().then(i=>{s||n.learn(i)}).catch(()=>{}),()=>{s=!0}},[r,d])}function q(){const e=de();return v(t=>{le(t,e)},[e])}function Dt(e,t,o,r){const{kind:c,open:d}=e,{selected:n,zoneOf:s}=t;g(()=>{$e(n?.type==="BookingBox"&&n.props.region==="confirm"?Qe(s(String(n.props.id))):null)},[n?.props.id]);const i=ye(e,t),{capabilities:{hasSiteSettings:m}}=L();Bt();const{chat:S,setChat:h,setSelected:p,setSelectHandler:l}=me(),T=v(()=>d(_e),[d]),P=c==="chat";g(()=>{p(P)},[P,p]),g(()=>{l(T)},[l,T]);const{setOpenHandler:u}=Se(),I=v(()=>d(Ce),[d]);g(()=>{u(I)},[u,I]);const b=Z(j(e),U(e)),E=At(t),w=yt(e,r),Q=o.device,$=q();return{...b,...E,...w,hasOwnRows:k=>k.type===Ae,ownRows:i.renderLocationTree,sectionPressed:i.sectionPressed,onCopyItem:$,wrap:k=>a(ce.Provider,{value:!0,children:C(fe.Provider,{value:Q,children:[k,a(Ye,{})]})}),addPanelRow:k=>m?C("div",{className:"sf-addside-sitewide",children:[a("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:a(R,{type:"chat",size:16})}),C("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{k(),T()},children:[f("Live chat"),a("span",{className:"sf-addside-sitewide-desc",children:f("A chat bubble on every page")})]}),a(oe,{checked:S.enabled,onChange:ee=>h({enabled:ee}),ariaLabel:f("Show the chat bubble on the whole site")})]}):void 0}}let X=null,A=new WeakMap;function Nt(e){const t=Pt();if(!e||!t)return e;X!==t&&(X=t,A=new WeakMap);let o=A.get(e);return o||(o={...e,choices:e.choices?e.choices.map(r=>({...r,label:f(r.label)})):null,spec:e.spec?{...e.spec,addLabel:f(e.spec.addLabel),...e.spec.childLabel?{childLabel:f(e.spec.childLabel)}:{}}:null},A.set(e,o)),o}const Ht={isLockedBlock:(e,t)=>at(e,t)||!!(t&&O()?.heldElsewhere(t.props.id)),duplicateBlocked:lt,nestDepth:(e,t,o)=>t===ze?Ke(e,o):0,newSectionNode:Rt,canAddTo:(e,t,o,r)=>Nt(qe(e,t,r,o)),blockIsOffered:Je,slotsOf:Xe,resolveOnInsert:!0},Wt=new Proxy(Tt,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?f(o):o}}),Vt={labelAtLevel:(e,t,o)=>f(Et(e,t,o)),descriptions:Wt,categoryLabel:e=>{const t=Ue(e);return t===void 0?void 0:f(t)},firstSection:Ze,blockRowName:et,rowName:tt,plainText:je,Icon:R,Thumbnail:Le,useProducts:Lt,presets:Ct()},Mt={desktop:2e3,tablet:800,mobile:390},J="desktop",xt={options:ue,initial:J,fluid:J,widths:Mt,hidesPerView:!0},Gt={read:nt,write:e=>st(e),forSelection:(e,t)=>rt(e,t)},Yt={first:G,last:ot,firstGroup:bt,lastGroup:K,isSectionGroup:gt,sectionGroupZone:It,panelOf:e=>e===G?ke:null,get sharedReach(){return _()?zt:void 0},get shared(){return O()?mt:void 0},get groupTab(){return _()?dt:void 0},get groupBadge(){return _()?Y({type:K})??void 0:void 0},get changeNotice(){return _()?ct():void 0},get band(){return _()?Ft:void 0},get groupAccepts(){return _()?wt:void 0}},Ft={foldable:!0},zt=e=>Y(e)??pt(e);function Kt(e){return{...Z(j(e),U(e)),onCopyItem:q(),openSettings:()=>e.show(M)}}function jt(e,t){Be(e,t),De()}const ar={useOwnerName:xe,useDocumentLabel:Fe,useBridges:Dt,useStandaloneBridges:Kt,useDocumentPass:jt,blockRules:Ht,blockLook:Vt,devices:xt,leftView:Gt,pinned:Yt,Canvas:St,canvasDrag:{media:ht},Inspector:ve};export{ar as WEBSITE_SCREEN};
1
+ "use client";import{jsx as a,Fragment as y,jsxs as C}from"react/jsx-runtime";import{useCallback as v,useEffect as g,useRef as te,useState as B}from"react";import{SettingsSwitch as oe}from"efficient-easel/panel";import{PagesIcon as re,StylesIcon as ne}from"efficient-easel/rail";import{PaletteIcon as ie}from"efficient-shell/icons/efficient";import{Subtree as se,TreeRow as D}from"efficient-easel/tree";import{useEasel as N}from"efficient-easel/easel";import{toItemSelector as ae}from"efficient-easel/node-ops";import{useEaselStrings as H}from"efficient-easel/strings";import{LocationsTreeContext as ce}from"./LocationsTreeContext.js";import{usePartTypingDeps as de}from"./usePartTypingDeps.js";import{copyItemWrite as le}from"../lib/document/card-copy-rows.js";import pe from"./PagesPanel.js";import{useShowPagesForAddPage as me}from"./AddPageOnOpen.js";import{usePreviewChat as ue}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as fe}from"./preview-devices.js";import{PreviewDeviceContext as Se}from"efficient-easel/draw/client";import{usePreviewSocial as Ee}from"../../render/components/PreviewSocialContext.js";import{usePreviewSurface as Pe}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as he,usePreviewTicker as Te}from"../../render/components/PreviewTickerContext.js";import{heroStoresLegacyTicker as we}from"../../format/lib/hero-ticker.js";import{usePreviewHeroPart as ge}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as Ie,HERO_PART_MODE as W,heroMediaRows as be,heroPartId as V,readHeroPartId as ve}from"../../render/lib/document/hero-media-parts.js";import _e,{CHAT_MODE as ke,HEADER_MODE as Ce,SOCIAL_MODE as Re,WEBSITE_MODE as M,WEBSITE_PAGE_MODE as Le}from"./SectionEditor.js";import R from"./SectionIcon.js";import Oe from"./SectionThumbnail.js";import{useScreenDocument as L}from"efficient-easel/screen/components/ScreenDocumentContext";import Ae from"./StylesPanel.js";import{LOCATIONS_TYPE as ye,useLocationsTree as Be}from"./useLocationsTree.js";import{usePinnedChromeSeed as De}from"./usePinnedChromeSeed.js";import{useHostDocumentBridge as Ne}from"./useHostDocumentBridge.js";import{usePreviewHref as He}from"./usePreviewHref.js";import{WebsitePreviewButton as We}from"./WebsitePreviewButton.js";import{SITE_STYLES_BASICS_TAB as Ve,SITE_STYLES_TABS as Me,SITE_STYLES_TEXT_TAB as xe,useWebsiteName as Ge}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as Ye}from"./useWebsiteMainAction.js";import{VersionHistory as Fe}from"./VersionHistoryDrawer.js";import{useEaselSession as x}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as ze}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as Ke,heroGroupNestDepth as je}from"../../format/lib/hero-group-placement.js";import{stripMarkup as Ue}from"../../format/lib/markup.js";import{categoryShortLabel as Ze,PINNED_SECTION_TYPE as qe}from"../lib/document/add-palette.js";import{canAddTo as Xe}from"../lib/document/add-target.js";import{cardTemplateSlotsOf as Je}from"../../format/lib/document/card-template-layers.js";import{blockIsOffered as Qe}from"../lib/document/block-offer.js";import{sectionIdOfBoxZone as $e,setBookingPreview as et}from"../../render/lib/document/booking-preview.js";import{footerBlockRowName as tt}from"../../format/lib/document/footer-block-row-name.js";import{sourceRowName as ot}from"../../format/lib/document/source-row-name.js";import{FOOTER_TYPE as rt,HEADER_TYPE as G}from"../lib/document/footer-blocks.js";import{leftViewForSelection as nt,readLeftView as it,resolveLeftView as st,writeLeftView as at}from"../../format/lib/document/left-view.js";import{websiteNodeIsLocked as ct}from"../lib/document/locked-blocks.js";import{everyPageNotice as dt,noOwnTab as lt,pinnedReach as Y,websiteDuplicateBlocked as pt}from"../lib/document/every-page.js";import{sharedSectionReach as mt,WEBSITE_SHARED_SECTIONS as ut}from"../lib/shared-sections-layer.js";import{activeSharedSections as O,setSharedEditor as F}from"../../format/lib/shared-sections-active.js";import{sharedSectionsOf as ft}from"efficient-easel/screen/lib/shared-sections";import{pinnedChromeInPlace as _}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as St,scrollPreviewToTop as z}from"efficient-easel/screen/lib/document/preview-dom";import{SiteCanvas as Et}from"../lib/document/overrides.js";import{labelAtLevel as Pt}from"../../format/lib/document/section-catalog.js";import{WEBSITE_MEDIA_DROP as ht}from"../../format/lib/document/media-drop.js";import{editorWords as Tt,say as f}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as wt}from"../../format/lib/document/section-descriptions.js";import{groupAccepts as gt,isSectionGroupType as It,sectionGroupZone as bt,SITE_FOOTER_TYPE as K,SITE_HEADER_TYPE as vt}from"../../format/lib/document/section-groups.js";import{SaveAsTemplateButton as _t}from"./SaveAsTemplateButton.js";import{resolveSaveAsTemplateAction as kt,SAVE_AS_TEMPLATE_EVENT as Ct}from"../../format/lib/save-as-template-action.js";import{menuPresets as Rt}from"../lib/sections/menu-presets.js";import{newSectionNode as Lt}from"../lib/sections/new-section-node.js";import{useHostProducts as Ot}from"../lib/use-host-products.js";import{backendOf as At}from"../lib/website-session.js";function j({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=Te(),c=H().tree,d=e,n=d.kind==="ticker"?d.heroId:null,s=v(i=>{if(!i)return;t({kind:"ticker",heroId:i}),St(i)},[t]);return g(()=>{o(n)},[n,o]),g(()=>{r(s)},[r,s]),{partRows:(i,{rowClick:m})=>{const S=String(i.props.id);return i.type==="Hero"&&we(i.props)&&a(D,{icon:a(R,{type:"ticker",size:13}),name:f(he),onSelect:()=>s(S),selected:n===S,rowProps:{onClick:m(()=>s(S))},words:c})}}}function U({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=ge(),c=H().tree,{appState:d,config:n}=N(p=>p),s=te({data:d.data,config:n});s.current={data:d.data,config:n};const i=e,m=Ie.find(p=>W[p]===i.kind),S=m&&"nodeId"in i?V(String(i.nodeId),m):null,P=v(p=>{const l=ve(p);if(!l)return;const{data:T,config:h}=s.current,u=ae(T,h,{kind:"node",id:l.nodeId});if(!u)return;const I={kind:W[l.part],nodeId:l.nodeId};t({index:u.index,zone:u.zone},I)},[t]);return g(()=>{o(S)},[S,o]),g(()=>{r(P)},[r,P]),{partRows:(p,{rowClick:l})=>{const T=String(p.props.id),h=be(p);if(h.length===0)return null;const u=E=>{const w=V(T,E.part);return a(D,{icon:a(R,{type:E.part==="media"?"heroMedia":"heroImage",size:13}),name:f(E.label),onSelect:()=>P(w),selected:S===w,rowProps:{onClick:l(()=>P(w))},words:c},w)},[I,...b]=h;return C(y,{children:[u(I),b.length>0&&a(se,{children:b.map(u)})]})}}}function Z(e,t){return{partRows:(o,r)=>C(y,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function yt(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:c,docId:d,hasUnsavedEdits:n,bridgeCapabilities:s,notifyParent:i,token:m}=L(),{hasPreviewLink:S}=o,P=At(x()).preview?.draftLink,p=Ye(e.data),l=kt({hasTrustedConsole:!!m,canCreatePlatformTemplate:s.canCreatePlatformTemplate,capabilities:o,siteId:c,hasUnsavedEdits:n}),T=v(()=>{!c||!r||i(Ct,{siteId:c,slug:r})},[i,c,r]),h=He({pageSlug:r,siteId:c,token:m}),u=t.previewHref?.(r)??h;return{barLead:()=>l.visible&&a(_t,{enabled:l.enabled,reason:l.enabled?"":l.disabledReason,onSaved:T}),barView:()=>S&&r&&a(We,{liveHref:u,pageId:d??null,draftLink:P}),mainAction:p}}function Bt(e,t){const{capabilities:o,templateId:r,siteId:c,tokenRef:d,navigate:n}=L(),{hasSiteTheme:s,explainsSiteSettings:i}=o,m=E=>t.setView(E),[S,P]=B(Me[0].id),[p,l]=B(!1),{surface:T,setSurface:h}=Pe(),u=()=>{if(s){m("styles"),t.reveal(),z();return}e.show(M),e.reveal(),z()},I={id:"pages",label:f("Pages"),icon:a(re,{}),panel:({onHide:E})=>a(pe,{activeSurface:T,onPreviewSurface:h,onNavigate:w=>{h(null),n(r?{kind:"template",id:r,pageSlug:w}:{kind:"page",slug:w,siteId:c??void 0})},onClose:E})},b=[];return!s&&i&&b.push({id:"appearance",label:f("Appearance"),icon:a(ie,{}),active:e.kind==="website",onSelect:u}),s&&b.push({id:"styles",label:f("Styles"),icon:a(ne,{}),panel:({onHide:E,notify:w})=>a(Ae,{tokenRef:d,siteId:c??void 0,onClose:E,onNotify:w,tab:S,onTabChange:P,revealPageGroup:p,onPageGroupRevealed:()=>l(!1)})}),{railLead:[I],railTrail:b,resolveLeftView:E=>st(E,s),openSettings:u,openStyles:()=>{P(xe),m("styles")},openPageStyles:s?()=>{P(Ve),l(!0),m("styles"),t.reveal()}:i?()=>{e.show(Le),e.reveal()}:void 0}}function Dt(){const{navigate:e,siteId:t,reloadFromServer:o,docId:r}=L(),c=N(n=>n.config),d=x();g(()=>(F({openPage:n=>e({kind:"page",slug:n.slug,siteId:t??void 0}),reload:()=>{o()},config:c}),()=>F(null)),[e,t,o,c]),g(()=>{const n=O();if(!n||!r)return;let s=!1;return ft(d).list().then(i=>{s||n.learn(i)}).catch(()=>{}),()=>{s=!0}},[r,d])}function q(){const e=de();return v(t=>{le(t,e)},[e])}function Nt(e,t,o,r){const{kind:c,open:d}=e,{selected:n,zoneOf:s}=t;g(()=>{et(n?.type==="BookingBox"&&n.props.region==="confirm"?$e(s(String(n.props.id))):null)},[n?.props.id]);const i=Be(e,t),{capabilities:{hasSiteSettings:m}}=L();Dt();const{chat:S,setChat:P,setSelected:p,setSelectHandler:l}=ue(),T=v(()=>d(ke),[d]),h=c==="chat";g(()=>{p(h)},[h,p]),g(()=>{l(T)},[l,T]);const{setOpenHandler:u}=Ee(),I=v(()=>d(Re),[d]);g(()=>{u(I)},[u,I]);const b=Z(j(e),U(e)),E=yt(t),w=Bt(e,r);me(r);const Q=o.device,$=q();return{...b,...E,...w,hasOwnRows:k=>k.type===ye,ownRows:i.renderLocationTree,sectionPressed:i.sectionPressed,onCopyItem:$,wrap:k=>a(ce.Provider,{value:!0,children:C(Se.Provider,{value:Q,children:[k,a(Fe,{})]})}),addPanelRow:k=>m?C("div",{className:"sf-addside-sitewide",children:[a("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:a(R,{type:"chat",size:16})}),C("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{k(),T()},children:[f("Live chat"),a("span",{className:"sf-addside-sitewide-desc",children:f("A chat bubble on every page")})]}),a(oe,{checked:S.enabled,onChange:ee=>P({enabled:ee}),ariaLabel:f("Show the chat bubble on the whole site")})]}):void 0}}let X=null,A=new WeakMap;function Ht(e){const t=Tt();if(!e||!t)return e;X!==t&&(X=t,A=new WeakMap);let o=A.get(e);return o||(o={...e,choices:e.choices?e.choices.map(r=>({...r,label:f(r.label)})):null,spec:e.spec?{...e.spec,addLabel:f(e.spec.addLabel),...e.spec.childLabel?{childLabel:f(e.spec.childLabel)}:{}}:null},A.set(e,o)),o}const Wt={isLockedBlock:(e,t)=>ct(e,t)||!!(t&&O()?.heldElsewhere(t.props.id)),duplicateBlocked:pt,nestDepth:(e,t,o)=>t===Ke?je(e,o):0,newSectionNode:Lt,canAddTo:(e,t,o,r)=>Ht(Xe(e,t,r,o)),blockIsOffered:Qe,slotsOf:Je,resolveOnInsert:!0},Vt=new Proxy(wt,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?f(o):o}}),Mt={labelAtLevel:(e,t,o)=>f(Pt(e,t,o)),descriptions:Vt,categoryLabel:e=>{const t=Ze(e);return t===void 0?void 0:f(t)},firstSection:qe,blockRowName:tt,rowName:ot,plainText:Ue,Icon:R,Thumbnail:Oe,useProducts:Ot,presets:Rt()},xt={desktop:2e3,tablet:800,mobile:390},J="desktop",Gt={options:fe,initial:J,fluid:J,widths:xt,hidesPerView:!0},Yt={read:it,write:e=>at(e),forSelection:(e,t)=>nt(e,t)},Ft={first:G,last:rt,firstGroup:vt,lastGroup:K,isSectionGroup:It,sectionGroupZone:bt,panelOf:e=>e===G?Ce:null,get sharedReach(){return _()?Kt:void 0},get shared(){return O()?ut:void 0},get groupTab(){return _()?lt:void 0},get groupBadge(){return _()?Y({type:K})??void 0:void 0},get changeNotice(){return _()?dt():void 0},get band(){return _()?zt:void 0},get groupAccepts(){return _()?gt:void 0}},zt={foldable:!0},Kt=e=>Y(e)??mt(e);function jt(e){return{...Z(j(e),U(e)),onCopyItem:q(),openSettings:()=>e.show(M)}}function Ut(e,t){De(e,t),Ne()}const dr={useOwnerName:Ge,useDocumentLabel:ze,useBridges:Nt,useStandaloneBridges:jt,useDocumentPass:Ut,blockRules:Wt,blockLook:Mt,devices:Gt,leftView:Yt,pinned:Ft,Canvas:Et,canvasDrag:{media:ht},Inspector:_e};export{dr as WEBSITE_SCREEN};
@@ -8,6 +8,7 @@ export type PublishedMount = {
8
8
  readonly inputs?: readonly string[];
9
9
  readonly readers?: readonly (string | PublishedReader)[];
10
10
  readonly renderFrom?: string;
11
+ readonly keepFrom?: string;
11
12
  };
12
13
  export type PublishedReader = {
13
14
  readonly name: string;
@@ -1,58 +1,68 @@
1
- import{ruleChecks as M}from"./rule.js";import{programOf as _}from"./support/ts-program.js";function Z(n){const a=[];let e=0,u=0;for(let o=0;o<n.length;o++){const p=n[o];"([{".includes(p)?e++:")]}".includes(p)?e--:p===","&&e===0&&(a.push(n.slice(u,o)),u=o+1)}return a.push(n.slice(u)),a.map(o=>o.trim()).filter(o=>o!=="")}const Y=/^[A-Za-z_$][\w$]*$/,ee=/^(?:@\/|\.\.?\/)/;function te(n,a){const e=_(n,[{path:"mount.tsx",text:a}]);return{sf:e.getSourceFile("/mount.tsx"),checker:e.getTypeChecker()}}function ne(n,a){const e=[],u=o=>{e.push(o),n.forEachChild(o,u)};return u(a),e}function v(n,a){const e=a.parent;return(n.isVariableDeclaration(e)||n.isParameter(e)||n.isBindingElement(e)||n.isFunctionDeclaration(e)||n.isFunctionExpression(e)||n.isClassDeclaration(e)||n.isClassExpression(e)||n.isImportSpecifier(e)||n.isImportClause(e)||n.isNamespaceImport(e)||n.isImportEqualsDeclaration(e))&&e.name===a}function F(n,a){return n.isParenthesizedExpression(a)||n.isAsExpression(a)||n.isNonNullExpression(a)||n.isTypeAssertionExpression(a)||n.isSatisfiesExpression(a)}function ae(n,a){for(;a.parent&&F(n,a.parent);)a=a.parent;return a}function V(n,a){let e=a,u=!1;for(;;){e=ae(n,e);const o=e.parent;if(o&&(n.isPropertyAccessExpression(o)||n.isElementAccessExpression(o))&&o.expression===e){e=o,u=!0;continue}return{top:e,path:u}}}const W=(n,a)=>n.isBinaryExpression(a)&&(a.operatorToken.kind===n.SyntaxKind.QuestionQuestionToken||a.operatorToken.kind===n.SyntaxKind.BarBarToken);function re(n,a){const e=a.parent;if(!e)return"used";if(n.isBinaryExpression(e)&&e.left===a&&e.operatorToken.kind>=n.SyntaxKind.FirstAssignment&&e.operatorToken.kind<=n.SyntaxKind.LastAssignment)return"assigned";if((n.isPrefixUnaryExpression(e)||n.isPostfixUnaryExpression(e))&&(e.operator===n.SyntaxKind.PlusPlusToken||e.operator===n.SyntaxKind.MinusMinusToken))return"changed by ++ or --";if(n.isDeleteExpression(e))return"deleted";if(n.isCallExpression(e)&&e.expression===a)return"called, or a method called on it";if(n.isCallExpression(e)||n.isNewExpression(e))return`handed to ${e.expression.getText()}(…)`;if(n.isJsxExpression(e)&&n.isJsxAttribute(e.parent))return`handed to the JSX attribute ${e.parent.name.getText()}`;if(n.isVariableDeclaration(e)||n.isBindingElement(e))return"aliased by a local";if(n.isSpreadElement(e)||n.isSpreadAssignment(e)||n.isJsxSpreadAttribute(e))return"spread";if(n.isForOfStatement(e)||n.isForInStatement(e))return"looped over";for(let u=a;u.parent;u=u.parent){const o=u.parent;if(n.isBinaryExpression(o)){if(o.left===u&&o.operatorToken.kind===n.SyntaxKind.EqualsToken)return"a destructuring target";break}if(!(n.isObjectLiteralExpression(o)||n.isArrayLiteralExpression(o)||n.isPropertyAssignment(o)||n.isShorthandPropertyAssignment(o)||n.isSpreadAssignment(o)||n.isSpreadElement(o)||F(n,o)))break}return`used in a ${n.SyntaxKind[e.kind]} (syntax kind)`}function G(n,a,e){if(!e)return["the rule was not handed the compiler (`options.ts`)"];const{sf:u,checker:o}=te(e,n),p=ne(e,u),x=p.filter(e.isIdentifier),$=t=>u.getLineAndCharacterOfPosition(t.getStart(u)).line+1,m=t=>e.isShorthandPropertyAssignment(t.parent)&&t.parent.name===t?o.getShorthandAssignmentValueSymbol(t.parent):o.getSymbolAtLocation(t),d=t=>x.filter(r=>r.text===t&&v(e,r)),c=t=>{for(let r=t;r.parent;r=r.parent){const i=r.parent;if(e.isExpressionWithTypeArguments(i)&&i.expression===r)return!1;if(e.isTypeNode(i))return!0}return!1},s=[],C=(t,r,i)=>{const l=p.filter(k=>e.isImportSpecifier(k)&&k.name.text===r),f=l[0],y=f?f.parent.parent.parent.moduleSpecifier.text:"";return l.length!==1?`${t} is not imported once in the mount`:f.propertyName&&f.propertyName.text!==r?`${t} is ${f.propertyName.text} renamed: it is imported by its own name`:f.isTypeOnly||f.parent.parent.isTypeOnly?`${t} is a type-only import`:(i===void 0?!ee.test(y):y!==i)?`${t} comes from "${y}", not ${i===void 0?"a module inside this package":`"${i}"`}`:d(r).length!==1?`${t} is declared again in the mount: it is the imported function`:o.getSymbolAtLocation(f.name)??`${t} has no binding in the mount`},A=d(a.variable);if(A.length!==1)return[`\`${a.variable}\` is declared ${A.length} times, not once`];const h=A[0].parent;if(!e.isVariableDeclaration(h))return[`\`${a.variable}\` is not a variable declaration`];const g=m(A[0]),b=h.initializer;let S=null;const w=C(`the call ${a.call}`,a.call,a.callFrom);if(typeof w=="string"&&s.push(w),!b||!e.isCallExpression(b)||!e.isIdentifier(b.expression)||b.expression.text!==a.call||typeof w!="string"&&m(b.expression)!==w)s.push(`\`${a.variable}\` is not set straight from ${a.call}(…): a pass wraps it, or something follows the call`);else{S=b;const t=n.slice(b.arguments.pos,b.arguments.end).trim();a.args!==void 0&&t!==a.args&&s.push(`${a.call} is handed \`${t}\`, not \`${a.args}\``)}const R=e.findAncestor(h,t=>e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isArrowFunction(t));if(!R||!R.body||h.parent.parent.parent!==R.body)return[...s,`\`${a.variable}\` is not declared at the top level of a component's body`];const T=R.parameters[0]?.name,D=new Map;if(T&&e.isObjectBindingPattern(T))for(const t of T.elements)e.isIdentifier(t.name)&&!t.dotDotDotToken&&D.set(t.name.text,t.name);else s.push("the component does not destructure its props");const B=a.inputs??Z(a.args??"").filter(t=>Y.test(t));B.length===0&&s.push(`${a.call}(…) reads no input the rule can check: name the props it reads in \`inputs\`, or bare names in \`args\``);const N=new Set;for(const t of B){const r=D.get(t);if(!r){s.push(`\`${t}\` is not a prop of the component: the call is handed something made in the mount`);continue}d(t).length!==1&&s.push(`\`${t}\` is declared ${d(t).length} times in the file: a second binding would pass for the input`);const i=m(r);i&&N.add(i)}for(const t of x)t.text==="arguments"&&!v(e,t)&&e.findAncestor(t,r=>r===R)&&s.push(`\`arguments\` is used in the component (line ${$(t)}): it is the props by another name`);for(const t of x)(t.text==="eval"||t.text==="Function")&&!v(e,t)&&!c(t)&&!(e.isPropertyAccessExpression(t.parent)&&t.parent.name===t)&&s.push(`\`${t.text}\` is used in the mount file (line ${$(t)}): code run from a string cannot be read`);const L=new Set;for(const t of a.readers??[]){const r=typeof t=="string"?t:t.name,i=C(`the reader ${r}`,r,typeof t=="string"?void 0:t.from);typeof i=="string"?s.push(i):L.add(i)}const X=t=>{if(!e.isCallExpression(t)||!e.isIdentifier(t.expression))return!1;const r=m(t.expression);return r!==void 0&&L.has(r)};let z=null;const P=p.filter(t=>e.isImportSpecifier(t)&&t.name.text==="Render"),O=a.renderFrom??"efficient-easel/render",q=P.length===1?P[0].parent.parent.parent.moduleSpecifier.text:"",I=p.filter(t=>e.isImportDeclaration(t)&&e.isStringLiteral(t.moduleSpecifier)&&t.moduleSpecifier.text===O&&!t.importClause?.isTypeOnly).flatMap(t=>{const r=t.importClause;if(!r)return[];const i=r.namedBindings;return[...r.name?[r.name.text]:[],...i&&e.isNamespaceImport(i)?[`* as ${i.name.text}`]:[],...i&&e.isNamedImports(i)?i.elements.filter(l=>!l.isTypeOnly).map(l=>l.propertyName?`${l.propertyName.text} as ${l.name.text}`:l.name.text):[]]});(I.length!==1||I[0]!=="Render")&&s.push(`"${O}" gives this file ${I.length} binding(s) (${I.join(", ")||"none"}), not the one \`Render\``);const J=P.length===1&&!P[0].propertyName&&q===O?o.getSymbolAtLocation(P[0].name):void 0;if(!J||d("Render").length!==1)s.push(`\`Render\` is not imported once by its own name from "${O}"`);else{const t=x.filter(i=>!v(e,i)&&m(i)===J),r=t.filter(i=>(e.isJsxOpeningElement(i.parent)||e.isJsxSelfClosingElement(i.parent))&&i.parent.tagName===i);if(r.length!==1||t.length!==1)s.push(`\`Render\` is used ${t.length} times, ${r.length} as a tag: one <Render> and no alias`);else{const l=r[0].parent.attributes.properties;l.some(j=>e.isJsxSpreadAttribute(j))&&s.push("the Render tag has a spread attribute, which can hand it another document");const f=l.filter(j=>e.isJsxAttribute(j)&&j.name.getText()==="data"),y=f.length===1?f[0].initializer:void 0,k=y&&e.isJsxExpression(y)?y.expression:void 0;!k||!e.isIdentifier(k)||m(k)!==g?s.push(`the Render tag draws \`${k?k.getText():f.length===1?f[0].getText():"nothing"}\`, not \`${a.variable}\``):z=k}}const E=new Map;for(const t of N)E.set(t,t.name);g&&E.set(g,a.variable);const H=t=>{for(let r=t;r.parent;r=r.parent){const i=r.parent;if(S&&i===S)return S.arguments.some(f=>f===r);if(!(F(e,i)||e.isObjectLiteralExpression(i)||e.isPropertyAssignment(i)&&i.initializer===r||e.isShorthandPropertyAssignment(i)||e.isSpreadAssignment(i)||e.isArrayLiteralExpression(i)||e.isSpreadElement(i)||e.isConditionalExpression(i)&&i.condition!==r||W(e,i)))return!1}return!1},Q=t=>{let r=t,i=!1;for(;;){const l=r.parent;if(!l)return;if(F(e,l))r=l;else if(e.isConditionalExpression(l)&&l.condition!==r)r=l,i=!0;else if(e.isSpreadAssignment(l)&&e.isObjectLiteralExpression(l.parent))r=l.parent,i=!0;else return e.isVariableDeclaration(l)&&l.initializer===r&&e.isIdentifier(l.name)&&i?m(l.name):void 0}},K=(t,r)=>{if(c(t))return!0;const{top:i,path:l}=V(e,t);if(t===z)return!0;let f=i;for(;f.parent&&(F(e,f.parent)||W(e,f.parent));)f=f.parent;if(f.parent&&X(f.parent)&&f.parent.arguments.some(k=>k===f)||N.has(r)&&H(i))return!0;const y=l?void 0:Q(i);return y?(E.has(y)||E.set(y,y.name),!0):!1};for(let t=-1;t!==E.size;){t=E.size;for(const r of x){if(v(e,r))continue;const i=m(r);i&&E.has(i)&&K(r,i)}}for(const t of x){if(v(e,t))continue;const r=m(t);if(!r||!E.has(r)||K(t,r))continue;const{top:i}=V(e,t),l=E.get(r),f=N.has(r)||r===g?"":" (a local that holds an input or the variable)";s.push(`\`${l}\`${f} is ${re(e,i)} at line ${$(t)}`)}return s}const U=new WeakMap;function ie(n){const a=U.get(n);if(a)return a;const{check:e,report:u}=M("published mounts fixtures"),o=(h,g)=>G(h,g,n),p={call:"publishedPageData",variable:"page",args:"data, metadata",readers:["first"]},x="return <Render config={c} data={page} />;",$=`const page = ${p.call}(data, metadata);`,m=h=>`import { Render } from "efficient-easel/render";
1
+ import{ruleChecks as U}from"./rule.js";import{programOf as ae}from"./support/ts-program.js";function re(n){const a=[];let e=0,m=0;for(let i=0;i<n.length;i++){const l=n[i];"([{".includes(l)?e++:")]}".includes(l)?e--:l===","&&e===0&&(a.push(n.slice(m,i)),m=i+1)}return a.push(n.slice(m)),a.map(i=>i.trim()).filter(i=>i!=="")}const ie=/^[A-Za-z_$][\w$]*$/,oe=/^(?:@\/|\.\.?\/)/;function se(n,a){const e=ae(n,[{path:"mount.tsx",text:a}]);return{sf:e.getSourceFile("/mount.tsx"),checker:e.getTypeChecker()}}function pe(n,a){const e=[],m=i=>{e.push(i),n.forEachChild(i,m)};return m(a),e}function N(n,a){const e=a.parent;return(n.isVariableDeclaration(e)||n.isParameter(e)||n.isBindingElement(e)||n.isFunctionDeclaration(e)||n.isFunctionExpression(e)||n.isClassDeclaration(e)||n.isClassExpression(e)||n.isImportSpecifier(e)||n.isImportClause(e)||n.isNamespaceImport(e)||n.isImportEqualsDeclaration(e))&&e.name===a}function L(n,a){return n.isParenthesizedExpression(a)||n.isAsExpression(a)||n.isNonNullExpression(a)||n.isTypeAssertionExpression(a)||n.isSatisfiesExpression(a)}function le(n,a){for(;a.parent&&L(n,a.parent);)a=a.parent;return a}function _(n,a){let e=a,m=!1;for(;;){e=le(n,e);const i=e.parent;if(i&&(n.isPropertyAccessExpression(i)||n.isElementAccessExpression(i))&&i.expression===e){e=i,m=!0;continue}return{top:e,path:m}}}const H=(n,a)=>n.isBinaryExpression(a)&&(a.operatorToken.kind===n.SyntaxKind.QuestionQuestionToken||a.operatorToken.kind===n.SyntaxKind.BarBarToken);function ce(n,a){const e=a.parent;if(!e)return"used";if(n.isBinaryExpression(e)&&e.left===a&&e.operatorToken.kind>=n.SyntaxKind.FirstAssignment&&e.operatorToken.kind<=n.SyntaxKind.LastAssignment)return"assigned";if((n.isPrefixUnaryExpression(e)||n.isPostfixUnaryExpression(e))&&(e.operator===n.SyntaxKind.PlusPlusToken||e.operator===n.SyntaxKind.MinusMinusToken))return"changed by ++ or --";if(n.isDeleteExpression(e))return"deleted";if(n.isCallExpression(e)&&e.expression===a)return"called, or a method called on it";if(n.isCallExpression(e)||n.isNewExpression(e))return`handed to ${e.expression.getText()}(…)`;if(n.isJsxExpression(e)&&n.isJsxAttribute(e.parent))return`handed to the JSX attribute ${e.parent.name.getText()}`;if(n.isVariableDeclaration(e)||n.isBindingElement(e))return"aliased by a local";if(n.isSpreadElement(e)||n.isSpreadAssignment(e)||n.isJsxSpreadAttribute(e))return"spread";if(n.isForOfStatement(e)||n.isForInStatement(e))return"looped over";for(let m=a;m.parent;m=m.parent){const i=m.parent;if(n.isBinaryExpression(i)){if(i.left===m&&i.operatorToken.kind===n.SyntaxKind.EqualsToken)return"a destructuring target";break}if(!(n.isObjectLiteralExpression(i)||n.isArrayLiteralExpression(i)||n.isPropertyAssignment(i)||n.isShorthandPropertyAssignment(i)||n.isSpreadAssignment(i)||n.isSpreadElement(i)||L(n,i)))break}return`used in a ${n.SyntaxKind[e.kind]} (syntax kind)`}function Q(n,a,e){if(!e)return["the rule was not handed the compiler (`options.ts`)"];const{sf:m,checker:i}=se(e,n),l=pe(e,m),x=l.filter(e.isIdentifier),f=t=>m.getLineAndCharacterOfPosition(t.getStart(m)).line+1,p=t=>e.isShorthandPropertyAssignment(t.parent)&&t.parent.name===t?i.getShorthandAssignmentValueSymbol(t.parent):i.getSymbolAtLocation(t),h=t=>x.filter(r=>r.text===t&&N(e,r)),d=t=>{for(let r=t;r.parent;r=r.parent){const o=r.parent;if(e.isExpressionWithTypeArguments(o)&&o.expression===r)return!1;if(e.isTypeNode(o))return!0}return!1},s=[],c=(t,r,o)=>{const u=l.filter(E=>e.isImportSpecifier(E)&&E.name.text===r),g=u[0],b=g?g.parent.parent.parent.moduleSpecifier.text:"";return u.length!==1?`${t} is not imported once in the mount`:g.propertyName&&g.propertyName.text!==r?`${t} is ${g.propertyName.text} renamed: it is imported by its own name`:g.isTypeOnly||g.parent.parent.isTypeOnly?`${t} is a type-only import`:(o===void 0?!oe.test(b):b!==o)?`${t} comes from "${b}", not ${o===void 0?"a module inside this package":`"${o}"`}`:h(r).length!==1?`${t} is declared again in the mount: it is the imported function`:i.getSymbolAtLocation(g.name)??`${t} has no binding in the mount`},K=h(a.variable);if(K.length!==1)return[`\`${a.variable}\` is declared ${K.length} times, not once`];const A=K[0].parent;if(!e.isVariableDeclaration(A))return[`\`${a.variable}\` is not a variable declaration`];const $=p(K[0]),k=A.initializer;let y=null;const T=c(`the call ${a.call}`,a.call,a.callFrom);if(typeof T=="string"&&s.push(T),!k||!e.isCallExpression(k)||!e.isIdentifier(k.expression)||k.expression.text!==a.call||typeof T!="string"&&p(k.expression)!==T)s.push(`\`${a.variable}\` is not set straight from ${a.call}(…): a pass wraps it, or something follows the call`);else{y=k;const t=n.slice(k.arguments.pos,k.arguments.end).trim();a.args!==void 0&&t!==a.args&&s.push(`${a.call} is handed \`${t}\`, not \`${a.args}\``)}const R=e.findAncestor(A,t=>e.isFunctionDeclaration(t)||e.isFunctionExpression(t)||e.isArrowFunction(t));if(!R||!R.body||A.parent.parent.parent!==R.body)return[...s,`\`${a.variable}\` is not declared at the top level of a component's body`];const C=R.parameters[0]?.name,S=new Map;if(C&&e.isObjectBindingPattern(C))for(const t of C.elements)e.isIdentifier(t.name)&&!t.dotDotDotToken&&S.set(t.name.text,t.name);else s.push("the component does not destructure its props");const B=a.inputs??re(a.args??"").filter(t=>ie.test(t));B.length===0&&s.push(`${a.call}(…) reads no input the rule can check: name the props it reads in \`inputs\`, or bare names in \`args\``);const P=new Set;for(const t of B){const r=S.get(t);if(!r){s.push(`\`${t}\` is not a prop of the component: the call is handed something made in the mount`);continue}h(t).length!==1&&s.push(`\`${t}\` is declared ${h(t).length} times in the file: a second binding would pass for the input`);const o=p(r);o&&P.add(o)}for(const t of x)t.text==="arguments"&&!N(e,t)&&e.findAncestor(t,r=>r===R)&&s.push(`\`arguments\` is used in the component (line ${f(t)}): it is the props by another name`);for(const t of x)(t.text==="eval"||t.text==="Function")&&!N(e,t)&&!d(t)&&!(e.isPropertyAccessExpression(t.parent)&&t.parent.name===t)&&s.push(`\`${t.text}\` is used in the mount file (line ${f(t)}): code run from a string cannot be read`);const z=new Set;for(const t of a.readers??[]){const r=typeof t=="string"?t:t.name,o=c(`the reader ${r}`,r,typeof t=="string"?void 0:t.from);typeof o=="string"?s.push(o):z.add(o)}const Y=t=>{if(!e.isCallExpression(t)||!e.isIdentifier(t.expression))return!1;const r=p(t.expression);return r!==void 0&&z.has(r)};let V=null;const I=l.filter(t=>e.isImportSpecifier(t)&&t.name.text==="Render"),J=a.renderFrom??"efficient-easel/render",ee=I.length===1?I[0].parent.parent.parent.moduleSpecifier.text:"",M=l.filter(t=>e.isImportDeclaration(t)&&e.isStringLiteral(t.moduleSpecifier)&&t.moduleSpecifier.text===J&&!t.importClause?.isTypeOnly).flatMap(t=>{const r=t.importClause;if(!r)return[];const o=r.namedBindings;return[...r.name?[r.name.text]:[],...o&&e.isNamespaceImport(o)?[`* as ${o.name.text}`]:[],...o&&e.isNamedImports(o)?o.elements.filter(u=>!u.isTypeOnly).map(u=>u.propertyName?`${u.propertyName.text} as ${u.name.text}`:u.name.text):[]]});(M.length!==1||M[0]!=="Render")&&s.push(`"${J}" gives this file ${M.length} binding(s) (${M.join(", ")||"none"}), not the one \`Render\``);const q=I.length===1&&!I[0].propertyName&&ee===J?i.getSymbolAtLocation(I[0].name):void 0;if(!q||h("Render").length!==1)s.push(`\`Render\` is not imported once by its own name from "${J}"`);else{const t=x.filter(o=>!N(e,o)&&p(o)===q),r=t.filter(o=>(e.isJsxOpeningElement(o.parent)||e.isJsxSelfClosingElement(o.parent))&&o.parent.tagName===o);if(r.length!==1||t.length!==1)s.push(`\`Render\` is used ${t.length} times, ${r.length} as a tag: one <Render> and no alias`);else{const u=r[0].parent.attributes.properties;u.some(w=>e.isJsxSpreadAttribute(w))&&s.push("the Render tag has a spread attribute, which can hand it another document");const g=u.filter(w=>e.isJsxAttribute(w)&&w.name.getText()==="data"),b=g.length===1?g[0].initializer:void 0,E=b&&e.isJsxExpression(b)?b.expression:void 0;!E||!e.isIdentifier(E)||p(E)!==$?s.push(`the Render tag draws \`${E?E.getText():g.length===1?g[0].getText():"nothing"}\`, not \`${a.variable}\``):V=E;const G=u.filter(w=>e.isJsxAttribute(w)&&w.name.getText()==="keep"),W=G.length===1?G[0].initializer:void 0,F=W&&e.isJsxExpression(W)?W.expression:void 0;if(!F||!e.isIdentifier(F))s.push("the Render tag has no `keep={keep}`: a mount drawn again would remount every slot it holds (lib/document/render-keep)");else{const w=c("the keep hook useRenderKeep","useRenderKeep",a.keepFrom??j);typeof w=="string"&&s.push(w);const D=p(F)?.valueDeclaration;if(!D||!e.isVariableDeclaration(D)||D.parent.parent.parent!==R.body||h(F.text).length!==1)s.push(`\`${F.text}\` (the Render tag's keep) is not declared once at the top level of the component's body: a keep made at module level is shared by every mount and request`);else if(!(e.getCombinedNodeFlags(D)&e.NodeFlags.Const))s.push(`\`${F.text}\` (the Render tag's keep) is not a \`const\`: a keep set again is a new keep`);else{const O=D.initializer;(!O||!e.isCallExpression(O)||O.arguments.length!==0||!e.isIdentifier(O.expression)||typeof w=="string"||p(O.expression)!==w)&&s.push(`\`${F.text}\` is not set straight from useRenderKeep(): a keep made new on each draw keeps nothing`)}}}}const v=new Map;for(const t of P)v.set(t,t.name);$&&v.set($,a.variable);const te=t=>{for(let r=t;r.parent;r=r.parent){const o=r.parent;if(y&&o===y)return y.arguments.some(g=>g===r);if(!(L(e,o)||e.isObjectLiteralExpression(o)||e.isPropertyAssignment(o)&&o.initializer===r||e.isShorthandPropertyAssignment(o)||e.isSpreadAssignment(o)||e.isArrayLiteralExpression(o)||e.isSpreadElement(o)||e.isConditionalExpression(o)&&o.condition!==r||H(e,o)))return!1}return!1},ne=t=>{let r=t,o=!1;for(;;){const u=r.parent;if(!u)return;if(L(e,u))r=u;else if(e.isConditionalExpression(u)&&u.condition!==r)r=u,o=!0;else if(e.isSpreadAssignment(u)&&e.isObjectLiteralExpression(u.parent))r=u.parent,o=!0;else return e.isVariableDeclaration(u)&&u.initializer===r&&e.isIdentifier(u.name)&&o?p(u.name):void 0}},X=(t,r)=>{if(d(t))return!0;const{top:o,path:u}=_(e,t);if(t===V)return!0;let g=o;for(;g.parent&&(L(e,g.parent)||H(e,g.parent));)g=g.parent;if(g.parent&&Y(g.parent)&&g.parent.arguments.some(E=>E===g)||P.has(r)&&te(o))return!0;const b=u?void 0:ne(o);return b?(v.has(b)||v.set(b,b.name),!0):!1};for(let t=-1;t!==v.size;){t=v.size;for(const r of x){if(N(e,r))continue;const o=p(r);o&&v.has(o)&&X(r,o)}}for(const t of x){if(N(e,t))continue;const r=p(t);if(!r||!v.has(r)||X(t,r))continue;const{top:o}=_(e,t),u=v.get(r),g=P.has(r)||r===$?"":" (a local that holds an input or the variable)";s.push(`\`${u}\`${g} is ${ce(e,o)} at line ${f(t)}`)}return s}const j="@/lib/document/render-keep";function de(n,a,e,m){if(!e.includes(m))return!1;const i=n.createSourceFile(a,e,n.ScriptTarget.Latest,!0,a.endsWith(".tsx")?n.ScriptKind.TSX:n.ScriptKind.TS),l=f=>f.some(p=>!p.isTypeOnly&&(p.propertyName??p.name).text==="Render"),x=f=>{if(n.isImportDeclaration(f)&&n.isStringLiteral(f.moduleSpecifier)&&f.moduleSpecifier.text===m){const p=f.importClause;if(!p||p.isTypeOnly)return!1;const h=p.namedBindings;return!!p.name||h!==void 0&&(n.isNamespaceImport(h)||l(h.elements))}if(n.isExportDeclaration(f)&&f.moduleSpecifier&&n.isStringLiteral(f.moduleSpecifier)&&f.moduleSpecifier.text===m){if(f.isTypeOnly)return!1;const p=f.exportClause;return!p||n.isNamespaceExport(p)||l(p.elements)}return n.isCallExpression(f)&&f.arguments.length>0&&n.isStringLiteralLike(f.arguments[0])&&f.arguments[0].text===m&&(f.expression.kind===n.SyntaxKind.ImportKeyword||n.isIdentifier(f.expression)&&f.expression.text==="require")?!0:n.forEachChild(f,x)??!1};return x(i)}const Z=new WeakMap;function ue(n){const a=Z.get(n);if(a)return a;const{check:e,report:m}=U("published mounts fixtures"),i=($,k)=>Q($,k,n),l={call:"publishedPageData",variable:"page",args:"data, metadata",readers:["first"]},x="return <Render config={c} keep={keep} data={page} />;",f=`const page = ${l.call}(data, metadata);`,p="const keep = useRenderKeep();",h=$=>`import { Render } from "efficient-easel/render";
2
2
  import { first } from "./first";
3
- import { ${p.call} } from "./published-passes";
3
+ import { useRenderKeep } from "${j}";
4
+ import { ${l.call} } from "./published-passes";
4
5
  export default function P({ data, metadata = {} }: Props) {
5
- ${h}
6
- }`,d=m(`${$}
7
- ${x}`),c=h=>m(`${h}
6
+ ${p}
8
7
  ${$}
9
- ${x}`),s=h=>m(`${$}
10
- ${h}
11
- ${x}`);e("the one call, drawn, passes",o(d,p).length===0,o(d,p).join("; "));{const h={...p,callFrom:"@/lib/document/published-passes"},g=d.replace('from "./published-passes"',`from "${h.callFrom}"`);e("…the call imported from the module the mount names passes",o(g,h).length===0,o(g,h).join("; ")),e("…and the call imported from another module inside this package fails it",o(d,h).length>0)}e("…a comment naming a wrapper does not fail it",o(`// const page = x(${p.call}(data, metadata));
12
- ${d}`,p).length===0),e("…a path handed to a listed reader does not fail it",o(s("const lead = first(page.content);"),p).length===0),e("…an input spread, and an input as a ternary's last branch, do not fail it",o(s("const facts = ok ? { ...metadata, k: 1 } : metadata;"),p).length===0,o(s("const facts = ok ? { ...metadata, k: 1 } : metadata;"),p).join("; "));{const h="efficient-web-builder/render/lib/document/published-passes",g={call:"publishedChromeData",callFrom:h,variable:"data",inputs:["group"]},b=`import { Render } from "efficient-easel/render";
13
- import { ${g.call} } from "${h}";
8
+ }`,d=h(`${f}
9
+ ${x}`),s=$=>h(`${$}
10
+ ${f}
11
+ ${x}`),c=$=>h(`${f}
12
+ ${$}
13
+ ${x}`);e("the one call, drawn, passes",i(d,l).length===0,i(d,l).join("; "));{const $={...l,callFrom:"@/lib/document/published-passes"},k=d.replace('from "./published-passes"',`from "${$.callFrom}"`);e("…the call imported from the module the mount names passes",i(k,$).length===0,i(k,$).join("; ")),e("…and the call imported from another module inside this package fails it",i(d,$).length>0)}e("…a comment naming a wrapper does not fail it",i(`// const page = x(${l.call}(data, metadata));
14
+ ${d}`,l).length===0),e("…a path handed to a listed reader does not fail it",i(c("const lead = first(page.content);"),l).length===0),e("…an input spread, and an input as a ternary's last branch, do not fail it",i(c("const facts = ok ? { ...metadata, k: 1 } : metadata;"),l).length===0,i(c("const facts = ok ? { ...metadata, k: 1 } : metadata;"),l).join("; "));{const $="efficient-web-builder/render/lib/document/published-passes",k="efficient-web-builder/render/lib/document/render-keep",y={call:"publishedChromeData",callFrom:$,variable:"data",inputs:["group"],keepFrom:k},T=`import { useRenderKeep } from "${k}";
15
+ `,R=`import { Render } from "efficient-easel/render";
16
+ ${T}import { ${y.call} } from "${$}";
14
17
  export default function H({ group }: { group: G }) {
15
- const data = ${g.call}({ content: [group] } as unknown as D);
16
- return <Render config={c} data={data} />;
17
- }`;e("…a chrome mount drawing `data={data}` passes",o(b,g).length===0,o(b,g).join("; ")),e("…and a write into its prop fails it",o(b.replace("const data",`group.props = {};
18
- const data`),g).length>0);const S="<Render config={headerRenderConfig()} data={data} />",w=`import { Render } from "efficient-easel/render";
19
- import { ${g.call} } from "${h}";
18
+ const data = ${y.call}({ content: [group] } as unknown as D);
19
+ const keep = useRenderKeep();
20
+ return <Render config={c} keep={keep} data={data} />;
21
+ }`;e("…a chrome mount drawing `data={data}` passes",i(R,y).length===0,i(R,y).join("; ")),e("…and a write into its prop fails it",i(R.replace("const data",`group.props = {};
22
+ const data`),y).length>0);const C="<Render config={headerRenderConfig()} keep={keep} data={data} />",S=`import { Render } from "efficient-easel/render";
23
+ ${T}import { ${y.call} } from "${$}";
20
24
  export default function PublishedHeader({ group }: { group: G }) {
21
- const data = ${g.call}({ root: { props: {} }, content: [group], zones: {} } as unknown as D);
25
+ const data = ${y.call}({ root: { props: {} }, content: [group], zones: {} } as unknown as D);
26
+ const keep = useRenderKeep();
22
27
  return (
23
28
  <Bar sticky={sticky}>
24
- ${S}
29
+ ${C}
25
30
  </Bar>
26
31
  );
27
- }`;e("…a header mount drawing `data={data}` inside a wrapper passes",o(w,g).length===0,o(w,g).join("; "));const R=[["`data` assigned after the call",w.replace(" return (",` data = extra;
28
- return (`)],["a property write on `data`",w.replace(" return (",` data.content = [];
29
- return (`)],["a second Render with `data={data}` and a spread",w.replace(S,`${S}
30
- <Render data={data} {...extra} />`)],["its call imported from another module",w.replace(`from "${h}"`,'from "./published-passes"')]];for(const[T,D]of R)e(`…${T} fails it`,o(D,g).length>0)}const C=[["a wrapping pass",m(`const page = extra(${p.call}(data, metadata));
31
- ${x}`)],["a pass after the call",m(`const page = ${p.call}(data, metadata).x;
32
- ${x}`)],["a reassignment",m(`let page = ${p.call}(data, metadata);
32
+ }`;e("…a header mount drawing `data={data}` inside a wrapper passes",i(S,y).length===0,i(S,y).join("; "));const B=[["`data` assigned after the call",S.replace(" return (",` data = extra;
33
+ return (`)],["a property write on `data`",S.replace(" return (",` data.content = [];
34
+ return (`)],["a second Render with `data={data}` and a spread",S.replace(C,`${C}
35
+ <Render data={data} {...extra} />`)],["its call imported from another module",S.replace(`from "${$}"`,'from "./published-passes"')],["no keep on the tag",S.replace(" keep={keep}","")],["its keep hook imported from another module",S.replace(`from "${k}"`,'from "./render-keep"')]];for(const[P,z]of B)e(`…${P} fails it`,i(z,y).length>0)}const K=[["a wrapping pass",h(`const page = extra(${l.call}(data, metadata));
36
+ ${x}`)],["a pass after the call",h(`const page = ${l.call}(data, metadata).x;
37
+ ${x}`)],["a reassignment",h(`let page = ${l.call}(data, metadata);
33
38
  page = extra(page);
34
- ${x}`)],["a pass in the Render prop",m(`${$}
35
- return <Render data={extra(page)} />;`)],["other arguments",m(`const page = ${p.call}(extra(data), metadata);
36
- ${x}`)],["no call at all",m(x)],["a pass on the input before the call",c("data = extra(data);")],["a compound assignment to the input",c("metadata ??= {};")],["an increment of the input",c("data++;")],["a destructured reassignment of the input",c("({ data } = extra({ data }));")],["an array reassignment of the input",c("[data, metadata] = extra([data, metadata]);")],["a local shadowing the input",c("{ const data = extra(0); }")],["a rebuilt argument named as the args",m(`const d = extra(data);
37
- const page = ${p.call}(d, metadata);
38
- ${x}`),{...p,args:"d, metadata"}],["an argument that is no prop at all",`const page = ${p.call}(data, metadata);
39
- ${x}`],["a property write",s("page.content = extra(page.content);")],["a deep property write",s("page.root.props = {};")],["a compound property write",s("page.count += 1;")],["a bracket write",s('page["content"] = [];')],["an optional-path write",s("page.root!.props = {};")],["a delete",s("delete page.root;")],["Object.assign into it",s("Object.assign(page, extra(page));")],["the variable handed whole to a call",s("mutate(page);")],["the variable aliased",s("const shown = page;")],["a push on a path from it",s("page.content.push(extra(0));")],["a splice on an optional path from it",s("page.content?.splice(0, 1);")],["a sort on a bracket path from it",s('page["content"].sort();')],["an input handed to a pass through a cast",c("inPlacePass(data as Doc);")],["an input handed whole to a call",c("mutate(data);")],["a push through a cast of an input",c("(data as Doc).content.push(x);")],["a property write through a cast of an input",c("(metadata as any).x = 1;")],["a property write through an old-style cast",c("(<any>metadata).x = 1;")],["a property write through a non-null input",c("(metadata!).x = 1;")],["a push on a non-null input",c("data!.content.push(x);")],["an input aliased through a cast, then written",c(`const d = data as any;
40
- d.content = [];`)],["an input aliased",c("const d = data;")],["an input path aliased",c("const p = metadata.facts;")],["a path value bound to a local",s("const one = page.content.length === 1;")],["a path alias pushed into",s(`const c = page.content;
41
- c.push(x);`)],["a path alias written",s(`const r = page.root;
42
- r.props = {};`)],["a path assigned to a let",s(`let c;
43
- c = page.content;`)],["a path handed to a writing call",s("mutate(page.content);")],["a path's forEach writing",s("page.content.forEach((s) => { s.props = {}; });")],["a path's for-of writing",s("for (const s of page.content) s.props.x = 1;")],["a path in an array literal",s("const all = [page.content];")],["the variable spread into a copy",s(`const copy = { ...page };
44
- copy.content.push(x);`)],["a path handed to a method that shares a reader's name",s("evil.first(page.content);")],["a local from an input's ternary branch, written through a cast",c(`const f = ok ? {} : metadata;
45
- (f as any).x = 1;`)],["a local from an input's ternary branch, handed to a call",c(`const f = ok ? {} : metadata;
46
- mutate(f);`)],["an input assigned an object with no space",c("data={content: [], root: {}};")],["an input assigned a cast object with no space",c("data={ content: [] } as unknown;")],["a second input assigned with no space",c("metadata={k: 1};")],["an input assigned a string with no space",c('data="";')],["the variable assigned with no space",s("page={content: [], root:{props:{}}} as any;")],["a spread copy of an input, written deep",c(`const copy: any = { ...metadata };
47
- copy.theme.x = 1;`)],["a spread copy of an input, handed to a call",c(`const copy = { ...metadata };
39
+ ${x}`)],["a pass in the Render prop",h(`${f}
40
+ return <Render data={extra(page)} />;`)],["other arguments",h(`const page = ${l.call}(extra(data), metadata);
41
+ ${x}`)],["no call at all",h(x)],["a pass on the input before the call",s("data = extra(data);")],["a compound assignment to the input",s("metadata ??= {};")],["an increment of the input",s("data++;")],["a destructured reassignment of the input",s("({ data } = extra({ data }));")],["an array reassignment of the input",s("[data, metadata] = extra([data, metadata]);")],["a local shadowing the input",s("{ const data = extra(0); }")],["a rebuilt argument named as the args",h(`const d = extra(data);
42
+ const page = ${l.call}(d, metadata);
43
+ ${x}`),{...l,args:"d, metadata"}],["an argument that is no prop at all",`const page = ${l.call}(data, metadata);
44
+ ${x}`],["a property write",c("page.content = extra(page.content);")],["a deep property write",c("page.root.props = {};")],["a compound property write",c("page.count += 1;")],["a bracket write",c('page["content"] = [];')],["an optional-path write",c("page.root!.props = {};")],["a delete",c("delete page.root;")],["Object.assign into it",c("Object.assign(page, extra(page));")],["the variable handed whole to a call",c("mutate(page);")],["the variable aliased",c("const shown = page;")],["a push on a path from it",c("page.content.push(extra(0));")],["a splice on an optional path from it",c("page.content?.splice(0, 1);")],["a sort on a bracket path from it",c('page["content"].sort();')],["an input handed to a pass through a cast",s("inPlacePass(data as Doc);")],["an input handed whole to a call",s("mutate(data);")],["a push through a cast of an input",s("(data as Doc).content.push(x);")],["a property write through a cast of an input",s("(metadata as any).x = 1;")],["a property write through an old-style cast",s("(<any>metadata).x = 1;")],["a property write through a non-null input",s("(metadata!).x = 1;")],["a push on a non-null input",s("data!.content.push(x);")],["an input aliased through a cast, then written",s(`const d = data as any;
45
+ d.content = [];`)],["an input aliased",s("const d = data;")],["an input path aliased",s("const p = metadata.facts;")],["a path value bound to a local",c("const one = page.content.length === 1;")],["a path alias pushed into",c(`const c = page.content;
46
+ c.push(x);`)],["a path alias written",c(`const r = page.root;
47
+ r.props = {};`)],["a path assigned to a let",c(`let c;
48
+ c = page.content;`)],["a path handed to a writing call",c("mutate(page.content);")],["a path's forEach writing",c("page.content.forEach((s) => { s.props = {}; });")],["a path's for-of writing",c("for (const s of page.content) s.props.x = 1;")],["a path in an array literal",c("const all = [page.content];")],["the variable spread into a copy",c(`const copy = { ...page };
49
+ copy.content.push(x);`)],["a path handed to a method that shares a reader's name",c("evil.first(page.content);")],["a local from an input's ternary branch, written through a cast",s(`const f = ok ? {} : metadata;
50
+ (f as any).x = 1;`)],["a local from an input's ternary branch, handed to a call",s(`const f = ok ? {} : metadata;
51
+ mutate(f);`)],["an input assigned an object with no space",s("data={content: [], root: {}};")],["an input assigned a cast object with no space",s("data={ content: [] } as unknown;")],["a second input assigned with no space",s("metadata={k: 1};")],["an input assigned a string with no space",s('data="";')],["the variable assigned with no space",c("page={content: [], root:{props:{}}} as any;")],["a spread copy of an input, written deep",s(`const copy: any = { ...metadata };
52
+ copy.theme.x = 1;`)],["a spread copy of an input, handed to a call",s(`const copy = { ...metadata };
48
53
  mutate(copy);`)],["a reader declared in the mount",`${d}
49
54
  function first(x) { x.content = []; }`],["a reader declared as a local arrow",`${d}
50
55
  const first = (x) => { x.content = []; };`],["a reader that is not imported",d.replace(`import { first } from "./first";
51
- `,"")],["eval",s('eval("page.content = []");')],["new Function",s('new Function("p", "p.content = []")(page);')],["Function called",s('Function("p", "p.content = []");')],["a call in a class extends clause",s("class W extends (mutate(page), Object) {}")],["a call in an instantiation expression",s("const g = (mutate(page), id)<number>;")],["a Render from another module",d.replace('from "efficient-easel/render"','from "./fake-render"')],["a second Render import, renamed",d.replace('import { Render } from "efficient-easel/render";',`import { Render } from "efficient-easel/render";
56
+ `,"")],["eval",c('eval("page.content = []");')],["new Function",c('new Function("p", "p.content = []")(page);')],["Function called",c('Function("p", "p.content = []");')],["a call in a class extends clause",c("class W extends (mutate(page), Object) {}")],["a call in an instantiation expression",c("const g = (mutate(page), id)<number>;")],["a Render from another module",d.replace('from "efficient-easel/render"','from "./fake-render"')],["a second Render import, renamed",d.replace('import { Render } from "efficient-easel/render";',`import { Render } from "efficient-easel/render";
52
57
  import { Render as Second } from "efficient-easel/render";`)],["a namespace import of Render's module",d.replace('import { Render } from "efficient-easel/render";',`import { Render } from "efficient-easel/render";
53
58
  import * as E from "efficient-easel/render";`)],["a default import of Render's module",d.replace('import { Render } from "efficient-easel/render";',`import { Render } from "efficient-easel/render";
54
- import E from "efficient-easel/render";`)],["the call declared in the mount, not imported",`${d.replace(`import { ${p.call} } from "./published-passes";
59
+ import E from "efficient-easel/render";`)],["the call declared in the mount, not imported",`${d.replace(`import { ${l.call} } from "./published-passes";
60
+ `,"")}
61
+ function ${l.call}(d, m) { const x: any = d; x.content = []; return x; }`],["the call declared again beside its import",`${d}
62
+ function ${l.call}(d, m) { return d; }`],["the call imported from outside this package",d.replace('from "./published-passes"','from "evil-passes"')],["another function imported as the call",d.replace(`import { ${l.call} }`,`import { evilPass as ${l.call} }`)],["the call as a type-only import",d.replace(`import { ${l.call} }`,`import type { ${l.call} }`)],["no keep on the tag",d.replace(" keep={keep}","")],["a keep made at module level",d.replace(`${p}
63
+ `,"").replace("export default function",`const keep = createRenderKeep();
64
+ export default function`)],["a keep made new on each draw",d.replace(p,"const keep = createRenderKeep();")],["a keep wrapped in a call",d.replace(p,"const keep = other(useRenderKeep());")],["a keep set again",d.replace(p,`let keep = useRenderKeep();
65
+ keep = createRenderKeep();`)],["a keep hook declared in the mount",`${d.replace(`import { useRenderKeep } from "${j}";
55
66
  `,"")}
56
- function ${p.call}(d, m) { const x: any = d; x.content = []; return x; }`],["the call declared again beside its import",`${d}
57
- function ${p.call}(d, m) { return d; }`],["the call imported from outside this package",d.replace('from "./published-passes"','from "evil-passes"')],["another function imported as the call",d.replace(`import { ${p.call} }`,`import { evilPass as ${p.call} }`)],["the call as a type-only import",d.replace(`import { ${p.call} }`,`import type { ${p.call} }`)],["a call with no input it can check",m(`const page = ${p.call}({ ...data });
58
- ${x}`),{call:p.call,variable:"page",args:"{ ...data }"}],["a call with no args and no inputs named",d,{call:p.call,variable:"page"}]];for(const[h,g,b]of C)e(`…${h} fails it`,o(g,b??p).length>0);const A=u().checks;return U.set(n,A),A}function le(n,a){const{check:e,report:u}=M("published mounts"),o=a.ts;if(!e("the rule is handed the compiler (`options.ts`)",o!==void 0,"a host passes `ts` from its own typescript"))return u();for(const $ of ie(o))e($.name,$.ok,$.detail);const p=n.filter($=>/\.tsx?$/.test($.path));e(`the source scan reached the tree (${p.length} TS/TSX files, at least ${a.minFiles})`,p.length>=a.minFiles);const x=Object.keys(a.mounts);e("at least one published mount is named",x.length>0);for(const $ of x){const m=p.find(c=>c.path===$);if(!e(`${$} is here`,m!==void 0,"a stale row would shelter nothing"))continue;const d=G(m.text,a.mounts[$],o);e(`${$} draws exactly what ${a.mounts[$].call} returns — a pass belongs in lib/document/published-passes`,d.length===0,d.join("; "))}return u()}export{G as mountProblems,le as publishedMounts};
67
+ function useRenderKeep() { return new WeakMap(); }`],["a keep hook from outside this package",d.replace(`from "${j}"`,'from "evil-keep"')],["a keep hook from another module of this package",d.replace(`from "${j}"`,'from "./render-keep"')],["a call with no input it can check",h(`const page = ${l.call}({ ...data });
68
+ ${x}`),{call:l.call,variable:"page",args:"{ ...data }"}],["a call with no args and no inputs named",d,{call:l.call,variable:"page"}]];for(const[$,k,y]of K)e(`…${$} fails it`,i(k,y??l).length>0);const A=m().checks;return Z.set(n,A),A}function ge(n,a){const{check:e,report:m}=U("published mounts"),i=a.ts;if(!e("the rule is handed the compiler (`options.ts`)",i!==void 0,"a host passes `ts` from its own typescript"))return m();for(const p of ue(i))e(p.name,p.ok,p.detail);const l=n.filter(p=>/\.tsx?$/.test(p.path));e(`the source scan reached the tree (${l.length} TS/TSX files, at least ${a.minFiles})`,l.length>=a.minFiles);const x=Object.keys(a.mounts);e("at least one published mount is named",x.length>0);const f=new Set(x.map(p=>a.mounts[p].renderFrom??"efficient-easel/render"));for(const p of l)!x.includes(p.path)&&[...f].some(h=>de(i,p.path,p.text,h))&&e(`${p.path} draws easel Render: it is a named published mount (a row), or the rule never reads it`,!1,"add its row to the mounts this repository names");for(const p of x){const h=l.find(s=>s.path===p);if(!e(`${p} is here`,h!==void 0,"a stale row would shelter nothing"))continue;const d=Q(h.text,a.mounts[p],i);e(`${p} draws exactly what ${a.mounts[p].call} returns — a pass belongs in lib/document/published-passes`,d.length===0,d.join("; "))}return m()}export{Q as mountProblems,ge as publishedMounts};
@@ -1,6 +1,8 @@
1
1
  import type { Config } from "efficient-easel/blocks";
2
- export default function PageRender({ config, data, metadata, }: {
2
+ declare function PageRender({ config, data, metadata, }: {
3
3
  config: Config;
4
4
  data: unknown;
5
5
  metadata?: Record<string, unknown>;
6
6
  }): import("react").JSX.Element;
7
+ declare const _default: import("react").MemoExoticComponent<typeof PageRender>;
8
+ export default _default;
@@ -1 +1 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import{Render as c}from"efficient-easel/render";import{BelowFirstScreen as d,LATER_SLIDES_KEY as l,firstScreenLead as f,laterSlideIdsOf as m,useLeadDrawsFirst as p}from"../first-screen.js";import{publishedPageData as u}from"./published-passes.js";import{withSlotCounts as S}from"./slot-counts.js";function g({config:o,data:s,metadata:t}){const e=u(s,t),i=p(o,f(e.content)),r=m(e.content),a=r.length>0?{...t,[l]:r}:t;return n(d,{children:n(c,{config:i,metadata:S(a,e.content),data:e})})}export{g as default};
1
+ "use client";import{jsx as o}from"react/jsx-runtime";import{memo as a}from"react";import{Render as p}from"efficient-easel/render";import{BelowFirstScreen as d,LATER_SLIDES_KEY as f,firstScreenLead as l,laterSlideIdsOf as u,useLeadDrawsFirst as S}from"../first-screen.js";import{publishedPageData as g}from"./published-passes.js";import{useRenderKeep as h}from"./render-keep.js";import{withSlotCounts as w}from"./slot-counts.js";function L({config:n,data:s,metadata:t}){const e=g(s,t),i=h(),c=S(n,l(e.content)),r=u(e.content),m=r.length>0?{...t,[f]:r}:t;return o(d,{children:o(p,{config:c,metadata:w(m,e.content),keep:i,data:e})})}var k=a(L);export{k as default};
@@ -0,0 +1,2 @@
1
+ import { type RenderKeep } from "efficient-easel/render";
2
+ export declare function useRenderKeep(): RenderKeep;
@@ -0,0 +1 @@
1
+ "use client";import{useRef as r}from"react";import{createRenderKeep as n}from"efficient-easel/render";function o(){const e=r(null);return e.current??=n(),e.current}export{o as useRenderKeep};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "70.3.0",
3
+ "version": "71.0.0",
4
4
  "description": "The EFFICIENT website builder: the website editor, the general sections and the renderer that draws them, compiled. Hostable by any EFFICIENT product; nothing here imports a host.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@tabler/icons-react": "^3.46.0",
57
- "efficient-easel": "^35.0.0",
57
+ "efficient-easel": "^35.1.0",
58
58
  "efficient-shell": "^13.17.0",
59
59
  "isomorphic-dompurify": "^3.18.0",
60
60
  "next": ">=16",
@@ -73,7 +73,7 @@
73
73
  "@types/node": "^20",
74
74
  "@types/react": "^19",
75
75
  "@types/react-dom": "^19",
76
- "efficient-easel": "^35.0.0",
76
+ "efficient-easel": "^35.1.0",
77
77
  "efficient-shell": "^13.17.0",
78
78
  "efficient-shell-checker": "npm:efficient-shell@13.17.0",
79
79
  "esbuild": "^0.28.0",