@prokodo/ui 0.0.53 → 0.0.55
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/_virtual/_commonjsHelpers.js +9 -0
- package/dist/_virtual/common.js +7 -0
- package/dist/components/list/List.module.scss.js +0 -1
- package/dist/components/post-item/PostItem.client.js +3 -4
- package/dist/components/post-item/PostItem.server.js +3 -4
- package/dist/components/post-item/PostItem.view.js +2 -2
- package/dist/components/post-teaser/PostTeaser.client.js +5 -6
- package/dist/components/post-teaser/PostTeaser.server.js +3 -4
- package/dist/components/post-teaser/PostTeaser.view.js +4 -4
- package/dist/components/rich-text/RichText.client.js +175 -10
- package/dist/components/rich-text/RichText.module.scss.js +1 -1
- package/dist/components/slider/Slider.view.js +19 -4
- package/dist/constants/project.js +1 -1
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/common.js +5 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/common.js +90 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/core.js +1629 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/bash.js +407 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/c.js +307 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/cpp.js +556 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/csharp.js +413 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/css.js +950 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/diff.js +66 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/go.js +167 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/graphql.js +83 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/ini.js +129 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/java.js +268 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/javascript.js +715 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/json.js +53 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/kotlin.js +268 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/less.js +1031 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/lua.js +74 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/makefile.js +84 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/markdown.js +245 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/objectivec.js +256 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/perl.js +498 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/php-template.js +59 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/php.js +614 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/plaintext.js +25 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/python-repl.js +38 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/python.js +428 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/r.js +223 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/ruby.js +426 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/rust.js +326 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/scss.js +935 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/shell.js +37 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/sql.js +658 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/swift.js +893 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/typescript.js +829 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/vbnet.js +146 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/wasm.js +134 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/xml.js +239 -0
- package/dist/node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/languages/yaml.js +214 -0
- package/dist/node_modules/.pnpm/marked-highlight@2.2.2_marked@15.0.12/node_modules/marked-highlight/src/index.js +93 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/post-item/PostItem.model.d.ts +1 -1
- package/dist/types/components/post-teaser/PostTeaser.model.d.ts +1 -1
- package/dist/types/components/rich-text/RichText.client.d.ts +1 -1
- package/dist/types/components/rich-text/RichText.d.ts +5 -0
- package/dist/types/components/rich-text/RichText.lazy.d.ts +5 -0
- package/dist/types/components/rich-text/RichText.model.d.ts +5 -0
- package/dist/ui.css +98 -58
- package/package.json +3 -1
- package/dist/helpers/calculation.js +0 -6
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
function getDefaultExportFromCjs(x) {
|
|
4
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
5
|
+
}
|
|
6
|
+
__name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
|
|
7
|
+
export {
|
|
8
|
+
getDefaultExportFromCjs
|
|
9
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as requireCommon } from "../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/lib/common.js";
|
|
3
|
+
var commonExports = requireCommon();
|
|
4
|
+
const HighlightJS = /* @__PURE__ */ getDefaultExportFromCjs(commonExports);
|
|
5
|
+
export {
|
|
6
|
+
HighlightJS as default
|
|
7
|
+
};
|
|
@@ -8,7 +8,6 @@ const styles = {
|
|
|
8
8
|
"prokodo-List__item__link": "prokodo-List__item__link",
|
|
9
9
|
"prokodo-List__item__link__header": "prokodo-List__item__link__header",
|
|
10
10
|
"prokodo-List__item__icon": "prokodo-List__item__icon",
|
|
11
|
-
"prokodo-List__item__icon__svg": "prokodo-List__item__icon__svg",
|
|
12
11
|
"prokodo-List__item__icon__wrapper": "prokodo-List__item__icon__wrapper",
|
|
13
12
|
"prokodo-List__item__title--card": "prokodo-List__item__title--card",
|
|
14
13
|
"prokodo-List__item__content": "prokodo-List__item__content",
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { memo, useMemo } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { isNumber } from "../../helpers/validations.js";
|
|
5
5
|
import { PostItemView } from "./PostItem.view.js";
|
|
6
6
|
const PostItemClient = memo((props) => {
|
|
7
|
-
const {
|
|
8
|
-
const wordCount = useMemo(() => calculateWordCount(content), [content]);
|
|
7
|
+
const { wordCount, readingWpm = 200 } = props;
|
|
9
8
|
const readMinutes = useMemo(
|
|
10
|
-
() => wordCount > 0 ? Math.max(1, Math.ceil(wordCount / readingWpm)) : 0,
|
|
9
|
+
() => isNumber(wordCount) && wordCount > 0 ? Math.max(1, Math.ceil(wordCount / readingWpm)) : 0,
|
|
11
10
|
[wordCount, readingWpm]
|
|
12
11
|
);
|
|
13
12
|
return /* @__PURE__ */ jsx(PostItemView, { ...props, readMinutes, wordCount });
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { isNumber } from "../../helpers/validations.js";
|
|
5
5
|
import { PostItemView } from "./PostItem.view.js";
|
|
6
6
|
function PostItemServer(p) {
|
|
7
|
-
const {
|
|
8
|
-
const
|
|
9
|
-
const readMinutes = wordCount > 0 ? Math.max(1, Math.ceil(wordCount / readingWpm)) : 0;
|
|
7
|
+
const { wordCount, readingWpm = 200 } = p;
|
|
8
|
+
const readMinutes = isNumber(wordCount) && wordCount > 0 ? Math.max(1, Math.ceil(wordCount / readingWpm)) : 0;
|
|
10
9
|
return /* @__PURE__ */ jsx(PostItemView, { ...p, readMinutes, wordCount });
|
|
11
10
|
}
|
|
12
11
|
__name(PostItemServer, "PostItemServer");
|
|
@@ -3,7 +3,7 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
4
4
|
import { create } from "../../helpers/bem.js";
|
|
5
5
|
import { localizeDate } from "../../helpers/date.js";
|
|
6
|
-
import { isString } from "../../helpers/validations.js";
|
|
6
|
+
import { isString, isNumber } from "../../helpers/validations.js";
|
|
7
7
|
import styles from "./PostItem.module.scss.js";
|
|
8
8
|
import { PostItemAuthor } from "./PostItemAuthor.js";
|
|
9
9
|
import { Button } from "../button/Button.js";
|
|
@@ -208,7 +208,7 @@ function PostItemView(props) {
|
|
|
208
208
|
}
|
|
209
209
|
) })
|
|
210
210
|
] }),
|
|
211
|
-
wordCount > 0 && /* @__PURE__ */ jsx("meta", { content: String(wordCount), itemProp: "wordCount" }),
|
|
211
|
+
isNumber(wordCount) && wordCount > 0 && /* @__PURE__ */ jsx("meta", { content: String(wordCount), itemProp: "wordCount" }),
|
|
212
212
|
isString(category) && /* @__PURE__ */ jsx("meta", { content: category, itemProp: "articleSection" }),
|
|
213
213
|
Boolean(structuredData) && /* @__PURE__ */ jsx(
|
|
214
214
|
"script",
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { memo, useMemo, useState, useCallback } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { isNumber } from "../../helpers/validations.js";
|
|
5
5
|
import { PostTeaserView } from "./PostTeaser.view.js";
|
|
6
6
|
const PostTeaserClient = memo((props) => {
|
|
7
|
-
const {
|
|
8
|
-
const wordCount = useMemo(() => calculateWordCount(content), [content]);
|
|
7
|
+
const { readCount, readingWpm = 200 } = props;
|
|
9
8
|
const readMinutes = useMemo(
|
|
10
|
-
() =>
|
|
11
|
-
[
|
|
9
|
+
() => isNumber(readCount) && readCount > 0 ? Math.max(1, Math.ceil(readCount / readingWpm)) : 0,
|
|
10
|
+
[readCount, readingWpm]
|
|
12
11
|
);
|
|
13
12
|
const [isHovered, setIsHovered] = useState(false);
|
|
14
13
|
const handleMouseEnter = useCallback(() => setIsHovered(true), []);
|
|
@@ -18,8 +17,8 @@ const PostTeaserClient = memo((props) => {
|
|
|
18
17
|
{
|
|
19
18
|
...props,
|
|
20
19
|
isHovered,
|
|
20
|
+
readCount,
|
|
21
21
|
readMinutes,
|
|
22
|
-
wordCount,
|
|
23
22
|
onMouseEnter: handleMouseEnter,
|
|
24
23
|
onMouseLeave: handleMouseLeave
|
|
25
24
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { isNumber } from "../../helpers/validations.js";
|
|
5
5
|
import { PostTeaserView } from "./PostTeaser.view.js";
|
|
6
6
|
function PostTeaserServer(p) {
|
|
7
|
-
const {
|
|
8
|
-
const
|
|
9
|
-
const readMinutes = wordCount > 0 ? Math.max(1, Math.ceil(wordCount / readingWpm)) : 0;
|
|
7
|
+
const { wordCount, readingWpm = 200 } = p;
|
|
8
|
+
const readMinutes = isNumber(wordCount) && wordCount > 0 ? Math.max(1, Math.ceil(wordCount / readingWpm)) : 0;
|
|
10
9
|
return /* @__PURE__ */ jsx(
|
|
11
10
|
PostTeaserView,
|
|
12
11
|
{
|
|
@@ -4,7 +4,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import { isValidElement } from "react";
|
|
5
5
|
import { create } from "../../helpers/bem.js";
|
|
6
6
|
import { localizeDate } from "../../helpers/date.js";
|
|
7
|
-
import { isString } from "../../helpers/validations.js";
|
|
7
|
+
import { isString, isNumber } from "../../helpers/validations.js";
|
|
8
8
|
import styles from "./PostTeaser.module.scss.js";
|
|
9
9
|
import { Chip } from "../chip/Chip.js";
|
|
10
10
|
import { Card } from "../card/Card.js";
|
|
@@ -22,6 +22,7 @@ function PostTeaserView(props) {
|
|
|
22
22
|
componentsProps,
|
|
23
23
|
image,
|
|
24
24
|
readCount,
|
|
25
|
+
wordCount,
|
|
25
26
|
title,
|
|
26
27
|
date,
|
|
27
28
|
hideCategory,
|
|
@@ -32,7 +33,6 @@ function PostTeaserView(props) {
|
|
|
32
33
|
structuredData = true,
|
|
33
34
|
// private
|
|
34
35
|
isHovered,
|
|
35
|
-
wordCount,
|
|
36
36
|
readMinutes,
|
|
37
37
|
// passthrough hover
|
|
38
38
|
onMouseEnter,
|
|
@@ -218,7 +218,7 @@ function PostTeaserView(props) {
|
|
|
218
218
|
]
|
|
219
219
|
}
|
|
220
220
|
),
|
|
221
|
-
wordCount > 0 && /* @__PURE__ */ jsx("meta", { content: String(wordCount), itemProp: "wordCount" }),
|
|
221
|
+
isNumber(wordCount) && wordCount > 0 && /* @__PURE__ */ jsx("meta", { content: String(wordCount), itemProp: "wordCount" }),
|
|
222
222
|
isString(category) && /* @__PURE__ */ jsx("meta", { content: category, itemProp: "articleSection" }),
|
|
223
223
|
structuredData && /* @__PURE__ */ jsx(
|
|
224
224
|
"script",
|
|
@@ -231,7 +231,7 @@ function PostTeaserView(props) {
|
|
|
231
231
|
headline: title == null ? void 0 : title.content,
|
|
232
232
|
datePublished: isString(formattedDate == null ? void 0 : formattedDate.meta) ? formattedDate == null ? void 0 : formattedDate.meta : void 0,
|
|
233
233
|
articleSection: category,
|
|
234
|
-
|
|
234
|
+
readCount,
|
|
235
235
|
interactionStatistic: typeof readCount === "number" ? {
|
|
236
236
|
"@type": "InteractionCounter",
|
|
237
237
|
interactionType: { "@type": "ReadAction" },
|
|
@@ -2,18 +2,79 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import { useMemo, Fragment, Children, isValidElement, createElement } from "react";
|
|
5
|
+
import { Marked } from "../../node_modules/.pnpm/marked@15.0.12/node_modules/marked/lib/marked.esm.js";
|
|
6
|
+
import { useRef, useMemo, useState, useEffect, Fragment, Children, isValidElement, createElement } from "react";
|
|
7
7
|
import { l as libExports } from "../../_virtual/index.js";
|
|
8
8
|
import { create } from "../../helpers/bem.js";
|
|
9
|
+
import { isString } from "../../helpers/validations.js";
|
|
9
10
|
import styles from "./RichText.module.scss.js";
|
|
10
11
|
import { Icon } from "../icon/Icon.js";
|
|
11
12
|
import { Link } from "../link/Link.js";
|
|
12
13
|
import { Headline } from "../headline/Headline.js";
|
|
13
14
|
import { AnimatedText } from "../animatedText/AnimatedText.js";
|
|
14
15
|
const bem = create(styles, "RichText");
|
|
16
|
+
const xssOptions = (() => {
|
|
17
|
+
const wl = typeof libExports.getDefaultWhiteList === "function" ? libExports.getDefaultWhiteList() : {};
|
|
18
|
+
const add = /* @__PURE__ */ __name((tag) => {
|
|
19
|
+
wl[tag] = Array.from(/* @__PURE__ */ new Set([...wl[tag] ?? [], "class"]));
|
|
20
|
+
}, "add");
|
|
21
|
+
add("pre");
|
|
22
|
+
add("code");
|
|
23
|
+
add("span");
|
|
24
|
+
return {
|
|
25
|
+
whiteList: wl,
|
|
26
|
+
allowList: wl
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
15
29
|
const normalize = /* @__PURE__ */ __name((nodes) => Children.toArray(nodes), "normalize");
|
|
16
30
|
const withKey = /* @__PURE__ */ __name((el, key) => isValidElement(el) ? el.key == null ? { ...el, key } : el : el, "withKey");
|
|
31
|
+
const hasCodeBlocks = /* @__PURE__ */ __name((src) => /(^|\n)```/.test(src) || /<pre|<code/i.test(src), "hasCodeBlocks");
|
|
32
|
+
const extractFenceLangs = /* @__PURE__ */ __name((src) => {
|
|
33
|
+
const langs = /* @__PURE__ */ new Set();
|
|
34
|
+
const re = /(^|\n)```([\w+-]+)/g;
|
|
35
|
+
let m;
|
|
36
|
+
while (m = re.exec(src)) {
|
|
37
|
+
const lang = (m[2] ?? "").toLowerCase().trim();
|
|
38
|
+
if (lang) langs.add(lang);
|
|
39
|
+
}
|
|
40
|
+
return langs;
|
|
41
|
+
}, "extractFenceLangs");
|
|
42
|
+
async function prepareHljs(_langs, theme) {
|
|
43
|
+
const hljs = (await import("../../node_modules/.pnpm/highlight.js@11.11.1/node_modules/highlight.js/es/common.js")).default;
|
|
44
|
+
const version = (hljs == null ? void 0 : hljs.versionString) || "11.11.1";
|
|
45
|
+
ensureHljsThemeLoaded(version, theme);
|
|
46
|
+
return hljs;
|
|
47
|
+
}
|
|
48
|
+
__name(prepareHljs, "prepareHljs");
|
|
49
|
+
function ensureHljsThemeLoaded(version, theme) {
|
|
50
|
+
const id = "hljs-theme";
|
|
51
|
+
const existing = document.getElementById(id);
|
|
52
|
+
const {
|
|
53
|
+
href: customHref,
|
|
54
|
+
name: themeName,
|
|
55
|
+
version: themeVersion
|
|
56
|
+
} = theme ?? {};
|
|
57
|
+
let href;
|
|
58
|
+
if (typeof customHref === "string" && customHref.trim().length > 0) {
|
|
59
|
+
href = customHref;
|
|
60
|
+
} else {
|
|
61
|
+
const name = (themeName ?? "github-dark-dimmed").replace(/\.css$/i, "");
|
|
62
|
+
const ver = themeVersion === "auto" || !isString(themeVersion) ? version : themeVersion;
|
|
63
|
+
href = `https://cdnjs.cloudflare.com/ajax/libs/highlight.js/${encodeURIComponent(
|
|
64
|
+
ver
|
|
65
|
+
)}/styles/${name}.min.css`;
|
|
66
|
+
}
|
|
67
|
+
if (existing) {
|
|
68
|
+
if (existing.href !== href) existing.href = href;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const link = document.createElement("link");
|
|
72
|
+
link.id = id;
|
|
73
|
+
link.rel = "stylesheet";
|
|
74
|
+
link.href = href;
|
|
75
|
+
document.head.appendChild(link);
|
|
76
|
+
}
|
|
77
|
+
__name(ensureHljsThemeLoaded, "ensureHljsThemeLoaded");
|
|
17
78
|
function RichTextClient({
|
|
18
79
|
children,
|
|
19
80
|
animated,
|
|
@@ -24,8 +85,10 @@ function RichTextClient({
|
|
|
24
85
|
linkComponent,
|
|
25
86
|
className,
|
|
26
87
|
overrideParagraph,
|
|
88
|
+
codeTheme,
|
|
27
89
|
...props
|
|
28
90
|
}) {
|
|
91
|
+
const containerRef = useRef(null);
|
|
29
92
|
const baseProps = {
|
|
30
93
|
animated,
|
|
31
94
|
className: className ?? void 0,
|
|
@@ -36,10 +99,78 @@ function RichTextClient({
|
|
|
36
99
|
if (!Boolean(animated)) return content;
|
|
37
100
|
return typeof content === "string" ? /* @__PURE__ */ jsx(AnimatedText, { ...animationProps, children: content }) : content;
|
|
38
101
|
}, "renderAnimation");
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
102
|
+
const src = String(children ?? "");
|
|
103
|
+
const fastHtml = useMemo(() => {
|
|
104
|
+
const parser2 = new Marked({ gfm: true, breaks: true });
|
|
105
|
+
return libExports.filterXSS(parser2.parse(src), xssOptions);
|
|
106
|
+
}, [src]);
|
|
107
|
+
const [html, setHtml] = useState("");
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
let cancelled = false;
|
|
110
|
+
void (async () => {
|
|
111
|
+
if (!hasCodeBlocks(src)) {
|
|
112
|
+
if (!cancelled) setHtml(fastHtml);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const [mhMod, hljs] = await Promise.all([
|
|
116
|
+
import("../../node_modules/.pnpm/marked-highlight@2.2.2_marked@15.0.12/node_modules/marked-highlight/src/index.js"),
|
|
117
|
+
prepareHljs(extractFenceLangs(src), codeTheme)
|
|
118
|
+
]);
|
|
119
|
+
const markedHighlight = (
|
|
120
|
+
// support both module shapes
|
|
121
|
+
mhMod.markedHighlight ?? mhMod.default
|
|
122
|
+
);
|
|
123
|
+
if (typeof markedHighlight !== "function") {
|
|
124
|
+
console.error(
|
|
125
|
+
"[RichText] marked-highlight not resolved; no code styling will be applied."
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
const parser2 = new Marked(
|
|
129
|
+
markedHighlight({
|
|
130
|
+
emptyLangClass: "hljs",
|
|
131
|
+
langPrefix: "hljs language-",
|
|
132
|
+
highlight(code, lang) {
|
|
133
|
+
try {
|
|
134
|
+
if (isString(lang) && hljs.getLanguage(lang)) {
|
|
135
|
+
return hljs.highlight(code, { language: lang }).value;
|
|
136
|
+
}
|
|
137
|
+
return hljs.highlightAuto(code).value;
|
|
138
|
+
} catch {
|
|
139
|
+
return code;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}),
|
|
143
|
+
{ gfm: true, breaks: true }
|
|
144
|
+
);
|
|
145
|
+
const step1 = libExports.filterXSS(parser2.parse(src), xssOptions);
|
|
146
|
+
const hasRawBlocks = /<pre[^>]*>\s*<code[^>]*>/.test(step1) && !/<span[^>]+class="[^"]*hljs-/.test(step1);
|
|
147
|
+
if (!hasRawBlocks) {
|
|
148
|
+
if (!cancelled) setHtml(step1);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const doc2 = new DOMParser().parseFromString(step1, "text/html");
|
|
152
|
+
doc2.querySelectorAll("pre code").forEach((codeEl) => {
|
|
153
|
+
var _a;
|
|
154
|
+
try {
|
|
155
|
+
const cls = codeEl.getAttribute("class") ?? "";
|
|
156
|
+
const m = cls.match(/language-([\w+-]+)/);
|
|
157
|
+
const lang = m == null ? void 0 : m[1];
|
|
158
|
+
const text = codeEl.textContent ?? "";
|
|
159
|
+
const html2 = isString(lang) && hljs.getLanguage(lang) ? hljs.highlight(text, { language: lang }).value : hljs.highlightAuto(text).value;
|
|
160
|
+
codeEl.innerHTML = html2;
|
|
161
|
+
codeEl.classList.add("hljs");
|
|
162
|
+
(_a = codeEl.closest("pre")) == null ? void 0 : _a.classList.add("hljs");
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
const step2 = doc2.body.innerHTML;
|
|
167
|
+
if (!cancelled) setHtml(step2);
|
|
168
|
+
})();
|
|
169
|
+
return () => {
|
|
170
|
+
cancelled = true;
|
|
171
|
+
};
|
|
172
|
+
}, [src, fastHtml, codeTheme]);
|
|
173
|
+
const safeHtml = html || fastHtml;
|
|
43
174
|
const VOID_TAGS = /* @__PURE__ */ new Set([
|
|
44
175
|
"area",
|
|
45
176
|
"base",
|
|
@@ -134,8 +265,22 @@ function RichTextClient({
|
|
|
134
265
|
);
|
|
135
266
|
}
|
|
136
267
|
case "pre": {
|
|
137
|
-
const
|
|
138
|
-
return /* @__PURE__ */ jsx("pre", { className:
|
|
268
|
+
const existing = elem.getAttribute("class");
|
|
269
|
+
return /* @__PURE__ */ jsx("pre", { className: [bem("pre"), existing].filter(Boolean).join(" "), children: keyedChildren });
|
|
270
|
+
}
|
|
271
|
+
case "code": {
|
|
272
|
+
const existing = elem.getAttribute("class");
|
|
273
|
+
return /* @__PURE__ */ jsx("code", { className: [bem("code"), existing].filter(Boolean).join(" "), children: keyedChildren });
|
|
274
|
+
}
|
|
275
|
+
case "blockquote": {
|
|
276
|
+
const existing = elem.getAttribute("class");
|
|
277
|
+
return /* @__PURE__ */ jsx(
|
|
278
|
+
"blockquote",
|
|
279
|
+
{
|
|
280
|
+
className: [bem("blockquote"), existing].filter(Boolean).join(" "),
|
|
281
|
+
children: keyedChildren
|
|
282
|
+
}
|
|
283
|
+
);
|
|
139
284
|
}
|
|
140
285
|
case "ul": {
|
|
141
286
|
const cls = bem("ul");
|
|
@@ -143,7 +288,23 @@ function RichTextClient({
|
|
|
143
288
|
}
|
|
144
289
|
case "ol": {
|
|
145
290
|
const cls = bem("ol");
|
|
146
|
-
|
|
291
|
+
const startAttr = elem.getAttribute("start");
|
|
292
|
+
const start = isString(startAttr) ? parseInt(startAttr, 10) || 1 : 1;
|
|
293
|
+
const liElems = Array.from(elem.children).filter(
|
|
294
|
+
(e) => e.tagName.toLowerCase() === "li"
|
|
295
|
+
);
|
|
296
|
+
return /* @__PURE__ */ jsx("ol", { className: cls, children: liElems.map((liEl, index) => {
|
|
297
|
+
const contentNodes = Array.from(liEl.childNodes).map(
|
|
298
|
+
(child, i) => domNodeToReact(child, `${path}.li${index}.${i}`)
|
|
299
|
+
);
|
|
300
|
+
return (
|
|
301
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
302
|
+
/* @__PURE__ */ jsxs("li", { className: bem("li"), children: [
|
|
303
|
+
/* @__PURE__ */ jsx("i", { className: bem("ol__decimal"), children: start + index }),
|
|
304
|
+
/* @__PURE__ */ jsx("span", { className: bem("li__content"), children: normalize(contentNodes.map(renderAnimation)) })
|
|
305
|
+
] }, `ol-li-${index}`)
|
|
306
|
+
);
|
|
307
|
+
}) });
|
|
147
308
|
}
|
|
148
309
|
case "li": {
|
|
149
310
|
const cls = bem("li");
|
|
@@ -162,7 +323,10 @@ function RichTextClient({
|
|
|
162
323
|
] });
|
|
163
324
|
}
|
|
164
325
|
default: {
|
|
165
|
-
const
|
|
326
|
+
const existing = elem.getAttribute("class");
|
|
327
|
+
const props2 = {
|
|
328
|
+
className: [bem(tagName), existing].filter(Boolean).join(" ")
|
|
329
|
+
};
|
|
166
330
|
if (tagName === "img") {
|
|
167
331
|
props2.src = elem.getAttribute("src") ?? "";
|
|
168
332
|
props2.alt = elem.getAttribute("alt") ?? "";
|
|
@@ -197,6 +361,7 @@ function RichTextClient({
|
|
|
197
361
|
return /* @__PURE__ */ jsx(
|
|
198
362
|
"div",
|
|
199
363
|
{
|
|
364
|
+
ref: containerRef,
|
|
200
365
|
className: bem(void 0, void 0, className),
|
|
201
366
|
...schema,
|
|
202
367
|
...props,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const styles = {
|
|
2
2
|
"prokodo-RichText__a": "prokodo-RichText__a",
|
|
3
|
-
"prokodo-RichText": "prokodo-RichText",
|
|
4
3
|
"prokodo-RichText__p": "prokodo-RichText__p",
|
|
5
4
|
"prokodo-RichText__pre": "prokodo-RichText__pre",
|
|
5
|
+
"prokodo-RichText__blockquote": "prokodo-RichText__blockquote",
|
|
6
6
|
"prokodo-RichText__ul": "prokodo-RichText__ul",
|
|
7
7
|
"prokodo-RichText__ol": "prokodo-RichText__ol",
|
|
8
8
|
"prokodo-RichText__li": "prokodo-RichText__li",
|
|
@@ -100,10 +100,25 @@ const SliderView = /* @__PURE__ */ __name(({
|
|
|
100
100
|
{
|
|
101
101
|
...valueLabelProps,
|
|
102
102
|
className: bem("valueText", { focused: isFocused }),
|
|
103
|
-
style: {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
style: (() => {
|
|
104
|
+
const EDGE_PAD_PX = 8;
|
|
105
|
+
if (pct <= 10) {
|
|
106
|
+
return {
|
|
107
|
+
left: "0%",
|
|
108
|
+
transform: `translateX(${EDGE_PAD_PX}px)`
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (pct >= 90) {
|
|
112
|
+
return {
|
|
113
|
+
left: "100%",
|
|
114
|
+
transform: `translateX(calc(-100% - ${EDGE_PAD_PX}px))`
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
left: `${pct}%`,
|
|
119
|
+
transform: "translateX(-50%)"
|
|
120
|
+
};
|
|
121
|
+
})(),
|
|
107
122
|
children: internalValue
|
|
108
123
|
}
|
|
109
124
|
),
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { __require as requireCore } from "./core.js";
|
|
4
|
+
import { __require as requireXml } from "./languages/xml.js";
|
|
5
|
+
import { __require as requireBash } from "./languages/bash.js";
|
|
6
|
+
import { __require as requireC } from "./languages/c.js";
|
|
7
|
+
import { __require as requireCpp } from "./languages/cpp.js";
|
|
8
|
+
import { __require as requireCsharp } from "./languages/csharp.js";
|
|
9
|
+
import { __require as requireCss } from "./languages/css.js";
|
|
10
|
+
import { __require as requireMarkdown } from "./languages/markdown.js";
|
|
11
|
+
import { __require as requireDiff } from "./languages/diff.js";
|
|
12
|
+
import { __require as requireRuby } from "./languages/ruby.js";
|
|
13
|
+
import { __require as requireGo } from "./languages/go.js";
|
|
14
|
+
import { __require as requireGraphql } from "./languages/graphql.js";
|
|
15
|
+
import { __require as requireIni } from "./languages/ini.js";
|
|
16
|
+
import { __require as requireJava } from "./languages/java.js";
|
|
17
|
+
import { __require as requireJavascript } from "./languages/javascript.js";
|
|
18
|
+
import { __require as requireJson } from "./languages/json.js";
|
|
19
|
+
import { __require as requireKotlin } from "./languages/kotlin.js";
|
|
20
|
+
import { __require as requireLess } from "./languages/less.js";
|
|
21
|
+
import { __require as requireLua } from "./languages/lua.js";
|
|
22
|
+
import { __require as requireMakefile } from "./languages/makefile.js";
|
|
23
|
+
import { __require as requirePerl } from "./languages/perl.js";
|
|
24
|
+
import { __require as requireObjectivec } from "./languages/objectivec.js";
|
|
25
|
+
import { __require as requirePhp } from "./languages/php.js";
|
|
26
|
+
import { __require as requirePhpTemplate } from "./languages/php-template.js";
|
|
27
|
+
import { __require as requirePlaintext } from "./languages/plaintext.js";
|
|
28
|
+
import { __require as requirePython } from "./languages/python.js";
|
|
29
|
+
import { __require as requirePythonRepl } from "./languages/python-repl.js";
|
|
30
|
+
import { __require as requireR } from "./languages/r.js";
|
|
31
|
+
import { __require as requireRust } from "./languages/rust.js";
|
|
32
|
+
import { __require as requireScss } from "./languages/scss.js";
|
|
33
|
+
import { __require as requireShell } from "./languages/shell.js";
|
|
34
|
+
import { __require as requireSql } from "./languages/sql.js";
|
|
35
|
+
import { __require as requireSwift } from "./languages/swift.js";
|
|
36
|
+
import { __require as requireYaml } from "./languages/yaml.js";
|
|
37
|
+
import { __require as requireTypescript } from "./languages/typescript.js";
|
|
38
|
+
import { __require as requireVbnet } from "./languages/vbnet.js";
|
|
39
|
+
import { __require as requireWasm } from "./languages/wasm.js";
|
|
40
|
+
var common;
|
|
41
|
+
var hasRequiredCommon;
|
|
42
|
+
function requireCommon() {
|
|
43
|
+
if (hasRequiredCommon) return common;
|
|
44
|
+
hasRequiredCommon = 1;
|
|
45
|
+
var hljs = /* @__PURE__ */ requireCore();
|
|
46
|
+
hljs.registerLanguage("xml", /* @__PURE__ */ requireXml());
|
|
47
|
+
hljs.registerLanguage("bash", /* @__PURE__ */ requireBash());
|
|
48
|
+
hljs.registerLanguage("c", /* @__PURE__ */ requireC());
|
|
49
|
+
hljs.registerLanguage("cpp", /* @__PURE__ */ requireCpp());
|
|
50
|
+
hljs.registerLanguage("csharp", /* @__PURE__ */ requireCsharp());
|
|
51
|
+
hljs.registerLanguage("css", /* @__PURE__ */ requireCss());
|
|
52
|
+
hljs.registerLanguage("markdown", /* @__PURE__ */ requireMarkdown());
|
|
53
|
+
hljs.registerLanguage("diff", /* @__PURE__ */ requireDiff());
|
|
54
|
+
hljs.registerLanguage("ruby", /* @__PURE__ */ requireRuby());
|
|
55
|
+
hljs.registerLanguage("go", /* @__PURE__ */ requireGo());
|
|
56
|
+
hljs.registerLanguage("graphql", /* @__PURE__ */ requireGraphql());
|
|
57
|
+
hljs.registerLanguage("ini", /* @__PURE__ */ requireIni());
|
|
58
|
+
hljs.registerLanguage("java", /* @__PURE__ */ requireJava());
|
|
59
|
+
hljs.registerLanguage("javascript", /* @__PURE__ */ requireJavascript());
|
|
60
|
+
hljs.registerLanguage("json", /* @__PURE__ */ requireJson());
|
|
61
|
+
hljs.registerLanguage("kotlin", /* @__PURE__ */ requireKotlin());
|
|
62
|
+
hljs.registerLanguage("less", /* @__PURE__ */ requireLess());
|
|
63
|
+
hljs.registerLanguage("lua", /* @__PURE__ */ requireLua());
|
|
64
|
+
hljs.registerLanguage("makefile", /* @__PURE__ */ requireMakefile());
|
|
65
|
+
hljs.registerLanguage("perl", /* @__PURE__ */ requirePerl());
|
|
66
|
+
hljs.registerLanguage("objectivec", /* @__PURE__ */ requireObjectivec());
|
|
67
|
+
hljs.registerLanguage("php", /* @__PURE__ */ requirePhp());
|
|
68
|
+
hljs.registerLanguage("php-template", /* @__PURE__ */ requirePhpTemplate());
|
|
69
|
+
hljs.registerLanguage("plaintext", /* @__PURE__ */ requirePlaintext());
|
|
70
|
+
hljs.registerLanguage("python", /* @__PURE__ */ requirePython());
|
|
71
|
+
hljs.registerLanguage("python-repl", /* @__PURE__ */ requirePythonRepl());
|
|
72
|
+
hljs.registerLanguage("r", /* @__PURE__ */ requireR());
|
|
73
|
+
hljs.registerLanguage("rust", /* @__PURE__ */ requireRust());
|
|
74
|
+
hljs.registerLanguage("scss", /* @__PURE__ */ requireScss());
|
|
75
|
+
hljs.registerLanguage("shell", /* @__PURE__ */ requireShell());
|
|
76
|
+
hljs.registerLanguage("sql", /* @__PURE__ */ requireSql());
|
|
77
|
+
hljs.registerLanguage("swift", /* @__PURE__ */ requireSwift());
|
|
78
|
+
hljs.registerLanguage("yaml", /* @__PURE__ */ requireYaml());
|
|
79
|
+
hljs.registerLanguage("typescript", /* @__PURE__ */ requireTypescript());
|
|
80
|
+
hljs.registerLanguage("vbnet", /* @__PURE__ */ requireVbnet());
|
|
81
|
+
hljs.registerLanguage("wasm", /* @__PURE__ */ requireWasm());
|
|
82
|
+
hljs.HighlightJS = hljs;
|
|
83
|
+
hljs.default = hljs;
|
|
84
|
+
common = hljs;
|
|
85
|
+
return common;
|
|
86
|
+
}
|
|
87
|
+
__name(requireCommon, "requireCommon");
|
|
88
|
+
export {
|
|
89
|
+
requireCommon as __require
|
|
90
|
+
};
|