@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.
Files changed (172) hide show
  1. package/README.md +48 -24
  2. package/dist/index.css +552 -560
  3. package/dist/index.js +228 -192
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.css +1 -1
  6. package/dist/index.min.js +954 -1
  7. package/dist/index.min.js.map +1 -0
  8. package/es/.dts-output-manifest.json +1 -0
  9. package/es/.dts.tsbuildinfo +1 -0
  10. package/es/components/KeyboardKey.js +1 -1
  11. package/es/components/KeyboardKey.js.map +1 -1
  12. package/es/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js +16 -7
  13. package/es/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js.map +1 -1
  14. package/es/components/KeyboardPopup.js +1 -1
  15. package/es/components/KeyboardPopup.js.map +1 -1
  16. package/es/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js +8 -5
  17. package/es/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  18. package/es/components/LicensePlateKeyboard.js +1 -1
  19. package/es/components/LicensePlateKeyboard.js.map +1 -1
  20. package/es/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js +2 -2
  21. package/es/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  22. package/es/components/VirtualKeyboard.js +1 -1
  23. package/es/components/VirtualKeyboard.js.map +1 -1
  24. package/es/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js +4 -4
  25. package/es/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  26. package/es/components/index.d.ts +1 -2
  27. package/es/components/index.d.ts.map +1 -1
  28. package/es/components/index.js +1 -1
  29. package/es/composables/index.d.ts +0 -1
  30. package/es/composables/index.js +1 -1
  31. package/es/composables/useKeyboard.d.ts +1 -2
  32. package/es/composables/useKeyboard.d.ts.map +1 -1
  33. package/es/composables/useKeyboard.js +8 -15
  34. package/es/composables/useKeyboard.js.map +1 -1
  35. package/es/composables/useKeyboardPopup.d.ts +2 -51
  36. package/es/composables/useKeyboardPopup.d.ts.map +1 -1
  37. package/es/composables/useKeyboardPopup.js +66 -49
  38. package/es/composables/useKeyboardPopup.js.map +1 -1
  39. package/es/directives/index.d.ts +0 -1
  40. package/es/directives/index.js +1 -1
  41. package/es/directives/v-keyboard.d.ts +0 -1
  42. package/es/directives/v-keyboard.d.ts.map +1 -1
  43. package/es/directives/v-keyboard.js +10 -11
  44. package/es/directives/v-keyboard.js.map +1 -1
  45. package/es/index.d.ts +3 -4
  46. package/es/index.d.ts.map +1 -1
  47. package/es/index.js +2 -5
  48. package/es/index.js.map +1 -1
  49. package/es/plugins/engine-plugin.d.ts +0 -1
  50. package/es/plugins/engine-plugin.d.ts.map +1 -1
  51. package/es/plugins/engine-plugin.js +19 -4
  52. package/es/plugins/engine-plugin.js.map +1 -1
  53. package/es/plugins/index.d.ts +0 -1
  54. package/es/plugins/index.js +1 -1
  55. package/es/style/css.js +1 -1
  56. package/es/style/index.css +2 -0
  57. package/es/style/index.js +1 -1
  58. package/es/styles/index.css +391 -0
  59. package/es/styles/keyboard.css +252 -0
  60. package/es/styles/themes.css +137 -0
  61. package/esm/components/KeyboardKey.js +17 -0
  62. package/esm/components/KeyboardKey.js.map +1 -0
  63. package/esm/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js +140 -0
  64. package/esm/components/KeyboardKey.vue_vue_type_script_setup_true_lang.js.map +1 -0
  65. package/esm/components/KeyboardPopup.js +17 -0
  66. package/esm/components/KeyboardPopup.js.map +1 -0
  67. package/esm/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js +167 -0
  68. package/esm/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.js.map +1 -0
  69. package/esm/components/LicensePlateKeyboard.js +17 -0
  70. package/esm/components/LicensePlateKeyboard.js.map +1 -0
  71. package/esm/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js +97 -0
  72. package/esm/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
  73. package/esm/components/VirtualKeyboard.js +17 -0
  74. package/esm/components/VirtualKeyboard.js.map +1 -0
  75. package/esm/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js +127 -0
  76. package/esm/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
  77. package/{lib → esm}/components/index.d.ts +1 -1
  78. package/esm/components/index.d.ts.map +1 -0
  79. package/esm/components/index.js +15 -0
  80. package/esm/composables/index.d.ts.map +1 -0
  81. package/esm/composables/index.js +13 -0
  82. package/{lib → esm}/composables/useKeyboard.d.ts +1 -1
  83. package/esm/composables/useKeyboard.d.ts.map +1 -0
  84. package/esm/composables/useKeyboard.js +68 -0
  85. package/esm/composables/useKeyboard.js.map +1 -0
  86. package/esm/composables/useKeyboardPopup.d.ts +25 -0
  87. package/esm/composables/useKeyboardPopup.d.ts.map +1 -0
  88. package/esm/composables/useKeyboardPopup.js +136 -0
  89. package/esm/composables/useKeyboardPopup.js.map +1 -0
  90. package/esm/directives/index.d.ts.map +1 -0
  91. package/esm/directives/index.js +12 -0
  92. package/esm/directives/v-keyboard.d.ts.map +1 -0
  93. package/esm/directives/v-keyboard.js +64 -0
  94. package/esm/directives/v-keyboard.js.map +1 -0
  95. package/esm/index.d.ts +42 -0
  96. package/esm/index.d.ts.map +1 -0
  97. package/esm/index.js +34 -0
  98. package/esm/index.js.map +1 -0
  99. package/esm/plugins/engine-plugin.d.ts.map +1 -0
  100. package/esm/plugins/engine-plugin.js +53 -0
  101. package/esm/plugins/engine-plugin.js.map +1 -0
  102. package/esm/plugins/index.d.ts.map +1 -0
  103. package/esm/plugins/index.js +12 -0
  104. package/esm/style/css.js +1 -0
  105. package/esm/style/index.js +1 -0
  106. package/{es → esm}/style/index.less +1 -1
  107. package/esm/styles/index.less +5 -0
  108. package/esm/styles/keyboard.less +286 -0
  109. package/esm/styles/themes.less +164 -0
  110. package/lib/components/KeyboardKey.cjs +1 -1
  111. package/lib/components/KeyboardKey.cjs.map +1 -1
  112. package/lib/components/KeyboardKey.vue_vue_type_script_setup_true_lang.cjs +16 -7
  113. package/lib/components/KeyboardKey.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  114. package/lib/components/KeyboardPopup.cjs +1 -1
  115. package/lib/components/KeyboardPopup.cjs.map +1 -1
  116. package/lib/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.cjs +8 -5
  117. package/lib/components/KeyboardPopup.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  118. package/lib/components/LicensePlateKeyboard.cjs +1 -1
  119. package/lib/components/LicensePlateKeyboard.cjs.map +1 -1
  120. package/lib/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.cjs +2 -2
  121. package/lib/components/LicensePlateKeyboard.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  122. package/lib/components/VirtualKeyboard.cjs +1 -1
  123. package/lib/components/VirtualKeyboard.cjs.map +1 -1
  124. package/lib/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.cjs +4 -4
  125. package/lib/components/VirtualKeyboard.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  126. package/lib/components/index.cjs +1 -1
  127. package/lib/components/index.d.cts +8 -0
  128. package/lib/components/index.d.cts.map +1 -0
  129. package/lib/composables/index.cjs +1 -1
  130. package/lib/composables/index.d.cts +6 -0
  131. package/lib/composables/index.d.cts.map +1 -0
  132. package/lib/composables/useKeyboard.cjs +8 -15
  133. package/lib/composables/useKeyboard.cjs.map +1 -1
  134. package/lib/composables/useKeyboard.d.cts +112 -0
  135. package/lib/composables/useKeyboard.d.cts.map +1 -0
  136. package/lib/composables/useKeyboardPopup.cjs +66 -49
  137. package/lib/composables/useKeyboardPopup.cjs.map +1 -1
  138. package/lib/composables/useKeyboardPopup.d.cts +24 -0
  139. package/lib/composables/useKeyboardPopup.d.cts.map +1 -0
  140. package/lib/directives/index.cjs +1 -1
  141. package/lib/directives/index.d.cts +5 -0
  142. package/lib/directives/index.d.cts.map +1 -0
  143. package/lib/directives/v-keyboard.cjs +10 -11
  144. package/lib/directives/v-keyboard.cjs.map +1 -1
  145. package/lib/directives/v-keyboard.d.cts +35 -0
  146. package/lib/directives/v-keyboard.d.cts.map +1 -0
  147. package/lib/index.cjs +2 -2
  148. package/lib/index.cjs.map +1 -1
  149. package/lib/index.d.cts +41 -0
  150. package/lib/index.d.cts.map +1 -0
  151. package/lib/plugins/engine-plugin.cjs +19 -3
  152. package/lib/plugins/engine-plugin.cjs.map +1 -1
  153. package/lib/plugins/engine-plugin.d.cts +36 -0
  154. package/lib/plugins/engine-plugin.d.cts.map +1 -0
  155. package/lib/plugins/index.cjs +1 -1
  156. package/lib/plugins/index.d.cts +5 -0
  157. package/lib/plugins/index.d.cts.map +1 -0
  158. package/lib/style/index.css +1 -1
  159. package/lib/styles/index.css +357 -195
  160. package/lib/styles/keyboard.css +92 -186
  161. package/lib/styles/themes.css +102 -178
  162. package/package.json +43 -34
  163. package/es/styles/index.less +0 -267
  164. package/es/styles/keyboard.less +0 -399
  165. package/es/styles/themes.less +0 -233
  166. package/lib/composables/useKeyboardPopup.d.ts +0 -73
  167. package/lib/index.d.ts +0 -42
  168. /package/{lib → esm}/composables/index.d.ts +0 -0
  169. /package/{lib → esm}/directives/index.d.ts +0 -0
  170. /package/{lib → esm}/directives/v-keyboard.d.ts +0 -0
  171. /package/{lib → esm}/plugins/engine-plugin.d.ts +0 -0
  172. /package/{lib → esm}/plugins/index.d.ts +0 -0
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @composy/keyboard-vue
3
+ * LDesign 虚拟键盘 - Vue 3 适配器
4
+ * @packageDocumentation
5
+ */
6
+ import type { Plugin } from 'vue';
7
+ export * from './components';
8
+ export * from './composables';
9
+ export * from './directives';
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
+ /**
14
+ * 键盘插件配置
15
+ */
16
+ export interface KeyboardPluginOptions {
17
+ /**
18
+ * 组件前缀
19
+ * @default 'L'
20
+ */
21
+ prefix?: string;
22
+ }
23
+ /**
24
+ * 原生 Vue 项目键盘插件
25
+ * 用于全局注册键盘组件和指令
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * import { createApp } from 'vue'
30
+ * import { KeyboardVuePlugin } from '@composy/keyboard-vue'
31
+ *
32
+ * const app = createApp(App)
33
+ * app.use(KeyboardVuePlugin, { prefix: 'L' })
34
+ * ```
35
+ */
36
+ export declare const KeyboardVuePlugin: Plugin;
37
+ /**
38
+ * @deprecated 使用 KeyboardVuePlugin 代替
39
+ */
40
+ export declare const KeyboardPlugin: import("vue").ObjectPlugin<any[]>;
41
+ export default KeyboardVuePlugin;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","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,YAAY,EAEZ,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAEhB,QAAQ,EACR,eAAe,EACf,SAAS,EAET,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,8BAA8B,EAC9B,kBAAkB,EAClB,wBAAwB,EACxB,0BAA0B,EAC1B,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,YAAY,EACZ,SAAS,EACT,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EAEf,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,OAAO,GACR,MAAM,wBAAwB,CAAA;AAG/B,YAAY,EACV,YAAY,EACZ,UAAU,EAEV,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,eAAe,EAEf,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,aAAa,EACb,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,YAAY,EAEZ,SAAS,EACT,UAAU,EACV,YAAY,GACb,MAAM,wBAAwB,CAAA;AAE/B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAY/B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,mCAAoB,CAAA;AAG/C,eAAe,iBAAiB,CAAA"}
@@ -2,7 +2,7 @@
2
2
  * ***********************************
