@techui/scifi 0.0.6-alpha.1 → 0.1.0-alpha.1

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/index.js CHANGED
@@ -1,37 +1,104 @@
1
- import "@techui/icons";
1
+ import "@techui/icons";
2
2
  import "./dist/index.css";
3
- import { dynamicEcharts, toComps, toDirective, toGlobal, toRoot } from "./dist/index.js";
3
+ import { tCryptoStore, tLang } from "@techui/utils";
4
+ import { toComps, toDirective, toGlobal, toRoot } from "./dist/index.js";
4
5
 
5
- const initComps=(app,license,features,debug=false)=>{
6
- const {echarts=false,advanced=false,}=features
6
+ const aliasName={
7
+ "ScifiButtonA1": "ScifiButtonHex",
8
+ "ScifiButtonA2": "ScifiButtonPod",
9
+ "ScifiButtonA3": "ScifiButtonDash",
10
+ "ScifiButtonA4": "ScifiButtonExo",
11
+ "ScifiButtonA5": "ScifiButtonFin",
12
+
13
+ "ScifiDecoA1": "ScifiDecoRune",
14
+ "ScifiDecoB1": "ScifiDecoOrb",
15
+ "ScifiDecoB2": "ScifiDecoHive",
16
+ "ScifiDecoB3": "ScifiDecoPrism",
17
+ "ScifiDecoC1": "ScifiDecoPair",
18
+
19
+ "ScifiHeaderA1": "ScifiHeaderSurge",
20
+ "ScifiHeaderA2": "ScifiHeaderRazor",
21
+ "ScifiHeaderA3": "ScifiHeaderEcho",
22
+ "ScifiHeaderA4": "ScifiHeaderPhantom",
23
+
24
+ "ScifiPanelA1": "ScifiPanelAlpha",
25
+ "ScifiPanelA2": "ScifiPanelVanguard",
26
+ "ScifiPanelA3": "ScifiPanelDelta",
27
+ "ScifiPanelB1": "ScifiPanelSentinel",
28
+ "ScifiPanelB2": "ScifiPanelDeck",
29
+ "ScifiPanelB3": "ScifiPanelPawn",
30
+ "ScifiPanelB4": "ScifiPanelInfinity",
31
+ "ScifiPanelDV1": "ScifiPanelProtocol",
32
+ "ScifiPanelDV2": "ScifiPanelReactor",
33
+ "ScifiPanelDV3": "ScifiPanelRanger",
34
+ "ScifiPanelDV4": "ScifiPanelQuad",
35
+ "ScifiPanelDV5": "ScifiPanelZone",
36
+ "ScifiPanelDV6": "ScifiPanelClip",
37
+ "ScifiPanelDV7": "ScifiPanelArc",
38
+ "ScifiPanelDV8": "ScifiPanelVeil",
39
+ "ScifiPanelDV9": "ScifiPanelFlow",
40
+ "TuiPanelA1": "TuiPanelZero",
41
+
42
+ "ScifiPanelTitleA1": "ScifiPanelTitleAlt",
43
+ "ScifiPanelTitleA2": "ScifiPanelTitleDuo",
44
+ "ScifiPanelTitleA3": "ScifiPanelTitlePipe",
45
+ "TuiPanelTitleA1": "TuiPanelTitleEave",
46
+ "TuiPanelTitleA2": "TuiPanelTitleRod"
47
+ }
48
+
49
+ const advanceComps=[
50
+ "Tui3DPanel",
51
+ "TuiBar3D",
52
+ "TuiBar3DGroup",
53
+ "TuiPie",
54
+ "TuiT3DPanelToggle",
55
+ "TuiPanicAlert",
56
+ ]
57
+
58
+ const echartsComps=[
59
+ "TuiEcharts",
60
+ "TuiEchartsMap",
61
+ ]
62
+
63
+ const initComps=(app,license,features,debug=false,initLang=null)=>{
64
+ const {echarts=null,advanced=false}=features
65
+ const isActEcharts = (
66
+ echarts !== null &&
67
+ typeof echarts === "object" &&
68
+ echarts.version?.startsWith('6.')
69
+ );
70
+ app.use(toGlobal.$gAttention)
7
71
  app.use(toGlobal.$gMask)
8
72
  app.use(toGlobal.$gLoading)
73
+ app.use(toGlobal.$gPopover)
74
+ app.use(toGlobal.$gPopoverDirectiveCloseAll)
75
+ app.directive('tuiMenu', toDirective.$dMenu)
9
76
  app.directive('tuiResize', toDirective.$dResize)
10
77
  app.directive('tuiDrag', toDirective.$dDrag)
78
+ app.directive('tuiPopover', toDirective.$dPopover)
79
+ app.directive('tuiCursorTip', toDirective.$dCursorTip)
11
80
  app.directive('tuiVcid', toDirective.$dVcid)
12
- const tService=toRoot.tuiService(advanced,debug)
81
+ const tService=toRoot.tuiService(advanced,debug,initLang)
13
82
  app.config.globalProperties.$tBus = toRoot.tuiBus
14
83
  app.config.globalProperties.$tService = tService
15
84
  app.config.globalProperties.$tState = tService.state
16
- app.config.globalProperties.isActAdvFeatures = advanced||license!=null
17
- app.config.globalProperties.isActEchartsFeatures = echarts
85
+ app.config.globalProperties.$echarts = isActEcharts?echarts:null
86
+ app.config.globalProperties.isActEchartsFeatures = isActEcharts
18
87
  app.config.globalProperties.isActAdminFeatures=false
19
- const advanceComps=[
20
- "Tui3DPanel",
21
- "TuiBar3D",
22
- "TuiBar3DGroup",
23
- "TuiPie",
24
- ]
25
- dynamicEcharts(app,echarts);
88
+ app.config.globalProperties.isActAdvFeatures = advanced||license!=null
89
+
26
90
  toComps.forEach((com) => {
27
91
  if(com.name){
28
92
  const isAdvanced = advanceComps.includes(com.name);
29
- const isEcharts = com.name.includes("Echarts");
93
+ const isEcharts = echartsComps.includes(com.name);
30
94
  const skipAdvanced = isAdvanced && !advanced && !license;
31
- const skipEcharts = isEcharts && !echarts;
95
+ const skipEcharts = isEcharts && !isActEcharts;
32
96
  const shouldSkip = skipAdvanced || skipEcharts;
33
97
  if (!shouldSkip) {
34
98
  app.component(com.name, com);
99
+ //别名注册
100
+ const alName = aliasName[com.name];
101
+ if (alName) { app.component(alName, com); }
35
102
  }
36
103
  }else{
37
104
  console.warn("TechUI Warning: Missing component name",com);
@@ -39,116 +106,127 @@ const initComps=(app,license,features,debug=false)=>{
39
106
  });
40
107
  };
41
108
 
42
- import { initLang } from "@techui/utils";
43
-
44
109
  import init, {
45
- coreInfo,
46
- techuiCoreInit
110
+ coreInfo,
111
+ openDec,
112
+ setLang,
113
+ techuiCoreInit
47
114
  } from './core/core.js';
48
115
 
49
116
  export {
50
- adptCalc, bar3DPathGen, cidGen, cidVaild, coreConsoleError, coreConsoleInfo, coreConsoleWarn, cssVarGen, floatInfo, getEnv, getVer,
51
- md5Enc, openDec, openEnc, pieArcPathGen,
52
-
53
- //button
54
- scifiButtonA1, scifiButtonA2, scifiButtonA3, scifiButtonA4, scifiButtonA5,
55
-
56
- //deco
57
- scifiDecoA1, scifiDecoB1, scifiDecoB2, scifiDecoB3, scifiDecoD1,
58
-
59
- //geometry
60
- scifiGeomeParallelogram, scifiGeomeRectangle, scifiGeomeTrapezoid, scifiGeomeTriangle, scifiGeomHexagon,
61
-
62
- //header
63
- scifiHeaderA1, scifiHeaderA2, scifiHeaderA3, scifiHeaderA4,
64
-
65
- //panel
66
- scifiPanelA1, scifiPanelA2, scifiPanelA3,
67
- scifiPanelB1, scifiPanelB2, scifiPanelB3, scifiPanelB4,
68
- scifiPanelDV1, scifiPanelDV2, scifiPanelDV3, scifiPanelDV4, scifiPanelDV5,
69
- scifiPanelDV6, scifiPanelDV7, scifiPanelDV8, scifiPanelDV9,
70
-
71
- //panel title
72
- scifiPanelTitleA1, scifiPanelTitleA2, scifiPanelTitleA3,
73
-
74
- svgPatBlocks,
75
- svgPatCircuitDiagram,
76
- svgPatCircularOverlayA,
77
- svgPatCircularOverlayB,
78
- svgPatContourLine,
79
- svgPatCrosshairA,
80
- svgPatCrosshairB,
81
- svgPatCubeA,
82
- svgPatCubeB,
83
- svgPatCubeC,
84
- svgPatDiamondFlipped,
85
- svgPatDiamondLattice,
86
- svgPatDiamondPixel,
87
- svgPatDiamondWeaving,
88
- svgPatDots,
89
- svgPatHexagonA,
90
- svgPatHexagonB,
91
- svgPatHexagonC,
92
- svgPatHexagonCurved,
93
- svgPatHexagonD,
94
- svgPatLineGrid,
95
- svgPatLineWeaving,
96
- svgPatMazeA,
97
- svgPatMazeB,
98
- svgPatMazeC,
99
- svgPatMountains,
100
- svgPatRain,
101
- svgPatRectWeavingA,
102
- svgPatRectWeavingB,
103
- svgPatRectWeavingC,
104
- svgPatShellA,
105
- svgPatShellB,
106
- svgPatSlashParallel,
107
- svgPatTest,
108
- svgPatTotem,
109
- svgPatTriangleA,
110
- svgPatTriangleB,
111
- svgPatWaveA,
112
- svgPatWaveB,
113
- svgPatZigzagA,
114
- svgPatZigzagB,
115
-
116
- svgSpinBarsA,
117
- svgSpinBarsB,
118
- svgSpinBarsC,
119
- svgSpinBlocksA,
120
- svgSpinBlocksB,
121
- svgSpinBlocksC,
122
- svgSpinClock,
123
- svgSpinPointA,
124
- svgSpinPointB,
125
- svgSpinPointC,
126
- svgSpinPulseDotA,
127
- svgSpinPulseDotB,
128
- svgSpinPulseDotC,
129
- svgSpinPulseRingA,
130
- svgSpinPulseRingB,
131
- svgSpinPulseRingC,
132
- svgSpinRingA,
133
- svgSpinRingB,
134
- svgSpinRingC,
135
-
136
- t3dCoeffCalc,
137
- t3dUpdateOrient,
138
- t3dUpdateRotate
117
+ adptCalc, bar3DPathGen, cidGen, cidVaild, coreConsoleError, coreConsoleInfo, coreConsoleWarn, cssVarGen, floatInfo, getEnv, getVer,
118
+ md5Enc, openDec, openEnc, pieArcPathGen, setLang,
119
+
120
+ //button
121
+ scifiButtonA1, scifiButtonA2, scifiButtonA3, scifiButtonA4, scifiButtonA5,
122
+
123
+ //deco
124
+ scifiDecoA1, scifiDecoB1, scifiDecoB2, scifiDecoB3, scifiDecoD1,
125
+
126
+ //geometry
127
+ scifiGeomeParallelogram, scifiGeomeRectangle, scifiGeomeTrapezoid, scifiGeomeTriangle, scifiGeomHexagon,
128
+
129
+ //header
130
+ scifiHeaderA1, scifiHeaderA2, scifiHeaderA3, scifiHeaderA4,
131
+
132
+ //panel
133
+ scifiPanelA1, scifiPanelA2, scifiPanelA3,
134
+ scifiPanelB1, scifiPanelB2, scifiPanelB3, scifiPanelB4,
135
+ scifiPanelDV1, scifiPanelDV2, scifiPanelDV3, scifiPanelDV4, scifiPanelDV5,
136
+ scifiPanelDV6, scifiPanelDV7, scifiPanelDV8, scifiPanelDV9,
137
+
138
+ //panel title
139
+ scifiPanelTitleA1, scifiPanelTitleA2, scifiPanelTitleA3,
140
+
141
+ svgPatBlocks,
142
+ svgPatCircuitDiagram,
143
+ svgPatCircularOverlayA,
144
+ svgPatCircularOverlayB,
145
+ svgPatContourLine,
146
+ svgPatCrosshairA,
147
+ svgPatCrosshairB,
148
+ svgPatCubeA,
149
+ svgPatCubeB,
150
+ svgPatCubeC,
151
+ svgPatDiamondFlipped,
152
+ svgPatDiamondLattice,
153
+ svgPatDiamondPixel,
154
+ svgPatDiamondWeaving,
155
+ svgPatDots,
156
+ svgPatHexagonA,
157
+ svgPatHexagonB,
158
+ svgPatHexagonC,
159
+ svgPatHexagonCurved,
160
+ svgPatHexagonD,
161
+ svgPatLineGrid,
162
+ svgPatLineWeaving,
163
+ svgPatMazeA,
164
+ svgPatMazeB,
165
+ svgPatMazeC,
166
+ svgPatMountains,
167
+ svgPatRain,
168
+ svgPatRectWeavingA,
169
+ svgPatRectWeavingB,
170
+ svgPatRectWeavingC,
171
+ svgPatShellA,
172
+ svgPatShellB,
173
+ svgPatSlashParallel,
174
+ svgPatTest,
175
+ svgPatTotem,
176
+ svgPatTriangleA,
177
+ svgPatTriangleB,
178
+ svgPatWaveA,
179
+ svgPatWaveB,
180
+ svgPatZigzagA,
181
+ svgPatZigzagB,
182
+
183
+ svgSpinBarsA,
184
+ svgSpinBarsB,
185
+ svgSpinBarsC,
186
+ svgSpinBlocksA,
187
+ svgSpinBlocksB,
188
+ svgSpinBlocksC,
189
+ svgSpinClock,
190
+ svgSpinPointA,
191
+ svgSpinPointB,
192
+ svgSpinPointC,
193
+ svgSpinPulseDotA,
194
+ svgSpinPulseDotB,
195
+ svgSpinPulseDotC,
196
+ svgSpinPulseRingA,
197
+ svgSpinPulseRingB,
198
+ svgSpinPulseRingC,
199
+ svgSpinRingA,
200
+ svgSpinRingB,
201
+ svgSpinRingC,
202
+
203
+ t3dCoeffCalc,
204
+ t3dUpdateOrient,
205
+ t3dUpdateRotate
139
206
  } from './core/core.js';
140
207
 
208
+ const getBootLang = (initLang = null) => {
209
+ const storedLocale = tCryptoStore.g("local", "globalConfig", openDec)?.lang
210
+ if (["zh-CN", "zh-TW", "en"].includes(storedLocale)) {
211
+ return storedLocale
212
+ }
213
+ if (["zh-CN", "zh-TW", "en"].includes(initLang)) {
214
+ return initLang
215
+ }
216
+ return tLang.getSysLang() || "zh-CN"
217
+ }
141
218
  const coreEnt=async ({
142
219
  app,
143
220
  license=null,
221
+ initLang=null,
144
222
  subLicense=null,
145
223
  features={},
146
224
  debug=false
147
225
  })=>{
148
- initLang();
149
226
  await init();
227
+ setLang(getBootLang(initLang))
150
228
  window.tuiCoreInfo=coreInfo
151
229
  techuiCoreInit(license,subLicense,coreEnt.toString());
152
- app.use(initComps,license,features,debug)
230
+ app.use(initComps,license,features,debug,initLang)
153
231
  };
154
- export default coreEnt
232
+ export default coreEnt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techui/scifi",
3
- "version": "0.0.6-alpha.1",
3
+ "version": "0.1.0-alpha.1",
4
4
  "description": "TechUI Scifi is a sci-fi SVG component library developed based on Vue3. It uses dynamically calculated SVG elements to generate a variety of cool, futuristic, and technological components.",
5
5
  "author": "aYin <ayin86cn@gmail.com> <wechat:jay1986cn>",
6
6
  "homepage": "https://techui.net",
@@ -41,15 +41,15 @@
41
41
  ],
42
42
 
43
43
  "dependencies": {
44
- "@techui/icons": "1.0.3",
44
+ "@techui/icons": "1.0.4",
45
45
  "@techui/colors": "1.0.2",
46
46
  "@techui/lessmixins": "0.0.6",
47
47
  "@techui/libs": "0.0.6",
48
- "@techui/locales": "0.0.6",
49
- "@techui/themes": "0.0.6",
50
- "@techui/utils": "0.0.6",
48
+ "@techui/locales": "0.1.0",
49
+ "@techui/themes": "0.1.0",
50
+ "@techui/utils": "0.1.0",
51
51
  "vue": "^3.4.27",
52
- "vue-router": "^4.3.2"
52
+ "vue-router": "^4.6.4"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"
@@ -1 +0,0 @@
1
- import*as N from"echarts";import{$c as y}from"@techui/colors";const O=o=>{const{chart:e,common:r,font:l,scifi:t}=o,{bg:i,bd:s}=r,{line:{weak:a,base:c,strong:h},bubble:{fc:d,bg:b,hlite:n},map:{fc:S,fc_hov:m,fc_act:w,bg:x,bd:p,bg_hov:C,bd_hov:g,bg_act:W,bd_act:f,glow:L,shadow:u},palette:k,visual:T}=e,{hlite:A,focus:B}=t,{weaker:v,weak:z,base:_,strong:N,stronger:O}=l;let J=y.scale(k,6,"lch"),E=y.scale(T,4,"lch");return JSON.stringify({color:J,textStyle:{},title:{textStyle:{color:_},subtextStyle:{color:z}},line:{label:{color:"inherit",textBorderColor:i,textBorderWidth:5},itemStyle:{borderWidth:"2"},lineStyle:{width:"3"},symbolSize:"7",symbol:"emptyCircle",smooth:!0},radar:{splitLine:{lineStyle:{show:!0,color:c,type:"dashed"}},axisLine:{show:!0,lineStyle:{color:c,type:"dashed"}},axisName:{show:!0,color:_},splitArea:{areaStyle:{color:[a,i]}},symbolSize:"7",symbol:"emptyCircle",markLine:{label:{color:"inherit",textBorderColor:i,textBorderWidth:5}},smooth:!0},bar:{itemStyle:{barBorderWidth:0,barBorderColor:a},markLine:{label:{color:"inherit",textBorderColor:i,textBorderWidth:5}}},pie:{itemStyle:{borderWidth:0,borderColor:i}},scatter:{label:{show:!0,color:d},emphasis:{labele:{fontWeight:"bold"}},itemStyle:{color:{type:"radial",x:.3,y:.3,r:.5,colorStops:[{offset:0,color:n},{offset:1,color:b}],global:!1},borderWidth:0,borderColor:a}},boxplot:{itemStyle:{borderWidth:0,borderColor:a}},parallel:{itemStyle:{borderWidth:0,borderColor:a}},sankey:{itemStyle:{borderWidth:0,borderColor:a}},funnel:{itemStyle:{borderWidth:0,borderColor:a}},gauge:{itemStyle:{borderWidth:0,borderColor:h},axisLine:{show:!0,lineStyle:{color:[[1,a]]}},axisTick:{show:!0,lineStyle:{color:h}},axisLabel:{show:!0,color:_},splitLine:{show:!0,lineStyle:{color:h}},detail:{color:"inherit"}},graph:{itemStyle:{borderWidth:0,borderColor:a},lineStyle:{width:1,color:c},symbolSize:"7",symbol:"circle",smooth:!0,color:J,label:{color:_}},map:{itemStyle:{areaColor:x,borderColor:p,borderWidth:.5},label:{color:_},emphasis:{itemStyle:{areaColor:C,borderColor:p,borderWidth:1},label:{color:_}}},geo:{scaleLimit:{min:.5,max:7},itemStyle:{areaColor:x,borderColor:p,shadowColor:u,shadowOffsetY:0,shadowBlur:5,borderWidth:.5},label:{show:!0,fontSize:12,color:S},emphasis:{itemStyle:{areaColor:C,borderColor:g,borderWidth:1},label:{fontSize:14,color:m}},select:{itemStyle:{areaColor:W,borderColor:f,borderWidth:1},label:{fontSize:14,color:w}}},categoryAxis:{axisLine:{show:!0,lineStyle:{color:c}},splitLine:{show:!1,lineStyle:{color:a}},axisTick:{show:!1,lineStyle:{color:a}},axisLabel:{show:!0,color:_},splitArea:{show:!1}},valueAxis:{axisLine:{show:!0,lineStyle:{color:c}},axisTick:{show:!1,lineStyle:{color:a}},axisLabel:{show:!0,color:_},splitLine:{show:!0,lineStyle:{color:a}},splitArea:{show:!1}},logAxis:{axisLine:{show:!0,lineStyle:{color:c}},axisTick:{show:!1,lineStyle:{color:a}},axisLabel:{show:!0,color:_},splitLine:{show:!1,lineStyle:{color:a}},splitArea:{show:!1}},timeAxis:{axisLine:{show:!0,lineStyle:{color:c}},axisTick:{show:!1,lineStyle:{color:a}},axisLabel:{show:!0,color:_},splitLine:{show:!1,lineStyle:{color:a}},splitArea:{show:!1}},toolbox:{iconStyle:{borderColor:_},emphasis:{iconStyle:{borderColor:N}}},legend:{y:"bottom",x:"center",textStyle:{color:_},itemStyle:{borderColor:"transparent",borderWidth:1,opacity:1}},tooltip:{backgroundColor:i,textStyle:{color:_},axisPointer:{lineStyle:{color:_,width:1},crossStyle:{color:_,width:1}}},timeline:{symbol:"circle",progress:{itemStyle:{color:A,borderColor:"white",borderWidth:0},lineStyle:{color:A,shadowColor:"rgba(0, 0, 0, 0)"}},lineStyle:{color:B,width:1,shadowColor:"rgba(0, 0, 0, 0)"},itemStyle:{color:B,borderColor:"white",borderWidth:0},controlStyle:{color:v,borderColor:"white",borderWidth:0},checkpointStyle:{symbol:"circle",color:A,borderColor:"white",borderWidth:0,shadowColor:"rgba(0, 0, 0, 0)"},label:{color:_},emphasis:{itemStyle:{color:B},controlStyle:{color:_,borderWidth:0},label:{color:N}}},visualMap:{color:E,textStyle:{color:_},zlevel:10}})};let J=null;function $(o){if(o)try{const e=JSON.parse(O(o));N.registerTheme("eTheme",e),J=o}catch(o){console.error("registerEchartsTheme: Failed to register theme",o)}else console.warn("registerEchartsTheme: themePalette is required!")}export{$ as registerEchartsTheme};
@@ -1 +0,0 @@
1
- import{inject as D,ref as U,shallowRef as q,reactive as L,computed as B,watch as v,nextTick as h,onMounted as W,onBeforeUnmount as F,resolveComponent as V,resolveDirective as H,createBlock as Q,openBlock as J,withCtx as K,withDirectives as X,renderSlot as Y,createElementVNode as Z,normalizeStyle as ee,normalizeClass as te,unref as P}from"vue";import{cidGen as ie,cssVarGen as ae}from"@techui/scifi";import{tQuery as z,tClass as R,tStr as re,tType as _}from"@techui/utils";import*as ne from"echarts";import{$c as oe}from"@techui/colors";const se=(e,t,a="358")=>{const i=z.get1stParent(e,".tui-3d-panel");if(!i)return;if(R.has(i,"is-3doff"))return;if(!(e&&e instanceof HTMLElement&&"string"==typeof t&&""!==t.trim()))return;const r=e.querySelector("svg");if(!r)return;const l="pathG"+t,n=r.querySelector(`g#${CSS.escape(l)}`);n&&r.removeChild(n);const s=r.querySelectorAll("path"),o=[];if(s.forEach((e=>{const t=e.getAttribute("stroke-width");null!=t&&""!==t.trim()&&String(t).includes(a)&&o.push(e)})),o.length>0){const e=document.createElementNS("http://www.w3.org/2000/svg","g");e.setAttribute("id",l),o.forEach((t=>{const a=t.getAttribute("fill"),i=t.getAttribute("stroke");t.setAttribute("class","ori-svg-item");const r=t.cloneNode(!0);r.setAttribute("class","t3d-shadow-item"),r.setAttribute("style",`--tui-t3d-thickcolor:${oe.darken("none"!=a?a:i,2.5)}`),e.appendChild(r)})),r.insertBefore(e,r.firstChild)}},le=e=>{const t="pathG"+e,a=z.el(`#${t}`);a&&a.remove()},E="TuiEcharts",fe=Object.assign({name:E},{__name:"tuiEcharts",props:{width:[Number,String],height:[Number,String],chartOption:{type:Object,required:!0},initOptions:{type:Object,default:()=>({})},loading:{type:Boolean,default:null},initT3DShadow:{type:Boolean,default:!1},t3DShadowUpdate:{type:String,default:"finished",validator:e=>["rendered","finished"].includes(e)},renderer:{type:String,default:"canvas",validator:e=>["svg","canvas"].includes(e)},ready:{type:Boolean,default:!1},dataOpacity:Number,dataBlur:Number,resizeObserver:{type:String,default:"global",validator:e=>["self","global","none"].includes(e)}},emits:["chartClick","chartDblClick","chartMouseDown","chartMouseUp","chartMouseOver","chartGlobalOut","chartInit","chartReady","chartRendered","chartFinished","update:loading"],setup(e,{expose:t,emit:a}){const{$gT3D:i,$gTheme:r,$optResizeCounter:l,initResizeBy:n}=D("$global",null),s=n(),o=ie(E),u="echart_"+re.rdm(),c=e,d=a,p=U(null),f=q(null),g=L({loading:!0,inited:!1,resizing:!0}),m=B({get:()=>c.loading??g.loading,set:e=>{null!==c.loading?d("update:loading",e):g.loading=e}}),b=async()=>{if(p.value)try{if(S(),f.value)return;await h(),f.value=ne.init(p.value,"eTheme",{...c.initOptions,renderer:c.initT3DShadow?"svg":c.renderer}),d("chartInit",f.value),f.value.setOption(c.chartOption),y(),await h(),f.value&&(d("chartReady",f.value),m.value=!1)}catch(e){console.error("ECharts initialization failed:",e)}},y=()=>{if(!f.value)return;const e=(e,t)=>{f.value&&f.value.on(e,t)};e("click",(e=>d("chartClick",e))),e("dblclick",(e=>d("chartDblClick",e))),e("mousedown",(e=>d("chartMouseDown",e))),e("mouseup",(e=>d("chartMouseUp",e))),e("mouseover",(e=>d("chartMouseOver",e))),e("globalout",(e=>d("chartGlobalOut",e))),e("rendered",(()=>{f.value&&"rendered"==c.t3DShadowUpdate&&w(),d("chartRendered")})),e("finished",(function(){f.value&&("finished"==c.t3DShadowUpdate&&w(),d("chartFinished"),m.value=!1,g.inited=!1)}))},w=()=>{if(!p.value)return;let e=!0;const t=z.get1stParent(p.value,".tui-3d-panel");(!t||t&&R.has(t,"is-3doff"))&&(e=!1),c.initT3DShadow&&e?se(p.value,u):le(u)},O=D("TuiT3DPanel",null);v((()=>[i.value,c.initT3DShadow,O?.view3d?.value]),(([e,t,a])=>{w()})),v((()=>r.value),(async e=>{f.value&&(await h(),f.value.setTheme("eTheme"))}));const S=()=>{f.value&&(f.value.dispose(),f.value=null)},T=()=>{f.value&&f.value.resize()};v((()=>c.ready),(e=>{e&&b()})),v((()=>c.chartOption),(()=>{f.value&&h((()=>{f.value&&(f.value.setOption(c.chartOption),m.value=!1)}))}),{deep:!0});const C=B((()=>ae("cpt-echart",{...c.width&&{width:_.join("number",c.width,"px")},...c.height&&{height:_.join("number",c.height,"px")},...c.dataOpacity&&{opa:c.dataOpacity},...c.dataBlur&&{blur:c.dataBlur+"px"}})));v((()=>l.value),((e,t)=>{"root"==s.value(c.resizeObserver)&&e>t&&k()}));const k=async()=>{g.resizing=!0,T(),await h(),setTimeout((()=>{g?.resizing&&(g.resizing=!1)}),500)};return W((()=>{c.ready&&h((()=>{b()}))})),F((()=>{S()})),t({resize:T,getChart:()=>f.value,setOption:(e,t)=>{f.value&&f.value.setOption(e,t)},clear:()=>{f.value&&f.value.clear()},initChart:b,dispose:S}),(t,a)=>{const i=V("TuiLoaderPanel"),r=H("tui-resize");return J(),Q(i,{loading:m.value,inited:g.inited},{default:K((()=>[X(Z("div",{ref_key:"chartRef",ref:p,class:te(["tui-echarts",{"is-resizing":g.resizing}]),style:ee(C.value)},null,6),[[r,{callback:k,uid:u,cid:P(o),disabled:"self"!=P(s)(e.resizeObserver)}]]),Y(t.$slots,"default")])),_:3},8,["loading","inited"])}}});export{fe as default};
@@ -1 +0,0 @@
1
- import{nextTick as m,markRaw as K,inject as Q,ref as W,shallowRef as Z,reactive as I,computed as C,watch as y,onMounted as ee,onBeforeUnmount as te,resolveComponent as ae,resolveDirective as re,createBlock as ie,openBlock as k,withCtx as oe,withDirectives as ne,createElementBlock as B,createCommentVNode as le,renderSlot as ce,createElementVNode as M,normalizeStyle as x,normalizeClass as ue,unref as N,Fragment as se,renderList as de,toDisplayString as pe}from"vue";import{cidGen as fe,cssVarGen as ve}from"@techui/scifi";import{tEvent as ge,tStr as me,tType as S}from"@techui/utils";import*as E from"echarts";const be=(e,a,t,i,r)=>{if(!e.value)return;const o=(a,t)=>{e.value&&e.value.on(a,t)};o("click",ge.debounce((t=>{let r,o=t;if(t.value&&!a.chartOption.geo3D)r=e.value.convertToPixel("geo",[t.value[0],t.value[1]]),o.domPosition=r;else if("geo"==t.componentType&&t.event?.offsetX){const{offsetX:a,offsetY:i}=t.event;r=e.value.convertFromPixel("geo",[a,i]),o.coordPosition=r}i("chartClick",o,t)}),500,!0)),o("dblclick",(e=>i("chartDblClick",e))),o("mousedown",(e=>i("chartMouseDown",e))),o("mouseup",(e=>i("chartMouseUp",e))),o("mouseover",(e=>i("chartMouseOver",e))),o("globalout",(e=>i("chartGlobalOut",e))),o("geoRoam",(e=>i("chartGeoRoam",e))),o("timelinechanged",(t=>{const{allAreaCodes:r,chartOption:{timeline:o}}=a;let l=t;if("geoTitle"==o.titleType){let a=o.data[t.currentIndex],i=r.find((e=>e.name.includes(a))),n=e.value.convertToPixel("geo",[i.lng,i.lat]);l.domPosition=n,l.current=i}i("chartTimelinechanged",l)})),o("rendered",(()=>{i("chartRendered")})),o("finished",(()=>{e.value&&(i("chartFinished"),t.inited=!0)}))},he=e=>{e.value&&e.value.resize()},ye=e=>e.value,Oe=(e,a,t)=>{e.value&&e.value.setOption(a,t)},Ce=e=>{e.value&&e.value.clear()},ke=e=>{if(e.value)try{const a=e.value.getOption();a.geo&&a.geo[0]&&(a.geo[0].roam=!0,a.geo[0].zoom=1,a.geo[0].center=null,e.value.setOption(a,!1))}catch(e){console.error("Failed to reset map view:",e)}},G=(e,a)=>{try{return a?(E.registerMap(e,a),!0):(console.warn("GeoJSON data is missing"),!1)}catch(e){return console.error("Failed to register map:",e),!1}},ze=async(e,a,t,i,r,o)=>{if(e.value)try{if(F(a),a.value)return;if(!G(t.mapName,t.geoJsonData))return void console.error("Map registration failed, aborting chart initialization");await m(),a.value=K(E.init(e.value,"eTheme",{...t.initOptions,notMerge:!1,renderer:t.renderer})),r("chartInit",a.value),a.value.setOption(t.chartOption),o(),await m(),a.value&&(r("chartReady",a.value),i.value=!1)}catch(e){console.error("ECharts Map initialization failed:",e)}},we=(e,a,t,i,r=!1)=>{e.value&&(e.value.setOption(a,r),t.value=!1,i("chartUpdate"))},F=e=>{e.value&&(e.value.dispose(),e.value=null)},Te=["onClick"],Be={class:"breadcrumb-text"},P="TuiEchartsMap",_e=Object.assign({name:P},{__name:"tuiEchartsMap",props:{width:[Number,String],height:[Number,String],chartOption:{type:Object,required:!0},geoJsonData:{type:Object,required:!0},allAreaCodes:Object,mapName:{type:String,required:!0},initOptions:{type:Object,default:()=>({})},loading:{type:Boolean,default:null},renderer:{type:String,default:"canvas",validator:e=>["svg","canvas"].includes(e)},ready:{type:Boolean,default:!1},dataOpacity:Number,dataBlur:Number,resizeObserver:{type:String,default:"global",validator:e=>["self","global","none"].includes(e)},updateReplace:{type:Boolean,default:!0},enableBreadcrumb:{type:Boolean,default:!1},breadcrumbConfig:{type:Object,default:()=>({data:[{code:1e5,name:"全国"}],position:{top:"5%",left:"5%"}})}},emits:["chartClick","chartDblClick","chartMouseDown","chartMouseUp","chartMouseOver","chartGlobalOut","chartInit","chartReady","chartRendered","chartFinished","chartGeoRoam","chartUpdate","chartTimelinechanged","breadcrumbClick","update:loading"],setup(e,{expose:a,emit:t}){const{$gT3D:i,$gTheme:r,$optResizeCounter:o,initResizeBy:l}=Q("$global",null),n=l(),s=fe(P),c="echart_map_"+me.rdm(),u=W(null),d=Z(null),p=e,v=t,h=I({loading:!0,inited:!1,resizing:!0}),g=C({get:()=>p.loading??h.loading,set:e=>{null!==p.loading?v("update:loading",e):h.loading=e}}),b=C((()=>p.breadcrumbConfig?.data||[])),f=C((()=>{let e=p.breadcrumbConfig?.position||{},a={};for(let t in e)"number"==typeof e[t]?a[t]=e[t]+"px":a[t]=e[t];return a})),O=async()=>{await ze(u,d,p,g,v,z,p.updateReplace)},w=()=>{we(d,p.chartOption,g,v,p.updateReplace)},z=()=>{be(d,p,h,v)},T=()=>{F(d)},R=()=>{he(d)},D=C((()=>ve("cpt-echart-map",{...p.width&&{width:S.join("number",p.width,"px")},...p.height&&{height:S.join("number",p.height,"px")},...p.dataOpacity&&{opa:p.dataOpacity},...p.dataBlur&&{blur:p.dataBlur+"px"}})));y((()=>p.geoJsonData),(()=>{d.value&&(G(p.mapName,p.geoJsonData),m((()=>{w()})))}),{deep:!0}),y((()=>p.ready),(e=>{e&&O()})),y((()=>p.chartOption),(()=>{d.value&&m((()=>{w()}))}),{deep:!0}),y((()=>r.value),(e=>{d.value&&m((()=>{d.value.setTheme("eTheme")}))})),y((()=>o.value),((e,a)=>{"root"==n.value(p.resizeObserver)&&e>a&&j()}));const j=async()=>{h.resizing=!0,R(),await m(),setTimeout((()=>{h?.resizing&&(h.resizing=!1)}),500)};return ee((()=>{p.ready&&m((()=>{O()}))})),te((()=>{T()})),a({resize:R,getChart:()=>ye(d),setOption:(e,a)=>{Oe(d,e,a)},initChart:O,clear:()=>{Ce(d)},resetMapView:()=>{ke(d)},dispose:T}),(a,t)=>{const i=ae("TuiLoaderPanel"),r=re("tui-resize");return k(),ie(i,{loading:g.value,inited:h.inited},{default:oe((()=>[ne(M("div",{ref_key:"mapRef",ref:u,class:ue(["tui-echarts-map",{"is-resizing":h.resizing}]),style:x(D.value)},null,6),[[r,{callback:j,uid:c,cid:N(s),disabled:"self"!=N(n)(e.resizeObserver)}]]),e.enableBreadcrumb&&b.value.length>0?(k(),B("div",{key:0,class:"tui-map-breadcrumb",style:x(f.value)},[(k(!0),B(se,null,de(b.value,((e,a)=>(k(),B("div",{key:`${e.code}-${a}`,class:"breadcrumb-item",onClick:t=>((e,a)=>{const t=b.value.slice(0,a+1);v("breadcrumbClick",{item:e,index:a,breadcrumb:t,chart:d.value})})(e,a)},[M("span",Be,pe(e.name),1)],8,Te)))),128)),t[0]||(t[0]=M("i",{class:"tui-icon ti-map breadcrumb-icon"},null,-1))],4)):le("",!0),ce(a.$slots,"default")])),_:3},8,["loading","inited"])}}});export{_e as default};