tsondb 0.8.0 → 0.8.1

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.
@@ -1,7 +1,7 @@
1
- import { type Decl } from "../index.ts";
1
+ import { type Decl, type EnumDecl, type TypeAliasDecl, type TypeParameter } from "../index.ts";
2
2
  import type { BaseNode } from "../Node.ts";
3
3
  import type { ArrayType } from "./generic/ArrayType.ts";
4
- import type { EnumType } from "./generic/EnumType.ts";
4
+ import type { EnumCaseDecl, EnumType } from "./generic/EnumType.ts";
5
5
  import type { MemberDecl, ObjectType } from "./generic/ObjectType.ts";
6
6
  import type { BooleanType } from "./primitives/BooleanType.ts";
7
7
  import type { DateType } from "./primitives/DateType.ts";
@@ -17,9 +17,23 @@ export interface BaseType extends BaseNode {
17
17
  }
18
18
  export type Type = BooleanType | DateType | FloatType | IntegerType | StringType | ArrayType | ObjectType | TypeArgumentType | ReferenceIdentifierType | IncludeIdentifierType | NestedEntityMapType | EnumType | ChildEntitiesType;
19
19
  export declare function walkTypeNodeTree(callbackFn: (type: Type, parentTypes: Type[], parentDecl: Decl) => void, type: Type, parentTypes: Type[], parentDecl: Decl): void;
20
+ type EnumCaseTypeAsType<Case extends string, T extends Type | null> = T extends object ? {
21
+ kind: Case;
22
+ } & {
23
+ [AV in Case]: AsType<T>;
24
+ } : {
25
+ kind: Case;
26
+ };
27
+ export type AsDeepType<T extends Type> = T extends ArrayType<infer I> ? AsType<I>[] : T extends ObjectType<infer P> ? {
28
+ [K in keyof P]: P[K] extends MemberDecl<Type, true> ? AsType<P[K]["type"]> : AsType<P[K]["type"]> | undefined;
29
+ } : T extends BooleanType ? boolean : T extends DateType ? Date : T extends FloatType ? number : T extends IntegerType ? number : T extends StringType ? string : T extends TypeArgumentType ? unknown : T extends IncludeIdentifierType<TypeParameter[], infer Decl> ? Decl extends TypeAliasDecl<string, infer TA> ? AsType<TA> : Decl extends EnumDecl<string, infer EC> ? AsType<EnumType<EC>> : unknown : T extends NestedEntityMapType ? unknown : T extends ReferenceIdentifierType ? string : T extends ChildEntitiesType ? string[] : T extends EnumType<infer EC> ? EC extends Record<string, EnumCaseDecl> ? {
30
+ [Case in keyof EC]: EnumCaseTypeAsType<Case & string, EC[Case]["type"]>;
31
+ }[keyof EC] : never : never;
20
32
  export type AsType<T extends Type> = T extends ArrayType<infer I> ? AsType<I>[] : T extends ObjectType<infer P> ? {
21
33
  [K in keyof P]: P[K] extends MemberDecl<Type, true> ? AsType<P[K]["type"]> : AsType<P[K]["type"]> | undefined;
22
- } : T extends BooleanType ? boolean : T extends DateType ? Date : T extends FloatType ? number : T extends IntegerType ? number : T extends StringType ? string : T extends TypeArgumentType ? unknown : T extends IncludeIdentifierType ? unknown : T extends NestedEntityMapType ? unknown : T extends ReferenceIdentifierType ? string : T extends ChildEntitiesType ? string[] : never;
34
+ } : T extends BooleanType ? boolean : T extends DateType ? Date : T extends FloatType ? number : T extends IntegerType ? number : T extends StringType ? string : T extends TypeArgumentType ? unknown : T extends IncludeIdentifierType ? unknown : T extends NestedEntityMapType ? unknown : T extends ReferenceIdentifierType ? string : T extends ChildEntitiesType ? string[] : T extends EnumType<infer EC> ? EC extends Record<string, EnumCaseDecl> ? {
35
+ [Case in keyof EC]: EnumCaseTypeAsType<Case & string, EC[Case]["type"]>;
36
+ }[keyof EC] : never : never;
23
37
  export type AsNode<T> = T extends (infer I)[] ? ArrayType<AsNode<I>> : T extends Record<string, unknown> ? ObjectType<{
24
38
  [K in keyof T]: T[K] extends MemberDecl ? T[K] : T extends null | undefined ? MemberDecl<AsNode<NonNullable<T[K]>>, false> : MemberDecl<AsNode<T[K]>, true>;
25
39
  }> : T extends string ? StringType : T extends number ? FloatType : T extends boolean ? BooleanType : T extends Date ? DateType : never;
