@composy/layout-vue 0.0.1 → 0.0.2

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 (157) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +82 -75
  3. package/dist/index.css +9 -3
  4. package/dist/index.js +22 -11
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.css +1 -1
  7. package/dist/index.min.js +2038 -1
  8. package/dist/index.min.js.map +1 -0
  9. package/es/.dts-output-manifest.json +1 -0
  10. package/es/.dts.tsbuildinfo +1 -0
  11. package/es/components/LGrid.d.ts +0 -1
  12. package/es/components/LGrid.js +3 -3
  13. package/es/components/LGrid.js.map +1 -1
  14. package/es/components/LGridItem.d.ts +0 -1
  15. package/es/components/LGridItem.d.ts.map +1 -1
  16. package/es/components/LGridItem.js +4 -2
  17. package/es/components/LGridItem.js.map +1 -1
  18. package/es/components/LLayoutEditor.d.ts +5 -5
  19. package/es/components/LLayoutEditor.d.ts.map +1 -1
  20. package/es/components/LLayoutEditor.js +2 -2
  21. package/es/components/LLayoutEditor.js.map +1 -1
  22. package/es/components/LLayoutWorkspace.js +1 -1
  23. package/es/components/LLayoutWorkspace.js.map +1 -1
  24. package/es/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js +8 -5
  25. package/es/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/es/components/LMaterialDragSource.d.ts +0 -1
  27. package/es/components/LMaterialDragSource.js +1 -1
  28. package/es/components/LMaterialRenderer.d.ts +0 -1
  29. package/es/components/LMaterialRenderer.js +1 -1
  30. package/es/components/LMetricCard.d.ts +0 -1
  31. package/es/components/LMetricCard.js +1 -1
  32. package/es/components/LTrendCard.d.ts +0 -1
  33. package/es/components/LTrendCard.js +1 -1
  34. package/es/components/index.d.ts +0 -1
  35. package/es/components/index.js +3 -3
  36. package/es/components/material-renderer.d.ts +0 -1
  37. package/es/components/material-renderer.d.ts.map +1 -1
  38. package/es/components/material-renderer.js +10 -3
  39. package/es/components/material-renderer.js.map +1 -1
  40. package/es/composables/index.d.ts +0 -1
  41. package/es/composables/index.js +1 -1
  42. package/es/composables/useLayoutEditor.d.ts +0 -1
  43. package/es/composables/useLayoutEditor.js +1 -1
  44. package/es/index.d.ts +0 -1
  45. package/es/index.js +3 -5
  46. package/es/style/css.js +1 -1
  47. package/es/style/index.css +1 -0
  48. package/es/style/index.js +1 -1
  49. package/es/style/workspace.css +18 -2
  50. package/es/types.d.ts +0 -1
  51. package/es/types.js +1 -1
  52. package/esm/components/LGrid.d.ts.map +1 -0
  53. package/esm/components/LGrid.js +91 -0
  54. package/esm/components/LGrid.js.map +1 -0
  55. package/esm/components/LGridItem.d.ts.map +1 -0
  56. package/esm/components/LGridItem.js +54 -0
  57. package/esm/components/LGridItem.js.map +1 -0
  58. package/esm/components/LLayoutEditor.d.ts +50 -0
  59. package/esm/components/LLayoutEditor.d.ts.map +1 -0
  60. package/esm/components/LLayoutEditor.js +81 -0
  61. package/esm/components/LLayoutEditor.js.map +1 -0
  62. package/esm/components/LLayoutWorkspace.js +17 -0
  63. package/esm/components/LLayoutWorkspace.js.map +1 -0
  64. package/esm/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js +2220 -0
  65. package/esm/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.js.map +1 -0
  66. package/esm/components/LMaterialDragSource.d.ts.map +1 -0
  67. package/esm/components/LMaterialDragSource.js +92 -0
  68. package/esm/components/LMaterialDragSource.js.map +1 -0
  69. package/esm/components/LMaterialRenderer.d.ts.map +1 -0
  70. package/esm/components/LMaterialRenderer.js +48 -0
  71. package/esm/components/LMaterialRenderer.js.map +1 -0
  72. package/esm/components/LMetricCard.d.ts.map +1 -0
  73. package/esm/components/LMetricCard.js +39 -0
  74. package/esm/components/LMetricCard.js.map +1 -0
  75. package/esm/components/LTrendCard.d.ts.map +1 -0
  76. package/esm/components/LTrendCard.js +36 -0
  77. package/esm/components/LTrendCard.js.map +1 -0
  78. package/esm/components/index.d.ts.map +1 -0
  79. package/esm/components/index.js +19 -0
  80. package/esm/components/material-renderer.d.ts.map +1 -0
  81. package/esm/components/material-renderer.js +103 -0
  82. package/esm/components/material-renderer.js.map +1 -0
  83. package/esm/composables/index.d.ts.map +1 -0
  84. package/esm/composables/index.js +12 -0
  85. package/esm/composables/useLayoutEditor.d.ts.map +1 -0
  86. package/esm/composables/useLayoutEditor.js +22 -0
  87. package/esm/composables/useLayoutEditor.js.map +1 -0
  88. package/esm/index.d.ts.map +1 -0
  89. package/esm/index.js +22 -0
  90. package/esm/style/css.js +1 -0
  91. package/esm/style/index.js +1 -0
  92. package/{es → esm}/style/index.less +1 -1
  93. package/esm/style/workspace.css +2379 -0
  94. package/esm/types.d.ts.map +1 -0
  95. package/esm/types.js +10 -0
  96. package/lib/components/LGrid.cjs +3 -3
  97. package/lib/components/LGrid.cjs.map +1 -1
  98. package/lib/components/LGrid.d.cts +2 -0
  99. package/lib/components/LGrid.d.cts.map +1 -0
  100. package/lib/components/LGridItem.cjs +4 -2
  101. package/lib/components/LGridItem.cjs.map +1 -1
  102. package/lib/components/LGridItem.d.cts +51 -0
  103. package/lib/components/LGridItem.d.cts.map +1 -0
  104. package/lib/components/LLayoutEditor.cjs +2 -2
  105. package/lib/components/LLayoutEditor.cjs.map +1 -1
  106. package/lib/components/{LLayoutEditor.d.ts → LLayoutEditor.d.cts} +5 -5
  107. package/lib/components/LLayoutEditor.d.cts.map +1 -0
  108. package/lib/components/LLayoutWorkspace.cjs +1 -1
  109. package/lib/components/LLayoutWorkspace.cjs.map +1 -1
  110. package/lib/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.cjs +8 -5
  111. package/lib/components/LLayoutWorkspace.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  112. package/lib/components/LMaterialDragSource.cjs +1 -1
  113. package/lib/components/LMaterialDragSource.d.cts +54 -0
  114. package/lib/components/LMaterialDragSource.d.cts.map +1 -0
  115. package/lib/components/LMaterialRenderer.cjs +1 -1
  116. package/lib/components/LMaterialRenderer.d.cts +62 -0
  117. package/lib/components/LMaterialRenderer.d.cts.map +1 -0
  118. package/lib/components/LMetricCard.cjs +1 -1
  119. package/lib/components/LMetricCard.d.cts +28 -0
  120. package/lib/components/LMetricCard.d.cts.map +1 -0
  121. package/lib/components/LTrendCard.cjs +1 -1
  122. package/lib/components/LTrendCard.d.cts +16 -0
  123. package/lib/components/LTrendCard.d.cts.map +1 -0
  124. package/lib/components/index.cjs +1 -1
  125. package/lib/components/index.d.cts +9 -0
  126. package/lib/components/index.d.cts.map +1 -0
  127. package/lib/components/material-renderer.cjs +10 -3
  128. package/lib/components/material-renderer.cjs.map +1 -1
  129. package/lib/components/material-renderer.d.cts +25 -0
  130. package/lib/components/material-renderer.d.cts.map +1 -0
  131. package/lib/composables/index.cjs +1 -1
  132. package/lib/composables/index.d.cts +1 -0
  133. package/lib/composables/index.d.cts.map +1 -0
  134. package/lib/composables/useLayoutEditor.cjs +1 -1
  135. package/lib/composables/useLayoutEditor.d.cts +2 -0
  136. package/lib/composables/useLayoutEditor.d.cts.map +1 -0
  137. package/lib/index.cjs +1 -1
  138. package/lib/index.d.cts +6 -0
  139. package/lib/index.d.cts.map +1 -0
  140. package/lib/style/index.css +0 -1
  141. package/lib/style/workspace.css +9 -1
  142. package/lib/types.cjs +1 -1
  143. package/lib/types.d.cts +25 -0
  144. package/lib/types.d.cts.map +1 -0
  145. package/package.json +25 -18
  146. /package/{lib → esm}/components/LGrid.d.ts +0 -0
  147. /package/{lib → esm}/components/LGridItem.d.ts +0 -0
  148. /package/{lib → esm}/components/LMaterialDragSource.d.ts +0 -0
  149. /package/{lib → esm}/components/LMaterialRenderer.d.ts +0 -0
  150. /package/{lib → esm}/components/LMetricCard.d.ts +0 -0
  151. /package/{lib → esm}/components/LTrendCard.d.ts +0 -0
  152. /package/{lib → esm}/components/index.d.ts +0 -0
  153. /package/{lib → esm}/components/material-renderer.d.ts +0 -0
  154. /package/{lib → esm}/composables/index.d.ts +0 -0
  155. /package/{lib → esm}/composables/useLayoutEditor.d.ts +0 -0
  156. /package/{lib → esm}/index.d.ts +0 -0
  157. /package/{lib → esm}/types.d.ts +0 -0
