vue-data-ui 2.6.52-beta.9 → 2.7.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/dist/{Arrow-DMgiQZ_4.js → Arrow-Tcvy-1tf.js} +1 -1
- package/dist/{Arrow-Bvc0lWZf.cjs → Arrow-q4elsfyi.cjs} +1 -1
- package/dist/{BaseIcon-4qX1_lK_.js → BaseIcon-BSkS89RT.js} +1 -1
- package/dist/{BaseIcon-D5l-ujm_.cjs → BaseIcon-wuetMnRj.cjs} +1 -1
- package/dist/{ColorPicker-DSeral-H.js → ColorPicker-B-UF8Xdm.js} +3 -3
- package/dist/{ColorPicker-CfOcggUt.cjs → ColorPicker-BsF6StNh.cjs} +1 -1
- package/dist/{DataTable-RPRtm5dz.cjs → DataTable-CxPPog04.cjs} +1 -1
- package/dist/{DataTable-D192lIs1.js → DataTable-DRB6Rt3T.js} +2 -2
- package/dist/{Legend-C931uD4w.cjs → Legend-BiZSIl_8.cjs} +1 -1
- package/dist/{Legend-t6D-CcgS.js → Legend-DACz926s.js} +2 -2
- package/dist/PackageVersion-K_dIfu_1.cjs +1 -0
- package/dist/{PackageVersion-DP9T4NNf.js → PackageVersion-iM0N7imM.js} +1 -1
- package/dist/{PenAndPaper-Db_wnpFu.js → PenAndPaper-Cnh7VAnd.js} +3 -3
- package/dist/{PenAndPaper-DxFQUt06.cjs → PenAndPaper-D4YVLZC3.cjs} +1 -1
- package/dist/{Shape-B6CG6Tjf.js → Shape-BlqLhJkb.js} +1 -1
- package/dist/{Shape-BT10qNqK.cjs → Shape-fiDmogTF.cjs} +1 -1
- package/dist/{Slicer-zUNWJ7Rt.js → Slicer-B6gtffPg.js} +2 -2
- package/dist/{Slicer-C32r4aWq.cjs → Slicer-BxsQavxP.cjs} +1 -1
- package/dist/{Title-BNDJzlYk.js → Title-BnbtlZuQ.js} +1 -1
- package/dist/{Title-K-KcP2WR.cjs → Title-ftVcKm8j.cjs} +1 -1
- package/dist/{Tooltip-DQeCgEls.js → Tooltip-BaCjRGR8.js} +1 -1
- package/dist/{Tooltip-DmYALolD.cjs → Tooltip-Dvq8qMfG.cjs} +1 -1
- package/dist/dom-to-png-DBqUgTmu.cjs +3 -0
- package/dist/dom-to-png-DkmDo75x.js +243 -0
- package/dist/{img-CKhJxCzz.cjs → img-DQpd_5yO.cjs} +1 -1
- package/dist/{img-CAUOYafO.js → img-U95ptFho.js} +1 -1
- package/dist/{index-BBwKaiVY.js → index-D-HIb4Mn.js} +1 -1
- package/dist/{index-DdmI4IyM.cjs → index-D5k9fip1.cjs} +1 -1
- package/dist/{pdf-DGsZCtrD.js → pdf-D2ouSvO-.js} +1 -1
- package/dist/{pdf-Bv-7Cz5O.cjs → pdf-XZ9tIX1c.cjs} +1 -1
- package/dist/{useNestedProp-Dctcwxef.cjs → useNestedProp-CpW5Z_Ke.cjs} +1 -1
- package/dist/{useNestedProp-CRcJE21n.js → useNestedProp-qC6DmhPQ.js} +1 -1
- package/dist/{usePrinter-ClXx8Fo-.cjs → usePrinter-DCjcVk63.cjs} +1 -1
- package/dist/{usePrinter-Csngp5T1.js → usePrinter-Dur-51db.js} +3 -3
- package/dist/{vue-data-ui-DRkvQU1Z.js → vue-data-ui-fow8gtsn.js} +60 -60
- package/dist/{vue-data-ui-B-HYjyTv.cjs → vue-data-ui-ozZctcYD.cjs} +1 -1
- package/dist/vue-data-ui.cjs +1 -1
- package/dist/vue-data-ui.js +1 -1
- package/dist/{vue-ui-3d-bar-Or_Pxl4f.js → vue-ui-3d-bar-C_JTgO_-.js} +9 -9
- package/dist/{vue-ui-3d-bar-DKTpxLQf.cjs → vue-ui-3d-bar-DTlVayO8.cjs} +1 -1
- package/dist/{vue-ui-accordion-fsdtcWoA.cjs → vue-ui-accordion-BiVdHPDv.cjs} +1 -1
- package/dist/{vue-ui-accordion-zwn0yEvW.js → vue-ui-accordion-qmHz6V_f.js} +3 -3
- package/dist/{vue-ui-age-pyramid-CR4X9AYe.js → vue-ui-age-pyramid-BtqOmeDs.js} +10 -10
- package/dist/{vue-ui-age-pyramid-CmeUQWOn.cjs → vue-ui-age-pyramid-DbCnCy8z.cjs} +1 -1
- package/dist/{vue-ui-annotator-DP0d9bO-.js → vue-ui-annotator-CsZ_WLwo.js} +2 -2
- package/dist/{vue-ui-annotator-iAmIySMn.cjs → vue-ui-annotator-DX-Zq2VD.cjs} +1 -1
- package/dist/{vue-ui-bullet-NSxVF_H8.cjs → vue-ui-bullet-BqOvmlj_.cjs} +1 -1
- package/dist/{vue-ui-bullet-BwRsLv44.js → vue-ui-bullet-DtYQOm8x.js} +8 -8
- package/dist/{vue-ui-candlestick-DxvXpsyX.js → vue-ui-candlestick-Bpd4Brzf.js} +11 -11
- package/dist/{vue-ui-candlestick-CGDmTY9u.cjs → vue-ui-candlestick-CY0LcjNv.cjs} +1 -1
- package/dist/{vue-ui-carousel-table-DD5-DjT1.js → vue-ui-carousel-table-C8_Ps2Zt.js} +4 -4
- package/dist/{vue-ui-carousel-table--LhcSQMy.cjs → vue-ui-carousel-table-CddMetKf.cjs} +1 -1
- package/dist/{vue-ui-chestnut-CQJTn7fn.js → vue-ui-chestnut-BpSKsoin.js} +8 -8
- package/dist/{vue-ui-chestnut-4VdU7keY.cjs → vue-ui-chestnut-BwXukm4F.cjs} +1 -1
- package/dist/{vue-ui-circle-pack-DtgTkVIO.cjs → vue-ui-circle-pack-BUlUJ_wP.cjs} +1 -1
- package/dist/{vue-ui-circle-pack-CiQ8_5Cm.js → vue-ui-circle-pack-CfED_zMB.js} +9 -9
- package/dist/{vue-ui-cursor-DZSRtqAI.js → vue-ui-cursor-B5oQgTgE.js} +2 -2
- package/dist/{vue-ui-cursor-sRVxw9VU.cjs → vue-ui-cursor-wiDFjlo1.cjs} +1 -1
- package/dist/{vue-ui-dashboard-CgDCZgWu.js → vue-ui-dashboard-By0Ava-e.js} +3 -3
- package/dist/{vue-ui-dashboard-BC5PNjG6.cjs → vue-ui-dashboard-tFgwPorT.cjs} +1 -1
- package/dist/{vue-ui-digits-CIPlnX4m.cjs → vue-ui-digits-C8E4WW3j.cjs} +1 -1
- package/dist/{vue-ui-digits-BnSm6HOD.js → vue-ui-digits-DVhsYo-l.js} +2 -2
- package/dist/{vue-ui-donut-CGN_56A-.js → vue-ui-donut-D03p4xQ2.js} +12 -12
- package/dist/{vue-ui-donut-Dt682HYD.cjs → vue-ui-donut-DuJGngc8.cjs} +1 -1
- package/dist/{vue-ui-donut-evolution-BUu7nOHx.js → vue-ui-donut-evolution-Ck8bjo-j.js} +11 -11
- package/dist/{vue-ui-donut-evolution-YnZ1tQZD.cjs → vue-ui-donut-evolution-jBUX8vo1.cjs} +1 -1
- package/dist/{vue-ui-dumbbell-Cah5eNlf.js → vue-ui-dumbbell-B1jv_9OG.js} +10 -10
- package/dist/{vue-ui-dumbbell-BWZRBoK5.cjs → vue-ui-dumbbell-DDDCgty2.cjs} +1 -1
- package/dist/{vue-ui-flow-NSqG-VJj.cjs → vue-ui-flow-CjlFZAXS.cjs} +1 -1
- package/dist/{vue-ui-flow-Cr1-IEyc.js → vue-ui-flow-DW_Yxbmf.js} +9 -9
- package/dist/{vue-ui-funnel-FSBnYvMH.cjs → vue-ui-funnel-CdXskLpT.cjs} +1 -1
- package/dist/{vue-ui-funnel-CdUSmZCU.js → vue-ui-funnel-rUNRbe1S.js} +9 -9
- package/dist/{vue-ui-galaxy-f0Mb4bW5.js → vue-ui-galaxy-D-d6BrEQ.js} +11 -11
- package/dist/{vue-ui-galaxy-CfHSHPsj.cjs → vue-ui-galaxy-DZRdJjEL.cjs} +1 -1
- package/dist/{vue-ui-gauge-BNBcgNxb.js → vue-ui-gauge-CJqfHd1V.js} +7 -7
- package/dist/{vue-ui-gauge-DiBPBBm0.cjs → vue-ui-gauge-utVziwmC.cjs} +1 -1
- package/dist/{vue-ui-gizmo-D5QF_8_x.js → vue-ui-gizmo-BJeFSq_h.js} +3 -3
- package/dist/{vue-ui-gizmo-D4ntZeoD.cjs → vue-ui-gizmo-BSYmNV2r.cjs} +1 -1
- package/dist/{vue-ui-heatmap-D4OrEjjo.cjs → vue-ui-heatmap-AOtOaNf0.cjs} +1 -1
- package/dist/{vue-ui-heatmap-MxSJwSDk.js → vue-ui-heatmap-BYWReIi3.js} +10 -10
- package/dist/{vue-ui-history-plot-DKHvI-HZ.cjs → vue-ui-history-plot-BORIs9Ia.cjs} +1 -1
- package/dist/{vue-ui-history-plot-PmmDMNhU.js → vue-ui-history-plot-OJbA6a9W.js} +11 -11
- package/dist/{vue-ui-kpi-DT94o6m6.js → vue-ui-kpi-ZRPbK9Xb.js} +3 -3
- package/dist/{vue-ui-kpi-DGvhcEZy.cjs → vue-ui-kpi-mzJ2Wwsd.cjs} +1 -1
- package/dist/{vue-ui-mini-loader-BmeR7-9f.cjs → vue-ui-mini-loader-BDpn3tU3.cjs} +1 -1
- package/dist/{vue-ui-mini-loader-DLN6kXO9.js → vue-ui-mini-loader-BpF3Gk95.js} +2 -2
- package/dist/{vue-ui-molecule-DypBWu0b.js → vue-ui-molecule-BNKBlCuv.js} +11 -11
- package/dist/{vue-ui-molecule-D51X1kpt.cjs → vue-ui-molecule-n2XcQwWm.cjs} +1 -1
- package/dist/{vue-ui-mood-radar-wCI5H7Ka.cjs → vue-ui-mood-radar-D7i4XkJ7.cjs} +1 -1
- package/dist/{vue-ui-mood-radar-D6VaT0FM.js → vue-ui-mood-radar-DkDCTTGe.js} +11 -11
- package/dist/{vue-ui-nested-donuts-3ICSijpW.js → vue-ui-nested-donuts-B10sUIYh.js} +11 -11
- package/dist/{vue-ui-nested-donuts-Bped69kR.cjs → vue-ui-nested-donuts-COztgojn.cjs} +1 -1
- package/dist/{vue-ui-onion-75D677VV.cjs → vue-ui-onion-DS8IMdbv.cjs} +1 -1
- package/dist/{vue-ui-onion-gJqbUjYS.js → vue-ui-onion-Dm0gIaEo.js} +11 -11
- package/dist/{vue-ui-parallel-coordinate-plot-CAxkNqsH.js → vue-ui-parallel-coordinate-plot-BARHF8if.js} +12 -12
- package/dist/{vue-ui-parallel-coordinate-plot-pRNEcwtp.cjs → vue-ui-parallel-coordinate-plot-DxyZ61ji.cjs} +1 -1
- package/dist/{vue-ui-quadrant-HPB66J-s.cjs → vue-ui-quadrant-CwRmXD1e.cjs} +1 -1
- package/dist/{vue-ui-quadrant-BSxpUAnN.js → vue-ui-quadrant-DEy0EDw0.js} +12 -12
- package/dist/{vue-ui-quick-chart-2GMvbDAA.js → vue-ui-quick-chart-CIukip1j.js} +9 -9
- package/dist/{vue-ui-quick-chart-DM5Qyur7.cjs → vue-ui-quick-chart-cQQXRntN.cjs} +1 -1
- package/dist/{vue-ui-radar-CrrE7tgM.cjs → vue-ui-radar-BBW5S8Yt.cjs} +1 -1
- package/dist/{vue-ui-radar-DRbxZIfI.js → vue-ui-radar-bY3aBAJt.js} +12 -12
- package/dist/{vue-ui-rating-B74MvkB-.cjs → vue-ui-rating-BrcdA_Ez.cjs} +1 -1
- package/dist/{vue-ui-rating-BVzeHFsE.js → vue-ui-rating-oiBRruzk.js} +2 -2
- package/dist/{vue-ui-relation-circle-bonK2Qo7.cjs → vue-ui-relation-circle-BIwMG6fK.cjs} +1 -1
- package/dist/{vue-ui-relation-circle-Vb6vY4qc.js → vue-ui-relation-circle-Cz4V-P4-.js} +7 -7
- package/dist/{vue-ui-rings-5S7O4poi.js → vue-ui-rings-B9v-QBUD.js} +12 -12
- package/dist/{vue-ui-rings-D8vjaeiH.cjs → vue-ui-rings-D2Xkr-UM.cjs} +1 -1
- package/dist/{vue-ui-scatter-BzyLf6Hr.js → vue-ui-scatter-B8njCxdy.js} +12 -12
- package/dist/{vue-ui-scatter-B3rdJPB7.cjs → vue-ui-scatter-Dax4tsln.cjs} +1 -1
- package/dist/{vue-ui-skeleton-DSAQr6x5.cjs → vue-ui-skeleton-Cxg_LxBB.cjs} +1 -1
- package/dist/{vue-ui-skeleton-CoW0Qci5.js → vue-ui-skeleton-WO50lQWb.js} +3 -3
- package/dist/{vue-ui-smiley-DnO-ASKu.cjs → vue-ui-smiley-CZc9x6AH.cjs} +1 -1
- package/dist/{vue-ui-smiley-CNRok3pP.js → vue-ui-smiley-CydE1BoA.js} +2 -2
- package/dist/{vue-ui-spark-trend-Ct1UY_MC.cjs → vue-ui-spark-trend-CW8LzMy4.cjs} +1 -1
- package/dist/{vue-ui-spark-trend-PplShNvM.js → vue-ui-spark-trend-sNLwMXHr.js} +5 -5
- package/dist/{vue-ui-sparkbar-I8_tYiKU.js → vue-ui-sparkbar-BIw5YHYN.js} +4 -4
- package/dist/{vue-ui-sparkbar-CYYHcuyY.cjs → vue-ui-sparkbar-CdEIQGlO.cjs} +1 -1
- package/dist/{vue-ui-sparkgauge-DB40CpGm.cjs → vue-ui-sparkgauge-BGv31zUU.cjs} +1 -1
- package/dist/{vue-ui-sparkgauge-CvxLXm7g.js → vue-ui-sparkgauge-BY1Db4u6.js} +4 -4
- package/dist/{vue-ui-sparkhistogram-CZRAkAG-.js → vue-ui-sparkhistogram-B2qXSmE6.js} +5 -5
- package/dist/{vue-ui-sparkhistogram-COtHy-A9.cjs → vue-ui-sparkhistogram-C5aVsaeV.cjs} +1 -1
- package/dist/{vue-ui-sparkline-DESd7Yax.js → vue-ui-sparkline-B-ROydCI.js} +4 -4
- package/dist/{vue-ui-sparkline-Be0XWPEe.cjs → vue-ui-sparkline-nv_hBl_Q.cjs} +1 -1
- package/dist/{vue-ui-sparkstackbar-CzEuwnJV.js → vue-ui-sparkstackbar-B_fyArxJ.js} +5 -5
- package/dist/{vue-ui-sparkstackbar-DxdMxOFQ.cjs → vue-ui-sparkstackbar-Dc7akbeI.cjs} +1 -1
- package/dist/{vue-ui-stackbar-DNuc2OCh.js → vue-ui-stackbar-CR-D8XTf.js} +13 -13
- package/dist/{vue-ui-stackbar-C9XLE8w2.cjs → vue-ui-stackbar-DPheM1P1.cjs} +1 -1
- package/dist/{vue-ui-strip-plot-DuM855Hq.js → vue-ui-strip-plot-BP_ZBS7j.js} +11 -11
- package/dist/{vue-ui-strip-plot-EVjIBlOg.cjs → vue-ui-strip-plot-Bqcuuu2h.cjs} +1 -1
- package/dist/{vue-ui-table-CobFbKRN.js → vue-ui-table-C_ARRjn7.js} +1 -1
- package/dist/{vue-ui-table-Dh_NnOFW.cjs → vue-ui-table-D6zyqYhW.cjs} +1 -1
- package/dist/{vue-ui-table-heatmap-DrgPZTXL.js → vue-ui-table-heatmap-5kssrpIQ.js} +4 -4
- package/dist/{vue-ui-table-heatmap-CLzAaAW1.cjs → vue-ui-table-heatmap-B1wpFAy-.cjs} +1 -1
- package/dist/{vue-ui-table-sparkline-D8_WyZeB.js → vue-ui-table-sparkline-DQb6dKDF.js} +5 -5
- package/dist/{vue-ui-table-sparkline-BQDc_il5.cjs → vue-ui-table-sparkline-DqiWxSfS.cjs} +1 -1
- package/dist/{vue-ui-thermometer-CW1KJ1Ix.cjs → vue-ui-thermometer-CmktvEk5.cjs} +1 -1
- package/dist/{vue-ui-thermometer-CUrWmL9J.js → vue-ui-thermometer-CzAL7se5.js} +7 -7
- package/dist/{vue-ui-timer-C5HcU0qt.js → vue-ui-timer-CN4LNkYi.js} +5 -5
- package/dist/{vue-ui-timer-CjXvzokw.cjs → vue-ui-timer-CoxSVJEi.cjs} +1 -1
- package/dist/{vue-ui-tiremarks-PsEoJbuf.js → vue-ui-tiremarks-CcHbgSJS.js} +7 -7
- package/dist/{vue-ui-tiremarks-YtX_KuXp.cjs → vue-ui-tiremarks-G4phSmYS.cjs} +1 -1
- package/dist/{vue-ui-treemap-DZ2QMQ2S.js → vue-ui-treemap-Cd0QURmy.js} +12 -12
- package/dist/{vue-ui-treemap-CGgRCl4E.cjs → vue-ui-treemap-X6ai1vvz.cjs} +1 -1
- package/dist/{vue-ui-vertical-bar-Bg68IfRu.js → vue-ui-vertical-bar-Bwb6qh-e.js} +12 -12
- package/dist/{vue-ui-vertical-bar-Bz-pbusQ.cjs → vue-ui-vertical-bar-DkkUwBFF.cjs} +1 -1
- package/dist/{vue-ui-waffle-Ci_DVsdn.js → vue-ui-waffle-BLFwSujO.js} +12 -12
- package/dist/{vue-ui-waffle-FNP844zt.cjs → vue-ui-waffle-CuqNVHpO.cjs} +1 -1
- package/dist/{vue-ui-wheel-DCdliwye.cjs → vue-ui-wheel-BF8y9DBh.cjs} +1 -1
- package/dist/{vue-ui-wheel-avTcqygq.js → vue-ui-wheel-BMKwq-xH.js} +7 -7
- package/dist/{vue-ui-word-cloud-BwNVlteE.js → vue-ui-word-cloud-2YUfi3uy.js} +10 -10
- package/dist/{vue-ui-word-cloud-DrApMsSm.cjs → vue-ui-word-cloud-B4OWtLLG.cjs} +1 -1
- package/dist/{vue-ui-xy-Ds8oB37Y.js → vue-ui-xy-B_rfc8IL.js} +16 -16
- package/dist/{vue-ui-xy-BdfDxlX6.cjs → vue-ui-xy-CC8PUupn.cjs} +2 -2
- package/dist/{vue-ui-xy-canvas-B7cjV0K6.cjs → vue-ui-xy-canvas-CQhMzfiO.cjs} +1 -1
- package/dist/{vue-ui-xy-canvas-B1LLzFGi.js → vue-ui-xy-canvas-ta12fbOW.js} +12 -12
- package/package.json +1 -2
- package/dist/PackageVersion-Dx3HlVxy.cjs +0 -1
- package/dist/dom-to-png-CNdnROpG.js +0 -223
- package/dist/dom-to-png-CP7WJd1S.cjs +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),u=require("./index-DdmI4IyM.cjs"),p=require("./useResponsive-DQmBAoBf.cjs"),vt=require("./Tooltip-DmYALolD.cjs"),dt=require("./Legend-C931uD4w.cjs"),ht=require("./Title-K-KcP2WR.cjs"),ft=require("./Slicer-C32r4aWq.cjs"),Ye=require("./usePrinter-ClXx8Fo-.cjs"),yt=require("./vue-ui-accordion-fsdtcWoA.cjs"),pt=require("./DataTable-RPRtm5dz.cjs"),gt=require("./vue-ui-skeleton-DSAQr6x5.cjs"),He=require("./useNestedProp-Dctcwxef.cjs"),mt=require("./useUserOptionState-BgepsfED.cjs"),bt=require("./useChartAccessibility-Cm7nkzTG.cjs"),me=require("./BaseIcon-D5l-ujm_.cjs"),xt=require("./ColorPicker-CfOcggUt.cjs"),Xe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),kt={class:l.normalizeClass({"vue-ui-pen-and-paper-action":!0}),style:{padding:"0 !important"}},Lt=["disabled"],Ct=["xmlns","viewBox"],wt=["cx","cy","r","fill"],St=["d","stroke","stroke-width"],$t=["d","stroke","stroke-width"],zt={__name:"NonSvgPenAndPaper",props:{parent:{type:HTMLElement},backgroundColor:{type:String,default:"#FFFFFF"},color:{type:String,default:"#2D353C"},active:{type:Boolean,default:!1}},emits:["close"],setup($,{emit:be}){const X=$,xe=be,x=l.ref([]),D=l.ref([]),Z=l.ref("0 0 0 0"),V=l.ref(X.color),c=l.ref(1),k=l.computed(()=>u.lightenHexColor(X.color,.6));function F({width:h,height:v}){Z.value=`0 0 ${h} ${v}`}const U=l.ref(null);l.onMounted(()=>{l.nextTick(()=>{if(X.parent){U.value=new ResizeObserver(s=>{for(const d of s){const{width:g,height:C}=d.contentRect;F({width:g,height:C})}}),U.value.observe(X.parent);const{width:h,height:v}=X.parent.getBoundingClientRect();F({width:h,height:v})}})}),l.onBeforeUnmount(()=>{U.value&&U.value.disconnect()}),l.watch(()=>X.parent,h=>{if(!h)return;const{width:v,height:s}=X.parent.getBoundingClientRect();F({width:v,height:s})},{immediate:!0});const f=l.ref(!1),A=l.ref(""),_=l.ref(null);function I(h){if(!_.value)return;f.value=!0;const{x:v,y:s}=re(h);A.value=`M ${v} ${s}`}function q(h){if(!f.value||!_.value)return;const{x:v,y:s}=re(h);A.value+=` ${v} ${s}`}function Y(h){const v=h.trim().split(/\s+/);if(v.length<4)return h;const s=v.slice(1).map(Number);if(s.length%2!==0)return h;const d=G(s),g=[`M ${d[0]} ${d[1]}`];for(let E=2;E<d.length-2;E+=2){const t=d[E-2],M=d[E-1],P=d[E],T=d[E+1],B=(t+P)/2,j=(M+T)/2;g.push(`Q ${t} ${M} ${B} ${j}`)}const C=d[d.length-2],S=d[d.length-1];return g.push(`L ${C} ${S}`),g.join(" ")}function G(h,v=1){const s=[...h];for(let d=2;d<h.length-2;d+=2){const g=h[d],C=h[d+1],S=h[d-2],E=h[d-1],t=h[d+2],M=h[d+3];s[d]=g+v*((S+t)/2-g),s[d+1]=C+v*((E+M)/2-C)}return s}function oe(h){const v=h.trim().split(/\s+/);let s="",d="",g=null,C=null;for(let S=0;S<v.length;S+=1){const E=v[S];if(isNaN(E)){if(d=E,d==="M"||d==="L")g=parseFloat(v[++S]),C=parseFloat(v[++S]),s+=`${d}${g} ${C}`;else if(d==="Q"){const t=parseFloat(v[++S]),M=parseFloat(v[++S]),P=parseFloat(v[++S]),T=parseFloat(v[++S]);t===g&&M===C?s+=`t${P-g} ${T-C}`:s+=`q${t-g} ${M-C} ${P-g} ${T-C}`,g=P,C=T}}else{const t=parseFloat(E),M=parseFloat(v[++S]);if(d==="L"){const P=t-g,T=M-C;P===0?s+=`v${T}`:T===0?s+=`h${P}`:s+=`l${P} ${T}`,g=t,C=M}else if(d==="Q"){const P=t,T=M,B=parseFloat(v[++S]),j=parseFloat(v[++S]);P===g&&T===C?s+=`t${B-g} ${j-C}`:s+=`q${P-g} ${T-C} ${B-g} ${j-C}`,g=B,C=j}}}return s}function ee(){f.value&&(x.value.push({strokeWidth:c.value,path:oe(Y(A.value)),color:V.value}),D.value=[],A.value=""),f.value=!1}function re(h){if(!_.value)return{x:0,y:0};const v=_.value.getBoundingClientRect();let s,d;return h.touches&&h.touches.length?(s=h.touches[0].clientX,d=h.touches[0].clientY):(s=h.clientX,d=h.clientY),{x:s-v.left,y:d-v.top}}l.ref(!1);function te(){if(x.value.length>0){const h=x.value.pop();D.value.push(h)}}function ce(){if(D.value.length>0){const h=D.value.pop();x.value.push(h)}}function ve(){x.value=[],D.value=[]}const de=l.ref(null);return(h,v)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[$.active?(l.openBlock(),l.createElementBlock("div",{key:0,"data-dom-to-png-ignore":"",class:l.normalizeClass({"vue-ui-pen-and-paper-actions":!0,visible:$.active})},[l.createElementVNode("button",{class:"vue-ui-pen-and-paper-action",style:l.normalizeStyle({backgroundColor:$.backgroundColor,border:`1px solid ${k.value}`}),onClick:v[0]||(v[0]=s=>xe("close"))},[l.createVNode(me.default,{name:"close",stroke:$.color},null,8,["stroke"])],4),l.createElementVNode("button",kt,[l.createVNode(xt.ColorPicker,{value:V.value,"onUpdate:value":v[1]||(v[1]=s=>V.value=s),backgroundColor:$.backgroundColor,buttonBorderColor:k.value},null,8,["value","backgroundColor","buttonBorderColor"])]),l.createElementVNode("button",{class:l.normalizeClass({"vue-ui-pen-and-paper-action":!0,"vue-ui-pen-and-paper-action-disabled":!x.value.length}),disabled:!x.value.length,style:l.normalizeStyle({backgroundColor:$.backgroundColor,border:`1px solid ${k.value}`}),onClick:te},[l.createVNode(me.default,{name:"restart",stroke:$.color},null,8,["stroke"])],14,Lt),l.createElementVNode("button",{class:l.normalizeClass({"vue-ui-pen-and-paper-action":!0,"vue-ui-pen-and-paper-action-disabled":!D.value.length}),style:l.normalizeStyle({backgroundColor:$.backgroundColor,border:`1px solid ${k.value}`}),onClick:ce},[l.createVNode(me.default,{name:"restart",stroke:$.color,style:{transform:"scaleX(-1)"}},null,8,["stroke"])],6),l.createElementVNode("button",{class:l.normalizeClass([{"vue-ui-pen-and-paper-action":!0,"vue-ui-pen-and-paper-action-disabled":!x.value.length},"vue-ui-pen-and-paper-action"]),style:l.normalizeStyle({backgroundColor:$.backgroundColor,border:`1px solid ${k.value}`}),onClick:ve},[l.createVNode(me.default,{name:"trash",stroke:$.color},null,8,["stroke"])],6),l.withDirectives(l.createElementVNode("input",{ref_key:"range",ref:de,type:"range",class:"vertical-range",min:.5,max:12,step:.1,"onUpdate:modelValue":v[2]||(v[2]=s=>c.value=s),style:l.normalizeStyle({accentColor:$.color})},null,4),[[l.vModelText,c.value]])],2)):l.createCommentVNode("",!0),(l.openBlock(),l.createElementBlock("svg",{ref_key:"svgElement",ref:_,xmlns:l.unref(u.XMLNS),viewBox:Z.value,class:l.normalizeClass({"vue-ui-pen-and-paper":!0,inactive:!$.active}),onMousedown:I,onMousemove:q,onMouseup:ee,onMouseleave:ee,onTouchstart:l.withModifiers(I,["prevent"]),onTouchmove:l.withModifiers(q,["prevent"]),onTouchend:ee},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(x.value,s=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:s},[s.path.replace("M","").split(" ").length===2?(l.openBlock(),l.createElementBlock("circle",{key:0,cx:s.path.replace("M","").split(" ")[0],cy:s.path.replace("M","").split(" ")[1],r:s.strokeWidth/2,fill:s.color},null,8,wt)):(l.openBlock(),l.createElementBlock("path",{key:1,class:"vue-ui-pen-and-paper-path",d:s.path,stroke:s.color,"stroke-width":s.strokeWidth,fill:"none"},null,8,St))],64))),128)),f.value?(l.openBlock(),l.createElementBlock("path",{key:0,class:"vue-ui-pen-and-paper-path vue-ui-pen-and-paper-path-drawing",d:Y(A.value),stroke:V.value,"stroke-width":c.value*1.1,fill:"none"},null,8,$t)):l.createCommentVNode("",!0)],42,Ct))],64))}},Mt=Xe._export_sfc(zt,[["__scopeId","data-v-6e690e62"]]),Pt=["id"],Tt=["onClick"],Bt={key:2,class:"vue-data-ui-watermark"},It=["innerHTML"],Et={__name:"vue-ui-xy-canvas",props:{dataset:{type:Array,default(){return[]}},config:{type:Object,default(){return{}}}},emits:["selectLegend"],setup($,{expose:be,emit:X}){const{vue_ui_xy_canvas:xe}=u.useConfig(),x=$,D=l.ref(u.createUid()),Z=l.ref(null),V=l.ref(null),c=l.ref(null),k=l.ref(1),F=l.ref(1),U=l.ref(!1),f=l.ref(null),A=l.ref(""),_=l.ref(null),I=l.ref([]),q=l.ref(1),Y=l.ref(!0),G=l.ref(!0),oe=l.ref(null),ee=l.ref(0),re=l.ref(0),te=l.ref(!1),ce=l.ref(null),ve=l.ref(null),de=l.ref(null),h=l.ref(null),v=l.ref(0),s=l.ref(0),d=l.ref(0),g=l.ref(null),C=l.computed(()=>!!x.dataset&&x.dataset.length),S=X,E=l.useSlots();l.onMounted(()=>{E["chart-background"]&&console.warn("VueUiXyCanvas does not support the #chart-background slot.")});const t=l.computed({get:()=>j(),set:e=>e}),{userOptionsVisible:M,setUserOptionsVisibility:P,keepUserOptionState:T}=mt.useUserOptionState({config:t.value}),{svgRef:B}=bt.useChartAccessibility({config:t.value.style.chart.title});function j(){const e=He.useNestedProp({userConfig:x.config,defaultConfig:xe});let o={};return e.theme?o={...He.useNestedProp({userConfig:u.themes.vue_ui_xy_canvas[e.theme]||x.config,defaultConfig:e}),customPalette:u.themePalettes[e.theme]||u.palette}:o=e,x.config&&u.hasDeepProperty(x.config,"style.chart.scale.min")?o.style.chart.scale.min=x.config.style.chart.scale.min:o.style.chart.scale.min=null,x.config&&u.hasDeepProperty(x.config,"style.chart.scale.max")?o.style.chart.scale.max=x.config.style.chart.scale.max:o.style.chart.scale.max=null,x.config&&u.hasDeepProperty(x.config,"style.chart.zoom.startIndex")?o.style.chart.zoom.startIndex=x.config.style.chart.zoom.startIndex:o.style.chart.zoom.startIndex=null,x.config&&u.hasDeepProperty(x.config,"style.chart.zoom.endIndex")?o.style.chart.zoom.endIndex=x.config.style.chart.zoom.endIndex:o.style.chart.zoom.endIndex=null,o}l.watch(()=>x.config,e=>{t.value=j(),M.value=!t.value.userOptions.showOnChartHover,ke(),v.value+=1,s.value+=1,d.value+=1,i.value.showTable=t.value.table.show,i.value.showDataLabels=t.value.style.chart.dataLabels.show,i.value.stacked=t.value.style.chart.stacked,i.value.showTooltip=t.value.style.chart.tooltip.show},{deep:!0}),l.watch(()=>x.dataset,()=>{ke(),v.value+=1,s.value+=1,d.value+=1},{deep:!0});const Ce=l.ref(t.value.style.chart.aspectRatio),{isPrinting:we,isImaging:Se,generatePdf:$e,generateImage:ze}=Ye.usePrinter({elementId:`xy_canvas_${D.value}`,fileName:t.value.style.chart.title.text||"vue-ui-xy-canvas",options:t.value.userOptions.print}),i=l.ref({showTable:t.value.table.show,showDataLabels:t.value.style.chart.dataLabels.show,stacked:t.value.style.chart.stacked,showTooltip:t.value.style.chart.tooltip.show});function Ue(e){te.value=e,re.value+=1}const Me=l.computed(()=>u.convertCustomPalette(t.value.customPalette)),H=l.computed(()=>le.value?Math.max(...le.value.filter((e,o)=>!I.value.includes(e.absoluteIndex)).map(e=>e.series.length)):0),a=l.computed(()=>{const e=k.value-k.value*(t.value.style.chart.paddingProportions.left+t.value.style.chart.paddingProportions.right);return{canvasWidth:k.value,canvasHeight:F.value,left:k.value*t.value.style.chart.paddingProportions.left,top:F.value*t.value.style.chart.paddingProportions.top,right:k.value-k.value*t.value.style.chart.paddingProportions.right,bottom:F.value-F.value*t.value.style.chart.paddingProportions.bottom,width:e,height:F.value-F.value*(t.value.style.chart.paddingProportions.top+t.value.style.chart.paddingProportions.bottom),slot:e/(n.value.end-n.value.start)}});function Pe(e,o){return e/o}function qe({hasAutoScale:e,series:o,min:r,max:y,scale:b,yOffset:R,individualHeight:m,stackIndex:w=null}){return o.map((J,O)=>{const Q=b.min<0?Math.abs(b.min):0,K=Pe(J+Q,Q+b.max);let se,ie;e&&(se=b.min,ie=Pe(J-se,b.max-se));let W=0;return w===null?W=a.value.bottom-a.value.height*(e?ie:K):W=a.value.bottom-R-m*(e?ie:K),{x:a.value.left+a.value.slot*O+a.value.slot/2,y:W,value:J}})}const z=l.computed(()=>{const e=t.value.style.chart.scale.min!==null?t.value.style.chart.scale.min:Math.min(...le.value.filter((m,w)=>!I.value.includes(m.absoluteIndex)).flatMap(m=>m.series.slice(n.value.start,n.value.end))),o=t.value.style.chart.scale.max!==null?t.value.style.chart.scale.max:Math.max(...le.value.filter((m,w)=>!I.value.includes(m.absoluteIndex)).flatMap(m=>m.series.slice(n.value.start,n.value.end))),r=u.calculateNiceScale(e<0?e:0,o===e?e+1<0?0:e+1:o<0?0:o,t.value.style.chart.scale.ticks),y=r.min<0?Math.abs(r.min):0,b=a.value.bottom-a.value.height*(y/(r.max+y)),R=r.ticks.map(m=>({y:a.value.bottom-a.value.height*((m+y)/(r.max+y)),x:a.value.left-8,value:m}));return{absoluteMin:y,max:o,min:e,scale:r,yLabels:R,zero:b}}),We=l.computed(()=>L.value.map(e=>`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),u=require("./index-D5k9fip1.cjs"),p=require("./useResponsive-DQmBAoBf.cjs"),vt=require("./Tooltip-Dvq8qMfG.cjs"),dt=require("./Legend-BiZSIl_8.cjs"),ht=require("./Title-ftVcKm8j.cjs"),ft=require("./Slicer-BxsQavxP.cjs"),Ye=require("./usePrinter-DCjcVk63.cjs"),yt=require("./vue-ui-accordion-BiVdHPDv.cjs"),pt=require("./DataTable-CxPPog04.cjs"),gt=require("./vue-ui-skeleton-Cxg_LxBB.cjs"),He=require("./useNestedProp-CpW5Z_Ke.cjs"),mt=require("./useUserOptionState-BgepsfED.cjs"),bt=require("./useChartAccessibility-Cm7nkzTG.cjs"),me=require("./BaseIcon-wuetMnRj.cjs"),xt=require("./ColorPicker-BsF6StNh.cjs"),Xe=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),kt={class:l.normalizeClass({"vue-ui-pen-and-paper-action":!0}),style:{padding:"0 !important"}},Lt=["disabled"],Ct=["xmlns","viewBox"],wt=["cx","cy","r","fill"],St=["d","stroke","stroke-width"],$t=["d","stroke","stroke-width"],zt={__name:"NonSvgPenAndPaper",props:{parent:{type:HTMLElement},backgroundColor:{type:String,default:"#FFFFFF"},color:{type:String,default:"#2D353C"},active:{type:Boolean,default:!1}},emits:["close"],setup($,{emit:be}){const X=$,xe=be,x=l.ref([]),D=l.ref([]),Z=l.ref("0 0 0 0"),V=l.ref(X.color),c=l.ref(1),k=l.computed(()=>u.lightenHexColor(X.color,.6));function F({width:h,height:v}){Z.value=`0 0 ${h} ${v}`}const U=l.ref(null);l.onMounted(()=>{l.nextTick(()=>{if(X.parent){U.value=new ResizeObserver(s=>{for(const d of s){const{width:g,height:C}=d.contentRect;F({width:g,height:C})}}),U.value.observe(X.parent);const{width:h,height:v}=X.parent.getBoundingClientRect();F({width:h,height:v})}})}),l.onBeforeUnmount(()=>{U.value&&U.value.disconnect()}),l.watch(()=>X.parent,h=>{if(!h)return;const{width:v,height:s}=X.parent.getBoundingClientRect();F({width:v,height:s})},{immediate:!0});const f=l.ref(!1),A=l.ref(""),_=l.ref(null);function I(h){if(!_.value)return;f.value=!0;const{x:v,y:s}=re(h);A.value=`M ${v} ${s}`}function q(h){if(!f.value||!_.value)return;const{x:v,y:s}=re(h);A.value+=` ${v} ${s}`}function Y(h){const v=h.trim().split(/\s+/);if(v.length<4)return h;const s=v.slice(1).map(Number);if(s.length%2!==0)return h;const d=G(s),g=[`M ${d[0]} ${d[1]}`];for(let E=2;E<d.length-2;E+=2){const t=d[E-2],M=d[E-1],P=d[E],T=d[E+1],B=(t+P)/2,j=(M+T)/2;g.push(`Q ${t} ${M} ${B} ${j}`)}const C=d[d.length-2],S=d[d.length-1];return g.push(`L ${C} ${S}`),g.join(" ")}function G(h,v=1){const s=[...h];for(let d=2;d<h.length-2;d+=2){const g=h[d],C=h[d+1],S=h[d-2],E=h[d-1],t=h[d+2],M=h[d+3];s[d]=g+v*((S+t)/2-g),s[d+1]=C+v*((E+M)/2-C)}return s}function oe(h){const v=h.trim().split(/\s+/);let s="",d="",g=null,C=null;for(let S=0;S<v.length;S+=1){const E=v[S];if(isNaN(E)){if(d=E,d==="M"||d==="L")g=parseFloat(v[++S]),C=parseFloat(v[++S]),s+=`${d}${g} ${C}`;else if(d==="Q"){const t=parseFloat(v[++S]),M=parseFloat(v[++S]),P=parseFloat(v[++S]),T=parseFloat(v[++S]);t===g&&M===C?s+=`t${P-g} ${T-C}`:s+=`q${t-g} ${M-C} ${P-g} ${T-C}`,g=P,C=T}}else{const t=parseFloat(E),M=parseFloat(v[++S]);if(d==="L"){const P=t-g,T=M-C;P===0?s+=`v${T}`:T===0?s+=`h${P}`:s+=`l${P} ${T}`,g=t,C=M}else if(d==="Q"){const P=t,T=M,B=parseFloat(v[++S]),j=parseFloat(v[++S]);P===g&&T===C?s+=`t${B-g} ${j-C}`:s+=`q${P-g} ${T-C} ${B-g} ${j-C}`,g=B,C=j}}}return s}function ee(){f.value&&(x.value.push({strokeWidth:c.value,path:oe(Y(A.value)),color:V.value}),D.value=[],A.value=""),f.value=!1}function re(h){if(!_.value)return{x:0,y:0};const v=_.value.getBoundingClientRect();let s,d;return h.touches&&h.touches.length?(s=h.touches[0].clientX,d=h.touches[0].clientY):(s=h.clientX,d=h.clientY),{x:s-v.left,y:d-v.top}}l.ref(!1);function te(){if(x.value.length>0){const h=x.value.pop();D.value.push(h)}}function ce(){if(D.value.length>0){const h=D.value.pop();x.value.push(h)}}function ve(){x.value=[],D.value=[]}const de=l.ref(null);return(h,v)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[$.active?(l.openBlock(),l.createElementBlock("div",{key:0,"data-dom-to-png-ignore":"",class:l.normalizeClass({"vue-ui-pen-and-paper-actions":!0,visible:$.active})},[l.createElementVNode("button",{class:"vue-ui-pen-and-paper-action",style:l.normalizeStyle({backgroundColor:$.backgroundColor,border:`1px solid ${k.value}`}),onClick:v[0]||(v[0]=s=>xe("close"))},[l.createVNode(me.default,{name:"close",stroke:$.color},null,8,["stroke"])],4),l.createElementVNode("button",kt,[l.createVNode(xt.ColorPicker,{value:V.value,"onUpdate:value":v[1]||(v[1]=s=>V.value=s),backgroundColor:$.backgroundColor,buttonBorderColor:k.value},null,8,["value","backgroundColor","buttonBorderColor"])]),l.createElementVNode("button",{class:l.normalizeClass({"vue-ui-pen-and-paper-action":!0,"vue-ui-pen-and-paper-action-disabled":!x.value.length}),disabled:!x.value.length,style:l.normalizeStyle({backgroundColor:$.backgroundColor,border:`1px solid ${k.value}`}),onClick:te},[l.createVNode(me.default,{name:"restart",stroke:$.color},null,8,["stroke"])],14,Lt),l.createElementVNode("button",{class:l.normalizeClass({"vue-ui-pen-and-paper-action":!0,"vue-ui-pen-and-paper-action-disabled":!D.value.length}),style:l.normalizeStyle({backgroundColor:$.backgroundColor,border:`1px solid ${k.value}`}),onClick:ce},[l.createVNode(me.default,{name:"restart",stroke:$.color,style:{transform:"scaleX(-1)"}},null,8,["stroke"])],6),l.createElementVNode("button",{class:l.normalizeClass([{"vue-ui-pen-and-paper-action":!0,"vue-ui-pen-and-paper-action-disabled":!x.value.length},"vue-ui-pen-and-paper-action"]),style:l.normalizeStyle({backgroundColor:$.backgroundColor,border:`1px solid ${k.value}`}),onClick:ve},[l.createVNode(me.default,{name:"trash",stroke:$.color},null,8,["stroke"])],6),l.withDirectives(l.createElementVNode("input",{ref_key:"range",ref:de,type:"range",class:"vertical-range",min:.5,max:12,step:.1,"onUpdate:modelValue":v[2]||(v[2]=s=>c.value=s),style:l.normalizeStyle({accentColor:$.color})},null,4),[[l.vModelText,c.value]])],2)):l.createCommentVNode("",!0),(l.openBlock(),l.createElementBlock("svg",{ref_key:"svgElement",ref:_,xmlns:l.unref(u.XMLNS),viewBox:Z.value,class:l.normalizeClass({"vue-ui-pen-and-paper":!0,inactive:!$.active}),onMousedown:I,onMousemove:q,onMouseup:ee,onMouseleave:ee,onTouchstart:l.withModifiers(I,["prevent"]),onTouchmove:l.withModifiers(q,["prevent"]),onTouchend:ee},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(x.value,s=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:s},[s.path.replace("M","").split(" ").length===2?(l.openBlock(),l.createElementBlock("circle",{key:0,cx:s.path.replace("M","").split(" ")[0],cy:s.path.replace("M","").split(" ")[1],r:s.strokeWidth/2,fill:s.color},null,8,wt)):(l.openBlock(),l.createElementBlock("path",{key:1,class:"vue-ui-pen-and-paper-path",d:s.path,stroke:s.color,"stroke-width":s.strokeWidth,fill:"none"},null,8,St))],64))),128)),f.value?(l.openBlock(),l.createElementBlock("path",{key:0,class:"vue-ui-pen-and-paper-path vue-ui-pen-and-paper-path-drawing",d:Y(A.value),stroke:V.value,"stroke-width":c.value*1.1,fill:"none"},null,8,$t)):l.createCommentVNode("",!0)],42,Ct))],64))}},Mt=Xe._export_sfc(zt,[["__scopeId","data-v-6e690e62"]]),Pt=["id"],Tt=["onClick"],Bt={key:2,class:"vue-data-ui-watermark"},It=["innerHTML"],Et={__name:"vue-ui-xy-canvas",props:{dataset:{type:Array,default(){return[]}},config:{type:Object,default(){return{}}}},emits:["selectLegend"],setup($,{expose:be,emit:X}){const{vue_ui_xy_canvas:xe}=u.useConfig(),x=$,D=l.ref(u.createUid()),Z=l.ref(null),V=l.ref(null),c=l.ref(null),k=l.ref(1),F=l.ref(1),U=l.ref(!1),f=l.ref(null),A=l.ref(""),_=l.ref(null),I=l.ref([]),q=l.ref(1),Y=l.ref(!0),G=l.ref(!0),oe=l.ref(null),ee=l.ref(0),re=l.ref(0),te=l.ref(!1),ce=l.ref(null),ve=l.ref(null),de=l.ref(null),h=l.ref(null),v=l.ref(0),s=l.ref(0),d=l.ref(0),g=l.ref(null),C=l.computed(()=>!!x.dataset&&x.dataset.length),S=X,E=l.useSlots();l.onMounted(()=>{E["chart-background"]&&console.warn("VueUiXyCanvas does not support the #chart-background slot.")});const t=l.computed({get:()=>j(),set:e=>e}),{userOptionsVisible:M,setUserOptionsVisibility:P,keepUserOptionState:T}=mt.useUserOptionState({config:t.value}),{svgRef:B}=bt.useChartAccessibility({config:t.value.style.chart.title});function j(){const e=He.useNestedProp({userConfig:x.config,defaultConfig:xe});let o={};return e.theme?o={...He.useNestedProp({userConfig:u.themes.vue_ui_xy_canvas[e.theme]||x.config,defaultConfig:e}),customPalette:u.themePalettes[e.theme]||u.palette}:o=e,x.config&&u.hasDeepProperty(x.config,"style.chart.scale.min")?o.style.chart.scale.min=x.config.style.chart.scale.min:o.style.chart.scale.min=null,x.config&&u.hasDeepProperty(x.config,"style.chart.scale.max")?o.style.chart.scale.max=x.config.style.chart.scale.max:o.style.chart.scale.max=null,x.config&&u.hasDeepProperty(x.config,"style.chart.zoom.startIndex")?o.style.chart.zoom.startIndex=x.config.style.chart.zoom.startIndex:o.style.chart.zoom.startIndex=null,x.config&&u.hasDeepProperty(x.config,"style.chart.zoom.endIndex")?o.style.chart.zoom.endIndex=x.config.style.chart.zoom.endIndex:o.style.chart.zoom.endIndex=null,o}l.watch(()=>x.config,e=>{t.value=j(),M.value=!t.value.userOptions.showOnChartHover,ke(),v.value+=1,s.value+=1,d.value+=1,i.value.showTable=t.value.table.show,i.value.showDataLabels=t.value.style.chart.dataLabels.show,i.value.stacked=t.value.style.chart.stacked,i.value.showTooltip=t.value.style.chart.tooltip.show},{deep:!0}),l.watch(()=>x.dataset,()=>{ke(),v.value+=1,s.value+=1,d.value+=1},{deep:!0});const Ce=l.ref(t.value.style.chart.aspectRatio),{isPrinting:we,isImaging:Se,generatePdf:$e,generateImage:ze}=Ye.usePrinter({elementId:`xy_canvas_${D.value}`,fileName:t.value.style.chart.title.text||"vue-ui-xy-canvas",options:t.value.userOptions.print}),i=l.ref({showTable:t.value.table.show,showDataLabels:t.value.style.chart.dataLabels.show,stacked:t.value.style.chart.stacked,showTooltip:t.value.style.chart.tooltip.show});function Ue(e){te.value=e,re.value+=1}const Me=l.computed(()=>u.convertCustomPalette(t.value.customPalette)),H=l.computed(()=>le.value?Math.max(...le.value.filter((e,o)=>!I.value.includes(e.absoluteIndex)).map(e=>e.series.length)):0),a=l.computed(()=>{const e=k.value-k.value*(t.value.style.chart.paddingProportions.left+t.value.style.chart.paddingProportions.right);return{canvasWidth:k.value,canvasHeight:F.value,left:k.value*t.value.style.chart.paddingProportions.left,top:F.value*t.value.style.chart.paddingProportions.top,right:k.value-k.value*t.value.style.chart.paddingProportions.right,bottom:F.value-F.value*t.value.style.chart.paddingProportions.bottom,width:e,height:F.value-F.value*(t.value.style.chart.paddingProportions.top+t.value.style.chart.paddingProportions.bottom),slot:e/(n.value.end-n.value.start)}});function Pe(e,o){return e/o}function qe({hasAutoScale:e,series:o,min:r,max:y,scale:b,yOffset:R,individualHeight:m,stackIndex:w=null}){return o.map((J,O)=>{const Q=b.min<0?Math.abs(b.min):0,K=Pe(J+Q,Q+b.max);let se,ie;e&&(se=b.min,ie=Pe(J-se,b.max-se));let W=0;return w===null?W=a.value.bottom-a.value.height*(e?ie:K):W=a.value.bottom-R-m*(e?ie:K),{x:a.value.left+a.value.slot*O+a.value.slot/2,y:W,value:J}})}const z=l.computed(()=>{const e=t.value.style.chart.scale.min!==null?t.value.style.chart.scale.min:Math.min(...le.value.filter((m,w)=>!I.value.includes(m.absoluteIndex)).flatMap(m=>m.series.slice(n.value.start,n.value.end))),o=t.value.style.chart.scale.max!==null?t.value.style.chart.scale.max:Math.max(...le.value.filter((m,w)=>!I.value.includes(m.absoluteIndex)).flatMap(m=>m.series.slice(n.value.start,n.value.end))),r=u.calculateNiceScale(e<0?e:0,o===e?e+1<0?0:e+1:o<0?0:o,t.value.style.chart.scale.ticks),y=r.min<0?Math.abs(r.min):0,b=a.value.bottom-a.value.height*(y/(r.max+y)),R=r.ticks.map(m=>({y:a.value.bottom-a.value.height*((m+y)/(r.max+y)),x:a.value.left-8,value:m}));return{absoluteMin:y,max:o,min:e,scale:r,yLabels:R,zero:b}}),We=l.computed(()=>L.value.map(e=>`
|
|
2
2
|
<div style="display:flex;flex-direction:row;gap:6px;align-items:center;">
|
|
3
3
|
<svg viewBox="0 0 10 10" height="12" width="12">
|
|
4
4
|
<circle cx="5" cy="5" r="5" fill="${e.color}"/>
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { ref as i, computed as T, onMounted as Ge, nextTick as Ie, onBeforeUnmount as bt, watch as te, createElementBlock as X, openBlock as C, Fragment as We, createCommentVNode as le, normalizeClass as fe, createElementVNode as U, withDirectives as Ut, normalizeStyle as W, createVNode as ke, vModelText as Wt, withModifiers as dt, unref as D, renderList as Vt, useSlots as Zt, createBlock as ue, createSlots as Gt, withCtx as z, renderSlot as M, normalizeProps as ve, guardReactiveProps as de, toDisplayString as ht, createTextVNode as _t } from "vue";
|
|
2
|
-
import { l as xt, X as jt, u as qt, c as Qt, t as Jt, p as he, a as Kt, C as Ne, b as el, D as Ve, i as be, f as xe, d as ft, $ as tl, J as ll, ac as al, o as ol, e as nl, x as yt, q as rl, r as sl, y as ul, s as Me } from "./index-
|
|
2
|
+
import { l as xt, X as jt, u as qt, c as Qt, t as Jt, p as he, a as Kt, C as Ne, b as el, D as Ve, i as be, f as xe, d as ft, $ as tl, J as ll, ac as al, o as ol, e as nl, x as yt, q as rl, r as sl, y as ul, s as Me } from "./index-D-HIb4Mn.js";
|
|
3
3
|
import { d as il, t as cl, u as vl, c as dl, a as gt, l as I, r as Ze, b as ee, p as pt } from "./useResponsive-Cw4oZ8sQ.js";
|
|
4
|
-
import { _ as hl } from "./Tooltip-
|
|
5
|
-
import { L as fl } from "./Legend-
|
|
6
|
-
import { _ as yl } from "./Title-
|
|
7
|
-
import { S as gl } from "./Slicer-
|
|
8
|
-
import { u as pl, U as ml } from "./usePrinter-
|
|
9
|
-
import bl from "./vue-ui-accordion-
|
|
10
|
-
import { D as xl } from "./DataTable-
|
|
11
|
-
import kl from "./vue-ui-skeleton-
|
|
12
|
-
import { u as mt } from "./useNestedProp-
|
|
4
|
+
import { _ as hl } from "./Tooltip-BaCjRGR8.js";
|
|
5
|
+
import { L as fl } from "./Legend-DACz926s.js";
|
|
6
|
+
import { _ as yl } from "./Title-BnbtlZuQ.js";
|
|
7
|
+
import { S as gl } from "./Slicer-B6gtffPg.js";
|
|
8
|
+
import { u as pl, U as ml } from "./usePrinter-Dur-51db.js";
|
|
9
|
+
import bl from "./vue-ui-accordion-qmHz6V_f.js";
|
|
10
|
+
import { D as xl } from "./DataTable-DRB6Rt3T.js";
|
|
11
|
+
import kl from "./vue-ui-skeleton-WO50lQWb.js";
|
|
12
|
+
import { u as mt } from "./useNestedProp-qC6DmhPQ.js";
|
|
13
13
|
import { u as Ll } from "./useUserOptionState-BIvW1Kz7.js";
|
|
14
14
|
import { u as Cl } from "./useChartAccessibility-BWojgys7.js";
|
|
15
|
-
import Ye from "./BaseIcon-
|
|
16
|
-
import { C as wl } from "./ColorPicker-
|
|
15
|
+
import Ye from "./BaseIcon-BSkS89RT.js";
|
|
16
|
+
import { C as wl } from "./ColorPicker-B-UF8Xdm.js";
|
|
17
17
|
import { _ as kt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
18
18
|
const $l = {
|
|
19
19
|
class: /* @__PURE__ */ fe({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-data-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.7.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A user-empowering data visualization Vue 3 components library for eloquent data storytelling",
|
|
7
7
|
"keywords": [
|
|
@@ -96,7 +96,6 @@
|
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@vitejs/plugin-vue": "^5.2.3",
|
|
99
|
-
"canvg": "^4.0.3",
|
|
100
99
|
"cypress": "^14.0.3",
|
|
101
100
|
"jspdf": "^3.0.1",
|
|
102
101
|
"remove-attr": "^0.0.13",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),t="2.6.52-beta.8",n={"aria-hidden":"true"},s={__name:"PackageVersion",setup(c){return(r,o)=>(e.openBlock(),e.createElementBlock("desc",n,"Composed with Vue Data UI "+e.toDisplayString(e.unref(t)),1))}};exports._sfc_main=s;
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { X as v } from "./index-BBwKaiVY.js";
|
|
2
|
-
async function j(e) {
|
|
3
|
-
const i = e.querySelectorAll("img"), n = [];
|
|
4
|
-
i.forEach((t) => {
|
|
5
|
-
t.src && !t.src.startsWith("data:") && n.push(
|
|
6
|
-
new Promise((s) => {
|
|
7
|
-
const a = new window.Image();
|
|
8
|
-
a.crossOrigin = "anonymous", a.onload = function() {
|
|
9
|
-
try {
|
|
10
|
-
const o = document.createElement("canvas");
|
|
11
|
-
o.width = a.naturalWidth, o.height = a.naturalHeight, o.getContext("2d").drawImage(a, 0, 0), t.src = o.toDataURL();
|
|
12
|
-
} catch {
|
|
13
|
-
}
|
|
14
|
-
s();
|
|
15
|
-
}, a.onerror = function() {
|
|
16
|
-
s();
|
|
17
|
-
}, a.src = t.src;
|
|
18
|
-
})
|
|
19
|
-
);
|
|
20
|
-
}), await Promise.all(n);
|
|
21
|
-
}
|
|
22
|
-
function T(e) {
|
|
23
|
-
e.querySelectorAll("[data-dom-to-png-ignore]").forEach((n) => {
|
|
24
|
-
n.remove();
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function x(e, i, n) {
|
|
28
|
-
const t = window.getComputedStyle(i), s = i.getBoundingClientRect(), a = t.display.includes("flex");
|
|
29
|
-
let o = {}, l = e.getAttribute("style");
|
|
30
|
-
typeof l != "string" && (l = ""), l.split(";").forEach((r) => {
|
|
31
|
-
if (typeof r == "string" && r.trim()) {
|
|
32
|
-
const [d, y] = r.split(":");
|
|
33
|
-
d && y !== void 0 && (o[d.trim()] = y.trim());
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
for (let r = 0; r < t.length; r += 1) {
|
|
37
|
-
const d = t[r], y = t.getPropertyValue(d);
|
|
38
|
-
o[d] = y;
|
|
39
|
-
}
|
|
40
|
-
o.color = t.color, o["background-color"] = t.backgroundColor;
|
|
41
|
-
let c = t.fontFamily || n || "";
|
|
42
|
-
(!c || c.trim() === "" || c === "inherit" || c === "initial" || c.toLowerCase().startsWith("system-ui") || c.toLowerCase() === "sans-serif" || c.toLowerCase() === "serif" || c.toLowerCase() === "monospace") && (c = "Helvetica, Arial, sans-serif"), o["font-family"] = c, o["font-size"] = t.fontSize, o["font-weight"] = t.fontWeight, (a || t.display.includes("grid") || ["inline-block", "absolute", "fixed"].includes(t.position)) && (s.width > 0 && (o.width = s.width + "px"), s.height > 0 && (o.height = s.height + "px")), a && t.flexWrap === "nowrap" && (o["white-space"] = "nowrap"), ["box-sizing", "padding", "margin", "border"].forEach((r) => {
|
|
43
|
-
o[r] = t.getPropertyValue(r);
|
|
44
|
-
}), o.overflow = "visible", o["overflow-x"] = "visible", o["overflow-y"] = "visible";
|
|
45
|
-
let f = "";
|
|
46
|
-
for (const r in o)
|
|
47
|
-
f += `${r}:${o[r]};`;
|
|
48
|
-
e.setAttribute("style", f);
|
|
49
|
-
const g = e.children || [], m = i.children || [];
|
|
50
|
-
for (let r = 0; r < g.length; r++)
|
|
51
|
-
g[r].nodeType === 1 && m[r] && x(g[r], m[r], c);
|
|
52
|
-
}
|
|
53
|
-
function q(e, i) {
|
|
54
|
-
e.querySelectorAll("text").forEach((t) => {
|
|
55
|
-
t.setAttribute("font-family", i), t.style.fontFamily = i;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
function L(e) {
|
|
59
|
-
const i = new TextEncoder().encode(e);
|
|
60
|
-
let n = "";
|
|
61
|
-
return i.forEach((t) => n += String.fromCharCode(t)), btoa(n);
|
|
62
|
-
}
|
|
63
|
-
function $(e, i, n) {
|
|
64
|
-
let s = new XMLSerializer().serializeToString(e);
|
|
65
|
-
s.match(/^<svg[^>]+xmlns="http\:\/\/www\.w3\.org\/2000\/svg"/) || (s = s.replace(/^<svg/, '<svg xmlns="http://www.w3.org/2000/svg"'));
|
|
66
|
-
const a = window.btoa(unescape(encodeURIComponent(s))), o = new window.Image();
|
|
67
|
-
return o.src = `data:image/svg+xml;base64,${a}`, new Promise((l, c) => {
|
|
68
|
-
o.onload = function() {
|
|
69
|
-
const f = document.createElement("canvas");
|
|
70
|
-
f.width = i, f.height = n, f.getContext("2d").drawImage(o, 0, 0, i, n), l(f.toDataURL("image/png", 1));
|
|
71
|
-
}, o.onerror = (f) => c(f);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function A(e) {
|
|
75
|
-
if (e.nodeType !== 1) return;
|
|
76
|
-
const i = window.getComputedStyle(e);
|
|
77
|
-
let n = "";
|
|
78
|
-
for (let t = 0; t < i.length; t++) {
|
|
79
|
-
const s = i[t];
|
|
80
|
-
n += `${s}:${i.getPropertyValue(s)};`;
|
|
81
|
-
}
|
|
82
|
-
e.setAttribute("style", n);
|
|
83
|
-
for (let t = 0; t < e.children.length; t++)
|
|
84
|
-
A(e.children[t]);
|
|
85
|
-
}
|
|
86
|
-
function I() {
|
|
87
|
-
const e = [];
|
|
88
|
-
for (const i of document.styleSheets)
|
|
89
|
-
try {
|
|
90
|
-
const n = i.cssRules;
|
|
91
|
-
if (!n) continue;
|
|
92
|
-
for (const t of n)
|
|
93
|
-
(typeof CSSFontFaceRule < "u" && t instanceof CSSFontFaceRule || t.cssText.trim().startsWith("@font-face")) && e.push(t.cssText);
|
|
94
|
-
} catch {
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
return e;
|
|
98
|
-
}
|
|
99
|
-
function z(e) {
|
|
100
|
-
const i = I();
|
|
101
|
-
if (!i.length) return;
|
|
102
|
-
const n = document.createElement("style");
|
|
103
|
-
n.setAttribute("type", "text/css"), n.textContent = i.join(`
|
|
104
|
-
`);
|
|
105
|
-
const t = e.querySelector("defs") || document.createElementNS(v, "defs");
|
|
106
|
-
t.appendChild(n), e.querySelector("defs") || e.insertBefore(t, e.firstChild);
|
|
107
|
-
}
|
|
108
|
-
function M(e, i) {
|
|
109
|
-
const n = e.querySelectorAll("foreignObject"), t = i.querySelectorAll("foreignObject");
|
|
110
|
-
n.forEach((s, a) => {
|
|
111
|
-
const o = t[a];
|
|
112
|
-
if (!o) return;
|
|
113
|
-
function l(c, f) {
|
|
114
|
-
if (!c || !f) return;
|
|
115
|
-
if (c.nodeType === 1 && f.nodeType === 1) {
|
|
116
|
-
const r = window.getComputedStyle(f);
|
|
117
|
-
let d = "";
|
|
118
|
-
for (let y = 0; y < r.length; y++) {
|
|
119
|
-
const b = r[y];
|
|
120
|
-
d += `${b}:${r.getPropertyValue(b)};`;
|
|
121
|
-
}
|
|
122
|
-
c.setAttribute("style", d);
|
|
123
|
-
}
|
|
124
|
-
const g = c.children || [], m = f.children || [];
|
|
125
|
-
for (let r = 0; r < g.length; r++)
|
|
126
|
-
l(g[r], m[r]);
|
|
127
|
-
}
|
|
128
|
-
l(s, o);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
function W(e) {
|
|
132
|
-
e.querySelectorAll("foreignObject").forEach((n) => {
|
|
133
|
-
let t = "";
|
|
134
|
-
const s = Array.from(n.querySelectorAll("*"));
|
|
135
|
-
if (s.length !== 0) {
|
|
136
|
-
for (const a of document.styleSheets) {
|
|
137
|
-
let o;
|
|
138
|
-
try {
|
|
139
|
-
o = a.cssRules;
|
|
140
|
-
} catch {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
if (o) {
|
|
144
|
-
for (const l of o)
|
|
145
|
-
if (!(typeof CSSStyleRule < "u" && !(l instanceof CSSStyleRule)))
|
|
146
|
-
try {
|
|
147
|
-
s.some((c) => c.matches(l.selectorText)) && (t += l.cssText + `
|
|
148
|
-
`);
|
|
149
|
-
} catch {
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (t) {
|
|
155
|
-
const a = document.createElement("style");
|
|
156
|
-
a.textContent = t, n.insertBefore(a, n.firstChild);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
function P(e) {
|
|
162
|
-
e.querySelectorAll("foreignObject").forEach((n) => {
|
|
163
|
-
const t = n.firstElementChild;
|
|
164
|
-
t && t.tagName.toLowerCase() !== "svg" && t.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
function H(e, i) {
|
|
168
|
-
const n = e.querySelectorAll("foreignObject"), t = i.querySelectorAll("foreignObject");
|
|
169
|
-
n.forEach((s, a) => {
|
|
170
|
-
const o = t[a];
|
|
171
|
-
if (!s || !o) return;
|
|
172
|
-
const l = s.firstElementChild, c = o.firstElementChild;
|
|
173
|
-
l && c && F(l, c);
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
function F(e, i) {
|
|
177
|
-
if (e.nodeType !== 1 || !i) return;
|
|
178
|
-
x(e, i);
|
|
179
|
-
const n = e.children || [], t = i.children || [];
|
|
180
|
-
for (let s = 0; s < n.length; s++)
|
|
181
|
-
F(n[s], t[s]);
|
|
182
|
-
}
|
|
183
|
-
async function D({ container: e, scale: i = 2 }) {
|
|
184
|
-
if (!e) throw new Error("No container provided");
|
|
185
|
-
await document.fonts.ready;
|
|
186
|
-
let n = window.getComputedStyle(e).fontFamily || "Helvetica";
|
|
187
|
-
n.toLowerCase().includes("helvetica") || (n += ", Helvetica");
|
|
188
|
-
const t = e.cloneNode(!0), s = t.querySelectorAll("canvas"), a = e.querySelectorAll("canvas");
|
|
189
|
-
for (let p = 0; p < a.length; p += 1) {
|
|
190
|
-
const u = a[p], h = s[p];
|
|
191
|
-
if (u && h) {
|
|
192
|
-
const w = document.createElement("img");
|
|
193
|
-
w.src = u.toDataURL("image/png"), w.width = u.width, w.height = u.height, w.style.width = u.style.width || u.width + "px", w.style.height = u.style.height || u.height + "px", h.replaceWith(w);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
const o = e.querySelector("svg[aria-label]"), l = t.querySelector("svg[aria-label]");
|
|
197
|
-
if (o && l) {
|
|
198
|
-
P(l), W(l), M(l, o), H(l, o), A(l), q(l, n);
|
|
199
|
-
const p = o.getBoundingClientRect(), u = p.width, h = p.height, w = Math.round(u * i), R = Math.round(h * i), E = await $(l, w, R), S = document.createElement("img");
|
|
200
|
-
S.src = E, S.width = u, S.height = h, S.style.width = u + "px", S.style.height = h + "px", l.parentNode.replaceChild(S, l);
|
|
201
|
-
}
|
|
202
|
-
x(t, e, n), T(t), await j(t);
|
|
203
|
-
const { width: c, height: f } = e.getBoundingClientRect(), g = Math.round(Math.max(t.scrollWidth, c) * i), m = Math.round(Math.max(t.scrollHeight, f) * 1.01 * i), r = document.createElementNS(v, "svg");
|
|
204
|
-
r.setAttribute("viewBox", `0 0 ${g} ${m}`), r.setAttribute("width", g), r.setAttribute("height", m), r.setAttribute("style", `font-family:${n};`);
|
|
205
|
-
const d = document.createElementNS(v, "foreignObject");
|
|
206
|
-
d.setAttribute("x", 0), d.setAttribute("y", 0), d.setAttribute("width", g), d.setAttribute("height", m), d.setAttribute("style", `font-family:${n};`), t.style.transform = `scale(${i})`, t.style.transformOrigin = "top left", t.style.width = c + "px", t.style.height = f + "px", t.style.background = window.getComputedStyle(e).backgroundColor, d.appendChild(t), z(r), r.appendChild(d);
|
|
207
|
-
const b = new XMLSerializer().serializeToString(r), O = L(b), C = new window.Image();
|
|
208
|
-
return C.crossOrigin = "anonymous", C.src = `data:image/svg+xml;base64,${O}`, new Promise((p, u) => {
|
|
209
|
-
C.onload = function() {
|
|
210
|
-
try {
|
|
211
|
-
const h = document.createElement("canvas");
|
|
212
|
-
h.width = g, h.height = m, h.getContext("2d").drawImage(C, 0, 0, g, m), p(h.toDataURL("image/png", 1));
|
|
213
|
-
} catch (h) {
|
|
214
|
-
u("Failed to draw SVG on canvas: " + h);
|
|
215
|
-
}
|
|
216
|
-
}, C.onerror = function() {
|
|
217
|
-
u("Failed to load SVG image for conversion");
|
|
218
|
-
};
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
export {
|
|
222
|
-
D as d
|
|
223
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";const v=require("./index-DdmI4IyM.cjs");async function j(e){const i=e.querySelectorAll("img"),n=[];i.forEach(t=>{t.src&&!t.src.startsWith("data:")&&n.push(new Promise(s=>{const a=new window.Image;a.crossOrigin="anonymous",a.onload=function(){try{const o=document.createElement("canvas");o.width=a.naturalWidth,o.height=a.naturalHeight,o.getContext("2d").drawImage(a,0,0),t.src=o.toDataURL()}catch{}s()},a.onerror=function(){s()},a.src=t.src}))}),await Promise.all(n)}function L(e){e.querySelectorAll("[data-dom-to-png-ignore]").forEach(n=>{n.remove()})}function x(e,i,n){const t=window.getComputedStyle(i),s=i.getBoundingClientRect(),a=t.display.includes("flex");let o={},l=e.getAttribute("style");typeof l!="string"&&(l=""),l.split(";").forEach(r=>{if(typeof r=="string"&&r.trim()){const[f,m]=r.split(":");f&&m!==void 0&&(o[f.trim()]=m.trim())}});for(let r=0;r<t.length;r+=1){const f=t[r],m=t.getPropertyValue(f);o[f]=m}o.color=t.color,o["background-color"]=t.backgroundColor;let c=t.fontFamily||n||"";(!c||c.trim()===""||c==="inherit"||c==="initial"||c.toLowerCase().startsWith("system-ui")||c.toLowerCase()==="sans-serif"||c.toLowerCase()==="serif"||c.toLowerCase()==="monospace")&&(c="Helvetica, Arial, sans-serif"),o["font-family"]=c,o["font-size"]=t.fontSize,o["font-weight"]=t.fontWeight,(a||t.display.includes("grid")||["inline-block","absolute","fixed"].includes(t.position))&&(s.width>0&&(o.width=s.width+"px"),s.height>0&&(o.height=s.height+"px")),a&&t.flexWrap==="nowrap"&&(o["white-space"]="nowrap"),["box-sizing","padding","margin","border"].forEach(r=>{o[r]=t.getPropertyValue(r)}),o.overflow="visible",o["overflow-x"]="visible",o["overflow-y"]="visible";let d="";for(const r in o)d+=`${r}:${o[r]};`;e.setAttribute("style",d);const g=e.children||[],y=i.children||[];for(let r=0;r<g.length;r++)g[r].nodeType===1&&y[r]&&x(g[r],y[r],c)}function T(e,i){e.querySelectorAll("text").forEach(t=>{t.setAttribute("font-family",i),t.style.fontFamily=i})}function q(e){const i=new TextEncoder().encode(e);let n="";return i.forEach(t=>n+=String.fromCharCode(t)),btoa(n)}function M(e,i,n){let s=new XMLSerializer().serializeToString(e);s.match(/^<svg[^>]+xmlns="http\:\/\/www\.w3\.org\/2000\/svg"/)||(s=s.replace(/^<svg/,'<svg xmlns="http://www.w3.org/2000/svg"'));const a=window.btoa(unescape(encodeURIComponent(s))),o=new window.Image;return o.src=`data:image/svg+xml;base64,${a}`,new Promise((l,c)=>{o.onload=function(){const d=document.createElement("canvas");d.width=i,d.height=n,d.getContext("2d").drawImage(o,0,0,i,n),l(d.toDataURL("image/png",1))},o.onerror=d=>c(d)})}function A(e){if(e.nodeType!==1)return;const i=window.getComputedStyle(e);let n="";for(let t=0;t<i.length;t++){const s=i[t];n+=`${s}:${i.getPropertyValue(s)};`}e.setAttribute("style",n);for(let t=0;t<e.children.length;t++)A(e.children[t])}function $(){const e=[];for(const i of document.styleSheets)try{const n=i.cssRules;if(!n)continue;for(const t of n)(typeof CSSFontFaceRule<"u"&&t instanceof CSSFontFaceRule||t.cssText.trim().startsWith("@font-face"))&&e.push(t.cssText)}catch{continue}return e}function I(e){const i=$();if(!i.length)return;const n=document.createElement("style");n.setAttribute("type","text/css"),n.textContent=i.join(`
|
|
2
|
-
`);const t=e.querySelector("defs")||document.createElementNS(v.XMLNS,"defs");t.appendChild(n),e.querySelector("defs")||e.insertBefore(t,e.firstChild)}function z(e,i){const n=e.querySelectorAll("foreignObject"),t=i.querySelectorAll("foreignObject");n.forEach((s,a)=>{const o=t[a];if(!o)return;function l(c,d){if(!c||!d)return;if(c.nodeType===1&&d.nodeType===1){const r=window.getComputedStyle(d);let f="";for(let m=0;m<r.length;m++){const b=r[m];f+=`${b}:${r.getPropertyValue(b)};`}c.setAttribute("style",f)}const g=c.children||[],y=d.children||[];for(let r=0;r<g.length;r++)l(g[r],y[r])}l(s,o)})}function P(e){e.querySelectorAll("foreignObject").forEach(n=>{let t="";const s=Array.from(n.querySelectorAll("*"));if(s.length!==0){for(const a of document.styleSheets){let o;try{o=a.cssRules}catch{continue}if(o){for(const l of o)if(!(typeof CSSStyleRule<"u"&&!(l instanceof CSSStyleRule)))try{s.some(c=>c.matches(l.selectorText))&&(t+=l.cssText+`
|
|
3
|
-
`)}catch{continue}}}if(t){const a=document.createElement("style");a.textContent=t,n.insertBefore(a,n.firstChild)}}})}function W(e){e.querySelectorAll("foreignObject").forEach(n=>{const t=n.firstElementChild;t&&t.tagName.toLowerCase()!=="svg"&&t.setAttribute("xmlns","http://www.w3.org/1999/xhtml")})}function H(e,i){const n=e.querySelectorAll("foreignObject"),t=i.querySelectorAll("foreignObject");n.forEach((s,a)=>{const o=t[a];if(!s||!o)return;const l=s.firstElementChild,c=o.firstElementChild;l&&c&&F(l,c)})}function F(e,i){if(e.nodeType!==1||!i)return;x(e,i);const n=e.children||[],t=i.children||[];for(let s=0;s<n.length;s++)F(n[s],t[s])}async function B({container:e,scale:i=2}){if(!e)throw new Error("No container provided");await document.fonts.ready;let n=window.getComputedStyle(e).fontFamily||"Helvetica";n.toLowerCase().includes("helvetica")||(n+=", Helvetica");const t=e.cloneNode(!0),s=t.querySelectorAll("canvas"),a=e.querySelectorAll("canvas");for(let p=0;p<a.length;p+=1){const u=a[p],h=s[p];if(u&&h){const w=document.createElement("img");w.src=u.toDataURL("image/png"),w.width=u.width,w.height=u.height,w.style.width=u.style.width||u.width+"px",w.style.height=u.style.height||u.height+"px",h.replaceWith(w)}}const o=e.querySelector("svg[aria-label]"),l=t.querySelector("svg[aria-label]");if(o&&l){W(l),P(l),z(l,o),H(l,o),A(l),T(l,n);const p=o.getBoundingClientRect(),u=p.width,h=p.height,w=Math.round(u*i),R=Math.round(h*i),E=await M(l,w,R),S=document.createElement("img");S.src=E,S.width=u,S.height=h,S.style.width=u+"px",S.style.height=h+"px",l.parentNode.replaceChild(S,l)}x(t,e,n),L(t),await j(t);const{width:c,height:d}=e.getBoundingClientRect(),g=Math.round(Math.max(t.scrollWidth,c)*i),y=Math.round(Math.max(t.scrollHeight,d)*1.01*i),r=document.createElementNS(v.XMLNS,"svg");r.setAttribute("viewBox",`0 0 ${g} ${y}`),r.setAttribute("width",g),r.setAttribute("height",y),r.setAttribute("style",`font-family:${n};`);const f=document.createElementNS(v.XMLNS,"foreignObject");f.setAttribute("x",0),f.setAttribute("y",0),f.setAttribute("width",g),f.setAttribute("height",y),f.setAttribute("style",`font-family:${n};`),t.style.transform=`scale(${i})`,t.style.transformOrigin="top left",t.style.width=c+"px",t.style.height=d+"px",t.style.background=window.getComputedStyle(e).backgroundColor,f.appendChild(t),I(r),r.appendChild(f);const b=new XMLSerializer().serializeToString(r),O=q(b),C=new window.Image;return C.crossOrigin="anonymous",C.src=`data:image/svg+xml;base64,${O}`,new Promise((p,u)=>{C.onload=function(){try{const h=document.createElement("canvas");h.width=g,h.height=y,h.getContext("2d").drawImage(C,0,0,g,y),p(h.toDataURL("image/png",1))}catch(h){u("Failed to draw SVG on canvas: "+h)}},C.onerror=function(){u("Failed to load SVG image for conversion")}})}exports.domToPng=B;
|