@dcloudio/uni-app
Advanced tools
Comparing version 3.0.0-alpha-3021220211105008 to 3.0.0-alpha-3021220211105009
@@ -7,36 +7,4 @@ 'use strict'; | ||
var shared = require('@vue/shared'); | ||
var uniShared = require('@dcloudio/uni-shared'); | ||
const UNI_SSR = '__uniSSR'; | ||
const UNI_SSR_DATA = 'data'; | ||
// lifecycle | ||
// 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'; | ||
const sanitise = (val) => (val && JSON.parse(JSON.stringify(val))) || val; | ||
function assertKey(key, shallow = false) { | ||
@@ -69,4 +37,4 @@ if (!key) { | ||
if (ctx) { | ||
const __uniSSR = ctx[UNI_SSR] || (ctx[UNI_SSR] = {}); | ||
state = __uniSSR[UNI_SSR_DATA] || (__uniSSR[UNI_SSR_DATA] = {}); | ||
const __uniSSR = ctx[uniShared.UNI_SSR] || (ctx[uniShared.UNI_SSR] = {}); | ||
state = __uniSSR[uniShared.UNI_SSR_DATA] || (__uniSSR[uniShared.UNI_SSR_DATA] = {}); | ||
} | ||
@@ -76,7 +44,7 @@ else { | ||
} | ||
state[key] = sanitise(value); | ||
state[key] = uniShared.sanitise(value); | ||
// SSR 模式下 watchEffect 不生效 https://github.com/vuejs/vue-next/blob/master/packages/runtime-core/src/apiWatch.ts#L283 | ||
// 故自定义ref | ||
return vue.customRef((track, trigger) => { | ||
const customTrigger = () => (trigger(), (state[key] = sanitise(value))); | ||
const customTrigger = () => (trigger(), (state[key] = uniShared.sanitise(value))); | ||
return { | ||
@@ -108,3 +76,3 @@ get: () => { | ||
function getSsrGlobalData() { | ||
return sanitise(globalData); | ||
return uniShared.sanitise(globalData); | ||
} | ||
@@ -120,27 +88,27 @@ | ||
!vue.isInSSRComponentSetup && vue.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); | ||
const onShow = /*#__PURE__*/ createHook(uniShared.ON_SHOW); | ||
const onHide = /*#__PURE__*/ createHook(uniShared.ON_HIDE); | ||
const onLaunch = /*#__PURE__*/ createHook(uniShared.ON_LAUNCH); | ||
const onError = /*#__PURE__*/ createHook(uniShared.ON_ERROR); | ||
const onThemeChange = /*#__PURE__*/ createHook(uniShared.ON_THEME_CHANGE); | ||
const onPageNotFound = /*#__PURE__*/ createHook(uniShared.ON_PAGE_NOT_FOUND); | ||
const onUnhandledRejection = /*#__PURE__*/ createHook(uniShared.ON_UNHANDLE_REJECTION); | ||
// 小程序如果想在 setup 的 props 传递页面参数,需要定义 props,故同时暴露 onLoad 吧 | ||
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); | ||
const onLoad = /*#__PURE__*/ createHook(uniShared.ON_LOAD); | ||
const onReady = /*#__PURE__*/ createHook(uniShared.ON_READY); | ||
const onUnload = /*#__PURE__*/ createHook(uniShared.ON_UNLOAD); | ||
const onResize = /*#__PURE__*/ createHook(uniShared.ON_RESIZE); | ||
const onBackPress = /*#__PURE__*/ createHook(uniShared.ON_BACK_PRESS); | ||
const onPageScroll = /*#__PURE__*/ createHook(uniShared.ON_PAGE_SCROLL); | ||
const onTabItemTap = /*#__PURE__*/ createHook(uniShared.ON_TAB_ITEM_TAP); | ||
const onReachBottom = /*#__PURE__*/ createHook(uniShared.ON_REACH_BOTTOM); | ||
const onPullDownRefresh = /*#__PURE__*/ createHook(uniShared.ON_PULL_DOWN_REFRESH); | ||
const onShareTimeline = /*#__PURE__*/ createHook(uniShared.ON_SHARE_TIMELINE); | ||
const onAddToFavorites = /*#__PURE__*/ createHook(uniShared.ON_ADD_TO_FAVORITES); | ||
const onShareAppMessage = /*#__PURE__*/ createHook(uniShared.ON_SHARE_APP_MESSAGE); | ||
const onNavigationBarButtonTap = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_BUTTON_TAP); | ||
const onNavigationBarSearchInputChanged = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED); | ||
const onNavigationBarSearchInputClicked = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED); | ||
const onNavigationBarSearchInputConfirmed = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED); | ||
const onNavigationBarSearchInputFocusChanged = /*#__PURE__*/ createHook(uniShared.ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED); | ||
@@ -147,0 +115,0 @@ exports.getSsrGlobalData = getSsrGlobalData; |
@@ -1,2 +0,2 @@ | ||
import { ComponentInternalInstance } from 'vue'; | ||
import type { ComponentInternalInstance } from '@vue/runtime-core'; | ||
import { ref } from 'vue'; | ||
@@ -3,0 +3,0 @@ import { shallowRef } from 'vue'; |
import { shallowRef, ref, getCurrentInstance, isInSSRComponentSetup, injectHook } from 'vue'; | ||
import { hasOwn, isString } from '@vue/shared'; | ||
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'; | ||
const UNI_SSR = '__uniSSR'; | ||
const UNI_SSR_DATA = 'data'; | ||
const UNI_SSR_GLOBAL_DATA = 'globalData'; | ||
// lifecycle | ||
// 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'; | ||
const sanitise = (val) => (val && JSON.parse(JSON.stringify(val))) || val; | ||
function getSSRDataType() { | ||
@@ -39,0 +6,0 @@ return getCurrentInstance() ? UNI_SSR_DATA : UNI_SSR_GLOBAL_DATA; |
{ | ||
"name": "@dcloudio/uni-app", | ||
"version": "3.0.0-alpha-3021220211105008", | ||
"version": "3.0.0-alpha-3021220211105009", | ||
"description": "@dcloudio/uni-app", | ||
@@ -21,3 +21,14 @@ "main": "./dist/uni-app.cjs.js", | ||
}, | ||
"gitHead": "3dee78eb8ec9e5767c6d04757d934b9f40338658" | ||
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da", | ||
"uni-app": { | ||
"name": "uni-app", | ||
"main": "dist/uni.compiler.js" | ||
}, | ||
"dependencies": { | ||
"@dcloudio/uni-cloud": "3.0.0-alpha-3021220211105009", | ||
"@dcloudio/uni-components": "3.0.0-alpha-3021220211105009", | ||
"@dcloudio/uni-i18n": "3.0.0-alpha-3021220211105009", | ||
"@dcloudio/uni-shared": "3.0.0-alpha-3021220211105009", | ||
"@dcloudio/uni-stat": "3.0.0-alpha-3021220211105009" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
26263
5
249