@aglyn/besigner-ui 1.0.0-beta.293 → 1.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.
Files changed (31) hide show
  1. package/package.json +17 -17
  2. package/src/besigner.d.ts +1 -0
  3. package/src/besigner.js +1 -0
  4. package/src/besigner.js.map +1 -1
  5. package/src/lib/components/dnd/draggable-droppable.js +17 -8
  6. package/src/lib/components/dnd/draggable-droppable.js.map +1 -1
  7. package/src/lib/components/node-leaf.js +1 -1
  8. package/src/lib/components/node-leaf.js.map +1 -1
  9. package/src/lib/components/node-outline.d.ts +0 -6
  10. package/src/lib/components/node-outline.js +1 -28
  11. package/src/lib/components/node-outline.js.map +1 -1
  12. package/src/lib/components/node-overlay.js +14 -65
  13. package/src/lib/components/node-overlay.js.map +1 -1
  14. package/src/lib/drafts/besigner-server-draft.d.ts +4 -1
  15. package/src/lib/drafts/besigner-server-draft.js +6 -3
  16. package/src/lib/drafts/besigner-server-draft.js.map +1 -1
  17. package/src/lib/hooks/use-besigner-document.d.ts +14 -0
  18. package/src/lib/hooks/use-besigner-document.js +19 -1
  19. package/src/lib/hooks/use-besigner-document.js.map +1 -1
  20. package/src/lib/hooks/use-besigner-draft.d.ts +22 -0
  21. package/src/lib/hooks/use-besigner-draft.js +24 -1
  22. package/src/lib/hooks/use-besigner-draft.js.map +1 -1
  23. package/src/lib/hooks/use-besigner-open-draft-param.d.ts +24 -0
  24. package/src/lib/hooks/use-besigner-open-draft-param.js +37 -0
  25. package/src/lib/hooks/use-besigner-open-draft-param.js.map +1 -0
  26. package/src/lib/utils/docs-help.generated.d.ts +1 -1
  27. package/src/lib/utils/docs-help.generated.js +1 -0
  28. package/src/lib/utils/docs-help.generated.js.map +1 -1
  29. package/src/lib/utils/repeat-copy.d.ts +45 -9
  30. package/src/lib/utils/repeat-copy.js +71 -20
  31. package/src/lib/utils/repeat-copy.js.map +1 -1
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { BESIGNER_OPEN_DRAFT_PARAM, BESIGNER_OPEN_DRAFT_VALUE } from "@aglyn/aglyn/app-utils/version-draft";
17
+ import { useEffect, useState } from "react";
18
+ /**
19
+ * Whether the link that opened this editor asked for the saved draft
20
+ * (AGL-4116). Read once, then taken off the address, so a reload is an
21
+ * ordinary open rather than a second ask laid over what the author has done
22
+ * since.
23
+ */ export function useBesignerOpenDraftParam() {
24
+ const [asked] = useState(()=>typeof window !== 'undefined' && new URLSearchParams(window.location.search).get(BESIGNER_OPEN_DRAFT_PARAM) === BESIGNER_OPEN_DRAFT_VALUE);
25
+ useEffect(()=>{
26
+ if (!asked) return;
27
+ const url = new URL(window.location.href);
28
+ url.searchParams.delete(BESIGNER_OPEN_DRAFT_PARAM);
29
+ window.history.replaceState(window.history.state, '', url);
30
+ }, [
31
+ asked
32
+ ]);
33
+ return asked;
34
+ }
35
+ export default useBesignerOpenDraftParam;
36
+
37
+ //# sourceMappingURL=use-besigner-open-draft-param.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/hooks/use-besigner-open-draft-param.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n BESIGNER_OPEN_DRAFT_PARAM,\n BESIGNER_OPEN_DRAFT_VALUE,\n} from '@aglyn/aglyn/app-utils/version-draft'\nimport { useEffect, useState } from 'react'\n\n/**\n * Whether the link that opened this editor asked for the saved draft\n * (AGL-4116). Read once, then taken off the address, so a reload is an\n * ordinary open rather than a second ask laid over what the author has done\n * since.\n */\nexport function useBesignerOpenDraftParam(): boolean {\n const [asked] = useState(\n () =>\n typeof window !== 'undefined' &&\n new URLSearchParams(window.location.search).get(BESIGNER_OPEN_DRAFT_PARAM) ===\n BESIGNER_OPEN_DRAFT_VALUE,\n )\n useEffect(() => {\n if (!asked) return\n const url = new URL(window.location.href)\n url.searchParams.delete(BESIGNER_OPEN_DRAFT_PARAM)\n window.history.replaceState(window.history.state, '', url)\n }, [asked])\n return asked\n}\n\nexport default useBesignerOpenDraftParam\n"],"names":["BESIGNER_OPEN_DRAFT_PARAM","BESIGNER_OPEN_DRAFT_VALUE","useEffect","useState","useBesignerOpenDraftParam","asked","window","URLSearchParams","location","search","get","url","URL","href","searchParams","delete","history","replaceState","state"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,yBAAyB,EACzBC,yBAAyB,QACpB,uCAAsC;AAC7C,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAE3C;;;;;CAKC,GACD,OAAO,SAASC;IACd,MAAM,CAACC,MAAM,GAAGF,SACd,IACE,OAAOG,WAAW,eAClB,IAAIC,gBAAgBD,OAAOE,QAAQ,CAACC,MAAM,EAAEC,GAAG,CAACV,+BAC9CC;IAENC,UAAU;QACR,IAAI,CAACG,OAAO;QACZ,MAAMM,MAAM,IAAIC,IAAIN,OAAOE,QAAQ,CAACK,IAAI;QACxCF,IAAIG,YAAY,CAACC,MAAM,CAACf;QACxBM,OAAOU,OAAO,CAACC,YAAY,CAACX,OAAOU,OAAO,CAACE,KAAK,EAAE,IAAIP;IACxD,GAAG;QAACN;KAAM;IACV,OAAOA;AACT;AAEA,eAAeD,0BAAyB"}
@@ -29,7 +29,7 @@ export declare const BESIGNER_DOCS: {
29
29
  };
30
30
  export type BesignerDocsKey = keyof typeof BESIGNER_DOCS;
