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

feat: add @dcloudio/uni-app

上级 090c78ff
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
\ No newline at end of file
{
"extends": "../../api-extractor.json",
"mainEntryPointFilePath": "./dist/packages/<unscopedPackageName>/src/index.d.ts",
"dtsRollup": {
"publicTrimmedFilePath": "./dist/<unscopedPackageName>.d.ts"
}
}
\ No newline at end of file
{
"input": {
"src/index.ts": ["dist/uni-app.esm.js"]
},
"compilerOptions": {
"declaration": true
}
}
import { ComponentInternalInstance } from 'vue';
export declare const onAddToFavorites: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onBackPress: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onError: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onHide: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onLaunch: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarButtonTap: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputChanged: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputClicked: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputConfirmed: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onNavigationBarSearchInputFocusChanged: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onPageNotFound: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onPageScroll: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onPullDownRefresh: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onReachBottom: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onReady: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onResize: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onShareAppMessage: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onShareTimeline: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onShow: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onTabItemTap: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onThemeChange: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onUnhandledRejection: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export declare const onUnload: (hook: () => any, target?: ComponentInternalInstance | null) => any;
export { }
import { getCurrentInstance, isInSSRComponentSetup, injectHook } from 'vue';
// @ts-ignore
// App and Page
const ON_SHOW = 'onShow';
const ON_HIDE = 'onHide';
//App
const ON_LAUNCH = 'onLaunch';
const ON_ERROR = 'onError';
const ON_THEME_CHANGE = 'onThemeChange';
const ON_PAGE_NOT_FOUND = 'onPageNotFound';
const ON_UNHANDLE_REJECTION = 'onUnhandledRejection';
const ON_READY = 'onReady';
const ON_UNLOAD = 'onUnload';
const ON_RESIZE = 'onResize';
const ON_BACK_PRESS = 'onBackPress';
const ON_PAGE_SCROLL = 'onPageScroll';
const ON_TAB_ITEM_TAP = 'onTabItemTap';
const ON_REACH_BOTTOM = 'onReachBottom';
const ON_PULL_DOWN_REFRESH = 'onPullDownRefresh';
const ON_SHARE_TIMELINE = 'onShareTimeline';
const ON_ADD_TO_FAVORITES = 'onAddToFavorites';
const ON_SHARE_APP_MESSAGE = 'onShareAppMessage';
// navigationBar
const ON_NAVIGATION_BAR_BUTTON_TAP = 'onNavigationBarButtonTap';
const ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = 'onNavigationBarSearchInputClicked';
const ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = 'onNavigationBarSearchInputChanged';
const ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = 'onNavigationBarSearchInputConfirmed';
const ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = 'onNavigationBarSearchInputFocusChanged';
const createHook = (lifecycle) => (hook, target = getCurrentInstance()) =>
// post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
const onShow = /*#__PURE__*/ createHook(ON_SHOW);
const onHide = /*#__PURE__*/ createHook(ON_HIDE);
const onLaunch = /*#__PURE__*/ createHook(ON_LAUNCH);
const onError = /*#__PURE__*/ createHook(ON_ERROR);
const onThemeChange = /*#__PURE__*/ createHook(ON_THEME_CHANGE);
const onPageNotFound = /*#__PURE__*/ createHook(ON_PAGE_NOT_FOUND);
const onUnhandledRejection = /*#__PURE__*/ createHook(ON_UNHANDLE_REJECTION);
// export const onLoad = /*#__PURE__*/ createHook(ON_LOAD)
const onReady = /*#__PURE__*/ createHook(ON_READY);
const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD);
const onResize = /*#__PURE__*/ createHook(ON_RESIZE);
const onBackPress = /*#__PURE__*/ createHook(ON_BACK_PRESS);
const onPageScroll = /*#__PURE__*/ createHook(ON_PAGE_SCROLL);
const onTabItemTap = /*#__PURE__*/ createHook(ON_TAB_ITEM_TAP);
const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM);
const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH);
const onShareTimeline = /*#__PURE__*/ createHook(ON_SHARE_TIMELINE);
const onAddToFavorites = /*#__PURE__*/ createHook(ON_ADD_TO_FAVORITES);
const onShareAppMessage = /*#__PURE__*/ createHook(ON_SHARE_APP_MESSAGE);
const onNavigationBarButtonTap = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_BUTTON_TAP);
const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED);
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED);
const onNavigationBarSearchInputFocusChanged = /*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED);
export { onAddToFavorites, onBackPress, onError, onHide, onLaunch, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload };
{
"name": "@dcloudio/uni-app",
"version": "3.0.0",
"description": "@dcloudio/uni-app",
"main": "dist/uni-app.cjs.js",
"module": "dist/uni-app.esm.js",
"types": "dist/uni-app.d.ts",
"files": [
"dist"
],
"sideEffects": false,
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
"directory": "packages/uni-app"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/dcloudio/uni-app/issues"
}
}
import { ComponentInternalInstance } from 'vue'
// @ts-ignore
import { isInSSRComponentSetup, injectHook, getCurrentInstance } from 'vue'
// App and Page
const ON_SHOW = 'onShow'
const ON_HIDE = 'onHide'
//App
const ON_LAUNCH = 'onLaunch'
const ON_ERROR = 'onError'
const ON_THEME_CHANGE = 'onThemeChange'
const ON_PAGE_NOT_FOUND = 'onPageNotFound'
const ON_UNHANDLE_REJECTION = 'onUnhandledRejection'
//Page
const ON_LOAD = 'onLoad'
const ON_READY = 'onReady'
const ON_UNLOAD = 'onUnload'
const ON_RESIZE = 'onResize'
const ON_BACK_PRESS = 'onBackPress'
const ON_PAGE_SCROLL = 'onPageScroll'
const ON_TAB_ITEM_TAP = 'onTabItemTap'
const ON_REACH_BOTTOM = 'onReachBottom'
const ON_PULL_DOWN_REFRESH = 'onPullDownRefresh'
const ON_SHARE_TIMELINE = 'onShareTimeline'
const ON_ADD_TO_FAVORITES = 'onAddToFavorites'
const ON_SHARE_APP_MESSAGE = 'onShareAppMessage'
// navigationBar
const ON_NAVIGATION_BAR_BUTTON_TAP = 'onNavigationBarButtonTap'
const ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED =
'onNavigationBarSearchInputClicked'
const ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED =
'onNavigationBarSearchInputChanged'
const ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED =
'onNavigationBarSearchInputConfirmed'
const ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED =
'onNavigationBarSearchInputFocusChanged'
type UniLifecycleHooks =
| typeof ON_SHOW
| typeof ON_HIDE
| typeof ON_LAUNCH
| typeof ON_ERROR
| typeof ON_THEME_CHANGE
| typeof ON_PAGE_NOT_FOUND
| typeof ON_UNHANDLE_REJECTION
| typeof ON_LOAD
| typeof ON_READY
| typeof ON_UNLOAD
| typeof ON_RESIZE
| typeof ON_BACK_PRESS
| typeof ON_PAGE_SCROLL
| typeof ON_TAB_ITEM_TAP
| typeof ON_REACH_BOTTOM
| typeof ON_PULL_DOWN_REFRESH
| typeof ON_SHARE_TIMELINE
| typeof ON_ADD_TO_FAVORITES
| typeof ON_SHARE_APP_MESSAGE
| typeof ON_NAVIGATION_BAR_BUTTON_TAP
| typeof ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
| typeof ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
| typeof ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
| typeof ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
const createHook = <T extends Function = () => any>(
lifecycle: UniLifecycleHooks
) => (
hook: T,
target: ComponentInternalInstance | null = getCurrentInstance()
) =>
// post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle as any, hook, target)
export const onShow = /*#__PURE__*/ createHook(ON_SHOW)
export const onHide = /*#__PURE__*/ createHook(ON_HIDE)
export const onLaunch = /*#__PURE__*/ createHook(ON_LAUNCH)
export const onError = /*#__PURE__*/ createHook(ON_ERROR)
export const onThemeChange = /*#__PURE__*/ createHook(ON_THEME_CHANGE)
export const onPageNotFound = /*#__PURE__*/ createHook(ON_PAGE_NOT_FOUND)
export const onUnhandledRejection = /*#__PURE__*/ createHook(
ON_UNHANDLE_REJECTION
)
// export const onLoad = /*#__PURE__*/ createHook(ON_LOAD)
export const onReady = /*#__PURE__*/ createHook(ON_READY)
export const onUnload = /*#__PURE__*/ createHook(ON_UNLOAD)
export const onResize = /*#__PURE__*/ createHook(ON_RESIZE)
export const onBackPress = /*#__PURE__*/ createHook(ON_BACK_PRESS)
export const onPageScroll = /*#__PURE__*/ createHook(ON_PAGE_SCROLL)
export const onTabItemTap = /*#__PURE__*/ createHook(ON_TAB_ITEM_TAP)
export const onReachBottom = /*#__PURE__*/ createHook(ON_REACH_BOTTOM)
export const onPullDownRefresh = /*#__PURE__*/ createHook(ON_PULL_DOWN_REFRESH)
export const onShareTimeline = /*#__PURE__*/ createHook(ON_SHARE_TIMELINE)
export const onAddToFavorites = /*#__PURE__*/ createHook(ON_ADD_TO_FAVORITES)
export const onShareAppMessage = /*#__PURE__*/ createHook(ON_SHARE_APP_MESSAGE)
export const onNavigationBarButtonTap = /*#__PURE__*/ createHook(
ON_NAVIGATION_BAR_BUTTON_TAP
)
export const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook(
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
)
export const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
)
export const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook(
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
)
export const onNavigationBarSearchInputFocusChanged = /*#__PURE__*/ createHook(
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
)
export * from './apiLifecycle'
{
"compilerOptions": {
"outDir": "dist",
"sourceMap": false,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"allowJs": false,
"strict": true,
"noUnusedLocals": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"removeComments": false,
"lib": ["ESNext", "DOM"]
},
"include": ["src"]
}
......@@ -45,7 +45,10 @@ export default defineComponent({
},
},
setup(props, { slots }) {
const uniForm = inject<UniFormCtx>(uniFormKey)
const uniForm = inject<UniFormCtx>(
uniFormKey,
(false as unknown) as UniFormCtx
)
const { hovering, binding } = useHover(props)
const { t } = useI18n()
function onClick() {
......
import { getCurrentInstance, inject, onBeforeUnmount, withScopeId } from 'vue'
import { getCurrentInstance, inject, onBeforeUnmount } from 'vue'
import { UniFormCtx, uniFormKey } from '../components/form'
export function useFormField(nameKey: string, valueKey: string) {
const uniForm = inject<UniFormCtx>(uniFormKey)
const uniForm = inject<UniFormCtx>(
uniFormKey,
(false as unknown) as UniFormCtx // remove warning
)
if (!uniForm) {
return
}
......
......@@ -275,7 +275,7 @@ function createGetter(isReadonly = false, shallow = false) {
return res;
};
}
const set$1 = /*#__PURE__*/ createSetter();
const set = /*#__PURE__*/ createSetter();
const shallowSet = /*#__PURE__*/ createSetter(true);
function createSetter(shallow = false) {
return function set(target, key, value, receiver) {
......@@ -325,7 +325,7 @@ function ownKeys(target) {
}
const mutableHandlers = {
get,
set: set$1,
set,
deleteProperty,
has,
ownKeys
......@@ -407,7 +407,7 @@ function add(value) {
}
return this;
}
function set$1$1(key, value) {
function set$1(key, value) {
value = toRaw(value);
const target = toRaw(this);
const { has, get } = getProto(target);
......@@ -527,7 +527,7 @@ const mutableInstrumentations = {
},
has: has$1,
add,
set: set$1$1,
set: set$1,
delete: deleteEntry,
clear,
forEach: createForEach(false, false)
......@@ -541,7 +541,7 @@ const shallowInstrumentations = {
},
has: has$1,
add,
set: set$1$1,
set: set$1,
delete: deleteEntry,
clear,
forEach: createForEach(false, true)
......@@ -2860,17 +2860,17 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
));
}
}
const createHook$1 = (lifecycle) => (hook, target = currentInstance) =>
const createHook = (lifecycle) => (hook, target = currentInstance) =>
// post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
const onBeforeMount = createHook$1("bm" /* BEFORE_MOUNT */);
const onMounted = createHook$1("m" /* MOUNTED */);
const onBeforeUpdate = createHook$1("bu" /* BEFORE_UPDATE */);
const onUpdated = createHook$1("u" /* UPDATED */);
const onBeforeUnmount = createHook$1("bum" /* BEFORE_UNMOUNT */);
const onUnmounted = createHook$1("um" /* UNMOUNTED */);
const onRenderTriggered = createHook$1("rtg" /* RENDER_TRIGGERED */);
const onRenderTracked = createHook$1("rtc" /* RENDER_TRACKED */);
const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
const onMounted = createHook("m" /* MOUNTED */);
const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
const onUpdated = createHook("u" /* UPDATED */);
const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
const onUnmounted = createHook("um" /* UNMOUNTED */);
const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
const onErrorCaptured = (hook, target = currentInstance) => {
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
};
......@@ -6713,7 +6713,7 @@ function createDuplicateChecker() {
};
}
let shouldCacheAccess = true;
function applyOptions$1(instance, options, deferredData = [], deferredWatch = [], deferredProvide = [], asMixin = false) {
function applyOptions(instance, options, deferredData = [], deferredWatch = [], deferredProvide = [], asMixin = false) {
const {
// composition
mixins, extends: extendsOptions,
......@@ -6746,7 +6746,7 @@ function applyOptions$1(instance, options, deferredData = [], deferredWatch = []
}
// extending a base component...
if (extendsOptions) {
applyOptions$1(instance, extendsOptions, deferredData, deferredWatch, deferredProvide, true);
applyOptions(instance, extendsOptions, deferredData, deferredWatch, deferredProvide, true);
}
// local mixins
if (mixins) {
......@@ -7005,7 +7005,7 @@ function callHookWithMixinAndExtends(name, type, options, instance) {
}
function applyMixins(instance, mixins, deferredData, deferredWatch, deferredProvide) {
for (let i = 0; i < mixins.length; i++) {
applyOptions$1(instance, mixins[i], deferredData, deferredWatch, deferredProvide, true);
applyOptions(instance, mixins[i], deferredData, deferredWatch, deferredProvide, true);
}
}
function resolveData(instance, dataFn, publicThis) {
......@@ -7606,7 +7606,7 @@ function finishComponentSetup(instance, isSSR) {
if (__VUE_OPTIONS_API__) {
currentInstance = instance;
pauseTracking();
applyOptions$1(instance, Component);
applyOptions(instance, Component);
resetTracking();
currentInstance = null;
}
......@@ -9404,90 +9404,4 @@ const compile$1 = () => {
}
};
function applyOptions(options, instance, publicThis) {
Object.keys(options).forEach((name) => {
if (name.indexOf('on') === 0) {
const hook = options[name];
if (isFunction(hook)) {
injectHook(name, hook.bind(publicThis), instance);
}
}
});
}
function set(target, key, val) {
return (target[key] = val);
}
function hasHook(name) {
const hooks = this.$[name];
if (hooks && hooks.length) {
return true;
}
return false;
}
function callHook(name, args) {
const hooks = this.$[name];
let ret;
if (hooks) {
for (let i = 0; i < hooks.length; i++) {
ret = hooks[i](args);
}
}
return ret;
}
function errorHandler(err, instance, info) {
if (!instance) {
throw err;
}
const appInstance = instance.$.appContext.$appInstance;
if (!appInstance) {
throw err;
}
appInstance.$callHook('onError', err, info);
}
// @ts-ignore
const createHook = (lifecycle) => (hook, target) =>
// post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
const onShow = /*#__PURE__*/ createHook("onShow" /* ON_SHOW */);
const onHide = /*#__PURE__*/ createHook("onHide" /* ON_HIDE */);
const onLaunch = /*#__PURE__*/ createHook("onLaunch" /* ON_LAUNCH */);
const onError = /*#__PURE__*/ createHook("onError" /* ON_ERROR */);
const onThemeChange = /*#__PURE__*/ createHook("onThemeChange" /* ON_THEME_CHANGE */);
const onPageNotFound = /*#__PURE__*/ createHook("onPageNotFound" /* ON_PAGE_NOT_FOUND */);
const onUnhandledRejection = /*#__PURE__*/ createHook("onUnhandledRejection" /* ON_UNHANDLE_REJECTION */);
// export const onLoad = /*#__PURE__*/ createHook(UniLifecycleHooks.ON_LOAD)
const onReady = /*#__PURE__*/ createHook("onReady" /* ON_READY */);
const onUnload = /*#__PURE__*/ createHook("onUnload" /* ON_UNLOAD */);
const onResize = /*#__PURE__*/ createHook("onResize" /* ON_RESIZE */);
const onBackPress = /*#__PURE__*/ createHook("onBackPress" /* ON_BACK_PRESS */);
const onPageScroll = /*#__PURE__*/ createHook("onPageScroll" /* ON_PAGE_SCROLL */);
const onTabItemTap = /*#__PURE__*/ createHook("onTabItemTap" /* ON_TAB_ITEM_TAP */);
const onReachBottom = /*#__PURE__*/ createHook("onReachBottom" /* ON_REACH_BOTTOM */);
const onPullDownRefresh = /*#__PURE__*/ createHook("onPullDownRefresh" /* ON_PULL_DOWN_REFRESH */);
const onShareTimeline = /*#__PURE__*/ createHook("onShareTimeline" /* ON_SHARE_TIMELINE */);
const onAddToFavorites = /*#__PURE__*/ createHook("onAddToFavorites" /* ON_ADD_TO_FAVORITES */);
const onShareAppMessage = /*#__PURE__*/ createHook("onShareAppMessage" /* ON_SHARE_APP_MESSAGE */);
const onNavigationBarButtonTap = /*#__PURE__*/ createHook("onNavigationBarButtonTap" /* ON_NAVIGATION_BAR_BUTTON_TAP */);
const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook("onNavigationBarSearchInputChanged" /* ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED */);
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook("onNavigationBarSearchInputClicked" /* ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED */);
const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook("onNavigationBarSearchInputConfirmed" /* ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED */);
const onNavigationBarSearchInputFocusChanged = /*#__PURE__*/ createHook("onNavigationBarSearchInputFocusChanged" /* ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED */);
function initApp(app) {
const appConfig = app._context.config;
if (isFunction(app._component.onError)) {
appConfig.errorHandler = errorHandler;
}
const globalProperties = appConfig.globalProperties;
globalProperties.$hasHook = hasHook;
globalProperties.$callHook = callHook;
if (__VUE_OPTIONS_API__) {
globalProperties.$set = set;
globalProperties.$applyOptions = applyOptions;
}
}
export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compile$1 as compile, computed$1 as computed, createApp, createBlock, createCommentVNode, createHook, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, createApp as createVueApp, createSSRApp as createVueSSRApp, customRef, defineAsyncComponent, defineComponent, defineEmit, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initApp, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeProps, nextTick, onActivated, onAddToFavorites, onBackPress, onBeforeActivate, onBeforeDeactivate, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onError, onErrorCaptured, onHide, onLaunch, onMounted, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onRenderTracked, onRenderTriggered, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useContext, useCssModule, useCssVars, useSSRContext, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers, withScopeId };
export { BaseTransition, Comment, Fragment, KeepAlive, Static, Suspense, Teleport, Text, Transition, TransitionGroup, callWithAsyncErrorHandling, callWithErrorHandling, cloneVNode, compile$1 as compile, computed$1 as computed, createApp, createBlock, createCommentVNode, createHydrationRenderer, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, createApp as createVueApp, createSSRApp as createVueSSRApp, customRef, defineAsyncComponent, defineComponent, defineEmit, defineProps, devtools, getCurrentInstance, getTransitionRawChildren, h, handleError, hydrate, initCustomFormatter, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isVNode, markRaw, mergeProps, nextTick, onActivated, onBeforeActivate, onBeforeDeactivate, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, toHandlers, toRaw, toRef, toRefs, transformVNodeArgs, triggerRef, unref, useContext, useCssModule, useCssVars, useSSRContext, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers, withScopeId };
// @ts-ignore
export * from '../lib/vue.runtime.esm.js'
export * from '@dcloudio/uni-vue'
import {isFunction, extend, isPlainObject, invokeArrayFns, isString, hasOwn as hasOwn$1, hyphenate, isArray, isObject as isObject$1, capitalize, toRawType, makeMap as makeMap$1, isPromise} from "@vue/shared";
import {injectHook, isInSSRComponentSetup, createVNode, inject, provide, reactive, computed, nextTick, getCurrentInstance, onBeforeMount, onMounted, onBeforeActivate, onBeforeDeactivate, openBlock, createBlock, mergeProps, toDisplayString, ref, defineComponent, resolveComponent, toHandlers, renderSlot, createCommentVNode, onBeforeUnmount, withModifiers, withDirectives, vShow, vModelDynamic, createTextVNode, Fragment, renderList, vModelText, watch, withCtx, KeepAlive, resolveDynamicComponent} from "vue";
import {injectHook, createVNode, inject, provide, reactive, computed, nextTick, getCurrentInstance, onBeforeMount, onMounted, onBeforeActivate, onBeforeDeactivate, openBlock, createBlock, mergeProps, toDisplayString, ref, defineComponent, resolveComponent, toHandlers, renderSlot, createCommentVNode, onBeforeUnmount, withModifiers, withDirectives, vShow, vModelDynamic, createTextVNode, Fragment, renderList, vModelText, watch, watchEffect, withCtx, KeepAlive, resolveDynamicComponent} from "vue";
import {passive, NAVBAR_HEIGHT, removeLeadingSlash, plusReady, debounce, PRIMARY_COLOR as PRIMARY_COLOR$1, getLen} from "@dcloudio/uni-shared";
import {useRoute, createRouter, createWebHistory, createWebHashHistory, isNavigationFailure, RouterView} from "vue-router";
function applyOptions(options, instance2, publicThis) {
......@@ -42,57 +42,6 @@ function errorHandler(err, instance2, info) {
}
appInstance.$callHook("onError", err, info);
}
var UniLifecycleHooks;
(function(UniLifecycleHooks2) {
UniLifecycleHooks2["ON_SHOW"] = "onShow";
UniLifecycleHooks2["ON_HIDE"] = "onHide";
UniLifecycleHooks2["ON_LAUNCH"] = "onLaunch";
UniLifecycleHooks2["ON_ERROR"] = "onError";
UniLifecycleHooks2["ON_THEME_CHANGE"] = "onThemeChange";
UniLifecycleHooks2["ON_PAGE_NOT_FOUND"] = "onPageNotFound";
UniLifecycleHooks2["ON_UNHANDLE_REJECTION"] = "onUnhandledRejection";
UniLifecycleHooks2["ON_LOAD"] = "onLoad";
UniLifecycleHooks2["ON_READY"] = "onReady";
UniLifecycleHooks2["ON_UNLOAD"] = "onUnload";
UniLifecycleHooks2["ON_RESIZE"] = "onResize";
UniLifecycleHooks2["ON_BACK_PRESS"] = "onBackPress";
UniLifecycleHooks2["ON_PAGE_SCROLL"] = "onPageScroll";
UniLifecycleHooks2["ON_TAB_ITEM_TAP"] = "onTabItemTap";
UniLifecycleHooks2["ON_REACH_BOTTOM"] = "onReachBottom";
UniLifecycleHooks2["ON_PULL_DOWN_REFRESH"] = "onPullDownRefresh";
UniLifecycleHooks2["ON_SHARE_TIMELINE"] = "onShareTimeline";
UniLifecycleHooks2["ON_ADD_TO_FAVORITES"] = "onAddToFavorites";
UniLifecycleHooks2["ON_SHARE_APP_MESSAGE"] = "onShareAppMessage";
UniLifecycleHooks2["ON_NAVIGATION_BAR_BUTTON_TAP"] = "onNavigationBarButtonTap";
UniLifecycleHooks2["ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED"] = "onNavigationBarSearchInputClicked";
UniLifecycleHooks2["ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED"] = "onNavigationBarSearchInputChanged";
UniLifecycleHooks2["ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED"] = "onNavigationBarSearchInputConfirmed";
UniLifecycleHooks2["ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED"] = "onNavigationBarSearchInputFocusChanged";
})(UniLifecycleHooks || (UniLifecycleHooks = {}));
const createHook = (lifecycle) => (hook, target) => !isInSSRComponentSetup && injectHook(lifecycle, hook, target);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_SHOW);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_HIDE);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_LAUNCH);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_ERROR);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_THEME_CHANGE);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_PAGE_NOT_FOUND);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_UNHANDLE_REJECTION);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_READY);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_UNLOAD);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_RESIZE);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_BACK_PRESS);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_PAGE_SCROLL);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_TAB_ITEM_TAP);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_REACH_BOTTOM);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_PULL_DOWN_REFRESH);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_SHARE_TIMELINE);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_ADD_TO_FAVORITES);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_SHARE_APP_MESSAGE);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_NAVIGATION_BAR_BUTTON_TAP);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED);
/* @__PURE__ */ createHook(UniLifecycleHooks.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED);
function initApp$1(app) {
const appConfig = app._context.config;
if (isFunction(app._component.onError)) {
......@@ -2136,7 +2085,7 @@ var index$4 = defineComponent({
setup(props, {
slots
}) {
const uniForm = inject(uniFormKey);
const uniForm = inject(uniFormKey, false);
const {
hovering,
binding
......@@ -5908,7 +5857,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
}
_sfc_main$h.render = _sfc_render$h;
function useFormField(nameKey, valueKey) {
const uniForm = inject(uniFormKey);
const uniForm = inject(uniFormKey, false);
if (!uniForm) {
return;
}
......@@ -11567,7 +11516,7 @@ var TabBar = /* @__PURE__ */ defineComponent({
}
});
function useSwitchTab(route, tabBar2) {
watch(route, () => {
watchEffect(() => {
const meta = route.meta;
if (meta.isTabBar) {
const pagePath = meta.route;
......@@ -11577,8 +11526,6 @@ function useSwitchTab(route, tabBar2) {
}
tabBar2.selectedIndex = index2;
}
}, {
immediate: true
});
return (tabBarItem, index2) => {
const {
......
import { watch, computed, defineComponent, onRenderTriggered } from 'vue'
import { watchEffect, computed, defineComponent } from 'vue'
import { RouteLocationNormalizedLoaded, useRoute } from 'vue-router'
import { invokeHook } from '@dcloudio/uni-core'
import {
......@@ -34,23 +34,17 @@ function useSwitchTab(
route: RouteLocationNormalizedLoaded,
tabBar: UniApp.TabBarOptions
) {
watch(
route,
() => {
const meta = route.meta
if (meta.isTabBar) {
const pagePath = meta.route
const index = tabBar.list.findIndex(
(item) => item.pagePath === pagePath
)
if (index === -1) {
return
}
tabBar.selectedIndex = index
watchEffect(() => {
const meta = route.meta
if (meta.isTabBar) {
const pagePath = meta.route
const index = tabBar.list.findIndex((item) => item.pagePath === pagePath)
if (index === -1) {
return
}
},
{ immediate: true }
)
tabBar.selectedIndex = index
}
})
return (tabBarItem: UniApp.TabBarItemOptions, index: number) => {
const { type } = tabBarItem
return () => {
......
import { isSymbol, extend, isMap, isObject, toRawType, def, isArray, isString, isFunction, isPromise, toHandlerKey, remove, EMPTY_OBJ, camelize, capitalize, normalizeClass, normalizeStyle, isOn, NOOP, isGloballyWhitelisted, isIntegerKey, hasOwn, hasChanged, NO, invokeArrayFns, makeMap, isSet, toNumber, hyphenate, isReservedProp, EMPTY_ARR, toTypeString } from '@vue/shared';
import { isFunction, isSymbol, extend, isMap, isObject, toRawType, def, isArray, isString, isPromise, toHandlerKey, remove, EMPTY_OBJ, camelize, capitalize, normalizeClass, normalizeStyle, isOn, NOOP, isGloballyWhitelisted, isIntegerKey, hasOwn, hasChanged, NO, invokeArrayFns, makeMap, isSet, toNumber, hyphenate, isReservedProp, EMPTY_ARR, toTypeString } from '@vue/shared';
export { camelize } from '@vue/shared';
import { injectHook as injectHook$1 } from 'vue';
function applyOptions$1(options, instance, publicThis) {
Object.keys(options).forEach((name) => {
if (name.indexOf('on') === 0) {
const hook = options[name];
if (isFunction(hook)) {
injectHook$1(name, hook.bind(publicThis), instance);
}
}
});
}
function set$2(target, key, val) {
return (target[key] = val);
}
function hasHook(name) {
const hooks = this.$[name];
if (hooks && hooks.length) {
return true;
}
return false;
}
function callHook(name, args) {
const hooks = this.$[name];
let ret;
if (hooks) {
for (let i = 0; i < hooks.length; i++) {
ret = hooks[i](args);
}
}
return ret;
}
function errorHandler(err, instance, info) {
if (!instance) {
throw err;
}
const appInstance = instance.$.appContext.$appInstance;
if (!appInstance) {
throw err;
}
appInstance.$callHook('onError', err, info);
}
function initApp(app) {
const appConfig = app._context.config;
if (isFunction(app._component.onError)) {
appConfig.errorHandler = errorHandler;
}
const globalProperties = appConfig.globalProperties;
globalProperties.$hasHook = hasHook;
globalProperties.$callHook = callHook;
if (__VUE_OPTIONS_API__) {
globalProperties.$set = set$2;
globalProperties.$applyOptions = applyOptions$1;
}
}
var plugin = {
install(app) {
initApp(app);
const globalProperties = app._context.config.globalProperties;
const oldCallHook = globalProperties.$callHook;
globalProperties.$callHook = function callHook(name, args) {
if (name === 'mounted') {
oldCallHook.call(this, 'bm'); // beforeMount
this.$.isMounted = true;
name = 'm';
}
return oldCallHook.call(this, name, args);
};
const oldMount = app.mount;
app.mount = function mount(rootContainer) {
const instance = oldMount.call(app, rootContainer);
// @ts-ignore
createMiniProgramApp(instance);
return instance;
};
},
};
const targetMap = new WeakMap();
const effectStack = [];
......@@ -275,7 +356,7 @@ function createGetter(isReadonly = false, shallow = false) {
return res;
};
}
const set$1 = /*#__PURE__*/ createSetter();
const set = /*#__PURE__*/ createSetter();
const shallowSet = /*#__PURE__*/ createSetter(true);
function createSetter(shallow = false) {
return function set(target, key, value, receiver) {
......@@ -325,7 +406,7 @@ function ownKeys(target) {
}
const mutableHandlers = {
get,
set: set$1,
set,
deleteProperty,
has,
ownKeys
......@@ -407,7 +488,7 @@ function add(value) {
}
return this;
}
function set$1$1(key, value) {
function set$1(key, value) {
value = toRaw(value);
const target = toRaw(this);
const { has, get } = getProto(target);
......@@ -527,7 +608,7 @@ const mutableInstrumentations = {
},
has: has$1,
add,
set: set$1$1,
set: set$1,
delete: deleteEntry,
clear,
forEach: createForEach(false, false)
......@@ -541,7 +622,7 @@ const shallowInstrumentations = {
},
has: has$1,
add,
set: set$1$1,
set: set$1,
delete: deleteEntry,
clear,
forEach: createForEach(false, true)
......@@ -1788,17 +1869,17 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
(``));
}
}
const createHook$1 = (lifecycle) => (hook, target = currentInstance) =>
const createHook = (lifecycle) => (hook, target = currentInstance) =>
// post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
const onBeforeMount = createHook$1("bm" /* BEFORE_MOUNT */);
const onMounted = createHook$1("m" /* MOUNTED */);
const onBeforeUpdate = createHook$1("bu" /* BEFORE_UPDATE */);
const onUpdated = createHook$1("u" /* UPDATED */);
const onBeforeUnmount = createHook$1("bum" /* BEFORE_UNMOUNT */);
const onUnmounted = createHook$1("um" /* UNMOUNTED */);
const onRenderTriggered = createHook$1("rtg" /* RENDER_TRIGGERED */);
const onRenderTracked = createHook$1("rtc" /* RENDER_TRACKED */);
const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
const onMounted = createHook("m" /* MOUNTED */);
const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
const onUpdated = createHook("u" /* UPDATED */);
const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
const onUnmounted = createHook("um" /* UNMOUNTED */);
const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
const onErrorCaptured = (hook, target = currentInstance) => {
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
};
......@@ -2623,7 +2704,7 @@ function createDuplicateChecker() {
};
}
let shouldCacheAccess = true;
function applyOptions$1(instance, options, deferredData = [], deferredWatch = [], deferredProvide = [], asMixin = false) {
function applyOptions(instance, options, deferredData = [], deferredWatch = [], deferredProvide = [], asMixin = false) {
const {
// composition
mixins, extends: extendsOptions,
......@@ -2651,7 +2732,7 @@ function applyOptions$1(instance, options, deferredData = [], deferredWatch = []
}
// extending a base component...
if (extendsOptions) {
applyOptions$1(instance, extendsOptions, deferredData, deferredWatch, deferredProvide, true);
applyOptions(instance, extendsOptions, deferredData, deferredWatch, deferredProvide, true);
}
// local mixins
if (mixins) {
......@@ -2918,7 +2999,7 @@ function callHookWithMixinAndExtends(name, type, options, instance) {
}
function applyMixins(instance, mixins, deferredData, deferredWatch, deferredProvide) {
for (let i = 0; i < mixins.length; i++) {
applyOptions$1(instance, mixins[i], deferredData, deferredWatch, deferredProvide, true);
applyOptions(instance, mixins[i], deferredData, deferredWatch, deferredProvide, true);
}
}
function resolveData(instance, dataFn, publicThis) {
......@@ -3493,7 +3574,7 @@ function finishComponentSetup(instance, isSSR) {
if (__VUE_OPTIONS_API__) {
currentInstance = instance;
pauseTracking();
applyOptions$1(instance, Component);
applyOptions(instance, Component);
resetTracking();
currentInstance = null;
}
......@@ -4039,118 +4120,9 @@ function createVueApp(rootComponent, rootProps = null) {
return app;
}
function applyOptions(options, instance, publicThis) {
Object.keys(options).forEach((name) => {
if (name.indexOf('on') === 0) {
const hook = options[name];
if (isFunction(hook)) {
injectHook(name, hook.bind(publicThis), instance);
}
}
});
}
function set(target, key, val) {
return (target[key] = val);
}
function hasHook(name) {
const hooks = this.$[name];
if (hooks && hooks.length) {
return true;
}
return false;
}
function callHook(name, args) {
const hooks = this.$[name];
let ret;
if (hooks) {
for (let i = 0; i < hooks.length; i++) {
ret = hooks[i](args);
}
}
return ret;
}
function errorHandler(err, instance, info) {
if (!instance) {
throw err;
}
const appInstance = instance.$.appContext.$appInstance;
if (!appInstance) {
throw err;
}
appInstance.$callHook('onError', err, info);
}
// @ts-ignore
const createHook = (lifecycle) => (hook, target) =>
// post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle, hook, target);
const onShow = /*#__PURE__*/ createHook("onShow" /* ON_SHOW */);
const onHide = /*#__PURE__*/ createHook("onHide" /* ON_HIDE */);
const onLaunch = /*#__PURE__*/ createHook("onLaunch" /* ON_LAUNCH */);
const onError = /*#__PURE__*/ createHook("onError" /* ON_ERROR */);
const onThemeChange = /*#__PURE__*/ createHook("onThemeChange" /* ON_THEME_CHANGE */);
const onPageNotFound = /*#__PURE__*/ createHook("onPageNotFound" /* ON_PAGE_NOT_FOUND */);
const onUnhandledRejection = /*#__PURE__*/ createHook("onUnhandledRejection" /* ON_UNHANDLE_REJECTION */);
// export const onLoad = /*#__PURE__*/ createHook(UniLifecycleHooks.ON_LOAD)
const onReady = /*#__PURE__*/ createHook("onReady" /* ON_READY */);
const onUnload = /*#__PURE__*/ createHook("onUnload" /* ON_UNLOAD */);
const onResize = /*#__PURE__*/ createHook("onResize" /* ON_RESIZE */);
const onBackPress = /*#__PURE__*/ createHook("onBackPress" /* ON_BACK_PRESS */);
const onPageScroll = /*#__PURE__*/ createHook("onPageScroll" /* ON_PAGE_SCROLL */);
const onTabItemTap = /*#__PURE__*/ createHook("onTabItemTap" /* ON_TAB_ITEM_TAP */);
const onReachBottom = /*#__PURE__*/ createHook("onReachBottom" /* ON_REACH_BOTTOM */);
const onPullDownRefresh = /*#__PURE__*/ createHook("onPullDownRefresh" /* ON_PULL_DOWN_REFRESH */);
const onShareTimeline = /*#__PURE__*/ createHook("onShareTimeline" /* ON_SHARE_TIMELINE */);
const onAddToFavorites = /*#__PURE__*/ createHook("onAddToFavorites" /* ON_ADD_TO_FAVORITES */);
const onShareAppMessage = /*#__PURE__*/ createHook("onShareAppMessage" /* ON_SHARE_APP_MESSAGE */);
const onNavigationBarButtonTap = /*#__PURE__*/ createHook("onNavigationBarButtonTap" /* ON_NAVIGATION_BAR_BUTTON_TAP */);
const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook("onNavigationBarSearchInputChanged" /* ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED */);
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook("onNavigationBarSearchInputClicked" /* ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED */);
const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook("onNavigationBarSearchInputConfirmed" /* ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED */);
const onNavigationBarSearchInputFocusChanged = /*#__PURE__*/ createHook("onNavigationBarSearchInputFocusChanged" /* ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED */);
function initApp(app) {
const appConfig = app._context.config;
if (isFunction(app._component.onError)) {
appConfig.errorHandler = errorHandler;
}
const globalProperties = appConfig.globalProperties;
globalProperties.$hasHook = hasHook;
globalProperties.$callHook = callHook;
if (__VUE_OPTIONS_API__) {
globalProperties.$set = set;
globalProperties.$applyOptions = applyOptions;
}
}
var plugin = {
install(app) {
initApp(app);
const globalProperties = app._context.config.globalProperties;
const oldCallHook = globalProperties.$callHook;
globalProperties.$callHook = function callHook(name, args) {
if (name === 'mounted') {
oldCallHook.call(this, 'bm'); // beforeMount
this.$.isMounted = true;
name = 'm';
}
return oldCallHook.call(this, name, args);
};
const oldMount = app.mount;
app.mount = function mount(rootContainer) {
const instance = oldMount.call(app, rootContainer);
// @ts-ignore
createMiniProgramApp(instance);
return instance;
};
},
};
function createApp(rootComponent, rootProps = null) {
rootComponent && (rootComponent.mpType = 'app');
return createVueApp(rootComponent, rootProps).use(plugin);
}
export { callWithAsyncErrorHandling, callWithErrorHandling, computed$1 as computed, createApp, createHook, createVueApp, customRef, defineComponent, defineEmit, defineProps, getCurrentInstance, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, nextTick, onActivated, onAddToFavorites, onBackPress, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onError, onErrorCaptured, onHide, onLaunch, onMounted, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onRenderTracked, onRenderTriggered, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, onUnmounted, onUpdated, provide, reactive, readonly, ref, resolveDirective, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, version, warn, watch, watchEffect, withDirectives };
export { callWithAsyncErrorHandling, callWithErrorHandling, computed$1 as computed, createApp, createVueApp, customRef, defineComponent, defineEmit, defineProps, getCurrentInstance, inject, injectHook, isInSSRComponentSetup, isProxy, isReactive, isReadonly, isRef, logError, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onUnmounted, onUpdated, provide, reactive, readonly, ref, resolveDirective, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, version, warn, watch, watchEffect, withDirectives };
......@@ -7,4 +7,3 @@ export function createApp(rootComponent: unknown, rootProps = null) {
}
// @ts-ignore
export * from '../lib/vue.runtime.esm.js'
export * from '@dcloudio/uni-vue/src/apiLifecycle'
import { ComponentInternalInstance } from 'vue'
// @ts-ignore
import { isInSSRComponentSetup, injectHook } from 'vue'
export const enum UniLifecycleHooks {
//App and Page
ON_SHOW = 'onShow',
ON_HIDE = 'onHide',
//App
ON_LAUNCH = 'onLaunch',
ON_ERROR = 'onError',
ON_THEME_CHANGE = 'onThemeChange',
ON_PAGE_NOT_FOUND = 'onPageNotFound',
ON_UNHANDLE_REJECTION = 'onUnhandledRejection',
//Page
ON_LOAD = 'onLoad',
ON_READY = 'onReady',
ON_UNLOAD = 'onUnload',
ON_RESIZE = 'onResize',
ON_BACK_PRESS = 'onBackPress',
ON_PAGE_SCROLL = 'onPageScroll',
ON_TAB_ITEM_TAP = 'onTabItemTap',
ON_REACH_BOTTOM = 'onReachBottom',
ON_PULL_DOWN_REFRESH = 'onPullDownRefresh',
ON_SHARE_TIMELINE = 'onShareTimeline',
ON_ADD_TO_FAVORITES = 'onAddToFavorites',
ON_SHARE_APP_MESSAGE = 'onShareAppMessage',
// navigationBar
ON_NAVIGATION_BAR_BUTTON_TAP = 'onNavigationBarButtonTap',
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED = 'onNavigationBarSearchInputClicked',
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED = 'onNavigationBarSearchInputChanged',
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED = 'onNavigationBarSearchInputConfirmed',
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED = 'onNavigationBarSearchInputFocusChanged',
}
export const createHook = <T extends Function = () => any>(
lifecycle: UniLifecycleHooks
) => (hook: T, target: ComponentInternalInstance | null) =>
// post-create lifecycle registrations are noops during SSR
!isInSSRComponentSetup && injectHook(lifecycle as any, hook, target)
export const onShow = /*#__PURE__*/ createHook(UniLifecycleHooks.ON_SHOW)
export const onHide = /*#__PURE__*/ createHook(UniLifecycleHooks.ON_HIDE)
export const onLaunch = /*#__PURE__*/ createHook(UniLifecycleHooks.ON_LAUNCH)
export const onError = /*#__PURE__*/ createHook(UniLifecycleHooks.ON_ERROR)
export const onThemeChange = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_THEME_CHANGE
)
export const onPageNotFound = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_PAGE_NOT_FOUND
)
export const onUnhandledRejection = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_UNHANDLE_REJECTION
)
// export const onLoad = /*#__PURE__*/ createHook(UniLifecycleHooks.ON_LOAD)
export const onReady = /*#__PURE__*/ createHook(UniLifecycleHooks.ON_READY)
export const onUnload = /*#__PURE__*/ createHook(UniLifecycleHooks.ON_UNLOAD)
export const onResize = /*#__PURE__*/ createHook(UniLifecycleHooks.ON_RESIZE)
export const onBackPress = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_BACK_PRESS
)
export const onPageScroll = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_PAGE_SCROLL
)
export const onTabItemTap = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_TAB_ITEM_TAP
)
export const onReachBottom = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_REACH_BOTTOM
)
export const onPullDownRefresh = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_PULL_DOWN_REFRESH
)
export const onShareTimeline = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_SHARE_TIMELINE
)
export const onAddToFavorites = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_ADD_TO_FAVORITES
)
export const onShareAppMessage = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_SHARE_APP_MESSAGE
)
export const onNavigationBarButtonTap = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_NAVIGATION_BAR_BUTTON_TAP
)
export const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
)
export const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
)
export const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
)
export const onNavigationBarSearchInputFocusChanged = /*#__PURE__*/ createHook(
UniLifecycleHooks.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
)
......@@ -5,9 +5,6 @@ import { isFunction } from '@vue/shared'
import { applyOptions } from './componentOptions'
import { set, hasHook, callHook } from './componentInstance'
import { errorHandler } from './appConfig'
export * from './apiLifecycle'
export function initApp(app: App) {
const appConfig = app._context.config
if (isFunction((app._component as any).onError)) {
......
......@@ -8,6 +8,8 @@ export function createOptimizeDeps(
exclude: [
'vue',
'vue-router',
'@dcloudio/uni-app',
'@dcloudio/uni-components',
'@dcloudio/uni-h5',
'@dcloudio/uni-h5-vue',
'@dcloudio/uni-shared',
......
......@@ -67,6 +67,7 @@ function createConfig(entryFile, output, plugins = []) {
hasTSChecked = true
const external = [
'vue',
'@vue/shared',
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
......
......@@ -45,6 +45,7 @@ async function build(target) {
const types =
target === 'uni-shared' ||
target === 'uni-i18n' ||
target === 'uni-app' ||
target === 'uni-cli-shared' ||
(buildTypes && pkg.types)
// if building a specific format, do not remove dist.
......
......@@ -4,6 +4,7 @@ const chalk = require('chalk')
const priority = {
'uni-shared': 100,
'uni-app': 90,
'uni-i18n': 90,
'uni-mp-vue': 80,
'uni-mp-alipay': 70,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册