3
3
  * @composy/keyboard-vue v0.0.1 *
4
4
  * Built with rollup *
5
- * Build time: 2024-08-17 11:42:14 *
5
+ * Build time: 2024-10-12 17:44:16 *
6
6
  * Build mode: production *
7
7
  * Minified: No *
8
8
  * ***********************************
@@ -13,19 +13,35 @@ const require_KeyboardPopup = require("../components/KeyboardPopup.cjs");
13
13
  const require_LicensePlateKeyboard = require("../components/LicensePlateKeyboard.cjs");
14
14
  const require_v_keyboard = require("../directives/v-keyboard.cjs");
15
15
  //#region src/plugins/engine-plugin.ts
16
+ function isRecord(value) {
17
+ return typeof value === "object" && value !== null;
18
+ }
19
+ function isVueApp(value) {
20
+ return isRecord(value) && typeof value.component === "function" && typeof value.directive === "function";
21
+ }
22
+ function getEngineContext(value) {
23
+ if (!isRecord(value)) return {};
24
+ const framework = isRecord(value.framework) ? value.framework : void 0;
25
+ const container = isRecord(value.container) ? value.container : void 0;
26
+ return {
27
+ framework: isVueApp(framework?.app) ? { app: framework.app } : void 0,
28
+ container: typeof container?.singleton === "function" ? { singleton: container.singleton } : void 0
29
+ };
30
+ }
16
31
  const KeyboardEnginePlugin = {
17
32
  name: "keyboard",
18
33
  version: "0.1.0",
19
34
  async install(context, options) {
20
35
  const prefix = options?.prefix ?? "L";
21
- const app = context?.framework?.app;
36
+ const engineContext = getEngineContext(context);
37
+ const app = engineContext.framework?.app;
22
38
  if (app) {
23
39
  app.component(`${prefix}Keyboard`, require_VirtualKeyboard.default);
24
40
  app.component(`${prefix}KeyboardPopup`, require_KeyboardPopup.default);
25
41
  app.component(`${prefix}LicensePlateKeyboard`, require_LicensePlateKeyboard.default);
26
42
  app.directive("keyboard", require_v_keyboard.vKeyboard);
27
43
  }
28
- if (context?.container?.singleton) context.container.singleton("keyboard", {
44
+ if (engineContext.container?.singleton) engineContext.container.singleton("keyboard", {
29
45
  name: "keyboard",
30
46
  version: "0.1.0"
31
47
  });
@@ -1 +1 @@
1
- {"version":3,"file":"engine-plugin.cjs","names":[],"sources":["../../src/plugins/engine-plugin.ts"],"sourcesContent":["/**\n * 键盘 Engine 插件\n * 适配 @composy/engine-vue 的插件\n * @module plugins/engine-plugin\n */\n\nimport type { App } from 'vue'\nimport { VirtualKeyboard, KeyboardPopup, LicensePlateKeyboard } from '../components'\nimport { vKeyboard } from '../directives/v-keyboard'\n\n/**\n * Engine 插件接口(兼容 @composy/engine-core Plugin)\n */\nexport interface KeyboardEnginePluginOptions {\n /**\n * 组件前缀\n * @default 'L'\n */\n prefix?: string\n}\n\n/**\n * 键盘 Engine 插件\n *\n * 符合 @composy/engine-core Plugin 接口规范\n * 通过 engine.use(KeyboardEnginePlugin) 安装\n *\n * @example\n * ```typescript\n * import { createVueEngine } from '@composy/engine-vue'\n * import { KeyboardEnginePlugin } from '@composy/keyboard-vue'\n *\n * const engine = createVueEngine({\n * plugins: [KeyboardEnginePlugin],\n * })\n * ```\n */\nexport const KeyboardEnginePlugin = {\n name: 'keyboard',\n version: '0.1.0',\n\n async install(context: unknown, options?: KeyboardEnginePluginOptions) {\n const prefix = options?.prefix ?? 'L'\n\n // 获取 Vue 应用实例(从 engine 上下文)\n const app: App | undefined = context?.framework?.app\n\n if (app) {\n // 注册全局组件\n app.component(`${prefix}Keyboard`, VirtualKeyboard)\n app.component(`${prefix}KeyboardPopup`, KeyboardPopup)\n app.component(`${prefix}LicensePlateKeyboard`, LicensePlateKeyboard)\n\n // 注册指令\n app.directive('keyboard', vKeyboard)\n }\n\n // 注册到服务容器(如果有)\n if (context?.container?.singleton) {\n context.container.singleton('keyboard', {\n name: 'keyboard',\n version: '0.1.0',\n })\n }\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqCO,MAAM,uBAAuB;CAClC,MAAM;CACN,SAAS;CAET,MAAM,QAAQ,SAAkB,SAAuC;EACrE,MAAM,SAAS,SAAS,UAAU;EAGlC,MAAM,MAAuB,SAAS,WAAW;EAEjD,IAAI,KAAK;GAEP,IAAI,UAAU,GAAG,OAAM,WAAY,wBAAA,OAAe;GAClD,IAAI,UAAU,GAAG,OAAM,gBAAiB,sBAAA,OAAa;GACrD,IAAI,UAAU,GAAG,OAAM,uBAAwB,6BAAA,OAAoB;GAGnE,IAAI,UAAU,YAAY,mBAAA,SAAS;EACrC;EAGA,IAAI,SAAS,WAAW,WACtB,QAAQ,UAAU,UAAU,YAAY;GACtC,MAAM;GACN,SAAS;EACX,CAAC;CAEL;AACF"}
1
+ {"version":3,"file":"engine-plugin.cjs","names":[],"sources":["../../src/plugins/engine-plugin.ts"],"sourcesContent":["/**\r\n * 键盘 Engine 插件\r\n * 适配 @composy/engine-vue 的插件\r\n * @module plugins/engine-plugin\r\n */\r\n\r\nimport type { App } from 'vue'\r\nimport {\r\n KeyboardPopup,\r\n LicensePlateKeyboard,\r\n VirtualKeyboard,\r\n} from '../components'\r\nimport { vKeyboard } from '../directives/v-keyboard'\r\n\r\ninterface KeyboardEngineContext {\r\n framework?: {\r\n app?: App\r\n }\r\n container?: {\r\n singleton?: (name: string, value: { name: string; version: string }) => void\r\n }\r\n}\r\n\r\nfunction isRecord(value: unknown): value is Record<string, unknown> {\r\n return typeof value === 'object' && value !== null\r\n}\r\n\r\nfunction isVueApp(value: unknown): value is App {\r\n return (\r\n isRecord(value) &&\r\n typeof value.component === 'function' &&\r\n typeof value.directive === 'function'\r\n )\r\n}\r\n\r\nfunction getEngineContext(value: unknown): KeyboardEngineContext {\r\n if (!isRecord(value)) return {}\r\n\r\n const framework = isRecord(value.framework) ? value.framework : undefined\r\n const container = isRecord(value.container) ? value.container : undefined\r\n\r\n return {\r\n framework: isVueApp(framework?.app) ? { app: framework.app } : undefined,\r\n container:\r\n typeof container?.singleton === 'function'\r\n ? {\r\n singleton:\r\n container.singleton as KeyboardEngineContext['container']['singleton'],\r\n }\r\n : undefined,\r\n }\r\n}\r\n\r\n/**\r\n * Engine 插件接口(兼容 @composy/engine-core Plugin)\r\n */\r\nexport interface KeyboardEnginePluginOptions {\r\n /**\r\n * 组件前缀\r\n * @default 'L'\r\n */\r\n prefix?: string\r\n}\r\n\r\n/**\r\n * 键盘 Engine 插件\r\n *\r\n * 符合 @composy/engine-core Plugin 接口规范\r\n * 通过 engine.use(KeyboardEnginePlugin) 安装\r\n *\r\n * @example\r\n * ```typescript\r\n * import { createVueEngine } from '@composy/engine-vue'\r\n * import { KeyboardEnginePlugin } from '@composy/keyboard-vue'\r\n *\r\n * const engine = createVueEngine({\r\n * plugins: [KeyboardEnginePlugin],\r\n * })\r\n * ```\r\n */\r\nexport const KeyboardEnginePlugin = {\r\n name: 'keyboard',\r\n version: '0.1.0',\r\n\r\n async install(context: unknown, options?: KeyboardEnginePluginOptions) {\r\n const prefix = options?.prefix ?? 'L'\r\n const engineContext = getEngineContext(context)\r\n\r\n // 获取 Vue 应用实例(从 engine 上下文)\r\n const app = engineContext.framework?.app\r\n\r\n if (app) {\r\n // 注册全局组件\r\n app.component(`${prefix}Keyboard`, VirtualKeyboard)\r\n app.component(`${prefix}KeyboardPopup`, KeyboardPopup)\r\n app.component(`${prefix}LicensePlateKeyboard`, LicensePlateKeyboard)\r\n\r\n // 注册指令\r\n app.directive('keyboard', vKeyboard)\r\n }\r\n\r\n // 注册到服务容器(如果有)\r\n if (engineContext.container?.singleton) {\r\n engineContext.container.singleton('keyboard', {\r\n name: 'keyboard',\r\n version: '0.1.0',\r\n })\r\n }\r\n },\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD;AAEA,SAAS,SAAS,OAA8B;CAC9C,OACE,SAAS,KAAK,KACd,OAAO,MAAM,cAAc,cAC3B,OAAO,MAAM,cAAc;AAE/B;AAEA,SAAS,iBAAiB,OAAuC;CAC/D,IAAI,CAAC,SAAS,KAAK,GAAG,OAAO,CAAC;CAE9B,MAAM,YAAY,SAAS,MAAM,SAAS,IAAI,MAAM,YAAY,KAAA;CAChE,MAAM,YAAY,SAAS,MAAM,SAAS,IAAI,MAAM,YAAY,KAAA;CAEhE,OAAO;EACL,WAAW,SAAS,WAAW,GAAG,IAAI,EAAE,KAAK,UAAU,IAAI,IAAI,KAAA;EAC/D,WACE,OAAO,WAAW,cAAc,aAC5B,EACE,WACE,UAAU,UACd,IACA,KAAA;CACR;AACF;AA6BO,MAAM,uBAAuB;CAClC,MAAM;CACN,SAAS;CAET,MAAM,QAAQ,SAAkB,SAAuC;EACrE,MAAM,SAAS,SAAS,UAAU;EAClC,MAAM,gBAAgB,iBAAiB,OAAO;EAG9C,MAAM,MAAM,cAAc,WAAW;EAErC,IAAI,KAAK;GAEP,IAAI,UAAU,GAAG,OAAM,WAAY,wBAAA,OAAe;GAClD,IAAI,UAAU,GAAG,OAAM,gBAAiB,sBAAA,OAAa;GACrD,IAAI,UAAU,GAAG,OAAM,uBAAwB,6BAAA,OAAoB;GAGnE,IAAI,UAAU,YAAY,mBAAA,SAAS;EACrC;EAGA,IAAI,cAAc,WAAW,WAC3B,cAAc,UAAU,UAAU,YAAY;GAC5C,MAAM;GACN,SAAS;EACX,CAAC;CAEL;AACF"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * 键盘 Engine 插件
3
+ * 适配 @composy/engine-vue 的插件
4
+ * @module plugins/engine-plugin
5
+ */
6
+ /**
7
+ * Engine 插件接口(兼容 @composy/engine-core Plugin)
8
+ */
9
+ export interface KeyboardEnginePluginOptions {
10
+ /**
11
+ * 组件前缀
12
+ * @default 'L'
13
+ */
14
+ prefix?: string;
15
+ }
16
+ /**
17
+ * 键盘 Engine 插件
18
+ *
19
+ * 符合 @composy/engine-core Plugin 接口规范
20
+ * 通过 engine.use(KeyboardEnginePlugin) 安装
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * import { createVueEngine } from '@composy/engine-vue'
25
+ * import { KeyboardEnginePlugin } from '@composy/keyboard-vue'
26
+ *
27
+ * const engine = createVueEngine({
28
+ * plugins: [KeyboardEnginePlugin],
29
+ * })
30
+ * ```
31
+ */
32
+ export declare const KeyboardEnginePlugin: {
33
+ name: string;
34
+ version: string;
35
+ install(context: unknown, options?: KeyboardEnginePluginOptions): Promise<void>;
36
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine-plugin.d.cts","sourceRoot":"","sources":["../../src/plugins/engine-plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiDH;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB;;;qBAIR,OAAO,YAAY,2BAA2B;CAyBtE,CAAA"}
@@ -2,7 +2,7 @@
2
2
  * ***********************************
3
3
  * @composy/keyboard-vue v0.0.1 *
4
4
  * Built with rollup *
5
- * Build time: 2024-08-17 11:42:14 *
5
+ * Build time: 2024-10-12 17:44:16 *
6
6
  * Build mode: production *
7
7
  * Minified: No *
8
8
  * ***********************************
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 插件导出
3
+ * @module plugins
4
+ */
5
+ export * from './engine-plugin';
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,iBAAiB,CAAA"}
@@ -1,2 +1,2 @@
1
1
 
2
- /*# sourceMappingURL=src/style/index.less.map */
2
+ /*# sourceMappingURL=src\style\index.less.map */