@airalogy/aimd-renderer 2.4.1 → 2.5.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/LICENSE +201 -0
- package/README.md +5 -1
- package/README.zh-CN.md +5 -1
- package/dist/__tests__/renderer.test.d.ts +2 -0
- package/dist/__tests__/renderer.test.d.ts.map +1 -0
- package/dist/common/annotateStepReferences.d.ts +10 -0
- package/dist/common/annotateStepReferences.d.ts.map +1 -0
- package/dist/common/assignerHighlighting.d.ts +14 -0
- package/dist/common/assignerHighlighting.d.ts.map +1 -0
- package/dist/common/assignerVisibility.d.ts +33 -0
- package/dist/common/assignerVisibility.d.ts.map +1 -0
- package/dist/common/eventKeys.d.ts +20 -0
- package/dist/common/eventKeys.d.ts.map +1 -0
- package/dist/common/figureNumbering.d.ts +30 -0
- package/dist/common/figureNumbering.d.ts.map +1 -0
- package/dist/common/processor.d.ts +96 -0
- package/dist/common/processor.d.ts.map +1 -0
- package/dist/common/quiz-preview.d.ts +11 -0
- package/dist/common/quiz-preview.d.ts.map +1 -0
- package/dist/common/unified-token-renderer.d.ts +124 -0
- package/dist/common/unified-token-renderer.d.ts.map +1 -0
- package/dist/html/index.d.ts +9 -0
- package/dist/html/index.d.ts.map +1 -0
- package/dist/html.js +1 -1
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -43
- package/dist/locales.d.ts +52 -0
- package/dist/locales.d.ts.map +1 -0
- package/dist/{processor-Cv8E7QsA.js → processor-B2mByErv.js} +1699 -1527
- package/dist/vue/index.d.ts +10 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue/vue-renderer.d.ts +138 -0
- package/dist/vue/vue-renderer.d.ts.map +1 -0
- package/dist/vue.js +1 -1
- package/package.json +13 -13
- package/src/__tests__/renderer.test.ts +29 -1
- package/src/common/processor.ts +4 -2
- package/src/common/unified-token-renderer.ts +2 -2
- package/src/locales.ts +5 -0
- package/src/vue/vue-renderer.ts +2 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @airalogy/aimd-renderer
|
|
3
|
+
*
|
|
4
|
+
* AIMD rendering engines for HTML and Vue
|
|
5
|
+
*/
|
|
6
|
+
export { createCustomElementAimdRenderer, createHtmlProcessor, createRenderer, defaultRenderer, parseAndExtract, renderToHtml, renderToHtmlSync, renderToVue, } from './common/processor';
|
|
7
|
+
export { createAimdRendererMessages, DEFAULT_AIMD_RENDERER_LOCALE, getAimdRendererQuizTypeLabel, resolveAimdRendererLocale, } from './locales';
|
|
8
|
+
export { bubbleMenuEventKey, draftEventKey, fieldEventKey, protocolKey, reportEventKey, } from './common/eventKeys';
|
|
9
|
+
export { type AssetResponse, createUnifiedTokenRenderer, type TokenLike, type TokenProps, type UnifiedRendererContext, type UnifiedTokenRendererOptions, } from './common/unified-token-renderer';
|
|
10
|
+
export { type AimdComponentRenderer, type AimdRendererContext, type AssetResolver, createAssetRenderer, createCodeBlockRenderer, createComponentRenderer, createEmbeddedRenderer, createMermaidRenderer, createStepCardRenderer, type ElementRenderer, hastToVue, renderToVNodes, type AimdStepCardRendererOptions, type ShikiHighlighter, type VueRendererOptions, } from './vue/vue-renderer';
|
|
11
|
+
export type { ProcessorOptions, RenderContext, RenderMode, RenderNode, TokenRenderRule, } from '@airalogy/aimd-core/types';
|
|
12
|
+
export type { AimdAssignerVisibility, AimdHtmlNodeRenderer, AimdHtmlRendererContext, CustomElementAimdRendererOptions, AimdRendererOptions, RenderResult, } from './common/processor';
|
|
13
|
+
export type { AimdRendererI18nOptions, AimdRendererLocale, AimdRendererMessages, AimdRendererMessagesInput, } from './locales';
|
|
14
|
+
export declare function getFinalIndent(item: {
|
|
15
|
+
parent?: any;
|
|
16
|
+
sequence: number;
|
|
17
|
+
level: number;
|
|
18
|
+
}): string;
|
|
19
|
+
export declare function parseFieldTag(template: string): {
|
|
20
|
+
type: string;
|
|
21
|
+
name: string;
|
|
22
|
+
}[];
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,KAAK,eAAe,EACpB,SAAS,EACT,cAAc,EACd,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,GACxB,MAAM,oBAAoB,CAAA;AAG3B,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,UAAU,EACV,eAAe,GAChB,MAAM,2BAA2B,CAAA;AAGlC,YAAY,EACV,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,gCAAgC,EAChC,mBAAmB,EACnB,YAAY,GACb,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,WAAW,CAAA;AAGlB,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAgB9F;AAED,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,5 +1,5 @@
|
|
|
1
|
-
import { e as V, c as C, p as I, q as K, s as j, t as x, u as D } from "./processor-
|
|
2
|
-
import { D as ie, f as re, g as ne, h as le, a as ce, i as de, b as oe, j as me, k as pe, l as ue, m as fe, n as _e, r as ye, d as ge, o as he } from "./processor-
|
|
1
|
+
import { e as V, c as C, p as I, q as K, s as j, t as x, u as D } from "./processor-B2mByErv.js";
|
|
2
|
+
import { D as ie, f as re, g as ne, h as le, a as ce, i as de, b as oe, j as me, k as pe, l as ue, m as fe, n as _e, r as ye, d as ge, o as he } from "./processor-B2mByErv.js";
|
|
3
3
|
import { h as e } from "vue";
|
|
4
4
|
const W = /* @__PURE__ */ Symbol("symbol-field-event-key"), J = /* @__PURE__ */ Symbol("symbol-protocol-key"), G = /* @__PURE__ */ Symbol("draft-event-key"), X = /* @__PURE__ */ Symbol("symbol-report-event-key"), Y = /* @__PURE__ */ Symbol("symbol-bubble-menu-event-key");
|
|
5
5
|
function B(t) {
|
|
@@ -12,12 +12,12 @@ function z(t, i) {
|
|
|
12
12
|
const n = [];
|
|
13
13
|
let l = 0;
|
|
14
14
|
for (const r of i.matchAll(H)) {
|
|
15
|
-
const o = r.index ?? 0, h = r[0],
|
|
15
|
+
const o = r.index ?? 0, h = r[0], p = r[1];
|
|
16
16
|
o > l && n.push(e("span", i.slice(l, o))), n.push(
|
|
17
17
|
e("span", {
|
|
18
18
|
class: "aimd-quiz__blank-placeholder",
|
|
19
|
-
"data-blank-key":
|
|
20
|
-
},
|
|
19
|
+
"data-blank-key": p
|
|
20
|
+
}, p)
|
|
21
21
|
), l = o + h.length;
|
|
22
22
|
}
|
|
23
23
|
return l < i.length && n.push(e("span", i.slice(l))), n.length === 0 && n.push(e("span", i)), n;
|
|
@@ -63,13 +63,13 @@ function L(t) {
|
|
|
63
63
|
function T(t, i, n, l) {
|
|
64
64
|
const r = B(t), o = x(t, n);
|
|
65
65
|
if (t === "var_table") {
|
|
66
|
-
const
|
|
66
|
+
const p = [
|
|
67
67
|
e("div", { class: "aimd-field__header" }, [
|
|
68
68
|
e("span", { class: "aimd-field__scope" }, n.scope.table),
|
|
69
69
|
e("span", { class: "aimd-field__name" }, i)
|
|
70
70
|
])
|
|
71
71
|
];
|
|
72
|
-
return l && l.length > 0 &&
|
|
72
|
+
return l && l.length > 0 && p.push(
|
|
73
73
|
e("table", { class: "aimd-field__table-preview" }, [
|
|
74
74
|
e("thead", [
|
|
75
75
|
e("tr", l.map((u) => e("th", u)))
|
|
@@ -82,7 +82,7 @@ function T(t, i, n, l) {
|
|
|
82
82
|
class: "aimd-field aimd-field--var-table",
|
|
83
83
|
"data-aimd-type": "var_table",
|
|
84
84
|
"data-aimd-id": i
|
|
85
|
-
},
|
|
85
|
+
}, p);
|
|
86
86
|
}
|
|
87
87
|
return e("span", {
|
|
88
88
|
class: `aimd-field aimd-field--${r === "table" ? "var-table" : r}`,
|
|
@@ -97,7 +97,7 @@ function O(t) {
|
|
|
97
97
|
const { getTokenProps: i, mode: n, components: l = {} } = t, r = C(t.locale, t.messages), {
|
|
98
98
|
AIMDItem: o,
|
|
99
99
|
AIMDTag: h,
|
|
100
|
-
AIMDStepRef:
|
|
100
|
+
AIMDStepRef: p,
|
|
101
101
|
StepRenderer: u,
|
|
102
102
|
CheckRenderer: q,
|
|
103
103
|
PreviewRenderer: _
|
|
@@ -111,31 +111,31 @@ function O(t) {
|
|
|
111
111
|
name: () => s
|
|
112
112
|
}) : T(c, s, r);
|
|
113
113
|
if (i && o) {
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
114
|
+
const m = await i({ meta: { node: { id: s, scope: c } } });
|
|
115
|
+
if (m)
|
|
116
116
|
return e("span", {
|
|
117
117
|
class: "aimd-field-wrapper aimd-field-wrapper--inline",
|
|
118
118
|
id: `${c}-${s}`,
|
|
119
119
|
"data-has-variable": "true"
|
|
120
|
-
}, [e(o,
|
|
120
|
+
}, [e(o, m)]);
|
|
121
121
|
}
|
|
122
122
|
return T(c, s, r);
|
|
123
123
|
},
|
|
124
124
|
var_table: async (d, y, f) => {
|
|
125
|
-
const a = d, { id: s, scope: c, columns:
|
|
125
|
+
const a = d, { id: s, scope: c, columns: m } = a;
|
|
126
126
|
if (v())
|
|
127
127
|
return _ ? e(_, { type: "var_table" }, {
|
|
128
128
|
default: () => f,
|
|
129
129
|
name: () => s
|
|
130
|
-
}) : T(c, s, r,
|
|
130
|
+
}) : T(c, s, r, m);
|
|
131
131
|
if (i && h) {
|
|
132
132
|
const A = await i({ meta: { node: { id: s, scope: c } } });
|
|
133
|
-
return e(h, { ...A, props:
|
|
133
|
+
return e(h, { ...A, props: m });
|
|
134
134
|
}
|
|
135
|
-
return T(c, s, r,
|
|
135
|
+
return T(c, s, r, m);
|
|
136
136
|
},
|
|
137
137
|
quiz: async (d, y, f) => {
|
|
138
|
-
const a = d, { id: s, scope: c, quizType:
|
|
138
|
+
const a = d, { id: s, scope: c, quizType: m, stem: A, score: k } = a, S = j(m, a.mode, r);
|
|
139
139
|
if (v()) {
|
|
140
140
|
if (_)
|
|
141
141
|
return e(_, { type: "quiz" }, {
|
|
@@ -149,25 +149,25 @@ function O(t) {
|
|
|
149
149
|
e("span", { class: "aimd-field__type" }, `(${S})`),
|
|
150
150
|
k !== void 0 ? e("span", { class: "aimd-quiz__score" }, r.quiz.score(k)) : null
|
|
151
151
|
]),
|
|
152
|
-
e("div", { class: "aimd-quiz__stem" }, z(
|
|
152
|
+
e("div", { class: "aimd-quiz__stem" }, z(m, A || s))
|
|
153
153
|
];
|
|
154
|
-
typeof a.title == "string" && a.title.trim() && g.splice(1, 0, e("div", { class: "aimd-quiz__title" }, a.title)), typeof a.description == "string" && a.description.trim() && g.push(e("div", { class: "aimd-quiz__description" }, a.description)),
|
|
154
|
+
typeof a.title == "string" && a.title.trim() && g.splice(1, 0, e("div", { class: "aimd-quiz__title" }, a.title)), typeof a.description == "string" && a.description.trim() && g.push(e("div", { class: "aimd-quiz__description" }, a.description)), (m === "choice" || m === "true_false") && Array.isArray(a.options) && a.options.length > 0 && g.push(
|
|
155
155
|
e("ul", { class: "aimd-quiz__options" }, a.options.map(
|
|
156
156
|
(R) => e("li", `${R.key}. ${R.text}`)
|
|
157
157
|
))
|
|
158
|
-
),
|
|
158
|
+
), m === "scale" && (g.push(...E(a)), g.push(...L(a)));
|
|
159
159
|
const $ = w();
|
|
160
|
-
if ($.showAnswers &&
|
|
160
|
+
if ($.showAnswers && (m === "choice" || m === "true_false") && a.answer !== void 0) {
|
|
161
161
|
const R = Array.isArray(a.answer) ? a.answer.join(", ") : String(a.answer);
|
|
162
162
|
R.trim() && g.push(
|
|
163
163
|
e("div", { class: "aimd-quiz__answer" }, r.quiz.answer(R))
|
|
164
164
|
);
|
|
165
165
|
}
|
|
166
|
-
return $.showAnswers &&
|
|
166
|
+
return $.showAnswers && m === "blank" && Array.isArray(a.blanks) && a.blanks.length > 0 && g.push(
|
|
167
167
|
e("ul", { class: "aimd-quiz__blanks" }, a.blanks.map(
|
|
168
168
|
(R) => e("li", `${R.key}: ${R.answer}`)
|
|
169
169
|
))
|
|
170
|
-
), $.showRubric &&
|
|
170
|
+
), $.showRubric && m === "open" && typeof a.rubric == "string" && a.rubric.trim() && g.push(
|
|
171
171
|
e("div", { class: "aimd-quiz__rubric" }, r.quiz.rubric(a.rubric))
|
|
172
172
|
), e("div", {
|
|
173
173
|
class: "aimd-field aimd-field--quiz",
|
|
@@ -195,34 +195,34 @@ function O(t) {
|
|
|
195
195
|
e("span", { class: "aimd-field__type" }, `(${S})`)
|
|
196
196
|
]),
|
|
197
197
|
...typeof a.title == "string" && a.title.trim() ? [e("div", { class: "aimd-quiz__title" }, a.title)] : [],
|
|
198
|
-
e("div", { class: "aimd-quiz__stem" }, z(
|
|
198
|
+
e("div", { class: "aimd-quiz__stem" }, z(m, A || s)),
|
|
199
199
|
...typeof a.description == "string" && a.description.trim() ? [e("div", { class: "aimd-quiz__description" }, a.description)] : [],
|
|
200
|
-
...
|
|
200
|
+
...m === "scale" ? [...E(a), ...L(a)] : []
|
|
201
201
|
]);
|
|
202
202
|
},
|
|
203
203
|
step: async (d, y, f) => {
|
|
204
|
-
const a = d, { id: s, scope: c, step:
|
|
204
|
+
const a = d, { id: s, scope: c, step: m, check: A } = a;
|
|
205
205
|
if (v())
|
|
206
206
|
return _ ? e(_, { type: "step" }, {
|
|
207
207
|
default: () => f,
|
|
208
208
|
name: () => s
|
|
209
|
-
}) : e("span", { class: "research-step__sequence" }, r.step.sequence(
|
|
209
|
+
}) : e("span", { class: "research-step__sequence" }, r.step.sequence(m));
|
|
210
210
|
if (i && u) {
|
|
211
211
|
const k = await i({ meta: { node: { id: s, scope: c } } }), S = await i({ meta: { node: { id: s, scope: c, type: "step-annotation" } } });
|
|
212
212
|
return e(u, {
|
|
213
213
|
item: k,
|
|
214
214
|
annotationItem: S,
|
|
215
215
|
name: s,
|
|
216
|
-
step: String(
|
|
216
|
+
step: String(m),
|
|
217
217
|
check: A
|
|
218
218
|
}, {
|
|
219
219
|
default: () => f
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
-
return e("span", { class: "research-step__sequence" }, r.step.sequence(
|
|
222
|
+
return e("span", { class: "research-step__sequence" }, r.step.sequence(m));
|
|
223
223
|
},
|
|
224
224
|
check: async (d, y, f) => {
|
|
225
|
-
const a = d, { id: s, scope: c, label:
|
|
225
|
+
const a = d, { id: s, scope: c, label: m } = a;
|
|
226
226
|
if (v())
|
|
227
227
|
return _ ? e(_, { type: "check" }, {
|
|
228
228
|
default: () => f,
|
|
@@ -242,7 +242,7 @@ function O(t) {
|
|
|
242
242
|
},
|
|
243
243
|
ref_step: (d, y) => {
|
|
244
244
|
const { id: f } = d, a = "refTarget" in d ? d.refTarget : f, s = "stepSequence" in d && typeof d.stepSequence == "string" ? d.stepSequence : void 0, c = s ? r.step.reference(s) : a;
|
|
245
|
-
return
|
|
245
|
+
return p ? e(p, { name: a, type: "step", stepSequence: s }) : e("a", {
|
|
246
246
|
class: "aimd-ref aimd-ref--step",
|
|
247
247
|
href: `#step-${a}`,
|
|
248
248
|
"data-aimd-step-sequence": s,
|
|
@@ -257,7 +257,7 @@ function O(t) {
|
|
|
257
257
|
},
|
|
258
258
|
ref_var: (d, y) => {
|
|
259
259
|
const { id: f } = d, a = "refTarget" in d ? d.refTarget : f, s = y.mode === "edit" ? F(y.value, a) : null;
|
|
260
|
-
return
|
|
260
|
+
return p ? e(p, {
|
|
261
261
|
name: a,
|
|
262
262
|
type: "var",
|
|
263
263
|
contextValue: y.value,
|
|
@@ -308,15 +308,15 @@ function F(t, i) {
|
|
|
308
308
|
return String(l);
|
|
309
309
|
}
|
|
310
310
|
function N(t) {
|
|
311
|
-
const { getStaticResearchAssets: i, highlighter: n, components: l = {} } = t, { AssetRenderer: r, EmbeddedRenderer: o, MermaidBlock: h } = l,
|
|
312
|
-
return (r || i) && (
|
|
311
|
+
const { getStaticResearchAssets: i, highlighter: n, components: l = {} } = t, { AssetRenderer: r, EmbeddedRenderer: o, MermaidBlock: h } = l, p = {};
|
|
312
|
+
return (r || i) && (p.img = (u, q, _) => {
|
|
313
313
|
const { src: b, alt: v } = u.properties || {};
|
|
314
314
|
return r ? e(r, {
|
|
315
315
|
src: b,
|
|
316
316
|
alt: v,
|
|
317
317
|
getStaticResearchAssets: i
|
|
318
318
|
}) : e("img", { src: b, alt: v, class: "aimd-image", loading: "lazy" });
|
|
319
|
-
}),
|
|
319
|
+
}), p.pre = (u, q, _) => {
|
|
320
320
|
const b = u.children.find(
|
|
321
321
|
(s) => s.type === "element" && s.tagName === "code"
|
|
322
322
|
);
|
|
@@ -351,16 +351,16 @@ function N(t) {
|
|
|
351
351
|
{ class: `language-${w}` },
|
|
352
352
|
e("code", { class: `language-${w}` }, d)
|
|
353
353
|
);
|
|
354
|
-
}, o && (
|
|
354
|
+
}, o && (p.iframe = (u, q, _) => e(o, {
|
|
355
355
|
contentProps: { ...u.properties, credentialless: !0 },
|
|
356
356
|
component: "iframe"
|
|
357
|
-
}),
|
|
357
|
+
}), p.video = (u, q, _) => e(o, {
|
|
358
358
|
contentProps: u.properties,
|
|
359
359
|
component: "video"
|
|
360
|
-
})),
|
|
360
|
+
})), p;
|
|
361
361
|
}
|
|
362
362
|
function Z(t) {
|
|
363
|
-
const i = () => typeof t.mode == "function" ? t.mode() : t.mode, n = () => D(i(), t.quizPreview), l = V(t.locale), r = C(l, t.messages), o = O(t), h = N(t),
|
|
363
|
+
const i = () => typeof t.mode == "function" ? t.mode() : t.mode, n = () => D(i(), t.quizPreview), l = V(t.locale), r = C(l, t.messages), o = O(t), h = N(t), p = {
|
|
364
364
|
locale: l,
|
|
365
365
|
messages: r,
|
|
366
366
|
context: {
|
|
@@ -380,13 +380,13 @@ function Z(t) {
|
|
|
380
380
|
math: !0,
|
|
381
381
|
breaks: !0,
|
|
382
382
|
assignerVisibility: t.assignerVisibility,
|
|
383
|
-
...
|
|
383
|
+
...p
|
|
384
384
|
});
|
|
385
385
|
},
|
|
386
386
|
extractFields(u) {
|
|
387
387
|
return I(u);
|
|
388
388
|
},
|
|
389
|
-
vueOptions:
|
|
389
|
+
vueOptions: p
|
|
390
390
|
};
|
|
391
391
|
}
|
|
392
392
|
function ee(t) {
|
|
@@ -401,8 +401,8 @@ function ee(t) {
|
|
|
401
401
|
}
|
|
402
402
|
function te(t) {
|
|
403
403
|
if (t.startsWith("var_table")) {
|
|
404
|
-
const [o, h,
|
|
405
|
-
return [{ type: o, name: `${
|
|
404
|
+
const [o, h, p, ...u] = t.split(/(\\)?\|/g);
|
|
405
|
+
return [{ type: o, name: `${p}|${u.filter(Boolean).join(",")}` }];
|
|
406
406
|
}
|
|
407
407
|
const [n, l, r] = t.split(/(\\)?\|/);
|
|
408
408
|
return [{ type: n, name: r }];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type AimdRendererLocale = "en-US" | "zh-CN";
|
|
2
|
+
export declare const DEFAULT_AIMD_RENDERER_LOCALE: AimdRendererLocale;
|
|
3
|
+
type DeepPartial<T> = {
|
|
4
|
+
[K in keyof T]?: T[K] extends (...args: any[]) => any ? T[K] : T[K] extends Array<infer U> ? Array<DeepPartial<U>> : T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
5
|
+
};
|
|
6
|
+
export interface AimdRendererMessages {
|
|
7
|
+
scope: {
|
|
8
|
+
var: string;
|
|
9
|
+
quiz: string;
|
|
10
|
+
step: string;
|
|
11
|
+
check: string;
|
|
12
|
+
table: string;
|
|
13
|
+
figure: string;
|
|
14
|
+
};
|
|
15
|
+
quiz: {
|
|
16
|
+
types: {
|
|
17
|
+
choice: string;
|
|
18
|
+
singleChoice: string;
|
|
19
|
+
multipleChoice: string;
|
|
20
|
+
trueFalse: string;
|
|
21
|
+
blank: string;
|
|
22
|
+
open: string;
|
|
23
|
+
scale: string;
|
|
24
|
+
};
|
|
25
|
+
score: (score: string | number) => string;
|
|
26
|
+
answer: (value: string) => string;
|
|
27
|
+
rubric: (value: string) => string;
|
|
28
|
+
};
|
|
29
|
+
step: {
|
|
30
|
+
sequence: (step: string | number) => string;
|
|
31
|
+
reference: (step: string | number) => string;
|
|
32
|
+
};
|
|
33
|
+
figure: {
|
|
34
|
+
reference: (value: string | number) => string;
|
|
35
|
+
captionTitle: (sequence: number, title?: string) => string;
|
|
36
|
+
};
|
|
37
|
+
assigner: {
|
|
38
|
+
clientSummary: string;
|
|
39
|
+
serverSummary: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export type AimdRendererMessagesInput = DeepPartial<AimdRendererMessages>;
|
|
43
|
+
export interface AimdRendererI18nOptions {
|
|
44
|
+
locale?: AimdRendererLocale | string;
|
|
45
|
+
messages?: AimdRendererMessagesInput;
|
|
46
|
+
}
|
|
47
|
+
export declare function resolveAimdRendererLocale(locale?: string): AimdRendererLocale;
|
|
48
|
+
export declare function createAimdRendererMessages(locale: string | undefined, overrides?: AimdRendererMessagesInput): AimdRendererMessages;
|
|
49
|
+
export declare function getAimdRendererScopeLabel(scope: string, messages: Pick<AimdRendererMessages, "scope">): string;
|
|
50
|
+
export declare function getAimdRendererQuizTypeLabel(quizType: string | undefined, quizMode: string | undefined, messages: Pick<AimdRendererMessages, "quiz">): string;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../src/locales.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,CAAA;AAElD,eAAO,MAAM,4BAA4B,EAAE,kBAA4B,CAAA;AAEvE,KAAK,WAAW,CAAC,CAAC,IAAI;KACnB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GACjD,CAAC,CAAC,CAAC,CAAC,GACJ,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACzB,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GACrB,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GACjB,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACjB,CAAC,CAAC,CAAC,CAAC;CACb,CAAA;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,CAAA;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,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