@aglyn/besigner 1.21.0 → 1.22.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/besigner",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,14 +25,14 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.21.0",
29
- "@aglyn/shared-data-types": "1.21.0",
30
- "@aglyn/shared-util-logger": "1.21.0",
31
- "@aglyn/shared-util-tools": "1.21.0",
32
- "@aglyn/shared-util-vendor": "1.21.0",
33
- "@swc/helpers": "0.5.23",
28
+ "@aglyn/aglyn": "1.22.0",
29
+ "@aglyn/shared-data-types": "1.22.0",
30
+ "@aglyn/shared-util-logger": "1.22.0",
31
+ "@aglyn/shared-util-tools": "1.22.0",
32
+ "@aglyn/shared-util-vendor": "1.22.0",
33
+ "@swc/helpers": "0.5.24",
34
34
  "lodash-es": "^4.18.1",
35
- "mobx": "^7.0.5",
35
+ "mobx": "^7.1.6",
36
36
  "rxjs": "^7.8.2"
37
37
  },
38
38
  "peerDependencies": {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/besigner/core/src/lib/constants/besigner.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 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\nexport enum InteractionModeFlag {\n SELECT = 0x1,\n REARRANGE = 0x2,\n PREVIEW = 0x3,\n}\n\nexport enum BesignerPanelViewFlag {\n PANEL_LEFT = 0x1,\n PANEL_RIGHT = 0x2,\n PANEL_BOTTOM = 0x3,\n}\n\nexport enum BesignerPanelTabFlag {\n ELEMENTS_TREE = 0x1,\n ELEMENT_BROWSE = 0x2,\n /**\n * Retired. The Info panel's two accordions — the component's own\n * description, and the element/parent/component/plugin ids — moved to the\n * bottom of Attributes, where they are reference detail beside the fields\n * they describe rather than a tab of their own.\n *\n * The VALUE stays reserved. Panel state is persisted, so a reader whose\n * last session ended on Info would otherwise come back to a tab id that now\n * means something else.\n */\n ELEMENT_INFO = 0x3,\n ELEMENT_PROPS_FORM = 0x4,\n ELEMENT_STYLES = 0x5,\n ELEMENT_INTERACTIONS = 0x6,\n}\n\nexport enum DndDragType {\n CANVAS = 'canvas',\n TEMPLATE = 'template',\n TREE = 'tree',\n}\n\nexport enum DndDropType {\n BEFORE = 0x1,\n INSIDE = 0x2,\n AFTER = 0x3,\n}\n\n/**\n * The interaction state the canvas is HOLDING ON for the element being\n * styled (AGL-2486 item 39).\n *\n * You cannot hover an element while working in a side panel, so a state\n * whose styles you cannot see is a state you cannot design. Selecting a\n * state in the Styles panel's chip row holds it on the canvas for that one\n * element; `undefined` is the resting state.\n *\n * Canvas UI context only — it is a flag, never a document field, so it\n * cannot be saved, cannot reach Preview and cannot reach a published page.\n * The union is declared HERE rather than in the designer so the flag store\n * and the panel share one source of truth.\n */\nexport type BesignerStateFlag =\n | 'hover'\n | 'active'\n | 'focusVisible'\n | 'disabled'\n\nexport enum BesignerDeviceFlag {\n SCALE = 0x1,\n RESPONSIVE = 0x2,\n XS = 0x3,\n SM = 0x4,\n MD = 0x5,\n LG = 0x6,\n XL = 0x7,\n}\n"],"names":["InteractionModeFlag","BesignerPanelViewFlag","BesignerPanelTabFlag","DndDragType","DndDropType","BesignerDeviceFlag"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAO,IAAA,AAAKA,6CAAAA;wDACD;2DACG;yDACF;WAHAA;MAIX;AAED,OAAO,IAAA,AAAKC,+CAAAA;gEACG;iEACC;kEACC;WAHLA;MAIX;AAED,OAAO,IAAA,AAAKC,8CAAAA;iEACM;kEACC;IACjB;;;;;;;;;GASC,+DACc;sEACM;kEACJ;wEACM;WAhBbA;MAiBX;AAED,OAAO,IAAA,AAAKC,qCAAAA;;;;WAAAA;MAIX;AAED,OAAO,IAAA,AAAKC,qCAAAA;wCACD;wCACA;uCACD;WAHEA;MAIX;AAsBD,OAAO,IAAA,AAAKC,4CAAAA;qDACF;0DACK;kDACR;kDACA;kDACA;kDACA;kDACA;WAPKA;MAQX"}