package/dist/index.min.js CHANGED
@@ -1 +1,2038 @@
1
- (function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports,require("vue"),require("@composy/layout-runtime"),require("@composy/layout-core"),require("@composy/layout-editor"),require("gridstack"),require("gridstack/dist/gridstack.min.css"),require("lucide"),require("lucide-vue-next"),require("@composy/layout-compiler"),require("@composy/layout-gridstack")):typeof define==="function"&&define.amd?define(["exports","vue","@composy/layout-runtime","@composy/layout-core","@composy/layout-editor","gridstack","gridstack/dist/gridstack.min.css","lucide","lucide-vue-next","@composy/layout-compiler","@composy/layout-gridstack"],factory):(global=typeof globalThis!=="undefined"?globalThis:global||self,factory(global.LDesignLayoutVue={},global.Vue,global.ComposyLayoutRuntime,global.ComposyLayoutCore,global.ComposyLayoutEditor,global.Gridstack,global["gridstack/dist/gridstack"].min.css,global.Lucide,global.LucideVueNext,global.ComposyLayoutCompiler,global.ComposyLayoutGridstack));})(this,function(exports,vue,_composy_layout_runtime,_composy_layout_core,_composy_layout_editor,gridstack,gridstack_dist_gridstack_min_css,lucide,lucide_vue_next,_composy_layout_compiler,_composy_layout_gridstack){Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function resolveRegistry(source){if(!source)return void 0;if(Array.isArray(source))return(0,_composy_layout_core.createMaterialRegistry)(source);return source;}function resolveMaterialDefinition(materials,type){return resolveRegistry(materials)?.get(type);}function renderMaterialFallback(materials,item,placement,breakpointId){const material=resolveMaterialDefinition(materials,item.type);const context={item,placement,breakpointId};const vueRenderer=material?.renderers?.vue;if(vueRenderer?.component)return(0,vue.h)(vueRenderer.component,{...item.props??{},...vueRenderer.tagName?{is:vueRenderer.tagName}:{}});const webComponentRenderer=material?.renderers?.webcomponent;if(webComponentRenderer?.tagName)return(0,vue.h)(webComponentRenderer.tagName,{...item.props??{},materialProps:{...item.props??{}}});const htmlRenderer=material?.renderers?.html;if(htmlRenderer?.render){const rendered=htmlRenderer.render(context);if(typeof rendered==="string")return(0,vue.h)("div",{innerHTML:sanitizeMarkup(rendered)});return rendered;}if(htmlRenderer?.tagName)return(0,vue.h)(htmlRenderer.tagName,{...item.props??{}});}function renderMaterialForTarget(materials,item,target,placement,breakpointId="desktop"){const material=resolveMaterialDefinition(materials,item.type);const props={...item.props??{}};if(target==="vue"){const renderer=material?.renderers?.vue;if(renderer?.component)return(0,vue.h)(renderer.component,props);}else{const renderer=material?.renderers?.webcomponent;if(renderer?.tagName)return(0,vue.h)(renderer.tagName,{...props,materialProps:props,onVnodeMounted:(vnode)=>{const el=vnode.el;if(el&&"materialProps" in el)el.materialProps=props;},onVnodeUpdated:(vnode)=>{const el=vnode.el;if(el&&"materialProps" in el)el.materialProps=props;}});}const htmlRenderer=material?.renderers?.html;if(htmlRenderer?.render){const rendered=htmlRenderer.render({item,placement:placement??item.layout[breakpointId]??{x:0,y:0,w:1,h:1},breakpointId});if(typeof rendered==="string")return(0,vue.h)("div",{innerHTML:sanitizeMarkup(rendered)});return rendered;}if(htmlRenderer?.tagName)return(0,vue.h)(htmlRenderer.tagName,props);return renderMaterialFallback(materials,item,placement??item.layout[breakpointId]??{x:0,y:0,w:1,h:1},breakpointId);}function sanitizeMarkup(value){return value.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*>/gi,"").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/\s+(?:href|src)\s*=\s*("|')\s*javascript:[^"']*\1/gi,"");}const LGrid=(0,vue.defineComponent)({name:"LGrid",props:{document:{type:Object,required:true},breakpoint:{type:String,default:void 0},readonly:{type:Boolean,default:false},materials:{type:[Object,Array],default:void 0},target:{type:String,default:"vue"}},setup(props,{slots,expose}){const root=(0,vue.ref)();const activeBreakpoint=(0,vue.ref)(props.breakpoint??props.document.defaultBreakpointId);const resolved=(0,vue.computed)(()=>props.document.breakpoints.find((bp)=>bp.id===activeBreakpoint.value)??props.document.breakpoints[0]);const gridStyle=(0,vue.computed)(()=>(0,_composy_layout_runtime.resolveGridStyle)(props.document,resolved.value.id));const resize=()=>{if(props.breakpoint||!root.value)return;const width=root.value.getBoundingClientRect().width;const match=props.document.breakpoints.find((bp)=>(bp.minWidth===void 0||width>=bp.minWidth)&&(bp.maxWidth===void 0||width<bp.maxWidth));activeBreakpoint.value=match?.id??props.document.defaultBreakpointId;};let observer;(0,vue.onMounted)(()=>{if(typeof ResizeObserver!=="undefined"&&root.value){observer=new ResizeObserver(resize);observer.observe(root.value);}resize();});(0,vue.onBeforeUnmount)(()=>observer?.disconnect());(0,vue.watch)(()=>props.breakpoint,(value)=>{activeBreakpoint.value=value??props.document.defaultBreakpointId;});expose({getBreakpoint:()=>activeBreakpoint.value});return()=>(0,vue.h)("div",{ref:root,class:"ldesign-layout-grid",style:gridStyle.value,dir:gridStyle.value.direction},props.document.items.map((item)=>{const placement=item.layout[activeBreakpoint.value];if(!placement||placement.hidden)return null;return(0,vue.h)("div",{class:"ldesign-layout-item","data-layout-item-id":item.id,"data-layout-type":item.type,style:(0,_composy_layout_runtime.resolveItemStyle)(item,activeBreakpoint.value),tabindex:props.readonly?void 0:0},slots.item?.({item,placement,breakpointId:activeBreakpoint.value})??slots.default?.({item,placement,breakpointId:activeBreakpoint.value})??renderMaterialForTarget(props.materials,item,props.target,placement,activeBreakpoint.value));}));}});const LGridItem=(0,vue.defineComponent)({name:"LGridItem",props:{item:{type:Object,required:true},placement:{type:Object,required:true},breakpointId:{type:String,required:true},materials:{type:[Object,Array],default:void 0},target:{type:String,default:"vue"}},setup(props,{slots}){return()=>(0,vue.h)("div",{class:"ldesign-layout-item","data-layout-item-id":props.item.id,"data-layout-type":props.item.type},slots.default?.({item:props.item,placement:props.placement,breakpointId:props.breakpointId})??renderMaterialForTarget(props.materials,props.item,props.target,props.placement,props.breakpointId));}});const LMaterialRenderer=(0,vue.defineComponent)({name:"LMaterialRenderer",props:{item:{type:Object,required:true},materials:{type:[Object,Array],default:void 0},target:{type:String,default:"vue"},placement:{type:Object,default:void 0},breakpointId:{type:String,default:"desktop"}},setup(props,{attrs}){return()=>{const rendered=renderMaterialForTarget(props.materials,props.item,props.target,props.placement,props.breakpointId);if(!rendered)return null;return(0,vue.h)(rendered,attrs);};}});const LLayoutEditor=(0,vue.defineComponent)({name:"LLayoutEditor",props:{document:{type:Object,required:true},engine:{type:Object,required:true},mode:{type:String,default:"edit"},preview:Object,materials:{type:Object,default:void 0}},emits:["update:document","change","ready"],setup(props,{slots,emit,expose}){const editor=(0,vue.shallowRef)((0,_composy_layout_editor.createLayoutEditor)({document:props.document,engine:props.engine,materials:props.materials,preview:props.preview}));let lastEmittedDocument=JSON.stringify(props.document);(0,vue.onMounted)(()=>{editor.value.on("document:change",(event)=>{lastEmittedDocument=JSON.stringify(event.document);emit("update:document",event.document);emit("change",event);});editor.value.mount();editor.value.setMode(props.mode);emit("ready",editor.value);});(0,vue.watch)(()=>props.document,(value)=>{const next=JSON.stringify(value);if(next!==lastEmittedDocument){editor.value.load(value);lastEmittedDocument=next;}});(0,vue.watch)(()=>props.mode,(value)=>editor.value.setMode(value));const onKeydown=(event)=>{editor.value.handleKeyboard(event);};(0,vue.onBeforeUnmount)(()=>editor.value.destroy());expose({editor});return()=>(0,vue.h)("div",{class:"ldesign-layout-editor","data-layout-mode":props.mode,"aria-keyshortcuts":"ArrowLeft ArrowRight ArrowUp ArrowDown Delete Control+C Control+V Control+X Control+D",onKeydown},slots.default?.({editor:editor.value}));}});const LMetricCard=(0,vue.defineComponent)({name:"LMetricCard",props:{title:{type:String,default:"数据指标"},value:{type:[String,Number],default:void 0}},setup(props){return()=>(0,vue.h)("article",{class:"layout-card","data-layout-card":""},[(0,vue.h)("div",{class:"layout-card__meta"},[(0,vue.h)("span",{class:"layout-card__type"},"数据指标"),(0,vue.h)("span",{class:"layout-card__status"},"已配置")]),(0,vue.h)("h3",{class:"layout-card__title"},props.title),props.value===void 0?null:(0,vue.h)("strong",{class:"layout-card__value"},Number(props.value).toLocaleString("zh-CN")),(0,vue.h)("div",{class:"layout-card__footer"},[(0,vue.h)("span",null,"实时数据"),(0,vue.h)("span",{class:"layout-card__spark"},"趋势稳定")])]);}});const LTrendCard=(0,vue.defineComponent)({name:"LTrendCard",props:{title:{type:String,default:"趋势图表"}},setup(props){return()=>(0,vue.h)("article",{class:"layout-card","data-layout-card":""},[(0,vue.h)("div",{class:"layout-card__meta"},[(0,vue.h)("span",{class:"layout-card__type"},"趋势图表"),(0,vue.h)("span",{class:"layout-card__status"},"已配置")]),(0,vue.h)("h3",{class:"layout-card__title"},props.title),(0,vue.h)("span",{class:"layout-card__chart","aria-hidden":"true"},Array.from({length:5},(_,index)=>(0,vue.h)("i",{key:index}))),(0,vue.h)("div",{class:"layout-card__footer"},[(0,vue.h)("span",null,"实时数据"),(0,vue.h)("span",{class:"layout-card__spark"},"趋势稳定")])]);}});const _hoisted_1=["data-theme","data-development-framework"];const _hoisted_2={class:"topbar"};const _hoisted_3={class:"brand"};const _hoisted_4={class:"brand-mark","aria-hidden":"true"};const _hoisted_5=["aria-expanded","title"];const _hoisted_6={key:0,class:"custom-select__menu development-mode__menu",role:"listbox"};const _hoisted_7=["aria-selected","onClick"];const _hoisted_8={class:"topbar-center","aria-hidden":"true",style:{"display":"none"}};const _hoisted_9={class:"route-tabs","aria-label":"工作区模式"};const _hoisted_10=["aria-current","aria-label","title","onClick"];const _hoisted_11={class:"breakpoint-tabs","aria-label":"画布尺寸"};const _hoisted_12=["aria-pressed","aria-label","title","onClick"];const _hoisted_13={class:"actions"};const _hoisted_14=["disabled"];const _hoisted_15=["disabled"];const _hoisted_16=["disabled"];const _hoisted_17=["aria-label","title","disabled"];const _hoisted_18=["aria-label","title","disabled"];const _hoisted_19=["aria-label","title","disabled"];const _hoisted_20=["aria-label","title"];const _hoisted_21=["aria-pressed","aria-label","title"];const _hoisted_22={class:"workspace"};const _hoisted_23={class:"materials panel-scroll","data-layout-panel":"materials","aria-label":"物料面板"};const _hoisted_24={class:"panel-heading"};const _hoisted_25={class:"panel-count"};const _hoisted_26={class:"material-toolbar"};const _hoisted_27={class:"material-search"};const _hoisted_28=["onKeydown"];const _hoisted_29=["aria-expanded","title"];const _hoisted_30={key:0,class:"custom-select__menu",role:"listbox"};const _hoisted_31=["aria-selected"];const _hoisted_32=["aria-selected","onClick"];const _hoisted_33={class:"material-result-summary"};const _hoisted_34={key:0};const _hoisted_35={key:0,class:"material-empty"};const _hoisted_36=["data-material-type","data-layout-material","data-layout-props","aria-label","onClick","onKeydown"];const _hoisted_37={class:"material-icon material-icon--metric","aria-hidden":"true"};const _hoisted_38={class:"material-copy"};const _hoisted_39={class:"material-card-meta"};const _hoisted_40={class:"material-size"};const _hoisted_41={class:"material-renderer-badges"};const _hoisted_42=["title"];const _hoisted_43={class:"material-card-actions"};const _hoisted_44=["onClick"];const _hoisted_45={class:"material-add","aria-hidden":"true"};const _hoisted_50={class:"canvas panel-scroll","data-layout-panel":"canvas","aria-label":"布局画布"};const _hoisted_51={class:"canvas-toolbar","aria-label":"画布操作"};const _hoisted_52=["aria-expanded"];const _hoisted_53={key:0,class:"custom-select__menu",role:"listbox"};const _hoisted_54=["aria-selected","aria-label","onClick"];const _hoisted_55={class:"custom-select__option-meta"};const _hoisted_56=["aria-label","title"];const _hoisted_57={class:"canvas-toolbar__group"};const _hoisted_58={class:"canvas-zoom-label","aria-live":"polite"};const _hoisted_59=["data-canvas-width","data-canvas-height","data-canvas-orientation"];const _hoisted_60={class:"editor-stage","aria-label":"可视化编辑画布"};const _hoisted_61={class:"stage-header"};const _hoisted_62={class:"stage-badge"};const _hoisted_63={class:"preview-stage","aria-label":"组件预览画布"};const _hoisted_64=["aria-label","onClick"];const _hoisted_65=["data-preview-framework"];const _hoisted_66={class:"stage-header"};const _hoisted_67={class:"stage-badge"};const _hoisted_68=["data-preview-framework"];const _hoisted_69={class:"stage-header"};const _hoisted_70={class:"stage-badge"};const _hoisted_71={class:"inspectors panel-scroll","data-layout-panel":"inspector","aria-label":"代码检查面板"};const _hoisted_72={class:"inspector-heading"};const _hoisted_73=["aria-label","title"];const _hoisted_74={class:"code-block","data-code-output":""};const _hoisted_75=["innerHTML"];const _hoisted_76={class:"code-status"};const _hoisted_77=["data-preview-framework","data-theme"];const _hoisted_78={class:"preview-dialog__panel"};const _hoisted_79={class:"preview-dialog__header"};const _hoisted_80={class:"preview-dialog__header-meta"};const _hoisted_81={class:"stage-badge"};const _hoisted_82={class:"preview-dialog__body"};const _hoisted_83={class:"preview-dialog__canvas"};const _hoisted_84=["data-material-code-framework","data-material-code-type","data-theme"];const _hoisted_85={class:"preview-dialog__panel material-code-dialog__panel"};const _hoisted_86={class:"preview-dialog__header"};const _hoisted_87={id:"material-code-title"};const _hoisted_88={class:"material-code-dialog__subtitle"};const _hoisted_89={class:"preview-dialog__header-meta"};const _hoisted_90={class:"stage-badge"};const _hoisted_91={class:"preview-dialog__body material-code-dialog__body"};const _hoisted_92={class:"code-block material-code-dialog__code"};const _hoisted_93=["innerHTML"];const _hoisted_94={class:"preview-dialog__footer"};const _hoisted_95={class:"material-code-dialog__actions"};const _hoisted_96=["aria-label","title"];var LLayoutWorkspace_vue_vue_type_script_setup_true_lang_default=(0,vue.defineComponent)({__name:"LLayoutWorkspace",props:{document:{type:Object,required:false},materials:{type:[Object,Array],required:false},theme:{type:String,required:false}},emits:["update:document","change"],setup(__props,{emit:__emit}){const workspaceProps=__props;const workspaceEmit=__emit;const routes=[{id:"editor",label:"编辑",description:"可视化编辑工作区"},{id:"vanilla",label:"原生",description:"原生运行时渲染"},{id:"runtime",label:"预览",description:"网格布局运行时预览"},{id:"vue",label:"组件",description:"组件适配器"}];const breakpointIcons={desktop:lucide_vue_next.Monitor,tablet:lucide_vue_next.Tablet,mobile:lucide_vue_next.Smartphone};const routeIcons={editor:lucide_vue_next.Grid2X2,vanilla:lucide_vue_next.Code2,runtime:lucide_vue_next.Eye,vue:lucide_vue_next.PanelsTopLeft};const developmentFrameworks=[{id:"webcomponent",label:"原生",description:"原生 Web Component 物料",icon:lucide_vue_next.Code2},{id:"vue",label:"Vue 3",description:"Vue 3 组件物料",icon:lucide_vue_next.PanelsTopLeft}];function developmentFrameworkLabel(framework){if(framework==="webcomponent")return "原生";return "Vue 3";}function escapeHtml(value){return value.replace(/[&<>'"]/g,(character)=>({"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#39;","\"":"&quot;"})[character]??character);}function itemTitle(item){return String(item.props?.title??item.id);}function materialLabel(type){return materials.get(type)?.title??materials.get(type)?.label??type;}function formatMarkup(value){const tokens=value.replace(/></g,">\n<").split("\n");let depth=0;return tokens.map((token)=>{const line=token.trim();if(!line)return "";if(line.startsWith("</"))depth=Math.max(0,depth-1);const formatted=`${" ".repeat(depth)}${line}`;if(line.startsWith("<")&&!line.startsWith("</")&&!line.startsWith("<!")&&!line.startsWith("<?")&&!line.endsWith("/>")&&!/^<(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)\b/i.test(line))depth+=1;return formatted;}).filter(Boolean).join("\n");}function formatCss(value){let depth=0;return value.replace(/\s*\{\s*/g,"{\n").replace(/\s*;\s*/g,";\n").replace(/\s*}\s*/g,"\n}\n").split("\n").map((line)=>line.trim()).filter(Boolean).map((line)=>{if(line.startsWith("}"))depth=Math.max(0,depth-1);const formatted=`${" ".repeat(depth)}${line}`;if(line.endsWith("{"))depth+=1;return formatted;}).join("\n");}function breakpointLabel(id){return id==="desktop"?"桌面":id==="tablet"?"平板":"手机";}function lucideMarkup(name){if(typeof document==="undefined")return "";const element=(0,lucide.createElement)(lucide.icons[name]);element.setAttribute("width","13");element.setAttribute("height","13");element.setAttribute("stroke-width","1.9");element.setAttribute("aria-hidden","true");return element.outerHTML;}function renderCardMarkup(item,options={}){const type=materialLabel(item.type);const title=escapeHtml(itemTitle(item));const value=item.props?.value;const valueMarkup=value===void 0?`<span class="layout-card__chart" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i></span>`:`<strong class="layout-card__value">${escapeHtml(new Intl.NumberFormat("zh-CN").format(Number(value)))}</strong>`;return `<article class="layout-card" data-layout-card data-layout-type="${escapeHtml(item.type)}">${options.interactive?`<div class="layout-card__actions" data-layout-actions><button class="layout-card__action" type="button" data-layout-action="copy" aria-disabled="false" aria-label="\u590D\u5236\u7269\u6599" title="\u590D\u5236\u7269\u6599">${lucideMarkup("Copy")}</button><button class="layout-card__action" type="button" data-layout-action="delete" aria-disabled="false" aria-label="\u5220\u9664\u7269\u6599" title="\u5220\u9664\u7269\u6599">${lucideMarkup("Trash2")}</button><button class="layout-card__action" type="button" data-layout-action="lock" aria-disabled="false" aria-label="${item.state?.locked?"解锁物料":"锁定物料"}" title="${item.state?.locked?"解锁物料":"锁定物料"}">${lucideMarkup(item.state?.locked?"Unlock":"Lock")}</button></div>`:""}<div class="layout-card__meta"><span class="layout-card__type">${escapeHtml(type)}</span><span class="layout-card__status">\u5DF2\u914D\u7F6E</span></div><h3 class="layout-card__title">${title}</h3>${valueMarkup}<div class="layout-card__footer"><span>\u5B9E\u65F6\u6570\u636E</span><span class="layout-card__spark">\u8D8B\u52BF\u7A33\u5B9A</span></div></article>`;}function renderExportMaterialMarkup(item){const tagName=(materials.get(item.type)?.renderers?.webcomponent)?.tagName;if(!tagName||!/^[a-z][a-z0-9.-]*$/i.test(tagName))return renderCardMarkup(item);const attributes=Object.entries(item.props??{}).filter(([,value])=>value!==void 0&&value!==null).filter(([,value])=>typeof value!=="object"&&typeof value!=="function").map(([key,value])=>`${key.replace(/[^a-zA-Z0-9:_.-]/g,"-")}="${escapeHtml(String(value))}"`).join(" ");return `<${tagName}${attributes?` ${attributes}`:""}></${tagName}>`;}function ensureWorkspaceMaterialElement(tagName,type){if(typeof customElements==="undefined"||!/^[a-z][a-z0-9.-]*$/i.test(tagName)||customElements.get(tagName))return;class LayoutMaterialElement extends HTMLElement{constructor(){super(...arguments);this.props={};}static get observedAttributes(){return["title","value"];}set materialProps(value){this.props={...value??{}};this.render();}connectedCallback(){this.render();}attributeChangedCallback(){if(!Object.keys(this.props).length)this.render();}attributeProps(){const result={};for(const attribute of Array.from(this.attributes)){if(attribute.name==="class"||attribute.name==="style")continue;result[attribute.name]=attribute.name==="value"&&attribute.value!==""&&!Number.isNaN(Number(attribute.value))?Number(attribute.value):attribute.value;}return result;}render(){const props=Object.keys(this.props).length?this.props:this.attributeProps();this.style.display="block";this.style.width="100%";this.style.height="100%";this.innerHTML=renderCardMarkup({id:`native-${type}`,type,layout:{},props});}}customElements.define(tagName,LayoutMaterialElement);}function setNativeRuntimeCard(shell,item){const tagName=(materials.get(item.type)?.renderers?.webcomponent)?.tagName;shell.className="layout-item-shell";shell.dataset.layoutType=item.type;shell.dataset.materialRenderer="webcomponent";if(!tagName||!/^[a-z][a-z0-9.-]*$/i.test(tagName)){shell.innerHTML=renderCardMarkup(item);return;}ensureWorkspaceMaterialElement(tagName,item.type);const element=shell.ownerDocument.createElement(tagName);element.materialProps={...item.props??{}};shell.replaceChildren(element);}function setRuntimeCard(shell,item){if(activeDevelopmentFramework.value==="webcomponent"){setNativeRuntimeCard(shell,item);return;}shell.className="layout-item-shell";shell.dataset.layoutType=item.type;shell.dataset.materialRenderer="vue";shell.innerHTML=renderCardMarkup(item);}function parseRoute(value){const id=value.replace(/^#\/?/,"");return routes.some((route)=>route.id===id)?id:"editor";}const builtinMaterials=[{type:"metric",order:1,title:"数据指标",category:"data",categoryLabel:"数据组件",description:"数值与摘要",keywords:["指标","数值","KPI"],tags:["数据","卡片"],defaultLayout:{w:4,h:8},size:{default:{w:4,h:8},min:{w:2,h:4},max:{w:12,h:20},step:{w:1,h:1}},constraints:{movable:true,resizable:true},defaults:{title:"新建指标",value:0},renderers:{html:{kind:"html",tagName:"article"},webcomponent:{kind:"webcomponent",tagName:"ldesign-metric-card"},vue:{kind:"vue",package:"@composy/layout-vue",exportName:"LMetricCard",component:LMetricCard}}},{type:"chart",order:2,title:"趋势图表",category:"visual",categoryLabel:"可视化组件",description:"变化与走向",keywords:["趋势","图表","分析"],tags:["可视化","卡片"],defaultLayout:{w:4,h:10},size:{default:{w:4,h:10},min:{w:3,h:6},max:{w:12,h:24},step:{w:1,h:1}},constraints:{movable:true,resizable:true},defaults:{title:"营收趋势"},renderers:{html:{kind:"html",tagName:"article"},webcomponent:{kind:"webcomponent",tagName:"ldesign-trend-card"},vue:{kind:"vue",package:"@composy/layout-vue",exportName:"LTrendCard",component:LTrendCard}}}];function resolveWorkspaceMaterials(input){if(!input)return(0,_composy_layout_core.createMaterialRegistry)(builtinMaterials);if(!Array.isArray(input))return input;return(0,_composy_layout_core.createMaterialRegistry)(input);}const materials=resolveWorkspaceMaterials(workspaceProps.materials);const initial=workspaceProps.document??(0,_composy_layout_core.createLayoutDocument)({id:"layout-alpha-demo",breakpoints:_composy_layout_core.responsiveWebBreakpoints.map((item)=>({...item})),defaultBreakpointId:"desktop",items:[{id:"sales",type:"metric",props:{title:"月度销售额",value:12840},layout:{desktop:{x:0,y:0,w:4,h:10},tablet:{x:0,y:0,w:4,h:10},mobile:{x:0,y:0,w:4,h:8}}},{id:"orders",type:"metric",props:{title:"待处理订单",value:86},layout:{desktop:{x:4,y:0,w:4,h:10},tablet:{x:4,y:0,w:4,h:10},mobile:{x:0,y:8,w:4,h:8}}},{id:"revenue",type:"chart",props:{title:"营收预测"},layout:{desktop:{x:8,y:0,w:4,h:18},tablet:{x:0,y:10,w:8,h:14},mobile:{x:0,y:16,w:4,h:12}}}]});const editorGrid=(0,vue.ref)();const canvasViewport=(0,vue.ref)();const runtimePreview=(0,vue.ref)();const vanillaRuntime=(0,vue.ref)();const previewDialogRuntime=(0,vue.ref)();const materialQuery=(0,vue.ref)("");const activeMaterialCategory=(0,vue.ref)();const activeDevelopmentFramework=(0,vue.ref)("vue");const materialElements=new Map();const materialSourceDisposers=new Map();const materialCategories=(0,vue.computed)(()=>materials.getCategories());const activeMaterialCategoryLabel=(0,vue.computed)(()=>{if(!activeMaterialCategory.value)return "全部分类";return materialCategories.value.find((category)=>category.id===activeMaterialCategory.value)?.label??"全部分类";});const activeDevelopmentFrameworkLabel=(0,vue.computed)(()=>developmentFrameworkLabel(activeDevelopmentFramework.value));const materialCategoryFilter=(0,vue.computed)({get:()=>activeMaterialCategory.value??"",set:(value)=>{activeMaterialCategory.value=value||void 0;}});const hasMaterialFilters=(0,vue.computed)(()=>Boolean(materialQuery.value.trim())||Boolean(activeMaterialCategory.value));const visibleMaterials=(0,vue.computed)(()=>materials.search({query:materialQuery.value,category:activeMaterialCategory.value,framework:activeDevelopmentFramework.value}));const layout=(0,vue.ref)(structuredClone(initial));const selected=(0,vue.ref)();const selectedIds=(0,vue.ref)([]);const activeBreakpoint=(0,vue.ref)("desktop");const canvasOrientation=(0,vue.ref)("landscape");const deviceMenuOpen=(0,vue.ref)(false);const categoryMenuOpen=(0,vue.ref)(false);const developmentModeMenuOpen=(0,vue.ref)(false);const copied=(0,vue.ref)(false);const previewMode=(0,vue.ref)(false);const previewDialogOpen=(0,vue.ref)(false);const materialCodeDialog=(0,vue.ref)();const materialCodeCopied=(0,vue.ref)(false);const activeRoute=(0,vue.ref)("editor");const theme=(0,vue.ref)(workspaceProps.theme??"light");const canvasZoom=(0,vue.ref)(1);const canvasPan=(0,vue.ref)({x:0,y:0});const canvasTool=(0,vue.ref)("select");const canvasPanning=(0,vue.ref)(false);const canvasSpacePressed=(0,vue.ref)(false);const canvasPanOrigin=(0,vue.ref)({x:0,y:0,panX:0,panY:0});let editor;let vanillaRuntimeInstance;let previewDialogRuntimeInstance;let previousGridStackRenderCallback;let interactionPreviewFrame;const disposers=[];const currentDocument=(0,vue.computed)(()=>layout.value);const canvasSize=(0,vue.computed)(()=>{return{desktop:{landscape:{width:1200,height:760},portrait:{width:760,height:1200}},tablet:{landscape:{width:1024,height:768},portrait:{width:768,height:1024}},mobile:{landscape:{width:844,height:390},portrait:{width:390,height:844}}}[activeBreakpoint.value]?.[canvasOrientation.value]??{width:1200,height:760};});const activeBreakpointIcon=(0,vue.computed)(()=>breakpointIcons[activeBreakpoint.value]??lucide_vue_next.Monitor);(0,vue.computed)(()=>JSON.stringify(currentDocument.value,null,2));const compiledResult=(0,vue.computed)(()=>(0,_composy_layout_compiler.compileLayout)(currentDocument.value,{target:"html-css",breakpointId:activeBreakpoint.value,materials,materialCompiler:{supports:()=>true,compile:(item)=>renderExportMaterialMarkup(item)}}));const compiled=(0,vue.computed)(()=>formatCss(compiledResult.value.css??""));const htmlSource=(0,vue.computed)(()=>{const result=compiledResult.value;return `<style>${compiled.value}</style>${formatMarkup(result.html??"")}`;});(0,vue.computed)(()=>`<script setup lang="ts">import{LGrid}from '@composy/layout-vue' import type{LayoutDocument}from '@composy/layout-core' const layoutDocument:LayoutDocument=${JSON.stringify(currentDocument.value,null,2)}<\/script><template><LGrid:document="layoutDocument" breakpoint="${activeBreakpoint.value}"><template #item="{item}"><article class="layout-card"><div class="layout-card__meta"><span class="layout-card__type">{{item.type==='metric'?'\u6570\u636E\u6307\u6807':'\u8D8B\u52BF\u56FE\u8868'}}</span><span class="layout-card__status">\u5DF2\u914D\u7F6E</span></div><h3 class="layout-card__title">{{item.props.title}}</h3><strong v-if="item.props.value!==undefined" class="layout-card__value">{{Number(item.props.value).toLocaleString('zh-CN')}}</strong><span v-else class="layout-card__chart" aria-hidden="true"><i v-for="bar in 5":key="bar"/></span><div class="layout-card__footer"><span>\u5B9E\u65F6\u6570\u636E</span><span class="layout-card__spark">\u8D8B\u52BF\u7A33\u5B9A</span></div></article></template></LGrid></template>`);(0,vue.computed)(()=>`import{Grid}from '@composy/layout-react' import type{LayoutDocument}from '@composy/layout-core' const layoutDocument:LayoutDocument=${JSON.stringify(currentDocument.value,null,2)}export function LayoutPreview(){return(<Grid document={layoutDocument}breakpoint="${activeBreakpoint.value}">{({item})=>(<article className="layout-card"><div className="layout-card__meta"><span className="layout-card__type">{item.type==='metric'?'\u6570\u636E\u6307\u6807':'\u8D8B\u52BF\u56FE\u8868'}</span><span className="layout-card__status">\u5DF2\u914D\u7F6E</span></div><h3 className="layout-card__title">{String(item.props.title)}</h3>{item.props.value!==undefined?(<strong className="layout-card__value">{Number(item.props.value).toLocaleString('zh-CN')}</strong>):(<span className="layout-card__chart" aria-hidden="true">{[1,2,3,4,5].map(bar=><i key={bar}/>)}</span>)}<div className="layout-card__footer"><span>\u5B9E\u65F6\u6570\u636E</span><span className="layout-card__spark">\u8D8B\u52BF\u7A33\u5B9A</span></div></article>)}</Grid>)}`);const generatedVueSource=(0,vue.computed)(()=>{const imports=new Map();const bindings=[];const usedLocals=new Set(["LGrid"]);for(const material of materials.getAll()){const renderer=material.renderers?.vue;if(!renderer?.package||!renderer.exportName)continue;const exportName=renderer.exportName.trim();if(!/^[A-Za-z_$][\w$]*$/.test(exportName))continue;let localName=exportName;let suffix=2;while(usedLocals.has(localName))localName=`${exportName}${suffix++}`;usedLocals.add(localName);const packageImports=imports.get(renderer.package)??[];packageImports.push(localName===exportName?exportName:`${exportName}as ${localName}`);imports.set(renderer.package,packageImports);bindings.push(` ${JSON.stringify(material.type)}:${localName}`);}const importLines=["import{LGrid}from '@composy/layout-vue'",...[...imports.entries()].map(([packageName,exports])=>`import{${exports.join(",")}}from '${packageName}'`)].join("\n");const componentMap=bindings.length?`const materialComponents={${bindings.join(",\n")}}as const`:"const materialComponents:Record<string,never>={}";return `<script setup lang="ts">${importLines}import type{LayoutDocument}from '@composy/layout-core' const layoutDocument:LayoutDocument=${JSON.stringify(currentDocument.value,null,2)}const breakpoint='${activeBreakpoint.value}' ${componentMap}<\/script><template><LGrid:document="layoutDocument":breakpoint="breakpoint"><template #item="{item}"><component:is="materialComponents[item.type as keyof typeof materialComponents]" v-bind="item.props"/></template></LGrid></template><style scoped>${compiled.value}</style>`;});(0,vue.computed)(()=>`import type{LayoutDocument,LayoutNode}from '@composy/layout-core' const layoutDocument:LayoutDocument=${JSON.stringify(currentDocument.value,null,2)}const breakpoint='${activeBreakpoint.value}' const itemClass=(item:LayoutNode)=>\`ldesign-layout-item-\${item.id.replace(/[^a-zA-Z0-9_-]/g,'-')}\` export function LayoutPreview(){return(<section className="ldesign-layout-grid">{layoutDocument.items.map(item=>(<article key={item.id}className={\`\${itemClass(item)}layout-card\`}><div className="layout-card__meta"><span className="layout-card__type">{item.type==='metric'?'\u6570\u636E\u6307\u6807':'\u8D8B\u52BF\u56FE\u8868'}</span><span className="layout-card__status">\u5DF2\u914D\u7F6E</span></div><h3 className="layout-card__title">{String(item.props.title)}</h3>{item.props.value!==undefined?<strong className="layout-card__value">{Number(item.props.value).toLocaleString('zh-CN')}</strong>:<span className="layout-card__chart" aria-hidden="true">{[1,2,3,4,5].map(bar=><i key={bar}/>)}</span>}<div className="layout-card__footer"><span>\u5B9E\u65F6\u6570\u636E</span><span className="layout-card__spark">\u8D8B\u52BF\u7A33\u5B9A</span></div></article>))}</section>)}`.replace(/<span className="layout-card__type">[\s\S]*?<\/span>/g,"<span className=\"layout-card__type\">{item.type}</span>").replace(/<span className="layout-card__status">[\s\S]*?<\/span>/g,"<span className=\"layout-card__status\">&#x5df2;&#x914d;&#x7f6e;</span>").replace(/<div className="layout-card__footer">[\s\S]*?<\/div>/g,"<div className=\"layout-card__footer\"><span>&#x5b9e;&#x65f6;&#x6570;&#x636e;</span><span className=\"layout-card__spark\">&#x7a33;&#x5b9a;</span></div>"));const activeCode=(0,vue.computed)(()=>activeDevelopmentFramework.value==="vue"?generatedVueSource.value:htmlSource.value);const activeCodeLabel=(0,vue.computed)(()=>activeDevelopmentFramework.value==="vue"?"Vue组件代码":"原生代码");const activeCodeExtension=(0,vue.computed)(()=>activeDevelopmentFramework.value==="vue"?"vue":"html");function materialCodeProps(material){return{...material.defaults??{}};}function materialVueCode(material){const renderer=material.renderers?.vue;const exportedName=renderer?.exportName?.trim();const componentName=(exportedName&&/^[A-Za-z_$][\w$]*$/.test(exportedName)?exportedName:void 0)??renderer?.component?.name??material.type.replace(/[^A-Za-z0-9_$]/g,"");const importLine=renderer?.package&&exportedName&&/^[A-Za-z_$][\w$]*$/.test(exportedName)?`import{${componentName}}from '${renderer.package}'`:` const props=materialCodeProps(material);const bindings=Object.entries(props).filter(([,value])=>value!==void 0&&value!==null).map(([key,value])=>`:${key}='${JSON.stringify(value)}'`).join("\n");return `<script setup lang="ts">${importLine}<\/script><!--\u6CE8\u518C\u8868\u7269\u6599\uFF1A${material.type}--><template><${componentName}${bindings?` ${bindings}`:""}/></template>`;}function materialWebComponentCode(material){const tagName=(material.renderers?.webcomponent)?.tagName??`ldesign-${material.type.replace(/[^a-z0-9-]/gi,"-")}`;const attributes=Object.entries(materialCodeProps(material)).filter(([,value])=>value!==void 0&&value!==null).map(([key,value])=>`${key}="${String(value).replace(/"/g,"&quot;")}"`).join("\n ");return `<!--\u6CE8\u518C\u8868\u7269\u6599\uFF1A${material.type}--><!--Web Component \u6807\u7B7E\uFF1A${tagName}--><${tagName}${attributes?` ${attributes}`:""}></${tagName}>`;}const materialCode=(0,vue.computed)(()=>{const material=materialCodeDialog.value;if(!material)return "";return activeDevelopmentFramework.value==="vue"?materialVueCode(material):materialWebComponentCode(material);});const highlightedMaterialCode=(0,vue.computed)(()=>highlightCode(materialCode.value));const materialCodeLineCount=(0,vue.computed)(()=>materialCode.value.split("\n").length);function highlightCode(value){const fragments=[];const stash=(value2,className)=>{return `__LDS_TOKEN_${fragments.push(`<span class="code-token-${className}">${value2}</span>`)-1}__`;};let code=escapeHtml(value);code=code.replace(/(&quot;.*?&quot;|&#39;.*?&#39;|`.*?`)/g,(match)=>stash(match,"string"));code=code.replace(/(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g,(match)=>stash(match,"comment"));code=code.replace(/(^|[;{\n]\s*)([A-Za-z_$][\w$-]*)(?=\s*:)/g,(_,prefix,name)=>`${prefix}${stash(name,"property")}`);code=code.replace(/\b(import|from|const|let|function|return|export|as|type|class|extends|new|true|false|null|undefined)\b/g,(match)=>stash(match,/^(true|false|null|undefined)$/.test(match)?"constant":"keyword"));code=code.replace(/(&lt;\/?[A-Za-z][^&]*?&gt;)/g,(match)=>stash(match,"tag"));let previous="";while(previous!==code&&/__LDS_TOKEN_\d+__/.test(code)){previous=code;code=code.replace(/__LDS_TOKEN_(\d+)__/g,(_,index)=>fragments[Number(index)]??"");}return code;}const highlightedCode=(0,vue.computed)(()=>highlightCode(activeCode.value));const activeCodeLineCount=(0,vue.computed)(()=>activeCode.value.split("\n").length);const canvasSceneStyle=(0,vue.computed)(()=>({width:`${canvasSize.value.width}px`,minHeight:`${canvasSize.value.height}px`,"--canvas-height":`${canvasSize.value.height}px`,"--canvas-grid-height":`${Math.max(180,canvasSize.value.height)}px`,transform:`translate3d(${canvasPan.value.x}px,${canvasPan.value.y}px,0)scale(${canvasZoom.value})`}));const canvasZoomLabel=(0,vue.computed)(()=>`${Math.round(canvasZoom.value*100)}%`);const selectedItem=(0,vue.computed)(()=>layout.value.items.find((item)=>item.id===selected.value));const selectedLocked=(0,vue.computed)(()=>Boolean(selectedItem.value?.state?.locked));const selectedMovable=(0,vue.computed)(()=>selectedItem.value?.constraints?.movable!==false);const selectedResizable=(0,vue.computed)(()=>selectedItem.value?.constraints?.resizable!==false);function add(type){if(!editor)return;const node=editor.addItem({type});editor.updateItem(node.id,(item)=>{for(const bp of Object.values(item.layout))bp.y=30;return item;});editor.select(node.id);}function materialProps(type){return JSON.stringify(materials.get(type)?.defaults??{});}function openMaterialCode(type){const material=materials.get(type);if(!material)return;materialCodeDialog.value=material;materialCodeCopied.value=false;closeFilterMenus();}function closeMaterialCode(){materialCodeDialog.value=void 0;materialCodeCopied.value=false;}async function copyMaterialCode(){if(!materialCode.value||typeof navigator==="undefined")return;try{await navigator.clipboard.writeText(materialCode.value);materialCodeCopied.value=true;window.setTimeout(()=>{materialCodeCopied.value=false;},1500);}catch{materialCodeCopied.value=false;}}function handleMaterialClick(type){add(type);}function toggleFilterMenu(menu){categoryMenuOpen.value=menu==="category"?!categoryMenuOpen.value:false;deviceMenuOpen.value=menu==="device"?!deviceMenuOpen.value:false;developmentModeMenuOpen.value=false;}function toggleDevelopmentModeMenu(){developmentModeMenuOpen.value=!developmentModeMenuOpen.value;categoryMenuOpen.value=false;deviceMenuOpen.value=false;}function closeFilterMenus(){categoryMenuOpen.value=false;deviceMenuOpen.value=false;developmentModeMenuOpen.value=false;}function handleFilterMenuKeydown(event){if(event.key!=="Escape")return;if(!categoryMenuOpen.value&&!developmentModeMenuOpen.value&&!deviceMenuOpen.value)return;closeFilterMenus();event.target?.blur();}function handleFilterOutsidePointerdown(event){const target=event.target;if(!(target instanceof Element))return;if(target.closest("[data-layout-filter-menu]"))return;closeFilterMenus();}function selectMaterialCategory(category){materialCategoryFilter.value=category;closeFilterMenus();}function selectDevelopmentFramework(framework){activeDevelopmentFramework.value=framework;if(typeof window!=="undefined")window.localStorage.setItem("layout-development-framework",framework);closeFilterMenus();(0,vue.nextTick)(()=>{syncVanillaRuntime();syncPreviewDialogRuntime();if(previewMode.value&&editor){editor.setMode("edit");(0,vue.nextTick)(()=>editor?.setMode("preview"));}});}function resetMaterialFilters(){materialQuery.value="";activeMaterialCategory.value=void 0;closeFilterMenus();}function materialIcon(type){return type==="chart"?lucide_vue_next.ChartSpline:lucide_vue_next.ChartNoAxesColumnIncreasing;}function setMaterialElement(type,value){if(value instanceof HTMLElement)materialElements.set(type,value);else materialElements.delete(type);}function syncMaterialSources(){if(!editor)return;const visibleTypes=new Set(visibleMaterials.value.map((material)=>material.type));for(const material of visibleMaterials.value){const element=materialElements.get(material.type);if(!element||materialSourceDisposers.has(material.type))continue;const size=material.defaultLayout??material.size?.default;const dispose=editor.registerExternalDragSource({element,type:material.type,props:{...material.defaults??{}},placement:{x:0,y:0,w:size?.w??1,h:size?.h??1}});materialSourceDisposers.set(material.type,dispose);}for(const[type,dispose]of materialSourceDisposers)if(!visibleTypes.has(type)){dispose();materialSourceDisposers.delete(type);}}(0,vue.watch)([materialQuery,activeMaterialCategory,activeDevelopmentFramework],()=>(0,vue.nextTick)(syncMaterialSources));function removeSelected(){editor?.handleKeyboard({key:"Delete"});}function toggleSelectedLock(){if(!editor||!selected.value)return;if(selectedLocked.value)editor.unlockItem(selected.value);else editor.lockItem(selected.value);}function toggleSelectedConstraint(key){if(!editor||!selected.value)return;editor.updateItem(selected.value,(item)=>{item.constraints={...item.constraints??{},[key]:item.constraints?.[key]===false};return item;});}function undo(){editor?.undo();}function redo(){editor?.redo();}function togglePreview(){const nextMode=previewMode.value?"edit":"preview";editor?.setMode(nextMode);navigate(nextMode==="preview"?"runtime":"editor");}function openPreviewDialog(){previewDialogOpen.value=true;(0,vue.nextTick)(syncPreviewDialogRuntime);}function closePreviewDialog(){previewDialogOpen.value=false;previewDialogRuntimeInstance?.destroy();previewDialogRuntimeInstance=void 0;}function syncPreviewDialogRuntime(){if(activeDevelopmentFramework.value!=="webcomponent"||!previewDialogOpen.value||!previewDialogRuntime.value){previewDialogRuntimeInstance?.destroy();previewDialogRuntimeInstance=void 0;return;}const runtimeDocument=editor?.exportRuntimeDocument()??layout.value;if(!previewDialogRuntimeInstance){previewDialogRuntimeInstance=(0,_composy_layout_runtime.createLayoutRuntime)({container:previewDialogRuntime.value,document:runtimeDocument,materials,observeResize:false,renderItem:({shell,item})=>{const render=()=>setNativeRuntimeCard(shell,item);render();return{update:render};}});previewDialogRuntimeInstance.mount();}else previewDialogRuntimeInstance.update(runtimeDocument);previewDialogRuntimeInstance.setBreakpoint(activeBreakpoint.value);}(0,vue.watch)([previewDialogOpen,activeDevelopmentFramework,activeBreakpoint,layout],()=>(0,vue.nextTick)(syncPreviewDialogRuntime));function syncVanillaRuntime(){if(activeDevelopmentFramework.value!=="webcomponent"||activeRoute.value!=="vanilla"||!vanillaRuntime.value||!editor){vanillaRuntimeInstance?.destroy();vanillaRuntimeInstance=void 0;return;}const document2=editor.exportRuntimeDocument();if(!vanillaRuntimeInstance){vanillaRuntimeInstance=(0,_composy_layout_runtime.createLayoutRuntime)({container:vanillaRuntime.value,document:document2,materials,observeResize:false,renderItem:({shell,item})=>{const render=()=>{setRuntimeCard(shell,item);};render();return{update:render};}});vanillaRuntimeInstance.mount();}else vanillaRuntimeInstance.update(document2);vanillaRuntimeInstance.setBreakpoint(activeBreakpoint.value);}function navigate(route){activeRoute.value=route;if(typeof window!=="undefined")window.location.hash=`/${route}`;if(route==="runtime"){if(editor?.getMode()==="preview")editor.setMode("edit");editor?.setMode("preview");const clearEditorWidgets=()=>{if(activeRoute.value!=="runtime")return;editorGrid.value?.querySelectorAll(".grid-stack-item").forEach((element)=>element.remove());};clearEditorWidgets();(0,vue.nextTick)(clearEditorWidgets);}else if(previewMode.value)editor?.setMode("edit");(0,vue.nextTick)(syncVanillaRuntime);}function select(id){editor?.select(id);}function changeBreakpoint(id){activeBreakpoint.value=id;canvasOrientation.value=id==="mobile"?"portrait":"landscape";editor?.setBreakpoint(id);vanillaRuntimeInstance?.setBreakpoint(id);deviceMenuOpen.value=false;}function selectBreakpoint(id){changeBreakpoint(id);}function toggleCanvasOrientation(){canvasOrientation.value=canvasOrientation.value==="portrait"?"landscape":"portrait";}function clampCanvasZoom(value){return Math.min(2,Math.max(.5,Math.round(value*20)/20));}function setCanvasZoom(value,anchor){const viewport=canvasViewport.value;const previousZoom=canvasZoom.value;const nextZoom=clampCanvasZoom(value);if(!viewport||previousZoom===nextZoom)return;const rect=viewport.getBoundingClientRect();const anchorX=anchor?.x??rect.left+rect.width/2;const anchorY=anchor?.y??rect.top+rect.height/2;const localX=(anchorX-rect.left-canvasPan.value.x)/previousZoom;const localY=(anchorY-rect.top-canvasPan.value.y)/previousZoom;canvasZoom.value=nextZoom;canvasPan.value={x:anchorX-rect.left-localX*nextZoom,y:anchorY-rect.top-localY*nextZoom};}function zoomCanvas(direction){setCanvasZoom(canvasZoom.value+direction*.1);}function resetCanvasView(){canvasZoom.value=1;canvasPan.value={x:0,y:0};}function resetCanvasPan(){canvasPan.value={x:0,y:0};}function toggleTheme(){theme.value=theme.value==="light"?"dark":"light";if(typeof window!=="undefined")window.localStorage.setItem("layout-theme",theme.value);}function handleCanvasWheel(event){event.preventDefault();const direction=event.deltaY<0?1:-1;setCanvasZoom(canvasZoom.value+direction*.08,{x:event.clientX,y:event.clientY});}function handleCanvasPointerDown(event){if(!(canvasTool.value==="pan"||canvasSpacePressed.value||event.button===1)||event.button===2)return;event.preventDefault();event.stopPropagation();event.currentTarget.setPointerCapture?.(event.pointerId);canvasPanning.value=true;canvasPanOrigin.value={x:event.clientX,y:event.clientY,panX:canvasPan.value.x,panY:canvasPan.value.y};}function handleCanvasPointerMove(event){if(!canvasPanning.value)return;const origin=canvasPanOrigin.value;canvasPan.value={x:origin.panX+event.clientX-origin.x,y:origin.panY+event.clientY-origin.y};}function finishCanvasPan(event){if(!canvasPanning.value)return;canvasPanning.value=false;if(event)event.currentTarget.releasePointerCapture?.(event.pointerId);}function handleCanvasKeydown(event){if(event.code==="Space")canvasSpacePressed.value=true;}function handleCanvasKeyup(event){if(event.code==="Space")canvasSpacePressed.value=false;}function handleWorkspaceKeydown(event){if(!editor||event.defaultPrevented)return;const root=editorGrid.value?.closest("[data-layout-workspace]");if(!root||!(event.target instanceof Node)||!root.contains(event.target))return;const key=event.key.toLowerCase();if(!((event.ctrlKey||event.metaKey)&&["c","v","x","d"].includes(key))&&!["delete","backspace"].includes(key))return;editor.handleKeyboard({key:event.key,shiftKey:event.shiftKey,ctrlKey:event.ctrlKey,metaKey:event.metaKey,altKey:event.altKey,preventDefault:()=>event.preventDefault()});}async function copyActiveCode(){const value=activeCode.value;try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(value);else{const textarea=document.createElement("textarea");textarea.value=value;textarea.style.position="fixed";textarea.style.opacity="0";document.body.appendChild(textarea);textarea.select();document.execCommand("copy");textarea.remove();}copied.value=true;window.setTimeout(()=>{copied.value=false;},1600);}catch{copied.value=false;}}function downloadActiveCode(){const blob=new Blob([activeCode.value],{type:"text/plain;charset=utf-8"});const url=URL.createObjectURL(blob);const anchor=document.createElement("a");anchor.href=url;anchor.download=`layout-${activeDevelopmentFramework.value}.${activeCodeExtension.value}`;anchor.click();URL.revokeObjectURL(url);}function handleEditorGridAction(event){const target=event.target;if(!(target instanceof Element))return;const action=target.closest("[data-layout-action]");const widget=target.closest(".grid-stack-item");if(!action||!widget||action.dataset.layoutActionPointer==="true"){if(action?.dataset.layoutActionPointer==="true")delete action.dataset.layoutActionPointer;return;}if(event.type==="pointerdown"){action.dataset.layoutActionPointer="true";event.preventDefault();}const id=widget.getAttribute("gs-id")??widget.getAttribute("data-layout-item-id");if(!id||!editor)return;editor.select(id);const kind=action.dataset.layoutAction;if(kind==="copy")editor.copySelection();else if(kind==="delete")editor.removeItem(id);else if(kind==="lock")if(layout.value.items.find((item)=>item.id===id)?.state?.locked)editor.unlockItem(id);else editor.lockItem(id);}function syncSelection(){const root=editorGrid.value;if(!root)return;root.querySelectorAll(".grid-stack-item").forEach((item)=>{const id=item.getAttribute("gs-id")??item.getAttribute("data-layout-item-id")??"";const node=layout.value.items.find((candidate)=>candidate.id===id);const active=selectedIds.value.includes(id);item.classList.toggle("is-selected",active);item.tabIndex=0;item.setAttribute("role","button");if(node)item.setAttribute("aria-label",`${itemTitle(node)}\uFF0C${materialLabel(node.type)}`);item.setAttribute("aria-pressed",String(active));item.setAttribute("aria-selected",String(active));item.setAttribute("aria-disabled",String(Boolean(node?.state?.locked)));});}function syncInteractionPreview(){if(interactionPreviewFrame!==void 0)return;const flush=()=>{interactionPreviewFrame=void 0;if(!editor)return;layout.value=editor.exportRuntimeDocument();queueMicrotask(syncSelection);};if(typeof window==="undefined")flush();else interactionPreviewFrame=window.requestAnimationFrame(flush);}(0,vue.onMounted)(()=>{if(typeof window!=="undefined"){const savedTheme=window.localStorage.getItem("layout-theme");if(savedTheme==="light"||savedTheme==="dark")theme.value=savedTheme;const savedFramework=window.localStorage.getItem("layout-development-framework");if(savedFramework==="webcomponent"||savedFramework==="vue")activeDevelopmentFramework.value=savedFramework;}if(!editorGrid.value)return;previousGridStackRenderCallback=gridstack.GridStack.renderCB;gridstack.GridStack.renderCB=(element,widget)=>{if(element&&widget?.content!==void 0)element.innerHTML=String(widget.content);};const engine=(0,_composy_layout_gridstack.createGridStackEditorEngine)({container:editorGrid.value,gridOptions:{acceptWidgets:true,animate:false},createGrid:(options)=>gridstack.GridStack.init(options,editorGrid.value),renderItem:({item})=>renderCardMarkup(item,{interactive:true})});editor=(0,_composy_layout_editor.createLayoutEditor)({document:initial,engine,materials,preview:runtimePreview.value?{container:runtimePreview.value,renderItem:({shell,item})=>{const render=()=>{setRuntimeCard(shell,item);};render();return{update:render};}}:void 0});editor.on("document:change",(event)=>{layout.value=event.document;workspaceEmit("update:document",event.document);workspaceEmit("change",event.document);queueMicrotask(syncSelection);syncVanillaRuntime();});editor.on("interaction:move",syncInteractionPreview);editor.on("interaction:resize",syncInteractionPreview);editor.on("selection:change",(event)=>{selected.value=event.primaryId;selectedIds.value=[...event.selectedIds];syncSelection();});editor.on("mode:change",(event)=>{previewMode.value=event.mode==="preview";if(event.mode==="preview"&&activeRoute.value!=="runtime")activeRoute.value="runtime";if(event.mode==="edit"&&activeRoute.value==="runtime")activeRoute.value="editor";(0,vue.nextTick)(syncVanillaRuntime);});editor.mount();editorGrid.value.addEventListener("pointerdown",handleEditorGridAction,true);editorGrid.value.addEventListener("click",handleEditorGridAction,true);disposers.push(()=>editorGrid.value?.removeEventListener("pointerdown",handleEditorGridAction,true));disposers.push(()=>editorGrid.value?.removeEventListener("click",handleEditorGridAction,true));(0,vue.nextTick)(syncMaterialSources);syncSelection();if(typeof window!=="undefined"){activeRoute.value=parseRoute(window.location.hash);const onHashChange=()=>{const next=parseRoute(window.location.hash);if(next!==activeRoute.value)navigate(next);else if(next==="runtime"&&editor?.getMode()!=="preview")editor.setMode("preview");else if(next!=="runtime"&&editor?.getMode()==="preview")editor.setMode("edit");};window.addEventListener("hashchange",onHashChange);disposers.push(()=>window.removeEventListener("hashchange",onHashChange));window.addEventListener("keydown",handleCanvasKeydown);window.addEventListener("keyup",handleCanvasKeyup);window.addEventListener("keydown",handleWorkspaceKeydown);document.addEventListener("pointerdown",handleFilterOutsidePointerdown);document.addEventListener("keydown",handleFilterMenuKeydown);disposers.push(()=>window.removeEventListener("keydown",handleCanvasKeydown));disposers.push(()=>window.removeEventListener("keyup",handleCanvasKeyup));disposers.push(()=>window.removeEventListener("keydown",handleWorkspaceKeydown));disposers.push(()=>document.removeEventListener("pointerdown",handleFilterOutsidePointerdown));disposers.push(()=>document.removeEventListener("keydown",handleFilterMenuKeydown));}if(activeRoute.value==="runtime")editor.setMode("preview");syncVanillaRuntime();});(0,vue.onBeforeUnmount)(()=>{if(interactionPreviewFrame!==void 0&&typeof window!=="undefined")window.cancelAnimationFrame(interactionPreviewFrame);interactionPreviewFrame=void 0;materialSourceDisposers.forEach((dispose)=>dispose());materialSourceDisposers.clear();disposers.splice(0).forEach((dispose)=>dispose());vanillaRuntimeInstance?.destroy();vanillaRuntimeInstance=void 0;previewDialogRuntimeInstance?.destroy();previewDialogRuntimeInstance=void 0;editor?.destroy();if(previousGridStackRenderCallback){gridstack.GridStack.renderCB=previousGridStackRenderCallback;previousGridStackRenderCallback=void 0;}});return(_ctx,_cache)=>{return(0,vue.openBlock)(),(0,vue.createElementBlock)("main",{class:"layout-demo","data-layout-workspace":"","data-theme":theme.value,"data-development-framework":activeDevelopmentFramework.value},[(0,vue.createElementVNode)("header",_hoisted_2,[(0,vue.createElementVNode)("div",_hoisted_3,[(0,vue.createElementVNode)("span",_hoisted_4,[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Grid2X2),{size:18,"stroke-width":1.8})]),_cache[20]||(_cache[20]=(0,vue.createElementVNode)("div",{class:"brand-copy"},[(0,vue.createElementVNode)("strong",null,"布局工作台"),(0,vue.createElementVNode)("span",null,"所见即所得 · 网格布局")],-1)),(0,vue.createElementVNode)("div",{class:(0,vue.normalizeClass)(["development-mode custom-select",{"is-open":developmentModeMenuOpen.value}]),"data-layout-filter-menu":"",onPointerdown:_cache[0]||(_cache[0]=(0,vue.withModifiers)(()=>{},["stop"]))},[(0,vue.createElementVNode)("button",{class:"custom-select__trigger",type:"button","aria-haspopup":"listbox","aria-expanded":developmentModeMenuOpen.value,"aria-label":"开发框架",title:`\u5F53\u524D\u5F00\u53D1\u6846\u67B6\uFF1A${activeDevelopmentFrameworkLabel.value}`,onClick:(0,vue.withModifiers)(toggleDevelopmentModeMenu,["stop"])},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(developmentFrameworks.find((framework)=>framework.id===activeDevelopmentFramework.value)?.icon??(0,vue.unref)(lucide_vue_next.PanelsTopLeft)),{size:14,"stroke-width":1.9,"aria-hidden":"true"})),(0,vue.createElementVNode)("span",null,(0,vue.toDisplayString)(activeDevelopmentFrameworkLabel.value),1),(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.ChevronDown),{size:12,"stroke-width":1.9,"aria-hidden":"true"})],8,_hoisted_5),developmentModeMenuOpen.value?((0,vue.openBlock)(),(0,vue.createElementBlock)("div",_hoisted_6,[((0,vue.openBlock)(),(0,vue.createElementBlock)(vue.Fragment,null,(0,vue.renderList)(developmentFrameworks,(framework)=>{return(0,vue.createElementVNode)("button",{key:framework.id,class:"custom-select__option",type:"button","aria-selected":activeDevelopmentFramework.value===framework.id,onClick:($event)=>selectDevelopmentFramework(framework.id)},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(framework.icon),{size:14,"stroke-width":1.8,"aria-hidden":"true"})),(0,vue.createElementVNode)("span",null,[(0,vue.createElementVNode)("strong",null,(0,vue.toDisplayString)(framework.label),1),(0,vue.createElementVNode)("small",null,(0,vue.toDisplayString)(framework.description),1)])],8,_hoisted_7);}),64))])):(0,vue.createCommentVNode)("v-if",true)],34)]),(0,vue.createElementVNode)("div",_hoisted_8,[(0,vue.createElementVNode)("nav",_hoisted_9,[((0,vue.openBlock)(),(0,vue.createElementBlock)(vue.Fragment,null,(0,vue.renderList)(routes,(demoRoute)=>{return(0,vue.createElementVNode)("button",{key:demoRoute.id,type:"button","aria-current":activeRoute.value===demoRoute.id?"page":void 0,"aria-label":`${demoRoute.label}\u6A21\u5F0F`,title:demoRoute.description,onClick:($event)=>navigate(demoRoute.id)},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(routeIcons[demoRoute.id]),{class:"route-icon",size:15,"stroke-width":1.8,"aria-hidden":"true"})),(0,vue.createElementVNode)("span",null,(0,vue.toDisplayString)(demoRoute.label),1)],8,_hoisted_10);}),64))]),(0,vue.createElementVNode)("div",_hoisted_11,[((0,vue.openBlock)(true),(0,vue.createElementBlock)(vue.Fragment,null,(0,vue.renderList)(layout.value.breakpoints,(breakpoint)=>{return(0,vue.openBlock)(),(0,vue.createElementBlock)("button",{key:breakpoint.id,class:"breakpoint-tab",type:"button","aria-pressed":activeBreakpoint.value===breakpoint.id,"aria-label":`\u5207\u6362\u5230${breakpointLabel(breakpoint.id)}\u753B\u5E03`,title:`${breakpointLabel(breakpoint.id)}\u753B\u5E03`,onClick:($event)=>changeBreakpoint(breakpoint.id)},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(breakpointIcons[breakpoint.id]??(0,vue.unref)(lucide_vue_next.Monitor)),{size:14,"stroke-width":1.8,"aria-hidden":"true"})),(0,vue.createElementVNode)("span",null,(0,vue.toDisplayString)(breakpointLabel(breakpoint.id)),1)],8,_hoisted_12);}),128)),(0,vue.createCommentVNode)("v-if",true)])]),(0,vue.createElementVNode)("div",_hoisted_13,[(0,vue.createElementVNode)("button",{class:"icon-button",type:"button","aria-label":"撤销",title:"撤销",disabled:!(0,vue.unref)(editor)?.canUndo(),onClick:undo},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Undo2),{size:16,"stroke-width":1.9,"aria-hidden":"true"})],8,_hoisted_14),(0,vue.createElementVNode)("button",{class:"icon-button",type:"button","aria-label":"重做",title:"重做",disabled:!(0,vue.unref)(editor)?.canRedo(),onClick:redo},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Redo2),{size:16,"stroke-width":1.9,"aria-hidden":"true"})],8,_hoisted_15),(0,vue.createElementVNode)("button",{class:"icon-button",type:"button","aria-label":"删除选中组件",title:"删除选中组件",disabled:!selected.value,onClick:removeSelected},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Trash2),{size:16,"stroke-width":1.9,"aria-hidden":"true"})],8,_hoisted_16),(0,vue.createElementVNode)("button",{class:"icon-button",type:"button","aria-label":selectedLocked.value?"解锁选中组件":"锁定选中组件",title:selectedLocked.value?"解锁选中组件":"锁定选中组件",disabled:!selected.value,onClick:toggleSelectedLock},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(selectedLocked.value?(0,vue.unref)(lucide_vue_next.Unlock):(0,vue.unref)(lucide_vue_next.Lock)),{size:16,"stroke-width":1.9,"aria-hidden":"true"}))],8,_hoisted_17),(0,vue.createElementVNode)("button",{class:"icon-button",type:"button","aria-label":selectedMovable.value?"禁止移动":"允许移动",title:selectedMovable.value?"禁止移动":"允许移动",disabled:!selected.value||selectedLocked.value,onClick:_cache[1]||(_cache[1]=($event)=>toggleSelectedConstraint("movable"))},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Move),{size:16,"stroke-width":1.9,"aria-hidden":"true"})],8,_hoisted_18),(0,vue.createElementVNode)("button",{class:"icon-button",type:"button","aria-label":selectedResizable.value?"禁止调整大小":"允许调整大小",title:selectedResizable.value?"禁止调整大小":"允许调整大小",disabled:!selected.value||selectedLocked.value,onClick:_cache[2]||(_cache[2]=($event)=>toggleSelectedConstraint("resizable"))},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Maximize2),{size:16,"stroke-width":1.9,"aria-hidden":"true"})],8,_hoisted_19),(0,vue.createElementVNode)("button",{class:"icon-button theme-button",type:"button","aria-label":theme.value==="dark"?"切换到亮色主题":"切换到暗色主题",title:theme.value==="dark"?"切换到亮色主题":"切换到暗色主题",onClick:toggleTheme},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(theme.value==="dark"?(0,vue.unref)(lucide_vue_next.Sun):(0,vue.unref)(lucide_vue_next.Moon)),{size:16,"stroke-width":1.9,"aria-hidden":"true"}))],8,_hoisted_20),(0,vue.createElementVNode)("button",{class:"preview-open-button",type:"button","aria-label":"打开实时预览",title:"打开实时预览",onClick:openPreviewDialog},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Eye),{size:15,"stroke-width":1.9,"aria-hidden":"true"}),_cache[21]||(_cache[21]=(0,vue.createElementVNode)("span",null,"实时预览",-1))]),(0,vue.createElementVNode)("button",{class:"mode-button",type:"button","aria-pressed":previewMode.value,"aria-label":previewMode.value?"返回编辑模式":"进入预览模式",title:previewMode.value?"返回编辑模式":"进入预览模式",onClick:togglePreview},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(previewMode.value?(0,vue.unref)(lucide_vue_next.Pencil):(0,vue.unref)(lucide_vue_next.Eye)),{size:16,"stroke-width":1.9,"aria-hidden":"true"})),(0,vue.createElementVNode)("span",null,(0,vue.toDisplayString)(previewMode.value?"编辑":"预览"),1)],8,_hoisted_21)])]),(0,vue.createElementVNode)("section",_hoisted_22,[(0,vue.createElementVNode)("aside",_hoisted_23,[(0,vue.createElementVNode)("div",_hoisted_24,[_cache[22]||(_cache[22]=(0,vue.createElementVNode)("div",null,[(0,vue.createElementVNode)("span",{class:"eyebrow"},"工作区"),(0,vue.createElementVNode)("h2",null,"物料")],-1)),(0,vue.createElementVNode)("span",_hoisted_25,(0,vue.toDisplayString)((0,vue.unref)(materials).getAll().length),1)]),(0,vue.createElementVNode)("div",_hoisted_26,[(0,vue.createElementVNode)("label",_hoisted_27,[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Search),{size:15,"stroke-width":1.8,"aria-hidden":"true"}),(0,vue.withDirectives)((0,vue.createElementVNode)("input",{"onUpdate:modelValue":_cache[3]||(_cache[3]=($event)=>materialQuery.value=$event),type:"search",placeholder:"搜索物料","aria-label":"搜索物料"},null,512),[[vue.vModelText,materialQuery.value]])]),(0,vue.createElementVNode)("div",{class:"material-filter-row","data-layout-filter-menu":"",onKeydown:(0,vue.withKeys)((0,vue.withModifiers)(handleFilterMenuKeydown,["stop","prevent"]),["esc"])},[(0,vue.createElementVNode)("div",{class:(0,vue.normalizeClass)(["material-select custom-select",{"is-open":categoryMenuOpen.value}]),onPointerdown:_cache[6]||(_cache[6]=(0,vue.withModifiers)(()=>{},["stop"]))},[(0,vue.createElementVNode)("button",{class:"custom-select__trigger",type:"button","aria-haspopup":"listbox","aria-expanded":categoryMenuOpen.value,"aria-label":"物料分类",title:`\u7269\u6599\u5206\u7C7B\uFF1A${activeMaterialCategoryLabel.value}`,onClick:_cache[4]||(_cache[4]=(0,vue.withModifiers)(($event)=>toggleFilterMenu("category"),["stop"]))},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Filter),{size:13,"stroke-width":1.9,"aria-hidden":"true"}),(0,vue.createElementVNode)("span",null,(0,vue.toDisplayString)(activeMaterialCategoryLabel.value),1),(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.ChevronDown),{size:12,"stroke-width":1.9,"aria-hidden":"true"})],8,_hoisted_29),categoryMenuOpen.value?((0,vue.openBlock)(),(0,vue.createElementBlock)("div",_hoisted_30,[(0,vue.createElementVNode)("button",{class:"custom-select__option",type:"button","aria-selected":!materialCategoryFilter.value,onClick:_cache[5]||(_cache[5]=($event)=>selectMaterialCategory(""))}," 全部分类 ",8,_hoisted_31),((0,vue.openBlock)(true),(0,vue.createElementBlock)(vue.Fragment,null,(0,vue.renderList)(materialCategories.value,(category)=>{return(0,vue.openBlock)(),(0,vue.createElementBlock)("button",{key:category.id,class:"custom-select__option",type:"button","aria-selected":materialCategoryFilter.value===category.id,onClick:($event)=>selectMaterialCategory(category.id)},(0,vue.toDisplayString)(category.label),9,_hoisted_32);}),128))])):(0,vue.createCommentVNode)("v-if",true)],34),hasMaterialFilters.value?((0,vue.openBlock)(),(0,vue.createElementBlock)("button",{key:0,class:"material-filter-reset",type:"button","aria-label":"清除物料筛选",title:"清除筛选",onClick:resetMaterialFilters},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.X),{size:13,"stroke-width":1.9,"aria-hidden":"true"})])):(0,vue.createCommentVNode)("v-if",true)],40,_hoisted_28),(0,vue.createElementVNode)("div",_hoisted_33,[(0,vue.createElementVNode)("span",null,(0,vue.toDisplayString)(visibleMaterials.value.length)+"/"+(0,vue.toDisplayString)((0,vue.unref)(materials).getAll().length)+" 个物料",1),hasMaterialFilters.value?((0,vue.openBlock)(),(0,vue.createElementBlock)("span",_hoisted_34,"已筛选")):(0,vue.createCommentVNode)("v-if",true)])]),!visibleMaterials.value.length?((0,vue.openBlock)(),(0,vue.createElementBlock)("div",_hoisted_35,[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Search),{size:17,"stroke-width":1.7,"aria-hidden":"true"}),_cache[23]||(_cache[23]=(0,vue.createElementVNode)("strong",null,"没有匹配的物料",-1)),_cache[24]||(_cache[24]=(0,vue.createElementVNode)("span",null,"试试更换关键词或分类",-1)),hasMaterialFilters.value?((0,vue.openBlock)(),(0,vue.createElementBlock)("button",{key:0,type:"button",onClick:resetMaterialFilters}," 清除筛选 ")):(0,vue.createCommentVNode)("v-if",true)])):(0,vue.createCommentVNode)("v-if",true),((0,vue.openBlock)(true),(0,vue.createElementBlock)(vue.Fragment,null,(0,vue.renderList)(visibleMaterials.value,(material)=>{return(0,vue.openBlock)(),(0,vue.createElementBlock)("div",{key:material.type,ref_for:true,ref:(element)=>setMaterialElement(material.type,element),class:"material-source grid-stack-item",role:"button",tabindex:"0","data-material-type":material.type,"data-layout-material":material.type,"data-layout-props":materialProps(material.type),"aria-label":`\u6DFB\u52A0${material.title??material.label??material.type}`,onClick:($event)=>handleMaterialClick(material.type),onKeydown:[(0,vue.withKeys)(($event)=>add(material.type),["enter"]),(0,vue.withKeys)((0,vue.withModifiers)(($event)=>add(material.type),["prevent"]),["space"])]},[(0,vue.createElementVNode)("span",_hoisted_37,[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(materialIcon(material.type)),{size:18,"stroke-width":1.8}))]),(0,vue.createElementVNode)("span",_hoisted_38,[(0,vue.createElementVNode)("strong",null,(0,vue.toDisplayString)(material.title??material.label??material.type),1),(0,vue.createElementVNode)("small",null,(0,vue.toDisplayString)(material.description??material.categoryLabel??"布局组件"),1)]),(0,vue.createElementVNode)("span",_hoisted_39,[(0,vue.createElementVNode)("span",_hoisted_40,(0,vue.toDisplayString)(material.defaultLayout?.w??material.size?.default.w??1)+" × "+(0,vue.toDisplayString)(material.defaultLayout?.h??material.size?.default.h??1),1),(0,vue.createElementVNode)("span",_hoisted_41,[(0,vue.createElementVNode)("span",{class:(0,vue.normalizeClass)(["material-renderer-badge",{"material-renderer-badge--vue":activeDevelopmentFramework.value==="vue"}]),title:`\u5F53\u524D\u5F00\u53D1\u76EE\u6807\uFF1A${activeDevelopmentFrameworkLabel.value}`},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(activeDevelopmentFramework.value==="vue"?(0,vue.unref)(lucide_vue_next.PanelsTopLeft):(0,vue.unref)(lucide_vue_next.Code2)),{size:11,"stroke-width":1.8,"aria-hidden":"true"})),(0,vue.createElementVNode)("span",null,(0,vue.toDisplayString)(activeDevelopmentFrameworkLabel.value),1)],10,_hoisted_42)])]),(0,vue.createElementVNode)("span",_hoisted_43,[(0,vue.createElementVNode)("button",{class:"material-code-button",type:"button","aria-label":"查看当前物料代码",title:"查看当前物料代码",onPointerdown:_cache[7]||(_cache[7]=(0,vue.withModifiers)(()=>{},["stop"])),onClick:(0,vue.withModifiers)(($event)=>openMaterialCode(material.type),["stop"])},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Code2),{size:14,"stroke-width":1.8,"aria-hidden":"true"})],40,_hoisted_44),(0,vue.createElementVNode)("span",_hoisted_45,[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Plus),{size:16,"stroke-width":1.8})])])],40,_hoisted_36);}),128)),(0,vue.createCommentVNode)("v-if",true),(0,vue.createCommentVNode)("v-if",true)]),(0,vue.createElementVNode)("section",_hoisted_50,[(0,vue.createElementVNode)("div",_hoisted_51,[(0,vue.createElementVNode)("div",{class:(0,vue.normalizeClass)(["canvas-device-control custom-select",{"is-open":deviceMenuOpen.value}]),onPointerdown:_cache[15]||(_cache[15]=(0,vue.withModifiers)(()=>{},["stop"]))},[(0,vue.createElementVNode)("button",{class:"custom-select__trigger",type:"button","aria-haspopup":"listbox","aria-expanded":deviceMenuOpen.value,"aria-label":"设备画布",onClick:_cache[14]||(_cache[14]=(0,vue.withModifiers)(($event)=>toggleFilterMenu("device"),["stop"]))},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(activeBreakpointIcon.value),{size:13,"stroke-width":1.9,"aria-hidden":"true"})),(0,vue.createElementVNode)("span",null,(0,vue.toDisplayString)(breakpointLabel(activeBreakpoint.value)),1),(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.ChevronDown),{size:12,"stroke-width":1.9,"aria-hidden":"true"})],8,_hoisted_52),deviceMenuOpen.value?((0,vue.openBlock)(),(0,vue.createElementBlock)("div",_hoisted_53,[((0,vue.openBlock)(true),(0,vue.createElementBlock)(vue.Fragment,null,(0,vue.renderList)(layout.value.breakpoints,(breakpoint)=>{return(0,vue.openBlock)(),(0,vue.createElementBlock)("button",{key:breakpoint.id,class:"custom-select__option",type:"button","aria-selected":activeBreakpoint.value===breakpoint.id,"aria-label":breakpointLabel(breakpoint.id)+"/"+breakpoint.columns+" 列",onClick:($event)=>selectBreakpoint(breakpoint.id)},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(breakpointIcons[breakpoint.id]??(0,vue.unref)(lucide_vue_next.Monitor)),{size:13,"stroke-width":1.8,"aria-hidden":"true"})),(0,vue.createElementVNode)("span",null,(0,vue.toDisplayString)(breakpointLabel(breakpoint.id)),1),(0,vue.createElementVNode)("span",_hoisted_55,(0,vue.toDisplayString)(breakpoint.columns)+" 列",1)],8,_hoisted_54);}),128))])):(0,vue.createCommentVNode)("v-if",true)],34),(0,vue.createElementVNode)("button",{class:"orientation-button",type:"button","aria-label":canvasOrientation.value==="portrait"?"切换为横屏":"切换为竖屏",title:canvasOrientation.value==="portrait"?"切换为横屏":"切换为竖屏",onClick:toggleCanvasOrientation},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(canvasOrientation.value==="portrait"?(0,vue.unref)(lucide_vue_next.ArrowLeftRight):(0,vue.unref)(lucide_vue_next.ArrowUpDown)),{size:14,"stroke-width":1.9,"aria-hidden":"true"}))],8,_hoisted_56),_cache[27]||(_cache[27]=(0,vue.createElementVNode)("span",{class:"canvas-toolbar__device-divider","aria-hidden":"true"},null,-1)),(0,vue.createElementVNode)("div",_hoisted_57,[(0,vue.createElementVNode)("button",{class:(0,vue.normalizeClass)(["canvas-tool-button",{active:canvasTool.value==="select"}]),type:"button","aria-label":"选择组件",title:"选择组件",onClick:_cache[16]||(_cache[16]=($event)=>canvasTool.value="select")},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.MousePointer2),{size:15,"stroke-width":1.9,"aria-hidden":"true"})],2),(0,vue.createElementVNode)("button",{class:(0,vue.normalizeClass)(["canvas-tool-button",{active:canvasTool.value==="pan"}]),type:"button","aria-label":"移动画布",title:"移动画布(也可按住空格拖动)",onClick:_cache[17]||(_cache[17]=($event)=>canvasTool.value=canvasTool.value==="pan"?"select":"pan")},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Hand),{size:15,"stroke-width":1.9,"aria-hidden":"true"})],2)]),_cache[28]||(_cache[28]=(0,vue.createElementVNode)("div",{class:"canvas-toolbar__divider","aria-hidden":"true"},null,-1)),(0,vue.createElementVNode)("button",{class:"canvas-tool-button",type:"button","aria-label":"缩小画布",title:"缩小画布",onClick:_cache[18]||(_cache[18]=($event)=>zoomCanvas(-1))},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.ZoomOut),{size:15,"stroke-width":1.9,"aria-hidden":"true"})]),(0,vue.createElementVNode)("span",_hoisted_58,(0,vue.toDisplayString)(canvasZoomLabel.value),1),(0,vue.createElementVNode)("button",{class:"canvas-tool-button",type:"button","aria-label":"放大画布",title:"放大画布",onClick:_cache[19]||(_cache[19]=($event)=>zoomCanvas(1))},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.ZoomIn),{size:15,"stroke-width":1.9,"aria-hidden":"true"})]),(0,vue.createElementVNode)("button",{class:"canvas-tool-button",type:"button","aria-label":"适配画布",title:"适配画布",onClick:resetCanvasView},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Scan),{size:15,"stroke-width":1.9,"aria-hidden":"true"})]),(0,vue.createElementVNode)("button",{class:"canvas-tool-button",type:"button","aria-label":"重置画布位置",title:"重置画布位置",onClick:resetCanvasPan},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.RotateCcw),{size:15,"stroke-width":1.9,"aria-hidden":"true"})])]),(0,vue.createElementVNode)("div",{ref_key:"canvasViewport",ref:canvasViewport,class:(0,vue.normalizeClass)(["canvas-viewport",{"is-panning":canvasPanning.value,"is-pan-tool":canvasTool.value==="pan"}]),onWheel:handleCanvasWheel,onPointerdownCapture:handleCanvasPointerDown,onPointermove:handleCanvasPointerMove,onPointerup:finishCanvasPan,onPointercancel:finishCanvasPan},[(0,vue.createElementVNode)("div",{class:(0,vue.normalizeClass)(["canvas-scene",`is-${canvasOrientation.value}`]),"data-canvas-width":canvasSize.value.width,"data-canvas-height":canvasSize.value.height,"data-canvas-orientation":canvasOrientation.value,style:(0,vue.normalizeStyle)(canvasSceneStyle.value)},[(0,vue.withDirectives)((0,vue.createElementVNode)("section",_hoisted_60,[(0,vue.createElementVNode)("header",_hoisted_61,[_cache[30]||(_cache[30]=(0,vue.createElementVNode)("div",null,[(0,vue.createElementVNode)("span",{class:"stage-kicker"},"编辑模式"),(0,vue.createElementVNode)("h2",null,"拖拽布局")],-1)),(0,vue.createElementVNode)("span",_hoisted_62,[_cache[29]||(_cache[29]=(0,vue.createElementVNode)("i",{"aria-hidden":"true"},null,-1)),(0,vue.createTextVNode)((0,vue.toDisplayString)(breakpointLabel(activeBreakpoint.value)),1)])]),(0,vue.createElementVNode)("div",{ref_key:"editorGrid",ref:editorGrid,class:"grid-stack layout-editor-grid",role:"grid","aria-label":"网格布局编辑器","aria-multiselectable":"true"},null,512)],512),[[vue.vShow,activeRoute.value==="editor"&&!previewMode.value]]),(0,vue.withDirectives)((0,vue.createElementVNode)("section",_hoisted_63,[_cache[31]||(_cache[31]=(0,vue.createElementVNode)("header",{class:"stage-header"},[(0,vue.createElementVNode)("div",null,[(0,vue.createElementVNode)("span",{class:"stage-kicker"},"预览模式"),(0,vue.createElementVNode)("h2",null,"组件渲染")]),(0,vue.createElementVNode)("span",{class:"stage-badge"},[(0,vue.createElementVNode)("i",{"aria-hidden":"true"}),(0,vue.createTextVNode)("同步布局")])],-1)),(0,vue.createVNode)((0,vue.unref)(LGrid),{document:layout.value,breakpoint:activeBreakpoint.value,materials:(0,vue.unref)(materials),target:activeDevelopmentFramework.value},{item:(0,vue.withCtx)(({item})=>[(0,vue.createElementVNode)("button",{class:(0,vue.normalizeClass)(["widget layout-item-shell layout-item-shell--interactive",{selected:selected.value===item.id}]),type:"button","aria-label":`${itemTitle(item)}\uFF0C${materialLabel(item.type)}`,onClick:($event)=>select(item.id)},[(0,vue.createVNode)((0,vue.unref)(LMaterialRenderer),(0,vue.mergeProps)({item,materials:(0,vue.unref)(materials),target:activeDevelopmentFramework.value},item.props),null,16,["item","materials","target"])],10,_hoisted_64)]),_:1},8,["document","breakpoint","materials","target"])],512),[[vue.vShow,activeRoute.value==="vue"]]),(0,vue.withDirectives)((0,vue.createElementVNode)("section",{class:"runtime-preview-stage","data-preview-framework":activeDevelopmentFramework.value,"aria-label":"运行时预览画布"},[(0,vue.createElementVNode)("header",_hoisted_66,[_cache[33]||(_cache[33]=(0,vue.createElementVNode)("div",null,[(0,vue.createElementVNode)("span",{class:"stage-kicker"},"预览模式"),(0,vue.createElementVNode)("h2",null,"运行时预览")],-1)),(0,vue.createElementVNode)("span",_hoisted_67,[_cache[32]||(_cache[32]=(0,vue.createElementVNode)("i",{"aria-hidden":"true"},null,-1)),(0,vue.createTextVNode)((0,vue.toDisplayString)(activeDevelopmentFrameworkLabel.value)+" · 只读",1)])]),activeDevelopmentFramework.value==="vue"?((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.unref)(LGrid),{key:0,document:layout.value,breakpoint:activeBreakpoint.value,materials:(0,vue.unref)(materials),target:activeDevelopmentFramework.value},{item:(0,vue.withCtx)(({item})=>[(0,vue.createVNode)((0,vue.unref)(LMaterialRenderer),(0,vue.mergeProps)({item,materials:(0,vue.unref)(materials),target:activeDevelopmentFramework.value,class:"preview-dialog__card"},item.props),null,16,["item","materials","target"])]),_:1},8,["document","breakpoint","materials","target"])):(0,vue.createCommentVNode)("v-if",true),(0,vue.withDirectives)((0,vue.createElementVNode)("div",{ref_key:"runtimePreview",ref:runtimePreview,class:"runtime-preview-grid","data-preview-renderer":"webcomponent"},null,512),[[vue.vShow,activeDevelopmentFramework.value==="webcomponent"]])],8,_hoisted_65),[[vue.vShow,activeRoute.value==="runtime"&&previewMode.value]]),(0,vue.withDirectives)((0,vue.createElementVNode)("section",{class:"vanilla-runtime-stage","data-preview-framework":activeDevelopmentFramework.value,"aria-label":"原生运行时画布"},[(0,vue.createElementVNode)("header",_hoisted_69,[_cache[35]||(_cache[35]=(0,vue.createElementVNode)("div",null,[(0,vue.createElementVNode)("span",{class:"stage-kicker"},"预览模式"),(0,vue.createElementVNode)("h2",null,"原生运行时")],-1)),(0,vue.createElementVNode)("span",_hoisted_70,[_cache[34]||(_cache[34]=(0,vue.createElementVNode)("i",{"aria-hidden":"true"},null,-1)),(0,vue.createTextVNode)((0,vue.toDisplayString)(activeDevelopmentFrameworkLabel.value)+" · 只读",1)])]),activeDevelopmentFramework.value==="vue"?((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.unref)(LGrid),{key:0,document:layout.value,breakpoint:activeBreakpoint.value,materials:(0,vue.unref)(materials),target:activeDevelopmentFramework.value},{item:(0,vue.withCtx)(({item})=>[(0,vue.createVNode)((0,vue.unref)(LMaterialRenderer),(0,vue.mergeProps)({item,materials:(0,vue.unref)(materials),target:activeDevelopmentFramework.value,class:"preview-dialog__card"},item.props),null,16,["item","materials","target"])]),_:1},8,["document","breakpoint","materials","target"])):(0,vue.createCommentVNode)("v-if",true),(0,vue.withDirectives)((0,vue.createElementVNode)("div",{ref_key:"vanillaRuntime",ref:vanillaRuntime,class:"runtime-preview-grid","data-preview-renderer":"webcomponent"},null,512),[[vue.vShow,activeDevelopmentFramework.value==="webcomponent"]])],8,_hoisted_68),[[vue.vShow,activeRoute.value==="vanilla"]])],14,_hoisted_59)],34)]),(0,vue.createElementVNode)("aside",_hoisted_71,[(0,vue.createElementVNode)("div",_hoisted_72,[(0,vue.createElementVNode)("div",null,[_cache[36]||(_cache[36]=(0,vue.createElementVNode)("span",{class:"eyebrow"},"实时输出",-1)),(0,vue.createElementVNode)("h2",null,(0,vue.toDisplayString)(activeCodeLabel.value),1)]),(0,vue.createElementVNode)("button",{class:"copy-code-button",type:"button","aria-label":copied.value?"代码已复制":"复制当前代码",title:copied.value?"代码已复制":"复制当前代码",onClick:copyActiveCode},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(copied.value?(0,vue.unref)(lucide_vue_next.CopyCheck):(0,vue.unref)(lucide_vue_next.Copy)),{size:15,"stroke-width":1.8,"aria-hidden":"true"}))],8,_hoisted_73),(0,vue.createElementVNode)("button",{class:"download-code-button",type:"button","aria-label":"下载当前代码",title:"下载当前代码",onClick:downloadActiveCode},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.Download),{size:15,"stroke-width":1.8,"aria-hidden":"true"})])]),(0,vue.createElementVNode)("pre",_hoisted_74,[(0,vue.createElementVNode)("code",{innerHTML:highlightedCode.value},null,8,_hoisted_75)]),(0,vue.createElementVNode)("div",_hoisted_76,[_cache[37]||(_cache[37]=(0,vue.createElementVNode)("span",{class:"code-status__dot","aria-hidden":"true"},null,-1)),(0,vue.createElementVNode)("span",null,"已根据当前布局、"+(0,vue.toDisplayString)(breakpointLabel(activeBreakpoint.value))+"断点实时生成 · 共 "+(0,vue.toDisplayString)(activeCodeLineCount.value)+" 行,可滚动查看完整输出",1)])])]),(0,vue.createVNode)(vue.Transition,{name:"preview-dialog"},{default:(0,vue.withCtx)(()=>[previewDialogOpen.value?((0,vue.openBlock)(),(0,vue.createElementBlock)("div",{key:0,class:"preview-dialog","data-preview-framework":activeDevelopmentFramework.value,"data-theme":theme.value,role:"dialog","aria-modal":"true","aria-labelledby":"layout-preview-title"},[(0,vue.createElementVNode)("button",{class:"preview-dialog__backdrop",type:"button","aria-label":"关闭实时预览",onClick:closePreviewDialog}),(0,vue.createElementVNode)("section",_hoisted_78,[(0,vue.createElementVNode)("header",_hoisted_79,[_cache[39]||(_cache[39]=(0,vue.createElementVNode)("div",null,[(0,vue.createElementVNode)("span",{class:"stage-kicker"},"真实渲染"),(0,vue.createElementVNode)("h2",{id:"layout-preview-title"},"实时预览")],-1)),(0,vue.createElementVNode)("div",_hoisted_80,[(0,vue.createElementVNode)("span",_hoisted_81,[_cache[38]||(_cache[38]=(0,vue.createElementVNode)("i",{"aria-hidden":"true"},null,-1)),(0,vue.createTextVNode)((0,vue.toDisplayString)(breakpointLabel(activeBreakpoint.value)),1)]),(0,vue.createElementVNode)("button",{class:"icon-button",type:"button","aria-label":"关闭实时预览",title:"关闭实时预览",onClick:closePreviewDialog},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.X),{size:16,"stroke-width":1.9,"aria-hidden":"true"})])])]),(0,vue.createElementVNode)("div",_hoisted_82,[(0,vue.createElementVNode)("div",_hoisted_83,[activeDevelopmentFramework.value==="vue"?((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.unref)(LGrid),{key:0,document:layout.value,breakpoint:activeBreakpoint.value,materials:(0,vue.unref)(materials),target:activeDevelopmentFramework.value},{item:(0,vue.withCtx)(({item})=>[(0,vue.createVNode)((0,vue.unref)(LMaterialRenderer),(0,vue.mergeProps)({item,materials:(0,vue.unref)(materials),target:activeDevelopmentFramework.value,class:"preview-dialog__card"},item.props),null,16,["item","materials","target"])]),_:1},8,["document","breakpoint","materials","target"])):((0,vue.openBlock)(),(0,vue.createElementBlock)("div",{key:1,ref_key:"previewDialogRuntime",ref:previewDialogRuntime,class:"runtime-preview-grid preview-dialog__runtime-grid","data-preview-renderer":"webcomponent"},null,512))])]),(0,vue.createElementVNode)("footer",{class:"preview-dialog__footer"},[_cache[40]||(_cache[40]=(0,vue.createElementVNode)("span",null,"此处展示当前布局的真实 CSS Grid 渲染结果",-1)),(0,vue.createElementVNode)("button",{class:"preview-dialog__close-button",type:"button",onClick:closePreviewDialog}," 关闭预览 ")])])],8,_hoisted_77)):(0,vue.createCommentVNode)("v-if",true)]),_:1}),(0,vue.createVNode)(vue.Transition,{name:"preview-dialog"},{default:(0,vue.withCtx)(()=>[materialCodeDialog.value?((0,vue.openBlock)(),(0,vue.createElementBlock)("div",{key:0,class:"preview-dialog material-code-dialog","data-material-code-dialog":"true","data-material-code-framework":activeDevelopmentFramework.value,"data-material-code-type":materialCodeDialog.value.type,"data-theme":theme.value,role:"dialog","aria-modal":"true","aria-labelledby":"material-code-title"},[(0,vue.createElementVNode)("button",{class:"preview-dialog__backdrop",type:"button","aria-label":"关闭物料代码",onClick:closeMaterialCode}),(0,vue.createElementVNode)("section",_hoisted_85,[(0,vue.createElementVNode)("header",_hoisted_86,[(0,vue.createElementVNode)("div",null,[_cache[41]||(_cache[41]=(0,vue.createElementVNode)("span",{class:"stage-kicker"},"注册表物料",-1)),(0,vue.createElementVNode)("h2",_hoisted_87,(0,vue.toDisplayString)(materialCodeDialog.value.title??materialCodeDialog.value.label??materialCodeDialog.value.type),1),(0,vue.createElementVNode)("p",_hoisted_88,(0,vue.toDisplayString)(activeDevelopmentFramework.value==="vue"?"Vue 3 真实组件用法":"原生 Web Component 标签用法"),1)]),(0,vue.createElementVNode)("div",_hoisted_89,[(0,vue.createElementVNode)("span",_hoisted_90,[_cache[42]||(_cache[42]=(0,vue.createElementVNode)("i",{"aria-hidden":"true"},null,-1)),(0,vue.createTextVNode)((0,vue.toDisplayString)(activeDevelopmentFrameworkLabel.value),1)]),(0,vue.createElementVNode)("button",{class:"icon-button",type:"button","aria-label":"关闭物料代码",title:"关闭物料代码",onClick:closeMaterialCode},[(0,vue.createVNode)((0,vue.unref)(lucide_vue_next.X),{size:16,"stroke-width":1.9,"aria-hidden":"true"})])])]),(0,vue.createElementVNode)("div",_hoisted_91,[(0,vue.createElementVNode)("pre",_hoisted_92,[(0,vue.createElementVNode)("code",{innerHTML:highlightedMaterialCode.value},null,8,_hoisted_93)])]),(0,vue.createElementVNode)("footer",_hoisted_94,[(0,vue.createElementVNode)("span",null,"来自当前注册表的 "+(0,vue.toDisplayString)(activeDevelopmentFramework.value==="vue"?"组件导出":"自定义元素标签")+",共 "+(0,vue.toDisplayString)(materialCodeLineCount.value)+" 行",1),(0,vue.createElementVNode)("div",_hoisted_95,[(0,vue.createElementVNode)("button",{class:"copy-code-button",type:"button","aria-label":materialCodeCopied.value?"代码已复制":"复制物料代码",title:materialCodeCopied.value?"代码已复制":"复制物料代码",onClick:copyMaterialCode},[((0,vue.openBlock)(),(0,vue.createBlock)((0,vue.resolveDynamicComponent)(materialCodeCopied.value?(0,vue.unref)(lucide_vue_next.CopyCheck):(0,vue.unref)(lucide_vue_next.Copy)),{size:15,"stroke-width":1.8,"aria-hidden":"true"}))],8,_hoisted_96),(0,vue.createElementVNode)("button",{class:"preview-dialog__close-button",type:"button",onClick:closeMaterialCode}," 关闭 ")])])])],8,_hoisted_84)):(0,vue.createCommentVNode)("v-if",true)]),_:1})],8,_hoisted_1);};}});LLayoutWorkspace_vue_vue_type_script_setup_true_lang_default.__file="src/components/LLayoutWorkspace.vue";var LLayoutWorkspace_default=LLayoutWorkspace_vue_vue_type_script_setup_true_lang_default;const LMaterialDragSource=(0,vue.defineComponent)({name:"LMaterialDragSource",props:{type:{type:String,default:void 0},material:{type:Object,default:void 0},props:{type:Object,default:()=>({})},placement:{type:Object,default:void 0},editor:{type:Object,required:true}},setup(props,{slots}){let unregister=()=>{};let element;const definition=props.material;const materialType=definition?.type??props.type;if(!materialType)throw new Error("LMaterialDragSource requires type or material.");const materialProps={...definition?.defaults??{},...props.props};const input=()=>({type:materialType,props:materialProps,placement:{x:props.placement?.x??0,y:props.placement?.y??0,w:props.placement?.w??definition?.defaultLayout?.w??definition?.size?.default.w??1,h:props.placement?.h??definition?.defaultLayout?.h??definition?.size?.default.h??1}});const start=(event)=>{props.editor.beginExternalDrag({...input(),element:event.currentTarget,dataTransfer:event.dataTransfer??void 0});};const end=()=>props.editor.endExternalDrag();(0,vue.onMounted)(()=>{if(element)unregister=props.editor.registerExternalDragSource({...input(),element});if(typeof document!=="undefined")document.addEventListener("dragend",end);});(0,vue.onBeforeUnmount)(()=>{unregister();if(typeof document!=="undefined")document.removeEventListener("dragend",end);});return()=>(0,vue.h)("div",{ref:(value)=>{element=value;},class:"ldesign-layout-material-drag-source grid-stack-item","data-material-type":materialType,"data-material-category":definition?.category,"data-material-title":definition?.title??definition?.label,"aria-label":`\u6DFB\u52A0${definition?.title??definition?.label??materialType}`,onDragstart:start},slots.default?.()??definition?.title??definition?.label??materialType);}});function useLayoutEditor(options){const editor=(0,vue.shallowRef)((0,_composy_layout_editor.createLayoutEditor)(options));(0,vue.onMounted)(()=>editor.value.mount());(0,vue.onBeforeUnmount)(()=>editor.value.destroy());return editor;}exports.LGrid=LGrid;exports.LGridItem=LGridItem;exports.LLayoutEditor=LLayoutEditor;exports.LLayoutWorkspace=LLayoutWorkspace_default;exports.LMaterialDragSource=LMaterialDragSource;exports.LMaterialRenderer=LMaterialRenderer;exports.LMetricCard=LMetricCard;exports.LTrendCard=LTrendCard;exports.useLayoutEditor=useLayoutEditor;});
1
+ /*!
2
+ * ***********************************
3
+ * @composy/layout-vue v0.0.1 *
4
+ * Built with rollup *
5
+ * Build time: 2024-10-12 17:52:50 *
6
+ * Build mode: production *
7
+ * Minified: No *
8
+ * ***********************************
9
+ */
10
+ (function(e, t) {
11
+ "object" == typeof exports && "undefined" != typeof module ? t(exports, require("vue"), require("@composy/layout-runtime"), require("@composy/layout-core"), require("@composy/layout-editor"), require("gridstack"), require("gridstack/dist/gridstack.min.css"), require("lucide"), require("lucide-vue-next"), require("@composy/layout-compiler"), require("@composy/layout-gridstack")) : "function" == typeof define && define.amd ? define([
12
+ "exports",
13
+ "vue",
14
+ "@composy/layout-runtime",
15
+ "@composy/layout-core",
16
+ "@composy/layout-editor",
17
+ "gridstack",
18
+ "gridstack/dist/gridstack.min.css",
19
+ "lucide",
20
+ "lucide-vue-next",
21
+ "@composy/layout-compiler",
22
+ "@composy/layout-gridstack"
23
+ ], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).LDesignLayoutVue = {}, e.Vue, e.ComposyLayoutRuntime, e.ComposyLayoutCore, e.ComposyLayoutEditor, e.Gridstack, e["gridstack/dist/gridstack"].min.css, e.Lucide, e.LucideVueNext, e.ComposyLayoutCompiler, e.ComposyLayoutGridstack);
24
+ })(this, function(exports, e, t, a, n, o, r, l, i, s, c) {
25
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
26
+ const d = /* @__PURE__ */ new WeakMap();
27
+ function u(e, t) {
28
+ return function(e) {
29
+ if (e) {
30
+ if (Array.isArray(e)) {
31
+ const t = d.get(e);
32
+ if (t) return t;
33
+ const n = (0, a.createMaterialRegistry)(e);
34
+ return d.set(e, n), n;
35
+ }
36
+ return e;
37
+ }
38
+ }(e)?.get(t);
39
+ }
40
+ function p(t, a, n, o, r = "desktop") {
41
+ const l = u(t, a.type), i = { ...a.props ?? {} };
42
+ if ("vue" === n) {
43
+ const t = l?.renderers?.vue;
44
+ if (t?.component) return (0, e.h)(t.component, i);
45
+ } else {
46
+ const t = l?.renderers?.webcomponent;
47
+ if (t?.tagName) return (0, e.h)(t.tagName, {
48
+ ...i,
49
+ materialProps: i,
50
+ onVnodeMounted: (e) => {
51
+ const t = e.el;
52
+ t && "materialProps" in t && (t.materialProps = i);
53
+ },
54
+ onVnodeUpdated: (e) => {
55
+ const t = e.el;
56
+ t && "materialProps" in t && (t.materialProps = i);
57
+ }
58
+ });
59
+ }
60
+ const s = l?.renderers?.html;
61
+ if (s?.render) {
62
+ const t = s.render({
63
+ item: a,
64
+ placement: o ?? a.layout[r] ?? {
65
+ x: 0,
66
+ y: 0,
67
+ w: 1,
68
+ h: 1
69
+ },
70
+ breakpointId: r
71
+ });
72
+ return "string" == typeof t ? (0, e.h)("div", { innerHTML: m(t) }) : t;
73
+ }
74
+ return s?.tagName ? (0, e.h)(s.tagName, i) : function(t, a, n, o) {
75
+ const r = u(t, a.type), l = {
76
+ item: a,
77
+ placement: n,
78
+ breakpointId: o
79
+ }, i = r?.renderers?.vue;
80
+ if (i?.component) return (0, e.h)(i.component, {
81
+ ...a.props ?? {},
82
+ ...i.tagName ? { is: i.tagName } : {}
83
+ });
84
+ const s = r?.renderers?.webcomponent;
85
+ if (s?.tagName) return (0, e.h)(s.tagName, {
86
+ ...a.props ?? {},
87
+ materialProps: { ...a.props ?? {} }
88
+ });
89
+ const c = r?.renderers?.html;
90
+ if (c?.render) {
91
+ const t = c.render(l);
92
+ return "string" == typeof t ? (0, e.h)("div", { innerHTML: m(t) }) : t;
93
+ }
94
+ return c?.tagName ? (0, e.h)(c.tagName, { ...a.props ?? {} }) : void 0;
95
+ }(t, a, o ?? a.layout[r] ?? {
96
+ x: 0,
97
+ y: 0,
98
+ w: 1,
99
+ h: 1
100
+ }, r);
101
+ }
102
+ function m(e) {
103
+ return e.replace(/<(?:script|style|iframe|object|embed|foreignObject)\b[^>]*>[\s\S]*?<\/(?:script|style|iframe|object|embed|foreignObject)\s*>/gi, "").replace(/<(?:script|style|iframe|object|embed|foreignObject)\b[^>]*>/gi, "").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+(?:href|src|xlink:href|formaction|srcdoc)\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, (e) => /javascript:|data:text\/html/i.test(e) ? "" : e);
104
+ }
105
+ const v = (0, e.defineComponent)({
106
+ name: "LGrid",
107
+ props: {
108
+ document: {
109
+ type: Object,
110
+ required: !0
111
+ },
112
+ breakpoint: {
113
+ type: String,
114
+ default: void 0
115
+ },
116
+ readonly: {
117
+ type: Boolean,
118
+ default: !1
119
+ },
120
+ materials: {
121
+ type: [Object, Array],
122
+ default: void 0
123
+ },
124
+ target: {
125
+ type: String,
126
+ default: "vue"
127
+ }
128
+ },
129
+ setup(a, { slots: n, expose: o }) {
130
+ const r = (0, e.ref)(), l = (0, e.ref)(a.breakpoint ?? a.document.defaultBreakpointId), i = (0, e.computed)(() => a.document.breakpoints.find((e) => e.id === l.value) ?? a.document.breakpoints[0]), s = (0, e.computed)(() => (0, t.resolveGridStyle)(a.document, i.value.id)), c = () => {
131
+ if (a.breakpoint || !r.value) return;
132
+ const e = r.value.getBoundingClientRect().width, t = a.document.breakpoints.find((t) => (void 0 === t.minWidth || e >= t.minWidth) && (void 0 === t.maxWidth || e < t.maxWidth));
133
+ l.value = t?.id ?? a.document.defaultBreakpointId;
134
+ };
135
+ let d;
136
+ return (0, e.onMounted)(() => {
137
+ "undefined" != typeof ResizeObserver && r.value && (d = new ResizeObserver(c), d.observe(r.value)), c();
138
+ }), (0, e.onBeforeUnmount)(() => d?.disconnect()), (0, e.watch)(() => [a.breakpoint, a.document.defaultBreakpointId], ([e, t]) => {
139
+ l.value = e ?? t;
140
+ }), o({ getBreakpoint: () => l.value }), () => (0, e.h)("div", {
141
+ ref: r,
142
+ class: "ldesign-layout-grid",
143
+ style: s.value,
144
+ dir: s.value.direction
145
+ }, a.document.items.map((o) => {
146
+ const r = o.layout[l.value];
147
+ return !r || r.hidden ? null : (0, e.h)("div", {
148
+ class: "ldesign-layout-item",
149
+ "data-layout-item-id": o.id,
150
+ "data-layout-type": o.type,
151
+ style: (0, t.resolveItemStyle)(o, l.value),
152
+ tabindex: a.readonly ? void 0 : 0
153
+ }, n.item?.({
154
+ item: o,
155
+ placement: r,
156
+ breakpointId: l.value
157
+ }) ?? n.default?.({
158
+ item: o,
159
+ placement: r,
160
+ breakpointId: l.value
161
+ }) ?? p(a.materials, o, a.target, r, l.value));
162
+ }));
163
+ }
164
+ }), y = (0, e.defineComponent)({
165
+ name: "LGridItem",
166
+ props: {
167
+ item: {
168
+ type: Object,
169
+ required: !0
170
+ },
171
+ placement: {
172
+ type: Object,
173
+ required: !0
174
+ },
175
+ breakpointId: {
176
+ type: String,
177
+ required: !0
178
+ },
179
+ materials: {
180
+ type: [Object, Array],
181
+ default: void 0
182
+ },
183
+ target: {
184
+ type: String,
185
+ default: "vue"
186
+ }
187
+ },
188
+ setup: (a, { slots: n }) => () => (0, e.h)("div", {
189
+ class: "ldesign-layout-item",
190
+ "data-layout-item-id": a.item.id,
191
+ "data-layout-type": a.item.type,
192
+ style: (0, t.resolveItemStyle)(a.item, a.breakpointId)
193
+ }, n.default?.({
194
+ item: a.item,
195
+ placement: a.placement,
196
+ breakpointId: a.breakpointId
197
+ }) ?? p(a.materials, a.item, a.target, a.placement, a.breakpointId))
198
+ }), f = (0, e.defineComponent)({
199
+ name: "LMaterialRenderer",
200
+ props: {
201
+ item: {
202
+ type: Object,
203
+ required: !0
204
+ },
205
+ materials: {
206
+ type: [Object, Array],
207
+ default: void 0
208
+ },
209
+ target: {
210
+ type: String,
211
+ default: "vue"
212
+ },
213
+ placement: {
214
+ type: Object,
215
+ default: void 0
216
+ },
217
+ breakpointId: {
218
+ type: String,
219
+ default: "desktop"
220
+ }
221
+ },
222
+ setup: (t, { attrs: a }) => () => {
223
+ const n = p(t.materials, t.item, t.target, t.placement, t.breakpointId);
224
+ return n ? (0, e.h)(n, a) : null;
225
+ }
226
+ }), h = (0, e.defineComponent)({
227
+ name: "LLayoutEditor",
228
+ props: {
229
+ document: {
230
+ type: Object,
231
+ required: !0
232
+ },
233
+ engine: {
234
+ type: Object,
235
+ required: !0
236
+ },
237
+ mode: {
238
+ type: String,
239
+ default: "edit"
240
+ },
241
+ preview: Object,
242
+ materials: {
243
+ type: [Object, Array],
244
+ default: void 0
245
+ }
246
+ },
247
+ emits: [
248
+ "update:document",
249
+ "change",
250
+ "ready"
251
+ ],
252
+ setup(t, { slots: a, emit: o, expose: r }) {
253
+ const l = (0, e.shallowRef)((0, n.createLayoutEditor)({
254
+ document: t.document,
255
+ engine: t.engine,
256
+ materials: t.materials,
257
+ preview: t.preview
258
+ }));
259
+ let i = JSON.stringify(t.document);
260
+ (0, e.onMounted)(() => {
261
+ l.value.on("document:change", (e) => {
262
+ i = JSON.stringify(e.document), o("update:document", e.document), o("change", e);
263
+ }), l.value.mount(), l.value.setMode(t.mode), o("ready", l.value);
264
+ }), (0, e.watch)(() => t.document, (e) => {
265
+ const t = JSON.stringify(e);
266
+ t !== i && (l.value.load(e), i = t);
267
+ }), (0, e.watch)(() => t.mode, (e) => l.value.setMode(e));
268
+ const s = (e) => {
269
+ l.value.handleKeyboard(e);
270
+ };
271
+ return (0, e.onBeforeUnmount)(() => l.value.destroy()), r({ editor: l }), () => (0, e.h)("div", {
272
+ class: "ldesign-layout-editor",
273
+ "data-layout-mode": t.mode,
274
+ "aria-keyshortcuts": "ArrowLeft ArrowRight ArrowUp ArrowDown Delete Control+C Control+V Control+X Control+D",
275
+ onKeydown: s
276
+ }, a.default?.({ editor: l.value }));
277
+ }
278
+ }), b = (0, e.defineComponent)({
279
+ name: "LMetricCard",
280
+ props: {
281
+ title: {
282
+ type: String,
283
+ default: "数据指标"
284
+ },
285
+ value: {
286
+ type: [String, Number],
287
+ default: void 0
288
+ }
289
+ },
290
+ setup: (t) => () => (0, e.h)("article", {
291
+ class: "layout-card",
292
+ "data-layout-card": ""
293
+ }, [
294
+ (0, e.h)("div", { class: "layout-card__meta" }, [(0, e.h)("span", { class: "layout-card__type" }, "数据指标"), (0, e.h)("span", { class: "layout-card__status" }, "已配置")]),
295
+ (0, e.h)("h3", { class: "layout-card__title" }, t.title),
296
+ void 0 === t.value ? null : (0, e.h)("strong", { class: "layout-card__value" }, Number(t.value).toLocaleString("zh-CN")),
297
+ (0, e.h)("div", { class: "layout-card__footer" }, [(0, e.h)("span", null, "实时数据"), (0, e.h)("span", { class: "layout-card__spark" }, "趋势稳定")])
298
+ ])
299
+ }), g = (0, e.defineComponent)({
300
+ name: "LTrendCard",
301
+ props: { title: {
302
+ type: String,
303
+ default: "趋势图表"
304
+ } },
305
+ setup: (t) => () => (0, e.h)("article", {
306
+ class: "layout-card",
307
+ "data-layout-card": ""
308
+ }, [
309
+ (0, e.h)("div", { class: "layout-card__meta" }, [(0, e.h)("span", { class: "layout-card__type" }, "趋势图表"), (0, e.h)("span", { class: "layout-card__status" }, "已配置")]),
310
+ (0, e.h)("h3", { class: "layout-card__title" }, t.title),
311
+ (0, e.h)("span", {
312
+ class: "layout-card__chart",
313
+ "aria-hidden": "true"
314
+ }, Array.from({ length: 5 }, (t, a) => (0, e.h)("i", { key: a }))),
315
+ (0, e.h)("div", { class: "layout-card__footer" }, [(0, e.h)("span", null, "实时数据"), (0, e.h)("span", { class: "layout-card__spark" }, "趋势稳定")])
316
+ ])
317
+ }), k = ["data-theme", "data-development-framework"], w = { class: "topbar" }, N = { class: "brand" }, E = {
318
+ class: "brand-mark",
319
+ "aria-hidden": "true"
320
+ }, _ = ["aria-expanded", "title"], V = {
321
+ key: 0,
322
+ class: "custom-select__menu development-mode__menu",
323
+ role: "listbox"
324
+ }, C = ["aria-selected", "onClick"], x = {
325
+ class: "topbar-center",
326
+ "aria-hidden": "true",
327
+ style: { display: "none" }
328
+ }, L = {
329
+ class: "route-tabs",
330
+ "aria-label": "工作区模式"
331
+ }, S = [
332
+ "aria-current",
333
+ "aria-label",
334
+ "title",
335
+ "onClick"
336
+ ], $ = {
337
+ class: "breakpoint-tabs",
338
+ "aria-label": "画布尺寸"
339
+ }, B = [
340
+ "aria-pressed",
341
+ "aria-label",
342
+ "title",
343
+ "onClick"
344
+ ], D = { class: "actions" }, z = ["disabled"], M = ["disabled"], T = ["disabled"], A = [
345
+ "aria-label",
346
+ "title",
347
+ "disabled"
348
+ ], O = [
349
+ "aria-label",
350
+ "title",
351
+ "disabled"
352
+ ], I = [
353
+ "aria-label",
354
+ "title",
355
+ "disabled"
356
+ ], j = ["aria-label", "title"], P = [
357
+ "aria-pressed",
358
+ "aria-label",
359
+ "title"
360
+ ], R = { class: "workspace" }, q = {
361
+ class: "materials panel-scroll",
362
+ "data-layout-panel": "materials",
363
+ "aria-label": "物料面板"
364
+ }, G = { class: "panel-heading" }, K = { class: "panel-count" }, W = { class: "material-toolbar" }, U = { class: "material-search" }, H = ["onKeydown"], X = ["aria-expanded", "title"], J = {
365
+ key: 0,
366
+ class: "custom-select__menu",
367
+ role: "listbox"
368
+ }, F = ["aria-selected"], Z = ["aria-selected", "onClick"], Y = { class: "material-result-summary" }, Q = { key: 0 }, ee = {
369
+ key: 0,
370
+ class: "material-empty"
371
+ }, te = [
372
+ "data-material-type",
373
+ "data-layout-material",
374
+ "data-layout-props",
375
+ "aria-label",
376
+ "onClick",
377
+ "onKeydown"
378
+ ], ae = {
379
+ class: "material-icon material-icon--metric",
380
+ "aria-hidden": "true"
381
+ }, ne = { class: "material-copy" }, oe = { class: "material-card-meta" }, re = { class: "material-size" }, le = { class: "material-renderer-badges" }, ie = ["title"], se = { class: "material-card-actions" }, ce = ["onClick"], de = {
382
+ class: "material-add",
383
+ "aria-hidden": "true"
384
+ }, ue = {
385
+ class: "canvas panel-scroll",
386
+ "data-layout-panel": "canvas",
387
+ "aria-label": "布局画布"
388
+ }, pe = {
389
+ class: "canvas-toolbar",
390
+ "aria-label": "画布操作"
391
+ }, me = ["aria-expanded"], ve = {
392
+ key: 0,
393
+ class: "custom-select__menu",
394
+ role: "listbox"
395
+ }, ye = [
396
+ "aria-selected",
397
+ "aria-label",
398
+ "onClick"
399
+ ], fe = { class: "custom-select__option-meta" }, he = ["aria-label", "title"], be = { class: "canvas-toolbar__group" }, ge = {
400
+ class: "canvas-zoom-label",
401
+ "aria-live": "polite"
402
+ }, ke = [
403
+ "data-canvas-width",
404
+ "data-canvas-height",
405
+ "data-canvas-orientation"
406
+ ], we = {
407
+ class: "editor-stage",
408
+ "aria-label": "可视化编辑画布"
409
+ }, Ne = { class: "stage-header" }, Ee = { class: "stage-badge" }, _e = {
410
+ class: "preview-stage",
411
+ "aria-label": "组件预览画布"
412
+ }, Ve = ["aria-label", "onClick"], Ce = ["data-preview-framework"], xe = { class: "stage-header" }, Le = { class: "stage-badge" }, Se = ["data-preview-framework"], $e = { class: "stage-header" }, Be = { class: "stage-badge" }, De = {
413
+ class: "inspectors panel-scroll",
414
+ "data-layout-panel": "inspector",
415
+ "aria-label": "代码检查面板"
416
+ }, ze = { class: "inspector-heading" }, Me = ["aria-label", "title"], Te = {
417
+ class: "code-block",
418
+ "data-code-output": ""
419
+ }, Ae = ["innerHTML"], Oe = { class: "code-status" }, Ie = ["data-preview-framework", "data-theme"], je = { class: "preview-dialog__panel" }, Pe = { class: "preview-dialog__header" }, Re = { class: "preview-dialog__header-meta" }, qe = { class: "stage-badge" }, Ge = { class: "preview-dialog__body" }, Ke = { class: "preview-dialog__canvas" }, We = [
420
+ "data-material-code-framework",
421
+ "data-material-code-type",
422
+ "data-theme"
423
+ ], Ue = { class: "preview-dialog__panel material-code-dialog__panel" }, He = { class: "preview-dialog__header" }, Xe = { id: "material-code-title" }, Je = { class: "material-code-dialog__subtitle" }, Fe = { class: "preview-dialog__header-meta" }, Ze = { class: "stage-badge" }, Ye = { class: "preview-dialog__body material-code-dialog__body" }, Qe = { class: "code-block material-code-dialog__code" }, et = ["innerHTML"], tt = { class: "preview-dialog__footer" }, at = { class: "material-code-dialog__actions" }, nt = ["aria-label", "title"];
424
+ var ot = (0, e.defineComponent)({
425
+ __name: "LLayoutWorkspace",
426
+ props: {
427
+ document: {
428
+ type: Object,
429
+ required: !1
430
+ },
431
+ materials: {
432
+ type: [Object, Array],
433
+ required: !1
434
+ },
435
+ theme: {
436
+ type: String,
437
+ required: !1
438
+ }
439
+ },
440
+ emits: ["update:document", "change"],
441
+ setup(r, { emit: d }) {
442
+ const u = r, p = d, m = [
443
+ {
444
+ id: "editor",
445
+ label: "编辑",
446
+ description: "可视化编辑工作区"
447
+ },
448
+ {
449
+ id: "vanilla",
450
+ label: "原生",
451
+ description: "原生运行时渲染"
452
+ },
453
+ {
454
+ id: "runtime",
455
+ label: "预览",
456
+ description: "网格布局运行时预览"
457
+ },
458
+ {
459
+ id: "vue",
460
+ label: "组件",
461
+ description: "组件适配器"
462
+ }
463
+ ], y = {
464
+ desktop: i.Monitor,
465
+ tablet: i.Tablet,
466
+ mobile: i.Smartphone
467
+ }, h = {
468
+ editor: i.Grid2X2,
469
+ vanilla: i.Code2,
470
+ runtime: i.Eye,
471
+ vue: i.PanelsTopLeft
472
+ }, ot = [{
473
+ id: "webcomponent",
474
+ label: "原生",
475
+ description: "原生 Web Component 物料",
476
+ icon: i.Code2
477
+ }, {
478
+ id: "vue",
479
+ label: "Vue 3",
480
+ description: "Vue 3 组件物料",
481
+ icon: i.PanelsTopLeft
482
+ }];
483
+ function rt(e) {
484
+ return e.replace(/[&<>'"]/g, (e) => ({
485
+ "&": "&amp;",
486
+ "<": "&lt;",
487
+ ">": "&gt;",
488
+ "'": "&#39;",
489
+ "\"": "&quot;"
490
+ })[e] ?? e);
491
+ }
492
+ function lt(e) {
493
+ return String(e.props?.title ?? e.id);
494
+ }
495
+ function it(e) {
496
+ return yt.get(e)?.title ?? yt.get(e)?.label ?? e;
497
+ }
498
+ function st(e) {
499
+ return "desktop" === e ? "桌面" : "tablet" === e ? "平板" : "手机";
500
+ }
501
+ function ct(e) {
502
+ if ("undefined" == typeof document) return "";
503
+ const t = (0, l.createElement)(l.icons[e]);
504
+ return t.setAttribute("width", "13"), t.setAttribute("height", "13"), t.setAttribute("stroke-width", "1.9"), t.setAttribute("aria-hidden", "true"), t.outerHTML;
505
+ }
506
+ function dt(e, t = {}) {
507
+ const a = it(e.type), n = rt(lt(e)), o = e.props?.value, r = void 0 === o ? "<span class=\"layout-card__chart\" aria-hidden=\"true\"><i></i><i></i><i></i><i></i><i></i></span>" : `<strong class="layout-card__value">${rt(new Intl.NumberFormat("zh-CN").format(Number(o)))}</strong>`;
508
+ return `<article class="layout-card" data-layout-card data-layout-type="${rt(e.type)}">\n ${t.interactive ? `<div class="layout-card__actions" data-layout-actions>\n <button class="layout-card__action" type="button" data-layout-action="copy" aria-disabled="false" aria-label="复制物料" title="复制物料">${ct("Copy")}</button>\n <button class="layout-card__action" type="button" data-layout-action="delete" aria-disabled="false" aria-label="删除物料" title="删除物料">${ct("Trash2")}</button>\n <button class="layout-card__action" type="button" data-layout-action="lock" aria-disabled="false" aria-label="${e.state?.locked ? "解锁物料" : "锁定物料"}" title="${e.state?.locked ? "解锁物料" : "锁定物料"}">${ct(e.state?.locked ? "Unlock" : "Lock")}</button>\n </div>` : ""}\n <div class="layout-card__meta"><span class="layout-card__type">${rt(a)}</span><span class="layout-card__status">已配置</span></div>\n <h3 class="layout-card__title">${n}</h3>\n ${r}\n <div class="layout-card__footer"><span>实时数据</span><span class="layout-card__spark">趋势稳定</span></div>\n </article>`;
509
+ }
510
+ function ut(e, t) {
511
+ const a = (yt.get(t.type)?.renderers?.webcomponent)?.tagName;
512
+ if (e.className = "layout-item-shell", e.dataset.layoutType = t.type, e.dataset.materialRenderer = "webcomponent", !a || !/^[a-z][a-z0-9.-]*$/i.test(a)) return void (e.innerHTML = dt(t));
513
+ (function(e, t) {
514
+ if ("undefined" != typeof customElements && /^[a-z][a-z0-9.-]*$/i.test(e) && !customElements.get(e)) {
515
+ class a extends HTMLElement {
516
+ constructor() {
517
+ super(...arguments), this.props = {};
518
+ }
519
+ static get observedAttributes() {
520
+ return ["title", "value"];
521
+ }
522
+ get materialProps() {
523
+ return { ...this.props };
524
+ }
525
+ set materialProps(e) {
526
+ this.props = { ...e ?? {} }, this.render();
527
+ }
528
+ connectedCallback() {
529
+ this.render();
530
+ }
531
+ attributeChangedCallback() {
532
+ Object.keys(this.props).length || this.render();
533
+ }
534
+ attributeProps() {
535
+ const e = {};
536
+ for (const t of Array.from(this.attributes)) "class" !== t.name && "style" !== t.name && (e[t.name] = "value" !== t.name || "" === t.value || Number.isNaN(Number(t.value)) ? t.value : Number(t.value));
537
+ return e;
538
+ }
539
+ render() {
540
+ const e = Object.keys(this.props).length ? this.props : this.attributeProps();
541
+ this.style.display = "block", this.style.width = "100%", this.style.height = "100%", this.innerHTML = dt({
542
+ id: `native-${t}`,
543
+ type: t,
544
+ layout: {},
545
+ props: e
546
+ });
547
+ }
548
+ }
549
+ customElements.define(e, a);
550
+ }
551
+ })(a, t.type);
552
+ const n = e.ownerDocument.createElement(a);
553
+ n.materialProps = { ...t.props ?? {} }, e.replaceChildren(n);
554
+ }
555
+ function pt(e, t) {
556
+ "webcomponent" !== Vt.value ? (e.className = "layout-item-shell", e.dataset.layoutType = t.type, e.dataset.materialRenderer = "vue", e.innerHTML = dt(t)) : ut(e, t);
557
+ }
558
+ function mt(e) {
559
+ const t = e.replace(/^#\/?/, "");
560
+ return m.some((e) => e.id === t) ? t : "editor";
561
+ }
562
+ const vt = [{
563
+ type: "metric",
564
+ order: 1,
565
+ title: "数据指标",
566
+ category: "data",
567
+ categoryLabel: "数据组件",
568
+ description: "数值与摘要",
569
+ keywords: [
570
+ "指标",
571
+ "数值",
572
+ "KPI"
573
+ ],
574
+ tags: ["数据", "卡片"],
575
+ defaultLayout: {
576
+ w: 4,
577
+ h: 8
578
+ },
579
+ size: {
580
+ default: {
581
+ w: 4,
582
+ h: 8
583
+ },
584
+ min: {
585
+ w: 2,
586
+ h: 4
587
+ },
588
+ max: {
589
+ w: 12,
590
+ h: 20
591
+ },
592
+ step: {
593
+ w: 1,
594
+ h: 1
595
+ }
596
+ },
597
+ constraints: {
598
+ movable: !0,
599
+ resizable: !0
600
+ },
601
+ defaults: {
602
+ title: "新建指标",
603
+ value: 0
604
+ },
605
+ renderers: {
606
+ html: {
607
+ kind: "html",
608
+ tagName: "article"
609
+ },
610
+ webcomponent: {
611
+ kind: "webcomponent",
612
+ tagName: "ldesign-metric-card"
613
+ },
614
+ vue: {
615
+ kind: "vue",
616
+ package: "@composy/layout-vue",
617
+ exportName: "LMetricCard",
618
+ component: b
619
+ }
620
+ }
621
+ }, {
622
+ type: "chart",
623
+ order: 2,
624
+ title: "趋势图表",
625
+ category: "visual",
626
+ categoryLabel: "可视化组件",
627
+ description: "变化与走向",
628
+ keywords: [
629
+ "趋势",
630
+ "图表",
631
+ "分析"
632
+ ],
633
+ tags: ["可视化", "卡片"],
634
+ defaultLayout: {
635
+ w: 4,
636
+ h: 10
637
+ },
638
+ size: {
639
+ default: {
640
+ w: 4,
641
+ h: 10
642
+ },
643
+ min: {
644
+ w: 3,
645
+ h: 6
646
+ },
647
+ max: {
648
+ w: 12,
649
+ h: 24
650
+ },
651
+ step: {
652
+ w: 1,
653
+ h: 1
654
+ }
655
+ },
656
+ constraints: {
657
+ movable: !0,
658
+ resizable: !0
659
+ },
660
+ defaults: { title: "营收趋势" },
661
+ renderers: {
662
+ html: {
663
+ kind: "html",
664
+ tagName: "article"
665
+ },
666
+ webcomponent: {
667
+ kind: "webcomponent",
668
+ tagName: "ldesign-trend-card"
669
+ },
670
+ vue: {
671
+ kind: "vue",
672
+ package: "@composy/layout-vue",
673
+ exportName: "LTrendCard",
674
+ component: g
675
+ }
676
+ }
677
+ }];
678
+ const yt = (ft = u.materials) ? Array.isArray(ft) ? (0, a.createMaterialRegistry)(ft) : ft : (0, a.createMaterialRegistry)(vt);
679
+ var ft;
680
+ const ht = u.document ?? (0, a.createLayoutDocument)({
681
+ id: "layout-alpha-demo",
682
+ breakpoints: a.responsiveWebBreakpoints.map((e) => ({ ...e })),
683
+ defaultBreakpointId: "desktop",
684
+ items: [
685
+ {
686
+ id: "sales",
687
+ type: "metric",
688
+ props: {
689
+ title: "月度销售额",
690
+ value: 12840
691
+ },
692
+ layout: {
693
+ desktop: {
694
+ x: 0,
695
+ y: 0,
696
+ w: 4,
697
+ h: 10
698
+ },
699
+ tablet: {
700
+ x: 0,
701
+ y: 0,
702
+ w: 4,
703
+ h: 10
704
+ },
705
+ mobile: {
706
+ x: 0,
707
+ y: 0,
708
+ w: 4,
709
+ h: 8
710
+ }
711
+ }
712
+ },
713
+ {
714
+ id: "orders",
715
+ type: "metric",
716
+ props: {
717
+ title: "待处理订单",
718
+ value: 86
719
+ },
720
+ layout: {
721
+ desktop: {
722
+ x: 4,
723
+ y: 0,
724
+ w: 4,
725
+ h: 10
726
+ },
727
+ tablet: {
728
+ x: 4,
729
+ y: 0,
730
+ w: 4,
731
+ h: 10
732
+ },
733
+ mobile: {
734
+ x: 0,
735
+ y: 8,
736
+ w: 4,
737
+ h: 8
738
+ }
739
+ }
740
+ },
741
+ {
742
+ id: "revenue",
743
+ type: "chart",
744
+ props: { title: "营收预测" },
745
+ layout: {
746
+ desktop: {
747
+ x: 8,
748
+ y: 0,
749
+ w: 4,
750
+ h: 18
751
+ },
752
+ tablet: {
753
+ x: 0,
754
+ y: 10,
755
+ w: 8,
756
+ h: 14
757
+ },
758
+ mobile: {
759
+ x: 0,
760
+ y: 16,
761
+ w: 4,
762
+ h: 12
763
+ }
764
+ }
765
+ }
766
+ ]
767
+ }), bt = (0, e.ref)(), gt = (0, e.ref)(), kt = (0, e.ref)(), wt = (0, e.ref)(), Nt = (0, e.ref)(), Et = (0, e.ref)(""), _t = (0, e.ref)(), Vt = (0, e.ref)("vue"), Ct = /* @__PURE__ */ new Map(), xt = /* @__PURE__ */ new Map(), Lt = (0, e.computed)(() => yt.getCategories()), St = (0, e.computed)(() => _t.value ? Lt.value.find((e) => e.id === _t.value)?.label ?? "全部分类" : "全部分类"), $t = (0, e.computed)(() => "webcomponent" === Vt.value ? "原生" : "Vue 3"), Bt = (0, e.computed)({
768
+ get: () => _t.value ?? "",
769
+ set: (e) => {
770
+ _t.value = e || void 0;
771
+ }
772
+ }), Dt = (0, e.computed)(() => Boolean(Et.value.trim()) || Boolean(_t.value)), zt = (0, e.computed)(() => yt.search({
773
+ query: Et.value,
774
+ category: _t.value,
775
+ framework: Vt.value
776
+ })), Mt = (0, e.ref)(structuredClone(ht)), Tt = (0, e.ref)(), At = (0, e.ref)([]), Ot = (0, e.ref)("desktop"), It = (0, e.ref)("landscape"), jt = (0, e.ref)(!1), Pt = (0, e.ref)(!1), Rt = (0, e.ref)(!1), qt = (0, e.ref)(!1), Gt = (0, e.ref)(!1), Kt = (0, e.ref)(!1), Wt = (0, e.ref)(), Ut = (0, e.ref)(!1), Ht = (0, e.ref)("editor"), Xt = (0, e.ref)(u.theme ?? "light"), Jt = (0, e.ref)(1), Ft = (0, e.ref)({
777
+ x: 0,
778
+ y: 0
779
+ }), Zt = (0, e.ref)("select"), Yt = (0, e.ref)(!1), Qt = (0, e.ref)(!1), ea = (0, e.ref)({
780
+ x: 0,
781
+ y: 0,
782
+ panX: 0,
783
+ panY: 0
784
+ });
785
+ let ta, aa, na, oa, ra;
786
+ const la = [], ia = (0, e.computed)(() => Mt.value), sa = (0, e.computed)(() => ({
787
+ desktop: {
788
+ landscape: {
789
+ width: 1200,
790
+ height: 760
791
+ },
792
+ portrait: {
793
+ width: 760,
794
+ height: 1200
795
+ }
796
+ },
797
+ tablet: {
798
+ landscape: {
799
+ width: 1024,
800
+ height: 768
801
+ },
802
+ portrait: {
803
+ width: 768,
804
+ height: 1024
805
+ }
806
+ },
807
+ mobile: {
808
+ landscape: {
809
+ width: 844,
810
+ height: 390
811
+ },
812
+ portrait: {
813
+ width: 390,
814
+ height: 844
815
+ }
816
+ }
817
+ })[Ot.value]?.[It.value] ?? {
818
+ width: 1200,
819
+ height: 760
820
+ }), ca = (0, e.computed)(() => y[Ot.value] ?? i.Monitor);
821
+ (0, e.computed)(() => JSON.stringify(ia.value, null, 2));
822
+ const da = (0, e.computed)(() => (0, s.compileLayout)(ia.value, {
823
+ target: "html-css",
824
+ breakpointId: Ot.value,
825
+ materials: yt,
826
+ materialCompiler: {
827
+ supports: () => !0,
828
+ compile: (e) => function(e) {
829
+ const t = (yt.get(e.type)?.renderers?.webcomponent)?.tagName;
830
+ if (!t || !/^[a-z][a-z0-9.-]*$/i.test(t)) return dt(e);
831
+ const a = Object.entries(e.props ?? {}).filter(([, e]) => null != e).filter(([, e]) => "object" != typeof e && "function" != typeof e).map(([e, t]) => `${e.replace(/[^a-zA-Z0-9:_.-]/g, "-")}="${rt(String(t))}"`).join(" ");
832
+ return `<${t}${a ? ` ${a}` : ""}></${t}>`;
833
+ }(e)
834
+ }
835
+ })), ua = (0, e.computed)(() => function(e) {
836
+ let t = 0;
837
+ return e.replace(/\s*\{\s*/g, " {\n").replace(/\s*;\s*/g, ";\n").replace(/\s*\}\s*/g, "\n}\n").split("\n").map((e) => e.trim()).filter(Boolean).map((e) => {
838
+ e.startsWith("}") && (t = Math.max(0, t - 1));
839
+ const a = `${" ".repeat(t)}${e}`;
840
+ return e.endsWith("{") && (t += 1), a;
841
+ }).join("\n");
842
+ }(da.value.css ?? "")), pa = (0, e.computed)(() => {
843
+ const e = da.value;
844
+ return `<style>\n${ua.value}\n</style>\n\n${function(e) {
845
+ const t = e.replace(/></g, ">\n<").split("\n");
846
+ let a = 0;
847
+ return t.map((e) => {
848
+ const t = e.trim();
849
+ if (!t) return "";
850
+ t.startsWith("</") && (a = Math.max(0, a - 1));
851
+ const n = `${" ".repeat(a)}${t}`;
852
+ return !t.startsWith("<") || t.startsWith("</") || t.startsWith("<!") || t.startsWith("<?") || t.endsWith("/>") || /^<(?:area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)\b/i.test(t) || (a += 1), n;
853
+ }).filter(Boolean).join("\n");
854
+ }(e.html ?? "")}`;
855
+ });
856
+ (0, e.computed)(() => `<script setup lang="ts">\nimport { LGrid } from '@composy/layout-vue'\nimport type { LayoutDocument } from '@composy/layout-core'\n\nconst layoutDocument: LayoutDocument = ${JSON.stringify(ia.value, null, 2)}\n<\/script>\n\n<template>\n <LGrid :document="layoutDocument" breakpoint="${Ot.value}">\n <template #item="{ item }">\n <article class="layout-card">\n <div class="layout-card__meta">\n <span class="layout-card__type">{{ item.type === 'metric' ? '数据指标' : '趋势图表' }}</span>\n <span class="layout-card__status">已配置</span>\n </div>\n <h3 class="layout-card__title">{{ item.props.title }}</h3>\n <strong v-if="item.props.value !== undefined" class="layout-card__value">\n {{ Number(item.props.value).toLocaleString('zh-CN') }}\n </strong>\n <span v-else class="layout-card__chart" aria-hidden="true">\n\n <i v-for="bar in 5" :key="bar" />\n </span>\n <div class="layout-card__footer"><span>实时数据</span><span class="layout-card__spark">趋势稳定</span></div>\n </article>\n </template>\n </LGrid>\n</template>`), (0, e.computed)(() => `import { Grid } from '@composy/layout-react'\nimport type { LayoutDocument } from '@composy/layout-core'\n\nconst layoutDocument: LayoutDocument = ${JSON.stringify(ia.value, null, 2)}\n\nexport function LayoutPreview() {\n return (\n <Grid document={layoutDocument} breakpoint="${Ot.value}">\n {({ item }) => (\n <article className="layout-card">\n <div className="layout-card__meta">\n <span className="layout-card__type">{item.type === 'metric' ? '数据指标' : '趋势图表'}</span>\n <span className="layout-card__status">已配置</span>\n </div>\n <h3 className="layout-card__title">{String(item.props.title)}</h3>\n {item.props.value !== undefined ? (\n <strong className="layout-card__value">{Number(item.props.value).toLocaleString('zh-CN')}</strong>\n ) : (\n <span className="layout-card__chart" aria-hidden="true">{[1, 2, 3, 4, 5].map(bar => <i key={bar} />)}</span>\n )}\n <div className="layout-card__footer"><span>实时数据</span><span className="layout-card__spark">趋势稳定</span></div>\n </article>\n )}\n </Grid>\n )\n}`);
857
+ const ma = (0, e.computed)(() => {
858
+ const e = /* @__PURE__ */ new Map(), t = [], a = /* @__PURE__ */ new Set(["LGrid"]);
859
+ for (const n of yt.getAll()) {
860
+ const o = n.renderers?.vue;
861
+ if (!o?.package || !o.exportName) continue;
862
+ const r = o.exportName.trim();
863
+ if (!/^[A-Za-z_$][\w$]*$/.test(r)) continue;
864
+ let l = r, i = 2;
865
+ for (; a.has(l);) l = `${r}${i++}`;
866
+ a.add(l);
867
+ const s = e.get(o.package) ?? [];
868
+ s.push(l === r ? r : `${r} as ${l}`), e.set(o.package, s), t.push(` ${JSON.stringify(n.type)}: ${l}`);
869
+ }
870
+ const n = ["import { LGrid } from '@composy/layout-vue'", ...[...e.entries()].map(([e, exports]) => `import { ${exports.join(", ")} } from '${e}'`)].join("\n"), o = t.length ? `const materialComponents = {\n${t.join(",\n")}\n} as const` : "const materialComponents: Record<string, never> = {}";
871
+ return `<script setup lang="ts">\n${n}\nimport type { LayoutDocument } from '@composy/layout-core'\n\nconst layoutDocument: LayoutDocument = ${JSON.stringify(ia.value, null, 2)}\nconst breakpoint = '${Ot.value}'\n${o}\n<\/script>\n\n<template>\n <LGrid :document="layoutDocument" :breakpoint="breakpoint">\n <template #item="{ item }">\n <component\n :is="materialComponents[item.type as keyof typeof materialComponents]"\n v-bind="item.props"\n />\n </template>\n </LGrid>\n</template>\n\n<style scoped>\n/* LGrid renders the ldesign-layout-grid CSS Grid container. */\n${ua.value}\n</style>`;
872
+ });
873
+ (0, e.computed)(() => `import type { LayoutDocument, LayoutNode } from '@composy/layout-core'\n\nconst layoutDocument: LayoutDocument = ${JSON.stringify(ia.value, null, 2)}\nconst breakpoint = '${Ot.value}'\nconst itemClass = (item: LayoutNode) => \`ldesign-layout-item-\${item.id.replace(/[^a-zA-Z0-9_-]/g, '-') }\`\n\nexport function LayoutPreview() {\n return (\n <section className="ldesign-layout-grid">\n {layoutDocument.items.map(item => (\n <article key={item.id} className={\`\${itemClass(item)} layout-card\`}>\n <div className="layout-card__meta"><span className="layout-card__type">{item.type === 'metric' ? '数据指标' : '趋势图表'}</span><span className="layout-card__status">已配置</span></div>\n <h3 className="layout-card__title">{String(item.props.title)}</h3>\n {item.props.value !== undefined ? <strong className="layout-card__value">{Number(item.props.value).toLocaleString('zh-CN')}</strong> : <span className="layout-card__chart" aria-hidden="true">{[1, 2, 3, 4, 5].map(bar => <i key={bar} />)}</span>}\n <div className="layout-card__footer"><span>实时数据</span><span className="layout-card__spark">趋势稳定</span></div>\n </article>\n ))}\n </section>\n )\n}\n\n/* CSS Grid styles are emitted separately by the compiler. */`.replace(/<span className="layout-card__type">[\s\S]*?<\/span>/g, "<span className=\"layout-card__type\">{item.type}</span>").replace(/<span className="layout-card__status">[\s\S]*?<\/span>/g, "<span className=\"layout-card__status\">&#x5df2;&#x914d;&#x7f6e;</span>").replace(/<div className="layout-card__footer">[\s\S]*?<\/div>/g, "<div className=\"layout-card__footer\"><span>&#x5b9e;&#x65f6;&#x6570;&#x636e;</span><span className=\"layout-card__spark\">&#x7a33;&#x5b9a;</span></div>"));
874
+ const va = (0, e.computed)(() => "vue" === Vt.value ? ma.value : pa.value), ya = (0, e.computed)(() => "vue" === Vt.value ? "Vue组件代码" : "原生代码"), fa = (0, e.computed)(() => "vue" === Vt.value ? "vue" : "html");
875
+ function ha(e) {
876
+ return { ...e.defaults ?? {} };
877
+ }
878
+ const ba = (0, e.computed)(() => {
879
+ const e = Wt.value;
880
+ return e ? "vue" === Vt.value ? function(e) {
881
+ const t = e.renderers?.vue, a = t?.exportName?.trim(), n = (a && /^[A-Za-z_$][\w$]*$/.test(a) ? a : void 0) ?? t?.component?.name ?? e.type.replace(/[^A-Za-z0-9_$]/g, ""), o = t?.package && a && /^[A-Za-z_$][\w$]*$/.test(a) ? `import { ${n} } from '${t.package}'` : `// Vue 组件由物料注册表提供:${n}`, r = ha(e), l = Object.entries(r).filter(([, e]) => null != e).map(([e, t]) => ` :${e}='${JSON.stringify(t)}'`).join("\n");
882
+ return `<script setup lang="ts">\n${o}\n<\/script>\n\n\x3c!-- 注册表物料:${e.type} --\x3e\n<template>\n <${n}${l ? `\n${l}\n ` : ""}/>\n</template>`;
883
+ }(e) : function(e) {
884
+ const t = (e.renderers?.webcomponent)?.tagName ?? `ldesign-${e.type.replace(/[^a-z0-9-]/gi, "-")}`, a = Object.entries(ha(e)).filter(([, e]) => null != e).map(([e, t]) => `${e}="${String(t).replace(/"/g, "&quot;")}"`).join("\n ");
885
+ return `\x3c!-- 注册表物料:${e.type} --\x3e\n\x3c!-- Web Component 标签:${t} --\x3e\n<${t}${a ? `\n ${a}` : ""}></${t}>`;
886
+ }(e) : "";
887
+ }), ga = (0, e.computed)(() => wa(ba.value)), ka = (0, e.computed)(() => ba.value.split("\n").length);
888
+ function wa(e) {
889
+ const t = [], a = (e, a) => `__LDS_TOKEN_${t.push(`<span class="code-token-${a}">${e}</span>`) - 1}__`;
890
+ let n = rt(e);
891
+ n = n.replace(/(&quot;.*?&quot;|&#39;.*?&#39;|`.*?`)/g, (e) => a(e, "string")), n = n.replace(/(\/\/[^\n]*|\/\*[\s\S]*?\*\/)/g, (e) => a(e, "comment")), n = n.replace(/(^|[;{\n]\s*)([A-Za-z_$][\w$-]*)(?=\s*:)/g, (e, t, n) => `${t}${a(n, "property")}`), n = n.replace(/\b(import|from|const|let|function|return|export|as|type|class|extends|new|true|false|null|undefined)\b/g, (e) => a(e, /^(?:true|false|null|undefined)$/.test(e) ? "constant" : "keyword")), n = n.replace(/(&lt;\/?[A-Za-z][^&]*&gt;)/g, (e) => a(e, "tag"));
892
+ let o = "";
893
+ for (; o !== n && /__LDS_TOKEN_\d+__/.test(n);) o = n, n = n.replace(/__LDS_TOKEN_(\d+)__/g, (e, a) => t[Number(a)] ?? "");
894
+ return n;
895
+ }
896
+ const Na = (0, e.computed)(() => wa(va.value)), Ea = (0, e.computed)(() => va.value.split("\n").length), _a = (0, e.computed)(() => ({
897
+ width: `${sa.value.width}px`,
898
+ minHeight: `${sa.value.height}px`,
899
+ "--canvas-height": `${sa.value.height}px`,
900
+ "--canvas-grid-height": `${Math.max(180, sa.value.height)}px`,
901
+ transform: `translate3d(${Ft.value.x}px, ${Ft.value.y}px, 0) scale(${Jt.value})`
902
+ })), Va = (0, e.computed)(() => `${Math.round(100 * Jt.value)}%`), Ca = (0, e.computed)(() => Mt.value.items.find((e) => e.id === Tt.value)), xa = (0, e.computed)(() => Boolean(Ca.value?.state?.locked)), La = (0, e.computed)(() => !1 !== Ca.value?.constraints?.movable), Sa = (0, e.computed)(() => !1 !== Ca.value?.constraints?.resizable);
903
+ function $a(e) {
904
+ if (!ta) return;
905
+ const t = ta.addItem({ type: e });
906
+ ta.updateItem(t.id, (e) => {
907
+ for (const t of Object.values(e.layout)) t.y = 30;
908
+ return e;
909
+ }), ta.select(t.id);
910
+ }
911
+ function Ba() {
912
+ Wt.value = void 0, Ut.value = !1;
913
+ }
914
+ async function Da() {
915
+ if (ba.value && "undefined" != typeof navigator) try {
916
+ await navigator.clipboard.writeText(ba.value), Ut.value = !0, window.setTimeout(() => {
917
+ Ut.value = !1;
918
+ }, 1500);
919
+ } catch {
920
+ Ut.value = !1;
921
+ }
922
+ }
923
+ function za(e) {
924
+ Pt.value = "category" === e && !Pt.value, jt.value = "device" === e && !jt.value, Rt.value = !1;
925
+ }
926
+ function Ma() {
927
+ Rt.value = !Rt.value, Pt.value = !1, jt.value = !1;
928
+ }
929
+ function Ta() {
930
+ Pt.value = !1, jt.value = !1, Rt.value = !1;
931
+ }
932
+ function Aa(e) {
933
+ "Escape" === e.key && (Pt.value || Rt.value || jt.value) && (Ta(), e.target?.blur());
934
+ }
935
+ function Oa(e) {
936
+ const t = e.target;
937
+ t instanceof Element && (t.closest("[data-layout-filter-menu]") || Ta());
938
+ }
939
+ function Ia(e) {
940
+ Bt.value = e, Ta();
941
+ }
942
+ function ja() {
943
+ Et.value = "", _t.value = void 0, Ta();
944
+ }
945
+ function Pa(e) {
946
+ return "chart" === e ? i.ChartSpline : i.ChartNoAxesColumnIncreasing;
947
+ }
948
+ function Ra() {
949
+ if (!ta) return;
950
+ const e = new Set(zt.value.map((e) => e.type));
951
+ for (const e of zt.value) {
952
+ const t = Ct.get(e.type);
953
+ if (!t || xt.has(e.type)) continue;
954
+ const a = e.defaultLayout ?? e.size?.default, n = ta.registerExternalDragSource({
955
+ element: t,
956
+ type: e.type,
957
+ props: { ...e.defaults ?? {} },
958
+ placement: {
959
+ x: 0,
960
+ y: 0,
961
+ w: a?.w ?? 1,
962
+ h: a?.h ?? 1
963
+ }
964
+ });
965
+ xt.set(e.type, n);
966
+ }
967
+ for (const [t, a] of xt) e.has(t) || (a(), xt.delete(t));
968
+ }
969
+ function qa() {
970
+ ta?.handleKeyboard({ key: "Delete" });
971
+ }
972
+ function Ga() {
973
+ ta && Tt.value && (xa.value ? ta.unlockItem(Tt.value) : ta.lockItem(Tt.value));
974
+ }
975
+ function Ka(e) {
976
+ ta && Tt.value && ta.updateItem(Tt.value, (t) => (t.constraints = {
977
+ ...t.constraints ?? {},
978
+ [e]: !1 === t.constraints?.[e]
979
+ }, t));
980
+ }
981
+ function Wa() {
982
+ ta?.undo();
983
+ }
984
+ function Ua() {
985
+ ta?.redo();
986
+ }
987
+ function Ha() {
988
+ const e = Gt.value ? "edit" : "preview";
989
+ ta?.setMode(e), Ya("preview" === e ? "runtime" : "editor");
990
+ }
991
+ function Xa() {
992
+ Kt.value = !0, (0, e.nextTick)(Fa);
993
+ }
994
+ function Ja() {
995
+ Kt.value = !1, na?.destroy(), na = void 0;
996
+ }
997
+ function Fa() {
998
+ if ("webcomponent" !== Vt.value || !Kt.value || !Nt.value) return na?.destroy(), void (na = void 0);
999
+ const e = ta?.exportRuntimeDocument() ?? Mt.value;
1000
+ na ? na.update(e) : (na = (0, t.createLayoutRuntime)({
1001
+ container: Nt.value,
1002
+ document: e,
1003
+ materials: yt,
1004
+ observeResize: !1,
1005
+ renderItem: ({ shell: e, item: t }) => {
1006
+ const a = () => ut(e, t);
1007
+ return a(), { update: a };
1008
+ }
1009
+ }), na.mount()), na.setBreakpoint(Ot.value);
1010
+ }
1011
+ function Za() {
1012
+ if ("webcomponent" !== Vt.value || "vanilla" !== Ht.value || !wt.value || !ta) return aa?.destroy(), void (aa = void 0);
1013
+ const e = ta.exportRuntimeDocument();
1014
+ aa ? aa.update(e) : (aa = (0, t.createLayoutRuntime)({
1015
+ container: wt.value,
1016
+ document: e,
1017
+ materials: yt,
1018
+ observeResize: !1,
1019
+ renderItem: ({ shell: e, item: t }) => {
1020
+ const a = () => {
1021
+ pt(e, t);
1022
+ };
1023
+ return a(), { update: a };
1024
+ }
1025
+ }), aa.mount()), aa.setBreakpoint(Ot.value);
1026
+ }
1027
+ function Ya(t) {
1028
+ if (Ht.value = t, "undefined" != typeof window && (window.location.hash = `/${t}`), "runtime" === t) {
1029
+ "preview" === ta?.getMode() && ta.setMode("edit"), ta?.setMode("preview");
1030
+ const t = () => {
1031
+ "runtime" === Ht.value && bt.value?.querySelectorAll(".grid-stack-item").forEach((e) => e.remove());
1032
+ };
1033
+ t(), (0, e.nextTick)(t);
1034
+ } else Gt.value && ta?.setMode("edit");
1035
+ (0, e.nextTick)(Za);
1036
+ }
1037
+ function Qa(e) {
1038
+ Ot.value = e, It.value = "mobile" === e ? "portrait" : "landscape", ta?.setBreakpoint(e), aa?.setBreakpoint(e), jt.value = !1;
1039
+ }
1040
+ function en() {
1041
+ It.value = "portrait" === It.value ? "landscape" : "portrait";
1042
+ }
1043
+ function tn(e, t) {
1044
+ const a = gt.value, n = Jt.value, o = function(e) {
1045
+ return Math.min(2, Math.max(.5, Math.round(20 * e) / 20));
1046
+ }(e);
1047
+ if (!a || n === o) return;
1048
+ const r = a.getBoundingClientRect(), l = t?.x ?? r.left + r.width / 2, i = t?.y ?? r.top + r.height / 2, s = (l - r.left - Ft.value.x) / n, c = (i - r.top - Ft.value.y) / n;
1049
+ Jt.value = o, Ft.value = {
1050
+ x: l - r.left - s * o,
1051
+ y: i - r.top - c * o
1052
+ };
1053
+ }
1054
+ function an(e) {
1055
+ tn(Jt.value + .1 * e);
1056
+ }
1057
+ function nn() {
1058
+ Jt.value = 1, Ft.value = {
1059
+ x: 0,
1060
+ y: 0
1061
+ };
1062
+ }
1063
+ function on() {
1064
+ Ft.value = {
1065
+ x: 0,
1066
+ y: 0
1067
+ };
1068
+ }
1069
+ function rn() {
1070
+ Xt.value = "light" === Xt.value ? "dark" : "light", "undefined" != typeof window && window.localStorage.setItem("layout-theme", Xt.value);
1071
+ }
1072
+ function ln(e) {
1073
+ e.preventDefault();
1074
+ const t = e.deltaY < 0 ? 1 : -1;
1075
+ tn(Jt.value + .08 * t, {
1076
+ x: e.clientX,
1077
+ y: e.clientY
1078
+ });
1079
+ }
1080
+ function sn(e) {
1081
+ "pan" !== Zt.value && !Qt.value && 1 !== e.button || 2 === e.button || (e.preventDefault(), e.stopPropagation(), e.currentTarget.setPointerCapture?.(e.pointerId), Yt.value = !0, ea.value = {
1082
+ x: e.clientX,
1083
+ y: e.clientY,
1084
+ panX: Ft.value.x,
1085
+ panY: Ft.value.y
1086
+ });
1087
+ }
1088
+ function cn(e) {
1089
+ if (!Yt.value) return;
1090
+ const t = ea.value;
1091
+ Ft.value = {
1092
+ x: t.panX + e.clientX - t.x,
1093
+ y: t.panY + e.clientY - t.y
1094
+ };
1095
+ }
1096
+ function dn(e) {
1097
+ Yt.value && (Yt.value = !1, e && e.currentTarget.releasePointerCapture?.(e.pointerId));
1098
+ }
1099
+ function un(e) {
1100
+ "Space" === e.code && (Qt.value = !0);
1101
+ }
1102
+ function pn(e) {
1103
+ "Space" === e.code && (Qt.value = !1);
1104
+ }
1105
+ function mn(e) {
1106
+ if (!ta || e.defaultPrevented) return;
1107
+ const t = bt.value?.closest("[data-layout-workspace]");
1108
+ if (!(t && e.target instanceof Node && t.contains(e.target))) return;
1109
+ const a = e.key.toLowerCase();
1110
+ ((e.ctrlKey || e.metaKey) && [
1111
+ "c",
1112
+ "v",
1113
+ "x",
1114
+ "d"
1115
+ ].includes(a) || ["delete", "backspace"].includes(a)) && ta.handleKeyboard({
1116
+ key: e.key,
1117
+ shiftKey: e.shiftKey,
1118
+ ctrlKey: e.ctrlKey,
1119
+ metaKey: e.metaKey,
1120
+ altKey: e.altKey,
1121
+ preventDefault: () => e.preventDefault()
1122
+ });
1123
+ }
1124
+ async function vn() {
1125
+ const e = va.value;
1126
+ try {
1127
+ if (navigator.clipboard?.writeText) await navigator.clipboard.writeText(e);
1128
+ else {
1129
+ const t = document.createElement("textarea");
1130
+ t.value = e, t.style.position = "fixed", t.style.opacity = "0", document.body.appendChild(t), t.select(), document.execCommand("copy"), t.remove();
1131
+ }
1132
+ qt.value = !0, window.setTimeout(() => {
1133
+ qt.value = !1;
1134
+ }, 1600);
1135
+ } catch {
1136
+ qt.value = !1;
1137
+ }
1138
+ }
1139
+ function yn() {
1140
+ const e = new Blob([va.value], { type: "text/plain;charset=utf-8" }), t = URL.createObjectURL(e), a = document.createElement("a");
1141
+ a.href = t, a.download = `layout-${Vt.value}.${fa.value}`, a.click(), URL.revokeObjectURL(t);
1142
+ }
1143
+ function fn(e) {
1144
+ const t = e.target;
1145
+ if (!(t instanceof Element)) return;
1146
+ const a = t.closest("[data-layout-action]"), n = t.closest(".grid-stack-item");
1147
+ if (!a || !n || "true" === a.dataset.layoutActionPointer) return void ("true" === a?.dataset.layoutActionPointer && delete a.dataset.layoutActionPointer);
1148
+ "pointerdown" === e.type && (a.dataset.layoutActionPointer = "true", e.preventDefault());
1149
+ const o = n.getAttribute("gs-id") ?? n.getAttribute("data-layout-item-id");
1150
+ if (!o || !ta) return;
1151
+ ta.select(o);
1152
+ const r = a.dataset.layoutAction;
1153
+ "copy" === r ? ta.copySelection() : "delete" === r ? ta.removeItem(o) : "lock" === r && (Mt.value.items.find((e) => e.id === o)?.state?.locked ? ta.unlockItem(o) : ta.lockItem(o));
1154
+ }
1155
+ function hn() {
1156
+ const e = bt.value;
1157
+ e && e.querySelectorAll(".grid-stack-item").forEach((e) => {
1158
+ const t = e.getAttribute("gs-id") ?? e.getAttribute("data-layout-item-id") ?? "", a = Mt.value.items.find((e) => e.id === t), n = At.value.includes(t);
1159
+ e.classList.toggle("is-selected", n), e.tabIndex = 0, e.setAttribute("role", "button"), a && e.setAttribute("aria-label", `${lt(a)},${it(a.type)}`), e.setAttribute("aria-pressed", String(n)), e.setAttribute("aria-selected", String(n)), e.setAttribute("aria-disabled", String(Boolean(a?.state?.locked)));
1160
+ });
1161
+ }
1162
+ function bn() {
1163
+ if (void 0 !== ra) return;
1164
+ const e = () => {
1165
+ ra = void 0, ta && (Mt.value = ta.exportRuntimeDocument(), queueMicrotask(hn));
1166
+ };
1167
+ "undefined" == typeof window ? e() : ra = window.requestAnimationFrame(e);
1168
+ }
1169
+ return (0, e.watch)([
1170
+ Et,
1171
+ _t,
1172
+ Vt
1173
+ ], () => (0, e.nextTick)(Ra)), (0, e.watch)([
1174
+ Kt,
1175
+ Vt,
1176
+ Ot,
1177
+ Mt
1178
+ ], () => (0, e.nextTick)(Fa)), (0, e.onMounted)(() => {
1179
+ if ("undefined" != typeof window) {
1180
+ const e = window.localStorage.getItem("layout-theme");
1181
+ "light" !== e && "dark" !== e || (Xt.value = e);
1182
+ const t = window.localStorage.getItem("layout-development-framework");
1183
+ "webcomponent" !== t && "vue" !== t || (Vt.value = t);
1184
+ }
1185
+ if (!bt.value) return;
1186
+ oa = o.GridStack.renderCB, o.GridStack.renderCB = (e, t) => {
1187
+ e && void 0 !== t?.content && (e.innerHTML = String(t.content));
1188
+ };
1189
+ const t = (0, c.createGridStackEditorEngine)({
1190
+ container: bt.value,
1191
+ gridOptions: {
1192
+ acceptWidgets: !0,
1193
+ animate: !1
1194
+ },
1195
+ createGrid: (e) => o.GridStack.init(e, bt.value),
1196
+ renderItem: ({ item: e }) => dt(e, { interactive: !0 })
1197
+ });
1198
+ if (ta = (0, n.createLayoutEditor)({
1199
+ document: ht,
1200
+ engine: t,
1201
+ materials: yt,
1202
+ preview: kt.value ? {
1203
+ container: kt.value,
1204
+ renderItem: ({ shell: e, item: t }) => {
1205
+ const a = () => {
1206
+ pt(e, t);
1207
+ };
1208
+ return a(), { update: a };
1209
+ }
1210
+ } : void 0
1211
+ }), ta.on("document:change", (e) => {
1212
+ Mt.value = e.document, p("update:document", e.document), p("change", e.document), queueMicrotask(hn), Za();
1213
+ }), ta.on("interaction:move", bn), ta.on("interaction:resize", bn), ta.on("selection:change", (e) => {
1214
+ Tt.value = e.primaryId, At.value = [...e.selectedIds], hn();
1215
+ }), ta.on("mode:change", (t) => {
1216
+ Gt.value = "preview" === t.mode, "preview" === t.mode && "runtime" !== Ht.value && (Ht.value = "runtime"), "edit" === t.mode && "runtime" === Ht.value && (Ht.value = "editor"), (0, e.nextTick)(Za);
1217
+ }), ta.mount(), bt.value.addEventListener("pointerdown", fn, !0), bt.value.addEventListener("click", fn, !0), la.push(() => bt.value?.removeEventListener("pointerdown", fn, !0)), la.push(() => bt.value?.removeEventListener("click", fn, !0)), (0, e.nextTick)(Ra), hn(), "undefined" != typeof window) {
1218
+ Ht.value = mt(window.location.hash);
1219
+ const e = () => {
1220
+ const e = mt(window.location.hash);
1221
+ e !== Ht.value ? Ya(e) : "runtime" === e && "preview" !== ta?.getMode() ? ta.setMode("preview") : "runtime" !== e && "preview" === ta?.getMode() && ta.setMode("edit");
1222
+ };
1223
+ window.addEventListener("hashchange", e), la.push(() => window.removeEventListener("hashchange", e)), window.addEventListener("keydown", un), window.addEventListener("keyup", pn), window.addEventListener("keydown", mn), document.addEventListener("pointerdown", Oa), document.addEventListener("keydown", Aa), la.push(() => window.removeEventListener("keydown", un)), la.push(() => window.removeEventListener("keyup", pn)), la.push(() => window.removeEventListener("keydown", mn)), la.push(() => document.removeEventListener("pointerdown", Oa)), la.push(() => document.removeEventListener("keydown", Aa));
1224
+ }
1225
+ "runtime" === Ht.value && ta.setMode("preview"), Za();
1226
+ }), (0, e.onBeforeUnmount)(() => {
1227
+ void 0 !== ra && "undefined" != typeof window && window.cancelAnimationFrame(ra), ra = void 0, xt.forEach((e) => e()), xt.clear(), la.splice(0).forEach((e) => e()), aa?.destroy(), aa = void 0, na?.destroy(), na = void 0, ta?.destroy(), oa && (o.GridStack.renderCB = oa, oa = void 0);
1228
+ }), (t, a) => ((0, e.openBlock)(), (0, e.createElementBlock)("main", {
1229
+ class: "layout-demo",
1230
+ "data-layout-workspace": "",
1231
+ "data-theme": Xt.value,
1232
+ "data-development-framework": Vt.value
1233
+ }, [
1234
+ (0, e.createElementVNode)("header", w, [
1235
+ (0, e.createElementVNode)("div", N, [
1236
+ (0, e.createElementVNode)("span", E, [(0, e.createVNode)((0, e.unref)(i.Grid2X2), {
1237
+ size: 18,
1238
+ "stroke-width": 1.8
1239
+ })]),
1240
+ a[20] || (a[20] = (0, e.createElementVNode)("div", { class: "brand-copy" }, [(0, e.createElementVNode)("strong", null, "布局工作台"), (0, e.createElementVNode)("span", null, "所见即所得 · 网格布局")], -1)),
1241
+ (0, e.createElementVNode)("div", {
1242
+ class: (0, e.normalizeClass)(["development-mode custom-select", { "is-open": Rt.value }]),
1243
+ "data-layout-filter-menu": "",
1244
+ onPointerdown: a[0] || (a[0] = (0, e.withModifiers)(() => {}, ["stop"]))
1245
+ }, [(0, e.createElementVNode)("button", {
1246
+ class: "custom-select__trigger",
1247
+ type: "button",
1248
+ "aria-haspopup": "listbox",
1249
+ "aria-expanded": Rt.value,
1250
+ "aria-label": "开发框架",
1251
+ title: `当前开发框架:${$t.value}`,
1252
+ onClick: (0, e.withModifiers)(Ma, ["stop"])
1253
+ }, [
1254
+ ((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(ot.find((e) => e.id === Vt.value)?.icon ?? (0, e.unref)(i.PanelsTopLeft)), {
1255
+ size: 14,
1256
+ "stroke-width": 1.9,
1257
+ "aria-hidden": "true"
1258
+ })),
1259
+ (0, e.createElementVNode)("span", null, (0, e.toDisplayString)($t.value), 1),
1260
+ (0, e.createVNode)((0, e.unref)(i.ChevronDown), {
1261
+ size: 12,
1262
+ "stroke-width": 1.9,
1263
+ "aria-hidden": "true"
1264
+ })
1265
+ ], 8, _), Rt.value ? ((0, e.openBlock)(), (0, e.createElementBlock)("div", V, [((0, e.openBlock)(), (0, e.createElementBlock)(e.Fragment, null, (0, e.renderList)(ot, (t) => (0, e.createElementVNode)("button", {
1266
+ key: t.id,
1267
+ class: "custom-select__option",
1268
+ type: "button",
1269
+ "aria-selected": Vt.value === t.id,
1270
+ onClick: (a) => function(t) {
1271
+ Vt.value = t, "undefined" != typeof window && window.localStorage.setItem("layout-development-framework", t), Ta(), (0, e.nextTick)(() => {
1272
+ Za(), Fa(), Gt.value && ta && (ta.setMode("edit"), (0, e.nextTick)(() => ta?.setMode("preview")));
1273
+ });
1274
+ }(t.id)
1275
+ }, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(t.icon), {
1276
+ size: 14,
1277
+ "stroke-width": 1.8,
1278
+ "aria-hidden": "true"
1279
+ })), (0, e.createElementVNode)("span", null, [(0, e.createElementVNode)("strong", null, (0, e.toDisplayString)(t.label), 1), (0, e.createElementVNode)("small", null, (0, e.toDisplayString)(t.description), 1)])], 8, C)), 64))])) : (0, e.createCommentVNode)("v-if", !0)], 34)
1280
+ ]),
1281
+ (0, e.createElementVNode)("div", x, [(0, e.createElementVNode)("nav", L, [((0, e.openBlock)(), (0, e.createElementBlock)(e.Fragment, null, (0, e.renderList)(m, (t) => (0, e.createElementVNode)("button", {
1282
+ key: t.id,
1283
+ type: "button",
1284
+ "aria-current": Ht.value === t.id ? "page" : void 0,
1285
+ "aria-label": `${t.label}模式`,
1286
+ title: t.description,
1287
+ onClick: (e) => Ya(t.id)
1288
+ }, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(h[t.id]), {
1289
+ class: "route-icon",
1290
+ size: 15,
1291
+ "stroke-width": 1.8,
1292
+ "aria-hidden": "true"
1293
+ })), (0, e.createElementVNode)("span", null, (0, e.toDisplayString)(t.label), 1)], 8, S)), 64))]), (0, e.createElementVNode)("div", $, [((0, e.openBlock)(!0), (0, e.createElementBlock)(e.Fragment, null, (0, e.renderList)(Mt.value.breakpoints, (t) => ((0, e.openBlock)(), (0, e.createElementBlock)("button", {
1294
+ key: t.id,
1295
+ class: "breakpoint-tab",
1296
+ type: "button",
1297
+ "aria-pressed": Ot.value === t.id,
1298
+ "aria-label": `切换到${st(t.id)}画布`,
1299
+ title: `${st(t.id)}画布`,
1300
+ onClick: (e) => Qa(t.id)
1301
+ }, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(y[t.id] ?? (0, e.unref)(i.Monitor)), {
1302
+ size: 14,
1303
+ "stroke-width": 1.8,
1304
+ "aria-hidden": "true"
1305
+ })), (0, e.createElementVNode)("span", null, (0, e.toDisplayString)(st(t.id)), 1)], 8, B))), 128)), (0, e.createCommentVNode)("v-if", !0)])]),
1306
+ (0, e.createElementVNode)("div", D, [
1307
+ (0, e.createElementVNode)("button", {
1308
+ class: "icon-button",
1309
+ type: "button",
1310
+ "aria-label": "撤销",
1311
+ title: "撤销",
1312
+ disabled: !(0, e.unref)(ta)?.canUndo(),
1313
+ onClick: Wa
1314
+ }, [(0, e.createVNode)((0, e.unref)(i.Undo2), {
1315
+ size: 16,
1316
+ "stroke-width": 1.9,
1317
+ "aria-hidden": "true"
1318
+ })], 8, z),
1319
+ (0, e.createElementVNode)("button", {
1320
+ class: "icon-button",
1321
+ type: "button",
1322
+ "aria-label": "重做",
1323
+ title: "重做",
1324
+ disabled: !(0, e.unref)(ta)?.canRedo(),
1325
+ onClick: Ua
1326
+ }, [(0, e.createVNode)((0, e.unref)(i.Redo2), {
1327
+ size: 16,
1328
+ "stroke-width": 1.9,
1329
+ "aria-hidden": "true"
1330
+ })], 8, M),
1331
+ (0, e.createElementVNode)("button", {
1332
+ class: "icon-button",
1333
+ type: "button",
1334
+ "aria-label": "删除选中组件",
1335
+ title: "删除选中组件",
1336
+ disabled: !Tt.value,
1337
+ onClick: qa
1338
+ }, [(0, e.createVNode)((0, e.unref)(i.Trash2), {
1339
+ size: 16,
1340
+ "stroke-width": 1.9,
1341
+ "aria-hidden": "true"
1342
+ })], 8, T),
1343
+ (0, e.createElementVNode)("button", {
1344
+ class: "icon-button",
1345
+ type: "button",
1346
+ "aria-label": xa.value ? "解锁选中组件" : "锁定选中组件",
1347
+ title: xa.value ? "解锁选中组件" : "锁定选中组件",
1348
+ disabled: !Tt.value,
1349
+ onClick: Ga
1350
+ }, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(xa.value ? (0, e.unref)(i.Unlock) : (0, e.unref)(i.Lock)), {
1351
+ size: 16,
1352
+ "stroke-width": 1.9,
1353
+ "aria-hidden": "true"
1354
+ }))], 8, A),
1355
+ (0, e.createElementVNode)("button", {
1356
+ class: "icon-button",
1357
+ type: "button",
1358
+ "aria-label": La.value ? "禁止移动" : "允许移动",
1359
+ title: La.value ? "禁止移动" : "允许移动",
1360
+ disabled: !Tt.value || xa.value,
1361
+ onClick: a[1] || (a[1] = (e) => Ka("movable"))
1362
+ }, [(0, e.createVNode)((0, e.unref)(i.Move), {
1363
+ size: 16,
1364
+ "stroke-width": 1.9,
1365
+ "aria-hidden": "true"
1366
+ })], 8, O),
1367
+ (0, e.createElementVNode)("button", {
1368
+ class: "icon-button",
1369
+ type: "button",
1370
+ "aria-label": Sa.value ? "禁止调整大小" : "允许调整大小",
1371
+ title: Sa.value ? "禁止调整大小" : "允许调整大小",
1372
+ disabled: !Tt.value || xa.value,
1373
+ onClick: a[2] || (a[2] = (e) => Ka("resizable"))
1374
+ }, [(0, e.createVNode)((0, e.unref)(i.Maximize2), {
1375
+ size: 16,
1376
+ "stroke-width": 1.9,
1377
+ "aria-hidden": "true"
1378
+ })], 8, I),
1379
+ (0, e.createElementVNode)("button", {
1380
+ class: "icon-button theme-button",
1381
+ type: "button",
1382
+ "aria-label": "dark" === Xt.value ? "切换到亮色主题" : "切换到暗色主题",
1383
+ title: "dark" === Xt.value ? "切换到亮色主题" : "切换到暗色主题",
1384
+ onClick: rn
1385
+ }, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)("dark" === Xt.value ? (0, e.unref)(i.Sun) : (0, e.unref)(i.Moon)), {
1386
+ size: 16,
1387
+ "stroke-width": 1.9,
1388
+ "aria-hidden": "true"
1389
+ }))], 8, j),
1390
+ (0, e.createElementVNode)("button", {
1391
+ class: "preview-open-button",
1392
+ type: "button",
1393
+ "aria-label": "打开实时预览",
1394
+ title: "打开实时预览",
1395
+ onClick: Xa
1396
+ }, [(0, e.createVNode)((0, e.unref)(i.Eye), {
1397
+ size: 15,
1398
+ "stroke-width": 1.9,
1399
+ "aria-hidden": "true"
1400
+ }), a[21] || (a[21] = (0, e.createElementVNode)("span", null, "实时预览", -1))]),
1401
+ (0, e.createElementVNode)("button", {
1402
+ class: "mode-button",
1403
+ type: "button",
1404
+ "aria-pressed": Gt.value,
1405
+ "aria-label": Gt.value ? "返回编辑模式" : "进入预览模式",
1406
+ title: Gt.value ? "返回编辑模式" : "进入预览模式",
1407
+ onClick: Ha
1408
+ }, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(Gt.value ? (0, e.unref)(i.Pencil) : (0, e.unref)(i.Eye)), {
1409
+ size: 16,
1410
+ "stroke-width": 1.9,
1411
+ "aria-hidden": "true"
1412
+ })), (0, e.createElementVNode)("span", null, (0, e.toDisplayString)(Gt.value ? "编辑" : "预览"), 1)], 8, P)
1413
+ ])
1414
+ ]),
1415
+ (0, e.createElementVNode)("section", R, [
1416
+ (0, e.createElementVNode)("aside", q, [
1417
+ (0, e.createElementVNode)("div", G, [a[22] || (a[22] = (0, e.createElementVNode)("div", null, [(0, e.createElementVNode)("span", { class: "eyebrow" }, "工作区"), (0, e.createElementVNode)("h2", null, "物料")], -1)), (0, e.createElementVNode)("span", K, (0, e.toDisplayString)((0, e.unref)(yt).getAll().length), 1)]),
1418
+ (0, e.createElementVNode)("div", W, [
1419
+ (0, e.createElementVNode)("label", U, [(0, e.createVNode)((0, e.unref)(i.Search), {
1420
+ size: 15,
1421
+ "stroke-width": 1.8,
1422
+ "aria-hidden": "true"
1423
+ }), (0, e.withDirectives)((0, e.createElementVNode)("input", {
1424
+ "onUpdate:modelValue": a[3] || (a[3] = (e) => Et.value = e),
1425
+ type: "search",
1426
+ placeholder: "搜索物料",
1427
+ "aria-label": "搜索物料"
1428
+ }, null, 512), [[e.vModelText, Et.value]])]),
1429
+ (0, e.createElementVNode)("div", {
1430
+ class: "material-filter-row",
1431
+ "data-layout-filter-menu": "",
1432
+ onKeydown: (0, e.withKeys)((0, e.withModifiers)(Aa, ["stop", "prevent"]), ["esc"])
1433
+ }, [(0, e.createElementVNode)("div", {
1434
+ class: (0, e.normalizeClass)(["material-select custom-select", { "is-open": Pt.value }]),
1435
+ onPointerdown: a[6] || (a[6] = (0, e.withModifiers)(() => {}, ["stop"]))
1436
+ }, [(0, e.createElementVNode)("button", {
1437
+ class: "custom-select__trigger",
1438
+ type: "button",
1439
+ "aria-haspopup": "listbox",
1440
+ "aria-expanded": Pt.value,
1441
+ "aria-label": "物料分类",
1442
+ title: `物料分类:${St.value}`,
1443
+ onClick: a[4] || (a[4] = (0, e.withModifiers)((e) => za("category"), ["stop"]))
1444
+ }, [
1445
+ (0, e.createVNode)((0, e.unref)(i.Filter), {
1446
+ size: 13,
1447
+ "stroke-width": 1.9,
1448
+ "aria-hidden": "true"
1449
+ }),
1450
+ (0, e.createElementVNode)("span", null, (0, e.toDisplayString)(St.value), 1),
1451
+ (0, e.createVNode)((0, e.unref)(i.ChevronDown), {
1452
+ size: 12,
1453
+ "stroke-width": 1.9,
1454
+ "aria-hidden": "true"
1455
+ })
1456
+ ], 8, X), Pt.value ? ((0, e.openBlock)(), (0, e.createElementBlock)("div", J, [(0, e.createElementVNode)("button", {
1457
+ class: "custom-select__option",
1458
+ type: "button",
1459
+ "aria-selected": !Bt.value,
1460
+ onClick: a[5] || (a[5] = (e) => Ia(""))
1461
+ }, " 全部分类 ", 8, F), ((0, e.openBlock)(!0), (0, e.createElementBlock)(e.Fragment, null, (0, e.renderList)(Lt.value, (t) => ((0, e.openBlock)(), (0, e.createElementBlock)("button", {
1462
+ key: t.id,
1463
+ class: "custom-select__option",
1464
+ type: "button",
1465
+ "aria-selected": Bt.value === t.id,
1466
+ onClick: (e) => Ia(t.id)
1467
+ }, (0, e.toDisplayString)(t.label), 9, Z))), 128))])) : (0, e.createCommentVNode)("v-if", !0)], 34), Dt.value ? ((0, e.openBlock)(), (0, e.createElementBlock)("button", {
1468
+ key: 0,
1469
+ class: "material-filter-reset",
1470
+ type: "button",
1471
+ "aria-label": "清除物料筛选",
1472
+ title: "清除筛选",
1473
+ onClick: ja
1474
+ }, [(0, e.createVNode)((0, e.unref)(i.X), {
1475
+ size: 13,
1476
+ "stroke-width": 1.9,
1477
+ "aria-hidden": "true"
1478
+ })])) : (0, e.createCommentVNode)("v-if", !0)], 40, H),
1479
+ (0, e.createElementVNode)("div", Y, [(0, e.createElementVNode)("span", null, (0, e.toDisplayString)(zt.value.length) + " / " + (0, e.toDisplayString)((0, e.unref)(yt).getAll().length) + " 个物料", 1), Dt.value ? ((0, e.openBlock)(), (0, e.createElementBlock)("span", Q, "已筛选")) : (0, e.createCommentVNode)("v-if", !0)])
1480
+ ]),
1481
+ zt.value.length ? (0, e.createCommentVNode)("v-if", !0) : ((0, e.openBlock)(), (0, e.createElementBlock)("div", ee, [
1482
+ (0, e.createVNode)((0, e.unref)(i.Search), {
1483
+ size: 17,
1484
+ "stroke-width": 1.7,
1485
+ "aria-hidden": "true"
1486
+ }),
1487
+ a[23] || (a[23] = (0, e.createElementVNode)("strong", null, "没有匹配的物料", -1)),
1488
+ a[24] || (a[24] = (0, e.createElementVNode)("span", null, "试试更换关键词或分类", -1)),
1489
+ Dt.value ? ((0, e.openBlock)(), (0, e.createElementBlock)("button", {
1490
+ key: 0,
1491
+ type: "button",
1492
+ onClick: ja
1493
+ }, " 清除筛选 ")) : (0, e.createCommentVNode)("v-if", !0)
1494
+ ])),
1495
+ ((0, e.openBlock)(!0), (0, e.createElementBlock)(e.Fragment, null, (0, e.renderList)(zt.value, (t) => {
1496
+ return (0, e.openBlock)(), (0, e.createElementBlock)("div", {
1497
+ key: t.type,
1498
+ ref_for: !0,
1499
+ ref: (e) => {
1500
+ a = t.type, (n = e) instanceof HTMLElement ? Ct.set(a, n) : Ct.delete(a);
1501
+ return;
1502
+ var a, n;
1503
+ },
1504
+ class: "material-source grid-stack-item",
1505
+ role: "button",
1506
+ tabindex: "0",
1507
+ "data-material-type": t.type,
1508
+ "data-layout-material": t.type,
1509
+ "data-layout-props": (n = t.type, JSON.stringify(yt.get(n)?.defaults ?? {})),
1510
+ "aria-label": `添加${t.title ?? t.label ?? t.type}`,
1511
+ onClick: (e) => function(e) {
1512
+ $a(e);
1513
+ }(t.type),
1514
+ onKeydown: [(0, e.withKeys)((e) => $a(t.type), ["enter"]), (0, e.withKeys)((0, e.withModifiers)((e) => $a(t.type), ["prevent"]), ["space"])]
1515
+ }, [
1516
+ (0, e.createElementVNode)("span", ae, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(Pa(t.type)), {
1517
+ size: 18,
1518
+ "stroke-width": 1.8
1519
+ }))]),
1520
+ (0, e.createElementVNode)("span", ne, [(0, e.createElementVNode)("strong", null, (0, e.toDisplayString)(t.title ?? t.label ?? t.type), 1), (0, e.createElementVNode)("small", null, (0, e.toDisplayString)(t.description ?? t.categoryLabel ?? "布局组件"), 1)]),
1521
+ (0, e.createElementVNode)("span", oe, [(0, e.createElementVNode)("span", re, (0, e.toDisplayString)(t.defaultLayout?.w ?? t.size?.default.w ?? 1) + " × " + (0, e.toDisplayString)(t.defaultLayout?.h ?? t.size?.default.h ?? 1), 1), (0, e.createElementVNode)("span", le, [(0, e.createElementVNode)("span", {
1522
+ class: (0, e.normalizeClass)(["material-renderer-badge", { "material-renderer-badge--vue": "vue" === Vt.value }]),
1523
+ title: `当前开发目标:${$t.value}`
1524
+ }, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)("vue" === Vt.value ? (0, e.unref)(i.PanelsTopLeft) : (0, e.unref)(i.Code2)), {
1525
+ size: 11,
1526
+ "stroke-width": 1.8,
1527
+ "aria-hidden": "true"
1528
+ })), (0, e.createElementVNode)("span", null, (0, e.toDisplayString)($t.value), 1)], 10, ie)])]),
1529
+ (0, e.createElementVNode)("span", se, [(0, e.createElementVNode)("button", {
1530
+ class: "material-code-button",
1531
+ type: "button",
1532
+ "aria-label": "查看当前物料代码",
1533
+ title: "查看当前物料代码",
1534
+ onPointerdown: a[7] || (a[7] = (0, e.withModifiers)(() => {}, ["stop"])),
1535
+ onClick: (0, e.withModifiers)((e) => function(e) {
1536
+ const t = yt.get(e);
1537
+ t && (Wt.value = t, Ut.value = !1, Ta());
1538
+ }(t.type), ["stop"])
1539
+ }, [(0, e.createVNode)((0, e.unref)(i.Code2), {
1540
+ size: 14,
1541
+ "stroke-width": 1.8,
1542
+ "aria-hidden": "true"
1543
+ })], 40, ce), (0, e.createElementVNode)("span", de, [(0, e.createVNode)((0, e.unref)(i.Plus), {
1544
+ size: 16,
1545
+ "stroke-width": 1.8
1546
+ })])])
1547
+ ], 40, te);
1548
+ var n;
1549
+ }), 128)),
1550
+ (0, e.createCommentVNode)("v-if", !0),
1551
+ (0, e.createCommentVNode)("v-if", !0)
1552
+ ]),
1553
+ (0, e.createElementVNode)("section", ue, [(0, e.createElementVNode)("div", pe, [
1554
+ (0, e.createElementVNode)("div", {
1555
+ class: (0, e.normalizeClass)(["canvas-device-control custom-select", { "is-open": jt.value }]),
1556
+ onPointerdown: a[15] || (a[15] = (0, e.withModifiers)(() => {}, ["stop"]))
1557
+ }, [(0, e.createElementVNode)("button", {
1558
+ class: "custom-select__trigger",
1559
+ type: "button",
1560
+ "aria-haspopup": "listbox",
1561
+ "aria-expanded": jt.value,
1562
+ "aria-label": "设备画布",
1563
+ onClick: a[14] || (a[14] = (0, e.withModifiers)((e) => za("device"), ["stop"]))
1564
+ }, [
1565
+ ((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(ca.value), {
1566
+ size: 13,
1567
+ "stroke-width": 1.9,
1568
+ "aria-hidden": "true"
1569
+ })),
1570
+ (0, e.createElementVNode)("span", null, (0, e.toDisplayString)(st(Ot.value)), 1),
1571
+ (0, e.createVNode)((0, e.unref)(i.ChevronDown), {
1572
+ size: 12,
1573
+ "stroke-width": 1.9,
1574
+ "aria-hidden": "true"
1575
+ })
1576
+ ], 8, me), jt.value ? ((0, e.openBlock)(), (0, e.createElementBlock)("div", ve, [((0, e.openBlock)(!0), (0, e.createElementBlock)(e.Fragment, null, (0, e.renderList)(Mt.value.breakpoints, (t) => ((0, e.openBlock)(), (0, e.createElementBlock)("button", {
1577
+ key: t.id,
1578
+ class: "custom-select__option",
1579
+ type: "button",
1580
+ "aria-selected": Ot.value === t.id,
1581
+ "aria-label": `${st(t.id)} / ${t.columns} 列`,
1582
+ onClick: (e) => {
1583
+ Qa(t.id);
1584
+ }
1585
+ }, [
1586
+ ((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(y[t.id] ?? (0, e.unref)(i.Monitor)), {
1587
+ size: 13,
1588
+ "stroke-width": 1.8,
1589
+ "aria-hidden": "true"
1590
+ })),
1591
+ (0, e.createElementVNode)("span", null, (0, e.toDisplayString)(st(t.id)), 1),
1592
+ (0, e.createElementVNode)("span", fe, (0, e.toDisplayString)(t.columns) + " 列", 1)
1593
+ ], 8, ye))), 128))])) : (0, e.createCommentVNode)("v-if", !0)], 34),
1594
+ (0, e.createElementVNode)("button", {
1595
+ class: "orientation-button",
1596
+ type: "button",
1597
+ "aria-label": "portrait" === It.value ? "切换为横屏" : "切换为竖屏",
1598
+ title: "portrait" === It.value ? "切换为横屏" : "切换为竖屏",
1599
+ onClick: en
1600
+ }, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)("portrait" === It.value ? (0, e.unref)(i.ArrowLeftRight) : (0, e.unref)(i.ArrowUpDown)), {
1601
+ size: 14,
1602
+ "stroke-width": 1.9,
1603
+ "aria-hidden": "true"
1604
+ }))], 8, he),
1605
+ a[27] || (a[27] = (0, e.createElementVNode)("span", {
1606
+ class: "canvas-toolbar__device-divider",
1607
+ "aria-hidden": "true"
1608
+ }, null, -1)),
1609
+ (0, e.createElementVNode)("div", be, [(0, e.createElementVNode)("button", {
1610
+ class: (0, e.normalizeClass)(["canvas-tool-button", { active: "select" === Zt.value }]),
1611
+ type: "button",
1612
+ "aria-label": "选择组件",
1613
+ title: "选择组件",
1614
+ onClick: a[16] || (a[16] = (e) => Zt.value = "select")
1615
+ }, [(0, e.createVNode)((0, e.unref)(i.MousePointer2), {
1616
+ size: 15,
1617
+ "stroke-width": 1.9,
1618
+ "aria-hidden": "true"
1619
+ })], 2), (0, e.createElementVNode)("button", {
1620
+ class: (0, e.normalizeClass)(["canvas-tool-button", { active: "pan" === Zt.value }]),
1621
+ type: "button",
1622
+ "aria-label": "移动画布",
1623
+ title: "移动画布(也可按住空格拖动)",
1624
+ onClick: a[17] || (a[17] = (e) => Zt.value = "pan" === Zt.value ? "select" : "pan")
1625
+ }, [(0, e.createVNode)((0, e.unref)(i.Hand), {
1626
+ size: 15,
1627
+ "stroke-width": 1.9,
1628
+ "aria-hidden": "true"
1629
+ })], 2)]),
1630
+ a[28] || (a[28] = (0, e.createElementVNode)("div", {
1631
+ class: "canvas-toolbar__divider",
1632
+ "aria-hidden": "true"
1633
+ }, null, -1)),
1634
+ (0, e.createElementVNode)("button", {
1635
+ class: "canvas-tool-button",
1636
+ type: "button",
1637
+ "aria-label": "缩小画布",
1638
+ title: "缩小画布",
1639
+ onClick: a[18] || (a[18] = (e) => an(-1))
1640
+ }, [(0, e.createVNode)((0, e.unref)(i.ZoomOut), {
1641
+ size: 15,
1642
+ "stroke-width": 1.9,
1643
+ "aria-hidden": "true"
1644
+ })]),
1645
+ (0, e.createElementVNode)("span", ge, (0, e.toDisplayString)(Va.value), 1),
1646
+ (0, e.createElementVNode)("button", {
1647
+ class: "canvas-tool-button",
1648
+ type: "button",
1649
+ "aria-label": "放大画布",
1650
+ title: "放大画布",
1651
+ onClick: a[19] || (a[19] = (e) => an(1))
1652
+ }, [(0, e.createVNode)((0, e.unref)(i.ZoomIn), {
1653
+ size: 15,
1654
+ "stroke-width": 1.9,
1655
+ "aria-hidden": "true"
1656
+ })]),
1657
+ (0, e.createElementVNode)("button", {
1658
+ class: "canvas-tool-button",
1659
+ type: "button",
1660
+ "aria-label": "适配画布",
1661
+ title: "适配画布",
1662
+ onClick: nn
1663
+ }, [(0, e.createVNode)((0, e.unref)(i.Scan), {
1664
+ size: 15,
1665
+ "stroke-width": 1.9,
1666
+ "aria-hidden": "true"
1667
+ })]),
1668
+ (0, e.createElementVNode)("button", {
1669
+ class: "canvas-tool-button",
1670
+ type: "button",
1671
+ "aria-label": "重置画布位置",
1672
+ title: "重置画布位置",
1673
+ onClick: on
1674
+ }, [(0, e.createVNode)((0, e.unref)(i.RotateCcw), {
1675
+ size: 15,
1676
+ "stroke-width": 1.9,
1677
+ "aria-hidden": "true"
1678
+ })])
1679
+ ]), (0, e.createElementVNode)("div", {
1680
+ ref_key: "canvasViewport",
1681
+ ref: gt,
1682
+ class: (0, e.normalizeClass)(["canvas-viewport", {
1683
+ "is-panning": Yt.value,
1684
+ "is-pan-tool": "pan" === Zt.value
1685
+ }]),
1686
+ onWheel: ln,
1687
+ onPointerdownCapture: sn,
1688
+ onPointermove: cn,
1689
+ onPointerup: dn,
1690
+ onPointercancel: dn
1691
+ }, [(0, e.createElementVNode)("div", {
1692
+ class: (0, e.normalizeClass)(["canvas-scene", `is-${It.value}`]),
1693
+ "data-canvas-width": sa.value.width,
1694
+ "data-canvas-height": sa.value.height,
1695
+ "data-canvas-orientation": It.value,
1696
+ style: (0, e.normalizeStyle)(_a.value)
1697
+ }, [
1698
+ (0, e.withDirectives)((0, e.createElementVNode)("section", we, [(0, e.createElementVNode)("header", Ne, [a[30] || (a[30] = (0, e.createElementVNode)("div", null, [(0, e.createElementVNode)("span", { class: "stage-kicker" }, "编辑模式"), (0, e.createElementVNode)("h2", null, "拖拽布局")], -1)), (0, e.createElementVNode)("span", Ee, [a[29] || (a[29] = (0, e.createElementVNode)("i", { "aria-hidden": "true" }, null, -1)), (0, e.createTextVNode)((0, e.toDisplayString)(st(Ot.value)), 1)])]), (0, e.createElementVNode)("div", {
1699
+ ref_key: "editorGrid",
1700
+ ref: bt,
1701
+ class: "grid-stack layout-editor-grid",
1702
+ role: "grid",
1703
+ "aria-label": "网格布局编辑器",
1704
+ "aria-multiselectable": "true"
1705
+ }, null, 512)], 512), [[e.vShow, "editor" === Ht.value && !Gt.value]]),
1706
+ (0, e.withDirectives)((0, e.createElementVNode)("section", _e, [a[31] || (a[31] = (0, e.createElementVNode)("header", { class: "stage-header" }, [(0, e.createElementVNode)("div", null, [(0, e.createElementVNode)("span", { class: "stage-kicker" }, "预览模式"), (0, e.createElementVNode)("h2", null, "组件渲染")]), (0, e.createElementVNode)("span", { class: "stage-badge" }, [(0, e.createElementVNode)("i", { "aria-hidden": "true" }), (0, e.createTextVNode)("同步布局")])], -1)), (0, e.createVNode)((0, e.unref)(v), {
1707
+ document: Mt.value,
1708
+ breakpoint: Ot.value,
1709
+ materials: (0, e.unref)(yt),
1710
+ target: Vt.value
1711
+ }, {
1712
+ item: (0, e.withCtx)(({ item: t }) => [(0, e.createElementVNode)("button", {
1713
+ class: (0, e.normalizeClass)(["widget layout-item-shell layout-item-shell--interactive", { selected: Tt.value === t.id }]),
1714
+ type: "button",
1715
+ "aria-label": `${lt(t)},${it(t.type)}`,
1716
+ onClick: (e) => {
1717
+ a = t.id, ta?.select(a);
1718
+ return;
1719
+ var a;
1720
+ }
1721
+ }, [(0, e.createVNode)((0, e.unref)(f), (0, e.mergeProps)({
1722
+ item: t,
1723
+ materials: (0, e.unref)(yt),
1724
+ target: Vt.value
1725
+ }, t.props), null, 16, [
1726
+ "item",
1727
+ "materials",
1728
+ "target"
1729
+ ])], 10, Ve)]),
1730
+ _: 1
1731
+ }, 8, [
1732
+ "document",
1733
+ "breakpoint",
1734
+ "materials",
1735
+ "target"
1736
+ ])], 512), [[e.vShow, "vue" === Ht.value]]),
1737
+ (0, e.withDirectives)((0, e.createElementVNode)("section", {
1738
+ class: "runtime-preview-stage",
1739
+ "data-preview-framework": Vt.value,
1740
+ "aria-label": "运行时预览画布"
1741
+ }, [
1742
+ (0, e.createElementVNode)("header", xe, [a[33] || (a[33] = (0, e.createElementVNode)("div", null, [(0, e.createElementVNode)("span", { class: "stage-kicker" }, "预览模式"), (0, e.createElementVNode)("h2", null, "运行时预览")], -1)), (0, e.createElementVNode)("span", Le, [a[32] || (a[32] = (0, e.createElementVNode)("i", { "aria-hidden": "true" }, null, -1)), (0, e.createTextVNode)((0, e.toDisplayString)($t.value) + " · 只读", 1)])]),
1743
+ "vue" === Vt.value ? ((0, e.openBlock)(), (0, e.createBlock)((0, e.unref)(v), {
1744
+ key: 0,
1745
+ document: Mt.value,
1746
+ breakpoint: Ot.value,
1747
+ materials: (0, e.unref)(yt),
1748
+ target: Vt.value
1749
+ }, {
1750
+ item: (0, e.withCtx)(({ item: t }) => [(0, e.createVNode)((0, e.unref)(f), (0, e.mergeProps)({
1751
+ item: t,
1752
+ materials: (0, e.unref)(yt),
1753
+ target: Vt.value,
1754
+ class: "preview-dialog__card"
1755
+ }, t.props), null, 16, [
1756
+ "item",
1757
+ "materials",
1758
+ "target"
1759
+ ])]),
1760
+ _: 1
1761
+ }, 8, [
1762
+ "document",
1763
+ "breakpoint",
1764
+ "materials",
1765
+ "target"
1766
+ ])) : (0, e.createCommentVNode)("v-if", !0),
1767
+ (0, e.withDirectives)((0, e.createElementVNode)("div", {
1768
+ ref_key: "runtimePreview",
1769
+ ref: kt,
1770
+ class: "runtime-preview-grid",
1771
+ "data-preview-renderer": "webcomponent"
1772
+ }, null, 512), [[e.vShow, "webcomponent" === Vt.value]])
1773
+ ], 8, Ce), [[e.vShow, "runtime" === Ht.value && Gt.value]]),
1774
+ (0, e.withDirectives)((0, e.createElementVNode)("section", {
1775
+ class: "vanilla-runtime-stage",
1776
+ "data-preview-framework": Vt.value,
1777
+ "aria-label": "原生运行时画布"
1778
+ }, [
1779
+ (0, e.createElementVNode)("header", $e, [a[35] || (a[35] = (0, e.createElementVNode)("div", null, [(0, e.createElementVNode)("span", { class: "stage-kicker" }, "预览模式"), (0, e.createElementVNode)("h2", null, "原生运行时")], -1)), (0, e.createElementVNode)("span", Be, [a[34] || (a[34] = (0, e.createElementVNode)("i", { "aria-hidden": "true" }, null, -1)), (0, e.createTextVNode)((0, e.toDisplayString)($t.value) + " · 只读", 1)])]),
1780
+ "vue" === Vt.value ? ((0, e.openBlock)(), (0, e.createBlock)((0, e.unref)(v), {
1781
+ key: 0,
1782
+ document: Mt.value,
1783
+ breakpoint: Ot.value,
1784
+ materials: (0, e.unref)(yt),
1785
+ target: Vt.value
1786
+ }, {
1787
+ item: (0, e.withCtx)(({ item: t }) => [(0, e.createVNode)((0, e.unref)(f), (0, e.mergeProps)({
1788
+ item: t,
1789
+ materials: (0, e.unref)(yt),
1790
+ target: Vt.value,
1791
+ class: "preview-dialog__card"
1792
+ }, t.props), null, 16, [
1793
+ "item",
1794
+ "materials",
1795
+ "target"
1796
+ ])]),
1797
+ _: 1
1798
+ }, 8, [
1799
+ "document",
1800
+ "breakpoint",
1801
+ "materials",
1802
+ "target"
1803
+ ])) : (0, e.createCommentVNode)("v-if", !0),
1804
+ (0, e.withDirectives)((0, e.createElementVNode)("div", {
1805
+ ref_key: "vanillaRuntime",
1806
+ ref: wt,
1807
+ class: "runtime-preview-grid",
1808
+ "data-preview-renderer": "webcomponent"
1809
+ }, null, 512), [[e.vShow, "webcomponent" === Vt.value]])
1810
+ ], 8, Se), [[e.vShow, "vanilla" === Ht.value]])
1811
+ ], 14, ke)], 34)]),
1812
+ (0, e.createElementVNode)("aside", De, [
1813
+ (0, e.createElementVNode)("div", ze, [
1814
+ (0, e.createElementVNode)("div", null, [a[36] || (a[36] = (0, e.createElementVNode)("span", { class: "eyebrow" }, "实时输出", -1)), (0, e.createElementVNode)("h2", null, (0, e.toDisplayString)(ya.value), 1)]),
1815
+ (0, e.createElementVNode)("button", {
1816
+ class: "copy-code-button",
1817
+ type: "button",
1818
+ "aria-label": qt.value ? "代码已复制" : "复制当前代码",
1819
+ title: qt.value ? "代码已复制" : "复制当前代码",
1820
+ onClick: vn
1821
+ }, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(qt.value ? (0, e.unref)(i.CopyCheck) : (0, e.unref)(i.Copy)), {
1822
+ size: 15,
1823
+ "stroke-width": 1.8,
1824
+ "aria-hidden": "true"
1825
+ }))], 8, Me),
1826
+ (0, e.createElementVNode)("button", {
1827
+ class: "download-code-button",
1828
+ type: "button",
1829
+ "aria-label": "下载当前代码",
1830
+ title: "下载当前代码",
1831
+ onClick: yn
1832
+ }, [(0, e.createVNode)((0, e.unref)(i.Download), {
1833
+ size: 15,
1834
+ "stroke-width": 1.8,
1835
+ "aria-hidden": "true"
1836
+ })])
1837
+ ]),
1838
+ (0, e.createElementVNode)("pre", Te, [(0, e.createElementVNode)("code", { innerHTML: Na.value }, null, 8, Ae)]),
1839
+ (0, e.createElementVNode)("div", Oe, [a[37] || (a[37] = (0, e.createElementVNode)("span", {
1840
+ class: "code-status__dot",
1841
+ "aria-hidden": "true"
1842
+ }, null, -1)), (0, e.createElementVNode)("span", null, "已根据当前布局、" + (0, e.toDisplayString)(st(Ot.value)) + "断点实时生成 · 共 " + (0, e.toDisplayString)(Ea.value) + " 行,可滚动查看完整输出", 1)])
1843
+ ])
1844
+ ]),
1845
+ (0, e.createVNode)(e.Transition, { name: "preview-dialog" }, {
1846
+ default: (0, e.withCtx)(() => [Kt.value ? ((0, e.openBlock)(), (0, e.createElementBlock)("div", {
1847
+ key: 0,
1848
+ class: "preview-dialog",
1849
+ "data-preview-framework": Vt.value,
1850
+ "data-theme": Xt.value,
1851
+ role: "dialog",
1852
+ "aria-modal": "true",
1853
+ "aria-labelledby": "layout-preview-title"
1854
+ }, [(0, e.createElementVNode)("button", {
1855
+ class: "preview-dialog__backdrop",
1856
+ type: "button",
1857
+ "aria-label": "关闭实时预览",
1858
+ onClick: Ja
1859
+ }), (0, e.createElementVNode)("section", je, [
1860
+ (0, e.createElementVNode)("header", Pe, [a[39] || (a[39] = (0, e.createElementVNode)("div", null, [(0, e.createElementVNode)("span", { class: "stage-kicker" }, "真实渲染"), (0, e.createElementVNode)("h2", { id: "layout-preview-title" }, "实时预览")], -1)), (0, e.createElementVNode)("div", Re, [(0, e.createElementVNode)("span", qe, [a[38] || (a[38] = (0, e.createElementVNode)("i", { "aria-hidden": "true" }, null, -1)), (0, e.createTextVNode)((0, e.toDisplayString)(st(Ot.value)), 1)]), (0, e.createElementVNode)("button", {
1861
+ class: "icon-button",
1862
+ type: "button",
1863
+ "aria-label": "关闭实时预览",
1864
+ title: "关闭实时预览",
1865
+ onClick: Ja
1866
+ }, [(0, e.createVNode)((0, e.unref)(i.X), {
1867
+ size: 16,
1868
+ "stroke-width": 1.9,
1869
+ "aria-hidden": "true"
1870
+ })])])]),
1871
+ (0, e.createElementVNode)("div", Ge, [(0, e.createElementVNode)("div", Ke, ["vue" === Vt.value ? ((0, e.openBlock)(), (0, e.createBlock)((0, e.unref)(v), {
1872
+ key: 0,
1873
+ document: Mt.value,
1874
+ breakpoint: Ot.value,
1875
+ materials: (0, e.unref)(yt),
1876
+ target: Vt.value
1877
+ }, {
1878
+ item: (0, e.withCtx)(({ item: t }) => [(0, e.createVNode)((0, e.unref)(f), (0, e.mergeProps)({
1879
+ item: t,
1880
+ materials: (0, e.unref)(yt),
1881
+ target: Vt.value,
1882
+ class: "preview-dialog__card"
1883
+ }, t.props), null, 16, [
1884
+ "item",
1885
+ "materials",
1886
+ "target"
1887
+ ])]),
1888
+ _: 1
1889
+ }, 8, [
1890
+ "document",
1891
+ "breakpoint",
1892
+ "materials",
1893
+ "target"
1894
+ ])) : ((0, e.openBlock)(), (0, e.createElementBlock)("div", {
1895
+ key: 1,
1896
+ ref_key: "previewDialogRuntime",
1897
+ ref: Nt,
1898
+ class: "runtime-preview-grid preview-dialog__runtime-grid",
1899
+ "data-preview-renderer": "webcomponent"
1900
+ }, null, 512))])]),
1901
+ (0, e.createElementVNode)("footer", { class: "preview-dialog__footer" }, [a[40] || (a[40] = (0, e.createElementVNode)("span", null, "此处展示当前布局的真实 CSS Grid 渲染结果", -1)), (0, e.createElementVNode)("button", {
1902
+ class: "preview-dialog__close-button",
1903
+ type: "button",
1904
+ onClick: Ja
1905
+ }, " 关闭预览 ")])
1906
+ ])], 8, Ie)) : (0, e.createCommentVNode)("v-if", !0)]),
1907
+ _: 1
1908
+ }),
1909
+ (0, e.createVNode)(e.Transition, { name: "preview-dialog" }, {
1910
+ default: (0, e.withCtx)(() => [Wt.value ? ((0, e.openBlock)(), (0, e.createElementBlock)("div", {
1911
+ key: 0,
1912
+ class: "preview-dialog material-code-dialog",
1913
+ "data-material-code-dialog": "true",
1914
+ "data-material-code-framework": Vt.value,
1915
+ "data-material-code-type": Wt.value.type,
1916
+ "data-theme": Xt.value,
1917
+ role: "dialog",
1918
+ "aria-modal": "true",
1919
+ "aria-labelledby": "material-code-title"
1920
+ }, [(0, e.createElementVNode)("button", {
1921
+ class: "preview-dialog__backdrop",
1922
+ type: "button",
1923
+ "aria-label": "关闭物料代码",
1924
+ onClick: Ba
1925
+ }), (0, e.createElementVNode)("section", Ue, [
1926
+ (0, e.createElementVNode)("header", He, [(0, e.createElementVNode)("div", null, [
1927
+ a[41] || (a[41] = (0, e.createElementVNode)("span", { class: "stage-kicker" }, "注册表物料", -1)),
1928
+ (0, e.createElementVNode)("h2", Xe, (0, e.toDisplayString)(Wt.value.title ?? Wt.value.label ?? Wt.value.type), 1),
1929
+ (0, e.createElementVNode)("p", Je, (0, e.toDisplayString)("vue" === Vt.value ? "Vue 3 真实组件用法" : "原生 Web Component 标签用法"), 1)
1930
+ ]), (0, e.createElementVNode)("div", Fe, [(0, e.createElementVNode)("span", Ze, [a[42] || (a[42] = (0, e.createElementVNode)("i", { "aria-hidden": "true" }, null, -1)), (0, e.createTextVNode)((0, e.toDisplayString)($t.value), 1)]), (0, e.createElementVNode)("button", {
1931
+ class: "icon-button",
1932
+ type: "button",
1933
+ "aria-label": "关闭物料代码",
1934
+ title: "关闭物料代码",
1935
+ onClick: Ba
1936
+ }, [(0, e.createVNode)((0, e.unref)(i.X), {
1937
+ size: 16,
1938
+ "stroke-width": 1.9,
1939
+ "aria-hidden": "true"
1940
+ })])])]),
1941
+ (0, e.createElementVNode)("div", Ye, [(0, e.createElementVNode)("pre", Qe, [(0, e.createElementVNode)("code", { innerHTML: ga.value }, null, 8, et)])]),
1942
+ (0, e.createElementVNode)("footer", tt, [(0, e.createElementVNode)("span", null, "来自当前注册表的 " + (0, e.toDisplayString)("vue" === Vt.value ? "组件导出" : "自定义元素标签") + ",共 " + (0, e.toDisplayString)(ka.value) + " 行", 1), (0, e.createElementVNode)("div", at, [(0, e.createElementVNode)("button", {
1943
+ class: "copy-code-button",
1944
+ type: "button",
1945
+ "aria-label": Ut.value ? "代码已复制" : "复制物料代码",
1946
+ title: Ut.value ? "代码已复制" : "复制物料代码",
1947
+ onClick: Da
1948
+ }, [((0, e.openBlock)(), (0, e.createBlock)((0, e.resolveDynamicComponent)(Ut.value ? (0, e.unref)(i.CopyCheck) : (0, e.unref)(i.Copy)), {
1949
+ size: 15,
1950
+ "stroke-width": 1.8,
1951
+ "aria-hidden": "true"
1952
+ }))], 8, nt), (0, e.createElementVNode)("button", {
1953
+ class: "preview-dialog__close-button",
1954
+ type: "button",
1955
+ onClick: Ba
1956
+ }, " 关闭 ")])])
1957
+ ])], 8, We)) : (0, e.createCommentVNode)("v-if", !0)]),
1958
+ _: 1
1959
+ })
1960
+ ], 8, k));
1961
+ }
1962
+ });
1963
+ ot.__file = "src/components/LLayoutWorkspace.vue";
1964
+ var rt = ot;
1965
+ const lt = (0, e.defineComponent)({
1966
+ name: "LMaterialDragSource",
1967
+ props: {
1968
+ type: {
1969
+ type: String,
1970
+ default: void 0
1971
+ },
1972
+ material: {
1973
+ type: Object,
1974
+ default: void 0
1975
+ },
1976
+ props: {
1977
+ type: Object,
1978
+ default: () => ({})
1979
+ },
1980
+ placement: {
1981
+ type: Object,
1982
+ default: void 0
1983
+ },
1984
+ editor: {
1985
+ type: Object,
1986
+ required: !0
1987
+ }
1988
+ },
1989
+ setup(t, { slots: a }) {
1990
+ let n, o = () => {};
1991
+ const r = t.material, l = r?.type ?? t.type;
1992
+ if (!l) throw new Error("LMaterialDragSource requires type or material.");
1993
+ const i = {
1994
+ ...r?.defaults ?? {},
1995
+ ...t.props
1996
+ }, s = () => ({
1997
+ type: l,
1998
+ props: i,
1999
+ placement: {
2000
+ x: t.placement?.x ?? 0,
2001
+ y: t.placement?.y ?? 0,
2002
+ w: t.placement?.w ?? r?.defaultLayout?.w ?? r?.size?.default.w ?? 1,
2003
+ h: t.placement?.h ?? r?.defaultLayout?.h ?? r?.size?.default.h ?? 1
2004
+ }
2005
+ }), c = (e) => {
2006
+ t.editor.beginExternalDrag({
2007
+ ...s(),
2008
+ element: e.currentTarget,
2009
+ dataTransfer: e.dataTransfer ?? void 0
2010
+ });
2011
+ }, d = () => t.editor.endExternalDrag();
2012
+ return (0, e.onMounted)(() => {
2013
+ n && (o = t.editor.registerExternalDragSource({
2014
+ ...s(),
2015
+ element: n
2016
+ })), "undefined" != typeof document && document.addEventListener("dragend", d);
2017
+ }), (0, e.onBeforeUnmount)(() => {
2018
+ o(), "undefined" != typeof document && document.removeEventListener("dragend", d);
2019
+ }), () => (0, e.h)("div", {
2020
+ ref: (e) => {
2021
+ n = e;
2022
+ },
2023
+ class: "ldesign-layout-material-drag-source grid-stack-item",
2024
+ "data-material-type": l,
2025
+ "data-material-category": r?.category,
2026
+ "data-material-title": r?.title ?? r?.label,
2027
+ "aria-label": `添加${r?.title ?? r?.label ?? l}`,
2028
+ onDragstart: c
2029
+ }, a.default?.() ?? r?.title ?? r?.label ?? l);
2030
+ }
2031
+ });
2032
+ exports.LGrid = v, exports.LGridItem = y, exports.LLayoutEditor = h, exports.LLayoutWorkspace = rt, exports.LMaterialDragSource = lt, exports.LMaterialRenderer = f, exports.LMetricCard = b, exports.LTrendCard = g, exports.useLayoutEditor = function(t) {
2033
+ const a = (0, e.shallowRef)((0, n.createLayoutEditor)(t));
2034
+ return (0, e.onMounted)(() => a.value.mount()), (0, e.onBeforeUnmount)(() => a.value.destroy()), a;
2035
+ };
2036
+ });
2037
+ /*! End of @composy/layout-vue | Powered by @composy/builder */
2038
+ //# sourceMappingURL=index.min.js.map