zcw-shared 1.29.0 → 1.30.0

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 (180) hide show
  1. package/README.md +87 -55
  2. package/dist/functions/platform/tencent-cloud/deploy.tcb.d.ts +13 -0
  3. package/dist/functions/platform/tencent-cloud/deploy.tcb.js +46 -0
  4. package/dist/functions/platform/tencent-cloud/deploy.tcb.js.map +1 -0
  5. package/dist/functions/platform/tencent-cloud/getSecret.d.ts +4 -0
  6. package/dist/functions/platform/tencent-cloud/getSecret.js +19 -0
  7. package/dist/functions/platform/tencent-cloud/getSecret.js.map +1 -0
  8. package/dist/functions/platform/uniapp/app-plus/buildAndroidApp.d.ts +27 -0
  9. package/dist/functions/platform/uniapp/app-plus/buildAndroidApp.js +287 -0
  10. package/dist/functions/platform/uniapp/app-plus/buildAndroidApp.js.map +1 -0
  11. package/dist/functions/platform/uniapp/build.d.ts +21 -0
  12. package/dist/functions/platform/uniapp/build.js +83 -0
  13. package/dist/functions/platform/uniapp/build.js.map +1 -0
  14. package/dist/functions/platform/uniapp/detectAndroidProjectStructure.d.ts +11 -0
  15. package/dist/functions/platform/uniapp/detectAndroidProjectStructure.js +30 -0
  16. package/dist/functions/platform/uniapp/detectAndroidProjectStructure.js.map +1 -0
  17. package/dist/functions/platform/uniapp/detectProjectType.d.ts +20 -0
  18. package/dist/functions/platform/uniapp/detectProjectType.js +68 -0
  19. package/dist/functions/platform/uniapp/detectProjectType.js.map +1 -0
  20. package/dist/functions/platform/uniapp/parseManifest.d.ts +18 -0
  21. package/dist/functions/platform/uniapp/parseManifest.js +49 -0
  22. package/dist/functions/platform/uniapp/parseManifest.js.map +1 -0
  23. package/dist/functions/platform/uniapp/waitForPages.d.ts +7 -0
  24. package/dist/functions/platform/uniapp/waitForPages.js +20 -0
  25. package/dist/functions/platform/uniapp/waitForPages.js.map +1 -0
  26. package/dist/functions/string/visualizeRegexSteps.d.ts +39 -0
  27. package/dist/functions/string/visualizeRegexSteps.js +446 -0
  28. package/dist/functions/string/visualizeRegexSteps.js.map +1 -0
  29. package/dist/functions/utils/createI18n.d.ts +2 -0
  30. package/dist/functions/utils/createI18n.js +97 -0
  31. package/dist/functions/utils/createI18n.js.map +1 -0
  32. package/dist/functions/utils/formatString.d.ts +5 -0
  33. package/dist/functions/utils/formatString.js +9 -0
  34. package/dist/functions/utils/formatString.js.map +1 -0
  35. package/dist/functions/vue/dynamicMount.d.ts +6 -4
  36. package/dist/functions/vue/isVNode.d.ts +1 -1
  37. package/dist/functions/vue/isVueComponent.d.ts +1 -1
  38. package/dist/hooks/usePermission.d.ts +7 -0
  39. package/dist/hooks/usePermission.js +123 -0
  40. package/dist/hooks/usePermission.js.map +1 -0
  41. package/dist/vue-hooks/browser/useBattery.d.ts +1 -1
  42. package/dist/vue-hooks/browser/useBluetooth.d.ts +1 -1
  43. package/dist/vue-hooks/browser/useCamera.d.ts +1 -1
  44. package/dist/vue-hooks/browser/useClipboard.d.ts +1 -1
  45. package/dist/vue-hooks/browser/useFileUpload.d.ts +1 -1
  46. package/dist/vue-hooks/browser/useFullscreen.d.ts +1 -1
  47. package/dist/vue-hooks/browser/useGamepad.d.ts +1 -1
  48. package/dist/vue-hooks/browser/useGeolocation.d.ts +1 -1
  49. package/dist/vue-hooks/browser/useMediaSession.d.ts +1 -1
  50. package/dist/vue-hooks/browser/useMicrophone.d.ts +1 -1
  51. package/dist/vue-hooks/browser/useNetwork.d.ts +1 -1
  52. package/dist/vue-hooks/browser/useOrientation.d.ts +1 -1
  53. package/dist/vue-hooks/browser/usePageVisibility.d.ts +1 -1
  54. package/dist/vue-hooks/browser/useScreenOrientation.d.ts +1 -1
  55. package/dist/vue-hooks/browser/useScreenWakeLock.d.ts +1 -1
  56. package/dist/vue-hooks/browser/useShare.d.ts +1 -1
  57. package/dist/vue-hooks/browser/useVibration.d.ts +1 -1
  58. package/dist/vue-hooks/dom/useAutoUpdate.d.ts +1 -1
  59. package/dist/vue-hooks/dom/useClickOutside.d.ts +1 -1
  60. package/dist/vue-hooks/dom/useDraggable.d.ts +4 -4
  61. package/dist/vue-hooks/dom/useEventListener.d.ts +1 -1
  62. package/dist/vue-hooks/dom/useKeyboard.d.ts +29 -0
  63. package/dist/vue-hooks/dom/useKeyboard.js +129 -0
  64. package/dist/vue-hooks/dom/useKeyboard.js.map +1 -0
  65. package/dist/vue-hooks/dom/useResizable.d.ts +8 -3
  66. package/dist/vue-hooks/history/useDebouncedRefHistory.d.ts +1 -1
  67. package/dist/vue-hooks/history/useManualRefHistory.d.ts +1 -1
  68. package/dist/vue-hooks/history/useRefHistory.d.ts +1 -1
  69. package/dist/vue-hooks/state/injectLocal.d.ts +1 -1
  70. package/dist/vue-hooks/state/provideLocal.d.ts +1 -1
  71. package/dist/vue-hooks/state/useAsyncState.d.ts +1 -1
  72. package/dist/vue-hooks/state/useCounter.d.ts +1 -1
  73. package/dist/vue-hooks/state/useFileUpload.d.ts +23 -0
  74. package/dist/vue-hooks/state/useFileUpload.js +93 -0
  75. package/dist/vue-hooks/state/useFileUpload.js.map +1 -0
  76. package/dist/vue-hooks/state/useToggle.d.ts +1 -1
  77. package/dist/vue-hooks/time/useInterval.d.ts +1 -1
  78. package/dist/vue-hooks/time/useTimeout.d.ts +1 -1
  79. package/dist/vue-hooks/worker/useWebWorker.d.ts +4 -4
  80. package/dist/vue-hooks/worker/useWorkerFunction.d.ts +4 -4
  81. package/dist/vue-hooks/worker/useWorkerPool.d.ts +4 -4
  82. package/package.json +1 -1
  83. package/types/vue.d.ts +1 -1
  84. package/dist/functions/algorithm/lcsVisual.d.ts +0 -6
  85. package/dist/functions/algorithm/lcsVisual.js +0 -88
  86. package/dist/functions/algorithm/lcsVisual.js.map +0 -1
  87. package/dist/functions/algorithm/mergeSortVisual.d.ts +0 -5
  88. package/dist/functions/algorithm/mergeSortVisual.js +0 -103
  89. package/dist/functions/algorithm/mergeSortVisual.js.map +0 -1
  90. package/dist/functions/algorithm/nQueensVisual.d.ts +0 -14
  91. package/dist/functions/algorithm/nQueensVisual.js +0 -94
  92. package/dist/functions/algorithm/nQueensVisual.js.map +0 -1
  93. package/dist/functions/algorithm/numIslandsVisual.d.ts +0 -17
  94. package/dist/functions/algorithm/numIslandsVisual.js +0 -102
  95. package/dist/functions/algorithm/numIslandsVisual.js.map +0 -1
  96. package/dist/functions/algorithm/quickSortVisual.d.ts +0 -18
  97. package/dist/functions/algorithm/quickSortVisual.js +0 -104
  98. package/dist/functions/algorithm/quickSortVisual.js.map +0 -1
  99. package/dist/functions/browser/detectDevice.d.ts +0 -10
  100. package/dist/functions/browser/detectDevice.js +0 -49
  101. package/dist/functions/browser/detectDevice.js.map +0 -1
  102. package/dist/functions/cookie/getCookie.d.ts +0 -5
  103. package/dist/functions/cookie/getCookie.js +0 -14
  104. package/dist/functions/cookie/getCookie.js.map +0 -1
  105. package/dist/functions/cookie/removeCookie.d.ts +0 -8
  106. package/dist/functions/cookie/removeCookie.js +0 -12
  107. package/dist/functions/cookie/removeCookie.js.map +0 -1
  108. package/dist/functions/cookie/setCookie.d.ts +0 -11
  109. package/dist/functions/cookie/setCookie.js +0 -23
  110. package/dist/functions/cookie/setCookie.js.map +0 -1
  111. package/dist/functions/data-structures/EventEmitter.d.ts +0 -32
  112. package/dist/functions/data-structures/EventEmitter.js +0 -108
  113. package/dist/functions/data-structures/EventEmitter.js.map +0 -1
  114. package/dist/functions/data-structures/MyPromise.d.ts +0 -32
  115. package/dist/functions/data-structures/MyPromise.js +0 -254
  116. package/dist/functions/data-structures/MyPromise.js.map +0 -1
  117. package/dist/functions/reactive/useReactiveCookie.d.ts +0 -19
  118. package/dist/functions/reactive/useReactiveCookie.js +0 -84
  119. package/dist/functions/reactive/useReactiveCookie.js.map +0 -1
  120. package/dist/hooks/useClickOutside.d.ts +0 -12
  121. package/dist/hooks/useClickOutside.js +0 -16
  122. package/dist/hooks/useClickOutside.js.map +0 -1
  123. package/dist/hooks/useClipboard.d.ts +0 -20
  124. package/dist/hooks/useClipboard.js +0 -33
  125. package/dist/hooks/useClipboard.js.map +0 -1
  126. package/dist/hooks/useCounter.d.ts +0 -19
  127. package/dist/hooks/useCounter.js +0 -44
  128. package/dist/hooks/useCounter.js.map +0 -1
  129. package/dist/hooks/useEventListener.d.ts +0 -14
  130. package/dist/hooks/useEventListener.js +0 -18
  131. package/dist/hooks/useEventListener.js.map +0 -1
  132. package/dist/hooks/useInterval.d.ts +0 -19
  133. package/dist/hooks/useInterval.js +0 -33
  134. package/dist/hooks/useInterval.js.map +0 -1
  135. package/dist/hooks/useTimeout.d.ts +0 -20
  136. package/dist/hooks/useTimeout.js +0 -40
  137. package/dist/hooks/useTimeout.js.map +0 -1
  138. package/dist/hooks/useToggle.d.ts +0 -15
  139. package/dist/hooks/useToggle.js +0 -23
  140. package/dist/hooks/useToggle.js.map +0 -1
  141. package/dist/reactive/createGlobalState.d.ts +0 -2
  142. package/dist/reactive/createGlobalState.js +0 -11
  143. package/dist/reactive/createGlobalState.js.map +0 -1
  144. package/dist/reactive/createSharedComposable.d.ts +0 -2
  145. package/dist/reactive/createSharedComposable.js +0 -13
  146. package/dist/reactive/createSharedComposable.js.map +0 -1
  147. package/dist/reactive/errorManager.d.ts +0 -63
  148. package/dist/reactive/errorManager.js +0 -199
  149. package/dist/reactive/errorManager.js.map +0 -1
  150. package/dist/reactive/i18n.d.ts +0 -27
  151. package/dist/reactive/i18n.js +0 -119
  152. package/dist/reactive/i18n.js.map +0 -1
  153. package/dist/reactive/permission.d.ts +0 -40
  154. package/dist/reactive/permission.js +0 -189
  155. package/dist/reactive/permission.js.map +0 -1
  156. package/dist/reactive/pinia.d.ts +0 -52
  157. package/dist/reactive/pinia.js +0 -183
  158. package/dist/reactive/pinia.js.map +0 -1
  159. package/dist/reactive/useAltool.d.ts +0 -39
  160. package/dist/reactive/useAltool.js +0 -350
  161. package/dist/reactive/useAltool.js.map +0 -1
  162. package/dist/reactive/useCache.d.ts +0 -18
  163. package/dist/reactive/useCache.js +0 -82
  164. package/dist/reactive/useCache.js.map +0 -1
  165. package/dist/reactive/useLocalStorage.d.ts +0 -8
  166. package/dist/reactive/useLocalStorage.js +0 -101
  167. package/dist/reactive/useLocalStorage.js.map +0 -1
  168. package/dist/reactive/usePluginSystem.d.ts +0 -11
  169. package/dist/reactive/usePluginSystem.js +0 -34
  170. package/dist/reactive/usePluginSystem.js.map +0 -1
  171. package/dist/reactive/useSessionStorage.d.ts +0 -8
  172. package/dist/reactive/useSessionStorage.js +0 -101
  173. package/dist/reactive/useSessionStorage.js.map +0 -1
  174. package/dist/reactive/useStorage.d.ts +0 -13
  175. package/dist/reactive/useStorage.js +0 -62
  176. package/dist/reactive/useStorage.js.map +0 -1
  177. package/dist/reactive/useStorageWithIndexedDB.d.ts +0 -8
  178. package/dist/reactive/useStorageWithIndexedDB.js +0 -132
  179. package/dist/reactive/useStorageWithIndexedDB.js.map +0 -1
  180. package/references/vue.d.ts +0 -242
