sykj 0.1.0 → 0.1.1

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 CHANGED
@@ -43,7 +43,7 @@ app.mount("#app");
43
43
  </template>
44
44
 
45
45
  <script setup>
46
- import SyKeyboard from "sykj";
46
+ import { SyKeyboard } from "sykj";
47
47
  </script>
48
48
 
49
49
  <style lang="scss" scoped>
@@ -2,8 +2,8 @@ import "/lib/store";
2
2
 
3
3
  import "/lib/focus";
4
4
 
5
- import SyKeyboard from "/packages/keyboard/index.js"; // 引入封装好的组件
6
- import SyLoading from "/packages/loading/index.js";
5
+ import SyKeyboard from "/packages/keyboard/index.ts"; // 引入封装好的组件
6
+ import SyLoading from "/packages/loading/index.ts";
7
7
 
8
8
  // export { SyKeyboard as default };
9
9
  // export { SyLoading };
@@ -19,7 +19,7 @@ const components = [
19
19
  // 其他组件...
20
20
  ];
21
21
 
22
- const install = function (Vue) {
22
+ const install = function (Vue: { component: (arg0: any, arg1: any) => void }) {
23
23
  components.forEach((component) => {
24
24
  Vue.component(component.name, component);
25
25
  });
@@ -5,10 +5,8 @@ const globalKey = window.$sy.key;
5
5
 
6
6
  let st = null;
7
7
  document.addEventListener("focusin", (event) => {
8
- if (
9
- event.target?.tagName === "INPUT" ||
10
- event.target?.tagName === "TEXTAREA"
11
- ) {
8
+ const target = event.target as HTMLElement;
9
+ if (target?.tagName === "INPUT" || target?.tagName === "TEXTAREA") {
12
10
  console.log(
13
11
  "🚀 ~ file: focus.js:15 ~ document.addEventListener ~ event.target:",
14
12
  event.target
@@ -17,18 +15,21 @@ document.addEventListener("focusin", (event) => {
17
15
  clearTimeout(st);
18
16
  globalKey.open();
19
17
  globalKey.currentElement = event.target;
18
+ console.log(
19
+ "🚀 ~ file: focus.ts:18 ~ document.addEventListener ~ globalKey:",
20
+ globalKey
21
+ );
20
22
  }
21
23
  });
22
24
  document.addEventListener("focusout", (event) => {
23
25
  st = setTimeout(() => {
24
26
  globalKey.close();
27
+ // globalKey.currentElement = null;
25
28
  }, 100);
26
- if (
27
- event.target?.tagName === "INPUT" ||
28
- event.target?.tagName === "TEXTAREA"
29
- ) {
29
+ const target = event.target as HTMLElement;
30
+ if (target?.tagName === "INPUT" || target?.tagName === "TEXTAREA") {
30
31
  // window.showKeyboard()
31
- globalKey.currentElement = null;
32
+ //
32
33
  console.log(2);
33
34
  }
34
35
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sykj",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "rem adaptation🚀",
5
5
  "main": "lib/common.ts",
6
6
  "files": [
@@ -1,7 +1,7 @@
1
1
  import SyKeyboard from "./src/Keyboardcon.vue";
2
-
2
+ import { App } from "vue";
3
3
  /* istanbul ignore next */
4
- SyKeyboard.install = function (Vue) {
4
+ SyKeyboard.install = function (Vue: App) {
5
5
  Vue.component(SyKeyboard.name, SyKeyboard);
6
6
  };
7
7
 
@@ -447,13 +447,14 @@ const setInputValue = (item) => {
447
447
  text = text.slice(0, carePos) + item + text.slice(carePos);
448
448
  }
449
449
 
450
- if (toUpKeyCase.value) {
451
- // keyStore.currentElement.value = `${text}`.toUpperCase();
452
- globalKey.currentElement.value = `${text}`.toUpperCase();
453
- } else {
454
- // keyStore.currentElement.value = text;
455
- globalKey.currentElement.value = text;
456
- }
450
+ // if (toUpKeyCase.value) {
451
+ // // keyStore.currentElement.value = `${text}`.toUpperCase();
452
+ // globalKey.currentElement.value = `${text}`.toUpperCase();
453
+ // } else {
454
+ // // keyStore.currentElement.value = text;
455
+ // globalKey.currentElement.value = text;
456
+ // }
457
+ globalKey.currentElement.value = text;
457
458
  carePos += item.length + 1;
458
459
 
459
460
  // keyStore.currentElement.setSelectionRange(carePos - 1, carePos - 1);
@@ -1,10 +1,10 @@
1
1
  import Loading1 from "./Loading1.vue";
2
2
  import Loading2 from "./Loading2.vue";
3
-
3
+ import { App } from "vue";
4
4
  const components = [Loading1, Loading2];
5
5
 
6
6
  components.forEach((i) => {
7
- i.install = function (Vue) {
7
+ i.install = function (Vue: App) {
8
8
  Vue.component(i.name, i);
9
9
  };
10
10
  });
@@ -0,0 +1,11 @@
1
+ // types/global.d.ts
2
+
3
+ // 确保 TypeScript 识别这是一个模块
4
+ export {};
5
+
6
+ declare global {
7
+ interface Window {
8
+ Vue: any;
9
+ $sy: any;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ // types/global.d.ts
2
+
3
+ // 确保 TypeScript 识别这是一个模块
4
+ export {};
File without changes