功能:同步小程序流程

This commit is contained in:
xiaowang
2026-05-23 18:45:41 +08:00
parent 844516988b
commit 30ae763e18
117 changed files with 8823 additions and 76 deletions
+56
View File
@@ -1,8 +1,28 @@
/**
* Purpose: DEFAULT_CURSOR_SPACING supports keyboard-safe.js by holding or executing the default cursor spacing page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEFAULT_CURSOR_SPACING = 96
/**
* Purpose: DEFAULT_SPACER_EXTRA_RPX supports keyboard-safe.js by holding or executing the default spacer extra rpx page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEFAULT_SPACER_EXTRA_RPX = 48
/**
* Purpose: DEFAULT_SCROLL_DELAY supports keyboard-safe.js by holding or executing the default scroll delay page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const DEFAULT_SCROLL_DELAY = 32
/**
* Purpose: MAX_CURSOR_SPACING supports keyboard-safe.js by holding or executing the max cursor spacing page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const MAX_CURSOR_SPACING = 180
/**
* Purpose: getWindowWidth supports keyboard-safe.js by holding or executing the get window width page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function getWindowWidth() {
try {
if (typeof wx.getWindowInfo === 'function') {
@@ -18,10 +38,18 @@ function getWindowWidth() {
}
}
/**
* Purpose: pxToRpx supports keyboard-safe.js by holding or executing the px to rpx page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function pxToRpx(px) {
return Math.round((Number(px) || 0) * 750 / getWindowWidth())
}
/**
* Purpose: createKeyboardSafeData supports keyboard-safe.js by holding or executing the create keyboard safe data page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function createKeyboardSafeData(options = {}) {
const cursorSpacing = Number(options.cursorSpacing) > 0
? Math.round(Number(options.cursorSpacing))
@@ -36,6 +64,10 @@ function createKeyboardSafeData(options = {}) {
}
}
/**
* Purpose: clearKeyboardTimers supports keyboard-safe.js by holding or executing the clear keyboard timers page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function clearKeyboardTimers(state) {
if (!state) {
return
@@ -52,6 +84,10 @@ function clearKeyboardTimers(state) {
}
}
/**
* Purpose: queueAnchorScroll supports keyboard-safe.js by holding or executing the queue anchor scroll page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function queueAnchorScroll(page, anchorId) {
const state = page && page.__keyboardSafe
if (!page || !state || !anchorId) {
@@ -83,6 +119,10 @@ function queueAnchorScroll(page, anchorId) {
state.anchorTimer = setTimeout(updateAnchor, 0)
}
/**
* Purpose: attachKeyboardSafe supports keyboard-safe.js by holding or executing the attach keyboard safe page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function attachKeyboardSafe(page, options = {}) {
if (!page) {
return
@@ -141,6 +181,10 @@ function attachKeyboardSafe(page, options = {}) {
}
}
/**
* Purpose: detachKeyboardSafe supports keyboard-safe.js by holding or executing the detach keyboard safe page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function detachKeyboardSafe(page) {
if (!page || !page.__keyboardSafe) {
return
@@ -158,6 +202,10 @@ function detachKeyboardSafe(page) {
delete page.__keyboardSafe
}
/**
* Purpose: handleKeyboardFocus supports keyboard-safe.js by holding or executing the handle keyboard focus page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function handleKeyboardFocus(page, event) {
const state = page && page.__keyboardSafe
if (!page || !state) {
@@ -191,6 +239,10 @@ function handleKeyboardFocus(page, event) {
}
}
/**
* Purpose: resetKeyboardSafe supports keyboard-safe.js by holding or executing the reset keyboard safe page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function resetKeyboardSafe(page, options = {}) {
if (!page) {
return
@@ -215,6 +267,10 @@ function resetKeyboardSafe(page, options = {}) {
})
}
/**
* Purpose: handleKeyboardBlur supports keyboard-safe.js by holding or executing the handle keyboard blur page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function handleKeyboardBlur(page) {
const state = page && page.__keyboardSafe
if (!page || !state) {