@@ -1,15 +1,17 @@
1
- import type { VueRuntime, VNode, Component, AppContext } from '../../../references/vue.d';
1
+ import type { VNode, createVNode, render, Component, AppContext } from 'vue';
2
2
  import type { HTMLElement, Document } from '../../../references/dom.d';
3
3
  export interface DynamicMountOptions {
4
4
  props: Record<string, any>;
5
5
  container: HTMLElement;
6
6
  appContext: AppContext;
7
- createVNode: VueRuntime['createVNode'];
8
- render: VueRuntime['render'];
7
+ createVNode: typeof createVNode;
8
+ render: typeof render;
9
9
  createElement: Document['createElement'];
10
10
  }
11
11
  export declare function dynamicMount(Comp: Component, options: DynamicMountOptions): {
12
- vnode: VNode;
12
+ vnode: VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }>;
13
15
  update: (newProps: typeof options.props) => void;
14
16
  destroy: () => void;
15
17
  el: HTMLElement;
@@ -1,2 +1,2 @@
1
- import type { VNode } from '../../../references/vue.d';
1
+ import type { VNode } from 'vue';
2
2
  export declare function isVNode(content: unknown): content is VNode;
@@ -1,2 +1,2 @@
1
- import type { Component } from '../../../references/vue.d';
1
+ import type { Component } from 'vue';
2
2
  export declare function isVueComponent(content: unknown): content is Component;
