@composy/keyboard-vue 0.0.1 → 0.0.2
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/README.md +48 -24
- package/dist/index.css +552 -560
- package/dist/index.js +228 -192
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.min.js +954 -1
- package/dist/index.min.js.map +1 -0
- package/es/.dts-output-manifest.json +1 -0
- package/es/.dts.tsbuildinfo +1 -0
- package/es/components/KeyboardKey.js +1 -1
- package/es/components/KeyboardKey.js.map +1 -1
- package/es/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js +16 -7
- package/es/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/es/components/KeyboardPopup.js +1 -1
- package/es/components/KeyboardPopup.js.map +1 -1
- package/es/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js +8 -5
- package/es/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/es/components/LicensePlateKeyboard.js +1 -1
- package/es/components/LicensePlateKeyboard.js.map +1 -1
- package/es/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/es/components/VirtualKeyboard.js +1 -1
- package/es/components/VirtualKeyboard.js.map +1 -1
- package/es/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js +4 -4
- package/es/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/es/components/index.d.ts +1 -2
- package/es/components/index.d.ts.map +1 -1
- package/es/components/index.js +1 -1
- package/es/composables/index.d.ts +0 -1
- package/es/composables/index.js +1 -1
- package/es/composables/useKeyboard.d.ts +1 -2
- package/es/composables/useKeyboard.d.ts.map +1 -1
- package/es/composables/useKeyboard.js +8 -15
- package/es/composables/useKeyboard.js.map +1 -1
- package/es/composables/useKeyboardPopup.d.ts +2 -51
- package/es/composables/useKeyboardPopup.d.ts.map +1 -1
- package/es/composables/useKeyboardPopup.js +66 -49
- package/es/composables/useKeyboardPopup.js.map +1 -1
- package/es/directives/index.d.ts +0 -1
- package/es/directives/index.js +1 -1
- package/es/directives/v-keyboard.d.ts +0 -1
- package/es/directives/v-keyboard.d.ts.map +1 -1
- package/es/directives/v-keyboard.js +10 -11
- package/es/directives/v-keyboard.js.map +1 -1
- package/es/index.d.ts +3 -4
- package/es/index.d.ts.map +1 -1
- package/es/index.js +2 -5
- package/es/index.js.map +1 -1
- package/es/plugins/engine-plugin.d.ts +0 -1
- package/es/plugins/engine-plugin.d.ts.map +1 -1
- package/es/plugins/engine-plugin.js +19 -4
- package/es/plugins/engine-plugin.js.map +1 -1
- package/es/plugins/index.d.ts +0 -1
- package/es/plugins/index.js +1 -1
- package/es/style/css.js +1 -1
- package/es/style/index.css +2 -0
- package/es/style/index.js +1 -1
- package/es/styles/index.css +391 -0
- package/es/styles/keyboard.css +252 -0
- package/es/styles/themes.css +137 -0
- package/esm/components/KeyboardKey.js +17 -0
- package/esm/components/KeyboardKey.js.map +1 -0
- package/esm/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js +140 -0
- package/esm/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/esm/components/KeyboardPopup.js +17 -0
- package/esm/components/KeyboardPopup.js.map +1 -0
- package/esm/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js +167 -0
- package/esm/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/esm/components/LicensePlateKeyboard.js +17 -0
- package/esm/components/LicensePlateKeyboard.js.map +1 -0
- package/esm/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js +97 -0
- package/esm/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/esm/components/VirtualKeyboard.js +17 -0
- package/esm/components/VirtualKeyboard.js.map +1 -0
- package/esm/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js +127 -0
- package/esm/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/{lib → esm}/components/index.d.ts +1 -1
- package/esm/components/index.d.ts.map +1 -0
- package/esm/components/index.js +15 -0
- package/esm/composables/index.d.ts.map +1 -0
- package/esm/composables/index.js +13 -0
- package/{lib → esm}/composables/useKeyboard.d.ts +1 -1
- package/esm/composables/useKeyboard.d.ts.map +1 -0
- package/esm/composables/useKeyboard.js +68 -0
- package/esm/composables/useKeyboard.js.map +1 -0
- package/esm/composables/useKeyboardPopup.d.ts +25 -0
- package/esm/composables/useKeyboardPopup.d.ts.map +1 -0
- package/esm/composables/useKeyboardPopup.js +136 -0
- package/esm/composables/useKeyboardPopup.js.map +1 -0
- package/esm/directives/index.d.ts.map +1 -0
- package/esm/directives/index.js +12 -0
- package/esm/directives/v-keyboard.d.ts.map +1 -0
- package/esm/directives/v-keyboard.js +64 -0
- package/esm/directives/v-keyboard.js.map +1 -0
- package/esm/index.d.ts +42 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +34 -0
- package/esm/index.js.map +1 -0
- package/esm/plugins/engine-plugin.d.ts.map +1 -0
- package/esm/plugins/engine-plugin.js +53 -0
- package/esm/plugins/engine-plugin.js.map +1 -0
- package/esm/plugins/index.d.ts.map +1 -0
- package/esm/plugins/index.js +12 -0
- package/esm/style/css.js +1 -0
- package/esm/style/index.js +1 -0
- package/{es → esm}/style/index.less +1 -1
- package/esm/styles/index.less +5 -0
- package/esm/styles/keyboard.less +286 -0
- package/esm/styles/themes.less +164 -0
- package/lib/components/KeyboardKey.cjs +1 -1
- package/lib/components/KeyboardKey.cjs.map +1 -1
- package/lib/components/KeyboardKey.vue_vue_type_script_setup_true_lang.cjs +16 -7
- package/lib/components/KeyboardKey.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/lib/components/KeyboardPopup.cjs +1 -1
- package/lib/components/KeyboardPopup.cjs.map +1 -1
- package/lib/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.cjs +8 -5
- package/lib/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/lib/components/LicensePlateKeyboard.cjs +1 -1
- package/lib/components/LicensePlateKeyboard.cjs.map +1 -1
- package/lib/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.cjs +2 -2
- package/lib/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/lib/components/VirtualKeyboard.cjs +1 -1
- package/lib/components/VirtualKeyboard.cjs.map +1 -1
- package/lib/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.cjs +4 -4
- package/lib/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/lib/components/index.cjs +1 -1
- package/lib/components/index.d.cts +8 -0
- package/lib/components/index.d.cts.map +1 -0
- package/lib/composables/index.cjs +1 -1
- package/lib/composables/index.d.cts +6 -0
- package/lib/composables/index.d.cts.map +1 -0
- package/lib/composables/useKeyboard.cjs +8 -15
- package/lib/composables/useKeyboard.cjs.map +1 -1
- package/lib/composables/useKeyboard.d.cts +112 -0
- package/lib/composables/useKeyboard.d.cts.map +1 -0
- package/lib/composables/useKeyboardPopup.cjs +66 -49
- package/lib/composables/useKeyboardPopup.cjs.map +1 -1
- package/lib/composables/useKeyboardPopup.d.cts +24 -0
- package/lib/composables/useKeyboardPopup.d.cts.map +1 -0
- package/lib/directives/index.cjs +1 -1
- package/lib/directives/index.d.cts +5 -0
- package/lib/directives/index.d.cts.map +1 -0
- package/lib/directives/v-keyboard.cjs +10 -11
- package/lib/directives/v-keyboard.cjs.map +1 -1
- package/lib/directives/v-keyboard.d.cts +35 -0
- package/lib/directives/v-keyboard.d.cts.map +1 -0
- package/lib/index.cjs +2 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +41 -0
- package/lib/index.d.cts.map +1 -0
- package/lib/plugins/engine-plugin.cjs +19 -3
- package/lib/plugins/engine-plugin.cjs.map +1 -1
- package/lib/plugins/engine-plugin.d.cts +36 -0
- package/lib/plugins/engine-plugin.d.cts.map +1 -0
- package/lib/plugins/index.cjs +1 -1
- package/lib/plugins/index.d.cts +5 -0
- package/lib/plugins/index.d.cts.map +1 -0
- package/lib/style/index.css +1 -1
- package/lib/styles/index.css +357 -195
- package/lib/styles/keyboard.css +92 -186
- package/lib/styles/themes.css +102 -178
- package/package.json +43 -34
- package/es/styles/index.less +0 -267
- package/es/styles/keyboard.less +0 -399
- package/es/styles/themes.less +0 -233
- package/lib/composables/useKeyboardPopup.d.ts +0 -73
- package/lib/index.d.ts +0 -42
- /package/{lib → esm}/composables/index.d.ts +0 -0
- /package/{lib → esm}/directives/index.d.ts +0 -0
- /package/{lib → esm}/directives/v-keyboard.d.ts +0 -0
- /package/{lib → esm}/plugins/engine-plugin.d.ts +0 -0
- /package/{lib → esm}/plugins/index.d.ts +0 -0
package/es/composables/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* 键盘管理 Composable
|
|
3
3
|
* @module composables/useKeyboard
|
|
4
4
|
*/
|
|
5
|
+
import type { KeyboardConfig, KeyboardEventMap, KeyboardOptions, KeyboardState, KeyboardType, KeyDefinition } from '@composy/keyboard-core';
|
|
5
6
|
import type { Ref } from 'vue';
|
|
6
|
-
import { type KeyboardConfig, type KeyboardEventMap, type KeyboardOptions, type KeyboardState, type KeyboardType, type KeyDefinition } from '@composy/keyboard-core';
|
|
7
7
|
/**
|
|
8
8
|
* useKeyboard 选项
|
|
9
9
|
*/
|
|
@@ -110,4 +110,3 @@ export interface UseKeyboardReturn {
|
|
|
110
110
|
* 键盘管理 Composable
|
|
111
111
|
*/
|
|
112
112
|
export declare function useKeyboard(options?: UseKeyboardOptions): UseKeyboardReturn;
|
|
113
|
-
//# sourceMappingURL=useKeyboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboard.d.ts","sourceRoot":"","sources":["../../src/composables/useKeyboard.ts"],"names":[],"mappings":"AAAA;;;GAGG;
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AAS,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,CAAA;IAEvC;;OAEG;IACH,WAAW,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,MAAM,CAAA;IAE3C;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAEjC;;OAEG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAEnC;;OAEG;IACH,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAE1C;;OAEG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,gBAAgB,GAAG,mBAAmB,KAAK,IAAI,CAAA;IAElE;;OAEG;IACH,WAAW,EAAE,MAAM,IAAI,CAAA;IAEvB;;OAEG;IACH,EAAE,EAAE,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACnC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,KACzC,MAAM,IAAI,CAAA;IAEf;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACrC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,KACzC,MAAM,IAAI,CAAA;IAEf;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CA4EnB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ***********************************
|
|
3
3
|
* @composy/keyboard-vue v0.0.1 *
|
|
4
4
|
* Built with rollup *
|
|
5
|
-
* Build time: 2024-
|
|
5
|
+
* Build time: 2024-10-12 17:44:15 *
|
|
6
6
|
* Build mode: production *
|
|
7
7
|
* Minified: No *
|
|
8
8
|
* ***********************************
|
|
@@ -13,21 +13,14 @@ import { createKeyboardManager } from "@composy/keyboard-core";
|
|
|
13
13
|
function useKeyboard(options = {}) {
|
|
14
14
|
const { immediate = false, ...keyboardOptions } = options;
|
|
15
15
|
const manager = createKeyboardManager(keyboardOptions);
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
16
|
+
const initialState = manager.getState();
|
|
17
|
+
const visible = ref(initialState.visible);
|
|
18
|
+
const type = ref(initialState.type);
|
|
19
|
+
const isUpperCase = ref(initialState.isUpperCase);
|
|
20
|
+
const value = ref(initialState.value);
|
|
21
|
+
const cursorPosition = ref(initialState.cursorPosition);
|
|
21
22
|
const layout = shallowRef(manager.getLayout());
|
|
22
|
-
const state = reactive({
|
|
23
|
-
visible: false,
|
|
24
|
-
type: keyboardOptions.type ?? "qwerty",
|
|
25
|
-
isUpperCase: keyboardOptions.defaultUpperCase ?? false,
|
|
26
|
-
value: keyboardOptions.value ?? "",
|
|
27
|
-
cursorPosition: keyboardOptions.value?.length ?? 0,
|
|
28
|
-
maxLength: keyboardOptions.maxLength,
|
|
29
|
-
inputElement: null
|
|
30
|
-
});
|
|
23
|
+
const state = reactive({ ...initialState });
|
|
31
24
|
const syncState = (newState) => {
|
|
32
25
|
visible.value = newState.visible;
|
|
33
26
|
type.value = newState.type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboard.js","names":[],"sources":["../../src/composables/useKeyboard.ts"],"sourcesContent":["/**\n * 键盘管理 Composable\n * @module composables/useKeyboard\n */\n\
|
|
1
|
+
{"version":3,"file":"useKeyboard.js","names":[],"sources":["../../src/composables/useKeyboard.ts"],"sourcesContent":["/**\r\n * 键盘管理 Composable\r\n * @module composables/useKeyboard\r\n */\r\n\r\nimport type {\r\n KeyboardConfig,\r\n KeyboardEventMap,\r\n KeyboardOptions,\r\n KeyboardState,\r\n KeyboardType,\r\n KeyDefinition,\r\n} from '@composy/keyboard-core'\r\nimport type { Ref } from 'vue'\r\nimport { createKeyboardManager } from '@composy/keyboard-core'\r\nimport { onBeforeUnmount, reactive, ref, shallowRef } from 'vue'\r\n\r\n/**\r\n * useKeyboard 选项\r\n */\r\nexport interface UseKeyboardOptions extends KeyboardOptions {\r\n /**\r\n * 是否立即显示\r\n */\r\n immediate?: boolean\r\n}\r\n\r\n/**\r\n * useKeyboard 返回值\r\n */\r\nexport interface UseKeyboardReturn {\r\n /**\r\n * 键盘是否可见\r\n */\r\n visible: Ref<boolean>\r\n\r\n /**\r\n * 当前键盘类型\r\n */\r\n type: Ref<KeyboardType>\r\n\r\n /**\r\n * 是否大写状态\r\n */\r\n isUpperCase: Ref<boolean>\r\n\r\n /**\r\n * 当前输入值\r\n */\r\n value: Ref<string>\r\n\r\n /**\r\n * 光标位置\r\n */\r\n cursorPosition: Ref<number>\r\n\r\n /**\r\n * 当前布局配置\r\n */\r\n layout: Ref<KeyboardConfig | null>\r\n\r\n /**\r\n * 完整状态\r\n */\r\n state: KeyboardState\r\n\r\n /**\r\n * 显示键盘\r\n */\r\n show: (input?: HTMLInputElement | HTMLTextAreaElement) => void\r\n\r\n /**\r\n * 隐藏键盘\r\n */\r\n hide: () => void\r\n\r\n /**\r\n * 切换显示/隐藏\r\n */\r\n toggle: (input?: HTMLInputElement | HTMLTextAreaElement) => void\r\n\r\n /**\r\n * 切换键盘类型\r\n */\r\n switchType: (type: KeyboardType | string) => void\r\n\r\n /**\r\n * 切换大小写\r\n */\r\n toggleShift: () => void\r\n\r\n /**\r\n * 处理按键\r\n */\r\n handleKey: (key: KeyDefinition) => void\r\n\r\n /**\r\n * 获取按键显示文本\r\n */\r\n getKeyLabel: (key: KeyDefinition) => string\r\n\r\n /**\r\n * 设置值\r\n */\r\n setValue: (value: string) => void\r\n\r\n /**\r\n * 追加值(在光标位置插入文本)\r\n */\r\n appendValue: (text: string) => void\r\n\r\n /**\r\n * 设置最大长度\r\n */\r\n setMaxLength: (maxLength?: number) => void\r\n\r\n /**\r\n * 绑定输入框\r\n */\r\n bindInput: (input: HTMLInputElement | HTMLTextAreaElement) => void\r\n\r\n /**\r\n * 解绑输入框\r\n */\r\n unbindInput: () => void\r\n\r\n /**\r\n * 事件监听\r\n */\r\n on: <K extends keyof KeyboardEventMap>(\r\n event: K,\r\n handler: (data: KeyboardEventMap[K]) => void\r\n ) => () => void\r\n\r\n /**\r\n * 单次事件监听\r\n */\r\n once: <K extends keyof KeyboardEventMap>(\r\n event: K,\r\n handler: (data: KeyboardEventMap[K]) => void\r\n ) => () => void\r\n\r\n /**\r\n * 销毁\r\n */\r\n destroy: () => void\r\n}\r\n\r\n/**\r\n * 键盘管理 Composable\r\n */\r\nexport function useKeyboard(\r\n options: UseKeyboardOptions = {}\r\n): UseKeyboardReturn {\r\n const { immediate = false, ...keyboardOptions } = options\r\n\r\n // 创建键盘管理器\r\n const manager = createKeyboardManager(keyboardOptions)\r\n const initialState = manager.getState()\r\n\r\n // 响应式状态\r\n const visible = ref(initialState.visible)\r\n const type = ref<KeyboardType>(initialState.type)\r\n const isUpperCase = ref(initialState.isUpperCase)\r\n const value = ref(initialState.value)\r\n const cursorPosition = ref(initialState.cursorPosition)\r\n const layout = shallowRef<KeyboardConfig | null>(manager.getLayout())\r\n\r\n // 完整状态(响应式对象)\r\n const state = reactive<KeyboardState>({\r\n ...initialState,\r\n })\r\n\r\n // 同步管理器状态到 Vue 响应式状态\r\n const syncState = (newState: KeyboardState) => {\r\n visible.value = newState.visible\r\n type.value = newState.type\r\n isUpperCase.value = newState.isUpperCase\r\n value.value = newState.value\r\n cursorPosition.value = newState.cursorPosition\r\n\r\n Object.assign(state, newState)\r\n }\r\n\r\n // 监听状态变化\r\n manager.on('stateChange', syncState)\r\n\r\n // 监听键盘类型切换,更新布局\r\n manager.on('switch', () => {\r\n layout.value = manager.getLayout()\r\n })\r\n\r\n // 立即显示\r\n if (immediate) {\r\n manager.show()\r\n }\r\n\r\n // 组件卸载时销毁\r\n onBeforeUnmount(() => {\r\n manager.destroy()\r\n })\r\n\r\n return {\r\n visible,\r\n type,\r\n isUpperCase,\r\n value,\r\n cursorPosition,\r\n layout,\r\n state,\r\n show: (input?: HTMLInputElement | HTMLTextAreaElement) =>\r\n manager.show(input),\r\n hide: () => manager.hide(),\r\n toggle: (input?: HTMLInputElement | HTMLTextAreaElement) =>\r\n manager.toggle(input),\r\n switchType: (t: KeyboardType | string) => manager.switchType(t),\r\n toggleShift: () => manager.toggleShift(),\r\n handleKey: (key: KeyDefinition) => manager.handleKey(key),\r\n getKeyLabel: (key: KeyDefinition) => manager.getKeyLabel(key),\r\n setValue: (v: string) => manager.setValue(v),\r\n appendValue: (text: string) => manager.appendValue(text),\r\n setMaxLength: (maxLength?: number) => manager.setMaxLength(maxLength),\r\n bindInput: (input: HTMLInputElement | HTMLTextAreaElement) =>\r\n manager.bindInput(input),\r\n unbindInput: () => manager.unbindInput(),\r\n on: (event, handler) => manager.on(event, handler),\r\n once: (event, handler) => manager.once(event, handler),\r\n destroy: () => manager.destroy(),\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAuJO,SAAS,YACd,UAA8B,CAAC,GACZ;CACnB,MAAM,EAAE,YAAY,OAAO,GAAG,oBAAoB;CAGlD,MAAM,UAAU,sBAAsB,eAAe;CACrD,MAAM,eAAe,QAAQ,SAAS;CAGtC,MAAM,UAAU,IAAI,aAAa,OAAO;CACxC,MAAM,OAAO,IAAkB,aAAa,IAAI;CAChD,MAAM,cAAc,IAAI,aAAa,WAAW;CAChD,MAAM,QAAQ,IAAI,aAAa,KAAK;CACpC,MAAM,iBAAiB,IAAI,aAAa,cAAc;CACtD,MAAM,SAAS,WAAkC,QAAQ,UAAU,CAAC;CAGpE,MAAM,QAAQ,SAAwB,EACpC,GAAG,aACL,CAAC;CAGD,MAAM,aAAa,aAA4B;EAC7C,QAAQ,QAAQ,SAAS;EACzB,KAAK,QAAQ,SAAS;EACtB,YAAY,QAAQ,SAAS;EAC7B,MAAM,QAAQ,SAAS;EACvB,eAAe,QAAQ,SAAS;EAEhC,OAAO,OAAO,OAAO,QAAQ;CAC/B;CAGA,QAAQ,GAAG,eAAe,SAAS;CAGnC,QAAQ,GAAG,gBAAgB;EACzB,OAAO,QAAQ,QAAQ,UAAU;CACnC,CAAC;CAGD,IAAI,WACF,QAAQ,KAAK;CAIf,sBAAsB;EACpB,QAAQ,QAAQ;CAClB,CAAC;CAED,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAO,UACL,QAAQ,KAAK,KAAK;EACpB,YAAY,QAAQ,KAAK;EACzB,SAAS,UACP,QAAQ,OAAO,KAAK;EACtB,aAAa,MAA6B,QAAQ,WAAW,CAAC;EAC9D,mBAAmB,QAAQ,YAAY;EACvC,YAAY,QAAuB,QAAQ,UAAU,GAAG;EACxD,cAAc,QAAuB,QAAQ,YAAY,GAAG;EAC5D,WAAW,MAAc,QAAQ,SAAS,CAAC;EAC3C,cAAc,SAAiB,QAAQ,YAAY,IAAI;EACvD,eAAe,cAAuB,QAAQ,aAAa,SAAS;EACpE,YAAY,UACV,QAAQ,UAAU,KAAK;EACzB,mBAAmB,QAAQ,YAAY;EACvC,KAAK,OAAO,YAAY,QAAQ,GAAG,OAAO,OAAO;EACjD,OAAO,OAAO,YAAY,QAAQ,KAAK,OAAO,OAAO;EACrD,eAAe,QAAQ,QAAQ;CACjC;AACF"}
|
|
@@ -1,73 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Keyboard popup composable.
|
|
3
3
|
* @module composables/useKeyboardPopup
|
|
4
4
|
*/
|
|
5
|
+
import type { PopupPlacement, PopupPositionConfig } from '@composy/keyboard-core';
|
|
5
6
|
import type { CSSProperties, Ref } from 'vue';
|
|
6
|
-
import { type PopupPlacement, type PopupPositionConfig } from '@composy/keyboard-core';
|
|
7
|
-
/**
|
|
8
|
-
* useKeyboardPopup 选项
|
|
9
|
-
*/
|
|
10
7
|
export interface UseKeyboardPopupOptions extends PopupPositionConfig {
|
|
11
|
-
/**
|
|
12
|
-
* 是否显示
|
|
13
|
-
*/
|
|
14
8
|
visible?: Ref<boolean>;
|
|
15
|
-
/**
|
|
16
|
-
* 目标元素
|
|
17
|
-
*/
|
|
18
9
|
target?: Ref<HTMLElement | null>;
|
|
19
|
-
/**
|
|
20
|
-
* 弹出层元素
|
|
21
|
-
*/
|
|
22
10
|
popup?: Ref<HTMLElement | null>;
|
|
23
|
-
/**
|
|
24
|
-
* 点击外部关闭
|
|
25
|
-
*/
|
|
26
11
|
closeOnClickOutside?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* 关闭回调
|
|
29
|
-
*/
|
|
30
12
|
onClose?: () => void;
|
|
31
13
|
}
|
|
32
|
-
/**
|
|
33
|
-
* useKeyboardPopup 返回值
|
|
34
|
-
*/
|
|
35
14
|
export interface UseKeyboardPopupReturn {
|
|
36
|
-
/**
|
|
37
|
-
* 弹出层样式
|
|
38
|
-
*/
|
|
39
15
|
popupStyles: Ref<CSSProperties>;
|
|
40
|
-
/**
|
|
41
|
-
* 遮罩层样式
|
|
42
|
-
*/
|
|
43
16
|
maskStyles: Ref<CSSProperties>;
|
|
44
|
-
/**
|
|
45
|
-
* 当前弹出位置
|
|
46
|
-
*/
|
|
47
17
|
placement: Ref<PopupPlacement>;
|
|
48
|
-
/**
|
|
49
|
-
* 是否移动端
|
|
50
|
-
*/
|
|
51
18
|
isMobileDevice: Ref<boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* 是否显示遮罩
|
|
54
|
-
*/
|
|
55
19
|
showMask: Ref<boolean>;
|
|
56
|
-
/**
|
|
57
|
-
* 是否正在动画中
|
|
58
|
-
*/
|
|
59
20
|
isAnimating: Ref<boolean>;
|
|
60
|
-
/**
|
|
61
|
-
* 更新位置
|
|
62
|
-
*/
|
|
63
21
|
updatePosition: () => void;
|
|
64
|
-
/**
|
|
65
|
-
* 关闭弹出层
|
|
66
|
-
*/
|
|
67
22
|
close: () => void;
|
|
68
23
|
}
|
|
69
|
-
/**
|
|
70
|
-
* 键盘弹出层 Composable
|
|
71
|
-
*/
|
|
72
24
|
export declare function useKeyboardPopup(options?: UseKeyboardPopupOptions): UseKeyboardPopupReturn;
|
|
73
|
-
//# sourceMappingURL=useKeyboardPopup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardPopup.d.ts","sourceRoot":"","sources":["../../src/composables/useKeyboardPopup.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"useKeyboardPopup.d.ts","sourceRoot":"","sources":["../../src/composables/useKeyboardPopup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACpB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAS7C,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,OAAO,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACtB,MAAM,CAAC,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAChC,KAAK,CAAC,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,GAAG,CAAC,aAAa,CAAC,CAAA;IAC/B,UAAU,EAAE,GAAG,CAAC,aAAa,CAAC,CAAA;IAC9B,SAAS,EAAE,GAAG,CAAC,cAAc,CAAC,CAAA;IAC9B,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAC5B,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACtB,WAAW,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IACzB,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,uBAA4B,GACpC,sBAAsB,CAwKxB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ***********************************
|
|
3
3
|
* @composy/keyboard-vue v0.0.1 *
|
|
4
4
|
* Built with rollup *
|
|
5
|
-
* Build time: 2024-
|
|
5
|
+
* Build time: 2024-10-12 17:44:15 *
|
|
6
6
|
* Build mode: production *
|
|
7
7
|
* Minified: No *
|
|
8
8
|
* ***********************************
|
|
@@ -22,12 +22,28 @@ function useKeyboardPopup(options = {}) {
|
|
|
22
22
|
let cleanupClickOutside = null;
|
|
23
23
|
let cleanupViewportChange = null;
|
|
24
24
|
let cleanupScroll = null;
|
|
25
|
+
let animationFrame = null;
|
|
26
|
+
let visibilitySession = 0;
|
|
27
|
+
const cleanupOpenResources = () => {
|
|
28
|
+
cleanupClickOutside?.();
|
|
29
|
+
cleanupClickOutside = null;
|
|
30
|
+
cleanupViewportChange?.();
|
|
31
|
+
cleanupViewportChange = null;
|
|
32
|
+
cleanupScroll?.();
|
|
33
|
+
cleanupScroll = null;
|
|
34
|
+
};
|
|
35
|
+
const cancelAnimationFrame = () => {
|
|
36
|
+
if (animationFrame === null || typeof window === "undefined") return;
|
|
37
|
+
window.cancelAnimationFrame(animationFrame);
|
|
38
|
+
animationFrame = null;
|
|
39
|
+
};
|
|
25
40
|
const updatePosition = () => {
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
const popupElement = popup.value;
|
|
42
|
+
if (!popupElement) return;
|
|
43
|
+
const popupRect = popupElement.getBoundingClientRect();
|
|
28
44
|
const result = positionManager.calculate(target.value, {
|
|
29
|
-
width: popupRect.width
|
|
30
|
-
height: popupRect.height
|
|
45
|
+
width: Math.max(0, popupRect.width),
|
|
46
|
+
height: Math.max(0, popupRect.height)
|
|
31
47
|
});
|
|
32
48
|
placement.value = result.placement;
|
|
33
49
|
showMask.value = positionManager.shouldShowMask();
|
|
@@ -36,71 +52,72 @@ function useKeyboardPopup(options = {}) {
|
|
|
36
52
|
left: "0",
|
|
37
53
|
right: "0",
|
|
38
54
|
bottom: "0",
|
|
39
|
-
maxHeight: `${result.maxHeight}px`,
|
|
55
|
+
maxHeight: result.maxHeight === void 0 ? void 0 : `${result.maxHeight}px`,
|
|
40
56
|
zIndex: 1e3
|
|
41
57
|
};
|
|
42
58
|
else popupStyles.value = {
|
|
43
59
|
position: "fixed",
|
|
44
60
|
left: `${result.position.x}px`,
|
|
45
61
|
top: `${result.position.y}px`,
|
|
46
|
-
maxHeight: result.maxHeight ? `${result.maxHeight}px
|
|
47
|
-
maxWidth: result.maxWidth ? `${result.maxWidth}px
|
|
62
|
+
maxHeight: result.maxHeight === void 0 ? void 0 : `${result.maxHeight}px`,
|
|
63
|
+
maxWidth: result.maxWidth === void 0 ? void 0 : `${result.maxWidth}px`,
|
|
48
64
|
zIndex: 1e3
|
|
49
65
|
};
|
|
50
|
-
|
|
66
|
+
maskStyles.value = showMask.value ? {
|
|
51
67
|
position: "fixed",
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
right: "0",
|
|
55
|
-
bottom: "0",
|
|
56
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
68
|
+
inset: "0",
|
|
69
|
+
backgroundColor: "var(--keyboard-mask-bg)",
|
|
57
70
|
zIndex: 999
|
|
58
|
-
};
|
|
71
|
+
} : {};
|
|
59
72
|
};
|
|
60
73
|
const close = () => {
|
|
61
|
-
onClose?.();
|
|
74
|
+
if (visible.value) onClose?.();
|
|
62
75
|
};
|
|
63
76
|
watch(visible, (newVisible) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
visibilitySession += 1;
|
|
78
|
+
const currentSession = visibilitySession;
|
|
79
|
+
cancelAnimationFrame();
|
|
80
|
+
cleanupOpenResources();
|
|
81
|
+
if (!newVisible) {
|
|
82
|
+
isAnimating.value = false;
|
|
83
|
+
showMask.value = false;
|
|
84
|
+
popupStyles.value = {};
|
|
85
|
+
maskStyles.value = {};
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
isMobileDevice.value = isMobile();
|
|
89
|
+
isAnimating.value = true;
|
|
90
|
+
if (typeof window !== "undefined") animationFrame = window.requestAnimationFrame(() => {
|
|
91
|
+
animationFrame = null;
|
|
92
|
+
if (!visible.value || currentSession !== visibilitySession) return;
|
|
93
|
+
updatePosition();
|
|
94
|
+
isAnimating.value = false;
|
|
95
|
+
if (closeOnClickOutside && popup.value) cleanupClickOutside = onClickOutside(popup.value, (event) => {
|
|
96
|
+
if (target.value && event.target instanceof Node && target.value.contains(event.target)) return;
|
|
97
|
+
close();
|
|
76
98
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
cleanupClickOutside = null;
|
|
91
|
-
cleanupViewportChange?.();
|
|
92
|
-
cleanupViewportChange = null;
|
|
93
|
-
cleanupScroll?.();
|
|
94
|
-
cleanupScroll = null;
|
|
99
|
+
});
|
|
100
|
+
cleanupViewportChange = onViewportChange(() => {
|
|
101
|
+
if (!visible.value) return;
|
|
102
|
+
isMobileDevice.value = isMobile();
|
|
103
|
+
updatePosition();
|
|
104
|
+
});
|
|
105
|
+
if (!isMobileDevice.value && typeof window !== "undefined") {
|
|
106
|
+
const handleScroll = () => {
|
|
107
|
+
if (!visible.value) return;
|
|
108
|
+
window.requestAnimationFrame(updatePosition);
|
|
109
|
+
};
|
|
110
|
+
window.addEventListener("scroll", handleScroll, true);
|
|
111
|
+
cleanupScroll = () => window.removeEventListener("scroll", handleScroll, true);
|
|
95
112
|
}
|
|
96
113
|
}, { immediate: true });
|
|
97
114
|
watch(target, () => {
|
|
98
115
|
if (visible.value) updatePosition();
|
|
99
116
|
});
|
|
100
117
|
onBeforeUnmount(() => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
118
|
+
visibilitySession += 1;
|
|
119
|
+
cancelAnimationFrame();
|
|
120
|
+
cleanupOpenResources();
|
|
104
121
|
});
|
|
105
122
|
return {
|
|
106
123
|
popupStyles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardPopup.js","names":[],"sources":["../../src/composables/useKeyboardPopup.ts"],"sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"file":"useKeyboardPopup.js","names":[],"sources":["../../src/composables/useKeyboardPopup.ts"],"sourcesContent":["/**\r\n * Keyboard popup composable.\r\n * @module composables/useKeyboardPopup\r\n */\r\n\r\nimport type {\r\n PopupPlacement,\r\n PopupPositionConfig,\r\n} from '@composy/keyboard-core'\r\nimport type { CSSProperties, Ref } from 'vue'\r\nimport {\r\n createPositionManager,\r\n isMobile,\r\n onClickOutside,\r\n onViewportChange,\r\n} from '@composy/keyboard-core'\r\nimport { onBeforeUnmount, ref, watch } from 'vue'\r\n\r\nexport interface UseKeyboardPopupOptions extends PopupPositionConfig {\r\n visible?: Ref<boolean>\r\n target?: Ref<HTMLElement | null>\r\n popup?: Ref<HTMLElement | null>\r\n closeOnClickOutside?: boolean\r\n onClose?: () => void\r\n}\r\n\r\nexport interface UseKeyboardPopupReturn {\r\n popupStyles: Ref<CSSProperties>\r\n maskStyles: Ref<CSSProperties>\r\n placement: Ref<PopupPlacement>\r\n isMobileDevice: Ref<boolean>\r\n showMask: Ref<boolean>\r\n isAnimating: Ref<boolean>\r\n updatePosition: () => void\r\n close: () => void\r\n}\r\n\r\nexport function useKeyboardPopup(\r\n options: UseKeyboardPopupOptions = {}\r\n): UseKeyboardPopupReturn {\r\n const {\r\n visible = ref(false),\r\n target = ref(null),\r\n popup = ref(null),\r\n closeOnClickOutside = true,\r\n onClose,\r\n ...positionConfig\r\n } = options\r\n\r\n const positionManager = createPositionManager(positionConfig)\r\n const popupStyles = ref<CSSProperties>({})\r\n const maskStyles = ref<CSSProperties>({})\r\n const placement = ref<PopupPlacement>('bottom')\r\n const isMobileDevice = ref(isMobile())\r\n const showMask = ref(false)\r\n const isAnimating = ref(false)\r\n\r\n let cleanupClickOutside: (() => void) | null = null\r\n let cleanupViewportChange: (() => void) | null = null\r\n let cleanupScroll: (() => void) | null = null\r\n let animationFrame: number | null = null\r\n let visibilitySession = 0\r\n\r\n const cleanupOpenResources = () => {\r\n cleanupClickOutside?.()\r\n cleanupClickOutside = null\r\n cleanupViewportChange?.()\r\n cleanupViewportChange = null\r\n cleanupScroll?.()\r\n cleanupScroll = null\r\n }\r\n\r\n const cancelAnimationFrame = () => {\r\n if (animationFrame === null || typeof window === 'undefined') return\r\n window.cancelAnimationFrame(animationFrame)\r\n animationFrame = null\r\n }\r\n\r\n const updatePosition = () => {\r\n const popupElement = popup.value\r\n if (!popupElement) return\r\n\r\n const popupRect = popupElement.getBoundingClientRect()\r\n const result = positionManager.calculate(target.value, {\r\n width: Math.max(0, popupRect.width),\r\n height: Math.max(0, popupRect.height),\r\n })\r\n\r\n placement.value = result.placement\r\n showMask.value = positionManager.shouldShowMask()\r\n\r\n if (result.placement === 'bottom-sheet') {\r\n popupStyles.value = {\r\n position: 'fixed',\r\n left: '0',\r\n right: '0',\r\n bottom: '0',\r\n maxHeight:\r\n result.maxHeight === undefined ? undefined : `${result.maxHeight}px`,\r\n zIndex: 1000,\r\n }\r\n } else {\r\n popupStyles.value = {\r\n position: 'fixed',\r\n left: `${result.position.x}px`,\r\n top: `${result.position.y}px`,\r\n maxHeight:\r\n result.maxHeight === undefined ? undefined : `${result.maxHeight}px`,\r\n maxWidth:\r\n result.maxWidth === undefined ? undefined : `${result.maxWidth}px`,\r\n zIndex: 1000,\r\n }\r\n }\r\n\r\n maskStyles.value = showMask.value\r\n ? {\r\n position: 'fixed',\r\n inset: '0',\r\n backgroundColor: 'var(--keyboard-mask-bg)',\r\n zIndex: 999,\r\n }\r\n : {}\r\n }\r\n\r\n const close = () => {\r\n if (visible.value) onClose?.()\r\n }\r\n\r\n watch(\r\n visible,\r\n newVisible => {\r\n visibilitySession += 1\r\n const currentSession = visibilitySession\r\n cancelAnimationFrame()\r\n cleanupOpenResources()\r\n\r\n if (!newVisible) {\r\n isAnimating.value = false\r\n showMask.value = false\r\n popupStyles.value = {}\r\n maskStyles.value = {}\r\n return\r\n }\r\n\r\n isMobileDevice.value = isMobile()\r\n isAnimating.value = true\r\n\r\n if (typeof window !== 'undefined') {\r\n animationFrame = window.requestAnimationFrame(() => {\r\n animationFrame = null\r\n if (!visible.value || currentSession !== visibilitySession) return\r\n\r\n updatePosition()\r\n isAnimating.value = false\r\n if (closeOnClickOutside && popup.value) {\r\n cleanupClickOutside = onClickOutside(popup.value, event => {\r\n if (\r\n target.value &&\r\n event.target instanceof Node &&\r\n target.value.contains(event.target)\r\n )\r\n return\r\n close()\r\n })\r\n }\r\n })\r\n }\r\n\r\n cleanupViewportChange = onViewportChange(() => {\r\n if (!visible.value) return\r\n isMobileDevice.value = isMobile()\r\n updatePosition()\r\n })\r\n\r\n if (!isMobileDevice.value && typeof window !== 'undefined') {\r\n const handleScroll = () => {\r\n if (!visible.value) return\r\n window.requestAnimationFrame(updatePosition)\r\n }\r\n window.addEventListener('scroll', handleScroll, true)\r\n cleanupScroll = () =>\r\n window.removeEventListener('scroll', handleScroll, true)\r\n }\r\n },\r\n { immediate: true }\r\n )\r\n\r\n watch(target, () => {\r\n if (visible.value) updatePosition()\r\n })\r\n\r\n onBeforeUnmount(() => {\r\n visibilitySession += 1\r\n cancelAnimationFrame()\r\n cleanupOpenResources()\r\n })\r\n\r\n return {\r\n popupStyles,\r\n maskStyles,\r\n placement,\r\n isMobileDevice,\r\n showMask,\r\n isAnimating,\r\n updatePosition,\r\n close,\r\n }\r\n}\r\n"],"mappings":";;;;;;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AAiB,UAAU,cAAc,IAAI;GACpD,sBACE,OAAO,oBAAoB,UAAU,cAAc,IAAI;EAC3D;CACF,GACA,EAAE,WAAW,KAAK,CACpB;CAEA,MAAM,cAAc;EAClB,IAAI,QAAQ,OAAO,eAAe;CACpC,CAAC;CAED,sBAAsB;EACpB,qBAAqB;EACrB,qBAAqB;EACrB,qBAAqB;CACvB,CAAC;CAED,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
package/es/directives/index.d.ts
CHANGED
package/es/directives/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v-keyboard.d.ts","sourceRoot":"","sources":["../../src/directives/v-keyboard.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,KAAK,CAAA;AAEtD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW;IACX,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,aAAa;IACb,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,gBAAgB,GAAG,mBAAmB,KAAK,IAAI,CAAA;IAC7D,aAAa;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;
|
|
1
|
+
{"version":3,"file":"v-keyboard.d.ts","sourceRoot":"","sources":["../../src/directives/v-keyboard.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,KAAK,CAAA;AAEtD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW;IACX,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,aAAa;IACb,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,gBAAgB,GAAG,mBAAmB,KAAK,IAAI,CAAA;IAC7D,aAAa;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAQD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,CAC/B,gBAAgB,GAAG,mBAAmB,EACtC,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAmDpC,CAAA"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ***********************************
|
|
3
3
|
* @composy/keyboard-vue v0.0.1 *
|
|
4
4
|
* Built with rollup *
|
|
5
|
-
* Build time: 2024-
|
|
5
|
+
* Build time: 2024-10-12 17:44:15 *
|
|
6
6
|
* Build mode: production *
|
|
7
7
|
* Minified: No *
|
|
8
8
|
* ***********************************
|
|
9
9
|
*/
|
|
10
10
|
//#region src/directives/v-keyboard.ts
|
|
11
|
-
const
|
|
11
|
+
const directiveStates = /* @__PURE__ */ new WeakMap();
|
|
12
12
|
const vKeyboard = {
|
|
13
13
|
mounted(el, binding) {
|
|
14
14
|
const options = parseBinding(binding);
|
|
@@ -19,14 +19,14 @@ const vKeyboard = {
|
|
|
19
19
|
};
|
|
20
20
|
el.addEventListener("focus", handleFocus);
|
|
21
21
|
el.setAttribute("inputmode", "none");
|
|
22
|
-
el
|
|
22
|
+
directiveStates.set(el, { cleanup: () => {
|
|
23
23
|
el.removeEventListener("focus", handleFocus);
|
|
24
24
|
el.removeAttribute("inputmode");
|
|
25
|
-
} };
|
|
25
|
+
} });
|
|
26
26
|
},
|
|
27
27
|
updated(el, binding) {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
directiveStates.get(el)?.cleanup();
|
|
29
|
+
directiveStates.delete(el);
|
|
30
30
|
const options = parseBinding(binding);
|
|
31
31
|
if (!options.enabled) return;
|
|
32
32
|
const handleFocus = () => {
|
|
@@ -35,15 +35,14 @@ const vKeyboard = {
|
|
|
35
35
|
};
|
|
36
36
|
el.addEventListener("focus", handleFocus);
|
|
37
37
|
el.setAttribute("inputmode", "none");
|
|
38
|
-
el
|
|
38
|
+
directiveStates.set(el, { cleanup: () => {
|
|
39
39
|
el.removeEventListener("focus", handleFocus);
|
|
40
40
|
el.removeAttribute("inputmode");
|
|
41
|
-
} };
|
|
41
|
+
} });
|
|
42
42
|
},
|
|
43
43
|
unmounted(el) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
delete el[KEYBOARD_ATTR];
|
|
44
|
+
directiveStates.get(el)?.cleanup();
|
|
45
|
+
directiveStates.delete(el);
|
|
47
46
|
}
|
|
48
47
|
};
|
|
49
48
|
function parseBinding(binding) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v-keyboard.js","names":[],"sources":["../../src/directives/v-keyboard.ts"],"sourcesContent":["/**\n * v-keyboard 指令\n * 自动在输入框聚焦时打开虚拟键盘\n * @module directives/v-keyboard\n */\n\nimport type { Directive, DirectiveBinding } from 'vue'\n\n/**\n * 指令绑定值\n */\nexport interface VKeyboardBinding {\n /** 键盘类型 */\n type?: string\n /** 是否启用 */\n enabled?: boolean\n /** 打开键盘回调 */\n onOpen?: (el: HTMLInputElement | HTMLTextAreaElement) => void\n /** 关闭键盘回调 */\n onClose?: () => void\n}\n\nconst
|
|
1
|
+
{"version":3,"file":"v-keyboard.js","names":[],"sources":["../../src/directives/v-keyboard.ts"],"sourcesContent":["/**\r\n * v-keyboard 指令\r\n * 自动在输入框聚焦时打开虚拟键盘\r\n * @module directives/v-keyboard\r\n */\r\n\r\nimport type { Directive, DirectiveBinding } from 'vue'\r\n\r\n/**\r\n * 指令绑定值\r\n */\r\nexport interface VKeyboardBinding {\r\n /** 键盘类型 */\r\n type?: string\r\n /** 是否启用 */\r\n enabled?: boolean\r\n /** 打开键盘回调 */\r\n onOpen?: (el: HTMLInputElement | HTMLTextAreaElement) => void\r\n /** 关闭键盘回调 */\r\n onClose?: () => void\r\n}\r\n\r\ninterface KeyboardDirectiveState {\r\n cleanup: () => void\r\n}\r\n\r\nconst directiveStates = new WeakMap<HTMLElement, KeyboardDirectiveState>()\r\n\r\n/**\r\n * v-keyboard 指令\r\n *\r\n * @example\r\n * ```html\r\n * <!-- 基础用法 -->\r\n * <input v-keyboard />\r\n *\r\n * <!-- 指定键盘类型 -->\r\n * <input v-keyboard=\"{ type: 'number' }\" />\r\n *\r\n * <!-- 配合回调 -->\r\n * <input v-keyboard=\"{ type: 'phone', onOpen: handleOpen }\" />\r\n * ```\r\n */\r\nexport const vKeyboard: Directive<\r\n HTMLInputElement | HTMLTextAreaElement,\r\n VKeyboardBinding | string | boolean\r\n> = {\r\n mounted(el, binding) {\r\n const options = parseBinding(binding)\r\n if (!options.enabled) return\r\n\r\n const handleFocus = () => {\r\n // 阻止原生键盘\r\n el.blur()\r\n options.onOpen?.(el)\r\n }\r\n\r\n el.addEventListener('focus', handleFocus)\r\n el.setAttribute('inputmode', 'none')\r\n\r\n // 存储清理函数\r\n directiveStates.set(el, {\r\n cleanup: () => {\r\n el.removeEventListener('focus', handleFocus)\r\n el.removeAttribute('inputmode')\r\n },\r\n })\r\n },\r\n\r\n updated(el, binding) {\r\n directiveStates.get(el)?.cleanup()\r\n directiveStates.delete(el)\r\n\r\n const options = parseBinding(binding)\r\n if (!options.enabled) return\r\n\r\n const handleFocus = () => {\r\n el.blur()\r\n options.onOpen?.(el)\r\n }\r\n\r\n el.addEventListener('focus', handleFocus)\r\n el.setAttribute('inputmode', 'none')\r\n\r\n directiveStates.set(el, {\r\n cleanup: () => {\r\n el.removeEventListener('focus', handleFocus)\r\n el.removeAttribute('inputmode')\r\n },\r\n })\r\n },\r\n\r\n unmounted(el) {\r\n directiveStates.get(el)?.cleanup()\r\n directiveStates.delete(el)\r\n },\r\n}\r\n\r\n/**\r\n * 解析指令绑定值\r\n */\r\nfunction parseBinding(\r\n binding: DirectiveBinding<VKeyboardBinding | string | boolean>\r\n): VKeyboardBinding & { enabled: boolean } {\r\n const value = binding.value\r\n\r\n if (value === false) {\r\n return { enabled: false }\r\n }\r\n\r\n if (value === true || value === undefined) {\r\n return { enabled: true }\r\n }\r\n\r\n if (typeof value === 'string') {\r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M,MAAM;CAAM;CAGtC,OAAO;EACL,SAAS,MAAM,YAAY;EAC3B,GAAG;CACL;AACF"}
|
package/es/index.d.ts
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
import type { Plugin } from 'vue';
|
|
7
7
|
export * from './components';
|
|
8
8
|
export * from './composables';
|
|
9
|
-
export * from './plugins';
|
|
10
9
|
export * from './directives';
|
|
11
|
-
export
|
|
12
|
-
export
|
|
10
|
+
export * from './plugins';
|
|
11
|
+
export { amountLayout, amountSimpleLayout, applyFormatter, applyTheme, bankcardLayout, createKeyboardManager, createKeyboardRenderer, createPositionManager, createRandomLetterLayout, createRandomMixedLayout, createRandomNumberLayout, createRandomPinLayout, createTheme, darkTheme, defaultTheme, deleteCharBeforeCursor, EMAIL_SUFFIXES, emailLayout, EventEmitter, formatAmount, formatBankCard, formatIdCard, formatLicensePlate, formatPhone, formatVerifyCode, generateThemeStyle, getAllThemes, getAvailableLayouts, getAvailableThemes, getBoundingRect, getCurrentTheme, getDeviceType, getFormatter, getLayout, getRandomAlphanumeric, getRandomLetters, getRandomNumbers, getTheme, getViewportInfo, hasLayout, idcardLayout, insertTextAtCursor, integerLayout, iosTheme, isMobile, isTouchDevice, KeyboardManager, KeyboardRenderer, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, materialTheme, mergeTheme, minimalTheme, miuiTheme, numberLayout, onClickOutside, onViewportChange, phoneLayout, phoneSimpleLayout, PLATE_LETTERS, PositionManager, presetThemes, PROVINCES, punctLayout, qwertyLayout, refreshRandomLayout, registerFormatter, registerLayout, registerLayouts, registerTheme, searchLayout, setCurrentTheme, shuffleArray, symbolLayout, symbolLayout2, themeToCSS, unregisterLayout, urlLayout, verifycodeLayout, vibrate, } from '@composy/keyboard-core';
|
|
12
|
+
export type { BoundingRect, DeviceType, FormatterFunction, KeyboardConfig, KeyboardEventMap, KeyboardOptions, KeyboardRendererOptions, KeyboardRow, KeyboardState, KeyboardType, KeyDefinition, KeyType, PopupPlacement, PopupPositionConfig, PopupPositionResult, Position, Size, ThemeColors, ThemeConfig, ThemeCSSVariables, ThemeEffects, ThemeName, ThemeSizes, ViewportInfo, } from '@composy/keyboard-core';
|
|
13
13
|
/**
|
|
14
14
|
* 键盘插件配置
|
|
15
15
|
*/
|
|
@@ -39,4 +39,3 @@ export declare const KeyboardVuePlugin: Plugin;
|
|
|
39
39
|
*/
|
|
40
40
|
export declare const KeyboardPlugin: import("vue").ObjectPlugin<any[]>;
|
|
41
41
|
export default KeyboardVuePlugin;
|
|
42
|
-
//# sourceMappingURL=index.d.ts.map
|
package/es/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,KAAK,CAAA;AAStC,cAAc,cAAc,CAAA;AAG5B,cAAc,eAAe,CAAA;AAG7B,cAAc,cAAc,CAAA;AAG5B,cAAc,WAAW,CAAA;AAGzB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,cAAc,EAEd,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,WAAW,EAEX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,kBAAkB,EAElB,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,aAAa,EACb,Y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 -2,22 +2,19 @@
|
|
|
2
2
|
* ***********************************
|
|
3
3
|
* @composy/keyboard-vue v0.0.1 *
|
|
4
4
|
* Built with rollup *
|
|
5
|
-
* Build time: 2024-
|
|
5
|
+
* Build time: 2024-10-12 17:44:15 *
|
|
6
6
|
* Build mode: production *
|
|
7
7
|
* Minified: No *
|
|
8
8
|
* ***********************************
|
|
9
9
|
*/
|
|
10
10
|
import KeyboardKey_default from "./components/KeyboardKey.js";
|
|
11
|
-
import VirtualKeyboard_default from "./components/VirtualKeyboard.js";
|
|
12
11
|
import { useKeyboard } from "./composables/useKeyboard.js";
|
|
13
12
|
import { useKeyboardPopup } from "./composables/useKeyboardPopup.js";
|
|
13
|
+
import VirtualKeyboard_default from "./components/VirtualKeyboard.js";
|
|
14
14
|
import KeyboardPopup_default from "./components/KeyboardPopup.js";
|
|
15
15
|
import LicensePlateKeyboard_default from "./components/LicensePlateKeyboard.js";
|
|
16
|
-
import "./components/index.js";
|
|
17
16
|
import { vKeyboard } from "./directives/v-keyboard.js";
|
|
18
|
-
import "./composables/index.js";
|
|
19
17
|
import { KeyboardEnginePlugin } from "./plugins/engine-plugin.js";
|
|
20
|
-
import "./plugins/index.js";
|
|
21
18
|
import { EMAIL_SUFFIXES, EventEmitter, KeyboardManager, KeyboardRenderer, PLATE_LETTERS, PROVINCES, PositionManager, amountLayout, amountSimpleLayout, applyFormatter, applyTheme, bankcardLayout, createKeyboardManager, createKeyboardRenderer, createPositionManager, createRandomLetterLayout, createRandomMixedLayout, createRandomNumberLayout, createRandomPinLayout, createTheme, darkTheme, defaultTheme, deleteCharBeforeCursor, emailLayout, formatAmount, formatBankCard, formatIdCard, formatLicensePlate, formatPhone, formatVerifyCode, generateThemeStyle, getAllThemes, getAvailableLayouts, getAvailableThemes, getBoundingRect, getCurrentTheme, getDeviceType, getFormatter, getLayout, getRandomAlphanumeric, getRandomLetters, getRandomNumbers, getTheme, getViewportInfo, hasLayout, idcardLayout, insertTextAtCursor, integerLayout, iosTheme, isMobile, isTouchDevice, licensePlateAlphanumericLayout, licensePlateLayout, licensePlateLetterLayout, licensePlateProvinceLayout, materialTheme, mergeTheme, minimalTheme, miuiTheme, numberLayout, onClickOutside, onViewportChange, phoneLayout, phoneSimpleLayout, presetThemes, punctLayout, qwertyLayout, refreshRandomLayout, registerFormatter, registerLayout, registerLayouts, registerTheme, searchLayout, setCurrentTheme, shuffleArray, symbolLayout, symbolLayout2, themeToCSS, unregisterLayout, urlLayout, verifycodeLayout, vibrate } from "@composy/keyboard-core";
|
|
22
19
|
//#region src/index.ts
|
|
23
20
|
const KeyboardVuePlugin = { install(app, options = {}) {
|