geekin-devtoys 0.4.1 → 0.4.2
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/lib/GButton/index.js +1 -1
- package/lib/GButton/index.mjs +1 -1
- package/lib/GButton/style.css +1 -1
- package/lib/GDropdown/index.js +1 -0
- package/lib/GDropdown/index.mjs +278 -0
- package/lib/GDropdown/style.css +1 -0
- package/lib/GDropdown.d.ts +1 -0
- package/lib/GPicker/index.js +1 -1
- package/lib/GPicker/index.mjs +37 -37
- package/lib/GPicker/style.css +1 -1
- package/lib/GPluginVideo/index.js +1 -1
- package/lib/GPluginVideo/index.mjs +59 -58
- package/lib/GToast/index.js +1 -1
- package/lib/GToast/index.mjs +23 -23
- package/lib/GToast/style.css +1 -1
- package/lib/components/GDropdown/index.d.ts +59 -0
- package/lib/components/GScroller/index.d.ts +1 -1
- package/lib/components/GShinyText/index.d.ts +1 -1
- package/lib/components/GToast/store.d.ts +1 -0
- package/lib/components/GToast/types.d.ts +9 -0
- package/lib/index/index.js +1 -1
- package/lib/index/index.mjs +30 -27
- package/lib/index/style.css +5 -3
- package/lib/index.d.ts +3 -1
- package/package.json +9 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),K=require("jsencrypt"),d=require("../GToast/index.js"),Y={id:"playWnd",class:"playWnd"},x=3,A=3e3,b="插件未启动,正在尝试启动,请稍候...",S="插件启动失败,请检查插件是否安装!",p={__name:"index",props:{isPlayVideo:{type:Boolean,default:!1},isFullScreen:{type:Boolean,default:!1},cameraIndexCode:{type:String,default:""},currentPlayType:{type:Number,default:0},baseUrl:{type:String,default:"http://92.97.137.81:48181"},basePath:{type:String,default:""},usefullData:{type:Object,default:()=>({appkey:"24460774",secret:"vphyI4pTqEVk4lT67jVe",ip:"61.27.16.15",port:443})},size:{type:Object,default:()=>({windowWidth:300,windowHeight:200})},isMulTip:{type:Boolean,default:!1},multipPointsArr:{type:Array,default:()=>[]},happenedTime:{type:String,default:""},isDoubleClickClose:{type:Boolean,default:!1}},emits:["closeVideoEmit"],setup(f,{expose:k,emit:q}){const n=f,E=q,a=o.ref(null),m=o.ref(0),C=o.ref(""),c=o.ref(""),g=o.ref("1x1"),h=o.ref(0),r=o.ref([]),w=o.ref(1),v=o.ref([]),T=o.ref(0);let M="/";try{M="/"}catch{}const B=()=>{const e=n.basePath||M;return e.endsWith("/")?e:`${e}/`};let y=null;function V(){return window.WebControl?Promise.resolve():(y||(y=import(`${B()}web-control.esm.min.js`).then(e=>{window.WebControl=e.WebControl}).catch(e=>{throw y=null,console.error("web-control.esm.min.js加载失败",e),new Error("加载web-control.esm.min.js失败")})),y)}function _(e){const t=new Date(Number(e));return t.setMinutes(t.getMinutes()-1),t.getTime()}function I(e){const t=new Date(Number(e));return t.setMinutes(t.getMinutes()+1),t.getTime()}function J(e,t){const i=[];for(let s=0;s<e.length;s+=t)i.push(e.slice(s,s+t));return i}function O(e){const t=new K;return t.setPublicKey(C.value),t.encrypt(e)}function u(e){E("closeVideoEmit",e),a.value!==null&&(a.value.JS_RequestInterface({funcName:"stopAllPreview"}),a.value.JS_HideWnd(),a.value.JS_Disconnect().then(()=>{},()=>{}))}function z(){a.value&&(a.value.JS_RequestInterface({funcName:"stopAllPreview"}),a.value.JS_HideWnd(),a.value.JS_RequestInterface({funcName:"destroyWnd"}))}function F(e){a.value.JS_RequestInterface({funcName:"getRSAPubKey",argument:JSON.stringify({keyLength:1024})}).then(t=>{t.responseMsg.data&&(C.value=t.responseMsg.data,e())})}function D(){let e=n.cameraIndexCode.trim();a.value.JS_RequestInterface({funcName:"startPreview",argument:JSON.stringify({cameraIndexCode:e,streamMode:0,transMode:1,gpuMode:0,wndId:-1})})}function N(){let e=n.cameraIndexCode,t="",i="";n.happenedTime?(t=_(n.happenedTime),i=I(n.happenedTime)):(t=Date.now()-1440*60*1e3,i=Date.now()),a.value.JS_RequestInterface({funcName:"startPlayback",argument:JSON.stringify({cameraIndexCode:e,startTimeStamp:Math.floor(t/1e3).toString(),endTimeStamp:Math.floor(i/1e3).toString(),recordLocation:1,transMode:1,gpuMode:0,wndId:-1})})}function R(){const e=v.value.map((t,i)=>({cameraIndexCode:t.indexCode.trim(),gpuMode:0,streamMode:0,transMode:1,wndId:i+1}));a.value.JS_RequestInterface({funcName:"startMultiPreviewByCameraIndexCode",argument:JSON.stringify({list:e})})}function P(){let e="",t="";n.happenedTime?(e=_(n.happenedTime),t=I(n.happenedTime)):(e=Date.now()-1440*60*1e3,t=Date.now());const i=v.value.map((s,U)=>({startTimeStamp:Math.floor(e/1e3).toString(),endTimeStamp:Math.floor(t/1e3).toString(),cameraIndexCode:s.indexCode.trim(),gpuMode:0,streamMode:0,transMode:1,wndId:U+1}));a.value.JS_RequestInterface({funcName:"startMultiPlaybackByCameraIndexCode",argument:JSON.stringify({list:i})})}function H(){F(()=>{a.value.JS_RequestInterface({funcName:"init",argument:JSON.stringify({appkey:n.usefullData.appkey,secret:O(n.usefullData.secret),ip:n.usefullData.ip,playMode:n.currentPlayType,port:n.usefullData.port,snapDir:"D:\\SnapDir",videoDir:"D:\\VideoDir",layout:g.value,enableHTTPS:1,encryptedFields:"secret",showToolbar:1,showSmart:0,buttonIDs:"0,256,257,258,259,260,512,513,514,515,516,517,768,769"})}).then(()=>{a.value.JS_Resize(n.size.windowWidth,n.size.windowHeight),n.isMulTip?n.currentPlayType===1?P():R():n.currentPlayType===1?N():D()}),n.isFullScreen&&a.value.JS_RequestInterface({funcName:"setFullScreen"})})}function j(e){const{responseMsg:t}=e;t.type===6&&(h.value=n.multipPointsArr.length,w.value=1,r.value=n.multipPointsArr,g.value=t.msg.layout,T.value=t.msg.wndNum,r.value=J(r.value,t.msg.wndNum),v.value=[...r.value[w.value-1]],a.value.JS_Disconnect().then(()=>{l()},()=>{})),t.type===7&&n.isDoubleClickClose&&u("doubleClick")}function l(){a.value=new window.WebControl({szPluginContainer:"playWnd",iServicePortStart:15900,iServicePortEnd:15900,szClassId:"23BF3B0A-2C56-4D97-9C03-0CB103AA8F11",cbConnectSuccess:()=>{a.value.JS_StartService("window",{dllPath:"./VideoPluginConnect.dll"}).then(()=>{a.value.JS_SetWindowControlCallback({cbIntegrationCallBack:j}),a.value.JS_CreateWnd("playWnd",n.size.windowWidth,n.size.windowHeight).then(()=>{H()})})},cbConnectError:()=>{a.value=null,d.toast.danger(b,{position:"top-center"}),c.value=b,window.WebControl.JS_WakeUp("VideoWebPlugin://"),m.value++,m.value<x?setTimeout(()=>l(),A):(d.toast.danger(S,{position:"top-center"}),c.value=S)},cbConnectClose:e=>{e||(a.value=null,c.value=b,m.value++,m.value<x?setTimeout(()=>l(),A):(d.toast.danger(S,{position:"top-center"}),c.value=S))}})}function W(){d.toast("播放视频需要下载插件",{position:"top-center",actionLabel:"下载插件",duration:0,onAction:()=>{G(),d.toast.success("下载插件成功",{position:"top-center"})},onDismiss:()=>u()})}function G(){try{const e=n.baseUrl+"static/VideoWebPlugin.exe",t=document.createElement("a");t.href=e,t.download="VideoWebPlugin.exe",t.style.display="none",document.body.appendChild(t),t.click(),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),u()},100)}catch{u()}}function L(){n.isMulTip&&(T.value=4,h.value=n.multipPointsArr.length,g.value=h.value<=1?"1x1":"2x2",r.value=J(n.multipPointsArr,4),v.value=[...r.value[w.value-1]])}return o.watch(()=>n.isPlayVideo,e=>{e===!0&&l(),e===!1&&u()}),o.watch(()=>n.happenedTime,()=>{P()}),o.watch(()=>n.cameraIndexCode,(e,t)=>{e!==t&&(z(),a.value.JS_Disconnect().then(()=>{l()},()=>{}))}),o.watch(c,e=>{e!==""&&W()}),o.onMounted(()=>{L(),V().then(()=>{n.isPlayVideo&&l()}).catch(()=>{W()})}),o.onBeforeUnmount(()=>{a.value&&(a.value.JS_RequestInterface({funcName:"stopAllPreview"}),a.value.JS_HideWnd(),a.value.JS_RequestInterface({funcName:"destroyWnd"}))}),k({closeVideo:u,initPlugin:l,startPlay:D,startPlayback:N,startMultiPreview:R,startMultiPlayback:P}),(e,t)=>o.withDirectives((o.openBlock(),o.createElementBlock("div",Y,null,512)),[[o.vShow,!f.isFullScreen]])}};p.install=f=>{f.component(p.name,p)};exports.GPluginVideo=p;exports.default=p;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as i, watch as y, onMounted as Y, onBeforeUnmount as $, withDirectives as X, createElementBlock as Q, openBlock as Z, vShow as ee } from "vue";
|
|
2
2
|
import te from "jsencrypt";
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
3
|
+
import { toast as d } from "../GToast/index.mjs";
|
|
4
|
+
const ne = {
|
|
5
5
|
id: "playWnd",
|
|
6
6
|
class: "playWnd"
|
|
7
|
-
},
|
|
7
|
+
}, A = 3, k = 3e3, b = "插件未启动,正在尝试启动,请稍候...", S = "插件启动失败,请检查插件是否安装!", C = {
|
|
8
8
|
__name: "index",
|
|
9
9
|
props: {
|
|
10
10
|
/** 是否播放 */
|
|
@@ -77,8 +77,8 @@ const ae = {
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
emits: ["closeVideoEmit"],
|
|
80
|
-
setup(
|
|
81
|
-
const n =
|
|
80
|
+
setup(p, { expose: E, emit: B }) {
|
|
81
|
+
const n = p, V = B, a = i(null), m = i(0), T = i(""), c = i(""), g = i("1x1"), h = i(0), r = i([]), w = i(1), f = i([]), M = i(0);
|
|
82
82
|
let _ = "/";
|
|
83
83
|
try {
|
|
84
84
|
_ = "/";
|
|
@@ -88,16 +88,16 @@ const ae = {
|
|
|
88
88
|
const e = n.basePath || _;
|
|
89
89
|
return e.endsWith("/") ? e : `${e}/`;
|
|
90
90
|
};
|
|
91
|
-
let
|
|
91
|
+
let v = null;
|
|
92
92
|
function O() {
|
|
93
|
-
return window.WebControl ? Promise.resolve() : (
|
|
93
|
+
return window.WebControl ? Promise.resolve() : (v || (v = import(
|
|
94
94
|
/* @vite-ignore */
|
|
95
95
|
`${q()}web-control.esm.min.js`
|
|
96
96
|
).then((e) => {
|
|
97
97
|
window.WebControl = e.WebControl;
|
|
98
98
|
}).catch((e) => {
|
|
99
|
-
throw
|
|
100
|
-
})),
|
|
99
|
+
throw v = null, console.error("web-control.esm.min.js加载失败", e), new Error("加载web-control.esm.min.js失败");
|
|
100
|
+
})), v);
|
|
101
101
|
}
|
|
102
102
|
function I(e) {
|
|
103
103
|
const t = new Date(Number(e));
|
|
@@ -107,7 +107,7 @@ const ae = {
|
|
|
107
107
|
const t = new Date(Number(e));
|
|
108
108
|
return t.setMinutes(t.getMinutes() + 1), t.getTime();
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function D(e, t) {
|
|
111
111
|
const o = [];
|
|
112
112
|
for (let s = 0; s < e.length; s += t)
|
|
113
113
|
o.push(e.slice(s, s + t));
|
|
@@ -133,7 +133,7 @@ const ae = {
|
|
|
133
133
|
t.responseMsg.data && (T.value = t.responseMsg.data, e());
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function N() {
|
|
137
137
|
let e = n.cameraIndexCode.trim();
|
|
138
138
|
a.value.JS_RequestInterface({
|
|
139
139
|
funcName: "startPreview",
|
|
@@ -150,7 +150,7 @@ const ae = {
|
|
|
150
150
|
})
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function R() {
|
|
154
154
|
let e = n.cameraIndexCode, t = "", o = "";
|
|
155
155
|
n.happenedTime ? (t = I(n.happenedTime), o = J(n.happenedTime)) : (t = Date.now() - 1440 * 60 * 1e3, o = Date.now()), a.value.JS_RequestInterface({
|
|
156
156
|
funcName: "startPlayback",
|
|
@@ -169,7 +169,7 @@ const ae = {
|
|
|
169
169
|
})
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function W() {
|
|
173
173
|
const e = f.value.map((t, o) => ({
|
|
174
174
|
cameraIndexCode: t.indexCode.trim(),
|
|
175
175
|
gpuMode: 0,
|
|
@@ -185,14 +185,14 @@ const ae = {
|
|
|
185
185
|
function P() {
|
|
186
186
|
let e = "", t = "";
|
|
187
187
|
n.happenedTime ? (e = I(n.happenedTime), t = J(n.happenedTime)) : (e = Date.now() - 1440 * 60 * 1e3, t = Date.now());
|
|
188
|
-
const o = f.value.map((s,
|
|
188
|
+
const o = f.value.map((s, K) => ({
|
|
189
189
|
startTimeStamp: Math.floor(e / 1e3).toString(),
|
|
190
190
|
endTimeStamp: Math.floor(t / 1e3).toString(),
|
|
191
191
|
cameraIndexCode: s.indexCode.trim(),
|
|
192
192
|
gpuMode: 0,
|
|
193
193
|
streamMode: 0,
|
|
194
194
|
transMode: 1,
|
|
195
|
-
wndId:
|
|
195
|
+
wndId: K + 1
|
|
196
196
|
}));
|
|
197
197
|
a.value.JS_RequestInterface({
|
|
198
198
|
funcName: "startMultiPlaybackByCameraIndexCode",
|
|
@@ -219,18 +219,18 @@ const ae = {
|
|
|
219
219
|
buttonIDs: "0,256,257,258,259,260,512,513,514,515,516,517,768,769"
|
|
220
220
|
})
|
|
221
221
|
}).then(() => {
|
|
222
|
-
a.value.JS_Resize(n.size.windowWidth, n.size.windowHeight), n.isMulTip ? n.currentPlayType === 1 ? P() :
|
|
222
|
+
a.value.JS_Resize(n.size.windowWidth, n.size.windowHeight), n.isMulTip ? n.currentPlayType === 1 ? P() : W() : n.currentPlayType === 1 ? R() : N();
|
|
223
223
|
}), n.isFullScreen && a.value.JS_RequestInterface({ funcName: "setFullScreen" });
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function L(e) {
|
|
227
227
|
const { responseMsg: t } = e;
|
|
228
|
-
t.type === 6 && (h.value = n.multipPointsArr.length, w.value = 1, r.value = n.multipPointsArr, g.value = t.msg.layout, M.value = t.msg.wndNum, r.value =
|
|
229
|
-
|
|
228
|
+
t.type === 6 && (h.value = n.multipPointsArr.length, w.value = 1, r.value = n.multipPointsArr, g.value = t.msg.layout, M.value = t.msg.wndNum, r.value = D(r.value, t.msg.wndNum), f.value = [...r.value[w.value - 1]], a.value.JS_Disconnect().then(() => {
|
|
229
|
+
l();
|
|
230
230
|
}, () => {
|
|
231
231
|
})), t.type === 7 && n.isDoubleClickClose && u("doubleClick");
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function l() {
|
|
234
234
|
a.value = new window.WebControl({
|
|
235
235
|
szPluginContainer: "playWnd",
|
|
236
236
|
iServicePortStart: 15900,
|
|
@@ -239,33 +239,34 @@ const ae = {
|
|
|
239
239
|
cbConnectSuccess: () => {
|
|
240
240
|
a.value.JS_StartService("window", { dllPath: "./VideoPluginConnect.dll" }).then(() => {
|
|
241
241
|
a.value.JS_SetWindowControlCallback({
|
|
242
|
-
cbIntegrationCallBack:
|
|
242
|
+
cbIntegrationCallBack: L
|
|
243
243
|
}), a.value.JS_CreateWnd("playWnd", n.size.windowWidth, n.size.windowHeight).then(() => {
|
|
244
244
|
j();
|
|
245
245
|
});
|
|
246
246
|
});
|
|
247
247
|
},
|
|
248
248
|
cbConnectError: () => {
|
|
249
|
-
a.value = null,
|
|
249
|
+
a.value = null, d.danger(b, { position: "top-center" }), c.value = b, window.WebControl.JS_WakeUp("VideoWebPlugin://"), m.value++, m.value < A ? setTimeout(() => l(), k) : (d.danger(S, { position: "top-center" }), c.value = S);
|
|
250
250
|
},
|
|
251
251
|
cbConnectClose: (e) => {
|
|
252
|
-
e || (a.value = null, c.value =
|
|
252
|
+
e || (a.value = null, c.value = b, m.value++, m.value < A ? setTimeout(() => l(), k) : (d.danger(S, { position: "top-center" }), c.value = S));
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
u()
|
|
256
|
+
function x() {
|
|
257
|
+
d("播放视频需要下载插件", {
|
|
258
|
+
position: "top-center",
|
|
259
|
+
actionLabel: "下载插件",
|
|
260
|
+
duration: 0,
|
|
261
|
+
// 不自动关闭,等用户做出选择(等价原模态框行为)
|
|
262
|
+
onAction: () => {
|
|
263
|
+
U(), d.success("下载插件成功", { position: "top-center" });
|
|
264
|
+
},
|
|
265
|
+
onDismiss: () => u()
|
|
266
|
+
// 未点下载而关闭提示,等价原"取消"
|
|
266
267
|
});
|
|
267
268
|
}
|
|
268
|
-
function
|
|
269
|
+
function U() {
|
|
269
270
|
try {
|
|
270
271
|
const e = n.baseUrl + "static/VideoWebPlugin.exe", t = document.createElement("a");
|
|
271
272
|
t.href = e, t.download = "VideoWebPlugin.exe", t.style.display = "none", document.body.appendChild(t), t.click(), setTimeout(() => {
|
|
@@ -275,44 +276,44 @@ const ae = {
|
|
|
275
276
|
u();
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
|
-
function
|
|
279
|
-
n.isMulTip && (M.value = 4, h.value = n.multipPointsArr.length, g.value = h.value <= 1 ? "1x1" : "2x2", r.value =
|
|
279
|
+
function G() {
|
|
280
|
+
n.isMulTip && (M.value = 4, h.value = n.multipPointsArr.length, g.value = h.value <= 1 ? "1x1" : "2x2", r.value = D(n.multipPointsArr, 4), f.value = [...r.value[w.value - 1]]);
|
|
280
281
|
}
|
|
281
|
-
return
|
|
282
|
-
e === !0 &&
|
|
283
|
-
}),
|
|
282
|
+
return y(() => n.isPlayVideo, (e) => {
|
|
283
|
+
e === !0 && l(), e === !1 && u();
|
|
284
|
+
}), y(() => n.happenedTime, () => {
|
|
284
285
|
P();
|
|
285
|
-
}),
|
|
286
|
+
}), y(() => n.cameraIndexCode, (e, t) => {
|
|
286
287
|
e !== t && (F(), a.value.JS_Disconnect().then(() => {
|
|
287
|
-
|
|
288
|
+
l();
|
|
288
289
|
}, () => {
|
|
289
290
|
}));
|
|
290
|
-
}),
|
|
291
|
-
e !== "" &&
|
|
291
|
+
}), y(c, (e) => {
|
|
292
|
+
e !== "" && x();
|
|
292
293
|
}), Y(() => {
|
|
293
|
-
|
|
294
|
-
n.isPlayVideo &&
|
|
294
|
+
G(), O().then(() => {
|
|
295
|
+
n.isPlayVideo && l();
|
|
295
296
|
}).catch(() => {
|
|
296
|
-
|
|
297
|
+
x();
|
|
297
298
|
});
|
|
298
299
|
}), $(() => {
|
|
299
300
|
a.value && (a.value.JS_RequestInterface({ funcName: "stopAllPreview" }), a.value.JS_HideWnd(), a.value.JS_RequestInterface({ funcName: "destroyWnd" }));
|
|
300
|
-
}),
|
|
301
|
+
}), E({
|
|
301
302
|
closeVideo: u,
|
|
302
|
-
initPlugin:
|
|
303
|
-
startPlay:
|
|
304
|
-
startPlayback:
|
|
305
|
-
startMultiPreview:
|
|
303
|
+
initPlugin: l,
|
|
304
|
+
startPlay: N,
|
|
305
|
+
startPlayback: R,
|
|
306
|
+
startMultiPreview: W,
|
|
306
307
|
startMultiPlayback: P
|
|
307
|
-
}), (e, t) => X((Z(), Q("div",
|
|
308
|
-
[ee, !
|
|
308
|
+
}), (e, t) => X((Z(), Q("div", ne, null, 512)), [
|
|
309
|
+
[ee, !p.isFullScreen]
|
|
309
310
|
]);
|
|
310
311
|
}
|
|
311
312
|
};
|
|
312
|
-
|
|
313
|
-
|
|
313
|
+
C.install = (p) => {
|
|
314
|
+
p.component(C.name, C);
|
|
314
315
|
};
|
|
315
316
|
export {
|
|
316
|
-
|
|
317
|
-
|
|
317
|
+
C as GPluginVideo,
|
|
318
|
+
C as default
|
|
318
319
|
};
|
package/lib/GToast/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),y=require("motion-v"),L=require("../GBranched-BtF7heMk.js"),p=t.reactive({items:[],max:4});let $=0;const T=new Set,q={type:"primary",position:"bottom-right",description:"",duration:4e3,actionLabel:"",showIcon:!0,closeButton:!1,dismissible:!0,pauseOnHover:!0,width:356,className:""};function V(s,n={}){const i={...q,...n,title:s},f=p.items.find(a=>!T.has(a.id)&&a.position===i.position&&a.type===i.type&&a.title===i.title&&a.description===i.description);if(f)return f.count+=1,f.resetTick+=1,f.id;const l={...i,id:++$,count:1,resetTick:0};p.items.push(l);const g=p.items.filter(a=>a.position===l.position);return g.length>p.max&&C(g[0].id),l.id}function C(s){T.delete(s);const n=p.items.findIndex(i=>i.id===s);n!==-1&&p.items.splice(n,1)}function z(){p.items.splice(0)}const M=(s,n)=>V(s,n);["primary","success","warning","danger"].forEach(s=>{M[s]=(n,i={})=>V(n,{...i,type:s})});M.dismiss=C;M.clear=z;const K=["data-type","data-fuse","data-dismissible","tabindex"],j={key:0,class:"g-toast__icon","aria-hidden":"true"},W=["innerHTML"],Z={class:"g-toast__body"},J={class:"g-toast__title"},Q={key:0,class:"g-toast__count"},ee={key:0,class:"g-toast__desc"},te=.11,oe=3,ne=24,se=40,ie=t.defineComponent({name:"GToastCard",__name:"ToastCard",props:{item:{}},setup(s){const n=s,i=[.23,1,.32,1],f=[{transform:"scaleX(1)"},{transform:"scaleX(0)"}],l={primary:'<circle cx="12" cy="12" r="9.25"/><path d="M12 11v5"/><path d="M12 7.6v.01"/>',success:'<path d="M4.5 12.6l4.7 4.7L19.5 7"/>',warning:'<path d="M12 3.6L1.6 21h20.8L12 3.6z"/><path d="M12 10v4.6"/><path d="M12 17.4v.01"/>',danger:'<circle cx="12" cy="12" r="9.25"/><path d="M9 9l6 6"/><path d="M15 9l-6 6"/>'},g=(e,o,c=.55)=>e*o*c/(o+c*Math.abs(e)),a=e=>{if(e.length<2)return 0;const[o,c]=e[0],[m,X]=e[e.length-1];return performance.now()-m>100?0:(X-c)/Math.max(1,m-o)},B=y.useReducedMotion(),r=t.ref(null),P=t.ref(null);let k=null,_=null,v=!1;const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),y=require("motion-v"),L=require("../GBranched-BtF7heMk.js"),p=t.reactive({items:[],max:4});let $=0;const T=new Set,q={type:"primary",position:"bottom-right",description:"",duration:4e3,actionLabel:"",showIcon:!0,closeButton:!1,dismissible:!0,pauseOnHover:!0,width:356,className:""};function V(s,n={}){const i={...q,...n,title:s},f=p.items.find(a=>!T.has(a.id)&&a.position===i.position&&a.type===i.type&&a.title===i.title&&a.description===i.description);if(f)return f.count+=1,f.resetTick+=1,f.id;const l={...i,id:++$,count:1,resetTick:0};p.items.push(l);const g=p.items.filter(a=>a.position===l.position);return g.length>p.max&&C(g[0].id),l.id}function C(s){T.delete(s);const n=p.items.findIndex(i=>i.id===s);n!==-1&&p.items.splice(n,1)}function z(){p.items.splice(0)}const M=(s,n)=>V(s,n);["primary","success","warning","danger"].forEach(s=>{M[s]=(n,i={})=>V(n,{...i,type:s})});M.dismiss=C;M.clear=z;const K=["data-type","data-fuse","data-dismissible","tabindex"],j={key:0,class:"g-toast__icon","aria-hidden":"true"},W=["innerHTML"],Z={class:"g-toast__body"},J={class:"g-toast__title"},Q={key:0,class:"g-toast__count"},ee={key:0,class:"g-toast__desc"},te=.11,oe=3,ne=24,se=40,ie=t.defineComponent({name:"GToastCard",__name:"ToastCard",props:{item:{}},setup(s){const n=s,i=[.23,1,.32,1],f=[{transform:"scaleX(1)"},{transform:"scaleX(0)"}],l={primary:'<circle cx="12" cy="12" r="9.25"/><path d="M12 11v5"/><path d="M12 7.6v.01"/>',success:'<path d="M4.5 12.6l4.7 4.7L19.5 7"/>',warning:'<path d="M12 3.6L1.6 21h20.8L12 3.6z"/><path d="M12 10v4.6"/><path d="M12 17.4v.01"/>',danger:'<circle cx="12" cy="12" r="9.25"/><path d="M9 9l6 6"/><path d="M15 9l-6 6"/>'},g=(e,o,c=.55)=>e*o*c/(o+c*Math.abs(e)),a=e=>{if(e.length<2)return 0;const[o,c]=e[0],[m,X]=e[e.length-1];return performance.now()-m>100?0:(X-c)/Math.max(1,m-o)},B=y.useReducedMotion(),r=t.ref(null),P=t.ref(null);let k=null,_=null,v=!1;const u={hover:!1,interacting:!1,focus:!1,hidden:!1},S=[],d=y.motionValue(0),w=y.motionValue(1),h=()=>{const e=k;e&&(u.hover||u.interacting||u.focus||u.hidden?e.pause():e.playState==="paused"&&e.play())},I=()=>{if(v||(k?.cancel(),n.item.duration<=0||!P.value))return;const e=P.value.animate(f,{duration:n.item.duration,easing:"linear",fill:"forwards"});e.onfinish=()=>E(),k=e,h()},E=(e=!1)=>{v||(v=!0,T.add(n.item.id),e||n.item.onDismiss?.(),C(n.item.id))},x=()=>{n.item.onAction?.(),E(!0)};t.watch(()=>n.item.resetTick,()=>{v||(d.set(0),w.set(1),I())}),t.onMounted(()=>{I(),S.push(d.on("change",o=>{r.value&&(r.value.style.transform=`translateY(${o}px)`)}),w.on("change",o=>{r.value&&(r.value.style.opacity=String(o))}));const e=()=>{u.hidden=document.hidden,h()};document.addEventListener("visibilitychange",e),S.push(()=>document.removeEventListener("visibilitychange",e))}),t.onUnmounted(()=>{k?.cancel(),S.forEach(e=>e()),d.stop(),w.stop()});const D=(e,o)=>{k?.pause(),v=!0,T.add(n.item.id),n.item.onDismiss?.(),!B.value&&r.value&&y.animate(d,e+r.value.offsetHeight,{type:"spring",duration:.3,bounce:0,velocity:o*1e3}),y.animate(w,0,{duration:.2,ease:i}).then(()=>C(n.item.id))},O=e=>{if(!(e.button!==0||!n.item.dismissible||_||v||e.target.closest("button"))){try{r.value?.setPointerCapture(e.pointerId)}catch{}d.stop(),_={id:e.pointerId,startY:e.clientY,grab:null,moved:!1,hist:[[performance.now(),d.get()]]},u.interacting=!0,h()}},F=e=>{const o=_;if(!o||o.id!==e.pointerId)return;if(o.grab===null){if(Math.abs(e.clientY-o.startY)<oe)return;o.grab=e.clientY-d.get(),r.value&&(r.value.dataset.swiping="")}const c=e.clientY-o.grab,m=c>=0?c:g(c,ne);d.set(m),o.moved=!0,o.hist.push([performance.now(),m]),o.hist.length>4&&o.hist.shift()},N=e=>{const o=_;if(!o||o.id!==e.pointerId)return;_=null,r.value&&delete r.value.dataset.swiping;try{r.value?.releasePointerCapture(e.pointerId)}catch{}u.interacting=!1;const c=d.get(),m=a(o.hist);if(c>0&&(m>te||c>=se&&m>=0)){D(c,m);return}o.moved&&y.animate(d,0,{type:"spring",duration:.5,bounce:.2,velocity:m*1e3}),h()},R=e=>{n.item.pauseOnHover&&e.pointerType==="mouse"&&(u.hover=!0,h())},Y=e=>{e.pointerType==="mouse"&&(u.hover=!1,h())},G=()=>{u.focus=!0,h()},A=e=>{e.currentTarget.contains(e.relatedTarget)||(u.focus=!1,h())},H=e=>{e.key==="Escape"&&n.item.dismissible&&(e.stopPropagation(),E())},U=()=>({"--gt-w":`${n.item.width}px`});return(e,o)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"cardRef",ref:r,class:t.normalizeClass(["g-toast",e.item.className]),"data-type":e.item.type,"data-fuse":e.item.duration>0?"bottom":"none","data-dismissible":e.item.dismissible?"true":"false",style:t.normalizeStyle(U()),role:"status","aria-live":"polite","aria-atomic":"true",tabindex:e.item.dismissible?0:-1,onPointerdown:O,onPointermove:F,onPointerup:N,onPointercancel:N,onPointerenter:R,onPointerleave:Y,onFocusin:G,onFocusout:A,onKeydown:H},[e.item.showIcon?(t.openBlock(),t.createElementBlock("span",j,[(t.openBlock(),t.createElementBlock("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",innerHTML:l[e.item.type]},null,8,W))])):t.createCommentVNode("",!0),t.createElementVNode("span",Z,[t.createElementVNode("span",J,[t.createTextVNode(t.toDisplayString(e.item.title)+" ",1),e.item.count>1?(t.openBlock(),t.createElementBlock("span",Q,"×"+t.toDisplayString(e.item.count),1)):t.createCommentVNode("",!0)]),e.item.description?(t.openBlock(),t.createElementBlock("span",ee,t.toDisplayString(e.item.description),1)):t.createCommentVNode("",!0)]),e.item.actionLabel?(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:"g-toast__action",onClick:x},t.toDisplayString(e.item.actionLabel),1)):t.createCommentVNode("",!0),e.item.closeButton?(t.openBlock(),t.createElementBlock("button",{key:2,type:"button",class:"g-toast__close","aria-label":"Close",onClick:E},o[0]||(o[0]=[t.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round"},[t.createElementVNode("path",{d:"M6 6l12 12M18 6L6 18"})],-1)]))):t.createCommentVNode("",!0),t.createElementVNode("i",{ref_key:"fuseRef",ref:P,class:"g-toast__fuse","aria-hidden":"true"},null,512)],46,K))}}),ae=L._export_sfc(ie,[["__scopeId","data-v-9ecb2be9"]]),re=["data-pos"],ce=t.defineComponent({name:"GToast",__name:"index",props:{max:{default:4}},setup(s){const n=s;t.watch(()=>n.max,l=>{p.max=Math.max(1,l)},{immediate:!0});const i=["top-center","top-right","bottom-right"],f=t.computed(()=>i.map(l=>({pos:l,items:p.items.filter(g=>g.position===l)})));return(l,g)=>(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(f.value,a=>(t.openBlock(),t.createElementBlock("div",{key:a.pos,class:"g-toast-view","data-pos":a.pos},[t.createVNode(t.TransitionGroup,{name:"g-toast-pop",tag:"div",class:"g-toast-stack"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.items,B=>(t.openBlock(),t.createBlock(ae,{key:B.id,item:B},null,8,["item"]))),128))]),_:2},1024)],8,re))),128))]))}}),b=L._export_sfc(ce,[["__scopeId","data-v-79e201ec"]]);b.install=s=>{s.component(b.name,b)};exports.GToast=b;exports.default=b;exports.toast=M;
|
package/lib/GToast/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive as nt, defineComponent as H, ref as
|
|
1
|
+
import { reactive as nt, defineComponent as H, ref as D, watch as U, onMounted as ot, onUnmounted as st, createElementBlock as m, openBlock as c, normalizeStyle as it, normalizeClass as at, createCommentVNode as w, createElementVNode as k, createTextVNode as rt, toDisplayString as P, computed as ct, createBlock as R, Teleport as lt, Fragment as Y, renderList as V, createVNode as ut, TransitionGroup as dt, withCtx as pt } from "vue";
|
|
2
2
|
import { useReducedMotion as mt, motionValue as A, animate as x } from "motion-v";
|
|
3
3
|
import { _ as G } from "../GBranched-vnLlYOl9.mjs";
|
|
4
4
|
const f = nt({
|
|
@@ -48,7 +48,7 @@ const vt = ["data-type", "data-fuse", "data-dismissible", "tabindex"], yt = {
|
|
|
48
48
|
key: 0,
|
|
49
49
|
class: "g-toast__icon",
|
|
50
50
|
"aria-hidden": "true"
|
|
51
|
-
},
|
|
51
|
+
}, bt = ["innerHTML"], _t = { class: "g-toast__body" }, wt = { class: "g-toast__title" }, kt = {
|
|
52
52
|
key: 0,
|
|
53
53
|
class: "g-toast__count"
|
|
54
54
|
}, Tt = {
|
|
@@ -70,23 +70,23 @@ const vt = ["data-type", "data-fuse", "data-dismissible", "tabindex"], yt = {
|
|
|
70
70
|
if (t.length < 2) return 0;
|
|
71
71
|
const [e, r] = t[0], [p, et] = t[t.length - 1];
|
|
72
72
|
return performance.now() - p > 100 ? 0 : (et - r) / Math.max(1, p - e);
|
|
73
|
-
}, T = mt(), a =
|
|
74
|
-
let
|
|
73
|
+
}, T = mt(), a = D(null), L = D(null);
|
|
74
|
+
let b = null, _ = null, y = !1;
|
|
75
75
|
const u = { hover: !1, interacting: !1, focus: !1, hidden: !1 }, S = [], d = A(0), M = A(1), g = () => {
|
|
76
|
-
const t =
|
|
76
|
+
const t = b;
|
|
77
77
|
t && (u.hover || u.interacting || u.focus || u.hidden ? t.pause() : t.playState === "paused" && t.play());
|
|
78
78
|
}, F = () => {
|
|
79
|
-
if (y || (
|
|
79
|
+
if (y || (b?.cancel(), n.item.duration <= 0 || !L.value)) return;
|
|
80
80
|
const t = L.value.animate(h, {
|
|
81
81
|
duration: n.item.duration,
|
|
82
82
|
easing: "linear",
|
|
83
83
|
fill: "forwards"
|
|
84
84
|
});
|
|
85
|
-
t.onfinish = () => I(),
|
|
86
|
-
}, I = () => {
|
|
87
|
-
y || (y = !0, C.add(n.item.id), E(n.item.id));
|
|
85
|
+
t.onfinish = () => I(), b = t, g();
|
|
86
|
+
}, I = (t = !1) => {
|
|
87
|
+
y || (y = !0, C.add(n.item.id), t || n.item.onDismiss?.(), E(n.item.id));
|
|
88
88
|
}, $ = () => {
|
|
89
|
-
n.item.onAction?.(), I();
|
|
89
|
+
n.item.onAction?.(), I(!0);
|
|
90
90
|
};
|
|
91
91
|
U(
|
|
92
92
|
() => n.item.resetTick,
|
|
@@ -107,22 +107,22 @@ const vt = ["data-type", "data-fuse", "data-dismissible", "tabindex"], yt = {
|
|
|
107
107
|
};
|
|
108
108
|
document.addEventListener("visibilitychange", t), S.push(() => document.removeEventListener("visibilitychange", t));
|
|
109
109
|
}), st(() => {
|
|
110
|
-
|
|
110
|
+
b?.cancel(), S.forEach((t) => t()), d.stop(), M.stop();
|
|
111
111
|
});
|
|
112
112
|
const z = (t, e) => {
|
|
113
|
-
|
|
113
|
+
b?.pause(), y = !0, C.add(n.item.id), n.item.onDismiss?.(), !T.value && a.value && x(d, t + a.value.offsetHeight, {
|
|
114
114
|
type: "spring",
|
|
115
115
|
duration: 0.3,
|
|
116
116
|
bounce: 0,
|
|
117
117
|
velocity: e * 1e3
|
|
118
118
|
}), x(M, 0, { duration: 0.2, ease: s }).then(() => E(n.item.id));
|
|
119
119
|
}, K = (t) => {
|
|
120
|
-
if (!(t.button !== 0 || !n.item.dismissible ||
|
|
120
|
+
if (!(t.button !== 0 || !n.item.dismissible || _ || y || t.target.closest("button"))) {
|
|
121
121
|
try {
|
|
122
122
|
a.value?.setPointerCapture(t.pointerId);
|
|
123
123
|
} catch {
|
|
124
124
|
}
|
|
125
|
-
d.stop(),
|
|
125
|
+
d.stop(), _ = {
|
|
126
126
|
id: t.pointerId,
|
|
127
127
|
startY: t.clientY,
|
|
128
128
|
grab: null,
|
|
@@ -131,7 +131,7 @@ const vt = ["data-type", "data-fuse", "data-dismissible", "tabindex"], yt = {
|
|
|
131
131
|
}, u.interacting = !0, g();
|
|
132
132
|
}
|
|
133
133
|
}, j = (t) => {
|
|
134
|
-
const e =
|
|
134
|
+
const e = _;
|
|
135
135
|
if (!e || e.id !== t.pointerId) return;
|
|
136
136
|
if (e.grab === null) {
|
|
137
137
|
if (Math.abs(t.clientY - e.startY) < It) return;
|
|
@@ -140,9 +140,9 @@ const vt = ["data-type", "data-fuse", "data-dismissible", "tabindex"], yt = {
|
|
|
140
140
|
const r = t.clientY - e.grab, p = r >= 0 ? r : v(r, Pt);
|
|
141
141
|
d.set(p), e.moved = !0, e.hist.push([performance.now(), p]), e.hist.length > 4 && e.hist.shift();
|
|
142
142
|
}, B = (t) => {
|
|
143
|
-
const e =
|
|
143
|
+
const e = _;
|
|
144
144
|
if (!e || e.id !== t.pointerId) return;
|
|
145
|
-
|
|
145
|
+
_ = null, a.value && delete a.value.dataset.swiping;
|
|
146
146
|
try {
|
|
147
147
|
a.value?.releasePointerCapture(t.pointerId);
|
|
148
148
|
} catch {
|
|
@@ -201,9 +201,9 @@ const vt = ["data-type", "data-fuse", "data-dismissible", "tabindex"], yt = {
|
|
|
201
201
|
"stroke-linecap": "round",
|
|
202
202
|
"stroke-linejoin": "round",
|
|
203
203
|
innerHTML: l[t.item.type]
|
|
204
|
-
}, null, 8,
|
|
204
|
+
}, null, 8, bt))
|
|
205
205
|
])) : w("", !0),
|
|
206
|
-
k("span",
|
|
206
|
+
k("span", _t, [
|
|
207
207
|
k("span", wt, [
|
|
208
208
|
rt(P(t.item.title) + " ", 1),
|
|
209
209
|
t.item.count > 1 ? (c(), m("span", kt, "×" + P(t.item.count), 1)) : w("", !0)
|
|
@@ -241,7 +241,7 @@ const vt = ["data-type", "data-fuse", "data-dismissible", "tabindex"], yt = {
|
|
|
241
241
|
}, null, 512)
|
|
242
242
|
], 46, vt));
|
|
243
243
|
}
|
|
244
|
-
}), Lt = /* @__PURE__ */ G(Et, [["__scopeId", "data-v-
|
|
244
|
+
}), Lt = /* @__PURE__ */ G(Et, [["__scopeId", "data-v-9ecb2be9"]]), St = ["data-pos"], xt = /* @__PURE__ */ H({
|
|
245
245
|
name: "GToast",
|
|
246
246
|
__name: "index",
|
|
247
247
|
props: {
|
|
@@ -259,8 +259,8 @@ const vt = ["data-type", "data-fuse", "data-dismissible", "tabindex"], yt = {
|
|
|
259
259
|
const s = ["top-center", "top-right", "bottom-right"], h = ct(
|
|
260
260
|
() => s.map((l) => ({ pos: l, items: f.items.filter((v) => v.position === l) }))
|
|
261
261
|
);
|
|
262
|
-
return (l, v) => (c(),
|
|
263
|
-
(c(!0), m(
|
|
262
|
+
return (l, v) => (c(), R(lt, { to: "body" }, [
|
|
263
|
+
(c(!0), m(Y, null, V(h.value, (i) => (c(), m("div", {
|
|
264
264
|
key: i.pos,
|
|
265
265
|
class: "g-toast-view",
|
|
266
266
|
"data-pos": i.pos
|
|
@@ -271,7 +271,7 @@ const vt = ["data-type", "data-fuse", "data-dismissible", "tabindex"], yt = {
|
|
|
271
271
|
class: "g-toast-stack"
|
|
272
272
|
}, {
|
|
273
273
|
default: pt(() => [
|
|
274
|
-
(c(!0), m(
|
|
274
|
+
(c(!0), m(Y, null, V(i.items, (T) => (c(), R(Lt, {
|
|
275
275
|
key: T.id,
|
|
276
276
|
item: T
|
|
277
277
|
}, null, 8, ["item"]))), 128))
|
package/lib/GToast/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.g-toast[data-v-
|
|
1
|
+
.g-toast[data-v-9ecb2be9]{position:relative;box-sizing:border-box;display:flex;align-items:center;gap:10px;width:min(var(--gt-w),calc(100vw - 32px));padding:13px 16px;overflow:hidden;border:1px solid var(--g-border-color, #dcdfe3);border-radius:12px;background:var(--g-bg-color, #ffffff);color:var(--g-text-color, rgba(0, 0, 0, .88));font-size:13px;line-height:1.45;box-shadow:0 1px 2px #0000000d,0 6px 16px #0000001a;outline:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;touch-action:none;cursor:grab;pointer-events:auto;-webkit-tap-highlight-color:transparent}.g-toast[data-type=primary][data-v-9ecb2be9]{--gt-accent: var(--g-primary-color, #039be5)}.g-toast[data-type=success][data-v-9ecb2be9]{--gt-accent: var(--g-success-color, #50c189)}.g-toast[data-type=warning][data-v-9ecb2be9]{--gt-accent: var(--g-warning-color, #f78716)}.g-toast[data-type=danger][data-v-9ecb2be9]{--gt-accent: var(--g-danger-color, #e1594d)}.g-toast[data-v-9ecb2be9]:before{content:"";position:absolute;top:0;bottom:0;left:0;width:3px;background:var(--gt-accent)}.g-toast[data-swiping][data-v-9ecb2be9]{cursor:grabbing}.g-toast[data-dismissible=false][data-v-9ecb2be9]{touch-action:auto;cursor:default}.g-toast__icon[data-v-9ecb2be9]{flex:none;display:inline-flex;width:30px;height:30px;align-items:center;justify-content:center;border-radius:999px;color:var(--gt-accent);background:color-mix(in srgb,var(--gt-accent) 12%,transparent)}.g-toast__icon svg[data-v-9ecb2be9]{width:16px;height:16px}.g-toast__body[data-v-9ecb2be9]{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.g-toast__title[data-v-9ecb2be9]{display:flex;align-items:center;gap:6px;font-weight:500}.g-toast__count[data-v-9ecb2be9]{flex:none;height:16px;padding:0 6px;border-radius:999px;background:var(--gt-accent);color:#fff;font-size:11px;font-weight:600;line-height:16px}.g-toast__desc[data-v-9ecb2be9]{color:var(--g-text-secondary-color, rgba(0, 0, 0, .45));font-size:12px}.g-toast__action[data-v-9ecb2be9]{flex:none;height:26px;padding:0 10px;border:0;border-radius:6px;background:var(--gt-accent);color:#fff;font-family:inherit;font-size:12px;font-weight:500;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:transform .16s cubic-bezier(.23,1,.32,1),filter .16s ease}.g-toast__action[data-v-9ecb2be9]:hover{filter:brightness(.94)}.g-toast__action[data-v-9ecb2be9]:active{transform:scale(.96)}.g-toast__close[data-v-9ecb2be9]{flex:none;display:grid;place-items:center;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:transparent;color:var(--g-text-secondary-color, rgba(0, 0, 0, .45));cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background-color .16s ease,color .16s ease}.g-toast__close[data-v-9ecb2be9]:hover{background:color-mix(in srgb,currentColor 10%,transparent);color:var(--g-text-color, rgba(0, 0, 0, .88))}.g-toast__close svg[data-v-9ecb2be9]{width:12px;height:12px}.g-toast__fuse[data-v-9ecb2be9]{position:absolute;right:0;bottom:0;left:0;height:2px;transform-origin:left;background:linear-gradient(90deg,transparent 0%,color-mix(in srgb,var(--gt-accent) 18%,transparent) 9%,color-mix(in srgb,var(--gt-accent) 50%,transparent) 18%,color-mix(in srgb,var(--gt-accent) 84%,transparent) 28%,var(--gt-accent) 38%,var(--gt-accent) 62%,color-mix(in srgb,var(--gt-accent) 84%,transparent) 72%,color-mix(in srgb,var(--gt-accent) 50%,transparent) 82%,color-mix(in srgb,var(--gt-accent) 18%,transparent) 91%,transparent 100%);pointer-events:none}.g-toast[data-fuse=none] .g-toast__fuse[data-v-9ecb2be9]{opacity:0}@media(prefers-reduced-motion:reduce){.g-toast[data-v-9ecb2be9],.g-toast__action[data-v-9ecb2be9],.g-toast__close[data-v-9ecb2be9]{transition:none}}.g-toast-view[data-v-79e201ec]{position:fixed;top:0;right:0;left:0;display:flex;justify-content:center;padding:24px 32px;pointer-events:none;z-index:9999}.g-toast-view[data-pos=top-center][data-v-79e201ec]{top:calc(24px + env(safe-area-inset-top,0px));--gt-in-y: -16px;--gt-out-y: -8px}.g-toast-view[data-pos=top-right][data-v-79e201ec]{top:calc(24px + env(safe-area-inset-top,0px));justify-content:flex-end;--gt-in-y: -16px;--gt-out-y: -8px}.g-toast-view[data-pos=bottom-right][data-v-79e201ec]{top:auto;bottom:calc(24px + env(safe-area-inset-bottom,0px));justify-content:flex-end;--gt-in-y: 16px;--gt-out-y: 8px}.g-toast-stack[data-v-79e201ec]{position:relative;display:flex;flex-direction:column;gap:10px}.g-toast-view[data-pos=top-center] .g-toast-stack[data-v-79e201ec],.g-toast-view[data-pos=top-right] .g-toast-stack[data-v-79e201ec]{flex-direction:column-reverse}@media(max-width:600px){.g-toast-view[data-v-79e201ec]{padding:16px}}.g-toast-pop-enter-active[data-v-79e201ec]{transition:transform .3s cubic-bezier(.23,1,.32,1),opacity .25s ease}.g-toast-pop-enter-from[data-v-79e201ec]{opacity:0;transform:translateY(var(--gt-in-y)) scale(.97)}.g-toast-pop-leave-active[data-v-79e201ec]{position:absolute;transition:transform .2s ease,opacity .2s ease}.g-toast-view[data-pos=top-right] .g-toast-pop-leave-active[data-v-79e201ec],.g-toast-view[data-pos=bottom-right] .g-toast-pop-leave-active[data-v-79e201ec]{right:0;margin-left:auto}.g-toast-view[data-pos=top-center] .g-toast-pop-leave-active[data-v-79e201ec]{left:0;right:0;margin-inline:auto}.g-toast-pop-leave-to[data-v-79e201ec]{opacity:0;transform:translateY(var(--gt-out-y)) scale(.96)}.g-toast-pop-move[data-v-79e201ec]{transition:transform .3s cubic-bezier(.23,1,.32,1)}@media(prefers-reduced-motion:reduce){.g-toast-pop-enter-active[data-v-79e201ec],.g-toast-pop-leave-active[data-v-79e201ec],.g-toast-pop-move[data-v-79e201ec]{transition-duration:0s}}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface GlideSelectOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
tag?: string;
|
|
5
|
+
}
|
|
6
|
+
interface GlideSelectProps {
|
|
7
|
+
options?: (string | GlideSelectOption)[];
|
|
8
|
+
value?: string;
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
showTags?: boolean;
|
|
12
|
+
accentColor?: string;
|
|
13
|
+
surfaceColor?: string;
|
|
14
|
+
highlightColor?: string;
|
|
15
|
+
textColor?: string;
|
|
16
|
+
size?: 'sm' | 'md' | 'lg';
|
|
17
|
+
radius?: number;
|
|
18
|
+
menuWidth?: number;
|
|
19
|
+
placement?: 'top' | 'bottom';
|
|
20
|
+
align?: 'left' | 'right';
|
|
21
|
+
popDuration?: number;
|
|
22
|
+
glideDuration?: number;
|
|
23
|
+
rememberPosition?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
ariaLabel?: string;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
declare const _default: import('vue').DefineComponent<GlideSelectProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
29
|
+
change: (value: string, option: GlideSelectOption) => any;
|
|
30
|
+
}, string, import('vue').PublicProps, Readonly<GlideSelectProps> & Readonly<{
|
|
31
|
+
onChange?: ((value: string, option: GlideSelectOption) => any) | undefined;
|
|
32
|
+
}>, {
|
|
33
|
+
className: string;
|
|
34
|
+
value: string;
|
|
35
|
+
size: "sm" | "md" | "lg";
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
placeholder: string;
|
|
38
|
+
accentColor: string;
|
|
39
|
+
radius: number;
|
|
40
|
+
textColor: string;
|
|
41
|
+
placement: "top" | "bottom";
|
|
42
|
+
align: "left" | "right";
|
|
43
|
+
defaultValue: string;
|
|
44
|
+
ariaLabel: string;
|
|
45
|
+
options: (string | GlideSelectOption)[];
|
|
46
|
+
showTags: boolean;
|
|
47
|
+
surfaceColor: string;
|
|
48
|
+
highlightColor: string;
|
|
49
|
+
menuWidth: number;
|
|
50
|
+
popDuration: number;
|
|
51
|
+
glideDuration: number;
|
|
52
|
+
rememberPosition: boolean;
|
|
53
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
54
|
+
rootRef: HTMLDivElement;
|
|
55
|
+
triggerRef: HTMLButtonElement;
|
|
56
|
+
menuRef: HTMLDivElement;
|
|
57
|
+
pillRef: HTMLSpanElement;
|
|
58
|
+
}, HTMLDivElement>;
|
|
59
|
+
export default _default;
|
|
@@ -45,8 +45,8 @@ declare const __VLS_component: import('vue').DefineComponent<AnimatedListProps,
|
|
|
45
45
|
}>, {
|
|
46
46
|
className: string;
|
|
47
47
|
loading: boolean;
|
|
48
|
-
stagger: number;
|
|
49
48
|
items: any[];
|
|
49
|
+
stagger: number;
|
|
50
50
|
showGradients: boolean;
|
|
51
51
|
itemClassName: string;
|
|
52
52
|
displayScrollbar: boolean;
|
|
@@ -29,9 +29,9 @@ declare const _default: import('vue').DefineComponent<ShinyTextProps, {}, {}, {}
|
|
|
29
29
|
color: string;
|
|
30
30
|
direction: "left" | "right";
|
|
31
31
|
speed: number;
|
|
32
|
+
pauseOnHover: boolean;
|
|
32
33
|
spread: number;
|
|
33
34
|
shineColor: string;
|
|
34
35
|
yoyo: boolean;
|
|
35
|
-
pauseOnHover: boolean;
|
|
36
36
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
37
37
|
export default _default;
|
|
@@ -43,6 +43,13 @@ export interface GToastOptions {
|
|
|
43
43
|
* @default undefined
|
|
44
44
|
*/
|
|
45
45
|
onAction?: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* @description 未点击操作按钮时的关闭回调:下滑关闭、Escape、右上角关闭按钮、
|
|
48
|
+
* 倒计时自动关闭均触发;点击操作按钮关闭不触发(走 onAction)
|
|
49
|
+
* @version 0.4.2
|
|
50
|
+
* @default undefined
|
|
51
|
+
*/
|
|
52
|
+
onDismiss?: () => void;
|
|
46
53
|
/**
|
|
47
54
|
* @description 是否显示类型图标(内置线性 SVG,随 type 着色)
|
|
48
55
|
* @version 0.3.14
|
|
@@ -96,6 +103,8 @@ export interface GToastItem {
|
|
|
96
103
|
width: number;
|
|
97
104
|
className: string;
|
|
98
105
|
onAction?: () => void;
|
|
106
|
+
/** 未点操作按钮的关闭回调(用户下滑 / Escape / 关闭按钮 / 倒计时到点) */
|
|
107
|
+
onDismiss?: () => void;
|
|
99
108
|
/** 同内容重复触发时的合并计数(多次点击去重,不重复弹卡) */
|
|
100
109
|
count: number;
|
|
101
110
|
/** 合并时自增,卡片监听后重置倒计时与进度条 */
|
package/lib/index/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../GCount/index.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../GCount/index.js"),d=require("../GDialog/index.js"),G=require("../GTable/index.js"),o=require("../GVideo/index.js"),l=require("../GProgress/index.js"),n=require("../GScreen/index.js"),i=require("../GPluginVideo/index.js"),s=require("../GPie3D/index.js"),c=require("../GRing/index.js"),f=require("../GPicker/index.js"),q=require("../GFuzzyText/index.js"),e=require("../GCard/index.js"),g=require("../GScroller/index.js"),S=require("../GShinyText/index.js"),T=require("../GSteps/index.js"),P=require("../GButton/index.js"),p=require("../GInput/index.js"),h=require("../GTag/index.js"),D=require("../GTree/index.js"),m=require("../GSlider/index.js"),y=require("../GRadio/index.js"),B=require("../GSegment/index.js"),t=require("../GToast/index.js"),x=require("../GBranched-BtF7heMk.js"),b=require("../GDropdown/index.js"),u={GCount:a.default,GDialog:d.default,GTable:G.default,GVideo:o.default,GProgress:l.default,GScreen:n.default,GPluginVideo:i.default,GPie3D:s.default,GRing:c.default,GPicker:f.default,GFuzzyText:q.default,GCard:e.default,GScroller:g.default,GShinyText:S.default,GSteps:T.default,GButton:P.default,GInput:p.default,GTag:h.default,GTree:D.default,GSlider:m.default,GRadio:y.default,GSegment:B.default,GToast:t.default,GBranched:x.GBranched,GDropdown:b.default},R=z=>{Object.keys(u).forEach(C=>{const r=u[C];z.component(r.name,r)})},V={install:R};exports.GCount=a.default;exports.GDialog=d.default;exports.GTable=G.default;exports.GVideo=o.default;exports.GProgress=l.default;exports.GScreen=n.default;exports.GPluginVideo=i.default;exports.GPie3D=s.default;exports.GRing=c.default;exports.GPicker=f.default;exports.GFuzzyText=q.default;exports.GCard=e.default;exports.cardPresets=e.cardPresets;exports.GScroller=g.default;exports.GShinyText=S.default;exports.GSteps=T.default;exports.GButton=P.default;exports.GInput=p.default;exports.GTag=h.default;exports.GTree=D.default;exports.GSlider=m.default;exports.GRadio=y.default;exports.GSegment=B.default;exports.GToast=t.default;exports.toast=t.toast;exports.GBranched=x.GBranched;exports.GDropdown=b.default;exports.default=V;
|