@airalogy/aimd-renderer 2.4.1 → 2.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.
Files changed (45) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +10 -5
  3. package/README.zh-CN.md +10 -5
  4. package/dist/__tests__/renderer.test.d.ts +2 -0
  5. package/dist/__tests__/renderer.test.d.ts.map +1 -0
  6. package/dist/aimd-renderer.css +1 -1
  7. package/dist/common/annotateStepReferences.d.ts +10 -0
  8. package/dist/common/annotateStepReferences.d.ts.map +1 -0
  9. package/dist/common/assignerHighlighting.d.ts +14 -0
  10. package/dist/common/assignerHighlighting.d.ts.map +1 -0
  11. package/dist/common/assignerVisibility.d.ts +33 -0
  12. package/dist/common/assignerVisibility.d.ts.map +1 -0
  13. package/dist/common/eventKeys.d.ts +20 -0
  14. package/dist/common/eventKeys.d.ts.map +1 -0
  15. package/dist/common/figureNumbering.d.ts +30 -0
  16. package/dist/common/figureNumbering.d.ts.map +1 -0
  17. package/dist/common/processor.d.ts +96 -0
  18. package/dist/common/processor.d.ts.map +1 -0
  19. package/dist/common/quiz-preview.d.ts +11 -0
  20. package/dist/common/quiz-preview.d.ts.map +1 -0
  21. package/dist/common/unified-token-renderer.d.ts +124 -0
  22. package/dist/common/unified-token-renderer.d.ts.map +1 -0
  23. package/dist/html/index.d.ts +9 -0
  24. package/dist/html/index.d.ts.map +1 -0
  25. package/dist/html.js +1 -1
  26. package/dist/index.d.ts +23 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +270 -225
  29. package/dist/locales.d.ts +52 -0
  30. package/dist/locales.d.ts.map +1 -0
  31. package/dist/{processor-Cv8E7QsA.js → processor-CHbNEcN8.js} +2977 -2212
  32. package/dist/vue/index.d.ts +10 -0
  33. package/dist/vue/index.d.ts.map +1 -0
  34. package/dist/vue/vue-renderer.d.ts +159 -0
  35. package/dist/vue/vue-renderer.d.ts.map +1 -0
  36. package/dist/vue.js +10 -9
  37. package/package.json +17 -17
  38. package/src/__tests__/renderer.test.ts +220 -2
  39. package/src/common/processor.ts +177 -43
  40. package/src/common/unified-token-renderer.ts +106 -26
  41. package/src/index.ts +3 -0
  42. package/src/locales.ts +5 -0
  43. package/src/styles/katex.css +109 -0
  44. package/src/vue/index.ts +3 -0
  45. package/src/vue/vue-renderer.ts +320 -50
