提交 514dab8e 编写于 作者: fxy060608's avatar fxy060608

wip(app): uni-app-plus

上级 28516be8
import { encodeEvent, encodeTag, UniEventListener } from '@dcloudio/uni-shared'
import {
ACTION_TYPE_ADD_EVENT,
ACTION_TYPE_CREATE,
ACTION_TYPE_INSERT,
ACTION_TYPE_REMOVE,
ACTION_TYPE_REMOVE_ATTRIBUTE,
ACTION_TYPE_REMOVE_EVENT,
ACTION_TYPE_SET_ATTRIBUTE,
ACTION_TYPE_SET_TEXT,
CreateAction,
encodeEvent,
encodeTag,
InsertAction,
SetAttributeAction,
UniEventListener,
} from '@dcloudio/uni-shared'
import { createPageNode } from '../../../src/service/framework/dom/Page'
import {
createElement,
createTextNode,
withModifiers,
} from '../../../../uni-app-vue/lib/service.runtime.esm'
import {
InsertAction,
ACTION_TYPE_INSERT,
SetAttributeAction,
ACTION_TYPE_SET_ATTRIBUTE,
ACTION_TYPE_REMOVE_ATTRIBUTE,
ACTION_TYPE_SET_TEXT,
ACTION_TYPE_REMOVE,
CreateAction,
ACTION_TYPE_CREATE,
ACTION_TYPE_ADD_EVENT,
ACTION_TYPE_REMOVE_EVENT,
} from '../../../src/PageAction'
import { EventModifierFlags } from '@dcloudio/uni-shared'
describe('dom', () => {
......
......@@ -986,6 +986,18 @@ var serviceContext = (function (vue) {
}
}
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_EVENT = 20;
function cache(fn) {
const cache = Object.create(null);
return (str) => {
......@@ -8208,18 +8220,6 @@ var serviceContext = (function (vue) {
const INVOKE_VIEW_API = 'invokeViewApi';
const INVOKE_SERVICE_API = 'invokeServiceApi';
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_EVENT = 20;
function onNodeEvent(nodeId, evt, pageNode) {
pageNode.fireEvent(nodeId, evt);
}
......
......@@ -270,6 +270,17 @@
function decodeAttr(name) {
return DECODED_ATTR_MAP[name] || name;
}
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_EVENT = 20;
function cache(fn) {
const cache2 = Object.create(null);
return (str) => {
......@@ -5820,17 +5831,6 @@
});
}
}
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_EVENT = 20;
class UniNode {
constructor(id2, tag, parentNodeId, element) {
this.isMounted = false;
......@@ -14443,9 +14443,14 @@
super(id2, "uni-button", Button, parentNodeId, nodeJson);
}
}
class UniCamera extends UniNode {
constructor(id2) {
super(id2, "uni-camera");
class UniTodoNode extends UniNode {
constructor(id2, tag, parentNodeId) {
super(id2, tag, parentNodeId);
}
}
class UniCamera extends UniTodoNode {
constructor(id2, parentNodeId) {
super(id2, "uni-camera", parentNodeId);
}
}
var canvas = "uni-canvas {\n width: 300px;\n height: 150px;\n display: block;\n position: relative;\n}\n\nuni-canvas > .uni-canvas-canvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n";
......@@ -14873,9 +14878,9 @@
super(id2, "uni-form", Form, parentNodeId, nodeJson, "span");
}
}
class UniFunctionalPageNavigator extends UniNode {
constructor(id2) {
super(id2, "uni-functional-page-navigator");
class UniFunctionalPageNavigator extends UniTodoNode {
constructor(id2, parentNodeId) {
super(id2, "uni-functional-page-navigator", parentNodeId);
}
}
var icon = "uni-icon {\n display: inline-block;\n font-size: 0;\n box-sizing: border-box;\n}\n\nuni-icon[hidden] {\n display: none;\n}\n";
......@@ -14902,14 +14907,14 @@
super(id2, "uni-label", Label, parentNodeId, nodeJson);
}
}
class UniLivePlayer extends UniNode {
constructor(id2) {
super(id2, "uni-live-player");
class UniLivePlayer extends UniTodoNode {
constructor(id2, parentNodeId) {
super(id2, "uni-live-player", parentNodeId);
}
}
class UniLivePusher extends UniNode {
constructor(id2) {
super(id2, "uni-live-pusher");
class UniLivePusher extends UniTodoNode {
constructor(id2, parentNodeId) {
super(id2, "uni-live-pusher", parentNodeId);
}
}
var Map$1 = /* @__PURE__ */ defineBuiltInComponent({
......@@ -14938,14 +14943,14 @@
super(id2, "uni-navigator", Navigator, parentNodeId, nodeJson);
}
}
class UniOfficialAccount extends UniNode {
constructor(id2) {
super(id2, "uni-official-account");
class UniOfficialAccount extends UniTodoNode {
constructor(id2, parentNodeId) {
super(id2, "uni-official-account", parentNodeId);
}
}
class UniOpenData extends UniNode {
constructor(id2) {
super(id2, "uni-open-data");
class UniOpenData extends UniTodoNode {
constructor(id2, parentNodeId) {
super(id2, "uni-open-data", parentNodeId);
}
}
var Picker = /* @__PURE__ */ defineBuiltInComponent({
......
......@@ -7,24 +7,23 @@ import {
formatLog,
UniEvent,
UniNodeJSON,
} from '@dcloudio/uni-shared'
import {
PageCreateAction,
PageCreatedAction,
PageAction,
PageNodeOptions,
ACTION_TYPE_ADD_EVENT,
ACTION_TYPE_CREATE,
ACTION_TYPE_INSERT,
ACTION_TYPE_PAGE_CREATE,
ACTION_TYPE_PAGE_CREATED,
ACTION_TYPE_REMOVE,
ACTION_TYPE_SET_ATTRIBUTE,
ACTION_TYPE_REMOVE_ATTRIBUTE,
ACTION_TYPE_REMOVE_EVENT,
ACTION_TYPE_SET_ATTRIBUTE,
ACTION_TYPE_SET_TEXT,
ACTION_TYPE_PAGE_CREATE,
ACTION_TYPE_PAGE_CREATED,
CreateAction,
ACTION_TYPE_ADD_EVENT,
ACTION_TYPE_REMOVE_EVENT,
} from '../../../PageAction'
PageAction,
PageCreateAction,
PageCreatedAction,
PageNodeOptions,
} from '@dcloudio/uni-shared'
import { VD_SYNC } from '../../../constants'
export default class UniPageNode extends UniNode implements IUniPageNode {
......
import { decodeTag } from '@dcloudio/uni-shared'
import {
CreateAction,
InsertAction,
RemoveAction,
SetAttributeAction,
RemoveAttributeAction,
SetTextAction,
ACTION_TYPE_ADD_EVENT,
ACTION_TYPE_CREATE,
ACTION_TYPE_INSERT,
ACTION_TYPE_PAGE_CREATE,
ACTION_TYPE_PAGE_CREATED,
ACTION_TYPE_REMOVE,
ACTION_TYPE_SET_ATTRIBUTE,
ACTION_TYPE_REMOVE_ATTRIBUTE,
ACTION_TYPE_REMOVE_EVENT,
ACTION_TYPE_SET_ATTRIBUTE,
ACTION_TYPE_SET_TEXT,
AddEventAction,
CreateAction,
decodeTag,
InsertAction,
PageAction,
PageCreateAction,
PageCreatedAction,
ACTION_TYPE_PAGE_CREATE,
ACTION_TYPE_PAGE_CREATED,
AddEventAction,
RemoveAction,
RemoveAttributeAction,
RemoveEventAction,
ACTION_TYPE_ADD_EVENT,
ACTION_TYPE_REMOVE_EVENT,
} from '../../../PageAction'
SetAttributeAction,
SetTextAction,
} from '@dcloudio/uni-shared'
function decodePageCreateAction([, pageCreateData]: PageCreateAction) {
return ['pageCreate', pageCreateData]
......
import { getPageById } from '@dcloudio/uni-core'
import { formatLog } from '@dcloudio/uni-shared'
import { ACTION_TYPE_EVENT, formatLog } from '@dcloudio/uni-shared'
import { ComponentPublicInstance } from 'vue'
import { ACTION_TYPE_EVENT, EventAction } from '../../../PageAction'
import { onNodeEvent } from './onNodeEvent'
import { EventAction, onNodeEvent } from './onNodeEvent'
import UniPageNode from './Page'
export function onVdSync(actions: EventAction[], pageId: string) {
......
import { UniEvent } from '@dcloudio/uni-shared'
import { ACTION_TYPE_EVENT, UniEvent } from '@dcloudio/uni-shared'
import UniPageNode from './Page'
export type EventAction = [
typeof ACTION_TYPE_EVENT,
Parameters<typeof onNodeEvent>[0],
Parameters<typeof onNodeEvent>[1]
]
export function onNodeEvent(
nodeId: number,
evt: UniEvent,
......
import { once } from '@dcloudio/uni-shared'
import { once, PageNodeOptions } from '@dcloudio/uni-shared'
import { createApp, DefineComponent } from 'vue'
import { createPageNode } from '../dom/Page'
import { setupPage } from './setup'
import __vuePlugin from '../plugin'
import { PageNodeOptions } from '../../../PageAction'
export type VuePageComponent = DefineComponent<PageProps>
......
......@@ -4,6 +4,7 @@ import {
formatLog,
NAVBAR_HEIGHT,
ON_REACH_BOTTOM_DISTANCE,
PageNodeOptions,
} from '@dcloudio/uni-shared'
import { initPageInternalInstance } from '@dcloudio/uni-core'
......@@ -11,7 +12,6 @@ import { initEntry } from '../app/initEntry'
import { initRouteOptions } from './routeOptions'
import { createWebview, initWebview } from '../webview'
import { createPage } from './define'
import { PageNodeOptions } from '../../../PageAction'
import { getStatusbarHeight } from '../../../helpers/statusBar'
import tabBar from '../app/tabBar'
import { addCurrentPage } from './getCurrentPages'
......
import { UniNode } from '../elements/UniNode'
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniCamera extends UniNode {
constructor(id: number) {
super(id, 'uni-camera')
export class UniCamera extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-camera', parentNodeId)
}
}
import { UniNode } from '../elements/UniNode'
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniFunctionalPageNavigator extends UniNode {
constructor(id: number) {
super(id, 'uni-functional-page-navigator')
export class UniFunctionalPageNavigator extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-functional-page-navigator', parentNodeId)
}
}
import { UniNode } from '../elements/UniNode'
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniLivePlayer extends UniNode {
constructor(id: number) {
super(id, 'uni-live-player')
export class UniLivePlayer extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-live-player', parentNodeId)
}
}
import { UniNode } from '../elements/UniNode'
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniLivePusher extends UniNode {
constructor(id: number) {
super(id, 'uni-live-pusher')
export class UniLivePusher extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-live-pusher', parentNodeId)
}
}
import { UniNode } from '../elements/UniNode'
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniOfficialAccount extends UniNode {
constructor(id: number) {
super(id, 'uni-official-account')
export class UniOfficialAccount extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-official-account', parentNodeId)
}
}
import { UniNode } from '../elements/UniNode'
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniOpenData extends UniNode {
constructor(id: number) {
super(id, 'uni-open-data')
export class UniOpenData extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-open-data', parentNodeId)
}
}
import { formatLog, UniNodeJSON } from '@dcloudio/uni-shared'
import { UniCustomElement } from '../components'
import { UniElement } from './UniElement'
interface HoverProps {
......
import { UniNode } from '../elements/UniNode'
export class UniTodoNode extends UniNode {
constructor(id: number, tag: string, parentNodeId: number) {
super(id, tag, parentNodeId)
}
}
import {
ACTION_TYPE_ADD_EVENT,
ACTION_TYPE_CREATE,
ACTION_TYPE_INSERT,
PageAction,
ACTION_TYPE_PAGE_CREATE,
ACTION_TYPE_PAGE_CREATED,
ACTION_TYPE_CREATE,
ACTION_TYPE_INSERT,
ACTION_TYPE_REMOVE,
ACTION_TYPE_SET_ATTRIBUTE,
ACTION_TYPE_REMOVE_ATTRIBUTE,
ACTION_TYPE_ADD_EVENT,
ACTION_TYPE_REMOVE_EVENT,
ACTION_TYPE_SET_ATTRIBUTE,
ACTION_TYPE_SET_TEXT,
PageAction,
} from '../../../PageAction'
} from '@dcloudio/uni-shared'
import { $, createElement, onPageCreate, onPageCreated } from './page'
import { flushPostActionJobs } from './scheduler'
......
......@@ -6,9 +6,9 @@ import {
formatLog,
EventModifierFlags,
normalizeEventType,
ACTION_TYPE_EVENT,
} from '@dcloudio/uni-shared'
import { VD_SYNC } from '../../../../constants'
import { ACTION_TYPE_EVENT } from '../../../../PageAction'
import { UniCustomElement } from '../components'
export function patchEvent(el: UniCustomElement, name: string, flag: number) {
......
......@@ -904,6 +904,18 @@ function decodeTag(tag) {
return (DECODED_COMPONENT_ARR[tag] || tag);
}
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_EVENT = 20;
function cache(fn) {
const cache = Object.create(null);
return (str) => {
......@@ -1014,6 +1026,17 @@ function getEnvLocale() {
return (lang && lang.replace(/[.:].*/, '')) || 'en';
}
exports.ACTION_TYPE_ADD_EVENT = ACTION_TYPE_ADD_EVENT;
exports.ACTION_TYPE_CREATE = ACTION_TYPE_CREATE;
exports.ACTION_TYPE_EVENT = ACTION_TYPE_EVENT;
exports.ACTION_TYPE_INSERT = ACTION_TYPE_INSERT;
exports.ACTION_TYPE_PAGE_CREATE = ACTION_TYPE_PAGE_CREATE;
exports.ACTION_TYPE_PAGE_CREATED = ACTION_TYPE_PAGE_CREATED;
exports.ACTION_TYPE_REMOVE = ACTION_TYPE_REMOVE;
exports.ACTION_TYPE_REMOVE_ATTRIBUTE = ACTION_TYPE_REMOVE_ATTRIBUTE;
exports.ACTION_TYPE_REMOVE_EVENT = ACTION_TYPE_REMOVE_EVENT;
exports.ACTION_TYPE_SET_ATTRIBUTE = ACTION_TYPE_SET_ATTRIBUTE;
exports.ACTION_TYPE_SET_TEXT = ACTION_TYPE_SET_TEXT;
exports.BACKGROUND_COLOR = BACKGROUND_COLOR;
exports.BUILT_IN_TAGS = BUILT_IN_TAGS;
exports.COMPONENT_NAME_PREFIX = COMPONENT_NAME_PREFIX;
......
import { FontFaceDescriptors } from 'css-font-loading-module';
export declare const ACTION_TYPE_ADD_EVENT = 8;
export declare const ACTION_TYPE_CREATE = 3;
export declare const ACTION_TYPE_EVENT = 20;
export declare const ACTION_TYPE_INSERT = 4;
export declare const ACTION_TYPE_PAGE_CREATE = 1;
export declare const ACTION_TYPE_PAGE_CREATED = 2;
export declare const ACTION_TYPE_REMOVE = 5;
export declare const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
export declare const ACTION_TYPE_REMOVE_EVENT = 9;
export declare const ACTION_TYPE_SET_ATTRIBUTE = 6;
export declare const ACTION_TYPE_SET_TEXT = 10;
/**
* nodeId
* event
* flag
*/
export declare type AddEventAction = [
typeof ACTION_TYPE_ADD_EVENT,
number,
string,
number
];
export declare function addFont(family: string, source: string, desc?: FontFaceDescriptors): Promise<void>;
export declare const BACKGROUND_COLOR = "#f7f7f7";
......@@ -23,6 +57,20 @@ export declare const COMPONENT_PREFIX: string;
export declare const COMPONENT_SELECTOR_PREFIX = "uni-";
/**
* nodeId
* tag
* parentNodeId
* nodeJson
*/
export declare type CreateAction = [
typeof ACTION_TYPE_CREATE,
number,
string | number,
number,
Partial<UniNodeJSON>?
];
export declare function createRpx2Unit(unit: string, unitRatio: number, unitPrecision: number): (val: string) => string;
export declare const DATA_RE: RegExp;
......@@ -86,6 +134,13 @@ declare interface HTMLElementWithDataset extends HTMLElement {
export declare function initCustomDataset(): void;
/**
* nodeId
* parentNodeId
* refNodeId
*/
export declare type InsertAction = [typeof ACTION_TYPE_INSERT, number, number, number];
export declare const invokeArrayFns: (fns: Function[], arg?: any) => any;
export declare function isBuiltInComponent(tag: string): boolean;
......@@ -146,6 +201,34 @@ declare interface Options {
complete?: (res: any) => void;
}
export declare type PageAction = PageCreateAction | PageCreatedAction | PageUpdateAction;
export declare type PageCreateAction = [typeof ACTION_TYPE_PAGE_CREATE, PageCreateData];
export declare type PageCreatedAction = [typeof ACTION_TYPE_PAGE_CREATED];
export declare interface PageCreateData extends PageNodeOptions {
}
export declare interface PageNodeOptions {
css: boolean;
route: string;
version: number;
locale: string;
platform: string;
pixelRatio: number;
windowWidth: number;
disableScroll: boolean;
onPageScroll: boolean;
onPageReachBottom: boolean;
onReachBottomDistance: number;
statusbarHeight: number;
windowTop: number;
windowBottom: number;
}
export declare type PageUpdateAction = CreateAction | InsertAction | RemoveAction | AddEventAction | RemoveEventAction | SetAttributeAction | RemoveAttributeAction | SetTextAction;
export declare function parseEventName(name: string): [string, EventListenerOptions | undefined];
/**
......@@ -172,6 +255,31 @@ export declare function plusReady(callback: () => void): void;
export declare const PRIMARY_COLOR = "#007aff";
/**
* nodeId
*/
export declare type RemoveAction = [typeof ACTION_TYPE_REMOVE, number];
/**
* nodeId
* name
*/
export declare type RemoveAttributeAction = [
typeof ACTION_TYPE_REMOVE_ATTRIBUTE,
number,
string
];
/**
* nodeId
* event
*/
export declare type RemoveEventAction = [
typeof ACTION_TYPE_REMOVE_EVENT,
number,
string
];
export declare function removeLeadingSlash(str: string): string;
export declare const RESPONSIVE_MIN_WIDTH = 768;
......@@ -187,6 +295,24 @@ export { scrollTo_2 as scrollTo }
export declare const SELECTED_COLOR = "#0062cc";
/**
* nodeId
* name
* value
*/
export declare type SetAttributeAction = [
typeof ACTION_TYPE_SET_ATTRIBUTE,
number,
string,
unknown
];
/**
* nodeId
* text
*/
export declare type SetTextAction = [typeof ACTION_TYPE_SET_TEXT, number, string];
export declare function stringifyQuery(obj?: Record<string, any>, encodeStr?: typeof encodeURIComponent): string;
export declare const TABBAR_HEIGHT = 50;
......
......@@ -900,6 +900,18 @@ function decodeTag(tag) {
return (DECODED_COMPONENT_ARR[tag] || tag);
}
const ACTION_TYPE_PAGE_CREATE = 1;
const ACTION_TYPE_PAGE_CREATED = 2;
const ACTION_TYPE_CREATE = 3;
const ACTION_TYPE_INSERT = 4;
const ACTION_TYPE_REMOVE = 5;
const ACTION_TYPE_SET_ATTRIBUTE = 6;
const ACTION_TYPE_REMOVE_ATTRIBUTE = 7;
const ACTION_TYPE_ADD_EVENT = 8;
const ACTION_TYPE_REMOVE_EVENT = 9;
const ACTION_TYPE_SET_TEXT = 10;
const ACTION_TYPE_EVENT = 20;
function cache(fn) {
const cache = Object.create(null);
return (str) => {
......@@ -1010,4 +1022,4 @@ function getEnvLocale() {
return (lang && lang.replace(/[.:].*/, '')) || 'en';
}
export { BACKGROUND_COLOR, BUILT_IN_TAGS, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, EventModifierFlags, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, ON_REACH_BOTTOM_DISTANCE, PLUS_RE, PRIMARY_COLOR, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, addFont, cache, cacheStringFunction, callOptions, createRpx2Unit, debounce, decode, decodeAttr, decodeEvent, decodeTag, decodedQuery, defaultRpx2Unit, encodeAttr, encodeEvent, encodeTag, formatDateTime, formatLog, getCustomDataset, getEnvLocale, getLen, initCustomDataset, invokeArrayFns, isBuiltInComponent, isCustomElement, isNativeTag, isServiceCustomElement, isServiceNativeTag, normalizeDataset, normalizeEventType, normalizeTarget, once, parseEventName, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, sanitise, scrollTo, stringifyQuery, updateElementStyle };
export { ACTION_TYPE_ADD_EVENT, ACTION_TYPE_CREATE, ACTION_TYPE_EVENT, ACTION_TYPE_INSERT, ACTION_TYPE_PAGE_CREATE, ACTION_TYPE_PAGE_CREATED, ACTION_TYPE_REMOVE, ACTION_TYPE_REMOVE_ATTRIBUTE, ACTION_TYPE_REMOVE_EVENT, ACTION_TYPE_SET_ATTRIBUTE, ACTION_TYPE_SET_TEXT, BACKGROUND_COLOR, BUILT_IN_TAGS, COMPONENT_NAME_PREFIX, COMPONENT_PREFIX, COMPONENT_SELECTOR_PREFIX, DATA_RE, EventModifierFlags, NAVBAR_HEIGHT, NODE_TYPE_COMMENT, NODE_TYPE_ELEMENT, NODE_TYPE_PAGE, NODE_TYPE_TEXT, ON_REACH_BOTTOM_DISTANCE, PLUS_RE, PRIMARY_COLOR, RESPONSIVE_MIN_WIDTH, SCHEME_RE, SELECTED_COLOR, TABBAR_HEIGHT, TAGS, UNI_SSR, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR_STORE, UNI_SSR_TITLE, UniBaseNode, UniCommentNode, UniElement, UniEvent, UniInputElement, UniNode, UniTextAreaElement, UniTextNode, WEB_INVOKE_APPSERVICE, addFont, cache, cacheStringFunction, callOptions, createRpx2Unit, debounce, decode, decodeAttr, decodeEvent, decodeTag, decodedQuery, defaultRpx2Unit, encodeAttr, encodeEvent, encodeTag, formatDateTime, formatLog, getCustomDataset, getEnvLocale, getLen, initCustomDataset, invokeArrayFns, isBuiltInComponent, isCustomElement, isNativeTag, isServiceCustomElement, isServiceNativeTag, normalizeDataset, normalizeEventType, normalizeTarget, once, parseEventName, parseQuery, parseUrl, passive, plusReady, removeLeadingSlash, sanitise, scrollTo, stringifyQuery, updateElementStyle };
import { onNodeEvent } from './service/framework/dom/onNodeEvent'
import { createElement } from './view/framework/dom/page'
import { UniElement } from './view/framework/dom/elements/UniElement'
import { UniNodeJSON } from './Node'
export const ACTION_TYPE_PAGE_CREATE = 1
export const ACTION_TYPE_PAGE_CREATED = 2
......@@ -37,53 +35,81 @@ export interface PageCreateData extends PageNodeOptions {}
export type PageCreateAction = [typeof ACTION_TYPE_PAGE_CREATE, PageCreateData]
export type PageCreatedAction = [typeof ACTION_TYPE_PAGE_CREATED]
export type EventAction = [
typeof ACTION_TYPE_EVENT,
Parameters<typeof onNodeEvent>[0],
Parameters<typeof onNodeEvent>[1]
]
/**
* nodeId
* tag
* parentNodeId
* nodeJson
*/
export type CreateAction = [
typeof ACTION_TYPE_CREATE,
...Parameters<typeof createElement>
]
type NodeAction<T extends Parameters<any>> = [/* nodeId */ number, ...T]
export type InsertAction = [
typeof ACTION_TYPE_INSERT,
...NodeAction<Parameters<UniElement<any>['insert']>>
]
export type RemoveAction = [
typeof ACTION_TYPE_REMOVE,
...NodeAction<Parameters<UniElement<any>['remove']>>
number,
string | number,
number,
Partial<UniNodeJSON>?
]
/**
* nodeId
* parentNodeId
* refNodeId
*/
export type InsertAction = [typeof ACTION_TYPE_INSERT, number, number, number]
/**
* nodeId
*/
export type RemoveAction = [typeof ACTION_TYPE_REMOVE, number]
/**
* nodeId
* event
* flag
*/
export type AddEventAction = [
typeof ACTION_TYPE_ADD_EVENT,
...NodeAction<Parameters<UniElement<any>['addEvent']>>
number,
string,
number
]
/**
* nodeId
* event
*/
export type RemoveEventAction = [
typeof ACTION_TYPE_REMOVE_EVENT,
...NodeAction<Parameters<UniElement<any>['removeEvent']>>
number,
string
]
/**
* nodeId
* name
* value
*/
export type SetAttributeAction = [
typeof ACTION_TYPE_SET_ATTRIBUTE,
...NodeAction<Parameters<UniElement<any>['setAttr']>>
number,
string,
unknown
]
/**
* nodeId
* name
*/
export type RemoveAttributeAction = [
typeof ACTION_TYPE_REMOVE_ATTRIBUTE,
...NodeAction<Parameters<UniElement<any>['removeAttr']>>
number,
string
]
export type SetTextAction = [
typeof ACTION_TYPE_SET_TEXT,
...NodeAction<Parameters<UniElement<any>['setText']>>
]
/**
* nodeId
* text
*/
export type SetTextAction = [typeof ACTION_TYPE_SET_TEXT, number, string]
export type PageUpdateAction =
| CreateAction
......
export const ACTION_MINIFY = true
......@@ -20,3 +20,4 @@ export { UniTextNode } from './Text'
export { encodeAttr, encodeEvent, encodeTag } from './encode'
export { decodeAttr, decodeEvent, decodeTag } from './decode'
export { EventModifierFlags } from './encode'
export * from './Action'
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册