@art-md/constructs 0.0.4 → 0.0.6

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 (133) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +1 -1
  3. package/dist/factories/constructs/Document/factory/createDocument.d.ts +3 -0
  4. package/dist/factories/constructs/Document/factory/types.d.ts +4 -0
  5. package/dist/factories/constructs/Document/index.d.ts +2 -0
  6. package/dist/factories/constructs/FieldBlock/factory/createFieldBlock.d.ts +3 -0
  7. package/dist/factories/constructs/FieldBlock/factory/types.d.ts +7 -0
  8. package/dist/factories/constructs/FieldBlock/index.d.ts +3 -0
  9. package/dist/factories/constructs/FieldBlock/types.d.ts +9 -0
  10. package/dist/factories/constructs/FieldInline/factory/createFieldInline.d.ts +3 -0
  11. package/dist/factories/constructs/FieldInline/factory/types.d.ts +7 -0
  12. package/dist/factories/constructs/FieldInline/index.d.ts +3 -0
  13. package/dist/factories/constructs/FieldInline/types.d.ts +9 -0
  14. package/dist/factories/constructs/NaturalBlock/factory/createNaturalBlock.d.ts +3 -0
  15. package/dist/factories/constructs/NaturalBlock/factory/types.d.ts +11 -0
  16. package/dist/factories/constructs/NaturalBlock/index.d.ts +3 -0
  17. package/dist/factories/constructs/NaturalBlock/types.d.ts +12 -0
  18. package/dist/factories/constructs/NaturalExpression/factory/createNaturalExpression.d.ts +3 -0
  19. package/dist/factories/constructs/NaturalExpression/factory/types.d.ts +7 -0
  20. package/dist/factories/constructs/NaturalExpression/index.d.ts +3 -0
  21. package/dist/factories/constructs/NaturalExpression/types.d.ts +8 -0
  22. package/dist/factories/constructs/SectionBlock/factory/createSectionBlock.d.ts +3 -0
  23. package/dist/factories/constructs/SectionBlock/factory/types.d.ts +8 -0
  24. package/dist/factories/constructs/SectionBlock/index.d.ts +3 -0
  25. package/dist/factories/constructs/SectionBlock/types.d.ts +9 -0
  26. package/dist/factories/constructs/Tag/factory/createTag.d.ts +3 -0
  27. package/dist/factories/constructs/Tag/factory/types.d.ts +3 -0
  28. package/dist/factories/constructs/Tag/index.d.ts +3 -0
  29. package/dist/factories/constructs/Tag/types.d.ts +5 -0
  30. package/dist/factories/index.d.ts +8 -0
  31. package/dist/factories/public.d.ts +36 -0
  32. package/dist/factories/types.d.ts +31 -0
  33. package/dist/index.d.ts +3 -0
  34. package/dist/index.mjs +627 -0
  35. package/dist/index.mjs.map +7 -0
  36. package/dist/parser/constructs/FieldBlock/createFieldBlockParser.d.ts +2 -0
  37. package/dist/parser/constructs/FieldBlock/index.d.ts +1 -0
  38. package/dist/parser/constructs/FieldBlock/private/helpers/createFieldBlockFromNode.d.ts +4 -0
  39. package/dist/parser/constructs/FieldBlock/private/helpers/onBeforeConstruct.d.ts +2 -0
  40. package/dist/parser/constructs/FieldBlock/private/index.d.ts +2 -0
  41. package/dist/parser/constructs/FieldBlock/private/integrator/createFieldBlockIntegrator.d.ts +2 -0
  42. package/dist/parser/constructs/FieldBlock/private/processor/createFieldBlockProcessor.d.ts +2 -0
  43. package/dist/parser/constructs/FieldInline/createFieldInlineParser.d.ts +2 -0
  44. package/dist/parser/constructs/FieldInline/index.d.ts +1 -0
  45. package/dist/parser/constructs/FieldInline/private/helpers/createFieldInlineFromNode.d.ts +4 -0
  46. package/dist/parser/constructs/FieldInline/private/helpers/trimFieldEdges.d.ts +2 -0
  47. package/dist/parser/constructs/FieldInline/private/index.d.ts +1 -0
  48. package/dist/parser/constructs/FieldInline/private/processor/createFieldInlineProcessor.d.ts +2 -0
  49. package/dist/parser/constructs/NaturalBlock/createNaturalBlockParser.d.ts +2 -0
  50. package/dist/parser/constructs/NaturalBlock/index.d.ts +1 -0
  51. package/dist/parser/constructs/NaturalBlock/private/helpers/createNaturalBlockFromNode.d.ts +4 -0
  52. package/dist/parser/constructs/NaturalBlock/private/index.d.ts +1 -0
  53. package/dist/parser/constructs/NaturalBlock/private/processor/createNaturalBlockProcessor.d.ts +2 -0
  54. package/dist/parser/constructs/SectionBlock/createSectionBlockParser.d.ts +2 -0
  55. package/dist/parser/constructs/SectionBlock/index.d.ts +1 -0
  56. package/dist/parser/constructs/SectionBlock/private/helpers/createSectionBlockFromNode.d.ts +4 -0
  57. package/dist/parser/constructs/SectionBlock/private/helpers/findParentSection.d.ts +3 -0
  58. package/dist/parser/constructs/SectionBlock/private/index.d.ts +2 -0
  59. package/dist/parser/constructs/SectionBlock/private/integrator/createSectionBlockIntegrator.d.ts +2 -0
  60. package/dist/parser/constructs/SectionBlock/private/processor/createSectionBlockProcessor.d.ts +2 -0
  61. package/dist/parser/document/createArtDocumentFromNode.d.ts +3 -0
  62. package/dist/parser/document/index.d.ts +1 -0
  63. package/dist/parser/fields/constants.d.ts +1 -0
  64. package/dist/parser/fields/index.d.ts +3 -0
  65. package/dist/parser/fields/isFieldStrong.d.ts +3 -0
  66. package/dist/parser/fields/stripStrong.d.ts +3 -0
  67. package/dist/parser/index.d.ts +6 -0
  68. package/dist/parser/mdast/index.d.ts +1 -0
  69. package/dist/parser/mdast/rawSlice.d.ts +2 -0
  70. package/dist/parser/naturalExpression/createNaturalExpressionFromNode.d.ts +3 -0
  71. package/dist/parser/naturalExpression/index.d.ts +1 -0
  72. package/dist/parser/public.d.ts +5 -0
  73. package/dist/parser/tags/extractTags.d.ts +5 -0
  74. package/dist/parser/tags/index.d.ts +1 -0
  75. package/dist/parser/types.d.ts +14 -0
  76. package/dist/serializer/constructs/Document/createDocumentToMdast.d.ts +2 -0
  77. package/dist/serializer/constructs/Document/index.d.ts +1 -0
  78. package/dist/serializer/constructs/FieldBlock/createFieldBlockToMdast.d.ts +2 -0
  79. package/dist/serializer/constructs/FieldBlock/index.d.ts +1 -0
  80. package/dist/serializer/constructs/FieldInline/createFieldInlineToMdast.d.ts +2 -0
  81. package/dist/serializer/constructs/FieldInline/index.d.ts +1 -0
  82. package/dist/serializer/constructs/NaturalBlock/createNaturalBlockToMdast.d.ts +2 -0
  83. package/dist/serializer/constructs/NaturalBlock/index.d.ts +1 -0
  84. package/dist/serializer/constructs/NaturalExpression/createNaturalExpressionToMdast.d.ts +2 -0
  85. package/dist/serializer/constructs/NaturalExpression/index.d.ts +1 -0
  86. package/dist/serializer/constructs/SectionBlock/createSectionBlockToMdast.d.ts +2 -0
  87. package/dist/serializer/constructs/SectionBlock/index.d.ts +1 -0
  88. package/dist/serializer/index.d.ts +7 -0
  89. package/dist/serializer/public.d.ts +3 -0
  90. package/dist/serializer/tags/index.d.ts +2 -0
  91. package/dist/serializer/tags/tagToMdast.d.ts +3 -0
  92. package/dist/serializer/tags/tagsToMdast.d.ts +3 -0
  93. package/dist/serializer/types.d.ts +7 -0
  94. package/dist/test/helpers/constructs/FieldBlock/createFieldBlockFromNodeMock.d.ts +7 -0
  95. package/dist/test/helpers/constructs/FieldBlock/createFieldBlockMock.d.ts +7 -0
  96. package/dist/test/helpers/constructs/FieldBlock/makeFieldBlockFixture.d.ts +9 -0
  97. package/dist/test/helpers/constructs/FieldBlock/makeFieldBlockMock.d.ts +9 -0
  98. package/dist/test/helpers/constructs/FieldInline/createFieldInlineFromNodeMock.d.ts +7 -0
  99. package/dist/test/helpers/constructs/FieldInline/createFieldInlineMock.d.ts +7 -0
  100. package/dist/test/helpers/constructs/FieldInline/makeFieldInlineFixture.d.ts +9 -0
  101. package/dist/test/helpers/constructs/FieldInline/makeFieldInlineMock.d.ts +9 -0
  102. package/dist/test/helpers/constructs/NaturalBlock/createNaturalBlockFromNodeMock.d.ts +7 -0
  103. package/dist/test/helpers/constructs/NaturalBlock/createNaturalBlockMock.d.ts +7 -0
  104. package/dist/test/helpers/constructs/NaturalBlock/makeNaturalBlockFixture.d.ts +12 -0
  105. package/dist/test/helpers/constructs/NaturalBlock/makeNaturalBlockMock.d.ts +12 -0
  106. package/dist/test/helpers/constructs/NaturalExpression/makeNaturalExpressionFixture.d.ts +10 -0
  107. package/dist/test/helpers/constructs/NaturalExpression/makeNaturalExpressionMock.d.ts +10 -0
  108. package/dist/test/helpers/constructs/SectionBlock/createSectionBlockFromNodeMock.d.ts +7 -0
  109. package/dist/test/helpers/constructs/SectionBlock/createSectionBlockMock.d.ts +7 -0
  110. package/dist/test/helpers/constructs/SectionBlock/makeSectionBlockFixture.d.ts +10 -0
  111. package/dist/test/helpers/constructs/Tag/makeTagFixture.d.ts +7 -0
  112. package/dist/test/helpers/constructs/index.d.ts +14 -0
  113. package/dist/test/helpers/index.d.ts +2 -0
  114. package/dist/test/helpers/parsers/fields/stripStrongMock.d.ts +7 -0
  115. package/dist/test/helpers/parsers/index.d.ts +5 -0
  116. package/dist/test/helpers/parsers/mdast/rawSliceMock.d.ts +7 -0
  117. package/dist/test/helpers/parsers/natural-expression/createNaturalExpressionFromNodeMock.d.ts +7 -0
  118. package/dist/test/helpers/parsers/tags/extractTagsMock.d.ts +7 -0
  119. package/dist/test/helpers/parsers/tags/tagToMdastMock.d.ts +7 -0
  120. package/package.json +34 -15
  121. package/src/parser/constructs/FieldBlock/private/helpers/createFieldBlockFromNode.test.ts +1 -1
  122. package/src/parser/constructs/FieldBlock/private/integrator/createFieldBlockIntegrator.test.ts +1 -1
  123. package/src/parser/constructs/FieldBlock/private/processor/createFieldBlockProcessor.test.ts +1 -1
  124. package/src/parser/constructs/FieldInline/private/helpers/createFieldInlineFromNode.test.ts +1 -1
  125. package/src/parser/constructs/FieldInline/private/processor/createFieldInlineProcessor.test.ts +1 -1
  126. package/src/parser/constructs/NaturalBlock/private/helpers/createNaturalBlockFromNode.test.ts +1 -1
  127. package/src/parser/constructs/NaturalBlock/private/processor/createNaturalBlockProcessor.test.ts +1 -1
  128. package/src/parser/constructs/SectionBlock/private/helpers/createSectionBlockFromNode.test.ts +1 -1
  129. package/src/parser/constructs/SectionBlock/private/helpers/findParentSection.test.ts +1 -1
  130. package/src/parser/constructs/SectionBlock/private/integrator/createSectionBlockIntegrator.test.ts +1 -1
  131. package/src/parser/constructs/SectionBlock/private/processor/createSectionBlockProcessor.test.ts +1 -1
  132. package/src/parser/document/createArtDocumentFromNode.test.ts +1 -1
  133. package/src/parser/naturalExpression/createNaturalExpressionFromNode.test.ts +1 -6
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../primitives/src/document/createArtDocument.ts", "../../primitives/src/parser/context/createParseContext.ts", "../../primitives/src/parser/context/private/createParserVisitContextBase.ts", "../../primitives/src/parser/context/createParserVisitContext.ts", "../../primitives/src/parser/helpers/nodePosition.ts", "../../primitives/src/parser/helpers/sectionDepth.ts", "../../primitives/src/serializer/context/createSerializeContext.ts", "../../primitives/src/source/createArtDocumentSource.ts", "../src/factories/constructs/Document/factory/createDocument.ts", "../src/factories/constructs/FieldBlock/factory/createFieldBlock.ts", "../src/factories/constructs/FieldInline/factory/createFieldInline.ts", "../src/factories/constructs/NaturalBlock/factory/createNaturalBlock.ts", "../src/factories/constructs/NaturalExpression/factory/createNaturalExpression.ts", "../src/factories/constructs/SectionBlock/factory/createSectionBlock.ts", "../src/factories/constructs/Tag/factory/createTag.ts", "../src/factories/public.ts", "../src/parser/constructs/FieldBlock/private/helpers/onBeforeConstruct.ts", "../src/parser/constructs/FieldBlock/private/integrator/createFieldBlockIntegrator.ts", "../src/parser/fields/constants.ts", "../src/parser/mdast/rawSlice.ts", "../src/parser/fields/stripStrong.ts", "../src/parser/fields/isFieldStrong.ts", "../src/parser/tags/extractTags.ts", "../src/parser/constructs/FieldBlock/private/helpers/createFieldBlockFromNode.ts", "../src/parser/constructs/FieldBlock/private/processor/createFieldBlockProcessor.ts", "../src/parser/constructs/FieldBlock/createFieldBlockParser.ts", "../src/parser/naturalExpression/createNaturalExpressionFromNode.ts", "../src/parser/constructs/FieldInline/private/helpers/trimFieldEdges.ts", "../src/parser/constructs/FieldInline/private/helpers/createFieldInlineFromNode.ts", "../src/parser/constructs/FieldInline/private/processor/createFieldInlineProcessor.ts", "../src/parser/constructs/FieldInline/createFieldInlineParser.ts", "../src/parser/constructs/NaturalBlock/private/helpers/createNaturalBlockFromNode.ts", "../src/parser/constructs/NaturalBlock/private/processor/createNaturalBlockProcessor.ts", "../src/parser/constructs/NaturalBlock/createNaturalBlockParser.ts", "../src/parser/constructs/SectionBlock/private/helpers/findParentSection.ts", "../src/parser/constructs/SectionBlock/private/integrator/createSectionBlockIntegrator.ts", "../src/parser/constructs/SectionBlock/private/helpers/createSectionBlockFromNode.ts", "../src/parser/constructs/SectionBlock/private/processor/createSectionBlockProcessor.ts", "../src/parser/constructs/SectionBlock/createSectionBlockParser.ts", "../src/parser/document/createArtDocumentFromNode.ts", "../src/parser/public.ts", "../src/serializer/constructs/Document/createDocumentToMdast.ts", "../src/serializer/tags/tagToMdast.ts", "../src/serializer/tags/tagsToMdast.ts", "../src/serializer/constructs/FieldBlock/createFieldBlockToMdast.ts", "../src/serializer/constructs/FieldInline/createFieldInlineToMdast.ts", "../src/serializer/constructs/NaturalBlock/createNaturalBlockToMdast.ts", "../src/serializer/constructs/NaturalExpression/createNaturalExpressionToMdast.ts", "../src/serializer/constructs/SectionBlock/createSectionBlockToMdast.ts", "../src/serializer/public.ts"],
4
+ "sourcesContent": ["import type { ArtDocument, ArtDocumentFactoryData } from './types.js';\n\nexport function createArtDocument(data?: ArtDocumentFactoryData): ArtDocument {\n\treturn {\n\t\tconstruct: 'Document',\n\t\tchildren: data?.children ?? [],\n\t};\n}\n", "import type { ParseContext, ParserContextData } from './types.js';\n\nexport function createParseContext(data: ParserContextData): ParseContext {\n\treturn { uri: data.uri };\n}\n", "import type { ConstructBase, ContainerConstructBase } from '../../../constructs/index.js';\nimport { createParseContext } from '../createParseContext.js';\nimport type {\n\tOnBeforeConstruct,\n\tParseContext,\n\tParserSource,\n\tParserVisitContext,\n} from '../types.js';\n\nexport function createParserVisitContextBase(\n\tsource: ParserSource,\n\tconstruct: ContainerConstructBase,\n\tparentContext: ParserVisitContext | undefined,\n\tonBeforeConstruct?: OnBeforeConstruct,\n\tparseContext: ParseContext = createParseContext({ uri: '' }),\n): ParserVisitContext {\n\tconst context: ParserVisitContext = {\n\t\tconstruct,\n\t\tsource,\n\t\tparseContext,\n\t\tcaptureChildConstruct(child: ConstructBase) {\n\t\t\tconstruct.children.push(child);\n\t\t},\n\t\tonBeforeConstruct(construct: ConstructBase) {\n\t\t\treturn onBeforeConstruct ? onBeforeConstruct(construct, context) : context;\n\t\t},\n\t\tchildContext(construct: ContainerConstructBase, onBeforeConstruct?: OnBeforeConstruct) {\n\t\t\treturn createParserVisitContextBase(\n\t\t\t\tsource,\n\t\t\t\tconstruct,\n\t\t\t\tcontext,\n\t\t\t\tonBeforeConstruct,\n\t\t\t\tparseContext,\n\t\t\t);\n\t\t},\n\t\tparent() {\n\t\t\treturn parentContext;\n\t\t},\n\t};\n\n\treturn context;\n}\n", "import type { ContainerConstructBase } from '../../constructs/index.js';\n\nimport { createParseContext } from './createParseContext.js';\nimport { createParserVisitContextBase } from './private/createParserVisitContextBase.js';\nimport type { ParseContext, ParserSource, ParserVisitContext } from './types.js';\n\nexport function createParserVisitContext(\n\tconstruct: ContainerConstructBase,\n\tsource: ParserSource,\n\tparseContext: ParseContext = createParseContext({ uri: '' }),\n): ParserVisitContext {\n\treturn createParserVisitContextBase(source, construct, undefined, undefined, parseContext);\n}\n", "import type { Node } from 'unist';\n\nimport type { Position } from '../types.js';\n\nexport function nodePosition(node: Node): Position {\n\tif (!node.position) {\n\t\tthrow new Error(`Expected source position for ${node.type}`);\n\t}\n\n\tconst raw = node.position;\n\n\tif (!raw?.start || !raw.end) {\n\t\tthrow new Error(`Expected source position for ${node.type}`);\n\t}\n\treturn {\n\t\tstart: {\n\t\t\tline: raw.start.line,\n\t\t\tcolumn: raw.start.column,\n\t\t\toffset: raw.start.offset ?? 0,\n\t\t},\n\t\tend: {\n\t\t\tline: raw.end.line,\n\t\t\tcolumn: raw.end.column,\n\t\t\toffset: raw.end.offset ?? 0,\n\t\t},\n\t};\n}\n", "export function sectionDepth(section: { depth?: number }): number {\n\treturn section.depth ?? 1;\n}\n", "import type { SerializeContext, SerializerContextData } from './types.js';\n\nexport function createSerializeContext(data: SerializerContextData): SerializeContext {\n\treturn { uri: data.uri };\n}\n", "import type { ArtCodec } from '../codec/types.js';\nimport type { ArtDocument } from '../document/index.js';\n\nimport type { ArtContentSource, ArtDocumentSource } from './types.js';\n\nexport function createArtDocumentSource(\n\tcodec: ArtCodec,\n\tcontentSource: ArtContentSource,\n): ArtDocumentSource {\n\tlet cached: ArtDocument | undefined;\n\n\treturn {\n\t\ttype: contentSource.type,\n\t\turi: contentSource.uri,\n\t\tget maybeDocument() {\n\t\t\treturn cached;\n\t\t},\n\t\tasync readDocument() {\n\t\t\tif (cached) return cached;\n\t\t\tconst content = await contentSource.readContent();\n\t\t\tconst result = codec.parse(content);\n\t\t\tcached = result.document;\n\t\t\treturn cached;\n\t\t},\n\t\tasync writeDocument(doc) {\n\t\t\tconst result = codec.serialize(doc);\n\t\t\tawait contentSource.writeContent(result.content);\n\t\t\tcached = doc;\n\t\t},\n\t};\n}\n", "import { type ArtDocument, createArtDocument } from '@art-md/primitives';\n\nimport type { DocumentFactoryData } from './types.js';\n\nexport function createDocument(data: DocumentFactoryData): ArtDocument {\n\tconst docData = {\n\t\t...data,\n\t\tchildren: data.children || [],\n\t};\n\treturn createArtDocument(docData);\n}\n", "import type { FieldBlock } from '../types.js';\n\nimport type { FieldBlockFactoryData } from './types.js';\n\nexport function createFieldBlock(data: FieldBlockFactoryData): FieldBlock {\n\tconst field: FieldBlock = {\n\t\tconstruct: 'FieldBlock',\n\t\tname: data.name,\n\t\tchildren: data.children ?? [],\n\t};\n\tif (data.tags?.length) {\n\t\tfield.tags = data.tags;\n\t}\n\treturn field;\n}\n", "import type { FieldInline } from '../types.js';\n\nimport type { FieldInlineFactoryData } from './types.js';\n\nexport function createFieldInline(data: FieldInlineFactoryData): FieldInline {\n\tconst field: FieldInline = {\n\t\tconstruct: 'FieldInline',\n\t\tname: data.name,\n\t\tchildren: data.children ?? [],\n\t};\n\tif (data.tags?.length) {\n\t\tfield.tags = data.tags;\n\t}\n\treturn field;\n}\n", "import type { NaturalBlock } from '../types.js';\n\nimport type { NaturalBlockFactoryData } from './types.js';\n\nexport function createNaturalBlock(data: NaturalBlockFactoryData): NaturalBlock {\n\tconst block: NaturalBlock = {\n\t\t...data.attributes,\n\t\tconstruct: 'NaturalBlock',\n\t\tvalue: data.value,\n\t\tchildren: data.children,\n\t};\n\tif (data.type) {\n\t\tblock.type = data.type;\n\t}\n\tif (data.lang !== undefined) {\n\t\tblock.lang = data.lang;\n\t}\n\tif (data.meta !== undefined) {\n\t\tblock.meta = data.meta;\n\t}\n\tif (data.tags?.length) {\n\t\tblock.tags = data.tags;\n\t}\n\treturn block;\n}\n", "import type { NaturalExpression } from '../types.js';\n\nimport type { NaturalExpressionFactoryData } from './types.js';\n\nexport function createNaturalExpression(data: NaturalExpressionFactoryData): NaturalExpression {\n\treturn {\n\t\tconstruct: 'NaturalExpression',\n\t\ttype: data.type,\n\t\tvalue: data.value,\n\t\tattributes: data.attributes,\n\t\tchildren: data.children ?? [],\n\t};\n}\n", "import type { SectionBlock } from '../types.js';\n\nimport type { SectionBlockFactoryData } from './types.js';\n\nexport function createSectionBlock(data: SectionBlockFactoryData): SectionBlock {\n\tconst section: SectionBlock = {\n\t\tconstruct: 'SectionBlock',\n\t\tname: data.name,\n\t\tchildren: data.children ?? [],\n\t};\n\tif (data.depth !== undefined) section.depth = data.depth;\n\tif (data.tags?.length) section.tags = data.tags;\n\treturn section;\n}\n", "import type { Tag } from '../types.js';\n\nimport type { TagFactoryData } from './types.js';\n\nexport function createTag(tagData: TagFactoryData): Tag {\n\treturn { construct: 'Tag' as const, name: tagData.name };\n}\n", "import { createDocument } from './constructs/Document/index.js';\nimport { createFieldBlock } from './constructs/FieldBlock/index.js';\nimport { createFieldInline } from './constructs/FieldInline/index.js';\nimport { createNaturalBlock } from './constructs/NaturalBlock/index.js';\nimport { createNaturalExpression } from './constructs/NaturalExpression/index.js';\nimport { createSectionBlock } from './constructs/SectionBlock/index.js';\nimport { createTag } from './constructs/Tag/index.js';\n\nexport type { FieldBlock } from './constructs/FieldBlock/index.js';\nexport type { FieldInline } from './constructs/FieldInline/index.js';\nexport type { NaturalBlock } from './constructs/NaturalBlock/index.js';\nexport type { NaturalExpression } from './constructs/NaturalExpression/index.js';\nexport type { SectionBlock } from './constructs/SectionBlock/index.js';\nexport type { Tag } from './constructs/Tag/index.js';\n\nexport type * from './types.js';\n\nexport const FACTORIES = [\n\t{\n\t\tname: 'Document',\n\t\tfactory: createDocument,\n\t},\n\t{\n\t\tname: 'FieldBlock',\n\t\tfactory: createFieldBlock,\n\t},\n\t{\n\t\tname: 'FieldInline',\n\t\tfactory: createFieldInline,\n\t},\n\t{\n\t\tname: 'NaturalBlock',\n\t\tfactory: createNaturalBlock,\n\t},\n\t{\n\t\tname: 'NaturalExpression',\n\t\tfactory: createNaturalExpression,\n\t},\n\t{\n\t\tname: 'SectionBlock',\n\t\tfactory: createSectionBlock,\n\t},\n\t{\n\t\tname: 'Tag',\n\t\tfactory: createTag,\n\t},\n];\n", "import type { ConstructBase, ParserVisitContext } from '@art-md/primitives';\n\nconst FIELD_BLOCK_BOUNDARIES = new Set(['FieldBlock', 'FieldInline', 'SectionBlock']);\n\nexport function onBeforeConstruct(\n\tconstruct: ConstructBase,\n\tcontext: ParserVisitContext,\n): ParserVisitContext {\n\tif (!FIELD_BLOCK_BOUNDARIES.has(construct.construct)) {\n\t\treturn context;\n\t}\n\n\tconst parent = context.parent();\n\tif (!parent) {\n\t\treturn context;\n\t}\n\n\treturn parent;\n}\n", "import type { FieldBlock } from '../../../../../factories/index.js';\nimport type { ConstructIntegrator } from '../../../../types.js';\nimport { onBeforeConstruct } from '../helpers/onBeforeConstruct.js';\n\nexport function createFieldBlockIntegrator(): ConstructIntegrator {\n\treturn {\n\t\tintegrate(context, _node, construct) {\n\t\t\tconst field = construct as FieldBlock;\n\t\t\tcontext.captureChildConstruct(field);\n\t\t\treturn context.childContext(field, onBeforeConstruct);\n\t\t},\n\t};\n}\n", "export const FIELD_TEXT_PATTERN = /^[A-Za-z][A-Za-z ]*:(?:\\s|$)/;\n", "import type { MdastNode, ParserVisitContext } from '@art-md/primitives';\n\nexport function rawSlice(node: MdastNode, context: ParserVisitContext): string {\n\tif (!node.position?.start || !node.position?.end) {\n\t\treturn '';\n\t}\n\treturn context.source.markdown.slice(node.position.start.offset, node.position.end.offset);\n}\n", "import type { ParserVisitContext } from '@art-md/primitives';\nimport type { Strong } from 'mdast';\n\nimport { rawSlice } from '../mdast/index.js';\n\nexport function stripStrong(node: Strong, context: ParserVisitContext): string {\n\tconst raw = rawSlice(node, context);\n\treturn raw.length >= 4 &&\n\t\t((raw.startsWith('**') && raw.endsWith('**')) || (raw.startsWith('__') && raw.endsWith('__')))\n\t\t? raw.slice(2, -2)\n\t\t: raw;\n}\n", "import type { ParserVisitContext } from '@art-md/primitives';\nimport type { Node, Strong } from 'mdast';\n\nimport { FIELD_TEXT_PATTERN } from './constants.js';\nimport { stripStrong } from './stripStrong.js';\n\nexport function isFieldStrong(node: Node, context: ParserVisitContext): node is Strong {\n\treturn node.type === 'strong' && FIELD_TEXT_PATTERN.test(stripStrong(node as Strong, context));\n}\n", "import { type Tag, createTag } from '../../factories/index.js';\n\nconst TRAILING_TAGS = /^(.*?)((?:\\(#[\\w-]+\\)\\s*)+)$/;\nconst TAG = /\\(#([\\w-]+)\\)/g;\n\nexport function extractTags(text: string): { tags: Tag[]; stripped: string } {\n\tconst trimmed = text.trimEnd();\n\tconst match = trimmed.match(TRAILING_TAGS);\n\tif (!match || !match[1] || !match[2]) {\n\t\treturn {\n\t\t\ttags: [],\n\t\t\tstripped: text,\n\t\t};\n\t}\n\n\tconst tags = [...match[2].matchAll(TAG)].map(matchResult =>\n\t\tcreateTag({ name: matchResult[1] ?? '' }),\n\t);\n\treturn {\n\t\ttags,\n\t\tstripped: match[1].trimEnd(),\n\t};\n}\n", "import type { ParserVisitContext } from '@art-md/primitives';\nimport { nodePosition } from '@art-md/primitives';\nimport type { Paragraph, Strong } from 'mdast';\n\nimport { type FieldBlock, createFieldBlock } from '../../../../../factories/index.js';\nimport { stripStrong } from '../../../../fields/index.js';\nimport { rawSlice } from '../../../../mdast/index.js';\nimport { extractTags } from '../../../../tags/index.js';\n\nexport function createFieldBlockFromNode(\n\tparagraph: Paragraph,\n\tcontext: ParserVisitContext,\n): FieldBlock | null {\n\tconst strong = paragraph.children[0] as Strong;\n\tconst paragraphRaw = rawSlice(paragraph, context);\n\tconst strongRaw = rawSlice(strong, context);\n\n\tconst afterStrong = paragraphRaw.slice(strongRaw.length);\n\tconst { tags, stripped } = extractTags(afterStrong);\n\tif (stripped.trim().length > 0) {\n\t\treturn null;\n\t}\n\tconst inner = stripStrong(strong, context);\n\tconst colonIndex = inner.indexOf(':');\n\n\tconst field = createFieldBlock({\n\t\tname: inner.slice(0, colonIndex).trim(),\n\t\ttags,\n\t});\n\tfield.position = nodePosition(paragraph);\n\n\treturn field;\n}\n", "import type { Paragraph } from 'mdast';\n\nimport { isFieldStrong } from '../../../../fields/index.js';\nimport type { ConstructProcessor } from '../../../../types.js';\nimport { createFieldBlockFromNode } from '../helpers/createFieldBlockFromNode.js';\n\nexport function createFieldBlockProcessor(): ConstructProcessor {\n\treturn {\n\t\tcaptureNode(context, node) {\n\t\t\tif (node.type !== 'paragraph') {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst paragraph = node as Paragraph;\n\t\t\tconst first = paragraph.children[0];\n\t\t\tif (first === undefined || !isFieldStrong(first, context)) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn createFieldBlockFromNode(paragraph, context);\n\t\t},\n\t};\n}\n", "import type { ConstructParserFactory } from '../../types.js';\n\nimport { createFieldBlockIntegrator, createFieldBlockProcessor } from './private/index.js';\n\nexport const createFieldBlockParser: ConstructParserFactory = () => ({\n\tname: 'FieldBlock',\n\tprocessor: createFieldBlockProcessor(),\n\tintegrator: createFieldBlockIntegrator(),\n});\n", "import { type MdastNode, nodePosition } from '@art-md/primitives';\n\nimport type { NaturalExpression } from '../../factories/index.js';\n\nexport function createNaturalExpressionFromNode(node: MdastNode): NaturalExpression {\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\tconst { position: _, children: mdastChildren, type, value, ...attributes } = node;\n\n\tlet children: NaturalExpression[] = [];\n\tif (Array.isArray(mdastChildren)) {\n\t\tchildren = mdastChildren.map((child: MdastNode) => createNaturalExpressionFromNode(child));\n\t}\n\n\tconst expression: NaturalExpression = {\n\t\tconstruct: 'NaturalExpression',\n\t\ttype,\n\t\tattributes,\n\t\tvalue,\n\t\tposition: nodePosition(node),\n\t\tchildren,\n\t};\n\n\treturn expression;\n}\n", "import type { NaturalExpression } from '../../../../../factories/index.js';\n\nexport function trimFieldEdges(value: NaturalExpression[]): typeof value {\n\tconst trimmed = [...value];\n\tconst first = trimmed[0];\n\tconst last = trimmed[trimmed.length - 1];\n\n\tif (first?.type === 'text' && typeof first?.value === 'string')\n\t\tfirst.value = first.value.replace(/^\\s+/, '');\n\tif (last?.type === 'text' && typeof last?.value === 'string')\n\t\tlast.value = last.value.replace(/\\s+$/, '');\n\n\treturn trimmed.filter(\n\t\texpression =>\n\t\t\texpression.type !== 'text' ||\n\t\t\t(typeof expression.value === 'string' && expression.value.length > 0),\n\t);\n}\n", "import type { ParserVisitContext } from '@art-md/primitives';\nimport { nodePosition } from '@art-md/primitives';\nimport type { Paragraph, Strong } from 'mdast';\n\nimport { type FieldInline, type Tag, createFieldInline } from '../../../../../factories/index.js';\nimport { stripStrong } from '../../../../fields/index.js';\nimport { rawSlice } from '../../../../mdast/index.js';\nimport { createNaturalExpressionFromNode } from '../../../../naturalExpression/index.js';\nimport { extractTags } from '../../../../tags/index.js';\n\nimport { trimFieldEdges } from './trimFieldEdges.js';\n\nexport function createFieldInlineFromNode(\n\tparagraph: Paragraph,\n\tcontext: ParserVisitContext,\n): FieldInline | null {\n\tconst strong = paragraph.children[0] as Strong;\n\tconst paragraphRaw = rawSlice(paragraph, context);\n\tconst strongRaw = rawSlice(strong, context);\n\n\tconst afterStrong = paragraphRaw.slice(strongRaw.length);\n\tconst { stripped } = extractTags(afterStrong);\n\tif (stripped.trim().length === 0) {\n\t\treturn null;\n\t}\n\tconst inner = stripStrong(strong, context);\n\tconst colonIndex = inner.indexOf(':');\n\n\tconst expressions = paragraph.children\n\t\t.slice(1)\n\t\t.map(child => createNaturalExpressionFromNode(child));\n\tconst children = trimFieldEdges(expressions);\n\tconst last = children[children.length - 1];\n\tlet tags: Tag[] = [];\n\tif (last?.type === 'text' && typeof last.value === 'string') {\n\t\tconst extracted = extractTags(last.value);\n\t\tif (extracted.tags.length) {\n\t\t\ttags = extracted.tags;\n\t\t\tlast.value = extracted.stripped;\n\t\t}\n\t}\n\n\tconst field = createFieldInline({\n\t\tname: inner.slice(0, colonIndex).trim(),\n\t\tchildren,\n\t\ttags,\n\t});\n\tfield.position = nodePosition(paragraph);\n\n\treturn field;\n}\n", "import type { Paragraph } from 'mdast';\n\nimport { isFieldStrong } from '../../../../fields/index.js';\nimport type { ConstructProcessor } from '../../../../types.js';\nimport { createFieldInlineFromNode } from '../helpers/createFieldInlineFromNode.js';\n\nexport function createFieldInlineProcessor(): ConstructProcessor {\n\treturn {\n\t\tcaptureNode(context, node) {\n\t\t\tif (node.type !== 'paragraph') {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst paragraph = node as Paragraph;\n\t\t\tconst first = paragraph.children[0];\n\t\t\tif (first === undefined || !isFieldStrong(first, context)) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn createFieldInlineFromNode(paragraph, context);\n\t\t},\n\t};\n}\n", "import type { ConstructParserFactory } from '../../types.js';\n\nimport { createFieldInlineProcessor } from './private/index.js';\n\nexport const createFieldInlineParser: ConstructParserFactory = () => ({\n\tname: 'FieldInline',\n\tprocessor: createFieldInlineProcessor(),\n});\n", "import type { MdastNode, ParserVisitContext } from '@art-md/primitives';\nimport { nodePosition } from '@art-md/primitives';\nimport type { Node } from 'mdast';\nimport { phrasing } from 'mdast-util-phrasing';\n\nimport {\n\ttype NaturalBlock,\n\ttype NaturalExpression,\n\ttype Tag,\n\tcreateNaturalBlock,\n} from '../../../../../factories/index.js';\nimport { rawSlice } from '../../../../mdast/index.js';\nimport { createNaturalExpressionFromNode } from '../../../../naturalExpression/index.js';\nimport { extractTags } from '../../../../tags/index.js';\n\nexport function createNaturalBlockFromNode(node: Node, context: ParserVisitContext): NaturalBlock {\n\tlet children: (NaturalBlock | NaturalExpression)[] = [];\n\tif (Array.isArray((node as MdastNode).children)) {\n\t\tconst nodeChildren = (node as MdastNode).children ?? [];\n\t\tconst phrasingContainer =\n\t\t\tnode.type === 'paragraph' || node.type === 'heading' || node.type === 'tableCell';\n\t\tchildren = nodeChildren.map(child =>\n\t\t\tphrasingContainer || phrasing(child)\n\t\t\t\t? createNaturalExpressionFromNode(child)\n\t\t\t\t: createNaturalBlockFromNode(child as Node, context),\n\t\t);\n\t}\n\n\tlet tags: Tag[] = [];\n\tif (node.type === 'paragraph') {\n\t\tconst last = children[children.length - 1];\n\t\tif (last?.type === 'text' && typeof last.value === 'string') {\n\t\t\tconst { tags: extractedTags, stripped } = extractTags(last.value);\n\t\t\tif (extractedTags.length) {\n\t\t\t\ttags = extractedTags;\n\t\t\t\tlast.value = stripped;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst { type, ...attributes } = node as MdastNode;\n\tconst block = createNaturalBlock({\n\t\tvalue: rawSlice(node, context),\n\t\tchildren,\n\t\ttype,\n\t\tattributes,\n\t\ttags,\n\t});\n\tblock.position = nodePosition(node);\n\treturn block;\n}\n", "import type { ConstructProcessor } from '../../../../types.js';\nimport { createNaturalBlockFromNode } from '../helpers/createNaturalBlockFromNode.js';\n\nexport function createNaturalBlockProcessor(): ConstructProcessor {\n\treturn {\n\t\tcaptureNode(context, node) {\n\t\t\treturn createNaturalBlockFromNode(node, context);\n\t\t},\n\t};\n}\n", "import type { ConstructParserFactory } from '../../types.js';\n\nimport { createNaturalBlockProcessor } from './private/index.js';\n\nexport const createNaturalBlockParser: ConstructParserFactory = () => ({\n\tname: 'NaturalBlock',\n\tprocessor: createNaturalBlockProcessor(),\n});\n", "import type { ParserVisitContext } from '@art-md/primitives';\n\nimport type { SectionBlock } from '../../../../../factories/index.js';\n\nexport function findParentSection(context: ParserVisitContext): SectionBlock | undefined {\n\tlet current: ParserVisitContext | undefined = context;\n\twhile (current) {\n\t\tif (current.construct?.construct === 'SectionBlock') {\n\t\t\treturn current.construct as SectionBlock;\n\t\t}\n\t\tcurrent = current.parent();\n\t}\n\treturn undefined;\n}\n", "import { sectionDepth } from '@art-md/primitives';\nimport type { Heading } from 'mdast';\n\nimport type { SectionBlock } from '../../../../../factories/index.js';\nimport type { ConstructIntegrator } from '../../../../types.js';\nimport { findParentSection } from '../helpers/findParentSection.js';\n\nexport function createSectionBlockIntegrator(): ConstructIntegrator {\n\treturn {\n\t\tintegrate(context, node, construct) {\n\t\t\tconst section = construct as SectionBlock;\n\t\t\tlet currentContext = context;\n\n\t\t\tconst heading = node as Heading;\n\t\t\twhile (currentContext.construct.construct === 'SectionBlock') {\n\t\t\t\tconst parentSection = findParentSection(currentContext);\n\t\t\t\tif (parentSection && sectionDepth(parentSection) >= heading.depth) {\n\t\t\t\t\tconst parentContext = currentContext.parent();\n\t\t\t\t\tif (parentContext) {\n\t\t\t\t\t\tcurrentContext = parentContext;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcurrentContext.captureChildConstruct(section);\n\t\t\treturn currentContext.childContext(section);\n\t\t},\n\t};\n}\n", "import { nodePosition } from '@art-md/primitives';\nimport type { ParserVisitContext } from '@art-md/primitives';\nimport type { Heading } from 'mdast';\n\nimport { type SectionBlock, createSectionBlock } from '../../../../../factories/index.js';\nimport { rawSlice } from '../../../../mdast/index.js';\nimport { extractTags } from '../../../../tags/index.js';\n\nexport function createSectionBlockFromNode(\n\tnode: Heading,\n\tcontext: ParserVisitContext,\n): SectionBlock {\n\tconst text = rawSlice(node, context)\n\t\t.replace(/^[ \\t]*#+[ \\t]*/, '')\n\t\t.trim();\n\tconst { tags, stripped } = extractTags(text);\n\tconst section = createSectionBlock({\n\t\tname: stripped,\n\t\tdepth: node.depth,\n\t\tchildren: [],\n\t\ttags,\n\t});\n\tsection.position = nodePosition(node);\n\treturn section;\n}\n", "import type { Heading } from 'mdast';\n\nimport type { ConstructProcessor } from '../../../../types.js';\nimport { createSectionBlockFromNode } from '../helpers/createSectionBlockFromNode.js';\n\nexport function createSectionBlockProcessor(): ConstructProcessor {\n\treturn {\n\t\tcaptureNode(context, node) {\n\t\t\tif (node.type !== 'heading') {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn createSectionBlockFromNode(node as Heading, context);\n\t\t},\n\t};\n}\n", "import type { ConstructParserFactory } from '../../types.js';\n\nimport { createSectionBlockIntegrator, createSectionBlockProcessor } from './private/index.js';\n\nexport const createSectionBlockParser: ConstructParserFactory = () => ({\n\tname: 'SectionBlock',\n\tprocessor: createSectionBlockProcessor(),\n\tintegrator: createSectionBlockIntegrator(),\n});\n", "import { type ArtDocument, nodePosition } from '@art-md/primitives';\nimport type { Node } from 'unist';\n\nimport { createDocument } from '../../factories/index.js';\n\nexport function createArtDocumentFromNode(root: Node): ArtDocument {\n\tconst document = createDocument({});\n\tdocument.position = nodePosition(root);\n\treturn document;\n}\n", "import { createFieldBlockParser } from './constructs/FieldBlock/index.js';\nimport { createFieldInlineParser } from './constructs/FieldInline/index.js';\nimport { createNaturalBlockParser } from './constructs/NaturalBlock/index.js';\nimport { createSectionBlockParser } from './constructs/SectionBlock/index.js';\nimport type { ConstructParserFactory } from './types.js';\n\nexport { createArtDocumentFromNode } from './document/createArtDocumentFromNode.js';\n\nexport const CONSTRUCT_PARSERS: ConstructParserFactory[] = [\n\tcreateFieldBlockParser,\n\tcreateFieldInlineParser,\n\tcreateSectionBlockParser,\n];\nexport const DEFAULT_CONSTRUCT_PARSER = createNaturalBlockParser;\n\nexport type * from './types.js';\n", "import type { Node } from 'mdast';\n\nimport type { ConstructSerializer } from '../../types.js';\n\nexport function createDocumentToMdast(): ConstructSerializer {\n\treturn {\n\t\tname: 'Document',\n\t\ttoMdast(_node, children) {\n\t\t\treturn {\n\t\t\t\ttype: 'root',\n\t\t\t\tchildren,\n\t\t\t} as Node;\n\t\t},\n\t};\n}\n", "import type { Text } from 'mdast';\n\nimport type { Tag } from '../../factories/index.js';\n\nexport function tagToMdast(tag: Tag): Text {\n\treturn { type: 'text', value: `(#${tag.name})` };\n}\n", "import type { Text } from 'mdast';\n\nimport type { Tag } from '../../factories/index.js';\n\nimport { tagToMdast } from './tagToMdast.js';\n\nexport function tagsToMdast(tags: Tag[]): Text {\n\tconst value = tags.map(tag => tagToMdast(tag).value).join(' ');\n\treturn { type: 'text', value: ` ${value}` };\n}\n", "import type { Node } from 'mdast';\n\nimport type { FieldBlock } from '../../../factories/index.js';\nimport { tagsToMdast } from '../../tags/index.js';\nimport type { ConstructSerializer } from '../../types.js';\n\nexport function createFieldBlockToMdast(): ConstructSerializer {\n\treturn {\n\t\tname: 'FieldBlock',\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\ttoMdast(node, _children) {\n\t\t\tconst field = node as unknown as FieldBlock;\n\t\t\tconst tagNode = field.tags?.length ? tagsToMdast(field.tags) : null;\n\t\t\treturn {\n\t\t\t\ttype: 'paragraph',\n\t\t\t\tchildren: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'strong',\n\t\t\t\t\t\tchildren: [{ type: 'text', value: `${field.name}:` }],\n\t\t\t\t\t},\n\t\t\t\t\t...(tagNode ? [tagNode] : []),\n\t\t\t\t],\n\t\t\t} as Node;\n\t\t},\n\t};\n}\n", "import type { Node } from 'mdast';\n\nimport type { FieldInline } from '../../../factories/index.js';\nimport { tagsToMdast } from '../../tags/index.js';\nimport type { ConstructSerializer } from '../../types.js';\n\nexport function createFieldInlineToMdast(): ConstructSerializer {\n\treturn {\n\t\tname: 'FieldInline',\n\t\ttoMdast(node, children) {\n\t\t\tconst field = node as unknown as FieldInline;\n\t\t\tconst tagNode = field.tags?.length ? tagsToMdast(field.tags) : null;\n\t\t\treturn {\n\t\t\t\ttype: 'paragraph',\n\t\t\t\tchildren: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'strong',\n\t\t\t\t\t\tchildren: [{ type: 'text', value: `${field.name}:` }],\n\t\t\t\t\t},\n\t\t\t\t\t{ type: 'text', value: ' ' },\n\t\t\t\t\t...children,\n\t\t\t\t\t...(tagNode ? [tagNode] : []),\n\t\t\t\t],\n\t\t\t} as Node;\n\t\t},\n\t};\n}\n", "import type { Node } from 'mdast';\nimport { fromMarkdown } from 'mdast-util-from-markdown';\n\nimport type { NaturalBlock } from '../../../factories/index.js';\nimport { tagsToMdast } from '../../tags/index.js';\nimport type { ConstructSerializer } from '../../types.js';\n\nexport function createNaturalBlockToMdast(): ConstructSerializer {\n\treturn {\n\t\tname: 'NaturalBlock',\n\t\ttoMdast(node, children) {\n\t\t\tconst block = node as unknown as NaturalBlock;\n\t\t\tconst parsed = fromMarkdown(block.value);\n\t\t\tif (block.type === 'paragraph' && children.length > 0) {\n\t\t\t\tconst paragraph = parsed.children.find(child => child.type === 'paragraph');\n\t\t\t\tif (paragraph && 'children' in paragraph) {\n\t\t\t\t\tconst tagNode = block.tags?.length ? tagsToMdast(block.tags) : null;\n\t\t\t\t\tparagraph.children = [\n\t\t\t\t\t\t...children,\n\t\t\t\t\t\t...(tagNode ? [tagNode] : []),\n\t\t\t\t\t] as typeof paragraph.children;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttype: 'root',\n\t\t\t\tchildren: parsed.children,\n\t\t\t} as Node;\n\t\t},\n\t};\n}\n", "import type { Node } from 'mdast';\n\nimport type { NaturalExpression } from '../../../factories/index.js';\nimport type { ConstructSerializer } from '../../types.js';\n\nexport function createNaturalExpressionToMdast(): ConstructSerializer {\n\treturn {\n\t\tname: 'NaturalExpression',\n\t\ttoMdast(node, children) {\n\t\t\tconst expression = node as unknown as NaturalExpression;\n\t\t\tconst attributes = { ...expression.attributes };\n\t\t\treturn { type: expression.type, value: expression.value, children, ...attributes } as Node;\n\t\t},\n\t};\n}\n", "import type { Node, RootContent } from 'mdast';\nimport { fromMarkdown } from 'mdast-util-from-markdown';\n\nimport type { SectionBlock } from '../../../factories/index.js';\nimport { tagsToMdast } from '../../tags/index.js';\nimport type { ConstructSerializer } from '../../types.js';\n\nexport function createSectionBlockToMdast(): ConstructSerializer {\n\treturn {\n\t\tname: 'SectionBlock',\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\ttoMdast(node, _children) {\n\t\t\tconst section = node as unknown as SectionBlock;\n\t\t\tconst depth = section.depth ?? 1;\n\t\t\tconst parsed = fromMarkdown(`# ${section.name}`);\n\t\t\tconst heading = parsed.children.find(child => child.type === 'heading');\n\t\t\tconst tagNode = section.tags?.length ? tagsToMdast(section.tags) : null;\n\t\t\tconst children: RootContent[] =\n\t\t\t\theading && 'children' in heading\n\t\t\t\t\t? [...heading.children, ...(tagNode ? [tagNode] : [])]\n\t\t\t\t\t: [{ type: 'text' as const, value: section.name }, ...(tagNode ? [tagNode] : [])];\n\t\t\treturn {\n\t\t\t\ttype: 'heading',\n\t\t\t\tdepth: depth as 1 | 2 | 3 | 4 | 5 | 6,\n\t\t\t\tchildren,\n\t\t\t} as Node;\n\t\t},\n\t};\n}\n", "import { createDocumentToMdast } from './constructs/Document/index.js';\nimport { createFieldBlockToMdast } from './constructs/FieldBlock/index.js';\nimport { createFieldInlineToMdast } from './constructs/FieldInline/index.js';\nimport { createNaturalBlockToMdast } from './constructs/NaturalBlock/index.js';\nimport { createNaturalExpressionToMdast } from './constructs/NaturalExpression/index.js';\nimport { createSectionBlockToMdast } from './constructs/SectionBlock/index.js';\nimport type { ConstructSerializerFactory } from './types.js';\n\nexport const CONSTRUCT_SERIALIZERS: ConstructSerializerFactory[] = [\n\tcreateDocumentToMdast,\n\tcreateFieldBlockToMdast,\n\tcreateFieldInlineToMdast,\n\tcreateNaturalBlockToMdast,\n\tcreateNaturalExpressionToMdast,\n\tcreateSectionBlockToMdast,\n];\n\nexport type * from './types.js';\n"],
5
+ "mappings": ";AAEO,SAAS,kBAAkB,MAA4C;AAC7E,SAAO;IACN,WAAW;IACX,UAAU,MAAM,YAAY,CAAC;EAC9B;AACD;AIHO,SAAS,aAAa,MAAsB;AAClD,MAAI,CAAC,KAAK,UAAU;AACnB,UAAM,IAAI,MAAM,gCAAgC,KAAK,IAAI,EAAE;EAC5D;AAEA,QAAM,MAAM,KAAK;AAEjB,MAAI,CAAC,KAAK,SAAS,CAAC,IAAI,KAAK;AAC5B,UAAM,IAAI,MAAM,gCAAgC,KAAK,IAAI,EAAE;EAC5D;AACA,SAAO;IACN,OAAO;MACN,MAAM,IAAI,MAAM;MAChB,QAAQ,IAAI,MAAM;MAClB,QAAQ,IAAI,MAAM,UAAU;IAC7B;IACA,KAAK;MACJ,MAAM,IAAI,IAAI;MACd,QAAQ,IAAI,IAAI;MAChB,QAAQ,IAAI,IAAI,UAAU;IAC3B;EACD;AACD;AC1BO,SAAS,aAAa,SAAqC;AACjE,SAAO,QAAQ,SAAS;AACzB;;;AGEO,SAAS,eAAe,MAAwC;AACtE,QAAM,UAAU;AAAA,IACf,GAAG;AAAA,IACH,UAAU,KAAK,YAAY,CAAC;AAAA,EAC7B;AACA,SAAO,kBAAkB,OAAO;AACjC;;;ACNO,SAAS,iBAAiB,MAAyC;AACzE,QAAM,QAAoB;AAAA,IACzB,WAAW;AAAA,IACX,MAAM,KAAK;AAAA,IACX,UAAU,KAAK,YAAY,CAAC;AAAA,EAC7B;AACA,MAAI,KAAK,MAAM,QAAQ;AACtB,UAAM,OAAO,KAAK;AAAA,EACnB;AACA,SAAO;AACR;;;ACVO,SAAS,kBAAkB,MAA2C;AAC5E,QAAM,QAAqB;AAAA,IAC1B,WAAW;AAAA,IACX,MAAM,KAAK;AAAA,IACX,U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AAS;AACtE,YAAM,UAAU,QAAQ,MAAM,SAAS,YAAY,QAAQ,IAAI,IAAI;AACnE,YAAM,WACL,WAAW,cAAc,UACtB,CAAC,GAAG,QAAQ,UAAU,GAAI,UAAU,CAAC,OAAO,IAAI,CAAC,CAAE,IACnD,CAAC,EAAE,MAAM,QAAiB,OAAO,QAAQ,KAAK,GAAG,GAAI,UAAU,CAAC,OAAO,IAAI,CAAC,CAAE;AAClF,aAAO;AAAA,QACN,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;;;ACpBO,IAAM,wBAAsD;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;",
6
+ "names": ["fromMarkdown", "fromMarkdown"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import type { ConstructParserFactory } from '../../types.js';
2
+ export declare const createFieldBlockParser: ConstructParserFactory;
@@ -0,0 +1 @@
1
+ export { createFieldBlockParser } from './createFieldBlockParser.js';
@@ -0,0 +1,4 @@
1
+ import type { ParserVisitContext } from '@art-md/primitives';
2
+ import type { Paragraph } from 'mdast';
3
+ import { type FieldBlock } from '../../../../../factories/index.js';
4
+ export declare function createFieldBlockFromNode(paragraph: Paragraph, context: ParserVisitContext): FieldBlock | null;
@@ -0,0 +1,2 @@
1
+ import type { ConstructBase, ParserVisitContext } from '@art-md/primitives';
2
+ export declare function onBeforeConstruct(construct: ConstructBase, context: ParserVisitContext): ParserVisitContext;
@@ -0,0 +1,2 @@
1
+ export * from './integrator/createFieldBlockIntegrator.js';
2
+ export * from './processor/createFieldBlockProcessor.js';
@@ -0,0 +1,2 @@
1
+ import type { ConstructIntegrator } from '../../../../types.js';
2
+ export declare function createFieldBlockIntegrator(): ConstructIntegrator;
@@ -0,0 +1,2 @@
1
+ import type { ConstructProcessor } from '../../../../types.js';
2
+ export declare function createFieldBlockProcessor(): ConstructProcessor;
@@ -0,0 +1,2 @@
1
+ import type { ConstructParserFactory } from '../../types.js';
2
+ export declare const createFieldInlineParser: ConstructParserFactory;
@@ -0,0 +1 @@
1
+ export { createFieldInlineParser } from './createFieldInlineParser.js';
@@ -0,0 +1,4 @@
1
+ import type { ParserVisitContext } from '@art-md/primitives';
2
+ import type { Paragraph } from 'mdast';
3
+ import { type FieldInline } from '../../../../../factories/index.js';
4
+ export declare function createFieldInlineFromNode(paragraph: Paragraph, context: ParserVisitContext): FieldInline | null;
@@ -0,0 +1,2 @@
1
+ import type { NaturalExpression } from '../../../../../factories/index.js';
2
+ export declare function trimFieldEdges(value: NaturalExpression[]): typeof value;
@@ -0,0 +1 @@
1
+ export * from './processor/createFieldInlineProcessor.js';
@@ -0,0 +1,2 @@
1
+ import type { ConstructProcessor } from '../../../../types.js';
2
+ export declare function createFieldInlineProcessor(): ConstructProcessor;
@@ -0,0 +1,2 @@
1
+ import type { ConstructParserFactory } from '../../types.js';
2
+ export declare const createNaturalBlockParser: ConstructParserFactory;
@@ -0,0 +1 @@
1
+ export { createNaturalBlockParser } from './createNaturalBlockParser.js';
@@ -0,0 +1,4 @@
1
+ import type { ParserVisitContext } from '@art-md/primitives';
2
+ import type { Node } from 'mdast';
3
+ import { type NaturalBlock } from '../../../../../factories/index.js';
4
+ export declare function createNaturalBlockFromNode(node: Node, context: ParserVisitContext): NaturalBlock;
@@ -0,0 +1 @@
1
+ export * from './processor/createNaturalBlockProcessor.js';
@@ -0,0 +1,2 @@
1
+ import type { ConstructProcessor } from '../../../../types.js';
2
+ export declare function createNaturalBlockProcessor(): ConstructProcessor;
@@ -0,0 +1,2 @@
1
+ import type { ConstructParserFactory } from '../../types.js';
2
+ export declare const createSectionBlockParser: ConstructParserFactory;
@@ -0,0 +1 @@
1
+ export { createSectionBlockParser } from './createSectionBlockParser.js';
@@ -0,0 +1,4 @@
1
+ import type { ParserVisitContext } from '@art-md/primitives';
2
+ import type { Heading } from 'mdast';
3
+ import { type SectionBlock } from '../../../../../factories/index.js';
4
+ export declare function createSectionBlockFromNode(node: Heading, context: ParserVisitContext): SectionBlock;
@@ -0,0 +1,3 @@
1
+ import type { ParserVisitContext } from '@art-md/primitives';
2
+ import type { SectionBlock } from '../../../../../factories/index.js';
3
+ export declare function findParentSection(context: ParserVisitContext): SectionBlock | undefined;
@@ -0,0 +1,2 @@
1
+ export * from './integrator/createSectionBlockIntegrator.js';
2
+ export * from './processor/createSectionBlockProcessor.js';
@@ -0,0 +1,2 @@
1
+ import type { ConstructIntegrator } from '../../../../types.js';
2
+ export declare function createSectionBlockIntegrator(): ConstructIntegrator;
@@ -0,0 +1,2 @@
1
+ import type { ConstructProcessor } from '../../../../types.js';
2
+ export declare function createSectionBlockProcessor(): ConstructProcessor;
@@ -0,0 +1,3 @@
1
+ import { type ArtDocument } from '@art-md/primitives';
2
+ import type { Node } from 'unist';
3
+ export declare function createArtDocumentFromNode(root: Node): ArtDocument;
@@ -0,0 +1 @@
1
+ export * from './createArtDocumentFromNode.js';
@@ -0,0 +1 @@
1
+ export declare const FIELD_TEXT_PATTERN: RegExp;
@@ -0,0 +1,3 @@
1
+ export { FIELD_TEXT_PATTERN } from './constants.js';
2
+ export { isFieldStrong } from './isFieldStrong.js';
3
+ export { stripStrong } from './stripStrong.js';
@@ -0,0 +1,3 @@
1
+ import type { ParserVisitContext } from '@art-md/primitives';
2
+ import type { Node, Strong } from 'mdast';
3
+ export declare function isFieldStrong(node: Node, context: ParserVisitContext): node is Strong;
@@ -0,0 +1,3 @@
1
+ import type { ParserVisitContext } from '@art-md/primitives';
2
+ import type { Strong } from 'mdast';
3
+ export declare function stripStrong(node: Strong, context: ParserVisitContext): string;
@@ -0,0 +1,6 @@
1
+ export { createArtDocumentFromNode } from './document/index.js';
2
+ export * from './constructs/FieldBlock/index.js';
3
+ export * from './constructs/FieldInline/index.js';
4
+ export * from './constructs/NaturalBlock/index.js';
5
+ export * from './constructs/SectionBlock/index.js';
6
+ export type * from './types.js';
@@ -0,0 +1 @@
1
+ export { rawSlice } from './rawSlice.js';
@@ -0,0 +1,2 @@
1
+ import type { MdastNode, ParserVisitContext } from '@art-md/primitives';
2
+ export declare function rawSlice(node: MdastNode, context: ParserVisitContext): string;
@@ -0,0 +1,3 @@
1
+ import { type MdastNode } from '@art-md/primitives';
2
+ import type { NaturalExpression } from '../../factories/index.js';
3
+ export declare function createNaturalExpressionFromNode(node: MdastNode): NaturalExpression;
@@ -0,0 +1 @@
1
+ export { createNaturalExpressionFromNode } from './createNaturalExpressionFromNode.js';
@@ -0,0 +1,5 @@
1
+ import type { ConstructParserFactory } from './types.js';
2
+ export { createArtDocumentFromNode } from './document/createArtDocumentFromNode.js';
3
+ export declare const CONSTRUCT_PARSERS: ConstructParserFactory[];
4
+ export declare const DEFAULT_CONSTRUCT_PARSER: ConstructParserFactory;
5
+ export type * from './types.js';
@@ -0,0 +1,5 @@
1
+ import { type Tag } from '../../factories/index.js';
2
+ export declare function extractTags(text: string): {
3
+ tags: Tag[];
4
+ stripped: string;
5
+ };
@@ -0,0 +1 @@
1
+ export { extractTags } from './extractTags.js';
@@ -0,0 +1,14 @@
1
+ import type { MdastNode, ParserVisitContext } from '@art-md/primitives';
2
+ import type { Construct } from '../factories/index.js';
3
+ export type ConstructProcessor = {
4
+ captureNode(context: ParserVisitContext, node: MdastNode): Construct | null;
5
+ };
6
+ export type ConstructIntegrator = {
7
+ integrate(context: ParserVisitContext, node: MdastNode, construct: Construct): ParserVisitContext;
8
+ };
9
+ export type ConstructParser = {
10
+ readonly name: string;
11
+ processor?: ConstructProcessor;
12
+ integrator?: ConstructIntegrator;
13
+ };
14
+ export type ConstructParserFactory = () => ConstructParser;
@@ -0,0 +1,2 @@
1
+ import type { ConstructSerializer } from '../../types.js';
2
+ export declare function createDocumentToMdast(): ConstructSerializer;
@@ -0,0 +1 @@
1
+ export { createDocumentToMdast } from './createDocumentToMdast.js';
@@ -0,0 +1,2 @@
1
+ import type { ConstructSerializer } from '../../types.js';
2
+ export declare function createFieldBlockToMdast(): ConstructSerializer;
@@ -0,0 +1 @@
1
+ export { createFieldBlockToMdast } from './createFieldBlockToMdast.js';
@@ -0,0 +1,2 @@
1
+ import type { ConstructSerializer } from '../../types.js';
2
+ export declare function createFieldInlineToMdast(): ConstructSerializer;
@@ -0,0 +1 @@
1
+ export { createFieldInlineToMdast } from './createFieldInlineToMdast.js';
@@ -0,0 +1,2 @@
1
+ import type { ConstructSerializer } from '../../types.js';
2
+ export declare function createNaturalBlockToMdast(): ConstructSerializer;
@@ -0,0 +1 @@
1
+ export { createNaturalBlockToMdast } from './createNaturalBlockToMdast.js';
@@ -0,0 +1,2 @@
1
+ import type { ConstructSerializer } from '../../types.js';
2
+ export declare function createNaturalExpressionToMdast(): ConstructSerializer;
@@ -0,0 +1 @@
1
+ export { createNaturalExpressionToMdast } from './createNaturalExpressionToMdast.js';
@@ -0,0 +1,2 @@
1
+ import type { ConstructSerializer } from '../../types.js';
2
+ export declare function createSectionBlockToMdast(): ConstructSerializer;
@@ -0,0 +1 @@
1
+ export { createSectionBlockToMdast } from './createSectionBlockToMdast.js';
@@ -0,0 +1,7 @@
1
+ export * from './constructs/Document/index.js';
2
+ export * from './constructs/FieldBlock/index.js';
3
+ export * from './constructs/FieldInline/index.js';
4
+ export * from './constructs/NaturalBlock/index.js';
5
+ export * from './constructs/NaturalExpression/index.js';
6
+ export * from './constructs/SectionBlock/index.js';
7
+ export type * from './types.js';
@@ -0,0 +1,3 @@
1
+ import type { ConstructSerializerFactory } from './types.js';
2
+ export declare const CONSTRUCT_SERIALIZERS: ConstructSerializerFactory[];
3
+ export type * from './types.js';
@@ -0,0 +1,2 @@
1
+ export { tagToMdast } from './tagToMdast.js';
2
+ export { tagsToMdast } from './tagsToMdast.js';
@@ -0,0 +1,3 @@
1
+ import type { Text } from 'mdast';
2
+ import type { Tag } from '../../factories/index.js';
3
+ export declare function tagToMdast(tag: Tag): Text;
@@ -0,0 +1,3 @@
1
+ import type { Text } from 'mdast';
2
+ import type { Tag } from '../../factories/index.js';
3
+ export declare function tagsToMdast(tags: Tag[]): Text;
@@ -0,0 +1,7 @@
1
+ import type { Node } from 'mdast';
2
+ import type { Construct } from '../factories/index.js';
3
+ export type ConstructSerializer = {
4
+ readonly name: string;
5
+ toMdast(node: Construct, children: Node[]): Node;
6
+ };
7
+ export type ConstructSerializerFactory = () => ConstructSerializer;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks createFieldBlockFromNode() from `src/constructs/FieldBlock/private/helpers`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const createFieldBlockFromNodeMock: (name?: string) => {
6
+ createFieldBlockFromNode: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks createFieldBlock() from `src/constructs/FieldBlock/private/factory`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const createFieldBlockMock: (name?: string) => {
6
+ createFieldBlock: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @fixture FieldBlock of factory`libs/constructs/src/constructs/FieldBlock/factory/createFieldBlock.ts`
3
+ */
4
+ import type { FieldBlock, Tag } from '../../../../factories/index.js';
5
+ export declare const makeFieldBlockFixture: (options?: {
6
+ name?: string;
7
+ children?: FieldBlock["children"];
8
+ tags?: Tag[];
9
+ }) => FieldBlock;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @fixture FieldBlock of factory`libs/constructs/src/constructs/FieldBlock/private/factory/createFieldBlock.ts`
3
+ */
4
+ import type { FieldBlock, Tag } from '../../../../factories/index.js';
5
+ export declare const makeFieldBlockMock: (options?: {
6
+ name?: string;
7
+ children?: FieldBlock["children"];
8
+ tags?: Tag[];
9
+ }) => FieldBlock;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks createFieldInlineFromNode() from `src/constructs/FieldInline/private/helpers`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const createFieldInlineFromNodeMock: (name?: string) => {
6
+ createFieldInlineFromNode: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks createFieldInline() from `src/constructs/FieldInline/private/factory`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const createFieldInlineMock: (name?: string) => {
6
+ createFieldInline: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @fixture FieldInline of factory`libs/constructs/src/constructs/FieldInline/factory/createFieldInline.ts`
3
+ */
4
+ import type { FieldInline, Tag } from '../../../../factories/index.js';
5
+ export declare const makeFieldInlineFixture: (options?: {
6
+ name?: string;
7
+ children?: FieldInline["children"];
8
+ tags?: Tag[];
9
+ }) => FieldInline;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @fixture FieldInline of factory`libs/constructs/src/constructs/FieldInline/private/factory/createFieldInline.ts`
3
+ */
4
+ import type { FieldInline, Tag } from '../../../../factories/index.js';
5
+ export declare const makeFieldInlineMock: (options?: {
6
+ name?: string;
7
+ children?: FieldInline["children"];
8
+ tags?: Tag[];
9
+ }) => FieldInline;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks createNaturalBlockFromNode() from `src/constructs/NaturalBlock/private/helpers`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const createNaturalBlockFromNodeMock: (value?: string) => {
6
+ createNaturalBlockFromNode: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks createNaturalBlock() from `src/constructs/NaturalBlock/private/factory`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const createNaturalBlockMock: (value?: string) => {
6
+ createNaturalBlock: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fixture NaturalBlock of factory`libs/constructs/src/constructs/NaturalBlock/factory/createNaturalBlock.ts`
3
+ */
4
+ import type { NaturalBlock, Tag } from '../../../../factories/index.js';
5
+ export declare const makeNaturalBlockFixture: (options?: {
6
+ value?: string;
7
+ type?: string;
8
+ lang?: string | null;
9
+ meta?: string | null;
10
+ children?: NaturalBlock["children"];
11
+ tags?: Tag[];
12
+ }) => NaturalBlock;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @fixture NaturalBlock of factory`libs/constructs/src/constructs/NaturalBlock/private/factory/createNaturalBlock.ts`
3
+ */
4
+ import type { NaturalBlock, Tag } from '../../../../factories/index.js';
5
+ export declare const makeNaturalBlockMock: (options?: {
6
+ value?: string;
7
+ type?: string;
8
+ lang?: string | null;
9
+ meta?: string | null;
10
+ children?: NaturalBlock["children"];
11
+ tags?: Tag[];
12
+ }) => NaturalBlock;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @fixture NaturalExpression of factory`libs/constructs/src/constructs/NaturalExpression/factory/createNaturalExpression.ts`
3
+ */
4
+ import type { NaturalExpression } from '../../../../factories/index.js';
5
+ export declare const makeNaturalExpressionFixture: (options?: {
6
+ type?: string;
7
+ value?: string;
8
+ attributes?: Record<string, unknown>;
9
+ children?: NaturalExpression["children"];
10
+ }) => NaturalExpression;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @fixture NaturalExpression of factory`libs/constructs/src/constructs/NaturalExpression/private/factory/createNaturalExpression.ts`
3
+ */
4
+ import type { NaturalExpression } from '../../../../factories/index.js';
5
+ export declare const makeNaturalExpressionMock: (options?: {
6
+ type?: string;
7
+ value?: string;
8
+ attributes?: Record<string, unknown>;
9
+ children?: NaturalExpression["children"];
10
+ }) => NaturalExpression;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks createSectionBlockFromNode() from `src/constructs/SectionBlock/private/helpers`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const createSectionBlockFromNodeMock: (name?: string) => {
6
+ createSectionBlockFromNode: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @mocks createSectionBlock() from `src/constructs/SectionBlock/private/factory`
3
+ */
4
+ import { vi } from 'vitest';
5
+ export declare const createSectionBlockMock: (name?: string) => {
6
+ createSectionBlock: ReturnType<typeof vi.fn>;
7
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @fixture SectionBlock of factory`libs/constructs/src/constructs/SectionBlock/factory/createSectionBlock.ts`
3
+ */
4
+ import type { SectionBlock, Tag } from '../../../../factories/index.js';
5
+ export declare const makeSectionBlockFixture: (options?: {
6
+ name?: string;
7
+ depth?: number;
8
+ children?: SectionBlock["children"];
9
+ tags?: Tag[];
10
+ }) => SectionBlock;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @fixture Tag of factory`libs/constructs/src/constructs/Tag/factory/createTag.ts`
3
+ */
4
+ import type { Tag } from '../../../../factories/index.js';
5
+ export declare const makeTagFixture: (options?: {
6
+ name?: string;
7
+ }) => Tag;