@@ -0,0 +1,10 @@
1
+ import type { Root as HastRoot } from "hast";
2
+ import type { ExtractedAimdFields } from "@airalogy/aimd-core/types";
3
+ import type { AimdRendererOptions } from "./processor";
4
+ /**
5
+ * Walk a HAST tree and inject the resolved step-sequence numbers into every
6
+ * `ref_step` element so the rendered output shows e.g. "Step 2.1" instead of
7
+ * the raw id.
8
+ */
9
+ export declare function annotateStepReferenceSequence(tree: HastRoot, fields: ExtractedAimdFields, options: AimdRendererOptions): void;
10
+ //# sourceMappingURL=annotateStepReferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotateStepReferences.d.ts","sourceRoot":"","sources":["../../src/common/annotateStepReferences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAA;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAEpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAuBtD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,mBAAmB,GAC3B,IAAI,CA0EN"}
@@ -0,0 +1,14 @@
1
+ import type { Element, Root as HastRoot } from "hast";
2
+ import type { AimdRendererOptions } from "./processor";
3
+ export declare function getClassNames(value: unknown): string[];
4
+ export declare function hasClassName(node: Element, className: string): boolean;
5
+ export declare function getCodeLanguage(node: Element): string | null;
6
+ export declare function collectTextContent(node: Element): string;
7
+ export declare function visitHastElements(node: HastRoot | Element, visitor: (element: Element) => void): void;
8
+ export declare function findDescendantElement(node: Element, predicate: (element: Element) => boolean): Element | null;
9
+ /**
10
+ * Walk a HAST tree and apply Shiki syntax highlighting to every visible
11
+ * assigner code block (`<code>` inside `.aimd-assigner-preview`).
12
+ */
13
+ export declare function highlightVisibleAssigners(tree: HastRoot, options: AimdRendererOptions): Promise<void>;
14
+ //# sourceMappingURL=assignerHighlighting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignerHighlighting.d.ts","sourceRoot":"","sources":["../../src/common/assignerHighlighting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAoB,MAAM,MAAM,CAAA;AAEvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAUtD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAQtD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAG5D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAUxD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAWrG;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GAAG,OAAO,GAAG,IAAI,CAc7G;AAwCD;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4C3G"}
@@ -0,0 +1,33 @@
1
+ import type { Plugin } from "unified";
2
+ import type { AimdRendererOptions } from "./processor";
3
+ import type { AimdAssignerVisibility } from "./processor";
4
+ /**
5
+ * Internal markdown AST node shape used during remark processing.
6
+ */
7
+ export interface MarkdownNode {
8
+ type: string;
9
+ children?: MarkdownNode[];
10
+ lang?: string | null;
11
+ meta?: string | null;
12
+ value?: string;
13
+ }
14
+ export type MarkdownParent = MarkdownNode & {
15
+ children: MarkdownNode[];
16
+ };
17
+ export declare function resolveAssignerVisibility(visibility: AimdRendererOptions["assignerVisibility"]): AimdAssignerVisibility;
18
+ export declare function isAssignerCodeNode(node: MarkdownNode): boolean;
19
+ export declare function getAssignerRuntime(meta: string | null | undefined): "client" | "server";
20
+ export declare function getRenderedAssignerLanguage(runtime: "client" | "server"): "javascript" | "python";
21
+ export declare function escapeHtml(value: string): string;
22
+ export declare function buildInlineStyle(declarations: Record<string, string>): string;
23
+ export declare function visitMarkdownParents(node: MarkdownNode, visitor: (parent: MarkdownParent) => void): void;
24
+ /**
25
+ * Remark plugin that inserts visible assigner preview nodes (collapsed or
26
+ * expanded) next to each assigner code block in the markdown AST.
27
+ */
28
+ export declare const remarkInsertVisibleAssigners: Plugin<[AimdRendererOptions?], MarkdownNode>;
29
+ /**
30
+ * Remark plugin that strips all assigner code blocks from the markdown AST.
31
+ */
32
+ export declare const remarkStripAssignerCodeBlocks: Plugin<[], MarkdownNode>;
33
+ //# sourceMappingURL=assignerVisibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignerVisibility.d.ts","sourceRoot":"","sources":["../../src/common/assignerVisibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAGzD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG;IAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,CAAA;AAMxE,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,GACpD,sBAAsB,CAQxB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAE9D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAMvF;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAEjG;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAI7E;AA0KD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI,CAWxG;AAMD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC,EAAE,YAAY,CAwBrF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAAC,EAAE,EAAE,YAAY,CAMlE,CAAA"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Event bus keys for AIMD system
3
+ */
4
+ import type { InjectionKey } from "vue";
5
+ export declare const fieldEventKey: InjectionKey<{
6
+ name: "field-event";
7
+ }>;
8
+ export declare const protocolKey: InjectionKey<{
9
+ name: "protocol-key";
10
+ }>;
11
+ export declare const draftEventKey: InjectionKey<{
12
+ name: "draft-event";
13
+ }>;
14
+ export declare const reportEventKey: InjectionKey<{
15
+ name: "report-event";
16
+ }>;
17
+ export declare const bubbleMenuEventKey: InjectionKey<{
18
+ name: "bubble-menu-event";
19
+ }>;
20
+ //# sourceMappingURL=eventKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventKeys.d.ts","sourceRoot":"","sources":["../../src/common/eventKeys.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAEvC,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAoC,CAAA;AACpG,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAiC,CAAA;AAChG,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAA6B,CAAA;AAC7F,eAAO,MAAM,cAAc,EAAE,YAAY,CAAC;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAqC,CAAA;AACvG,eAAO,MAAM,kBAAkB,EAAE,YAAY,CAAC;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAA0C,CAAA"}
@@ -0,0 +1,30 @@
1
+ import type { Element, Text as HastText, Root as HastRoot } from "hast";
2
+ import type { ExtractedAimdFields } from "@airalogy/aimd-core/types";
3
+ /**
4
+ * Build a map from figure id to its sequence number based on the
5
+ * extracted fields. The sequence is assigned in document order (1-based).
6
+ */
7
+ export declare function buildFigureSequenceMap(fields: ExtractedAimdFields): Map<string, number>;
8
+ /**
9
+ * Build the HAST children array for a figure AIMD node.
10
+ *
11
+ * Returns `[imgElement]` or `[imgElement, figcaptionElement]` depending on
12
+ * whether a title or legend is present.
13
+ */
14
+ export declare function buildFigureChildren(figNode: {
15
+ id: string;
16
+ src?: string;
17
+ title?: string;
18
+ legend?: string;
19
+ sequence?: number | string;
20
+ }): (Element | HastText)[];
21
+ /**
22
+ * Walk the HAST tree and stamp each `[data-aimd-type="fig"]` element with
23
+ * its 1-based sequence number as `data-aimd-fig-sequence`.
24
+ *
25
+ * This is a post-processing pass that runs after the initial HAST is built
26
+ * so that figure numbers are consistent with document order regardless of
27
+ * any reordering caused by rehype plugins.
28
+ */
29
+ export declare function assignFigureSequenceNumbers(tree: HastRoot, fields: ExtractedAimdFields): void;
30
+ //# sourceMappingURL=figureNumbering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"figureNumbering.d.ts","sourceRoot":"","sources":["../../src/common/figureNumbering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAA;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAMpE;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,mBAAmB,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAWvF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC3B,GAAG,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,CAkDzB;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,mBAAmB,GAC1B,IAAI,CA0BN"}
@@ -0,0 +1,96 @@
1
+ import type { Element, Properties, Root as HastRoot } from "hast";
2
+ import type { VNode } from "vue";
3
+ import type { AimdFieldType, AimdNode, ProcessorOptions, RenderContext } from "@airalogy/aimd-core/types";
4
+ import type { ExtractedAimdFields } from "@airalogy/aimd-core/types";
5
+ import type { AimdRendererI18nOptions } from "../locales";
6
+ import type { VueRendererOptions } from "../vue/vue-renderer";
7
+ /**
8
+ * Render result
9
+ */
10
+ export interface RenderResult {
11
+ nodes: VNode[];
12
+ fields: ExtractedAimdFields;
13
+ }
14
+ export type AimdAssignerVisibility = "hidden" | "collapsed" | "expanded";
15
+ export interface AimdHtmlRendererContext extends RenderContext {
16
+ locale: NonNullable<AimdRendererI18nOptions["locale"]> | string;
17
+ messages: ReturnType<typeof createAimdRendererMessages>;
18
+ }
19
+ export type AimdHtmlNodeRenderer = (node: AimdNode, defaultElement: Element, context: AimdHtmlRendererContext) => Element | null | undefined;
20
+ export interface AimdRendererOptions extends ProcessorOptions, AimdRendererI18nOptions {
21
+ assignerVisibility?: AimdAssignerVisibility;
22
+ aimdElementRenderers?: Partial<Record<AimdFieldType, AimdHtmlNodeRenderer>>;
23
+ groupStepBodies?: boolean;
24
+ groupCheckBodies?: boolean;
25
+ blockVarTypes?: string[];
26
+ }
27
+ export interface CustomElementAimdRendererOptions {
28
+ container?: boolean;
29
+ stripDefaultChildren?: boolean;
30
+ }
31
+ export declare function createCustomElementAimdRenderer(tagName: string, mapProperties?: (node: AimdNode, context: AimdHtmlRendererContext, defaultElement: Element) => Properties, options?: CustomElementAimdRendererOptions): AimdHtmlNodeRenderer;
32
+ import { createAimdRendererMessages } from "../locales";
33
+ /**
34
+ * Create HTML output processor
35
+ */
36
+ export declare function createHtmlProcessor(options?: AimdRendererOptions): import("unified").Processor<import("mdast").Root, import("mdast").Root, HastRoot, undefined, undefined>;
37
+ /**
38
+ * Render Markdown/AIMD to HTML string
39
+ */
40
+ export declare function renderToHtml(content: string, options?: AimdRendererOptions): Promise<{
41
+ html: string;
42
+ fields: ExtractedAimdFields;
43
+ }>;
44
+ /**
45
+ * Render Markdown/AIMD to Vue VNodes
46
+ */
47
+ export declare function renderToVue(content: string, options?: AimdRendererOptions & VueRendererOptions): Promise<RenderResult>;
48
+ /**
49
+ * Parse Markdown/AIMD and extract field information (no rendering)
50
+ */
51
+ export declare function parseAndExtract(content: string): ExtractedAimdFields;
52
+ /**
53
+ * Synchronous render to HTML (for simple scenarios)
54
+ */
55
+ export declare function renderToHtmlSync(content: string, options?: AimdRendererOptions): {
56
+ html: string;
57
+ fields: ExtractedAimdFields;
58
+ };
59
+ /**
60
+ * Create reusable renderer instance
61
+ */
62
+ export declare function createRenderer(options?: AimdRendererOptions): {
63
+ /**
64
+ * Render to HTML
65
+ */
66
+ toHtml(content: string): Promise<{
67
+ html: string;
68
+ fields: ExtractedAimdFields;
69
+ }>;
70
+ /**
71
+ * Render to Vue VNodes
72
+ */
73
+ toVue(content: string, renderOptions?: VueRendererOptions): Promise<RenderResult>;
74
+ /**
75
+ * Extract fields only
76
+ */
77
+ extractFields(content: string): ExtractedAimdFields;
78
+ };
79
+ export declare const defaultRenderer: {
80
+ /**
81
+ * Render to HTML
82
+ */
83
+ toHtml(content: string): Promise<{
84
+ html: string;
85
+ fields: ExtractedAimdFields;
86
+ }>;
87
+ /**
88
+ * Render to Vue VNodes
89
+ */
90
+ toVue(content: string, renderOptions?: VueRendererOptions): Promise<RenderResult>;
91
+ /**
92
+ * Extract fields only
93
+ */
94
+ extractFields(content: string): ExtractedAimdFields;
95
+ };
96
+ //# sourceMappingURL=processor.d.ts.map
@@ -0,0 +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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AAC;IAIrF;;OAEG;mBAEQ,MAAM,kBACC,kBAAkB,GACjC,OAAO,CAAC,YAAY,CAAC;IAIxB;;OAEG;2BACoB,MAAM,GAAG,mBAAmB;CAOR,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { QuizPreviewOptions } from "@airalogy/aimd-core/types";
2
+ export interface ResolvedQuizPreviewOptions {
3
+ showAnswers: boolean;
4
+ showRubric: boolean;
5
+ }
6
+ /**
7
+ * Resolve quiz preview visibility options from mode and user overrides.
8
+ * Default behavior: reveal answers/rubric in "report" mode, hide otherwise.
9
+ */
10
+ export declare function resolveQuizPreviewOptions(mode: string, quizPreview?: QuizPreviewOptions): ResolvedQuizPreviewOptions;
11
+ //# sourceMappingURL=quiz-preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quiz-preview.d.ts","sourceRoot":"","sources":["../../src/common/quiz-preview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,OAAO,CAAA;CACpB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,kBAAkB,GAC/B,0BAA0B,CAO5B"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Unified-based token renderer
3
+ * Provides compatibility layer for migrating from markdown-it tokenRenderer
4
+ */
5
+ import type { Component } from "vue";
6
+ import type { QuizPreviewOptions } from "@airalogy/aimd-core/types";
7
+ import type { ExtractedAimdFields } from "@airalogy/aimd-core/types";
8
+ import type { AimdRendererI18nOptions } from "../locales";
9
+ import type { ShikiHighlighter, VueRendererOptions } from "../vue/vue-renderer";
10
+ import type { AimdRendererOptions, RenderResult } from "./processor";
11
+ /**
12
+ * Token props interface (compatible with IAIMDItemProps)
13
+ */
14
+ export interface TokenProps {
15
+ scope: string;
16
+ prop: string;
17
+ type?: string;
18
+ value?: unknown;
19
+ label?: string;
20
+ disabled?: boolean;
21
+ title?: string;
22
+ required?: boolean;
23
+ [key: string]: unknown;
24
+ }
25
+ /**
26
+ * Token-like object for getTokenProps compatibility
27
+ */
28
+ export interface TokenLike {
29
+ meta?: {
30
+ node?: {
31
+ id: string;
32
+ scope: string;
33
+ type?: string;
34
+ };
35
+ };
36
+ }
37
+ /**
38
+ * Asset response interface
39
+ */
40
+ export interface AssetResponse {
41
+ url: string;
42
+ [key: string]: unknown;
43
+ }
44
+ /**
45
+ * Render mode type
46
+ */
47
+ export type RenderMode = "preview" | "edit" | "timeline" | "report";
48
+ /**
49
+ * Unified token renderer options
50
+ * Compatible with TokenRendererBaseOptions from markdown-it version
51
+ */
52
+ export interface UnifiedTokenRendererOptions {
53
+ /**
54
+ * Get props for a field from external data source
55
+ */
56
+ getTokenProps?: (token: TokenLike) => Promise<TokenProps | null>;
57
+ /**
58
+ * Get static research assets (images, files)
59
+ */
60
+ getStaticResearchAssets?: (id: string) => Promise<AssetResponse | null>;
61
+ /**
62
+ * Render mode
63
+ */
64
+ mode: RenderMode | (() => RenderMode);
65
+ /**
66
+ * Shiki highlighter for code blocks
67
+ */
68
+ highlighter?: ShikiHighlighter | null | (() => ShikiHighlighter | null);
69
+ /**
70
+ * Custom Vue components
71
+ */
72
+ components?: {
73
+ AIMDItem?: Component;
74
+ AIMDTag?: Component;
75
+ AIMDStepRef?: Component;
76
+ StepRenderer?: Component;
77
+ CheckRenderer?: Component;
78
+ PreviewRenderer?: Component;
79
+ AssetRenderer?: Component;
80
+ EmbeddedRenderer?: Component;
81
+ MermaidBlock?: Component;
82
+ };
83
+ /**
84
+ * Quiz preview visibility policy
85
+ */
86
+ quizPreview?: QuizPreviewOptions;
87
+ /**
88
+ * Built-in renderer locale
89
+ */
90
+ locale?: AimdRendererI18nOptions["locale"];
91
+ /**
92
+ * Optional overrides for built-in renderer copy
93
+ */
94
+ messages?: AimdRendererI18nOptions["messages"];
95
+ /**
96
+ * Assigner block visibility policy in rendered output.
97
+ */
98
+ assignerVisibility?: AimdRendererOptions["assignerVisibility"];
99
+ }
100
+ /**
101
+ * Unified token renderer context
102
+ * Compatible interface for migration from markdown-it
103
+ */
104
+ export interface UnifiedRendererContext {
105
+ /**
106
+ * Render markdown/AIMD content to Vue VNodes
107
+ */
108
+ render: (content: string) => Promise<RenderResult>;
109
+ /**
110
+ * Extract fields from content
111
+ */
112
+ extractFields: (content: string) => ExtractedAimdFields;
113
+ /**
114
+ * Vue renderer options (for use with renderToVue)
115
+ */
116
+ vueOptions: VueRendererOptions;
117
+ }
118
+ /**
119
+ * Create unified-based token renderer
120
+ * Provides API compatible with createDefaultTokenRenderer from markdown-it version
121
+ */
122
+ export declare function createUnifiedTokenRenderer(options: UnifiedTokenRendererOptions): UnifiedRendererContext;
123
+ export type { ExtractedAimdFields, RenderResult, VueRendererOptions };
124
+ //# sourceMappingURL=unified-token-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified-token-renderer.d.ts","sourceRoot":"","sources":["../../src/common/unified-token-renderer.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,KAAK,CAAA;AAQ3C,OAAO,KAAK,EAAY,kBAAkB,EAAiB,MAAM,2BAA2B,CAAA;AAC5F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAQpE,OAAO,KAAK,EAAE,uBAAuB,EAAwB,MAAM,YAAY,CAAA;AAC/E,OAAO,KAAK,EAA0C,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACvH,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAWpE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK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AC,EAAE,SAAS,CAAA;QACxB,aAAa,CAAC,EAAE,SAAS,CAAA;QACzB,eAAe,CAAC,EAAE,SAAS,CAAA;QAC3B,aAAa,CAAC,EAAE,SAAS,CAAA;QACzB,gBAAgB,CAAC,EAAE,SAAS,CAAA;QAC5B,YAAY,CAAC,EAAE,SAAS,CAAA;KACzB,CAAA;IACD;;OAEG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAA;IAC1C;;OAEG;IACH,QAAQ,CAAC,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAA;IAC9C;;OAEG;IACH,kBAAkB,CAAC,EAAE,mBAAmB,CAAC,oBAAoB,CAAC,CAAA;CAC/D;AAurBD;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;IAClD;;OAEG;IACH,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,mBAAmB,CAAA;IACvD;;OAEG;IACH,UAAU,EAAE,kBAAkB,CAAA;CAC/B;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,2BAA2B,GAAG,sBAAsB,CAyCvG;AAGD,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * HTML rendering exports
3
+ */
4
+ export { createCustomElementAimdRenderer, createHtmlProcessor, renderToHtml, renderToHtmlSync, parseAndExtract, } from '../common/processor';
5
+ export { createAimdRendererMessages, DEFAULT_AIMD_RENDERER_LOCALE, resolveAimdRendererLocale, } from '../locales';
6
+ export type { ProcessorOptions } from '@airalogy/aimd-core/types';
7
+ export type { AimdAssignerVisibility, AimdHtmlNodeRenderer, AimdHtmlRendererContext, CustomElementAimdRendererOptions, AimdRendererOptions, RenderResult, } from '../common/processor';
8
+ export type { AimdRendererI18nOptions, AimdRendererLocale, AimdRendererMessages, AimdRendererMessagesInput, } from '../locales';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/html/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,YAAY,CAAA;AAEnB,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AACjE,YAAY,EACV,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,gCAAgC,EAChC,mBAAmB,EACnB,YAAY,GACb,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,YAAY,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-Cv8E7QsA.js";
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-CHbNEcN8.js";
2
2
  export {
3
3
  a as DEFAULT_AIMD_RENDERER_LOCALE,
4
4
  s as createAimdRendererMessages,
@@ -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, loadShikiHighlighter, type CodeBlockRendererOptions, type ElementRenderer, hastToVue, renderToVNodes, type LoadShikiHighlighterOptions, 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,oBA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