@airalogy/aimd-renderer 2.6.0 → 2.7.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/README.md +38 -0
- package/README.zh-CN.md +38 -0
- package/dist/aimd-renderer.css +1 -1
- package/dist/common/criticMarkup.d.ts +10 -0
- package/dist/common/criticMarkup.d.ts.map +1 -0
- package/dist/common/processor.d.ts.map +1 -1
- package/dist/html.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +80 -73
- package/dist/{processor-CHbNEcN8.js → processor-BOCQYqXE.js} +1899 -1573
- package/dist/readonly-record-renderer-CkzY7UvT.js +711 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/readonly-record-renderer.d.ts +42 -0
- package/dist/vue/readonly-record-renderer.d.ts.map +1 -0
- package/dist/vue.js +20 -13
- package/package.json +2 -2
- package/src/__tests__/renderer.test.ts +244 -1
- package/src/common/criticMarkup.ts +97 -0
- package/src/common/processor.ts +13 -2
- package/src/index.ts +18 -0
- package/src/styles/katex.css +65 -0
- package/src/vue/index.ts +18 -0
- package/src/vue/readonly-record-renderer.ts +747 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Element } from "hast";
|
|
2
|
+
import type { AimdCriticMarkupBaseNode, AimdCriticSubstitutionNode } from "@airalogy/aimd-core/types";
|
|
3
|
+
export declare const criticMarkupHandlers: {
|
|
4
|
+
criticAddition(state: any, node: AimdCriticMarkupBaseNode): Element;
|
|
5
|
+
criticDeletion(state: any, node: AimdCriticMarkupBaseNode): Element;
|
|
6
|
+
criticHighlight(state: any, node: AimdCriticMarkupBaseNode): Element;
|
|
7
|
+
criticComment(_state: any, node: AimdCriticMarkupBaseNode): Element;
|
|
8
|
+
criticSubstitution(state: any, node: AimdCriticSubstitutionNode): Element;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=criticMarkup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"criticMarkup.d.ts","sourceRoot":"","sources":["../../src/common/criticMarkup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAoB,MAAM,MAAM,CAAA;AACrD,OAAO,KAAK,EACV,wBAAwB,EAGxB,0BAA0B,EAC3B,MAAM,2BAA2B,CAAA;AA+ClC,eAAO,MAAM,oBAAoB;0BACT,GAAG,QAAQ,wBAAwB,GAAG,OAAO;0BAI7C,GAAG,QAAQ,wBAAwB,GAAG,OAAO;2BAI5C,GAAG,QAAQ,wBAAwB,GAAG,OAAO;0BAI9C,GAAG,QAAQ,wBAAwB,GAAG,OAAO;8BAkBzC,GAAG,QAAQ,0BAA0B,GAAG,OAAO;CAY1E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../src/common/processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,QAAQ,EAAoB,MAAM,MAAM,CAAA;AAEnF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAChC,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EAGR,gBAAgB,EAChB,aAAa,EACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AACpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../src/common/processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,QAAQ,EAAoB,MAAM,MAAM,CAAA;AAEnF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,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,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,mBAAmB,CAAA;KAAE,CAAC;IAIrF;;OAEG;mBAEQ,MAAM,kBACC,kBAAkB,GACjC,OAAO,CAAC,YAAY,CAAC;IAIxB;;OAEG;2BACoB,MAAM,GAAG,mBAAmB;CAOR,CAAA"}
|
package/dist/html.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as a, c as s, a as t, b as d, p as m, r as o, d as c, e as n } from "./processor-
|
|
1
|
+
import { D as a, c as s, a as t, b as d, p as m, r as o, d as c, e as n } from "./processor-BOCQYqXE.js";
|
|
2
2
|
export {
|
|
3
3
|
a as DEFAULT_AIMD_RENDERER_LOCALE,
|
|
4
4
|
s as createAimdRendererMessages,
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { createCustomElementAimdRenderer, createHtmlProcessor, createRenderer, d
|
|
|
7
7
|
export { createAimdRendererMessages, DEFAULT_AIMD_RENDERER_LOCALE, getAimdRendererQuizTypeLabel, resolveAimdRendererLocale, } from './locales';
|
|
8
8
|
export { bubbleMenuEventKey, draftEventKey, fieldEventKey, protocolKey, reportEventKey, } from './common/eventKeys';
|
|
9
9
|
export { type AssetResponse, createUnifiedTokenRenderer, type TokenLike, type TokenProps, type UnifiedRendererContext, type UnifiedTokenRendererOptions, } from './common/unified-token-renderer';
|
|
10
|
+
export { AIMD_RECORD_RENDER_SCOPES, createReadonlyRecordAimdRenderers, createReadonlyRecordElementRenderers, createReadonlyRecordRenderContext, normalizeRecordRenderValue, renderReadonlyRecordToVue, type AimdRecordRenderScope, type AimdRecordRenderValue, type ReadonlyRecordAsset, type ReadonlyRecordAssetKind, type ReadonlyRecordAssetResolveContext, type ReadonlyRecordAssetResolver, type ReadonlyRecordMarkdownRenderOptions, type ReadonlyRecordRenderContextInput, type ReadonlyRecordVueRendererOptions, } from './vue/readonly-record-renderer';
|
|
10
11
|
export { type AimdComponentRenderer, type AimdRendererContext, type AssetResolver, createAssetRenderer, createCodeBlockRenderer, createComponentRenderer, createEmbeddedRenderer, createMermaidRenderer, createStepCardRenderer, loadShikiHighlighter, type CodeBlockRendererOptions, type ElementRenderer, hastToVue, renderToVNodes, type LoadShikiHighlighterOptions, type AimdStepCardRendererOptions, type ShikiHighlighter, type VueRendererOptions, } from './vue/vue-renderer';
|
|
11
12
|
export type { ProcessorOptions, RenderContext, RenderMode, RenderNode, TokenRenderRule, } from '@airalogy/aimd-core/types';
|
|
12
13
|
export type { AimdAssignerVisibility, AimdHtmlNodeRenderer, AimdHtmlRendererContext, CustomElementAimdRendererOptions, AimdRendererOptions, RenderResult, } from './common/processor';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,WAAW,GACZ,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,WAAW,EACX,cAAc,GACf,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,KAAK,aAAa,EAClB,0BAA0B,EAC1B,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,GACjC,MAAM,iCAAiC,CAAA;AAGxC,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,wBAAwB,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ED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAQhF"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { D as pe, f as ue, g as fe, h as _e, a as ye, i as ge, b as ve, j as he, k as be, l as
|
|
1
|
+
import { e as F, c as M, p as I, s as B, u as H, v as z, w as V, t as j, x as O, y as K, z as N, A as Q } from "./processor-BOCQYqXE.js";
|
|
2
|
+
import { D as pe, f as ue, g as fe, h as _e, a as ye, i as ge, b as ve, j as he, k as be, l as Re, m as Ae, n as we, o as xe, r as Te, d as ke, q as qe } from "./processor-BOCQYqXE.js";
|
|
3
3
|
import { h as e } from "vue";
|
|
4
|
+
import { A as $e, c as ze, a as Ee, b as Pe, n as Le, r as Ce } from "./readonly-record-renderer-CkzY7UvT.js";
|
|
4
5
|
const te = /* @__PURE__ */ Symbol("symbol-field-event-key"), ie = /* @__PURE__ */ Symbol("symbol-protocol-key"), se = /* @__PURE__ */ Symbol("draft-event-key"), re = /* @__PURE__ */ Symbol("symbol-report-event-key"), ne = /* @__PURE__ */ Symbol("symbol-bubble-menu-event-key");
|
|
5
6
|
function U(a) {
|
|
6
7
|
return a === "var_table" ? "table" : a;
|
|
@@ -22,16 +23,16 @@ function E(a, i) {
|
|
|
22
23
|
}
|
|
23
24
|
return l < i.length && r.push(e("span", i.slice(l))), r.length === 0 && r.push(e("span", i)), r;
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function P(a) {
|
|
26
27
|
return typeof a.points == "number" && Number.isFinite(a.points) ? `${a.text} (${a.points})` : a.text;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function L(a) {
|
|
29
30
|
return !Array.isArray(a.items) || a.items.length === 0 || !Array.isArray(a.options) || a.options.length === 0 ? [e("div", { class: "aimd-scale__empty" }, "Scale definition is incomplete.")] : a.display === "list" ? [
|
|
30
31
|
e("div", { class: "aimd-scale__list" }, a.items.map(
|
|
31
32
|
(i) => e("div", { class: "aimd-scale__list-item" }, [
|
|
32
33
|
e("div", { class: "aimd-scale__item-stem" }, i.stem),
|
|
33
34
|
e("ul", { class: "aimd-scale__item-options" }, a.options.map(
|
|
34
|
-
(r) => e("li",
|
|
35
|
+
(r) => e("li", P(r))
|
|
35
36
|
))
|
|
36
37
|
])
|
|
37
38
|
))
|
|
@@ -40,7 +41,7 @@ function P(a) {
|
|
|
40
41
|
e("thead", [
|
|
41
42
|
e("tr", [
|
|
42
43
|
e("th", { class: "aimd-scale__item-header" }, "Item"),
|
|
43
|
-
...a.options.map((i) => e("th",
|
|
44
|
+
...a.options.map((i) => e("th", P(i)))
|
|
44
45
|
])
|
|
45
46
|
]),
|
|
46
47
|
e("tbody", a.items.map(
|
|
@@ -52,7 +53,7 @@ function P(a) {
|
|
|
52
53
|
])
|
|
53
54
|
];
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function C(a) {
|
|
56
57
|
const i = Array.isArray(a.grading?.bands) ? a.grading.bands : [];
|
|
57
58
|
return i.length === 0 ? [] : [
|
|
58
59
|
e("ul", { class: "aimd-scale__bands" }, i.map(
|
|
@@ -61,7 +62,7 @@ function M(a) {
|
|
|
61
62
|
];
|
|
62
63
|
}
|
|
63
64
|
function J(a) {
|
|
64
|
-
const i =
|
|
65
|
+
const i = K(a), r = N(a).map(Q).map((d) => d.trim()).filter(Boolean), l = r.length > 0 ? `e.g. ${r.join(", ")}` : void 0;
|
|
65
66
|
return {
|
|
66
67
|
tooltip: [i, l].filter((d) => !!d).join(`
|
|
67
68
|
`),
|
|
@@ -87,7 +88,7 @@ function G(a) {
|
|
|
87
88
|
}, i);
|
|
88
89
|
}
|
|
89
90
|
function $(a, i) {
|
|
90
|
-
const r = j(a, i), l =
|
|
91
|
+
const r = j(a, i), l = O(i) !== void 0 && r !== a, n = J(i), d = !!n.description || n.examples.length > 0;
|
|
91
92
|
return e("span", {
|
|
92
93
|
class: [
|
|
93
94
|
"aimd-field__name",
|
|
@@ -102,7 +103,7 @@ function $(a, i) {
|
|
|
102
103
|
G(n)
|
|
103
104
|
]);
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function k(a, i, r, l, n) {
|
|
106
107
|
const d = U(a), g = z(a, r);
|
|
107
108
|
if (a === "var_table") {
|
|
108
109
|
const u = [
|
|
@@ -138,22 +139,22 @@ function R(a, i, r, l, n) {
|
|
|
138
139
|
]);
|
|
139
140
|
}
|
|
140
141
|
function X(a) {
|
|
141
|
-
const { getTokenProps: i, mode: r, components: l = {} } = a, n =
|
|
142
|
+
const { getTokenProps: i, mode: r, components: l = {} } = a, n = M(a.locale, a.messages), {
|
|
142
143
|
AIMDItem: d,
|
|
143
144
|
AIMDTag: g,
|
|
144
145
|
AIMDStepRef: p,
|
|
145
146
|
StepRenderer: u,
|
|
146
147
|
CheckRenderer: b,
|
|
147
148
|
PreviewRenderer: _
|
|
148
|
-
} = l,
|
|
149
|
+
} = l, A = () => typeof r == "function" ? r() : r, R = () => A() === "preview", w = () => V(A(), a.quizPreview);
|
|
149
150
|
return {
|
|
150
151
|
var: async (o, y, f) => {
|
|
151
152
|
const t = o, { id: s, scope: c } = t, m = t.definition;
|
|
152
|
-
if (
|
|
153
|
+
if (R())
|
|
153
154
|
return _ ? e(_, { type: "var" }, {
|
|
154
155
|
default: () => f,
|
|
155
156
|
name: () => s
|
|
156
|
-
}) :
|
|
157
|
+
}) : k(c, s, n, void 0, m);
|
|
157
158
|
if (i && d) {
|
|
158
159
|
const v = await i({ meta: { node: { id: s, scope: c } } });
|
|
159
160
|
if (v)
|
|
@@ -163,24 +164,24 @@ function X(a) {
|
|
|
163
164
|
"data-has-variable": "true"
|
|
164
165
|
}, [e(d, v)]);
|
|
165
166
|
}
|
|
166
|
-
return
|
|
167
|
+
return k(c, s, n, void 0, m);
|
|
167
168
|
},
|
|
168
169
|
var_table: async (o, y, f) => {
|
|
169
170
|
const t = o, { id: s, scope: c, columns: m } = t, v = t.definition;
|
|
170
|
-
if (
|
|
171
|
+
if (R())
|
|
171
172
|
return _ ? e(_, { type: "var_table" }, {
|
|
172
173
|
default: () => f,
|
|
173
174
|
name: () => s
|
|
174
|
-
}) :
|
|
175
|
+
}) : k(c, s, n, m, v);
|
|
175
176
|
if (i && g) {
|
|
176
|
-
const
|
|
177
|
-
return e(g, { ...
|
|
177
|
+
const x = await i({ meta: { node: { id: s, scope: c } } });
|
|
178
|
+
return e(g, { ...x, props: m });
|
|
178
179
|
}
|
|
179
|
-
return
|
|
180
|
+
return k(c, s, n, m, v);
|
|
180
181
|
},
|
|
181
182
|
quiz: async (o, y, f) => {
|
|
182
|
-
const t = o, { id: s, scope: c, quizType: m, stem: v, score:
|
|
183
|
-
if (
|
|
183
|
+
const t = o, { id: s, scope: c, quizType: m, stem: v, score: x } = t, q = H(m, t.mode, n);
|
|
184
|
+
if (R()) {
|
|
184
185
|
if (_)
|
|
185
186
|
return e(_, { type: "quiz" }, {
|
|
186
187
|
default: () => f,
|
|
@@ -191,25 +192,25 @@ function X(a) {
|
|
|
191
192
|
e("span", { class: "aimd-field__scope" }, z(c, n)),
|
|
192
193
|
e("span", { class: "aimd-field__name" }, s),
|
|
193
194
|
e("span", { class: "aimd-field__type" }, `(${q})`),
|
|
194
|
-
|
|
195
|
+
x !== void 0 ? e("span", { class: "aimd-quiz__score" }, n.quiz.score(x)) : null
|
|
195
196
|
]),
|
|
196
197
|
e("div", { class: "aimd-quiz__stem" }, E(m, v || s))
|
|
197
198
|
];
|
|
198
199
|
typeof t.title == "string" && t.title.trim() && h.splice(1, 0, e("div", { class: "aimd-quiz__title" }, t.title)), typeof t.description == "string" && t.description.trim() && h.push(e("div", { class: "aimd-quiz__description" }, t.description)), (m === "choice" || m === "true_false") && Array.isArray(t.options) && t.options.length > 0 && h.push(
|
|
199
200
|
e("ul", { class: "aimd-quiz__options" }, t.options.map(
|
|
200
|
-
(
|
|
201
|
+
(T) => e("li", `${T.key}. ${T.text}`)
|
|
201
202
|
))
|
|
202
|
-
), m === "scale" && (h.push(...
|
|
203
|
-
const S =
|
|
203
|
+
), m === "scale" && (h.push(...L(t)), h.push(...C(t)));
|
|
204
|
+
const S = w();
|
|
204
205
|
if (S.showAnswers && (m === "choice" || m === "true_false") && t.answer !== void 0) {
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
e("div", { class: "aimd-quiz__answer" }, n.quiz.answer(
|
|
206
|
+
const T = Array.isArray(t.answer) ? t.answer.join(", ") : String(t.answer);
|
|
207
|
+
T.trim() && h.push(
|
|
208
|
+
e("div", { class: "aimd-quiz__answer" }, n.quiz.answer(T))
|
|
208
209
|
);
|
|
209
210
|
}
|
|
210
211
|
return S.showAnswers && m === "blank" && Array.isArray(t.blanks) && t.blanks.length > 0 && h.push(
|
|
211
212
|
e("ul", { class: "aimd-quiz__blanks" }, t.blanks.map(
|
|
212
|
-
(
|
|
213
|
+
(T) => e("li", `${T.key}: ${T.answer}`)
|
|
213
214
|
))
|
|
214
215
|
), S.showRubric && m === "open" && typeof t.rubric == "string" && t.rubric.trim() && h.push(
|
|
215
216
|
e("div", { class: "aimd-quiz__rubric" }, n.quiz.rubric(t.rubric))
|
|
@@ -241,20 +242,20 @@ function X(a) {
|
|
|
241
242
|
...typeof t.title == "string" && t.title.trim() ? [e("div", { class: "aimd-quiz__title" }, t.title)] : [],
|
|
242
243
|
e("div", { class: "aimd-quiz__stem" }, E(m, v || s)),
|
|
243
244
|
...typeof t.description == "string" && t.description.trim() ? [e("div", { class: "aimd-quiz__description" }, t.description)] : [],
|
|
244
|
-
...m === "scale" ? [...
|
|
245
|
+
...m === "scale" ? [...L(t), ...C(t)] : []
|
|
245
246
|
]);
|
|
246
247
|
},
|
|
247
248
|
step: async (o, y, f) => {
|
|
248
249
|
const t = o, { id: s, scope: c, step: m, check: v } = t;
|
|
249
|
-
if (
|
|
250
|
+
if (R())
|
|
250
251
|
return _ ? e(_, { type: "step" }, {
|
|
251
252
|
default: () => f,
|
|
252
253
|
name: () => s
|
|
253
254
|
}) : e("span", { class: "research-step__sequence" }, n.step.sequence(m));
|
|
254
255
|
if (i && u) {
|
|
255
|
-
const
|
|
256
|
+
const x = await i({ meta: { node: { id: s, scope: c } } }), q = await i({ meta: { node: { id: s, scope: c, type: "step-annotation" } } });
|
|
256
257
|
return e(u, {
|
|
257
|
-
item:
|
|
258
|
+
item: x,
|
|
258
259
|
annotationItem: q,
|
|
259
260
|
name: s,
|
|
260
261
|
step: String(m),
|
|
@@ -267,22 +268,22 @@ function X(a) {
|
|
|
267
268
|
},
|
|
268
269
|
check: async (o, y, f) => {
|
|
269
270
|
const t = o, { id: s, scope: c, label: m } = t;
|
|
270
|
-
if (
|
|
271
|
+
if (R())
|
|
271
272
|
return _ ? e(_, { type: "check" }, {
|
|
272
273
|
default: () => f,
|
|
273
274
|
name: () => s
|
|
274
|
-
}) :
|
|
275
|
+
}) : k(c, s, n);
|
|
275
276
|
if (i && b) {
|
|
276
|
-
const v = await i({ meta: { node: { id: s, scope: c } } }),
|
|
277
|
+
const v = await i({ meta: { node: { id: s, scope: c } } }), x = await i({ meta: { node: { id: s, scope: c, type: "check-annotation" } } });
|
|
277
278
|
return e(b, {
|
|
278
279
|
item: v,
|
|
279
|
-
annotationItem:
|
|
280
|
+
annotationItem: x,
|
|
280
281
|
name: s
|
|
281
282
|
}, {
|
|
282
283
|
default: () => f
|
|
283
284
|
});
|
|
284
285
|
}
|
|
285
|
-
return
|
|
286
|
+
return k(c, s, n);
|
|
286
287
|
},
|
|
287
288
|
ref_step: (o, y) => {
|
|
288
289
|
const { id: f } = o, t = "refTarget" in o ? o.refTarget : f, s = "stepSequence" in o && typeof o.stepSequence == "string" ? o.stepSequence : void 0, c = s ? n.step.reference(s) : t;
|
|
@@ -334,16 +335,16 @@ function X(a) {
|
|
|
334
335
|
}
|
|
335
336
|
};
|
|
336
337
|
}
|
|
337
|
-
function
|
|
338
|
+
function D(a) {
|
|
338
339
|
return typeof a == "object" && a !== null && !Array.isArray(a);
|
|
339
340
|
}
|
|
340
341
|
function Y(a, i) {
|
|
341
|
-
const r = a?.var?.[i], l =
|
|
342
|
+
const r = a?.var?.[i], l = D(r) && "value" in r ? r.value : r;
|
|
342
343
|
if (l == null || l === "")
|
|
343
344
|
return null;
|
|
344
345
|
if (Array.isArray(l))
|
|
345
346
|
return l.map((n) => String(n)).join(", ");
|
|
346
|
-
if (
|
|
347
|
+
if (D(l))
|
|
347
348
|
try {
|
|
348
349
|
return JSON.stringify(l);
|
|
349
350
|
} catch {
|
|
@@ -354,37 +355,37 @@ function Y(a, i) {
|
|
|
354
355
|
function Z(a) {
|
|
355
356
|
const { getStaticResearchAssets: i, highlighter: r, components: l = {} } = a, { AssetRenderer: n, EmbeddedRenderer: d, MermaidBlock: g } = l, p = {};
|
|
356
357
|
return (n || i) && (p.img = (u, b, _) => {
|
|
357
|
-
const { src:
|
|
358
|
+
const { src: A, alt: R } = u.properties || {};
|
|
358
359
|
return n ? e(n, {
|
|
359
|
-
src:
|
|
360
|
-
alt:
|
|
360
|
+
src: A,
|
|
361
|
+
alt: R,
|
|
361
362
|
getStaticResearchAssets: i
|
|
362
|
-
}) : e("img", { src:
|
|
363
|
+
}) : e("img", { src: A, alt: R, class: "aimd-image", loading: "lazy" });
|
|
363
364
|
}), p.pre = (u, b, _) => {
|
|
364
|
-
const
|
|
365
|
+
const A = u.children.find(
|
|
365
366
|
(s) => s.type === "element" && s.tagName === "code"
|
|
366
367
|
);
|
|
367
|
-
if (!
|
|
368
|
+
if (!A)
|
|
368
369
|
return e("pre", {}, b);
|
|
369
|
-
const
|
|
370
|
-
let
|
|
371
|
-
if (Array.isArray(
|
|
372
|
-
const s =
|
|
373
|
-
s && typeof s == "string" && (
|
|
370
|
+
const R = A.properties?.className;
|
|
371
|
+
let w = "text";
|
|
372
|
+
if (Array.isArray(R)) {
|
|
373
|
+
const s = R.find((c) => typeof c == "string" && c.startsWith("language-"));
|
|
374
|
+
s && typeof s == "string" && (w = s.replace("language-", ""));
|
|
374
375
|
}
|
|
375
|
-
const o =
|
|
376
|
-
if ((
|
|
376
|
+
const o = A.children.map((s) => s.type === "text" ? s.value : "").join(""), y = o.split(/\n/)[0].trim();
|
|
377
|
+
if ((w === "mermaid" || y === "gantt" || y === "sequenceDiagram" || /^graph (?:TB|BT|RL|LR|TD);?$/.test(y)) && g)
|
|
377
378
|
return e(g, { code: o });
|
|
378
379
|
const t = typeof r == "function" ? r() : r;
|
|
379
380
|
if (t)
|
|
380
381
|
try {
|
|
381
382
|
const s = t.codeToHtml(o, {
|
|
382
|
-
lang:
|
|
383
|
+
lang: w,
|
|
383
384
|
theme: "github-dark"
|
|
384
385
|
});
|
|
385
386
|
return e("div", {
|
|
386
387
|
class: "shiki-code-block",
|
|
387
|
-
"data-lang":
|
|
388
|
+
"data-lang": w,
|
|
388
389
|
innerHTML: s
|
|
389
390
|
});
|
|
390
391
|
} catch (s) {
|
|
@@ -392,8 +393,8 @@ function Z(a) {
|
|
|
392
393
|
}
|
|
393
394
|
return e(
|
|
394
395
|
"pre",
|
|
395
|
-
{ class: `language-${
|
|
396
|
-
e("code", { class: `language-${
|
|
396
|
+
{ class: `language-${w}` },
|
|
397
|
+
e("code", { class: `language-${w}` }, o)
|
|
397
398
|
);
|
|
398
399
|
}, d && (p.iframe = (u, b, _) => e(d, {
|
|
399
400
|
contentProps: { ...u.properties, credentialless: !0 },
|
|
@@ -404,7 +405,7 @@ function Z(a) {
|
|
|
404
405
|
})), p;
|
|
405
406
|
}
|
|
406
407
|
function le(a) {
|
|
407
|
-
const i = () => typeof a.mode == "function" ? a.mode() : a.mode, r = () =>
|
|
408
|
+
const i = () => typeof a.mode == "function" ? a.mode() : a.mode, r = () => V(i(), a.quizPreview), l = F(a.locale), n = M(l, a.messages), d = X(a), g = Z(a), p = {
|
|
408
409
|
locale: l,
|
|
409
410
|
messages: n,
|
|
410
411
|
context: {
|
|
@@ -419,7 +420,7 @@ function le(a) {
|
|
|
419
420
|
};
|
|
420
421
|
return {
|
|
421
422
|
async render(u) {
|
|
422
|
-
return
|
|
423
|
+
return B(u, {
|
|
423
424
|
gfm: !0,
|
|
424
425
|
math: !0,
|
|
425
426
|
breaks: !0,
|
|
@@ -428,7 +429,7 @@ function le(a) {
|
|
|
428
429
|
});
|
|
429
430
|
},
|
|
430
431
|
extractFields(u) {
|
|
431
|
-
return
|
|
432
|
+
return I(u);
|
|
432
433
|
},
|
|
433
434
|
vueOptions: p
|
|
434
435
|
};
|
|
@@ -452,9 +453,10 @@ function ce(a) {
|
|
|
452
453
|
return [{ type: r, name: n }];
|
|
453
454
|
}
|
|
454
455
|
export {
|
|
456
|
+
$e as AIMD_RECORD_RENDER_SCOPES,
|
|
455
457
|
pe as DEFAULT_AIMD_RENDERER_LOCALE,
|
|
456
458
|
ne as bubbleMenuEventKey,
|
|
457
|
-
|
|
459
|
+
M as createAimdRendererMessages,
|
|
458
460
|
ue as createAssetRenderer,
|
|
459
461
|
fe as createCodeBlockRenderer,
|
|
460
462
|
_e as createComponentRenderer,
|
|
@@ -462,23 +464,28 @@ export {
|
|
|
462
464
|
ge as createEmbeddedRenderer,
|
|
463
465
|
ve as createHtmlProcessor,
|
|
464
466
|
he as createMermaidRenderer,
|
|
467
|
+
ze as createReadonlyRecordAimdRenderers,
|
|
468
|
+
Ee as createReadonlyRecordElementRenderers,
|
|
469
|
+
Pe as createReadonlyRecordRenderContext,
|
|
465
470
|
be as createRenderer,
|
|
466
|
-
|
|
471
|
+
Re as createStepCardRenderer,
|
|
467
472
|
le as createUnifiedTokenRenderer,
|
|
468
|
-
|
|
473
|
+
Ae as defaultRenderer,
|
|
469
474
|
se as draftEventKey,
|
|
470
475
|
te as fieldEventKey,
|
|
471
|
-
|
|
476
|
+
H as getAimdRendererQuizTypeLabel,
|
|
472
477
|
de as getFinalIndent,
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
478
|
+
we as hastToVue,
|
|
479
|
+
xe as loadShikiHighlighter,
|
|
480
|
+
Le as normalizeRecordRenderValue,
|
|
481
|
+
I as parseAndExtract,
|
|
476
482
|
ce as parseFieldTag,
|
|
477
483
|
ie as protocolKey,
|
|
478
|
-
|
|
479
|
-
|
|
484
|
+
Ce as renderReadonlyRecordToVue,
|
|
485
|
+
Te as renderToHtml,
|
|
486
|
+
ke as renderToHtmlSync,
|
|
480
487
|
qe as renderToVNodes,
|
|
481
|
-
|
|
488
|
+
B as renderToVue,
|
|
482
489
|
re as reportEventKey,
|
|
483
|
-
|
|
490
|
+
F as resolveAimdRendererLocale
|
|
484
491
|
};
|