@robot-admin/naive-ui-components 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +2 -1
- package/README_EN.md +16 -15
- package/dist/BPMN.cjs +1 -0
- package/dist/BPMN.js +1 -0
- package/dist/C_ActionBar.css +68 -55
- package/dist/C_ActionBar2.cjs +1 -1
- package/dist/C_ActionBar2.js +1 -1
- package/dist/C_AntV.cjs +1 -1
- package/dist/C_AntV.css +156 -153
- package/dist/C_AntV.js +1 -1
- package/dist/C_AntV2.cjs +1 -4
- package/dist/C_AntV2.js +1 -4
- package/dist/C_AudioPlayer.css +74 -61
- package/dist/C_AudioPlayer2.cjs +1 -1
- package/dist/C_AudioPlayer2.js +1 -1
- package/dist/C_AutoComplete.css +3 -3
- package/dist/C_AutoComplete2.cjs +1 -1
- package/dist/C_AutoComplete2.js +1 -1
- package/dist/C_AvatarGroup.css +38 -38
- package/dist/C_AvatarGroup2.cjs +1 -1
- package/dist/C_AvatarGroup2.js +1 -1
- package/dist/C_Barcode.css +9 -9
- package/dist/C_Barcode2.cjs +1 -1
- package/dist/C_Barcode2.js +1 -1
- package/dist/C_Breadcrumb.css +73 -60
- package/dist/C_Breadcrumb2.cjs +1 -1
- package/dist/C_Breadcrumb2.js +1 -1
- package/dist/C_Captcha.css +74 -40
- package/dist/C_Captcha.d.ts +2 -2
- package/dist/C_Captcha2.cjs +1 -1
- package/dist/C_Captcha2.js +1 -1
- package/dist/C_Cascade.css +4 -4
- package/dist/C_Cascade2.cjs +1 -1
- package/dist/C_Cascade2.js +1 -1
- package/dist/C_Chat.css +136 -115
- package/dist/C_Chat2.cjs +1 -1
- package/dist/C_Chat2.js +1 -1
- package/dist/C_City.css +57 -56
- package/dist/C_City2.cjs +1 -1
- package/dist/C_City2.js +1 -1
- package/dist/C_Code.cjs +1 -1
- package/dist/C_Code.css +110 -45
- package/dist/C_Code.js +1 -1
- package/dist/C_Code2.cjs +2 -1
- package/dist/C_Code2.js +2 -1
- package/dist/C_CollapsePanel.css +67 -54
- package/dist/C_CollapsePanel2.cjs +1 -1
- package/dist/C_CollapsePanel2.js +1 -1
- package/dist/C_ContextMenu.css +36 -23
- package/dist/C_ContextMenu2.cjs +1 -1
- package/dist/C_ContextMenu2.js +1 -1
- package/dist/C_Cron.css +144 -131
- package/dist/C_Cron2.cjs +1 -1
- package/dist/C_Cron2.js +1 -1
- package/dist/C_DataPicker.css +84 -84
- package/dist/C_DataPicker.d.ts +2 -2
- package/dist/C_DataPicker2.cjs +1 -1
- package/dist/C_DataPicker2.js +1 -1
- package/dist/C_Date.css +5 -5
- package/dist/C_Date2.cjs +1 -1
- package/dist/C_Date2.js +1 -1
- package/dist/C_Density2.cjs +1 -1
- package/dist/C_Density2.js +1 -1
- package/dist/C_Draggable.css +71 -71
- package/dist/C_Draggable2.cjs +1 -1
- package/dist/C_Draggable2.js +1 -1
- package/dist/C_Editor.css +51 -76
- package/dist/C_Editor2.cjs +1 -1
- package/dist/C_Editor2.js +1 -1
- package/dist/C_FilePreview.css +109 -109
- package/dist/C_FilePreview2.cjs +1 -1
- package/dist/C_FilePreview2.js +1 -1
- package/dist/C_Form.base.css +64 -74
- package/dist/C_Form.cjs +1 -1
- package/dist/C_Form.css +64 -74
- package/dist/C_Form.d.cts +1 -2
- package/dist/C_Form.d.ts +1 -2
- package/dist/C_Form.js +1 -1
- package/dist/C_FormModal.css +69 -56
- package/dist/C_FormModal.d.ts +1 -1
- package/dist/C_FormModal2.cjs +1 -1
- package/dist/C_FormModal2.js +1 -1
- package/dist/C_FormSearch.css +99 -99
- package/dist/C_FormSearch.d.ts +2 -2
- package/dist/C_FormulaEditor.css +171 -150
- package/dist/C_FullCalendar.css +35 -11
- package/dist/C_FullCalendar2.cjs +1 -1
- package/dist/C_FullCalendar2.js +1 -1
- package/dist/C_GlobalSearch.css +221 -200
- package/dist/C_GlobalSearch2.cjs +1 -1
- package/dist/C_GlobalSearch2.js +1 -1
- package/dist/C_Guide.css +37 -24
- package/dist/C_Guide2.cjs +1 -1
- package/dist/C_Guide2.js +1 -1
- package/dist/C_Icon.css +13 -0
- package/dist/C_ImageCropper.css +41 -40
- package/dist/C_ImageCropper2.cjs +1 -1
- package/dist/C_ImageCropper2.js +1 -1
- package/dist/C_Language.css +15 -2
- package/dist/C_Language2.cjs +1 -1
- package/dist/C_Language2.js +1 -1
- package/dist/C_Loading.css +18 -18
- package/dist/C_Loading2.cjs +1 -1
- package/dist/C_Loading2.js +1 -1
- package/dist/C_Login.css +88 -54
- package/dist/C_Login.d.ts +2 -2
- package/dist/C_Login2.cjs +1 -1
- package/dist/C_Login2.js +1 -1
- package/dist/C_Map.css +13 -13
- package/dist/C_Map2.cjs +1 -1
- package/dist/C_Map2.js +1 -1
- package/dist/C_Markdown.css +69 -60
- package/dist/C_Markdown2.cjs +1 -1
- package/dist/C_Markdown2.js +1 -1
- package/dist/C_NotificationCenter.css +173 -199
- package/dist/C_NotificationCenter2.cjs +1 -1
- package/dist/C_NotificationCenter2.js +1 -1
- package/dist/C_OrgChart.css +16 -16
- package/dist/C_OrgChart2.cjs +1 -1
- package/dist/C_OrgChart2.js +1 -1
- package/dist/C_PageLoading.css +33 -33
- package/dist/C_QRCode.css +14 -14
- package/dist/C_QRCode2.cjs +1 -1
- package/dist/C_QRCode2.js +1 -1
- package/dist/C_Select.css +4 -4
- package/dist/C_Select2.cjs +1 -1
- package/dist/C_Select2.js +1 -1
- package/dist/C_Signature.css +25 -25
- package/dist/C_Signature2.cjs +1 -1
- package/dist/C_Signature2.js +1 -1
- package/dist/C_Skeleton.css +28 -16
- package/dist/C_Skeleton2.cjs +1 -1
- package/dist/C_Skeleton2.js +1 -1
- package/dist/C_SplitPane.css +82 -70
- package/dist/C_SplitPane2.cjs +1 -1
- package/dist/C_SplitPane2.js +1 -1
- package/dist/C_Steps.css +48 -48
- package/dist/C_Steps2.cjs +1 -1
- package/dist/C_Steps2.js +1 -1
- package/dist/C_Table.base.css +302 -299
- package/dist/C_Table.css +238 -225
- package/dist/C_Table.d.ts +3 -2
- package/dist/C_Table2.cjs +4 -4
- package/dist/C_Table2.js +4 -4
- package/dist/C_Tabs.css +11 -51
- package/dist/C_TagsView.css +91 -84
- package/dist/C_TagsView2.cjs +1 -1
- package/dist/C_TagsView2.js +1 -1
- package/dist/C_Theme.css +13 -0
- package/dist/C_Time.css +5 -5
- package/dist/C_Time2.cjs +1 -1
- package/dist/C_Time2.js +1 -1
- package/dist/C_Timeline.css +112 -71
- package/dist/C_Timeline2.cjs +1 -1
- package/dist/C_Timeline2.js +1 -1
- package/dist/C_Transfer.css +69 -60
- package/dist/C_Transfer2.cjs +1 -1
- package/dist/C_Transfer2.js +1 -1
- package/dist/C_Tree.css +30 -30
- package/dist/C_Tree.d.ts +3 -2
- package/dist/C_Tree2.cjs +1 -1
- package/dist/C_Tree2.js +1 -1
- package/dist/C_Upload.css +113 -116
- package/dist/C_Upload2.cjs +1 -1
- package/dist/C_Upload2.js +1 -1
- package/dist/C_UserPicker.css +2 -2
- package/dist/C_UserPicker.d.ts +2 -2
- package/dist/C_VideoPlayer.cjs +1 -1
- package/dist/C_VideoPlayer.css +138 -119
- package/dist/C_VideoPlayer.js +1 -1
- package/dist/C_VideoPlayer2.cjs +3 -3
- package/dist/C_VideoPlayer2.js +3 -3
- package/dist/C_VtableGantt.css +37 -40
- package/dist/C_WaterFall.css +55 -46
- package/dist/C_WaterFall2.cjs +1 -1
- package/dist/C_WaterFall2.js +1 -1
- package/dist/C_WorkFlow.css +456 -520
- package/dist/C_WorkFlow.d.ts +2 -2
- package/dist/C_WorkFlow2.cjs +1 -1
- package/dist/C_WorkFlow2.js +1 -1
- package/dist/Card.cjs +1 -1
- package/dist/Card.js +1 -1
- package/dist/Dynamic.cjs +1 -1
- package/dist/Dynamic.js +1 -1
- package/dist/ER.cjs +1 -0
- package/dist/ER.js +1 -0
- package/dist/NodeConfigModal.cjs +1 -1
- package/dist/NodeConfigModal.js +1 -1
- package/dist/SearchFieldSettings.cjs +1 -1
- package/dist/SearchFieldSettings.js +1 -1
- package/dist/Steps.cjs +1 -1
- package/dist/Steps.js +1 -1
- package/dist/Tabs.cjs +1 -1
- package/dist/Tabs.js +1 -1
- package/dist/UML.cjs +4 -0
- package/dist/UML.js +4 -0
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +3 -10
- package/dist/config.d.ts +3 -10
- package/dist/config.js +1 -1
- package/dist/constants3.d.cts +3 -3
- package/dist/constants3.d.ts +3 -3
- package/dist/constants4.d.cts +1 -1
- package/dist/constants4.d.ts +1 -1
- package/dist/constants5.d.cts +2 -2
- package/dist/constants5.d.ts +2 -2
- package/dist/context.cjs +1 -0
- package/dist/{useFormConfig.d.cts → context.d.cts} +8 -2
- package/dist/{useFormConfig.d.ts → context.d.ts} +8 -2
- package/dist/context.js +1 -0
- package/dist/createPageLoading.cjs +1 -1
- package/dist/createPageLoading.js +1 -1
- package/dist/data2.d.cts +8 -8
- package/dist/data2.d.ts +8 -8
- package/dist/data3.cjs +1 -1
- package/dist/data3.js +1 -1
- package/dist/dateRange.d.ts +1 -1
- package/dist/editors.d.cts +7 -7
- package/dist/editors.d.ts +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.js +1 -1
- package/dist/fieldRenderers.cjs +1 -1
- package/dist/fieldRenderers.js +1 -1
- package/dist/graphics.cjs +1 -1
- package/dist/graphics.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -1
- package/dist/index.vue.d.cts +1 -1
- package/dist/index.vue.d.ts +1 -1
- package/dist/index10.vue.d.cts +3 -0
- package/dist/index10.vue.d.ts +2 -2
- package/dist/index11.vue.d.cts +2 -2
- package/dist/index11.vue.d.ts +4 -4
- package/dist/index12.vue.d.cts +4 -4
- package/dist/index13.vue.d.ts +1 -2
- package/dist/index14.vue.d.cts +1 -2
- package/dist/index15.vue.d.ts +1 -1
- package/dist/index16.vue.d.cts +1 -1
- package/dist/index16.vue.d.ts +5 -5
- package/dist/index17.vue.d.cts +5 -5
- package/dist/index17.vue.d.ts +7 -7
- package/dist/index18.vue.d.cts +7 -7
- package/dist/index20.vue.d.ts +1 -1
- package/dist/index21.vue.d.cts +1 -1
- package/dist/index21.vue.d.ts +2 -2
- package/dist/index22.vue.d.cts +2 -2
- package/dist/index3.vue.d.cts +1 -1
- package/dist/index3.vue.d.ts +1 -1
- package/dist/index31.vue.d.cts +4 -4
- package/dist/index31.vue.d.ts +4 -4
- package/dist/index32.vue.d.cts +2 -2
- package/dist/index32.vue.d.ts +2 -2
- package/dist/index4.vue.d.cts +2 -2
- package/dist/index4.vue.d.ts +2 -2
- package/dist/index7.vue.d.ts +2 -0
- package/dist/index8.vue.d.cts +2 -0
- package/dist/index9.vue.d.ts +3 -0
- package/dist/mapUtils.d.cts +3 -3
- package/dist/mapUtils.d.ts +3 -3
- package/dist/readonlyGraph.cjs +1 -0
- package/dist/readonlyGraph.js +1 -0
- package/dist/serializeSearch.cjs +1 -1
- package/dist/serializeSearch.js +1 -1
- package/dist/shared-tokens.css +1 -1
- package/dist/source.cjs +1 -1
- package/dist/source.js +1 -1
- package/dist/style.css +3601 -3554
- package/dist/theme.cjs +1 -0
- package/dist/theme.d.cts +73 -0
- package/dist/theme.d.ts +73 -0
- package/dist/theme.js +1 -0
- package/dist/theme2.cjs +1 -0
- package/dist/theme2.js +1 -0
- package/dist/useCalendarEvents.d.cts +2 -2
- package/dist/useCalendarEvents.d.ts +2 -2
- package/dist/useCollapsePanel.d.cts +4 -4
- package/dist/useCollapsePanel.d.ts +4 -4
- package/dist/useComponentDensity.cjs +1 -0
- package/dist/useComponentDensity.js +1 -0
- package/dist/useComponentLocale.cjs +1 -1
- package/dist/useComponentLocale.js +1 -1
- package/dist/useComponentTheme.cjs +1 -0
- package/dist/useComponentTheme.js +1 -0
- package/dist/useCropperCore.d.cts +3 -3
- package/dist/useCropperCore.d.ts +3 -3
- package/dist/useDynamicFormState.d.cts +1 -1
- package/dist/useDynamicFormState.d.ts +1 -1
- package/dist/useEdgeInteraction.cjs +1 -0
- package/dist/useEdgeInteraction.d.cts +21 -4
- package/dist/useEdgeInteraction.d.ts +21 -4
- package/dist/useEdgeInteraction.js +1 -0
- package/dist/useFormConfig.cjs +1 -1
- package/dist/useFormConfig.js +1 -1
- package/dist/useFormRenderer.d.cts +1 -1
- package/dist/useFormRenderer.d.ts +1 -1
- package/dist/useFormulaEvaluator.cjs +2 -2
- package/dist/useFormulaEvaluator.js +2 -2
- package/dist/useFullscreen.d.cts +3 -3
- package/dist/useFullscreen.d.ts +3 -3
- package/dist/useGraphExport.cjs +1 -0
- package/dist/useGraphExport.js +1 -0
- package/dist/useInfiniteScroll.d.cts +4 -4
- package/dist/useInfiniteScroll.d.ts +4 -4
- package/dist/useQRCode.d.cts +2 -2
- package/dist/useQRCode.d.ts +2 -2
- package/dist/useSignatureHistory.d.cts +4 -4
- package/dist/useSignatureHistory.d.ts +4 -4
- package/dist/useSplitResize.d.cts +3 -3
- package/dist/useSplitResize.d.ts +3 -3
- package/dist/useWorkflowValidation.d.cts +30 -30
- package/dist/useWorkflowValidation.d.ts +30 -30
- package/dist/verification.d.cts +2 -3
- package/dist/verification.d.ts +2 -3
- package/docs/guides/theme.md +79 -0
- package/package.json +1 -1
- /package/dist/{config2.d.ts → component-config.d.ts} +0 -0
package/dist/C_GlobalSearch2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);const e=require(`./export-helper.cjs`),t=require(`./virtualList.cjs`);let n=require(`vue`);const r=e=>e.replace(/^\//,``).replace(/\//g,` > `)||`首页`;function i(e){let t=new Map,n=new Map;return{entries:e.map(e=>{let{key:i}=e,o=r(i);t.set(i,o),n.set(i,e);let s=e.label.toLowerCase();return{item:e,label:s,path:o.toLowerCase(),normalizedLabel:a(s),text:a([s,o,e.breadcrumb??``,...e.keywords??[]].join(` `))}}),paths:t,byKey:n}}function a(e){return e.normalize(`NFKC`).toLowerCase().trim().replace(/\s+/g,` `)}function o(e,t,n=`literal`){if(!t.trim())return[];if(n===`tokens`){let n=a(t),r=n.split(` `);return e.entries.filter(e=>r.every(t=>e.text.includes(t))).map(e=>({item:e.item,rank:e.normalizedLabel===n?0:e.normalizedLabel.startsWith(n)?1:e.normalizedLabel.includes(n)?2:3})).sort((e,t)=>e.rank-t.rank).map(e=>e.item)}let r=t.toLowerCase();return e.entries.filter(e=>e.label.includes(r)||e.path.includes(r)).map(e=>e.item)}function s(e){let t=typeof e==`string`?{query:e}:e;if(!t||typeof t!=`object`)return[];let{query:n,menuKey:r,menuItem:i,timestamp:a}=t,o=typeof r==`string`?r:i?.key,s=Number.isFinite(a)?a:0;return typeof o==`string`?[{menuKey:o,timestamp:s}]:typeof n!=`string`||!n.trim()?[]:[{query:n.slice(0,200),menuKey:null,timestamp:s}]}function c(e){let t=()=>(0,n.toValue)(e),a=()=>t().menuItems(),c=(0,n.computed)(()=>t().storageKey??`robot-search-history`),l=(0,n.computed)(()=>Math.min(100,Math.max(0,Math.trunc(t().maxHistory??10)))),u=(0,n.computed)(()=>Math.min(l.value,Math.max(0,Math.trunc(t().maxDisplayHistory??5)))),d=(0,n.ref)(!1),f=(0,n.ref)(``),p=(0,n.ref)(0),m=(0,n.ref)(),h=(0,n.ref)([]),g=(0,n.ref)(!1),_=(0,n.computed)(()=>t().isDark?.()??!1),v=(0,n.computed)(()=>i(a())),y=(0,n.computed)(()=>{if(!f.value.trim())return[];let e=v.value,{search:n,matchMode:r}=t();if(!n)return o(e,f.value,r);let i=new Set;return n(f.value,e.entries.map(e=>e.item)).flatMap(t=>{let n=e.byKey.get(t.key);return!n||i.has(t.key)?[]:(i.add(t.key),[n])})}),b=(0,n.computed)(()=>{let e=[];for(let[t,n]of h.value.entries()){if(e.length>=u.value)break;let{menuKey:r,query:i,timestamp:a}=n,o=r===null?null:v.value.byKey.get(r),s=o?.label??i;o===void 0||s===void 0||e.push({item:{query:s,menuItem:o,timestamp:a},sourceIndex:t})}return e}),x=(0,n.computed)(()=>b.value.map(({item:e})=>e)),ee=(0,n.computed)(()=>y.value.length>0),te=(0,n.computed)(()=>!!f.value.trim()||x.value.length>0),S=(0,n.computed)(()=>f.value.trim()?y.value.length:x.value.length),C=(e,t)=>[`robot-result-item`,t&&`robot-history-item`,{"robot-result-item-selected":p.value===e}],w=(e,n)=>{if(!n)return[{text:e,matched:!1}];let r=t().matchMode===`tokens`?n.trim().split(/\s+/).filter(Boolean).sort((e,t)=>t.length-e.length):[n];if(!r.length)return[{text:e,matched:!1}];let i=RegExp(`(${r.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})`,`gi`);return e.split(i).filter(Boolean).map(e=>({text:e,matched:r.some(t=>e.toLocaleLowerCase()===t.toLocaleLowerCase())}))},T=e=>v.value.paths.get(e)??r(e),E=()=>{if(!(typeof localStorage>`u`))try{localStorage.setItem(c.value,JSON.stringify(h.value))}catch{}},D=e=>{if(!e.label.trim())return;let t=h.value.filter(t=>t.menuKey!==e.key);h.value=[{menuKey:e.key,timestamp:Date.now()},...t].slice(0,l.value),E()},O=()=>{if(h.value=[],!(typeof localStorage>`u`))try{let e=localStorage.getItem(c.value);if(e){let t=JSON.parse(e);if(!Array.isArray(t))return;h.value=t.flatMap(s).slice(0,l.value)}}catch{h.value=[]}},k=()=>{if(h.value=[],!(typeof localStorage>`u`))try{localStorage.removeItem(c.value)}catch{}},A=e=>{let t=b.value[e];t&&(h.value.splice(t.sourceIndex,1),E(),p.value=Math.max(0,Math.min(p.value,x.value.length-1)))},j=async()=>{d.value=!0,f.value=``,p.value=0,g.value=!1,await(0,n.nextTick)(),m.value?.focus()},M=()=>{d.value=!1,f.value=``,p.value=0,g.value=!1},N=e=>{if(e.menuItem){let n=v.value.byKey.get(e.menuItem.key);if(!n)return;t().onSelect?.(n.key,!!n.children?.length),M()}else f.value=e.query,p.value=0},P=e=>{let n=v.value.byKey.get(e.key);n&&(D(n),t().onSelect?.(n.key,!!n.children?.length),M())},F=e=>g.value||!!(e&&(e.defaultPrevented||e.isComposing||e.keyCode===229||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey)),I=e=>{if(F(e))return;p.value=Math.max(0,Math.min(p.value,S.value-1));let t=!f.value.trim()&&x.value.length>0,n=f.value.trim()&&y.value.length>0;if(t){let t=x.value[p.value];t&&(e?.preventDefault(),N(t))}else if(n){let t=y.value[p.value];t&&(e?.preventDefault(),P(t))}},L=e=>{F(e)||(e?.preventDefault(),p.value=Math.max(0,Math.min(p.value+1,S.value-1)))},R=e=>{F(e)||(e?.preventDefault(),p.value=Math.max(0,Math.min(p.value-1,S.value-1)))},z=e=>{e.key!==`Escape`||F(e)||(e.preventDefault(),M())},B=e=>{e.key===`ArrowDown`?L(e):e.key===`ArrowUp`?R(e):e.key===`Enter`?I(e):z(e)};(0,n.watch)(f,()=>{p.value=0}),(0,n.watch)(S,e=>{p.value=Math.max(0,Math.min(p.value,e-1))}),(0,n.watch)(c,O);let V=e=>{e.defaultPrevented||e.isComposing||e.keyCode===229||g.value||(e.ctrlKey||e.metaKey)&&e.key===`k`&&(e.preventDefault(),j())};return(0,n.onMounted)(()=>{O(),document.addEventListener(`keydown`,V)}),(0,n.onUnmounted)(()=>document.removeEventListener(`keydown`,V)),{showDialog:d,searchValue:f,selectedIndex:p,searchInputRef:m,isDark:_,filteredMenuItems:y,displayHistory:x,hasResults:ee,hasContent:te,getItemClasses:C,highlightMatch:w,formatMenuPath:T,clearHistory:k,removeHistoryItem:A,openDialog:j,closeDialog:M,selectHistoryItem:N,selectItem:P,handleEnter:I,focusNext:L,focusPrev:R,handleInputKeydown:B,handleDialogKeydown:z,handleCompositionStart:()=>{g.value=!0},handleCompositionEnd:()=>{g.value=!1}}}const l={class:`robot-search-palette`},u={class:`robot-search-header`},d=[`placeholder`,`aria-expanded`,`aria-activedescendant`],f={key:0,class:`robot-empty-state`},p={class:`robot-search-results`},m={class:`robot-result-group`},h={class:`robot-group-title`},g={class:`robot-group-count`},_=[`id`,`aria-selected`,`data-option-index`,`onClick`,`onMouseenter`],v={key:1,class:`robot-item-icon robot-default-icon`},y={class:`robot-item-content`},b={class:`robot-item-label`},x={class:`robot-item-desc`},ee=[`onClick`],te={class:`robot-search-results`},S={key:0,class:`robot-empty-state`},C={class:`robot-result-group`},w={class:`robot-group-title`},T={class:`robot-group-count`},E=[`id`,`aria-selected`,`aria-posinset`,`aria-setsize`,`title`,`onClick`,`onMouseenter`],D={key:1,class:`robot-item-icon robot-default-icon`},O={class:`robot-item-content`},k={class:`robot-item-label`},A={key:0,class:`robot-highlight`},j={class:`robot-item-desc`},M={key:2,class:`robot-item-badge`},N={class:`robot-search-footer`},P={key:0,class:`robot-footer-info`},F={key:0},I={key:1},L=(0,n.defineComponent)({name:`C_GlobalSearch`,__name:`index`,props:{options:{},placeholder:{default:`搜索导航菜单...`},emptyText:{default:`输入关键词搜索菜单`},resultGroupTitle:{default:`菜单导航`}},setup(e,{expose:r}){let i=e,{showDialog:a,searchValue:o,selectedIndex:s,searchInputRef:L,isDark:R,filteredMenuItems:z,displayHistory:B,hasResults:V,hasContent:H,getItemClasses:U,highlightMatch:ne,formatMenuPath:W,clearHistory:G,removeHistoryItem:re,openDialog:K,closeDialog:q,selectHistoryItem:ie,selectItem:ae,handleInputKeydown:oe,handleDialogKeydown:J,handleCompositionStart:Y,handleCompositionEnd:X}=c(()=>i.options),Z=`robot-search-options-${(0,n.useId)()}`,Q=e=>`${Z}-${e}`,se=(0,n.computed)(()=>(o.value.trim()?z.value.length:B.value.length)>0?Q(s.value):void 0),ce=(0,n.ref)(),le=(0,n.ref)(),$=!1,ue=async()=>{$||($=!0,await(0,n.nextTick)(),$=!1,a.value&&(o.value.trim()?z.value.length&&ce.value?.scrollTo({index:s.value}):le.value?.querySelector(`[data-option-index="${s.value}"]`)?.scrollIntoView({block:`nearest`})))},de=e=>{let t=e.defaultPrevented;oe(e),!t&&e.defaultPrevented&&(e.key===`ArrowDown`||e.key===`ArrowUp`)&&ue()};return(0,n.watch)([s,z,B,a],ue,{flush:`post`}),r({openDialog:K,closeDialog:q}),(r,i)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,l,[(0,n.createCommentVNode)(` 搜索触发按钮 `),(0,n.createElementVNode)(`div`,{class:(0,n.normalizeClass)([`robot-search-trigger`,{"trigger-dark":(0,n.unref)(R)}]),onClick:i[0]||=(...e)=>(0,n.unref)(K)&&(0,n.unref)(K)(...e)},[...i[9]||=[(0,n.createElementVNode)(`div`,{class:`i-mdi:search robot-trigger-icon`},null,-1),(0,n.createElementVNode)(`span`,{class:`robot-trigger-text`},`搜索`,-1),(0,n.createElementVNode)(`span`,{class:`robot-trigger-shortcut`},`Ctrl K`,-1)]],2),(0,n.createCommentVNode)(` 搜索对话框 `),((0,n.openBlock)(),(0,n.createBlock)(n.Teleport,{to:`body`},[(0,n.createVNode)(n.Transition,{name:`robot-dialog`},{default:(0,n.withCtx)(()=>[(0,n.unref)(a)?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,class:`robot-dialog-overlay`,onClick:i[7]||=(...e)=>(0,n.unref)(q)&&(0,n.unref)(q)(...e),onKeydown:i[8]||=(...e)=>(0,n.unref)(J)&&(0,n.unref)(J)(...e)},[(0,n.createElementVNode)(`div`,{class:(0,n.normalizeClass)([`robot-dialog-container`,{"dialog-dark":(0,n.unref)(R)}]),role:`dialog`,"aria-modal":`true`,"aria-label":`全局搜索`,onClick:i[6]||=(0,n.withModifiers)(()=>{},[`stop`])},[(0,n.createCommentVNode)(` 搜索头部 `),(0,n.createElementVNode)(`div`,u,[i[11]||=(0,n.createElementVNode)(`div`,{class:`i-mdi:magnify robot-search-icon`},null,-1),(0,n.withDirectives)((0,n.createElementVNode)(`input`,{ref_key:`searchInputRef`,ref:L,"onUpdate:modelValue":i[1]||=e=>(0,n.isRef)(o)?o.value=e:null,type:`text`,placeholder:e.placeholder,class:`robot-search-input`,role:`combobox`,"aria-label":`搜索菜单`,"aria-autocomplete":`list`,"aria-expanded":(0,n.unref)(a),"aria-controls":Z,"aria-activedescendant":se.value,onKeydown:de,onCompositionstart:i[2]||=(...e)=>(0,n.unref)(Y)&&(0,n.unref)(Y)(...e),onCompositionend:i[3]||=(...e)=>(0,n.unref)(X)&&(0,n.unref)(X)(...e)},null,40,d),[[n.vModelText,(0,n.unref)(o)]]),(0,n.createElementVNode)(`button`,{class:`robot-close-btn`,"aria-label":`关闭搜索`,onClick:i[4]||=(...e)=>(0,n.unref)(q)&&(0,n.unref)(q)(...e)},[...i[10]||=[(0,n.createElementVNode)(`div`,{class:`i-mdi:close`},null,-1)]])]),(0,n.createCommentVNode)(` 搜索内容 `),(0,n.createElementVNode)(`div`,{class:(0,n.normalizeClass)([`robot-search-content`,{"robot-search-content--virtual":(0,n.unref)(o).trim()&&(0,n.unref)(V)}])},[(0,n.createCommentVNode)(` 空状态 `),(0,n.unref)(H)?!(0,n.unref)(o).trim()&&(0,n.unref)(B).length>0?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createCommentVNode)(` 搜索历史 `),(0,n.createElementVNode)(`div`,p,[(0,n.createElementVNode)(`div`,m,[(0,n.createElementVNode)(`div`,h,[i[14]||=(0,n.createElementVNode)(`div`,{class:`i-mdi:clock-time-four-outline robot-group-icon`},null,-1),i[15]||=(0,n.createTextVNode)(` 最近搜索 `,-1),(0,n.createElementVNode)(`span`,g,(0,n.toDisplayString)((0,n.unref)(B).length),1),(0,n.createElementVNode)(`button`,{class:`robot-clear-history`,onClick:i[5]||=(...e)=>(0,n.unref)(G)&&(0,n.unref)(G)(...e),title:`清空历史`},[...i[13]||=[(0,n.createElementVNode)(`div`,{class:`i-mdi:delete-outline`},null,-1)]])]),(0,n.createElementVNode)(`div`,{id:Z,ref_key:`historyItemsRef`,ref:le,class:`robot-group-items`,role:`listbox`,"aria-label":`最近搜索`},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(B),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:`history-${t}`,id:Q(t),class:(0,n.normalizeClass)((0,n.unref)(U)(t,!0)),role:`option`,"aria-selected":(0,n.unref)(s)===t,"data-option-index":t,onClick:t=>(0,n.unref)(ie)(e),onMouseenter:e=>s.value=t},[e.menuItem?.icon?((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.menuItem.icon),{key:0,class:`robot-item-icon`})):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,v,[...i[16]||=[(0,n.createElementVNode)(`div`,{class:`i-mdi:file-document-outline`},null,-1)]])),(0,n.createElementVNode)(`div`,y,[(0,n.createElementVNode)(`div`,b,(0,n.toDisplayString)(e.query),1),(0,n.createElementVNode)(`div`,x,(0,n.toDisplayString)((0,n.unref)(W)(e.menuItem?.key||``)),1)]),(0,n.createElementVNode)(`button`,{class:`robot-history-delete`,onClick:(0,n.withModifiers)(e=>(0,n.unref)(re)(t),[`stop`]),title:`删除此记录`},[...i[17]||=[(0,n.createElementVNode)(`div`,{class:`i-mdi:close`},null,-1)]],8,ee)],42,_))),128))],512)])])],64)):(0,n.unref)(o).trim()?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:2},[(0,n.createCommentVNode)(` 搜索结果 `),(0,n.createElementVNode)(`div`,te,[(0,n.createCommentVNode)(` 无结果状态 `),(0,n.unref)(V)?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createCommentVNode)(` 搜索结果列表 `),(0,n.createElementVNode)(`div`,C,[(0,n.createElementVNode)(`div`,w,[i[19]||=(0,n.createElementVNode)(`div`,{class:`i-mdi:menu robot-group-icon`},null,-1),(0,n.createTextVNode)(` `+(0,n.toDisplayString)(e.resultGroupTitle)+` `,1),(0,n.createElementVNode)(`span`,T,(0,n.toDisplayString)((0,n.unref)(z).length),1)]),(0,n.createVNode)((0,n.unref)(t.t),{id:Z,ref_key:`resultListRef`,ref:ce,class:`robot-group-items robot-virtual-items`,role:`listbox`,"aria-label":e.resultGroupTitle,items:(0,n.unref)(z),"item-size":64,style:(0,n.normalizeStyle)({height:`${Math.min((0,n.unref)(z).length*64,336)}px`})},{default:(0,n.withCtx)(({item:e,index:t})=>[(0,n.createElementVNode)(`div`,{id:Q(t),class:(0,n.normalizeClass)((0,n.unref)(U)(t,!1)),role:`option`,"aria-selected":(0,n.unref)(s)===t,"aria-posinset":t+1,"aria-setsize":(0,n.unref)(z).length,title:`${e.label} · ${(0,n.unref)(W)(e.key)}`,onClick:t=>(0,n.unref)(ae)(e),onMouseenter:e=>s.value=t},[e.icon?((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.icon),{key:0,class:`robot-item-icon`})):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,D,[...i[20]||=[(0,n.createElementVNode)(`div`,{class:`i-mdi:file-document-outline`},null,-1)]])),(0,n.createElementVNode)(`div`,O,[(0,n.createElementVNode)(`div`,k,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(ne)(e.label,(0,n.unref)(o)),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:t},[e.matched?((0,n.openBlock)(),(0,n.createElementBlock)(`mark`,A,(0,n.toDisplayString)(e.text),1)):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createTextVNode)((0,n.toDisplayString)(e.text),1)],64))],64))),128))]),(0,n.createElementVNode)(`div`,j,(0,n.toDisplayString)((0,n.unref)(W)(e.key)),1)]),e.children?.length?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,M,(0,n.toDisplayString)(e.children.length),1)):(0,n.createCommentVNode)(`v-if`,!0)],42,E)]),_:1},8,[`aria-label`,`items`,`style`])])],2112)):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,S,[i[18]||=(0,n.createElementVNode)(`div`,{class:`i-mdi:magnify robot-empty-icon`},null,-1),(0,n.createElementVNode)(`p`,null,`未找到 "`+(0,n.toDisplayString)((0,n.unref)(o))+`" 相关内容`,1)]))])],64)):(0,n.createCommentVNode)(`v-if`,!0):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,f,[i[12]||=(0,n.createElementVNode)(`div`,{class:`i-mdi:magnify robot-empty-icon`},null,-1),(0,n.createElementVNode)(`p`,null,(0,n.toDisplayString)(e.emptyText),1)]))],2),(0,n.createCommentVNode)(` 搜索底部 `),(0,n.createElementVNode)(`div`,N,[i[21]||=(0,n.createElementVNode)(`div`,{class:`robot-footer-actions`},[(0,n.createElementVNode)(`div`,{class:`robot-action-item`},[(0,n.createElementVNode)(`kbd`,null,`↵`),(0,n.createElementVNode)(`span`,null,`选择`)]),(0,n.createElementVNode)(`div`,{class:`robot-action-item`},[(0,n.createElementVNode)(`kbd`,null,`↑↓`),(0,n.createElementVNode)(`span`,null,`导航`)]),(0,n.createElementVNode)(`div`,{class:`robot-action-item`},[(0,n.createElementVNode)(`kbd`,null,`esc`),(0,n.createElementVNode)(`span`,null,`关闭`)])],-1),(0,n.unref)(H)?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,P,[(0,n.unref)(o).trim()&&(0,n.unref)(V)?((0,n.openBlock)(),(0,n.createElementBlock)(`span`,F,` 共 `+(0,n.toDisplayString)((0,n.unref)(z).length)+` 项结果 `,1)):!(0,n.unref)(o).trim()&&(0,n.unref)(B).length>0?((0,n.openBlock)(),(0,n.createElementBlock)(`span`,I,(0,n.toDisplayString)((0,n.unref)(B).length)+` 条历史记录 `,1)):(0,n.createCommentVNode)(`v-if`,!0)])):(0,n.createCommentVNode)(`v-if`,!0)])],2)],32)):(0,n.createCommentVNode)(`v-if`,!0)]),_:1})]))]))}});var R=e.t(L,[[`__scopeId`,`data-v-c2819875`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return R}});
|
|
1
|
+
require(`./chunk.cjs`);const e=require(`./useComponentTheme.cjs`),t=require(`./export-helper.cjs`),n=require(`./virtualList.cjs`);let r=require(`vue`);const i=e=>e.replace(/^\//,``).replace(/\//g,` > `)||`首页`;function a(e){let t=new Map,n=new Map;return{entries:e.map(e=>{let{key:r}=e,a=i(r);t.set(r,a),n.set(r,e);let s=e.label.toLowerCase();return{item:e,label:s,path:a.toLowerCase(),normalizedLabel:o(s),text:o([s,a,e.breadcrumb??``,...e.keywords??[]].join(` `))}}),paths:t,byKey:n}}function o(e){return e.normalize(`NFKC`).toLowerCase().trim().replace(/\s+/g,` `)}function s(e,t,n=`literal`){if(!t.trim())return[];if(n===`tokens`){let n=o(t),r=n.split(` `);return e.entries.filter(e=>r.every(t=>e.text.includes(t))).map(e=>({item:e.item,rank:e.normalizedLabel===n?0:e.normalizedLabel.startsWith(n)?1:e.normalizedLabel.includes(n)?2:3})).sort((e,t)=>e.rank-t.rank).map(e=>e.item)}let r=t.toLowerCase();return e.entries.filter(e=>e.label.includes(r)||e.path.includes(r)).map(e=>e.item)}function c(e){let t=typeof e==`string`?{query:e}:e;if(!t||typeof t!=`object`)return[];let{query:n,menuKey:r,menuItem:i,timestamp:a}=t,o=typeof r==`string`?r:i?.key,s=Number.isFinite(a)?a:0;return typeof o==`string`?[{menuKey:o,timestamp:s}]:typeof n!=`string`||!n.trim()?[]:[{query:n.slice(0,200),menuKey:null,timestamp:s}]}function l(t){let n=()=>(0,r.toValue)(t),o=()=>n().menuItems(),l=(0,r.computed)(()=>n().storageKey??`robot-search-history`),u=(0,r.computed)(()=>Math.min(100,Math.max(0,Math.trunc(n().maxHistory??10)))),ee=(0,r.computed)(()=>Math.min(u.value,Math.max(0,Math.trunc(n().maxDisplayHistory??5)))),d=(0,r.ref)(!1),f=(0,r.ref)(``),p=(0,r.ref)(0),m=(0,r.ref)(),h=(0,r.ref)([]),g=(0,r.ref)(!1),_=e.t(()=>{let e=n().isDark?.();return e===void 0?void 0:e?`dark`:`light`}),v=(0,r.computed)(()=>_.value===`dark`),y=(0,r.computed)(()=>a(o())),b=(0,r.computed)(()=>{if(!f.value.trim())return[];let e=y.value,{search:t,matchMode:r}=n();if(!t)return s(e,f.value,r);let i=new Set;return t(f.value,e.entries.map(e=>e.item)).flatMap(t=>{let n=e.byKey.get(t.key);return!n||i.has(t.key)?[]:(i.add(t.key),[n])})}),x=(0,r.computed)(()=>{let e=[];for(let[t,n]of h.value.entries()){if(e.length>=ee.value)break;let{menuKey:r,query:i,timestamp:a}=n,o=r===null?null:y.value.byKey.get(r),s=o?.label??i;o===void 0||s===void 0||e.push({item:{query:s,menuItem:o,timestamp:a},sourceIndex:t})}return e}),S=(0,r.computed)(()=>x.value.map(({item:e})=>e)),C=(0,r.computed)(()=>b.value.length>0),te=(0,r.computed)(()=>!!f.value.trim()||S.value.length>0),w=(0,r.computed)(()=>f.value.trim()?b.value.length:S.value.length),T=(e,t)=>[`robot-result-item`,t&&`robot-history-item`,{"robot-result-item-selected":p.value===e}],E=(e,t)=>{if(!t)return[{text:e,matched:!1}];let r=n().matchMode===`tokens`?t.trim().split(/\s+/).filter(Boolean).sort((e,t)=>t.length-e.length):[t];if(!r.length)return[{text:e,matched:!1}];let i=RegExp(`(${r.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})`,`gi`);return e.split(i).filter(Boolean).map(e=>({text:e,matched:r.some(t=>e.toLocaleLowerCase()===t.toLocaleLowerCase())}))},ne=e=>y.value.paths.get(e)??i(e),D=()=>{if(!(typeof localStorage>`u`))try{localStorage.setItem(l.value,JSON.stringify(h.value))}catch{}},O=e=>{if(!e.label.trim())return;let t=h.value.filter(t=>t.menuKey!==e.key);h.value=[{menuKey:e.key,timestamp:Date.now()},...t].slice(0,u.value),D()},k=()=>{if(h.value=[],!(typeof localStorage>`u`))try{let e=localStorage.getItem(l.value);if(e){let t=JSON.parse(e);if(!Array.isArray(t))return;h.value=t.flatMap(c).slice(0,u.value)}}catch{h.value=[]}},A=()=>{if(h.value=[],!(typeof localStorage>`u`))try{localStorage.removeItem(l.value)}catch{}},j=e=>{let t=x.value[e];t&&(h.value.splice(t.sourceIndex,1),D(),p.value=Math.max(0,Math.min(p.value,S.value.length-1)))},M=async()=>{d.value=!0,f.value=``,p.value=0,g.value=!1,await(0,r.nextTick)(),m.value?.focus()},N=()=>{d.value=!1,f.value=``,p.value=0,g.value=!1},P=e=>{if(e.menuItem){let t=y.value.byKey.get(e.menuItem.key);if(!t)return;n().onSelect?.(t.key,!!t.children?.length),N()}else f.value=e.query,p.value=0},F=e=>{let t=y.value.byKey.get(e.key);t&&(O(t),n().onSelect?.(t.key,!!t.children?.length),N())},I=e=>g.value||!!(e&&(e.defaultPrevented||e.isComposing||e.keyCode===229||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey)),L=e=>{if(I(e))return;p.value=Math.max(0,Math.min(p.value,w.value-1));let t=!f.value.trim()&&S.value.length>0,n=f.value.trim()&&b.value.length>0;if(t){let t=S.value[p.value];t&&(e?.preventDefault(),P(t))}else if(n){let t=b.value[p.value];t&&(e?.preventDefault(),F(t))}},R=e=>{I(e)||(e?.preventDefault(),p.value=Math.max(0,Math.min(p.value+1,w.value-1)))},z=e=>{I(e)||(e?.preventDefault(),p.value=Math.max(0,Math.min(p.value-1,w.value-1)))},B=e=>{e.key!==`Escape`||I(e)||(e.preventDefault(),N())},V=e=>{e.key===`ArrowDown`?R(e):e.key===`ArrowUp`?z(e):e.key===`Enter`?L(e):B(e)};(0,r.watch)(f,()=>{p.value=0}),(0,r.watch)(w,e=>{p.value=Math.max(0,Math.min(p.value,e-1))}),(0,r.watch)(l,k);let H=e=>{e.defaultPrevented||e.isComposing||e.keyCode===229||g.value||(e.ctrlKey||e.metaKey)&&e.key===`k`&&(e.preventDefault(),M())};return(0,r.onMounted)(()=>{k(),document.addEventListener(`keydown`,H)}),(0,r.onUnmounted)(()=>document.removeEventListener(`keydown`,H)),{showDialog:d,searchValue:f,selectedIndex:p,searchInputRef:m,isDark:v,filteredMenuItems:b,displayHistory:S,hasResults:C,hasContent:te,getItemClasses:T,highlightMatch:E,formatMenuPath:ne,clearHistory:A,removeHistoryItem:j,openDialog:M,closeDialog:N,selectHistoryItem:P,selectItem:F,handleEnter:L,focusNext:R,focusPrev:z,handleInputKeydown:V,handleDialogKeydown:B,handleCompositionStart:()=>{g.value=!0},handleCompositionEnd:()=>{g.value=!1}}}const u={class:`robot-search-header`},ee=[`placeholder`,`aria-expanded`,`aria-activedescendant`],d={key:0,class:`robot-empty-state`},f={class:`robot-search-results`},p={class:`robot-result-group`},m={class:`robot-group-title`},h={class:`robot-group-count`},g=[`id`,`aria-selected`,`data-option-index`,`onClick`,`onMouseenter`],_={key:1,class:`robot-item-icon robot-default-icon`},v={class:`robot-item-content`},y={class:`robot-item-label`},b={class:`robot-item-desc`},x=[`onClick`],S={class:`robot-search-results`},C={key:0,class:`robot-empty-state`},te={class:`robot-result-group`},w={class:`robot-group-title`},T={class:`robot-group-count`},E=[`id`,`aria-selected`,`aria-posinset`,`aria-setsize`,`title`,`onClick`,`onMouseenter`],ne={key:1,class:`robot-item-icon robot-default-icon`},D={class:`robot-item-content`},O={class:`robot-item-label`},k={key:0,class:`robot-highlight`},A={class:`robot-item-desc`},j={key:2,class:`robot-item-badge`},M={class:`robot-search-footer`},N={key:0,class:`robot-footer-info`},P={key:0},F={key:1},I=(0,r.defineComponent)({name:`C_GlobalSearch`,__name:`index`,props:{options:{},placeholder:{default:`搜索导航菜单...`},emptyText:{default:`输入关键词搜索菜单`},resultGroupTitle:{default:`菜单导航`}},setup(t,{expose:i}){let a=t,{showDialog:o,searchValue:s,selectedIndex:c,searchInputRef:I,isDark:L,filteredMenuItems:R,displayHistory:z,hasResults:B,hasContent:V,getItemClasses:H,highlightMatch:re,formatMenuPath:U,clearHistory:W,removeHistoryItem:ie,openDialog:G,closeDialog:K,selectHistoryItem:ae,selectItem:oe,handleInputKeydown:se,handleDialogKeydown:q,handleCompositionStart:J,handleCompositionEnd:Y}=l(()=>a.options),X=e.n(()=>L.value?`dark`:`light`),Z=`robot-search-options-${(0,r.useId)()}`,Q=e=>`${Z}-${e}`,ce=(0,r.computed)(()=>(s.value.trim()?R.value.length:z.value.length)>0?Q(c.value):void 0),le=(0,r.ref)(),ue=(0,r.ref)(),$=!1,de=async()=>{$||($=!0,await(0,r.nextTick)(),$=!1,o.value&&(s.value.trim()?R.value.length&&le.value?.scrollTo({index:c.value}):ue.value?.querySelector(`[data-option-index="${c.value}"]`)?.scrollIntoView({block:`nearest`})))},fe=e=>{let t=e.defaultPrevented;se(e),!t&&e.defaultPrevented&&(e.key===`ArrowDown`||e.key===`ArrowUp`)&&de()};return(0,r.watch)([c,R,z,o],de,{flush:`post`}),i({openDialog:G,closeDialog:K}),(e,i)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{class:`robot-search-palette`,style:(0,r.normalizeStyle)((0,r.unref)(X))},[(0,r.createCommentVNode)(` 搜索触发按钮 `),(0,r.createElementVNode)(`button`,{type:`button`,class:(0,r.normalizeClass)([`robot-search-trigger`,{"trigger-dark":(0,r.unref)(L)}]),onClick:i[0]||=(...e)=>(0,r.unref)(G)&&(0,r.unref)(G)(...e)},[...i[9]||=[(0,r.createElementVNode)(`span`,{class:`i-mdi:search robot-trigger-icon`},null,-1),(0,r.createElementVNode)(`span`,{class:`robot-trigger-text`},`搜索`,-1),(0,r.createElementVNode)(`span`,{class:`robot-trigger-shortcut`},`Ctrl K`,-1)]],2),(0,r.createCommentVNode)(` 搜索对话框 `),((0,r.openBlock)(),(0,r.createBlock)(r.Teleport,{to:`body`},[(0,r.createVNode)(r.Transition,{name:`robot-dialog`},{default:(0,r.withCtx)(()=>[(0,r.unref)(o)?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{key:0,class:`robot-dialog-overlay`,style:(0,r.normalizeStyle)((0,r.unref)(X)),onClick:i[7]||=(...e)=>(0,r.unref)(K)&&(0,r.unref)(K)(...e),onKeydown:i[8]||=(...e)=>(0,r.unref)(q)&&(0,r.unref)(q)(...e)},[(0,r.createElementVNode)(`div`,{class:(0,r.normalizeClass)([`robot-dialog-container`,{"dialog-dark":(0,r.unref)(L)}]),role:`dialog`,"aria-modal":`true`,"aria-label":`全局搜索`,onClick:i[6]||=(0,r.withModifiers)(()=>{},[`stop`])},[(0,r.createCommentVNode)(` 搜索头部 `),(0,r.createElementVNode)(`div`,u,[i[11]||=(0,r.createElementVNode)(`div`,{class:`i-mdi:magnify robot-search-icon`},null,-1),(0,r.withDirectives)((0,r.createElementVNode)(`input`,{ref_key:`searchInputRef`,ref:I,"onUpdate:modelValue":i[1]||=e=>(0,r.isRef)(s)?s.value=e:null,type:`text`,placeholder:t.placeholder,class:`robot-search-input`,role:`combobox`,"aria-label":`搜索菜单`,"aria-autocomplete":`list`,"aria-expanded":(0,r.unref)(o),"aria-controls":Z,"aria-activedescendant":ce.value,onKeydown:fe,onCompositionstart:i[2]||=(...e)=>(0,r.unref)(J)&&(0,r.unref)(J)(...e),onCompositionend:i[3]||=(...e)=>(0,r.unref)(Y)&&(0,r.unref)(Y)(...e)},null,40,ee),[[r.vModelText,(0,r.unref)(s)]]),(0,r.createElementVNode)(`button`,{class:`robot-close-btn`,"aria-label":`关闭搜索`,onClick:i[4]||=(...e)=>(0,r.unref)(K)&&(0,r.unref)(K)(...e)},[...i[10]||=[(0,r.createElementVNode)(`div`,{class:`i-mdi:close`},null,-1)]])]),(0,r.createCommentVNode)(` 搜索内容 `),(0,r.createElementVNode)(`div`,{class:(0,r.normalizeClass)([`robot-search-content`,{"robot-search-content--virtual":(0,r.unref)(s).trim()&&(0,r.unref)(B)}])},[(0,r.createCommentVNode)(` 空状态 `),(0,r.unref)(V)?!(0,r.unref)(s).trim()&&(0,r.unref)(z).length>0?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[(0,r.createCommentVNode)(` 搜索历史 `),(0,r.createElementVNode)(`div`,f,[(0,r.createElementVNode)(`div`,p,[(0,r.createElementVNode)(`div`,m,[i[14]||=(0,r.createElementVNode)(`div`,{class:`i-mdi:clock-time-four-outline robot-group-icon`},null,-1),i[15]||=(0,r.createTextVNode)(` 最近搜索 `,-1),(0,r.createElementVNode)(`span`,h,(0,r.toDisplayString)((0,r.unref)(z).length),1),(0,r.createElementVNode)(`button`,{class:`robot-clear-history`,onClick:i[5]||=(...e)=>(0,r.unref)(W)&&(0,r.unref)(W)(...e),title:`清空历史`},[...i[13]||=[(0,r.createElementVNode)(`div`,{class:`i-mdi:delete-outline`},null,-1)]])]),(0,r.createElementVNode)(`div`,{id:Z,ref_key:`historyItemsRef`,ref:ue,class:`robot-group-items`,role:`listbox`,"aria-label":`最近搜索`},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(z),(e,t)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{key:`history-${t}`,id:Q(t),class:(0,r.normalizeClass)((0,r.unref)(H)(t,!0)),role:`option`,"aria-selected":(0,r.unref)(c)===t,"data-option-index":t,onClick:t=>(0,r.unref)(ae)(e),onMouseenter:e=>c.value=t},[e.menuItem?.icon?((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(e.menuItem.icon),{key:0,class:`robot-item-icon`})):((0,r.openBlock)(),(0,r.createElementBlock)(`div`,_,[...i[16]||=[(0,r.createElementVNode)(`div`,{class:`i-mdi:file-document-outline`},null,-1)]])),(0,r.createElementVNode)(`div`,v,[(0,r.createElementVNode)(`div`,y,(0,r.toDisplayString)(e.query),1),(0,r.createElementVNode)(`div`,b,(0,r.toDisplayString)((0,r.unref)(U)(e.menuItem?.key||``)),1)]),(0,r.createElementVNode)(`button`,{class:`robot-history-delete`,onClick:(0,r.withModifiers)(e=>(0,r.unref)(ie)(t),[`stop`]),title:`删除此记录`},[...i[17]||=[(0,r.createElementVNode)(`div`,{class:`i-mdi:close`},null,-1)]],8,x)],42,g))),128))],512)])])],64)):(0,r.unref)(s).trim()?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:2},[(0,r.createCommentVNode)(` 搜索结果 `),(0,r.createElementVNode)(`div`,S,[(0,r.createCommentVNode)(` 无结果状态 `),(0,r.unref)(B)?((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[(0,r.createCommentVNode)(` 搜索结果列表 `),(0,r.createElementVNode)(`div`,te,[(0,r.createElementVNode)(`div`,w,[i[19]||=(0,r.createElementVNode)(`div`,{class:`i-mdi:menu robot-group-icon`},null,-1),(0,r.createTextVNode)(` `+(0,r.toDisplayString)(t.resultGroupTitle)+` `,1),(0,r.createElementVNode)(`span`,T,(0,r.toDisplayString)((0,r.unref)(R).length),1)]),(0,r.createVNode)((0,r.unref)(n.t),{id:Z,ref_key:`resultListRef`,ref:le,class:`robot-group-items robot-virtual-items`,role:`listbox`,"aria-label":t.resultGroupTitle,items:(0,r.unref)(R),"item-size":64,style:(0,r.normalizeStyle)({height:`${Math.min((0,r.unref)(R).length*64,336)}px`})},{default:(0,r.withCtx)(({item:e,index:t})=>[(0,r.createElementVNode)(`div`,{id:Q(t),class:(0,r.normalizeClass)((0,r.unref)(H)(t,!1)),role:`option`,"aria-selected":(0,r.unref)(c)===t,"aria-posinset":t+1,"aria-setsize":(0,r.unref)(R).length,title:`${e.label} · ${(0,r.unref)(U)(e.key)}`,onClick:t=>(0,r.unref)(oe)(e),onMouseenter:e=>c.value=t},[e.icon?((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(e.icon),{key:0,class:`robot-item-icon`})):((0,r.openBlock)(),(0,r.createElementBlock)(`div`,ne,[...i[20]||=[(0,r.createElementVNode)(`div`,{class:`i-mdi:file-document-outline`},null,-1)]])),(0,r.createElementVNode)(`div`,D,[(0,r.createElementVNode)(`div`,O,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(re)(e.label,(0,r.unref)(s)),(e,t)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:t},[e.matched?((0,r.openBlock)(),(0,r.createElementBlock)(`mark`,k,(0,r.toDisplayString)(e.text),1)):((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[(0,r.createTextVNode)((0,r.toDisplayString)(e.text),1)],64))],64))),128))]),(0,r.createElementVNode)(`div`,A,(0,r.toDisplayString)((0,r.unref)(U)(e.key)),1)]),e.children?.length?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,j,(0,r.toDisplayString)(e.children.length),1)):(0,r.createCommentVNode)(`v-if`,!0)],42,E)]),_:1},8,[`aria-label`,`items`,`style`])])],2112)):((0,r.openBlock)(),(0,r.createElementBlock)(`div`,C,[i[18]||=(0,r.createElementVNode)(`div`,{class:`i-mdi:magnify robot-empty-icon`},null,-1),(0,r.createElementVNode)(`p`,null,`未找到 "`+(0,r.toDisplayString)((0,r.unref)(s))+`" 相关内容`,1)]))])],64)):(0,r.createCommentVNode)(`v-if`,!0):((0,r.openBlock)(),(0,r.createElementBlock)(`div`,d,[i[12]||=(0,r.createElementVNode)(`div`,{class:`i-mdi:magnify robot-empty-icon`},null,-1),(0,r.createElementVNode)(`p`,null,(0,r.toDisplayString)(t.emptyText),1)]))],2),(0,r.createCommentVNode)(` 搜索底部 `),(0,r.createElementVNode)(`div`,M,[i[21]||=(0,r.createElementVNode)(`div`,{class:`robot-footer-actions`},[(0,r.createElementVNode)(`div`,{class:`robot-action-item`},[(0,r.createElementVNode)(`kbd`,null,`↵`),(0,r.createElementVNode)(`span`,null,`选择`)]),(0,r.createElementVNode)(`div`,{class:`robot-action-item`},[(0,r.createElementVNode)(`kbd`,null,`↑↓`),(0,r.createElementVNode)(`span`,null,`导航`)]),(0,r.createElementVNode)(`div`,{class:`robot-action-item`},[(0,r.createElementVNode)(`kbd`,null,`esc`),(0,r.createElementVNode)(`span`,null,`关闭`)])],-1),(0,r.unref)(V)?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,N,[(0,r.unref)(s).trim()&&(0,r.unref)(B)?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,P,` 共 `+(0,r.toDisplayString)((0,r.unref)(R).length)+` 项结果 `,1)):!(0,r.unref)(s).trim()&&(0,r.unref)(z).length>0?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,F,(0,r.toDisplayString)((0,r.unref)(z).length)+` 条历史记录 `,1)):(0,r.createCommentVNode)(`v-if`,!0)])):(0,r.createCommentVNode)(`v-if`,!0)])],2)],36)):(0,r.createCommentVNode)(`v-if`,!0)]),_:1})]))],4))}});var L=t.t(I,[[`__scopeId`,`data-v-fa264652`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return L}});
|
package/dist/C_GlobalSearch2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./export-helper.js";import{t}from"./virtualList.js";import{Fragment as n,Teleport as r,Transition as i,computed as a,createBlock as o,createCommentVNode as s,createElementBlock as c,createElementVNode as l,createTextVNode as u,createVNode as d,defineComponent as f,isRef as p,nextTick as ee,normalizeClass as m,normalizeStyle as h,onMounted as te,onUnmounted as g,openBlock as _,ref as v,renderList as y,resolveDynamicComponent as b,toDisplayString as x,toValue as S,unref as C,useId as ne,vModelText as re,watch as w,withCtx as T,withDirectives as E,withModifiers as D}from"vue";const O=e=>e.replace(/^\//,``).replace(/\//g,` > `)||`首页`;function ie(e){let t=new Map,n=new Map;return{entries:e.map(e=>{let{key:r}=e,i=O(r);t.set(r,i),n.set(r,e);let a=e.label.toLowerCase();return{item:e,label:a,path:i.toLowerCase(),normalizedLabel:k(a),text:k([a,i,e.breadcrumb??``,...e.keywords??[]].join(` `))}}),paths:t,byKey:n}}function k(e){return e.normalize(`NFKC`).toLowerCase().trim().replace(/\s+/g,` `)}function A(e,t,n=`literal`){if(!t.trim())return[];if(n===`tokens`){let n=k(t),r=n.split(` `);return e.entries.filter(e=>r.every(t=>e.text.includes(t))).map(e=>({item:e.item,rank:e.normalizedLabel===n?0:e.normalizedLabel.startsWith(n)?1:e.normalizedLabel.includes(n)?2:3})).sort((e,t)=>e.rank-t.rank).map(e=>e.item)}let r=t.toLowerCase();return e.entries.filter(e=>e.label.includes(r)||e.path.includes(r)).map(e=>e.item)}function j(e){let t=typeof e==`string`?{query:e}:e;if(!t||typeof t!=`object`)return[];let{query:n,menuKey:r,menuItem:i,timestamp:a}=t,o=typeof r==`string`?r:i?.key,s=Number.isFinite(a)?a:0;return typeof o==`string`?[{menuKey:o,timestamp:s}]:typeof n!=`string`||!n.trim()?[]:[{query:n.slice(0,200),menuKey:null,timestamp:s}]}function M(e){let t=()=>S(e),n=()=>t().menuItems(),r=a(()=>t().storageKey??`robot-search-history`),i=a(()=>Math.min(100,Math.max(0,Math.trunc(t().maxHistory??10)))),o=a(()=>Math.min(i.value,Math.max(0,Math.trunc(t().maxDisplayHistory??5)))),s=v(!1),c=v(``),l=v(0),u=v(),d=v([]),f=v(!1),p=a(()=>t().isDark?.()??!1),m=a(()=>ie(n())),h=a(()=>{if(!c.value.trim())return[];let e=m.value,{search:n,matchMode:r}=t();if(!n)return A(e,c.value,r);let i=new Set;return n(c.value,e.entries.map(e=>e.item)).flatMap(t=>{let n=e.byKey.get(t.key);return!n||i.has(t.key)?[]:(i.add(t.key),[n])})}),_=a(()=>{let e=[];for(let[t,n]of d.value.entries()){if(e.length>=o.value)break;let{menuKey:r,query:i,timestamp:a}=n,s=r===null?null:m.value.byKey.get(r),c=s?.label??i;s===void 0||c===void 0||e.push({item:{query:c,menuItem:s,timestamp:a},sourceIndex:t})}return e}),y=a(()=>_.value.map(({item:e})=>e)),b=a(()=>h.value.length>0),x=a(()=>!!c.value.trim()||y.value.length>0),C=a(()=>c.value.trim()?h.value.length:y.value.length),ne=(e,t)=>[`robot-result-item`,t&&`robot-history-item`,{"robot-result-item-selected":l.value===e}],re=(e,n)=>{if(!n)return[{text:e,matched:!1}];let r=t().matchMode===`tokens`?n.trim().split(/\s+/).filter(Boolean).sort((e,t)=>t.length-e.length):[n];if(!r.length)return[{text:e,matched:!1}];let i=RegExp(`(${r.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})`,`gi`);return e.split(i).filter(Boolean).map(e=>({text:e,matched:r.some(t=>e.toLocaleLowerCase()===t.toLocaleLowerCase())}))},T=e=>m.value.paths.get(e)??O(e),E=()=>{if(!(typeof localStorage>`u`))try{localStorage.setItem(r.value,JSON.stringify(d.value))}catch{}},D=e=>{if(!e.label.trim())return;let t=d.value.filter(t=>t.menuKey!==e.key);d.value=[{menuKey:e.key,timestamp:Date.now()},...t].slice(0,i.value),E()},k=()=>{if(d.value=[],!(typeof localStorage>`u`))try{let e=localStorage.getItem(r.value);if(e){let t=JSON.parse(e);if(!Array.isArray(t))return;d.value=t.flatMap(j).slice(0,i.value)}}catch{d.value=[]}},M=()=>{if(d.value=[],!(typeof localStorage>`u`))try{localStorage.removeItem(r.value)}catch{}},ae=e=>{let t=_.value[e];t&&(d.value.splice(t.sourceIndex,1),E(),l.value=Math.max(0,Math.min(l.value,y.value.length-1)))},N=async()=>{s.value=!0,c.value=``,l.value=0,f.value=!1,await ee(),u.value?.focus()},P=()=>{s.value=!1,c.value=``,l.value=0,f.value=!1},F=e=>{if(e.menuItem){let n=m.value.byKey.get(e.menuItem.key);if(!n)return;t().onSelect?.(n.key,!!n.children?.length),P()}else c.value=e.query,l.value=0},I=e=>{let n=m.value.byKey.get(e.key);n&&(D(n),t().onSelect?.(n.key,!!n.children?.length),P())},L=e=>f.value||!!(e&&(e.defaultPrevented||e.isComposing||e.keyCode===229||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey)),R=e=>{if(L(e))return;l.value=Math.max(0,Math.min(l.value,C.value-1));let t=!c.value.trim()&&y.value.length>0,n=c.value.trim()&&h.value.length>0;if(t){let t=y.value[l.value];t&&(e?.preventDefault(),F(t))}else if(n){let t=h.value[l.value];t&&(e?.preventDefault(),I(t))}},z=e=>{L(e)||(e?.preventDefault(),l.value=Math.max(0,Math.min(l.value+1,C.value-1)))},B=e=>{L(e)||(e?.preventDefault(),l.value=Math.max(0,Math.min(l.value-1,C.value-1)))},V=e=>{e.key!==`Escape`||L(e)||(e.preventDefault(),P())},oe=e=>{e.key===`ArrowDown`?z(e):e.key===`ArrowUp`?B(e):e.key===`Enter`?R(e):V(e)};w(c,()=>{l.value=0}),w(C,e=>{l.value=Math.max(0,Math.min(l.value,e-1))}),w(r,k);let H=e=>{e.defaultPrevented||e.isComposing||e.keyCode===229||f.value||(e.ctrlKey||e.metaKey)&&e.key===`k`&&(e.preventDefault(),N())};return te(()=>{k(),document.addEventListener(`keydown`,H)}),g(()=>document.removeEventListener(`keydown`,H)),{showDialog:s,searchValue:c,selectedIndex:l,searchInputRef:u,isDark:p,filteredMenuItems:h,displayHistory:y,hasResults:b,hasContent:x,getItemClasses:ne,highlightMatch:re,formatMenuPath:T,clearHistory:M,removeHistoryItem:ae,openDialog:N,closeDialog:P,selectHistoryItem:F,selectItem:I,handleEnter:R,focusNext:z,focusPrev:B,handleInputKeydown:oe,handleDialogKeydown:V,handleCompositionStart:()=>{f.value=!0},handleCompositionEnd:()=>{f.value=!1}}}const ae={class:`robot-search-palette`},N={class:`robot-search-header`},P=[`placeholder`,`aria-expanded`,`aria-activedescendant`],F={key:0,class:`robot-empty-state`},I={class:`robot-search-results`},L={class:`robot-result-group`},R={class:`robot-group-title`},z={class:`robot-group-count`},B=[`id`,`aria-selected`,`data-option-index`,`onClick`,`onMouseenter`],V={key:1,class:`robot-item-icon robot-default-icon`},oe={class:`robot-item-content`},H={class:`robot-item-label`},se={class:`robot-item-desc`},ce=[`onClick`],le={class:`robot-search-results`},ue={key:0,class:`robot-empty-state`},de={class:`robot-result-group`},fe={class:`robot-group-title`},pe={class:`robot-group-count`},me=[`id`,`aria-selected`,`aria-posinset`,`aria-setsize`,`title`,`onClick`,`onMouseenter`],he={key:1,class:`robot-item-icon robot-default-icon`},ge={class:`robot-item-content`},_e={class:`robot-item-label`},ve={key:0,class:`robot-highlight`},ye={class:`robot-item-desc`},be={key:2,class:`robot-item-badge`},xe={class:`robot-search-footer`},Se={key:0,class:`robot-footer-info`},Ce={key:0},we={key:1};var U=e(f({name:`C_GlobalSearch`,__name:`index`,props:{options:{},placeholder:{default:`搜索导航菜单...`},emptyText:{default:`输入关键词搜索菜单`},resultGroupTitle:{default:`菜单导航`}},setup(e,{expose:f}){let te=e,{showDialog:g,searchValue:S,selectedIndex:O,searchInputRef:ie,isDark:k,filteredMenuItems:A,displayHistory:j,hasResults:U,hasContent:W,getItemClasses:G,highlightMatch:Te,formatMenuPath:K,clearHistory:Ee,removeHistoryItem:De,openDialog:q,closeDialog:J,selectHistoryItem:Oe,selectItem:ke,handleInputKeydown:Ae,handleDialogKeydown:je,handleCompositionStart:Y,handleCompositionEnd:Me}=M(()=>te.options),X=`robot-search-options-${ne()}`,Z=e=>`${X}-${e}`,Ne=a(()=>(S.value.trim()?A.value.length:j.value.length)>0?Z(O.value):void 0),Pe=v(),Fe=v(),Q=!1,$=async()=>{Q||(Q=!0,await ee(),Q=!1,g.value&&(S.value.trim()?A.value.length&&Pe.value?.scrollTo({index:O.value}):Fe.value?.querySelector(`[data-option-index="${O.value}"]`)?.scrollIntoView({block:`nearest`})))},Ie=e=>{let t=e.defaultPrevented;Ae(e),!t&&e.defaultPrevented&&(e.key===`ArrowDown`||e.key===`ArrowUp`)&&$()};return w([O,A,j,g],$,{flush:`post`}),f({openDialog:q,closeDialog:J}),(a,f)=>(_(),c(`div`,ae,[s(` 搜索触发按钮 `),l(`div`,{class:m([`robot-search-trigger`,{"trigger-dark":C(k)}]),onClick:f[0]||=(...e)=>C(q)&&C(q)(...e)},[...f[9]||=[l(`div`,{class:`i-mdi:search robot-trigger-icon`},null,-1),l(`span`,{class:`robot-trigger-text`},`搜索`,-1),l(`span`,{class:`robot-trigger-shortcut`},`Ctrl K`,-1)]],2),s(` 搜索对话框 `),(_(),o(r,{to:`body`},[d(i,{name:`robot-dialog`},{default:T(()=>[C(g)?(_(),c(`div`,{key:0,class:`robot-dialog-overlay`,onClick:f[7]||=(...e)=>C(J)&&C(J)(...e),onKeydown:f[8]||=(...e)=>C(je)&&C(je)(...e)},[l(`div`,{class:m([`robot-dialog-container`,{"dialog-dark":C(k)}]),role:`dialog`,"aria-modal":`true`,"aria-label":`全局搜索`,onClick:f[6]||=D(()=>{},[`stop`])},[s(` 搜索头部 `),l(`div`,N,[f[11]||=l(`div`,{class:`i-mdi:magnify robot-search-icon`},null,-1),E(l(`input`,{ref_key:`searchInputRef`,ref:ie,"onUpdate:modelValue":f[1]||=e=>p(S)?S.value=e:null,type:`text`,placeholder:e.placeholder,class:`robot-search-input`,role:`combobox`,"aria-label":`搜索菜单`,"aria-autocomplete":`list`,"aria-expanded":C(g),"aria-controls":X,"aria-activedescendant":Ne.value,onKeydown:Ie,onCompositionstart:f[2]||=(...e)=>C(Y)&&C(Y)(...e),onCompositionend:f[3]||=(...e)=>C(Me)&&C(Me)(...e)},null,40,P),[[re,C(S)]]),l(`button`,{class:`robot-close-btn`,"aria-label":`关闭搜索`,onClick:f[4]||=(...e)=>C(J)&&C(J)(...e)},[...f[10]||=[l(`div`,{class:`i-mdi:close`},null,-1)]])]),s(` 搜索内容 `),l(`div`,{class:m([`robot-search-content`,{"robot-search-content--virtual":C(S).trim()&&C(U)}])},[s(` 空状态 `),C(W)?!C(S).trim()&&C(j).length>0?(_(),c(n,{key:1},[s(` 搜索历史 `),l(`div`,I,[l(`div`,L,[l(`div`,R,[f[14]||=l(`div`,{class:`i-mdi:clock-time-four-outline robot-group-icon`},null,-1),f[15]||=u(` 最近搜索 `,-1),l(`span`,z,x(C(j).length),1),l(`button`,{class:`robot-clear-history`,onClick:f[5]||=(...e)=>C(Ee)&&C(Ee)(...e),title:`清空历史`},[...f[13]||=[l(`div`,{class:`i-mdi:delete-outline`},null,-1)]])]),l(`div`,{id:X,ref_key:`historyItemsRef`,ref:Fe,class:`robot-group-items`,role:`listbox`,"aria-label":`最近搜索`},[(_(!0),c(n,null,y(C(j),(e,t)=>(_(),c(`div`,{key:`history-${t}`,id:Z(t),class:m(C(G)(t,!0)),role:`option`,"aria-selected":C(O)===t,"data-option-index":t,onClick:t=>C(Oe)(e),onMouseenter:e=>O.value=t},[e.menuItem?.icon?(_(),o(b(e.menuItem.icon),{key:0,class:`robot-item-icon`})):(_(),c(`div`,V,[...f[16]||=[l(`div`,{class:`i-mdi:file-document-outline`},null,-1)]])),l(`div`,oe,[l(`div`,H,x(e.query),1),l(`div`,se,x(C(K)(e.menuItem?.key||``)),1)]),l(`button`,{class:`robot-history-delete`,onClick:D(e=>C(De)(t),[`stop`]),title:`删除此记录`},[...f[17]||=[l(`div`,{class:`i-mdi:close`},null,-1)]],8,ce)],42,B))),128))],512)])])],64)):C(S).trim()?(_(),c(n,{key:2},[s(` 搜索结果 `),l(`div`,le,[s(` 无结果状态 `),C(U)?(_(),c(n,{key:1},[s(` 搜索结果列表 `),l(`div`,de,[l(`div`,fe,[f[19]||=l(`div`,{class:`i-mdi:menu robot-group-icon`},null,-1),u(` `+x(e.resultGroupTitle)+` `,1),l(`span`,pe,x(C(A).length),1)]),d(C(t),{id:X,ref_key:`resultListRef`,ref:Pe,class:`robot-group-items robot-virtual-items`,role:`listbox`,"aria-label":e.resultGroupTitle,items:C(A),"item-size":64,style:h({height:`${Math.min(C(A).length*64,336)}px`})},{default:T(({item:e,index:t})=>[l(`div`,{id:Z(t),class:m(C(G)(t,!1)),role:`option`,"aria-selected":C(O)===t,"aria-posinset":t+1,"aria-setsize":C(A).length,title:`${e.label} · ${C(K)(e.key)}`,onClick:t=>C(ke)(e),onMouseenter:e=>O.value=t},[e.icon?(_(),o(b(e.icon),{key:0,class:`robot-item-icon`})):(_(),c(`div`,he,[...f[20]||=[l(`div`,{class:`i-mdi:file-document-outline`},null,-1)]])),l(`div`,ge,[l(`div`,_e,[(_(!0),c(n,null,y(C(Te)(e.label,C(S)),(e,t)=>(_(),c(n,{key:t},[e.matched?(_(),c(`mark`,ve,x(e.text),1)):(_(),c(n,{key:1},[u(x(e.text),1)],64))],64))),128))]),l(`div`,ye,x(C(K)(e.key)),1)]),e.children?.length?(_(),c(`div`,be,x(e.children.length),1)):s(`v-if`,!0)],42,me)]),_:1},8,[`aria-label`,`items`,`style`])])],2112)):(_(),c(`div`,ue,[f[18]||=l(`div`,{class:`i-mdi:magnify robot-empty-icon`},null,-1),l(`p`,null,`未找到 "`+x(C(S))+`" 相关内容`,1)]))])],64)):s(`v-if`,!0):(_(),c(`div`,F,[f[12]||=l(`div`,{class:`i-mdi:magnify robot-empty-icon`},null,-1),l(`p`,null,x(e.emptyText),1)]))],2),s(` 搜索底部 `),l(`div`,xe,[f[21]||=l(`div`,{class:`robot-footer-actions`},[l(`div`,{class:`robot-action-item`},[l(`kbd`,null,`↵`),l(`span`,null,`选择`)]),l(`div`,{class:`robot-action-item`},[l(`kbd`,null,`↑↓`),l(`span`,null,`导航`)]),l(`div`,{class:`robot-action-item`},[l(`kbd`,null,`esc`),l(`span`,null,`关闭`)])],-1),C(W)?(_(),c(`div`,Se,[C(S).trim()&&C(U)?(_(),c(`span`,Ce,` 共 `+x(C(A).length)+` 项结果 `,1)):!C(S).trim()&&C(j).length>0?(_(),c(`span`,we,x(C(j).length)+` 条历史记录 `,1)):s(`v-if`,!0)])):s(`v-if`,!0)])],2)],32)):s(`v-if`,!0)]),_:1})]))]))}}),[[`__scopeId`,`data-v-c2819875`]]);export{M as n,U as t};
|
|
1
|
+
import{n as e,t}from"./useComponentTheme.js";import{t as n}from"./export-helper.js";import{t as r}from"./virtualList.js";import{Fragment as i,Teleport as a,Transition as o,computed as s,createBlock as c,createCommentVNode as l,createElementBlock as u,createElementVNode as d,createTextVNode as f,createVNode as p,defineComponent as m,isRef as ee,nextTick as te,normalizeClass as h,normalizeStyle as g,onMounted as _,onUnmounted as v,openBlock as y,ref as b,renderList as x,resolveDynamicComponent as S,toDisplayString as C,toValue as w,unref as T,useId as ne,vModelText as re,watch as E,withCtx as D,withDirectives as O,withModifiers as k}from"vue";const A=e=>e.replace(/^\//,``).replace(/\//g,` > `)||`首页`;function j(e){let t=new Map,n=new Map;return{entries:e.map(e=>{let{key:r}=e,i=A(r);t.set(r,i),n.set(r,e);let a=e.label.toLowerCase();return{item:e,label:a,path:i.toLowerCase(),normalizedLabel:M(a),text:M([a,i,e.breadcrumb??``,...e.keywords??[]].join(` `))}}),paths:t,byKey:n}}function M(e){return e.normalize(`NFKC`).toLowerCase().trim().replace(/\s+/g,` `)}function N(e,t,n=`literal`){if(!t.trim())return[];if(n===`tokens`){let n=M(t),r=n.split(` `);return e.entries.filter(e=>r.every(t=>e.text.includes(t))).map(e=>({item:e.item,rank:e.normalizedLabel===n?0:e.normalizedLabel.startsWith(n)?1:e.normalizedLabel.includes(n)?2:3})).sort((e,t)=>e.rank-t.rank).map(e=>e.item)}let r=t.toLowerCase();return e.entries.filter(e=>e.label.includes(r)||e.path.includes(r)).map(e=>e.item)}function P(e){let t=typeof e==`string`?{query:e}:e;if(!t||typeof t!=`object`)return[];let{query:n,menuKey:r,menuItem:i,timestamp:a}=t,o=typeof r==`string`?r:i?.key,s=Number.isFinite(a)?a:0;return typeof o==`string`?[{menuKey:o,timestamp:s}]:typeof n!=`string`||!n.trim()?[]:[{query:n.slice(0,200),menuKey:null,timestamp:s}]}function F(e){let n=()=>w(e),r=()=>n().menuItems(),i=s(()=>n().storageKey??`robot-search-history`),a=s(()=>Math.min(100,Math.max(0,Math.trunc(n().maxHistory??10)))),o=s(()=>Math.min(a.value,Math.max(0,Math.trunc(n().maxDisplayHistory??5)))),c=b(!1),l=b(``),u=b(0),d=b(),f=b([]),p=b(!1),m=t(()=>{let e=n().isDark?.();return e===void 0?void 0:e?`dark`:`light`}),ee=s(()=>m.value===`dark`),h=s(()=>j(r())),g=s(()=>{if(!l.value.trim())return[];let e=h.value,{search:t,matchMode:r}=n();if(!t)return N(e,l.value,r);let i=new Set;return t(l.value,e.entries.map(e=>e.item)).flatMap(t=>{let n=e.byKey.get(t.key);return!n||i.has(t.key)?[]:(i.add(t.key),[n])})}),y=s(()=>{let e=[];for(let[t,n]of f.value.entries()){if(e.length>=o.value)break;let{menuKey:r,query:i,timestamp:a}=n,s=r===null?null:h.value.byKey.get(r),c=s?.label??i;s===void 0||c===void 0||e.push({item:{query:c,menuItem:s,timestamp:a},sourceIndex:t})}return e}),x=s(()=>y.value.map(({item:e})=>e)),S=s(()=>g.value.length>0),C=s(()=>!!l.value.trim()||x.value.length>0),T=s(()=>l.value.trim()?g.value.length:x.value.length),ne=(e,t)=>[`robot-result-item`,t&&`robot-history-item`,{"robot-result-item-selected":u.value===e}],re=(e,t)=>{if(!t)return[{text:e,matched:!1}];let r=n().matchMode===`tokens`?t.trim().split(/\s+/).filter(Boolean).sort((e,t)=>t.length-e.length):[t];if(!r.length)return[{text:e,matched:!1}];let i=RegExp(`(${r.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})`,`gi`);return e.split(i).filter(Boolean).map(e=>({text:e,matched:r.some(t=>e.toLocaleLowerCase()===t.toLocaleLowerCase())}))},D=e=>h.value.paths.get(e)??A(e),O=()=>{if(!(typeof localStorage>`u`))try{localStorage.setItem(i.value,JSON.stringify(f.value))}catch{}},k=e=>{if(!e.label.trim())return;let t=f.value.filter(t=>t.menuKey!==e.key);f.value=[{menuKey:e.key,timestamp:Date.now()},...t].slice(0,a.value),O()},M=()=>{if(f.value=[],!(typeof localStorage>`u`))try{let e=localStorage.getItem(i.value);if(e){let t=JSON.parse(e);if(!Array.isArray(t))return;f.value=t.flatMap(P).slice(0,a.value)}}catch{f.value=[]}},F=()=>{if(f.value=[],!(typeof localStorage>`u`))try{localStorage.removeItem(i.value)}catch{}},ie=e=>{let t=y.value[e];t&&(f.value.splice(t.sourceIndex,1),O(),u.value=Math.max(0,Math.min(u.value,x.value.length-1)))},I=async()=>{c.value=!0,l.value=``,u.value=0,p.value=!1,await te(),d.value?.focus()},L=()=>{c.value=!1,l.value=``,u.value=0,p.value=!1},R=e=>{if(e.menuItem){let t=h.value.byKey.get(e.menuItem.key);if(!t)return;n().onSelect?.(t.key,!!t.children?.length),L()}else l.value=e.query,u.value=0},z=e=>{let t=h.value.byKey.get(e.key);t&&(k(t),n().onSelect?.(t.key,!!t.children?.length),L())},B=e=>p.value||!!(e&&(e.defaultPrevented||e.isComposing||e.keyCode===229||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey)),V=e=>{if(B(e))return;u.value=Math.max(0,Math.min(u.value,T.value-1));let t=!l.value.trim()&&x.value.length>0,n=l.value.trim()&&g.value.length>0;if(t){let t=x.value[u.value];t&&(e?.preventDefault(),R(t))}else if(n){let t=g.value[u.value];t&&(e?.preventDefault(),z(t))}},H=e=>{B(e)||(e?.preventDefault(),u.value=Math.max(0,Math.min(u.value+1,T.value-1)))},U=e=>{B(e)||(e?.preventDefault(),u.value=Math.max(0,Math.min(u.value-1,T.value-1)))},W=e=>{e.key!==`Escape`||B(e)||(e.preventDefault(),L())},ae=e=>{e.key===`ArrowDown`?H(e):e.key===`ArrowUp`?U(e):e.key===`Enter`?V(e):W(e)};E(l,()=>{u.value=0}),E(T,e=>{u.value=Math.max(0,Math.min(u.value,e-1))}),E(i,M);let G=e=>{e.defaultPrevented||e.isComposing||e.keyCode===229||p.value||(e.ctrlKey||e.metaKey)&&e.key===`k`&&(e.preventDefault(),I())};return _(()=>{M(),document.addEventListener(`keydown`,G)}),v(()=>document.removeEventListener(`keydown`,G)),{showDialog:c,searchValue:l,selectedIndex:u,searchInputRef:d,isDark:ee,filteredMenuItems:g,displayHistory:x,hasResults:S,hasContent:C,getItemClasses:ne,highlightMatch:re,formatMenuPath:D,clearHistory:F,removeHistoryItem:ie,openDialog:I,closeDialog:L,selectHistoryItem:R,selectItem:z,handleEnter:V,focusNext:H,focusPrev:U,handleInputKeydown:ae,handleDialogKeydown:W,handleCompositionStart:()=>{p.value=!0},handleCompositionEnd:()=>{p.value=!1}}}const ie={class:`robot-search-header`},I=[`placeholder`,`aria-expanded`,`aria-activedescendant`],L={key:0,class:`robot-empty-state`},R={class:`robot-search-results`},z={class:`robot-result-group`},B={class:`robot-group-title`},V={class:`robot-group-count`},H=[`id`,`aria-selected`,`data-option-index`,`onClick`,`onMouseenter`],U={key:1,class:`robot-item-icon robot-default-icon`},W={class:`robot-item-content`},ae={class:`robot-item-label`},G={class:`robot-item-desc`},oe=[`onClick`],se={class:`robot-search-results`},ce={key:0,class:`robot-empty-state`},le={class:`robot-result-group`},ue={class:`robot-group-title`},de={class:`robot-group-count`},fe=[`id`,`aria-selected`,`aria-posinset`,`aria-setsize`,`title`,`onClick`,`onMouseenter`],pe={key:1,class:`robot-item-icon robot-default-icon`},me={class:`robot-item-content`},he={class:`robot-item-label`},ge={key:0,class:`robot-highlight`},_e={class:`robot-item-desc`},ve={key:2,class:`robot-item-badge`},ye={class:`robot-search-footer`},be={key:0,class:`robot-footer-info`},xe={key:0},Se={key:1};var K=n(m({name:`C_GlobalSearch`,__name:`index`,props:{options:{},placeholder:{default:`搜索导航菜单...`},emptyText:{default:`输入关键词搜索菜单`},resultGroupTitle:{default:`菜单导航`}},setup(t,{expose:n}){let m=t,{showDialog:_,searchValue:v,selectedIndex:w,searchInputRef:A,isDark:j,filteredMenuItems:M,displayHistory:N,hasResults:P,hasContent:K,getItemClasses:Ce,highlightMatch:we,formatMenuPath:q,clearHistory:Te,removeHistoryItem:Ee,openDialog:J,closeDialog:Y,selectHistoryItem:De,selectItem:Oe,handleInputKeydown:ke,handleDialogKeydown:Ae,handleCompositionStart:je,handleCompositionEnd:Me}=F(()=>m.options),X=e(()=>j.value?`dark`:`light`),Z=`robot-search-options-${ne()}`,Q=e=>`${Z}-${e}`,Ne=s(()=>(v.value.trim()?M.value.length:N.value.length)>0?Q(w.value):void 0),Pe=b(),Fe=b(),$=!1,Ie=async()=>{$||($=!0,await te(),$=!1,_.value&&(v.value.trim()?M.value.length&&Pe.value?.scrollTo({index:w.value}):Fe.value?.querySelector(`[data-option-index="${w.value}"]`)?.scrollIntoView({block:`nearest`})))},Le=e=>{let t=e.defaultPrevented;ke(e),!t&&e.defaultPrevented&&(e.key===`ArrowDown`||e.key===`ArrowUp`)&&Ie()};return E([w,M,N,_],Ie,{flush:`post`}),n({openDialog:J,closeDialog:Y}),(e,n)=>(y(),u(`div`,{class:`robot-search-palette`,style:g(T(X))},[l(` 搜索触发按钮 `),d(`button`,{type:`button`,class:h([`robot-search-trigger`,{"trigger-dark":T(j)}]),onClick:n[0]||=(...e)=>T(J)&&T(J)(...e)},[...n[9]||=[d(`span`,{class:`i-mdi:search robot-trigger-icon`},null,-1),d(`span`,{class:`robot-trigger-text`},`搜索`,-1),d(`span`,{class:`robot-trigger-shortcut`},`Ctrl K`,-1)]],2),l(` 搜索对话框 `),(y(),c(a,{to:`body`},[p(o,{name:`robot-dialog`},{default:D(()=>[T(_)?(y(),u(`div`,{key:0,class:`robot-dialog-overlay`,style:g(T(X)),onClick:n[7]||=(...e)=>T(Y)&&T(Y)(...e),onKeydown:n[8]||=(...e)=>T(Ae)&&T(Ae)(...e)},[d(`div`,{class:h([`robot-dialog-container`,{"dialog-dark":T(j)}]),role:`dialog`,"aria-modal":`true`,"aria-label":`全局搜索`,onClick:n[6]||=k(()=>{},[`stop`])},[l(` 搜索头部 `),d(`div`,ie,[n[11]||=d(`div`,{class:`i-mdi:magnify robot-search-icon`},null,-1),O(d(`input`,{ref_key:`searchInputRef`,ref:A,"onUpdate:modelValue":n[1]||=e=>ee(v)?v.value=e:null,type:`text`,placeholder:t.placeholder,class:`robot-search-input`,role:`combobox`,"aria-label":`搜索菜单`,"aria-autocomplete":`list`,"aria-expanded":T(_),"aria-controls":Z,"aria-activedescendant":Ne.value,onKeydown:Le,onCompositionstart:n[2]||=(...e)=>T(je)&&T(je)(...e),onCompositionend:n[3]||=(...e)=>T(Me)&&T(Me)(...e)},null,40,I),[[re,T(v)]]),d(`button`,{class:`robot-close-btn`,"aria-label":`关闭搜索`,onClick:n[4]||=(...e)=>T(Y)&&T(Y)(...e)},[...n[10]||=[d(`div`,{class:`i-mdi:close`},null,-1)]])]),l(` 搜索内容 `),d(`div`,{class:h([`robot-search-content`,{"robot-search-content--virtual":T(v).trim()&&T(P)}])},[l(` 空状态 `),T(K)?!T(v).trim()&&T(N).length>0?(y(),u(i,{key:1},[l(` 搜索历史 `),d(`div`,R,[d(`div`,z,[d(`div`,B,[n[14]||=d(`div`,{class:`i-mdi:clock-time-four-outline robot-group-icon`},null,-1),n[15]||=f(` 最近搜索 `,-1),d(`span`,V,C(T(N).length),1),d(`button`,{class:`robot-clear-history`,onClick:n[5]||=(...e)=>T(Te)&&T(Te)(...e),title:`清空历史`},[...n[13]||=[d(`div`,{class:`i-mdi:delete-outline`},null,-1)]])]),d(`div`,{id:Z,ref_key:`historyItemsRef`,ref:Fe,class:`robot-group-items`,role:`listbox`,"aria-label":`最近搜索`},[(y(!0),u(i,null,x(T(N),(e,t)=>(y(),u(`div`,{key:`history-${t}`,id:Q(t),class:h(T(Ce)(t,!0)),role:`option`,"aria-selected":T(w)===t,"data-option-index":t,onClick:t=>T(De)(e),onMouseenter:e=>w.value=t},[e.menuItem?.icon?(y(),c(S(e.menuItem.icon),{key:0,class:`robot-item-icon`})):(y(),u(`div`,U,[...n[16]||=[d(`div`,{class:`i-mdi:file-document-outline`},null,-1)]])),d(`div`,W,[d(`div`,ae,C(e.query),1),d(`div`,G,C(T(q)(e.menuItem?.key||``)),1)]),d(`button`,{class:`robot-history-delete`,onClick:k(e=>T(Ee)(t),[`stop`]),title:`删除此记录`},[...n[17]||=[d(`div`,{class:`i-mdi:close`},null,-1)]],8,oe)],42,H))),128))],512)])])],64)):T(v).trim()?(y(),u(i,{key:2},[l(` 搜索结果 `),d(`div`,se,[l(` 无结果状态 `),T(P)?(y(),u(i,{key:1},[l(` 搜索结果列表 `),d(`div`,le,[d(`div`,ue,[n[19]||=d(`div`,{class:`i-mdi:menu robot-group-icon`},null,-1),f(` `+C(t.resultGroupTitle)+` `,1),d(`span`,de,C(T(M).length),1)]),p(T(r),{id:Z,ref_key:`resultListRef`,ref:Pe,class:`robot-group-items robot-virtual-items`,role:`listbox`,"aria-label":t.resultGroupTitle,items:T(M),"item-size":64,style:g({height:`${Math.min(T(M).length*64,336)}px`})},{default:D(({item:e,index:t})=>[d(`div`,{id:Q(t),class:h(T(Ce)(t,!1)),role:`option`,"aria-selected":T(w)===t,"aria-posinset":t+1,"aria-setsize":T(M).length,title:`${e.label} · ${T(q)(e.key)}`,onClick:t=>T(Oe)(e),onMouseenter:e=>w.value=t},[e.icon?(y(),c(S(e.icon),{key:0,class:`robot-item-icon`})):(y(),u(`div`,pe,[...n[20]||=[d(`div`,{class:`i-mdi:file-document-outline`},null,-1)]])),d(`div`,me,[d(`div`,he,[(y(!0),u(i,null,x(T(we)(e.label,T(v)),(e,t)=>(y(),u(i,{key:t},[e.matched?(y(),u(`mark`,ge,C(e.text),1)):(y(),u(i,{key:1},[f(C(e.text),1)],64))],64))),128))]),d(`div`,_e,C(T(q)(e.key)),1)]),e.children?.length?(y(),u(`div`,ve,C(e.children.length),1)):l(`v-if`,!0)],42,fe)]),_:1},8,[`aria-label`,`items`,`style`])])],2112)):(y(),u(`div`,ce,[n[18]||=d(`div`,{class:`i-mdi:magnify robot-empty-icon`},null,-1),d(`p`,null,`未找到 "`+C(T(v))+`" 相关内容`,1)]))])],64)):l(`v-if`,!0):(y(),u(`div`,L,[n[12]||=d(`div`,{class:`i-mdi:magnify robot-empty-icon`},null,-1),d(`p`,null,C(t.emptyText),1)]))],2),l(` 搜索底部 `),d(`div`,ye,[n[21]||=d(`div`,{class:`robot-footer-actions`},[d(`div`,{class:`robot-action-item`},[d(`kbd`,null,`↵`),d(`span`,null,`选择`)]),d(`div`,{class:`robot-action-item`},[d(`kbd`,null,`↑↓`),d(`span`,null,`导航`)]),d(`div`,{class:`robot-action-item`},[d(`kbd`,null,`esc`),d(`span`,null,`关闭`)])],-1),T(K)?(y(),u(`div`,be,[T(v).trim()&&T(P)?(y(),u(`span`,xe,` 共 `+C(T(M).length)+` 项结果 `,1)):!T(v).trim()&&T(N).length>0?(y(),u(`span`,Se,C(T(N).length)+` 条历史记录 `,1)):l(`v-if`,!0)])):l(`v-if`,!0)])],2)],36)):l(`v-if`,!0)]),_:1})]))],4))}}),[[`__scopeId`,`data-v-fa264652`]]);export{F as n,K as t};
|
package/dist/C_Guide.css
CHANGED
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
inset: 0;
|
|
34
34
|
}
|
|
35
35
|
.c-icon__spinner[data-v-075758a0] {
|
|
36
|
+
display: block;
|
|
37
|
+
box-sizing: border-box;
|
|
36
38
|
width: 100%;
|
|
37
39
|
height: 100%;
|
|
38
40
|
border: 2px solid currentColor;
|
|
@@ -58,6 +60,17 @@
|
|
|
58
60
|
transform: rotate(360deg);
|
|
59
61
|
}
|
|
60
62
|
}
|
|
63
|
+
@media (prefers-reduced-motion: reduce) {
|
|
64
|
+
.c-icon[data-v-075758a0],
|
|
65
|
+
.c-icon__spinner[data-v-075758a0] {
|
|
66
|
+
animation: none;
|
|
67
|
+
transition: none;
|
|
68
|
+
}
|
|
69
|
+
.c-icon--clickable[data-v-075758a0]:hover,
|
|
70
|
+
.c-icon--clickable[data-v-075758a0]:active {
|
|
71
|
+
transform: none;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
61
74
|
|
|
62
75
|
/* layer: default */
|
|
63
76
|
.inline-flex[data-v-075758a0]{display:inline-flex;}
|
|
@@ -72,8 +85,8 @@
|
|
|
72
85
|
* @Description: 引导入口键盘焦点样式,不依赖宿主样式
|
|
73
86
|
* Copyright (c) 2026 by CHENY, All Rights Reserved 😎.
|
|
74
87
|
*/
|
|
75
|
-
.c-guide-trigger[data-v-
|
|
76
|
-
outline: 2px solid var(--c-primary, #2080f0);
|
|
88
|
+
.c-guide-trigger[data-v-bb73745a]:focus-visible {
|
|
89
|
+
outline: 2px solid var(--c-primary, var(--c-theme-primary, #2080f0));
|
|
77
90
|
outline-offset: 4px;
|
|
78
91
|
border-radius: 4px;
|
|
79
92
|
}
|
|
@@ -90,29 +103,29 @@
|
|
|
90
103
|
min-width: 0;
|
|
91
104
|
max-width: calc(100vw - 24px);
|
|
92
105
|
padding: 20px;
|
|
93
|
-
color: var(--c-guide-text, var(--c-text-1, #262626));
|
|
94
|
-
background: var(--c-guide-bg, var(--c-bg-surface, #fff));
|
|
95
|
-
border: 1px solid var(--c-guide-border, var(--c-border, #e5e7eb));
|
|
106
|
+
color: var(--c-guide-text, var(--c-text-1, var(--c-theme-text-1, #262626)));
|
|
107
|
+
background: var(--c-guide-bg, var(--c-bg-surface, var(--c-theme-bg-surface, #fff)));
|
|
108
|
+
border: 1px solid var(--c-guide-border, var(--c-border, var(--c-theme-border, #e5e7eb)));
|
|
96
109
|
border-radius: var(--c-guide-radius, 14px);
|
|
97
|
-
box-shadow: var(--c-shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.2));
|
|
110
|
+
box-shadow: var(--c-shadow-lg, var(--c-theme-shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.2)));
|
|
98
111
|
font-family: inherit;
|
|
99
112
|
}
|
|
100
113
|
.driver-popover.c-guide-popover .driver-popover-title {
|
|
101
114
|
padding-right: 20px;
|
|
102
|
-
color: var(--c-guide-text, var(--c-text-1, #262626));
|
|
115
|
+
color: var(--c-guide-text, var(--c-text-1, var(--c-theme-text-1, #262626)));
|
|
103
116
|
font-size: 18px;
|
|
104
117
|
font-weight: 650;
|
|
105
118
|
line-height: 1.5;
|
|
106
119
|
}
|
|
107
120
|
.driver-popover.c-guide-popover .driver-popover-description {
|
|
108
|
-
color: var(--c-guide-text-secondary, var(--c-text-2, #525252));
|
|
121
|
+
color: var(--c-guide-text-secondary, var(--c-text-2, var(--c-theme-text-2, #525252)));
|
|
109
122
|
font-size: 13px;
|
|
110
123
|
line-height: 1.7;
|
|
111
124
|
}
|
|
112
125
|
.driver-popover.c-guide-popover .c-guide-figure {
|
|
113
126
|
padding: 4px 0;
|
|
114
|
-
color: var(--c-guide-primary, var(--c-primary, #2080f0));
|
|
115
|
-
background: color-mix(in srgb, var(--c-guide-primary, var(--c-primary, #2080f0)) 8%, var(--c-guide-bg, var(--c-bg-surface, #fff)));
|
|
127
|
+
color: var(--c-guide-primary, var(--c-primary, var(--c-theme-primary, #2080f0)));
|
|
128
|
+
background: color-mix(in srgb, var(--c-guide-primary, var(--c-primary, var(--c-theme-primary, #2080f0))) 8%, var(--c-guide-bg, var(--c-bg-surface, var(--c-theme-bg-surface, #fff))));
|
|
116
129
|
border-radius: 9px;
|
|
117
130
|
}
|
|
118
131
|
.driver-popover.c-guide-popover .c-guide-figure svg {
|
|
@@ -142,9 +155,9 @@
|
|
|
142
155
|
.driver-popover.c-guide-popover .driver-popover-footer button {
|
|
143
156
|
min-height: 32px;
|
|
144
157
|
padding: 5px 12px;
|
|
145
|
-
color: var(--c-guide-text, var(--c-text-1, #262626));
|
|
146
|
-
background: var(--c-guide-bg, var(--c-bg-surface, #fff));
|
|
147
|
-
border: 1px solid var(--c-guide-border, var(--c-border, #e5e7eb));
|
|
158
|
+
color: var(--c-guide-text, var(--c-text-1, var(--c-theme-text-1, #262626)));
|
|
159
|
+
background: var(--c-guide-bg, var(--c-bg-surface, var(--c-theme-bg-surface, #fff)));
|
|
160
|
+
border: 1px solid var(--c-guide-border, var(--c-border, var(--c-theme-border, #e5e7eb)));
|
|
148
161
|
border-radius: 7px;
|
|
149
162
|
font-size: 12px;
|
|
150
163
|
text-shadow: none;
|
|
@@ -157,13 +170,13 @@
|
|
|
157
170
|
background: color-mix(in srgb, var(--c-guide-primary, #2080f0) 8%, var(--c-guide-bg, #fff));
|
|
158
171
|
}
|
|
159
172
|
.driver-popover.c-guide-popover .driver-popover-footer button:focus-visible {
|
|
160
|
-
outline: 2px solid var(--c-guide-primary, var(--c-primary, #2080f0));
|
|
173
|
+
outline: 2px solid var(--c-guide-primary, var(--c-primary, var(--c-theme-primary, #2080f0)));
|
|
161
174
|
outline-offset: 2px;
|
|
162
175
|
}
|
|
163
176
|
.driver-popover.c-guide-popover .driver-popover-footer .driver-popover-next-btn {
|
|
164
177
|
color: #fff;
|
|
165
|
-
background: var(--c-guide-primary, var(--c-primary, #2080f0));
|
|
166
|
-
border-color: var(--c-guide-primary, var(--c-primary, #2080f0));
|
|
178
|
+
background: var(--c-guide-primary, var(--c-primary, var(--c-theme-primary, #2080f0)));
|
|
179
|
+
border-color: var(--c-guide-primary, var(--c-primary, var(--c-theme-primary, #2080f0)));
|
|
167
180
|
}
|
|
168
181
|
.driver-popover.c-guide-popover .driver-popover-footer .driver-popover-next-btn:hover {
|
|
169
182
|
background: var(--c-guide-primary-hover, #4098fc);
|
|
@@ -171,24 +184,24 @@
|
|
|
171
184
|
.driver-popover.c-guide-popover .driver-popover-close-btn {
|
|
172
185
|
top: 14px;
|
|
173
186
|
right: 12px;
|
|
174
|
-
color: var(--c-guide-text-muted, var(--c-text-3, #a3a3a3));
|
|
187
|
+
color: var(--c-guide-text-muted, var(--c-text-3, var(--c-theme-text-3, #a3a3a3)));
|
|
175
188
|
}
|
|
176
189
|
.driver-popover.c-guide-popover .driver-popover-close-btn:hover, .driver-popover.c-guide-popover .driver-popover-close-btn:focus {
|
|
177
|
-
color: var(--c-guide-text, var(--c-text-1, #262626));
|
|
190
|
+
color: var(--c-guide-text, var(--c-text-1, var(--c-theme-text-1, #262626)));
|
|
178
191
|
}
|
|
179
192
|
.driver-popover.c-guide-popover .driver-popover-arrow-side-left {
|
|
180
|
-
border-left-color: var(--c-guide-bg, var(--c-bg-surface, #fff));
|
|
193
|
+
border-left-color: var(--c-guide-bg, var(--c-bg-surface, var(--c-theme-bg-surface, #fff)));
|
|
181
194
|
}
|
|
182
195
|
.driver-popover.c-guide-popover .driver-popover-arrow-side-right {
|
|
183
|
-
border-right-color: var(--c-guide-bg, var(--c-bg-surface, #fff));
|
|
196
|
+
border-right-color: var(--c-guide-bg, var(--c-bg-surface, var(--c-theme-bg-surface, #fff)));
|
|
184
197
|
}
|
|
185
198
|
.driver-popover.c-guide-popover .driver-popover-arrow-side-top {
|
|
186
|
-
border-top-color: var(--c-guide-bg, var(--c-bg-surface, #fff));
|
|
199
|
+
border-top-color: var(--c-guide-bg, var(--c-bg-surface, var(--c-theme-bg-surface, #fff)));
|
|
187
200
|
}
|
|
188
201
|
.driver-popover.c-guide-popover .driver-popover-arrow-side-bottom {
|
|
189
|
-
border-bottom-color: var(--c-guide-bg, var(--c-bg-surface, #fff));
|
|
202
|
+
border-bottom-color: var(--c-guide-bg, var(--c-bg-surface, var(--c-theme-bg-surface, #fff)));
|
|
190
203
|
}
|
|
191
204
|
|
|
192
205
|
/* layer: default */
|
|
193
|
-
.m62[data-v-
|
|
194
|
-
.hidden[data-v-
|
|
206
|
+
.m62[data-v-bb73745a]{margin:15.5rem;}
|
|
207
|
+
.hidden[data-v-bb73745a]{display:none;}
|
package/dist/C_Guide2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);const e=require(`./
|
|
1
|
+
require(`./chunk.cjs`);const e=require(`./useComponentTheme.cjs`),t=require(`./export-helper.cjs`),n=require(`./C_Icon2.cjs`);let r=require(`vue`),i=require(`naive-ui`);const a={navigation:`<rect x="34" y="12" width="56" height="72" rx="6" fill="currentColor" opacity=".12"/><path d="M46 30h30M46 48h30M46 66h20"/><rect x="108" y="12" width="118" height="72" rx="6" fill="currentColor" opacity=".07"/><path d="M122 32h64M122 48h90M122 64h74"/>`,search:`<rect x="28" y="26" width="204" height="44" rx="10" fill="currentColor" opacity=".09"/><circle cx="56" cy="46" r="8"/><path d="m62 52 6 6M86 44h104M86 55h70"/>`,tabs:`<rect x="28" y="24" width="204" height="56" rx="6" fill="currentColor" opacity=".07"/><rect x="40" y="16" width="58" height="26" rx="6" fill="currentColor" opacity=".2"/><path d="M50 29h25m10-3 6 6m0-6-6 6M112 29h38M166 29h38M44 56h100M44 67h144"/>`,account:`<circle cx="60" cy="48" r="22" fill="currentColor" opacity=".12"/><circle cx="60" cy="41" r="6"/><path d="M49 60c0-13 22-13 22 0M94 40h40m-8-6 8 6-8 6M94 58h40m-32-6-8 6 8 6"/><rect x="154" y="20" width="62" height="56" rx="6" fill="currentColor" opacity=".09"/><path d="M168 36h34M168 48h34M168 60h22"/>`,overview:`<rect x="28" y="14" width="204" height="68" rx="8" fill="currentColor" opacity=".07"/><path d="M42 30h76M42 42h52"/><rect x="42" y="54" width="48" height="16" rx="4"/><rect x="106" y="54" width="48" height="16" rx="4"/><rect x="170" y="54" width="48" height="16" rx="4"/>`,notification:`<circle cx="130" cy="48" r="36" fill="currentColor" opacity=".07"/><path d="M109 63h42l-6-10V40a15 15 0 0 0-30 0v13l-6 10ZM124 71h12"/><circle cx="150" cy="26" r="8" fill="currentColor" opacity=".3"/>`,fullscreen:`<rect x="50" y="14" width="160" height="68" rx="8" fill="currentColor" opacity=".07"/><path d="M66 40V28h20M174 28h20v12M66 56v12h20M174 68h20V56"/><rect x="106" y="34" width="48" height="28" rx="4"/>`,language:`<rect x="54" y="18" width="72" height="54" rx="8" fill="currentColor" opacity=".1"/><rect x="134" y="24" width="72" height="54" rx="8" fill="currentColor" opacity=".07"/><path d="M70 34h40M90 27v7M79 34c2 15 9 22 27 28M101 34c-3 15-13 24-28 29M151 64l16-27 16 27M158 53h18"/>`,theme:`<circle cx="78" cy="48" r="15" fill="currentColor" opacity=".12"/><path d="M78 24v-6M78 78v-6M54 48h-6M108 48h-6M61 31l-5-5M100 70l-5-5M61 65l-5 5M100 26l-5 5M168 22a26 26 0 1 0 28 42 26 26 0 0 1-28-42Z"/>`,settings:`<rect x="44" y="14" width="172" height="68" rx="8" fill="currentColor" opacity=".07"/><path d="M62 31h136M62 48h136M62 65h136"/><circle cx="94" cy="31" r="5" fill="currentColor"/><circle cx="168" cy="48" r="5" fill="currentColor"/><circle cx="124" cy="65" r="5" fill="currentColor"/>`};function o(e){return e.width>0&&e.height>0&&e.right>0&&e.bottom>0&&e.left<window.innerWidth&&e.top<window.innerHeight}function s(e){if(!(!e||typeof document>`u`))return(typeof e==`string`?Array.from(document.querySelectorAll(e)):[typeof e==`function`?e():e]).find(e=>{if(!e?.isConnected)return!1;let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView?.getComputedStyle(e);return o(t)&&n?.visibility!==`hidden`})}function c(e){let{illustration:t}=e.popover,n=t&&a[t];return n?`<div class="c-guide-figure"><svg viewBox="0 0 260 96" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">${n}</svg></div><div class="c-guide-copy">${e.popover.description}</div>`:e.popover.description}const l=(0,r.defineComponent)({name:`C_Guide`,__name:`index`,props:{steps:{default:()=>[]},doneBtnText:{default:`完成`},nextBtnText:{default:`下一步`},prevBtnText:{default:`上一步`},showSkipButton:{type:Boolean,default:!0},skipBtnText:{default:`跳过引导`},showProgress:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},animate:{type:Boolean,default:!0},allowClose:{type:Boolean,default:!0},skipMissingElements:{type:Boolean,default:!0},theme:{},persistence:{},popoverClass:{default:`driverjs-theme`},showTrigger:{type:Boolean,default:!0},triggerTooltip:{default:`功能引导`},triggerIcon:{default:`mdi:sign-routes`}},emits:[`start`,`complete`,`close`,`skip`,`step-change`,`error`],setup(t,{expose:a,emit:o}){let l=e.n(),u=t,d=o,f=(0,i.useThemeVars)(),p=(0,r.ref)(!1),m=(0,r.computed)(()=>`${u.persistence?.keyPrefix??`c_guide`}_completed`),h=null,g,_=0,v=()=>{if(!u.persistence?.enabled)return!1;try{return localStorage.getItem(m.value)===`true`}catch{return!1}},y=()=>{if(u.persistence?.enabled)try{localStorage.setItem(m.value,`true`)}catch{}},b=()=>{try{localStorage.removeItem(m.value)}catch{}},x=()=>{_++,p.value=!1;let e=g;g=void 0,e?.()},S=e=>{let t=u.theme??{},n={"--c-guide-bg":t.popoverBgColor??f.value.popoverColor,"--c-guide-text":t.popoverTextColor??f.value.textColor1,"--c-guide-text-secondary":t.popoverTextColor??f.value.textColor2,"--c-guide-text-muted":f.value.textColor3,"--c-guide-primary":t.primaryColor??f.value.primaryColor,"--c-guide-primary-hover":t.primaryColor??f.value.primaryColorHover,"--c-guide-border":f.value.borderColor,"--c-guide-radius":t.borderRadius??`14px`};for(let[t,r]of Object.entries(n))e.wrapper.style.setProperty(t,r)},C=()=>u.theme?.overlayOpacity===void 0?{}:{overlayOpacity:u.theme.overlayOpacity},w=e=>p.value||!e&&v(),T=async(e=!1)=>{if(w(e))return;x();let t=_;p.value=!0;try{let{driver:e}=await import(`driver.js`);if(t!==_)return;let n=u.steps.filter(e=>!e.skipIf?.()&&(!u.skipMissingElements||!e.element||s(e.element)));if(!n.length)return;let r=`close`,i=0,a=!1,o=!1,l=e=>{e.nextButton.disabled=o,e.previousButton.disabled=o},f=()=>{a||(a=!0,h===b&&(h=null,g=void 0),r===`complete`?(y(),d(`complete`)):r!==`dispose`&&(r===`skip`&&d(`skip`,i),d(`close`,i)))},p=()=>{b.destroy(),f()},m=()=>{o||(b.isLastStep()?(r=`complete`,p()):b.moveNext())},v=C(),b=e({popoverClass:`c-guide-popover ${u.popoverClass}`.trim(),animate:u.animate&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,showProgress:u.showProgress,progressText:`{{current}} / {{total}}`,allowClose:u.allowClose,allowKeyboardControl:u.keyboard,skipMissingElement:u.skipMissingElements,...v,doneBtnText:u.doneBtnText,nextBtnText:u.nextBtnText,prevBtnText:u.prevBtnText,steps:n.map(e=>({element:e.element?()=>s(e.element):void 0,popover:{...e.popover,description:c(e)},onHighlightStarted:(t,n,{state:r})=>{o=!0,i=r.activeIndex??i,e.onHighlightStarted?.(t,e),d(`step-change`,i,e)},onHighlighted:()=>{o=!1;let{popover:e}=b.getState();e&&l(e)},onDeselected:t=>e.onDeselected?.(t,e)})),onPopoverRender:e=>{if(S(e),l(e),u.showSkipButton&&u.allowClose){let t=document.createElement(`button`);t.type=`button`,t.className=`c-guide-skip-btn`,t.textContent=u.skipBtnText,t.addEventListener(`click`,()=>{r=`skip`,p()}),e.footer.prepend(t)}},onNextClick:m,onPrevClick:()=>{o||b.movePrevious()},onDestroyStarted:p,onDestroyed:f});h=b,g=()=>{r=`dispose`,p()},d(`start`),t===_&&b.drive()}catch(e){t===_&&(x(),d(`error`,e))}finally{t===_&&(p.value=!1)}};return(0,r.onBeforeUnmount)(x),(0,r.watch)(()=>u.steps,x),(0,r.watch)([f,()=>u.theme],()=>{let e=h?.getState().popover;e&&S(e)},{deep:!0}),a({startGuide:T,stopGuide:x,resetCompleted:b,isCompleted:v}),(e,t)=>u.showTrigger?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(i.NTooltip),{key:0,placement:`bottom`,trigger:`hover`},{trigger:(0,r.withCtx)(()=>[(0,r.createVNode)((0,r.unref)(i.NButton),{class:`c-guide-trigger`,style:(0,r.normalizeStyle)((0,r.unref)(l)),text:``,loading:p.value,"aria-label":u.triggerTooltip,onClick:t[0]||=e=>T(!0)},{default:(0,r.withCtx)(()=>[(0,r.createVNode)(n.t,{name:u.triggerIcon,size:18},null,8,[`name`])]),_:1},8,[`style`,`loading`,`aria-label`])]),default:(0,r.withCtx)(()=>[(0,r.createElementVNode)(`span`,null,(0,r.toDisplayString)(u.triggerTooltip),1)]),_:1})):(0,r.createCommentVNode)(`v-if`,!0)}});var u=t.t(l,[[`__scopeId`,`data-v-bb73745a`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}});
|
package/dist/C_Guide2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as e}from"./useComponentTheme.js";import{t}from"./export-helper.js";import{t as n}from"./C_Icon2.js";import{computed as r,createBlock as i,createCommentVNode as a,createElementVNode as o,createVNode as s,defineComponent as c,normalizeStyle as l,onBeforeUnmount as u,openBlock as d,ref as f,toDisplayString as p,unref as m,watch as h,withCtx as g}from"vue";import{NButton as _,NTooltip as v,useThemeVars as y}from"naive-ui";const b={navigation:`<rect x="34" y="12" width="56" height="72" rx="6" fill="currentColor" opacity=".12"/><path d="M46 30h30M46 48h30M46 66h20"/><rect x="108" y="12" width="118" height="72" rx="6" fill="currentColor" opacity=".07"/><path d="M122 32h64M122 48h90M122 64h74"/>`,search:`<rect x="28" y="26" width="204" height="44" rx="10" fill="currentColor" opacity=".09"/><circle cx="56" cy="46" r="8"/><path d="m62 52 6 6M86 44h104M86 55h70"/>`,tabs:`<rect x="28" y="24" width="204" height="56" rx="6" fill="currentColor" opacity=".07"/><rect x="40" y="16" width="58" height="26" rx="6" fill="currentColor" opacity=".2"/><path d="M50 29h25m10-3 6 6m0-6-6 6M112 29h38M166 29h38M44 56h100M44 67h144"/>`,account:`<circle cx="60" cy="48" r="22" fill="currentColor" opacity=".12"/><circle cx="60" cy="41" r="6"/><path d="M49 60c0-13 22-13 22 0M94 40h40m-8-6 8 6-8 6M94 58h40m-32-6-8 6 8 6"/><rect x="154" y="20" width="62" height="56" rx="6" fill="currentColor" opacity=".09"/><path d="M168 36h34M168 48h34M168 60h22"/>`,overview:`<rect x="28" y="14" width="204" height="68" rx="8" fill="currentColor" opacity=".07"/><path d="M42 30h76M42 42h52"/><rect x="42" y="54" width="48" height="16" rx="4"/><rect x="106" y="54" width="48" height="16" rx="4"/><rect x="170" y="54" width="48" height="16" rx="4"/>`,notification:`<circle cx="130" cy="48" r="36" fill="currentColor" opacity=".07"/><path d="M109 63h42l-6-10V40a15 15 0 0 0-30 0v13l-6 10ZM124 71h12"/><circle cx="150" cy="26" r="8" fill="currentColor" opacity=".3"/>`,fullscreen:`<rect x="50" y="14" width="160" height="68" rx="8" fill="currentColor" opacity=".07"/><path d="M66 40V28h20M174 28h20v12M66 56v12h20M174 68h20V56"/><rect x="106" y="34" width="48" height="28" rx="4"/>`,language:`<rect x="54" y="18" width="72" height="54" rx="8" fill="currentColor" opacity=".1"/><rect x="134" y="24" width="72" height="54" rx="8" fill="currentColor" opacity=".07"/><path d="M70 34h40M90 27v7M79 34c2 15 9 22 27 28M101 34c-3 15-13 24-28 29M151 64l16-27 16 27M158 53h18"/>`,theme:`<circle cx="78" cy="48" r="15" fill="currentColor" opacity=".12"/><path d="M78 24v-6M78 78v-6M54 48h-6M108 48h-6M61 31l-5-5M100 70l-5-5M61 65l-5 5M100 26l-5 5M168 22a26 26 0 1 0 28 42 26 26 0 0 1-28-42Z"/>`,settings:`<rect x="44" y="14" width="172" height="68" rx="8" fill="currentColor" opacity=".07"/><path d="M62 31h136M62 48h136M62 65h136"/><circle cx="94" cy="31" r="5" fill="currentColor"/><circle cx="168" cy="48" r="5" fill="currentColor"/><circle cx="124" cy="65" r="5" fill="currentColor"/>`};function x(e){return e.width>0&&e.height>0&&e.right>0&&e.bottom>0&&e.left<window.innerWidth&&e.top<window.innerHeight}function S(e){if(!(!e||typeof document>`u`))return(typeof e==`string`?Array.from(document.querySelectorAll(e)):[typeof e==`function`?e():e]).find(e=>{if(!e?.isConnected)return!1;let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView?.getComputedStyle(e);return x(t)&&n?.visibility!==`hidden`})}function C(e){let{illustration:t}=e.popover,n=t&&b[t];return n?`<div class="c-guide-figure"><svg viewBox="0 0 260 96" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">${n}</svg></div><div class="c-guide-copy">${e.popover.description}</div>`:e.popover.description}var w=t(c({name:`C_Guide`,__name:`index`,props:{steps:{default:()=>[]},doneBtnText:{default:`完成`},nextBtnText:{default:`下一步`},prevBtnText:{default:`上一步`},showSkipButton:{type:Boolean,default:!0},skipBtnText:{default:`跳过引导`},showProgress:{type:Boolean,default:!0},keyboard:{type:Boolean,default:!0},animate:{type:Boolean,default:!0},allowClose:{type:Boolean,default:!0},skipMissingElements:{type:Boolean,default:!0},theme:{},persistence:{},popoverClass:{default:`driverjs-theme`},showTrigger:{type:Boolean,default:!0},triggerTooltip:{default:`功能引导`},triggerIcon:{default:`mdi:sign-routes`}},emits:[`start`,`complete`,`close`,`skip`,`step-change`,`error`],setup(t,{expose:c,emit:b}){let x=e(),w=t,T=b,E=y(),D=f(!1),O=r(()=>`${w.persistence?.keyPrefix??`c_guide`}_completed`),k=null,A,j=0,M=()=>{if(!w.persistence?.enabled)return!1;try{return localStorage.getItem(O.value)===`true`}catch{return!1}},N=()=>{if(w.persistence?.enabled)try{localStorage.setItem(O.value,`true`)}catch{}},P=()=>{try{localStorage.removeItem(O.value)}catch{}},F=()=>{j++,D.value=!1;let e=A;A=void 0,e?.()},I=e=>{let t=w.theme??{},n={"--c-guide-bg":t.popoverBgColor??E.value.popoverColor,"--c-guide-text":t.popoverTextColor??E.value.textColor1,"--c-guide-text-secondary":t.popoverTextColor??E.value.textColor2,"--c-guide-text-muted":E.value.textColor3,"--c-guide-primary":t.primaryColor??E.value.primaryColor,"--c-guide-primary-hover":t.primaryColor??E.value.primaryColorHover,"--c-guide-border":E.value.borderColor,"--c-guide-radius":t.borderRadius??`14px`};for(let[t,r]of Object.entries(n))e.wrapper.style.setProperty(t,r)},L=()=>w.theme?.overlayOpacity===void 0?{}:{overlayOpacity:w.theme.overlayOpacity},R=e=>D.value||!e&&M(),z=async(e=!1)=>{if(R(e))return;F();let t=j;D.value=!0;try{let{driver:e}=await import(`driver.js`);if(t!==j)return;let n=w.steps.filter(e=>!e.skipIf?.()&&(!w.skipMissingElements||!e.element||S(e.element)));if(!n.length)return;let r=`close`,i=0,a=!1,o=!1,s=e=>{e.nextButton.disabled=o,e.previousButton.disabled=o},c=()=>{a||(a=!0,k===f&&(k=null,A=void 0),r===`complete`?(N(),T(`complete`)):r!==`dispose`&&(r===`skip`&&T(`skip`,i),T(`close`,i)))},l=()=>{f.destroy(),c()},u=()=>{o||(f.isLastStep()?(r=`complete`,l()):f.moveNext())},d=L(),f=e({popoverClass:`c-guide-popover ${w.popoverClass}`.trim(),animate:w.animate&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,showProgress:w.showProgress,progressText:`{{current}} / {{total}}`,allowClose:w.allowClose,allowKeyboardControl:w.keyboard,skipMissingElement:w.skipMissingElements,...d,doneBtnText:w.doneBtnText,nextBtnText:w.nextBtnText,prevBtnText:w.prevBtnText,steps:n.map(e=>({element:e.element?()=>S(e.element):void 0,popover:{...e.popover,description:C(e)},onHighlightStarted:(t,n,{state:r})=>{o=!0,i=r.activeIndex??i,e.onHighlightStarted?.(t,e),T(`step-change`,i,e)},onHighlighted:()=>{o=!1;let{popover:e}=f.getState();e&&s(e)},onDeselected:t=>e.onDeselected?.(t,e)})),onPopoverRender:e=>{if(I(e),s(e),w.showSkipButton&&w.allowClose){let t=document.createElement(`button`);t.type=`button`,t.className=`c-guide-skip-btn`,t.textContent=w.skipBtnText,t.addEventListener(`click`,()=>{r=`skip`,l()}),e.footer.prepend(t)}},onNextClick:u,onPrevClick:()=>{o||f.movePrevious()},onDestroyStarted:l,onDestroyed:c});k=f,A=()=>{r=`dispose`,l()},T(`start`),t===j&&f.drive()}catch(e){t===j&&(F(),T(`error`,e))}finally{t===j&&(D.value=!1)}};return u(F),h(()=>w.steps,F),h([E,()=>w.theme],()=>{let e=k?.getState().popover;e&&I(e)},{deep:!0}),c({startGuide:z,stopGuide:F,resetCompleted:P,isCompleted:M}),(e,t)=>w.showTrigger?(d(),i(m(v),{key:0,placement:`bottom`,trigger:`hover`},{trigger:g(()=>[s(m(_),{class:`c-guide-trigger`,style:l(m(x)),text:``,loading:D.value,"aria-label":w.triggerTooltip,onClick:t[0]||=e=>z(!0)},{default:g(()=>[s(n,{name:w.triggerIcon,size:18},null,8,[`name`])]),_:1},8,[`style`,`loading`,`aria-label`])]),default:g(()=>[o(`span`,null,p(w.triggerTooltip),1)]),_:1})):a(`v-if`,!0)}}),[[`__scopeId`,`data-v-bb73745a`]]);export{w as t};
|
package/dist/C_Icon.css
CHANGED
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
inset: 0;
|
|
34
34
|
}
|
|
35
35
|
.c-icon__spinner[data-v-075758a0] {
|
|
36
|
+
display: block;
|
|
37
|
+
box-sizing: border-box;
|
|
36
38
|
width: 100%;
|
|
37
39
|
height: 100%;
|
|
38
40
|
border: 2px solid currentColor;
|
|
@@ -58,6 +60,17 @@
|
|
|
58
60
|
transform: rotate(360deg);
|
|
59
61
|
}
|
|
60
62
|
}
|
|
63
|
+
@media (prefers-reduced-motion: reduce) {
|
|
64
|
+
.c-icon[data-v-075758a0],
|
|
65
|
+
.c-icon__spinner[data-v-075758a0] {
|
|
66
|
+
animation: none;
|
|
67
|
+
transition: none;
|
|
68
|
+
}
|
|
69
|
+
.c-icon--clickable[data-v-075758a0]:hover,
|
|
70
|
+
.c-icon--clickable[data-v-075758a0]:active {
|
|
71
|
+
transform: none;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
61
74
|
|
|
62
75
|
/* layer: default */
|
|
63
76
|
.inline-flex[data-v-075758a0]{display:inline-flex;}
|
package/dist/C_ImageCropper.css
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
@import "./shared-tokens.css";
|
|
2
2
|
.vue-cropper[data-v-a742df44]{position:relative;width:100%;height:100%;box-sizing:border-box;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;direction:ltr;touch-action:none;text-align:left;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.vue-cropper .cropper-box[data-v-a742df44],.vue-cropper .cropper-box-canvas[data-v-a742df44],.vue-cropper .cropper-drag-box[data-v-a742df44],.vue-cropper .cropper-crop-box[data-v-a742df44],.vue-cropper .cropper-face[data-v-a742df44]{position:absolute;top:0;right:0;bottom:0;left:0;-webkit-user-select:none;user-select:none}.vue-cropper .cropper-box-canvas img[data-v-a742df44]{position:relative;text-align:left;-webkit-user-select:none;user-select:none;transform:none;max-width:none;max-height:none}.vue-cropper .cropper-box[data-v-a742df44]{overflow:hidden}.vue-cropper .cropper-move[data-v-a742df44]{cursor:move}.vue-cropper .cropper-crop[data-v-a742df44]{cursor:crosshair}.vue-cropper .cropper-modal[data-v-a742df44]{background:rgba(0,0,0,.5)}.vue-cropper .cropper-view-box[data-v-a742df44]{display:block;overflow:hidden;width:100%;height:100%;outline:1px solid #39f;outline-color:#3399ffbf;-webkit-user-select:none;user-select:none}.vue-cropper .cropper-view-box img[data-v-a742df44]{-webkit-user-select:none;user-select:none;text-align:left;max-width:none;max-height:none}.vue-cropper .cropper-face[data-v-a742df44]{top:0;left:0;background-color:#fff;opacity:.1}.vue-cropper .crop-info[data-v-a742df44]{position:absolute;left:0;min-width:65px;text-align:center;color:#fff;line-height:20px;background-color:#000c;font-size:12px}.vue-cropper .crop-line[data-v-a742df44]{position:absolute;display:block;width:100%;height:100%;opacity:.1}.vue-cropper .line-w[data-v-a742df44]{top:-3px;left:0;height:5px;cursor:n-resize}.vue-cropper .line-a[data-v-a742df44]{top:0;left:-3px;width:5px;cursor:w-resize}.vue-cropper .line-s[data-v-a742df44]{bottom:-3px;left:0;height:5px;cursor:s-resize}.vue-cropper .line-d[data-v-a742df44]{top:0;right:-3px;width:5px;cursor:e-resize}.vue-cropper .crop-point[data-v-a742df44]{position:absolute;width:8px;height:8px;opacity:.75;background-color:#39f;border-radius:100%}.vue-cropper .point1[data-v-a742df44]{top:-4px;left:-4px;cursor:nw-resize}.vue-cropper .point2[data-v-a742df44]{top:-5px;left:50%;margin-left:-3px;cursor:n-resize}.vue-cropper .point3[data-v-a742df44]{top:-4px;right:-4px;cursor:ne-resize}.vue-cropper .point4[data-v-a742df44]{top:50%;left:-4px;margin-top:-3px;cursor:w-resize}.vue-cropper .point5[data-v-a742df44]{top:50%;right:-4px;margin-top:-3px;cursor:e-resize}.vue-cropper .point6[data-v-a742df44]{bottom:-5px;left:-4px;cursor:sw-resize}.vue-cropper .point7[data-v-a742df44]{bottom:-5px;left:50%;margin-left:-3px;cursor:s-resize}.vue-cropper .point8[data-v-a742df44]{bottom:-5px;right:-4px;cursor:se-resize}@media screen and (max-width: 500px){.vue-cropper .crop-point[data-v-a742df44]{position:absolute;width:20px;height:20px;opacity:.45;background-color:#39f;border-radius:100%}.vue-cropper .point1[data-v-a742df44]{top:-10px;left:-10px}.vue-cropper .point2[data-v-a742df44],.vue-cropper .point4[data-v-a742df44],.vue-cropper .point5[data-v-a742df44],.vue-cropper .point7[data-v-a742df44]{display:none}.vue-cropper .point3[data-v-a742df44]{top:-10px;right:-10px}.vue-cropper .point4[data-v-a742df44]{top:0;left:0}.vue-cropper .point6[data-v-a742df44]{bottom:-10px;left:-10px}.vue-cropper .point8[data-v-a742df44]{bottom:-10px;right:-10px}}
|
|
3
3
|
|
|
4
|
-
.cropper-preview[data-v-
|
|
4
|
+
.cropper-preview[data-v-4ba28a69] {
|
|
5
5
|
display: flex;
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
gap: 16px;
|
|
8
8
|
}
|
|
9
|
-
.cropper-preview .preview-label[data-v-
|
|
9
|
+
.cropper-preview .preview-label[data-v-4ba28a69] {
|
|
10
10
|
display: flex;
|
|
11
11
|
gap: 6px;
|
|
12
12
|
align-items: center;
|
|
13
13
|
font-size: 13px;
|
|
14
14
|
font-weight: 500;
|
|
15
|
-
color: var(--text-
|
|
15
|
+
color: var(--c-text-2, var(--c-theme-text-2));
|
|
16
16
|
}
|
|
17
|
-
.cropper-preview .preview-main[data-v-
|
|
17
|
+
.cropper-preview .preview-main[data-v-4ba28a69] {
|
|
18
18
|
width: 100%;
|
|
19
19
|
overflow: hidden;
|
|
20
|
-
border: 1px solid var(--border-
|
|
20
|
+
border: 1px solid var(--c-border, var(--c-theme-border));
|
|
21
21
|
border-radius: 6px;
|
|
22
22
|
background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f0 75%), linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
|
|
23
23
|
background-position: 0 0, 0 8px, 8px -8px, -8px 0;
|
|
24
24
|
background-size: 16px 16px;
|
|
25
25
|
}
|
|
26
|
-
.cropper-preview .preview-main--circular[data-v-
|
|
26
|
+
.cropper-preview .preview-main--circular[data-v-4ba28a69] {
|
|
27
27
|
border-radius: 50%;
|
|
28
28
|
}
|
|
29
|
-
.cropper-preview .preview-main__viewport img[data-v-
|
|
29
|
+
.cropper-preview .preview-main__viewport img[data-v-4ba28a69] {
|
|
30
30
|
display: block;
|
|
31
31
|
max-width: none !important;
|
|
32
32
|
}
|
|
33
|
-
.cropper-preview .preview-empty[data-v-
|
|
33
|
+
.cropper-preview .preview-empty[data-v-4ba28a69] {
|
|
34
34
|
display: flex;
|
|
35
35
|
align-items: center;
|
|
36
36
|
justify-content: center;
|
|
@@ -38,44 +38,44 @@
|
|
|
38
38
|
height: 100%;
|
|
39
39
|
min-height: 120px;
|
|
40
40
|
}
|
|
41
|
-
.cropper-preview .preview-thumbs[data-v-
|
|
41
|
+
.cropper-preview .preview-thumbs[data-v-4ba28a69] {
|
|
42
42
|
display: flex;
|
|
43
43
|
gap: 12px;
|
|
44
44
|
align-items: flex-end;
|
|
45
45
|
justify-content: center;
|
|
46
46
|
}
|
|
47
|
-
.cropper-preview .preview-thumb[data-v-
|
|
47
|
+
.cropper-preview .preview-thumb[data-v-4ba28a69] {
|
|
48
48
|
display: flex;
|
|
49
49
|
flex-direction: column;
|
|
50
50
|
gap: 4px;
|
|
51
51
|
align-items: center;
|
|
52
52
|
}
|
|
53
|
-
.cropper-preview .preview-thumb__box[data-v-
|
|
53
|
+
.cropper-preview .preview-thumb__box[data-v-4ba28a69] {
|
|
54
54
|
overflow: hidden;
|
|
55
|
-
border: 1px solid var(--border-
|
|
55
|
+
border: 1px solid var(--c-border, var(--c-theme-border));
|
|
56
56
|
border-radius: 4px;
|
|
57
|
-
background: var(--body-
|
|
57
|
+
background: var(--c-bg-body, var(--c-theme-bg-body));
|
|
58
58
|
}
|
|
59
|
-
.cropper-preview .preview-thumb__box--circular[data-v-
|
|
59
|
+
.cropper-preview .preview-thumb__box--circular[data-v-4ba28a69] {
|
|
60
60
|
border-radius: 50%;
|
|
61
61
|
}
|
|
62
|
-
.cropper-preview .preview-thumb__viewport img[data-v-
|
|
62
|
+
.cropper-preview .preview-thumb__viewport img[data-v-4ba28a69] {
|
|
63
63
|
display: block;
|
|
64
64
|
max-width: none !important;
|
|
65
65
|
}
|
|
66
|
-
.cropper-preview .preview-thumb__label[data-v-
|
|
66
|
+
.cropper-preview .preview-thumb__label[data-v-4ba28a69] {
|
|
67
67
|
font-size: 11px;
|
|
68
|
-
color: var(--text-
|
|
68
|
+
color: var(--c-text-3, var(--c-theme-text-3));
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/* layer: default */
|
|
72
|
-
.block[data-v-
|
|
73
|
-
.hidden[data-v-
|
|
74
|
-
.flex[data-v-
|
|
75
|
-
.border[data-v-
|
|
76
|
-
.px[data-v-
|
|
72
|
+
.block[data-v-4ba28a69]{display:block;}
|
|
73
|
+
.hidden[data-v-4ba28a69]{display:none;}
|
|
74
|
+
.flex[data-v-4ba28a69]{display:flex;}
|
|
75
|
+
.border[data-v-4ba28a69]{border-width:1px;}
|
|
76
|
+
.px[data-v-4ba28a69]{padding-left:1rem;padding-right:1rem;}
|
|
77
77
|
|
|
78
|
-
.cropper-toolbar[data-v-
|
|
78
|
+
.cropper-toolbar[data-v-3f34ca44] {
|
|
79
79
|
display: flex;
|
|
80
80
|
flex-wrap: wrap;
|
|
81
81
|
gap: 4px;
|
|
@@ -84,63 +84,64 @@
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
/* layer: default */
|
|
87
|
-
.flex[data-v-
|
|
88
|
-
.flex-wrap[data-v-
|
|
87
|
+
.flex[data-v-3f34ca44]{display:flex;}
|
|
88
|
+
.flex-wrap[data-v-3f34ca44]{flex-wrap:wrap;}
|
|
89
89
|
|
|
90
90
|
/* C_ImageCropper styles */
|
|
91
|
-
.c-image-cropper[data-v-
|
|
91
|
+
.c-image-cropper[data-v-bf64f2a5] {
|
|
92
92
|
width: 100%;
|
|
93
93
|
}
|
|
94
|
-
.c-image-cropper__body[data-v-
|
|
94
|
+
.c-image-cropper__body[data-v-bf64f2a5] {
|
|
95
95
|
display: flex;
|
|
96
96
|
flex-direction: column;
|
|
97
97
|
gap: 8px;
|
|
98
98
|
}
|
|
99
|
-
.c-image-cropper__workspace[data-v-
|
|
99
|
+
.c-image-cropper__workspace[data-v-bf64f2a5] {
|
|
100
100
|
display: flex;
|
|
101
101
|
gap: 16px;
|
|
102
102
|
align-items: stretch;
|
|
103
103
|
}
|
|
104
|
-
.c-image-cropper__canvas[data-v-
|
|
104
|
+
.c-image-cropper__canvas[data-v-bf64f2a5] {
|
|
105
105
|
position: relative;
|
|
106
106
|
flex: 1;
|
|
107
107
|
min-width: 0;
|
|
108
108
|
overflow: hidden;
|
|
109
|
-
border: 1px solid var(--border-
|
|
109
|
+
border: 1px solid var(--c-border, var(--c-theme-border));
|
|
110
110
|
border-radius: 6px;
|
|
111
|
-
background: var(--body-
|
|
111
|
+
background: var(--c-bg-body, var(--c-theme-bg-body));
|
|
112
112
|
}
|
|
113
|
-
.c-image-cropper__canvas[data-v-
|
|
113
|
+
.c-image-cropper__canvas[data-v-bf64f2a5] .vue-cropper {
|
|
114
114
|
width: 100% !important;
|
|
115
115
|
height: 100% !important;
|
|
116
116
|
}
|
|
117
|
-
.c-image-cropper__preview-panel[data-v-
|
|
117
|
+
.c-image-cropper__preview-panel[data-v-bf64f2a5] {
|
|
118
118
|
flex: 0 1 280px;
|
|
119
119
|
min-width: 200px;
|
|
120
120
|
padding: 16px;
|
|
121
121
|
overflow: hidden;
|
|
122
|
-
border: 1px solid var(--border-
|
|
122
|
+
border: 1px solid var(--c-border, var(--c-theme-border));
|
|
123
123
|
border-radius: 6px;
|
|
124
|
-
background: var(--card-
|
|
124
|
+
background: var(--c-bg-card, var(--c-theme-bg-card));
|
|
125
125
|
}
|
|
126
|
-
.c-image-cropper__placeholder[data-v-
|
|
126
|
+
.c-image-cropper__placeholder[data-v-bf64f2a5] {
|
|
127
127
|
display: flex;
|
|
128
128
|
flex-direction: column;
|
|
129
129
|
gap: 8px;
|
|
130
130
|
align-items: center;
|
|
131
131
|
justify-content: center;
|
|
132
132
|
height: 100%;
|
|
133
|
-
color: var(--text-
|
|
133
|
+
color: var(--c-text-3, var(--c-theme-text-3));
|
|
134
134
|
font-size: 14px;
|
|
135
135
|
}
|
|
136
136
|
@media (width <= 768px) {
|
|
137
|
-
.c-image-cropper__workspace[data-v-
|
|
137
|
+
.c-image-cropper__workspace[data-v-bf64f2a5] {
|
|
138
138
|
flex-direction: column;
|
|
139
139
|
}
|
|
140
|
-
.c-image-cropper__preview-panel[data-v-
|
|
140
|
+
.c-image-cropper__preview-panel[data-v-bf64f2a5] {
|
|
141
|
+
min-width: 0;
|
|
141
142
|
max-width: none;
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
/* layer: default */
|
|
146
|
-
.px[data-v-
|
|
147
|
+
.px[data-v-bf64f2a5]{padding-left:1rem;padding-right:1rem;}
|