@@ -0,0 +1,7 @@
1
+ import type { PermissionConfig, UsePermissionReturn } from '../../types/permission';
2
+ import type { CreateReactive } from '../../types/reactive';
3
+ export interface UsePermissionDeps {
4
+ createReactive: CreateReactive;
5
+ }
6
+ export declare function usePermission(config: PermissionConfig, deps: UsePermissionDeps): UsePermissionReturn;
7
+ export default usePermission;
@@ -0,0 +1,123 @@
1
+ export function usePermission(config, deps) {
2
+ const computePermissions = (roles, customPermissions) => {
3
+ const permissionsSet = new Set();
4
+ roles.forEach(role => {
5
+ const rolePerms = config.rolePermissions[role];
6
+ if (rolePerms) {
7
+ rolePerms.forEach(perm => permissionsSet.add(perm));
8
+ }
9
+ else if (config.strict) {
10
+ throw new Error(`未定义的角色: ${role}`);
11
+ }
12
+ });
13
+ customPermissions.forEach(perm => permissionsSet.add(perm));
14
+ return Array.from(permissionsSet);
15
+ };
16
+ const initialState = {
17
+ roles: [],
18
+ permissions: [],
19
+ customPermissions: []
20
+ };
21
+ const reactiveState = deps.createReactive(initialState, {
22
+ subscribers: new Set(),
23
+ notify: () => { },
24
+ subscribe: () => () => { },
25
+ dispose: () => { },
26
+ createProxy: (target, deps) => new Proxy(target, {
27
+ get(target, property) {
28
+ if (property === 'subscribe' || property === 'notify' || property === 'dispose' || property === 'subscribers') {
29
+ return deps[property];
30
+ }
31
+ return target[property];
32
+ },
33
+ set(target, property, value) {
34
+ target[property] = value;
35
+ deps.notify();
36
+ return true;
37
+ }
38
+ }),
39
+ getChangePath: (target, property) => [String(property)]
40
+ });
41
+ const hasPermission = (permission, options) => {
42
+ const permissions = Array.isArray(permission) ? permission : [permission];
43
+ const mode = options?.mode || 'some';
44
+ if (mode === 'every') {
45
+ return permissions.every(p => reactiveState.permissions.includes(p));
46
+ }
47
+ else {
48
+ return permissions.some(p => reactiveState.permissions.includes(p));
49
+ }
50
+ };
51
+ const hasRole = (role, options) => {
52
+ const roles = Array.isArray(role) ? role : [role];
53
+ const mode = options?.mode || 'some';
54
+ if (mode === 'every') {
55
+ return roles.every(r => reactiveState.roles.includes(r));
56
+ }
57
+ else {
58
+ return roles.some(r => reactiveState.roles.includes(r));
59
+ }
60
+ };
61
+ const updatePermissions = () => {
62
+ reactiveState.permissions = computePermissions(reactiveState.roles, reactiveState.customPermissions);
63
+ };
64
+ const setRoles = (roles) => {
65
+ reactiveState.roles = [...roles];
66
+ updatePermissions();
67
+ };
68
+ const addRole = (role) => {
69
+ if (!reactiveState.roles.includes(role)) {
70
+ reactiveState.roles = [...reactiveState.roles, role];
71
+ updatePermissions();
72
+ }
73
+ };
74
+ const removeRole = (role) => {
75
+ const index = reactiveState.roles.indexOf(role);
76
+ if (index !== -1) {
77
+ reactiveState.roles = reactiveState.roles.filter(r => r !== role);
78
+ updatePermissions();
79
+ }
80
+ };
81
+ const addPermission = (permission) => {
82
+ if (!reactiveState.customPermissions.includes(permission)) {
83
+ reactiveState.customPermissions = [...reactiveState.customPermissions, permission];
84
+ updatePermissions();
85
+ }
86
+ };
87
+ const removePermission = (permission) => {
88
+ const index = reactiveState.customPermissions.indexOf(permission);
89
+ if (index !== -1) {
90
+ reactiveState.customPermissions = reactiveState.customPermissions.filter(p => p !== permission);
91
+ updatePermissions();
92
+ }
93
+ };
94
+ const clear = () => {
95
+ reactiveState.roles = [];
96
+ reactiveState.customPermissions = [];
97
+ reactiveState.permissions = [];
98
+ };
99
+ const subscribe = (listener) => {
100
+ const unsubscribe = reactiveState.subscribe(() => {
101
+ listener({
102
+ roles: [...reactiveState.roles],
103
+ permissions: [...reactiveState.permissions],
104
+ customPermissions: [...reactiveState.customPermissions]
105
+ });
106
+ });
107
+ return unsubscribe;
108
+ };
109
+ return {
110
+ state: reactiveState,
111
+ hasPermission,
112
+ hasRole,
113
+ setRoles,
114
+ addRole,
115
+ removeRole,
116
+ addPermission,
117
+ removePermission,
118
+ clear,
119
+ subscribe
120
+ };
121
+ }
122
+ export default usePermission;
123
+ //# sourceMappingURL=usePermission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePermission.js","sourceRoot":"","sources":["../../src/hooks/usePermission.ts"],"names":[],"mappings":"AAmEA,MAAM,UAAU,aAAa,CAC3B,MAAwB,EACxB,IAAuB;IAGvB,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,iBAA+B,EAAgB,EAAE;QAC1F,MAAM,cAAc,GAAG,IAAI,GAAG,EAAc,CAAA;QAG5C,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnB,MAAM,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAA;YAC9C,IAAI,SAAS,EAAE,CAAC;gBACd,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;YACrD,CAAC;iBAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;YACpC,CAAC;QACH,CAAC,CAAC,CAAA;QAGF,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;QAE3D,OAAO,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IACnC,CAAC,CAAA;IAGD,MAAM,YAAY,GAAoB;QACpC,KAAK,EAAE,EAAE;QACT,WAAW,EAAE,EAAE;QACf,iBAAiB,EAAE,EAAE;KACtB,CAAA;IAGD,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE;QACtD,WAAW,EAAE,IAAI,GAAG,EAAE;QACtB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;QAChB,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC;QACzB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,WAAW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C/C,QAAQ,CAAC;gBACP,KAAK,EAAE,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC;gBAC/B,WAAW,EAAE,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC;gBAC3C,iBAAiB,EAAE,CAAC,GAAG,aAAa,CAAC,iBAAiB,CAAC;aACxD,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,OAAO,WAAW,CAAA;IACpB,CAAC,CAAA;IAED,OAAO;QACL,KAAK,EAAE,aAAa;QACpB,aAAa;QACb,OAAO;QACP,QAAQ;QACR,OAAO;QACP,UAAU;QACV,aAAa;QACb,gBAAgB;QAChB,KAAK;QACL,SAAS;KACV,CAAA;AACH,CAAC;AAED,eAAe,aAAa,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { Navigator } from '../../../references/device.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface UseBatteryDeps {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { Bluetooth, BluetoothDevice } from '../../../references/device.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface UseBluetoothDeps {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { MediaDevices, MediaStream } from '../../../references/device.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface UseCameraDeps {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { Navigator } from '../../../references/browser.d';
3
3
  import type { setTimeout, clearTimeout } from '../../../references/timer.d';
