@elmethis/core 0.5.7 → 0.6.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/dist/components/others/ElmMarkdown.vue.mjs +1 -2
- package/dist/components/typography/ElmTypingAnimation.vue.mjs +10 -0
- package/dist/components/typography/ElmTypingAnimation.vue2.mjs +49 -0
- package/dist/components/typography/ElmTypingAnimation.vue3.mjs +26 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +2 -2
|
@@ -82,7 +82,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
82
82
|
loader: () => import("../table/ElmTableCell.vue.mjs"),
|
|
83
83
|
loadingComponent: ElmBlockFallback
|
|
84
84
|
});
|
|
85
|
-
const tokensToText = ({ tokens }) => tokens.map((token) => "text" in token ? token.text : token.raw).join("");
|
|
86
85
|
const renderByToken = ({ tokens }) => {
|
|
87
86
|
const results = [];
|
|
88
87
|
for (const token of tokens) {
|
|
@@ -176,7 +175,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
176
175
|
case "link":
|
|
177
176
|
results.push(
|
|
178
177
|
token.tokens != null && token.tokens.length !== 0 ? h(AsyncElmInlineText, {
|
|
179
|
-
text:
|
|
178
|
+
text: token.text,
|
|
180
179
|
href: token.href
|
|
181
180
|
}) : h(AsyncElmInlineText, { text: token.text, href: token.href })
|
|
182
181
|
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _sfc_main from "./ElmTypingAnimation.vue2.mjs";
|
|
2
|
+
import style0 from "./ElmTypingAnimation.vue3.mjs";
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
4
|
+
const cssModules = {
|
|
5
|
+
"$style": style0
|
|
6
|
+
};
|
|
7
|
+
const ElmTypingAnimation = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]);
|
|
8
|
+
export {
|
|
9
|
+
ElmTypingAnimation as default
|
|
10
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineComponent, ref, onMounted, createElementBlock, openBlock, normalizeStyle, normalizeClass, createTextVNode, createElementVNode, toDisplayString } from "vue";
|
|
2
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
|
+
__name: "ElmTypingAnimation",
|
|
4
|
+
props: {
|
|
5
|
+
texts: { default: () => [] },
|
|
6
|
+
interval: { default: 3e3 },
|
|
7
|
+
fontSize: { default: "1rem" }
|
|
8
|
+
},
|
|
9
|
+
setup(__props) {
|
|
10
|
+
const props = __props;
|
|
11
|
+
const sleep = (duration) => {
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
setTimeout(resolve, duration);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
const display = ref("");
|
|
17
|
+
onMounted(async () => {
|
|
18
|
+
while (true) {
|
|
19
|
+
for (const text of props.texts) {
|
|
20
|
+
for (const char of text) {
|
|
21
|
+
await sleep(75);
|
|
22
|
+
display.value += char;
|
|
23
|
+
}
|
|
24
|
+
await sleep(props.interval);
|
|
25
|
+
while (true) {
|
|
26
|
+
if (display.value === "") break;
|
|
27
|
+
display.value = display.value.slice(0, -1);
|
|
28
|
+
await sleep(25);
|
|
29
|
+
}
|
|
30
|
+
await sleep(200);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return (_ctx, _cache) => {
|
|
35
|
+
return openBlock(), createElementBlock("span", {
|
|
36
|
+
class: normalizeClass(_ctx.$style.text),
|
|
37
|
+
style: normalizeStyle({ fontSize: _ctx.fontSize })
|
|
38
|
+
}, [
|
|
39
|
+
createTextVNode(toDisplayString(display.value), 1),
|
|
40
|
+
createElementVNode("span", {
|
|
41
|
+
class: normalizeClass(_ctx.$style.cursor)
|
|
42
|
+
}, " ", 2)
|
|
43
|
+
], 6);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export {
|
|
48
|
+
_sfc_main as default
|
|
49
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
"use strict";
|
|
3
|
+
try {
|
|
4
|
+
if (typeof document != "undefined") {
|
|
5
|
+
var elementStyle = document.createElement("style");
|
|
6
|
+
elementStyle.appendChild(document.createTextNode("._text_kfz2u_1{font-family:monospace;color:#000c;-webkit-user-select:none;-moz-user-select:none;user-select:none}._text_kfz2u_1::-moz-selection{color:#fffc;background-color:#000c}._text_kfz2u_1::selection{color:#fffc;background-color:#000c}[data-theme=dark] ._text_kfz2u_1{color:#fffc}[data-theme=dark] ._text_kfz2u_1::-moz-selection{color:#000c;background-color:#fffc}[data-theme=dark] ._text_kfz2u_1::selection{color:#000c;background-color:#fffc}@keyframes _blink_kfz2u_1{0%{opacity:0}to{opacity:1}}._cursor_kfz2u_26{margin-inline:1px;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:#3e434b80}[data-theme=dark] ._cursor_kfz2u_26{background-color:#cccfd540}"));
|
|
7
|
+
document.head.appendChild(elementStyle);
|
|
8
|
+
}
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.error("vite-plugin-css-injected-by-js", e);
|
|
11
|
+
}
|
|
12
|
+
})();
|
|
13
|
+
const text = "_text_kfz2u_1";
|
|
14
|
+
const cursor = "_cursor_kfz2u_26";
|
|
15
|
+
const blink = "_blink_kfz2u_1";
|
|
16
|
+
const style0 = {
|
|
17
|
+
text,
|
|
18
|
+
cursor,
|
|
19
|
+
blink
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
blink,
|
|
23
|
+
cursor,
|
|
24
|
+
style0 as default,
|
|
25
|
+
text
|
|
26
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -108,5 +108,7 @@ export type { ElmParagraphProps } from './components/typography/ElmParagraph.vue
|
|
|
108
108
|
export { default as ElmParagraph } from './components/typography/ElmParagraph.vue';
|
|
109
109
|
export type { ElmListProps } from './components/typography/ElmList.vue';
|
|
110
110
|
export { default as ElmList } from './components/typography/ElmList.vue';
|
|
111
|
+
export type { ElmTypingAnimationProps } from './components/typography/ElmTypingAnimation.vue';
|
|
112
|
+
export { default as ElmTypingAnimation } from './components/typography/ElmTypingAnimation.vue';
|
|
111
113
|
export { useElmethisTheme } from './hooks/useElmethisTheme';
|
|
112
114
|
export { useTyping } from './hooks/useTyping';
|
package/dist/index.mjs
CHANGED
|
@@ -66,6 +66,7 @@ import { default as default54 } from "./components/typography/ElmInlineText.vue.
|
|
|
66
66
|
import { default as default55 } from "./components/typography/ElmParagraph.vue.mjs";
|
|
67
67
|
import { default as default56 } from "./components/typography/ElmList.vue.mjs";
|
|
68
68
|
|
|
69
|
+
import { default as default57 } from "./components/typography/ElmTypingAnimation.vue.mjs";
|
|
69
70
|
import { useElmethisTheme } from "./hooks/useElmethisTheme.mjs";
|
|
70
71
|
import { useTyping } from "./hooks/useTyping.mjs";
|
|
71
72
|
export {
|
|
@@ -122,6 +123,7 @@ export {
|
|
|
122
123
|
default11 as ElmToggle,
|
|
123
124
|
default33 as ElmToggleTheme,
|
|
124
125
|
default12 as ElmTooltip,
|
|
126
|
+
default57 as ElmTypingAnimation,
|
|
125
127
|
default19 as ElmUnsupportedBlock,
|
|
126
128
|
default25 as ElmValidation,
|
|
127
129
|
useElmethisTheme,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elmethis/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"jarkup-ts": "^0.4.1",
|
|
45
45
|
"openapi-types": "^12.1.3",
|
|
46
46
|
"postcss": "^8.5.6",
|
|
47
|
-
"postcss-preset-env": "^10.3.
|
|
47
|
+
"postcss-preset-env": "^10.3.1",
|
|
48
48
|
"sass": "^1.91.0",
|
|
49
49
|
"vite": "^7.1.3",
|
|
50
50
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|