sykj 0.0.7 → 0.1.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.
package/lib/common.js ADDED
@@ -0,0 +1,36 @@
1
+ import "/lib/store";
2
+
3
+ import "/lib/focus";
4
+
5
+ import SyKeyboard from "/packages/keyboard/index.js"; // 引入封装好的组件
6
+ import SyLoading from "/packages/loading/index.js";
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) {
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
+ };
@@ -3,13 +3,18 @@
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
8
  if (
9
- (event.target as HTMLElement)?.tagName === "INPUT" ||
10
- (event.target as HTMLElement)?.tagName === "TEXTAREA"
9
+ event.target?.tagName === "INPUT" ||
10
+ event.target?.tagName === "TEXTAREA"
11
11
  ) {
12
- clearTimeout(st as number | undefined);
12
+ console.log(
13
+ "🚀 ~ file: focus.js:15 ~ document.addEventListener ~ event.target:",
14
+ event.target
15
+ );
16
+
17
+ clearTimeout(st);
13
18
  globalKey.open();
14
19
  globalKey.currentElement = event.target;
15
20
  }
@@ -19,10 +24,11 @@ document.addEventListener("focusout", (event) => {
19
24
  globalKey.close();
20
25
  }, 100);
21
26
  if (
22
- (event.target as HTMLElement)?.tagName === "INPUT" ||
23
- (event.target as HTMLElement)?.tagName === "TEXTAREA"
27
+ event.target?.tagName === "INPUT" ||
28
+ event.target?.tagName === "TEXTAREA"
24
29
  ) {
25
30
  // window.showKeyboard()
26
- // console.log(2);
31
+ globalKey.currentElement = null;
32
+ console.log(2);
27
33
  }
28
34
  });
package/lib/store.js ADDED
@@ -0,0 +1,5 @@
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.0",
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';
1
+ import SyKeyboard from "./src/Keyboardcon.vue";
2
2
 
3
3
  /* istanbul ignore next */
