sykj 0.0.7 → 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>
package/lib/common.ts CHANGED
@@ -1,8 +1,36 @@
1
- import 'sykj/lib/store'
1
+ import "/lib/store";
2
2
 
3
- import 'sykj/lib/focus'
4
- import SyKeyboard from "sykj/packages/keyboard/index.ts"; // 引入封装好的组件
3
+ import "/lib/focus";
5
4
 
6
- export {
7
- SyKeyboard as default,
8
- };
5
+ import SyKeyboard from "/packages/keyboard/index.ts"; // 引入封装好的组件
6
+ import SyLoading from "/packages/loading/index.ts";
7
+
8
+ // export { SyKeyboard as default };
9
+ // export { SyLoading };
10
+
11
+ // import Vue from "vue";
12
+ // import Loading1 from "./Loading1.vue";
13
+ // import Loading2 from "./Loading2.vue";
14
+ // // 导入其他组件...
15
+
16
+ const components = [
17
+ ...SyLoading,
18
+ SyKeyboard,
19
+ // 其他组件...
20
+ ];
21
+
22
+ const install = function (Vue: { component: (arg0: any, arg1: any) => void }) {
23
+ components.forEach((component) => {
24
+ Vue.component(component.name, component);
25
+ });
26
+ };
27
+
28
+ // Auto-install when vue is found (eg. in browser via <script> tag)
29
+ if (typeof window !== "undefined" && window.Vue) {
30
+ install(window.Vue);
31
+ }
32
+
33
+ export default {
34
+ install,
35
+ // 其他导出...
36
+ };
package/lib/focus.ts CHANGED
@@ -3,26 +3,33 @@
3
3
  const globalKey = window.$sy.key;
4
4
  // const keyStore = useKeyStore()
5
5
 