@@ -31,3 +45,4 @@ export declare const findTypeAtPath: (type: Type, path: string[], options?: {
31
45
  */
32
46
  export type StructureFormatter<T extends Type> = (type: T, value: unknown) => unknown;
33
47
  export declare const formatValue: StructureFormatter<Type>;
48
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { assertExhaustive } from "../../../shared/utils/typeSafety.js";
2
- import { isTypeAliasDecl } from "../index.js";
2
+ import { isTypeAliasDecl, } from "../index.js";
3
3
  import { NodeKind } from "../Node.js";
4
4
  import { formatArrayValue, isArrayType } from "./generic/ArrayType.js";
5
5
  import { formatEnumType } from "./generic/EnumType.js";
@@ -2,13 +2,13 @@ import type { GetInstanceById } from "../../node/server/index.ts";
2
2
  import { type DisplayNameResult } from "../../shared/utils/displayName.ts";
3
3
  import type { InstanceContainer } from "../../shared/utils/instances.ts";
4
4
  import { type EntityDecl } from "../schema/declarations/EntityDecl.ts";
5
- import type { AsType, Type } from "../schema/types/Type.ts";
5
+ import type { AsDeepType, Type } from "../schema/types/Type.ts";
6
6
  export type GetChildInstancesForInstanceId = (parentEntityName: string, parentId: string, childEntityName: string) => {
7
7
  id: string;
8
8
  content: unknown;
9
9
  }[];
10
10
  export type DisplayNameCustomizer<T extends Type> = (params: {
11
- instance: AsType<T>;
11
+ instance: AsDeepType<T>;
12
12
  instanceId: string;
13
13
  instanceDisplayName: string;
14
14
  instanceDisplayNameLocaleId: string | undefined;
@@ -22,3 +22,10 @@ export declare const unique: <T>(arr: T[], equalityCheck?: (a: T, b: T) => boole
22
22
  * Moves an element from one position to another within the array.
23
23
  */
24
24
  export declare const reorder: <T>(arr: T[], sourceIndex: number, targetIndex: number) => T[];
25
+ /**
26
+ * Splits an array into chunks of a specified size.
27
+ * @param arr The array to be chunked.
28
+ * @param size The size of each chunk.
29
+ * @returns An array of chunks, where each chunk is an array of elements. The last chunk may be smaller than the specified size if there are not enough elements left.
30
+ */
31
+ export declare const chunk: <T>(arr: T[], size: number) => T[][];
@@ -59,3 +59,19 @@ export const reorder = (arr, sourceIndex, targetIndex) => {
59
59
  ...arr.slice(sourceIndex + 1),
60
60
  ];
61
61
  };
62
+ /**
63
+ * Splits an array into chunks of a specified size.
64
+ * @param arr The array to be chunked.
65
+ * @param size The size of each chunk.
66
+ * @returns An array of chunks, where each chunk is an array of elements. The last chunk may be smaller than the specified size if there are not enough elements left.
67
+ */
68
+ export const chunk = (arr, size) => {
69
+ if (size <= 0) {
70
+ throw new RangeError(`size must be a positive integer, got ${size.toString()}`);
71
+ }
72
+ return arr.reduce((chunks, item, index) => {
73
+ const chunkIndex = Math.floor(index / size);
74
+ (chunks[chunkIndex] ??= []).push(item);
75
+ return chunks;
76
+ }, []);
77
+ };
@@ -70,7 +70,7 @@ export type TableCellBlockNode = {
70
70
  content: InlineMarkdownNode[];
71
71
  };
72
72
  export type SectionBlockNode = {
73
- kind: "section";
73
+ kind: "container";
74
74
  name?: string;
75
75
  content: BlockMarkdownNode[];
76
76
  };
@@ -79,7 +79,16 @@ export type FootnoteBlockNode = {
79
79
  label: string;
80
80
  content: BlockMarkdownNode[];
81
81
  };
82
- export type BlockMarkdownNode = ParagraphBlockNode | HeadingBlockNode | ListBlockNode | TableBlockNode | SectionBlockNode | FootnoteBlockNode;
82
+ export type DefinitionListBlockNode = {
83
+ kind: "definitionList";
84
+ content: DefinitionListItemBlockNode[];
85
+ };
86
+ export type DefinitionListItemBlockNode = {
87
+ kind: "definitionListItem";
88
+ terms: InlineMarkdownNode[][];
89
+ definitions: BlockMarkdownNode[][];
90
+ };
91
+ export type BlockMarkdownNode = ParagraphBlockNode | HeadingBlockNode | ListBlockNode | TableBlockNode | SectionBlockNode | FootnoteBlockNode | DefinitionListBlockNode;
83
92
  type ListItemMarkerSyntaxNode = {
84
93
  kind: "listItemMarker";
85
94
  content: string;
@@ -100,7 +109,11 @@ type FootnoteMarkerSyntaxNode = {
100
109
  kind: "footnoteMarker";
101
110
  content: string;
102
111
  };
103
- type SyntaxNode = ListItemMarkerSyntaxNode | TableMarkerSyntaxNode | HeadingMarkerSyntaxNode | SectionMarkerSyntaxNode | FootnoteMarkerSyntaxNode;
112
+ type DefinitionMarkerSyntaxNode = {
113
+ kind: "definitionMarker";
114
+ content: string;
115
+ };
116
+ type SyntaxNode = ListItemMarkerSyntaxNode | TableMarkerSyntaxNode | HeadingMarkerSyntaxNode | SectionMarkerSyntaxNode | FootnoteMarkerSyntaxNode | DefinitionMarkerSyntaxNode;
104
117
  export type BlockSyntaxMarkdownNode = InlineMarkdownNode | SyntaxNode;
105
118
  export declare const parseBlockMarkdown: (text: string) => BlockMarkdownNode[];
106
119
  export declare const parseBlockMarkdownForSyntaxHighlighting: (text: string) => BlockSyntaxMarkdownNode[];
@@ -1,3 +1,4 @@
1
+ import { chunk } from "./array.js";
1
2
  import { omitUndefinedKeys } from "./object.js";
2
3
  import { assertExhaustive } from "./typeSafety.js";
3
4
  const codeRule = {
@@ -12,7 +13,7 @@ const codeRule = {
12
13
  }),
13
14
  };
14
15
  const boldWithItalicRule = {
15
- pattern: /(?<!\\)\*\*((.*?[^\\*])?\*(?!\*).*?[^\\*]\*.*?)(?<!\\)\*\*/,
16
+ pattern: /(?<!\\|\*\*.*)\*\*(([^\\*]*)?\*(?!\*).*?[^\\*]\*.*?)(?<!\\)\*\*/,
16
17
  map: (result, parseInside) => ({
17
18
  kind: "bold",
18
19
  content: parseInside(result[1] ?? ""),
@@ -23,7 +24,7 @@ const boldWithItalicRule = {
23
24
  }),
24
25
  };
25
26
  const italicWithBoldRule = {
26
- pattern: /(?<![\\*])\*(?=\*\*|[^*])(.*?\*\*.*?\*\*.*?)(?<=[^\\*]|[^\\]\*\*)\*(?!\*)/,
27
+ pattern: /(?<![\\*]|[\\*]\*.*)\*(?=\*\*|[^*])([^*]*?\*\*[^*]*?\*\*[^*]*?)(?<=[^\\*]|[^\\]\*\*)\*(?!\*)/,
27
28
  map: (result, parseInside) => ({
28
29
  kind: "italic",
29
30
  content: parseInside(result[1] ?? ""),
@@ -391,10 +392,10 @@ const tableRule = {
391
392
  ...nodesForTrailingWhitespace(trailingWhitespace),
392
393
  ],
393
394
  };
394
- const sectionRule = {
395
- pattern: /^::: (\w+)?(\n+)(.+?)\n:::(\n{2,}|\s*$)/s,
395
+ const containerRule = {
396
+ pattern: /^::: ([\w-_]+)?(\n+)(.+?)\n:::(\n{2,}|\s*$)/s,
396
397
  map: ([_match, name, _leadingContentWhitespace, content, _trailingWhitespace,]) => ({
397
- kind: "section",
398
+ kind: "container",
398
399
  name: name ?? undefined,
399
400
  content: parseBlockMarkdown(content ?? ""),
400
401
  }),
@@ -425,6 +426,7 @@ export const syntaxNodeToString = (node) => {
425
426
  case "headingMarker":
426
427
  case "sectionMarker":
427
428
  case "footnoteMarker":
429
+ case "definitionMarker":
428
430
  return node.content;
429
431
  case "footnoteRef":
430
432
  return node.label;
@@ -451,7 +453,8 @@ const addIndentationToSyntax = (nodes, nextUpperNode) => nodes.reduce((accNodes,
451
453
  case "tableMarker":
452
454
  case "headingMarker":
453
455
  case "sectionMarker":
454
- case "footnoteMarker": {
456
+ case "footnoteMarker":
457
+ case "definitionMarker": {
455
458
  const nextNode = nodes[index + 1] ?? nextUpperNode;
456
459
  const currentContent = currentNode.content.endsWith("\n") &&
457
460
  nextNode &&
@@ -483,12 +486,59 @@ const footnoteRule = {
483
486
  ...nodesForTrailingWhitespace(trailingWhitespace),
484
487
  ],
485
488
  };
489
+ const definitionListItemSeparatorPattern = /(^.+?(?=\n:)|\n\n[^: ].*?(?=\n:))/s;
490
+ const definitionListRule = {
491
+ pattern: /((?:[^\n]+?(?:\n[^\n]+?)*)(?:\n: .+?(?:\n {2}.+?)*)+(?:\n\n(?:[^\n]+?(?:\n[^\n]+?)*)(?:\n: .+?(?:\n(?=\n)|\n {2}.+?)*))*)(\n{2,}|\s*$)/,
492
+ map: ([_res, content = "", _trailingWhitespace]) => {
493
+ const definitionItemPairs = chunk(content.split(definitionListItemSeparatorPattern).slice(1), 2);
494
+ const items = definitionItemPairs.map(([termsText = "", definitionsText = ""]) => {
495
+ const terms = termsText
496
+ .trim()
497
+ .split("\n")
498
+ .map(term => parseInlineMarkdown(term.trim(), false));
499
+ const definitions = definitionsText
500
+ .split("\n:")
501
+ .slice(1)
502
+ .map(definition => parseBlockMarkdown(removeIndentation(definition.trim())));
503
+ return {
504
+ kind: "definitionListItem",
505
+ terms,
506
+ definitions,
507
+ };
508
+ });
509
+ return {
510
+ kind: "definitionList",
511
+ content: items,
512
+ };
513
+ },
514
+ mapHighlighting: ([_res, content = "", trailingWhitespace]) => {
515
+ const items = chunk(content.split(definitionListItemSeparatorPattern).slice(1), 2).flatMap(([termsText = "", definitionsText = ""]) => {
516
+ const terms = termsText
517
+ .split("\n")
518
+ .flatMap((term, index, termArray) => [
519
+ ...parseInlineMarkdown(term, true),
520
+ ...(index < termArray.length - 1 ? [textNode("\n")] : []),
521
+ ]);
522
+ const definitions = definitionsText
523
+ .split("\n:")
524
+ .slice(1)
525
+ .flatMap((definition, defIndex, defArray) => [
526
+ { kind: "definitionMarker", content: ":" },
527
+ ...addIndentationToSyntax(parseBlockMarkdownForSyntaxHighlighting(removeIndentation(definition))),
528
+ ...(defIndex < defArray.length - 1 ? [textNode("\n")] : []),
529
+ ]);
530
+ return [...terms, textNode("\n"), ...definitions];
531
+ });
532
+ return [...items, ...nodesForTrailingWhitespace(trailingWhitespace)];
533
+ },
534
+ };
486
535
  const blockRules = [
487
- sectionRule,
536
+ containerRule,
488
537
  headingRule,
489
538
  footnoteRule,
490
539
  tableRule,
491
540
  listRule,
541
+ definitionListRule,
492
542
  paragraphRule,
493
543
  ];
494
544
  const parseActiveBlockRule = (rule, res) => [
@@ -530,9 +580,9 @@ const reduceSyntaxNode = (node) => {
530
580
  switch (node.kind) {
531
581
  case "bold":
532
582
  case "italic":
583
+ case "link":
533
584
  return { ...node, content: reduceSyntaxNodes(node.content) };
534
585
  case "code":
535
- case "link":
536
586
  case "attributed":
537
587
  case "text":
538
588
  case "listItemMarker":
@@ -541,6 +591,7 @@ const reduceSyntaxNode = (node) => {
541
591
  case "sectionMarker":
542
592
  case "footnoteMarker":
543
593
  case "footnoteRef":
594
+ case "definitionMarker":
544
595
  return node;
545
596
  default:
546
597
  return assertExhaustive(node);
@@ -556,6 +607,7 @@ const syntaxNodeMergeRules = {
556
607
  headingMarker: (a, b) => ({ ...a, content: a.content + b.content }),
557
608
  sectionMarker: (a, b) => ({ ...a, content: a.content + b.content }),
558
609
  footnoteMarker: (a, b) => ({ ...a, content: a.content + b.content }),
610
+ definitionMarker: (a, b) => ({ ...a, content: a.content + b.content }),
559
611
  footnoteRef: null,
560
612
  link: null,
561
613
  attributed: null,
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
2
  import { useLocation, useRoute } from "preact-iso";
3
- import { useCallback, useContext, useEffect, useState } from "preact/hooks";
3
+ import { useCallback, useContext, useEffect, useMemo, useState } from "preact/hooks";
4
4
  import { removeAt } from "../../shared/utils/array.js";
5
5
  import { deepEqual } from "../../shared/utils/compare.js";
6
6
  import { getSerializedDisplayNameFromEntityInstance } from "../../shared/utils/displayName.js";
@@ -37,17 +37,18 @@ export const InstanceRouteSkeleton = ({ mode, buttons, init, titleBuilder, onSub
37
37
  const [customId, setCustomId] = useState("");
38
38
  const client = useContext(GitClientContext);
39
39
  const { route } = useLocation();
40
+ const hasUnsavedChanges = useMemo(() => !deepEqual(instanceContent, savedInstanceContent), [instanceContent, savedInstanceContent]);
40
41
  useEffect(() => {
41
- if (deepEqual(instanceContent, savedInstanceContent)) {
42
- window.removeEventListener("beforeunload", onBeforeUnload);
42
+ if (hasUnsavedChanges) {
43
+ window.addEventListener("beforeunload", onBeforeUnload);
43
44
  }
44
45
  else {
45
- window.addEventListener("beforeunload", onBeforeUnload);
46
+ window.removeEventListener("beforeunload", onBeforeUnload);
46
47
  }
47
48
  return () => {
48
49
  window.removeEventListener("beforeunload", onBeforeUnload);
49
50
  };
50
- }, [instanceContent, savedInstanceContent]);
51
+ }, [hasUnsavedChanges]);
51
52
  useEffect(() => {
52
53
  document.title =
53
54
  (entity && titleBuilder({ locales, entity, instanceContent, instanceId: id })) ??
@@ -147,5 +148,5 @@ export const InstanceRouteSkeleton = ({ mode, buttons, init, titleBuilder, onSub
147
148
  }
148
149
  }, children: "Delete" }))] }), !id && isLocaleEntity && (_jsxs("div", { class: "field field--id", children: [_jsx("label", { htmlFor: "id", children: "ID" }), _jsx("p", { className: "comment", children: "The instance\u2019s identifier. An IETF language tag (BCP47)." }), _jsx("input", { type: "text", id: "id", value: customId, required: true, pattern: "[a-z]{2,3}(-[A-Z]{2,3})?", placeholder: "en-US, de-DE, \u2026", onInput: event => {
149
150
  setCustomId(event.currentTarget.value);
150
- }, "aria-invalid": idErrors.length > 0 }), _jsx(ValidationErrors, { errors: idErrors })] })), _jsxs("form", { onSubmit: handleSubmit, children: [_jsx(TypeInput, { type: entity.type, value: instanceContent, path: undefined, instanceNamesByEntity: instanceNamesByEntity, childInstances: childInstances, getDeclFromDeclName: getDeclFromDeclName, onChange: setInstanceContent, onChildChange: handleOnChildChange, onChildAdd: handleOnChildAdd, onChildRemove: handleOnChildRemove, checkIsLocaleEntity: checkIsLocaleEntity }), _jsx("div", { class: "form-footer btns", children: buttons.map(button => (_jsx("button", { type: "submit", name: button.name, class: button.primary ? "primary" : undefined, children: button.label }, button.name))) })] })] }));
151
+ }, "aria-invalid": idErrors.length > 0 }), _jsx(ValidationErrors, { errors: idErrors })] })), _jsxs("form", { onSubmit: handleSubmit, children: [_jsx(TypeInput, { type: entity.type, value: instanceContent, path: undefined, instanceNamesByEntity: instanceNamesByEntity, childInstances: childInstances, getDeclFromDeclName: getDeclFromDeclName, onChange: setInstanceContent, onChildChange: handleOnChildChange, onChildAdd: handleOnChildAdd, onChildRemove: handleOnChildRemove, checkIsLocaleEntity: checkIsLocaleEntity }), _jsx("div", { class: "form-footer btns", children: buttons.map(button => (_jsx("button", { type: "submit", name: button.name, class: button.primary ? "primary" : undefined, disabled: !hasUnsavedChanges, children: button.label }, button.name))) })] })] }));
151
152
  };