1
+ {"version":3,"sources":["../../../../../../../libs/besigner/core/src/lib/constants/besigner.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 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\nexport enum InteractionModeFlag {\n SELECT = 0x1,\n REARRANGE = 0x2,\n PREVIEW = 0x3,\n}\n\nexport enum BesignerPanelViewFlag {\n PANEL_LEFT = 0x1,\n PANEL_RIGHT = 0x2,\n PANEL_BOTTOM = 0x3,\n}\n\nexport enum BesignerPanelTabFlag {\n ELEMENTS_TREE = 0x1,\n ELEMENT_BROWSE = 0x2,\n /**\n * Retired. The Info panel's two accordions — the component's own\n * description, and the element/parent/component/plugin ids — moved to the\n * bottom of Attributes, where they are reference detail beside the fields\n * they describe rather than a tab of their own.\n *\n * The VALUE stays reserved. Panel state is persisted, so a reader whose\n * last session ended on Info would otherwise come back to a tab id that now\n * means something else.\n */\n ELEMENT_INFO = 0x3,\n ELEMENT_PROPS_FORM = 0x4,\n ELEMENT_STYLES = 0x5,\n ELEMENT_INTERACTIONS = 0x6,\n}\n\nexport enum DndDragType {\n CANVAS = 'canvas',\n TEMPLATE = 'template',\n TREE = 'tree',\n}\n\nexport enum DndDropType {\n BEFORE = 0x1,\n INSIDE = 0x2,\n AFTER = 0x3,\n}\n\n/**\n * The interaction state the canvas is HOLDING ON for the element being\n * styled (AGL-2486 item 39).\n *\n * You cannot hover an element while working in a side panel, so a state\n * whose styles you cannot see is a state you cannot design. Selecting a\n * state in the Styles panel's chip row holds it on the canvas for that one\n * element; `undefined` is the resting state.\n *\n * Canvas UI context only — it is a flag, never a document field, so it\n * cannot be saved, cannot reach Preview and cannot reach a published page.\n * The union is declared HERE rather than in the designer so the flag store\n * and the panel share one source of truth.\n */\nexport type BesignerStateFlag =\n | 'hover'\n | 'active'\n | 'focusVisible'\n | 'disabled'\n\nexport enum BesignerDeviceFlag {\n SCALE = 0x1,\n RESPONSIVE = 0x2,\n XS = 0x3,\n SM = 0x4,\n MD = 0x5,\n LG = 0x6,\n XL = 0x7,\n}\n"],"names":["InteractionModeFlag","BesignerPanelViewFlag","BesignerPanelTabFlag","DndDragType","DndDropType","BesignerDeviceFlag"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAO,IAAA,AAAKA;wDACD;2DACG;yDACF;;MACX;AAED,OAAO,IAAA,AAAKC;gEACG;iEACC;kEACC;;MAChB;AAED,OAAO,IAAA,AAAKC;iEACM;kEACC;IACjB;;;;;;;;;GASC,+DACc;sEACM;kEACJ;wEACM;;MACxB;AAED,OAAO,IAAA,AAAKC;;;;;MAIX;AAED,OAAO,IAAA,AAAKC;wCACD;wCACA;uCACD;;MACT;AAsBD,OAAO,IAAA,AAAKC;qDACF;0DACK;kDACR;kDACA;kDACA;kDACA;kDACA;;MACN"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/besigner/core/src/lib/dnd-manager/confirm-valid-lineal-relationship.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 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 { checkLinealOrder, components, LinealDirectiveFlag } from '@aglyn/aglyn'\nimport { _isArr } from '@aglyn/shared-util-tools'\n\nexport enum InvalidLinealRelationFlag {\n DISALLOW = 0x01,\n LIMIT_TO = 0x02,\n\n ITEM = 0x04,\n PARENT = 0x08,\n\n COMPONENT = 0x10,\n BUNDLE = 0x20,\n\n DISALLOW_COMPONENT = DISALLOW | COMPONENT,\n DISALLOW_BUNDLE = DISALLOW | BUNDLE,\n LIMIT_TO_COMPONENT = LIMIT_TO | COMPONENT,\n LIMIT_TO_BUNDLE = LIMIT_TO | BUNDLE,\n\n DISALLOW_COMPONENT_ITEM = DISALLOW_COMPONENT | ITEM,\n DISALLOW_BUNDLE_ITEM = DISALLOW_BUNDLE | ITEM,\n LIMIT_TO_COMPONENT_ITEM = LIMIT_TO_COMPONENT | ITEM,\n LIMIT_TO_BUNDLE_ITEM = LIMIT_TO_BUNDLE | ITEM,\n\n DISALLOW_COMPONENT_PARENT = DISALLOW_COMPONENT | PARENT,\n DISALLOW_BUNDLE_PARENT = DISALLOW_BUNDLE | PARENT,\n LIMIT_TO_COMPONENT_PARENT = LIMIT_TO_COMPONENT | PARENT,\n LIMIT_TO_BUNDLE_PARENT = LIMIT_TO_BUNDLE | PARENT,\n}\n\nexport type ConfirmValidLinealRelationshipResponse =\n [isValid: true] | [isValid: false, reason: InvalidLinealRelationFlag]\n\nfunction validateLinealOrder(\n componentId: Aglyn.ComponentId,\n pluginId: Aglyn.PluginId,\n linealOrder: Aglyn.ComponentsLinealOrder,\n governor:\n | typeof InvalidLinealRelationFlag.ITEM\n | typeof InvalidLinealRelationFlag.PARENT,\n) {\n // The rule itself is shared with the AI node-tree validator (AGL-2905);\n // what stays here is the bitflag vocabulary the drop indicator reads.\n const failed = checkLinealOrder(componentId, pluginId, linealOrder)\n if (failed === 'component') {\n throw InvalidLinealRelationFlag.DISALLOW_COMPONENT | governor\n }\n if (failed === 'plugin') {\n throw InvalidLinealRelationFlag.DISALLOW_BUNDLE | governor\n }\n}\n\nexport type LinealItem = {\n componentId?: Aglyn.ComponentId\n pluginId?: Aglyn.PluginId\n restrictParent?: Aglyn.ComponentsLinealOrder\n restrictChildren?: Aglyn.ComponentsLinealOrder\n}\n\nfunction componentLabel(componentId?: Aglyn.ComponentId): string | undefined {\n if (!componentId) return undefined\n return components.getLabel(componentId) ?? componentId\n}\n\nfunction allowedComponentLabels(\n linealOrder?: Aglyn.ComponentsLinealOrder,\n): string[] {\n if (!linealOrder) return []\n const [directiveType, directiveDefinition] = linealOrder\n if (directiveType !== LinealDirectiveFlag.LIMIT_TO) return []\n const components = _isArr(directiveDefinition)\n ? directiveDefinition\n : directiveDefinition?.components\n return (components ?? [])\n .map((id) => componentLabel(id))\n .filter(Boolean) as string[]\n}\n\n/**\n * Human-readable explanation for a failed lineal validation, e.g.\n * \"Toolbar Content must be placed inside App Bar\". Pair with the reason\n * flag returned by {@link confirmValidLinealRelationship}.\n */\nexport function describeInvalidLinealRelationship(\n item: LinealItem,\n parent: LinealItem,\n reason: InvalidLinealRelationFlag,\n): string {\n const itemLabel = componentLabel(item.componentId) ?? 'This element'\n const parentLabel =\n parent.componentId && parent.componentId !== 'div'\n ? (componentLabel(parent.componentId) ?? parent.componentId)\n : 'the document'\n\n // ITEM governor: the dragged element's own restrictParent failed.\n if (reason & InvalidLinealRelationFlag.ITEM) {\n const allowed = allowedComponentLabels(item.restrictParent)\n if (allowed.length) {\n return `${itemLabel} must be placed inside ${allowed.join(' or ')}`\n }\n return `${itemLabel} can't be placed inside ${parentLabel}`\n }\n\n // PARENT governor: the target's restrictChildren failed.\n const allowed = allowedComponentLabels(parent.restrictChildren)\n if (allowed.length) {\n return `${parentLabel} only accepts ${allowed.join(', ')}`\n }\n return `${parentLabel} doesn't accept ${itemLabel}`\n}\n\nexport function confirmValidLinealRelationship(\n item: LinealItem,\n parent: LinealItem,\n): ConfirmValidLinealRelationshipResponse {\n try {\n if (item.restrictParent) {\n validateLinealOrder(\n parent.componentId,\n parent.pluginId,\n item.restrictParent,\n InvalidLinealRelationFlag.ITEM,\n )\n }\n if (parent.restrictChildren) {\n validateLinealOrder(\n item.componentId,\n item.pluginId,\n parent.restrictChildren,\n InvalidLinealRelationFlag.PARENT,\n )\n }\n } catch (e) {\n console.error(e)\n if (typeof e === 'number') {\n return [false, e]\n }\n throw e\n }\n\n return [true]\n}\nexport default confirmValidLinealRelationship\n"],"names":["checkLinealOrder","components","LinealDirectiveFlag","_isArr","InvalidLinealRelationFlag","validateLinealOrder","componentId","pluginId","linealOrder","governor","failed","componentLabel","undefined","getLabel","allowedComponentLabels","directiveType","directiveDefinition","LIMIT_TO","map","id","filter","Boolean","describeInvalidLinealRelationship","item","parent","reason","itemLabel","parentLabel","allowed","restrictParent","length","join","restrictChildren","confirmValidLinealRelationship","e","console","error"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,gBAAgB,EAAEC,UAAU,EAAEC,mBAAmB,QAAQ,eAAc;AAChF,SAASC,MAAM,QAAQ,2BAA0B;AAEjD,OAAO,IAAA,AAAKC,mDAAAA;sEACC;sEACA;kEAEJ;oEACE;uEAEG;oEACH;;;;;;;;;;;;;WARCA;MAwBX;AAKD,SAASC,oBACPC,WAA8B,EAC9BC,QAAwB,EACxBC,WAAwC,EACxCC,QAE2C;IAE3C,wEAAwE;IACxE,sEAAsE;IACtE,MAAMC,SAASV,iBAAiBM,aAAaC,UAAUC;IACvD,IAAIE,WAAW,aAAa;QAC1B,M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AQG,IAAI,CAAC,OAAO;IAC5D;IACA,OAAO,GAAGJ,YAAY,gBAAgB,EAAED,WAAW;AACrD;AAEA,OAAO,SAASO,+BACdV,IAAgB,EAChBC,MAAkB;IAElB,IAAI;QACF,IAAID,KAAKM,cAAc,EAAE;YACvBxB,oBACEmB,OAAOlB,WAAW,EAClBkB,OAAOjB,QAAQ,EACfgB,KAAKM,cAAc,EAhHlB;QAmHL;QACA,IAAIL,OAAOQ,gBAAgB,EAAE;YAC3B3B,oBACEkB,KAAKjB,WAAW,EAChBiB,KAAKhB,QAAQ,EACbiB,OAAOQ,gBAAgB,EAvHpB;QA0HP;IACF,EAAE,OAAOE,GAAG;QACVC,QAAQC,KAAK,CAACF;QACd,IAAI,OAAOA,MAAM,UAAU;YACzB,OAAO;gBAAC;gBAAOA;aAAE;QACnB;QACA,MAAMA;IACR;IAEA,OAAO;QAAC;KAAK;AACf;AACA,eAAeD,+BAA8B"}
1
+ {"version":3,"sources":["../../../../../../../libs/besigner/core/src/lib/dnd-manager/confirm-valid-lineal-relationship.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 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 { checkLinealOrder, components, LinealDirectiveFlag } from '@aglyn/aglyn'\nimport { _isArr } from '@aglyn/shared-util-tools'\n\nexport enum InvalidLinealRelationFlag {\n DISALLOW = 0x01,\n LIMIT_TO = 0x02,\n\n ITEM = 0x04,\n PARENT = 0x08,\n\n COMPONENT = 0x10,\n BUNDLE = 0x20,\n\n DISALLOW_COMPONENT = DISALLOW | COMPONENT,\n DISALLOW_BUNDLE = DISALLOW | BUNDLE,\n LIMIT_TO_COMPONENT = LIMIT_TO | COMPONENT,\n LIMIT_TO_BUNDLE = LIMIT_TO | BUNDLE,\n\n DISALLOW_COMPONENT_ITEM = DISALLOW_COMPONENT | ITEM,\n DISALLOW_BUNDLE_ITEM = DISALLOW_BUNDLE | ITEM,\n LIMIT_TO_COMPONENT_ITEM = LIMIT_TO_COMPONENT | ITEM,\n LIMIT_TO_BUNDLE_ITEM = LIMIT_TO_BUNDLE | ITEM,\n\n DISALLOW_COMPONENT_PARENT = DISALLOW_COMPONENT | PARENT,\n DISALLOW_BUNDLE_PARENT = DISALLOW_BUNDLE | PARENT,\n LIMIT_TO_COMPONENT_PARENT = LIMIT_TO_COMPONENT | PARENT,\n LIMIT_TO_BUNDLE_PARENT = LIMIT_TO_BUNDLE | PARENT,\n}\n\nexport type ConfirmValidLinealRelationshipResponse =\n [isValid: true] | [isValid: false, reason: InvalidLinealRelationFlag]\n\nfunction validateLinealOrder(\n componentId: Aglyn.ComponentId,\n pluginId: Aglyn.PluginId,\n linealOrder: Aglyn.ComponentsLinealOrder,\n governor:\n | typeof InvalidLinealRelationFlag.ITEM\n | typeof InvalidLinealRelationFlag.PARENT,\n) {\n // The rule itself is shared with the AI node-tree validator (AGL-2905);\n // what stays here is the bitflag vocabulary the drop indicator reads.\n const failed = checkLinealOrder(componentId, pluginId, linealOrder)\n if (failed === 'component') {\n throw InvalidLinealRelationFlag.DISALLOW_COMPONENT | governor\n }\n if (failed === 'plugin') {\n throw InvalidLinealRelationFlag.DISALLOW_BUNDLE | governor\n }\n}\n\nexport type LinealItem = {\n componentId?: Aglyn.ComponentId\n pluginId?: Aglyn.PluginId\n restrictParent?: Aglyn.ComponentsLinealOrder\n restrictChildren?: Aglyn.ComponentsLinealOrder\n}\n\nfunction componentLabel(componentId?: Aglyn.ComponentId): string | undefined {\n if (!componentId) return undefined\n return components.getLabel(componentId) ?? componentId\n}\n\nfunction allowedComponentLabels(\n linealOrder?: Aglyn.ComponentsLinealOrder,\n): string[] {\n if (!linealOrder) return []\n const [directiveType, directiveDefinition] = linealOrder\n if (directiveType !== LinealDirectiveFlag.LIMIT_TO) return []\n const components = _isArr(directiveDefinition)\n ? directiveDefinition\n : directiveDefinition?.components\n return (components ?? [])\n .map((id) => componentLabel(id))\n .filter(Boolean) as string[]\n}\n\n/**\n * Human-readable explanation for a failed lineal validation, e.g.\n * \"Toolbar Content must be placed inside App Bar\". Pair with the reason\n * flag returned by {@link confirmValidLinealRelationship}.\n */\nexport function describeInvalidLinealRelationship(\n item: LinealItem,\n parent: LinealItem,\n reason: InvalidLinealRelationFlag,\n): string {\n const itemLabel = componentLabel(item.componentId) ?? 'This element'\n const parentLabel =\n parent.componentId && parent.componentId !== 'div'\n ? (componentLabel(parent.componentId) ?? parent.componentId)\n : 'the document'\n\n // ITEM governor: the dragged element's own restrictParent failed.\n if (reason & InvalidLinealRelationFlag.ITEM) {\n const allowed = allowedComponentLabels(item.restrictParent)\n if (allowed.length) {\n return `${itemLabel} must be placed inside ${allowed.join(' or ')}`\n }\n return `${itemLabel} can't be placed inside ${parentLabel}`\n }\n\n // PARENT governor: the target's restrictChildren failed.\n const allowed = allowedComponentLabels(parent.restrictChildren)\n if (allowed.length) {\n return `${parentLabel} only accepts ${allowed.join(', ')}`\n }\n return `${parentLabel} doesn't accept ${itemLabel}`\n}\n\nexport function confirmValidLinealRelationship(\n item: LinealItem,\n parent: LinealItem,\n): ConfirmValidLinealRelationshipResponse {\n try {\n if (item.restrictParent) {\n validateLinealOrder(\n parent.componentId,\n parent.pluginId,\n item.restrictParent,\n InvalidLinealRelationFlag.ITEM,\n )\n }\n if (parent.restrictChildren) {\n validateLinealOrder(\n item.componentId,\n item.pluginId,\n parent.restrictChildren,\n InvalidLinealRelationFlag.PARENT,\n )\n }\n } catch (e) {\n console.error(e)\n if (typeof e === 'number') {\n return [false, e]\n }\n throw e\n }\n\n return [true]\n}\nexport default confirmValidLinealRelationship\n"],"names":["checkLinealOrder","components","LinealDirectiveFlag","_isArr","InvalidLinealRelationFlag","validateLinealOrder","componentId","pluginId","linealOrder","governor","failed","componentLabel","undefined","getLabel","allowedComponentLabels","directiveType","directiveDefinition","LIMIT_TO","map","id","filter","Boolean","describeInvalidLinealRelationship","item","parent","reason","itemLabel","parentLabel","allowed","restrictParent","length","join","restrictChildren","confirmValidLinealRelationship","e","console","error"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,gBAAgB,EAAEC,UAAU,EAAEC,mBAAmB,QAAQ,eAAc;AAChF,SAASC,MAAM,QAAQ,2BAA0B;AAEjD,OAAO,IAAA,AAAKC;sEACC;sEACA;kEAEJ;oEACE;uEAEG;oEACH;;;;;;;;;;;;;;MAgBV;AAKD,SAASC,oBACPC,WAA8B,EAC9BC,QAAwB,EACxBC,WAAwC,EACxCC,QAE2C;IAE3C,wEAAwE;IACxE,sEAAsE;IACtE,MAAMC,SAASV,iBAAiBM,aAAaC,UAAUC;IACvD,IAAIE,WAAW,aAAa;QAC1B,MAAMN,KAA+CK;IACvD;IACA,IAAIC,WAAW,UAAU;QACvB,MAAMN,KAA4CK;IACpD;AACF;AASA,SAASE,eAAeL,WAA+B;QAE9CL;IADP,IAAI,CAACK,aAAa,OAAOM;IACzB,QAAOX,uBAAAA,WAAWY,QAAQ,CAACP,wBAApBL,uBAAoCK;AAC7C;AAEA,SAASQ,uBACPN,WAAyC;IAEzC,IAAI,CAACA,aAAa,OAAO,EAAE;IAC3B,MAAM,CAACO,eAAeC,oBAAoB,GAAGR;IAC7C,IAAIO,kBAAkBb,oBAAoBe,QAAQ,EAAE,OAAO,EAAE;IAC7D,MAAMhB,aAAaE,OAAOa,uBACtBA,sBACAA,uCAAAA,oBAAqBf,UAAU;IACnC,OAAO,CAACA,qBAAAA,aAAc,EAAE,EACrBiB,GAAG,CAAC,CAACC,KAAOR,eAAeQ,KAC3BC,MAAM,CAACC;AACZ;AAEA;;;;CAIC,GACD,OAAO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B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/besigner/core/src/lib/dnd-manager/dnd-manager.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 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, components, isFeatureEnabled, NodeType } from '@aglyn/aglyn'\nimport {\n confirmValidLinealRelationship,\n type ConfirmValidLinealRelationshipResponse,\n describeInvalidLinealRelationship,\n type InvalidLinealRelationFlag,\n type LinealItem,\n} from './confirm-valid-lineal-relationship'\nimport { makeAutoObservable } from 'mobx'\nimport { getSelected, isNodeSelected } from '../focus-manager/focus-manager'\n\nexport enum DragType {\n CANVAS = 'canvas',\n PRESET = 'preset',\n TREE = 'tree',\n}\n\nexport enum DropAreaType {\n BEFORE = 0x1,\n INSIDE = 0x2,\n AFTER = 0x3,\n}\n\nexport enum DropRegion {\n CHILDREN = 'children',\n TOP = 'top',\n RIGHT = 'right',\n BOTTOM = 'bottom',\n LEFT = 'left',\n}\n\nexport type DraggableNode = Aglyn.NodeSchema<any> | Aglyn.PresetSchema<any>\n\nexport class DndManager {\n drag?: DraggableNode = null\n drop?: DraggableNode = null\n dropRegion?: DropRegion | null = null\n public get intoArea(): DropAreaType {\n switch (this.dropRegion) {\n case DropRegion.TOP:\n case DropRegion.LEFT:\n return DropAreaType.BEFORE\n case DropRegion.RIGHT:\n case DropRegion.BOTTOM:\n return DropAreaType.AFTER\n }\n\n return DropAreaType.INSIDE\n }\n\n public get computedDrop() {\n if (!this.drop) return this.drop\n if (canvas.isRootNode(this.drop)) return this.drop\n if (!this.dropRegion) return this.drop\n if (this.dropRegion === DropRegion.CHILDREN) {\n // A leaf (self-closing / text-editable) has no slot for node children,\n // so a center/CHILDREN drop resolves against its PARENT and lands as a\n // sibling — mirroring the Insert menu's leaf handling (AGL-575). This\n // also makes the lineal check validate against the real parent instead\n // of the leaf, which (declaring no restrictChildren) would wrongly pass.\n const node = canvas.getNode(this.drop.$id)\n if (node && !canvas.nodeAcceptsChildren(node)) return node.parent\n return this.drop\n }\n // The target can be gone by the time this is read — undone, or removed\n // by a co-editor mid-drag. Nothing to resolve against, rather than a\n // throw out of the drag's end that would leave its state painted.\n return canvas.getNode(this.drop.$id)?.parent ?? null\n }\n\n public get hasDragTarget(): boolean {\n return Boolean(this.drag)\n }\n public get hasDropTarget(): boolean {\n return Boolean(this.drop)\n }\n public get dragBreadcrumbs(): Aglyn.NodeBreadcrumbPath | false {\n if (!this.hasDragTarget) return false\n return this.drag?.breadcrumbPath\n }\n public get dropBreadcrumbs(): Aglyn.NodeBreadcrumbPath | false {\n if (!this.hasDropTarget) return false\n return this.drop?.breadcrumbPath\n }\n public get dropIsInsideDrag() {\n return Boolean(\n this.computedDrop?.breadcrumbPath?.some((i) => i === this.drag?.$id),\n )\n }\n /**\n * Multi-drag (AGL-13): when the dragged node is part of the current\n * multi-selection, every draggable selected node moves; otherwise just\n * the dragged node. Presets never join a selection.\n */\n public get dragNodes(): DraggableNode[] {\n if (\n this.drag &&\n this.drag.type === NodeType.NODE &&\n isNodeSelected(this.drag as Aglyn.NodeSchema<any>)\n ) {\n const selected = getSelected().filter((node) => this.canDragNode(node))\n if (selected.length > 1) {\n // Document order (not selection order) so relative positions\n // survive the move: compare breadcrumb paths by sibling index.\n const orderKey = (node: Aglyn.NodeSchema<any>): number[] =>\n (node.breadcrumbPath ?? []).map((id) => {\n try {\n return canvas.getNodeIndex(canvas.getNode(id))\n } catch {\n return 0\n }\n })\n return [...selected].sort((a, b) => {\n const left = orderKey(a)\n const right = orderKey(b)\n for (let i = 0; i < Math.max(left.length, right.length); i += 1) {\n const diff = (left[i] ?? -1) - (right[i] ?? -1)\n if (diff !== 0) return diff\n }\n return 0\n })\n }\n if (selected.length === 1) return selected\n }\n return this.drag ? [this.drag] : []\n }\n /** Item/parent descriptors for the pending drop, or null without targets. */\n private get dropRelationshipActors(): {\n item: LinealItem\n parent: LinealItem\n } | null {\n if (!this.hasDragTarget || !this.hasDropTarget) return null\n const parent: LinealItem = {\n pluginId: this.computedDrop?.pluginId,\n componentId: this.computedDrop?.componentId,\n restrictChildren: this.computedDrop?.componentSchema?.restrictChildren,\n restrictParent: this.computedDrop?.componentSchema?.restrictParent,\n }\n\n if (this.drag?.type === NodeType.PRESET) {\n const preset = this.drag as Aglyn.PresetSchema<any>\n const itemNode = preset.data\n const itemSchema = components.getSchema(itemNode?.componentId)\n return {\n item: {\n pluginId: preset.data?.pluginId,\n componentId: itemNode?.componentId,\n restrictChildren: itemSchema?.restrictChildren,\n restrictParent: itemSchema?.restrictParent,\n },\n parent,\n }\n }\n return {\n item: {\n pluginId: this.drag?.pluginId,\n componentId: this.drag?.componentId,\n restrictChildren: this.drag?.componentSchema?.restrictChildren,\n restrictParent: this.drag?.componentSchema?.restrictParent,\n },\n parent,\n }\n }\n\n public get linealValidation(): ConfirmValidLinealRelationshipResponse {\n const actors = this.dropRelationshipActors\n if (!actors) return [false, 0 as InvalidLinealRelationFlag]\n return confirmValidLinealRelationship(actors.item, actors.parent)\n }\n\n public get isValidLinealRelationship(): boolean {\n return this.linealValidation[0]\n }\n\n /**\n * Human-readable reason the pending drop would be rejected, or null when\n * the drop is valid (or there is nothing to validate). Read this before\n * onDragEnd — completing the drag clears the dnd state.\n */\n public describeDropRejection(): string | null {\n const actors = this.dropRelationshipActors\n if (!actors) return null\n if (this.dropIsInsideDrag) {\n return \"An element can't be moved inside itself\"\n }\n // Says out loud what `onDragEnd` refuses silently: the resolved parent\n // has no slot a child could render into (AGL-1405).\n const into = this.computedDrop as Aglyn.NodeSchema<any>\n if (into && !canvas.nodeAcceptsChildren(into)) {\n return `${into.labelShort || 'That element'} can't hold other elements`\n }\n const [valid, reason] = confirmValidLinealRelationship(\n actors.item,\n actors.parent,\n )\n if (valid) return null\n return describeInvalidLinealRelationship(actors.item, actors.parent, reason)\n }\n\n constructor() {\n makeAutoObservable(this)\n }\n\n public isDraggingNode(node: DraggableNode): boolean {\n if (!node) return false\n return node?.$id === this.drag?.$id\n }\n public isDraggingDropNode(node: DraggableNode): boolean {\n if (!node) return false\n return node?.$id === this.drop?.$id\n }\n public isDraggingOverDropNode(node: DraggableNode): boolean {\n if (!node) return false\n const breadcrumbs = this.dropBreadcrumbs\n return Array.isArray(breadcrumbs) && breadcrumbs.indexOf(node?.$id) >= 0\n }\n canDragNode(node: DraggableNode): boolean {\n if (!node) throw new Error('Invalid node')\n switch (true) {\n case canvas.isRootNode(node):\n return false\n case node?.type === NodeType.PRESET:\n return true\n case node?.type === NodeType.NODE:\n return isFeatureEnabled(\n (node as Aglyn.NodeSchema<any>)?.componentSchema?.flags?.dragging,\n )\n default:\n return false\n }\n }\n\n public clearDndStatus() {\n this.drag = null\n this.drop = null\n this.dropRegion = null\n return this\n }\n\n public setDragNode(node: DraggableNode) {\n this.drag = node || null\n return this\n }\n public setDropNode(node: DraggableNode) {\n this.drop = node || null\n return this\n }\n public setDropRegion(region: DropRegion) {\n this.dropRegion = region || null\n return this\n }\n public onDragEnd() {\n // Every drag ends by clearing, landed, refused or thrown. A drag that\n // left its state set kept painting it — the dragged node's wash, the\n // ring on the target and every ancestor of it, the hierarchy row that\n // stops taking drops while it is dragged — until the next drag began.\n try {\n this.landDrop()\n } finally {\n this.clearDndStatus()\n }\n }\n\n /** Commits the pending drop, or does nothing when it would be refused. */\n private landDrop() {\n if (\n !this.drop ||\n !this.drag ||\n // Gone since the pointer got there: there is no slot left to name.\n !canvas.getNode(this.drop.$id) ||\n this.dropIsInsideDrag ||\n !this.isValidLinealRelationship\n ) {\n return\n }\n\n const dragNode = this.drag\n const dropNode = this.drop\n const region = this.dropRegion\n const before = region === DropRegion.TOP || region === DropRegion.LEFT\n const after = region === DropRegion.RIGHT || region === DropRegion.BOTTOM\n let position = NaN\n let parent\n\n if (before || after) {\n parent = canvas.getNode(dropNode.parentId)\n position = canvas.getNodeIndex(dropNode)\n if (after) position = position + 1\n } else {\n const dropTarget = canvas.getNode(dropNode.$id)\n // Leaf redirect (AGL-575 parallel): a self-closing / text-editable\n // target has no children slot, so a center drop becomes a sibling right\n // after it rather than a nested child. Non-leaf containers still nest.\n if (\n dropTarget &&\n dropNode.parentId &&\n !canvas.nodeAcceptsChildren(dropTarget)\n ) {\n const leafIndex = canvas.getNodeIndex(dropTarget)\n parent = canvas.getNode(dropNode.parentId)\n if (leafIndex > -1) position = leafIndex + 1\n } else {\n parent = dropTarget\n }\n }\n\n // The redirect above only rescues a drop aimed AT a leaf. An edge drop\n // resolves to the drop node's existing parent, and that parent may itself\n // be unable to hold children — a node already trapped under a `markdown`\n // block (AGL-1388) has exactly that shape, so dropping a sibling next to\n // it would deepen the same hole. `reparentNode` refuses this outright\n // now (AGL-1405); catch it here so a drag ends quietly instead of\n // throwing out of the pointer handler.\n if (!parent || !canvas.nodeAcceptsChildren(parent)) return\n\n if (dragNode.type === NodeType.PRESET) {\n canvas.addNodeFromPreset(dragNode as Aglyn.PresetSchema<any>, parent, position)\n // Besigner.focus.setSelectedNode(newNode)\n } else {\n // Multi-drag (AGL-13): move the whole selection when the dragged\n // node is selected. Per-node guards mirror the single-node checks —\n // nodes that contain the drop target or fail the lineal rules are\n // skipped rather than failing the whole move. Sequential inserts\n // with an advancing position preserve document order (CANVAS and\n // TREE drags both land here).\n const parentSchema = components.getSchema(parent?.componentId)\n for (const node of this.dragNodes) {\n if (node.type !== NodeType.NODE) continue\n const containsDrop = Boolean(\n this.computedDrop?.breadcrumbPath?.some((id) => id === node.$id),\n )\n if (containsDrop) continue\n const [valid] = confirmValidLinealRelationship(\n {\n pluginId: node.pluginId,\n componentId: node.componentId,\n restrictChildren: (node as Aglyn.NodeSchema<any>)\n ?.componentSchema?.restrictChildren,\n restrictParent: (node as Aglyn.NodeSchema<any>)?.componentSchema\n ?.restrictParent,\n },\n {\n pluginId: parent?.pluginId,\n componentId: parent?.componentId,\n restrictChildren: parentSchema?.restrictChildren,\n restrictParent: parentSchema?.restrictParent,\n },\n )\n if (!valid) continue\n\n // An edge drop names a GAP in the sibling list as it stands now —\n // \"before whatever is at index 2\". `reparentNode` indexes the list it\n // is left with, after this node has been spliced out of it. Those\n // agree for a drop into a different parent; among the node's OWN\n // siblings every slot past it shifts down by one, so without this the\n // drag lands one place late — and dropping a node just above itself\n // resolves to the slot it is already in, which is what made the\n // hierarchy drag look inert (AGL-1405).\n let at = position\n if (!Number.isNaN(at) && node.parentId === parent?.$id) {\n const from = canvas.getNodeIndex(node)\n if (from > -1 && from < at) at -= 1\n }\n canvas.reparentNode(node, parent, at)\n if (!Number.isNaN(position)) position += 1\n }\n }\n }\n}\n\nexport default DndManager\n"],"names":["canvas","components","isFeatureEnabled","NodeType","confirmValidLinealRelationship","describeInvalidLinealRelationship","makeAutoObservable","getSelected","isNodeSelected","DragType","DropAreaType","DropRegion","DndManager","intoArea","dropRegion","computedDrop","drop","isRootNode","node","getNode","$id","nodeAcceptsChildren","parent","hasDragTarget","Boolean","drag","hasDropTarget","dragBreadcrumbs","breadcrumbPath","dropBreadcrumbs","dropIsInsideDrag","some","i","dragNodes","type","NODE","selected","filter","canDragNode","length","orderKey","map","id","getNodeIndex","sort","a","b","left","right","Math","max","diff","dropRelationshipActors","pluginId","componentId","restrictChildren","componentSchema","restrictParent","PRESET","preset","itemNode","data","itemSchema","getSchema","item","linealValidation","actors","isValidLinealRelationship","describeDropRejection","into","labelShort","valid","reason","isDraggingNode","isDraggingDropNode","isDraggingOverDropNode","breadcrumbs","Array","isArray","indexOf","Error","flags","dragging","clearDndStatus","setDragNode","setDropNode","setDropRegion","region","onDragEnd","landDrop","dragNode","dropNode","before","after","position","NaN","parentId","dropTarget","leafIndex","addNodeFromPreset","parentSchema","containsDrop","at","Number","isNaN","from","reparentNode"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,MAAM,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,QAAQ,QAAQ,eAAc;AAC7E,SACEC,8BAA8B,EAE9BC,iCAAiC,QAG5B,yCAAqC;AAC5C,SAASC,kBAAkB,QAAQ,OAAM;AACzC,SAASC,WAAW,EAAEC,cAAc,QAAQ,oCAAgC;AAE5E,OAAO,IAAA,AAAKC,kCAAAA;;;;WAAAA;MAIX;AAED,OAAO,IAAA,AAAKC,sCAAAA;0CACD;0CACA;yCACD;WAHEA;MAIX;AAED,OAAO,IAAA,AAAKC,oCAAAA;;;;;;WAAAA;MAMX;AAID,OAAO,MAAMC;IAIX,IAAWC,WAAyB;QAClC,OAAQ,IAAI,CAACC,UAAU;YACrB;YACA;gBACE,OAvBG;YAwBL;YACA;gBACE,OAxBE;QAyBN;QAEA,OA5BO;IA6BT;IAEA,IAAWC,eAAe;;YAiBjBf;QAhBP,IAAI,CAAC,IAAI,CAACgB,IAAI,EAAE,OAAO,IAAI,CAACA,IAAI;QAChC,IAAIhB,OAAOiB,UAAU,CAAC,IAAI,CAACD,IAAI,GAAG,OAAO,IAAI,CAACA,IAAI;QAClD,IAAI,CAAC,IAAI,CAACF,UAAU,EAAE,OAAO,IAAI,CAACE,IAAI;QACtC,IAAI,IAAI,CAACF,UAAU,iBAA0B;YAC3C,uEAAuE;YACvE,uEAAuE;YACvE,sEAAsE;YACtE,uEAAuE;YACvE,yEAAyE;YACzE,MAAMI,OAAOlB,OAAOmB,OAAO,CAAC,IAAI,CAACH,IAAI,CAACI,GAAG;YACzC,IAAIF,QAAQ,CAAClB,OAAOqB,mBAAmB,CAACH,OAAO,OAAOA,KAAKI,MAAM;YACjE,OAAO,IAAI,CAACN,IAAI;QAClB;QACA,uEAAuE;QACvE,qEAAqE;QACrE,kEAAkE;QAClE,gBAAOhB,kBAAAA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BAClB,MAAM,CAAC9B,MAAM,GAAGnE,+BACd;oBACEiD,UAAUnC,KAAKmC,QAAQ;oBACvBC,aAAapC,KAAKoC,WAAW;oBAC7BC,gBAAgB,EAAGrC,yBAAD,wBAAA,AAACA,KACfsC,eAAe,qBADD,sBACGD,gBAAgB;oBACrCE,cAAc,EAAGvC,yBAAD,yBAAA,AAACA,KAAgCsC,eAAe,qBAAhD,uBACZC,cAAc;gBACpB,GACA;oBACEJ,QAAQ,EAAE/B,0BAAAA,OAAQ+B,QAAQ;oBAC1BC,WAAW,EAAEhC,0BAAAA,OAAQgC,WAAW;oBAChCC,gBAAgB,EAAE6C,gCAAAA,aAAc7C,gBAAgB;oBAChDE,cAAc,EAAE2C,gCAAAA,aAAc3C,cAAc;gBAC9C;gBAEF,IAAI,CAACc,OAAO;gBAEZ,kEAAkE;gBAClE,sEAAsE;gBACtE,kEAAkE;gBAClE,iEAAiE;gBACjE,sEAAsE;gBACtE,oEAAoE;gBACpE,gEAAgE;gBAChE,wCAAwC;gBACxC,IAAI+B,KAAKR;gBACT,IAAI,CAACS,OAAOC,KAAK,CAACF,OAAOpF,KAAK8E,QAAQ,MAAK1E,0BAAAA,OAAQF,GAAG,GAAE;oBACtD,MAAMqF,OAAOzG,OAAO2C,YAAY,CAACzB;oBACjC,IAAIuF,OAAO,CAAC,KAAKA,OAAOH,IAAIA,MAAM;gBACpC;gBACAtG,OAAO0G,YAAY,CAACxF,MAAMI,QAAQgF;gBAClC,IAAI,CAACC,OAAOC,KAAK,CAACV,WAAWA,YAAY;YAC3C;QACF;IACF;IAxKA,aAAc;aArKdrE,OAAuB;aACvBT,OAAuB;aACvBF,aAAiC;QAoK/BR,mBAAmB,IAAI;IACzB;AAuKF;AAEA,eAAeM,WAAU"}
1
+ {"version":3,"sources":["../../../../../../../libs/besigner/core/src/lib/dnd-manager/dnd-manager.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 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, components, isFeatureEnabled, NodeType } from '@aglyn/aglyn'\nimport {\n confirmValidLinealRelationship,\n type ConfirmValidLinealRelationshipResponse,\n describeInvalidLinealRelationship,\n type InvalidLinealRelationFlag,\n type LinealItem,\n} from './confirm-valid-lineal-relationship'\nimport { makeAutoObservable } from 'mobx'\nimport { getSelected, isNodeSelected } from '../focus-manager/focus-manager'\n\nexport enum DragType {\n CANVAS = 'canvas',\n PRESET = 'preset',\n TREE = 'tree',\n}\n\nexport enum DropAreaType {\n BEFORE = 0x1,\n INSIDE = 0x2,\n AFTER = 0x3,\n}\n\nexport enum DropRegion {\n CHILDREN = 'children',\n TOP = 'top',\n RIGHT = 'right',\n BOTTOM = 'bottom',\n LEFT = 'left',\n}\n\nexport type DraggableNode = Aglyn.NodeSchema<any> | Aglyn.PresetSchema<any>\n\nexport class DndManager {\n drag?: DraggableNode = null\n drop?: DraggableNode = null\n dropRegion?: DropRegion | null = null\n public get intoArea(): DropAreaType {\n switch (this.dropRegion) {\n case DropRegion.TOP:\n case DropRegion.LEFT:\n return DropAreaType.BEFORE\n case DropRegion.RIGHT:\n case DropRegion.BOTTOM:\n return DropAreaType.AFTER\n }\n\n return DropAreaType.INSIDE\n }\n\n public get computedDrop() {\n if (!this.drop) return this.drop\n if (canvas.isRootNode(this.drop)) return this.drop\n if (!this.dropRegion) return this.drop\n if (this.dropRegion === DropRegion.CHILDREN) {\n // A leaf (self-closing / text-editable) has no slot for node children,\n // so a center/CHILDREN drop resolves against its PARENT and lands as a\n // sibling — mirroring the Insert menu's leaf handling (AGL-575). This\n // also makes the lineal check validate against the real parent instead\n // of the leaf, which (declaring no restrictChildren) would wrongly pass.\n const node = canvas.getNode(this.drop.$id)\n if (node && !canvas.nodeAcceptsChildren(node)) return node.parent\n return this.drop\n }\n // The target can be gone by the time this is read — undone, or removed\n // by a co-editor mid-drag. Nothing to resolve against, rather than a\n // throw out of the drag's end that would leave its state painted.\n return canvas.getNode(this.drop.$id)?.parent ?? null\n }\n\n public get hasDragTarget(): boolean {\n return Boolean(this.drag)\n }\n public get hasDropTarget(): boolean {\n return Boolean(this.drop)\n }\n public get dragBreadcrumbs(): Aglyn.NodeBreadcrumbPath | false {\n if (!this.hasDragTarget) return false\n return this.drag?.breadcrumbPath\n }\n public get dropBreadcrumbs(): Aglyn.NodeBreadcrumbPath | false {\n if (!this.hasDropTarget) return false\n return this.drop?.breadcrumbPath\n }\n public get dropIsInsideDrag() {\n return Boolean(\n this.computedDrop?.breadcrumbPath?.some((i) => i === this.drag?.$id),\n )\n }\n /**\n * Multi-drag (AGL-13): when the dragged node is part of the current\n * multi-selection, every draggable selected node moves; otherwise just\n * the dragged node. Presets never join a selection.\n */\n public get dragNodes(): DraggableNode[] {\n if (\n this.drag &&\n this.drag.type === NodeType.NODE &&\n isNodeSelected(this.drag as Aglyn.NodeSchema<any>)\n ) {\n const selected = getSelected().filter((node) => this.canDragNode(node))\n if (selected.length > 1) {\n // Document order (not selection order) so relative positions\n // survive the move: compare breadcrumb paths by sibling index.\n const orderKey = (node: Aglyn.NodeSchema<any>): number[] =>\n (node.breadcrumbPath ?? []).map((id) => {\n try {\n return canvas.getNodeIndex(canvas.getNode(id))\n } catch {\n return 0\n }\n })\n return [...selected].sort((a, b) => {\n const left = orderKey(a)\n const right = orderKey(b)\n for (let i = 0; i < Math.max(left.length, right.length); i += 1) {\n const diff = (left[i] ?? -1) - (right[i] ?? -1)\n if (diff !== 0) return diff\n }\n return 0\n })\n }\n if (selected.length === 1) return selected\n }\n return this.drag ? [this.drag] : []\n }\n /** Item/parent descriptors for the pending drop, or null without targets. */\n private get dropRelationshipActors(): {\n item: LinealItem\n parent: LinealItem\n } | null {\n if (!this.hasDragTarget || !this.hasDropTarget) return null\n const parent: LinealItem = {\n pluginId: this.computedDrop?.pluginId,\n componentId: this.computedDrop?.componentId,\n restrictChildren: this.computedDrop?.componentSchema?.restrictChildren,\n restrictParent: this.computedDrop?.componentSchema?.restrictParent,\n }\n\n if (this.drag?.type === NodeType.PRESET) {\n const preset = this.drag as Aglyn.PresetSchema<any>\n const itemNode = preset.data\n const itemSchema = components.getSchema(itemNode?.componentId)\n return {\n item: {\n pluginId: preset.data?.pluginId,\n componentId: itemNode?.componentId,\n restrictChildren: itemSchema?.restrictChildren,\n restrictParent: itemSchema?.restrictParent,\n },\n parent,\n }\n }\n return {\n item: {\n pluginId: this.drag?.pluginId,\n componentId: this.drag?.componentId,\n restrictChildren: this.drag?.componentSchema?.restrictChildren,\n restrictParent: this.drag?.componentSchema?.restrictParent,\n },\n parent,\n }\n }\n\n public get linealValidation(): ConfirmValidLinealRelationshipResponse {\n const actors = this.dropRelationshipActors\n if (!actors) return [false, 0 as InvalidLinealRelationFlag]\n return confirmValidLinealRelationship(actors.item, actors.parent)\n }\n\n public get isValidLinealRelationship(): boolean {\n return this.linealValidation[0]\n }\n\n /**\n * Human-readable reason the pending drop would be rejected, or null when\n * the drop is valid (or there is nothing to validate). Read this before\n * onDragEnd — completing the drag clears the dnd state.\n */\n public describeDropRejection(): string | null {\n const actors = this.dropRelationshipActors\n if (!actors) return null\n if (this.dropIsInsideDrag) {\n return \"An element can't be moved inside itself\"\n }\n // Says out loud what `onDragEnd` refuses silently: the resolved parent\n // has no slot a child could render into (AGL-1405).\n const into = this.computedDrop as Aglyn.NodeSchema<any>\n if (into && !canvas.nodeAcceptsChildren(into)) {\n return `${into.labelShort || 'That element'} can't hold other elements`\n }\n const [valid, reason] = confirmValidLinealRelationship(\n actors.item,\n actors.parent,\n )\n if (valid) return null\n return describeInvalidLinealRelationship(actors.item, actors.parent, reason)\n }\n\n constructor() {\n makeAutoObservable(this)\n }\n\n public isDraggingNode(node: DraggableNode): boolean {\n if (!node) return false\n return node?.$id === this.drag?.$id\n }\n public isDraggingDropNode(node: DraggableNode): boolean {\n if (!node) return false\n return node?.$id === this.drop?.$id\n }\n public isDraggingOverDropNode(node: DraggableNode): boolean {\n if (!node) return false\n const breadcrumbs = this.dropBreadcrumbs\n return Array.isArray(breadcrumbs) && breadcrumbs.indexOf(node?.$id) >= 0\n }\n canDragNode(node: DraggableNode): boolean {\n if (!node) throw new Error('Invalid node')\n switch (true) {\n case canvas.isRootNode(node):\n return false\n case node?.type === NodeType.PRESET:\n return true\n case node?.type === NodeType.NODE:\n return isFeatureEnabled(\n (node as Aglyn.NodeSchema<any>)?.componentSchema?.flags?.dragging,\n )\n default:\n return false\n }\n }\n\n public clearDndStatus() {\n this.drag = null\n this.drop = null\n this.dropRegion = null\n return this\n }\n\n public setDragNode(node: DraggableNode) {\n this.drag = node || null\n return this\n }\n public setDropNode(node: DraggableNode) {\n this.drop = node || null\n return this\n }\n public setDropRegion(region: DropRegion) {\n this.dropRegion = region || null\n return this\n }\n public onDragEnd() {\n // Every drag ends by clearing, landed, refused or thrown. A drag that\n // left its state set kept painting it — the dragged node's wash, the\n // ring on the target and every ancestor of it, the hierarchy row that\n // stops taking drops while it is dragged — until the next drag began.\n try {\n this.landDrop()\n } finally {\n this.clearDndStatus()\n }\n }\n\n /** Commits the pending drop, or does nothing when it would be refused. */\n private landDrop() {\n if (\n !this.drop ||\n !this.drag ||\n // Gone since the pointer got there: there is no slot left to name.\n !canvas.getNode(this.drop.$id) ||\n this.dropIsInsideDrag ||\n !this.isValidLinealRelationship\n ) {\n return\n }\n\n const dragNode = this.drag\n const dropNode = this.drop\n const region = this.dropRegion\n const before = region === DropRegion.TOP || region === DropRegion.LEFT\n const after = region === DropRegion.RIGHT || region === DropRegion.BOTTOM\n let position = NaN\n let parent\n\n if (before || after) {\n parent = canvas.getNode(dropNode.parentId)\n position = canvas.getNodeIndex(dropNode)\n if (after) position = position + 1\n } else {\n const dropTarget = canvas.getNode(dropNode.$id)\n // Leaf redirect (AGL-575 parallel): a self-closing / text-editable\n // target has no children slot, so a center drop becomes a sibling right\n // after it rather than a nested child. Non-leaf containers still nest.\n if (\n dropTarget &&\n dropNode.parentId &&\n !canvas.nodeAcceptsChildren(dropTarget)\n ) {\n const leafIndex = canvas.getNodeIndex(dropTarget)\n parent = canvas.getNode(dropNode.parentId)\n if (leafIndex > -1) position = leafIndex + 1\n } else {\n parent = dropTarget\n }\n }\n\n // The redirect above only rescues a drop aimed AT a leaf. An edge drop\n // resolves to the drop node's existing parent, and that parent may itself\n // be unable to hold children — a node already trapped under a `markdown`\n // block (AGL-1388) has exactly that shape, so dropping a sibling next to\n // it would deepen the same hole. `reparentNode` refuses this outright\n // now (AGL-1405); catch it here so a drag ends quietly instead of\n // throwing out of the pointer handler.\n if (!parent || !canvas.nodeAcceptsChildren(parent)) return\n\n if (dragNode.type === NodeType.PRESET) {\n canvas.addNodeFromPreset(dragNode as Aglyn.PresetSchema<any>, parent, position)\n // Besigner.focus.setSelectedNode(newNode)\n } else {\n // Multi-drag (AGL-13): move the whole selection when the dragged\n // node is selected. Per-node guards mirror the single-node checks —\n // nodes that contain the drop target or fail the lineal rules are\n // skipped rather than failing the whole move. Sequential inserts\n // with an advancing position preserve document order (CANVAS and\n // TREE drags both land here).\n const parentSchema = components.getSchema(parent?.componentId)\n for (const node of this.dragNodes) {\n if (node.type !== NodeType.NODE) continue\n const containsDrop = Boolean(\n this.computedDrop?.breadcrumbPath?.some((id) => id === node.$id),\n )\n if (containsDrop) continue\n const [valid] = confirmValidLinealRelationship(\n {\n pluginId: node.pluginId,\n componentId: node.componentId,\n restrictChildren: (node as Aglyn.NodeSchema<any>)\n ?.componentSchema?.restrictChildren,\n restrictParent: (node as Aglyn.NodeSchema<any>)?.componentSchema\n ?.restrictParent,\n },\n {\n pluginId: parent?.pluginId,\n componentId: parent?.componentId,\n restrictChildren: parentSchema?.restrictChildren,\n restrictParent: parentSchema?.restrictParent,\n },\n )\n if (!valid) continue\n\n // An edge drop names a GAP in the sibling list as it stands now —\n // \"before whatever is at index 2\". `reparentNode` indexes the list it\n // is left with, after this node has been spliced out of it. Those\n // agree for a drop into a different parent; among the node's OWN\n // siblings every slot past it shifts down by one, so without this the\n // drag lands one place late — and dropping a node just above itself\n // resolves to the slot it is already in, which is what made the\n // hierarchy drag look inert (AGL-1405).\n let at = position\n if (!Number.isNaN(at) && node.parentId === parent?.$id) {\n const from = canvas.getNodeIndex(node)\n if (from > -1 && from < at) at -= 1\n }\n canvas.reparentNode(node, parent, at)\n if (!Number.isNaN(position)) position += 1\n }\n }\n }\n}\n\nexport default DndManager\n"],"names":["canvas","components","isFeatureEnabled","NodeType","confirmValidLinealRelationship","describeInvalidLinealRelationship","makeAutoObservable","getSelected","isNodeSelected","DragType","DropAreaType","DropRegion","DndManager","intoArea","dropRegion","computedDrop","drop","isRootNode","node","getNode","$id","nodeAcceptsChildren","parent","hasDragTarget","Boolean","drag","hasDropTarget","dragBreadcrumbs","breadcrumbPath","dropBreadcrumbs","dropIsInsideDrag","some","i","dragNodes","type","NODE","selected","filter","canDragNode","length","orderKey","map","id","getNodeIndex","sort","a","b","left","right","Math","max","diff","dropRelationshipActors","pluginId","componentId","restrictChildren","componentSchema","restrictParent","PRESET","preset","itemNode","data","itemSchema","getSchema","item","linealValidation","actors","isValidLinealRelationship","describeDropRejection","into","labelShort","valid","reason","isDraggingNode","isDraggingDropNode","isDraggingOverDropNode","breadcrumbs","Array","isArray","indexOf","Error","flags","dragging","clearDndStatus","setDragNode","setDropNode","setDropRegion","region","onDragEnd","landDrop","dragNode","dropNode","before","after","position","NaN","parentId","dropTarget","leafIndex","addNodeFromPreset","parentSchema","containsDrop","at","Number","isNaN","from","reparentNode"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,MAAM,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,QAAQ,Q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vC,yBAAD,yBAAA,AAACA,KAAgCsC,eAAe,qBAAhD,uBACZC,cAAc;gBACpB,GACA;oBACEJ,QAAQ,EAAE/B,0BAAAA,OAAQ+B,QAAQ;oBAC1BC,WAAW,EAAEhC,0BAAAA,OAAQgC,WAAW;oBAChCC,gBAAgB,EAAE6C,gCAAAA,aAAc7C,gBAAgB;oBAChDE,cAAc,EAAE2C,gCAAAA,aAAc3C,cAAc;gBAC9C;gBAEF,IAAI,CAACc,OAAO;gBAEZ,kEAAkE;gBAClE,sEAAsE;gBACtE,kEAAkE;gBAClE,iEAAiE;gBACjE,sEAAsE;gBACtE,oEAAoE;gBACpE,gEAAgE;gBAChE,wCAAwC;gBACxC,IAAI+B,KAAKR;gBACT,IAAI,CAACS,OAAOC,KAAK,CAACF,OAAOpF,KAAK8E,QAAQ,MAAK1E,0BAAAA,OAAQF,GAAG,GAAE;oBACtD,MAAMqF,OAAOzG,OAAO2C,YAAY,CAACzB;oBACjC,IAAIuF,OAAO,CAAC,KAAKA,OAAOH,IAAIA,MAAM;gBACpC;gBACAtG,OAAO0G,YAAY,CAACxF,MAAMI,QAAQgF;gBAClC,IAAI,CAACC,OAAOC,KAAK,CAACV,WAAWA,YAAY;YAC3C;QACF;IACF;IAxKA,aAAc;aArKdrE,OAAuB;aACvBT,OAAuB;aACvBF,aAAiC;QAoK/BR,mBAAmB,IAAI;IACzB;AAuKF;AAEA,eAAeM,WAAU"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/besigner/core/src/lib/node-refs/node-refs.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 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 { observable } from 'mobx'\nimport type { RefObject } from 'react'\n\nexport enum EditorMode { //BesignerDeviceFlag\n SELECT = 0x1,\n REARRANGE = 0x2,\n PREVIEW = 0x3,\n}\n\nexport const refs = observable.map<Aglyn.NodeId, RefObject<HTMLElement>>(\n {},\n { deep: false },\n)\nexport const handles = observable.map<Aglyn.NodeId, JSX.AnyProps>(\n {},\n { deep: false },\n)\n"],"names":["observable","EditorMode","refs","map","deep","handles"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,UAAU,QAAQ,OAAM;AAGjC,OAAO,IAAA,AAAKC,oCAAAA;sCACD;yCACG;uCACF;WAHAA;MAIX;AAED,OAAO,MAAMC,OAAOF,WAAWG,GAAG,CAChC,CAAC,GACD;IAAEC,MAAM;AAAM,GACf;AACD,OAAO,MAAMC,UAAUL,WAAWG,GAAG,CACnC,CAAC,GACD;IAAEC,MAAM;AAAM,GACf"}
1
+ {"version":3,"sources":["../../../../../../../libs/besigner/core/src/lib/node-refs/node-refs.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 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 { observable } from 'mobx'\nimport type { RefObject } from 'react'\n\nexport enum EditorMode { //BesignerDeviceFlag\n SELECT = 0x1,\n REARRANGE = 0x2,\n PREVIEW = 0x3,\n}\n\nexport const refs = observable.map<Aglyn.NodeId, RefObject<HTMLElement>>(\n {},\n { deep: false },\n)\nexport const handles = observable.map<Aglyn.NodeId, JSX.AnyProps>(\n {},\n { deep: false },\n)\n"],"names":["observable","EditorMode","refs","map","deep","handles"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SAASA,UAAU,QAAQ,OAAM;AAGjC,OAAO,IAAA,AAAKC;sCACD;yCACG;uCACF;;MACX;AAED,OAAO,MAAMC,OAAOF,WAAWG,GAAG,CAChC,CAAC,GACD;IAAEC,MAAM;AAAM,GACf;AACD,OAAO,MAAMC,UAAUL,WAAWG,GAAG,CACnC,CAAC,GACD;IAAEC,MAAM;AAAM,GACf"}