31
31
  export declare const BESIGNER_DOCS_ANCHORS: {
32
- readonly besigner: readonly ["#preview-vs-canvas", "#what-you-can-do", "#the-canvas", "#hierarchy-panel", "#the-inspector", "#inline-and-rich-text", "#reusable-components", "#editing-together", "#ai-in-the-canvas", "#related"];
32
+ readonly besigner: readonly ["#preview-vs-canvas", "#publish-from-a-preview", "#what-you-can-do", "#the-canvas", "#hierarchy-panel", "#the-inspector", "#inline-and-rich-text", "#reusable-components", "#editing-together", "#ai-in-the-canvas", "#related"];
33
33
  readonly bindings: readonly ["#binding-tokens", "#rename-safe-id-tokens", "#insert-a-variable", "#token-pills", "#in-the-canvas-text-editor", "#site-details", "#typed-variables", "#no-code-functions", "#functions-card", "#parameters-a-visitor-can-answer", "#a-calculator-you-lay-out", "#where-used--safety", "#workflows", "#related"];
34
34
  readonly dragDropHierarchy: readonly ["#where-you-can-drag", "#what-a-drag-does", "#drop-zones-edges-vs-center", "#containers-vs-leaf-elements", "#containers-accept-children", "#leaf-elements-dont--dropping-on-one-makes-a-sibling", "#adding-a-new-element", "#when-a-drop-is-rejected", "#moving-an-element-without-dragging", "#multi-drag", "#tips", "#related"];
35
35
  readonly elementCatalog: readonly ["#finding-an-element", "#element-search", "#element-detail", "#layout", "#the-pages-main-landmark", "#every-container-can-be-a-semantic-element", "#light-or-dark-whatever-the-visitor-picked", "#which-link-groups-want-to-be-a-nav", "#header-and-footer-for-your-site-chrome", "#grid", "#surface", "#accordion", "#navigation", "#where-a-link-opens", "#linking-to-a-collection-listing", "#link-container", "#tabs", "#tabs-that-go-to-another-screen", "#pagination", "#text", "#data-display", "#media", "#image", "#image-list", "#forms", "#commerce", "#members", "#input", "#related"];
@@ -34,6 +34,7 @@ export const BESIGNER_DOCS = {
34
34
  export const BESIGNER_DOCS_ANCHORS = {
35
35
  besigner: [
36
36
  '#preview-vs-canvas',
37
+ '#publish-from-a-preview',
37
38
  '#what-you-can-do',
38
39
  '#the-canvas',
39
40
  '#hierarchy-panel',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/utils/docs-help.generated.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// GENERATED FILE — do not edit. Regenerate with:\n// node tools/scripts/generate-docs-help.mjs\n// Source of truth: apps/docs/docs frontmatter + headings (AGL-602).\n\n// The besigner designer lib can't import the console constants, so it carries\n// its own generated subset of the docs help registry.\n\nexport const BESIGNER_DOCS = {\n besigner: '/building-sites/besigner/overview',\n bindings: '/building-sites/bindings/overview',\n dragDropHierarchy: '/building-sites/besigner/drag-drop-hierarchy',\n elementCatalog: '/building-sites/besigner/element-catalog',\n interactions: '/building-sites/besigner/interactions-and-custom-html',\n layouts: '/building-sites/screens-and-layouts/layouts',\n repeat: '/building-sites/besigner/repeat',\n responsiveStyling: '/building-sites/besigner/responsive-styling',\n reusableComponents: '/building-sites/besigner/reusable-components',\n seo: '/building-sites/seo/overview',\n textEditing: '/building-sites/besigner/text-editing',\n} as const satisfies Record<string, string>\n\nexport type BesignerDocsKey = keyof typeof BESIGNER_DOCS\n\nexport const BESIGNER_DOCS_ANCHORS = {\n besigner: ['#preview-vs-canvas', '#what-you-can-do', '#the-canvas', '#hierarchy-panel', '#the-inspector', '#inline-and-rich-text', '#reusable-components', '#editing-together', '#ai-in-the-canvas', '#related'],\n bindings: ['#binding-tokens', '#rename-safe-id-tokens', '#insert-a-variable', '#token-pills', '#in-the-canvas-text-editor', '#site-details', '#typed-variables', '#no-code-functions', '#functions-card', '#parameters-a-visitor-can-answer', '#a-calculator-you-lay-out', '#where-used--safety', '#workflows', '#related'],\n dragDropHierarchy: ['#where-you-can-drag', '#what-a-drag-does', '#drop-zones-edges-vs-center', '#containers-vs-leaf-elements', '#containers-accept-children', '#leaf-elements-dont--dropping-on-one-makes-a-sibling', '#adding-a-new-element', '#when-a-drop-is-rejected', '#moving-an-element-without-dragging', '#multi-drag', '#tips', '#related'],\n elementCatalog: ['#finding-an-element', '#element-search', '#element-detail', '#layout', '#the-pages-main-landmark', '#every-container-can-be-a-semantic-element', '#light-or-dark-whatever-the-visitor-picked', '#which-link-groups-want-to-be-a-nav', '#header-and-footer-for-your-site-chrome', '#grid', '#surface', '#accordion', '#navigation', '#where-a-link-opens', '#linking-to-a-collection-listing', '#link-container', '#tabs', '#tabs-that-go-to-another-screen', '#pagination', '#text', '#data-display', '#media', '#image', '#image-list', '#forms', '#commerce', '#members', '#input', '#related'],\n interactions: ['#fluent-interactions', '#interactions-belong-to-the-page-they-are-on', '#plan-availability', '#pick-the-target-by-clicking', '#interaction-cookbook', '#scroll-to-element-step', '#play-video-step', '#open-a-lightbox', '#analytics-event-step', '#analytics-event-name', '#analytics-event-parameters', '#analytics-event-delivery', '#custom-html-block', '#related'],\n layouts: ['#what-a-layout-is', '#find-a-layout', '#nested-layouts', '#layout-properties', '#restyle-the-layout-on-one-page', '#duplicate', '#generate-a-layout-with-aglyn-ai', '#used-by', '#layouts-vs-reusable-components', '#related'],\n repeat: ['#turn-it-on', '#what-repeats-the-element-or-whats-inside-it', '#fill-each-copy-in', '#see-the-copies-while-you-design', '#bound-what-renders', '#the-hundred-record-ceiling', '#what-you-cant-do', '#when-a-dataset-goes-away', '#related'],\n responsiveStyling: ['#style-per-breakpoint', '#mute-a-style', '#interaction-states', '#you-can-see-the-state-while-you-style-it', '#fields-you-dont-touch-keep-inheriting', '#states-and-breakpoints-combine', '#focus-state', '#box-stylers', '#spacing-side-names', '#spacing-units', '#spacing-steps', '#spacing-custom-amounts', '#unit-px', '#unit-rem', '#unit-em', '#unit-percent', '#unit-ch', '#unit-viewport', '#unit-small-viewport', '#style-groups', '#borders-without-css', '#picking-a-font', '#gradient-backgrounds', '#visibility-per-device-band', '#scheme-scoped-colors', '#pin-a-color-scheme', '#custom-classes', '#custom-css-sx', '#semantic-sections--theme-mode', '#edit-json-for-one-element'],\n reusableComponents: ['#promote', '#insert-instances', '#properties', '#declare-them', '#make-a-property-conditional', '#use-them', '#save-then-publish', '#fill-them-in-per-page', '#restyle-one-instance', '#override-an-attribute-on-one-instance', '#retrofit-duplicated-sections', '#detach', '#nesting', '#used-by', '#manage', '#component-details-card', '#duplicate', '#reusable-email-blocks', '#make-a-header-or-footer', '#add-one-to-an-email', '#change-a-block-in-one-email', '#emails-you-have-not-designed', '#email-theme-colors', '#copy--paste-vs-reusable-components', '#tips', '#related'],\n seo: ['#per-screen-seo', '#how-a-page-title-is-built', '#variables-so-a-title-is-not-a-copy-of-your-site-name', '#site-wide-defaults', '#site-description', '#title-separator', '#title-pattern', '#favicon', '#app-icon', '#site-social-image', '#every-icon-size-is-generated-for-you', '#your-sites-install-details-the-web-app-manifest', '#what-language-your-site-says-it-is-in', '#seo-check', '#target-keywords', '#check-one-page', '#search-engine-visibility', '#the-whole-site', '#a-single-page', '#verify-your-site-with-google-search-console', '#sitemap--robots', '#one-index-one-file-per-section', '#social-cards', '#what-each-kind-of-page-emits', '#structured-data', '#entity-card', '#entity-type', '#entity-name', '#entity-description', '#entity-website', '#entity-contact', '#entity-logo', '#address-card', '#local-businesses', '#ai-agents', '#markdown-for-any-page', '#llmstxt', '#ai-agents-card', '#openapijson', '#well-knownapi-catalog', '#crawler-access', '#analytics-integration', '#related'],\n textEditing: ['#edit-inline', '#committing', '#inline-toolbar', '#rich-text', '#the-text-attribute', '#text-field-formatting', '#remove-formatting', '#line-breaks', '#bindings-in-text', '#limits', '#wrapped-outlines', '#related'],\n} as const satisfies Partial<Record<BesignerDocsKey, readonly `#${string}`[]>>\n\ntype BesignerAnchorMap = typeof BESIGNER_DOCS_ANCHORS\n\n/** Valid heading anchors for a besigner docs page (`never` when none). */\nexport type BesignerDocsAnchor<K extends BesignerDocsKey> =\n K extends keyof BesignerAnchorMap ? BesignerAnchorMap[K][number] : never\n"],"names":["BESIGNER_DOCS","besigner","bindings","dragDropHierarchy","elementCatalog","interactions","layouts","repeat","responsiveStyling","reusableComponents","seo","textEditing","BESIGNER_DOCS_ANCHORS"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD,iDAAiD;AACjD,8CAA8C;AAC9C,oEAAoE;AAEpE,8EAA8E;AAC9E,sDAAsD;AAEtD,OAAO,MAAMA,gBAAgB;IAC3BC,UAAU;IACVC,UAAU;IACVC,mBAAmB;IACnBC,gBAAgB;IAChBC,cAAc;IACdC,SAAS;IACTC,QAAQ;IACRC,mBAAmB;IACnBC,oBAAoB;IACpBC,KAAK;IACLC,aAAa;AACf,EAA2C;AAI3C,OAAO,MAAMC,wBAAwB;IACnCX,UAAU;QAAC;QAAsB;QAAoB;QAAe;QAAoB;QAAkB;QAAyB;QAAwB;QAAqB;QAAqB;KAAW;IAChNC,UAAU;QAAC;QAAmB;QAA0B;QAAsB;QAAgB;QAA8B;QAAiB;QAAoB;QAAsB;QAAmB;QAAoC;QAA6B;QAAuB;QAAc;KAAW;IAC3TC,mBAAmB;QAAC;QAAuB;QAAqB;QAA+B;QAAgC;QAA+B;QAAwD;QAAyB;QAA4B;QAAuC;QAAe;QAAS;KAAW;IACrVC,gBAAgB;QAAC;QAAuB;QAAmB;QAAmB;QAAW;QAA4B;QAA8C;QAA8C;QAAuC;QAA2C;QAAS;QAAY;QAAc;QAAe;QAAuB;QAAoC;QAAmB;QAAS;QAAmC;QAAe;QAAS;QAAiB;QAAU;QAAU;QAAe;QAAU;QAAa;QAAY;QAAU;KAAW;IACnlBC,cAAc;QAAC;QAAwB;QAAgD;QAAsB;QAAgC;QAAyB;QAA2B;QAAoB;QAAoB;QAAyB;QAAyB;QAA+B;QAA6B;QAAsB;KAAW;IACxXC,SAAS;QAAC;QAAqB;QAAkB;QAAmB;QAAsB;QAAmC;QAAc;QAAoC;QAAY;QAAmC;KAAW;IACzOC,QAAQ;QAAC;QAAe;QAAgD;QAAsB;QAAoC;QAAuB;QAA+B;QAAqB;QAA6B;KAAW;IACrPC,mBAAmB;QAAC;QAAyB;QAAiB;QAAuB;QAA6C;QAA0C;QAAmC;QAAgB;QAAgB;QAAuB;QAAkB;QAAkB;QAA2B;QAAY;QAAa;QAAY;QAAiB;QAAY;QAAkB;QAAwB;QAAiB;QAAwB;QAAmB;QAAyB;QAA+B;QAAyB;QAAuB;QAAmB;QAAkB;QAAkC;KAA6B;IACzrBC,oBAAoB;QAAC;QAAY;QAAqB;QAAe;QAAiB;QAAgC;QAAa;QAAsB;QAA0B;QAAyB;QAA0C;QAAiC;QAAW;QAAY;QAAY;QAAW;QAA2B;QAAc;QAA0B;QAA4B;QAAwB;QAAgC;QAAiC;QAAuB;QAAuC;QAAS;KAAW;IAC/kBC,KAAK;QAAC;QAAmB;QAA8B;QAAyD;QAAuB;QAAqB;QAAoB;QAAkB;QAAY;QAAa;QAAsB;QAAyC;QAAoD;QAA0C;QAAc;QAAoB;QAAmB;QAA6B;QAAmB;QAAkB;QAAgD;QAAoB;QAAmC;QAAiB;QAAiC;QAAoB;QAAgB;QAAgB;QAAgB;QAAuB;QAAmB;QAAmB;QAAgB;QAAiB;QAAqB;QAAc;QAA0B;QAAY;QAAmB;QAAgB;QAA0B;QAAmB;QAA0B;KAAW;IACx+BC,aAAa;QAAC;QAAgB;QAAe;QAAmB;QAAc;QAAuB;QAA0B;QAAsB;QAAgB;QAAqB;QAAW;QAAqB;KAAW;AACvO,EAA8E"}
1
+ {"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/utils/docs-help.generated.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// GENERATED FILE — do not edit. Regenerate with:\n// node tools/scripts/generate-docs-help.mjs\n// Source of truth: apps/docs/docs frontmatter + headings (AGL-602).\n\n// The besigner designer lib can't import the console constants, so it carries\n// its own generated subset of the docs help registry.\n\nexport const BESIGNER_DOCS = {\n besigner: '/building-sites/besigner/overview',\n bindings: '/building-sites/bindings/overview',\n dragDropHierarchy: '/building-sites/besigner/drag-drop-hierarchy',\n elementCatalog: '/building-sites/besigner/element-catalog',\n interactions: '/building-sites/besigner/interactions-and-custom-html',\n layouts: '/building-sites/screens-and-layouts/layouts',\n repeat: '/building-sites/besigner/repeat',\n responsiveStyling: '/building-sites/besigner/responsive-styling',\n reusableComponents: '/building-sites/besigner/reusable-components',\n seo: '/building-sites/seo/overview',\n textEditing: '/building-sites/besigner/text-editing',\n} as const satisfies Record<string, string>\n\nexport type BesignerDocsKey = keyof typeof BESIGNER_DOCS\n\nexport const BESIGNER_DOCS_ANCHORS = {\n besigner: ['#preview-vs-canvas', '#publish-from-a-preview', '#what-you-can-do', '#the-canvas', '#hierarchy-panel', '#the-inspector', '#inline-and-rich-text', '#reusable-components', '#editing-together', '#ai-in-the-canvas', '#related'],\n bindings: ['#binding-tokens', '#rename-safe-id-tokens', '#insert-a-variable', '#token-pills', '#in-the-canvas-text-editor', '#site-details', '#typed-variables', '#no-code-functions', '#functions-card', '#parameters-a-visitor-can-answer', '#a-calculator-you-lay-out', '#where-used--safety', '#workflows', '#related'],\n dragDropHierarchy: ['#where-you-can-drag', '#what-a-drag-does', '#drop-zones-edges-vs-center', '#containers-vs-leaf-elements', '#containers-accept-children', '#leaf-elements-dont--dropping-on-one-makes-a-sibling', '#adding-a-new-element', '#when-a-drop-is-rejected', '#moving-an-element-without-dragging', '#multi-drag', '#tips', '#related'],\n elementCatalog: ['#finding-an-element', '#element-search', '#element-detail', '#layout', '#the-pages-main-landmark', '#every-container-can-be-a-semantic-element', '#light-or-dark-whatever-the-visitor-picked', '#which-link-groups-want-to-be-a-nav', '#header-and-footer-for-your-site-chrome', '#grid', '#surface', '#accordion', '#navigation', '#where-a-link-opens', '#linking-to-a-collection-listing', '#link-container', '#tabs', '#tabs-that-go-to-another-screen', '#pagination', '#text', '#data-display', '#media', '#image', '#image-list', '#forms', '#commerce', '#members', '#input', '#related'],\n interactions: ['#fluent-interactions', '#interactions-belong-to-the-page-they-are-on', '#plan-availability', '#pick-the-target-by-clicking', '#interaction-cookbook', '#scroll-to-element-step', '#play-video-step', '#open-a-lightbox', '#analytics-event-step', '#analytics-event-name', '#analytics-event-parameters', '#analytics-event-delivery', '#custom-html-block', '#related'],\n layouts: ['#what-a-layout-is', '#find-a-layout', '#nested-layouts', '#layout-properties', '#restyle-the-layout-on-one-page', '#duplicate', '#generate-a-layout-with-aglyn-ai', '#used-by', '#layouts-vs-reusable-components', '#related'],\n repeat: ['#turn-it-on', '#what-repeats-the-element-or-whats-inside-it', '#fill-each-copy-in', '#see-the-copies-while-you-design', '#bound-what-renders', '#the-hundred-record-ceiling', '#what-you-cant-do', '#when-a-dataset-goes-away', '#related'],\n responsiveStyling: ['#style-per-breakpoint', '#mute-a-style', '#interaction-states', '#you-can-see-the-state-while-you-style-it', '#fields-you-dont-touch-keep-inheriting', '#states-and-breakpoints-combine', '#focus-state', '#box-stylers', '#spacing-side-names', '#spacing-units', '#spacing-steps', '#spacing-custom-amounts', '#unit-px', '#unit-rem', '#unit-em', '#unit-percent', '#unit-ch', '#unit-viewport', '#unit-small-viewport', '#style-groups', '#borders-without-css', '#picking-a-font', '#gradient-backgrounds', '#visibility-per-device-band', '#scheme-scoped-colors', '#pin-a-color-scheme', '#custom-classes', '#custom-css-sx', '#semantic-sections--theme-mode', '#edit-json-for-one-element'],\n reusableComponents: ['#promote', '#insert-instances', '#properties', '#declare-them', '#make-a-property-conditional', '#use-them', '#save-then-publish', '#fill-them-in-per-page', '#restyle-one-instance', '#override-an-attribute-on-one-instance', '#retrofit-duplicated-sections', '#detach', '#nesting', '#used-by', '#manage', '#component-details-card', '#duplicate', '#reusable-email-blocks', '#make-a-header-or-footer', '#add-one-to-an-email', '#change-a-block-in-one-email', '#emails-you-have-not-designed', '#email-theme-colors', '#copy--paste-vs-reusable-components', '#tips', '#related'],\n seo: ['#per-screen-seo', '#how-a-page-title-is-built', '#variables-so-a-title-is-not-a-copy-of-your-site-name', '#site-wide-defaults', '#site-description', '#title-separator', '#title-pattern', '#favicon', '#app-icon', '#site-social-image', '#every-icon-size-is-generated-for-you', '#your-sites-install-details-the-web-app-manifest', '#what-language-your-site-says-it-is-in', '#seo-check', '#target-keywords', '#check-one-page', '#search-engine-visibility', '#the-whole-site', '#a-single-page', '#verify-your-site-with-google-search-console', '#sitemap--robots', '#one-index-one-file-per-section', '#social-cards', '#what-each-kind-of-page-emits', '#structured-data', '#entity-card', '#entity-type', '#entity-name', '#entity-description', '#entity-website', '#entity-contact', '#entity-logo', '#address-card', '#local-businesses', '#ai-agents', '#markdown-for-any-page', '#llmstxt', '#ai-agents-card', '#openapijson', '#well-knownapi-catalog', '#crawler-access', '#analytics-integration', '#related'],\n textEditing: ['#edit-inline', '#committing', '#inline-toolbar', '#rich-text', '#the-text-attribute', '#text-field-formatting', '#remove-formatting', '#line-breaks', '#bindings-in-text', '#limits', '#wrapped-outlines', '#related'],\n} as const satisfies Partial<Record<BesignerDocsKey, readonly `#${string}`[]>>\n\ntype BesignerAnchorMap = typeof BESIGNER_DOCS_ANCHORS\n\n/** Valid heading anchors for a besigner docs page (`never` when none). */\nexport type BesignerDocsAnchor<K extends BesignerDocsKey> =\n K extends keyof BesignerAnchorMap ? BesignerAnchorMap[K][number] : never\n"],"names":["BESIGNER_DOCS","besigner","bindings","dragDropHierarchy","elementCatalog","interactions","layouts","repeat","responsiveStyling","reusableComponents","seo","textEditing","BESIGNER_DOCS_ANCHORS"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD,iDAAiD;AACjD,8CAA8C;AAC9C,oEAAoE;AAEpE,8EAA8E;AAC9E,sDAAsD;AAEtD,OAAO,MAAMA,gBAAgB;IAC3BC,UAAU;IACVC,UAAU;IACVC,mBAAmB;IACnBC,gBAAgB;IAChBC,cAAc;IACdC,SAAS;IACTC,QAAQ;IACRC,mBAAmB;IACnBC,oBAAoB;IACpBC,KAAK;IACLC,aAAa;AACf,EAA2C;AAI3C,OAAO,MAAMC,wBAAwB;IACnCX,UAAU;QAAC;QAAsB;QAA2B;QAAoB;QAAe;QAAoB;QAAkB;QAAyB;QAAwB;QAAqB;QAAqB;KAAW;IAC3OC,UAAU;QAAC;QAAmB;QAA0B;QAAsB;QAAgB;QAA8B;QAAiB;QAAoB;QAAsB;QAAmB;QAAoC;QAA6B;QAAuB;QAAc;KAAW;IAC3TC,mBAAmB;QAAC;QAAuB;QAAqB;QAA+B;QAAgC;QAA+B;QAAwD;QAAyB;QAA4B;QAAuC;QAAe;QAAS;KAAW;IACrVC,gBAAgB;QAAC;QAAuB;QAAmB;QAAmB;QAAW;QAA4B;QAA8C;QAA8C;QAAuC;QAA2C;QAAS;QAAY;QAAc;QAAe;QAAuB;QAAoC;QAAmB;QAAS;QAAmC;QAAe;QAAS;QAAiB;QAAU;QAAU;QAAe;QAAU;QAAa;QAAY;QAAU;KAAW;IACnlBC,cAAc;QAAC;QAAwB;QAAgD;QAAsB;QAAgC;QAAyB;QAA2B;QAAoB;QAAoB;QAAyB;QAAyB;QAA+B;QAA6B;QAAsB;KAAW;IACxXC,SAAS;QAAC;QAAqB;QAAkB;QAAmB;QAAsB;QAAmC;QAAc;QAAoC;QAAY;QAAmC;KAAW;IACzOC,QAAQ;QAAC;QAAe;QAAgD;QAAsB;QAAoC;QAAuB;QAA+B;QAAqB;QAA6B;KAAW;IACrPC,mBAAmB;QAAC;QAAyB;QAAiB;QAAuB;QAA6C;QAA0C;QAAmC;QAAgB;QAAgB;QAAuB;QAAkB;QAAkB;QAA2B;QAAY;QAAa;QAAY;QAAiB;QAAY;QAAkB;QAAwB;QAAiB;QAAwB;QAAmB;QAAyB;QAA+B;QAAyB;QAAuB;QAAmB;QAAkB;QAAkC;KAA6B;IACzrBC,oBAAoB;QAAC;QAAY;QAAqB;QAAe;QAAiB;QAAgC;QAAa;QAAsB;QAA0B;QAAyB;QAA0C;QAAiC;QAAW;QAAY;QAAY;QAAW;QAA2B;QAAc;QAA0B;QAA4B;QAAwB;QAAgC;QAAiC;QAAuB;QAAuC;QAAS;KAAW;IAC/kBC,KAAK;QAAC;QAAmB;QAA8B;QAAyD;QAAuB;QAAqB;QAAoB;QAAkB;QAAY;QAAa;QAAsB;QAAyC;QAAoD;QAA0C;QAAc;QAAoB;QAAmB;QAA6B;QAAmB;QAAkB;QAAgD;QAAoB;QAAmC;QAAiB;QAAiC;QAAoB;QAAgB;QAAgB;QAAgB;QAAuB;QAAmB;QAAmB;QAAgB;QAAiB;QAAqB;QAAc;QAA0B;QAAY;QAAmB;QAAgB;QAA0B;QAAmB;QAA0B;KAAW;IACx+BC,aAAa;QAAC;QAAgB;QAAe;QAAmB;QAAc;QAAuB;QAA0B;QAAsB;QAAgB;QAAqB;QAAW;QAAqB;KAAW;AACvO,EAA8E"}
@@ -23,9 +23,16 @@ export declare const REPEAT_COPY_ATTR = "data-aglyn-repeat-copy";
23
23
  * that is not a copy comes back as it is.
24
24
  */
25
25
  export declare function repeatTemplateIdOf(id: string): string;
26
+ /** A repeat copy the pointer is on, and the real element it is a picture of. */
27
+ export interface RepeatCopyHit {
28
+ /** The element the copy draws: the one an edit changes. */
29
+ original: Aglyn.NodeSchema<any>;
30
+ /** The copy's own id, `rep__…`, as its rendered stamp carries it. */
31
+ copyId: string;
32
+ }
26
33
  /**
27
- * The real element a repeat copy under the pointer is a picture of, or null
28
- * when the pointer is not on a copy.
34
+ * The repeat copy under the pointer and the real element it is a picture of,
35
+ * or null when the pointer is not on a copy.
29
36
  *
30
37
  * The copies (Sam, Jordan beside the real Avery) are inert drawings: nothing
31
38
  * in them is a document, so none of them can be selected. A click on one
@@ -33,13 +40,42 @@ export declare function repeatTemplateIdOf(id: string): string;
33
40
  * change every copy at once — and the repeating element's own handlers,
34
41
  * which the copies are drawn inside, send it there.
35
42
  */
36
- export declare function repeatOriginalAt(target: EventTarget | null): Aglyn.NodeSchema<any> | null;
43
+ export declare function repeatCopyAt(target: EventTarget | null): RepeatCopyHit | null;
44
+ /** A copy the canvas outlines in place of the element it draws. */
45
+ export interface RepeatCopyStandIn {
46
+ /** The element hovered or selected. */
47
+ nodeId: string;
48
+ /** The copy of it the pointer is on, or was on when it was clicked. */
49
+ copyId: string;
50
+ }
37
51
  /**
38
- * Every drawn copy of the node `id` in the canvas `element` lives in: the
39
- * copies a repeat draws of it, at any depth — a Typography inside a repeated
40
- * card has a copy inside each copy of the card.
52
+ * Which copy the canvas outlines for the hovered and the selected element
53
+ * (AGL-3111).
41
54
  *
42
- * Read off the rendered stamps (`leaf:rep__…__<id>`), because the copies are
43
- * pictures, not canvas nodes: the refs registry has no entry for them.
55
+ * Pointing at or clicking a copy hovers or selects the element it draws, so
56
+ * an edit changes the element and every copy with it — but the outline goes
57
+ * where the pointer is: round that copy, exactly, and nothing else. It used
58
+ * to go round the element, or round the element and all its copies at once,
59
+ * and either way the box was somewhere other than the thing just clicked.
60
+ *
61
+ * Kept by the copy's id rather than its element, since the copies are drawn
62
+ * again whenever what they repeat is edited; and by the element's id with it.
63
+ * A stand-in is dropped the moment the hover or the selection moves to
64
+ * another element, however it moves — the hierarchy, the breadcrumbs, a
65
+ * shortcut — so coming back to the element later outlines the element, not
66
+ * a copy clicked some time before.
44
67
  */
45
- export declare function repeatCopyElementsOf(element: Element, id: string): Element[];
68
+ declare class RepeatCopyStandIns {
69
+ hovered?: RepeatCopyStandIn;
70
+ selected?: RepeatCopyStandIn;
71
+ constructor();
72
+ private forgetUnless;
73
+ /** Records the copy a hover or a selection was made on, or clears it. */
74
+ set(variant: 'hovered' | 'selected', hit: RepeatCopyHit | null): void;
75
+ /** The copy to outline for `nodeId`, if the hover or selection was made on one. */
76
+ copyIdFor(variant: 'hovered' | 'selected', nodeId: string | undefined): string;
77
+ }
78
+ export declare const repeatCopyStandIns: RepeatCopyStandIns;
79
+ /** The drawn copy `copyId`, in the canvas `element` lives in, or null. */
80
+ export declare function repeatCopyElementIn(element: Element, copyId: string): Element | null;
81
+ export {};
@@ -15,6 +15,8 @@
15
15
  * limitations under the License.
16
16
  */ import { canvas } from "@aglyn/aglyn";
17
17
  import { REPEAT_NODE_ID_PREFIX } from "@aglyn/aglyn/app-utils/expand-repeatables";
18
+ import * as Besigner from "@aglyn/besigner";
19
+ import { makeAutoObservable, observableRef, reaction } from "mobx";
18
20
  const LEAF_STAMP = '[data-aglyn^="leaf:"]';
19
21
  /** `rep__<repeating id>__<record>__<original id>`, as the expansion names a copy. */ const REPEAT_COPY_ID = new RegExp(`^${REPEAT_NODE_ID_PREFIX}.+?__\\d+__(.+)$`);
20
22
  /** The attribute the canvas puts on each repeat copy's root, for its outline. */ export const REPEAT_COPY_ATTR = 'data-aglyn-repeat-copy';
@@ -31,38 +33,87 @@ const LEAF_STAMP = '[data-aglyn^="leaf:"]';
31
33
  return current;
32
34
  }
33
35
  /**
34
- * The real element a repeat copy under the pointer is a picture of, or null
35
- * when the pointer is not on a copy.
36
+ * The repeat copy under the pointer and the real element it is a picture of,
37
+ * or null when the pointer is not on a copy.
36
38
  *
37
39
  * The copies (Sam, Jordan beside the real Avery) are inert drawings: nothing
38
40
  * in them is a document, so none of them can be selected. A click on one
39
41
  * still means something — the element it draws, the one an author edits to
40
42
  * change every copy at once — and the repeating element's own handlers,
41
43
  * which the copies are drawn inside, send it there.
42
- */ export function repeatOriginalAt(target) {
43
- var _canvas_getNode;
44
+ */ export function repeatCopyAt(target) {
44
45
  var _leaf_getAttribute;
45
46
  const leaf = target instanceof Element ? target.closest(LEAF_STAMP) : null;
46
- const id = leaf == null ? void 0 : (_leaf_getAttribute = leaf.getAttribute('data-aglyn')) == null ? void 0 : _leaf_getAttribute.slice('leaf:'.length);
47
- if (!(id == null ? void 0 : id.startsWith(REPEAT_NODE_ID_PREFIX))) return null;
48
- return (_canvas_getNode = canvas.getNode(repeatTemplateIdOf(id))) != null ? _canvas_getNode : null;
47
+ const copyId = leaf == null ? void 0 : (_leaf_getAttribute = leaf.getAttribute('data-aglyn')) == null ? void 0 : _leaf_getAttribute.slice('leaf:'.length);
48
+ if (!(copyId == null ? void 0 : copyId.startsWith(REPEAT_NODE_ID_PREFIX))) return null;
49
+ const original = canvas.getNode(repeatTemplateIdOf(copyId));
50
+ return original ? {
51
+ original,
52
+ copyId
53
+ } : null;
49
54
  }
50
55
  /**
51
- * Every drawn copy of the node `id` in the canvas `element` lives in: the
52
- * copies a repeat draws of it, at any depth — a Typography inside a repeated
53
- * card has a copy inside each copy of the card.
56
+ * Which copy the canvas outlines for the hovered and the selected element
57
+ * (AGL-3111).
54
58
  *
55
- * Read off the rendered stamps (`leaf:rep__…__<id>`), because the copies are
56
- * pictures, not canvas nodes: the refs registry has no entry for them.
57
- */ export function repeatCopyElementsOf(element, id) {
59
+ * Pointing at or clicking a copy hovers or selects the element it draws, so
60
+ * an edit changes the element and every copy with it — but the outline goes
61
+ * where the pointer is: round that copy, exactly, and nothing else. It used
62
+ * to go round the element, or round the element and all its copies at once,
63
+ * and either way the box was somewhere other than the thing just clicked.
64
+ *
65
+ * Kept by the copy's id rather than its element, since the copies are drawn
66
+ * again whenever what they repeat is edited; and by the element's id with it.
67
+ * A stand-in is dropped the moment the hover or the selection moves to
68
+ * another element, however it moves — the hierarchy, the breadcrumbs, a
69
+ * shortcut — so coming back to the element later outlines the element, not
70
+ * a copy clicked some time before.
71
+ */ let RepeatCopyStandIns = class RepeatCopyStandIns {
72
+ forgetUnless(variant, nodeId) {
73
+ var _this_variant;
74
+ if (this[variant] && ((_this_variant = this[variant]) == null ? void 0 : _this_variant.nodeId) !== nodeId) {
75
+ this[variant] = undefined;
76
+ }
77
+ }
78
+ /** Records the copy a hover or a selection was made on, or clears it. */ set(variant, hit) {
79
+ const current = this[variant];
80
+ // Every mouseover lands here; one that changes nothing must not
81
+ // re-render the overlay reading it.
82
+ if ((current == null ? void 0 : current.nodeId) === (hit == null ? void 0 : hit.original.$id) && (current == null ? void 0 : current.copyId) === (hit == null ? void 0 : hit.copyId)) {
83
+ return;
84
+ }
85
+ this[variant] = hit ? {
86
+ nodeId: hit.original.$id,
87
+ copyId: hit.copyId
88
+ } : undefined;
89
+ }
90
+ /** The copy to outline for `nodeId`, if the hover or selection was made on one. */ copyIdFor(variant, nodeId) {
91
+ const standIn = this[variant];
92
+ return nodeId && (standIn == null ? void 0 : standIn.nodeId) === nodeId ? standIn.copyId : undefined;
93
+ }
94
+ constructor(){
95
+ this.hovered = undefined;
96
+ this.selected = undefined;
97
+ makeAutoObservable(this, {
98
+ hovered: observableRef,
99
+ selected: observableRef
100
+ });
101
+ reaction(()=>{
102
+ var _Besigner_focus_getHovered;
103
+ return (_Besigner_focus_getHovered = Besigner.focus.getHovered()) == null ? void 0 : _Besigner_focus_getHovered.$id;
104
+ }, (id)=>this.forgetUnless('hovered', id));
105
+ reaction(()=>{
106
+ var _Besigner_focus_getLastSelected;
107
+ return (_Besigner_focus_getLastSelected = Besigner.focus.getLastSelected()) == null ? void 0 : _Besigner_focus_getLastSelected.$id;
108
+ }, (id)=>this.forgetUnless('selected', id));
109
+ }
110
+ };
111
+ export const repeatCopyStandIns = new RepeatCopyStandIns();
112
+ /** The drawn copy `copyId`, in the canvas `element` lives in, or null. */ export function repeatCopyElementIn(element, copyId) {
58
113
  const root = element.getRootNode();
59
- if (!(root == null ? void 0 : root.querySelectorAll) || !id) return [];
60
- const escaped = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(id) : id;
61
- return Array.from(root.querySelectorAll(`[data-aglyn^="leaf:${REPEAT_NODE_ID_PREFIX}"][data-aglyn$="__${escaped}"]`)).filter((copy)=>{
62
- var _ref;
63
- var _copy_getAttribute;
64
- return repeatTemplateIdOf((_ref = (_copy_getAttribute = copy.getAttribute('data-aglyn')) == null ? void 0 : _copy_getAttribute.slice('leaf:'.length)) != null ? _ref : '') === id;
65
- });
114
+ if (!(root == null ? void 0 : root.querySelector)) return null;
115
+ const escaped = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(copyId) : copyId;
116
+ return root.querySelector(`[data-aglyn="leaf:${escaped}"]`);
66
117
  }
67
118
 
68
119
  //# sourceMappingURL=repeat-copy.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/utils/repeat-copy.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type * as Aglyn from '@aglyn/aglyn'\nimport { canvas } from '@aglyn/aglyn'\nimport { REPEAT_NODE_ID_PREFIX } from '@aglyn/aglyn/app-utils/expand-repeatables'\n\nconst LEAF_STAMP = '[data-aglyn^=\"leaf:\"]'\n\n/** `rep__<repeating id>__<record>__<original id>`, as the expansion names a copy. */\nconst REPEAT_COPY_ID = new RegExp(`^${REPEAT_NODE_ID_PREFIX}.+?__\\\\d+__(.+)$`)\n\n/** The attribute the canvas puts on each repeat copy's root, for its outline. */\nexport const REPEAT_COPY_ATTR = 'data-aglyn-repeat-copy'\n\n/**\n * The id of the node a repeat copy draws: the copy's id with every repeat\n * prefix taken off, so a copy inside a copy names the original too. An id\n * that is not a copy comes back as it is.\n */\nexport function repeatTemplateIdOf(id: string): string {\n let current = id\n for (let match = REPEAT_COPY_ID.exec(current); match; ) {\n current = match[1]\n match = REPEAT_COPY_ID.exec(current)\n }\n return current\n}\n\n/**\n * The real element a repeat copy under the pointer is a picture of, or null\n * when the pointer is not on a copy.\n *\n * The copies (Sam, Jordan beside the real Avery) are inert drawings: nothing\n * in them is a document, so none of them can be selected. A click on one\n * still means something — the element it draws, the one an author edits to\n * change every copy at once — and the repeating element's own handlers,\n * which the copies are drawn inside, send it there.\n */\nexport function repeatOriginalAt(\n target: EventTarget | null,\n): Aglyn.NodeSchema<any> | null {\n const leaf = target instanceof Element ? target.closest(LEAF_STAMP) : null\n const id = leaf?.getAttribute('data-aglyn')?.slice('leaf:'.length)\n if (!id?.startsWith(REPEAT_NODE_ID_PREFIX)) return null\n return canvas.getNode(repeatTemplateIdOf(id)) ?? null\n}\n\n/**\n * Every drawn copy of the node `id` in the canvas `element` lives in: the\n * copies a repeat draws of it, at any depth — a Typography inside a repeated\n * card has a copy inside each copy of the card.\n *\n * Read off the rendered stamps (`leaf:rep__…__<id>`), because the copies are\n * pictures, not canvas nodes: the refs registry has no entry for them.\n */\nexport function repeatCopyElementsOf(element: Element, id: string): Element[] {\n const root = element.getRootNode() as ParentNode | null\n if (!root?.querySelectorAll || !id) return []\n const escaped = typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(id) : id\n return Array.from(\n root.querySelectorAll(\n `[data-aglyn^=\"leaf:${REPEAT_NODE_ID_PREFIX}\"][data-aglyn$=\"__${escaped}\"]`,\n ),\n ).filter(\n (copy) =>\n repeatTemplateIdOf(\n copy.getAttribute('data-aglyn')?.slice('leaf:'.length) ?? '',\n ) === id,\n )\n}\n"],"names":["canvas","REPEAT_NODE_ID_PREFIX","LEAF_STAMP","REPEAT_COPY_ID","RegExp","REPEAT_COPY_ATTR","repeatTemplateIdOf","id","current","match","exec","repeatOriginalAt","target","leaf","Element","closest","getAttribute","slice","length","startsWith","getNode","repeatCopyElementsOf","element","root","getRootNode","querySelectorAll","escaped","CSS","escape","Array","from","filter","copy"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,MAAM,QAAQ,eAAc;AACrC,SAASC,qBAAqB,QAAQ,4CAA2C;AAEjF,MAAMC,aAAa;AAEnB,mFAAmF,GACnF,MAAMC,iBAAiB,IAAIC,OAAO,CAAC,CAAC,EAAEH,sBAAsB,gBAAgB,CAAC;AAE7E,+EAA+E,GAC/E,OAAO,MAAMI,mBAAmB,yBAAwB;AAExD;;;;CAIC,GACD,OAAO,SAASC,mBAAmBC,EAAU;IAC3C,IAAIC,UAAUD;IACd,IAAK,IAAIE,QAAQN,eAAeO,IAAI,CAACF,UAAUC,OAAS;QACtDD,UAAUC,KAAK,CAAC,EAAE;QAClBA,QAAQN,eAAeO,IAAI,CAACF;IAC9B;IACA,OAAOA;AACT;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASG,iBACdC,MAA0B;QAKnBZ;QAFIa;IADX,MAAMA,OAAOD,kBAAkBE,UAAUF,OAAOG,OAAO,CAACb,cAAc;IACtE,MAAMK,KAAKM,yBAAAA,qBAAAA,KAAMG,YAAY,CAAC,kCAAnBH,mBAAkCI,KAAK,CAAC,QAAQC,MAAM;IACjE,IAAI,EAACX,sBAAAA,GAAIY,UAAU,CAAClB,yBAAwB,OAAO;IACnD,QAAOD,kBAAAA,OAAOoB,OAAO,CAACd,mBAAmBC,gBAAlCP,kBAA0C;AACnD;AAEA;;;;;;;CAOC,GACD,OAAO,SAASqB,qBAAqBC,OAAgB,EAAEf,EAAU;IAC/D,MAAMgB,OAAOD,QAAQE,WAAW;IAChC,IAAI,EAACD,wBAAAA,KAAME,gBAAgB,KAAI,CAAClB,IAAI,OAAO,EAAE;IAC7C,MAAMmB,UAAU,OAAOC,QAAQ,eAAeA,IAAIC,MAAM,GAAGD,IAAIC,MAAM,CAACrB,MAAMA;IAC5E,OAAOsB,MAAMC,IAAI,CACfP,KAAKE,gBAAgB,CACnB,CAAC,mBAAmB,EAAExB,sBAAsB,kBAAkB,EAAEyB,QAAQ,EAAE,CAAC,GAE7EK,MAAM,CACN,CAACC;;YAEGA;eADF1B,4BACE0B,qBAAAA,KAAKhB,YAAY,CAAC,kCAAlBgB,mBAAiCf,KAAK,CAAC,QAAQC,MAAM,oBAAK,QACtDX;;AAEZ"}
1
+ {"version":3,"sources":["../../../../../../../../libs/besigner/feature/designer/src/lib/utils/repeat-copy.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type * as Aglyn from '@aglyn/aglyn'\nimport { canvas } from '@aglyn/aglyn'\nimport { REPEAT_NODE_ID_PREFIX } from '@aglyn/aglyn/app-utils/expand-repeatables'\nimport * as Besigner from '@aglyn/besigner'\nimport { makeAutoObservable, observableRef, reaction } from 'mobx'\n\nconst LEAF_STAMP = '[data-aglyn^=\"leaf:\"]'\n\n/** `rep__<repeating id>__<record>__<original id>`, as the expansion names a copy. */\nconst REPEAT_COPY_ID = new RegExp(`^${REPEAT_NODE_ID_PREFIX}.+?__\\\\d+__(.+)$`)\n\n/** The attribute the canvas puts on each repeat copy's root, for its outline. */\nexport const REPEAT_COPY_ATTR = 'data-aglyn-repeat-copy'\n\n/**\n * The id of the node a repeat copy draws: the copy's id with every repeat\n * prefix taken off, so a copy inside a copy names the original too. An id\n * that is not a copy comes back as it is.\n */\nexport function repeatTemplateIdOf(id: string): string {\n let current = id\n for (let match = REPEAT_COPY_ID.exec(current); match; ) {\n current = match[1]\n match = REPEAT_COPY_ID.exec(current)\n }\n return current\n}\n\n/** A repeat copy the pointer is on, and the real element it is a picture of. */\nexport interface RepeatCopyHit {\n /** The element the copy draws: the one an edit changes. */\n original: Aglyn.NodeSchema<any>\n /** The copy's own id, `rep__…`, as its rendered stamp carries it. */\n copyId: string\n}\n\n/**\n * The repeat copy under the pointer and the real element it is a picture of,\n * or null when the pointer is not on a copy.\n *\n * The copies (Sam, Jordan beside the real Avery) are inert drawings: nothing\n * in them is a document, so none of them can be selected. A click on one\n * still means something — the element it draws, the one an author edits to\n * change every copy at once — and the repeating element's own handlers,\n * which the copies are drawn inside, send it there.\n */\nexport function repeatCopyAt(target: EventTarget | null): RepeatCopyHit | null {\n const leaf = target instanceof Element ? target.closest(LEAF_STAMP) : null\n const copyId = leaf?.getAttribute('data-aglyn')?.slice('leaf:'.length)\n if (!copyId?.startsWith(REPEAT_NODE_ID_PREFIX)) return null\n const original = canvas.getNode(repeatTemplateIdOf(copyId))\n return original ? { original, copyId } : null\n}\n\n/** A copy the canvas outlines in place of the element it draws. */\nexport interface RepeatCopyStandIn {\n /** The element hovered or selected. */\n nodeId: string\n /** The copy of it the pointer is on, or was on when it was clicked. */\n copyId: string\n}\n\n/**\n * Which copy the canvas outlines for the hovered and the selected element\n * (AGL-3111).\n *\n * Pointing at or clicking a copy hovers or selects the element it draws, so\n * an edit changes the element and every copy with it — but the outline goes\n * where the pointer is: round that copy, exactly, and nothing else. It used\n * to go round the element, or round the element and all its copies at once,\n * and either way the box was somewhere other than the thing just clicked.\n *\n * Kept by the copy's id rather than its element, since the copies are drawn\n * again whenever what they repeat is edited; and by the element's id with it.\n * A stand-in is dropped the moment the hover or the selection moves to\n * another element, however it moves — the hierarchy, the breadcrumbs, a\n * shortcut — so coming back to the element later outlines the element, not\n * a copy clicked some time before.\n */\nclass RepeatCopyStandIns {\n hovered?: RepeatCopyStandIn = undefined\n selected?: RepeatCopyStandIn = undefined\n\n constructor() {\n makeAutoObservable(this, {\n hovered: observableRef,\n selected: observableRef,\n })\n reaction(\n () => Besigner.focus.getHovered()?.$id,\n (id) => this.forgetUnless('hovered', id),\n )\n reaction(\n () => Besigner.focus.getLastSelected()?.$id,\n (id) => this.forgetUnless('selected', id),\n )\n }\n\n private forgetUnless(variant: 'hovered' | 'selected', nodeId?: string) {\n if (this[variant] && this[variant]?.nodeId !== nodeId) {\n this[variant] = undefined\n }\n }\n\n /** Records the copy a hover or a selection was made on, or clears it. */\n set(variant: 'hovered' | 'selected', hit: RepeatCopyHit | null) {\n const current = this[variant]\n // Every mouseover lands here; one that changes nothing must not\n // re-render the overlay reading it.\n if (\n current?.nodeId === hit?.original.$id &&\n current?.copyId === hit?.copyId\n ) {\n return\n }\n this[variant] = hit\n ? { nodeId: hit.original.$id, copyId: hit.copyId }\n : undefined\n }\n\n /** The copy to outline for `nodeId`, if the hover or selection was made on one. */\n copyIdFor(variant: 'hovered' | 'selected', nodeId: string | undefined) {\n const standIn = this[variant]\n return nodeId && standIn?.nodeId === nodeId ? standIn.copyId : undefined\n }\n}\n\nexport const repeatCopyStandIns = new RepeatCopyStandIns()\n\n/** The drawn copy `copyId`, in the canvas `element` lives in, or null. */\nexport function repeatCopyElementIn(\n element: Element,\n copyId: string,\n): Element | null {\n const root = element.getRootNode() as ParentNode | null\n if (!root?.querySelector) return null\n const escaped =\n typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(copyId) : copyId\n return root.querySelector(`[data-aglyn=\"leaf:${escaped}\"]`)\n}\n"],"names":["canvas","REPEAT_NODE_ID_PREFIX","Besigner","makeAutoObservable","observableRef","reaction","LEAF_STAMP","REPEAT_COPY_ID","RegExp","REPEAT_COPY_ATTR","repeatTemplateIdOf","id","current","match","exec","repeatCopyAt","target","leaf","Element","closest","copyId","getAttribute","slice","length","startsWith","original","getNode","RepeatCopyStandIns","forgetUnless","variant","nodeId","undefined","set","hit","$id","copyIdFor","standIn","hovered","selected","focus","getHovered","getLastSelected","repeatCopyStandIns","repeatCopyElementIn","element","root","getRootNode","querySelector","escaped","CSS","escape"],"mappings":"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"}