@@ -24,6 +24,7 @@ const onSubmit = async ({ locales, entity, buttonName, instanceContent, isLocale
24
24
  switch (buttonName) {
25
25
  case "saveandcontinue": {
26
26
  route(`/entities/${entity.name}/instances/${createdInstance.instance.id}`);
27
+ setInstanceContent(createdInstance.instance.content);
27
28
  break;
28
29
  }
29
30
  case "saveandaddanother": {
@@ -21,7 +21,7 @@ const titleBuilder = ({ locales, entity, instanceId, instanceContent, }) => {
21
21
  }
22
22
  return undefined;
23
23
  };
24
- const onSubmit = async ({ locales, entity, instanceId, instanceContent, buttonName, childInstances, route, updateLocalGitState, }) => {
24
+ const onSubmit = async ({ locales, entity, instanceId, instanceContent, buttonName, childInstances, route, updateLocalGitState, setInstanceContent, }) => {
25
25
  try {
26
26
  if (instanceId && buttonName) {
27
27
  await updateInstanceByEntityNameAndId(locales, entity.name, instanceId, {
@@ -33,6 +33,7 @@ const onSubmit = async ({ locales, entity, instanceId, instanceContent, buttonNa
33
33
  await updateLocalGitState?.();
34
34
  switch (buttonName) {
35
35
  case "saveandcontinue": {
36
+ setInstanceContent(instanceContent);
36
37
  break;
37
38
  }
38
39
  case "save": {
@@ -18,12 +18,14 @@ export const BlockMarkdown = ({ node, outerHeadingLevel = 0, insertBefore, }) =>
18
18
  }
19
19
  case "table":
20
20
  return (_jsxs(_Fragment, { children: [insertBefore, _jsxs("table", { children: [node.caption !== undefined && (_jsx("caption", { children: node.caption.map((inline, ci) => (_jsx(InlineMarkdown, { node: inline }, ci))) })), _jsx("thead", { children: _jsx(TableRow, { cells: node.header, cellType: "th" }) }), checkTableRowsAreSections(node.rows) ? (node.rows.map((section, si) => (_jsxs("tbody", { children: [section.header && _jsx(TableRow, { cells: section.header, cellType: "th" }), section.rows.map((row, ri) => (_jsx(TableRow, { cells: row.cells }, ri)))] }, si)))) : (_jsx("tbody", { children: node.rows.map((row, ri) => (_jsx(TableRow, { cells: row.cells }, ri))) }))] })] }));
21
- case "section":
22
- return (_jsxs("div", { class: node.name, children: [insertBefore, node.content.map((childNode, i) => (_jsx(BlockMarkdown, { node: childNode }, i)))] }));
21
+ case "container":
22
+ return (_jsxs("div", { class: node.name, children: [insertBefore, node.content.map((childNode, i) => (_jsx(BlockMarkdown, { node: childNode, outerHeadingLevel: outerHeadingLevel }, i)))] }));
23
23
  case "footnote": {
24
24
  const label = (_jsxs(_Fragment, { children: [_jsxs("span", { class: "footnote-label", children: [node.label, /^\*+$/.test(node.label) ? ")" : ":"] }), " "] }));
25
- return (_jsxs("div", { role: "note", children: [insertBefore, node.content.map((n, i) => (_jsx(BlockMarkdown, { node: n, insertBefore: label }, i)))] }));
25
+ return (_jsxs("div", { role: "note", children: [insertBefore, node.content.map((n, i) => (_jsx(BlockMarkdown, { node: n, outerHeadingLevel: outerHeadingLevel, insertBefore: label }, i)))] }));
26
26
  }
27
+ case "definitionList":
28
+ return (_jsxs(_Fragment, { children: [insertBefore, _jsx("dl", { children: node.content.map((item, ii) => (_jsxs("div", { children: [item.terms.map((term, ti) => (_jsx("dt", { children: term.map((inline, iii) => (_jsx(InlineMarkdown, { node: inline }, iii))) }, ti))), item.definitions.map((definition, di) => (_jsx("dd", { children: definition.map((n, i) => (_jsx(BlockMarkdown, { node: n, outerHeadingLevel: outerHeadingLevel }, i))) }, di)))] }, ii))) })] }));
27
29
  default:
28
30
  return assertExhaustive(node);
29
31
  }
@@ -14,6 +14,8 @@ export const BlockMarkdownHighlighting = ({ node }) => {
14
14
  return _jsx("span", { class: "footnote-marker", children: node.content });
15
15
  case "footnoteRef":
16
16
  return _jsx("span", { class: "footnote-marker", children: node.label });
17
+ case "definitionMarker":
18
+ return _jsx("span", { class: "definition-description-marker", children: node.content });
17
19
  default:
18
20
  return _jsx(InlineMarkdown, { node: node });
19
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsondb",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Lukas Obermann",
@@ -725,7 +725,7 @@ form > .field--container {
725
725
  color: var(--color-syntax-italic);
726
726
  }
727
727
 
728
- .editor-highlighting .list-item-marker {
728
+ .editor-highlighting :is(.list-item-marker, .definition-description-marker) {
729
729
  color: var(--color-syntax-list-item-marker);
730
730
  }
731
731