4
4
  SyKeyboard.install = function (Vue) {
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>
@@ -784,29 +784,33 @@ const cancelPress = () => {
784
784
  @import "./theme.scss";
785
785
 
786
786
  .defaultCss {
787
- --h: 0.7rem;
788
- --gap: 0.1rem;
789
- --fontSize: 0.4rem;
790
- --borra: 0.2em;
787
+ --h: 4vh;
788
+ --gap: 0.6vh;
789
+ --fontSize: 2vh;
790
+ --borra: 0.4vh;
791
791
  }
792
792
 
793
793
  .upKeyCase {
794
- --fontSize: 0.35rem;
794
+ --fontSize: 2vh;
795
795
  }
796
796
 
797
797
  .keyboardcon {
798
798
  position: fixed;
799
799
  background-color: #212123;
800
800
  width: 100%;
801
+ max-width: 1280px;
802
+ margin: auto;
803
+ left: 0;
804
+ right: 0;
801
805
  bottom: 0;
802
806
  font-size: var(--fontSize);
803
- padding: 0.25rem 0.25rem 0.125rem;
807
+ padding: 1.2vh 1.2vh 0.6vh;
804
808
  box-sizing: border-box;
805
- box-shadow: 0 0 0.3rem 0 rgb(117, 117, 117);
809
+ box-shadow: 0 0 1.5vh 0 rgb(117, 117, 117);
806
810
  z-index: 10000;
807
811
  // // @include key_background("keyboard_background");
808
812
  background: var(--keyboard_background);
809
- border-radius: 0.25rem 0.25rem 0 0;
813
+ border-radius: 1.2vh 1.2vh 0 0;
810
814
  transition: all 0.2s;
811
815
  & * {
812
816
  box-sizing: border-box;
@@ -816,11 +820,11 @@ const cancelPress = () => {
816
820
  display: flex;
817
821
  justify-content: space-between;
818
822
  align-items: center;
819
- margin: 0.25rem 0;
820
- font-size: 0.25rem;
821
-
823
+ margin: 1.2vh 0;
824
+ font-size: 1.2vh;
825
+ cursor: pointer;
822
826
  > div {
823
- height: 0.25rem;
827
+ height: 1.2vh;
824
828
  span {
825
829
  color: gainsboro;
826
830
  transition: all 0.3s;
@@ -828,7 +832,7 @@ const cancelPress = () => {
828
832
  }
829
833
 
830
834
  .ch {
831
- font-size: 0.35rem;
835
+ font-size: 1.4vh;
832
836
  color: rgb(0, 123, 255);
833
837
  }
834
838
  }
@@ -844,11 +848,11 @@ const cancelPress = () => {
844
848
 
845
849
  .wenzi {
846
850
  position: relative;
847
- height: 0.6rem;
851
+ height: 3.6vh;
848
852
 
849
853
  // border: 1px solid red;
850
854
  background: var(--keyboard_background);
851
- margin-bottom: 0.1rem;
855
+ margin-bottom: 0.6vh;
852
856
  .wenzi_box {
853
857
  display: flex;
854
858
  // flex-wrap: wrap;
@@ -871,7 +875,7 @@ const cancelPress = () => {
871
875
 
872
876
  span {
873
877
  flex-shrink: 0;
874
- padding: 0.04rem 0.08rem;
878
+ padding: 0.24vh 0.48vh;
875
879
  border-radius: 6px;
876
880
  // border: 1px solid red;
877
881
  height: fit-content;
@@ -887,23 +891,23 @@ const cancelPress = () => {
887
891
 
888
892
  .wenzi_box_more {
889
893
  // flex-wrap: wrap;
890
- padding-right: 0.34rem;
894
+ padding-right: 1.8vh;
891
895
  box-sizing: border-box;
892
896
  width: 102%;
893
- left: -0.03rem;
897
+ left: -0.18vh;
894
898
  // height: 31vh;
895
- height: 4.5rem;
899
+ height: 25vh;
896
900
 
897
901
  // border: 1px solid red;
898
902
  }
899
903
 
900
904
  .moreText {
901
905
  position: absolute;
902
- height: 0.55rem;
906
+ height: 3.5vh;
903
907
  top: 0;
904
908
  right: -5px;
905
909
  z-index: 100;
906
- padding: 0 0.05rem;
910
+ padding: 0 0.3vh;
907
911
  display: flex;
908
912
  justify-content: center;
909
913
  align-items: center;
@@ -1051,7 +1055,7 @@ const cancelPress = () => {
1051
1055
  background: var(--key_background);
1052
1056
  span {
1053
1057
  height: fit-content;
1054
- line-height: 0.2rem;
1058
+ line-height: 1.2vh;
1055
1059
  // border: 1px solid red;
1056
1060
  }
1057
1061
 
@@ -1095,8 +1099,8 @@ const cancelPress = () => {
1095
1099
  // grid-template-columns: repeat(9, 1fr);
1096
1100
  }
1097
1101
 
1098
- --flw: 8%; // 3 4 头尾
1099
- --mflw: 50px;
1102
+ --flw: 10%; // 3 4 头尾
1103
+ --mflw: 60px;
1100
1104
  // 单独第3行
1101
1105
  &:nth-child(3) {
1102
1106
  justify-self: center;
@@ -1111,7 +1115,8 @@ const cancelPress = () => {
1111
1115
  display: flex;
1112
1116
  justify-content: center;
1113
1117
  align-items: center;
1114
- font-size: 0.3rem;
1118
+ font-size: 1.8vh;
1119
+ // border: 1px solid red;
1115
1120
  img {
1116
1121
  transform: scale(0.7);
1117
1122
  // @include filter("key_filter");
@@ -1121,8 +1126,7 @@ const cancelPress = () => {
1121
1126
 
1122
1127
  .toUpKeyCase {
1123
1128
  box-shadow: none;
1124
- // border: 1px solid red;
1125
- background: #c7c7c7;
1129
+ // border: 1px solid red; ´
1126
1130
 
1127
1131
  img {
1128
1132
  filter: invert(100%);
@@ -1167,7 +1171,7 @@ const cancelPress = () => {
1167
1171
  .key {
1168
1172
  padding: 0;
1169
1173
  box-sizing: border-box;
1170
- font-size: 0.3rem;
1174
+ font-size: 1.8vh;
1171
1175
  font-weight: bold;
1172
1176
 
1173
1177
  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
+
4
+ const components = [Loading1, Loading2];
5
+
6
+ components.forEach((i) => {
7
+ i.install = function (Vue) {
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
+ }
package/lib/common.ts DELETED
@@ -1,8 +0,0 @@
1
- import 'sykj/lib/store'
2
-
3
- import 'sykj/lib/focus'
4
- import SyKeyboard from "sykj/packages/keyboard/index.ts"; // 引入封装好的组件
5
-
6
- export {
7
- SyKeyboard as default,
8
- };
package/lib/store.ts DELETED
@@ -1,6 +0,0 @@
1
- (window.globalThis as any).$sy= {
2
- key:{
3
- show_keyboard:false
4
- }
5
- }
6
-
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