solely 0.4.18 → 0.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/commands/tooltip/types.d.ts +2 -5
- package/dist/components/elements/tooltip/index.cjs +1 -1
- package/dist/components/elements/tooltip/index.js +1 -1
- package/dist/components/elements/tooltip/types.d.ts +2 -5
- package/dist/components/tooltip-types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
|
5
|
-
export type TooltipTrigger = 'hover' | 'click' | 'focus' | 'manual';
|
|
1
|
+
import { TooltipPlacement, TooltipTrigger } from '../../tooltip-types';
|
|
2
|
+
export type { TooltipPlacement, TooltipTrigger };
|
|
6
3
|
export interface TooltipOptions {
|
|
7
4
|
/** 提示内容 */
|
|
8
5
|
content?: string | HTMLElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var t=Object.defineProperty,e=(e,i,s)=>((e,i,s)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s)(e,"symbol"!=typeof i?i+"":i,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./style.css.cjs"),s=require("./index.html.cjs"),n=require("../../../runtime/component/base-element.cjs"),o=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyTooltip=class extends n.default{constructor(){super(...arguments),e(this,"_clickOutsideHandler"),e(this,"_boundFocusHandler"),e(this,"_boundBlurHandler"),e(this,"_boundFocusable")}getTooltipClasses(){return{[`tooltip--${this.$data.placement}`]:!0,"is-visible":this.$data.visible}}show(){this.$data.visible||(this.$data.visible=!0,this.emit("show"))}hide(){this.$data.visible&&(this.$data.visible=!1,this.emit("hide"))}handleMouseEnter(t){"hover"===this.$data.trigger&&(t.stopPropagation(),this.show())}handleMouseLeave(t){"hover"===this.$data.trigger&&(t.stopPropagation(),this.hide())}handleFocus(t){"focus"===this.$data.trigger&&(t.stopPropagation(),this.show())}handleBlur(t){"focus"===this.$data.trigger&&(t.stopPropagation(),this.hide())}bindSlotEvents(){var t;if("manual"===this.$data.trigger)return;if("focus"!==this.$data.trigger)return;const e=null==(t=this.shadowRoot)?void 0:t.querySelector("slot");e&&(this.unbindSlotEvents(),e.assignedElements().forEach(t=>{const e=t.querySelector("input, textarea, select, button, a, [tabindex]")||t;e&&(this._boundFocusHandler=this.handleFocus.bind(this),this._boundBlurHandler=this.handleBlur.bind(this),this._boundFocusable=e,e.addEventListener("focus",this._boundFocusHandler),e.addEventListener("blur",this._boundBlurHandler))}))}unbindSlotEvents(){this._boundFocusable&&(this._boundFocusHandler&&this._boundFocusable.removeEventListener("focus",this._boundFocusHandler),this._boundBlurHandler&&this._boundFocusable.removeEventListener("blur",this._boundBlurHandler),this._boundFocusable=void 0,this._boundFocusHandler=void 0,this._boundBlurHandler=void 0)}handleClick(t){"manual"!==this.$data.trigger&&"click"===this.$data.trigger&&(t.stopPropagation(),this.$data.visible?(this.hide(),this.unbindClickOutside()):(this.show(),this.bindClickOutside()))}bindClickOutside(){this._clickOutsideHandler||(this._clickOutsideHandler=t=>{t.composedPath().includes(this)||(this.hide(),this.unbindClickOutside())},document.addEventListener("click",this._clickOutsideHandler))}unbindClickOutside(){this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler),this._clickOutsideHandler=void 0)}mounted(){this.refresh(),this.bindSlotEvents()}unmounted(){this.unbindClickOutside(),this.unbindSlotEvents()}},exports.SolelyTooltip=((t,e)=>{for(var i,s=e,n=t.length-1;n>=0;n--)(i=t[n])&&(s=i(s)||s);return s})([o.CustomElement({tagName:"solely-tooltip",template:s.__SOLELY_IR__,styles:i.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"content",type:"string",default:""},{name:"placement",type:"string",default:"top"},{name:"trigger",type:"string",default:"hover"},{name:"visible",type:"boolean",default:!1},{name:"color",type:"string",default:""},{name:"maxWidth",type:"number",default:250}]})],exports.SolelyTooltip);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=(e,i,s)=>((e,i,s)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s)(e,"symbol"!=typeof i?i+"":i,s);import i from"./style.css.js";import{__SOLELY_IR__ as s}from"./index.html.js";import n from"../../../runtime/component/base-element.js";import{CustomElement as o}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let d=class extends n{constructor(){super(...arguments),e(this,"_clickOutsideHandler"),e(this,"_boundFocusHandler"),e(this,"_boundBlurHandler"),e(this,"_boundFocusable")}getTooltipClasses(){return{[`tooltip--${this.$data.placement}`]:!0,"is-visible":this.$data.visible}}show(){this.$data.visible||(this.$data.visible=!0,this.emit("show"))}hide(){this.$data.visible&&(this.$data.visible=!1,this.emit("hide"))}handleMouseEnter(t){"hover"===this.$data.trigger&&(t.stopPropagation(),this.show())}handleMouseLeave(t){"hover"===this.$data.trigger&&(t.stopPropagation(),this.hide())}handleFocus(t){"focus"===this.$data.trigger&&(t.stopPropagation(),this.show())}handleBlur(t){"focus"===this.$data.trigger&&(t.stopPropagation(),this.hide())}bindSlotEvents(){var t;if("focus"!==this.$data.trigger)return;const e=null==(t=this.shadowRoot)?void 0:t.querySelector("slot");e&&(this.unbindSlotEvents(),e.assignedElements().forEach(t=>{const e=t.querySelector("input, textarea, select, button, a, [tabindex]")||t;e&&(this._boundFocusHandler=this.handleFocus.bind(this),this._boundBlurHandler=this.handleBlur.bind(this),this._boundFocusable=e,e.addEventListener("focus",this._boundFocusHandler),e.addEventListener("blur",this._boundBlurHandler))}))}unbindSlotEvents(){this._boundFocusable&&(this._boundFocusHandler&&this._boundFocusable.removeEventListener("focus",this._boundFocusHandler),this._boundBlurHandler&&this._boundFocusable.removeEventListener("blur",this._boundBlurHandler),this._boundFocusable=void 0,this._boundFocusHandler=void 0,this._boundBlurHandler=void 0)}handleClick(t){"click"===this.$data.trigger&&(t.stopPropagation(),this.$data.visible?(this.hide(),this.unbindClickOutside()):(this.show(),this.bindClickOutside()))}bindClickOutside(){this._clickOutsideHandler||(this._clickOutsideHandler=t=>{t.composedPath().includes(this)||(this.hide(),this.unbindClickOutside())},document.addEventListener("click",this._clickOutsideHandler))}unbindClickOutside(){this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler),this._clickOutsideHandler=void 0)}mounted(){this.refresh(),this.bindSlotEvents()}unmounted(){this.unbindClickOutside(),this.unbindSlotEvents()}};d=((t,e)=>{for(var i,s=e,n=t.length-1;n>=0;n--)(i=t[n])&&(s=i(s)||s);return s})([o({tagName:"solely-tooltip",template:s,styles:i,shadowDOM:{use:!0,mode:"open"},props:[{name:"content",type:"string",default:""},{name:"placement",type:"string",default:"top"},{name:"trigger",type:"string",default:"hover"},{name:"visible",type:"boolean",default:!1},{name:"color",type:"string",default:""},{name:"maxWidth",type:"number",default:250}]})],d);export{d as SolelyTooltip};
|
|
1
|
+
var t=Object.defineProperty,e=(e,i,s)=>((e,i,s)=>i in e?t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[i]=s)(e,"symbol"!=typeof i?i+"":i,s);import i from"./style.css.js";import{__SOLELY_IR__ as s}from"./index.html.js";import n from"../../../runtime/component/base-element.js";import{CustomElement as o}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let d=class extends n{constructor(){super(...arguments),e(this,"_clickOutsideHandler"),e(this,"_boundFocusHandler"),e(this,"_boundBlurHandler"),e(this,"_boundFocusable")}getTooltipClasses(){return{[`tooltip--${this.$data.placement}`]:!0,"is-visible":this.$data.visible}}show(){this.$data.visible||(this.$data.visible=!0,this.emit("show"))}hide(){this.$data.visible&&(this.$data.visible=!1,this.emit("hide"))}handleMouseEnter(t){"hover"===this.$data.trigger&&(t.stopPropagation(),this.show())}handleMouseLeave(t){"hover"===this.$data.trigger&&(t.stopPropagation(),this.hide())}handleFocus(t){"focus"===this.$data.trigger&&(t.stopPropagation(),this.show())}handleBlur(t){"focus"===this.$data.trigger&&(t.stopPropagation(),this.hide())}bindSlotEvents(){var t;if("manual"===this.$data.trigger)return;if("focus"!==this.$data.trigger)return;const e=null==(t=this.shadowRoot)?void 0:t.querySelector("slot");e&&(this.unbindSlotEvents(),e.assignedElements().forEach(t=>{const e=t.querySelector("input, textarea, select, button, a, [tabindex]")||t;e&&(this._boundFocusHandler=this.handleFocus.bind(this),this._boundBlurHandler=this.handleBlur.bind(this),this._boundFocusable=e,e.addEventListener("focus",this._boundFocusHandler),e.addEventListener("blur",this._boundBlurHandler))}))}unbindSlotEvents(){this._boundFocusable&&(this._boundFocusHandler&&this._boundFocusable.removeEventListener("focus",this._boundFocusHandler),this._boundBlurHandler&&this._boundFocusable.removeEventListener("blur",this._boundBlurHandler),this._boundFocusable=void 0,this._boundFocusHandler=void 0,this._boundBlurHandler=void 0)}handleClick(t){"manual"!==this.$data.trigger&&"click"===this.$data.trigger&&(t.stopPropagation(),this.$data.visible?(this.hide(),this.unbindClickOutside()):(this.show(),this.bindClickOutside()))}bindClickOutside(){this._clickOutsideHandler||(this._clickOutsideHandler=t=>{t.composedPath().includes(this)||(this.hide(),this.unbindClickOutside())},document.addEventListener("click",this._clickOutsideHandler))}unbindClickOutside(){this._clickOutsideHandler&&(document.removeEventListener("click",this._clickOutsideHandler),this._clickOutsideHandler=void 0)}mounted(){this.refresh(),this.bindSlotEvents()}unmounted(){this.unbindClickOutside(),this.unbindSlotEvents()}};d=((t,e)=>{for(var i,s=e,n=t.length-1;n>=0;n--)(i=t[n])&&(s=i(s)||s);return s})([o({tagName:"solely-tooltip",template:s,styles:i,shadowDOM:{use:!0,mode:"open"},props:[{name:"content",type:"string",default:""},{name:"placement",type:"string",default:"top"},{name:"trigger",type:"string",default:"hover"},{name:"visible",type:"boolean",default:!1},{name:"color",type:"string",default:""},{name:"maxWidth",type:"number",default:250}]})],d);export{d as SolelyTooltip};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
|
5
|
-
export type TooltipTrigger = 'hover' | 'click' | 'focus';
|
|
1
|
+
import { TooltipPlacement, TooltipTrigger } from '../../tooltip-types';
|
|
2
|
+
export type { TooltipPlacement, TooltipTrigger };
|
|
6
3
|
export interface TooltipProps {
|
|
7
4
|
/** 提示内容 */
|
|
8
5
|
content: string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip 共享类型定义
|
|
3
|
+
* 供 elements 和 commands 模块复用
|
|
4
|
+
*/
|
|
5
|
+
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
|
6
|
+
export type TooltipTrigger = 'hover' | 'click' | 'focus' | 'manual';
|
package/package.json
CHANGED