hortimagic 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -0
- package/README.md +9 -0
- package/dist/hortimagic.es.js +4024 -0
- package/dist/hortimagic.iife.js +1153 -0
- package/dist/hortimagic.js +1165 -0
- package/dist/hortimagic.txt +1165 -0
- package/dist/hortimagic.user.js +1165 -0
- package/dist/index.d.ts +1239 -0
- package/package.json +43 -0
- package/src/components/hm-accordion.ts +141 -0
- package/src/components/hm-button.ts +161 -0
- package/src/components/hm-cell.ts +181 -0
- package/src/components/hm-dialog.ts +125 -0
- package/src/components/hm-icon.ts +70 -0
- package/src/components/hm-input.ts +116 -0
- package/src/components/hm-menu.ts +94 -0
- package/src/components/hm-move-panel.ts +358 -0
- package/src/components/hm-notification.ts +177 -0
- package/src/components/hm-swipe-cell.ts +378 -0
- package/src/components/hm-switch.ts +167 -0
- package/src/components/index.ts +11 -0
- package/src/components/type.d.ts +48 -0
- package/types/global.d.ts +351 -0
- package/types/vite-env.d.ts +2 -0
|
@@ -0,0 +1,1165 @@
|
|
|
1
|
+
// ==UserScript==
|
|
2
|
+
// @name hortimagic
|
|
3
|
+
// @namespace hortimagic
|
|
4
|
+
// @version 1.0.0
|
|
5
|
+
// @description 园艺魔法,花园插件
|
|
6
|
+
// @author Narlen
|
|
7
|
+
// @match https://iirose.com/messages.html
|
|
8
|
+
// @grant none
|
|
9
|
+
// @run-at onmessage-end
|
|
10
|
+
// @license MIT
|
|
11
|
+
// @buildtime 2025-10-28T15:10:10.901Z
|
|
12
|
+
// ==/UserScript==
|
|
13
|
+
top.window.hortimagic=window.hortimagic=function(t){"use strict";async function e(t){return new Promise(e=>setTimeout(e,t))}function i(t){return t=(t=(t=(t=(t=(t=t.replace("&","&")).replace("<","<")).replace(">",">")).replace('"',""")).replace("'","'")).replace("\\","\")}function o(t){return t=(t=(t=(t=(t=(t=t.replace("<","<")).replace(">",">")).replace(""",'"')).replace("'","'")).replace("\","\\")).replace("&","&")}function n(){return window.myself?window.myself:null}function s(){return window.uid?window.uid:null}function r(){return window.avatar2&&window.avatarconv?window.avatarconv(window.avatar2):null}function l(){return window.inputcolorhex?window.inputcolorhex:null}const a=Object.freeze(Object.defineProperty({__proto__:null,addStyle:function(t){let e=document.createElement("style");e.innerText=t,document.body.append(e)},changeRoom:function(t){(t=String(t))&&window.Objs.mapHolder?.function?.roomchanger(t)},compressCSS:function(t){return t=(t=(t=(t=(t=t.replace(/\s{2,}/g," ")).replace(/\/\*[\s\S]*?\*\//g,"")).replace(/\s*([{};:,])\s*/g,"$1")).replace(/;\s*}/g,"}")).trim()},compressHTML:function(t){return t=(t=(t=(t=t.replace(/>\s+</g,"><")).replace(/\s{2,}/g," ")).replace(/<!--[\s\S]*?-->/g,"")).trim()},generatePrivateMessageBubble:function(t,e,o){window.privatechatfunc&&window.privatechatfunc([Math.floor(Date.now()/1e3).toString(10),s(),i(n()),i(r()),i(e),i(l()),"",i(l()),"","",o,t,"","","","",""].join(">"))},getAllOnlineUserInfo:function(){let t=window.Objs.mapHolder.Assets.userJson;return t?Object.keys(t).map(e=>{let i=t[e];return{name:i[2],uid:i[8],color:i[3],avatar:i[0],roomId:i[4],personalizedSignature:i[6]}}):null},getOnlineUserInfoById:function(t){t=String(t);let e=window.Objs.mapHolder?.function?.findUserByUid?.(t);return e?{name:e[2],uid:t,color:e[3],avatar:e[0],roomId:e[4],personalizedSignature:e[6]}:null},getRoomId:function(){return window.roomn?window.roomn:null},getRoomInfoById:function(t){let e=window.Objs.mapHolder?.Assets?.roomJson?.[t];if(e){let t=e[5].split("&&").map(t=>t.split(" & ")),i=o(t[0][0]),n=i.indexOf(" ");return{name:e[1],color:e[2],roomPath:e[0].split("_"),description:i.slice(n+1),roomImage:i.slice(0,n),currentUserNum:"number"==typeof e[7]?e[7]:"hidden",ownerName:t[1][0],member:t[4].map(t=>({name:o(t.slice(1)),auth:"0"==t[0]?"member":"1"==t[0]?"admin":"unknow"}))}}return null},getUserInputColor:l,getUserName:n,getUserProfilePictureUrl:r,getUserUid:s,htmlSpecialCharsDecode:o,htmlSpecialCharsEscape:i,sleep:e,switchRoom:function(t){window.Objs.mapHolder?.function?.roomchanger&&window.Objs.mapHolder.function.roomchanger(t)}},Symbol.toStringTag,{value:"Module"}));class c{constructor(){this.timeStamp="",this.headPortrait="",this.name="",this.message="",this.color="",this.gender="",this.uid="",this.designation="",this.messageUid="",this.messageClass="public"}}class h{constructor(){this.timeStamp="",this.headPortrait="",this.name="",this.message="",this.color="",this.gender="",this.uid="",this.messageUid="",this.messageClass="private"}}class d{constructor(){this.messageName="",this.uid="",this.data="",this.messageClass="hidden"}}class p{constructor(){this.username="",this.avatar="",this.message="",this.color="",this.gender="",this.timeStamp="",this.uid="",this.messageClass="danmu"}}class u{constructor(){this.privateUID="",this.uid="",this.messageUid="",this.dataUid="",this.messageClass="withdrawn"}}class m{constructor(){this.userMessageList=[],this.messageClass="system"}}class g{constructor(){this.result="",this.stockPrice=NaN,this.totalStock=NaN,this.holdingAmount=NaN,this.totalEquity=NaN,this.balance=NaN,this.messageClass="stock"}}class f{constructor(){this.message="",this.messageClass="unkonw"}}const b=Object.freeze(Object.defineProperty({__proto__:null,Danmu:p,Hidden:d,Private:h,Public:c,Stock:g,System:m,Unkonw:f,Withdrawn:u},Symbol.toStringTag,{value:"Module"}));let y=[];function v(t){let e=new c,i=t.split(">");return e.timeStamp=i[0],e.headPortrait=i[1],e.name=i[2],e.message=i[3],e.color=i[5],e.gender=i[6],e.uid=i[8],e.designation=i[9],e.messageUid=i[10],e}function w(t){let e=new h,i=t.split(">");return e.timeStamp=i[0].slice(1),e.uid=i[1],e.name=i[2],e.headPortrait=i[3],e.message=i[4],e.color=i[5],e.gender=i[8],e.messageUid=i[10],e}function _(t){let e=new p,i=t.split(">");return e.username=i[0],e.message=i[1],e.color=i[2],e.gender=i[4],e.avatar=i[5],e.timeStamp=i[6],e.uid=i[7],e}function $(t){if(y=[],/^"[^"].*/gs.test(t)){let e=t.slice(1).split("<");for(let t=e.length-1;t>=0;t--)y.push(v(e[t]))}else if(/^"".*/gs.test(t)){let e=t.slice(1).split("<");for(let t=e.length-1;t>=0;t--)y.push(w(e[t]))}else if(/^=.*/gs.test(t)){let e=t.slice(1).split("<");for(let t=e.length-1;t>=0;t--)y.push(_(e[t]))}else/^[/]<.*>[0-9|a-z]{13}:.*/gs.test(t)?y.push(function(t){let e,i=new d;return e=t.match(/(?<=^[/]<).*(?=>[0-9|a-z]{13}:.*)/gs),i.messageName=null==e?"":e[0],e=t.match(/(?<=^[/]<.*>)[0-9|a-z]{13}(?=:.*)/gs),i.uid=null==e?"":e[0],e=t.match(/(?<=^[/]<.*>[0-9|a-z]{13}:).*/gs),i.data=null==e?"":e[0],i}(t)):/^v0.*/gs.test(t)?y.push(function(t){let e=new u;return"#"==t[2]?(e.privateUID="",e.uid=t.slice(3,16),e.messageUid=t.slice(17,29),e.dataUid=t.slice(3,29)):(e.privateUID=t.slice(3,16),e.uid=t.slice(17,30),e.messageUid=t.slice(31),e.dataUid=t.slice(17)),e}(t)):/^%\*".*/gs.test(t)?y.push(function(t){let e=new m;return e.userMessageList=t.split("<"),e}(t)):/^>.*/gs.test(t)?y.push(function(t){let e=new g;if(e.result=t[2],"*"==e.result)return e;if(">"==e.result)return e.holdingAmount=parseInt(t.slice(2)),e;if("<"==e.result)return e.balance=parseInt(t.slice(2)),e;{let i=t.split('"');if(5==i.length)return e.stockPrice=parseFloat(i[2]),e.totalStock=parseInt(i[0].slice(1)),e.holdingAmount=parseInt(i[3]),e.totalEquity=parseFloat(i[1]),e.balance=parseFloat(i[4]),e;if(4==i.length)return e.stockPrice=parseFloat(i[1])/parseInt(i[0].slice(1)),e.totalStock=parseInt(i[0].slice(1)),e.holdingAmount=parseInt(i[2]),e.totalEquity=parseFloat(i[1]),e.balance=parseFloat(i[3]),e}return e}(t)):y.push(function(t){let e=new f;return e.message=t,e}(t))}const x=Object.freeze(Object.defineProperty({__proto__:null,decodeMessage:$,get messageObjList(){return y}},Symbol.toStringTag,{value:"Module"}));var S,k={exports:{}};var A=function(){if(S)return k.exports;function t(){}return S=1,t.prototype={on:function(t,e,i){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:i}),this},once:function(t,e,i){var o=this;function n(){o.off(t,n),e.apply(i,arguments)}return n._=e,this.on(t,n,i)},emit:function(t){for(var e=[].slice.call(arguments,1),i=((this.e||(this.e={}))[t]||[]).slice(),o=0,n=i.length;o<n;o++)i[o].fn.apply(i[o].ctx,e);return this},off:function(t,e){var i=this.e||(this.e={}),o=i[t],n=[];if(o&&e)for(var s=0,r=o.length;s<r;s++)o[s].fn!==e&&o[s].fn._!==e&&n.push(o[s]);return n.length?i[t]=n:delete i[t],this}},k.exports=t,k.exports.TinyEmitter=t,k.exports}();let C=new A.TinyEmitter;const E=Object.freeze(Object.defineProperty({__proto__:null,TinyEmitter:A.TinyEmitter,emitter:C},Symbol.toStringTag,{value:"Module"}));async function O(){for(let i=0;i<30;i++)try{if(null==window.socket.__onmessage&&null!=window.socket._onmessage&&null!=window.socket.send)break;await e(500);continue}catch(t){}null==window.socket.__onmessage&&null!=window.socket._onmessage&&null!=window.socket.send&&(T.originalSend=window.socket.send,window.socket.send=T.send,T.originalOnmessage=window.socket._onmessage,window.socket._onmessage=T.onmessage)}const T={beforeSend:async function(t){return t},originalSend:function(t){return t},afterSend:function(t){return t},send:async function(t){let e=await T.beforeSend(t);try{null!=e&&(T.originalSend(e),T.afterSend(e))}catch(i){}},beforeOnmessage:async function(t){return $(t),t},originalOnmessage:function(t){return t},afterOnmessage:async function(t){for(let e of y)C.emit(e.messageClass,e);return t},onmessage:async function(t){let e=await T.beforeOnmessage(t);try{null!=e&&(T.originalOnmessage(e),T.afterOnmessage(e))}catch(i){}},initSocket:O},P=Object.freeze(Object.defineProperty({__proto__:null,initSocket:O,sockets:T},Symbol.toStringTag,{value:"Module"}));function M(t,e){return"cut"===t?`{0${JSON.stringify({m:t,mc:e,i:Math.random().toString().slice(2,12)})}`:JSON.stringify({m:t,mc:e,i:Math.random().toString().slice(2,12)})}const j=Object.freeze(Object.defineProperty({__proto__:null,danmu:function(t,e,i="0"){return`~{"t":"${t}","c":"${e}","v":${i}}`},hidden:function(t,e,i){return`/<${t}>${e}:${i}`},like:function(t,e=""){return`+*${t}${e}`},musicCard:function(t,e,i,o,n,s){return M(`m__4=${t}>${e}>${i}>${o}>${n}>${s}`,n)},privateChat:function(t,e,i){return JSON.stringify({g:t,m:e,mc:i,i:Math.random().toString().slice(2,12)})},publicChat:M,stockRequest:function(t){return null==t?">#":t>0?`>$${Math.round(Math.abs(t))}`:t<0?`>@${Math.round(Math.abs(t))}`:">#"},videoCard:function(t,e,i,o,n,s,r){return M(`m__4*${t}>${e}>${i}>${o}>${n}>${s}>${r}`,n)},withdrawn:function(t,e=""){return""==e?`v0#${t}`:`v0*${e}#${t}`}},Symbol.toStringTag,{value:"Module"}));let z={movePanelHolder:document.querySelector("#movePanelHolder"),functionHolder:document.querySelector("#functionHolder"),functionButtonGroupList:[...document.querySelectorAll(".functionButton.functionButtonGroup")],msgholderBox:document.querySelector("#msgholder .fullBox.msgholderBox"),homeHolderMsgBox:document.querySelector("#homeHolder .homeHolderMsgContentBox .homeHolderMsgBox.fullBox"),sessionHolderPmTaskBoxItems:[...document.querySelectorAll(".sessionHolderPmTaskBoxItem.whoisTouch2")],moveinputDisplay:document.querySelector("#moveinputDisplay"),moveinput:document.getElementById("moveinput"),moveinputSendBtnFunc:document.querySelector("#moveinputDisplay #moveinputSendBtnFunc"),moveinputSendBtnSend:document.querySelector("#moveinputDisplay #moveinputSendBtnSend")};function B(){z.movePanelHolder=document.querySelector("#movePanelHolder"),z.functionHolder=document.querySelector("#functionHolder"),z.functionButtonGroupList=[...document.querySelectorAll(".functionButton.functionButtonGroup")],z.msgholderBox=document.querySelector("#msgholder .fullBox .fullBox.msgholderBox"),z.homeHolderMsgBox=document.querySelector("#homeHolder .homeHolderMsgContentBox .homeHolderMsgBox.fullBox"),z.sessionHolderPmTaskBoxItems=[...document.querySelectorAll(".sessionHolderPmTaskBoxItem.whoisTouch2")],z.moveinputDisplay=document.querySelector("#moveinputDisplay"),z.moveinput=document.getElementById("moveinput"),z.moveinputSendBtnFunc=document.querySelector("#moveinputDisplay #moveinputSendBtnFunc"),z.moveinputSendBtnSend=document.querySelector("#moveinputDisplay #moveinputSendBtnSend")}let H={elementHooks:{moveinput:{oninputBefore:()=>!0,oninputAfter:()=>!0,onblurBefore:()=>!0,onblurAfter:()=>!0,onfocusBefore:()=>!0,onfocusAfter:()=>!0}},functionHooks:{processer:{onBefore:(t,e,i,o)=>!0,onAfter:(t,e,i,o)=>!0}},replaceMoveinput:()=>{try{let t=z.moveinput.oninput;z.moveinput.oninput=function(){1==H.elementHooks.moveinput.oninputBefore()&&(t?.call(z.moveinput),H.elementHooks.moveinput.oninputAfter())}}catch(t){}try{let t=z.moveinput.oninput;z.moveinput.onblur=function(){1==H.elementHooks.moveinput.onblurBefore()&&(t?.call(z.moveinput),H.elementHooks.moveinput.onblurAfter())}}catch(t){}try{let t=z.moveinput.oninput;z.moveinput.onfocus=function(){1==H.elementHooks.moveinput.onfocusBefore()&&(t?.call(z.moveinput),H.elementHooks.moveinput.onfocusAfter())}}catch(t){}},replaceButtonProcesser:()=>{try{let t=buttonProcesser;buttonProcesser=(e,i,o,n)=>{1==H.functionHooks.processer.onBefore(e,i,o,n)&&(t(e,i,o,n),H.functionHooks.processer.onAfter(e,i,o,n))}}catch(t){}}};function I(){H.replaceMoveinput(),H.replaceButtonProcesser()}const D=Object.freeze(Object.defineProperty({__proto__:null,Hooks:H,elements:z,initHooks:I,refreshAll:B},Symbol.toStringTag,{value:"Module"}));class N{constructor(t,e,i=!0,o=!1){this.name=t,this.url=e,this.enable=i,this.ingected=o}}let U=[];function L(t){if(""==t.name||""==t.url)return _alert("脚本名字或链接不能为空"),!1;for(let e of U){if(e.name===t.name)return e.url=t.url,e.enable=t.enable,e.ingected=t.ingected,!1;if(e.url===t.url)return e.name=t.name,e.enable=t.enable,e.ingected=t.ingected,!1}return U.push(t),!0}function R(t){U=U.filter(e=>e.name!==t.name&&e.url!==t.url)}function q(t){if(t.ingected)return _alert(`脚本 ${t.name} 已经注入`),t.ingected;const e=document.createElement("script");return e.src=t.url,e.onload=()=>{_alert(`脚本 ${t.name} 注入成功`),t.ingected=!0},e.onerror=()=>{_alert(`脚本 ${t.name} 注入失败`),t.enable=!1},document.head.appendChild(e),t.ingected}function W(t){for(let e of t)e.enable&&!e.ingected&&q(e)}function X(){let t=localStorage.getItem("hortiMagicScriptList");U=null==t?[]:JSON.parse(t);for(let e of U)e.ingected=!1}function F(){localStorage.setItem("hortiMagicScriptList",JSON.stringify(U)),_alert("脚本列表已保存")}function V(){X(),W(U)}const J=Object.freeze(Object.defineProperty({__proto__:null,Script:N,addScriptToList:L,ingectlocalScript:V,injectScript:q,injectScriptList:W,readScriptList:X,removeScriptFromList:R,saveScriptList:F,get scriptList(){return U}},Symbol.toStringTag,{value:"Module"})),G=Object.freeze(Object.defineProperty({__proto__:null,Message:b,decoder:x,elements_hooks:D,encoder:j,eventEmitter:E,iirose_socket:P,script_tools:J,tools:a},Symbol.toStringTag,{value:"Module"})),Z=globalThis,Y=Z.ShadowRoot&&(void 0===Z.ShadyCSS||Z.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,K=Symbol(),Q=new WeakMap;let tt=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==K)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(Y&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=Q.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Q.set(e,t))}return t}toString(){return this.cssText}};const et=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1],t[0]);return new tt(i,t,K)},it=Y?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new tt("string"==typeof t?t:t+"",void 0,K))(e)})(t):t,{is:ot,defineProperty:nt,getOwnPropertyDescriptor:st,getOwnPropertyNames:rt,getOwnPropertySymbols:lt,getPrototypeOf:at}=Object,ct=globalThis,ht=ct.trustedTypes,dt=ht?ht.emptyScript:"",pt=ct.reactiveElementPolyfillSupport,ut=(t,e)=>t,mt={toAttribute(t,e){switch(e){case Boolean:t=t?dt:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(o){i=null}}return i}},gt=(t,e)=>!ot(t,e),ft={attribute:!0,type:String,converter:mt,reflect:!1,useDefault:!1,hasChanged:gt};Symbol.metadata??=Symbol("metadata"),ct.litPropertyMetadata??=new WeakMap;let bt=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=ft){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(t,i,e);void 0!==o&&nt(this.prototype,t,o)}}static getPropertyDescriptor(t,e,i){const{get:o,set:n}=st(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:o,set(e){const s=o?.call(this);n?.call(this,e),this.requestUpdate(t,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ft}static _$Ei(){if(this.hasOwnProperty(ut("elementProperties")))return;const t=at(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ut("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ut("properties"))){const t=this.properties,e=[...rt(t),...lt(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const t=this._$Eu(e,i);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(it(t))}else void 0!==t&&e.push(it(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(Y)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),o=Z.litNonce;void 0!==o&&e.setAttribute("nonce",o),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,i);if(void 0!==o&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:mt).toAttribute(e,i.type);this._$Em=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(t,e){const i=this.constructor,o=i._$Eh.get(t);if(void 0!==o&&this._$Em!==o){const t=i.getPropertyOptions(o),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:mt;this._$Em=o;const s=n.fromAttribute(e,t.type);this[o]=s??this._$Ej?.get(o)??s,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const o=this.constructor,n=this[t];if(i??=o.getPropertyOptions(t),!((i.hasChanged??gt)(n,e)||i.useDefault&&i.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:o,wrapped:n},s){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),!0!==n||void 0!==s)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===o&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,o=this[e];!0!==t||this._$AL.has(e)||void 0===o||this.C(e,void 0,i,o)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};bt.elementStyles=[],bt.shadowRootOptions={mode:"open"},bt[ut("elementProperties")]=new Map,bt[ut("finalized")]=new Map,pt?.({ReactiveElement:bt}),(ct.reactiveElementVersions??=[]).push("2.1.1");const yt=globalThis,vt=yt.trustedTypes,wt=vt?vt.createPolicy("lit-html",{createHTML:t=>t}):void 0,_t="$lit$",$t=`lit$${Math.random().toFixed(9).slice(2)}$`,xt="?"+$t,St=`<${xt}>`,kt=document,At=()=>kt.createComment(""),Ct=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Et=Array.isArray,Ot="[ \t\n\f\r]",Tt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Pt=/-->/g,Mt=/>/g,jt=RegExp(`>|${Ot}(?:([^\\s"'>=/]+)(${Ot}*=${Ot}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),zt=/'/g,Bt=/"/g,Ht=/^(?:script|style|textarea|title)$/i,It=(Rt=1,(t,...e)=>({_$litType$:Rt,strings:t,values:e})),Dt=Symbol.for("lit-noChange"),Nt=Symbol.for("lit-nothing"),Ut=new WeakMap,Lt=kt.createTreeWalker(kt,129);var Rt;function qt(t,e){if(!Et(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==wt?wt.createHTML(e):e}class Wt{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let n=0,s=0;const r=t.length-1,l=this.parts,[a,c]=((t,e)=>{const i=t.length-1,o=[];let n,s=2===e?"<svg>":3===e?"<math>":"",r=Tt;for(let l=0;l<i;l++){const e=t[l];let i,a,c=-1,h=0;for(;h<e.length&&(r.lastIndex=h,a=r.exec(e),null!==a);)h=r.lastIndex,r===Tt?"!--"===a[1]?r=Pt:void 0!==a[1]?r=Mt:void 0!==a[2]?(Ht.test(a[2])&&(n=RegExp("</"+a[2],"g")),r=jt):void 0!==a[3]&&(r=jt):r===jt?">"===a[0]?(r=n??Tt,c=-1):void 0===a[1]?c=-2:(c=r.lastIndex-a[2].length,i=a[1],r=void 0===a[3]?jt:'"'===a[3]?Bt:zt):r===Bt||r===zt?r=jt:r===Pt||r===Mt?r=Tt:(r=jt,n=void 0);const d=r===jt&&t[l+1].startsWith("/>")?" ":"";s+=r===Tt?e+St:c>=0?(o.push(i),e.slice(0,c)+_t+e.slice(c)+$t+d):e+$t+(-2===c?l:d)}return[qt(t,s+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),o]})(t,e);if(this.el=Wt.createElement(a,i),Lt.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(o=Lt.nextNode())&&l.length<r;){if(1===o.nodeType){if(o.hasAttributes())for(const t of o.getAttributeNames())if(t.endsWith(_t)){const e=c[s++],i=o.getAttribute(t).split($t),r=/([.?@])?(.*)/.exec(e);l.push({type:1,index:n,name:r[2],strings:i,ctor:"."===r[1]?Gt:"?"===r[1]?Zt:"@"===r[1]?Yt:Jt}),o.removeAttribute(t)}else t.startsWith($t)&&(l.push({type:6,index:n}),o.removeAttribute(t));if(Ht.test(o.tagName)){const t=o.textContent.split($t),e=t.length-1;if(e>0){o.textContent=vt?vt.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],At()),Lt.nextNode(),l.push({type:2,index:++n});o.append(t[e],At())}}}else if(8===o.nodeType)if(o.data===xt)l.push({type:2,index:n});else{let t=-1;for(;-1!==(t=o.data.indexOf($t,t+1));)l.push({type:7,index:n}),t+=$t.length-1}n++}}static createElement(t,e){const i=kt.createElement("template");return i.innerHTML=t,i}}function Xt(t,e,i=t,o){if(e===Dt)return e;let n=void 0!==o?i._$Co?.[o]:i._$Cl;const s=Ct(e)?void 0:e._$litDirective$;return n?.constructor!==s&&(n?._$AO?.(!1),void 0===s?n=void 0:(n=new s(t),n._$AT(t,i,o)),void 0!==o?(i._$Co??=[])[o]=n:i._$Cl=n),void 0!==n&&(e=Xt(t,n._$AS(t,e.values),n,o)),e}class Ft{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,o=(t?.creationScope??kt).importNode(e,!0);Lt.currentNode=o;let n=Lt.nextNode(),s=0,r=0,l=i[0];for(;void 0!==l;){if(s===l.index){let e;2===l.type?e=new Vt(n,n.nextSibling,this,t):1===l.type?e=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(e=new Kt(n,this,t)),this._$AV.push(e),l=i[++r]}s!==l?.index&&(n=Lt.nextNode(),s++)}return Lt.currentNode=kt,o}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Vt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,o){this.type=2,this._$AH=Nt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Xt(this,t,e),Ct(t)?t===Nt||null==t||""===t?(this._$AH!==Nt&&this._$AR(),this._$AH=Nt):t!==this._$AH&&t!==Dt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>Et(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Nt&&Ct(this._$AH)?this._$AA.nextSibling.data=t:this.T(kt.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,o="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=Wt.createElement(qt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===o)this._$AH.p(e);else{const t=new Ft(o,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=Ut.get(t.strings);return void 0===e&&Ut.set(t.strings,e=new Wt(t)),e}k(t){Et(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const n of t)o===e.length?e.push(i=new Vt(this.O(At()),this.O(At()),this,this.options)):i=e[o],i._$AI(n),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class Jt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,o,n){this.type=1,this._$AH=Nt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Nt}_$AI(t,e=this,i,o){const n=this.strings;let s=!1;if(void 0===n)t=Xt(this,t,e,0),s=!Ct(t)||t!==this._$AH&&t!==Dt,s&&(this._$AH=t);else{const o=t;let r,l;for(t=n[0],r=0;r<n.length-1;r++)l=Xt(this,o[i+r],e,r),l===Dt&&(l=this._$AH[r]),s||=!Ct(l)||l!==this._$AH[r],l===Nt?t=Nt:t!==Nt&&(t+=(l??"")+n[r+1]),this._$AH[r]=l}s&&!o&&this.j(t)}j(t){t===Nt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Gt extends Jt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Nt?void 0:t}}class Zt extends Jt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Nt)}}class Yt extends Jt{constructor(t,e,i,o,n){super(t,e,i,o,n),this.type=5}_$AI(t,e=this){if((t=Xt(this,t,e,0)??Nt)===Dt)return;const i=this._$AH,o=t===Nt&&i!==Nt||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==Nt&&(i===Nt||o);o&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class Kt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Xt(this,t)}}const Qt=yt.litHtmlPolyfillSupport;Qt?.(Wt,Vt),(yt.litHtmlVersions??=[]).push("3.3.1");const te=(t,e,i)=>{const o=i?.renderBefore??e;let n=o._$litPart$;if(void 0===n){const t=i?.renderBefore??null;o._$litPart$=n=new Vt(e.insertBefore(At(),t),t,void 0,i??{})}return n._$AI(t),n},ee=globalThis;let ie=class extends bt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=te(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Dt}};ie._$litElement$=!0,ie.finalized=!0,ee.litElementHydrateSupport?.({LitElement:ie});const oe=ee.litElementPolyfillSupport;oe?.({LitElement:ie}),(ee.litElementVersions??=[]).push("4.2.1");const ne=t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},se={attribute:!0,type:String,converter:mt,reflect:!1,hasChanged:gt},re=(t=se,e,i)=>{const{kind:o,metadata:n}=i;let s=globalThis.litPropertyMetadata.get(n);if(void 0===s&&globalThis.litPropertyMetadata.set(n,s=new Map),"setter"===o&&((t=Object.create(t)).wrapped=!0),s.set(i.name,t),"accessor"===o){const{name:o}=i;return{set(i){const n=e.get.call(this);e.set.call(this,i),this.requestUpdate(o,n,t)},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===o){const{name:o}=i;return function(i){const n=this[o];e.call(this,i),this.requestUpdate(o,n,t)}}throw Error("Unsupported decorator location: "+o)};function le(t){return(e,i)=>"object"==typeof i?re(t,e,i):((t,e,i)=>{const o=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),o?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}const ae=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i);function ce(t,e){return(e,i,o)=>ae(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}var he=Object.defineProperty,de=Object.getOwnPropertyDescriptor,pe=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?de(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&he(e,i,s),s};let ue=[],me=99999,ge=class extends ie{constructor(){super(),this.width=320,this.height=490,this.headerBackgroundColor="rgba(66,134,182,0.9)",this.headerColor="rgb(255,255,255)",this.bodyBackgroundColor="rgba(255,255,255,0.7)",this.bodyColor="rgba(23, 23, 23, 0.9)",this.footerBackgroundColor="rgba(255,255,255,0.7)",this.buttonBackgroundColor="rgba(255,255,255,0.9)",this.buttonColor="rgba(66,134,182,0.9)",this.titleContent="面板",this.leftButtonText="按钮1",this.rightButtonText="按钮2",this.isDisplay=!1,this.zIndex=me,this.icon="magic-wand",this.left=(window.innerWidth-this.width)/2,this.top=(window.innerHeight-(this.height+80))/2,this.dragging=!1,ue.push(this),this.zIndex=++me}handleLeftClick(){this.hideMovePanel()}handleRightClick(){this.hideMovePanel()}hideMovePanel(){this.isDisplay=!1,this.dispatchEvent(new CustomEvent("close",{detail:{isDisplay:this.isDisplay,message:"关闭事件"},bubbles:!0,composed:!0}))}showMovePanel(){this.isDisplay=!0,this.dispatchEvent(new CustomEvent("show",{detail:{isDisplay:this.isDisplay},bubbles:!0,composed:!0}))}toogleDisplay(){this.isDisplay?this.hideMovePanel():this.showMovePanel()}mouseDragging(t){let e=this.left,i=this.top,o=t.clientX-e,n=t.clientY-i;0==this.dragging&&(this.dragging=!0),document.onmousemove=t=>{this.dragging&&(this.left=t.clientX-o,this.top=t.clientY-n)},document.onmouseup=()=>{this.dragging&&(this.dragging=!1),document.onmousemove=null}}touchDragging(t){let e=this.left,i=this.top,o=t.touches[0].clientX-e,n=t.touches[0].clientY-i;0==this.dragging&&(this.dragging=!0),document.ontouchmove=t=>{this.dragging&&(this.left=t.touches[0].clientX-o,this.top=t.touches[0].clientY-n)},document.ontouchend=()=>{this.dragging&&(this.dragging=!1),document.onmousemove=null}}putTop(){let t=!1;if(ue.includes(this)){for(let t=0;t<ue.length;t++)ue[t].zIndex>this.zIndex&&(ue[t].zIndex=ue[t].zIndex-1);this.zIndex=me,t=!0}else t=!1;return t}putTopToggel(){this.zIndex!=me?(this.putTop(),this.showMovePanel()):this.toogleDisplay()}render(){return It`
|
|
14
|
+
<div
|
|
15
|
+
class="panel"
|
|
16
|
+
style="
|
|
17
|
+
width: ${this.width}px;
|
|
18
|
+
height: ${this.height+80}px;
|
|
19
|
+
left: ${this.left}px;
|
|
20
|
+
top: ${this.top}px;
|
|
21
|
+
display: ${this.isDisplay?"block":"none"};
|
|
22
|
+
z-index: ${this.zIndex};
|
|
23
|
+
"
|
|
24
|
+
@mousedown="${this.putTop}"
|
|
25
|
+
@touchstart="${this.putTop}"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
class="header"
|
|
29
|
+
style="background-color: ${this.headerBackgroundColor}; color: ${this.headerColor};"
|
|
30
|
+
@mousedown="${this.mouseDragging}"
|
|
31
|
+
@touchstart="${this.touchDragging}"
|
|
32
|
+
>
|
|
33
|
+
<div class="header-left">
|
|
34
|
+
<div class="header-icon">
|
|
35
|
+
<slot name="left-icon" class="left-icon">
|
|
36
|
+
<hm-icon icon="${this.icon}" size="24px"></hm-icon>
|
|
37
|
+
</slot>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="header-title">${this.titleContent}</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="header-close" @click="${this._handleClose}">
|
|
42
|
+
<slot name="right-icon" class="right-icon">
|
|
43
|
+
<hm-icon icon="close" size="18px"></hm-icon>
|
|
44
|
+
</slot>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<div
|
|
48
|
+
class="body"
|
|
49
|
+
style="background-color: ${this.bodyBackgroundColor}; color: ${this.bodyColor}; height:${this.height}px;width:${this.width}px;"
|
|
50
|
+
>
|
|
51
|
+
<slot></slot>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="footer" style="background-color: ${this.footerBackgroundColor};width:${this.width}px;">
|
|
54
|
+
<hm-button
|
|
55
|
+
class="footer-button footer-button-left"
|
|
56
|
+
icon="magic-wand"
|
|
57
|
+
width="100%"
|
|
58
|
+
backgroundColor="${this.buttonBackgroundColor}"
|
|
59
|
+
color="${this.buttonColor}"
|
|
60
|
+
@click="${this._handleLeftButtonClick}"
|
|
61
|
+
>
|
|
62
|
+
${this.leftButtonText}
|
|
63
|
+
</hm-button>
|
|
64
|
+
<hm-button
|
|
65
|
+
class="footer-button footer-button-right"
|
|
66
|
+
icon="magic-wand"
|
|
67
|
+
width="100%"
|
|
68
|
+
backgroundColor="${this.buttonColor}"
|
|
69
|
+
color="${this.buttonBackgroundColor}"
|
|
70
|
+
@click="${this._handleRightButtonClick}"
|
|
71
|
+
>
|
|
72
|
+
${this.rightButtonText}
|
|
73
|
+
</hm-button>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
`}_handleClose(){this.hideMovePanel()}_handleLeftButtonClick(){this.dispatchEvent(new CustomEvent("left-button-click",{detail:{message:"左侧按钮被点击"},bubbles:!0,composed:!0}))}_handleRightButtonClick(){this.dispatchEvent(new CustomEvent("right-button-click",{detail:{message:"右侧按钮被点击"},bubbles:!0,composed:!0}))}};var fe;ge.styles=et`
|
|
78
|
+
.panel {
|
|
79
|
+
position: absolute;
|
|
80
|
+
display: block;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.header {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: space-between;
|
|
87
|
+
height: 40px;
|
|
88
|
+
}
|
|
89
|
+
.header-left {
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.header-icon {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
margin-left: 24px;
|
|
98
|
+
margin-right: 24px;
|
|
99
|
+
}
|
|
100
|
+
.left-icon {
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
}
|
|
104
|
+
.header-title {
|
|
105
|
+
margin-right: auto;
|
|
106
|
+
font-size: 16px !important;
|
|
107
|
+
opacity: 0.7;
|
|
108
|
+
font-weight: bold;
|
|
109
|
+
height: 100%;
|
|
110
|
+
line-height: 40px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
.header-close {
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
display: flex;
|
|
117
|
+
align-items: center;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
width: 40px;
|
|
120
|
+
higth: 40px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.body {
|
|
124
|
+
display: block;
|
|
125
|
+
position: absolute;
|
|
126
|
+
top: 40px;
|
|
127
|
+
overflow: auto;
|
|
128
|
+
scrollbar-width: none; /* Firefox */
|
|
129
|
+
}
|
|
130
|
+
.body::-webkit-scrollbar {
|
|
131
|
+
display: none; /* Chrome/Safari/Webkit */
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.footer {
|
|
135
|
+
display: flex;
|
|
136
|
+
position: absolute;
|
|
137
|
+
height: 40px;
|
|
138
|
+
bottom: 0px;
|
|
139
|
+
width: 100%; /* 添加宽度占满父容器 */
|
|
140
|
+
box-sizing: border-box; /* 确保padding不会增加元素总宽度 */
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.footer-button {
|
|
144
|
+
flex: 1;
|
|
145
|
+
border: none;
|
|
146
|
+
border-radius: 4px;
|
|
147
|
+
cursor: pointer;
|
|
148
|
+
transition: all 0.2s;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.footer-button:active {
|
|
152
|
+
transform: scale(0.98);
|
|
153
|
+
}
|
|
154
|
+
`,pe([le({type:Number})],ge.prototype,"width",2),pe([le({type:Number})],ge.prototype,"height",2),pe([le({type:String,attribute:"header-background-color"})],ge.prototype,"headerBackgroundColor",2),pe([le({type:String,attribute:"header-color"})],ge.prototype,"headerColor",2),pe([le({type:String,attribute:"body-background-color"})],ge.prototype,"bodyBackgroundColor",2),pe([le({type:String,attribute:"body-color"})],ge.prototype,"bodyColor",2),pe([le({type:String,attribute:"footer-background-color"})],ge.prototype,"footerBackgroundColor",2),pe([le({type:String,attribute:"button-background-color"})],ge.prototype,"buttonBackgroundColor",2),pe([le({type:String,attribute:"button-color"})],ge.prototype,"buttonColor",2),pe([le({type:String})],ge.prototype,"titleContent",2),pe([le({type:String,attribute:"left-button-text"})],ge.prototype,"leftButtonText",2),pe([le({type:String,attribute:"right-button-text"})],ge.prototype,"rightButtonText",2),pe([le({type:Boolean,attribute:"is-display"})],ge.prototype,"isDisplay",2),pe([le({type:Number})],ge.prototype,"zIndex",2),pe([le({type:String})],ge.prototype,"icon",2),pe([le({type:Number})],ge.prototype,"left",2),pe([le({type:Number})],ge.prototype,"top",2),pe([(fe=".body",(t,e)=>ae(t,e,{async get(){return await this.updateComplete,this.renderRoot?.querySelector(fe)??null}}))],ge.prototype,"body",2),ge=pe([ne("hm-move-panel")],ge);const be=Object.freeze(Object.defineProperty({__proto__:null,get HmMovePanel(){return ge},movePanelItemList:ue,get movePanelItemMaxZindex(){return me}},Symbol.toStringTag,{value:"Module"})),ye=2;class ve{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}class we extends ve{constructor(t){if(super(t),this.it=Nt,t.type!==ye)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===Nt||null==t)return this._t=void 0,this.it=t;if(t===Dt)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}we.directiveName="unsafeHTML",we.resultType=1;class _e extends we{}_e.directiveName="unsafeSVG",_e.resultType=2;const $e=(t=>(...e)=>({_$litDirective$:t,values:e}))(_e);var xe=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,ke=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?Se(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&xe(e,i,s),s};const Ae=new Map([["magic-wand",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="m12.64 1.87l-.84 2.48a.41.41 0 0 0 0 .37l1.57 2.1a.4.4 0 0 1-.33.64h-2.62a.43.43 0 0 0-.33.17l-1.46 2.1a.4.4 0 0 1-.71-.11l-.78-2.5a.38.38 0 0 0-.26-.26l-2.5-.78a.4.4 0 0 1-.11-.71l2.14-1.51a.43.43 0 0 0 .17-.33V.91a.4.4 0 0 1 .6-.33l2.1 1.57a.41.41 0 0 0 .37.05l2.48-.84a.4.4 0 0 1 .51.51m-5.6 5.09L.5 13.5" stroke-width="1"/></svg>'],["close",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6z"/></svg>'],["open",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M4 21q-.425 0-.712-.288T3 20v-6q0-.425.288-.712T4 13t.713.288T5 14v3.6L17.6 5H14q-.425 0-.712-.288T13 4t.288-.712T14 3h6q.425 0 .713.288T21 4v6q0 .425-.288.713T20 11t-.712-.288T19 10V6.4L6.4 19H10q.425 0 .713.288T11 20t-.288.713T10 21z"/></svg>'],["arrow-up",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M16.21 16H7.79a1.76 1.76 0 0 1-1.59-1a2.1 2.1 0 0 1 .26-2.21l4.21-5.1a1.76 1.76 0 0 1 2.66 0l4.21 5.1A2.1 2.1 0 0 1 17.8 15a1.76 1.76 0 0 1-1.59 1"/></svg>'],["arrow-down",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M12 17a1.72 1.72 0 0 1-1.33-.64l-4.21-5.1a2.1 2.1 0 0 1-.26-2.21A1.76 1.76 0 0 1 7.79 8h8.42a1.76 1.76 0 0 1 1.59 1.05a2.1 2.1 0 0 1-.26 2.21l-4.21 5.1A1.72 1.72 0 0 1 12 17"/></svg>'],["template",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><defs><mask id="SVGZZ153dkC"><path fill="#4d4d4d" stroke="#fff" stroke-linejoin="round" stroke-width="4" d="M23 4H4v22h19zm21 30H4v9h40zm0-30H31v8h13zm0 14H31v8h13z"/></mask></defs><path fill="currentColor" d="M0 0h48v48H0z" mask="url(#SVGZZ153dkC)"/></svg>'],["js",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="currentColor" d="M10.77 7.3h.002c1.045.393 2.479.93 2.479 2.45a2.5 2.5 0 0 1-.224 1.02a2.5 2.5 0 0 1-1.515 1.364a2.5 2.5 0 0 1-1.035.115a2 2 0 0 1-.214.012a2.5 2.5 0 0 1-1.673-.65a2.52 2.52 0 0 1-.838-1.859c0-.202.078-.39.22-.532a.77.77 0 0 1 1.06 0a.74.74 0 0 1 .221.53c0 .952 1.041 1 1.25 1s1.25-.048 1.25-1c0-.413-.447-.648-1.514-1.048h-.003C9.19 8.307 7.753 7.77 7.753 6.25q.005-.537.224-1.02a2.5 2.5 0 0 1 .614-.842a2.5 2.5 0 0 1 .9-.52a3.5 3.5 0 0 1 2.023 0a2.52 2.52 0 0 1 1.738 2.381c0 .201-.078.39-.22.531a.77.77 0 0 1-1.061 0a.74.74 0 0 1-.22-.53c0-.952-1.041-1-1.25-1s-1.25.048-1.25 1c0 .413.447.648 1.514 1.048zM5.751 4.5c0-.2.078-.388.22-.53a.77.77 0 0 1 1.06 0c.142.141.22.33.22.53v5a2.75 2.75 0 0 1-4.695 1.945A2.73 2.73 0 0 1 1.75 9.5V9c0-.2.078-.388.22-.53a.77.77 0 0 1 1.061 0c.142.141.22.33.22.53v.5c0 .33.134.652.366.884c.465.465 1.303.465 1.768 0c.232-.233.366-.555.366-.884z"/></svg>'],["filter",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M3 4c2.01 2.59 7 9 7 9v7h4v-7s4.98-6.41 7-9z"/></svg>'],["filter-off",'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M3.004 1.59L3 1.586L1.586 3l4.928 4.928L10 12.818V21h4v-5.585l7 7l1.41-1.41L3 1.595zm12.266 9.446L21 3H7.234z"/></svg>']]);function Ce(t){return Ae.get(t)||'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="m12.64 1.87l-.84 2.48a.41.41 0 0 0 0 .37l1.57 2.1a.4.4 0 0 1-.33.64h-2.62a.43.43 0 0 0-.33.17l-1.46 2.1a.4.4 0 0 1-.71-.11l-.78-2.5a.38.38 0 0 0-.26-.26l-2.5-.78a.4.4 0 0 1-.11-.71l2.14-1.51a.43.43 0 0 0 .17-.33V.91a.4.4 0 0 1 .6-.33l2.1 1.57a.41.41 0 0 0 .37.05l2.48-.84a.4.4 0 0 1 .51.51m-5.6 5.09L.5 13.5" stroke-width="1"/></svg>'}let Ee=class extends ie{constructor(){super(...arguments),this.icon="magic-wand",this.size="16px"}handelClick(){this.dispatchEvent(new CustomEvent("hm-icon-click"))}render(){return It`
|
|
155
|
+
<div class="icon"
|
|
156
|
+
style="width:${this.size}; height:${this.size};"
|
|
157
|
+
@click="${this.handelClick}"
|
|
158
|
+
>
|
|
159
|
+
${$e(Ce(this.icon))}
|
|
160
|
+
</div>
|
|
161
|
+
`}};Ee.styles=et`
|
|
162
|
+
:host {
|
|
163
|
+
display: inline-block;
|
|
164
|
+
}
|
|
165
|
+
.icon {
|
|
166
|
+
display: flex;
|
|
167
|
+
align-items: center;
|
|
168
|
+
justify-content: center;
|
|
169
|
+
width: 100%;
|
|
170
|
+
height: 100%;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.icon svg {
|
|
174
|
+
width: 100%;
|
|
175
|
+
height: 100%;
|
|
176
|
+
}
|
|
177
|
+
`,ke([le({type:String})],Ee.prototype,"icon",2),ke([le({type:String})],Ee.prototype,"size",2),Ee=ke([ne("hm-icon")],Ee);const Oe=Object.freeze(Object.defineProperty({__proto__:null,get HmIcon(){return Ee},getIcon:Ce,registerIcon:function(t,e){Ae.set(t,e)}},Symbol.toStringTag,{value:"Module"}));var Te=Object.defineProperty,Pe=Object.getOwnPropertyDescriptor,Me=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?Pe(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&Te(e,i,s),s};let je=class extends ie{constructor(){super(...arguments),this.icon="magic-wand",this.content="HortiMagic",this.flag=!1,this.isMenuItem=!1}handleClick(){this.isMenuItem||(this.flag=!this.flag),this.dispatchEvent(new CustomEvent("hm-menu-click"))}render(){return It`
|
|
178
|
+
<div
|
|
179
|
+
class="menu ${this.isMenuItem?"is-menu-item":"not-menu-item"}"
|
|
180
|
+
style="display:${this.isMenuItem&&!this.flag?"none":"flex"}"
|
|
181
|
+
@click="${this.handleClick}"
|
|
182
|
+
>
|
|
183
|
+
<hm-icon class="left icon" icon="${this.icon}" size="24px"></hm-icon>
|
|
184
|
+
<div class="content">
|
|
185
|
+
<slot name="content"> ${this.content} </slot>
|
|
186
|
+
</div>
|
|
187
|
+
<div class="right">
|
|
188
|
+
<slot name="right">
|
|
189
|
+
${this.isMenuItem?"":It`<hm-icon
|
|
190
|
+
class="icon right"
|
|
191
|
+
icon="${this.flag?"arrow-up":"arrow-down"}"
|
|
192
|
+
></hm-icon
|
|
193
|
+
>`}
|
|
194
|
+
</slot>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
`}};je.styles=et`
|
|
202
|
+
:host {
|
|
203
|
+
color: rgb(33,33,33);
|
|
204
|
+
height: 56px;
|
|
205
|
+
}
|
|
206
|
+
.menu:hover {
|
|
207
|
+
color: rgba(255, 255, 0, 1);
|
|
208
|
+
}
|
|
209
|
+
.menu {
|
|
210
|
+
height: 56px;
|
|
211
|
+
align-items: center;
|
|
212
|
+
}
|
|
213
|
+
.icon {
|
|
214
|
+
display: flex;
|
|
215
|
+
justify-content: center;
|
|
216
|
+
align-items: center;
|
|
217
|
+
height: 56px;
|
|
218
|
+
width: 56px;
|
|
219
|
+
}
|
|
220
|
+
.left {
|
|
221
|
+
margin-right: 16px;
|
|
222
|
+
color: rgb(117,117,117);
|
|
223
|
+
}
|
|
224
|
+
.right {
|
|
225
|
+
position: absolute;
|
|
226
|
+
right: 2px;
|
|
227
|
+
display: flex;
|
|
228
|
+
justify-content: center;
|
|
229
|
+
align-items: center;
|
|
230
|
+
}
|
|
231
|
+
.content {
|
|
232
|
+
font-size: 16px;
|
|
233
|
+
font-weight:bold;
|
|
234
|
+
margin-right:auto;
|
|
235
|
+
}
|
|
236
|
+
.is-menu-item {
|
|
237
|
+
background:rgb(240,240,240);
|
|
238
|
+
}
|
|
239
|
+
.not-menu-item {
|
|
240
|
+
background:rgb(255,255,255);
|
|
241
|
+
}
|
|
242
|
+
`,Me([le({type:String})],je.prototype,"icon",2),Me([le({type:String})],je.prototype,"content",2),Me([le({type:Boolean})],je.prototype,"flag",2),Me([le({type:Boolean})],je.prototype,"isMenuItem",2),je=Me([ne("hm-menu")],je);const ze=Object.freeze(Object.defineProperty({__proto__:null,get HmMenu(){return je}},Symbol.toStringTag,{value:"Module"}));var Be=Object.defineProperty,He=Object.getOwnPropertyDescriptor,Ie=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?He(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&Be(e,i,s),s};let De=class extends ie{constructor(){super(...arguments),this.leftIcon="magic-wand",this.title="HortiMagic",this.content="Hello iirose!",this.rightIcon="",this.displayTime=999999,this.color="rgb(33,33,33)",this.backgroundColor="rgba(255,255,255,0.9)"}firstUpdated(){this.displayTime>0&&setTimeout(()=>{this.startLeaveAnimation()},this.displayTime)}startLeaveAnimation(){this.setAttribute("leaving",""),setTimeout(()=>{this.remove()},300)}render(){return It`
|
|
243
|
+
<div
|
|
244
|
+
class="hm-notification"
|
|
245
|
+
style="${this.color?`border-color: ${this.color};`:""}
|
|
246
|
+
${this.color?`color: ${this.color};`:""}
|
|
247
|
+
${this.backgroundColor?`background-color: ${this.backgroundColor};`:""}"
|
|
248
|
+
>
|
|
249
|
+
${this.leftIcon?It`
|
|
250
|
+
<div class="icondiv">
|
|
251
|
+
<hm-icon icon="${this.leftIcon}" size="24px"></hm-icon>
|
|
252
|
+
</div>
|
|
253
|
+
`:""}
|
|
254
|
+
|
|
255
|
+
<div class="hm-notification-main">
|
|
256
|
+
<div class="hm-notification-title">${this.title}</div>
|
|
257
|
+
<div class="hm-notification-content">${this.content}</div>
|
|
258
|
+
</div>
|
|
259
|
+
${this.rightIcon?It`
|
|
260
|
+
<div class="icondiv">
|
|
261
|
+
<hm-icon icon="${this.rightIcon}" size="24px"></hm-icon>
|
|
262
|
+
</div>
|
|
263
|
+
`:""}
|
|
264
|
+
</div>
|
|
265
|
+
`}};De.styles=et`
|
|
266
|
+
:host{
|
|
267
|
+
display: block;
|
|
268
|
+
width: auto;
|
|
269
|
+
z-index: 9999999;
|
|
270
|
+
margin: 2px;
|
|
271
|
+
animation: slideInRight 0.3s ease-out forwards;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
:host([leaving]) {
|
|
275
|
+
animation: slideOutRight 0.3s ease-in forwards;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
@keyframes slideInRight {
|
|
279
|
+
from {
|
|
280
|
+
opacity: 0;
|
|
281
|
+
transform: translate3d(100%, 0, 0);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
to {
|
|
285
|
+
opacity: 1;
|
|
286
|
+
transform: translate3d(0, 0, 0);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
@keyframes slideOutRight {
|
|
291
|
+
from {
|
|
292
|
+
opacity: 1;
|
|
293
|
+
transform: translate3d(0, 0, 0);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
to {
|
|
297
|
+
opacity: 0;
|
|
298
|
+
transform: translate3d(100%, 0, 0);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.hm-notification{
|
|
303
|
+
display: flex;
|
|
304
|
+
align-items: center;
|
|
305
|
+
width:fit-content;
|
|
306
|
+
max-width: 320px;
|
|
307
|
+
border-radius: 10px;
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
.hm-notification-main{
|
|
311
|
+
margin-right: 8px;
|
|
312
|
+
padding: 8px;
|
|
313
|
+
}
|
|
314
|
+
.hm-notification-title{
|
|
315
|
+
font-size: 16px;
|
|
316
|
+
font-weight: bold;
|
|
317
|
+
}
|
|
318
|
+
.hm-notification-content{
|
|
319
|
+
font-size: 14px;
|
|
320
|
+
}
|
|
321
|
+
.icondiv{
|
|
322
|
+
display: flex;
|
|
323
|
+
align-items: center;
|
|
324
|
+
justify-content: center;
|
|
325
|
+
width: 44px;
|
|
326
|
+
height: 44px;
|
|
327
|
+
}
|
|
328
|
+
`,Ie([le()],De.prototype,"leftIcon",2),Ie([le()],De.prototype,"title",2),Ie([le()],De.prototype,"content",2),Ie([le()],De.prototype,"rightIcon",2),Ie([le()],De.prototype,"displayTime",2),Ie([le()],De.prototype,"color",2),Ie([le()],De.prototype,"backgroundColor",2),De=Ie([ne("hm-notification")],De);const Ne=Object.freeze(Object.defineProperty({__proto__:null,get HmNotification(){return De}},Symbol.toStringTag,{value:"Module"}));var Ue=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,Re=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?Le(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&Ue(e,i,s),s};let qe=class extends ie{constructor(){super(...arguments),this.icon="",this.content="",this.fontSize="14px",this.color="",this.background="",this.width="",this.height="",this.enable=!0,this.loading=!1}render(){const t=`\n ${this.color?`color: ${this.color};`:""}\n ${this.background?`background-color: ${this.background};`:""}\n ${this.width?`width: ${this.width};`:""}\n ${this.height?`height: ${this.height};`:""}\n ${this.fontSize?`font-size: ${this.fontSize};`:"14px"}\n `;return It`
|
|
329
|
+
<button
|
|
330
|
+
class="button"
|
|
331
|
+
style="${t}"
|
|
332
|
+
?disabled="${!this.enable||this.loading}"
|
|
333
|
+
@click="${this._handleClick}">
|
|
334
|
+
|
|
335
|
+
${this.loading?It`
|
|
336
|
+
<div class="loading-spinner"></div>
|
|
337
|
+
`:this.icon?It`
|
|
338
|
+
<slot name="icon">
|
|
339
|
+
<hm-icon icon="${this.icon}" style="margin-right: 8px;"></hm-icon>
|
|
340
|
+
</slot>
|
|
341
|
+
`:""}
|
|
342
|
+
|
|
343
|
+
<span class="button-content">
|
|
344
|
+
<slot>${this.content}</slot>
|
|
345
|
+
</span>
|
|
346
|
+
</button>
|
|
347
|
+
`}_handleClick(t){this.enable&&!this.loading?this.dispatchEvent(new CustomEvent("hm-button-click")):t.stopPropagation()}};qe.styles=et`
|
|
348
|
+
:host {
|
|
349
|
+
display: inline-block;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.button {
|
|
353
|
+
display: inline-flex;
|
|
354
|
+
align-items: center;
|
|
355
|
+
justify-content: center;
|
|
356
|
+
border: none;
|
|
357
|
+
border-radius: 4px;
|
|
358
|
+
padding: 8px 16px;
|
|
359
|
+
cursor: pointer;
|
|
360
|
+
transition: all 0.3s;
|
|
361
|
+
opacity: 1;
|
|
362
|
+
// 添加鼠标悬停动画
|
|
363
|
+
&:hover:not(:disabled) {
|
|
364
|
+
transform: translateY(-2px);
|
|
365
|
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.button:disabled {
|
|
370
|
+
cursor: not-allowed;
|
|
371
|
+
opacity: 0.6;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.button.loading {
|
|
375
|
+
cursor: not-allowed;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.loading-spinner {
|
|
379
|
+
width: 14px;
|
|
380
|
+
height: 14px;
|
|
381
|
+
border: 2px solid transparent;
|
|
382
|
+
border-top-color: currentColor;
|
|
383
|
+
border-radius: 50%;
|
|
384
|
+
animation: rotate 1s linear infinite;
|
|
385
|
+
margin-right: 8px;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
@keyframes rotate {
|
|
389
|
+
from {
|
|
390
|
+
transform: rotate(0deg);
|
|
391
|
+
}
|
|
392
|
+
to {
|
|
393
|
+
transform: rotate(360deg);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.button-content {
|
|
398
|
+
display: flex;
|
|
399
|
+
align-items: center;
|
|
400
|
+
}
|
|
401
|
+
`,Re([le({type:String})],qe.prototype,"icon",2),Re([le({type:String})],qe.prototype,"content",2),Re([le({type:String})],qe.prototype,"fontSize",2),Re([le({type:String})],qe.prototype,"color",2),Re([le({type:String})],qe.prototype,"background",2),Re([le({type:String})],qe.prototype,"width",2),Re([le({type:String})],qe.prototype,"height",2),Re([le({type:Boolean})],qe.prototype,"enable",2),Re([le({type:Boolean})],qe.prototype,"loading",2),qe=Re([ne("hm-button")],qe);const We=Object.freeze(Object.defineProperty({__proto__:null,get HmButton(){return qe}},Symbol.toStringTag,{value:"Module"}));var Xe=Object.defineProperty,Fe=Object.getOwnPropertyDescriptor,Ve=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?Fe(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&Xe(e,i,s),s};let Je=class extends ie{constructor(){super(...arguments),this.titleName="单元格",this.descripthion="描述信息",this.content="内容",this.titleClickCallback=()=>{},this.contentClickCallback=()=>{}}render(){return It`
|
|
402
|
+
<div class="cell" part="cell">
|
|
403
|
+
<div
|
|
404
|
+
class="left-section"
|
|
405
|
+
part="left-section"
|
|
406
|
+
@click="${this.titleClickCallback}"
|
|
407
|
+
>
|
|
408
|
+
<div class="title" part="title">
|
|
409
|
+
<slot name="title">${this.titleName}</slot>
|
|
410
|
+
</div>
|
|
411
|
+
<div class="description" part="description">
|
|
412
|
+
<slot name="description">${this.descripthion}</slot>
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
<div
|
|
416
|
+
class="right-section"
|
|
417
|
+
part="right-section"
|
|
418
|
+
@click="${this.contentClickCallback}"
|
|
419
|
+
>
|
|
420
|
+
<div class="content" part="content">
|
|
421
|
+
<slot name="content">${this.content}</slot>
|
|
422
|
+
</div>
|
|
423
|
+
</div>
|
|
424
|
+
</div>
|
|
425
|
+
|
|
426
|
+
`}};Je.styles=et`
|
|
427
|
+
:host {
|
|
428
|
+
display: block;
|
|
429
|
+
width: 100%;
|
|
430
|
+
}
|
|
431
|
+
.cell {
|
|
432
|
+
display: flex;
|
|
433
|
+
align-items: center;
|
|
434
|
+
justify-content: space-between;
|
|
435
|
+
width: 100%;
|
|
436
|
+
min-height: 60px;
|
|
437
|
+
padding: var(--hm-cell-padding, 12px 16px);
|
|
438
|
+
background: var(--hm-cell-background, #ffffff);
|
|
439
|
+
border: var(--hm-cell-border, 1px dashed #e0e0e0);
|
|
440
|
+
box-sizing: border-box;
|
|
441
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.left-section {
|
|
445
|
+
display: flex;
|
|
446
|
+
flex-direction: column;
|
|
447
|
+
justify-content: center;
|
|
448
|
+
flex: 1;
|
|
449
|
+
min-width: 0; /* 允许文本截断 */
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.title {
|
|
453
|
+
font-size: var(--hm-cell-title-font-size, 18px);
|
|
454
|
+
font-weight: var(--hm-cell-title-font-weight, 600);
|
|
455
|
+
color: var(--hm-cell-title-color, #000000);
|
|
456
|
+
line-height: 1.4;
|
|
457
|
+
margin-bottom: 2px;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.description {
|
|
461
|
+
font-size: var(--hm-cell-description-font-size, 14px);
|
|
462
|
+
color: var(--hm-cell-description-color, #666666);
|
|
463
|
+
line-height: 1.4;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.right-section {
|
|
467
|
+
display: flex;
|
|
468
|
+
align-items: center;
|
|
469
|
+
justify-content: flex-end;
|
|
470
|
+
margin-left: auto;
|
|
471
|
+
padding-left: 16px;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.content {
|
|
475
|
+
font-size: var(--hm-cell-content-font-size, 16px);
|
|
476
|
+
color: var(--hm-cell-content-color, #333333);
|
|
477
|
+
text-align: right;
|
|
478
|
+
padding-right: var(--hm-cell-content-padding-right, 30px);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/* 响应式设计 */
|
|
482
|
+
@media (max-width: 480px) {
|
|
483
|
+
.cell {
|
|
484
|
+
padding: var(--hm-cell-mobile-padding, 10px 12px);
|
|
485
|
+
min-height: 50px;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.title {
|
|
489
|
+
font-size: var(--hm-cell-mobile-title-font-size, 16px);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.description {
|
|
493
|
+
font-size: var(--hm-cell-mobile-description-font-size, 12px);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.content {
|
|
497
|
+
font-size: var(--hm-cell-mobile-content-font-size, 14px);
|
|
498
|
+
padding-right: var(--hm-cell-mobile-content-padding-right, 16px);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
/* 当鼠标或触摸悬停在整个单元格上时,改变内部文本的样式 */
|
|
502
|
+
.cell:hover .title,
|
|
503
|
+
.cell:hover .description,
|
|
504
|
+
.cell:hover .content {
|
|
505
|
+
/* 使用CSS变量允许自定义,并提供默认高亮颜色 */
|
|
506
|
+
color: var(--hm-cell-hover-font-color, #1890ff);
|
|
507
|
+
/* 可选:增加字体粗细使其更突出 */
|
|
508
|
+
font-weight: var(--hm-cell-hover-font-weight, 600);
|
|
509
|
+
/* 可选:添加文字阴影增强视觉效果 */
|
|
510
|
+
text-shadow: var(--hm-cell-hover-text-shadow, 0 0 5px rgba(24, 144, 255, 0.2));
|
|
511
|
+
}
|
|
512
|
+
`,Ve([le()],Je.prototype,"titleName",2),Ve([le()],Je.prototype,"descripthion",2),Ve([le()],Je.prototype,"content",2),Ve([le()],Je.prototype,"titleClickCallback",2),Ve([le()],Je.prototype,"contentClickCallback",2),Je=Ve([ne("hm-cell")],Je);const Ge=Object.freeze(Object.defineProperty({__proto__:null,get HmCell(){return Je}},Symbol.toStringTag,{value:"Module"}));var Ze=Object.defineProperty,Ye=Object.getOwnPropertyDescriptor,Ke=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?Ye(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&Ze(e,i,s),s};let Qe=class extends ie{constructor(){super(...arguments),this._isDragging=!1,this._startX=0,this._currentTranslate=0,this._prevTranslate=0,this._animationId=0,this._velocity=0,this._lastX=0,this._lastTime=0,this._isOpen=!1,this.rightButtonName="右侧按钮",this.rightButtonCallback=function(){},this.leftActionsWidth=0,this.rightActionsWidth=0,this.onDragStart=t=>{t.preventDefault(),this.startDrag(t.clientX),this.sliderElement.style.cursor="grabbing",this.sliderElement.style.transition="none"},this.onTouchStart=t=>{t.preventDefault(),this.startDrag(t.touches[0].clientX),this.sliderElement.style.transition="none"},this.startDrag=t=>{this._isDragging=!0,this._startX=t,this._lastX=t,this._lastTime=Date.now(),this._isOpen=Math.abs(this._prevTranslate)>10,this.calculateActionWidths()},this.onDragMove=t=>{this._isDragging&&(t.preventDefault(),this.handleMove(t.clientX))},this.onTouchMove=t=>{this._isDragging&&(t.preventDefault(),this.handleMove(t.touches[0].clientX))},this.onDragEnd=()=>{this.finishDrag(),this.sliderElement.style.cursor="grab"},this.onTouchEnd=()=>{this.finishDrag()}}firstUpdated(){this.calculateActionWidths(),this.addEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListeners()}calculateActionWidths(){this.leftActionsWidth=this.leftActions?this.leftActions.offsetWidth:0,this.rightActionsWidth=this.rightActions?this.rightActions.offsetWidth:0}addEventListeners(){this.sliderElement.addEventListener("mousedown",this.onDragStart),this.sliderElement.addEventListener("touchstart",this.onTouchStart,{passive:!1}),document.addEventListener("mousemove",this.onDragMove),document.addEventListener("touchmove",this.onTouchMove,{passive:!1}),document.addEventListener("mouseup",this.onDragEnd),document.addEventListener("touchend",this.onTouchEnd)}removeEventListeners(){this.sliderElement.removeEventListener("mousedown",this.onDragStart),this.sliderElement.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("mousemove",this.onDragMove),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("mouseup",this.onDragEnd),document.removeEventListener("touchend",this.onTouchEnd)}handleMove(t){const e=Date.now(),i=e-this._lastTime;i>0&&(this._velocity=(t-this._lastX)/i,this._lastX=t,this._lastTime=e);const o=t-this._startX;let n=this._prevTranslate+o;if(n>this.leftActionsWidth){const t=n-this.leftActionsWidth;n=this.leftActionsWidth+this.easeOut(t,30)}else if(n<-this.rightActionsWidth){const t=n+this.rightActionsWidth;n=-this.rightActionsWidth+this.easeOut(t,30)}this._currentTranslate=n,this.updateSliderPosition()}easeOut(t,e){return.2*t}finishDrag(){this._isDragging=!1,this.sliderElement.style.transition="transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)";let t=0;if(t=this._currentTranslate>5||this._currentTranslate>0&&this._velocity>.1?this.leftActionsWidth:this._currentTranslate<-5||this._currentTranslate<0&&this._velocity<-.1?-this.rightActionsWidth:0,this._isOpen){const e=5;t=this._prevTranslate>0&&this._currentTranslate<this._prevTranslate-e||this._prevTranslate<0&&this._currentTranslate>this._prevTranslate+e?0:this._prevTranslate}this._currentTranslate=t,this._prevTranslate=t,this.updateSliderPosition(),this._velocity=0}updateSliderPosition(){this._animationId&&cancelAnimationFrame(this._animationId),this._animationId=requestAnimationFrame(()=>{if(this.sliderElement.style.transform=`translateX(${this._currentTranslate}px)`,this._currentTranslate>0){const t=Math.min(this._currentTranslate/this.leftActionsWidth,1);this.leftActions.style.transform=`translateX(${100*t-100}%)`,this.rightActions.style.transform="translateX(100%)"}else if(this._currentTranslate<0){const t=Math.min(-this._currentTranslate/this.rightActionsWidth,1);this.rightActions.style.transform=`translateX(${100-100*t}%)`,this.leftActions.style.transform="translateX(-100%)"}else this.leftActions.style.transform="translateX(-100%)",this.rightActions.style.transform="translateX(100%)"})}render(){return It`
|
|
513
|
+
<div class="swipe-container">
|
|
514
|
+
<div class="actions left-actions">
|
|
515
|
+
<slot name="left-actions"> </slot>
|
|
516
|
+
</div>
|
|
517
|
+
<div class="slider">
|
|
518
|
+
<slot name="content" class="content">
|
|
519
|
+
<hm-cell></hm-cell>
|
|
520
|
+
</slot>
|
|
521
|
+
</div>
|
|
522
|
+
<div class="actions right-actions">
|
|
523
|
+
<slot name="right-actions">
|
|
524
|
+
<hm-button type="primary" @hm-button-click="${this.rightButtonCallback}"
|
|
525
|
+
>${this.rightButtonName}</hm-button
|
|
526
|
+
>
|
|
527
|
+
</slot>
|
|
528
|
+
</div>
|
|
529
|
+
</div>
|
|
530
|
+
`}};Qe.styles=et`
|
|
531
|
+
:host {
|
|
532
|
+
display: block;
|
|
533
|
+
overflow: hidden;
|
|
534
|
+
position: relative;
|
|
535
|
+
user-select: none;
|
|
536
|
+
touch-action: pan-y;
|
|
537
|
+
height: 60px;
|
|
538
|
+
background: #f9f9f9;
|
|
539
|
+
border-radius: 8px;
|
|
540
|
+
margin: 10px 0;
|
|
541
|
+
}
|
|
542
|
+
.swipe-container {
|
|
543
|
+
position: relative;
|
|
544
|
+
width: 100%;
|
|
545
|
+
height: 100%;
|
|
546
|
+
background: white;
|
|
547
|
+
border-radius: 8px;
|
|
548
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
|
549
|
+
overflow: hidden;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.slider {
|
|
553
|
+
position: relative;
|
|
554
|
+
width: 100%;
|
|
555
|
+
height: 100%;
|
|
556
|
+
transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
557
|
+
will-change: transform;
|
|
558
|
+
z-index: 2;
|
|
559
|
+
background: white;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.content {
|
|
563
|
+
display: flex;
|
|
564
|
+
align-items: center;
|
|
565
|
+
justify-content: space-between;
|
|
566
|
+
padding: 0 15px;
|
|
567
|
+
height: 100%;
|
|
568
|
+
width: 100%;
|
|
569
|
+
position: relative; // 改为相对定位
|
|
570
|
+
top: 0;
|
|
571
|
+
left: 0;
|
|
572
|
+
background: white;
|
|
573
|
+
box-sizing: border-box;
|
|
574
|
+
border-radius: 8px;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.actions {
|
|
578
|
+
position: absolute;
|
|
579
|
+
top: 0;
|
|
580
|
+
bottom: 0;
|
|
581
|
+
display: flex;
|
|
582
|
+
align-items: center;
|
|
583
|
+
z-index: 1;
|
|
584
|
+
transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.left-actions {
|
|
588
|
+
left: 0;
|
|
589
|
+
padding-left: 10px;
|
|
590
|
+
transform: translateX(-100%);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.right-actions {
|
|
594
|
+
right: 0;
|
|
595
|
+
padding-right: 10px;
|
|
596
|
+
transform: translateX(100%);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.action-btn {
|
|
600
|
+
height: 44px;
|
|
601
|
+
border: none;
|
|
602
|
+
color: white;
|
|
603
|
+
padding: 0 20px;
|
|
604
|
+
cursor: pointer;
|
|
605
|
+
font-size: 14px;
|
|
606
|
+
display: flex;
|
|
607
|
+
align-items: center;
|
|
608
|
+
justify-content: center;
|
|
609
|
+
transition: all 0.2s ease;
|
|
610
|
+
border-radius: 6px;
|
|
611
|
+
margin: 0 4px;
|
|
612
|
+
min-width: 80px;
|
|
613
|
+
font-weight: 500;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
.action-btn:hover {
|
|
617
|
+
transform: scale(1.05);
|
|
618
|
+
filter: brightness(1.1);
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.action-btn:active {
|
|
622
|
+
transform: scale(0.95);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.action-btn.favorite {
|
|
626
|
+
background: linear-gradient(135deg, #2196F3, #1976D2);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.action-btn.delete {
|
|
630
|
+
background: linear-gradient(135deg, #f44336, #d32f2f);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.action-btn.mark {
|
|
634
|
+
background: linear-gradient(135deg, #FF9800, #F57C00);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
.action-btn.archive {
|
|
638
|
+
background: linear-gradient(135deg, #9C27B0, #7B1FA2);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
.action-btn.share {
|
|
642
|
+
background: linear-gradient(135deg, #4CAF50, #388E3C);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
.action-btn.edit {
|
|
646
|
+
background: linear-gradient(135deg, #607D8B, #455A64);
|
|
647
|
+
}
|
|
648
|
+
.contentslot{
|
|
649
|
+
width: 100%;
|
|
650
|
+
}
|
|
651
|
+
`,Ke([le()],Qe.prototype,"_isDragging",2),Ke([le()],Qe.prototype,"_startX",2),Ke([le()],Qe.prototype,"_currentTranslate",2),Ke([le()],Qe.prototype,"_prevTranslate",2),Ke([le()],Qe.prototype,"_animationId",2),Ke([le()],Qe.prototype,"_velocity",2),Ke([le()],Qe.prototype,"_lastX",2),Ke([le()],Qe.prototype,"_lastTime",2),Ke([le()],Qe.prototype,"_isOpen",2),Ke([le()],Qe.prototype,"rightButtonName",2),Ke([le()],Qe.prototype,"rightButtonCallback",2),Ke([ce(".slider")],Qe.prototype,"sliderElement",2),Ke([ce(".content")],Qe.prototype,"contentElement",2),Ke([ce(".left-actions")],Qe.prototype,"leftActions",2),Ke([ce(".right-actions")],Qe.prototype,"rightActions",2),Qe=Ke([ne("hm-swipe-cell")],Qe);const ti=Object.freeze(Object.defineProperty({__proto__:null,get HmSwipeCell(){return Qe}},Symbol.toStringTag,{value:"Module"}));var ei=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,oi=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?ii(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&ei(e,i,s),s};let ni=class extends ie{constructor(){super(...arguments),this.checked=!1,this.disabled=!1,this.loading=!1,this.color="#1890ff",this.openContent="",this.closeContent="",this.openIcon="",this.closeIcon=""}change(){this.disabled||this.loading||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("hm-switch-change",{detail:{checked:this.checked},bubbles:!0,composed:!0})))}render(){return It`
|
|
652
|
+
<div
|
|
653
|
+
class="switch ${this.disabled?"disabled":""} ${this.loading?"loading":""} ${this.checked?"checked":""}"
|
|
654
|
+
@click="${this.change}"
|
|
655
|
+
@touchstart="${this.change}"
|
|
656
|
+
style="--switch-color: ${this.color}"
|
|
657
|
+
>
|
|
658
|
+
<div class="switch-inner">
|
|
659
|
+
${this.checked?this.openIcon?It`<hm-icon icon="${this.openIcon}" size="14px"></hm-icon>`:this.openContent?It`<span>${this.openContent}</span>`:"":this.closeIcon?It`<hm-icon icon="${this.closeIcon}" size="14px"></hm-icon>`:this.closeContent?It`<span>${this.closeContent}</span>`:""}
|
|
660
|
+
</div>
|
|
661
|
+
</div>
|
|
662
|
+
`}};ni.styles=et`
|
|
663
|
+
.switch {
|
|
664
|
+
position: relative;
|
|
665
|
+
display: inline-block;
|
|
666
|
+
width: 44px;
|
|
667
|
+
height: 22px;
|
|
668
|
+
vertical-align: middle;
|
|
669
|
+
border: 1px solid #ccc;
|
|
670
|
+
border-radius: 20px;
|
|
671
|
+
background-color: #ccc;
|
|
672
|
+
cursor: pointer;
|
|
673
|
+
transition: all 0.3s;
|
|
674
|
+
user-select: none;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
.switch.checked {
|
|
678
|
+
background-color: var(--switch-color, #1890ff);
|
|
679
|
+
border-color: var(--switch-color, #1890ff);
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
.switch.disabled {
|
|
683
|
+
cursor: not-allowed;
|
|
684
|
+
opacity: 0.6;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
.switch.loading {
|
|
688
|
+
cursor: wait;
|
|
689
|
+
opacity: 0.6;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
.switch-inner {
|
|
693
|
+
position: absolute;
|
|
694
|
+
top: 2px;
|
|
695
|
+
left: 2px;
|
|
696
|
+
width: 18px;
|
|
697
|
+
height: 18px;
|
|
698
|
+
background-color: #fff;
|
|
699
|
+
border-radius: 50%;
|
|
700
|
+
transition: all 0.3s;
|
|
701
|
+
display: flex;
|
|
702
|
+
align-items: center;
|
|
703
|
+
justify-content: center;
|
|
704
|
+
font-size: 12px;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
.switch.checked .switch-inner {
|
|
708
|
+
left: calc(100% - 20px);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
.switch.loading::after {
|
|
712
|
+
content: '';
|
|
713
|
+
position: absolute;
|
|
714
|
+
top: 50%;
|
|
715
|
+
left: 50%;
|
|
716
|
+
width: 12px;
|
|
717
|
+
height: 12px;
|
|
718
|
+
margin-top: -6px;
|
|
719
|
+
margin-left: -6px;
|
|
720
|
+
border: 2px solid transparent;
|
|
721
|
+
border-top-color: currentColor;
|
|
722
|
+
border-radius: 50%;
|
|
723
|
+
animation: rotate 1s linear infinite;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
@keyframes rotate {
|
|
727
|
+
from {
|
|
728
|
+
transform: rotate(0deg);
|
|
729
|
+
}
|
|
730
|
+
to {
|
|
731
|
+
transform: rotate(360deg);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
hm-icon {
|
|
736
|
+
font-size: 12px;
|
|
737
|
+
width: 12px;
|
|
738
|
+
height: 12px;
|
|
739
|
+
display: flex;
|
|
740
|
+
align-items: center;
|
|
741
|
+
justify-content: center;
|
|
742
|
+
}
|
|
743
|
+
`,oi([le({type:Boolean})],ni.prototype,"checked",2),oi([le({type:Boolean})],ni.prototype,"disabled",2),oi([le({type:Boolean})],ni.prototype,"loading",2),oi([le({type:String})],ni.prototype,"color",2),oi([le({type:String})],ni.prototype,"openContent",2),oi([le({type:String})],ni.prototype,"closeContent",2),oi([le({type:String})],ni.prototype,"openIcon",2),oi([le({type:String})],ni.prototype,"closeIcon",2),ni=oi([ne("hm-switch")],ni);const si=Object.freeze(Object.defineProperty({__proto__:null,get HmSwitch(){return ni}},Symbol.toStringTag,{value:"Module"}));var ri=Object.defineProperty,li=Object.getOwnPropertyDescriptor,ai=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?li(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&ri(e,i,s),s};let ci=class extends ie{constructor(){super(...arguments),this.maxHeight="500px",this.items=[],this.expanded=!1}togglePanel(){this.expanded=!this.expanded}render(){return It`
|
|
744
|
+
<div class="accordion-container" style="max-height: ${this.maxHeight}">
|
|
745
|
+
<div class="accordion-header" @click=${this.togglePanel}>
|
|
746
|
+
<slot name="header">面板标题</slot>
|
|
747
|
+
<div class="accordion-toggle">
|
|
748
|
+
${this.expanded?It`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
|
749
|
+
<path d="M7.247 4.86l-4.796 5.481c-.566.647-.106 1.659.753 1.659h9.592a1 1 0 0 0 .753-1.659l-4.796-5.48a1 1 0 0 0-1.506 0z"/>
|
|
750
|
+
</svg>`:It`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
|
751
|
+
<path d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/>
|
|
752
|
+
</svg>`}
|
|
753
|
+
</div>
|
|
754
|
+
</div>
|
|
755
|
+
|
|
756
|
+
<div class="accordion-content" ?hidden=${!this.expanded}>
|
|
757
|
+
${this.items.length>0?this.items.map(t=>It`<div class="accordion-item">${t}</div>`):It`<slot></slot>`}
|
|
758
|
+
</div>
|
|
759
|
+
|
|
760
|
+
<div class="accordion-footer" ?hidden=${!this.expanded}>
|
|
761
|
+
<slot name="footer">
|
|
762
|
+
<hm-button @hm-button-click="${()=>{this.expanded=!1}}">关闭</hm-button>
|
|
763
|
+
</slot>
|
|
764
|
+
</div>
|
|
765
|
+
</div>
|
|
766
|
+
`}};ci.styles=et`
|
|
767
|
+
:host {
|
|
768
|
+
display: block;
|
|
769
|
+
width: 100%;
|
|
770
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
.accordion-container {
|
|
774
|
+
display: flex;
|
|
775
|
+
flex-direction: column;
|
|
776
|
+
border-radius: 8px;
|
|
777
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
778
|
+
background-color: white;
|
|
779
|
+
overflow: hidden;
|
|
780
|
+
transition: all 0.3s ease;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
.accordion-header {
|
|
784
|
+
padding: 16px 20px;
|
|
785
|
+
background-color: #f8f9fa;
|
|
786
|
+
border-bottom: 1px solid #e9ecef;
|
|
787
|
+
font-size: 1.25rem;
|
|
788
|
+
font-weight: 600;
|
|
789
|
+
color: #212529;
|
|
790
|
+
display: flex;
|
|
791
|
+
justify-content: space-between;
|
|
792
|
+
align-items: center;
|
|
793
|
+
cursor: pointer;
|
|
794
|
+
transition: background-color 0.2s;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
.accordion-header:hover {
|
|
798
|
+
background-color: #e9ecef;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
.accordion-toggle {
|
|
802
|
+
transition: transform 0.3s ease;
|
|
803
|
+
width: 24px;
|
|
804
|
+
height: 24px;
|
|
805
|
+
display: flex;
|
|
806
|
+
align-items: center;
|
|
807
|
+
justify-content: center;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
.accordion-content {
|
|
811
|
+
flex: 1;
|
|
812
|
+
overflow-y: auto;
|
|
813
|
+
padding: 0;
|
|
814
|
+
background-color: #ffffff;
|
|
815
|
+
transition: max-height 0.3s ease, opacity 0.3s ease;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
.accordion-footer {
|
|
819
|
+
padding: 12px 20px;
|
|
820
|
+
background-color: #f8f9fa;
|
|
821
|
+
border-top: 1px solid #e9ecef;
|
|
822
|
+
display: flex;
|
|
823
|
+
justify-content: flex-end;
|
|
824
|
+
gap: 10px;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
.accordion-item {
|
|
828
|
+
padding: 12px 20px;
|
|
829
|
+
border-bottom: 1px solid #e9ecef;
|
|
830
|
+
transition: background-color 0.2s;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
.accordion-item:last-child {
|
|
834
|
+
border-bottom: none;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
.accordion-item:hover {
|
|
838
|
+
background-color: #f8f9fa;
|
|
839
|
+
}
|
|
840
|
+
`,ai([le({type:String,attribute:"max-height"})],ci.prototype,"maxHeight",2),ai([le({type:Array})],ci.prototype,"items",2),ai([le({type:Boolean})],ci.prototype,"expanded",2),ci=ai([ne("hm-accordion")],ci);const hi=Object.freeze(Object.defineProperty({__proto__:null,get HmAccordion(){return ci}},Symbol.toStringTag,{value:"Module"}));var di=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,ui=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?pi(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&di(e,i,s),s};let mi=class extends ie{constructor(){super(...arguments),this.type="text",this.icon="",this.label="输入框",this.placeholder="",this.enable=!0,this.readonly=!1,this.value=""}_handleKeyDown(t){t.stopPropagation()}_handleInput(t){const e=t.target;this.value=e.value,this.dispatchEvent(new CustomEvent("hm-input-change",{detail:{value:this.value},bubbles:!0,composed:!0}))}render(){return It`
|
|
841
|
+
<div class="input-container">
|
|
842
|
+
<span class="label">${this.label}</span>
|
|
843
|
+
${this.icon?It`<hm-icon icon="${this.icon}" class="icon"></hm-icon>`:""}
|
|
844
|
+
<input
|
|
845
|
+
type="${this.type}"
|
|
846
|
+
value="${this.value}"
|
|
847
|
+
?disabled="${!this.enable}"
|
|
848
|
+
?readonly="${this.readonly}"
|
|
849
|
+
placeholder="${this.placeholder}"
|
|
850
|
+
style="padding-left: ${this.icon?"24px":"8px"};"
|
|
851
|
+
@keydown="${this._handleKeyDown}"
|
|
852
|
+
@input="${this._handleInput}"
|
|
853
|
+
/>
|
|
854
|
+
<slot name="right">
|
|
855
|
+
</slot>
|
|
856
|
+
</div>
|
|
857
|
+
`}};mi.styles=et`
|
|
858
|
+
:host {
|
|
859
|
+
display: block;
|
|
860
|
+
}
|
|
861
|
+
.input-container {
|
|
862
|
+
display: flex;
|
|
863
|
+
align-items: center;
|
|
864
|
+
}
|
|
865
|
+
.label {
|
|
866
|
+
margin-right: 8px;
|
|
867
|
+
}
|
|
868
|
+
input {
|
|
869
|
+
flex: 1;
|
|
870
|
+
padding: 8px 12px;
|
|
871
|
+
border: 1px solid #d9d9d9;
|
|
872
|
+
border-radius: 4px;
|
|
873
|
+
font-size: 14px;
|
|
874
|
+
outline: none;
|
|
875
|
+
transition: all 0.2s ease;
|
|
876
|
+
}
|
|
877
|
+
input:disabled {
|
|
878
|
+
background-color: #f5f5f5;
|
|
879
|
+
color: #999;
|
|
880
|
+
border-color: #ddd;
|
|
881
|
+
cursor: not-allowed;
|
|
882
|
+
}
|
|
883
|
+
input[readonly] {
|
|
884
|
+
background-color: #f5f5f5;
|
|
885
|
+
cursor: default;
|
|
886
|
+
}
|
|
887
|
+
.icon {
|
|
888
|
+
margin-right: 8px;
|
|
889
|
+
width: 16px;
|
|
890
|
+
height: 16px;
|
|
891
|
+
}
|
|
892
|
+
`,ui([le({type:String})],mi.prototype,"type",2),ui([le({type:String})],mi.prototype,"icon",2),ui([le({type:String})],mi.prototype,"label",2),ui([le({type:String})],mi.prototype,"placeholder",2),ui([le({type:Boolean})],mi.prototype,"enable",2),ui([le({type:Boolean})],mi.prototype,"readonly",2),ui([le()],mi.prototype,"value",2),mi=ui([ne("hm-input")],mi);const gi=Object.freeze(Object.defineProperty({__proto__:null,get HmInput(){return mi}},Symbol.toStringTag,{value:"Module"}));var fi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,yi=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?bi(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&fi(e,i,s),s};let vi=class extends ie{constructor(){super(...arguments),this.isOpen=!1,this.dialog=this}open(){this.isOpen=!0,this.dispatchEvent(new CustomEvent("hm-dialog-open"))}close(){this.isOpen=!1,this.dispatchEvent(new CustomEvent("hm-dialog-close"))}confirm(){this.close(),this.dispatchEvent(new CustomEvent("hm-dialog-confirm"))}cancel(){this.close(),this.dispatchEvent(new CustomEvent("hm-dialog-cancel"))}updated(t){t.has("isOpen")&&(this.isOpen?this.style.display="block":this.style.display="none")}render(){return It`
|
|
893
|
+
<div class="overlay"
|
|
894
|
+
@click="${this.close}"
|
|
895
|
+
></div>
|
|
896
|
+
<div class="content">
|
|
897
|
+
<slot></slot>
|
|
898
|
+
<div class="footer">
|
|
899
|
+
<slot name="footer">
|
|
900
|
+
<hm-button @click="${()=>{this.cancel()}}">取消</hm-button>
|
|
901
|
+
<hm-button @click="${()=>{this.confirm()}}">确定</hm-button>
|
|
902
|
+
</slot>
|
|
903
|
+
</div>
|
|
904
|
+
</div>
|
|
905
|
+
`}};vi.styles=et`
|
|
906
|
+
:host {
|
|
907
|
+
display: none;
|
|
908
|
+
position: fixed;
|
|
909
|
+
top: 0;
|
|
910
|
+
left: 0;
|
|
911
|
+
width: 100%;
|
|
912
|
+
height: 100%;
|
|
913
|
+
z-index: 1000;
|
|
914
|
+
}
|
|
915
|
+
:host([isopen]) {
|
|
916
|
+
display: block;
|
|
917
|
+
}
|
|
918
|
+
.overlay {
|
|
919
|
+
position: fixed;
|
|
920
|
+
top: 0;
|
|
921
|
+
left: 0;
|
|
922
|
+
width: 100%;
|
|
923
|
+
height: 100%;
|
|
924
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
.content {
|
|
928
|
+
position: absolute;
|
|
929
|
+
top: 50%;
|
|
930
|
+
left: 50%;
|
|
931
|
+
transform: translate(-50%, -50%);
|
|
932
|
+
background: white;
|
|
933
|
+
border-radius: 4px;
|
|
934
|
+
min-width: 300px;
|
|
935
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
936
|
+
padding: 20px;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
.footer {
|
|
940
|
+
display: flex;
|
|
941
|
+
justify-content: flex-end;
|
|
942
|
+
gap: 10px;
|
|
943
|
+
margin-top: 20px;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
hm-button {
|
|
947
|
+
min-width: 80px;
|
|
948
|
+
}
|
|
949
|
+
`,yi([le({type:Boolean,attribute:"isopen"})],vi.prototype,"isOpen",2),vi=yi([ne("hm-dialog")],vi);const wi=Object.freeze(Object.defineProperty({__proto__:null,get HmDialog(){return vi}},Symbol.toStringTag,{value:"Module"})),_i=Object.freeze(Object.defineProperty({__proto__:null,hm_accordion:hi,hm_button:We,hm_cell:Ge,hm_dialog:wi,hm_icon:Oe,hm_input:gi,hm_menu:ze,hm_move_panel:be,hm_notification:Ne,hm_swipe_cell:ti,hm_switch:si},Symbol.toStringTag,{value:"Module"}));let $i=document.createElement("div");function xi(){$i.id="hmMenuHolder";let t=document.querySelector("#functionHolderImg");null!==t&&t.parentElement.insertAdjacentElement("afterend",$i)}const Si=Object.freeze(Object.defineProperty({__proto__:null,initMenuHolder:xi,menuHolder:$i},Symbol.toStringTag,{value:"Module"}));let ki=document.createElement("div");function Ai(){ki.id="hmMovePanelHolder",document.body.append(ki)}const Ci=Object.freeze(Object.defineProperty({__proto__:null,initMovePanelHolder:Ai,movePanelHolder:ki},Symbol.toStringTag,{value:"Module"}));let Ei=document.createElement("div");function Oi(){Ei.id="hmNotificationHolder",document.body.append(Ei)}let Ti={success(t,e,i=2e3){let o=document.createElement("hm-notification");o.title=t,o.content=e,o.displayTime=i,o.backgroundColor="rgba(57, 231, 34, 0.7)",o.color="rgb(255,255,255)",Ei.append(o)},warning(t,e,i=2e3){let o=document.createElement("hm-notification");o.title=t,o.content=e,o.displayTime=i,o.backgroundColor="rgba(255,193,7,0.7)",o.color="rgb(255,255,255)",Ei.append(o)},error(t,e,i=2e3){let o=document.createElement("hm-notification");o.title=t,o.content=e,o.displayTime=i,o.backgroundColor="rgba(255,0,0,0.7)",o.color="rgb(255,255,255)",Ei.append(o)},normal(t,e,i=2e3){let o=document.createElement("hm-notification");o.title=t,o.content=e,o.displayTime=i,o.backgroundColor="rgba(33,33,33,0.7)",o.color="rgb(255,255,255)",Ei.append(o)}};const Pi=Object.freeze(Object.defineProperty({__proto__:null,initNotificationHolder:Oi,notice:Ti,notificationHolder:Ei},Symbol.toStringTag,{value:"Module"}));let Mi=document.createElement("div");function ji(){Mi.id="hmDialogHolder",document.body.append(Mi)}const zi=Object.freeze(Object.defineProperty({__proto__:null,dialogHolder:Mi,initDialogHolder:ji},Symbol.toStringTag,{value:"Module"}));async function Bi(){let t=document.createElement("hm-move-panel");t.titleContent="组件模板",t.icon="template",ki.appendChild(t);let e=It`
|
|
950
|
+
|
|
951
|
+
<h3>输入框</h3>
|
|
952
|
+
基本使用
|
|
953
|
+
<hm-input label="用户名" placeholder="请输入用户名"></hm-input>
|
|
954
|
+
带图标的输入框
|
|
955
|
+
<hm-input label="密码" icon="password" placeholder="请输入密码"></hm-input>
|
|
956
|
+
禁用状态
|
|
957
|
+
<hm-input label="禁用输入框" value="已禁用" enable="false"></hm-input>
|
|
958
|
+
只读状态
|
|
959
|
+
<hm-input label="只读输入框" value="只读内容" readonly="true"></hm-input>
|
|
960
|
+
<h3>折叠面板</h3>
|
|
961
|
+
<hm-accordion>
|
|
962
|
+
<span slot="header">我的折叠面板</span>
|
|
963
|
+
<div>内容项 1</div>
|
|
964
|
+
<div>内容项 2</div>
|
|
965
|
+
</hm-accordion>
|
|
966
|
+
<h3>滑动开关</h3>
|
|
967
|
+
<!-- 基础用法 -->
|
|
968
|
+
<hm-switch></hm-switch>
|
|
969
|
+
|
|
970
|
+
<!-- 默认开启 -->
|
|
971
|
+
<hm-switch checked></hm-switch>
|
|
972
|
+
|
|
973
|
+
<!-- 禁用状态 -->
|
|
974
|
+
<hm-switch disabled></hm-switch>
|
|
975
|
+
|
|
976
|
+
<!-- 加载状态 -->
|
|
977
|
+
<hm-switch loading></hm-switch>
|
|
978
|
+
|
|
979
|
+
<!-- 自定义颜色 -->
|
|
980
|
+
<hm-switch color="#ff4757"></hm-switch>
|
|
981
|
+
hc-s
|
|
982
|
+
<!-- 带图标 -->
|
|
983
|
+
<hm-switch openIcon="check" closeIcon="close"></hm-switch>
|
|
984
|
+
|
|
985
|
+
<!-- 监听状态变化 -->
|
|
986
|
+
<hm-switch
|
|
987
|
+
|
|
988
|
+
@hm-switch-change
|
|
989
|
+
="${t=>{}}"></hm-switch>
|
|
990
|
+
<h3>滑动单元格</h3>
|
|
991
|
+
<hm-swipe-cell>
|
|
992
|
+
<!-- 主内容 -->
|
|
993
|
+
<div slot="content">主内容</div>
|
|
994
|
+
<!-- 左侧操作按钮 -->
|
|
995
|
+
<div slot="left-actions">左侧操作</div>
|
|
996
|
+
<!-- 右侧操作按钮 -->
|
|
997
|
+
<div slot="right-actions">右侧操作</div>
|
|
998
|
+
</hm-swipe-cell>
|
|
999
|
+
<hm-swipe-cell>
|
|
1000
|
+
<!-- 主内容 -->
|
|
1001
|
+
<hm-cell
|
|
1002
|
+
slot="content"
|
|
1003
|
+
titleName="单元格标题"
|
|
1004
|
+
descripthion="这是描述信息"
|
|
1005
|
+
content="内容区域"
|
|
1006
|
+
>
|
|
1007
|
+
</hm-cell>
|
|
1008
|
+
<!-- 左侧操作按钮 -->
|
|
1009
|
+
<div slot="left-actions"><hm-button>删除</hm-button></div>
|
|
1010
|
+
<!-- 右侧操作按钮 -->
|
|
1011
|
+
<div slot="right-actions">
|
|
1012
|
+
<hm-button>修改</hm-button>
|
|
1013
|
+
<hm-button>运行</hm-button>
|
|
1014
|
+
</div>
|
|
1015
|
+
</hm-swipe-cell>
|
|
1016
|
+
|
|
1017
|
+
<h3>单元格</h3>
|
|
1018
|
+
<hm-cell>
|
|
1019
|
+
<hm-switch slot="content"></hm-switch>
|
|
1020
|
+
</hm-cell>
|
|
1021
|
+
<hm-cell titleName="单元格标题" descripthion="这是描述信息" content="内容区域">
|
|
1022
|
+
</hm-cell>
|
|
1023
|
+
<!-- 使用插槽自定义内容 -->
|
|
1024
|
+
<hm-cell>
|
|
1025
|
+
<div slot="title">自定义标题</div>
|
|
1026
|
+
<div slot="description">自定义描述</div>
|
|
1027
|
+
<div slot="content">自定义内容</div>
|
|
1028
|
+
</hm-cell>
|
|
1029
|
+
|
|
1030
|
+
<!-- 带点击事件 -->
|
|
1031
|
+
<hm-cell
|
|
1032
|
+
titleName="可点击标题"
|
|
1033
|
+
content="点击查看详情"
|
|
1034
|
+
.titleClickCallback="${()=>{}}"
|
|
1035
|
+
.contentClickCallback="${()=>{}}"
|
|
1036
|
+
>
|
|
1037
|
+
</hm-cell>
|
|
1038
|
+
|
|
1039
|
+
<!-- 自定义样式 -->
|
|
1040
|
+
<hm-cell
|
|
1041
|
+
titleName="自定义样式"
|
|
1042
|
+
content="特殊样式"
|
|
1043
|
+
style="--hm-cell-background: #f0f8ff; --hm-cell-title-color: #1890ff"
|
|
1044
|
+
>
|
|
1045
|
+
</hm-cell>
|
|
1046
|
+
<h3>通知</h3>
|
|
1047
|
+
<hm-button
|
|
1048
|
+
content="成功通知"
|
|
1049
|
+
@click="${()=>Ti.success("成功","这是成功提示",2e3)}"
|
|
1050
|
+
></hm-button>
|
|
1051
|
+
<hm-button
|
|
1052
|
+
content="普通通知"
|
|
1053
|
+
@click="${()=>Ti.normal("普通","这是普通提示",3e3)}"
|
|
1054
|
+
></hm-button>
|
|
1055
|
+
<hm-button
|
|
1056
|
+
content="警告通知"
|
|
1057
|
+
@click="${()=>Ti.warning("警告","这是警告提示",4e3)}"
|
|
1058
|
+
></hm-button>
|
|
1059
|
+
<hm-button
|
|
1060
|
+
content="错误通知"
|
|
1061
|
+
@click="${()=>Ti.error("错误","这是错误提示",5e3)}"
|
|
1062
|
+
></hm-button>
|
|
1063
|
+
<h3>按钮</h3>
|
|
1064
|
+
|
|
1065
|
+
<!-- 基础用法 -->
|
|
1066
|
+
<hm-button content="普通按钮"></hm-button>
|
|
1067
|
+
|
|
1068
|
+
<!-- 带图标按钮 -->
|
|
1069
|
+
<hm-button icon="plus" content="添加"></hm-button>
|
|
1070
|
+
|
|
1071
|
+
<!-- 自定义颜色 -->
|
|
1072
|
+
<hm-button content="自定义样式" color="#ffffff" background="#4caf50"></hm-button>
|
|
1073
|
+
</hm-button>
|
|
1074
|
+
|
|
1075
|
+
<!-- 禁用状态 -->
|
|
1076
|
+
<hm-button content="禁用按钮" .enable="${!1}"></hm-button>
|
|
1077
|
+
|
|
1078
|
+
<!-- 加载状态 -->
|
|
1079
|
+
<hm-button content="加载中" .loading="${!0}"></hm-button>
|
|
1080
|
+
|
|
1081
|
+
<!-- 自定义尺寸 -->
|
|
1082
|
+
<hm-button content="大按钮" width="200px" height="50px"></hm-button>
|
|
1083
|
+
<hm-button content="小按钮" width="60px" height="30px" fontSize="8px"></hm-button>
|
|
1084
|
+
<h3>图标</h3>
|
|
1085
|
+
<hm-icon></hm-icon>
|
|
1086
|
+
`;te(e,await t.body);let i=document.createElement("hm-menu");return i.content="组件模板",i.isMenuItem=!0,i.icon="template",i.addEventListener("hm-menu-click",function(){t.putTopToggel()}),i}const Hi=Object.freeze(Object.defineProperty({__proto__:null,initExampleApp:Bi},Symbol.toStringTag,{value:"Module"}));var Ii=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,Ni=(t,e,i,o)=>{for(var n,s=o>1?void 0:o?Di(e,i):e,r=t.length-1;r>=0;r--)(n=t[r])&&(s=(o?n(e,i,s):n(s))||s);return o&&s&&Ii(e,i,s),s};let Ui=class extends ie{constructor(){super(...arguments),this.scriptName="",this.scriptUrl="",this.scriptEnable=!0,this.scriptIngected=!1,this.dialogOpen=!1,this.scriptList=U}render(){return It`
|
|
1087
|
+
<hm-dialog
|
|
1088
|
+
?isopen="${this.dialogOpen}"
|
|
1089
|
+
@hm-dialog-close="${()=>{this.dialogOpen=!1}}"
|
|
1090
|
+
@hm-dialog-confirm="${()=>{if(""==this.scriptName.trim()||""==this.scriptUrl.trim())return void Ti.error("脚本管理","请填写完整的脚本信息");this.scriptEnable=!0,this.scriptIngected=!1,L(new N(this.scriptName,this.scriptUrl,this.scriptEnable,this.scriptIngected)),F(),this.scriptList=U}}"
|
|
1091
|
+
>
|
|
1092
|
+
<h2>修改或添加脚本</h2>
|
|
1093
|
+
<hm-input
|
|
1094
|
+
label="脚本名称"
|
|
1095
|
+
placeholder="请输入脚本名称"
|
|
1096
|
+
value="${this.scriptName}"
|
|
1097
|
+
@hm-input-change="${t=>{this.scriptName=t.detail.value}}"
|
|
1098
|
+
></hm-input>
|
|
1099
|
+
<hm-input
|
|
1100
|
+
label="脚本链接"
|
|
1101
|
+
placeholder="请输入https的脚本链接"
|
|
1102
|
+
value="${this.scriptUrl}"
|
|
1103
|
+
@hm-input-change="${t=>{this.scriptUrl=t.detail.value}}"
|
|
1104
|
+
></hm-input>
|
|
1105
|
+
</hm-dialog>
|
|
1106
|
+
|
|
1107
|
+
<hm-accordion>
|
|
1108
|
+
<span slot="header">脚本列表</span>
|
|
1109
|
+
${this.scriptList.map(t=>It`
|
|
1110
|
+
<hm-swipe-cell>
|
|
1111
|
+
<div slot="left-actions">
|
|
1112
|
+
<hm-button
|
|
1113
|
+
@hm-button-click="${()=>{R(t),F(),this.scriptList=U}}"
|
|
1114
|
+
>删除</hm-button
|
|
1115
|
+
>
|
|
1116
|
+
</div>
|
|
1117
|
+
<hm-cell
|
|
1118
|
+
slot="content"
|
|
1119
|
+
titleName="${t.name}"
|
|
1120
|
+
descripthion="${t.url}"
|
|
1121
|
+
>
|
|
1122
|
+
<hm-switch
|
|
1123
|
+
slot="content"
|
|
1124
|
+
?checked="${t.enable}"
|
|
1125
|
+
@hm-switch-change="${e=>{t.enable=e.detail.checked,L(t),F(),this.scriptList=U}}"
|
|
1126
|
+
></hm-switch>
|
|
1127
|
+
</hm-cell>
|
|
1128
|
+
|
|
1129
|
+
<div slot="right-actions">
|
|
1130
|
+
<hm-button
|
|
1131
|
+
@hm-button-click="${()=>{this.scriptName=t.name,this.scriptUrl=t.url,this.dialogOpen=!0}}"
|
|
1132
|
+
>修改</hm-button
|
|
1133
|
+
>
|
|
1134
|
+
<hm-button
|
|
1135
|
+
?enable="${!t.ingected}"
|
|
1136
|
+
@hm-button-click="${()=>{t.ingected=q(t),L(t),this.scriptList=U}}"
|
|
1137
|
+
>运行</hm-button
|
|
1138
|
+
>
|
|
1139
|
+
</div>
|
|
1140
|
+
</hm-swipe-cell>
|
|
1141
|
+
|
|
1142
|
+
`)}
|
|
1143
|
+
<div slot="footer">
|
|
1144
|
+
<hm-button
|
|
1145
|
+
@click="${()=>{X(),this.scriptList=U}}"
|
|
1146
|
+
>刷新</hm-button
|
|
1147
|
+
>
|
|
1148
|
+
<hm-button
|
|
1149
|
+
@click="${()=>{this.scriptName="",this.scriptUrl="",this.scriptEnable=!0,this.scriptIngected=!1,this.dialogOpen=!0}}"
|
|
1150
|
+
>添加</hm-button
|
|
1151
|
+
>
|
|
1152
|
+
<hm-button @click="${()=>{F()}}"
|
|
1153
|
+
>保存</hm-button
|
|
1154
|
+
>
|
|
1155
|
+
</div>
|
|
1156
|
+
</hm-accordion>
|
|
1157
|
+
|
|
1158
|
+
`}};Ui.styles=et`
|
|
1159
|
+
:host {
|
|
1160
|
+
display:block;
|
|
1161
|
+
width: 100%;
|
|
1162
|
+
}
|
|
1163
|
+
`,Ni([le({type:String})],Ui.prototype,"scriptName",2),Ni([le({type:String})],Ui.prototype,"scriptUrl",2),Ni([le({type:Boolean})],Ui.prototype,"scriptEnable",2),Ni([le({type:Boolean})],Ui.prototype,"scriptIngected",2),Ni([le({type:Boolean})],Ui.prototype,"dialogOpen",2),Ni([le({type:Array})],Ui.prototype,"scriptList",2),Ui=Ni([ne("hm-script-app")],Ui);const Li={name:"hortimagic",private:!1,version:"1.0.0",author:"Narlen",description:"园艺魔法,花园插件",keywords:["iirose","plugins","hortimagic"],repository:{type:"git",url:"https://github.com/NarlenHua/hortimagic.git"},license:"MIT",type:"module",scripts:{dev:"vite",build:"tsc && vite build",preview:"vite preview"},dependencies:{lit:"^3.3.1",terser:"^5.44.0","tiny-emitter":"^2.1.0","vite-plugin-dts":"^4.5.4"},devDependencies:{"@types/node":"^24.9.1",typescript:"~5.9.3",vite:"^7.1.7"},main:"dist/Horticraft.life.js",module:"dist/HortiCraft.es.js",typings:"dist/index.d.ts",types:"dist/index.d.ts",files:["dist","src/components","types"]};async function Ri(){try{Oi(),xi(),Ai(),ji(),Ti.normal(Li.name,"注入网络钩子函数"),await O(),Ti.normal(Li.name,"注入钩子函数"),B(),I(),Ti.normal(Li.name,"注入脚本"),V(),Ti.normal(Li.name,"生成菜单");let t=document.createElement("hm-menu");t.content="HortiMagic",t.isMenuItem=!1,$i.appendChild(t);let e=await Bi(),i=await async function(){let t=document.createElement("hm-move-panel");t.titleContent="脚本管理",t.icon="js",ki.appendChild(t);let e=It`
|
|
1164
|
+
<hm-script-app></hm-script-app>
|
|
1165
|
+
`;te(e,await t.body);let i=document.createElement("hm-menu");return i.content="脚本管理",i.isMenuItem=!0,i.icon="js",i.addEventListener("hm-menu-click",function(){t.putTopToggel()}),i}();t.addEventListener("hm-menu-click",function(){e.flag=t.flag,i.flag=t.flag}),$i.append(t,e,i),Ti.success(Li.name,`${Li.version} 已加载`,3e3)}catch(t){}}const qi=Object.freeze(Object.defineProperty({__proto__:null,init:Ri},Symbol.toStringTag,{value:"Module"})),Wi=Object.freeze(Object.defineProperty({__proto__:null,example_app:Hi,main_app:qi},Symbol.toStringTag,{value:"Module"})),Xi=Object.freeze(Object.defineProperty({__proto__:null,dialog:zi,menu:Si,move_panel:Ci,notification:Pi},Symbol.toStringTag,{value:"Module"})),Fi={name:Li.name,version:Li.version,description:Li.description,author:Li.author,license:Li.license,repository:Li.repository,buildTime:(new Date).toISOString()};return async function(){Ri()}(),t.apps=Wi,t.components=_i,t.core=G,t.holders=Xi,t.information=Fi,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
|