提交 0146b8c5 编写于 作者: fxy060608's avatar fxy060608

wip(app): nvue components

上级 fcd25d66
......@@ -1676,7 +1676,7 @@ var serviceContext = (function (vue) {
return value.indexOf(delimiters[0]) > -1;
}
const isEnableLocale = once(() => typeof __uniConfig !== 'undefined' &&
const isEnableLocale = /*#__PURE__*/ once(() => typeof __uniConfig !== 'undefined' &&
__uniConfig.locales &&
!!Object.keys(__uniConfig.locales).length);
......@@ -2225,6 +2225,133 @@ var serviceContext = (function (vue) {
}
}
let plus_;
let weex_;
let BroadcastChannel_;
function getRuntime() {
return typeof window === 'object' &&
typeof navigator === 'object' &&
typeof document === 'object'
? 'webview'
: 'v8';
}
function getPageId() {
return plus_.webview.currentWebview().id;
}
let channel;
let globalEvent$1;
const callbacks$2 = {};
function onPlusMessage$1(res) {
const message = res.data && res.data.__message;
if (!message || !message.__page) {
return;
}
const pageId = message.__page;
const callback = callbacks$2[pageId];
callback && callback(message);
if (!message.keep) {
delete callbacks$2[pageId];
}
}
function addEventListener(pageId, callback) {
if (getRuntime() === 'v8') {
if (BroadcastChannel_) {
channel && channel.close();
channel = new BroadcastChannel_(getPageId());
channel.onmessage = onPlusMessage$1;
}
else if (!globalEvent$1) {
globalEvent$1 = weex_.requireModule('globalEvent');
globalEvent$1.addEventListener('plusMessage', onPlusMessage$1);
}
}
else {
// @ts-ignore
window.__plusMessage = onPlusMessage$1;
}
callbacks$2[pageId] = callback;
}
class Page {
constructor(webview) {
this.webview = webview;
}
sendMessage(data) {
const message = JSON.parse(JSON.stringify({
__message: {
data,
},
}));
const id = this.webview.id;
if (BroadcastChannel_) {
const channel = new BroadcastChannel_(id);
channel.postMessage(message);
}
else {
plus_.webview.postMessageToUniNView &&
plus_.webview.postMessageToUniNView(message, id);
}
}
close() {
this.webview.close();
}
}
function showPage({ context = {}, url, data = {}, style = {}, onMessage, onClose, }) {
// eslint-disable-next-line
plus_ = context.plus || plus;
// eslint-disable-next-line
weex_ = context.weex || (typeof weex === 'object' ? weex : null);
// eslint-disable-next-line
BroadcastChannel_ =
context.BroadcastChannel ||
(typeof BroadcastChannel === 'object' ? BroadcastChannel : null);
const titleNView = {
autoBackButton: true,
titleSize: '17px',
};
const pageId = `page${Date.now()}`;
style = extend({}, style);
if (style.titleNView !== false && style.titleNView !== 'none') {
style.titleNView = extend(titleNView, style.titleNView);
}
const defaultStyle = {
top: 0,
bottom: 0,
usingComponents: {},
popGesture: 'close',
scrollIndicator: 'none',
animationType: 'pop-in',
animationDuration: 200,
uniNView: {
path: `${(typeof process === 'object' &&
process.env &&
process.env.VUE_APP_TEMPLATE_PATH) ||
''}/${url}.js`,
defaultFontSize: 16,
viewport: plus_.screen.resolutionWidth,
},
};
style = extend(defaultStyle, style);
const page = plus_.webview.create('', pageId, style, {
extras: {
from: getPageId(),
runtime: getRuntime(),
data,
useGlobalEvent: !BroadcastChannel_,
},
});
page.addEventListener('close', onClose);
addEventListener(pageId, (message) => {
if (typeof onMessage === 'function') {
onMessage(message.data);
}
if (!message.keep) {
page.close('auto');
}
});
page.show(style.animationType, style.animationDuration);
return new Page(page);
}
const invokeOnCallback = (name, res) => UniServiceJSBridge.emit('api.' + name, res);
let invokeViewMethodId = 1;
......@@ -2271,7 +2398,8 @@ var serviceContext = (function (vue) {
}
}
const ServiceJSBridge = /*#__PURE__*/ extend(initBridge('view' /* view 指的是 service 层订阅的是 view 层事件 */), {
const ServiceJSBridge = /*#__PURE__*/ extend(
/*#__PURE__*/ initBridge('view' /* view 指的是 service 层订阅的是 view 层事件 */), {
invokeOnCallback,
invokeViewMethod,
invokeViewMethodKeepAlive,
......@@ -14217,133 +14345,6 @@ var serviceContext = (function (vue) {
}
}, StartSoterAuthenticationProtocols, StartSoterAuthenticationOptions);
let plus_;
let weex_;
let BroadcastChannel_;
function getRuntime() {
return typeof window === 'object' &&
typeof navigator === 'object' &&
typeof document === 'object'
? 'webview'
: 'v8';
}
function getPageId() {
return plus_.webview.currentWebview().id;
}
let channel;
let globalEvent$1;
const callbacks$2 = {};
function onPlusMessage$1(res) {
const message = res.data && res.data.__message;
if (!message || !message.__page) {
return;
}
const pageId = message.__page;
const callback = callbacks$2[pageId];
callback && callback(message);
if (!message.keep) {
delete callbacks$2[pageId];
}
}
function addEventListener(pageId, callback) {
if (getRuntime() === 'v8') {
if (BroadcastChannel_) {
channel && channel.close();
channel = new BroadcastChannel_(getPageId());
channel.onmessage = onPlusMessage$1;
}
else if (!globalEvent$1) {
globalEvent$1 = weex_.requireModule('globalEvent');
globalEvent$1.addEventListener('plusMessage', onPlusMessage$1);
}
}
else {
// @ts-ignore
window.__plusMessage = onPlusMessage$1;
}
callbacks$2[pageId] = callback;
}
class Page {
constructor(webview) {
this.webview = webview;
}
sendMessage(data) {
const message = JSON.parse(JSON.stringify({
__message: {
data,
},
}));
const id = this.webview.id;
if (BroadcastChannel_) {
const channel = new BroadcastChannel_(id);
channel.postMessage(message);
}
else {
plus_.webview.postMessageToUniNView &&
plus_.webview.postMessageToUniNView(message, id);
}
}
close() {
this.webview.close();
}
}
function showPage({ context = {}, url, data = {}, style = {}, onMessage, onClose, }) {
// eslint-disable-next-line
plus_ = context.plus || plus;
// eslint-disable-next-line
weex_ = context.weex || (typeof weex === 'object' ? weex : null);
// eslint-disable-next-line
BroadcastChannel_ =
context.BroadcastChannel ||
(typeof BroadcastChannel === 'object' ? BroadcastChannel : null);
const titleNView = {
autoBackButton: true,
titleSize: '17px',
};
const pageId = `page${Date.now()}`;
style = extend({}, style);
if (style.titleNView !== false && style.titleNView !== 'none') {
style.titleNView = extend(titleNView, style.titleNView);
}
const defaultStyle = {
top: 0,
bottom: 0,
usingComponents: {},
popGesture: 'close',
scrollIndicator: 'none',
animationType: 'pop-in',
animationDuration: 200,
uniNView: {
path: `${(typeof process === 'object' &&
process.env &&
process.env.VUE_APP_TEMPLATE_PATH) ||
''}/${url}.js`,
defaultFontSize: 16,
viewport: plus_.screen.resolutionWidth,
},
};
style = extend(defaultStyle, style);
const page = plus_.webview.create('', pageId, style, {
extras: {
from: getPageId(),
runtime: getRuntime(),
data,
useGlobalEvent: !BroadcastChannel_,
},
});
page.addEventListener('close', onClose);
addEventListener(pageId, (message) => {
if (typeof onMessage === 'function') {
onMessage(message.data);
}
if (!message.keep) {
page.close('auto');
}
});
page.show(style.animationType, style.animationDuration);
return new Page(page);
}
const scanCode = defineAsyncApi(API_SCAN_CODE, (options, { resolve, reject }) => {
initI18nScanCodeMsgsOnce();
const { t } = useI18n();
......
import { defineComponent, createVNode, mergeProps, getCurrentInstance, provide, watch, onUnmounted, ref, inject, onBeforeUnmount, resolveComponent, Text, isVNode, Fragment, onMounted, computed } from "vue";
import { hasOwn, isPlainObject, extend } from "@vue/shared";
import { createElementVNode, defineComponent, createVNode, mergeProps, getCurrentInstance, provide, watch, onUnmounted, ref, inject, onBeforeUnmount, Text, isVNode, Fragment, onMounted, computed } from "vue";
import { hasOwn, extend, isPlainObject } from "@vue/shared";
import { cacheStringFunction } from "@dcloudio/uni-shared";
const OPEN_TYPES = [
"navigate",
......@@ -97,6 +97,9 @@ function useHoverClass(props2) {
}
return {};
}
function createNVueTextVNode(text, attrs) {
return createElementVNode("u-text", extend({ appendAsTree: true }, attrs), text);
}
const navigatorStyles = [{
"navigator-hover": {
backgroundColor: "rgba(0,0,0,0.1)",
......@@ -506,13 +509,13 @@ var Button = defineComponent({
const wrapSlots = () => {
if (!slots.default)
return [];
const _slots = slots.default();
return _slots.map((slot) => {
if (slot.type === Text) {
return createVNode("text", null, [slot]);
}
return slot;
});
const vnodes = slots.default();
if (vnodes.length === 1 && vnodes[0].type === Text) {
return [createNVueTextVNode(vnodes[0].children, {
class: "ub-t " + _getClass("-t")
})];
}
return vnodes;
};
return () => {
return createVNode("div", mergeProps({
......@@ -522,7 +525,7 @@ var Button = defineComponent({
hoverClass: _getHoverClass("")
}), {
"onClick": onClick
}), [props2.loading ? createVNode(resolveComponent("loading-indicator"), mergeProps({
}), [props2.loading ? createVNode("loading-indicator", mergeProps({
"class": ["ub-loading", `ub-${TYPES[type]}-loading`]
}, {
arrow: "false",
......
import { inject, onBeforeUnmount, ref, defineComponent, Text } from 'vue'
import { uniLabelKey, UniLabelCtx } from '../label'
import { useListeners } from '../../helpers/useListeners'
import { useHoverClass } from '../utils'
import { createNVueTextVNode, useHoverClass } from '../utils'
import { buttonProps } from '../../components/button'
import { extend } from '@vue/shared'
......@@ -256,13 +256,15 @@ export default defineComponent({
const wrapSlots = () => {
if (!slots.default) return []
const _slots = slots.default()
return _slots.map((slot) => {
if (slot.type === Text) {
return <text>{slot}</text>
}
return slot
})
const vnodes = slots.default()
if (vnodes.length === 1 && vnodes[0].type === Text) {
return [
createNVueTextVNode(vnodes[0].children as string, {
class: 'ub-t ' + _getClass('-t'),
}),
]
}
return vnodes
}
return () => {
......
import { hasOwn } from '@vue/shared'
import { createElementVNode } from 'vue'
import { extend, hasOwn } from '@vue/shared'
interface HoverProps {
hoverClass?: string
......@@ -22,3 +23,14 @@ export function useHoverClass(props: HoverProps) {
}
return {}
}
export function createNVueTextVNode(
text: string,
attrs?: Record<string, unknown>
) {
return createElementVNode(
'u-text',
extend({ appendAsTree: true }, attrs),
text
)
}
......@@ -2,6 +2,7 @@ import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { isAppNVueNativeTag } from '@dcloudio/uni-shared'
function resolve(file: string) {
return path.resolve(__dirname, file)
......@@ -47,5 +48,5 @@ export default defineConfig({
},
},
},
plugins: [vue(), vueJsx({})],
plugins: [vue(), vueJsx({ isCustomElement: isAppNVueNativeTag })],
})
......@@ -6,7 +6,7 @@ var shared = require("@vue/shared");
var uniShared = require("@dcloudio/uni-shared");
var uniI18n = require("@dcloudio/uni-i18n");
var vueRouter = require("vue-router");
const isEnableLocale = uniShared.once(() => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length);
const isEnableLocale = /* @__PURE__ */ uniShared.once(() => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length);
let i18n;
function getLocaleMessage() {
const locale = uni.getLocale();
......@@ -201,10 +201,9 @@ function registerViewMethod(pageId, name, fn) {
viewMethods[name] = fn;
}
}
const ViewJSBridge = /* @__PURE__ */ shared.extend(initBridge("service"), {
const ViewJSBridge = /* @__PURE__ */ shared.extend(/* @__PURE__ */ initBridge("service"), {
invokeServiceMethod
});
uniShared.passive(true);
const onEventPrevent = /* @__PURE__ */ vue.withModifiers(() => {
}, ["prevent"]);
const onEventStop = /* @__PURE__ */ vue.withModifiers(() => {
......@@ -408,7 +407,7 @@ const invokeViewMethodKeepAlive = (name, args, callback, pageId) => {
unsubscribe(subscribeName);
};
};
const ServiceJSBridge = /* @__PURE__ */ shared.extend(initBridge("view"), {
const ServiceJSBridge = /* @__PURE__ */ shared.extend(/* @__PURE__ */ initBridge("view"), {
invokeOnCallback,
invokeViewMethod,
invokeViewMethodKeepAlive
......@@ -730,13 +729,25 @@ function provideForm(trigger) {
});
return fields2;
}
const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul");
const props$u = {
for: {
type: String,
default: ""
}
};
const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul");
function useProvideLabel() {
const handlers = [];
vue.provide(uniLabelKey, {
addHandler(handler) {
handlers.push(handler);
},
removeHandler(handler) {
handlers.splice(handlers.indexOf(handler), 1);
}
});
return handlers;
}
var index$D = /* @__PURE__ */ defineBuiltInComponent({
name: "Label",
props: props$u,
......@@ -769,18 +780,6 @@ var index$D = /* @__PURE__ */ defineBuiltInComponent({
}, [slots.default && slots.default()], 10, ["onClick"]);
}
});
function useProvideLabel() {
const handlers = [];
vue.provide(uniLabelKey, {
addHandler(handler) {
handlers.push(handler);
},
removeHandler(handler) {
handlers.splice(handlers.indexOf(handler), 1);
}
});
return handlers;
}
const buttonProps = {
id: {
type: String,
......@@ -2772,7 +2771,6 @@ function throttle(fn, wait) {
};
return newFn;
}
uniShared.passive(true);
function useUserAction() {
const state = vue.reactive({
userAction: false
......@@ -3505,7 +3503,7 @@ function Friction(e2, t2) {
this._v = 0;
}
Friction.prototype.setV = function(x, y) {
var n = Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5);
const n = Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5);
this._x_v = x;
this._y_v = y;
this._x_a = -this._f * this._x_v / n;
......@@ -3526,8 +3524,8 @@ Friction.prototype.s = function(t2) {
t2 = this._t;
this._lastDt = t2;
}
var x = this._x_v * t2 + 0.5 * this._x_a * Math.pow(t2, 2) + this._x_s;
var y = this._y_v * t2 + 0.5 * this._y_a * Math.pow(t2, 2) + this._y_s;
let x = this._x_v * t2 + 0.5 * this._x_a * Math.pow(t2, 2) + this._x_s;
let y = this._y_v * t2 + 0.5 * this._y_a * Math.pow(t2, 2) + this._y_s;
if (this._x_a > 0 && x < this._endPositionX || this._x_a < 0 && x > this._endPositionX) {
x = this._endPositionX;
}
......@@ -3561,7 +3559,7 @@ Friction.prototype.dt = function() {
return -this._x_v / this._x_a;
};
Friction.prototype.done = function() {
var t2 = e(this.s().x, this._endPositionX) || e(this.s().y, this._endPositionY) || this._lastDt === this._t;
const t2 = e(this.s().x, this._endPositionX) || e(this.s().y, this._endPositionY) || this._lastDt === this._t;
this._lastDt = null;
return t2;
};
......@@ -3582,10 +3580,10 @@ function Spring(m, k, c) {
this._startTime = 0;
}
Spring.prototype._solve = function(e2, t2) {
var n = this._c;
var i = this._m;
var r = this._k;
var o = n * n - 4 * i * r;
const n = this._c;
const i = this._m;
const r = this._k;
const o = n * n - 4 * i * r;
if (o === 0) {
const a = -n / (2 * i);
const s = e2;
......@@ -3595,7 +3593,7 @@ Spring.prototype._solve = function(e2, t2) {
return (s + l * e3) * Math.pow(Math.E, a * e3);
},
dx: function(e3) {
var t3 = Math.pow(Math.E, a * e3);
const t3 = Math.pow(Math.E, a * e3);
return a * (s + l * e3) * t3 + l * t3;
}
};
......@@ -3607,8 +3605,8 @@ Spring.prototype._solve = function(e2, t2) {
const h = e2 - d;
return {
x: function(e3) {
var t3;
var n2;
let t3;
let n2;
if (e3 === this._t) {
t3 = this._powER1T;
n2 = this._powER2T;
......@@ -3623,8 +3621,8 @@ Spring.prototype._solve = function(e2, t2) {
return h * t3 + d * n2;
},
dx: function(e3) {
var t3;
var n2;
let t3;
let n2;
if (e3 === this._t) {
t3 = this._powER1T;
n2 = this._powER2T;
......@@ -3640,18 +3638,18 @@ Spring.prototype._solve = function(e2, t2) {
}
};
}
var p2 = Math.sqrt(4 * i * r - n * n) / (2 * i);
var f2 = -n / 2 * i;
var v2 = e2;
var g2 = (t2 - f2 * e2) / p2;
const p2 = Math.sqrt(4 * i * r - n * n) / (2 * i);
const f2 = -n / 2 * i;
const v2 = e2;
const g2 = (t2 - f2 * e2) / p2;
return {
x: function(e3) {
return Math.pow(Math.E, f2 * e3) * (v2 * Math.cos(p2 * e3) + g2 * Math.sin(p2 * e3));
},
dx: function(e3) {
var t3 = Math.pow(Math.E, f2 * e3);
var n2 = Math.cos(p2 * e3);
var i2 = Math.sin(p2 * e3);
const t3 = Math.pow(Math.E, f2 * e3);
const n2 = Math.cos(p2 * e3);
const i2 = Math.sin(p2 * e3);
return t3 * (g2 * p2 * n2 - v2 * p2 * i2) + f2 * t3 * (g2 * i2 + v2 * n2);
}
};
......@@ -3674,7 +3672,7 @@ Spring.prototype.setEnd = function(e2, n, i) {
}
if (e2 !== this._endPosition || !t(n, 0.1)) {
n = n || 0;
var r = this._endPosition;
let r = this._endPosition;
if (this._solution) {
if (t(n, 0.1)) {
n = this._solution.dx((i - this._startTime) / 1e3);
......@@ -3759,14 +3757,14 @@ function STD(e2, t2, n) {
this._startTime = 0;
}
STD.prototype.setEnd = function(e2, t2, n, i) {
var r = new Date().getTime();
const r = new Date().getTime();
this._springX.setEnd(e2, i, r);
this._springY.setEnd(t2, i, r);
this._springScale.setEnd(n, i, r);
this._startTime = r;
};
STD.prototype.x = function() {
var e2 = (new Date().getTime() - this._startTime) / 1e3;
const e2 = (new Date().getTime() - this._startTime) / 1e3;
return {
x: this._springX.x(e2),
y: this._springY.x(e2),
......@@ -3774,7 +3772,7 @@ STD.prototype.x = function() {
};
};
STD.prototype.done = function() {
var e2 = new Date().getTime();
const e2 = new Date().getTime();
return this._springX.done(e2) && this._springY.done(e2) && this._springScale.done(e2);
};
STD.prototype.reconfigure = function(e2, t2, n) {
......@@ -3836,6 +3834,9 @@ const props$k = {
default: true
}
};
function v(a, b) {
return +((1e3 * a - 1e3 * b) / 1e3).toFixed(1);
}
var index$u = /* @__PURE__ */ defineBuiltInComponent({
name: "MovableView",
props: props$k,
......@@ -3882,9 +3883,6 @@ function f(t2, n) {
let i = t2.offsetTop;
return t2.offsetParent ? i += f(t2.offsetParent, n) : 0;
}
function v(a, b) {
return +((1e3 * a - 1e3 * b) / 1e3).toFixed(1);
}
function g(friction, execute, endCallback) {
let record = {
id: 0,
......@@ -5150,7 +5148,6 @@ var index$p = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
uniShared.passive(true);
const props$e = {
scrollX: {
type: [Boolean, String],
......
......@@ -3,7 +3,7 @@ import { isString, extend, stringifyStyle, parseStringStyle, isPlainObject, isFu
import { once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS, Emitter, passive, initCustomDataset, resolveComponentInstance, addLeadingSlash, invokeArrayFns, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, LINEFEED, ON_ERROR, callOptions, ON_LAUNCH, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, ON_LOAD, UniLifecycleHooks, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, formatDateTime, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import { initVueI18n, isI18nStr, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT } from "@dcloudio/uni-i18n";
import { useRoute, createRouter, createWebHistory, createWebHashHistory, useRouter, isNavigationFailure, RouterView } from "vue-router";
const isEnableLocale = once(() => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length);
const isEnableLocale = /* @__PURE__ */ once(() => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length);
let i18n;
function getLocaleMessage() {
const locale = uni.getLocale();
......@@ -418,12 +418,12 @@ function onInvokeViewMethod({
publish({});
}
}
const ViewJSBridge = /* @__PURE__ */ extend(initBridge("service"), {
const ViewJSBridge = /* @__PURE__ */ extend(/* @__PURE__ */ initBridge("service"), {
invokeServiceMethod
});
const LONGPRESS_TIMEOUT = 350;
const LONGPRESS_THRESHOLD = 10;
const passiveOptions$2 = passive(true);
const passiveOptions$2 = /* @__PURE__ */ passive(true);
let longPressTimer;
function clearLongPressTimer() {
if (longPressTimer) {
......@@ -1346,7 +1346,7 @@ const invokeViewMethodKeepAlive = (name, args, callback, pageId) => {
unsubscribe(subscribeName);
};
};
const ServiceJSBridge = /* @__PURE__ */ extend(initBridge("view"), {
const ServiceJSBridge = /* @__PURE__ */ extend(/* @__PURE__ */ initBridge("view"), {
invokeOnCallback,
invokeViewMethod,
invokeViewMethodKeepAlive
......@@ -1769,13 +1769,25 @@ function provideForm(trigger) {
});
return fields2;
}
const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul");
const props$B = {
for: {
type: String,
default: ""
}
};
const uniLabelKey = PolySymbol(process.env.NODE_ENV !== "production" ? "uniLabel" : "ul");
function useProvideLabel() {
const handlers = [];
provide(uniLabelKey, {
addHandler(handler) {
handlers.push(handler);
},
removeHandler(handler) {
handlers.splice(handlers.indexOf(handler), 1);
}
});
return handlers;
}
var index$z = /* @__PURE__ */ defineBuiltInComponent({
name: "Label",
props: props$B,
......@@ -1808,18 +1820,6 @@ var index$z = /* @__PURE__ */ defineBuiltInComponent({
}, [slots.default && slots.default()], 10, ["onClick"]);
}
});
function useProvideLabel() {
const handlers = [];
provide(uniLabelKey, {
addHandler(handler) {
handlers.push(handler);
},
removeHandler(handler) {
handlers.splice(handlers.indexOf(handler), 1);
}
});
return handlers;
}
function useListeners$1(props2, listeners2) {
_addListeners(props2.id, listeners2);
watch(() => props2.id, (newId, oldId) => {
......@@ -8195,7 +8195,7 @@ function throttle(fn, wait) {
};
return newFn;
}
const passiveOptions$1 = passive(true);
const passiveOptions$1 = /* @__PURE__ */ passive(true);
const states = [];
let userInteract = 0;
let inited;
......@@ -9107,7 +9107,7 @@ function Friction$1(e2, t2) {
this._v = 0;
}
Friction$1.prototype.setV = function(x, y) {
var n = Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5);
const n = Math.pow(Math.pow(x, 2) + Math.pow(y, 2), 0.5);
this._x_v = x;
this._y_v = y;
this._x_a = -this._f * this._x_v / n;
......@@ -9128,8 +9128,8 @@ Friction$1.prototype.s = function(t2) {
t2 = this._t;
this._lastDt = t2;
}
var x = this._x_v * t2 + 0.5 * this._x_a * Math.pow(t2, 2) + this._x_s;
var y = this._y_v * t2 + 0.5 * this._y_a * Math.pow(t2, 2) + this._y_s;
let x = this._x_v * t2 + 0.5 * this._x_a * Math.pow(t2, 2) + this._x_s;
let y = this._y_v * t2 + 0.5 * this._y_a * Math.pow(t2, 2) + this._y_s;
if (this._x_a > 0 && x < this._endPositionX || this._x_a < 0 && x > this._endPositionX) {
x = this._endPositionX;
}
......@@ -9163,7 +9163,7 @@ Friction$1.prototype.dt = function() {
return -this._x_v / this._x_a;
};
Friction$1.prototype.done = function() {
var t2 = e(this.s().x, this._endPositionX) || e(this.s().y, this._endPositionY) || this._lastDt === this._t;
const t2 = e(this.s().x, this._endPositionX) || e(this.s().y, this._endPositionY) || this._lastDt === this._t;
this._lastDt = null;
return t2;
};
......@@ -9184,10 +9184,10 @@ function Spring$1(m, k, c) {
this._startTime = 0;
}
Spring$1.prototype._solve = function(e2, t2) {
var n = this._c;
var i = this._m;
var r = this._k;
var o2 = n * n - 4 * i * r;
const n = this._c;
const i = this._m;
const r = this._k;
const o2 = n * n - 4 * i * r;
if (o2 === 0) {
const a2 = -n / (2 * i);
const s = e2;
......@@ -9197,7 +9197,7 @@ Spring$1.prototype._solve = function(e2, t2) {
return (s + l * e3) * Math.pow(Math.E, a2 * e3);
},
dx: function(e3) {
var t3 = Math.pow(Math.E, a2 * e3);
const t3 = Math.pow(Math.E, a2 * e3);
return a2 * (s + l * e3) * t3 + l * t3;
}
};
......@@ -9209,8 +9209,8 @@ Spring$1.prototype._solve = function(e2, t2) {
const h = e2 - d;
return {
x: function(e3) {
var t3;
var n2;
let t3;
let n2;
if (e3 === this._t) {
t3 = this._powER1T;
n2 = this._powER2T;
......@@ -9225,8 +9225,8 @@ Spring$1.prototype._solve = function(e2, t2) {
return h * t3 + d * n2;
},
dx: function(e3) {
var t3;
var n2;
let t3;
let n2;
if (e3 === this._t) {
t3 = this._powER1T;
n2 = this._powER2T;
......@@ -9242,18 +9242,18 @@ Spring$1.prototype._solve = function(e2, t2) {
}
};
}
var p2 = Math.sqrt(4 * i * r - n * n) / (2 * i);
var f2 = -n / 2 * i;
var v2 = e2;
var g2 = (t2 - f2 * e2) / p2;
const p2 = Math.sqrt(4 * i * r - n * n) / (2 * i);
const f2 = -n / 2 * i;
const v2 = e2;
const g2 = (t2 - f2 * e2) / p2;
return {
x: function(e3) {
return Math.pow(Math.E, f2 * e3) * (v2 * Math.cos(p2 * e3) + g2 * Math.sin(p2 * e3));
},
dx: function(e3) {
var t3 = Math.pow(Math.E, f2 * e3);
var n2 = Math.cos(p2 * e3);
var i2 = Math.sin(p2 * e3);
const t3 = Math.pow(Math.E, f2 * e3);
const n2 = Math.cos(p2 * e3);
const i2 = Math.sin(p2 * e3);
return t3 * (g2 * p2 * n2 - v2 * p2 * i2) + f2 * t3 * (g2 * i2 + v2 * n2);
}
};
......@@ -9276,7 +9276,7 @@ Spring$1.prototype.setEnd = function(e2, n, i) {
}
if (e2 !== this._endPosition || !t(n, 0.1)) {
n = n || 0;
var r = this._endPosition;
let r = this._endPosition;
if (this._solution) {
if (t(n, 0.1)) {
n = this._solution.dx((i - this._startTime) / 1e3);
......@@ -9361,14 +9361,14 @@ function STD(e2, t2, n) {
this._startTime = 0;
}
STD.prototype.setEnd = function(e2, t2, n, i) {
var r = new Date().getTime();
const r = new Date().getTime();
this._springX.setEnd(e2, i, r);
this._springY.setEnd(t2, i, r);
this._springScale.setEnd(n, i, r);
this._startTime = r;
};
STD.prototype.x = function() {
var e2 = (new Date().getTime() - this._startTime) / 1e3;
const e2 = (new Date().getTime() - this._startTime) / 1e3;
return {
x: this._springX.x(e2),
y: this._springY.x(e2),
......@@ -9376,7 +9376,7 @@ STD.prototype.x = function() {
};
};
STD.prototype.done = function() {
var e2 = new Date().getTime();
const e2 = new Date().getTime();
return this._springX.done(e2) && this._springY.done(e2) && this._springScale.done(e2);
};
STD.prototype.reconfigure = function(e2, t2, n) {
......@@ -9438,6 +9438,9 @@ const props$r = {
default: true
}
};
function v(a2, b) {
return +((1e3 * a2 - 1e3 * b) / 1e3).toFixed(1);
}
var MovableView = /* @__PURE__ */ defineBuiltInComponent({
name: "MovableView",
props: props$r,
......@@ -9484,9 +9487,6 @@ function f(t2, n) {
let i = t2.offsetTop;
return t2.offsetParent ? i += f(t2.offsetParent, n) : 0;
}
function v(a2, b) {
return +((1e3 * a2 - 1e3 * b) / 1e3).toFixed(1);
}
function g(friction, execute, endCallback) {
let record = {
id: 0,
......@@ -11756,7 +11756,7 @@ var index$m = /* @__PURE__ */ defineBuiltInComponent({
};
}
});
const passiveOptions = passive(true);
const passiveOptions = /* @__PURE__ */ passive(true);
const props$l = {
scrollX: {
type: [Boolean, String],
......
......@@ -5538,8 +5538,8 @@ packages:
engines: {node: '>= 0.6'}
/fs-extra/10.0.0:
resolution: {integrity: sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==, tarball: fs-extra/-/fs-extra-10.0.0.tgz}
engines: {node: '>=10'}
resolution: {integrity: sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==}
engines: {node: '>=12'}
dependencies:
at-least-node: 1.0.0
graceful-fs: 4.2.8
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册