@elmethis/core 0.2.5 → 0.2.7
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/icon/ElmInlineIcon.vue3.mjs +2 -2
- package/dist/components/typography/ElmFragmentIdentifier.vue2.mjs +1 -12
- package/dist/components/typography/ElmHeading.vue2.mjs +22 -2
- package/dist/components/typography/ElmInlineText.vue2.mjs +1 -1
- package/dist/components/typography/ElmInlineText.vue3.mjs +9 -9
- package/package.json +1 -1
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
try {
|
|
4
4
|
if (typeof document != "undefined") {
|
|
5
5
|
var elementStyle = document.createElement("style");
|
|
6
|
-
elementStyle.appendChild(document.createTextNode(".
|
|
6
|
+
elementStyle.appendChild(document.createTextNode("._icon_19g82_1{margin:0;padding:0;display:inline-block;vertical-align:middle;height:1em}._icon_19g82_1::-moz-selection{filter:brightness(1000%);background-color:#00000040;background-color:var(--color, rgba(0, 0, 0, .25))}._icon_19g82_1::selection{filter:brightness(1000%);background-color:#00000040;background-color:var(--color, rgba(0, 0, 0, .25))}[data-theme=dark] ._icon_19g82_1{color:#ffffffb3;color:var(--color, rgba(255, 255, 255, .7))}[data-theme=dark] ._icon_19g82_1::-moz-selection{color:#000000b3;background-color:#ffffff40;background-color:var(--color, rgba(255, 255, 255, .25))}[data-theme=dark] ._icon_19g82_1::selection{color:#000000b3;background-color:#ffffff40;background-color:var(--color, rgba(255, 255, 255, .25))}"));
|
|
7
7
|
document.head.appendChild(elementStyle);
|
|
8
8
|
}
|
|
9
9
|
} catch (e) {
|
|
10
10
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
11
11
|
}
|
|
12
12
|
})();
|
|
13
|
-
const icon = "
|
|
13
|
+
const icon = "_icon_19g82_1";
|
|
14
14
|
const style0 = {
|
|
15
15
|
icon
|
|
16
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, normalizeClass } from "vue";
|
|
2
2
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
3
|
__name: "ElmFragmentIdentifier",
|
|
4
4
|
props: {
|
|
@@ -14,17 +14,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
14
14
|
target.scrollIntoView({ behavior: "smooth" });
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
onMounted(() => {
|
|
18
|
-
nextTick(() => {
|
|
19
|
-
const hash = window.location.hash;
|
|
20
|
-
if (hash && hash.startsWith("#")) {
|
|
21
|
-
const element = document.querySelector(hash);
|
|
22
|
-
if (element) {
|
|
23
|
-
element.scrollIntoView({ behavior: "smooth" });
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
17
|
return (_ctx, _cache) => {
|
|
29
18
|
return openBlock(), createElementBlock("span", {
|
|
30
19
|
class: normalizeClass(_ctx.$style.fragment),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, useSlots, createBlock, openBlock, resolveDynamicComponent, normalizeStyle, unref, normalizeClass, withCtx, createCommentVNode, createElementBlock, h } from "vue";
|
|
1
|
+
import { defineComponent, ref, useSlots, createBlock, openBlock, resolveDynamicComponent, normalizeStyle, unref, normalizeClass, withCtx, createCommentVNode, createElementBlock, h, isVNode } from "vue";
|
|
2
2
|
import { useIntersectionObserver } from "@vueuse/core";
|
|
3
3
|
import { kebabCase } from "lodash-es";
|
|
4
4
|
import ElmFragmentIdentifier from "./ElmFragmentIdentifier.vue.mjs";
|
|
@@ -37,6 +37,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
37
37
|
return h("span");
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
+
const extractTextFromVNode = (vnodes) => {
|
|
41
|
+
const nodes = Array.isArray(vnodes) ? vnodes : [vnodes];
|
|
42
|
+
const extract = (node) => {
|
|
43
|
+
if (typeof node.children === "string") {
|
|
44
|
+
return node.children;
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(node.children)) {
|
|
47
|
+
return node.children.map((child) => {
|
|
48
|
+
return isVNode(child) ? extract(child) : typeof child === "string" ? child : "";
|
|
49
|
+
}).join("");
|
|
50
|
+
}
|
|
51
|
+
return "";
|
|
52
|
+
};
|
|
53
|
+
return nodes.map(extract).join("");
|
|
54
|
+
};
|
|
55
|
+
const extractId = () => {
|
|
56
|
+
if (props.id) return props.id;
|
|
57
|
+
if (slots.default) return kebabCase(extractTextFromVNode(slots.default()));
|
|
58
|
+
return kebabCase(props.text);
|
|
59
|
+
};
|
|
40
60
|
return (_ctx, _cache) => {
|
|
41
61
|
return openBlock(), createBlock(resolveDynamicComponent(`h${_ctx.level}`), {
|
|
42
62
|
ref_key: "target",
|
|
@@ -57,7 +77,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
57
77
|
(openBlock(), createBlock(resolveDynamicComponent(() => renderSlots()))),
|
|
58
78
|
!_ctx.disableFragmentIdentifier ? (openBlock(), createBlock(ElmFragmentIdentifier, {
|
|
59
79
|
key: 0,
|
|
60
|
-
id:
|
|
80
|
+
id: extractId()
|
|
61
81
|
}, null, 8, ["id"])) : createCommentVNode("", true),
|
|
62
82
|
_ctx.level === 2 ? (openBlock(), createElementBlock("span", {
|
|
63
83
|
key: 1,
|
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
try {
|
|
4
4
|
if (typeof document != "undefined") {
|
|
5
5
|
var elementStyle = document.createElement("style");
|
|
6
|
-
elementStyle.appendChild(document.createTextNode('.
|
|
6
|
+
elementStyle.appendChild(document.createTextNode('._text_38tt2_1{padding:0;margin:0;white-space:pre-line;font-size:1em;font-size:var(--font-size, 1em);line-height:1em;line-height:var(--font-size, 1em);background-color:var(--background-color)}._code_38tt2_10{margin-inline:.25rem;padding:2px .5em;font-size:calc(1em - 2px);border-radius:.125rem;background-color:#00000013;font-family:"Source Code Pro" monospace}._kbd_38tt2_19{padding:.125rem .25rem;position:relative;border-radius:.125rem;background-color:#e6e6e6}[data-theme=dark] ._kbd_38tt2_19{background-color:#404040}._kbd_38tt2_19:before{z-index:-1;position:absolute;content:"";bottom:-.25em;left:0;height:100%;width:100%;background-color:#ccc;border-radius:0 0 .125rem .125rem;box-shadow:0 0 .125em #00000080}[data-theme=dark] ._kbd_38tt2_19:before{background-color:#595959;box-shadow:0 0 .125em #ffffff80}._link_38tt2_45{all:unset;box-sizing:border-box;padding:0 .25rem;font-size:var(--font-size);display:inline-flex;align-items:center;gap:.25rem;cursor:pointer;color:#6987b8;border-radius:.125rem;transition:background-color .2s,color .2s,opacity .2s}._link_38tt2_45:hover{background-color:#6987b833}._link_38tt2_45:active{opacity:.5}._link_38tt2_45:visited{color:#9771bd;border-bottom:dashed 1px #9771bd}._link_38tt2_45:visited:hover{background-color:#9771bd33}._ogp_38tt2_72{display:flex;flex-direction:column;gap:.25rem;overflow:hidden;border-radius:.25rem;box-shadow:0 0 .125rem #0000004d;background-color:#fffc}[data-theme=dark] ._ogp_38tt2_72{background-color:#ffffff1a}._ogp-text_38tt2_85{box-sizing:border-box;padding:.5rem}._ogp-title_38tt2_90{box-sizing:border-box;font-weight:700;padding-block-end:.25rem}._ogp-description_38tt2_96{opacity:.7;padding:.25rem}'));
|
|
7
7
|
document.head.appendChild(elementStyle);
|
|
8
8
|
}
|
|
9
9
|
} catch (e) {
|
|
10
10
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
11
11
|
}
|
|
12
12
|
})();
|
|
13
|
-
const text = "
|
|
14
|
-
const code = "
|
|
15
|
-
const kbd = "
|
|
16
|
-
const link = "
|
|
17
|
-
const ogp = "
|
|
13
|
+
const text = "_text_38tt2_1";
|
|
14
|
+
const code = "_code_38tt2_10";
|
|
15
|
+
const kbd = "_kbd_38tt2_19";
|
|
16
|
+
const link = "_link_38tt2_45";
|
|
17
|
+
const ogp = "_ogp_38tt2_72";
|
|
18
18
|
const style0 = {
|
|
19
19
|
text,
|
|
20
20
|
code,
|
|
21
21
|
kbd,
|
|
22
22
|
link,
|
|
23
23
|
ogp,
|
|
24
|
-
"ogp-text": "_ogp-
|
|
25
|
-
"ogp-title": "_ogp-
|
|
26
|
-
"ogp-description": "_ogp-
|
|
24
|
+
"ogp-text": "_ogp-text_38tt2_85",
|
|
25
|
+
"ogp-title": "_ogp-title_38tt2_90",
|
|
26
|
+
"ogp-description": "_ogp-description_38tt2_96"
|
|
27
27
|
};
|
|
28
28
|
export {
|
|
29
29
|
code,
|