6
- let st: number | null = null;
6
+ let st = null;
7
7
  document.addEventListener("focusin", (event) => {
8
- if (
9
- (event.target as HTMLElement)?.tagName === "INPUT" ||
10
- (event.target as HTMLElement)?.tagName === "TEXTAREA"
11
- ) {
12
- clearTimeout(st as number | undefined);
8
+ const target = event.target as HTMLElement;
9
+ if (target?.tagName === "INPUT" || target?.tagName === "TEXTAREA") {
10
+ console.log(
11
+ "🚀 ~ file: focus.js:15 ~ document.addEventListener ~ event.target:",
12
+ event.target
13
+ );
14
+
15
+ clearTimeout(st);
13
16
  globalKey.open();
14
17
  globalKey.currentElement = event.target;
18
+ console.log(
19
+ "🚀 ~ file: focus.ts:18 ~ document.addEventListener ~ globalKey:",
20
+ globalKey
21
+ );
15
22
  }
16
23
  });
17
24
  document.addEventListener("focusout", (event) => {
18
25
  st = setTimeout(() => {
19
26
  globalKey.close();
27
+ // globalKey.currentElement = null;
20
28
  }, 100);
21
- if (
22
- (event.target as HTMLElement)?.tagName === "INPUT" ||
23
- (event.target as HTMLElement)?.tagName === "TEXTAREA"
24
- ) {
29
+ const target = event.target as HTMLElement;
30
+ if (target?.tagName === "INPUT" || target?.tagName === "TEXTAREA") {
25
31
  // window.showKeyboard()
26
- // console.log(2);
32
+ //
33
+ console.log(2);
27
34
  }
28
35
  });
package/lib/store.ts CHANGED
@@ -1,6 +1,5 @@
1
- (window.globalThis as any).$sy= {
2
- key:{
3
- show_keyboard:false
4
- }
5
- }
6
-
1
+ window.globalThis.$sy = {
2
+ key: {
3
+ show_keyboard: false,
4
+ },
5
+ };
package/package.json CHANGED
@@ -1,15 +1,48 @@
1
1
  {
2
2
  "name": "sykj",
3
- "version": "0.0.7",
3
+ "version": "0.1.1",
4
4
  "description": "rem adaptation🚀",
5
5
  "main": "lib/common.ts",
6
6
  "files": [
7
7
  "lib",
8
8
  "packages",
9
- "src"
9
+ "main",
10
+ "types"
10
11
  ],
12
+ "types": "/types/index.d.ts",
11
13
  "scripts": {
12
- "test": "echo \"Error: no test specified\" && exit 1"
14
+ "dev": "vite --host",
15
+ "build": "run-p type-check \"build-only {@}\" --",
16
+ "preview": "vite preview",
17
+ "build-only": "vite build ",
18
+ "type-check": "vue-tsc --build --force",
19
+ "package": "vite build && cp -r ./dist/* ./sykj",
20
+ "docs:dev": "vitepress dev docs --host",
21
+ "docs:build": "vitepress build docs",
22
+ "docs:preview": "vitepress preview docs"
23
+ },
24
+ "dependencies": {
25
+ "@element-plus/icons-vue": "^2.3.1",
26
+ "amfe-flexible": "^2.2.1",
27
+ "axios": "^1.6.8",
28
+ "element-plus": "^2.7.2",
29
+ "pinia": "^2.1.7",
30
+ "vitepress": "^1.3.1",
31
+ "vue": "^3.4.21",
32
+ "vue-router": "^4.3.0"
33
+ },
34
+ "devDependencies": {
35
+ "@tsconfig/node20": "^20.1.4",
36
+ "@types/node": "^20.12.5",
37
+ "@vitejs/plugin-vue": "^5.0.4",
38
+ "@vue/tsconfig": "^0.5.1",
39
+ "npm-run-all2": "^6.1.2",
40
+ "postcss": "^8.4.38",
41
+ "postcss-pxtorem": "^6.1.0",
42
+ "sass": "^1.77.1",
43
+ "typescript": "~5.4.5",
44
+ "vite": "^5.2.11",
45
+ "vue-tsc": "^2.0.11"
13
46
  },
14
47
  "keywords": [
15
48
  "keyboard",
@@ -1,8 +1,8 @@
1
- import SyKeyboard from './src/Keyboardcon.vue';
2
-
1
+ import SyKeyboard from "./src/Keyboardcon.vue";
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
 
8
- export default SyKeyboard;
8
+ export default SyKeyboard;
@@ -144,7 +144,7 @@
144
144
  >英</span
145
145
  >
146
146
  </div>
147
- <span>确认</span>
147
+ <span @click.stop>确认</span>
148
148
  </div>
149
149
  <!-- <div class="symbol_list" v-show="keyStore.inputType == 'symbol'"></div> -->
150
150
  </div>
@@ -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);
@@ -784,29 +785,33 @@ const cancelPress = () => {
784
785
  @import "./theme.scss";
785
786
 
786
787
  .defaultCss {
787
- --h: 0.7rem;
788
- --gap: 0.1rem;
789
- --fontSize: 0.4rem;
790
- --borra: 0.2em;
788
+ --h: 4vh;
789
+ --gap: 0.6vh;
790
+ --fontSize: 2vh;
791
+ --borra: 0.4vh;
791
792
  }
792
793
 
793
794
  .upKeyCase {
794
- --fontSize: 0.35rem;
795
+ --fontSize: 2vh;
795
796
  }
796
797
 
797
798
  .keyboardcon {
798
799
  position: fixed;
799
800
  background-color: #212123;
800
801
  width: 100%;
802
+ max-width: 1280px;
803
+ margin: auto;
804
+ left: 0;
805
+ right: 0;
801
806
  bottom: 0;
802
807
  font-size: var(--fontSize);
803
- padding: 0.25rem 0.25rem 0.125rem;
808
+ padding: 1.2vh 1.2vh 0.6vh;
804
809
  box-sizing: border-box;
805
- box-shadow: 0 0 0.3rem 0 rgb(117, 117, 117);
810
+ box-shadow: 0 0 1.5vh 0 rgb(117, 117, 117);
806
811
  z-index: 10000;
807
812
  // // @include key_background("keyboard_background");
808
813
  background: var(--keyboard_background);
809
- border-radius: 0.25rem 0.25rem 0 0;
814
+ border-radius: 1.2vh 1.2vh 0 0;
810
815
  transition: all 0.2s;
811
816
  & * {
812
817
  box-sizing: border-box;
@@ -816,11 +821,11 @@ const cancelPress = () => {
816
821
  display: flex;
817
822
  justify-content: space-between;
818
823
  align-items: center;
819
- margin: 0.25rem 0;
820
- font-size: 0.25rem;
821
-
824
+ margin: 1.2vh 0;
825
+ font-size: 1.2vh;
826
+ cursor: pointer;
822
827
  > div {
823
- height: 0.25rem;
828
+ height: 1.2vh;
824
829
  span {
825
830
  color: gainsboro;
826
831
  transition: all 0.3s;
@@ -828,7 +833,7 @@ const cancelPress = () => {
828
833
  }
829
834
 
830
835
  .ch {
831
- font-size: 0.35rem;
836
+ font-size: 1.4vh;
832
837
  color: rgb(0, 123, 255);
833
838
  }
834
839
  }
@@ -844,11 +849,11 @@ const cancelPress = () => {
844
849
 
845
850
  .wenzi {
846
851
  position: relative;
847
- height: 0.6rem;
852
+ height: 3.6vh;
848
853
 
849
854
  // border: 1px solid red;
850
855
  background: var(--keyboard_background);
851
- margin-bottom: 0.1rem;
856
+ margin-bottom: 0.6vh;
852
857
  .wenzi_box {
853
858
  display: flex;
854
859
  // flex-wrap: wrap;
@@ -871,7 +876,7 @@ const cancelPress = () => {
871
876
 
872
877
  span {
873
878
  flex-shrink: 0;
874
- padding: 0.04rem 0.08rem;
879
+ padding: 0.24vh 0.48vh;
875
880
  border-radius: 6px;
876
881
  // border: 1px solid red;
877
882
  height: fit-content;
@@ -887,23 +892,23 @@ const cancelPress = () => {
887
892
 
888
893
  .wenzi_box_more {
889
894
  // flex-wrap: wrap;
890
- padding-right: 0.34rem;
895
+ padding-right: 1.8vh;
891
896
  box-sizing: border-box;
892
897
  width: 102%;
893
- left: -0.03rem;
898
+ left: -0.18vh;
894
899
  // height: 31vh;
895
- height: 4.5rem;
900
+ height: 25vh;
896
901
 
897
902
  // border: 1px solid red;
898
903
  }
899
904
 
900
905
  .moreText {
901
906
  position: absolute;
902
- height: 0.55rem;
907
+ height: 3.5vh;
903
908
  top: 0;
904
909
  right: -5px;
905
910
  z-index: 100;
906
- padding: 0 0.05rem;
911
+ padding: 0 0.3vh;
907
912
  display: flex;
908
913
  justify-content: center;
909
914
  align-items: center;
@@ -1051,7 +1056,7 @@ const cancelPress = () => {
1051
1056
  background: var(--key_background);
1052
1057
  span {
1053
1058
  height: fit-content;
1054
- line-height: 0.2rem;
1059
+ line-height: 1.2vh;
1055
1060
  // border: 1px solid red;
1056
1061
  }
1057
1062
 
@@ -1095,8 +1100,8 @@ const cancelPress = () => {
1095
1100
  // grid-template-columns: repeat(9, 1fr);
1096
1101
  }
1097
1102
 
1098
- --flw: 8%; // 3 4 头尾
1099
- --mflw: 50px;
1103
+ --flw: 10%; // 3 4 头尾
1104
+ --mflw: 60px;
1100
1105
  // 单独第3行
1101
1106
  &:nth-child(3) {
1102
1107
  justify-self: center;
@@ -1111,7 +1116,8 @@ const cancelPress = () => {
1111
1116
  display: flex;
1112
1117
  justify-content: center;
1113
1118
  align-items: center;
1114
- font-size: 0.3rem;
1119
+ font-size: 1.8vh;
1120
+ // border: 1px solid red;
1115
1121
  img {
1116
1122
  transform: scale(0.7);
1117
1123
  // @include filter("key_filter");
@@ -1121,8 +1127,7 @@ const cancelPress = () => {
1121
1127
 
1122
1128
  .toUpKeyCase {
1123
1129
  box-shadow: none;
1124
- // border: 1px solid red;
1125
- background: #c7c7c7;
1130
+ // border: 1px solid red; ´
1126
1131
 
1127
1132
  img {
1128
1133
  filter: invert(100%);
@@ -1167,7 +1172,7 @@ const cancelPress = () => {
1167
1172
  .key {
1168
1173
  padding: 0;
1169
1174
  box-sizing: border-box;
1170
- font-size: 0.3rem;
1175
+ font-size: 1.8vh;
1171
1176
  font-weight: bold;
1172
1177
 
1173
1178
  img {
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <div class="loadAni">
3
+ <span>.</span>
4
+ <span>.</span>
5
+ <span>.</span>
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: "SyLoading1",
12
+ };
13
+ </script>
14
+
15
+ <script lang="ts" setup></script>
16
+
17
+ <style lang="scss" scoped>
18
+ .loadAni {
19
+ display: inline-block;
20
+ user-select: none;
21
+ span {
22
+ display: inline-block;
23
+ margin: 0 2px;
24
+ font-size: 26px;
25
+ animation: loadAni 1s ease-in-out infinite;
26
+ &:nth-child(1) {
27
+ animation-delay: 0s;
28
+ }
29
+ &:nth-child(2) {
30
+ animation-delay: 0.1s;
31
+ }
32
+ &:nth-child(3) {
33
+ animation-delay: 0.2s;
34
+ }
35
+ // border:1px solid red;
36
+ @keyframes loadAni {
37
+ 0% {
38
+ transform: translateY(0%);
39
+ }
40
+ 25% {
41
+ transform: translateY(-20%);
42
+ }
43
+ 50% {
44
+ transform: translateY(10%);
45
+ }
46
+ 60% {
47
+ transform: translateY(0%);
48
+ }
49
+ 100% {
50
+ transform: translateY(0%);
51
+ }
52
+ }
53
+ }
54
+ }
55
+ </style>
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <div class="loadAni">
3
+ <el-icon><Loading /></el-icon>
4
+ </div>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ export default {
9
+ name: "SyLoading2",
10
+ };
11
+ </script>
12
+
13
+ <script lang="ts" setup>
14
+ const props = defineProps({
15
+ size: {
16
+ default: 1,
17
+ },
18
+ });
19
+ </script>
20
+
21
+ <style lang="scss" scoped>
22
+ .loadAni {
23
+ display: inline-block;
24
+ user-select: none;
25
+ height: fit-content;
26
+ .el-icon {
27
+ animation: loadAni 2s linear infinite;
28
+ font-size: 20px;
29
+ @keyframes loadAni {
30
+ 100% {
31
+ transform: rotateZ(360deg);
32
+ }
33
+ }
34
+ }
35
+ }
36
+ </style>
@@ -0,0 +1,12 @@
1
+ import Loading1 from "./Loading1.vue";
2
+ import Loading2 from "./Loading2.vue";
3
+ import { App } from "vue";
4
+ const components = [Loading1, Loading2];
5
+
6
+ components.forEach((i) => {
7
+ i.install = function (Vue: App) {
8
+ Vue.component(i.name, i);
9
+ };
10
+ });
11
+
12
+ export default components;
@@ -0,0 +1,7 @@
1
+ import Vue from "vue";
2
+
3
+ /** ElementUI component common definition */
4
+ export declare class ElementUIComponent extends Vue {
5
+ /** Install component into Vue */
6
+ static install(vue: typeof Vue): void;
7
+ }
@@ -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 {};
package/packages/index.ts DELETED
@@ -1,6 +0,0 @@
1
- // import { useKeyStore } from "./keyboard/src/key_pinia";
2
-
3
-
4
- // export {
5
- // useKeyStore
6
- // }
@@ -1,13 +0,0 @@
1
- // src/store/user.js
2
- import { defineStore } from "pinia";
3
- export const useKeyStore = defineStore({
4
- id: "key",
5
- state: () => {
6
- return {
7
- keyboardcon: !false,
8
- currentElement: null,
9
- inputType: "text",
10
- showCheckChinese: false,//是否展示中文输入切换
11
- };
12
- },
13
- });
File without changes