Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小浣熊撸代码
uni-app
提交
c3a0b3d9
U
uni-app
项目概览
小浣熊撸代码
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c3a0b3d9
编写于
7月 28, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): nvue
上级
d51e4497
变更
28
展开全部
隐藏空白更改
内联
并排
Showing
28 changed file
with
714 addition
and
486 deletion
+714
-486
packages/shims-node.d.ts
packages/shims-node.d.ts
+3
-0
packages/uni-app-plus/dist/style.css
packages/uni-app-plus/dist/style.css
+8
-0
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+282
-228
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+178
-66
packages/uni-app-plus/src/service/framework/app/subscriber/webviewLifecycle.ts
.../src/service/framework/app/subscriber/webviewLifecycle.ts
+6
-13
packages/uni-app-plus/src/service/framework/dom/Page.ts
packages/uni-app-plus/src/service/framework/dom/Page.ts
+28
-27
packages/uni-app-plus/src/service/onWebInvokeAppService.ts
packages/uni-app-plus/src/service/onWebInvokeAppService.ts
+13
-16
packages/uni-cli-nvue/dist/webpack/config/index.js
packages/uni-cli-nvue/dist/webpack/config/index.js
+1
-2
packages/uni-cli-nvue/dist/webpack/config/module/rules/index.js
...es/uni-cli-nvue/dist/webpack/config/module/rules/index.js
+11
-0
packages/uni-cli-nvue/dist/webpack/config/plugins/define.js
packages/uni-cli-nvue/dist/webpack/config/plugins/define.js
+5
-7
packages/uni-cli-nvue/package.json
packages/uni-cli-nvue/package.json
+3
-0
packages/uni-cli-nvue/src/webpack/config/index.ts
packages/uni-cli-nvue/src/webpack/config/index.ts
+1
-2
packages/uni-cli-nvue/src/webpack/config/module/rules/index.ts
...ges/uni-cli-nvue/src/webpack/config/module/rules/index.ts
+11
-0
packages/uni-cli-nvue/src/webpack/config/plugins/define.ts
packages/uni-cli-nvue/src/webpack/config/plugins/define.ts
+9
-9
packages/uni-cli-shared/package.json
packages/uni-cli-shared/package.json
+1
-1
packages/uni-h5-vite/lib/ssr/cloudfunction.js
packages/uni-h5-vite/lib/ssr/cloudfunction.js
+25
-0
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+1
-1
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+1
-1
packages/uni-mp-alipay/dist/uni.api.esm.js
packages/uni-mp-alipay/dist/uni.api.esm.js
+1
-1
packages/uni-mp-baidu/dist/uni.api.esm.js
packages/uni-mp-baidu/dist/uni.api.esm.js
+1
-1
packages/uni-mp-qq/dist/uni.api.esm.js
packages/uni-mp-qq/dist/uni.api.esm.js
+1
-1
packages/uni-mp-toutiao/dist/uni.api.esm.js
packages/uni-mp-toutiao/dist/uni.api.esm.js
+1
-1
packages/uni-mp-weixin/dist/uni.api.esm.js
packages/uni-mp-weixin/dist/uni.api.esm.js
+1
-1
packages/uni-quickapp-webview/dist/uni.api.esm.js
packages/uni-quickapp-webview/dist/uni.api.esm.js
+1
-1
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+1
-0
packages/uni-shared/dist/uni-shared.d.ts
packages/uni-shared/dist/uni-shared.d.ts
+2
-0
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+1
-1
yarn.lock
yarn.lock
+117
-106
未找到文件。
packages/shims-node.d.ts
浏览文件 @
c3a0b3d9
declare
namespace
NodeJS
{
interface
Process
{
UNI_NVUE_ENTRY
:
Record
<
string
,
string
>
}
interface
ProcessEnv
{
UNI_PLATFORM
:
UniApp
.
PLATFORM
UNI_INPUT_DIR
:
string
...
...
packages/uni-app-plus/dist/style.css
浏览文件 @
c3a0b3d9
...
...
@@ -1904,3 +1904,11 @@ uni-video[hidden] {
overflow
:
hidden
;
pointer-events
:
none
;
}
uni-web-view
{
display
:
inline-block
;
position
:
absolute
;
left
:
0
;
right
:
0
;
top
:
0
;
bottom
:
0
;
}
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
c3a0b3d9
...
...
@@ -1707,12 +1707,13 @@ var serviceContext = (function (vue) {
liveEvents.length ? (e[name] = liveEvents) : delete e[name];
return this;
},
};
};
var Emitter = E;
// TODO 等待 vue3 的兼容模式自带emitter
function initBridge(subscribeNamespace) {
// TODO vue3 compatibility builds
const emitter = new E();
const emitter = new E
mitter
();
return {
on(event, callback) {
return emitter.on(event, callback);
...
...
@@ -2337,7 +2338,7 @@ var serviceContext = (function (vue) {
},
];
const emitter = new E();
const emitter = new E
mitter
();
const $on = defineSyncApi(API_ON, (name, callback) => {
emitter.on(name, callback);
return () => emitter.off(name, callback);
...
...
@@ -8146,7 +8147,10 @@ var serviceContext = (function (vue) {
const ON_WEBVIEW_READY = 'onWebviewReady';
const PAGE_SCROLL_TO = 'pageScrollTo';
const LOAD_FONT_FACE = 'loadFontFace';
const ACTION_TYPE_DICT = 0;
const ACTION_TYPE_DICT = 0;
const WEBVIEW_INSERTED = 'webviewInserted';
const WEBVIEW_REMOVED = 'webviewRemoved';
const WEB_INVOKE_APPSERVICE = 'WEB_INVOKE_APPSERVICE';
const loadFontFace = defineAsyncApi(API_LOAD_FONT_FACE, (options, { resolve, reject }) => {
const pageId = getPageIdByVm(getCurrentPageVm());
...
...
@@ -9480,11 +9484,283 @@ var serviceContext = (function (vue) {
}
}
function onWebviewInserted(_, pageId) {
const page = getPageById(parseInt(pageId));
page && (page.__uniapp_webview = true);
}
function onWebviewRemoved(_, pageId) {
const page = getPageById(parseInt(pageId));
page && delete page.__uniapp_webview;
}
class UniPageNode extends UniNode {
constructor(pageId, options, setup = false) {
super(NODE_TYPE_PAGE, '#page', null);
this._id = 1;
this._created = false;
this._createActionMap = new Map();
this.updateActions = [];
this.dicts = [];
this.nodeId = 0;
this.pageId = pageId;
this.pageNode = this;
this.isUnmounted = false;
this.createAction = [ACTION_TYPE_PAGE_CREATE, options];
this.createdAction = [ACTION_TYPE_PAGE_CREATED];
this.normalizeDict = this._normalizeDict.bind(this);
this._update = this.update.bind(this);
setup && this.setup();
}
_normalizeDict(value, normalizeValue = true) {
if (!isPlainObject(value)) {
return this.addDict(value);
}
const dictArray = [];
Object.keys(value).forEach((n) => {
const dict = [this.addDict(n)];
const v = value[n];
if (normalizeValue) {
dict.push(this.addDict(v));
}
else {
dict.push(v);
}
dictArray.push(dict);
});
return dictArray;
}
addDict(value) {
const { dicts } = this;
const index = dicts.indexOf(value);
if (index > -1) {
return index;
}
return dicts.push(value) - 1;
}
onCreate(thisNode, nodeName) {
pushCreateAction(this, thisNode.nodeId, nodeName);
return thisNode;
}
onInsertBefore(thisNode, newChild, refChild) {
pushInsertAction(this, newChild, thisNode.nodeId, (refChild && refChild.nodeId) || -1);
return newChild;
}
onRemoveChild(oldChild) {
pushRemoveAction(this, oldChild.nodeId);
return oldChild;
}
onAddEvent(thisNode, name, flag) {
if (thisNode.parentNode) {
pushAddEventAction(this, thisNode.nodeId, name, flag);
}
}
onRemoveEvent(thisNode, name) {
if (thisNode.parentNode) {
pushRemoveEventAction(this, thisNode.nodeId, name);
}
}
onSetAttribute(thisNode, qualifiedName, value) {
if (thisNode.parentNode) {
pushSetAttributeAction(this, thisNode.nodeId, qualifiedName, value);
}
}
onRemoveAttribute(thisNode, qualifiedName) {
if (thisNode.parentNode) {
pushRemoveAttributeAction(this, thisNode.nodeId, qualifiedName);
}
}
onTextContent(thisNode, text) {
if (thisNode.parentNode) {
pushSetTextAction(this, thisNode.nodeId, text);
}
}
onNodeValue(thisNode, val) {
if (thisNode.parentNode) {
pushSetTextAction(this, thisNode.nodeId, val);
}
}
genId() {
return this._id++;
}
push(action, extras) {
if (this.isUnmounted) {
if ((process.env.NODE_ENV !== 'production')) {
console.log(formatLog('PageNode', 'push.prevent', action));
}
return;
}
switch (action[0]) {
case ACTION_TYPE_CREATE:
this._createActionMap.set(action[1], action);
break;
case ACTION_TYPE_INSERT:
const createAction = this._createActionMap.get(action[1]);
if (createAction) {
createAction[3] = action[2]; // parentNodeId
createAction[4] = action[3]; // anchorId
if (extras) {
createAction[5] = extras;
}
}
else {
if ((process.env.NODE_ENV !== 'production')) {
console.error(formatLog(`Insert`, action, 'not found createAction'));
}
}
break;
}
// insert 被合并进 create
if (action[0] !== ACTION_TYPE_INSERT) {
this.updateActions.push(action);
}
vue.queuePostFlushCb(this._update);
}
restore() {
this.push(this.createAction);
// TODO restore children
this.push(this.createdAction);
}
setup() {
this.send([this.createAction]);
}
update() {
const { dicts, updateActions, _createActionMap } = this;
if ((process.env.NODE_ENV !== 'production')) {
console.log(formatLog('PageNode', 'update', updateActions.length, _createActionMap.size));
}
_createActionMap.clear();
// 首次
if (!this._created) {
this._created = true;
updateActions.push(this.createdAction);
}
if (updateActions.length) {
if (dicts.length) {
updateActions.unshift([ACTION_TYPE_DICT, dicts]);
}
this.send(updateActions);
dicts.length = 0;
updateActions.length = 0;
}
}
send(action) {
UniServiceJSBridge.publishHandler(VD_SYNC, action, this.pageId);
}
fireEvent(id, evt) {
const node = findNodeById(id, this);
if (node) {
node.dispatchEvent(evt);
}
else if ((process.env.NODE_ENV !== 'production')) {
console.error(formatLog('PageNode', 'fireEvent', id, 'not found', evt));
}
}
}
function getPageNode(pageId) {
const page = getPageById(pageId);
if (!page)
return null;
return page.__page_container__;
}
function findNode(name, value, uniNode) {
if (typeof uniNode === 'number') {
uniNode = getPageNode(uniNode);
}
if (uniNode[name] === value) {
return uniNode;
}
const { childNodes } = uniNode;
for (let i = 0; i < childNodes.length; i++) {
const uniNode = findNode(name, value, childNodes[i]);
if (uniNode) {
return uniNode;
}
}
return null;
}
function findNodeById(nodeId, uniNode) {
return findNode('nodeId', nodeId, uniNode);
}
function findNodeByTagName(tagName, uniNode) {
return findNode('nodeName', tagName.toUpperCase(), uniNode);
}
function pushCreateAction(pageNode, nodeId, nodeName) {
pageNode.push([
ACTION_TYPE_CREATE,
nodeId,
pageNode.addDict(nodeName),
-1,
-1,
]);
}
function pushInsertAction(pageNode, newChild, parentNodeId, refChildId) {
const nodeJson = newChild.toJSON({
attr: true,
normalize: pageNode.normalizeDict,
});
pageNode.push([ACTION_TYPE_INSERT, newChild.nodeId, parentNodeId, refChildId], Object.keys(nodeJson).length ? nodeJson : undefined);
}
function pushRemoveAction(pageNode, nodeId) {
pageNode.push([ACTION_TYPE_REMOVE, nodeId]);
}
function pushAddEventAction(pageNode, nodeId, name, value) {
pageNode.push([ACTION_TYPE_ADD_EVENT, nodeId, pageNode.addDict(name), value]);
}
function pushRemoveEventAction(pageNode, nodeId, name) {
pageNode.push([ACTION_TYPE_REMOVE_EVENT, nodeId, pageNode.addDict(name)]);
}
function normalizeAttrValue(pageNode, name, value) {
return name === 'style' && isPlainObject(value)
? pageNode.normalizeDict(value)
: pageNode.addDict(value);
}
function pushSetAttributeAction(pageNode, nodeId, name, value) {
pageNode.push([
ACTION_TYPE_SET_ATTRIBUTE,
nodeId,
pageNode.addDict(name),
normalizeAttrValue(pageNode, name, value),
]);
}
function pushRemoveAttributeAction(pageNode, nodeId, name) {
pageNode.push([ACTION_TYPE_REMOVE_ATTRIBUTE, nodeId, pageNode.addDict(name)]);
}
function pushSetTextAction(pageNode, nodeId, text) {
pageNode.push([ACTION_TYPE_SET_TEXT, nodeId, pageNode.addDict(text)]);
}
function createPageNode(pageId, pageOptions, setup) {
return new UniPageNode(pageId, pageOptions, setup);
}
const onWebInvokeAppService = ({ name, arg }, pageIds) => {
if (name === 'postMessage') {
onMessage(pageIds[0], arg);
}
else {
uni[name](arg);
}
};
function onMessage(pageId, arg) {
const uniNode = findNodeByTagName('web-view', parseInt(pageId));
uniNode &&
uniNode.dispatchEvent(createUniEvent({
type: 'onMessage',
target: Object.create(null),
currentTarget: Object.create(null),
detail: {
data: [arg],
},
}));
}
function initSubscribeHandlers() {
const { subscribe, subscribeHandler } = UniServiceJSBridge;
onPlusMessage('subscribeHandler', ({ type, data, pageId }) => {
subscribeHandler(type, data, pageId);
});
onPlusMessage(WEB_INVOKE_APPSERVICE, ({ data, webviewIds }) => {
onWebInvokeAppService(data, webviewIds);
});
if (__uniConfig.renderer !== 'native') {
// 非纯原生
subscribe(ON_WEBVIEW_READY, subscribeWebviewReady);
...
...
@@ -9492,6 +9768,8 @@ var serviceContext = (function (vue) {
subscribeServiceMethod();
subscribeAd();
subscribeNavigator();
subscribe(WEBVIEW_INSERTED, onWebviewInserted);
subscribe(WEBVIEW_REMOVED, onWebviewRemoved);
}
}
...
...
@@ -10164,230 +10442,6 @@ var serviceContext = (function (vue) {
});
}
class UniPageNode extends UniNode {
constructor(pageId, options, setup = false) {
super(NODE_TYPE_PAGE, '#page', null);
this._id = 1;
this._created = false;
this._createActionMap = new Map();
this.updateActions = [];
this.dicts = [];
this.nodeId = 0;
this.pageId = pageId;
this.pageNode = this;
this.isUnmounted = false;
this.createAction = [ACTION_TYPE_PAGE_CREATE, options];
this.createdAction = [ACTION_TYPE_PAGE_CREATED];
this.normalizeDict = this._normalizeDict.bind(this);
this._update = this.update.bind(this);
setup && this.setup();
}
_normalizeDict(value, normalizeValue = true) {
if (!isPlainObject(value)) {
return this.addDict(value);
}
const dictArray = [];
Object.keys(value).forEach((n) => {
const dict = [this.addDict(n)];
const v = value[n];
if (normalizeValue) {
dict.push(this.addDict(v));
}
else {
dict.push(v);
}
dictArray.push(dict);
});
return dictArray;
}
addDict(value) {
const { dicts } = this;
const index = dicts.indexOf(value);
if (index > -1) {
return index;
}
return dicts.push(value) - 1;
}
onCreate(thisNode, nodeName) {
pushCreateAction(this, thisNode.nodeId, nodeName);
return thisNode;
}
onInsertBefore(thisNode, newChild, refChild) {
pushInsertAction(this, newChild, thisNode.nodeId, (refChild && refChild.nodeId) || -1);
return newChild;
}
onRemoveChild(oldChild) {
pushRemoveAction(this, oldChild.nodeId);
return oldChild;
}
onAddEvent(thisNode, name, flag) {
if (thisNode.parentNode) {
pushAddEventAction(this, thisNode.nodeId, name, flag);
}
}
onRemoveEvent(thisNode, name) {
if (thisNode.parentNode) {
pushRemoveEventAction(this, thisNode.nodeId, name);
}
}
onSetAttribute(thisNode, qualifiedName, value) {
if (thisNode.parentNode) {
pushSetAttributeAction(this, thisNode.nodeId, qualifiedName, value);
}
}
onRemoveAttribute(thisNode, qualifiedName) {
if (thisNode.parentNode) {
pushRemoveAttributeAction(this, thisNode.nodeId, qualifiedName);
}
}
onTextContent(thisNode, text) {
if (thisNode.parentNode) {
pushSetTextAction(this, thisNode.nodeId, text);
}
}
onNodeValue(thisNode, val) {
if (thisNode.parentNode) {
pushSetTextAction(this, thisNode.nodeId, val);
}
}
genId() {
return this._id++;
}
push(action, extras) {
if (this.isUnmounted) {
if ((process.env.NODE_ENV !== 'production')) {
console.log(formatLog('PageNode', 'push.prevent', action));
}
return;
}
switch (action[0]) {
case ACTION_TYPE_CREATE:
this._createActionMap.set(action[1], action);
break;
case ACTION_TYPE_INSERT:
const createAction = this._createActionMap.get(action[1]);
if (createAction) {
createAction[3] = action[2]; // parentNodeId
createAction[4] = action[3]; // anchorId
if (extras) {
createAction[5] = extras;
}
}
else {
if ((process.env.NODE_ENV !== 'production')) {
console.error(formatLog(`Insert`, action, 'not found createAction'));
}
}
break;
}
// insert 被合并进 create
if (action[0] !== ACTION_TYPE_INSERT) {
this.updateActions.push(action);
}
vue.queuePostFlushCb(this._update);
}
restore() {
this.push(this.createAction);
// TODO restore children
this.push(this.createdAction);
}
setup() {
this.send([this.createAction]);
}
update() {
const { dicts, updateActions, _createActionMap } = this;
if ((process.env.NODE_ENV !== 'production')) {
console.log(formatLog('PageNode', 'update', updateActions.length, _createActionMap.size));
}
_createActionMap.clear();
// 首次
if (!this._created) {
this._created = true;
updateActions.push(this.createdAction);
}
if (updateActions.length) {
if (dicts.length) {
updateActions.unshift([ACTION_TYPE_DICT, dicts]);
}
this.send(updateActions);
dicts.length = 0;
updateActions.length = 0;
}
}
send(action) {
UniServiceJSBridge.publishHandler(VD_SYNC, action, this.pageId);
}
fireEvent(id, evt) {
const node = findNodeById(id, this);
if (node) {
node.dispatchEvent(evt);
}
else if ((process.env.NODE_ENV !== 'production')) {
console.error(formatLog('PageNode', 'fireEvent', id, 'not found', evt));
}
}
}
function findNodeById(id, uniNode) {
if (uniNode.nodeId === id) {
return uniNode;
}
const { childNodes } = uniNode;
for (let i = 0; i < childNodes.length; i++) {
const uniNode = findNodeById(id, childNodes[i]);
if (uniNode) {
return uniNode;
}
}
return null;
}
function pushCreateAction(pageNode, nodeId, nodeName) {
pageNode.push([
ACTION_TYPE_CREATE,
nodeId,
pageNode.addDict(nodeName),
-1,
-1,
]);
}
function pushInsertAction(pageNode, newChild, parentNodeId, refChildId) {
const nodeJson = newChild.toJSON({
attr: true,
normalize: pageNode.normalizeDict,
});
pageNode.push([ACTION_TYPE_INSERT, newChild.nodeId, parentNodeId, refChildId], Object.keys(nodeJson).length ? nodeJson : undefined);
}
function pushRemoveAction(pageNode, nodeId) {
pageNode.push([ACTION_TYPE_REMOVE, nodeId]);
}
function pushAddEventAction(pageNode, nodeId, name, value) {
pageNode.push([ACTION_TYPE_ADD_EVENT, nodeId, pageNode.addDict(name), value]);
}
function pushRemoveEventAction(pageNode, nodeId, name) {
pageNode.push([ACTION_TYPE_REMOVE_EVENT, nodeId, pageNode.addDict(name)]);
}
function normalizeAttrValue(pageNode, name, value) {
return name === 'style' && isPlainObject(value)
? pageNode.normalizeDict(value)
: pageNode.addDict(value);
}
function pushSetAttributeAction(pageNode, nodeId, name, value) {
pageNode.push([
ACTION_TYPE_SET_ATTRIBUTE,
nodeId,
pageNode.addDict(name),
normalizeAttrValue(pageNode, name, value),
]);
}
function pushRemoveAttributeAction(pageNode, nodeId, name) {
pageNode.push([ACTION_TYPE_REMOVE_ATTRIBUTE, nodeId, pageNode.addDict(name)]);
}
function pushSetTextAction(pageNode, nodeId, text) {
pageNode.push([ACTION_TYPE_SET_TEXT, nodeId, pageNode.addDict(text)]);
}
function createPageNode(pageId, pageOptions, setup) {
return new UniPageNode(pageId, pageOptions, setup);
}
function setupPage(component) {
const oldSetup = component.setup;
component.inheritAttrs = false; // 禁止继承 __pageId 等属性,避免告警
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
c3a0b3d9
...
...
@@ -5506,6 +5506,9 @@
const PAGE_SCROLL_TO = "pageScrollTo";
const LOAD_FONT_FACE = "loadFontFace";
const ACTION_TYPE_DICT = 0;
const WEBVIEW_INSERTED = "webviewInserted";
const WEBVIEW_REMOVED = "webviewRemoved";
const WEBVIEW_ID_PREFIX = "webviewId";
const APP_SERVICE_ID = "__uniapp__service";
const UniViewJSBridge$1 = /* @__PURE__ */ extend(ViewJSBridge, {
publishHandler
...
...
@@ -6640,7 +6643,7 @@
return fields;
}
const uniLabelKey = PolySymbol("uniLabel");
const props$
p
= {
const props$
q
= {
for: {
type: String,
default: ""
...
...
@@ -6648,7 +6651,7 @@
};
var Label = /* @__PURE__ */ defineBuiltInComponent({
name: "Label",
props: props$
p
,
props: props$
q
,
setup(props2, {
slots
}) {
...
...
@@ -7104,7 +7107,7 @@
tempCanvas.height = height;
return tempCanvas;
}
const props$
o
= {
const props$
p
= {
canvasId: {
type: String,
default: ""
...
...
@@ -7120,7 +7123,7 @@
compatConfig: {
MODE: 3
},
props: props$
o
,
props: props$
p
,
computed: {
id() {
return this.canvasId;
...
...
@@ -7580,7 +7583,7 @@
});
}
const uniCheckGroupKey = PolySymbol("uniCheckGroup");
const props$
n
= {
const props$
o
= {
name: {
type: String,
default: ""
...
...
@@ -7588,7 +7591,7 @@
};
var CheckboxGroup = /* @__PURE__ */ defineBuiltInComponent({
name: "CheckboxGroup",
props: props$
n
,
props: props$
o
,
emits: ["change"],
setup(props2, {
emit: emit2,
...
...
@@ -7642,7 +7645,7 @@
}
return getFieldsValue;
}
const props$
m
= {
const props$
n
= {
checked: {
type: [Boolean, String],
default: false
...
...
@@ -7666,7 +7669,7 @@
};
var Checkbox = /* @__PURE__ */ defineBuiltInComponent({
name: "Checkbox",
props: props$
m
,
props: props$
n
,
setup(props2, {
slots
}) {
...
...
@@ -7814,7 +7817,7 @@
});
}
}
const props$
l
= {
const props$
m
= {
cursorSpacing: {
type: [Number, String],
default: 0
...
...
@@ -8636,7 +8639,7 @@
}
}, id2, true);
}
const props$
k = /* @__PURE__ */ extend({}, props$l
, {
const props$
l = /* @__PURE__ */ extend({}, props$m
, {
id: {
type: String,
default: ""
...
...
@@ -8664,7 +8667,7 @@
});
var Editor = /* @__PURE__ */ defineBuiltInComponent({
name: "Editor",
props: props$
k
,
props: props$
l
,
emit: ["ready", "focus", "blur", "input", "statuschange", ...emit$1],
setup(props2, {
emit: emit2
...
...
@@ -8753,7 +8756,7 @@
};
}
});
const props$
j
= {
const props$
k
= {
src: {
type: String,
default: ""
...
...
@@ -8792,7 +8795,7 @@
};
var Image$1 = /* @__PURE__ */ defineBuiltInComponent({
name: "Image",
props: props$
j
,
props: props$
k
,
setup(props2, {
emit: emit2
}) {
...
...
@@ -9093,7 +9096,7 @@
function getValueString(value) {
return value === null ? "" : String(value);
}
const props$
i
= /* @__PURE__ */ extend({}, {
const props$
j
= /* @__PURE__ */ extend({}, {
name: {
type: String,
default: ""
...
...
@@ -9158,7 +9161,7 @@
type: String,
default: "done"
}
}, props$
l
);
}, props$
m
);
const emit = [
"input",
"focus",
...
...
@@ -9364,7 +9367,7 @@
trigger: trigger2
};
}
const props$
h = /* @__PURE__ */ extend({}, props$i
, {
const props$
i = /* @__PURE__ */ extend({}, props$j
, {
placeholderClass: {
type: String,
default: "input-placeholder"
...
...
@@ -9376,7 +9379,7 @@
});
var Input = /* @__PURE__ */ defineBuiltInComponent({
name: "Input",
props: props$
h
,
props: props$
i
,
emits: ["confirm", ...emit],
setup(props2, {
emit: emit2
...
...
@@ -9537,16 +9540,16 @@
});
return { $attrs: attrs2, $listeners: listeners, $excludeAttrs: excludeAttrs };
};
let webview;
let webview
$2
;
let pullToRefreshStyle;
function initScrollBounce() {
{
plusReady(() => {
if (!webview) {
webview = plus.webview.currentWebview();
if (!webview
$2
) {
webview
$2
= plus.webview.currentWebview();
}
if (!pullToRefreshStyle) {
pullToRefreshStyle = (webview.getStyle() || {}).pullToRefresh || {};
pullToRefreshStyle = (webview
$2
.getStyle() || {}).pullToRefresh || {};
}
});
}
...
...
@@ -9554,7 +9557,7 @@
function disableScrollBounce({ disable }) {
{
if (pullToRefreshStyle && pullToRefreshStyle.support) {
webview.setPullToRefresh(Object.assign({}, pullToRefreshStyle, {
webview
$2
.setPullToRefresh(Object.assign({}, pullToRefreshStyle, {
support: !disable
}));
}
...
...
@@ -9581,7 +9584,7 @@
const instance = getCurrentInstance();
instance.rebuild = callback;
}
const props$
g
= {
const props$
h
= {
scaleArea: {
type: Boolean,
default: false
...
...
@@ -9590,7 +9593,7 @@
var MovableArea = /* @__PURE__ */ defineBuiltInComponent({
inheritAttrs: false,
name: "MovableArea",
props: props$
g
,
props: props$
h
,
setup(props2, {
slots
}) {
...
...
@@ -10209,7 +10212,7 @@
this._springY.reconfigure(e2, t2, n);
this._springScale.reconfigure(e2, t2, n);
};
const props$
f
= {
const props$
g
= {
direction: {
type: String,
default: "none"
...
...
@@ -10265,7 +10268,7 @@
};
var MovableView = /* @__PURE__ */ defineBuiltInComponent({
name: "MovableView",
props: props$
f
,
props: props$
g
,
emits: ["change", "scale"],
setup(props2, {
slots,
...
...
@@ -10858,7 +10861,7 @@
};
}
const OPEN_TYPES = ["navigate", "redirect", "switchTab", "reLaunch", "navigateBack"];
const props$
e
= {
const props$
f
= {
hoverClass: {
type: String,
default: "navigator-hover"
...
...
@@ -10900,7 +10903,7 @@
compatConfig: {
MODE: 3
},
props: props$
e
,
props: props$
f
,
setup(props2, {
slots
}) {
...
...
@@ -10957,7 +10960,7 @@
};
}
});
const props$
d
= {
const props$
e
= {
value: {
type: Array,
default() {
...
...
@@ -11004,7 +11007,7 @@
}
var PickerView = /* @__PURE__ */ defineBuiltInComponent({
name: "PickerView",
props: props$
d
,
props: props$
e
,
emits: ["change", "pickstart", "pickend", "update:value"],
setup(props2, {
slots,
...
...
@@ -11965,7 +11968,7 @@
backgroundColor: "#EBEBEB",
activeMode: "backwards"
};
const props$
c
= {
const props$
d
= {
percent: {
type: [Number, String],
default: 0,
...
...
@@ -12014,7 +12017,7 @@
};
var Progress = /* @__PURE__ */ defineBuiltInComponent({
name: "Progress",
props: props$
c
,
props: props$
d
,
setup(props2) {
const state = useProgressState(props2);
_activeAnimation(state, props2);
...
...
@@ -12088,7 +12091,7 @@
}
}
const uniRadioGroupKey = PolySymbol("uniCheckGroup");
const props$
b
= {
const props$
c
= {
name: {
type: String,
default: ""
...
...
@@ -12096,7 +12099,7 @@
};
var RadioGroup = /* @__PURE__ */ defineBuiltInComponent({
name: "RadioGroup",
props: props$
b
,
props: props$
c
,
setup(props2, {
emit: emit2,
slots
...
...
@@ -12177,7 +12180,7 @@
}
return fields;
}
const props$
a
= {
const props$
b
= {
checked: {
type: [Boolean, String],
default: false
...
...
@@ -12201,7 +12204,7 @@
};
var Radio = /* @__PURE__ */ defineBuiltInComponent({
name: "Radio",
props: props$
a
,
props: props$
b
,
setup(props2, {
slots
}) {
...
...
@@ -12497,7 +12500,7 @@
});
return parentNode;
}
const props$
9
= {
const props$
a
= {
nodes: {
type: [Array, String],
default: function() {
...
...
@@ -12510,7 +12513,7 @@
compatConfig: {
MODE: 3
},
props: props$
9
,
props: props$
a
,
setup(props2) {
const rootRef = ref(null);
function _renderNodes(nodes) {
...
...
@@ -12537,7 +12540,7 @@
}
});
const passiveOptions = passive(true);
const props$
8
= {
const props$
9
= {
scrollX: {
type: [Boolean, String],
default: false
...
...
@@ -12600,7 +12603,7 @@
compatConfig: {
MODE: 3
},
props: props$
8
,
props: props$
9
,
emits: ["scroll", "scrolltoupper", "scrolltolower", "refresherrefresh", "refresherrestore", "refresherpulling", "refresherabort", "update:refresherTriggered"],
setup(props2, {
emit: emit2,
...
...
@@ -13030,7 +13033,7 @@
}
});
}
const props$
7
= {
const props$
8
= {
name: {
type: String,
default: ""
...
...
@@ -13086,7 +13089,7 @@
};
var Slider = /* @__PURE__ */ defineBuiltInComponent({
name: "Slider",
props: props$
7
,
props: props$
8
,
emits: ["changing", "change"],
setup(props2, {
emit: emit2
...
...
@@ -13257,7 +13260,7 @@
return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
}
};
const props$
6
= {
const props$
7
= {
indicatorDots: {
type: [Boolean, String],
default: false
...
...
@@ -13738,7 +13741,7 @@
}
var Swiper = /* @__PURE__ */ defineBuiltInComponent({
name: "Swiper",
props: props$
6
,
props: props$
7
,
emits: ["change", "transition", "animationfinish", "update:current", "update:currentItemId"],
setup(props2, {
slots,
...
...
@@ -13844,7 +13847,7 @@
};
}
});
const props$
5
= {
const props$
6
= {
itemId: {
type: String,
default: ""
...
...
@@ -13852,7 +13855,7 @@
};
var SwiperItem = /* @__PURE__ */ defineBuiltInComponent({
name: "SwiperItem",
props: props$
5
,
props: props$
6
,
setup(props2, {
slots
}) {
...
...
@@ -13903,7 +13906,7 @@
};
}
});
const props$
4
= {
const props$
5
= {
name: {
type: String,
default: ""
...
...
@@ -13931,7 +13934,7 @@
};
var Switch = /* @__PURE__ */ defineBuiltInComponent({
name: "Switch",
props: props$
4
,
props: props$
5
,
emits: ["change"],
setup(props2, {
emit: emit2
...
...
@@ -14035,7 +14038,7 @@
}
return text2.replace(/ /g, SPACE_UNICODE.nbsp).replace(/ /g, SPACE_UNICODE.ensp).replace(/ /g, SPACE_UNICODE.emsp).replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'");
}
const props$
3 = /* @__PURE__ */ extend({}, props$i
, {
const props$
4 = /* @__PURE__ */ extend({}, props$j
, {
placeholderClass: {
type: String,
default: "input-placeholder"
...
...
@@ -14056,7 +14059,7 @@
}
var Textarea = /* @__PURE__ */ defineBuiltInComponent({
name: "Textarea",
props: props$
3
,
props: props$
4
,
emit: ["confirm", "linechange", ...emit],
setup(props2, {
emit: emit2
...
...
@@ -14859,7 +14862,7 @@
});
}
const TEMP_PATH = "_doc/uniapp_temp/";
const props$
2
= {
const props$
3
= {
src: {
type: String,
default: ""
...
...
@@ -14930,7 +14933,7 @@
}
var CoverImage = /* @__PURE__ */ defineBuiltInComponent({
name: "CoverImage",
props: props$
2
,
props: props$
3
,
emits: ["click", "load", "error"],
setup(props2, {
emit: emit2
...
...
@@ -15067,7 +15070,7 @@
opacity: opacity ? Number("0x" + opacity) / 255 : 1
};
}
const props$
1
= {
const props$
2
= {
id: {
type: String,
default: ""
...
...
@@ -15111,7 +15114,7 @@
};
var Map$1 = /* @__PURE__ */ defineBuiltInComponent({
name: "Map",
props: props$
1
,
props: props$
2
,
emits: ["click", "regionchange", "controltap", "markertap", "callouttap"],
setup(props2, {
emit: emit2
...
...
@@ -15199,6 +15202,7 @@
onBeforeUnmount(() => {
if (map2) {
map2.close();
_setMap(null);
}
});
return () => {
...
...
@@ -15311,9 +15315,9 @@
};
}
}
map2.addOverlay(nativeMarker);
map2
== null ? void 0 : map2
.addOverlay(nativeMarker);
map2.__markers__.push(nativeMarker);
map2
.__markers_map__[id2 + ""] = nativeMarker
;
map2
&& (map2.__markers_map__[id2 + ""] = nativeMarker)
;
});
}
function _clearMarkers() {
...
...
@@ -15321,7 +15325,7 @@
return;
const markers = map2.__markers__;
markers.forEach((marker) => {
map2.removeOverlay(marker);
map2
== null ? void 0 : map2
.removeOverlay(marker);
});
map2.__markers__ = [];
map2.__markers_map__ = {};
...
...
@@ -15339,7 +15343,7 @@
return;
if (map2.__lines__.length > 0) {
map2.__lines__.forEach((circle) => {
map2.removeOverlay(circle);
map2
== null ? void 0 : map2
.removeOverlay(circle);
});
map2.__lines__ = [];
}
...
...
@@ -15358,7 +15362,7 @@
if (width) {
polyline.setLineWidth(width);
}
map2.addOverlay(polyline);
map2
== null ? void 0 : map2
.addOverlay(polyline);
map2.__lines__.push(polyline);
});
}
...
...
@@ -15367,7 +15371,7 @@
return;
if (map2.__circles__.length > 0) {
map2.__circles__.forEach((circle) => {
map2.removeOverlay(circle);
map2
== null ? void 0 : map2
.removeOverlay(circle);
});
map2.__circles__ = [];
}
...
...
@@ -15394,7 +15398,7 @@
if (strokeWidth) {
nativeCircle.setLineWidth(strokeWidth);
}
map2.addOverlay(nativeCircle);
map2
== null ? void 0 : map2
.addOverlay(nativeCircle);
map2.__circles__.push(nativeCircle);
});
}
...
...
@@ -15536,7 +15540,7 @@
}
}
var video = "uni-video {\n width: 300px;\n height: 225px;\n display: inline-block;\n line-height: 0;\n overflow: hidden;\n position: relative;\n}\n\nuni-video[hidden] {\n display: none;\n}\n\n.uni-video-container {\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n overflow: hidden;\n background-color: black;\n}\n\n.uni-video-slot {\n position: absolute;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n pointer-events: none;\n}\n";
const props = {
const props
$1
= {
id: {
type: String,
default: ""
...
...
@@ -15656,7 +15660,7 @@
const methods = ["play", "pause", "stop", "seek", "sendDanmu", "playbackRate", "requestFullScreen", "exitFullScreen"];
var Video = /* @__PURE__ */ defineBuiltInComponent({
name: "Video",
props,
props
: props$1
,
emits,
setup(props2, {
emit: emit2
...
...
@@ -15741,8 +15745,108 @@
super(id2, "uni-video", Video, parentNodeId, refNodeId, nodeJson, ".uni-video-slot");
}
}
var webview$1 = "uni-web-view {\n display: inline-block;\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n}\n";
const props = {
src: {
type: String,
default: ""
},
webviewStyles: {
type: Object,
default() {
return {};
}
}
};
let webview;
const insertHTMLWebView = ({
htmlId,
src,
webviewStyles
}) => {
const parentWebview = plus.webview.currentWebview();
const styles = extend(webviewStyles, {
"uni-app": "none",
isUniH5: true
});
const parentTitleNView = parentWebview.getTitleNView();
if (parentTitleNView) {
let defaultTop = NAVBAR_HEIGHT + parseFloat(styles.top || "0");
if (plus.navigator.isImmersedStatusbar()) {
defaultTop += plus.navigator.getStatusbarHeight();
}
styles.top = String(defaultTop);
styles.bottom = styles.bottom || "0";
}
webview = plus.webview.create(src, htmlId, styles);
if (parentTitleNView) {
webview.addEventListener("titleUpdate", function() {
const title = webview == null ? void 0 : webview.getTitle();
parentWebview.setStyle({
titleNView: {
titleText: !title || title === "null" ? " " : title
}
});
});
}
plus.webview.currentWebview().append(webview);
};
const removeHTMLWebView = () => {
plus.webview.currentWebview().remove(webview);
webview == null ? void 0 : webview.close("none");
webview = null;
};
var WebView = /* @__PURE__ */ defineBuiltInComponent({
name: "WebView"
name: "WebView",
props,
setup(props2) {
const pageId = getCurrentPageId();
const containerRef = ref(null);
const {
position,
hidden,
onParentReady
} = useNative(containerRef);
const webviewStyles = computed$1(() => props2.webviewStyles);
onParentReady(() => {
const htmlId = ref(WEBVIEW_ID_PREFIX + pageId);
insertHTMLWebView({
htmlId: htmlId.value,
src: getRealPath(props2.src),
webviewStyles: webviewStyles.value
});
UniViewJSBridge.publishHandler(WEBVIEW_INSERTED, {}, pageId);
if (hidden.value)
webview == null ? void 0 : webview.hide();
});
onBeforeUnmount(() => {
removeHTMLWebView();
UniViewJSBridge.publishHandler(WEBVIEW_REMOVED, {}, pageId);
});
watch(() => props2.src, (val) => {
const realPath = getRealPath(val) || "";
if (!realPath) {
return;
}
if (/^(http|https):\/\//.test(realPath) && props2.webviewStyles.progress) {
webview == null ? void 0 : webview.setStyle({
progress: {
color: props2.webviewStyles.progress.color
}
});
}
webview == null ? void 0 : webview.loadURL(realPath);
});
watch(webviewStyles, (webviewStyles2) => {
webview == null ? void 0 : webview.setStyle(webviewStyles2);
});
watch(hidden, (val) => {
webview && webview[val ? "hide" : "show"]();
});
return () => createVNode("uni-web-view", {
"ref": containerRef
}, null, 512);
}
});
class UniWebView extends UniComponent {
constructor(id2, parentNodeId, refNodeId, nodeJson) {
...
...
@@ -15905,7 +16009,11 @@
}
requestAnimationFrame(() => document.addEventListener("scroll", createScrollListener(opts)));
}
function pageScrollTo({ scrollTop, selector, duration }, publish) {
function pageScrollTo({
scrollTop,
selector,
duration
}, publish) {
scrollTo(selector || scrollTop || 0, duration);
publish();
}
...
...
@@ -16079,7 +16187,11 @@
});
callback(result);
}
function loadFontFace({ family, source, desc }, publish) {
function loadFontFace({
family,
source,
desc
}, publish) {
addFont(family, source, desc).then(() => {
publish();
}).catch((err) => {
...
...
packages/uni-app-plus/src/service/framework/app/subscriber/webviewLifecycle.ts
浏览文件 @
c3a0b3d9
function
findPage
(
pageId
:
string
)
{
const
page
=
getCurrentPages
().
find
(
(
page
)
=>
page
.
$page
.
id
===
parseInt
(
pageId
)
)
if
(
!
page
)
{
return
console
.
error
(
`Page[
${
pageId
}
] not found`
)
}
return
page
}
export
function
onWebviewInserted
(
data
:
any
,
pageId
:
string
)
{
const
page
=
findPage
(
pageId
)
import
{
getPageById
}
from
'
@dcloudio/uni-core
'
export
function
onWebviewInserted
(
_
:
unknown
,
pageId
:
string
)
{
const
page
=
getPageById
(
parseInt
(
pageId
))
page
&&
((
page
as
any
).
__uniapp_webview
=
true
)
}
export
function
onWebviewRemoved
(
data
:
any
,
pageId
:
string
)
{
const
page
=
findPage
(
pageId
)
export
function
onWebviewRemoved
(
_
:
unknown
,
pageId
:
string
)
{
const
page
=
getPageById
(
parseInt
(
pageId
)
)
page
&&
delete
(
page
as
any
).
__uniapp_webview
}
packages/uni-app-plus/src/service/framework/dom/Page.ts
浏览文件 @
c3a0b3d9
...
...
@@ -25,6 +25,8 @@ import {
PageNodeOptions
,
}
from
'
@dcloudio/uni-shared
'
import
{
getPageById
}
from
'
@dcloudio/uni-core
'
import
{
ACTION_MINIFY
,
ACTION_TYPE_DICT
,
...
...
@@ -33,7 +35,6 @@ import {
Value
,
VD_SYNC
,
}
from
'
../../../constants
'
import
{
getPageById
}
from
'
@dcloudio/uni-core
'
export
default
class
UniPageNode
extends
UniNode
implements
IUniPageNode
{
pageId
:
number
...
...
@@ -240,14 +241,26 @@ export default class UniPageNode extends UniNode implements IUniPageNode {
}
}
}
export
function
getPageNode
(
pageId
:
number
):
UniPageNode
|
null
{
const
page
=
getPageById
(
pageId
)
if
(
!
page
)
return
null
return
(
page
as
any
).
__page_container__
as
UniPageNode
}
function
findNodeById
(
id
:
number
,
uniNode
:
UniNode
):
UniNode
|
null
{
if
(
uniNode
.
nodeId
===
id
)
{
function
findNode
(
name
:
'
nodeId
'
|
'
nodeName
'
,
value
:
string
|
number
,
uniNode
:
UniNode
|
number
):
UniNode
|
null
{
if
(
typeof
uniNode
===
'
number
'
)
{
uniNode
=
getPageNode
(
uniNode
)
as
UniNode
}
if
(
uniNode
[
name
]
===
value
)
{
return
uniNode
}
const
{
childNodes
}
=
uniNode
for
(
let
i
=
0
;
i
<
childNodes
.
length
;
i
++
)
{
const
uniNode
=
findNode
ById
(
id
,
childNodes
[
i
])
const
uniNode
=
findNode
(
name
,
value
,
childNodes
[
i
])
if
(
uniNode
)
{
return
uniNode
}
...
...
@@ -255,6 +268,17 @@ function findNodeById(id: number, uniNode: UniNode): UniNode | null {
return
null
}
export
function
findNodeById
(
nodeId
:
number
,
uniNode
:
UniNode
|
number
)
{
return
findNode
(
'
nodeId
'
,
nodeId
,
uniNode
)
}
export
function
findNodeByTagName
(
tagName
:
string
,
uniNode
:
UniNode
|
number
):
UniNode
|
null
{
return
findNode
(
'
nodeName
'
,
tagName
.
toUpperCase
(),
uniNode
)
}
function
pushCreateAction
(
pageNode
:
UniPageNode
,
nodeId
:
number
,
...
...
@@ -353,26 +377,3 @@ export function createPageNode(
)
{
return
new
UniPageNode
(
pageId
,
pageOptions
,
setup
)
}
export
function
getPageNode
(
pageId
:
string
):
UniPageNode
|
null
{
const
page
=
getPageById
(
parseInt
(
pageId
))
if
(
!
page
)
return
null
return
(
page
as
any
).
__page_container__
as
UniPageNode
}
export
function
findNodeByTagName
(
tagName
:
string
,
uniNode
:
UniNode
):
UniNode
|
null
{
if
(
uniNode
.
nodeName
===
tagName
.
toLocaleUpperCase
())
{
return
uniNode
}
const
{
childNodes
}
=
uniNode
for
(
let
i
=
0
;
i
<
childNodes
.
length
;
i
++
)
{
const
uniNode
=
findNodeByTagName
(
tagName
,
childNodes
[
i
])
if
(
uniNode
)
{
return
uniNode
}
}
return
null
}
packages/uni-app-plus/src/service/onWebInvokeAppService.ts
浏览文件 @
c3a0b3d9
import
{
getPageNode
,
findNodeByTagName
}
from
'
./framework/dom/Page
'
import
{
findNodeByTagName
}
from
'
./framework/dom/Page
'
import
{
createUniEvent
}
from
'
@dcloudio/uni-shared
'
type
Name
=
...
...
@@ -29,19 +29,16 @@ export const onWebInvokeAppService: WebInvokeAppService = (
}
function
onMessage
(
pageId
:
string
,
arg
:
any
)
{
const
page
=
getPageNode
(
pageId
)
if
(
!
page
)
{
return
}
const
uniNode
=
findNodeByTagName
(
'
web-view
'
,
page
)
uniNode
?.
dispatchEvent
(
createUniEvent
({
type
:
'
onMessage
'
,
target
:
Object
.
create
(
null
),
currentTarget
:
Object
.
create
(
null
),
detail
:
{
data
:
[
arg
],
},
})
)
const
uniNode
=
findNodeByTagName
(
'
web-view
'
,
parseInt
(
pageId
))
uniNode
&&
uniNode
.
dispatchEvent
(
createUniEvent
({
type
:
'
onMessage
'
,
target
:
Object
.
create
(
null
),
currentTarget
:
Object
.
create
(
null
),
detail
:
{
data
:
[
arg
],
},
})
)
}
packages/uni-cli-nvue/dist/webpack/config/index.js
浏览文件 @
c3a0b3d9
...
...
@@ -7,12 +7,11 @@ const module_1 = require("./module");
const
plugins_1
=
require
(
"
./plugins
"
);
function
createConfig
(
mode
)
{
return
{
target
:
'
node
'
,
mode
:
mode
,
devtool
:
false
,
watch
:
mode
===
'
development
'
,
entry
()
{
return
{}
;
return
process
.
UNI_NVUE_ENTRY
;
},
externals
:
{
vue
:
'
Vue
'
,
...
...
packages/uni-cli-nvue/dist/webpack/config/module/rules/index.js
浏览文件 @
c3a0b3d9
...
...
@@ -6,4 +6,15 @@ exports.rules = [
test
:
[
/
\.
nvue
(\?[^
?
]
+
)?
$/
,
/
\.
vue
(\?[^
?
]
+
)?
$/
],
loader
:
'
vue-loader
'
,
},
{
test
:
/
\.
js$/
,
use
:
[
{
loader
:
'
babel-loader
'
,
options
:
{
babelrc
:
false
,
},
},
],
},
];
packages/uni-cli-nvue/dist/webpack/config/plugins/define.js
浏览文件 @
c3a0b3d9
...
...
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports
.
define
=
void
0
;
const
webpack_1
=
require
(
"
webpack
"
);
exports
.
define
=
new
webpack_1
.
DefinePlugin
({
'
process.env
'
:
{
NODE_ENV
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
VUE_APP_PLATFORM
:
JSON
.
stringify
(
process
.
env
.
UNI_PLATFORM
),
UNI_CLOUD_PROVIDER
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
HBX_USER_TOKEN
:
JSON
.
stringify
(
process
.
env
.
HBX_USER_TOKEN
||
''
),
UNI_AUTOMATOR_WS_ENDPOINT
:
JSON
.
stringify
(
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
),
},
'
process.env.NODE_ENV
'
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
'
process.env.VUE_APP_PLATFORM
'
:
JSON
.
stringify
(
process
.
env
.
UNI_PLATFORM
),
'
process.env.UNI_CLOUD_PROVIDER
'
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
'
process.env.HBX_USER_TOKEN
'
:
JSON
.
stringify
(
process
.
env
.
HBX_USER_TOKEN
||
''
),
'
process.env.UNI_AUTOMATOR_WS_ENDPOINT
'
:
JSON
.
stringify
(
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
),
});
packages/uni-cli-nvue/package.json
浏览文件 @
c3a0b3d9
...
...
@@ -20,6 +20,9 @@
"license"
:
"Apache-2.0"
,
"gitHead"
:
"4dd0e035b52584ff028ee3028c46adc555be0529"
,
"dependencies"
:
{
"@babel/core"
:
"^7.14.8"
,
"@babel/preset-env"
:
"^7.14.8"
,
"babel-loader"
:
"^8.2.2"
,
"terser-webpack-plugin"
:
"^5.1.4"
,
"vue-loader"
:
"^16.3.3"
,
"webpack"
:
"^5.45.1"
...
...
packages/uni-cli-nvue/src/webpack/config/index.ts
浏览文件 @
c3a0b3d9
...
...
@@ -7,12 +7,11 @@ export function createConfig(
mode
:
'
production
'
|
'
development
'
):
Configuration
{
return
{
target
:
'
node
'
,
mode
:
mode
,
devtool
:
false
,
watch
:
mode
===
'
development
'
,
entry
()
{
return
{}
return
process
.
UNI_NVUE_ENTRY
},
externals
:
{
vue
:
'
Vue
'
,
...
...
packages/uni-cli-nvue/src/webpack/config/module/rules/index.ts
浏览文件 @
c3a0b3d9
...
...
@@ -4,4 +4,15 @@ export const rules: RuleSetRule[] = [
test
:
[
/
\.
nvue
(\?[^
?
]
+
)?
$/
,
/
\.
vue
(\?[^
?
]
+
)?
$/
],
loader
:
'
vue-loader
'
,
},
{
test
:
/
\.
js$/
,
use
:
[
{
loader
:
'
babel-loader
'
,
options
:
{
babelrc
:
false
,
},
},
],
},
]
packages/uni-cli-nvue/src/webpack/config/plugins/define.ts
浏览文件 @
c3a0b3d9
import
{
DefinePlugin
}
from
'
webpack
'
export
const
define
=
new
DefinePlugin
({
'
process.env
'
:
{
NODE_ENV
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
VUE_APP_PLATFORM
:
JSON
.
stringify
(
process
.
env
.
UNI_PLATFORM
)
,
UNI_CLOUD_PROVIDER
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
HBX_USER_TOKEN
:
JSON
.
stringify
(
process
.
env
.
HBX_USER_TOKEN
||
''
),
UNI_AUTOMATOR_WS_ENDPOINT
:
JSON
.
stringify
(
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
),
}
,
'
process.env
.NODE_ENV
'
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
),
'
process.env.VUE_APP_PLATFORM
'
:
JSON
.
stringify
(
process
.
env
.
UNI_PLATFORM
),
'
process.env.UNI_CLOUD_PROVIDER
'
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
'
process.env.HBX_USER_TOKEN
'
:
JSON
.
stringify
(
process
.
env
.
HBX_USER_TOKEN
||
''
),
'
process.env.UNI_AUTOMATOR_WS_ENDPOINT
'
:
JSON
.
stringify
(
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
)
,
})
packages/uni-cli-shared/package.json
浏览文件 @
c3a0b3d9
...
...
@@ -19,7 +19,7 @@
"url"
:
"https://github.com/dcloudio/uni-app/issues"
},
"dependencies"
:
{
"@rollup/pluginutils"
:
"^4.1.
0
"
,
"@rollup/pluginutils"
:
"^4.1.
1
"
,
"compare-versions"
:
"^3.6.0"
,
"debug"
:
"^4.3.1"
,
"estree-walker"
:
"^2.0.2"
,
...
...
packages/uni-h5-vite/lib/ssr/cloudfunction.js
0 → 100644
浏览文件 @
c3a0b3d9
'
use strict
'
const
fs
=
require
(
'
fs
'
)
const
path
=
require
(
'
path
'
)
const
template
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
./server/index.html
'
),
'
utf-8
'
)
const
manifest
=
require
(
'
./server/ssr-manifest.json
'
)
const
render
=
require
(
'
./server/entry-server.js
'
).
render
exports
.
main
=
async
(
event
)
=>
{
const
[
appHtml
,
preloadLinks
,
appContext
]
=
await
render
(
event
.
path
,
manifest
)
const
html
=
template
.
replace
(
`<!--preload-links-->`
,
preloadLinks
)
.
replace
(
`<!--app-html-->`
,
appHtml
)
.
replace
(
`<!--app-context-->`
,
appContext
)
return
{
mpserverlessComposedResponse
:
true
,
// 使用阿里云返回集成响应是需要此字段为true
statusCode
:
200
,
headers
:
{
'
content-type
'
:
'
text/html
'
,
},
body
:
html
,
}
}
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
c3a0b3d9
...
...
@@ -7770,7 +7770,7 @@ const onWebInvokeAppService = ({ name, arg }) => {
uni
[
name
](
arg
);
}
};
const
Invoke
=
/* @__PURE__ */
uniShared
.
once
(()
=>
UniServiceJSBridge
.
on
(
"
onWebInvokeAppService
"
,
onWebInvokeAppService
));
const
Invoke
=
/* @__PURE__ */
uniShared
.
once
(()
=>
UniServiceJSBridge
.
on
(
uniShared
.
ON_WEB_INVOKE_APP_SERVICE
,
onWebInvokeAppService
));
const
props$7
=
{
src
:
{
type
:
String
,
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
c3a0b3d9
...
...
@@ -14681,7 +14681,7 @@ const onWebInvokeAppService = ({ name, arg }) => {
uni[name](arg);
}
};
const Invoke = /* @__PURE__ */ once(() => UniServiceJSBridge.on(
"onWebInvokeAppService"
, onWebInvokeAppService));
const Invoke = /* @__PURE__ */ once(() => UniServiceJSBridge.on(
ON_WEB_INVOKE_APP_SERVICE
, onWebInvokeAppService));
const props$e = {
src: {
type: String,
...
...
packages/uni-mp-alipay/dist/uni.api.esm.js
浏览文件 @
c3a0b3d9
...
...
@@ -1255,4 +1255,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
export
default
index
;
export
{
index
as
default
}
;
packages/uni-mp-baidu/dist/uni.api.esm.js
浏览文件 @
c3a0b3d9
...
...
@@ -825,4 +825,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
export
default
index
;
export
{
index
as
default
}
;
packages/uni-mp-qq/dist/uni.api.esm.js
浏览文件 @
c3a0b3d9
...
...
@@ -726,4 +726,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
export
default
index
;
export
{
index
as
default
}
;
packages/uni-mp-toutiao/dist/uni.api.esm.js
浏览文件 @
c3a0b3d9
...
...
@@ -791,4 +791,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
export
default
index
;
export
{
index
as
default
}
;
packages/uni-mp-weixin/dist/uni.api.esm.js
浏览文件 @
c3a0b3d9
...
...
@@ -689,4 +689,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
export
default
index
;
export
{
index
as
default
}
;
packages/uni-quickapp-webview/dist/uni.api.esm.js
浏览文件 @
c3a0b3d9
...
...
@@ -733,4 +733,4 @@ var protocols = /*#__PURE__*/Object.freeze({
var
index
=
initUni
(
shims
,
protocols
);
export
default
index
;
export
{
index
as
default
}
;
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
c3a0b3d9
...
...
@@ -1014,6 +1014,7 @@ exports.cache = cache;
exports
.
cacheStringFunction
=
cacheStringFunction
;
exports
.
callOptions
=
callOptions
;
exports
.
createRpx2Unit
=
createRpx2Unit
;
exports
.
createUniEvent
=
createUniEvent
;
exports
.
debounce
=
debounce
;
exports
.
decode
=
decode
;
exports
.
decodedQuery
=
decodedQuery
;
...
...
packages/uni-shared/dist/uni-shared.d.ts
浏览文件 @
c3a0b3d9
...
...
@@ -79,6 +79,8 @@ Partial<UniNodeJSON | UniNodeJSONMinify>?
export
declare
function
createRpx2Unit
(
unit
:
string
,
unitRatio
:
number
,
unitPrecision
:
number
):
(
val
:
string
)
=>
string
;
export
declare
function
createUniEvent
(
evt
:
Record
<
string
,
any
>
):
UniEvent
;
export
declare
const
DATA_RE
:
RegExp
;
export
declare
function
debounce
(
fn
:
Function
,
delay
:
number
):
{
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
c3a0b3d9
...
...
@@ -929,4 +929,4 @@ function getEnvLocale() {
return
(
lang
&&
lang
.
replace
(
/
[
.:
]
.*/
,
''
))
||
'
en
'
;
}
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
,
ATTR_CLASS
,
ATTR_STYLE
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
EventChannel
,
EventModifierFlags
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
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
,
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
,
decodedQuery
,
defaultRpx2Unit
,
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
,
ATTR_CLASS
,
ATTR_STYLE
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
EventChannel
,
EventModifierFlags
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
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
,
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
,
createUniEvent
,
debounce
,
decode
,
decodedQuery
,
defaultRpx2Unit
,
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
};
yarn.lock
浏览文件 @
c3a0b3d9
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录