geekin-devtoys 0.3.11 → 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/{GBubble → GBranched}/index.js +1 -1
- package/lib/GBranched/index.mjs +5 -0
- package/lib/GBranched/style.css +1 -0
- package/lib/GBranched-BtF7heMk.js +1 -0
- package/lib/GBranched-vnLlYOl9.mjs +197 -0
- package/lib/GButton/index.js +1 -1
- package/lib/GButton/index.mjs +10 -10
- package/lib/GButton/style.css +1 -1
- package/lib/GCard/index.js +1 -1
- package/lib/GCard/index.mjs +1 -1
- package/lib/GDialog/index.js +1 -1
- package/lib/GDialog/index.mjs +29 -29
- package/lib/GDialog/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/GInput/index.js +1 -1
- package/lib/GInput/index.mjs +2 -2
- package/lib/GInput/style.css +1 -1
- package/lib/GPicker/index.js +1 -0
- package/lib/{GInputTreeTag → GPicker}/index.mjs +111 -111
- package/lib/GPicker/style.css +1 -0
- package/lib/GPicker.d.ts +1 -0
- package/lib/GPie3D/index.js +1 -1
- package/lib/GPie3D/index.mjs +1 -1
- package/lib/GPluginVideo/index.js +1 -1
- package/lib/GPluginVideo/index.mjs +59 -58
- package/lib/GProgress/index.js +1 -1
- package/lib/GProgress/index.mjs +1 -1
- package/lib/GRadio/index.js +1 -0
- package/lib/GRadio/index.mjs +198 -0
- package/lib/GRadio/style.css +1 -0
- package/lib/GRadio.d.ts +1 -0
- package/lib/GRing/index.js +1 -1
- package/lib/GRing/index.mjs +1 -1
- package/lib/GScroller/index.js +1 -1
- package/lib/GScroller/index.mjs +1 -1
- package/lib/GSegment/index.js +1 -0
- package/lib/GSegment/index.mjs +364 -0
- package/lib/GSegment/style.css +1 -0
- package/lib/GSegment.d.ts +1 -0
- package/lib/GSlider/index.js +1 -0
- package/lib/GSlider/index.mjs +184 -0
- package/lib/GSlider/style.css +1 -0
- package/lib/GSlider.d.ts +1 -0
- package/lib/GSteps/index.js +1 -1
- package/lib/GSteps/index.mjs +1 -1
- package/lib/GTable/index.js +1 -1
- package/lib/GTable/index.mjs +1 -1
- package/lib/GTag/index.js +1 -1
- package/lib/GTag/index.mjs +7 -5
- package/lib/GTag/style.css +1 -0
- package/lib/GToast/index.js +1 -0
- package/lib/GToast/index.mjs +292 -0
- package/lib/GToast/style.css +1 -0
- package/lib/GToast.d.ts +1 -0
- package/lib/GTree/index.js +1 -1
- package/lib/GTree/index.mjs +1 -1
- package/lib/GVideo/index.js +2 -2
- package/lib/GVideo/index.mjs +1 -1
- package/lib/components/GBranched/index.d.ts +29 -0
- package/lib/components/GBranched/types.d.ts +139 -0
- package/lib/components/GDialog/index.d.ts +3 -90
- package/lib/components/GDialog/types.d.ts +89 -0
- package/lib/components/GDropdown/index.d.ts +59 -0
- package/lib/components/GRadio/index.d.ts +45 -0
- package/lib/components/GRadio/types.d.ts +94 -0
- package/lib/components/GScroller/index.d.ts +1 -1
- package/lib/components/GSegment/index.d.ts +30 -0
- package/lib/components/GSegment/types.d.ts +125 -0
- package/lib/components/GShinyText/index.d.ts +1 -1
- package/lib/components/GSlider/index.d.ts +27 -0
- package/lib/components/GSlider/types.d.ts +88 -0
- package/lib/components/GTag/index.d.ts +3 -0
- package/lib/components/GToast/ToastCard.d.ts +9 -0
- package/lib/components/GToast/index.d.ts +7 -0
- package/lib/components/GToast/store.d.ts +46 -0
- package/lib/components/GToast/types.d.ts +121 -0
- package/lib/index/index.js +1 -1
- package/lib/index/index.mjs +70 -53
- package/lib/index/style.css +17 -5
- package/lib/index.d.ts +16 -5
- package/package.json +58 -13
- package/lib/GBubble/index.mjs +0 -5
- package/lib/GBubble/style.css +0 -1
- package/lib/GBubble-C3cM9Put.mjs +0 -216
- package/lib/GBubble-Dph0YDkU.js +0 -2
- package/lib/GInputTreeTag/index.js +0 -1
- package/lib/GInputTreeTag/style.css +0 -1
- package/lib/assets/GTag.css +0 -1
- package/lib/components/GBubble/index.d.ts +0 -61
- /package/lib/{GBubble.d.ts → GBranched.d.ts} +0 -0
- /package/lib/{GInputTreeTag.d.ts → GDropdown.d.ts} +0 -0
- /package/lib/components/{GInputTreeTag → GPicker}/index.d.ts +0 -0
package/lib/GTable/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),A=require("sortablejs"),y=require("../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),A=require("sortablejs"),y=require("../GBranched-BtF7heMk.js");var k=e.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(i){return(F,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"})]))}}),S=k,z=e.defineComponent({name:"Operation",__name:"operation",setup(i){return(F,n)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M389.44 768a96.064 96.064 0 0 1 181.12 0H896v64H570.56a96.064 96.064 0 0 1-181.12 0H128v-64zm192-288a96.064 96.064 0 0 1 181.12 0H896v64H762.56a96.064 96.064 0 0 1-181.12 0H128v-64zm-320-288a96.064 96.064 0 0 1 181.12 0H896v64H442.56a96.064 96.064 0 0 1-181.12 0H128v-64z"})]))}}),x=z,T={name:"zh-cn",el:{breadcrumb:{label:"面包屑"},colorpicker:{confirm:"确定",clear:"清空",defaultLabel:"颜色选择器",description:"当前颜色 {color},按 Enter 键选择新颜色",alphaLabel:"选择透明度的值",alphaDescription:"透明度 {alpha}, 当前颜色 {color}",hueLabel:"选择色相值",hueDescription:"色相 {hue}, 当前颜色 {color}",svLabel:"选择饱和度与明度的值",svDescription:"饱和度 {saturation}, 明度 {brightness}, 当前颜色 {color}",predefineDescription:"选择 {value} 作为颜色"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",dateTablePrompt:"使用方向键与 Enter 键可选择日期",monthTablePrompt:"使用方向键与 Enter 键可选择月份",yearTablePrompt:"使用方向键与 Enter 键可选择年份",selectedDate:"已选日期",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},weeksFull:{sun:"星期日",mon:"星期一",tue:"星期二",wed:"星期三",thu:"星期四",fri:"星期五",sat:"星期六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},inputNumber:{decrease:"减少数值",increase:"增加数值"},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},mention:{loading:"加载中"},dropdown:{toggleDropdown:"切换下拉选项"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页",page:"页",prev:"上一页",next:"下一页",currentPage:"第 {pager} 页",prevPages:"向前 {pager} 页",nextPages:"向后 {pager} 页",deprecationWarning:"你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"},dialog:{close:"关闭此对话框"},drawer:{close:"关闭此对话框"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!",close:"关闭此对话框"},upload:{deleteTip:"按 Delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},slider:{defaultLabel:"滑块介于 {min} 至 {max}",defaultRangeStartLabel:"选择起始值",defaultRangeEndLabel:"选择结束值"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计",selectAllLabel:"选择所有行",selectRowLabel:"选择当前行",expandRowLabel:"展开当前行",collapseRowLabel:"收起当前行",sortLabel:"按 {column} 排序",filterLabel:"按 {column} 过滤"},tag:{close:"关闭此标签"},tour:{next:"下一步",previous:"上一步",finish:"结束导览",close:"关闭此对话框"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},carousel:{leftArrow:"上一张幻灯片",rightArrow:"下一张幻灯片",indicator:"幻灯片切换至索引 {index}"}}};const N={class:"g-table"},P={key:0,class:"g-table-action"},L={key:1},V={class:"g-dropdown-link"},$=e.defineComponent({name:"GTable",inheritAttrs:!1,__name:"index",props:{data:{default:()=>[]},pagination:{type:Boolean,default:!1},operationLabel:{default:"操作"},operaWidth:{default:160},dragSort:{type:Boolean,default:!1},dragSortProps:{default:()=>[]},currentPage:{default:1},pageSize:{default:10},total:{default:0},pageSizes:{default:()=>[10,20,50,100]},layout:{default:"total, sizes, prev, pager, next"},size:{default:"default"}},emits:["update:currentPage","update:pageSize","sorted:data"],setup(i,{emit:F}){const n=i,d=F,B=u=>{d("update:pageSize",u)},w=u=>{d("update:currentPage",u)},b=e.useSlots(),h=u=>!!b[u],E=e.useAttrs(),v=u=>{const t=!!E["page-size"],r=!!E["current-page"];if(t&&r){const a=Number(E["page-size"]||10),o=Number(E["current-page"]||1);return u+1+a*(o-1)}return u},p=e.ref(null),m=e.shallowRef(null),_=(u=20)=>new Promise(t=>{let r=0;const a=()=>{if(!p.value){t(null);return}const o=p.value.$el.querySelectorAll("tbody");for(let s=0;s<o.length;s++)if(o[s].querySelectorAll("tr").length>0){t(o[s]);return}if(++r>=u){t(null);return}setTimeout(a,500)};a()}),C=async()=>{if(p.value)try{const u=await _();if(!u){console.error("未找到包含数据行的 tbody 元素");return}m.value?.destroy?.(),m.value=new A(u,{draggable:"tr",handle:".g-drag-icon",animation:200,ghostClass:"g-sortable-ghost",forceFallback:!0,onStart:function(t){t.item.classList.add("dragging")},onEnd:async function(t){t.item.classList.remove("dragging");const{oldIndex:r,newIndex:a}=t;if(r===void 0||a===void 0){console.error("无效的索引值");return}const o=[...n.data],[s]=o.splice(r,1);if(o.splice(a,0,s),n.dragSortProps.length===0){d("sorted:data",o);return}if(n.dragSortProps.length>0){const f=o.map(D=>{const g={};return n.dragSortProps.forEach(l=>{g[l]=D[l]}),g});d("sorted:data",f)}}})}catch(u){console.error("初始化拖拽排序失败:",u)}};return e.onMounted(()=>{n.dragSort&&C()}),e.watch(()=>n.data,()=>{n.dragSort&&C()}),e.onBeforeUnmount(()=>{m.value?.destroy?.(),m.value=null}),(u,t)=>{const r=e.resolveComponent("el-icon"),a=e.resolveComponent("el-table-column"),o=e.resolveComponent("el-dropdown-menu"),s=e.resolveComponent("el-dropdown"),f=e.resolveComponent("el-table"),D=e.resolveComponent("el-pagination"),g=e.resolveComponent("el-config-provider");return e.openBlock(),e.createElementBlock("div",N,[u.$slots.action?(e.openBlock(),e.createElementBlock("div",P,[e.renderSlot(u.$slots,"action",{},void 0,!0)])):e.createCommentVNode("",!0),e.createVNode(f,e.mergeProps({data:u.data||[]},u.$attrs,{size:u.size,stripe:"",ref_key:"tableRef",ref:p,class:["g-table-main",`g-table-main--${u.size}`]}),{empty:e.withCtx(()=>[u.$slots.empty?e.renderSlot(u.$slots,"empty",{key:0},void 0,!0):(e.openBlock(),e.createElementBlock("span",L,"暂无数据"))]),default:e.withCtx(()=>[u.dragSort?(e.openBlock(),e.createBlock(a,{key:0,label:"序号",width:"65"},{default:e.withCtx(l=>[e.createElementVNode("div",null,[e.createTextVNode(e.toDisplayString(v(l.$index))+" ",1),e.createVNode(r,{class:"g-drag-icon"},{default:e.withCtx(()=>[e.createVNode(e.unref(x))]),_:1})])]),_:1})):e.createCommentVNode("",!0),e.renderSlot(u.$slots,"default",{},void 0,!0),h("operations")?(e.openBlock(),e.createBlock(a,{key:1,fixed:"right",label:u.operationLabel||"操作",width:u.operaWidth},{default:e.withCtx(l=>[e.renderSlot(u.$slots,"operations",{row:l.row,index:l.$index},void 0,!0),h("more")?(e.openBlock(),e.createBlock(s,{key:0,size:"small",style:{"vertical-align":"baseline"}},{dropdown:e.withCtx(()=>[e.createVNode(o,null,{default:e.withCtx(()=>[e.renderSlot(u.$slots,"more",{row:l.row,index:l.$index},void 0,!0)]),_:2},1024)]),default:e.withCtx(()=>[e.createElementVNode("span",V,[t[0]||(t[0]=e.createTextVNode(" 更多 ")),e.createVNode(r,null,{default:e.withCtx(()=>[e.createVNode(e.unref(S))]),_:1})])]),_:2},1024)):e.createCommentVNode("",!0)]),_:3},8,["label","width"])):e.createCommentVNode("",!0)]),_:3},16,["data","size","class"]),u.pagination?(e.openBlock(),e.createBlock(g,{key:1,locale:e.unref(T)},{default:e.withCtx(()=>[e.createVNode(D,{class:"g-pagination-contianer",size:"small","current-page":u.currentPage,"page-size":u.pageSize,total:u.total,"page-sizes":u.pageSizes,layout:u.layout,onSizeChange:B,onCurrentChange:w},null,8,["current-page","page-size","total","page-sizes","layout"])]),_:1},8,["locale"])):e.createCommentVNode("",!0)])}}}),c=y._export_sfc($,[["__scopeId","data-v-90ad3ecc"]]);c.install=i=>{i.component(c.name,c)};exports.GTable=c;exports.default=c;
|
package/lib/GTable/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as z, createElementBlock as m, openBlock as s, createElementVNode as b, useSlots as M, useAttrs as R, ref as N, shallowRef as I, onMounted as V, watch as W, onBeforeUnmount as j, resolveComponent as d, createCommentVNode as p, createVNode as E, createBlock as C, renderSlot as g, mergeProps as q, withCtx as o, createTextVNode as P, toDisplayString as G, unref as A } from "vue";
|
|
2
2
|
import Y from "sortablejs";
|
|
3
|
-
import { _ as O } from "../
|
|
3
|
+
import { _ as O } from "../GBranched-vnLlYOl9.mjs";
|
|
4
4
|
var U = /* @__PURE__ */ z({
|
|
5
5
|
name: "ArrowDown",
|
|
6
6
|
__name: "arrow-down",
|
package/lib/GTag/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),i=require("../GBranched-BtF7heMk.js"),p=["draggable"],u={key:0,class:"g-tag__icon"},m={key:1,class:"g-tag__text"},b=e.defineComponent({name:"GTag",__name:"index",props:{type:{},variant:{},size:{},closable:{type:Boolean},draggable:{type:Boolean}},emits:["close","dragstart","dragend"],setup(a,{emit:l}){const r=a,n=l,d=t=>{n("close",t)},g=t=>{r.draggable&&n("dragstart",t)},c=t=>{r.draggable&&n("dragend",t)};return(t,s)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["g-tag",["g-tag--"+t.type,"g-tag--"+t.variant,"g-tag--"+(t.size??"small"),{"is-closable":t.closable,"is-draggable":t.draggable}]]),draggable:t.draggable,onDragstart:g,onDragend:c},[t.$slots.icon?(e.openBlock(),e.createElementBlock("span",u,[e.renderSlot(t.$slots,"icon",{},void 0,!0)])):e.createCommentVNode("",!0),t.$slots.default?(e.openBlock(),e.createElementBlock("span",m,[e.renderSlot(t.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0),t.closable?(e.openBlock(),e.createElementBlock("span",{key:2,class:"g-tag__close",onClick:e.withModifiers(d,["stop"])},s[0]||(s[0]=[e.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[e.createElementVNode("path",{d:"M6 6l12 12M18 6L6 18",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round"})],-1)]))):e.createCommentVNode("",!0)],42,p))}}),o=i._export_sfc(b,[["__scopeId","data-v-6b73580e"]]);o.install=a=>{a.component(o.name,o)};exports.GTag=o;exports.default=o;
|
package/lib/GTag/index.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { _ as k } from "../
|
|
1
|
+
import { defineComponent as b, createElementBlock as a, openBlock as o, normalizeClass as f, createCommentVNode as r, renderSlot as d, withModifiers as _, createElementVNode as i } from "vue";
|
|
2
|
+
import { _ as k } from "../GBranched-vnLlYOl9.mjs";
|
|
3
3
|
const v = ["draggable"], y = {
|
|
4
4
|
key: 0,
|
|
5
5
|
class: "g-tag__icon"
|
|
6
6
|
}, h = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "g-tag__text"
|
|
9
|
-
}, C = /* @__PURE__ */
|
|
9
|
+
}, C = /* @__PURE__ */ b({
|
|
10
10
|
name: "GTag",
|
|
11
11
|
__name: "index",
|
|
12
12
|
props: {
|
|
13
13
|
type: {},
|
|
14
14
|
variant: {},
|
|
15
|
+
size: {},
|
|
15
16
|
closable: { type: Boolean },
|
|
16
17
|
draggable: { type: Boolean }
|
|
17
18
|
},
|
|
@@ -25,9 +26,10 @@ const v = ["draggable"], y = {
|
|
|
25
26
|
l.draggable && s("dragend", e);
|
|
26
27
|
};
|
|
27
28
|
return (e, g) => (o(), a("span", {
|
|
28
|
-
class:
|
|
29
|
+
class: f(["g-tag", [
|
|
29
30
|
"g-tag--" + e.type,
|
|
30
31
|
"g-tag--" + e.variant,
|
|
32
|
+
"g-tag--" + (e.size ?? "small"),
|
|
31
33
|
{
|
|
32
34
|
"is-closable": e.closable,
|
|
33
35
|
"is-draggable": e.draggable
|
|
@@ -63,7 +65,7 @@ const v = ["draggable"], y = {
|
|
|
63
65
|
]))) : r("", !0)
|
|
64
66
|
], 42, v));
|
|
65
67
|
}
|
|
66
|
-
}), n = /* @__PURE__ */ k(C, [["__scopeId", "data-v-
|
|
68
|
+
}), n = /* @__PURE__ */ k(C, [["__scopeId", "data-v-6b73580e"]]);
|
|
67
69
|
n.install = (t) => {
|
|
68
70
|
t.component(n.name, n);
|
|
69
71
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset "UTF-8";.g-tag[data-v-6b73580e]{--g-tag-type-color: var(--g-text-color, rgba(0, 0, 0, .88));display:inline-flex;align-items:center;gap:4px;max-width:100%;height:var(--g-tag-height, var(--g-size-middle-height, 32px));padding:0 8px;font-size:var(--g-tag-font-size, var(--g-size-middle-font-size, 14px));line-height:1;white-space:nowrap;-webkit-user-select:none;user-select:none;border-radius:var(--g-tag-radius, 4px);transition:all .2s cubic-bezier(.645,.045,.355,1)}.g-tag[data-v-6b73580e]:has(.g-tag__close){padding-right:4px}.g-tag.is-draggable[data-v-6b73580e]{cursor:grab}.g-tag--large[data-v-6b73580e]{--g-tag-height: var(--g-size-large-height, 40px);--g-tag-font-size: var(--g-size-large-font-size, 16px)}.g-tag--small[data-v-6b73580e]{--g-tag-height: var(--g-size-small-height, 24px);--g-tag-font-size: var(--g-size-small-font-size, 12px)}.g-tag__text[data-v-6b73580e]{overflow:hidden;text-overflow:ellipsis}.g-tag__icon[data-v-6b73580e]{display:inline-flex;align-items:center}.g-tag__icon[data-v-6b73580e] svg{width:1em;height:1em;display:block}.g-tag__close[data-v-6b73580e]{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:16px;height:16px;cursor:pointer;border-radius:50%;transition:background-color .2s cubic-bezier(.645,.045,.355,1)}.g-tag__close svg[data-v-6b73580e]{width:10px;height:10px;display:block}.g-tag__close[data-v-6b73580e]:hover{background:color-mix(in srgb,currentcolor 20%,transparent)}.g-tag--solid[data-v-6b73580e]{color:#fff;background:var(--g-tag-type-color)}.g-tag--solid .g-tag__close[data-v-6b73580e]:hover{color:var(--g-tag-type-color)}.g-tag--filled[data-v-6b73580e]{color:var(--g-tag-type-color);background:color-mix(in srgb,var(--g-tag-type-color) 12%,transparent)}.g-tag--primary[data-v-6b73580e]{--g-tag-type-color: var(--g-primary-color, #039be5)}.g-tag--success[data-v-6b73580e]{--g-tag-type-color: var(--g-success-color, #50c189)}.g-tag--warning[data-v-6b73580e]{--g-tag-type-color: var(--g-warning-color, #f78716)}.g-tag--danger[data-v-6b73580e]{--g-tag-type-color: var(--g-danger-color, #e1594d)}.g-tag--emphasis[data-v-6b73580e]{--g-tag-type-color: var(--g-emphasis-color, #000)}.g-tag--emphasis.g-tag--solid[data-v-6b73580e]{color:var(--g-emphasis-text-color, #fff);background:var(--g-tag-type-color)}.g-tag--emphasis.g-tag--solid .g-tag__close[data-v-6b73580e]:hover{color:var(--g-emphasis-text-color, #fff)}.g-tag--default[data-v-6b73580e]{--g-tag-type-color: var(--g-text-color, rgba(0, 0, 0, .88));--g-tag-solid-bg: var(--g-tag-default-color, #e8e8eb)}.g-tag--default.g-tag--solid[data-v-6b73580e]{color:var(--g-text-color, rgba(0, 0, 0, .88));background:var(--g-tag-solid-bg)}.g-tag--default.g-tag--filled[data-v-6b73580e]{color:var(--g-text-color, rgba(0, 0, 0, .88));background:var(--g-tag-default-color, #e8e8eb)}
|
|
@@ -0,0 +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 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;
|
|
@@ -0,0 +1,292 @@
|
|
|
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
|
+
import { useReducedMotion as mt, motionValue as A, animate as x } from "motion-v";
|
|
3
|
+
import { _ as G } from "../GBranched-vnLlYOl9.mjs";
|
|
4
|
+
const f = nt({
|
|
5
|
+
items: [],
|
|
6
|
+
max: 4
|
|
7
|
+
});
|
|
8
|
+
let ft = 0;
|
|
9
|
+
const C = /* @__PURE__ */ new Set(), ht = {
|
|
10
|
+
type: "primary",
|
|
11
|
+
position: "bottom-right",
|
|
12
|
+
description: "",
|
|
13
|
+
duration: 4e3,
|
|
14
|
+
actionLabel: "",
|
|
15
|
+
showIcon: !0,
|
|
16
|
+
closeButton: !1,
|
|
17
|
+
dismissible: !0,
|
|
18
|
+
pauseOnHover: !0,
|
|
19
|
+
width: 356,
|
|
20
|
+
className: ""
|
|
21
|
+
};
|
|
22
|
+
function X(o, n = {}) {
|
|
23
|
+
const s = { ...ht, ...n, title: o }, h = f.items.find(
|
|
24
|
+
(i) => !C.has(i.id) && i.position === s.position && i.type === s.type && i.title === s.title && i.description === s.description
|
|
25
|
+
);
|
|
26
|
+
if (h)
|
|
27
|
+
return h.count += 1, h.resetTick += 1, h.id;
|
|
28
|
+
const l = { ...s, id: ++ft, count: 1, resetTick: 0 };
|
|
29
|
+
f.items.push(l);
|
|
30
|
+
const v = f.items.filter((i) => i.position === l.position);
|
|
31
|
+
return v.length > f.max && E(v[0].id), l.id;
|
|
32
|
+
}
|
|
33
|
+
function E(o) {
|
|
34
|
+
C.delete(o);
|
|
35
|
+
const n = f.items.findIndex((s) => s.id === o);
|
|
36
|
+
n !== -1 && f.items.splice(n, 1);
|
|
37
|
+
}
|
|
38
|
+
function gt() {
|
|
39
|
+
f.items.splice(0);
|
|
40
|
+
}
|
|
41
|
+
const O = (o, n) => X(o, n);
|
|
42
|
+
["primary", "success", "warning", "danger"].forEach((o) => {
|
|
43
|
+
O[o] = (n, s = {}) => X(n, { ...s, type: o });
|
|
44
|
+
});
|
|
45
|
+
O.dismiss = E;
|
|
46
|
+
O.clear = gt;
|
|
47
|
+
const vt = ["data-type", "data-fuse", "data-dismissible", "tabindex"], yt = {
|
|
48
|
+
key: 0,
|
|
49
|
+
class: "g-toast__icon",
|
|
50
|
+
"aria-hidden": "true"
|
|
51
|
+
}, bt = ["innerHTML"], _t = { class: "g-toast__body" }, wt = { class: "g-toast__title" }, kt = {
|
|
52
|
+
key: 0,
|
|
53
|
+
class: "g-toast__count"
|
|
54
|
+
}, Tt = {
|
|
55
|
+
key: 0,
|
|
56
|
+
class: "g-toast__desc"
|
|
57
|
+
}, Mt = 0.11, It = 3, Pt = 24, Ct = 40, Et = /* @__PURE__ */ H({
|
|
58
|
+
name: "GToastCard",
|
|
59
|
+
__name: "ToastCard",
|
|
60
|
+
props: {
|
|
61
|
+
item: {}
|
|
62
|
+
},
|
|
63
|
+
setup(o) {
|
|
64
|
+
const n = o, s = [0.23, 1, 0.32, 1], h = [{ transform: "scaleX(1)" }, { transform: "scaleX(0)" }], l = {
|
|
65
|
+
primary: '<circle cx="12" cy="12" r="9.25"/><path d="M12 11v5"/><path d="M12 7.6v.01"/>',
|
|
66
|
+
success: '<path d="M4.5 12.6l4.7 4.7L19.5 7"/>',
|
|
67
|
+
warning: '<path d="M12 3.6L1.6 21h20.8L12 3.6z"/><path d="M12 10v4.6"/><path d="M12 17.4v.01"/>',
|
|
68
|
+
danger: '<circle cx="12" cy="12" r="9.25"/><path d="M9 9l6 6"/><path d="M15 9l-6 6"/>'
|
|
69
|
+
}, v = (t, e, r = 0.55) => t * e * r / (e + r * Math.abs(t)), i = (t) => {
|
|
70
|
+
if (t.length < 2) return 0;
|
|
71
|
+
const [e, r] = t[0], [p, et] = t[t.length - 1];
|
|
72
|
+
return performance.now() - p > 100 ? 0 : (et - r) / Math.max(1, p - e);
|
|
73
|
+
}, T = mt(), a = D(null), L = D(null);
|
|
74
|
+
let b = null, _ = null, y = !1;
|
|
75
|
+
const u = { hover: !1, interacting: !1, focus: !1, hidden: !1 }, S = [], d = A(0), M = A(1), g = () => {
|
|
76
|
+
const t = b;
|
|
77
|
+
t && (u.hover || u.interacting || u.focus || u.hidden ? t.pause() : t.playState === "paused" && t.play());
|
|
78
|
+
}, F = () => {
|
|
79
|
+
if (y || (b?.cancel(), n.item.duration <= 0 || !L.value)) return;
|
|
80
|
+
const t = L.value.animate(h, {
|
|
81
|
+
duration: n.item.duration,
|
|
82
|
+
easing: "linear",
|
|
83
|
+
fill: "forwards"
|
|
84
|
+
});
|
|
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
|
+
}, $ = () => {
|
|
89
|
+
n.item.onAction?.(), I(!0);
|
|
90
|
+
};
|
|
91
|
+
U(
|
|
92
|
+
() => n.item.resetTick,
|
|
93
|
+
() => {
|
|
94
|
+
y || (d.set(0), M.set(1), F());
|
|
95
|
+
}
|
|
96
|
+
), ot(() => {
|
|
97
|
+
F(), S.push(
|
|
98
|
+
d.on("change", (e) => {
|
|
99
|
+
a.value && (a.value.style.transform = `translateY(${e}px)`);
|
|
100
|
+
}),
|
|
101
|
+
M.on("change", (e) => {
|
|
102
|
+
a.value && (a.value.style.opacity = String(e));
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
const t = () => {
|
|
106
|
+
u.hidden = document.hidden, g();
|
|
107
|
+
};
|
|
108
|
+
document.addEventListener("visibilitychange", t), S.push(() => document.removeEventListener("visibilitychange", t));
|
|
109
|
+
}), st(() => {
|
|
110
|
+
b?.cancel(), S.forEach((t) => t()), d.stop(), M.stop();
|
|
111
|
+
});
|
|
112
|
+
const z = (t, e) => {
|
|
113
|
+
b?.pause(), y = !0, C.add(n.item.id), n.item.onDismiss?.(), !T.value && a.value && x(d, t + a.value.offsetHeight, {
|
|
114
|
+
type: "spring",
|
|
115
|
+
duration: 0.3,
|
|
116
|
+
bounce: 0,
|
|
117
|
+
velocity: e * 1e3
|
|
118
|
+
}), x(M, 0, { duration: 0.2, ease: s }).then(() => E(n.item.id));
|
|
119
|
+
}, K = (t) => {
|
|
120
|
+
if (!(t.button !== 0 || !n.item.dismissible || _ || y || t.target.closest("button"))) {
|
|
121
|
+
try {
|
|
122
|
+
a.value?.setPointerCapture(t.pointerId);
|
|
123
|
+
} catch {
|
|
124
|
+
}
|
|
125
|
+
d.stop(), _ = {
|
|
126
|
+
id: t.pointerId,
|
|
127
|
+
startY: t.clientY,
|
|
128
|
+
grab: null,
|
|
129
|
+
moved: !1,
|
|
130
|
+
hist: [[performance.now(), d.get()]]
|
|
131
|
+
}, u.interacting = !0, g();
|
|
132
|
+
}
|
|
133
|
+
}, j = (t) => {
|
|
134
|
+
const e = _;
|
|
135
|
+
if (!e || e.id !== t.pointerId) return;
|
|
136
|
+
if (e.grab === null) {
|
|
137
|
+
if (Math.abs(t.clientY - e.startY) < It) return;
|
|
138
|
+
e.grab = t.clientY - d.get(), a.value && (a.value.dataset.swiping = "");
|
|
139
|
+
}
|
|
140
|
+
const r = t.clientY - e.grab, p = r >= 0 ? r : v(r, Pt);
|
|
141
|
+
d.set(p), e.moved = !0, e.hist.push([performance.now(), p]), e.hist.length > 4 && e.hist.shift();
|
|
142
|
+
}, B = (t) => {
|
|
143
|
+
const e = _;
|
|
144
|
+
if (!e || e.id !== t.pointerId) return;
|
|
145
|
+
_ = null, a.value && delete a.value.dataset.swiping;
|
|
146
|
+
try {
|
|
147
|
+
a.value?.releasePointerCapture(t.pointerId);
|
|
148
|
+
} catch {
|
|
149
|
+
}
|
|
150
|
+
u.interacting = !1;
|
|
151
|
+
const r = d.get(), p = i(e.hist);
|
|
152
|
+
if (r > 0 && (p > Mt || r >= Ct && p >= 0)) {
|
|
153
|
+
z(r, p);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
e.moved && x(d, 0, {
|
|
157
|
+
type: "spring",
|
|
158
|
+
duration: 0.5,
|
|
159
|
+
bounce: 0.2,
|
|
160
|
+
velocity: p * 1e3
|
|
161
|
+
}), g();
|
|
162
|
+
}, W = (t) => {
|
|
163
|
+
n.item.pauseOnHover && t.pointerType === "mouse" && (u.hover = !0, g());
|
|
164
|
+
}, Z = (t) => {
|
|
165
|
+
t.pointerType === "mouse" && (u.hover = !1, g());
|
|
166
|
+
}, q = () => {
|
|
167
|
+
u.focus = !0, g();
|
|
168
|
+
}, J = (t) => {
|
|
169
|
+
t.currentTarget.contains(t.relatedTarget) || (u.focus = !1, g());
|
|
170
|
+
}, Q = (t) => {
|
|
171
|
+
t.key === "Escape" && n.item.dismissible && (t.stopPropagation(), I());
|
|
172
|
+
}, tt = () => ({ "--gt-w": `${n.item.width}px` });
|
|
173
|
+
return (t, e) => (c(), m("div", {
|
|
174
|
+
ref_key: "cardRef",
|
|
175
|
+
ref: a,
|
|
176
|
+
class: at(["g-toast", t.item.className]),
|
|
177
|
+
"data-type": t.item.type,
|
|
178
|
+
"data-fuse": t.item.duration > 0 ? "bottom" : "none",
|
|
179
|
+
"data-dismissible": t.item.dismissible ? "true" : "false",
|
|
180
|
+
style: it(tt()),
|
|
181
|
+
role: "status",
|
|
182
|
+
"aria-live": "polite",
|
|
183
|
+
"aria-atomic": "true",
|
|
184
|
+
tabindex: t.item.dismissible ? 0 : -1,
|
|
185
|
+
onPointerdown: K,
|
|
186
|
+
onPointermove: j,
|
|
187
|
+
onPointerup: B,
|
|
188
|
+
onPointercancel: B,
|
|
189
|
+
onPointerenter: W,
|
|
190
|
+
onPointerleave: Z,
|
|
191
|
+
onFocusin: q,
|
|
192
|
+
onFocusout: J,
|
|
193
|
+
onKeydown: Q
|
|
194
|
+
}, [
|
|
195
|
+
t.item.showIcon ? (c(), m("span", yt, [
|
|
196
|
+
(c(), m("svg", {
|
|
197
|
+
viewBox: "0 0 24 24",
|
|
198
|
+
fill: "none",
|
|
199
|
+
stroke: "currentColor",
|
|
200
|
+
"stroke-width": "2",
|
|
201
|
+
"stroke-linecap": "round",
|
|
202
|
+
"stroke-linejoin": "round",
|
|
203
|
+
innerHTML: l[t.item.type]
|
|
204
|
+
}, null, 8, bt))
|
|
205
|
+
])) : w("", !0),
|
|
206
|
+
k("span", _t, [
|
|
207
|
+
k("span", wt, [
|
|
208
|
+
rt(P(t.item.title) + " ", 1),
|
|
209
|
+
t.item.count > 1 ? (c(), m("span", kt, "×" + P(t.item.count), 1)) : w("", !0)
|
|
210
|
+
]),
|
|
211
|
+
t.item.description ? (c(), m("span", Tt, P(t.item.description), 1)) : w("", !0)
|
|
212
|
+
]),
|
|
213
|
+
t.item.actionLabel ? (c(), m("button", {
|
|
214
|
+
key: 1,
|
|
215
|
+
type: "button",
|
|
216
|
+
class: "g-toast__action",
|
|
217
|
+
onClick: $
|
|
218
|
+
}, P(t.item.actionLabel), 1)) : w("", !0),
|
|
219
|
+
t.item.closeButton ? (c(), m("button", {
|
|
220
|
+
key: 2,
|
|
221
|
+
type: "button",
|
|
222
|
+
class: "g-toast__close",
|
|
223
|
+
"aria-label": "Close",
|
|
224
|
+
onClick: I
|
|
225
|
+
}, e[0] || (e[0] = [
|
|
226
|
+
k("svg", {
|
|
227
|
+
viewBox: "0 0 24 24",
|
|
228
|
+
fill: "none",
|
|
229
|
+
stroke: "currentColor",
|
|
230
|
+
"stroke-width": "2.5",
|
|
231
|
+
"stroke-linecap": "round"
|
|
232
|
+
}, [
|
|
233
|
+
k("path", { d: "M6 6l12 12M18 6L6 18" })
|
|
234
|
+
], -1)
|
|
235
|
+
]))) : w("", !0),
|
|
236
|
+
k("i", {
|
|
237
|
+
ref_key: "fuseRef",
|
|
238
|
+
ref: L,
|
|
239
|
+
class: "g-toast__fuse",
|
|
240
|
+
"aria-hidden": "true"
|
|
241
|
+
}, null, 512)
|
|
242
|
+
], 46, vt));
|
|
243
|
+
}
|
|
244
|
+
}), Lt = /* @__PURE__ */ G(Et, [["__scopeId", "data-v-9ecb2be9"]]), St = ["data-pos"], xt = /* @__PURE__ */ H({
|
|
245
|
+
name: "GToast",
|
|
246
|
+
__name: "index",
|
|
247
|
+
props: {
|
|
248
|
+
max: { default: 4 }
|
|
249
|
+
},
|
|
250
|
+
setup(o) {
|
|
251
|
+
const n = o;
|
|
252
|
+
U(
|
|
253
|
+
() => n.max,
|
|
254
|
+
(l) => {
|
|
255
|
+
f.max = Math.max(1, l);
|
|
256
|
+
},
|
|
257
|
+
{ immediate: !0 }
|
|
258
|
+
);
|
|
259
|
+
const s = ["top-center", "top-right", "bottom-right"], h = ct(
|
|
260
|
+
() => s.map((l) => ({ pos: l, items: f.items.filter((v) => v.position === l) }))
|
|
261
|
+
);
|
|
262
|
+
return (l, v) => (c(), R(lt, { to: "body" }, [
|
|
263
|
+
(c(!0), m(Y, null, V(h.value, (i) => (c(), m("div", {
|
|
264
|
+
key: i.pos,
|
|
265
|
+
class: "g-toast-view",
|
|
266
|
+
"data-pos": i.pos
|
|
267
|
+
}, [
|
|
268
|
+
ut(dt, {
|
|
269
|
+
name: "g-toast-pop",
|
|
270
|
+
tag: "div",
|
|
271
|
+
class: "g-toast-stack"
|
|
272
|
+
}, {
|
|
273
|
+
default: pt(() => [
|
|
274
|
+
(c(!0), m(Y, null, V(i.items, (T) => (c(), R(Lt, {
|
|
275
|
+
key: T.id,
|
|
276
|
+
item: T
|
|
277
|
+
}, null, 8, ["item"]))), 128))
|
|
278
|
+
]),
|
|
279
|
+
_: 2
|
|
280
|
+
}, 1024)
|
|
281
|
+
], 8, St))), 128))
|
|
282
|
+
]));
|
|
283
|
+
}
|
|
284
|
+
}), N = /* @__PURE__ */ G(xt, [["__scopeId", "data-v-79e201ec"]]);
|
|
285
|
+
N.install = (o) => {
|
|
286
|
+
o.component(N.name, N);
|
|
287
|
+
};
|
|
288
|
+
export {
|
|
289
|
+
N as GToast,
|
|
290
|
+
N as default,
|
|
291
|
+
O as toast
|
|
292
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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}}
|
package/lib/GToast.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/lib/GTree/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),te=require("../
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),te=require("../GBranched-BtF7heMk.js"),ae=["draggable","onClick","onDragstart","onDragover","onDrop"],ne=["onClick"],le={key:1,class:"g-tree__switcher is-placeholder"},de={key:2,class:"g-tree__icon"},se={class:"g-tree__label"},oe={key:0,class:"g-tree__empty"},re=n.defineComponent({__name:"index",props:{data:{default:()=>[]},props:{default:()=>({})},nodeKey:{default:"id"},defaultExpandAll:{type:Boolean,default:!1},defaultExpandedKeys:{default:()=>[]},autoExpandParent:{type:Boolean,default:!0},draggable:{type:Boolean,default:!1},allowDrop:{type:Function,default:()=>!0},disabled:{type:Boolean,default:!1},showLine:{type:Boolean,default:!1},expandOnClickNode:{type:Boolean,default:!0},highlightCurrent:{type:Boolean,default:!0},currentKey:{default:null},emptyText:{default:"暂无数据"},filterMethod:{type:Function,default:void 0}},emits:["update:currentKey","current-change","node-click","node-expand","node-collapse","node-drag-start","node-drag-enter","node-drag-over","node-drag-end","node-drop"],setup(S,{expose:z,emit:G}){const d=S,p=G,I=n.computed(()=>d.nodeKey||"id"),j=n.computed(()=>d.props?.label||"label"),T=n.computed(()=>d.props?.children||"children"),q=n.computed(()=>d.props?.disabled||"disabled"),g=e=>e?e[I.value]:void 0,A=e=>e?e[j.value]??"":"",h=e=>e?e[T.value]:void 0,R=e=>!!e?.[q.value],_=e=>{const t=h(e);return Array.isArray(t)&&t.length>0},u=n.ref(new Set),L=(e,t,a=[])=>{for(const l of e||[]){const o=h(l);if(o?.length){if(a.push(g(l)),g(l)===t)return a;const r=L(o,t,a);if(r)return r;a.pop()}else if(g(l)===t)return a}return null},D=e=>{const t=L(d.data||[],e,[]);if(!t?.length)return;const a=new Set(u.value);t.forEach(l=>a.add(l)),u.value=a},Y=()=>{const e=new Set;if(d.defaultExpandAll){const t=a=>(a||[]).forEach(l=>{_(l)&&(e.add(g(l)),t(h(l)))});t(d.data)}else(d.defaultExpandedKeys||[]).forEach(t=>{e.add(t),d.autoExpandParent&&D(t)});u.value=e};n.watch(()=>d.data,Y,{immediate:!0});const M=n.ref(""),m=n.ref(null),K=n.ref(new Set),H=e=>{if(M.value=e??"",!e){m.value=null,K.value=new Set;return}const t=new Set,a=new Set,l=o=>{let r=!1;for(const s of o||[]){const f=d.filterMethod?d.filterMethod(e,s):String(A(s)??"").toLowerCase().includes(String(e).toLowerCase()),v=l(h(s));(f||v)&&t.add(g(s)),v&&a.add(g(s)),(f||v)&&(r=!0)}return r};l(d.data||[]),m.value=t,K.value=a},F=n.computed(()=>{const e=[],t=m.value!==null,a=(l,o,r)=>{(l||[]).forEach((s,f)=>{const v=g(s);if(t&&!m.value.has(v))return;const N=_(s),$=t?N&&K.value.has(v):u.value.has(v),O=f===(l?.length??0)-1;e.push({data:s,key:v,level:o,isLast:O,ancestorIsLast:r,expandable:N,expanded:$,disabled:R(s)}),N&&$&&a(h(s),o+1,[...r,O])})};return a(d.data,0,[]),e}),J=(e,t)=>{const a=t-1;return a<e.level-1?["is-ancestor",{"is-hidden":e.ancestorIsLast[a]}]:["is-connector",{"is-last":e.isLast}]},P=e=>{if(d.disabled||e.disabled)return;const t=new Set(u.value);t.has(e.key)?(t.delete(e.key),p("node-collapse",e.data)):(t.add(e.key),p("node-expand",e.data)),u.value=t},y=n.ref(d.currentKey),V=e=>{y.value=e,p("update:currentKey",e),p("current-change",e!=null?x(e):null,e)},Q=e=>{d.disabled||(p("node-click",e.data,e),!e.disabled&&(d.highlightCurrent&&e.key!==y.value&&V(e.key),e.expandable&&d.expandOnClickNode&&P(e)))};n.watch(()=>d.currentKey,e=>{e!==y.value&&(y.value=e,e!=null&&d.autoExpandParent&&D(e))});const x=e=>{const t=b(e);return t?t.node:null},b=(e,t=d.data,a=null)=>{const l=t||[];for(let o=0;o<l.length;o++){const r=l[o];if(g(r)===e)return{node:r,list:l,index:o,parent:a};const s=h(r);if(s?.length){const f=b(e,s,r);if(f)return f}}return null},U=(e,t)=>{const a=x(e);if(!a)return!1;let l=!1;const o=r=>{for(const s of r||[]){if(g(s)===t){l=!0;return}o(h(s))}};return o(h(a)||[]),l},c=n.ref(null),i=n.ref(null),E=n.ref(null);let B=null;const C=()=>{B&&(clearTimeout(B),B=null)},W=(e,t)=>{if(d.disabled||t.disabled){e.preventDefault();return}c.value={key:t.key,data:t.data},e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",String(t.key)),p("node-drag-start",t.data,e)},X=(e,t)=>!c.value||e.disabled||e.key===c.value.key||U(c.value.key,e.key)?!1:d.allowDrop(c.value.data,e.data,t),Z=(e,t)=>{if(!c.value||d.disabled)return;e.preventDefault(),e.dataTransfer.dropEffect="move";const a=e.currentTarget.getBoundingClientRect(),l=(e.clientY-a.top)/Math.max(a.height,1);let o;if(t.expandable?o=l<.25?"before":l>.75?"after":"inner":o=l<.5?"before":"after",!X(t,o)){i.value=null,C();return}i.value={key:t.key,type:o},p("node-drag-over",t.data,c.value.data,e),E.value!==t.key&&(E.value=t.key,C(),p("node-drag-enter",t.data,c.value.data,e),d.autoExpandParent&&t.expandable&&!t.expanded&&(B=setTimeout(()=>{const r=new Set(u.value);r.add(t.key),u.value=r,p("node-expand",t.data)},600)))},w=(e,t)=>{if(!c.value||!i.value||d.disabled||i.value.key!==t.key)return;const{type:a}=i.value,{key:l,data:o}=c.value;i.value=null,E.value=null,C();const r=b(l);if(r&&r.list.splice(r.index,1),a==="inner"){const s=x(t.key);let f=h(s);if(Array.isArray(f)||(f=[],s[T.value]=f),f.push(o),!u.value.has(t.key)){const v=new Set(u.value);v.add(t.key),u.value=v}}else{const s=b(t.key);s&&s.list.splice(a==="before"?s.index:s.index+1,0,o)}p("node-drop",t.data,o,a,e)},ee=e=>{C();const t=c.value;c.value=null,i.value=null,E.value=null,t&&p("node-drag-end",t.data,e)};return z({filter:H,getNode:x,setCurrentKey:V,expandAll:()=>{const e=new Set,t=a=>(a||[]).forEach(l=>{_(l)&&(e.add(g(l)),t(h(l)))});t(d.data),u.value=e},collapseAll:()=>{u.value=new Set},expandNode:(e,t=!0)=>{const a=new Set(u.value);t?(a.add(e),d.autoExpandParent&&D(e)):a.delete(e),u.value=a},getCurrentKey:()=>y.value}),(e,t)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["g-tree",{"is-disabled":e.disabled,"g-tree--line":e.showLine}])},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.value,a=>(n.openBlock(),n.createElementBlock("div",{key:a.key,class:n.normalizeClass(["g-tree__row",[{"is-current":e.highlightCurrent&&y.value!==null&&a.key===y.value,"is-disabled-node":a.disabled,"is-drop-before":i.value&&i.value.key===a.key&&i.value.type==="before","is-drop-after":i.value&&i.value.key===a.key&&i.value.type==="after","is-drop-inner":i.value&&i.value.key===a.key&&i.value.type==="inner"}]]),draggable:e.draggable&&!e.disabled&&!a.disabled,onClick:l=>Q(a),onDragstart:l=>W(l,a),onDragover:l=>Z(l,a),onDrop:l=>w(l,a),onDragend:t[0]||(t[0]=l=>ee(l))},[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(a.level,l=>(n.openBlock(),n.createElementBlock("span",{key:l,class:n.normalizeClass(["g-tree__indent",J(a,l)]),"aria-hidden":"true"},null,2))),128)),a.expandable?(n.openBlock(),n.createElementBlock("span",{key:0,class:n.normalizeClass(["g-tree__switcher",{"is-expanded":a.expanded}]),onClick:n.withModifiers(l=>P(a),["stop"])},t[1]||(t[1]=[n.createElementVNode("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[n.createElementVNode("path",{d:"M9 6l6 6-6 6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]),10,ne)):(n.openBlock(),n.createElementBlock("span",le)),e.$slots.icon?(n.openBlock(),n.createElementBlock("span",de,[n.renderSlot(e.$slots,"icon",{data:a.data,level:a.level,expanded:a.expanded,isLeaf:!a.expandable},void 0,!0)])):n.createCommentVNode("",!0),n.createElementVNode("span",se,[n.renderSlot(e.$slots,"default",{data:a.data,level:a.level,expanded:a.expanded,isLeaf:!a.expandable},()=>[n.createTextVNode(n.toDisplayString(A(a.data)),1)],!0)])],42,ae))),128)),F.value.length?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",oe,[n.renderSlot(e.$slots,"empty",{},()=>[n.createTextVNode(n.toDisplayString(M.value?"无匹配数据":e.emptyText),1)],!0)]))],2))}}),k=te._export_sfc(re,[["__scopeId","data-v-fb036ba6"]]);k.install=S=>{S.component(k.name,k)};exports.GTree=k;exports.default=k;
|
package/lib/GTree/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as fe, computed as k, ref as x, watch as q, createElementBlock as h, openBlock as y, normalizeClass as K, createCommentVNode as H, Fragment as J, renderList as Q, createElementVNode as M, withModifiers as pe, renderSlot as F, createTextVNode as U, toDisplayString as W } from "vue";
|
|
2
|
-
import { _ as ve } from "../
|
|
2
|
+
import { _ as ve } from "../GBranched-vnLlYOl9.mjs";
|
|
3
3
|
const ge = ["draggable", "onClick", "onDragstart", "onDragover", "onDrop"], he = ["onClick"], ye = {
|
|
4
4
|
key: 1,
|
|
5
5
|
class: "g-tree__switcher is-placeholder"
|
package/lib/GVideo/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),
|
|
2
|
-
`),r=
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),b=require("crypto-js"),$=require("axios"),A=require("../GBranched-BtF7heMk.js");function D(c,p,m){const y=["POST","*/*","application/json",`x-ca-key:${p["X-Ca-Key"]}`,c].filter(Boolean).join(`
|
|
2
|
+
`),r=b.HmacSHA256(y,m);return b.enc.Base64.stringify(r)}function N(c,p,m){const y=$.create();async function r(u){const a={Accept:"*/*","Content-Type":"application/json","X-Ca-Key":p,"X-Ca-Signature-Headers":"x-ca-key"};return a["X-Ca-Signature"]=D(u.url,a,m),y({baseURL:c,method:u.method||"POST",url:u.url,headers:a,data:u.data})}return{request:r}}const U=3,V=1e3,j=3,q=300,M={__name:"index",props:{videoName:{type:String,default:""},channelCode:{type:String,default:""},streamType:{type:Number,default:1},baseUrl:{type:String,default:""},appKey:{type:String,default:""},appSecret:{type:String,default:""},basePath:{type:String,default:""}},emits:["double-click"],setup(c,{expose:p,emit:m}){let y=0;const r=c,u=m,a=n.ref(null),i=n.ref(""),_=n.ref(!1),o=n.ref("");let d=null,S=null,l=0;const P=`g-video-window-${++y}`;let g="/";try{g="/"}catch{}const C=()=>{const e=r.basePath||g;return e.endsWith("/")?e:`${e}/`};let h=null;const E=()=>window.JSPlugin?Promise.resolve():(h||(h=new Promise((e,t)=>{const s=document.createElement("script");s.src=`${C()}h5player.min.js`,s.async=!0,s.onload=()=>e(),s.onerror=()=>{h=null,t(new Error("加载h5player.min.js失败"))},document.head.appendChild(s)})),h),I=()=>{a.value||!window.JSPlugin||(a.value=new window.JSPlugin({szId:P,szBasePath:C(),bSupporDoubleClickFull:!1,iMaxSplit:1,iCurrentSplit:1,openDebug:!1,oStyle:{borderSelect:"#000"}}),R(),_.value=!0)},f=(e,t)=>{if(console.error(`${e}:`,t),l>=U){o.value="视频加载失败";return}l++,o.value=`第${l}次重试`,clearTimeout(d),d=setTimeout(()=>{T(),w()},V)},w=()=>{new N(r.baseUrl,r.appKey,r.appSecret).request({url:"/artemis/api/video/v1/cameras/previewURLs",data:{cameraIndexCode:r.channelCode,streamType:r.streamType,protocol:"ws",transmode:1,expand:"transcode=0"}}).then(e=>{const t=e?.data?.data?.url;if(!t)throw new Error("未获取到取流地址");l=0,clearTimeout(d),I(),i.value=t}).catch(e=>{f("获取WebSocket地址失败",e)})},x=()=>{const e=a.value;e&&_.value&&i.value&&e.JS_Play(i.value,{playURL:i.value,mode:0,keepDecoder:0},e.currentWindowIndex).then(()=>{o.value="",l=0}).catch(t=>{f("播放失败",t)})};n.watch([_,i],([e,t])=>{!e||!t||(clearTimeout(S),S=setTimeout(x,q))}),n.watch([()=>r.channelCode,()=>r.streamType],()=>{r.channelCode&&(clearTimeout(d),clearTimeout(S),T(),i.value="",l=0,o.value="更换通道中",w())});const k=()=>{clearTimeout(d),clearTimeout(S),T(),i.value="",l=0,o.value="重新加载中",w()},T=()=>{const e=a.value;if(e)try{e.JS_Stop(e.currentWindowIndex??0).then(()=>{},t=>{console.error("JS_Stop 失败:",t)})}catch(t){console.error("JS_Stop 异常:",t)}},J=()=>{const e=a.value;e&&e.JS_SetInterruptTime(0,j).then(()=>{},t=>{console.error("JS_SetInterruptTime 失败:",t)})},R=()=>{a.value.JS_SetWindowControlCallback({pluginErrorHandler:(e,t,s)=>{f(`插件错误(${t})`,s)},InterruptStream:(e,t)=>{f(`断流(${e}, ${t}s)`,new Error("stream interrupted"))}})},B=()=>{u("double-click",{isPlayVideo:!0,channel_code:r.channelCode,channel_name:r.videoName})};return p({stopPlay:T,setInterruptTime:J,rePlay:k}),n.onMounted(()=>{E().then(()=>{w()}).catch(e=>{console.error(e),o.value="播放器加载失败"})}),n.onBeforeUnmount(()=>{clearTimeout(d),clearTimeout(S),l=0;const e=a.value;e&&e.JS_StopRealPlayAll().finally(()=>{a.value=null})}),(e,t)=>(n.openBlock(),n.createElementBlock("div",{class:"g-video-container",onDblclick:B},[n.createElementVNode("div",{id:P,class:"g-video-window"}),n.withDirectives(n.createElementVNode("p",{class:"g-video-window-tips"},n.toDisplayString(o.value),513),[[n.vShow,o.value]])],32))}},v=A._export_sfc(M,[["__scopeId","data-v-908e0405"]]);v.install=c=>{c.component(v.name,v)};exports.GVideo=v;exports.default=v;
|
package/lib/GVideo/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref as w, watch as b, onMounted as D, onBeforeUnmount as U, createElementBlock as N, openBlock as W, createElementVNode as x, withDirectives as j, toDisplayString as H, vShow as L } from "vue";
|
|
2
2
|
import I from "crypto-js";
|
|
3
3
|
import V from "axios";
|
|
4
|
-
import { _ as X } from "../
|
|
4
|
+
import { _ as X } from "../GBranched-vnLlYOl9.mjs";
|
|
5
5
|
function K(l, p, d) {
|
|
6
6
|
const m = [
|
|
7
7
|
"POST",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GBranchedChild, GBranchedItem, GBranchedProps } from './types';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<GBranchedProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
3
|
+
select: (value: string, item: GBranchedChild | GBranchedItem) => any;
|
|
4
|
+
toggle: (index: number, open: boolean) => any;
|
|
5
|
+
}, string, import('vue').PublicProps, Readonly<GBranchedProps> & Readonly<{
|
|
6
|
+
onSelect?: ((value: string, item: GBranchedChild | GBranchedItem) => any) | undefined;
|
|
7
|
+
onToggle?: ((index: number, open: boolean) => any) | undefined;
|
|
8
|
+
}>, {
|
|
9
|
+
className: string;
|
|
10
|
+
width: number;
|
|
11
|
+
color: string;
|
|
12
|
+
accentColor: string;
|
|
13
|
+
fontSize: number;
|
|
14
|
+
radius: number;
|
|
15
|
+
items: GBranchedItem[];
|
|
16
|
+
defaultOpen: number | number[];
|
|
17
|
+
defaultActive: string;
|
|
18
|
+
lineColor: string;
|
|
19
|
+
rowHeight: number;
|
|
20
|
+
indent: number;
|
|
21
|
+
trunk: number;
|
|
22
|
+
lineWidth: number;
|
|
23
|
+
drawDuration: number;
|
|
24
|
+
foldDuration: number;
|
|
25
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
26
|
+
navRef: HTMLElement;
|
|
27
|
+
markerRef: HTMLSpanElement;
|
|
28
|
+
}, HTMLElement>;
|
|
29
|
+
export default _default;
|