@dcloudio/uni-app 0.0.1-nvue3.3030820220125001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/dist/uni-app.cjs.js +150 -0
- package/dist/uni-app.d.ts +194 -0
- package/dist/uni-app.es.js +91 -0
- package/dist/uni.compiler.js +10 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var shared = require('@vue/shared');
|
|
7
|
+
var uniShared = require('@dcloudio/uni-shared');
|
|
8
|
+
|
|
9
|
+
function assertKey(key, shallow = false) {
|
|
10
|
+
if (!key) {
|
|
11
|
+
throw new Error(`${shallow ? 'shallowSsrRef' : 'ssrRef'}: You must provide a key.`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function proxy(target, track, trigger) {
|
|
15
|
+
return new Proxy(target, {
|
|
16
|
+
get(target, prop) {
|
|
17
|
+
track();
|
|
18
|
+
if (shared.isObject(target[prop])) {
|
|
19
|
+
return proxy(target[prop], track, trigger);
|
|
20
|
+
}
|
|
21
|
+
return Reflect.get(target, prop);
|
|
22
|
+
},
|
|
23
|
+
set(obj, prop, newVal) {
|
|
24
|
+
const result = Reflect.set(obj, prop, newVal);
|
|
25
|
+
trigger();
|
|
26
|
+
return result;
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const globalData = {};
|
|
31
|
+
const ssrServerRef = (value, key, shallow = false) => {
|
|
32
|
+
assertKey(key, shallow);
|
|
33
|
+
const ctx = vue.getCurrentInstance() && vue.useSSRContext();
|
|
34
|
+
let state;
|
|
35
|
+
if (ctx) {
|
|
36
|
+
const __uniSSR = ctx[uniShared.UNI_SSR] || (ctx[uniShared.UNI_SSR] = {});
|
|
37
|
+
state = __uniSSR[uniShared.UNI_SSR_DATA] || (__uniSSR[uniShared.UNI_SSR_DATA] = {});
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
state = globalData;
|
|
41
|
+
}
|
|
42
|
+
state[key] = uniShared.sanitise(value);
|
|
43
|
+
// SSR 模式下 watchEffect 不生效 https://github.com/vuejs/vue-next/blob/master/packages/runtime-core/src/apiWatch.ts#L283
|
|
44
|
+
// 故自定义ref
|
|
45
|
+
return vue.customRef((track, trigger) => {
|
|
46
|
+
const customTrigger = () => (trigger(), (state[key] = uniShared.sanitise(value)));
|
|
47
|
+
return {
|
|
48
|
+
get: () => {
|
|
49
|
+
track();
|
|
50
|
+
if (!shallow && shared.isObject(value)) {
|
|
51
|
+
return proxy(value, track, customTrigger);
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
},
|
|
55
|
+
set: (v) => {
|
|
56
|
+
value = v;
|
|
57
|
+
customTrigger();
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const ssrRef = (value, key) => {
|
|
63
|
+
{
|
|
64
|
+
return ssrServerRef(value, key);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const shallowSsrRef = (value, key) => {
|
|
68
|
+
{
|
|
69
|
+
return ssrServerRef(value, key, true);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function getSsrGlobalData() {
|
|
73
|
+
return uniShared.sanitise(globalData);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function resolveEasycom(component, easycom) {
|
|
77
|
+
return shared.isString(component) ? easycom : component;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) =>
|
|
82
|
+
// post-create lifecycle registrations are noops during SSR
|
|
83
|
+
!vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target);
|
|
84
|
+
const onShow = /*#__PURE__*/ createHook(uniShared.ON_SHOW);
|
|
85
|
+
const onHide = /*#__PURE__*/ createHook(uniShared.ON_HIDE);
|
|
86
|
+
const onLaunch = /*#__PURE__*/ createHook(uniShared.ON_LAUNCH);
|
|
87
|
+
const onError = /*#__PURE__*/ createHook(uniShared.ON_ERROR);
|
|
88
|
+
const onThemeChange =
|
|
89
|
+
/*#__PURE__*/ createHook(uniShared.ON_THEME_CHANGE);
|
|
90
|
+
const onPageNotFound =
|
|
91
|
+
/*#__PURE__*/ createHook(uniShared.ON_PAGE_NOT_FOUND);
|
|
92
|
+
const onUnhandledRejection =
|
|
93
|
+
/*#__PURE__*/ createHook(uniShared.ON_UNHANDLE_REJECTION);
|
|
94
|
+
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧
|
|
95
|
+
const onLoad = /*#__PURE__*/ createHook(uniShared.ON_LOAD);
|
|
96
|
+
const onReady = /*#__PURE__*/ createHook(uniShared.ON_READY);
|
|
97
|
+
const onUnload = /*#__PURE__*/ createHook(uniShared.ON_UNLOAD);
|
|
98
|
+
const onResize = /*#__PURE__*/ createHook(uniShared.ON_RESIZE);
|
|
99
|
+
const onBackPress =
|
|
100
|
+
/*#__PURE__*/ createHook(uniShared.ON_BACK_PRESS);
|
|
101
|
+
const onPageScroll =
|
|
102
|
+
/*#__PURE__*/ createHook(uniShared.ON_PAGE_SCROLL);
|
|
103
|
+
const onTabItemTap =
|
|
104
|
+
/*#__PURE__*/ createHook(uniShared.ON_TAB_ITEM_TAP);
|
|
105
|
+
const onReachBottom = /*#__PURE__*/ createHook(uniShared.ON_REACH_BOTTOM);
|
|
106
|
+
const onPullDownRefresh = /*#__PURE__*/ createHook(uniShared.ON_PULL_DOWN_REFRESH);
|
|
107
|
+
const onShareTimeline =
|
|
108
|
+
/*#__PURE__*/ createHook(uniShared.ON_SHARE_TIMELINE);
|
|
109
|
+
const onAddToFavorites =
|
|
110
|
+
/*#__PURE__*/ createHook(uniShared.ON_ADD_TO_FAVORITES);
|
|
111
|
+
const onShareAppMessage =
|
|
112
|
+
/*#__PURE__*/ createHook(uniShared.ON_SHARE_APP_MESSAGE);
|
|
113
|
+
const onNavigationBarButtonTap =
|
|
114
|
+
/*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_BUTTON_TAP);
|
|
115
|
+
const onNavigationBarSearchInputChanged =
|
|
116
|
+
/*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED);
|
|
117
|
+
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
|
|
118
|
+
const onNavigationBarSearchInputConfirmed =
|
|
119
|
+
/*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED);
|
|
120
|
+
const onNavigationBarSearchInputFocusChanged =
|
|
121
|
+
/*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED);
|
|
122
|
+
|
|
123
|
+
exports.getSsrGlobalData = getSsrGlobalData;
|
|
124
|
+
exports.onAddToFavorites = onAddToFavorites;
|
|
125
|
+
exports.onBackPress = onBackPress;
|
|
126
|
+
exports.onError = onError;
|
|
127
|
+
exports.onHide = onHide;
|
|
128
|
+
exports.onLaunch = onLaunch;
|
|
129
|
+
exports.onLoad = onLoad;
|
|
130
|
+
exports.onNavigationBarButtonTap = onNavigationBarButtonTap;
|
|
131
|
+
exports.onNavigationBarSearchInputChanged = onNavigationBarSearchInputChanged;
|
|
132
|
+
exports.onNavigationBarSearchInputClicked = onNavigationBarSearchInputClicked;
|
|
133
|
+
exports.onNavigationBarSearchInputConfirmed = onNavigationBarSearchInputConfirmed;
|
|
134
|
+
exports.onNavigationBarSearchInputFocusChanged = onNavigationBarSearchInputFocusChanged;
|
|
135
|
+
exports.onPageNotFound = onPageNotFound;
|
|
136
|
+
exports.onPageScroll = onPageScroll;
|
|
137
|
+
exports.onPullDownRefresh = onPullDownRefresh;
|
|
138
|
+
exports.onReachBottom = onReachBottom;
|
|
139
|
+
exports.onReady = onReady;
|
|
140
|
+
exports.onResize = onResize;
|
|
141
|
+
exports.onShareAppMessage = onShareAppMessage;
|
|
142
|
+
exports.onShareTimeline = onShareTimeline;
|
|
143
|
+
exports.onShow = onShow;
|
|
144
|
+
exports.onTabItemTap = onTabItemTap;
|
|
145
|
+
exports.onThemeChange = onThemeChange;
|
|
146
|
+
exports.onUnhandledRejection = onUnhandledRejection;
|
|
147
|
+
exports.onUnload = onUnload;
|
|
148
|
+
exports.resolveEasycom = resolveEasycom;
|
|
149
|
+
exports.shallowSsrRef = shallowSsrRef;
|
|
150
|
+
exports.ssrRef = ssrRef;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type { ComponentInternalInstance } from '@vue/runtime-core';
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import { shallowRef } from 'vue';
|
|
4
|
+
|
|
5
|
+
declare interface AddToFavoritesContent {
|
|
6
|
+
title?: string;
|
|
7
|
+
imageUrl?: string;
|
|
8
|
+
query?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare interface AddToFavoritesOption {
|
|
12
|
+
webviewUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare interface BackPressOption {
|
|
16
|
+
from: 'backbutton' | 'navigateBack';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare interface CustomShareAppMessage {
|
|
20
|
+
title?: string;
|
|
21
|
+
path?: string;
|
|
22
|
+
imageUrl?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare interface CustomShareTimeline {
|
|
26
|
+
title?: string;
|
|
27
|
+
query?: string;
|
|
28
|
+
imageUrl?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export declare function getSsrGlobalData(): any;
|
|
32
|
+
|
|
33
|
+
declare type LaunchOption = LaunchShowOption;
|
|
34
|
+
|
|
35
|
+
declare interface LaunchShowOption {
|
|
36
|
+
path: string;
|
|
37
|
+
query: Record<string, string | undefined>;
|
|
38
|
+
scene: number;
|
|
39
|
+
shareTicket: string;
|
|
40
|
+
referrerInfo?: ReferrerInfo;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare interface NavigationBarButtonTapOption {
|
|
44
|
+
index: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare interface NavigationBarSearchInputChangedOption {
|
|
48
|
+
text: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare type NavigationBarSearchInputConfirmedOption = NavigationBarSearchInputChangedOption;
|
|
52
|
+
|
|
53
|
+
declare interface NavigationBarSearchInputFocusChanged {
|
|
54
|
+
focus: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export declare const onAddToFavorites: (hook: onAddToFavoritesHook, target?: ComponentInternalInstance | null) => any;
|
|
58
|
+
|
|
59
|
+
declare type onAddToFavoritesHook = (options: AddToFavoritesOption) => AddToFavoritesContent | void;
|
|
60
|
+
|
|
61
|
+
declare type onAppShowHook = (options: LaunchShowOption) => void;
|
|
62
|
+
|
|
63
|
+
export declare const onBackPress: (hook: onBackPressHook, target?: ComponentInternalInstance | null) => any;
|
|
64
|
+
|
|
65
|
+
declare type onBackPressHook = (options: BackPressOption) => boolean | void;
|
|
66
|
+
|
|
67
|
+
export declare const onError: (hook: onErrorHook, target?: ComponentInternalInstance | null) => any;
|
|
68
|
+
|
|
69
|
+
declare type onErrorHook = (error: string) => void;
|
|
70
|
+
|
|
71
|
+
export declare const onHide: (hook: () => any, target?: ComponentInternalInstance | null) => any;
|
|
72
|
+
|
|
73
|
+
export declare const onLaunch: (hook: onLaunchHook, target?: ComponentInternalInstance | null) => any;
|
|
74
|
+
|
|
75
|
+
declare type onLaunchHook = (options: LaunchOption) => void;
|
|
76
|
+
|
|
77
|
+
export declare const onLoad: (hook: onLoadHook, target?: ComponentInternalInstance | null) => any;
|
|
78
|
+
|
|
79
|
+
declare type onLoadHook = (query: Record<string, string | undefined>) => void;
|
|
80
|
+
|
|
81
|
+
export declare const onNavigationBarButtonTap: (hook: onNavigationBarButtonTapHook, target?: ComponentInternalInstance | null) => any;
|
|
82
|
+
|
|
83
|
+
declare type onNavigationBarButtonTapHook = (options: NavigationBarButtonTapOption) => void;
|
|
84
|
+
|
|
85
|
+
export declare const onNavigationBarSearchInputChanged: (hook: onNavigationBarSearchInputChangedHook, target?: ComponentInternalInstance | null) => any;
|
|
86
|
+
|
|
87
|
+
declare type onNavigationBarSearchInputChangedHook = (options: NavigationBarSearchInputChangedOption) => void;
|
|
88
|
+
|
|
89
|
+
export declare const onNavigationBarSearchInputClicked: (hook: () => any, target?: ComponentInternalInstance | null) => any;
|
|
90
|
+
|
|
91
|
+
export declare const onNavigationBarSearchInputConfirmed: (hook: onNavigationBarSearchInputConfirmedHook, target?: ComponentInternalInstance | null) => any;
|
|
92
|
+
|
|
93
|
+
declare type onNavigationBarSearchInputConfirmedHook = (options: NavigationBarSearchInputConfirmedOption) => void;
|
|
94
|
+
|
|
95
|
+
export declare const onNavigationBarSearchInputFocusChanged: (hook: onNavigationBarSearchInputFocusChangedHook, target?: ComponentInternalInstance | null) => any;
|
|
96
|
+
|
|
97
|
+
declare type onNavigationBarSearchInputFocusChangedHook = (options: NavigationBarSearchInputFocusChanged) => void;
|
|
98
|
+
|
|
99
|
+
export declare const onPageNotFound: (hook: onPageNotFoundHook, target?: ComponentInternalInstance | null) => any;
|
|
100
|
+
|
|
101
|
+
declare type onPageNotFoundHook = (options: PageNotFoundOption) => void;
|
|
102
|
+
|
|
103
|
+
export declare const onPageScroll: (hook: onPageScrollHook, target?: ComponentInternalInstance | null) => any;
|
|
104
|
+
|
|
105
|
+
declare type onPageScrollHook = (options: PageScrollOption) => void;
|
|
106
|
+
|
|
107
|
+
declare type onPageShowHook = () => void;
|
|
108
|
+
|
|
109
|
+
export declare const onPullDownRefresh: (hook: () => any, target?: ComponentInternalInstance | null) => any;
|
|
110
|
+
|
|
111
|
+
export declare const onReachBottom: (hook: () => any, target?: ComponentInternalInstance | null) => any;
|
|
112
|
+
|
|
113
|
+
export declare const onReady: (hook: () => any, target?: ComponentInternalInstance | null) => any;
|
|
114
|
+
|
|
115
|
+
export declare const onResize: (hook: onResizeHook, target?: ComponentInternalInstance | null) => any;
|
|
116
|
+
|
|
117
|
+
declare type onResizeHook = (options: ResizeOption) => void;
|
|
118
|
+
|
|
119
|
+
export declare const onShareAppMessage: (hook: onShareAppMessageHook, target?: ComponentInternalInstance | null) => any;
|
|
120
|
+
|
|
121
|
+
declare type onShareAppMessageHook = (options: ShareAppMessageOption) => CustomShareAppMessage | void;
|
|
122
|
+
|
|
123
|
+
export declare const onShareTimeline: (hook: onShareTimelineHook, target?: ComponentInternalInstance | null) => any;
|
|
124
|
+
|
|
125
|
+
declare type onShareTimelineHook = () => CustomShareTimeline | void;
|
|
126
|
+
|
|
127
|
+
export declare const onShow: (hook: onAppShowHook | onPageShowHook, target?: ComponentInternalInstance | null) => any;
|
|
128
|
+
|
|
129
|
+
export declare const onTabItemTap: (hook: onTabItemTapHook, target?: ComponentInternalInstance | null) => any;
|
|
130
|
+
|
|
131
|
+
declare type onTabItemTapHook = (options: TabItemTapOption) => void;
|
|
132
|
+
|
|
133
|
+
export declare const onThemeChange: (hook: onThemeChangeHook, target?: ComponentInternalInstance | null) => any;
|
|
134
|
+
|
|
135
|
+
declare type onThemeChangeHook = (options: ThemeChangeOption) => void;
|
|
136
|
+
|
|
137
|
+
export declare const onUnhandledRejection: (hook: onUnhandledRejectionHook, target?: ComponentInternalInstance | null) => any;
|
|
138
|
+
|
|
139
|
+
declare type onUnhandledRejectionHook = (options: UnhandledRejectionOption) => void;
|
|
140
|
+
|
|
141
|
+
export declare const onUnload: (hook: () => any, target?: ComponentInternalInstance | null) => any;
|
|
142
|
+
|
|
143
|
+
declare interface PageNotFoundOption {
|
|
144
|
+
path: string;
|
|
145
|
+
query: Record<string, string | undefined>;
|
|
146
|
+
isEntryPage: boolean;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
declare interface PageScrollOption {
|
|
150
|
+
scrollTop: number;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare interface ReferrerInfo {
|
|
154
|
+
appId: string;
|
|
155
|
+
extraData?: any;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
declare interface ResizeOption {
|
|
159
|
+
size: {
|
|
160
|
+
windowWidth: number;
|
|
161
|
+
windowHeight: number;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export declare function resolveEasycom(component: unknown, easycom: unknown): unknown;
|
|
166
|
+
|
|
167
|
+
export declare const shallowSsrRef: SSRRef;
|
|
168
|
+
|
|
169
|
+
declare interface ShareAppMessageOption {
|
|
170
|
+
from: 'button' | 'menu' | string;
|
|
171
|
+
target: any;
|
|
172
|
+
webViewUrl?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
declare type SSRRef = (value: unknown, key?: string, shallow?: boolean) => ReturnType<typeof ref> | ReturnType<typeof shallowRef>;
|
|
176
|
+
|
|
177
|
+
export declare const ssrRef: SSRRef;
|
|
178
|
+
|
|
179
|
+
declare interface TabItemTapOption {
|
|
180
|
+
index: string;
|
|
181
|
+
pagePath: string;
|
|
182
|
+
text: string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
declare interface ThemeChangeOption {
|
|
186
|
+
theme: 'dark' | 'light';
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
declare interface UnhandledRejectionOption {
|
|
190
|
+
promise: Promise<any>;
|
|
191
|
+
reason: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export { }
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { shallowRef, ref, getCurrentInstance, isInSSRComponentSetup, injectHook } from 'vue';
|
|
2
|
+
import { hasOwn, isString } from '@vue/shared';
|
|
3
|
+
import { sanitise, UNI_SSR_DATA, UNI_SSR_GLOBAL_DATA, UNI_SSR, ON_SHOW, ON_HIDE, ON_LAUNCH, ON_ERROR, ON_THEME_CHANGE, ON_PAGE_NOT_FOUND, ON_UNHANDLE_REJECTION, ON_LOAD, ON_READY, ON_UNLOAD, ON_RESIZE, ON_BACK_PRESS, ON_PAGE_SCROLL, ON_TAB_ITEM_TAP, ON_REACH_BOTTOM, ON_PULL_DOWN_REFRESH, ON_SHARE_TIMELINE, ON_ADD_TO_FAVORITES, ON_SHARE_APP_MESSAGE, 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 } from '@dcloudio/uni-shared';
|
|
4
|
+
|
|
5
|
+
function getSSRDataType() {
|
|
6
|
+
return getCurrentInstance() ? UNI_SSR_DATA : UNI_SSR_GLOBAL_DATA;
|
|
7
|
+
}
|
|
8
|
+
function assertKey(key, shallow = false) {
|
|
9
|
+
if (!key) {
|
|
10
|
+
throw new Error(`${shallow ? 'shallowSsrRef' : 'ssrRef'}: You must provide a key.`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const ssrClientRef = (value, key, shallow = false) => {
|
|
14
|
+
const valRef = shallow ? shallowRef(value) : ref(value);
|
|
15
|
+
// 非 h5 平台
|
|
16
|
+
if (typeof window === 'undefined') {
|
|
17
|
+
return valRef;
|
|
18
|
+
}
|
|
19
|
+
const __uniSSR = window[UNI_SSR];
|
|
20
|
+
if (!__uniSSR) {
|
|
21
|
+
return valRef;
|
|
22
|
+
}
|
|
23
|
+
const type = getSSRDataType();
|
|
24
|
+
assertKey(key, shallow);
|
|
25
|
+
if (hasOwn(__uniSSR[type], key)) {
|
|
26
|
+
valRef.value = __uniSSR[type][key];
|
|
27
|
+
if (type === UNI_SSR_DATA) {
|
|
28
|
+
delete __uniSSR[type][key]; // TODO 非全局数据仅使用一次?否则下次还会再次使用该数据
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return valRef;
|
|
32
|
+
};
|
|
33
|
+
const globalData = {};
|
|
34
|
+
const ssrRef = (value, key) => {
|
|
35
|
+
return ssrClientRef(value, key);
|
|
36
|
+
};
|
|
37
|
+
const shallowSsrRef = (value, key) => {
|
|
38
|
+
return ssrClientRef(value, key, true);
|
|
39
|
+
};
|
|
40
|
+
function getSsrGlobalData() {
|
|
41
|
+
return sanitise(globalData);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function resolveEasycom(component, easycom) {
|
|
45
|
+
return isString(component) ? easycom : component;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
const createHook = (lifecycle) => (hook, target = getCurrentInstance()) =>
|
|
50
|
+
// post-create lifecycle registrations are noops during SSR
|
|
51
|
+
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
|
|
52
|
+
const onShow = /*#__PURE__*/ createHook(ON_SHOW);
|
|
53
|
+
const onHide = /*#__PURE__*/ createHook(ON_HIDE);
|
|
54
|
+
const onLaunch = /*#__PURE__*/ createHook(ON_LAUNCH);
|
|
55
|
+
const onError = /*#__PURE__*/ createHook(ON_ERROR);
|
|
56
|
+
const onThemeChange =
|
|
57
|
+
/*#__PURE__*/ createHook(ON_THEME_CHANGE);
|
|
58
|
+
const onPageNotFound =
|
|
59
|
+
/*#__PURE__*/ createHook(ON_PAGE_NOT_FOUND);
|
|
60
|
+
const onUnhandledRejection =
|
|
61
|
+
/*#__PURE__*/ createHook(ON_UNHANDLE_REJECTION);
|
|
62
|
+
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧
|
|
63
|
+
const onLoad = /*#__PURE__*/ createHook(ON_LOAD);
|
|
64
|
+
const onReady = /*#__PURE__*/ createHook(ON_READY);
|
|
65
|
+
const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD);
|
|
66
|
+
const onResize = /*#__PURE__*/ createHook(ON_RESIZE);
|
|
67
|
+
const onBackPress =
|
|
68
|
+
/*#__PURE__*/ createHook(ON_BACK_PRESS);
|
|
69
|
+
const onPageScroll =
|
|
70
|
+
/*#__PURE__*/ createHook(ON_PAGE_SCROLL);
|
|
71
|
+
const onTabItemTap =
|
|
72
|
+
/*#__PURE__*/ createHook(ON_TAB_ITEM_TAP);
|
|
73
|
+
const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM);
|
|
74
|
+
const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH);
|
|
75
|
+
const onShareTimeline =
|
|
76
|
+
/*#__PURE__*/ createHook(ON_SHARE_TIMELINE);
|
|
77
|
+
const onAddToFavorites =
|
|
78
|
+
/*#__PURE__*/ createHook(ON_ADD_TO_FAVORITES);
|
|
79
|
+
const onShareAppMessage =
|
|
80
|
+
/*#__PURE__*/ createHook(ON_SHARE_APP_MESSAGE);
|
|
81
|
+
const onNavigationBarButtonTap =
|
|
82
|
+
/*#__PURE__*/ createHook(ON_NAVIGATION_BAR_BUTTON_TAP);
|
|
83
|
+
const onNavigationBarSearchInputChanged =
|
|
84
|
+
/*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED);
|
|
85
|
+
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
|
|
86
|
+
const onNavigationBarSearchInputConfirmed =
|
|
87
|
+
/*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED);
|
|
88
|
+
const onNavigationBarSearchInputFocusChanged =
|
|
89
|
+
/*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED);
|
|
90
|
+
|
|
91
|
+
export { getSsrGlobalData, onAddToFavorites, onBackPress, onError, onHide, onLaunch, onLoad, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, resolveEasycom, shallowSsrRef, ssrRef };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = () => [
|
|
4
|
+
/* eslint-disable no-restricted-globals */
|
|
5
|
+
...require('@dcloudio/uni-cloud/lib/uni.plugin.js').default(),
|
|
6
|
+
/* eslint-disable no-restricted-globals */
|
|
7
|
+
...require('@dcloudio/uni-stat/lib/uni.plugin.js')(),
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
module.exports = index;
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dcloudio/uni-app",
|
|
3
|
+
"version": "0.0.1-nvue3.3030820220125001",
|
|
4
|
+
"description": "@dcloudio/uni-app",
|
|
5
|
+
"main": "./dist/uni-app.cjs.js",
|
|
6
|
+
"module": "./dist/uni-app.es.js",
|
|
7
|
+
"types": "./dist/uni-app.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/dcloudio/uni-app.git",
|
|
15
|
+
"directory": "packages/uni-app"
|
|
16
|
+
},
|
|
17
|
+
"license": "Apache-2.0",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/dcloudio/uni-app/issues"
|
|
20
|
+
},
|
|
21
|
+
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
22
|
+
"uni-app": {
|
|
23
|
+
"name": "uni-app",
|
|
24
|
+
"main": "dist/uni.compiler.js"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@dcloudio/uni-cloud": "0.0.1-nvue3.3030820220125001",
|
|
28
|
+
"@dcloudio/uni-components": "0.0.1-nvue3.3030820220125001",
|
|
29
|
+
"@dcloudio/uni-i18n": "0.0.1-nvue3.3030820220125001",
|
|
30
|
+
"@dcloudio/uni-shared": "0.0.1-nvue3.3030820220125001",
|
|
31
|
+
"@dcloudio/uni-stat": "0.0.1-nvue3.3030820220125001",
|
|
32
|
+
"@vue/shared": "3.2.29"
|
|
33
|
+
}
|
|
34
|
+
}
|