@pantograph/vue 0.13.1 → 0.14.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/dist/ActionButton/index.js +1 -1
- package/dist/ActionButton/index.umd.cjs +1 -1
- package/dist/{ActionButton.vue_vue_type_script_setup_true_lang-DaeklrrN.js → ActionButton.vue_vue_type_script_setup_true_lang-CIRnLjGb.js} +1 -1
- package/dist/{ActionButton.vue_vue_type_script_setup_true_lang-Bq-Tb6pj.js → ActionButton.vue_vue_type_script_setup_true_lang-SWGqIOkL.js} +1 -1
- package/dist/Alert/index.js +1 -1
- package/dist/Alert/index.umd.cjs +1 -1
- package/dist/{Alert.vue_vue_type_style_index_0_lang-BC_IaSi8.js → Alert.vue_vue_type_style_index_0_lang-CgaIpUlB.js} +4 -4
- package/dist/{Alert.vue_vue_type_style_index_0_lang--7bfc5C-.js → Alert.vue_vue_type_style_index_0_lang-igQvl6PR.js} +1 -1
- package/dist/Avatar/index.js +1 -1
- package/dist/Avatar/index.umd.cjs +1 -1
- package/dist/{Avatar.vue_vue_type_style_index_0_lang-BBnmLfTi.js → Avatar.vue_vue_type_style_index_0_lang-B--X3QQp.js} +1 -1
- package/dist/{Avatar.vue_vue_type_style_index_0_lang-Dlk0AXBn.js → Avatar.vue_vue_type_style_index_0_lang-CsXvz6XE.js} +3 -3
- package/dist/AvatarGroup/index.js +1 -1
- package/dist/AvatarGroup/index.umd.cjs +1 -1
- package/dist/Badge/index.js +1 -1
- package/dist/Badge/index.umd.cjs +1 -1
- package/dist/{Badge.vue_vue_type_script_setup_true_lang-Ck0gfAPv.js → Badge.vue_vue_type_script_setup_true_lang-C6BNLMaW.js} +1 -1
- package/dist/{Badge.vue_vue_type_script_setup_true_lang-8c7akyTm.js → Badge.vue_vue_type_script_setup_true_lang-Dn33PgFw.js} +1 -1
- package/dist/{BaseBadge.vue_vue_type_style_index_0_lang-BoPWxJgb.js → BaseBadge.vue_vue_type_style_index_0_lang-BCkm3H4P.js} +2 -2
- package/dist/{BaseBadge.vue_vue_type_style_index_0_lang-Coak5m7J.js → BaseBadge.vue_vue_type_style_index_0_lang-BeAtJkbh.js} +1 -1
- package/dist/{BaseButton.vue_vue_type_style_index_0_lang-jR9htGtl.js → BaseButton.vue_vue_type_style_index_0_lang-BG8oFqnh.js} +4 -4
- package/dist/{BaseButton.vue_vue_type_style_index_0_lang-IWrQ3G21.js → BaseButton.vue_vue_type_style_index_0_lang-CDioOTsQ.js} +1 -1
- package/dist/Button/index.js +1 -1
- package/dist/Button/index.umd.cjs +1 -1
- package/dist/{Button.vue_vue_type_script_setup_true_lang-DxYAiv5-.js → Button.vue_vue_type_script_setup_true_lang-B4NQ4Dxa.js} +1 -1
- package/dist/{Button.vue_vue_type_script_setup_true_lang-w8EXhfob.js → Button.vue_vue_type_script_setup_true_lang-BCRCGuJq.js} +1 -1
- package/dist/Checkbox/index.js +1 -1
- package/dist/Checkbox/index.umd.cjs +1 -1
- package/dist/{Checkbox.vue_vue_type_style_index_0_lang-D9moel7o.js → Checkbox.vue_vue_type_style_index_0_lang-DXothnel.js} +1 -1
- package/dist/{Checkbox.vue_vue_type_style_index_0_lang-C741-uKz.js → Checkbox.vue_vue_type_style_index_0_lang-Dpzk-ikf.js} +1 -1
- package/dist/CheckboxGroup/index.js +1 -1
- package/dist/CheckboxGroup/index.umd.cjs +1 -1
- package/dist/ColorPicker/index.js +1 -1
- package/dist/ColorPicker/index.umd.cjs +1 -1
- package/dist/ColorPicker.vue_vue_type_style_index_0_lang-C7mV51Ad.js +2625 -0
- package/dist/ColorPicker.vue_vue_type_style_index_0_lang-znCqIygO.js +4 -0
- package/dist/ColorSwatch/index.js +1 -1
- package/dist/ColorSwatch/index.umd.cjs +1 -1
- package/dist/{ColorSwatch.vue_vue_type_style_index_0_lang-1YgCj4lQ.js → ColorSwatch.vue_vue_type_style_index_0_lang-03eJikYh.js} +1 -1
- package/dist/{ColorSwatch.vue_vue_type_style_index_0_lang-C_ucF_yu.js → ColorSwatch.vue_vue_type_style_index_0_lang-BmHfEa7I.js} +2 -2
- package/dist/ColorSwatchGroup/index.js +1 -1
- package/dist/ColorSwatchGroup/index.umd.cjs +1 -1
- package/dist/{ColorSwatchGroup.vue_vue_type_style_index_0_lang-BtxjxG9e.js → ColorSwatchGroup.vue_vue_type_style_index_0_lang-B77FnS5z.js} +4 -4
- package/dist/{ColorSwatchGroup.vue_vue_type_style_index_0_lang-c1ySzkyZ.js → ColorSwatchGroup.vue_vue_type_style_index_0_lang-DkF3uee8.js} +1 -1
- package/dist/ColorTrigger/index.js +1 -1
- package/dist/ColorTrigger/index.umd.cjs +1 -1
- package/dist/{ColorTrigger.vue_vue_type_style_index_0_lang-Cqjja8Kz.js → ColorTrigger.vue_vue_type_style_index_0_lang-DtSOxztA.js} +1 -1
- package/dist/{ColorTrigger.vue_vue_type_style_index_0_lang-CpboYwky.js → ColorTrigger.vue_vue_type_style_index_0_lang-Q00MQEXY.js} +3 -3
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/ConfigProvider/index.umd.cjs +1 -1
- package/dist/DataTable/index.js +1 -1
- package/dist/DataTable/index.umd.cjs +1 -1
- package/dist/{DataTable.vue_vue_type_style_index_0_lang-DMa_QFrL.js → DataTable.vue_vue_type_style_index_0_lang-wUSNbKN5.js} +9 -9
- package/dist/{DataTable.vue_vue_type_style_index_0_lang-C4_xSg7e.js → DataTable.vue_vue_type_style_index_0_lang-zj_Bkt1X.js} +1 -1
- package/dist/Empty/index.js +1 -1
- package/dist/Empty/index.umd.cjs +1 -1
- package/dist/{Empty.vue_vue_type_style_index_0_lang-Cz88kxid.js → Empty.vue_vue_type_style_index_0_lang-DIgNReMG.js} +1 -1
- package/dist/{Empty.vue_vue_type_style_index_0_lang-BCaOU35N.js → Empty.vue_vue_type_style_index_0_lang-DnbvFfFf.js} +1 -1
- package/dist/FloatButton/index.js +1 -1
- package/dist/FloatButton/index.umd.cjs +1 -1
- package/dist/{FloatButton.vue_vue_type_script_setup_true_lang-Bd4BeKfC.js → FloatButton.vue_vue_type_script_setup_true_lang-B1XPEkaM.js} +1 -1
- package/dist/{FloatButton.vue_vue_type_script_setup_true_lang-CI_ILBah.js → FloatButton.vue_vue_type_script_setup_true_lang-B_StGCXt.js} +1 -1
- package/dist/GraphicalObject/index.js +1 -1
- package/dist/GraphicalObject/index.umd.cjs +1 -1
- package/dist/{GraphicalObject.vue_vue_type_script_setup_true_lang-CnSiDVWQ.js → GraphicalObject.vue_vue_type_script_setup_true_lang-BfmGxGrs.js} +1 -1
- package/dist/{GraphicalObject.vue_vue_type_script_setup_true_lang-DI3DhvVj.js → GraphicalObject.vue_vue_type_script_setup_true_lang-CS169UvS.js} +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/Icon/index.umd.cjs +1 -1
- package/dist/{Icon.vue_vue_type_style_index_0_lang-BOEBJy1n.js → Icon.vue_vue_type_style_index_0_lang-BbOuVnaS.js} +1 -1
- package/dist/{Icon.vue_vue_type_style_index_0_lang-C00M2fnO.js → Icon.vue_vue_type_style_index_0_lang-BrV8amSh.js} +1 -1
- package/dist/IconButton/index.js +1 -1
- package/dist/IconButton/index.umd.cjs +1 -1
- package/dist/{IconButton.vue_vue_type_script_setup_true_lang-CI37BUhQ.js → IconButton.vue_vue_type_script_setup_true_lang-8SXYjPFD.js} +1 -1
- package/dist/{IconButton.vue_vue_type_script_setup_true_lang-aNYHKjEX.js → IconButton.vue_vue_type_script_setup_true_lang-BCKUoXMR.js} +1 -1
- package/dist/Image/index.js +1 -1
- package/dist/Image/index.umd.cjs +1 -1
- package/dist/{Image.vue_vue_type_style_index_0_lang-ojGZYu59.js → Image.vue_vue_type_style_index_0_lang-BCEUJNgp.js} +2 -2
- package/dist/{Image.vue_vue_type_style_index_0_lang-C4SkcHXd.js → Image.vue_vue_type_style_index_0_lang-Dl1BLT7r.js} +1 -1
- package/dist/IndentLevel/index.js +1 -1
- package/dist/IndentLevel/index.umd.cjs +1 -1
- package/dist/{IndentLevel.vue_vue_type_style_index_0_lang-kxY9UBCJ.js → IndentLevel.vue_vue_type_style_index_0_lang-B8LQPGav.js} +2 -2
- package/dist/{IndentLevel.vue_vue_type_style_index_0_lang-ClQO0x1v.js → IndentLevel.vue_vue_type_style_index_0_lang-Balon_8b.js} +1 -1
- package/dist/Indicator/index.js +1 -1
- package/dist/Indicator/index.umd.cjs +1 -1
- package/dist/{Indicator.vue_vue_type_script_setup_true_lang-CRmpJaKR.js → Indicator.vue_vue_type_script_setup_true_lang-B23gQXdq.js} +1 -1
- package/dist/{Indicator.vue_vue_type_script_setup_true_lang-BX9JOpMY.js → Indicator.vue_vue_type_script_setup_true_lang-DW3eCurT.js} +1 -1
- package/dist/Input/index.js +1 -1
- package/dist/Input/index.umd.cjs +1 -1
- package/dist/{Input.vue_vue_type_style_index_0_lang-07-tyz6h.js → Input.vue_vue_type_style_index_0_lang-B2Z-qNGX.js} +1 -1
- package/dist/{Input.vue_vue_type_style_index_0_lang-Dj4efG7U.js → Input.vue_vue_type_style_index_0_lang-Ct9RhrT6.js} +1 -1
- package/dist/Kbd/index.js +1 -1
- package/dist/Kbd/index.umd.cjs +1 -1
- package/dist/{Kbd.vue_vue_type_style_index_0_lang-DQHLesHx.js → Kbd.vue_vue_type_style_index_0_lang-BUlyDd1x.js} +1 -1
- package/dist/{Kbd.vue_vue_type_style_index_0_lang-qS65z9Bz.js → Kbd.vue_vue_type_style_index_0_lang-qT4atWnM.js} +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/Link/index.umd.cjs +1 -1
- package/dist/{Link.vue_vue_type_style_index_0_lang-ZgPgAnUp.js → Link.vue_vue_type_style_index_0_lang-C-Zg_lAq.js} +1 -1
- package/dist/{Link.vue_vue_type_style_index_0_lang-K7EUHqqW.js → Link.vue_vue_type_style_index_0_lang-CwqNtUft.js} +1 -1
- package/dist/Menu/index.js +1 -1
- package/dist/Menu/index.umd.cjs +1 -1
- package/dist/{Menu.vue_vue_type_style_index_0_lang-DsGOSTfu.js → Menu.vue_vue_type_style_index_0_lang-B4nElqHh.js} +3 -3
- package/dist/{Menu.vue_vue_type_style_index_0_lang-i1Np-1Ek.js → Menu.vue_vue_type_style_index_0_lang-DI8PfRfx.js} +1 -1
- package/dist/MenuItem/index.js +1 -1
- package/dist/MenuItem/index.umd.cjs +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/Popover/index.umd.cjs +1 -1
- package/dist/{Popover.vue_vue_type_style_index_0_lang-Bh6rugB0.js → Popover.vue_vue_type_style_index_0_lang-0M5QF6zB.js} +1 -1
- package/dist/{Popover.vue_vue_type_style_index_0_lang-By7sWU4H.js → Popover.vue_vue_type_style_index_0_lang-DexTJf-3.js} +1 -1
- package/dist/ScrollContainer/Mask.d.ts +9 -0
- package/dist/ScrollContainer/ScrollContainer.d.ts +215 -0
- package/dist/ScrollContainer/ScrollContainer.model.d.ts +2 -0
- package/dist/ScrollContainer/index.d.ts +2 -0
- package/dist/ScrollContainer/index.js +148 -0
- package/dist/ScrollContainer/index.umd.cjs +1 -0
- package/dist/Shortcut/index.js +1 -1
- package/dist/Shortcut/index.umd.cjs +1 -1
- package/dist/{Shortcut.vue_vue_type_style_index_0_lang-4v-K4pSO.js → Shortcut.vue_vue_type_style_index_0_lang-BVM8_oZn.js} +2 -2
- package/dist/{Shortcut.vue_vue_type_style_index_0_lang-ChhQV0kI.js → Shortcut.vue_vue_type_style_index_0_lang-Dnwi2zuY.js} +1 -1
- package/dist/Spinner/index.js +1 -1
- package/dist/Spinner/index.umd.cjs +1 -1
- package/dist/{Spinner.vue_vue_type_style_index_0_lang-CQL0u4nz.js → Spinner.vue_vue_type_style_index_0_lang-BxkbqSR_.js} +1 -1
- package/dist/{Spinner.vue_vue_type_style_index_0_lang-CTjUx8rR.js → Spinner.vue_vue_type_style_index_0_lang-DqDFW850.js} +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/Switch/index.umd.cjs +1 -1
- package/dist/{Switch.vue_vue_type_style_index_0_lang-KqZBQVZb.js → Switch.vue_vue_type_style_index_0_lang-D03EmiSs.js} +1 -1
- package/dist/{Switch.vue_vue_type_style_index_0_lang-X8rMBTNH.js → Switch.vue_vue_type_style_index_0_lang-EFeii6Wg.js} +1 -1
- package/dist/Tree/index.js +1 -1
- package/dist/Tree/index.umd.cjs +1 -1
- package/dist/Tree.vue_vue_type_style_index_0_lang-CYGAlGwC.js +1 -0
- package/dist/{Tree.vue_vue_type_style_index_0_lang-DT7izWYN.js → Tree.vue_vue_type_style_index_0_lang-DKH3b_ev.js} +171 -168
- package/dist/index-BfpYQmzU.js +1 -0
- package/dist/index-D_hCmLp9.js +146 -0
- package/dist/index.js +30 -30
- package/dist/index.umd.cjs +1 -1
- package/dist/style/index.css +1 -1
- package/package.json +10 -4
- package/dist/ColorPicker.vue_vue_type_style_index_0_lang-Byz3evrQ.js +0 -1
- package/dist/ColorPicker.vue_vue_type_style_index_0_lang-CGOaJvqg.js +0 -541
- package/dist/Tree.vue_vue_type_style_index_0_lang-CtQ_g29v.js +0 -1
- package/dist/index-DXzWdQsN.js +0 -137
- package/dist/index-fCdmNGB1.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pantograph/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -190,6 +190,11 @@
|
|
|
190
190
|
"import": "./dist/RadioGroup/index.js",
|
|
191
191
|
"require": "./dist/RadioGroup/index.umd.cjs"
|
|
192
192
|
},
|
|
193
|
+
"./ScrollContainer": {
|
|
194
|
+
"types": "./dist/ScrollContainer/index.d.ts",
|
|
195
|
+
"import": "./dist/ScrollContainer/index.js",
|
|
196
|
+
"require": "./dist/ScrollContainer/index.umd.cjs"
|
|
197
|
+
},
|
|
193
198
|
"./Shortcut": {
|
|
194
199
|
"types": "./dist/Shortcut/index.d.ts",
|
|
195
200
|
"import": "./dist/Shortcut/index.js",
|
|
@@ -237,8 +242,8 @@
|
|
|
237
242
|
"dependencies": {
|
|
238
243
|
"@faker-js/faker": "^9.5.0",
|
|
239
244
|
"@iconify/vue": "^4.3.0",
|
|
240
|
-
"@pantograph/tokens": "^0.0.
|
|
241
|
-
"@pantograph/utils": "^0.0.
|
|
245
|
+
"@pantograph/tokens": "^0.0.18",
|
|
246
|
+
"@pantograph/utils": "^0.0.8",
|
|
242
247
|
"@tanstack/vue-table": "^8.21.2",
|
|
243
248
|
"@types/lodash-es": "^4.17.12",
|
|
244
249
|
"@types/sortablejs": "^1.15.8",
|
|
@@ -251,7 +256,8 @@
|
|
|
251
256
|
"vue-tippy": "^6.6.0"
|
|
252
257
|
},
|
|
253
258
|
"peerDependencies": {
|
|
254
|
-
"vue": "^3.5.13"
|
|
259
|
+
"vue": "^3.5.13",
|
|
260
|
+
"nuxt": "^3.0.0"
|
|
255
261
|
},
|
|
256
262
|
"devDependencies": {
|
|
257
263
|
"@histoire/plugin-vue": "0.17.17",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("vue"),ae=require("./ActionButton.vue_vue_type_script_setup_true_lang-Bq-Tb6pj.js"),U=require("./Input.vue_vue_type_style_index_0_lang-Dj4efG7U.js"),ie=require("./Icon.vue_vue_type_style_index_0_lang-C00M2fnO.js"),j=require("@vueuse/core"),x=require("@pantograph/utils"),fe=require("radix-vue");function A(e,t,r){return Math.max(t,Math.min(e,r))}function me(e,t){if(typeof e=="string"||typeof t=="string")return e===t;if(e){if(!t)return!1;for(const r in e)if(e[r]!==t[r])return!1}return!0}function H(e){const t=[],r=e.length>5?2:1;for(let n=1;n<e.length;n+=r){const c=e.substring(n,n+r).repeat(r%2+1),a=parseInt(c,16);t.push(n===3*r+1?a/255:a)}return t.length===3&&t.push(1),{r:t[0],g:t[1],b:t[2],a:t[3]}}function J(e){const t=e.l/100,r=t+e.s/100*Math.min(t,1-t),n=r===0?0:200*(1-t/r);return{h:e.h,s:n,v:r*100,a:e.a}}function L(e){let t=e.h%360;t<0&&(t+=360);const r=e.s/100,n=e.l/100;return{r:$(0,t,r,n)*255,g:$(8,t,r,n)*255,b:$(4,t,r,n)*255,a:e.a}}function $(e,t,r,n){const c=(e+t/30)%12,a=r*Math.min(n,1-n);return n-a*Math.max(-1,Math.min(c-3,9-c,1))}function Q(e){const t=e.s/100,r=e.v/100,n=r*(1-t/2);return{h:e.h,s:n===0||n===1?0:(r-n)/Math.min(n,1-n)*100,l:n*100,a:e.a}}function Z(e){return{h:e.h,w:e.v*(100-e.s)/100,b:100-e.v,a:e.a}}function N(e){return L(Q(e))}function k(e){const t=e.w/100,r=e.b/100;let n,c;const a=t+r;return a>=1?(n=0,c=t/a):(c=1-r,n=(1-t/c)*100),{h:e.h,s:n,v:c*100,a:e.a}}function I(e){const{r:t,g:r,b:n,a:c}=e,a=Math.min(t,r,n),h=Math.max(t,r,n),m=h-a,d=(h+a)/2;let v=0;m!==0&&(h===t?v=(r-n)/m+(r<n?6:0):h===r?v=(n-t)/m+2:h===n&&(v=(t-r)/m+4),v*=60);let b=0;return d!==0&&d!==255&&(b=(h-d)/Math.min(d,255-d)),{h:v,s:b*100,l:d/255*100,a:c}}function S(e){return"#"+Object.values(e).map((t,r)=>Math.round(r===3?t*255:t).toString(16).padStart(2,"0")).join("")}function M(e){return Z(J(I(e)))}const he={hex:{hex:e=>e,hsl:e=>I(H(e)),hsv:e=>k(M(H(e))),hwb:e=>M(H(e)),rgb:H},hsl:{hex:e=>S(L(e)),hsl:e=>e,hsv:J,hwb:e=>M(L(e)),rgb:L},hsv:{hex:e=>S(N(e)),hsl:Q,hsv:e=>e,hwb:Z,rgb:N},hwb:{hex:e=>S(N(k(e))),hsl:e=>I(N(k(e))),hsv:k,hwb:e=>e,rgb:e=>N(k(e))},rgb:{hex:S,hsl:I,hsv:e=>k(M(e)),hwb:M,rgb:e=>e}};function Y(e,t,r){return he[e][t](r)}function de(e,t){const r=e.toFixed(t);return r.includes(".")?r.replace(/\.?0+$/,""):r}const pe={deg:1,grad:.9,rad:180/Math.PI,turn:360},R={from(e){return e.endsWith("%")?E.from(e,{referenceValue:1}):y.from(e,{min:0,max:1})},to(e){return y.to(e)}},K={from(e){const t=e.match(/deg|g?rad|turn$/);if(t===null)return y.from(e);const r=t[0];return y.from(e.slice(0,-r.length))*pe[r]},to(e){return y.to(e)}},y={from(e,{min:t=Number.NEGATIVE_INFINITY,max:r=Number.POSITIVE_INFINITY}={}){return e.endsWith(".")?NaN:A(Number(e),t,r)},to(e){return de(e,2)}},E={from(e,{referenceValue:t=100,min:r=0,max:n=100}={}){return e.endsWith("%")?y.from(e.slice(0,-1),{min:r,max:n})*t/100:NaN},to(e){return y.to(e)+"%"}},z={from(e){return e.endsWith("%")?E.from(e,{referenceValue:255}):y.from(e,{min:0,max:255})},to(e){return y.to(e)}},ve={hsl:{h:K,s:E,l:E},hwb:{h:K,w:E,b:E},rgb:{r:z,g:z,b:z}};function F(e,t){return ve[e][t]}function O({format:e,color:t},r){if(e==="hex")return r&&[5,9].includes(t.length)?t.substring(0,t.length-(t.length-1)/4):t;const n=Object.entries(t).slice(0,r?3:4).map(([c,a])=>{const h=c==="a"?R:F(e,c);return(c==="a"?"/ ":"")+h.to(a)});return`${e}(${n.join(" ")})`}function ee(e){return/^#(?:(?:[A-F0-9]{2}){3,4}|[A-F0-9]{3,4})$/i.test(e)}function ge(e){return"r"in e?"rgb":"w"in e?"hwb":"v"in e?"hsv":"s"in e?"hsl":null}const G={hsl:["h","s","l","a"],hwb:["h","w","b","a"],rgb:["r","g","b","a"]};function X(e){if(!e)return null;if(typeof e!="string"){const m=ge(e);return m===null?null:{format:m,color:e}}if(e.startsWith("#"))return ee(e)?{format:"hex",color:e}:null;if(!e.includes("(")){const m=document.createElement("canvas").getContext("2d");m.fillStyle=e;const d=m.fillStyle;return d==="#000000"&&e!=="black"?null:{format:"hex",color:d}}const[t,r]=e.split("("),n=t.substring(0,3);if(!(n in G))return null;const c=r.replace(/[,/)]/g," ").replace(/\s+/g," ").trim().split(" ");c.length===3&&c.push("1");const a=G[n],h=Object.fromEntries(a.map((m,d)=>{const v=m==="a"?R:F(n,m);return[m,v.from(c[d])]}));return{format:n,color:h}}const be=typeof window<"u",te=be&&"EyeDropper"in window,we=e=>{const t=new AbortController;o.onUnmounted(()=>t.abort());async function r(){if(!te)return;const n=new window.EyeDropper;try{let a=(await n.open({signal:t.signal})).sRGBHex;if(a.startsWith("rgba")){const h=a.match(/rgba?\((?<r>\d+), (?<g>\d+), (?<b>\d+), (?<a>[\d.]+)\)/);if(h){const[m,d,v,b,i]=h;a=`rgba(${d}, ${v}, ${b}, ${parseFloat(i)===0?"1":i})`}}e(a)}catch(c){console.log("e ===>",c)}}return{openEyeDropper:r,abortController:t}};function ye(e,t,r){const n=e.getBoundingClientRect(),c=t-n.left,a=r-n.top;return{x:n.width===0?0:A(c/n.width*100,0,100),y:n.height===0?0:A((1-a/n.height)*100,0,100)}}const xe=o.defineComponent({__name:"ColorPickerSpace",setup(e){const t=ne();let r=!1,n;function c(i){n=document.body.style.userSelect,document.body.style.userSelect="none",r=!0,m(i)}function a(i){r=!0,d(i)}function h(){document.body.style.userSelect=n,r=!1}function m(i){i.buttons!==1||!r||!(t.colorSpace.value instanceof HTMLElement)||v(t.colorSpace.value,i.clientX,i.clientY)}function d(i){if(!r||!(t.colorSpace.value instanceof HTMLElement))return;i.preventDefault();const g=i.touches[0];v(t.colorSpace.value,g.clientX,g.clientY)}function v(i,g,_){const C=ye(i,g,_),f={...t.colors.hsv};f.s=C.x,f.v=C.y,t.setColor("hsv",f)}function b(i){if(!["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(i.key))return;i.preventDefault();const g=["ArrowLeft","ArrowDown"].includes(i.key)?-1:1,_=["ArrowLeft","ArrowRight"].includes(i.key)?"s":"v",C=i.shiftKey?10:1,f=t.colors.hsv[_]+g*C,w={...t.colors.hsv};w[_]=A(f,0,100),t.setColor("hsv",w)}return o.onMounted(()=>{document.addEventListener("mousemove",m,{passive:!1}),document.addEventListener("touchmove",d,{passive:!1}),document.addEventListener("mouseup",h),document.addEventListener("touchend",h)}),o.onBeforeUnmount(()=>{document.removeEventListener("mousemove",m),document.removeEventListener("touchmove",d),document.removeEventListener("mouseup",h),document.removeEventListener("touchend",h)}),(i,g)=>(o.openBlock(),o.createElementBlock("div",{ref:o.unref(t).colorSpace,class:o.normalizeClass([o.unref(x.getBemElement)(o.unref(V),"space")]),onMousedown:c,onTouchstart:a},[o.createElementVNode("button",{ref:o.unref(t).thumb,class:o.normalizeClass([o.unref(x.getBemElement)(o.unref(V),"thumb")]),tabindex:"0","aria-label":"Color space thumb",onKeydown:b},null,34)],34))}}),Ce=["value"],_e=["value"],[ne,oe]=fe.createContext("ColorPicker"),V=x.getBemBlock("color_picker"),ke=o.defineComponent({__name:"ColorPicker",props:{class:{},color:{},defaultColor:{default:"#ffffffff"},format:{},defaultFormat:{default:"hex"},hideAlpha:{type:Boolean}},emits:["update:color","update:format","change"],setup(e,{emit:t}){const r=["hex","hsl","hsv","hwb","rgb"],n=e,c=t,a=o.ref(null),h=o.ref(null),m=o.ref(null),d=j.useVModel(n,"format",c,{defaultValue:n.defaultFormat,passive:n.format===void 0}),v=o.computed(()=>d.value&&r.includes(d.value)?d.value:"hex"),b=j.useVModel(n,"color",c,{defaultValue:n.defaultColor,passive:n.color===void 0}),i="#ffffffff",g=o.computed(()=>b.value??n.defaultColor??i);o.watch(g,D);const _=o.computed(()=>{const u=v.value,s=f[u];return u.split("").map(l=>{const p=s[l];return{value:F(u,l).to(p),channel:l,label:l.toUpperCase()}}).concat(n.hideAlpha?[]:[{value:R.to(s.a),channel:"a",label:"Alpha"}])}),C=o.computed({get(){return n.hideAlpha&&[5,9].includes(f.hex.length)?f.hex.substring(0,f.hex.length-(f.hex.length-1)/4):f.hex},set(u){ee(u)&&w("hex",u)}}),f=o.reactive({hex:i,hsl:{h:0,s:0,l:100,a:1},hsv:{h:0,s:0,v:100,a:1},hwb:{h:0,w:100,b:0,a:1},rgb:{r:255,g:255,b:255,a:1}});function w(u,s){let l=s;if(n.hideAlpha)if(typeof s!="string")s.a=1,l=s;else if([5,9].includes(s.length)){const p=(s.length-1)/4;l=s.substring(0,s.length-p)+"f".repeat(p)}else[4,7].includes(s.length)&&(l=s+"f".repeat((s.length-1)/3));if(!me(f[u],l)){f[u]=l;for(const p of r)p!==u&&(f[p]=Y(u,p,l));b.value=O({color:Y(u,v.value,l),format:v.value},n.hideAlpha),c("change",ue())}a.value instanceof HTMLElement&&h.value instanceof HTMLElement&&m.value instanceof HTMLElement&&le(a.value,h.value,m.value)}function D(u){const s=X(u);if(s!==null)w(s.format,s.color);else{const l=X(i);l!==null&&w(l.format,l.color)}}function re(u){d.value=u}function W(u,s){const l=u.currentTarget,p={...f.hsv};p[s]=Number(l.value),w("hsv",p)}function se(u,s){const l=v.value,p={...f[l]},P=(s==="a"?R:F(l,s)).from(u);Number.isNaN(u)||u===void 0||(p[s]=P,w(l,p))}function le(u,s,l){const p=O({format:"hsl",color:f.hsl},!0);u.style.setProperty("--vacp-color",p),s.style.position="relative",s.style.backgroundColor=`hsl(${f.hsl.h} 100% 50%)`,s.style.backgroundImage="linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent)",l.style.boxSizing="border-box",l.style.position="absolute",l.style.left=`${f.hsv.s}%`,l.style.bottom=`${f.hsv.v}%`}function ue(){const u=O({color:f[v.value],format:v.value},n.hideAlpha);return{colors:f,cssColor:u}}function q(u){if(!["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"].includes(u.key)||!u.shiftKey)return;const s=u.currentTarget,l=Number(s.step),p=["ArrowLeft","ArrowDown"].includes(u.key)?-1:1,T=Number(s.value)+p*l*10,P=A(T,Number(s.min),Number(s.max));s.value=String(P-p*l)}const{openEyeDropper:ce}=we(D);o.onMounted(()=>D(g.value)),oe({colorSpace:h,thumb:m,colors:f,setColor:w});const B=x.getBemElement(V,"slider");return(u,s)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"colorPicker",ref:a,class:o.normalizeClass([o.unref(V),n.class])},[o.createVNode(xe),o.createElementVNode("div",{class:o.normalizeClass(o.unref(x.getBemElement)(o.unref(V),"sliders"))},[o.createElementVNode("input",{class:o.normalizeClass([o.unref(B),o.unref(x.getBemModifier)(o.unref(B),"hue")]),value:f.hsv.h,type:"range",min:"0",max:"360",step:"1",onKeydownPassive:q,onInput:s[0]||(s[0]=l=>W(l,"h"))},null,42,Ce),u.hideAlpha?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("input",{key:0,class:o.normalizeClass([o.unref(B),o.unref(x.getBemModifier)(o.unref(B),"alpha")]),value:f.hsv.a,type:"range",min:"0",max:"1",step:"0.01",onKeydownPassive:q,onInput:s[1]||(s[1]=l=>W(l,"a"))},null,42,_e))],2),o.createElementVNode("div",{class:o.normalizeClass(o.unref(x.getBemElement)(o.unref(V),"inputs"))},[o.createElementVNode("button",{disabled:!0,class:"fake-select",onClick:s[2]||(s[2]=l=>re("rgb"))},[s[4]||(s[4]=o.createElementVNode("div",null,"Hex",-1)),o.createVNode(ie._sfc_main,{icon:"tabler:chevron-down",size:"2xsm",class:"fake-select-icon"})]),v.value==="hex"?(o.openBlock(),o.createBlock(U._sfc_main,{key:0,class:"flex-1",size:"sm",modelValue:C.value,"onUpdate:modelValue":s[3]||(s[3]=l=>C.value=l)},null,8,["modelValue"])):(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:1},o.renderList(_.value,({value:l,channel:p})=>(o.openBlock(),o.createBlock(U._sfc_main,{modelValue:l,"onUpdate:modelValue":T=>se(T,p),size:"sm"},null,8,["modelValue","onUpdate:modelValue"]))),256)),o.unref(te)?(o.openBlock(),o.createBlock(ae._sfc_main,{key:2,onClick:o.unref(ce),icon:"tabler:color-picker",size:"sm",type:"outline",variant:"icon"},null,8,["onClick"])):o.createCommentVNode("",!0)],2)],2))}});exports._sfc_main=ke;exports.injectColorPickerContext=ne;exports.provideColorPickerContext=oe;
|
|
@@ -1,541 +0,0 @@
|
|
|
1
|
-
import { onUnmounted as we, defineComponent as ue, onMounted as ae, onBeforeUnmount as ye, createElementBlock as D, openBlock as C, normalizeClass as T, unref as v, createElementVNode as E, ref as j, computed as R, watch as xe, reactive as Ce, createVNode as Q, createCommentVNode as Z, createBlock as Y, Fragment as Te, renderList as Ve } from "vue";
|
|
2
|
-
import { _ as ke } from "./ActionButton.vue_vue_type_script_setup_true_lang-DaeklrrN.js";
|
|
3
|
-
import { _ as ee } from "./Input.vue_vue_type_style_index_0_lang-07-tyz6h.js";
|
|
4
|
-
import { _ as Ee } from "./Icon.vue_vue_type_style_index_0_lang-BOEBJy1n.js";
|
|
5
|
-
import { useVModel as te } from "@vueuse/core";
|
|
6
|
-
import { getBemElement as P, getBemBlock as Me, getBemModifier as ne } from "@pantograph/utils";
|
|
7
|
-
import { createContext as _e } from "radix-vue";
|
|
8
|
-
function S(e, t, o) {
|
|
9
|
-
return Math.max(t, Math.min(e, o));
|
|
10
|
-
}
|
|
11
|
-
function Ae(e, t) {
|
|
12
|
-
if (typeof e == "string" || typeof t == "string")
|
|
13
|
-
return e === t;
|
|
14
|
-
if (e) {
|
|
15
|
-
if (!t) return !1;
|
|
16
|
-
for (const o in e)
|
|
17
|
-
if (e[o] !== t[o])
|
|
18
|
-
return !1;
|
|
19
|
-
}
|
|
20
|
-
return !0;
|
|
21
|
-
}
|
|
22
|
-
function F(e) {
|
|
23
|
-
const t = [], o = e.length > 5 ? 2 : 1;
|
|
24
|
-
for (let n = 1; n < e.length; n += o) {
|
|
25
|
-
const u = e.substring(n, n + o).repeat(o % 2 + 1), a = parseInt(u, 16);
|
|
26
|
-
t.push(n === 3 * o + 1 ? a / 255 : a);
|
|
27
|
-
}
|
|
28
|
-
return t.length === 3 && t.push(1), {
|
|
29
|
-
r: t[0],
|
|
30
|
-
g: t[1],
|
|
31
|
-
b: t[2],
|
|
32
|
-
a: t[3]
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function ie(e) {
|
|
36
|
-
const t = e.l / 100, o = t + e.s / 100 * Math.min(t, 1 - t), n = o === 0 ? 0 : 200 * (1 - t / o);
|
|
37
|
-
return {
|
|
38
|
-
h: e.h,
|
|
39
|
-
s: n,
|
|
40
|
-
v: o * 100,
|
|
41
|
-
a: e.a
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function O(e) {
|
|
45
|
-
let t = e.h % 360;
|
|
46
|
-
t < 0 && (t += 360);
|
|
47
|
-
const o = e.s / 100, n = e.l / 100;
|
|
48
|
-
return {
|
|
49
|
-
r: K(0, t, o, n) * 255,
|
|
50
|
-
g: K(8, t, o, n) * 255,
|
|
51
|
-
b: K(4, t, o, n) * 255,
|
|
52
|
-
a: e.a
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function K(e, t, o, n) {
|
|
56
|
-
const u = (e + t / 30) % 12, a = o * Math.min(n, 1 - n);
|
|
57
|
-
return n - a * Math.max(-1, Math.min(u - 3, 9 - u, 1));
|
|
58
|
-
}
|
|
59
|
-
function ce(e) {
|
|
60
|
-
const t = e.s / 100, o = e.v / 100, n = o * (1 - t / 2);
|
|
61
|
-
return {
|
|
62
|
-
h: e.h,
|
|
63
|
-
s: n === 0 || n === 1 ? 0 : (o - n) / Math.min(n, 1 - n) * 100,
|
|
64
|
-
l: n * 100,
|
|
65
|
-
a: e.a
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function fe(e) {
|
|
69
|
-
return {
|
|
70
|
-
h: e.h,
|
|
71
|
-
w: e.v * (100 - e.s) / 100,
|
|
72
|
-
b: 100 - e.v,
|
|
73
|
-
a: e.a
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
function N(e) {
|
|
77
|
-
return O(ce(e));
|
|
78
|
-
}
|
|
79
|
-
function k(e) {
|
|
80
|
-
const t = e.w / 100, o = e.b / 100;
|
|
81
|
-
let n, u;
|
|
82
|
-
const a = t + o;
|
|
83
|
-
return a >= 1 ? (n = 0, u = t / a) : (u = 1 - o, n = (1 - t / u) * 100), {
|
|
84
|
-
h: e.h,
|
|
85
|
-
s: n,
|
|
86
|
-
v: u * 100,
|
|
87
|
-
a: e.a
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
function W(e) {
|
|
91
|
-
const { r: t, g: o, b: n, a: u } = e, a = Math.min(t, o, n), m = Math.max(t, o, n), f = m - a, h = (m + a) / 2;
|
|
92
|
-
let p = 0;
|
|
93
|
-
f !== 0 && (m === t ? p = (o - n) / f + (o < n ? 6 : 0) : m === o ? p = (n - t) / f + 2 : m === n && (p = (t - o) / f + 4), p *= 60);
|
|
94
|
-
let b = 0;
|
|
95
|
-
return h !== 0 && h !== 255 && (b = (m - h) / Math.min(h, 255 - h)), {
|
|
96
|
-
h: p,
|
|
97
|
-
s: b * 100,
|
|
98
|
-
l: h / 255 * 100,
|
|
99
|
-
a: u
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function $(e) {
|
|
103
|
-
return "#" + Object.values(e).map(
|
|
104
|
-
(t, o) => Math.round(o === 3 ? t * 255 : t).toString(16).padStart(2, "0")
|
|
105
|
-
).join("");
|
|
106
|
-
}
|
|
107
|
-
function H(e) {
|
|
108
|
-
return fe(ie(W(e)));
|
|
109
|
-
}
|
|
110
|
-
const Ne = {
|
|
111
|
-
hex: {
|
|
112
|
-
hex: (e) => e,
|
|
113
|
-
hsl: (e) => W(F(e)),
|
|
114
|
-
hsv: (e) => k(H(F(e))),
|
|
115
|
-
hwb: (e) => H(F(e)),
|
|
116
|
-
rgb: F
|
|
117
|
-
},
|
|
118
|
-
hsl: {
|
|
119
|
-
hex: (e) => $(O(e)),
|
|
120
|
-
hsl: (e) => e,
|
|
121
|
-
hsv: ie,
|
|
122
|
-
hwb: (e) => H(O(e)),
|
|
123
|
-
rgb: O
|
|
124
|
-
},
|
|
125
|
-
hsv: {
|
|
126
|
-
hex: (e) => $(N(e)),
|
|
127
|
-
hsl: ce,
|
|
128
|
-
hsv: (e) => e,
|
|
129
|
-
hwb: fe,
|
|
130
|
-
rgb: N
|
|
131
|
-
},
|
|
132
|
-
hwb: {
|
|
133
|
-
hex: (e) => $(N(k(e))),
|
|
134
|
-
hsl: (e) => W(N(k(e))),
|
|
135
|
-
hsv: k,
|
|
136
|
-
hwb: (e) => e,
|
|
137
|
-
rgb: (e) => N(k(e))
|
|
138
|
-
},
|
|
139
|
-
rgb: {
|
|
140
|
-
hex: $,
|
|
141
|
-
hsl: W,
|
|
142
|
-
hsv: (e) => k(H(e)),
|
|
143
|
-
hwb: H,
|
|
144
|
-
rgb: (e) => e
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
function oe(e, t, o) {
|
|
148
|
-
return Ne[e][t](o);
|
|
149
|
-
}
|
|
150
|
-
function He(e, t) {
|
|
151
|
-
const o = e.toFixed(t);
|
|
152
|
-
return o.includes(".") ? o.replace(/\.?0+$/, "") : o;
|
|
153
|
-
}
|
|
154
|
-
const Pe = {
|
|
155
|
-
deg: 1,
|
|
156
|
-
grad: 0.9,
|
|
157
|
-
rad: 180 / Math.PI,
|
|
158
|
-
turn: 360
|
|
159
|
-
}, B = {
|
|
160
|
-
from(e) {
|
|
161
|
-
return e.endsWith("%") ? M.from(e, { referenceValue: 1 }) : y.from(e, { min: 0, max: 1 });
|
|
162
|
-
},
|
|
163
|
-
to(e) {
|
|
164
|
-
return y.to(e);
|
|
165
|
-
}
|
|
166
|
-
}, re = {
|
|
167
|
-
from(e) {
|
|
168
|
-
const t = e.match(/deg|g?rad|turn$/);
|
|
169
|
-
if (t === null)
|
|
170
|
-
return y.from(e);
|
|
171
|
-
const o = t[0];
|
|
172
|
-
return y.from(e.slice(0, -o.length)) * Pe[o];
|
|
173
|
-
},
|
|
174
|
-
to(e) {
|
|
175
|
-
return y.to(e);
|
|
176
|
-
}
|
|
177
|
-
}, y = {
|
|
178
|
-
from(e, { min: t = Number.NEGATIVE_INFINITY, max: o = Number.POSITIVE_INFINITY } = {}) {
|
|
179
|
-
return e.endsWith(".") ? NaN : S(Number(e), t, o);
|
|
180
|
-
},
|
|
181
|
-
to(e) {
|
|
182
|
-
return He(e, 2);
|
|
183
|
-
}
|
|
184
|
-
}, M = {
|
|
185
|
-
from(e, { referenceValue: t = 100, min: o = 0, max: n = 100 } = {}) {
|
|
186
|
-
return e.endsWith("%") ? y.from(e.slice(0, -1), { min: o, max: n }) * t / 100 : NaN;
|
|
187
|
-
},
|
|
188
|
-
to(e) {
|
|
189
|
-
return y.to(e) + "%";
|
|
190
|
-
}
|
|
191
|
-
}, q = {
|
|
192
|
-
from(e) {
|
|
193
|
-
return e.endsWith("%") ? M.from(e, { referenceValue: 255 }) : y.from(e, { min: 0, max: 255 });
|
|
194
|
-
},
|
|
195
|
-
to(e) {
|
|
196
|
-
return y.to(e);
|
|
197
|
-
}
|
|
198
|
-
}, Se = {
|
|
199
|
-
hsl: {
|
|
200
|
-
h: re,
|
|
201
|
-
s: M,
|
|
202
|
-
l: M
|
|
203
|
-
},
|
|
204
|
-
hwb: {
|
|
205
|
-
h: re,
|
|
206
|
-
w: M,
|
|
207
|
-
b: M
|
|
208
|
-
},
|
|
209
|
-
rgb: {
|
|
210
|
-
r: q,
|
|
211
|
-
g: q,
|
|
212
|
-
b: q
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
function U(e, t) {
|
|
216
|
-
return Se[e][t];
|
|
217
|
-
}
|
|
218
|
-
function G({ format: e, color: t }, o) {
|
|
219
|
-
if (e === "hex")
|
|
220
|
-
return o && [5, 9].includes(t.length) ? t.substring(0, t.length - (t.length - 1) / 4) : t;
|
|
221
|
-
const n = Object.entries(t).slice(0, o ? 3 : 4).map(([u, a]) => {
|
|
222
|
-
const m = u === "a" ? B : U(e, u);
|
|
223
|
-
return (u === "a" ? "/ " : "") + m.to(a);
|
|
224
|
-
});
|
|
225
|
-
return `${e}(${n.join(" ")})`;
|
|
226
|
-
}
|
|
227
|
-
function me(e) {
|
|
228
|
-
return /^#(?:(?:[A-F0-9]{2}){3,4}|[A-F0-9]{3,4})$/i.test(e);
|
|
229
|
-
}
|
|
230
|
-
function Le(e) {
|
|
231
|
-
return "r" in e ? "rgb" : "w" in e ? "hwb" : "v" in e ? "hsv" : "s" in e ? "hsl" : null;
|
|
232
|
-
}
|
|
233
|
-
const se = {
|
|
234
|
-
hsl: ["h", "s", "l", "a"],
|
|
235
|
-
hwb: ["h", "w", "b", "a"],
|
|
236
|
-
rgb: ["r", "g", "b", "a"]
|
|
237
|
-
};
|
|
238
|
-
function le(e) {
|
|
239
|
-
if (!e) return null;
|
|
240
|
-
if (typeof e != "string") {
|
|
241
|
-
const f = Le(e);
|
|
242
|
-
return f === null ? null : { format: f, color: e };
|
|
243
|
-
}
|
|
244
|
-
if (e.startsWith("#"))
|
|
245
|
-
return me(e) ? { format: "hex", color: e } : null;
|
|
246
|
-
if (!e.includes("(")) {
|
|
247
|
-
const f = document.createElement("canvas").getContext("2d");
|
|
248
|
-
f.fillStyle = e;
|
|
249
|
-
const h = f.fillStyle;
|
|
250
|
-
return h === "#000000" && e !== "black" ? null : { format: "hex", color: h };
|
|
251
|
-
}
|
|
252
|
-
const [t, o] = e.split("("), n = t.substring(0, 3);
|
|
253
|
-
if (!(n in se))
|
|
254
|
-
return null;
|
|
255
|
-
const u = o.replace(/[,/)]/g, " ").replace(/\s+/g, " ").trim().split(" ");
|
|
256
|
-
u.length === 3 && u.push("1");
|
|
257
|
-
const a = se[n], m = Object.fromEntries(
|
|
258
|
-
a.map((f, h) => {
|
|
259
|
-
const p = f === "a" ? B : U(n, f);
|
|
260
|
-
return [f, p.from(u[h])];
|
|
261
|
-
})
|
|
262
|
-
);
|
|
263
|
-
return { format: n, color: m };
|
|
264
|
-
}
|
|
265
|
-
const Ie = typeof window < "u", he = Ie && "EyeDropper" in window, Re = (e) => {
|
|
266
|
-
const t = new AbortController();
|
|
267
|
-
we(() => t.abort());
|
|
268
|
-
async function o() {
|
|
269
|
-
if (!he) return;
|
|
270
|
-
const n = new window.EyeDropper();
|
|
271
|
-
try {
|
|
272
|
-
let a = (await n.open({ signal: t.signal })).sRGBHex;
|
|
273
|
-
if (a.startsWith("rgba")) {
|
|
274
|
-
const m = a.match(/rgba?\((?<r>\d+), (?<g>\d+), (?<b>\d+), (?<a>[\d.]+)\)/);
|
|
275
|
-
if (m) {
|
|
276
|
-
const [f, h, p, b, i] = m;
|
|
277
|
-
a = `rgba(${h}, ${p}, ${b}, ${parseFloat(i) === 0 ? "1" : i})`;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
e(a);
|
|
281
|
-
} catch (u) {
|
|
282
|
-
console.log("e ===>", u);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return {
|
|
286
|
-
openEyeDropper: o,
|
|
287
|
-
abortController: t
|
|
288
|
-
};
|
|
289
|
-
};
|
|
290
|
-
function Fe(e, t, o) {
|
|
291
|
-
const n = e.getBoundingClientRect(), u = t - n.left, a = o - n.top;
|
|
292
|
-
return {
|
|
293
|
-
x: n.width === 0 ? 0 : S(u / n.width * 100, 0, 100),
|
|
294
|
-
y: n.height === 0 ? 0 : S((1 - a / n.height) * 100, 0, 100)
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
const $e = /* @__PURE__ */ ue({
|
|
298
|
-
__name: "ColorPickerSpace",
|
|
299
|
-
setup(e) {
|
|
300
|
-
const t = We();
|
|
301
|
-
let o = !1, n;
|
|
302
|
-
function u(i) {
|
|
303
|
-
n = document.body.style.userSelect, document.body.style.userSelect = "none", o = !0, f(i);
|
|
304
|
-
}
|
|
305
|
-
function a(i) {
|
|
306
|
-
o = !0, h(i);
|
|
307
|
-
}
|
|
308
|
-
function m() {
|
|
309
|
-
document.body.style.userSelect = n, o = !1;
|
|
310
|
-
}
|
|
311
|
-
function f(i) {
|
|
312
|
-
i.buttons !== 1 || !o || !(t.colorSpace.value instanceof HTMLElement) || p(t.colorSpace.value, i.clientX, i.clientY);
|
|
313
|
-
}
|
|
314
|
-
function h(i) {
|
|
315
|
-
if (!o || !(t.colorSpace.value instanceof HTMLElement))
|
|
316
|
-
return;
|
|
317
|
-
i.preventDefault();
|
|
318
|
-
const g = i.touches[0];
|
|
319
|
-
p(t.colorSpace.value, g.clientX, g.clientY);
|
|
320
|
-
}
|
|
321
|
-
function p(i, g, V) {
|
|
322
|
-
const x = Fe(i, g, V), c = { ...t.colors.hsv };
|
|
323
|
-
c.s = x.x, c.v = x.y, t.setColor("hsv", c);
|
|
324
|
-
}
|
|
325
|
-
function b(i) {
|
|
326
|
-
if (!["ArrowUp", "ArrowRight", "ArrowDown", "ArrowLeft"].includes(i.key))
|
|
327
|
-
return;
|
|
328
|
-
i.preventDefault();
|
|
329
|
-
const g = ["ArrowLeft", "ArrowDown"].includes(i.key) ? -1 : 1, V = ["ArrowLeft", "ArrowRight"].includes(i.key) ? "s" : "v", x = i.shiftKey ? 10 : 1, c = t.colors.hsv[V] + g * x, w = { ...t.colors.hsv };
|
|
330
|
-
w[V] = S(c, 0, 100), t.setColor("hsv", w);
|
|
331
|
-
}
|
|
332
|
-
return ae(() => {
|
|
333
|
-
document.addEventListener("mousemove", f, { passive: !1 }), document.addEventListener("touchmove", h, { passive: !1 }), document.addEventListener("mouseup", m), document.addEventListener("touchend", m);
|
|
334
|
-
}), ye(() => {
|
|
335
|
-
document.removeEventListener("mousemove", f), document.removeEventListener("touchmove", h), document.removeEventListener("mouseup", m), document.removeEventListener("touchend", m);
|
|
336
|
-
}), (i, g) => (C(), D("div", {
|
|
337
|
-
ref: v(t).colorSpace,
|
|
338
|
-
class: T([v(P)(v(_), "space")]),
|
|
339
|
-
onMousedown: u,
|
|
340
|
-
onTouchstart: a
|
|
341
|
-
}, [
|
|
342
|
-
E("button", {
|
|
343
|
-
ref: v(t).thumb,
|
|
344
|
-
class: T([v(P)(v(_), "thumb")]),
|
|
345
|
-
tabindex: "0",
|
|
346
|
-
"aria-label": "Color space thumb",
|
|
347
|
-
onKeydown: b
|
|
348
|
-
}, null, 34)
|
|
349
|
-
], 34));
|
|
350
|
-
}
|
|
351
|
-
}), De = ["value"], Oe = ["value"], [We, Be] = _e("ColorPicker"), _ = Me("color_picker"), Xe = /* @__PURE__ */ ue({
|
|
352
|
-
__name: "ColorPicker",
|
|
353
|
-
props: {
|
|
354
|
-
class: {},
|
|
355
|
-
color: {},
|
|
356
|
-
defaultColor: { default: "#ffffffff" },
|
|
357
|
-
format: {},
|
|
358
|
-
defaultFormat: { default: "hex" },
|
|
359
|
-
hideAlpha: { type: Boolean }
|
|
360
|
-
},
|
|
361
|
-
emits: ["update:color", "update:format", "change"],
|
|
362
|
-
setup(e, { emit: t }) {
|
|
363
|
-
const o = ["hex", "hsl", "hsv", "hwb", "rgb"], n = e, u = t, a = j(null), m = j(null), f = j(null), h = te(n, "format", u, {
|
|
364
|
-
defaultValue: n.defaultFormat,
|
|
365
|
-
passive: n.format === void 0
|
|
366
|
-
}), p = R(
|
|
367
|
-
() => h.value && o.includes(h.value) ? h.value : "hex"
|
|
368
|
-
), b = te(n, "color", u, {
|
|
369
|
-
defaultValue: n.defaultColor,
|
|
370
|
-
passive: n.color === void 0
|
|
371
|
-
}), i = "#ffffffff", g = R(() => b.value ?? n.defaultColor ?? i);
|
|
372
|
-
xe(g, z);
|
|
373
|
-
const V = R(() => {
|
|
374
|
-
const l = p.value, r = c[l];
|
|
375
|
-
return l.split("").map((s) => {
|
|
376
|
-
const d = r[s];
|
|
377
|
-
return {
|
|
378
|
-
value: U(l, s).to(d),
|
|
379
|
-
channel: s,
|
|
380
|
-
label: s.toUpperCase()
|
|
381
|
-
};
|
|
382
|
-
}).concat(
|
|
383
|
-
n.hideAlpha ? [] : [
|
|
384
|
-
{
|
|
385
|
-
value: B.to(r.a),
|
|
386
|
-
channel: "a",
|
|
387
|
-
label: "Alpha"
|
|
388
|
-
}
|
|
389
|
-
]
|
|
390
|
-
);
|
|
391
|
-
}), x = R({
|
|
392
|
-
get() {
|
|
393
|
-
return n.hideAlpha && [5, 9].includes(c.hex.length) ? c.hex.substring(0, c.hex.length - (c.hex.length - 1) / 4) : c.hex;
|
|
394
|
-
},
|
|
395
|
-
set(l) {
|
|
396
|
-
me(l) && w("hex", l);
|
|
397
|
-
}
|
|
398
|
-
}), c = Ce({
|
|
399
|
-
hex: i,
|
|
400
|
-
hsl: { h: 0, s: 0, l: 100, a: 1 },
|
|
401
|
-
hsv: { h: 0, s: 0, v: 100, a: 1 },
|
|
402
|
-
hwb: { h: 0, w: 100, b: 0, a: 1 },
|
|
403
|
-
rgb: { r: 255, g: 255, b: 255, a: 1 }
|
|
404
|
-
});
|
|
405
|
-
function w(l, r) {
|
|
406
|
-
let s = r;
|
|
407
|
-
if (n.hideAlpha)
|
|
408
|
-
if (typeof r != "string")
|
|
409
|
-
r.a = 1, s = r;
|
|
410
|
-
else if ([5, 9].includes(r.length)) {
|
|
411
|
-
const d = (r.length - 1) / 4;
|
|
412
|
-
s = r.substring(0, r.length - d) + "f".repeat(d);
|
|
413
|
-
} else [4, 7].includes(r.length) && (s = r + "f".repeat((r.length - 1) / 3));
|
|
414
|
-
if (!Ae(c[l], s)) {
|
|
415
|
-
c[l] = s;
|
|
416
|
-
for (const d of o)
|
|
417
|
-
d !== l && (c[d] = oe(l, d, s));
|
|
418
|
-
b.value = G(
|
|
419
|
-
{ color: oe(l, p.value, s), format: p.value },
|
|
420
|
-
n.hideAlpha
|
|
421
|
-
), u("change", ge());
|
|
422
|
-
}
|
|
423
|
-
a.value instanceof HTMLElement && m.value instanceof HTMLElement && f.value instanceof HTMLElement && ve(a.value, m.value, f.value);
|
|
424
|
-
}
|
|
425
|
-
function z(l) {
|
|
426
|
-
const r = le(l);
|
|
427
|
-
if (r !== null)
|
|
428
|
-
w(r.format, r.color);
|
|
429
|
-
else {
|
|
430
|
-
const s = le(i);
|
|
431
|
-
s !== null && w(s.format, s.color);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
function de(l) {
|
|
435
|
-
h.value = l;
|
|
436
|
-
}
|
|
437
|
-
function X(l, r) {
|
|
438
|
-
const s = l.currentTarget, d = { ...c.hsv };
|
|
439
|
-
d[r] = Number(s.value), w("hsv", d);
|
|
440
|
-
}
|
|
441
|
-
function pe(l, r) {
|
|
442
|
-
const s = p.value, d = { ...c[s] }, I = (r === "a" ? B : U(s, r)).from(l);
|
|
443
|
-
Number.isNaN(l) || l === void 0 || (d[r] = I, w(s, d));
|
|
444
|
-
}
|
|
445
|
-
function ve(l, r, s) {
|
|
446
|
-
const d = G({ format: "hsl", color: c.hsl }, !0);
|
|
447
|
-
l.style.setProperty("--vacp-color", d), r.style.position = "relative", r.style.backgroundColor = `hsl(${c.hsl.h} 100% 50%)`, r.style.backgroundImage = "linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent)", s.style.boxSizing = "border-box", s.style.position = "absolute", s.style.left = `${c.hsv.s}%`, s.style.bottom = `${c.hsv.v}%`;
|
|
448
|
-
}
|
|
449
|
-
function ge() {
|
|
450
|
-
const l = G(
|
|
451
|
-
{ color: c[p.value], format: p.value },
|
|
452
|
-
n.hideAlpha
|
|
453
|
-
);
|
|
454
|
-
return {
|
|
455
|
-
colors: c,
|
|
456
|
-
cssColor: l
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
function J(l) {
|
|
460
|
-
if (!["ArrowUp", "ArrowRight", "ArrowDown", "ArrowLeft"].includes(l.key) || !l.shiftKey)
|
|
461
|
-
return;
|
|
462
|
-
const r = l.currentTarget, s = Number(r.step), d = ["ArrowLeft", "ArrowDown"].includes(l.key) ? -1 : 1, A = Number(r.value) + d * s * 10, I = S(A, Number(r.min), Number(r.max));
|
|
463
|
-
r.value = String(I - d * s);
|
|
464
|
-
}
|
|
465
|
-
const { openEyeDropper: be } = Re(z);
|
|
466
|
-
ae(() => z(g.value)), Be({ colorSpace: m, thumb: f, colors: c, setColor: w });
|
|
467
|
-
const L = P(_, "slider");
|
|
468
|
-
return (l, r) => (C(), D("div", {
|
|
469
|
-
ref_key: "colorPicker",
|
|
470
|
-
ref: a,
|
|
471
|
-
class: T([v(_), n.class])
|
|
472
|
-
}, [
|
|
473
|
-
Q($e),
|
|
474
|
-
E("div", {
|
|
475
|
-
class: T(v(P)(v(_), "sliders"))
|
|
476
|
-
}, [
|
|
477
|
-
E("input", {
|
|
478
|
-
class: T([v(L), v(ne)(v(L), "hue")]),
|
|
479
|
-
value: c.hsv.h,
|
|
480
|
-
type: "range",
|
|
481
|
-
min: "0",
|
|
482
|
-
max: "360",
|
|
483
|
-
step: "1",
|
|
484
|
-
onKeydownPassive: J,
|
|
485
|
-
onInput: r[0] || (r[0] = (s) => X(s, "h"))
|
|
486
|
-
}, null, 42, De),
|
|
487
|
-
l.hideAlpha ? Z("", !0) : (C(), D("input", {
|
|
488
|
-
key: 0,
|
|
489
|
-
class: T([v(L), v(ne)(v(L), "alpha")]),
|
|
490
|
-
value: c.hsv.a,
|
|
491
|
-
type: "range",
|
|
492
|
-
min: "0",
|
|
493
|
-
max: "1",
|
|
494
|
-
step: "0.01",
|
|
495
|
-
onKeydownPassive: J,
|
|
496
|
-
onInput: r[1] || (r[1] = (s) => X(s, "a"))
|
|
497
|
-
}, null, 42, Oe))
|
|
498
|
-
], 2),
|
|
499
|
-
E("div", {
|
|
500
|
-
class: T(v(P)(v(_), "inputs"))
|
|
501
|
-
}, [
|
|
502
|
-
E("button", {
|
|
503
|
-
disabled: !0,
|
|
504
|
-
class: "fake-select",
|
|
505
|
-
onClick: r[2] || (r[2] = (s) => de("rgb"))
|
|
506
|
-
}, [
|
|
507
|
-
r[4] || (r[4] = E("div", null, "Hex", -1)),
|
|
508
|
-
Q(Ee, {
|
|
509
|
-
icon: "tabler:chevron-down",
|
|
510
|
-
size: "2xsm",
|
|
511
|
-
class: "fake-select-icon"
|
|
512
|
-
})
|
|
513
|
-
]),
|
|
514
|
-
p.value === "hex" ? (C(), Y(ee, {
|
|
515
|
-
key: 0,
|
|
516
|
-
class: "flex-1",
|
|
517
|
-
size: "sm",
|
|
518
|
-
modelValue: x.value,
|
|
519
|
-
"onUpdate:modelValue": r[3] || (r[3] = (s) => x.value = s)
|
|
520
|
-
}, null, 8, ["modelValue"])) : (C(!0), D(Te, { key: 1 }, Ve(V.value, ({ value: s, channel: d }) => (C(), Y(ee, {
|
|
521
|
-
modelValue: s,
|
|
522
|
-
"onUpdate:modelValue": (A) => pe(A, d),
|
|
523
|
-
size: "sm"
|
|
524
|
-
}, null, 8, ["modelValue", "onUpdate:modelValue"]))), 256)),
|
|
525
|
-
v(he) ? (C(), Y(ke, {
|
|
526
|
-
key: 2,
|
|
527
|
-
onClick: v(be),
|
|
528
|
-
icon: "tabler:color-picker",
|
|
529
|
-
size: "sm",
|
|
530
|
-
type: "outline",
|
|
531
|
-
variant: "icon"
|
|
532
|
-
}, null, 8, ["onClick"])) : Z("", !0)
|
|
533
|
-
], 2)
|
|
534
|
-
], 2));
|
|
535
|
-
}
|
|
536
|
-
});
|
|
537
|
-
export {
|
|
538
|
-
Xe as _,
|
|
539
|
-
We as i,
|
|
540
|
-
Be as p
|
|
541
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var ie=Object.create;var ee=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty;var pe=(m,r,a,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let x of ue(r))!ve.call(m,x)&&x!==a&&ee(m,x,{get:()=>r[x],enumerable:!(t=ce(r,x))||t.enumerable});return m};var me=(m,r,a)=>(a=m!=null?ie(ge(m)):{},pe(r||!m||!m.__esModule?ee(a,"default",{value:m,enumerable:!0}):a,m));const e=require("vue"),u=require("@pantograph/utils"),ne=require("class-variance-authority"),N=require("./cloneDeep-CNkGIW_B.js"),fe=require("./uniq-BoseFDe4.js"),te=require("./get-w4jLplqh.js");require("sortablejs");const ae=require("./options-B4iSAKol.js"),ye=require("radix-vue"),he=require("./IndentLevel.vue_vue_type_style_index_0_lang-ClQO0x1v.js"),ke=require("./Icon.vue_vue_type_style_index_0_lang-C00M2fnO.js"),be=require("./Checkbox.vue_vue_type_style_index_0_lang-D9moel7o.js"),xe=require("./useInputDataStates-CbRgNQqU.js"),Be=require("./_getTag-DaDHQQf0.js"),oe=["sm","md","lg"],Y={none:"gap-none",sm:"gap-sm",md:"gap-md",lg:"gap-lg"},[le,re]=ye.createContext("CheckboxGroup"),Ce=["data-parents","data-key","data-draggable"],Se=["tabindex"],we=["data-parents","data-level"],Ne=e.defineComponent({...ae.getComponentOptions("TreeNode"),__name:"TreeNode",props:{item:{},level:{default:1},hovered:{type:Boolean},parentKeys:{}},setup(m){const r=m,a=e.useSlots(),t=le(),x=ne.cva(t.prefixes.node,{variants:{disabled:u.generateVariantClassList("disabled",t.prefixes.node),active:u.generateVariantClassList("active",t.prefixes.node)}}),y=e.computed(()=>{switch(t.size.value){case"sm":return"2xsm";case"md":case"lg":return"xsm"}}),A=e.computed(()=>{switch(t.size.value){case"sm":return"2xsm";default:return"xsm"}}),B=n=>t.getNodeField(n,"children"),z=n=>t.getNodeField(n,"key"),I=e.computed(()=>B(r.item)),H=e.computed(()=>t.getNodeField(r.item,"leaf")),F=e.computed(()=>t.draggable.value?t.getNodeField(r.item,"draggable")??!0:!1),C=e.computed(()=>z(r.item)),h=e.computed(()=>!!(t.disabled.value||t.getNodeField(r.item,"disabled"))),E=e.computed(()=>{var n;return!!((n=I.value)!=null&&n.some(o=>t.expandedKeys.value.includes(z(o))))}),g=e.inject("tree-node-context",{hovered:e.ref(r.hovered??!1),expanded:e.ref(!1),childExpanded:E}),S=e.computed(()=>!(r.item.dragging??!1)&&t.expandedKeys.value.includes(C.value)),k=e.ref(!1),K=n=>{k.value=n};e.watch(k,n=>{t.showLine.value&&g.hovered&&(g.hovered.value=n)}),e.provide("tree-node-context",{expanded:S,childExpanded:E,hovered:k});const R=e.computed(()=>{var n,o,l;if(t.dragging.value)return!1;if(t.showLine.value){if(r.hovered||(n=g.hovered)!=null&&n.value||k.value)return"all";if(S.value&&!E.value)return"self";if((o=g.expanded)!=null&&o.value&&!((l=g.childExpanded)!=null&&l.value))return"last"}}),_=()=>{h.value||t.onSelect(r.item)},T=e.computed(()=>!!t.model.value.includes(C.value)),L=e.computed(()=>{const n=(d=r.item)=>{const i=B(d);return(i==null?void 0:i.length)&&i.every(v=>t.checked.value.includes(z(v)))},o=(d=r.item)=>{const i=B(d);return i!=null&&i.length?!!(i!=null&&i.some(v=>t.checked.value.includes(z(v))||o(v))):!1},l=t.checked.value.includes(C.value);return n()?(l||t.onCheck(r.item),!0):o()?(l&&t.onCheck(r.item),"indeterminate"):!!l}),b=()=>{var l;if(!((l=I.value)!=null&&l.length))return t.onCheck(r.item);const n=(s=r.item)=>{const d=B(s);return d!=null&&d.length?d.reduce((i,v)=>{const w=B(v),p=z(v);return w!=null&&w.length?[...i,p,...n(v)]:[...i,p]},[]):[]},o=n();return t.onCheck(r.item,{keys:[C.value,...o],value:!t.checked.value.includes(C.value)})},j=e.computed(()=>[...r.parentKeys??[],C.value]),J=()=>{t.onExpandKey(r.item)},O=e.computed(()=>r.item.dragging_level??r.level),V=e.computed(()=>O.value+1),q=e.ref(),P=e.ref();t.useSortable({root:q,instance:P,node:r.item});const U=e.computed(()=>{switch(t.size.value){case"sm":return"2xsm";case"md":return"xsm";case"lg":return"sm"}}),{rootBindings:Q,inputBindings:G}=xe.UseInputDataStates({getDisabled:()=>h.value});return(n,o)=>{var s,d,i;const l=e.resolveComponent("TreeNode",!0);return e.openBlock(),e.createElementBlock("div",e.mergeProps({"data-parents":e.unref(t).draggable.value?n.parentKeys:void 0,"data-key":e.unref(t).draggable.value?C.value:void 0,"data-draggable":e.unref(t).draggable.value?!h.value&&F.value:void 0,class:[(s=I.value)!=null&&s.length?e.unref(t).prefixes.group:"",e.unref(u.getBemElement)(e.unref(t).prefixes.node,"root"),e.unref(t).getNodeField(n.item,"class")]},e.unref(Q)),[e.createElementVNode("div",e.mergeProps({tabindex:h.value?void 0:0,class:[e.unref(x)({disabled:h.value,active:T.value})]},e.unref(G),{onMouseenter:o[1]||(o[1]=v=>K(!0)),onMouseleave:o[2]||(o[2]=v=>K(!1)),onClick:_}),[e.unref(t).draggable.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(t).prefixes.draggable)},[!n.item.dragging&&!e.unref(t).dragging.value?(e.openBlock(),e.createBlock(ke._sfc_main,{key:0,icon:"tabler:grip-vertical",size:A.value,class:e.normalizeClass(e.unref(t).prefixes.draggableIcon)},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"dragTrigger",e.normalizeProps(e.guardReactiveProps({...n.item,selected:T.value,checked:L.value,disabled:h.value,unFocusable:!0})))]),_:3},8,["size","class"])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),e.createVNode(he._sfc_main,{level:O.value,children:!!((d=I.value)!=null&&d.length||e.unref(t).lazyLoad.value&&!H.value),size:U.value,expanded:S.value,showLine:R.value,loading:e.unref(t).getNodeField(n.item,"loading"),"branch-icon":e.unref(t).getNodeField(n.item,"switcherIcon")??e.unref(t).switcherIcon.value,"no-rotate-branch":e.unref(t).getNodeField(n.item,"noRotateSwitcherIcon")??e.unref(t).noRotateSwitcherIcon.value,onToggleExpand:e.withModifiers(J,["stop"])},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"switcherIcon",e.normalizeProps(e.guardReactiveProps({...n.item,selected:T.value,checked:L.value,expanded:S.value,disabled:h.value,unFocusable:!0})))]),_:3},8,["level","children","size","expanded","showLine","loading","branch-icon","no-rotate-branch"]),!n.item.dragging||!e.unref(t).dragging.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(t).checkbox.value?(e.openBlock(),e.createBlock(be._sfc_main,{key:0,size:y.value,onClick:o[0]||(o[0]=e.withModifiers(()=>{},["stop"])),checked:L.value,"onUpdate:checked":b,disabled:h.value},null,8,["size","checked","disabled"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"title",e.normalizeProps(e.guardReactiveProps({...n.item,selected:T.value,checked:L.value,disabled:h.value,unFocusable:!0})),()=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(u.getBemElement)(e.unref(t).prefixes.node,"title"))},e.toDisplayString(e.unref(t).getNodeField(n.item,"title")),3)])],64)):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(e.unref(u.getBemElement)(e.unref(t).prefixes.node,"slot"))},null,2))],16,Se),(i=I.value)!=null&&i.length?e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(t).prefixes.groupList),ref_key:"root",ref:q,"data-parents":e.unref(t).draggable.value?j.value:void 0,"data-level":e.unref(t).draggable.value?V.value:void 0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B(n.item),v=>{var w;return e.openBlock(),e.createBlock(l,{key:e.unref(t).getNodeField(v,"key"),parentKeys:j.value,item:v,level:V.value,hovered:r.hovered||k.value||((w=e.unref(g).hovered)==null?void 0:w.value)},e.createSlots({_:2},[e.renderList(Object.keys(a),p=>({name:p,fn:e.withCtx(c=>[e.renderSlot(n.$slots,p,e.mergeProps({ref_for:!0},c))])}))]),1032,["parentKeys","item","level","hovered"])}),128))],10,we)),[[e.vShow,S.value]]):e.createCommentVNode("",!0)],16,Ce)}}}),ze=e.defineComponent({...ae.getComponentOptions("Tree"),__name:"Tree",props:{class:{},size:{default:"md"},gap:{},data:{},value:{},checkedKeys:{},expandedKeys:{},multiple:{type:Boolean},checkbox:{type:Boolean},defaultExpandAll:{type:Boolean},selectable:{type:Boolean},showLine:{type:Boolean},inlineNode:{type:Boolean},lazyLoad:{type:Boolean},fieldNames:{},groupName:{},switcherIcon:{},noRotateSwitcherIcon:{type:Boolean},draggable:{type:Boolean},disabled:{type:Boolean}},emits:["update:value","update:expandedKeys","update:checkedKeys","expand","select","check","dragStart","dragEnd"],setup(m,{emit:r}){const a=m,t=r,x=e.useSlots(),y=u.getBemBlock("tree"),A=u.getBemElement(y,"node"),B=u.getBemElement(A,"group"),z=u.getBemElement(A,"draggable"),I=u.getBemElement(z,"icon"),H=u.getBemElement(B,"list"),F={node:A,group:B,draggable:z,draggableIcon:I,groupList:H},C=ne.cva(y,{variants:{size:u.generateVariantClassList(oe,y),gap:u.generateVariantClassList(Y,y),selectable:u.generateVariantClassList("selectable",y),disabled:u.generateVariantClassList("disabled",y),inlineNode:u.generateVariantClassList("inline-node",y),dragging:u.generateVariantClassList("dragging",y)}}),h=e.computed(()=>N.cloneDeep(a.data)),E=e.ref(h.value),g=(n,o)=>{var s;const l=te.get(n,o);return(s=a.fieldNames)!=null&&s[o]?te.get(n,a.fieldNames[o],l):l},S=()=>{if(!a.lazyLoad){const n=[],o=l=>{for(const s of l){const d=g(s,"children");d!=null&&d.length&&(n.push(g(s,"key")),o(d))}};return o(E.value),n}return[]},k=e.ref(a.expandedKeys??(a.defaultExpandAll?S():[]));e.watch(()=>[a.defaultExpandAll,a.expandedKeys],([n,o],[l,s])=>{o!==s?k.value=a.expandedKeys??[]:n&&!l&&(k.value=S())});const K=e.computed({get(){return a.expandedKeys?a.expandedKeys:k.value},set(n){a.expandedKeys||(k.value=n),t("update:expandedKeys",n)}});e.watch(h,n=>{E.value=n;const o=S();K.value=K.value.filter(l=>o.includes(l)),q.value++},{deep:!0});const R=e.ref(a.value??[]);e.watch(()=>a.value,()=>{R.value=a.value??[]});const _=e.computed({get(){return a.value?a.value:R.value},set(n){a.value||(R.value=n),t("update:value",n)}}),T=n=>{if(a.selectable&&!a.disabled){let o=N.cloneDeep(_.value);const l=g(n,"key");a.multiple?_.value.includes(l)?o=N.cloneDeep(_.value.filter(s=>s!==l)):o=N.cloneDeep([..._.value,l]):o.includes(l)?o=[]:o=[l],_.value=o,t("select",n,o.includes(l))}},L=e.ref(a.checkedKeys??[]);e.watch(()=>a.checkedKeys,()=>{L.value=a.checkedKeys??[]});const b=e.computed({get(){return a.checkedKeys?a.checkedKeys:L.value},set(n){a.checkedKeys||(L.value=n),t("update:checkedKeys",n)}}),j=(n,o)=>{if(a.checkbox&&!a.disabled){let l=N.cloneDeep(b.value);const s=g(n,"key");o!=null&&o.keys.length?o.value?l=fe.uniq([...o.keys,...l]):l=N.cloneDeep(b.value.filter(i=>!o.keys.includes(i))):b.value.includes(s)?l=N.cloneDeep(b.value.filter(i=>i!==s)):l=N.cloneDeep([...b.value,s]),b.value=l;const d=(o==null?void 0:o.value)??b.value.includes(s);t("check",n,d,(o==null?void 0:o.keys)??s)}},J=n=>{let o=!0;const l=g(n,"key");let s=N.cloneDeep(K.value);s.includes(l)?(s=s.filter(d=>d!==l),o=!1):s=[...s,l],K.value=s,t("expand",n,o)},O=e.computed(()=>{if(a.gap){if(typeof a.gap=="number")return`${a.gap}px`;if(!Object.keys(Y).includes(a.gap))return a.gap}}),V=a.groupName??u.usePCId(y),q=e.ref(1),P=e.ref(!1),U=e.ref(),Q=e.ref(),G=n=>{const{root:o,instance:l,node:s}=n,d=p=>{var c;return(c=p.getAttribute("data-parents"))==null?void 0:c.split(",")},i=p=>{const c=(M,se=E.value)=>{const{parents:W,self:de}=M;for(let X of se){const Z=g(X,"key").toString();if(Z===de)return X;const D=g(X,"children");if(W!=null&&W.includes(Z)&&(D!=null&&D.length))return c(M,D)}},f=d(p),$=p.getAttribute("data-key")??"";return c({parents:f,self:$})},v=u.getBemModifier(u.getBemElement(y,"dragging_item"),a.size),w=()=>{var p;(p=l.value)==null||p.destroy(),l.value=void 0};e.onMounted(()=>{e.watch(()=>[o.value,a.draggable,q.value],async()=>{if(l.value)w();else if(o.value&&a.draggable){const{default:p}=await import("sortablejs");l.value=new p(o.value,{group:Be.isFunction(V)?V(s):V,animation:150,forceFallback:!0,fallbackOnBody:!0,filter:"[data-draggable=false]",handle:`.${F.node} .${F.draggable} .${F.draggableIcon}`,dataIdAttr:"data-key",dragClass:v,onChoose(c){const f=i(c.item);f&&(f.dragging=!0)},onStart(c){var M;const f=document.querySelector(`.${v}`),$=(M=getComputedStyle(o.value))==null?void 0:M.direction;f!=null&&f.style&&(f.style.direction=$),P.value=!0,t("dragStart",c)},onUnchoose(c){const f=i(c.item);f&&(f.dragging=!1)},onEnd(c){P.value=!1,t("dragEnd",{...c,node:i(c.item),oldParents:d(c.item),newParents:d(c.to)})},onMove(c){const f=Number(c.to.getAttribute("data-level")??"1"),$=i(c.dragged);$&&($.dragging_level=f)}})}},{immediate:!0})}),e.onBeforeUnmount(()=>{l.value&&w()})};return G({root:U,instance:Q}),re({size:e.computed(()=>a.size),draggable:e.computed(()=>a.draggable),lazyLoad:e.computed(()=>a.lazyLoad),checkbox:e.computed(()=>a.checkbox),showLine:e.computed(()=>a.showLine),disabled:e.computed(()=>a.disabled),switcherIcon:e.computed(()=>a.switcherIcon),noRotateSwitcherIcon:e.computed(()=>a.noRotateSwitcherIcon),expandedKeys:K,model:_,checked:b,onExpandKey:J,onSelect:T,onCheck:j,getNodeField:g,useSortable:G,dragging:P,prefixes:F}),(n,o)=>(e.openBlock(),e.createElementBlock("div",{key:q.value,class:e.normalizeClass([e.unref(C)({size:a.size,gap:a.gap??a.size,selectable:a.selectable,disabled:a.disabled,inlineNode:a.inlineNode,dragging:P.value}),a.class]),style:e.normalizeStyle({"--ptc-tree-gap":O.value}),ref_key:"root",ref:U},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,l=>(e.openBlock(),e.createBlock(Ne,{key:g(l,"key"),item:l},e.createSlots({_:2},[e.renderList(Object.keys(x),s=>({name:s,fn:e.withCtx(d=>[e.renderSlot(n.$slots,s,e.mergeProps({ref_for:!0},d))])}))]),1032,["item"]))),128))],6))}});exports.TreeGaps=Y;exports.TreeSizes=oe;exports._sfc_main=ze;exports.injectTreeContext=le;exports.provideTreeContext=re;
|