@elmethis/core 1.0.0-alpha.170 → 1.0.0-alpha.172
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.
|
@@ -13,10 +13,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
13
13
|
let katexRenderToString = null;
|
|
14
14
|
const loadKatex = async () => {
|
|
15
15
|
if (!katexRenderToString) {
|
|
16
|
-
const
|
|
17
|
-
import("katex"),
|
|
18
|
-
Promise.resolve({ })
|
|
19
|
-
]);
|
|
16
|
+
const { renderToString } = await import("katex");
|
|
20
17
|
katexRenderToString = renderToString;
|
|
21
18
|
}
|
|
22
19
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { onKeyStroke } from "@vueuse/core";
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
function useTyping() {
|
|
4
|
+
const targetString = ref(null);
|
|
5
|
+
const targetArray = ref([]);
|
|
6
|
+
const currentCharIndex = ref(0);
|
|
7
|
+
const mistakes = ref(0);
|
|
8
|
+
const isFinished = ref(false);
|
|
9
|
+
const start = (target) => {
|
|
10
|
+
isFinished.value = false;
|
|
11
|
+
currentCharIndex.value = 0;
|
|
12
|
+
targetString.value = target;
|
|
13
|
+
targetArray.value = target.split("").map((char) => ({ char, status: "default" }));
|
|
14
|
+
targetArray.value[0].status = "current";
|
|
15
|
+
};
|
|
16
|
+
onKeyStroke((event) => {
|
|
17
|
+
if (targetArray.value[currentCharIndex.value] != null && !isFinished.value && event.key.length === 1) {
|
|
18
|
+
if (event.key === targetArray.value[currentCharIndex.value].char) {
|
|
19
|
+
targetArray.value[currentCharIndex.value].status = "typed";
|
|
20
|
+
if (currentCharIndex.value === targetArray.value.length - 1) {
|
|
21
|
+
isFinished.value = true;
|
|
22
|
+
} else {
|
|
23
|
+
currentCharIndex.value += 1;
|
|
24
|
+
targetArray.value[currentCharIndex.value] = targetArray.value[currentCharIndex.value];
|
|
25
|
+
targetArray.value[currentCharIndex.value].status = "current";
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
mistakes.value += 1;
|
|
29
|
+
targetArray.value[currentCharIndex.value].status = "incorrect";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return { start, targetArray, isFinished, mistakes };
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
useTyping
|
|
37
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -122,3 +122,5 @@ export type { ElmParagraphProps } from './components/typography/ElmParagraph.vue
|
|
|
122
122
|
export { default as ElmParagraph } from './components/typography/ElmParagraph.vue';
|
|
123
123
|
export type { ElmListItemProps } from './components/typography/ElmListItem.vue';
|
|
124
124
|
export { default as ElmListItem } from './components/typography/ElmListItem.vue';
|
|
125
|
+
export { useElmethisTheme } from './hooks/useElmethisTheme';
|
|
126
|
+
export { useTyping } from './hooks/useTyping';
|
package/dist/index.mjs
CHANGED
|
@@ -76,6 +76,8 @@ import { default as default61 } from "./components/typography/ElmNumberedList.vu
|
|
|
76
76
|
|
|
77
77
|
import { default as default62 } from "./components/typography/ElmParagraph.vue.mjs";
|
|
78
78
|
import { default as default63 } from "./components/typography/ElmListItem.vue.mjs";
|
|
79
|
+
import { useElmethisTheme } from "./hooks/useElmethisTheme.mjs";
|
|
80
|
+
import { useTyping } from "./hooks/useTyping.mjs";
|
|
79
81
|
export {
|
|
80
82
|
default33 as ElmArrowIcon,
|
|
81
83
|
default2 as ElmBadge,
|
|
@@ -138,5 +140,7 @@ export {
|
|
|
138
140
|
default13 as ElmToggle,
|
|
139
141
|
default39 as ElmToggleTheme,
|
|
140
142
|
default14 as ElmTooltip,
|
|
141
|
-
default25 as ElmTotp
|
|
143
|
+
default25 as ElmTotp,
|
|
144
|
+
useElmethisTheme,
|
|
145
|
+
useTyping
|
|
142
146
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elmethis/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.172",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"openapi-types": "^12.1.3",
|
|
54
54
|
"postcss": "^8.5.3",
|
|
55
55
|
"postcss-preset-env": "^10.1.5",
|
|
56
|
-
"sass": "^1.86.
|
|
56
|
+
"sass": "^1.86.1",
|
|
57
57
|
"storybook": "^8.6.11",
|
|
58
58
|
"vite": "^6.2.4",
|
|
59
59
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|