提交 5ec7a426 编写于 作者: fxy060608's avatar fxy060608

refactor(app): vdom

上级 2dbb687e
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`dom minify = true 1`] = `"[[0,[\\"VIEW\\",\\"id\\",\\"view\\",\\"hidden\\",true]],[3,3,0,0,{\\"a\\":[[1,2]]}],[4,3,0,-1],[6,3,3,4]]"`;
exports[`dom minify = true 1`] = `"[[0,[\\"VIEW\\",\\"id\\",\\"view\\",\\"hidden\\",true]],[3,3,0,0,-1,{\\"a\\":[[1,2]]}],[6,3,3,4]]"`;
exports[`dom minify = true 2`] = `"[[0,[\\"VIEW\\",\\"id\\",\\"view\\",\\"hidden\\",true]],[\\"create\\",3,\\"VIEW\\",0,{\\"a\\":{\\"id\\":\\"view\\"}}],[\\"insert\\",3,0,-1],[\\"setAttr\\",3,\\"hidden\\",true]]"`;
exports[`dom minify = true 2`] = `"[[0,[\\"VIEW\\",\\"id\\",\\"view\\",\\"hidden\\",true]],[\\"create\\",3,\\"VIEW\\",0,-1,{\\"a\\":{\\"id\\":\\"view\\"}}],[\\"setAttr\\",3,\\"hidden\\",true]]"`;
exports[`dom minify = true 3`] = `"[[0,[\\"hidden\\"]],[7,3,0]]"`;
......@@ -16,9 +16,9 @@ exports[`dom minify = true 7`] = `"[[0,[]],[5,3]]"`;
exports[`dom minify = true 8`] = `"[[0,[]],[\\"remove\\",3]]"`;
exports[`dom minify = true 9`] = `"[[0,[\\"#text\\",\\"hello\\"]],[3,4,0,0,{\\"t\\":1}],[4,4,0,-1]]"`;
exports[`dom minify = true 9`] = `"[[0,[\\"#text\\",\\"hello\\"]],[3,4,0,0,-1,{\\"t\\":1}]]"`;
exports[`dom minify = true 10`] = `"[[0,[\\"#text\\",\\"hello\\"]],[\\"create\\",4,\\"#text\\",0,{\\"t\\":\\"hello\\"}],[\\"insert\\",4,0,-1]]"`;
exports[`dom minify = true 10`] = `"[[0,[\\"#text\\",\\"hello\\"]],[\\"create\\",4,\\"#text\\",0,-1,{\\"t\\":\\"hello\\"}]]"`;
exports[`dom minify = true 11`] = `"[[0,[\\"onClick\\"]],[8,4,0,0]]"`;
......
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,
InsertAction,
SetAttributeAction,
UniEventListener,
EventModifierFlags,
......@@ -57,14 +55,15 @@ describe('dom', () => {
expect(createElementAction[1]).toBe(1)
expect(createElementAction[2]).toBe('VIEW')
expect(createElementAction[3]).toBe(0)
expect((createElementAction[4]!.a as any).id).toBe('view')
const addElementAction = updateActions[1] as InsertAction
expect(addElementAction[0]).toBe(ACTION_TYPE_INSERT)
expect(addElementAction[1]).toBe(1) // nodeId
expect(addElementAction[2]).toBe(0) // parentNodeId
expect(addElementAction[3]).toBe(-1) // index
const setAttributeAction = updateActions[2] as SetAttributeAction
expect(createElementAction[4]).toBe(-1)
expect((createElementAction[5]!.a as any).id).toBe('view')
// const addElementAction = updateActions[1] as InsertAction
// expect(addElementAction[0]).toBe(ACTION_TYPE_INSERT)
// expect(addElementAction[1]).toBe(1) // nodeId
// expect(addElementAction[2]).toBe(0) // parentNodeId
// expect(addElementAction[3]).toBe(-1) // index
const setAttributeAction = updateActions[1] as SetAttributeAction
expect(setAttributeAction[0]).toBe(ACTION_TYPE_SET_ATTRIBUTE)
expect(setAttributeAction[1]).toBe(1)
expect(setAttributeAction[2]).toBe('hidden')
......@@ -100,12 +99,13 @@ describe('dom', () => {
const textNode = createTextNode('hello', { pageNode: root })
root.appendChild(textNode)
const {
updateActions: [, addTextNodeAction],
updateActions: [addTextNodeAction],
} = root
expect(addTextNodeAction[0]).toBe(ACTION_TYPE_INSERT)
expect(addTextNodeAction[0]).toBe(ACTION_TYPE_CREATE)
expect(addTextNodeAction[1]).toBe(2)
expect(addTextNodeAction[2]).toBe(0)
expect(addTextNodeAction[3]).toBe(-1)
expect(addTextNodeAction[2]).toBe('#text')
expect(addTextNodeAction[3]).toBe(0)
expect(addTextNodeAction[4]).toBe(-1)
root.updateActions.length = 0
const clickFn = () => {}
......
......@@ -95,12 +95,13 @@
}
return nodeJson;
}
function decodeCreateAction([, nodeId, nodeName, parentNodeId, nodeJson], getDict) {
function decodeCreateAction([, nodeId, nodeName, parentNodeId, refNodeId, nodeJson], getDict) {
return [
'create',
nodeId,
getDict(nodeName),
parentNodeId,
refNodeId,
decodeNodeJson(getDict, nodeJson),
];
}
......
......@@ -625,7 +625,7 @@ var serviceContext = (function (vue) {
}
return req;
}),
}, callback, page.$page.id);
}, page.$page.id, callback);
}
function formatLog(module, ...args) {
......@@ -1802,10 +1802,10 @@ var serviceContext = (function (vue) {
function publishViewMethodName() {
return getCurrentPageId() + '.' + INVOKE_VIEW_API;
}
const invokeViewMethod = (name, args, callback, pageId) => {
const invokeViewMethod = (name, args, pageId, callback) => {
const { subscribe, publishHandler } = UniServiceJSBridge;
const id = invokeViewMethodId++;
subscribe(INVOKE_VIEW_API + '.' + id, callback, true);
callback && subscribe(INVOKE_VIEW_API + '.' + id, callback, true);
publishHandler(publishViewMethodName(), { id, name, args }, pageId);
};
const invokeViewMethodKeepAlive = (name, args, callback, pageId) => {
......@@ -2427,20 +2427,16 @@ var serviceContext = (function (vue) {
//#endregion
//#region UniServiceJSBridge
const canvasEventCallbacks = createCallbacks('canvasEvent');
const onCanvasMethodCallback = /*#__PURE__*/ once(() => {
UniServiceJSBridge.subscribe('onCanvasMethodCallback', ({ callbackId, data }) => {
function operateCanvas(canvasId, pageId, type, data) {
UniServiceJSBridge.invokeViewMethod(`canvas.${canvasId}`, {
type,
data,
}, pageId, ({ callbackId, data }) => {
const callback = canvasEventCallbacks.pop(callbackId);
if (callback) {
callback(data);
}
});
});
function operateCanvas(canvasId, pageId, type, data) {
UniServiceJSBridge.publishHandler('canvas.' + canvasId, {
canvasId,
type,
data,
}, pageId);
}
//#endregion
//#region methods
......@@ -3271,7 +3267,7 @@ var serviceContext = (function (vue) {
}
}, CreateCanvasContextProtocol);
const canvasGetImageData = defineAsyncApi(API_CANVAS_GET_IMAGE_DATA, ({ canvasId, x, y, width, height }, { resolve, reject }) => {
onCanvasMethodCallback();
// onCanvasMethodCallback()
const pageId = getPageIdByVm(getCurrentPageVm());
if (!pageId) {
reject();
......@@ -3301,7 +3297,7 @@ var serviceContext = (function (vue) {
});
}, CanvasGetImageDataProtocol, CanvasGetImageDataOptions);
const canvasPutImageData = defineAsyncApi(API_CANVAS_PUT_IMAGE_DATA, ({ canvasId, data, x, y, width, height }, { resolve, reject }) => {
onCanvasMethodCallback();
// onCanvasMethodCallback()
var pageId = getPageIdByVm(getCurrentPageVm());
if (!pageId) {
reject();
......@@ -3335,7 +3331,7 @@ var serviceContext = (function (vue) {
operate();
}, CanvasPutImageDataProtocol, CanvasPutImageDataOptions);
const canvasToTempFilePath = defineAsyncApi(API_CANVAS_TO_TEMP_FILE_PATH, ({ x = 0, y = 0, width, height, destWidth, destHeight, canvasId, fileType, quality, }, { resolve, reject }) => {
onCanvasMethodCallback();
// onCanvasMethodCallback()
var pageId = getPageIdByVm(getCurrentPageVm());
if (!pageId) {
reject();
......@@ -3501,12 +3497,12 @@ var serviceContext = (function (vue) {
UniServiceJSBridge.invokeViewMethod(`editor.${componentId}`, {
type,
data,
}, ({ callbackId, data }) => {
}, pageId, ({ callbackId, data }) => {
if (needCallOptions) {
callOptions(optionsCache[callbackId], data);
delete optionsCache[callbackId];
}
}, pageId);
});
}
class EditorContext {
id;
......@@ -3853,7 +3849,7 @@ var serviceContext = (function (vue) {
const API_GET_SELECTED_TEXT_RANGE = 'getSelectedTextRange';
const getSelectedTextRange = defineAsyncApi(API_GET_SELECTED_TEXT_RANGE, (_, { resolve, reject }) => {
UniServiceJSBridge.invokeViewMethod('getSelectedTextRange', {}, (res) => {
UniServiceJSBridge.invokeViewMethod('getSelectedTextRange', {}, getCurrentPageId(), (res) => {
if (typeof res.end === 'undefined' &&
typeof res.start === 'undefined') {
reject('no focused');
......@@ -3861,7 +3857,7 @@ var serviceContext = (function (vue) {
else {
resolve(res);
}
}, getCurrentPageId());
});
});
const API_GET_BACKGROUND_AUDIO_MANAGER = 'getBackgroundAudioManager';
......@@ -10046,8 +10042,9 @@ var serviceContext = (function (vue) {
const createAction = this._createActionMap.get(action[1]);
if (createAction) {
createAction[3] = action[2]; // parentNodeId
createAction[4] = action[3]; // anchorId
if (extras) {
createAction[4] = extras;
createAction[5] = extras;
}
}
else {
......@@ -10057,7 +10054,10 @@ var serviceContext = (function (vue) {
}
break;
}
this.updateActions.push(action);
// insert 被合并进 create
if (action[0] !== ACTION_TYPE_INSERT) {
this.updateActions.push(action);
}
vue.queuePostFlushCb(this._update);
}
restore() {
......@@ -10115,7 +10115,13 @@ var serviceContext = (function (vue) {
return null;
}
function pushCreateAction(pageNode, nodeId, nodeName) {
pageNode.push([ACTION_TYPE_CREATE, nodeId, pageNode.addDict(nodeName), -1]);
pageNode.push([
ACTION_TYPE_CREATE,
nodeId,
pageNode.addDict(nodeName),
-1,
-1,
]);
}
function pushInsertAction(pageNode, newChild, parentNodeId, refChildId) {
const nodeJson = newChild.toJSON({
......
......@@ -175,8 +175,9 @@ export default class UniPageNode extends UniNode implements IUniPageNode {
const createAction = this._createActionMap.get(action[1])
if (createAction) {
createAction[3] = action[2] // parentNodeId
createAction[4] = action[3] // anchorId
if (extras) {
createAction[4] = extras as UniNodeJSON
createAction[5] = extras as UniNodeJSON
}
} else {
if (__DEV__) {
......@@ -185,7 +186,10 @@ export default class UniPageNode extends UniNode implements IUniPageNode {
}
break
}
this.updateActions.push(action)
// insert 被合并进 create
if (action[0] !== ACTION_TYPE_INSERT) {
this.updateActions.push(action)
}
queuePostFlushCb(this._update)
}
restore() {
......@@ -255,7 +259,13 @@ function pushCreateAction(
nodeId: number,
nodeName: string | number
) {
pageNode.push([ACTION_TYPE_CREATE, nodeId, pageNode.addDict(nodeName), -1])
pageNode.push([
ACTION_TYPE_CREATE,
nodeId,
pageNode.addDict(nodeName),
-1,
-1,
])
}
function pushInsertAction(
......
......@@ -7,8 +7,9 @@ export class UniAd extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-ad', Ad, parentNodeId, nodeJson)
super(id, 'uni-ad', Ad, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniAudio extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-audio', Audio, parentNodeId, nodeJson)
super(id, 'uni-audio', Audio, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniButton extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-button', Button, parentNodeId, nodeJson)
super(id, 'uni-button', Button, parentNodeId, refNodeId, nodeJson)
}
}
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniCamera extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-camera', parentNodeId)
constructor(id: number, parentNodeId: number, refNodeId: number) {
super(id, 'uni-camera', parentNodeId, refNodeId)
}
}
......@@ -7,8 +7,17 @@ export class UniCanvas extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-canvas', Canvas, parentNodeId, nodeJson, 'canvas > div')
super(
id,
'uni-canvas',
Canvas,
parentNodeId,
refNodeId,
nodeJson,
'canvas > div'
)
}
}
......@@ -7,6 +7,7 @@ export class UniCheckbox extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(
......@@ -14,6 +15,7 @@ export class UniCheckbox extends UniComponent {
'uni-checkbox',
Checkbox,
parentNodeId,
refNodeId,
nodeJson,
'.uni-checkbox-wrapper'
)
......
......@@ -7,8 +7,16 @@ export class UniCheckboxGroup extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-checkbox-group', CheckboxGroup, parentNodeId, nodeJson)
super(
id,
'uni-checkbox-group',
CheckboxGroup,
parentNodeId,
refNodeId,
nodeJson
)
}
}
import { hasOwn } from '@vue/shared'
import { Component, ComponentInternalInstance, createApp, reactive } from 'vue'
import {
App,
Component,
ComponentInternalInstance,
createApp,
reactive,
// @ts-expect-error
flushPostFlushCbs,
} from 'vue'
import { formatLog, parseEventName, UniNodeJSON } from '@dcloudio/uni-shared'
import { UniNode } from '../elements/UniNode'
import { createInvoker } from '../modules/events'
import { createWrapper, UniCustomElement } from '.'
import { $ } from '../page'
import { $, removeElement } from '../page'
import { queuePostActionJob } from '../scheduler'
export class UniComponent extends UniNode {
declare $: UniCustomElement
protected $props!: Record<string, any>
$holder?: Element
$app!: App
constructor(
id: number,
tag: string,
component: Component,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>,
selector?: string
) {
......@@ -23,7 +34,8 @@ export class UniComponent extends UniNode {
;(container as any).__vueParent = getVueParent(this)
this.$props = reactive({})
this.init(nodeJson)
createApp(createWrapper(component, this.$props)).mount(container)
this.$app = createApp(createWrapper(component, this.$props))
this.$app.mount(container)
this.$ = container.firstElementChild! as UniCustomElement
if (selector) {
this.$holder = this.$.querySelector(selector)!
......@@ -36,6 +48,9 @@ export class UniComponent extends UniNode {
if (hasOwn(nodeJson, 't')) {
this.setText(nodeJson.t || '')
}
this.insert(parentNodeId, refNodeId)
// 延迟到insert之后,再flush,确保mounted等生命周期触发正常
flushPostFlushCbs()
}
init(nodeJson: Partial<UniNodeJSON>) {
const { a, e } = nodeJson
......@@ -70,6 +85,12 @@ export class UniComponent extends UniNode {
removeAttr(name: string) {
this.$props[name] = null
}
remove() {
this.isUnmounted = true
this.$app.unmount()
removeElement(this.id)
}
appendChild(node: Element) {
return (this.$holder || this.$).appendChild(node)
}
......@@ -79,33 +100,40 @@ export class UniComponent extends UniNode {
}
export class UniContainerComponent extends UniComponent {
private _rebuild!: Function
constructor(
id: number,
tag: string,
component: Component,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>,
selector?: string
) {
super(id, tag, component, parentNodeId, nodeJson, selector)
this.initObserver()
super(id, tag, component, parentNodeId, refNodeId, nodeJson, selector)
this._rebuild = this.rebuild.bind(this)
}
initObserver() {
const elem = this.$holder || this.$
const observer = new MutationObserver((mutations) => {
if (__DEV__) {
console.log(formatLog('Observer', mutations))
}
// TODO 刷新容器组件状态
const vm = this.$.__vueParentComponent
if ((vm as any).rebuild) {
;(vm as any).rebuild()
}
})
observer.observe(elem, {
childList: true,
subtree: true,
})
setText(text: string) {
queuePostActionJob(this._rebuild)
return super.setText(text)
}
appendChild(node: Element) {
queuePostActionJob(this._rebuild)
return super.appendChild(node)
}
insertBefore(newChild: Node, refChild: Node) {
queuePostActionJob(this._rebuild)
return super.insertBefore(newChild, refChild)
}
rebuild() {
// 刷新容器组件状态
if (__DEV__) {
console.log(formatLog('rebuild', this.id, this.tag))
}
const vm = this.$.__vueParentComponent
if ((vm as any).rebuild) {
;(vm as any).rebuild()
}
}
}
......
......@@ -7,8 +7,9 @@ export class UniCoverImage extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-cover-image', CoverImage, parentNodeId, nodeJson)
super(id, 'uni-cover-image', CoverImage, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniCoverView extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-cover-view', CoverView, parentNodeId, nodeJson)
super(id, 'uni-cover-view', CoverView, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniEditor extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-editor', Editor, parentNodeId, nodeJson)
super(id, 'uni-editor', Editor, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniForm extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-form', Form, parentNodeId, nodeJson, 'span')
super(id, 'uni-form', Form, parentNodeId, refNodeId, nodeJson, 'span')
}
}
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniFunctionalPageNavigator extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-functional-page-navigator', parentNodeId)
constructor(id: number, parentNodeId: number, refNodeId: number) {
super(id, 'uni-functional-page-navigator', parentNodeId, refNodeId)
}
}
......@@ -8,8 +8,9 @@ export class UniIcon extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-icon', Icon, parentNodeId, nodeJson)
super(id, 'uni-icon', Icon, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniImage extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-image', Image, parentNodeId, nodeJson)
super(id, 'uni-image', Image, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniInput extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-input', Input, parentNodeId, nodeJson)
super(id, 'uni-input', Input, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniLabel extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-label', Label, parentNodeId, nodeJson)
super(id, 'uni-label', Label, parentNodeId, refNodeId, nodeJson)
}
}
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniLivePlayer extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-live-player', parentNodeId)
constructor(id: number, parentNodeId: number, refNodeId: number) {
super(id, 'uni-live-player', parentNodeId, refNodeId)
}
}
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniLivePusher extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-live-pusher', parentNodeId)
constructor(id: number, parentNodeId: number, refNodeId: number) {
super(id, 'uni-live-pusher', parentNodeId, refNodeId)
}
}
......@@ -7,8 +7,9 @@ export class UniMap extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-map', Map, parentNodeId, nodeJson)
super(id, 'uni-map', Map, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,16 @@ export class UniMovableArea extends UniContainerComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-movable-area', MovableArea, parentNodeId, nodeJson)
super(
id,
'uni-movable-area',
MovableArea,
parentNodeId,
refNodeId,
nodeJson
)
}
}
......@@ -7,8 +7,16 @@ export class UniMovableView extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-movable-view', MovableView, parentNodeId, nodeJson)
super(
id,
'uni-movable-view',
MovableView,
parentNodeId,
refNodeId,
nodeJson
)
}
}
......@@ -7,8 +7,9 @@ export class UniNavigator extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-navigator', Navigator, parentNodeId, nodeJson)
super(id, 'uni-navigator', Navigator, parentNodeId, refNodeId, nodeJson)
}
}
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniOfficialAccount extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-official-account', parentNodeId)
constructor(id: number, parentNodeId: number, refNodeId: number) {
super(id, 'uni-official-account', parentNodeId, refNodeId)
}
}
import { UniTodoNode } from '../elements/UniTodoNode'
export class UniOpenData extends UniTodoNode {
constructor(id: number, parentNodeId: number) {
super(id, 'uni-open-data', parentNodeId)
constructor(id: number, parentNodeId: number, refNodeId: number) {
super(id, 'uni-open-data', parentNodeId, refNodeId)
}
}
......@@ -6,8 +6,9 @@ export class UniPicker extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-picker', Picker, parentNodeId, nodeJson)
super(id, 'uni-picker', Picker, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,6 +7,7 @@ export class UniPickerView extends UniContainerComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(
......@@ -14,6 +15,7 @@ export class UniPickerView extends UniContainerComponent {
'uni-picker-view',
PickerView,
parentNodeId,
refNodeId,
nodeJson,
'.uni-picker-view-wrapper'
)
......
......@@ -7,6 +7,7 @@ export class UniPickerViewColumn extends UniContainerComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(
......@@ -14,6 +15,7 @@ export class UniPickerViewColumn extends UniContainerComponent {
'uni-picker-view-column',
PickerViewColumn,
parentNodeId,
refNodeId,
nodeJson,
'.uni-picker-view-content'
)
......
......@@ -7,8 +7,9 @@ export class UniProgress extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-progress', Progress, parentNodeId, nodeJson)
super(id, 'uni-progress', Progress, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,9 +7,18 @@ export class UniRadio extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-radio', Radio, parentNodeId, nodeJson, '.uni-radio-wrapper')
super(
id,
'uni-radio',
Radio,
parentNodeId,
refNodeId,
nodeJson,
'.uni-radio-wrapper'
)
}
setText(text: string) {
setHolderText(this.$holder!, 'uni-radio-input', text)
......
......@@ -7,8 +7,9 @@ export class UniRadioGroup extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-radio-group', RadioGroup, parentNodeId, nodeJson)
super(id, 'uni-radio-group', RadioGroup, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniRichText extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-rich-text', RichText, parentNodeId, nodeJson)
super(id, 'uni-rich-text', RichText, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,6 +7,7 @@ export class UniScrollView extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(
......@@ -14,6 +15,7 @@ export class UniScrollView extends UniComponent {
'uni-scroll-view',
ScrollView,
parentNodeId,
refNodeId,
nodeJson,
'.uni-scroll-view-content'
)
......
......@@ -7,8 +7,9 @@ export class UniSlider extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-slider', Slider, parentNodeId, nodeJson)
super(id, 'uni-slider', Slider, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,6 +7,7 @@ export class UniSwiper extends UniContainerComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(
......@@ -14,6 +15,7 @@ export class UniSwiper extends UniContainerComponent {
'uni-swiper',
Swiper,
parentNodeId,
refNodeId,
nodeJson,
'.uni-swiper-slide-frame'
)
......
......@@ -7,8 +7,9 @@ export class UniSwiperItem extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-swiper-item', SwiperItem, parentNodeId, nodeJson)
super(id, 'uni-swiper-item', SwiperItem, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniSwitch extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-switch', Switch, parentNodeId, nodeJson)
super(id, 'uni-switch', Switch, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniTextarea extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-textarea', Textarea, parentNodeId, nodeJson)
super(id, 'uni-textarea', Textarea, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -8,8 +8,9 @@ export class UniVideo extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-video', Video, parentNodeId, nodeJson)
super(id, 'uni-video', Video, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -7,8 +7,9 @@ export class UniWebView extends UniComponent {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, 'uni-web-view', WebView, parentNodeId, nodeJson)
super(id, 'uni-web-view', WebView, parentNodeId, refNodeId, nodeJson)
}
}
......@@ -131,7 +131,7 @@ export function decodeNodeJson(
}
function decodeCreateAction(
[, nodeId, nodeName, parentNodeId, nodeJson]: CreateAction,
[, nodeId, nodeName, parentNodeId, refNodeId, nodeJson]: CreateAction,
getDict: GetDict
) {
return [
......@@ -139,6 +139,7 @@ function decodeCreateAction(
nodeId,
getDict(nodeName as number),
parentNodeId,
refNodeId,
decodeNodeJson(getDict, nodeJson as UniNodeJSONMinify),
]
}
......
import { UniNode } from './UniNode'
export class UniComment extends UniNode {
constructor(id: number, parentNodeId: number) {
constructor(id: number, parentNodeId: number, refNodeId: number) {
super(id, '#comment', parentNodeId, document.createComment(''))
this.insert(parentNodeId, refNodeId)
}
}
......@@ -17,6 +17,7 @@ export class UniElement<T extends object> extends UniNode {
id: number,
element: Element,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>,
propNames: string[] = []
) {
......@@ -26,6 +27,7 @@ export class UniElement<T extends object> extends UniNode {
this.$propNames = propNames
this._update = this.update.bind(this)
this.init(nodeJson)
this.insert(parentNodeId, refNodeId)
}
init(nodeJson: Partial<UniNodeJSON>) {
if (hasOwn(nodeJson, 'a')) {
......
......@@ -19,10 +19,11 @@ export class UniHoverElement extends UniElement<HoverProps> {
id: number,
element: Element,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>,
propNames: string[] = []
) {
super(id, element, parentNodeId, nodeJson, [
super(id, element, parentNodeId, refNodeId, nodeJson, [
...PROP_NAMES_HOVER,
...propNames,
])
......@@ -51,8 +52,8 @@ class Hover {
private _hovering: boolean = false
private _hoverTouch: boolean = false
private _hoverStartTimer: number = 0
private _hoverStayTimer: number = 0
private _hoverStartTimer?: ReturnType<typeof setTimeout>
private _hoverStayTimer?: ReturnType<typeof setTimeout>
private __hoverTouchStart!: (evt: Event) => void
private __hoverTouchEnd!: (evt?: Event) => void
......@@ -143,7 +144,7 @@ class Hover {
}
_hoverReset() {
requestAnimationFrame(() => {
clearTimeout(this._hoverStayTimer)
clearTimeout(this._hoverStayTimer!)
this._hoverStayTimer = setTimeout(() => {
this.hovering = false
}, this.props['hover-stay-time'])
......@@ -152,6 +153,6 @@ class Hover {
_hoverTouchCancel() {
this._hoverTouch = false
this.hovering = false
clearTimeout(this._hoverStartTimer)
clearTimeout(this._hoverStartTimer!)
}
}
......@@ -44,7 +44,7 @@ export class UniNode {
remove() {
const { $ } = this
$.parentNode!.removeChild($)
this.isUnmounted = false
this.isUnmounted = true
removeElement(this.id)
}
appendChild(node: Node) {
......
import '@dcloudio/uni-components/style/text.css'
import { DecodeOptions, parseText } from '@dcloudio/uni-components'
import { UniElement } from './UniElement'
import { formatLog, UniNodeJSON } from '@dcloudio/uni-shared'
import { UniNodeJSON } from '@dcloudio/uni-shared'
interface TextProps {
space: DecodeOptions['space']
......@@ -16,12 +16,14 @@ export class UniTextElement extends UniElement<TextProps> {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(
id,
document.createElement('uni-text'),
parentNodeId,
refNodeId,
nodeJson,
PROP_NAMES_HOVER
)
......
......@@ -5,9 +5,11 @@ export class UniTextNode extends UniNode {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, '#text', parentNodeId, document.createTextNode(''))
this.init(nodeJson)
this.insert(parentNodeId, refNodeId)
}
}
import { UniNode } from '../elements/UniNode'
export class UniTodoNode extends UniNode {
constructor(id: number, tag: string, parentNodeId: number) {
constructor(
id: number,
tag: string,
parentNodeId: number,
refNodeId: number
) {
super(id, tag, parentNodeId)
this.insert(parentNodeId, refNodeId)
}
}
......@@ -5,8 +5,15 @@ export class UniViewElement extends UniHoverElement {
constructor(
id: number,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON>
) {
super(id, document.createElement('uni-view'), parentNodeId, nodeJson)
super(
id,
document.createElement('uni-view'),
parentNodeId,
refNodeId,
nodeJson
)
}
}
......@@ -3,7 +3,7 @@ import {
ACTION_TYPE_PAGE_CREATE,
ACTION_TYPE_PAGE_CREATED,
ACTION_TYPE_CREATE,
ACTION_TYPE_INSERT,
// ACTION_TYPE_INSERT,
ACTION_TYPE_REMOVE,
ACTION_TYPE_SET_ATTRIBUTE,
ACTION_TYPE_REMOVE_ATTRIBUTE,
......@@ -34,10 +34,11 @@ export function onVdSync(actions: (PageAction | DictAction)[]) {
action[1],
getDict(action[2] as number),
action[3],
decodeNodeJson(getDict, action[4] as UniNodeJSONMinify)
action[4],
decodeNodeJson(getDict, action[5] as UniNodeJSONMinify)
)
case ACTION_TYPE_INSERT:
return $(action[1]).insert(action[2], action[3])
// case ACTION_TYPE_INSERT:
// return $(action[1]).insert(action[2], action[3])
case ACTION_TYPE_REMOVE:
return $(action[1]).remove()
case ACTION_TYPE_SET_ATTRIBUTE:
......
......@@ -33,6 +33,7 @@ export function createElement(
id: number,
tag: string,
parentNodeId: number,
refNodeId: number,
nodeJson: Partial<UniNodeJSON> = {}
) {
let element: UniNode
......@@ -47,12 +48,13 @@ export function createElement(
} else {
const Component = BuiltInComponents[tag as keyof typeof BuiltInComponents]
if (Component) {
element = new Component(id, parentNodeId, nodeJson)
element = new Component(id, parentNodeId, refNodeId, nodeJson)
} else {
element = new UniElement(
id,
document.createElement(tag),
parentNodeId,
refNodeId,
nodeJson
)
}
......@@ -118,7 +120,7 @@ function initSystemInfo(
}
function initPageElement() {
createElement(0, 'div', -1).$ = document.getElementById('app')!
createElement(0, 'div', -1, -1).$ = document.getElementById('app')!
}
function initPageCss(route: string) {
......
......@@ -6701,10 +6701,10 @@ function baseCreateRenderer(options, createHydrationFns) {
}
}
else {
// fixed by xxxxxx 补充父组件
patch(container._vnode || null, vnode, container, null, container.__vueParent || null, null, isSVG);
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
}
flushPostFlushCbs();
// fixed by xxxxxx 调整到UniComponent里边触发flushPostFlushCbs
// flushPostFlushCbs()
container._vnode = vnode;
};
const internals = {
......@@ -10084,4 +10084,4 @@ function normalizeContainer(container) {
return container;
}
export { BaseTransition, Comment$1 as Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmit, defineEmits, defineExpose, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, 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, ssrUtils, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useContext, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withModifiers, withScopeId };
export { BaseTransition, Comment$1 as Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmit, defineEmits, defineExpose, defineProps, devtools, flushPostFlushCbs, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, 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, ssrUtils, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useContext, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withModifiers, withScopeId };
......@@ -6719,10 +6719,10 @@ function baseCreateRenderer(options, createHydrationFns) {
}
}
else {
// fixed by xxxxxx 补充父组件
patch(container._vnode || null, vnode, container, null, container.__vueParent || null, null, isSVG);
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
}
flushPostFlushCbs();
// fixed by xxxxxx 调整到UniComponent里边触发flushPostFlushCbs
// flushPostFlushCbs()
container._vnode = vnode;
};
const internals = {
......@@ -10102,4 +10102,4 @@ function normalizeContainer(container) {
return container;
}
export { BaseTransition, Comment$1 as Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmit, defineEmits, defineExpose, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, 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, ssrUtils, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useContext, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withModifiers, withScopeId };
export { BaseTransition, Comment$1 as Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compatUtils, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, defineAsyncComponent, defineComponent, defineEmit, defineEmits, defineExpose, defineProps, devtools, flushPostFlushCbs, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeDefaults, mergeProps, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, 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, ssrUtils, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useAttrs, useContext, useCssModule, useCssVars, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withModifiers, withScopeId };
......@@ -788,7 +788,7 @@ var safeAreaInsets = {
onChange,
offChange
};
var D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out = safeAreaInsets;
var out = safeAreaInsets;
const onEventPrevent = /* @__PURE__ */ withModifiers(() => {
}, ["prevent"]);
const onEventStop = /* @__PURE__ */ withModifiers(() => {
......@@ -800,10 +800,10 @@ function getWindowOffset() {
const left = parseInt(style.getPropertyValue("--window-left"));
const right = parseInt(style.getPropertyValue("--window-right"));
return {
top: top ? top + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top : 0,
bottom: bottom ? bottom + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom : 0,
left: left ? left + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left : 0,
right: right ? right + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right : 0
top: top ? top + out.top : 0,
bottom: bottom ? bottom + out.bottom : 0,
left: left ? left + out.left : 0,
right: right ? right + out.right : 0
};
}
function updateCssVar(cssVars) {
......@@ -13227,7 +13227,7 @@ function normalizePageMeta(pageMeta) {
}, pageMeta.pullToRefresh));
const { type, style } = navigationBar;
if (style !== "custom" && type !== "transparent") {
pullToRefresh.offset += NAVBAR_HEIGHT + D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top;
pullToRefresh.offset += NAVBAR_HEIGHT + out.top;
}
pageMeta.pullToRefresh = pullToRefresh;
}
......@@ -15413,7 +15413,7 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const windowWidth = getWindowWidth(screenWidth);
let windowHeight = window.innerHeight;
const language = navigator.language;
const statusBarHeight = D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top;
const statusBarHeight = out.top;
let osname;
let osversion;
let model;
......@@ -15526,12 +15526,12 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const system = `${osname} ${osversion}`;
const platform = osname.toLocaleLowerCase();
const safeArea = {
left: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left,
right: windowWidth - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right,
top: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top,
bottom: windowHeight - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom,
width: windowWidth - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right,
height: windowHeight - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top - D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom
left: out.left,
right: windowWidth - out.right,
top: out.top,
bottom: windowHeight - out.bottom,
width: windowWidth - out.left - out.right,
height: windowHeight - out.top - out.bottom
};
const { top: windowTop, bottom: windowBottom } = getWindowOffset();
windowHeight -= windowTop;
......@@ -15551,10 +15551,10 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
model,
safeArea,
safeAreaInsets: {
top: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.top,
right: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.right,
bottom: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.bottom,
left: D__DCloud_local_git_uniAppNext_node_modules_safeAreaInsets_out.left
top: out.top,
right: out.right,
bottom: out.bottom,
left: out.left
}
};
});
......
......@@ -65,6 +65,7 @@ export declare const COMPONENT_SELECTOR_PREFIX = "uni-";
* nodeId
* tag
* parentNodeId
* refNodeId
* nodeJson
*/
export declare type CreateAction = [
......@@ -72,6 +73,7 @@ typeof ACTION_TYPE_CREATE,
number,
string | number,
number,
number,
Partial<UniNodeJSON | UniNodeJSONMinify>?
];
......
......@@ -39,6 +39,7 @@ export type PageCreatedAction = [typeof ACTION_TYPE_PAGE_CREATED]
* nodeId
* tag
* parentNodeId
* refNodeId
* nodeJson
*/
export type CreateAction = [
......@@ -46,6 +47,7 @@ export type CreateAction = [
number,
string | number,
number,
number,
Partial<UniNodeJSON | UniNodeJSONMinify>?
]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册