4
4
  import type { VueCompositionAPI } from '../../../types/vue.d';
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { VueCompositionAPI } from '../../../types/vue.d';
3
3
  import type { Window, File } from '../../../references/browser.d';
4
4
  export interface FileUploadItem {
@@ -1,5 +1,5 @@
1
1
  import { Element } from 'references/dom';
2
- import type { Ref } from '../../../references/vue.d';
2
+ import type { Ref } from 'vue';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface UseFullscreenDeps {
5
5
  vue: Pick<Required<VueCompositionAPI>, 'ref' | 'onMounted' | 'onUnmounted'>;
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { Gamepad, GamepadButton } from '../../../references/device.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface UseGamepadDeps {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { Geolocation, GeolocationPosition } from '../../../references/device.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface UseGeolocationDeps {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { MediaSession, MediaMetadataInit } from '../../../references/device.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export type MediaSessionAction = 'play' | 'pause' | 'seekbackward' | 'seekforward' | 'previoustrack' | 'nexttrack' | 'stop' | 'seekto';
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { MediaDevices, MediaStream } from '../../../references/device.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface UseMicrophoneDeps {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { NetworkInformation } from '../../../references/device.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface UseNetworkDeps {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { VueCompositionAPI } from '../../../types/vue.d';
3
3
  export interface UseOrientationDeps {
4
4
  vue: Pick<Required<VueCompositionAPI>, 'ref' | 'onMounted' | 'onUnmounted'>;
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { VueCompositionAPI } from '../../../types/vue.d';
3
3
  export interface UsePageVisibilityDeps {
4
4
  vue: Pick<Required<VueCompositionAPI>, 'ref' | 'onMounted' | 'onUnmounted'>;
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { VueCompositionAPI } from '../../../types/vue.d';
3
3
  export type OrientationType = 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
4
4
  export type OrientationLockType = 'any' | 'natural' | 'landscape' | 'portrait' | 'portrait-primary' | 'portrait-secondary' | 'landscape-primary' | 'landscape-secondary';
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { WakeLockSentinel } from '../../../references/device.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface UseScreenWakeLockDeps {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { File } from '../../../references/browser.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface ShareData {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { NavigatorVibration } from '../../../references/device.d';
3
3
  import type { setTimeout } from '../../../references/timer.d';
4
4
  import type { VueCompositionAPI } from '../../../types/vue.d';
@@ -1,4 +1,4 @@
1
- import type { UnwrapRef } from '../../../references/vue.d';
1
+ import type { UnwrapRef } from 'vue';
2
2
  import type { VueCompositionAPI } from '../../../types/vue.d';
3
3
  import type { CreateThrottledEventListenerDeps } from '../../functions/dom/createThrottledEventListener';
4
4
  export interface StateData {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { Document, HTMLElement, Event } from '../../../references/dom.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface UseClickOutsideDeps {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { HTMLElement, Document, MouseEvent, TouchEvent } from '../../../references/dom.d';
3
3
  import type { Window } from '../../../references/browser.d';
4
4
  import type { VueCompositionAPI } from '../../../types/vue.d';
@@ -25,9 +25,9 @@ export interface UseDraggableOptions {
25
25
  };
26
26
  }
27
27
  export declare function useDraggable(targetRef: Ref<HTMLElement | null>, options: UseDraggableOptions | undefined, env: DraggableEnvironment): {
28
- position: Ref<Position>;
29
- isDragging: Ref<boolean>;
30
- style: Ref<Record<string, string>>;
28
+ position: Ref<Position, Position>;
29
+ isDragging: Ref<boolean, boolean>;
30
+ style: Ref<Record<string, string>, Record<string, string>>;
31
31
  cleanup: () => void;
32
32
  };
33
33
  export default useDraggable;
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { EventListener, AddEventListenerOptions, EventListenerOptions } from '../../../references/dom.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface EventTarget {
@@ -0,0 +1,29 @@
1
+ import type { Ref } from '../../../references/vue.d';
2
+ import type { KeyboardEvent } from '../../../references/dom.d';
3
+ import type { VueCompositionAPI } from '../../../types/vue.d';
4
+ import { Window } from 'references/browser';
5
+ export type KeyboardEventType = 'keydown' | 'keyup';
6
+ export type KeyboardCallback = (event: KeyboardEvent) => void;
7
+ export type Unsubscribe = () => void;
8
+ export interface UseKeyboardOptions {
9
+ onKeyDown?: (event: KeyboardEvent) => void;
10
+ exclusive?: boolean;
11
+ priority?: number;
12
+ eventType?: KeyboardEventType;
13
+ }
14
+ export interface UseKeyboardReturn {
15
+ pressedKey: Ref<string | null>;
16
+ isCtrlKey: Ref<boolean>;
17
+ isMetaKey: Ref<boolean>;
18
+ isAltKey: Ref<boolean>;
19
+ isShiftKey: Ref<boolean>;
20
+ unsubscribe: Unsubscribe;
21
+ }
22
+ export interface UseKeyboardDeps {
23
+ vue: Pick<Required<VueCompositionAPI>, 'ref' | 'onMounted' | 'onUnmounted'>;
24
+ window: {
25
+ addEventListener: Window['addEventListener'];
26
+ removeEventListener: Window['removeEventListener'];
27
+ };
28
+ }
29
+ export declare function useKeyboard(options: UseKeyboardOptions | undefined, deps: UseKeyboardDeps): UseKeyboardReturn;
@@ -0,0 +1,129 @@
1
+ class KeyboardManager {
2
+ listeners = new Map();
3
+ exclusiveListeners = new Map();
4
+ isListening = false;
5
+ boundHandler = null;
6
+ idCounter = 0;
7
+ sortedListenersCache = new Map();
8
+ sortedExclusiveCache = new Map();
9
+ windowDeps = null;
10
+ setWindowDeps(windowDeps) {
11
+ if (!this.windowDeps) {
12
+ this.windowDeps = windowDeps;
13
+ }
14
+ }
15
+ start() {
16
+ if (this.isListening || !this.windowDeps)
17
+ return;
18
+ if (!this.boundHandler) {
19
+ this.boundHandler = this.handleEvent.bind(this);
20
+ }
21
+ try {
22
+ this.windowDeps.addEventListener('keydown', this.boundHandler);
23
+ this.windowDeps.addEventListener('keyup', this.boundHandler);
24
+ this.isListening = true;
25
+ }
26
+ catch (e) {
27
+ }
28
+ }
29
+ stop() {
30
+ if (!this.isListening || !this.boundHandler || !this.windowDeps)
31
+ return;
32
+ try {
33
+ this.windowDeps.removeEventListener('keydown', this.boundHandler);
34
+ this.windowDeps.removeEventListener('keyup', this.boundHandler);
35
+ }
36
+ catch (e) {
37
+ }
38
+ this.isListening = false;
39
+ }
40
+ getSortedExclusiveListeners(eventType) {
41
+ if (!this.sortedExclusiveCache.has(eventType)) {
42
+ const sorted = Array.from(this.exclusiveListeners.values())
43
+ .filter(listener => listener.eventType === eventType)
44
+ .sort((a, b) => b.priority - a.priority);
45
+ this.sortedExclusiveCache.set(eventType, sorted);
46
+ }
47
+ return this.sortedExclusiveCache.get(eventType);
48
+ }
49
+ getSortedNormalListeners(eventType) {
50
+ if (!this.sortedListenersCache.has(eventType)) {
51
+ const sorted = Array.from(this.listeners.values())
52
+ .filter(listener => listener.eventType === eventType)
53
+ .sort((a, b) => b.priority - a.priority);
54
+ this.sortedListenersCache.set(eventType, sorted);
55
+ }
56
+ return this.sortedListenersCache.get(eventType);
57
+ }
58
+ clearCache() {
59
+ this.sortedListenersCache.clear();
60
+ this.sortedExclusiveCache.clear();
61
+ }
62
+ handleEvent(event) {
63
+ const eventType = event.type;
64
+ const exclusiveListeners = this.getSortedExclusiveListeners(eventType);
65
+ if (exclusiveListeners.length > 0) {
66
+ for (const listener of exclusiveListeners) {
67
+ listener.callback(event);
68
+ }
69
+ return;
70
+ }
71
+ const normalListeners = this.getSortedNormalListeners(eventType);
72
+ for (const listener of normalListeners) {
73
+ listener.callback(event);
74
+ }
75
+ }
76
+ register(callback, exclusive = false, priority = 0, eventType = 'keydown') {
77
+ const id = `listener_${++this.idCounter}`;
78
+ const listener = { id, callback, exclusive, priority, eventType };
79
+ if (exclusive) {
80
+ this.exclusiveListeners.set(id, listener);
81
+ this.sortedExclusiveCache.delete(eventType);
82
+ }
83
+ else {
84
+ this.listeners.set(id, listener);
85
+ this.sortedListenersCache.delete(eventType);
86
+ }
87
+ if (!this.isListening) {
88
+ this.start();
89
+ }
90
+ return id;
91
+ }
92
+ unregister(id) {
93
+ const listener = this.listeners.get(id) || this.exclusiveListeners.get(id);
94
+ const eventType = listener?.eventType;
95
+ this.listeners.delete(id);
96
+ this.exclusiveListeners.delete(id);
97
+ if (eventType) {
98
+ this.sortedListenersCache.delete(eventType);
99
+ this.sortedExclusiveCache.delete(eventType);
100
+ }
101
+ if (this.listeners.size === 0 && this.exclusiveListeners.size === 0) {
102
+ this.stop();
103
+ }
104
+ }
105
+ }
106
+ const keyboardManager = new KeyboardManager();
107
+ export function useKeyboard(options = {}, deps) {
108
+ const { onKeyDown, exclusive = false, priority = 0, eventType = 'keydown' } = options;
109
+ keyboardManager.setWindowDeps(deps.window);
110
+ const pressedKey = deps.vue.ref(null);
111
+ const isCtrlKey = deps.vue.ref(false);
112
+ const isMetaKey = deps.vue.ref(false);
113
+ const isAltKey = deps.vue.ref(false);
114
+ const isShiftKey = deps.vue.ref(false);
115
+ const listenerId = keyboardManager.register((event) => {
116
+ pressedKey.value = event.key;
117
+ isCtrlKey.value = event.ctrlKey;
118
+ isMetaKey.value = event.metaKey;
119
+ isAltKey.value = event.altKey;
120
+ isShiftKey.value = event.shiftKey;
121
+ onKeyDown?.(event);
122
+ }, exclusive, priority, eventType);
123
+ const unsubscribe = () => {
124
+ keyboardManager.unregister(listenerId);
125
+ };
126
+ deps.vue.onUnmounted(unsubscribe);
127
+ return { pressedKey, isCtrlKey, isMetaKey, isAltKey, isShiftKey, unsubscribe };
128
+ }
129
+ //# sourceMappingURL=useKeyboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeyboard.js","sourceRoot":"","sources":["../../../src/vue-hooks/dom/useKeyboard.ts"],"names":[],"mappings":"AAgFA,MAAM,eAAe;IACX,SAAS,GAAkC,IAAI,GAAG,EAAE,CAAA;IACpD,kBAAkB,GAAkC,IAAI,GAAG,EAAE,CAAA;IAC7D,WAAW,GAAG,KAAK,CAAA;IACnB,YAAY,GAA4C,IAAI,CAAA;IAC5D,SAAS,GAAG,CAAC,CAAA;IAEb,oBAAoB,GAA+C,IAAI,GAAG,EAAE,CAAA;IAC5E,oBAAoB,GAA+C,IAAI,GAAG,EAAE,CAAA;IAC5E,UAAU,GAAqC,IAAI,CAAA;IAK3D,aAAa,CAAC,UAAqC;QACjD,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC9B,CAAC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K,EAAE,EAAE;QAEpD,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAA;QAC5B,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAA;QAC/B,SAAS,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAA;QAC/B,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAA;QAC7B,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAA;QAGjC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;IAGlC,MAAM,WAAW,GAAgB,GAAG,EAAE;QACpC,eAAe,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;IACxC,CAAC,CAAA;IAGD,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;IAEjC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,CAAA;AAChF,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { HTMLElement, Document, MouseEvent, TouchEvent } from '../../../references/dom.d';
3
3
  import type { Window } from '../../../references/browser.d';
4
4
  import type { VueCompositionAPI } from '../../../types/vue.d';
@@ -36,14 +36,19 @@ export interface UseResizableOptions {
36
36
  };
37
37
  }
38
38
  export declare function useResizable(targetRef: Ref<HTMLElement | null>, options: UseResizableOptions | undefined, env: ResizableEnvironment): {
39
- size: Ref<Size>;
39
+ size: Ref<Size, Size>;
40
40
  style: Ref<{
41
41
  width: string;
42
42
  height: string;
43
43
  left?: string;
44
44
  top?: string;
45
+ }, {
46
+ width: string;
47
+ height: string;
48
+ left?: string;
49
+ top?: string;
45
50
  }>;
46
- isResizing: Ref<boolean>;
51
+ isResizing: Ref<boolean, boolean>;
47
52
  onResizeHandleMouseDown: (e: MouseEvent | TouchEvent, direction?: string) => void;
48
53
  reset: () => void;
49
54
  cleanupEventListeners: () => void;
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import { type UseManualRefHistoryReturn, type UseManualRefHistoryOptions } from './useManualRefHistory';
3
3
  import type { setTimeout, clearTimeout } from '../../../references/timer.d';
4
4
  import type { VueCompositionAPI } from '../../../types/vue.d';
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  export interface RefHistoryRecord<T> {
3
3
  snapshot: T;
4
4
  timestamp: number;
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { UseManualRefHistoryReturn } from './useManualRefHistory';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface RefHistoryEnvironment {
@@ -1,4 +1,4 @@
1
- import type { InjectionKey } from '../../../references/vue.d';
1
+ import type { InjectionKey } from 'vue';
2
2
  import type { VueCompositionAPI } from '../../../types/vue.d';
3
3
  export interface InjectLocalEnvironment {
4
4
  vue: Pick<Required<VueCompositionAPI>, 'inject'>;
@@ -1,4 +1,4 @@
1
- import type { InjectionKey } from '../../../references/vue.d';
1
+ import type { InjectionKey } from 'vue';
2
2
  import type { VueCompositionAPI } from '../../../types/vue.d';
3
3
  export interface ProvideLocalEnvironment {
4
4
  vue: Pick<Required<VueCompositionAPI>, 'provide'>;
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { setTimeout } from '../../../references/timer.d';
3
3
  import type { VueCompositionAPI } from '../../../types/vue.d';
4
4
  export interface AsyncStateEnvironment {
@@ -1,4 +1,4 @@
1
- import type { Ref } from '../../../references/vue.d';
1
+ import type { Ref } from 'vue';
2
2
  import type { VueCompositionAPI } from '../../../types/vue.d';
3
3
  export interface UseCounterDeps {
4
4
  vue: Pick<Required<VueCompositionAPI>, 'ref'>;
@@ -0,0 +1,23 @@
1
+ import type { Ref } from '../../../references/vue.d';
2
+ import type { VueCompositionAPI } from '../../../types/vue.d';
3
+ import type { UploadFile, BeforeUploadHandler, UploadHandler, AfterUploadHandler } from '../../../types/file-upload.d';
4
+ import type { File } from '../../../references/browser.d';
5
+ export interface UseFileUploadEnvironment {
6
+ vue: Pick<Required<VueCompositionAPI>, 'ref' | 'shallowRef' | 'watch'>;
7
+ }
8
+ export interface UseFileUploadOptions {
9
+ fileList?: UploadFile[];
10
+ maxCount?: number;
11
+ beforeUpload?: BeforeUploadHandler;
12
+ upload?: UploadHandler;
13
+ afterUpload?: AfterUploadHandler;
14
+ }
15
+ export interface UseFileUploadReturn {
16
+ readonly fileList: Ref<UploadFile[]>;
17
+ readonly: (list: UploadFile[]) => void;
18
+ appendFileAt: (file: UploadFile, index?: number) => void;
19
+ replaceFileAt: (file: UploadFile, index: number) => void;
20
+ addFile: (file: File) => Promise<void>;
21
+ }
22
+ export declare function useFileUpload(options: UseFileUploadOptions, env: UseFileUploadEnvironment): UseFileUploadReturn;
23
+ export default useFileUpload;