vcolorpicker
Advanced tools
Comparing version 2.0.11 to 2.0.12
@@ -1,6 +0,5 @@ | ||
import type { App } from 'vue'; | ||
import type { PluginInstallFunction } from 'vue'; | ||
declare const _default: { | ||
version: string; | ||
install: (app: App<any>) => App<any>; | ||
install: PluginInstallFunction | ||
}; | ||
export default _default; |
@@ -1,19 +0,19 @@ | ||
import { getCurrentScope as ne, onScopeDispose as le, unref as w, watch as re, defineComponent as se, ref as B, computed as F, openBlock as k, createElementBlock as h, createCommentVNode as L, createElementVNode as i, normalizeClass as W, normalizeStyle as M, Fragment as V, renderList as N, withDirectives as ue, isRef as ae, vModelText as ie, pushScopeId as ce, popScopeId as de } from "vue"; | ||
import { getCurrentScope as ne, onScopeDispose as te, unref as w, watch as le, defineComponent as re, ref as B, computed as L, openBlock as k, createElementBlock as O, createCommentVNode as D, createElementVNode as i, normalizeClass as W, normalizeStyle as M, Fragment as V, renderList as N, withDirectives as ue, isRef as se, vModelText as ae } from "vue"; | ||
var j; | ||
const $ = typeof window < "u", fe = (e) => typeof e == "string", pe = () => { | ||
const $ = typeof window < "u", ie = (e) => typeof e == "string", ce = () => { | ||
}; | ||
$ && ((j = window == null ? void 0 : window.navigator) == null ? void 0 : j.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); | ||
function ve(e) { | ||
function de(e) { | ||
return typeof e == "function" ? e() : w(e); | ||
} | ||
function me(e) { | ||
function fe(e) { | ||
return e; | ||
} | ||
function Ce(e) { | ||
return ne() ? (le(e), !0) : !1; | ||
function pe(e) { | ||
return ne() ? (te(e), !0) : !1; | ||
} | ||
function A(e) { | ||
var t; | ||
const o = ve(e); | ||
return (t = o == null ? void 0 : o.$el) != null ? t : o; | ||
var n; | ||
const o = de(e); | ||
return (n = o == null ? void 0 : o.$el) != null ? n : o; | ||
} | ||
@@ -25,24 +25,24 @@ const K = $ ? window : void 0; | ||
function Q(...e) { | ||
let t, o, s, p; | ||
if (fe(e[0]) || Array.isArray(e[0]) ? ([o, s, p] = e, t = K) : [t, o, s, p] = e, !t) | ||
return pe; | ||
Array.isArray(o) || (o = [o]), Array.isArray(s) || (s = [s]); | ||
const _ = [], I = () => { | ||
_.forEach((v) => v()), _.length = 0; | ||
}, C = (v, g, m) => (v.addEventListener(g, m, p), () => v.removeEventListener(g, m, p)), d = re(() => A(t), (v) => { | ||
I(), v && _.push(...o.flatMap((g) => s.map((m) => C(v, g, m)))); | ||
}, { immediate: !0, flush: "post" }), y = () => { | ||
d(), I(); | ||
let n, o, u, p; | ||
if (ie(e[0]) || Array.isArray(e[0]) ? ([o, u, p] = e, n = K) : [n, o, u, p] = e, !n) | ||
return ce; | ||
Array.isArray(o) || (o = [o]), Array.isArray(u) || (u = [u]); | ||
const g = [], E = () => { | ||
g.forEach((v) => v()), g.length = 0; | ||
}, C = (v, _, m) => (v.addEventListener(_, m, p), () => v.removeEventListener(_, m, p)), d = le(() => A(n), (v) => { | ||
E(), v && g.push(...o.flatMap((_) => u.map((m) => C(v, _, m)))); | ||
}, { immediate: !0, flush: "post" }), b = () => { | ||
d(), E(); | ||
}; | ||
return Ce(y), y; | ||
return pe(b), b; | ||
} | ||
function _e(e, t, o = {}) { | ||
const { window: s = K, ignore: p, capture: _ = !0, detectIframe: I = !1 } = o; | ||
if (!s) | ||
function ve(e, n, o = {}) { | ||
const { window: u = K, ignore: p, capture: g = !0, detectIframe: E = !1 } = o; | ||
if (!u) | ||
return; | ||
let C = !0, d; | ||
const y = (u) => { | ||
s.clearTimeout(d); | ||
const b = (s) => { | ||
u.clearTimeout(d); | ||
const a = A(e); | ||
if (!(!a || a === u.target || u.composedPath().includes(a))) { | ||
if (!(!a || a === s.target || s.composedPath().includes(a))) { | ||
if (!C) { | ||
@@ -52,30 +52,30 @@ C = !0; | ||
} | ||
t(u); | ||
n(s); | ||
} | ||
}, v = (u) => p && p.some((a) => { | ||
const b = A(a); | ||
return b && (u.target === b || u.composedPath().includes(b)); | ||
}), g = [ | ||
Q(s, "click", y, { passive: !0, capture: _ }), | ||
Q(s, "pointerdown", (u) => { | ||
}, v = (s) => p && p.some((a) => { | ||
const y = A(a); | ||
return y && (s.target === y || s.composedPath().includes(y)); | ||
}), _ = [ | ||
Q(u, "click", b, { passive: !0, capture: g }), | ||
Q(u, "pointerdown", (s) => { | ||
const a = A(e); | ||
a && (C = !u.composedPath().includes(a) && !v(u)); | ||
a && (C = !s.composedPath().includes(a) && !v(s)); | ||
}, { passive: !0 }), | ||
Q(s, "pointerup", (u) => { | ||
if (u.button === 0) { | ||
const a = u.composedPath(); | ||
u.composedPath = () => a, d = s.setTimeout(() => y(u), 50); | ||
Q(u, "pointerup", (s) => { | ||
if (s.button === 0) { | ||
const a = s.composedPath(); | ||
s.composedPath = () => a, d = u.setTimeout(() => b(s), 50); | ||
} | ||
}, { passive: !0 }), | ||
I && Q(s, "blur", (u) => { | ||
E && Q(u, "blur", (s) => { | ||
var a; | ||
const b = A(e); | ||
((a = s.document.activeElement) == null ? void 0 : a.tagName) === "IFRAME" && !(b != null && b.contains(s.document.activeElement)) && t(u); | ||
const y = A(e); | ||
((a = u.document.activeElement) == null ? void 0 : a.tagName) === "IFRAME" && !(y != null && y.contains(u.document.activeElement)) && n(s); | ||
}) | ||
].filter(Boolean); | ||
return () => g.forEach((u) => u()); | ||
return () => _.forEach((s) => s()); | ||
} | ||
const D = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, R = "__vueuse_ssr_handlers__"; | ||
D[R] = D[R] || {}; | ||
D[R]; | ||
const R = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, S = "__vueuse_ssr_handlers__"; | ||
R[S] = R[S] || {}; | ||
R[S]; | ||
var q; | ||
@@ -85,11 +85,11 @@ (function(e) { | ||
})(q || (q = {})); | ||
var ge = Object.defineProperty, z = Object.getOwnPropertySymbols, be = Object.prototype.hasOwnProperty, ye = Object.prototype.propertyIsEnumerable, G = (e, t, o) => t in e ? ge(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, ke = (e, t) => { | ||
for (var o in t || (t = {})) | ||
be.call(t, o) && G(e, o, t[o]); | ||
var me = Object.defineProperty, z = Object.getOwnPropertySymbols, Ce = Object.prototype.hasOwnProperty, ge = Object.prototype.propertyIsEnumerable, G = (e, n, o) => n in e ? me(e, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[n] = o, _e = (e, n) => { | ||
for (var o in n || (n = {})) | ||
Ce.call(n, o) && G(e, o, n[o]); | ||
if (z) | ||
for (var o of z(t)) | ||
ye.call(t, o) && G(e, o, t[o]); | ||
for (var o of z(n)) | ||
ge.call(n, o) && G(e, o, n[o]); | ||
return e; | ||
}; | ||
const he = { | ||
const ye = { | ||
easeInSine: [0.12, 0, 0.39, 0], | ||
@@ -120,9 +120,9 @@ easeOutSine: [0.61, 1, 0.88, 1], | ||
}; | ||
ke({ | ||
linear: me | ||
}, he); | ||
const J = (e) => (ce("data-v-b46fc003"), e = e(), de(), e), we = { class: "hd" }, Oe = { class: "bd" }, Ie = /* @__PURE__ */ J(() => /* @__PURE__ */ i("h3", null, "\u4E3B\u9898\u989C\u8272", -1)), Ee = { class: "tColor" }, Pe = ["onMouseover", "onClick"], Me = { class: "bColor" }, Ae = ["onMouseover", "onClick"], $e = /* @__PURE__ */ J(() => /* @__PURE__ */ i("h3", null, "\u6807\u51C6\u989C\u8272", -1)), Te = { class: "tColor" }, Be = ["onMouseover", "onClick"], Ve = { | ||
_e({ | ||
linear: fe | ||
}, ye); | ||
const be = { class: "hd" }, ke = { class: "bd" }, Oe = /* @__PURE__ */ i("h3", null, "\u4E3B\u9898\u989C\u8272", -1), we = { class: "tColor" }, he = ["onMouseover", "onClick"], Ee = { class: "bColor" }, Pe = ["onMouseover", "onClick"], Ie = /* @__PURE__ */ i("h3", null, "\u6807\u51C6\u989C\u8272", -1), Me = { class: "tColor" }, Ae = ["onMouseover", "onClick"], $e = { | ||
name: "colorPicker" | ||
}, Ne = /* @__PURE__ */ se({ | ||
...Ve, | ||
}, Te = /* @__PURE__ */ re({ | ||
...$e, | ||
props: { | ||
@@ -134,12 +134,12 @@ modelValue: { type: String, required: !0 }, | ||
emits: ["update:modelValue", "change"], | ||
setup(e, { emit: t }) { | ||
const o = e, s = B(!1), p = () => { | ||
s.value = !o.disabled; | ||
}, _ = B(null); | ||
_e(_, () => { | ||
s.value = !1; | ||
setup(e, { emit: n }) { | ||
const o = e, u = B(!1), p = () => { | ||
u.value = !o.disabled; | ||
}, g = B(null); | ||
ve(g, () => { | ||
u.value = !1; | ||
}); | ||
const C = B(""), d = (n) => { | ||
C.value = n; | ||
}, y = ["#000000", "#ffffff", "#eeece1", "#1e497b", "#4e81bb", "#e2534d", "#9aba60", "#8165a0", "#47acc5", "#f9974c"], v = [ | ||
const C = B(""), d = (t) => { | ||
C.value = t; | ||
}, b = ["#000000", "#ffffff", "#eeece1", "#1e497b", "#4e81bb", "#e2534d", "#9aba60", "#8165a0", "#47acc5", "#f9974c"], v = [ | ||
["#7f7f7f", "#f2f2f2"], | ||
@@ -155,33 +155,33 @@ ["#0d0d0d", "#808080"], | ||
["#99490f", "#fee9da"] | ||
], g = ["#c21401", "#ff1e02", "#ffc12a", "#ffff3a", "#90cf5b", "#00af57", "#00afee", "#0071be", "#00215f", "#72349d"], m = o.modelValue, u = F(() => C.value ? C : a), a = F(() => o.modelValue ? o.modelValue : o.defaultColor), b = F(() => { | ||
let n = []; | ||
], _ = ["#c21401", "#ff1e02", "#ffc12a", "#ffff3a", "#90cf5b", "#00af57", "#00afee", "#0071be", "#00215f", "#72349d"], m = o.modelValue, s = L(() => C.value ? C : a), a = L(() => o.modelValue ? o.modelValue : o.defaultColor), y = L(() => { | ||
let t = []; | ||
for (let r of v) | ||
n.push(oe(r[1], r[0], 5)); | ||
return n; | ||
}), x = B(null), X = () => { | ||
var n; | ||
(n = x.value) == null || n.click(); | ||
}, E = (n) => { | ||
t("update:modelValue", n), t("change", n), s.value = !1; | ||
}, Y = () => { | ||
E(o.defaultColor); | ||
}, Z = (n) => n.length === 4 ? n = "#" + n[1] + n[1] + n[2] + n[2] + n[3] + n[3] : n, ee = (n, r, l) => { | ||
const c = (n << 16 | r << 8 | l).toString(16); | ||
t.push(ee(r[1], r[0], 5)); | ||
return t; | ||
}), x = B(null), J = () => { | ||
var t; | ||
(t = x.value) == null || t.click(); | ||
}, P = (t) => { | ||
n("update:modelValue", t), n("change", t), u.value = !1; | ||
}, X = () => { | ||
P(o.defaultColor); | ||
}, Y = (t) => t.length === 4 ? t = "#" + t[1] + t[1] + t[2] + t[2] + t[3] + t[3] : t, Z = (t, r, l) => { | ||
const c = (t << 16 | r << 8 | l).toString(16); | ||
return "#" + new Array(Math.abs(c.length - 7)).join("0") + c; | ||
}, H = (n) => { | ||
n = Z(n); | ||
}, H = (t) => { | ||
t = Y(t); | ||
let r = []; | ||
for (let l = 1; l < 7; l += 2) | ||
r.push(parseInt("0x" + n.slice(l, l + 2))); | ||
r.push(parseInt("0x" + t.slice(l, l + 2))); | ||
return r; | ||
}, oe = (n, r, l) => { | ||
let c = H(n), f = H(r), S = (f[0] - c[0]) / l, T = (f[1] - c[1]) / l, te = (f[2] - c[2]) / l, U = []; | ||
for (let P = 0; P < l; P++) | ||
U.push(ee(S * P + c[0], T * P + c[1], te * P + c[2])); | ||
}, ee = (t, r, l) => { | ||
let c = H(t), f = H(r), F = (f[0] - c[0]) / l, T = (f[1] - c[1]) / l, oe = (f[2] - c[2]) / l, U = []; | ||
for (let I = 0; I < l; I++) | ||
U.push(Z(F * I + c[0], T * I + c[1], oe * I + c[2])); | ||
return U; | ||
}; | ||
return (n, r) => (k(), h("div", { | ||
return (t, r) => (k(), O("div", { | ||
class: "m-colorPicker", | ||
ref_key: "colorPicker", | ||
ref: _, | ||
ref: g, | ||
onClick: r[7] || (r[7] = (l) => { | ||
@@ -191,3 +191,3 @@ l.stopPropagation(); | ||
}, [ | ||
L(" \u989C\u8272\u663E\u793A\u5C0F\u65B9\u5757 "), | ||
D(" \u989C\u8272\u663E\u793A\u5C0F\u65B9\u5757 "), | ||
i("div", { | ||
@@ -198,14 +198,14 @@ class: W(["colorBtn", { disabled: e.disabled }]), | ||
}, null, 6), | ||
L(" \u989C\u8272\u8272\u76D8 "), | ||
D(" \u989C\u8272\u8272\u76D8 "), | ||
i("div", { | ||
class: W(["box", { open: s.value }]) | ||
class: W(["box", { open: u.value }]) | ||
}, [ | ||
i("div", we, [ | ||
i("div", be, [ | ||
i("div", { | ||
class: "colorView", | ||
style: M({ "background-color": w(u).value }) | ||
style: M({ "background-color": w(s).value }) | ||
}, null, 4), | ||
i("div", { | ||
class: "defaultColor", | ||
onClick: Y, | ||
onClick: X, | ||
onMouseover: r[0] || (r[0] = (l) => d(e.defaultColor)), | ||
@@ -215,6 +215,6 @@ onMouseout: r[1] || (r[1] = (l) => d("")) | ||
]), | ||
i("div", Oe, [ | ||
Ie, | ||
i("ul", Ee, [ | ||
(k(), h(V, null, N(y, (l, c) => i("li", { | ||
i("div", ke, [ | ||
Oe, | ||
i("ul", we, [ | ||
(k(), O(V, null, N(b, (l, c) => i("li", { | ||
key: c, | ||
@@ -224,21 +224,21 @@ style: M({ backgroundColor: l }), | ||
onMouseout: r[2] || (r[2] = (f) => d("")), | ||
onClick: (f) => E(l) | ||
}, null, 44, Pe)), 64)) | ||
onClick: (f) => P(l) | ||
}, null, 44, he)), 64)) | ||
]), | ||
i("ul", Me, [ | ||
(k(!0), h(V, null, N(w(b), (l, c) => (k(), h("li", { key: c }, [ | ||
i("ul", Ee, [ | ||
(k(!0), O(V, null, N(w(y), (l, c) => (k(), O("li", { key: c }, [ | ||
i("ul", null, [ | ||
(k(!0), h(V, null, N(l, (f, S) => (k(), h("li", { | ||
key: S, | ||
(k(!0), O(V, null, N(l, (f, F) => (k(), O("li", { | ||
key: F, | ||
style: M({ backgroundColor: f }), | ||
onMouseover: (T) => d(f), | ||
onMouseout: r[3] || (r[3] = (T) => d("")), | ||
onClick: (T) => E(f) | ||
}, null, 44, Ae))), 128)) | ||
onClick: (T) => P(f) | ||
}, null, 44, Pe))), 128)) | ||
]) | ||
]))), 128)) | ||
]), | ||
$e, | ||
i("ul", Te, [ | ||
(k(), h(V, null, N(g, (l, c) => i("li", { | ||
Ie, | ||
i("ul", Me, [ | ||
(k(), O(V, null, N(_, (l, c) => i("li", { | ||
key: c, | ||
@@ -248,7 +248,7 @@ style: M({ backgroundColor: l }), | ||
onMouseout: r[4] || (r[4] = (f) => d("")), | ||
onClick: (f) => E(l) | ||
}, null, 44, Be)), 64)) | ||
onClick: (f) => P(l) | ||
}, null, 44, Ae)), 64)) | ||
]), | ||
i("h3", { onClick: X }, "\u66F4\u591A\u989C\u8272..."), | ||
L(" \u7528\u4EE5\u6FC0\u6D3BHTML5\u989C\u8272\u9762\u677F "), | ||
i("h3", { onClick: J }, "\u66F4\u591A\u989C\u8272..."), | ||
D(" \u7528\u4EE5\u6FC0\u6D3BHTML5\u989C\u8272\u9762\u677F "), | ||
ue(i("input", { | ||
@@ -258,6 +258,6 @@ type: "color", | ||
ref: x, | ||
"onUpdate:modelValue": r[5] || (r[5] = (l) => ae(m) ? m.value = l : null), | ||
onChange: r[6] || (r[6] = (l) => E(w(m))) | ||
"onUpdate:modelValue": r[5] || (r[5] = (l) => se(m) ? m.value = l : null), | ||
onChange: r[6] || (r[6] = (l) => P(w(m))) | ||
}, null, 544), [ | ||
[ie, w(m)] | ||
[ae, w(m)] | ||
]) | ||
@@ -269,22 +269,24 @@ ]) | ||
}); | ||
const Qe = (e, t) => { | ||
const Be = (e, n) => { | ||
const o = e.__vccOpts || e; | ||
for (const [s, p] of t) | ||
o[s] = p; | ||
for (const [u, p] of n) | ||
o[u] = p; | ||
return o; | ||
}, O = /* @__PURE__ */ Qe(Ne, [["__scopeId", "data-v-b46fc003"], ["__file", "/Users/zhuleyi/WORK/github/vue-color-picker/packages/color-picker/src/index.vue"]]); | ||
O.install = function(e, t) { | ||
e.component(O.name, O); | ||
}, h = /* @__PURE__ */ Be(Te, [["__file", "/Users/zhuleyi/WORK/github/vue-color-picker/packages/color-picker/src/index.vue"]]); | ||
h.install = function(e, n) { | ||
e.component(h.name, h); | ||
}; | ||
console.log("name", O.name); | ||
const Se = [ | ||
O | ||
], Fe = function(e) { | ||
Se.map((t) => e.component(t.name, t)); | ||
}, De = { | ||
install: Fe, | ||
colorPicker: O | ||
console.log("name", h.name); | ||
const Ve = [ | ||
h | ||
]; | ||
debugger; | ||
const Ne = function(e) { | ||
Ve.map((n) => e.component(n.name, n)); | ||
}, Fe = { | ||
install: Ne, | ||
colorPicker: h | ||
}; | ||
export { | ||
De as default | ||
Fe as default | ||
}; |
{ | ||
"name": "vcolorpicker", | ||
"version": "2.0.11", | ||
"version": "2.0.12", | ||
"type": "module", | ||
"description": "基于 Vue3 的颜色选择器", | ||
"main": "./lib/vcolorpicker.js", | ||
"module": "./lib/vcolorpicker.js", | ||
"types": "./index.d.ts", | ||
@@ -38,5 +37,4 @@ "exports": { | ||
"@vueuse/core": "^9.6.0", | ||
"ant-design-vue": "^3.2.15", | ||
"highlight.js": "^11.7.0", | ||
"vcolorpicker": "2.0.10", | ||
"vcolorpicker": "2.0.11", | ||
"vue": "^3.2.45" | ||
@@ -43,0 +41,0 @@ }, |
@@ -9,3 +9,3 @@ import type { Plugin } from 'vue' | ||
] | ||
debugger | ||
// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册 | ||
@@ -12,0 +12,0 @@ const install: Plugin['install'] = function (app) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37327
4
16
369
+ Addedvcolorpicker@2.0.11(transitive)
- Removedant-design-vue@^3.2.15
Updatedvcolorpicker@2.0.11