@opentiny/vue-tooltip
Advanced tools
Comparing version 3.6.7 to 3.8.0
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
import Tooltip from './src/index.vue'; | ||
import Tooltip from './src/index'; | ||
export default Tooltip; |
227
lib/index.js
@@ -1,21 +0,34 @@ | ||
import { withDirectives, createVNode, vShow } from "vue"; | ||
import { renderless, api } from "@opentiny/vue-renderless/tooltip/vue"; | ||
import { defineComponent, $prefix, setup as _setup, createComponent, h, parseVnode } from "@opentiny/vue-common"; | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : function(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
import { defineComponent, $prefix, $props, $setup } from "@opentiny/vue-common"; | ||
import PcTemplate from "./pc.js"; | ||
import MobileFirstTemplate from "./mobile-first.js"; | ||
import "@opentiny/vue-theme/tooltip/index.css"; | ||
var _sfc_main = /* @__PURE__ */ defineComponent({ | ||
var template = function template2(mode) { | ||
if ("mobile" === (process.env.TINY_MODE || mode)) | ||
return MobileTemplate; | ||
else if ("mobile-first" === (process.env.TINY_MODE || mode)) | ||
return MobileFirstTemplate; | ||
else | ||
return PcTemplate; | ||
}; | ||
var Tooltip = defineComponent({ | ||
name: $prefix + "Tooltip", | ||
componentName: "Tooltip", | ||
props: { | ||
visible: { | ||
type: String, | ||
default: function _default() { | ||
return "always"; | ||
}, | ||
validator: function validator(value) { | ||
return ["always", "auto"].includes(value); | ||
} | ||
}, | ||
props: _extends({}, $props, { | ||
adjustArrow: { | ||
type: Boolean, | ||
default: function _default2() { | ||
default: function _default() { | ||
return false; | ||
@@ -26,3 +39,3 @@ } | ||
type: Boolean, | ||
default: function _default3() { | ||
default: function _default2() { | ||
return true; | ||
@@ -33,3 +46,3 @@ } | ||
type: Number, | ||
default: function _default4() { | ||
default: function _default3() { | ||
return 0; | ||
@@ -40,12 +53,6 @@ } | ||
type: Number, | ||
default: function _default5() { | ||
default: function _default4() { | ||
return 5; | ||
} | ||
}, | ||
closeDelay: { | ||
type: Number, | ||
default: function _default6() { | ||
return 300; | ||
} | ||
}, | ||
content: { | ||
@@ -57,11 +64,5 @@ type: String | ||
}, | ||
effect: { | ||
type: String, | ||
default: function _default7() { | ||
return "dark"; | ||
} | ||
}, | ||
enterable: { | ||
type: Boolean, | ||
default: function _default8() { | ||
default: function _default5() { | ||
return true; | ||
@@ -72,3 +73,3 @@ } | ||
type: Number, | ||
default: function _default9() { | ||
default: function _default6() { | ||
return 0; | ||
@@ -84,15 +85,27 @@ } | ||
offset: { | ||
default: function _default10() { | ||
default: function _default7() { | ||
return 0; | ||
} | ||
}, | ||
effect: { | ||
type: String, | ||
default: function _default8() { | ||
return "dark"; | ||
} | ||
}, | ||
openDelay: { | ||
type: Number, | ||
default: function _default11() { | ||
default: function _default9() { | ||
return 0; | ||
} | ||
}, | ||
closeDelay: { | ||
type: Number, | ||
default: function _default10() { | ||
return 100; | ||
} | ||
}, | ||
placement: { | ||
type: String, | ||
default: function _default12() { | ||
default: function _default11() { | ||
return "bottom"; | ||
@@ -106,3 +119,3 @@ } | ||
popperOptions: { | ||
default: function _default13() { | ||
default: function _default12() { | ||
return { | ||
@@ -123,3 +136,3 @@ gpuAcceleration: false, | ||
type: Number, | ||
default: function _default14() { | ||
default: function _default13() { | ||
return 0; | ||
@@ -130,3 +143,3 @@ } | ||
type: [Boolean, String], | ||
default: function _default15() { | ||
default: function _default14() { | ||
return true; | ||
@@ -137,3 +150,3 @@ } | ||
type: String, | ||
default: function _default16() { | ||
default: function _default15() { | ||
return "tiny-fade-in-linear"; | ||
@@ -144,3 +157,3 @@ } | ||
type: String, | ||
validator: function validator2(value) { | ||
validator: function validator(value) { | ||
return Boolean(~["normal", "warning", "error", "info", "success"].indexOf(value)); | ||
@@ -151,3 +164,3 @@ } | ||
type: Boolean, | ||
default: function _default17() { | ||
default: function _default16() { | ||
return true; | ||
@@ -158,140 +171,26 @@ } | ||
type: String, | ||
default: function _default18() { | ||
default: function _default17() { | ||
return "next"; | ||
} | ||
} | ||
}, | ||
}), | ||
setup: function setup(props, context) { | ||
return _setup({ | ||
return $setup({ | ||
props, | ||
context, | ||
renderless, | ||
api, | ||
mono: true | ||
template | ||
}); | ||
}, | ||
render: function render() { | ||
var _this = this; | ||
var getContent = function getContent2(vm) { | ||
var slotContent = vm.slots.content && vm.slots.content(); | ||
if (slotContent) { | ||
return slotContent; | ||
} | ||
var attrContent; | ||
if (vm.renderContent) { | ||
attrContent = vm.renderContent(h, vm.content); | ||
} else if (vm.pre) { | ||
attrContent = vm.content ? h("pre", vm.content) : null; | ||
} else { | ||
attrContent = vm.content; | ||
} | ||
return attrContent; | ||
}; | ||
Object.prototype.hasOwnProperty.call(this, "popperVM") || this.d({ | ||
popperVM: { | ||
get: function get() { | ||
return ( | ||
// 使用适配器里的createComponent创建一个新的vue的vnode节点为一个新组件,挂载到el下面去 | ||
createComponent({ | ||
el: document.createElement("div"), | ||
component: { | ||
render: function render2() { | ||
var content = getContent(_this); | ||
var propsData = { | ||
attrs: { | ||
name: _this.transition | ||
}, | ||
on: { | ||
"after-leave": _this.doDestroy | ||
} | ||
}; | ||
var typeClass = "is-" + (_this.type || _this.effect); | ||
var mouseenter = function mouseenter2() { | ||
return _this.setExpectedState(true); | ||
}; | ||
var mouseleave = function mouseleave2() { | ||
_this.setExpectedState(false); | ||
_this.debounceClose(); | ||
}; | ||
_this.$nextTick(function() { | ||
return _this.updatePopper(); | ||
}); | ||
return h("transition", propsData, [withDirectives(createVNode("div", { | ||
"ref": "popper", | ||
"id": _this.state.tooltipId, | ||
"appendToBody": _this.appendToBody, | ||
"class": ["tiny-tooltip", "tiny-tooltip__popper", typeClass, _this.popperClass], | ||
"role": "tooltip", | ||
"aria-hidden": _this.disabled || !_this.state.showPopper ? "true" : "false", | ||
"onMouseenter": function onMouseenter() { | ||
return mouseenter(); | ||
}, | ||
"onMouseleave": function onMouseleave() { | ||
return mouseleave(); | ||
} | ||
}, [content]), [[vShow, !_this.disabled && _this.state.showPopper && content]])]); | ||
} | ||
} | ||
}) | ||
); | ||
} | ||
} | ||
}); | ||
var stringifyClassObj = function stringifyClassObj2(classObj) { | ||
return Object.keys(classObj).filter(function(key) { | ||
return classObj[key]; | ||
}).join(" "); | ||
}; | ||
var stringifyClassArr = function stringifyClassArr2(classArr) { | ||
return classArr.filter(function(item) { | ||
return item; | ||
}).map(function(item) { | ||
return typeof item === "string" ? item.trim() : typeof item === "object" ? stringifyClassObj(item) : ""; | ||
}).join(" "); | ||
}; | ||
var addTooltipClass = function addTooltipClass2(bindClass) { | ||
var className = ""; | ||
if (bindClass) { | ||
if (typeof bindClass === "string") { | ||
className = bindClass.trim(); | ||
} else if (Array.isArray(bindClass)) { | ||
className = stringifyClassArr(bindClass); | ||
} else if (typeof bindClass === "object") { | ||
className = stringifyClassObj(bindClass); | ||
} | ||
} | ||
return "tiny-tooltip " + className.replace(/\btiny-tooltip\b/g, "").trim(); | ||
}; | ||
var getFirstElement = function getFirstElement2() { | ||
var slots = _this.slots.default && _this.slots.default(); | ||
if (!Array.isArray(slots)) | ||
return null; | ||
var element = null; | ||
for (var index = 0; index < slots.length; index++) { | ||
var vnode = parseVnode(slots[index]); | ||
if (vnode && vnode.type) { | ||
element = vnode; | ||
} | ||
} | ||
return element; | ||
}; | ||
var firstElement = getFirstElement(); | ||
if (!firstElement) | ||
return null; | ||
var data = firstElement.data || firstElement.props || (firstElement.props = {}); | ||
data.class = addTooltipClass(data.class); | ||
return firstElement; | ||
} | ||
}); | ||
var version = "3.7.0"; | ||
_sfc_main.model = { | ||
Tooltip.model = { | ||
prop: "modelValue", | ||
event: "update:modelValue" | ||
}; | ||
_sfc_main.install = function(Vue) { | ||
Vue.component(_sfc_main.name, _sfc_main); | ||
Tooltip.install = function(Vue) { | ||
Vue.component(Tooltip.name, Tooltip); | ||
}; | ||
_sfc_main.version = version; | ||
Tooltip.version = version; | ||
export { | ||
_sfc_main as default | ||
Tooltip as default | ||
}; |
{ | ||
"name": "@opentiny/vue-tooltip", | ||
"version": "3.6.7", | ||
"version": "3.8.0", | ||
"description": "", | ||
"main": "./lib/index.js", | ||
"module": "./lib/index.js", | ||
"dependencies": { | ||
"@opentiny/vue-renderless": "~3.6.6", | ||
"@opentiny/vue-common": "~3.6.7" | ||
"@opentiny/vue-renderless": "~3.8.0", | ||
"@opentiny/vue-common": "~3.8.0" | ||
}, | ||
@@ -10,0 +11,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36713
10
1265
3
1
+ Added@opentiny/vue-common@3.8.3(transitive)
+ Added@opentiny/vue-locale@3.8.3(transitive)
+ Added@opentiny/vue-renderless@3.8.4(transitive)
+ Added@opentiny/vue-theme@3.8.5(transitive)
+ Added@opentiny/vue-theme-mobile@3.8.3(transitive)
+ Addedtailwind-merge@1.14.0(transitive)
- Removed@opentiny/vue-common@3.6.7(transitive)
- Removed@opentiny/vue-locale@3.6.7(transitive)
- Removed@opentiny/vue-renderless@3.6.8(transitive)
- Removed@opentiny/vue-theme@3.6.7(transitive)
- Removed@opentiny/vue-theme-mobile@3.6.6(transitive)
Updated@opentiny/vue-common@~3.8.0