提交 3f982430 编写于 作者: fxy060608's avatar fxy060608

wip(app): nvue

上级 5101fdd6
...@@ -265,20 +265,6 @@ function vueFactory(exports) { ...@@ -265,20 +265,6 @@ function vueFactory(exports) {
return _globalThis || (_globalThis = typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {}); return _globalThis || (_globalThis = typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {});
}; };
var latestNodeId = 1;
class NVueTextNode {
constructor(text) {
this.instanceId = '';
this.nodeId = latestNodeId++;
this.parentNode = null;
this.nodeType = 3;
this.text = text;
this.children = [];
}
}
var activeEffectScope; var activeEffectScope;
var effectScopeStack = []; var effectScopeStack = [];
...@@ -9305,7 +9291,7 @@ function vueFactory(exports) { ...@@ -9305,7 +9291,7 @@ function vueFactory(exports) {
createElement: tag => { createElement: tag => {
return document.createElement(tag); return document.createElement(tag);
}, },
createText: text => new NVueTextNode(text), createText: text => document.createText(text),
createComment: text => document.createComment(text), createComment: text => document.createComment(text),
setText: (node, text) => { setText: (node, text) => {
node.setAttr('value', text); node.setAttr('value', text);
...@@ -9317,19 +9303,58 @@ function vueFactory(exports) { ...@@ -9317,19 +9303,58 @@ function vueFactory(exports) {
nextSibling: node => node.nextSibling nextSibling: node => node.nextSibling
}; };
function isUndef(val) { function useCssStyles(styles) {
return val === undefined || val === null; var normalized = {};
if (isArray(styles)) {
styles.forEach(style => {
Object.keys(style).forEach(name => {
if (hasOwn(normalized, name)) {
extend(normalized[name], style[name]);
} else {
normalized[name] = style[name];
}
});
});
}
return normalized;
}
function parseStylesheet(_ref23) {
var {
type,
vnode: {
appContext
}
} = _ref23;
if (!type.__styles) {
var styles = [];
if (appContext) {
styles.push(appContext.provides.__appStyles);
}
if (isArray(type.styles)) {
type.styles.forEach(style => styles.push(style));
}
type.__styles = useCssStyles(styles);
}
return type.__styles;
} }
function parseStylesheet(instance) { function isUndef(val) {
return instance.type.__stylesheet || {}; return val === undefined || val === null;
} }
function patchAttr(el, key, value) { function patchAttr(el, key, value) {
var instance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; var instance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
if (instance) { if (instance) {
value = transformAttr(el, key, value, instance); [key, value] = transformAttr(el, key, value, instance);
} }
if (value == null) ;else { if (value == null) ;else {
...@@ -9373,26 +9398,28 @@ function vueFactory(exports) { ...@@ -9373,26 +9398,28 @@ function vueFactory(exports) {
function transformAttr(el, key, value, instance) { function transformAttr(el, key, value, instance) {
if (!value) { if (!value) {
return value; return [key, value];
} }
var opts = CLASS_AND_STYLES[el.type]; var opts = CLASS_AND_STYLES[el.type];
if (opts) { if (opts) {
if (opts['class'].indexOf(key) !== -1) { var camelized = camelize(key);
return parseStylesheet(instance)[value] || {};
if (opts['class'].indexOf(camelized) > -1) {
return [camelized, parseStylesheet(instance)[value] || {}];
} }
if (opts['style'].indexOf(key) !== -1) { if (opts['style'].indexOf(key) > -1) {
if (isString(value)) { if (isString(value)) {
return parseStringStyle(value); return [camelized, parseStringStyle(value)];
} }
return normalizeStyle(value); return [camelized, normalizeStyle(value)];
} }
} }
return value; return [key, value];
} // compiler should normalize class + :class bindings on the same element } // compiler should normalize class + :class bindings on the same element
// into a single binding ['staticClass', dynamic] // into a single binding ['staticClass', dynamic]
...@@ -9833,6 +9860,7 @@ function vueFactory(exports) { ...@@ -9833,6 +9860,7 @@ function vueFactory(exports) {
unref: unref, unref: unref,
useAttrs: useAttrs, useAttrs: useAttrs,
useCssModule: useCssModule, useCssModule: useCssModule,
useCssStyles: useCssStyles,
useCssVars: useCssVars, useCssVars: useCssVars,
useSSRContext: useSSRContext, useSSRContext: useSSRContext,
useSlots: useSlots, useSlots: useSlots,
...@@ -9851,6 +9879,7 @@ function vueFactory(exports) { ...@@ -9851,6 +9879,7 @@ function vueFactory(exports) {
withScopeId: withScopeId, withScopeId: withScopeId,
camelize: camelize, camelize: camelize,
capitalize: capitalize, capitalize: capitalize,
hyphenate: hyphenate,
normalizeClass: normalizeClass, normalizeClass: normalizeClass,
normalizeProps: normalizeProps, normalizeProps: normalizeProps,
normalizeStyle: normalizeStyle, normalizeStyle: normalizeStyle,
......
import { NVueTextNode } from '@dcloudio/uni-shared';
import { extend, isArray, isMap, isIntegerKey, isSymbol, hasOwn, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP, isString, isPromise, getGlobalThis, EMPTY_OBJ, toHandlerKey, toNumber, hyphenate, camelize, isOn, isModelListener, remove, isSet, isPlainObject, invokeArrayFns, isReservedProp, EMPTY_ARR, NO, normalizeClass, normalizeStyle, isGloballyWhitelisted, parseStringStyle } from '@vue/shared'; import { extend, isArray, isMap, isIntegerKey, isSymbol, hasOwn, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP, isString, isPromise, getGlobalThis, EMPTY_OBJ, toHandlerKey, toNumber, hyphenate, camelize, isOn, isModelListener, remove, isSet, isPlainObject, invokeArrayFns, isReservedProp, EMPTY_ARR, NO, normalizeClass, normalizeStyle, isGloballyWhitelisted, parseStringStyle } from '@vue/shared';
export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared'; export { camelize, capitalize, hyphenate, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
function warn(msg, ...args) { function warn(msg, ...args) {
console.warn(`[Vue warn] ${msg}`, ...args); console.warn(`[Vue warn] ${msg}`, ...args);
...@@ -8863,7 +8862,7 @@ const nodeOps = { ...@@ -8863,7 +8862,7 @@ const nodeOps = {
createElement: (tag) => { createElement: (tag) => {
return document.createElement(tag); return document.createElement(tag);
}, },
createText: text => new NVueTextNode(text), createText: text => document.createText(text),
createComment: text => document.createComment(text), createComment: text => document.createComment(text),
setText: (node, text) => { setText: (node, text) => {
node.setAttr('value', text); node.setAttr('value', text);
...@@ -8875,17 +8874,43 @@ const nodeOps = { ...@@ -8875,17 +8874,43 @@ const nodeOps = {
nextSibling: node => node.nextSibling nextSibling: node => node.nextSibling
}; };
function useCssStyles(styles) {
const normalized = {};
if (isArray(styles)) {
styles.forEach(style => {
Object.keys(style).forEach(name => {
if (hasOwn(normalized, name)) {
extend(normalized[name], style[name]);
}
else {
normalized[name] = style[name];
}
});
});
}
return normalized;
}
function parseStylesheet({ type, vnode: { appContext } }) {
if (!type.__styles) {
const styles = [];
if (appContext) {
styles.push(appContext.provides.__appStyles);
}
if (isArray(type.styles)) {
type.styles.forEach(style => styles.push(style));
}
type.__styles = useCssStyles(styles);
}
return type.__styles;
}
function isUndef(val) { function isUndef(val) {
return val === undefined || val === null; return val === undefined || val === null;
}
function parseStylesheet(instance) {
return (instance.type.__stylesheet ||
{});
} }
function patchAttr(el, key, value, instance = null) { function patchAttr(el, key, value, instance = null) {
if (instance) { if (instance) {
value = transformAttr(el, key, value, instance); [key, value] = transformAttr(el, key, value, instance);
} }
if (value == null) ; if (value == null) ;
else { else {
...@@ -8927,21 +8952,22 @@ const CLASS_AND_STYLES = { ...@@ -8927,21 +8952,22 @@ const CLASS_AND_STYLES = {
}; };
function transformAttr(el, key, value, instance) { function transformAttr(el, key, value, instance) {
if (!value) { if (!value) {
return value; return [key, value];
} }
const opts = CLASS_AND_STYLES[el.type]; const opts = CLASS_AND_STYLES[el.type];
if (opts) { if (opts) {
if (opts['class'].indexOf(key) !== -1) { const camelized = camelize(key);
return parseStylesheet(instance)[value] || {}; if (opts['class'].indexOf(camelized) > -1) {
return [camelized, parseStylesheet(instance)[value] || {}];
} }
if (opts['style'].indexOf(key) !== -1) { if (opts['style'].indexOf(key) > -1) {
if (isString(value)) { if (isString(value)) {
return parseStringStyle(value); return [camelized, parseStringStyle(value)];
} }
return normalizeStyle(value); return [camelized, normalizeStyle(value)];
} }
} }
return value; return [key, value];
} }
// compiler should normalize class + :class bindings on the same element // compiler should normalize class + :class bindings on the same element
...@@ -9203,4 +9229,4 @@ const createApp = ((...args) => { ...@@ -9203,4 +9229,4 @@ const createApp = ((...args) => {
return app; return app;
}); });
export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed$1 as computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, stop, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId }; export { BaseTransition, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed$1 as computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineProps, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, stop, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssStyles, useCssVars, useSSRContext, useSlots, useTransitionState, version, warn$1 as warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
...@@ -585,18 +585,6 @@ function formatH5Log(type, filename, ...args) { ...@@ -585,18 +585,6 @@ function formatH5Log(type, filename, ...args) {
console[type].apply(console, [...args, filename]); console[type].apply(console, [...args, filename]);
} }
let latestNodeId = 1;
class NVueTextNode {
constructor(text) {
this.instanceId = '';
this.nodeId = latestNodeId++;
this.parentNode = null;
this.nodeType = 3;
this.text = text;
this.children = [];
}
}
function plusReady(callback) { function plusReady(callback) {
if (typeof callback !== 'function') { if (typeof callback !== 'function') {
return; return;
...@@ -1345,7 +1333,6 @@ exports.NODE_TYPE_PAGE = NODE_TYPE_PAGE; ...@@ -1345,7 +1333,6 @@ exports.NODE_TYPE_PAGE = NODE_TYPE_PAGE;
exports.NODE_TYPE_TEXT = NODE_TYPE_TEXT; exports.NODE_TYPE_TEXT = NODE_TYPE_TEXT;
exports.NVUE_BUILT_IN_TAGS = NVUE_BUILT_IN_TAGS; exports.NVUE_BUILT_IN_TAGS = NVUE_BUILT_IN_TAGS;
exports.NVUE_U_BUILT_IN_TAGS = NVUE_U_BUILT_IN_TAGS; exports.NVUE_U_BUILT_IN_TAGS = NVUE_U_BUILT_IN_TAGS;
exports.NVueTextNode = NVueTextNode;
exports.ON_ADD_TO_FAVORITES = ON_ADD_TO_FAVORITES; exports.ON_ADD_TO_FAVORITES = ON_ADD_TO_FAVORITES;
exports.ON_APP_ENTER_BACKGROUND = ON_APP_ENTER_BACKGROUND; exports.ON_APP_ENTER_BACKGROUND = ON_APP_ENTER_BACKGROUND;
exports.ON_APP_ENTER_FOREGROUND = ON_APP_ENTER_FOREGROUND; exports.ON_APP_ENTER_FOREGROUND = ON_APP_ENTER_FOREGROUND;
......
...@@ -323,6 +323,7 @@ export declare interface NVueDocument { ...@@ -323,6 +323,7 @@ export declare interface NVueDocument {
open: () => void; open: () => void;
close: () => void; close: () => void;
createElement: (tagName: string, props?: Record<string, unknown>) => NVueElement; createElement: (tagName: string, props?: Record<string, unknown>) => NVueElement;
createText: (text: string) => Record<string, unknown>;
createComment: (text: string) => Record<string, unknown>; createComment: (text: string) => Record<string, unknown>;
fireEvent: (type: string) => void; fireEvent: (type: string) => void;
destroy: () => void; destroy: () => void;
...@@ -395,16 +396,6 @@ export declare interface NVueTaskCenter { ...@@ -395,16 +396,6 @@ export declare interface NVueTaskCenter {
updateData: (componentId: string, data: Record<string, unknown> | void, callback?: Function) => void; updateData: (componentId: string, data: Record<string, unknown> | void, callback?: Function) => void;
} }
export declare class NVueTextNode {
instanceId: string;
nodeId: number;
parentNode: null | NVueElement;
nodeType: 3;
text: string;
children: unknown[];
constructor(text: string);
}
export declare const ON_ADD_TO_FAVORITES = "onAddToFavorites"; export declare const ON_ADD_TO_FAVORITES = "onAddToFavorites";
export declare const ON_APP_ENTER_BACKGROUND = "onAppEnterBackground"; export declare const ON_APP_ENTER_BACKGROUND = "onAppEnterBackground";
......
...@@ -581,18 +581,6 @@ function formatH5Log(type, filename, ...args) { ...@@ -581,18 +581,6 @@ function formatH5Log(type, filename, ...args) {
console[type].apply(console, [...args, filename]); console[type].apply(console, [...args, filename]);
} }
let latestNodeId = 1;
class NVueTextNode {
constructor(text) {
this.instanceId = '';
this.nodeId = latestNodeId++;
this.parentNode = null;
this.nodeType = 3;
this.text = text;
this.children = [];
}
}
function plusReady(callback) { function plusReady(callback) {
if (typeof callback !== 'function') { if (typeof callback !== 'function') {
return; return;
...@@ -1300,4 +1288,4 @@ function getEnvLocale() { ...@@ -1300,4 +1288,4 @@ function getEnvLocale() {
return (lang && lang.replace(/[.:].*/, '')) || 'en'; return (lang && lang.replace(/[.:].*/, '')) || 'en';
} }
export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_ADD_WXS_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_PAGE_SCROLL, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ATTR_CHANGE_PREFIX, ATTR_CLASS, ATTR_INNER_HTML, ATTR_STYLE, ATTR_TEXT_CONTENT, ATTR_V_OWNER_ID, ATTR_V_RENDERJS, ATTR_V_SHOW, BACKGROUND_COLOR, BUILT_IN_TAGS, BUILT_IN_TAG_NAMES, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, EventChannel, EventModifierFlags, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, NVUE_BUILT_IN_TAGS, NVUE_U_BUILT_IN_TAGS, NVueTextNode, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_HIDE, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_PAGE_NOT_FOUND, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_REACH_BOTTOM_DISTANCE, ON_READY, ON_RESIZE, ON_SHARE_APP_MESSAGE, ON_SHARE_TIMELINE, ON_SHOW, ON_TAB_ITEM_TAP, ON_THEME_CHANGE, ON_UNHANDLE_REJECTION, ON_UNLOAD, ON_WEB_INVOKE_APP_SERVICE, ON_WXS_INVOKE_CALL_METHOD, PLUS_RE, PRIMARY_COLOR, RENDERJS_MODULES, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, SLOT_DEFAULT_NAME, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UNI_STORAGE_LOCALE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, addLeadingSlash, cache, cacheStringFunction, callOptions, createIsCustomElement, createRpx2Unit, createUniEvent, customizeEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultNVueRpx2Unit, defaultRpx2Unit, dynamicSlotName, forcePatchProp, formatAppLog, formatDateTime, formatH5Log, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDataset, invokeArrayFns, isAppNVueNativeTag, isAppNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isRootHook, normalizeDataset, normalizeEventType, normalizeTarget, once, parseEventName, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveComponentInstance, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, stringifyQuery, updateElementStyle }; export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_ADD_WXS_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_PAGE_SCROLL, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, ATTR_CHANGE_PREFIX, ATTR_CLASS, ATTR_INNER_HTML, ATTR_STYLE, ATTR_TEXT_CONTENT, ATTR_V_OWNER_ID, ATTR_V_RENDERJS, ATTR_V_SHOW, BACKGROUND_COLOR, BUILT_IN_TAGS, BUILT_IN_TAG_NAMES, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, EventChannel, EventModifierFlags, I18N_JSON_DELIMITERS, JSON_PROTOCOL, LINEFEED, MINI_PROGRAM_PAGE_RUNTIME_HOOKS, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, NVUE_BUILT_IN_TAGS, NVUE_U_BUILT_IN_TAGS, ON_ADD_TO_FAVORITES, ON_APP_ENTER_BACKGROUND, ON_APP_ENTER_FOREGROUND, ON_BACK_PRESS, ON_ERROR, ON_HIDE, ON_KEYBOARD_HEIGHT_CHANGE, ON_LAUNCH, ON_LOAD, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_PAGE_NOT_FOUND, ON_PAGE_SCROLL, ON_PULL_DOWN_REFRESH, ON_REACH_BOTTOM, ON_REACH_BOTTOM_DISTANCE, ON_READY, ON_RESIZE, ON_SHARE_APP_MESSAGE, ON_SHARE_TIMELINE, ON_SHOW, ON_TAB_ITEM_TAP, ON_THEME_CHANGE, ON_UNHANDLE_REJECTION, ON_UNLOAD, ON_WEB_INVOKE_APP_SERVICE, ON_WXS_INVOKE_CALL_METHOD, PLUS_RE, PRIMARY_COLOR, RENDERJS_MODULES, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, SLOT_DEFAULT_NAME, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UNI_STORAGE_LOCALE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniLifecycleHooks, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, WXS_MODULES, WXS_PROTOCOL, addFont, addLeadingSlash, cache, cacheStringFunction, callOptions, createIsCustomElement, createRpx2Unit, createUniEvent, customizeEvent, debounce, decode, decodedQuery, defaultMiniProgramRpx2Unit, defaultNVueRpx2Unit, defaultRpx2Unit, dynamicSlotName, forcePatchProp, formatAppLog, formatDateTime, formatH5Log, formatLog, getCustomDataset, getEnvLocale, getLen, getValueByDataPath, initCustomDataset, invokeArrayFns, isAppNVueNativeTag, isAppNativeTag, isBuiltInComponent, isComponentInternalInstance, isComponentTag, isH5CustomElement, isH5NativeTag, isMiniProgramNativeTag, isRootHook, normalizeDataset, normalizeEventType, normalizeTarget, once, parseEventName, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, resolveComponentInstance, resolveOwnerEl, resolveOwnerVm, sanitise, scrollTo, stringifyQuery, updateElementStyle };
import { createApp, ComponentPublicInstance } from 'vue' import { createApp, ComponentPublicInstance } from 'vue'
let latestNodeId = 1
export class NVueTextNode {
instanceId: string
nodeId: number
parentNode: null | NVueElement
nodeType: 3
text: string
children: unknown[]
constructor(text: string) {
this.instanceId = ''
this.nodeId = latestNodeId++
this.parentNode = null
this.nodeType = 3
this.text = text
this.children = []
}
}
export interface Vue { export interface Vue {
createApp: typeof createApp createApp: typeof createApp
} }
...@@ -91,6 +72,7 @@ export interface NVueDocument { ...@@ -91,6 +72,7 @@ export interface NVueDocument {
tagName: string, tagName: string,
props?: Record<string, unknown> props?: Record<string, unknown>
) => NVueElement ) => NVueElement
createText: (text: string) => Record<string, unknown>
createComment: (text: string) => Record<string, unknown> createComment: (text: string) => Record<string, unknown>
fireEvent: (type: string) => void fireEvent: (type: string) => void
destroy: () => void destroy: () => void
......
...@@ -81,8 +81,8 @@ export default function uniPlugin( ...@@ -81,8 +81,8 @@ export default function uniPlugin(
initPreContext(options.platform, process.env.UNI_CUSTOM_CONTEXT) initPreContext(options.platform, process.env.UNI_CUSTOM_CONTEXT)
const plugins: Plugin[] = [] const plugins: Plugin[] = []
// 仅限 h5
if (options.viteLegacyOptions) { if (options.viteLegacyOptions && options.platform === 'h5') {
plugins.push( plugins.push(
...(legacyPlugin( ...(legacyPlugin(
initPluginViteLegacyOptions(options) initPluginViteLegacyOptions(options)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册