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,CAAC,CACzB,CAAA;QAED,OAAO;YACL,IAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,CAAA;YACnC,IAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAAA;YAE/B,IAAM,aAAa,GAAG,QAAQ,CAAC,iBAAiB,EAAE,CAAA;YAClD,IAAM,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;YAElC,IAAM,WAAW,GAAG;gBAClB,OAAO,CACL,CAAC,IAAI,CACH,KAAK,CAAC,CAAC;wBACL,UAAU,EAAE,QAAQ;qBACrB,CAAC,CAEF;YAAA,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,EACjC;YAAA,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CACxC;UAAA,EAAE,IAAI,CAAC,CACR,CAAA;YACH,CAAC,CAAA;YAED,IAAI,CAAC,SAAS;gBAAE,OAAO,IAAI,CAAA;YAE3B,OAAO,MAAM,CAAC,MAAM,KAAK,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC/C,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAC5C;UAAA,CAAC,WAAW,EAAE,CAChB;QAAA,EAAE,GAAG,CAAC,CACP,CAAC,CAAC,CAAC,IAAI,CAAA;QACV,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,IAAM,WAAW,GAAG,aAAa,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE;IACvE,WAAW,EAAE,aAAa;CAC3B,CAAC,CAAA","sourcesContent":["import { useCursor, usePrefix, useDesigner } from '../../hooks'\nimport { CursorStatus } from '@designable/core'\nimport { autorun, observe } from '@formily/reactive'\nimport { observer } from '@formily/reactive-vue'\nimport { NodeTitleWidget } from '../NodeTitleWidget'\nimport './styles.less'\nimport { composeExport } from '@jeamn/formily-components/src/__builtins__'\nimport { defineComponent, ref, unref, onBeforeUnmount } from 'vue-demi'\nimport { useEffect } from '../../shared/useEffect'\n\nconst GhostWidgetComponent = defineComponent({\n  setup() {\n    const designerRef = useDesigner()\n    const cursorRef = useCursor()\n    const refInstance = ref<HTMLDivElement>()\n    const prefixRef = usePrefix('ghost')\n\n    useEffect(\n      () =>\n        autorun(() => {\n          const cursor = unref(cursorRef)\n          const ref = refInstance.value\n          const transform = `perspective(1px) translate3d(${cursor.position!.topClientX! - 18\n            }px,${cursor.position!.topClientY! - 12}px,0) scale(0.8)`\n          if (!ref) return\n          ref.style.transform = transform\n        }),\n      [designerRef, cursorRef]\n    )\n\n    return () => {\n      const designer = unref(designerRef)\n      const cursor = unref(cursorRef)\n\n      const draggingNodes = designer.findDraggingNodes()\n      const firstNode = draggingNodes[0]\n\n      const renderNodes = () => {\n        return (\n          <span\n            style={{\n              whiteSpace: 'nowrap',\n            }}\n          >\n            <NodeTitleWidget node={firstNode} />\n            {draggingNodes.length > 1 ? '...' : ''}\n          </span>\n        )\n      }\n\n      if (!firstNode) return null\n\n      return cursor.status === CursorStatus.Dragging ? (\n        <div class={prefixRef.value} ref={refInstance}>\n          {renderNodes()}\n        </div>\n      ) : null\n    }\n  },\n})\n\nexport const GhostWidget = composeExport(observer(GhostWidgetComponent), {\n  displayName: 'GhostWidget',\n})\n"]}