@wix/web5-core 1.59.0 → 1.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/component/componentDefinitions/ComparisonSectionDefinition.js +33 -1
- package/dist/cjs/component/componentDefinitions/ComparisonSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/FeatureSection9PlusDefinition.js +9 -5
- package/dist/cjs/component/componentDefinitions/FeatureSection9PlusDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/listItemsSectionDefinition.js +10 -5
- package/dist/cjs/component/componentDefinitions/listItemsSectionDefinition.js.map +1 -1
- package/dist/cjs/component/componentDefinitions/parse-utils.js +45 -8
- package/dist/cjs/component/componentDefinitions/parse-utils.js.map +1 -1
- package/dist/cjs/component/componentParser.js +15 -0
- package/dist/cjs/component/componentParser.js.map +1 -1
- package/dist/cjs/component/section-definition.js +14 -0
- package/dist/cjs/component/section-definition.js.map +1 -1
- package/dist/cjs/components/ui/MarkdownText.js +41 -42
- package/dist/cjs/components/ui/MarkdownText.js.map +1 -1
- package/dist/cjs/components/ui/UnifiedLink.js +22 -10
- package/dist/cjs/components/ui/UnifiedLink.js.map +1 -1
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/styles/base-tokens.css +0 -26
- package/dist/cjs/styles/tailwind-theme.css +0 -17
- package/dist/cjs/utils/markdownPreprocessor.js +162 -8
- package/dist/cjs/utils/markdownPreprocessor.js.map +1 -1
- package/dist/esm/component/componentDefinitions/ComparisonSectionDefinition.js +34 -1
- package/dist/esm/component/componentDefinitions/ComparisonSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/FeatureSection9PlusDefinition.js +10 -6
- package/dist/esm/component/componentDefinitions/FeatureSection9PlusDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/listItemsSectionDefinition.js +11 -6
- package/dist/esm/component/componentDefinitions/listItemsSectionDefinition.js.map +1 -1
- package/dist/esm/component/componentDefinitions/parse-utils.js +44 -8
- package/dist/esm/component/componentDefinitions/parse-utils.js.map +1 -1
- package/dist/esm/component/componentParser.js +15 -0
- package/dist/esm/component/componentParser.js.map +1 -1
- package/dist/esm/component/section-definition.js +13 -1
- package/dist/esm/component/section-definition.js.map +1 -1
- package/dist/esm/components/ui/MarkdownText.js +8 -9
- package/dist/esm/components/ui/MarkdownText.js.map +1 -1
- package/dist/esm/components/ui/UnifiedLink.js +7 -1
- package/dist/esm/components/ui/UnifiedLink.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/styles/base-tokens.css +0 -26
- package/dist/esm/styles/tailwind-theme.css +0 -17
- package/dist/esm/utils/markdownPreprocessor.js +160 -8
- package/dist/esm/utils/markdownPreprocessor.js.map +1 -1
- package/dist/types/component/componentDefinitions/ComparisonSectionDefinition.d.ts +2 -2
- package/dist/types/component/componentDefinitions/ComparisonSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/FeatureSection9PlusDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/listItemsSectionDefinition.d.ts.map +1 -1
- package/dist/types/component/componentDefinitions/parse-utils.d.ts +10 -0
- package/dist/types/component/componentDefinitions/parse-utils.d.ts.map +1 -1
- package/dist/types/component/componentParser.d.ts.map +1 -1
- package/dist/types/component/section-definition.d.ts +13 -1
- package/dist/types/component/section-definition.d.ts.map +1 -1
- package/dist/types/components/ui/MarkdownText.d.ts +13 -0
- package/dist/types/components/ui/MarkdownText.d.ts.map +1 -1
- package/dist/types/components/ui/UnifiedLink.d.ts +1 -1
- package/dist/types/components/ui/UnifiedLink.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/markdownPreprocessor.d.ts +30 -5
- package/dist/types/utils/markdownPreprocessor.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/styles/base-tokens.css +0 -26
- package/src/styles/tailwind-theme.css +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_patternValidator","_astToParts","_linkTypes","_web5LinkValidator","_diagnosticTypes","_componentTracking","_matchDebug","_diagnosticsCollector","_unifiedMarkdownParser","_markdownPreprocessor","_intentExtractor","_contentKeywordMatcher","_propsExtractor","isEntityCompProps","props","Array","isArray","items","ENRICHABLE_ENTITY_SECTION_TYPES","Set","isItemsFromContentSection","sectionType","semantic","serverSectionId","has","normalizedSemantic","toLowerCase","replace","normalizedId","includes","mergeSectionsWithStableReferences","existingSections","newSections","length","merged","i","_existing$sourceMarkd","_updated$sourceMarkdo","existing","updated","push","existingLength","sourceMarkdown","updatedLength","component","componentOptions","debugProps","isSkeleton","newSectionsToAdd","slice","combineAdjacentGeneralTextSections","sections","registry","placement","placementId","combined","currentSection","sectionsToCombine","j","mergedSection","mergeGeneralTextSections","index","Error","mergedSourceMarkdown","map","section","filter","markdown","trim","join","mergedProps","FallbackComponent","resolveSection","mergedComponent","React","createElement","createPageSection","componentName","displayName","name","parseMarkdownToComponents","pageMarkdown","options","_clientConfig$feature","clientConfig","enrichEntityProps","clientId","intentInfo","providedIntent","payload","disableContextualImages","explicitDisableImages","preprocessedMarkdown","diagnostics","preprocessDiagnostics","preprocessMarkdown","knownIntents","getKnownIntents","getIntentFromMarkdown","validIntents","undefined","allNodes","parseMarkdownToAst","children","nodes","tracking","ComponentTracking","diagnosticsCollector","DiagnosticsCollector","d","report","diagnosticType","type","sectionIndex","details","original","normalized","features","disableContextualImagesEnrichment","context","intent","currentGlobalIndex","startIndex","parsedCount","tryParseComponent","parseAstToMarkdown","endIndex","addRange","splice","link","findInvalidWeb5Links","label","reason","DIAGNOSTIC_TYPES","LEGACY_PROTOCOL_LINK","INVALID_LINK_FORMAT","BROKEN_WEB5_LINK","nodeType","url","combinedSections","definitions","getAllDefinitions","allowedKeywords","allowedImageSearchKeywords","baseParseContext","getContextualImage","contentParts","result","getContextualImageFilename","isWeb5ImageUrl","filename","getComponentCount","setMeta","key","value","getMeta","trace","isMatchDebugEnabled","logMatchDebug","n","definition","isPlacementOnly","pattern","patterns","_parts$find","_context$intent","validatePattern","valid","error","parsedNodes","astEndIndex","maxNodes","maxConsumedNodes","matchedNodes","parts","nodesToParts","parseContext","reportDiagnostic","parse","leadingHtmlCommentMeta","find","p","meta","id","singleInstance","isNullComponent","nullComponent","Component","resolvedSectionOptions","resolveSectionOptions","patternValidation","astStartIndex"],"sources":["../../../src/component/componentParser.ts"],"sourcesContent":["/**\n * Markdown → component orchestrator. Lifted from\n * `web50-server-ui/src/utils/componentParser.ts` per DL #088 B9.5.\n *\n * The lift replaces three app-side singletons with options:\n * - `getAppRegistry()` → `options.registry`\n * - `getClientConfigSync(clientId)` → `options.clientConfig`\n * - `setLastDiagnosticsCollector(...)` → returned in the result object\n *\n * Adds a `placement` option that flows into every `registry.resolveSection`\n * call so the placement bundle can pick the placement variant of each section.\n *\n * The app-side `componentParser.ts` is a thin wrapper around this orchestrator\n * that pre-binds its singletons and a product-payload enrichment callback.\n */\nimport type { RootContent } from 'mdast';\nimport React from 'react';\n\nimport { validatePattern } from '../patternValidator';\nimport { nodesToParts } from '../match/astToParts';\nimport { isWeb5ImageUrl } from '../types/link-types';\nimport { findInvalidWeb5Links } from '../utils/web5LinkValidator';\nimport { DIAGNOSTIC_TYPES, type DiagnosticType } from './diagnosticTypes';\nimport { ComponentTracking } from '../utils/componentTracking';\nimport { isMatchDebugEnabled, logMatchDebug } from '../utils/matchDebug';\nimport { DiagnosticsCollector } from '../utils/diagnosticsCollector';\nimport {\n parseAstToMarkdown,\n parseMarkdownToAst,\n} from '../utils/unifiedMarkdownParser';\nimport { preprocessMarkdown } from '../utils/markdownPreprocessor';\nimport {\n getIntentFromMarkdown,\n type IntentInfo,\n} from '../utils/intentExtractor';\nimport { getContextualImageFilename } from '../utils/contentKeywordMatcher';\nimport { createPageSection } from '../utils/propsExtractor';\nimport type { PageSection } from '../types/page-section';\nimport type { ApiPayloadItem } from '../types/entity';\nimport type { ComponentRegistry } from '../registry';\nimport type { EntityCompProps, GeneralTextCompProps } from './types';\nimport type { SectionDefinition, ParseContext } from './section-definition';\nimport type {\n EnrichEntityProps,\n ParserClientConfig,\n ParserContext,\n} from './parser-types';\n\nexport type { ComponentMatch, ParserContext } from './parser-types';\n\nexport interface ParseMarkdownOptions {\n /** Required — replaces the app-side `getAppRegistry()` singleton. */\n registry: ComponentRegistry<React.FC<any>>;\n /** Replaces `getClientConfigSync(clientId)` — caller resolves it first. */\n clientConfig?: ParserClientConfig | null;\n /** When true, resolveSection prefers placement variants (DL #088 D3.1). */\n placement?: boolean;\n /**\n * Placement slot id (the `data-web5-placement` value) — forwarded to\n * `resolveSection` so a section can resolve a per-placement variant. Only\n * meaningful with `placement: true`.\n */\n placementId?: string;\n /** App-specific payload-to-entity enrichment; omitted by the placement bundle. */\n enrichEntityProps?: EnrichEntityProps;\n /** Reuse an existing collector (e.g. for streaming) instead of creating one. */\n diagnosticsCollector?: DiagnosticsCollector;\n clientId?: string;\n intentInfo?: IntentInfo | null;\n payload?: ApiPayloadItem[];\n disableContextualImages?: boolean;\n}\n\nexport interface ParseMarkdownResult {\n sections: PageSection[];\n tracking: ComponentTracking;\n diagnosticsCollector: DiagnosticsCollector;\n}\n\nfunction isEntityCompProps(props: unknown): props is EntityCompProps {\n return (\n typeof props === 'object' &&\n props !== null &&\n Array.isArray((props as EntityCompProps).items)\n );\n}\n\n/**\n * Section types whose props are `EntityCompProps` and therefore participate in\n * payload enrichment. `entityCollection` is `entity` narrowed to collection\n * links — it produces the same props and arrives under the same\n * `semantic: items` descriptor, so leaving it out would silently strip its\n * items of their catalog data (image, title) and render the section blank.\n */\nconst ENRICHABLE_ENTITY_SECTION_TYPES = new Set(['entity', 'entityCollection']);\n\nfunction isItemsFromContentSection(\n sectionType: string,\n semantic?: string,\n serverSectionId?: string,\n): boolean {\n if (!ENRICHABLE_ENTITY_SECTION_TYPES.has(sectionType)) {\n return false;\n }\n const normalizedSemantic = semantic?.toLowerCase().replace(/_/g, '-');\n const normalizedId = serverSectionId?.toLowerCase().replace(/_/g, '-');\n return (\n normalizedSemantic === 'items' ||\n normalizedSemantic === 'items-from-content' ||\n normalizedId?.includes('items-from-content') === true\n );\n}\n\n/**\n * Merges new sections with existing sections, maintaining stable references\n * for unchanged sections to prevent unnecessary rerenders.\n */\nexport function mergeSectionsWithStableReferences(\n existingSections: PageSection[],\n newSections: PageSection[],\n): PageSection[] {\n if (existingSections.length === 0) {\n return newSections;\n }\n if (newSections.length < existingSections.length) {\n return newSections;\n }\n\n const merged: PageSection[] = [];\n\n for (let i = 0; i < existingSections.length; i++) {\n const existing = existingSections[i];\n const updated = newSections[i];\n\n if (!updated) {\n merged.push(existing);\n continue;\n }\n\n const existingLength = existing.sourceMarkdown?.length || 0;\n const updatedLength = updated.sourceMarkdown?.length || 0;\n\n if (existingLength === updatedLength) {\n existing.sourceMarkdown = updated.sourceMarkdown;\n existing.component = updated.component;\n existing.componentOptions = updated.componentOptions;\n existing.debugProps = updated.debugProps;\n // V3 (DL #106): a skeleton and its real section both have empty\n // sourceMarkdown, so without carrying this flag the slot would stay a\n // skeleton forever (its real component never rendering).\n existing.isSkeleton = updated.isSkeleton;\n merged.push(existing);\n } else {\n merged.push(updated);\n }\n }\n\n if (newSections.length > existingSections.length) {\n const newSectionsToAdd = newSections.slice(existingSections.length);\n merged.push(...newSectionsToAdd);\n }\n\n return merged;\n}\n\nfunction combineAdjacentGeneralTextSections(\n sections: PageSection[],\n registry: ComponentRegistry<React.FC<any>>,\n placement?: boolean,\n placementId?: string,\n): PageSection[] {\n if (sections.length === 0) {\n return sections;\n }\n\n const combined: PageSection[] = [];\n let i = 0;\n\n while (i < sections.length) {\n const currentSection = sections[i];\n if (currentSection.sectionType === 'fallback') {\n const sectionsToCombine: PageSection[] = [currentSection];\n let j = i + 1;\n\n while (j < sections.length && sections[j].sectionType === 'fallback') {\n sectionsToCombine.push(sections[j]);\n j++;\n }\n\n if (sectionsToCombine.length > 1) {\n const mergedSection = mergeGeneralTextSections(\n sectionsToCombine,\n combined.length,\n registry,\n placement,\n placementId,\n );\n combined.push(mergedSection);\n i = j;\n } else {\n combined.push(currentSection);\n i++;\n }\n } else {\n combined.push(currentSection);\n i++;\n }\n }\n\n return combined;\n}\n\nfunction mergeGeneralTextSections(\n sections: PageSection[],\n index: number,\n registry: ComponentRegistry<React.FC<any>>,\n placement?: boolean,\n placementId?: string,\n): PageSection {\n if (sections.length === 0) {\n throw new Error('Cannot merge empty sections array');\n }\n if (sections.length === 1) {\n return sections[0];\n }\n\n const mergedSourceMarkdown = sections\n .map((section) => section.sourceMarkdown || '')\n .filter((markdown) => markdown.trim().length > 0)\n .join('\\n\\n');\n\n const mergedProps: GeneralTextCompProps = {\n markdown: mergedSourceMarkdown,\n };\n\n const FallbackComponent = registry.resolveSection('fallback', {\n placement,\n placementId,\n });\n const mergedComponent = React.createElement(FallbackComponent, mergedProps);\n\n return createPageSection({\n sectionType: 'fallback',\n componentName:\n (FallbackComponent as React.FC).displayName || FallbackComponent.name,\n index,\n component: mergedComponent,\n sourceMarkdown: mergedSourceMarkdown,\n debugProps: mergedProps,\n });\n}\n\nexport function parseMarkdownToComponents(\n pageMarkdown: string,\n options: ParseMarkdownOptions,\n): ParseMarkdownResult {\n const {\n registry,\n clientConfig,\n placement,\n placementId,\n enrichEntityProps,\n clientId,\n intentInfo: providedIntent,\n payload,\n disableContextualImages: explicitDisableImages,\n } = options;\n\n const { markdown: preprocessedMarkdown, diagnostics: preprocessDiagnostics } =\n preprocessMarkdown(pageMarkdown);\n\n // Validate the emitted intent against this client's own registered intents\n // (its taxonomy), falling back to core's DEFAULT_INTENTS when the registry\n // declares none.\n const knownIntents = registry.getKnownIntents();\n const intentInfo =\n providedIntent ??\n getIntentFromMarkdown(preprocessedMarkdown, {\n validIntents: knownIntents.length > 0 ? knownIntents : undefined,\n });\n\n const allNodes: RootContent[] = [\n ...parseMarkdownToAst(preprocessedMarkdown).children,\n ];\n const nodes: RootContent[] = [...allNodes];\n\n const sections: PageSection[] = [];\n const tracking = new ComponentTracking();\n const diagnosticsCollector =\n options.diagnosticsCollector ?? new DiagnosticsCollector();\n\n for (const d of preprocessDiagnostics) {\n diagnosticsCollector.report({\n diagnosticType: d.type as DiagnosticType,\n sectionType: 'preprocessor',\n sectionIndex: -1,\n details: `${d.original} → ${d.normalized}`,\n });\n }\n\n const disableContextualImages =\n explicitDisableImages ??\n clientConfig?.features?.disableContextualImagesEnrichment ??\n false;\n\n const context: ParserContext = {\n registry,\n clientConfig,\n placement,\n placementId,\n enrichEntityProps,\n clientId,\n intent: intentInfo,\n tracking,\n disableContextualImages,\n diagnosticsCollector,\n payload,\n };\n let currentGlobalIndex = 0;\n\n while (nodes.length > 0) {\n const startIndex = currentGlobalIndex;\n const { section, parsedCount } = tryParseComponent(\n nodes,\n sections.length,\n context,\n );\n\n if (!parsedCount) {\n break;\n }\n\n if (section) {\n section.sourceMarkdown = parseAstToMarkdown(nodes.slice(0, parsedCount));\n sections.push(section);\n\n const endIndex = startIndex + parsedCount;\n tracking.addRange(\n section.sectionType,\n startIndex,\n endIndex,\n sections.length - 1,\n );\n } else {\n const endIndex = startIndex + parsedCount;\n tracking.addRange('', startIndex, endIndex, -1);\n }\n\n currentGlobalIndex += parsedCount;\n nodes.splice(0, parsedCount);\n }\n\n for (const link of findInvalidWeb5Links(allNodes)) {\n let diagnosticType: DiagnosticType;\n let label: string;\n switch (link.reason) {\n case 'legacy':\n diagnosticType = DIAGNOSTIC_TYPES.LEGACY_PROTOCOL_LINK;\n label = 'legacy protocol';\n break;\n case 'empty':\n diagnosticType = DIAGNOSTIC_TYPES.INVALID_LINK_FORMAT;\n label = 'empty href';\n break;\n default:\n diagnosticType = DIAGNOSTIC_TYPES.BROKEN_WEB5_LINK;\n label = 'web5://';\n break;\n }\n diagnosticsCollector.report({\n diagnosticType,\n sectionType: 'parser',\n sectionIndex: -1,\n details: `Invalid ${label} URL in ${link.nodeType}: ${link.url}`.slice(\n 0,\n 200,\n ),\n });\n }\n\n const combinedSections = combineAdjacentGeneralTextSections(\n sections,\n registry,\n placement,\n placementId,\n );\n\n return {\n sections: combinedSections,\n tracking,\n diagnosticsCollector,\n };\n}\n\nexport function tryParseComponent(\n nodes: RootContent[],\n sectionIndex: number,\n context: ParserContext,\n): { section?: PageSection; parsedCount?: number } {\n if (!nodes?.length) {\n return {};\n }\n\n const registry = context.registry;\n const placement = context.placement;\n const placementId = context.placementId;\n const definitions = registry.getAllDefinitions();\n\n const clientConfig = context.clientConfig ?? null;\n const allowedKeywords = clientConfig?.allowedImageSearchKeywords ?? [];\n const disableContextualImages = context.disableContextualImages ?? false;\n\n const baseParseContext: ParseContext = {\n getContextualImage:\n disableContextualImages || allowedKeywords.length === 0\n ? undefined\n : (contentParts) => {\n const result = getContextualImageFilename(\n contentParts,\n allowedKeywords,\n '',\n context.tracking,\n );\n return isWeb5ImageUrl(result.filename) ? result : null;\n },\n getComponentCount: context.tracking\n ? (sectionType) => context.tracking!.getComponentCount(sectionType)\n : undefined,\n setMeta: context.tracking\n ? (sectionType, key, value) =>\n context.tracking!.setMeta(sectionType, key, value)\n : undefined,\n getMeta: context.tracking\n ? (sectionType, key) => context.tracking!.getMeta(sectionType, key)\n : undefined,\n };\n\n // Debug-only trace (`?web5DebugMatch=1`). The registry order line doubles as\n // a \"is my definition even registered?\" check — a definition missing from it\n // never reached `register()` (stale client bundle / web5-core version skew).\n const trace = isMatchDebugEnabled();\n if (trace) {\n logMatchDebug(\n `block #${sectionIndex} [${nodes.map((n) => n.type).join(', ')}]`,\n );\n logMatchDebug(\n ` registry order: ${definitions.map((d) => d.sectionType).join(' > ')}`,\n );\n }\n\n for (const { sectionType, definition } of definitions) {\n // Placement-only definitions (registered with `{ placement: true }`\n // variants and no non-placement variant) must not match in a non-placement\n // render (the main app) — their markdown should fall through to the generic\n // sections there. Skip them unless this is a placement parse.\n if (!placement && registry.isPlacementOnly(sectionType)) {\n if (trace) {\n logMatchDebug(` ${sectionType}: skipped (placement-only)`);\n }\n continue;\n }\n for (const pattern of definition.patterns) {\n const result = validatePattern(nodes, pattern);\n if (!result.valid) {\n if (trace) {\n logMatchDebug(\n ` ${sectionType}: no match — ${\n result.error ?? 'pattern did not match'\n }\\n pattern: ${pattern}`,\n );\n }\n continue;\n }\n\n let parsedNodes =\n result.astEndIndex !== undefined && result.astEndIndex >= 0\n ? result.astEndIndex + 1\n : result.endIndex >= 0\n ? result.endIndex + 1\n : 1;\n\n const maxNodes = (\n definition as SectionDefinition & { maxConsumedNodes?: number }\n ).maxConsumedNodes;\n if (typeof maxNodes === 'number' && parsedNodes > maxNodes) {\n parsedNodes = maxNodes;\n }\n\n const matchedNodes = nodes.slice(0, parsedNodes);\n const parts = nodesToParts(matchedNodes);\n const parseContext: ParseContext = {\n ...baseParseContext,\n reportDiagnostic: context.diagnosticsCollector\n ? (type, details) => {\n context.diagnosticsCollector!.report({\n diagnosticType: type,\n sectionType,\n sectionIndex,\n details: details.slice(0, 200),\n });\n }\n : undefined,\n };\n let props = definition.parse(parts, parseContext);\n\n if (props === null) {\n if (trace) {\n logMatchDebug(\n ` ${sectionType}: pattern matched ${parsedNodes} node(s) but parse() returned null — falling through`,\n );\n }\n continue;\n }\n\n if (trace) {\n logMatchDebug(\n ` ${sectionType}: MATCHED ${parsedNodes} node(s) via ${pattern}`,\n );\n }\n\n const leadingHtmlCommentMeta = parts.find(\n (p) => p.type === 'htmlComment' && p.meta,\n )?.meta;\n const semantic = leadingHtmlCommentMeta?.semantic as string | undefined;\n const serverSectionId = leadingHtmlCommentMeta?.id as string | undefined;\n\n if (\n isEntityCompProps(props) &&\n isItemsFromContentSection(sectionType, semantic, serverSectionId) &&\n context.enrichEntityProps\n ) {\n props = context.enrichEntityProps(props, {\n payload: context.payload,\n clientConfig,\n sectionType,\n semantic,\n serverSectionId,\n });\n }\n\n if (\n definition.singleInstance &&\n context.tracking &&\n context.tracking.getComponentCount(sectionType) > 0\n ) {\n if (trace) {\n logMatchDebug(\n ` ${sectionType}: dropped (singleInstance, already rendered once)`,\n );\n }\n continue;\n }\n\n const isNullComponent =\n (definition as SectionDefinition & { nullComponent?: boolean })\n .nullComponent === true;\n if (isNullComponent) {\n return { parsedCount: parsedNodes };\n }\n\n const intent = context.intent?.intent;\n const Component = registry.resolveSection(sectionType, {\n intent,\n semantic,\n placement,\n placementId,\n });\n const resolvedSectionOptions = registry.resolveSectionOptions(\n sectionType,\n { intent, semantic, placement, placementId },\n );\n const component = React.createElement(Component, props);\n const componentName =\n Component.displayName || Component.name || undefined;\n\n const section = createPageSection({\n sectionType,\n componentName,\n semantic,\n componentOptions: resolvedSectionOptions?.componentOptions,\n index: sectionIndex,\n id: serverSectionId,\n component,\n sourceMarkdown: '',\n debugProps: {\n ...props,\n patternValidation: {\n astStartIndex: result.astStartIndex,\n astEndIndex: result.astEndIndex,\n endIndex: result.endIndex,\n },\n },\n });\n\n return { section, parsedCount: parsedNodes };\n }\n }\n\n if (trace) {\n logMatchDebug(' no definition claimed this block');\n }\n\n return {};\n}\n"],"mappings":";;;;;;;AAgBA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAR,OAAA;AACA,IAAAS,sBAAA,GAAAT,OAAA;AAIA,IAAAU,qBAAA,GAAAV,OAAA;AACA,IAAAW,gBAAA,GAAAX,OAAA;AAIA,IAAAY,sBAAA,GAAAZ,OAAA;AACA,IAAAa,eAAA,GAAAb,OAAA;AApCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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7D,OAAO;QAAE0D,WAAW,EAAE8C;MAAY,CAAC;IAC9C;EACF;EAEA,IAAIb,KAAK,EAAE;IACT,IAAAE,yBAAa,EAAC,oCAAoC,CAAC;EACrD;EAEA,OAAO,CAAC,CAAC;AACX","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_patternValidator","_astToParts","_linkTypes","_web5LinkValidator","_diagnosticTypes","_componentTracking","_matchDebug","_diagnosticsCollector","_unifiedMarkdownParser","_markdownPreprocessor","_intentExtractor","_contentKeywordMatcher","_propsExtractor","_sectionDefinition","isEntityCompProps","props","Array","isArray","items","ENRICHABLE_ENTITY_SECTION_TYPES","Set","isItemsFromContentSection","sectionType","semantic","serverSectionId","has","normalizedSemantic","toLowerCase","replace","normalizedId","includes","mergeSectionsWithStableReferences","existingSections","newSections","length","merged","i","_existing$sourceMarkd","_updated$sourceMarkdo","existing","updated","push","existingLength","sourceMarkdown","updatedLength","component","componentOptions","debugProps","isSkeleton","newSectionsToAdd","slice","combineAdjacentGeneralTextSections","sections","registry","placement","placementId","combined","currentSection","sectionsToCombine","j","mergedSection","mergeGeneralTextSections","index","Error","mergedSourceMarkdown","map","section","filter","markdown","trim","join","mergedProps","FallbackComponent","resolveSection","mergedComponent","React","createElement","createPageSection","componentName","displayName","name","parseMarkdownToComponents","pageMarkdown","options","_clientConfig$feature","clientConfig","enrichEntityProps","clientId","intentInfo","providedIntent","payload","disableContextualImages","explicitDisableImages","preprocessedMarkdown","diagnostics","preprocessDiagnostics","preprocessMarkdown","knownIntents","getKnownIntents","getIntentFromMarkdown","validIntents","undefined","allNodes","parseMarkdownToAst","children","nodes","tracking","ComponentTracking","diagnosticsCollector","DiagnosticsCollector","d","report","diagnosticType","type","sectionIndex","details","original","normalized","features","disableContextualImagesEnrichment","context","intent","currentGlobalIndex","startIndex","parsedCount","tryParseComponent","parseAstToMarkdown","endIndex","addRange","splice","link","findInvalidWeb5Links","label","reason","DIAGNOSTIC_TYPES","LEGACY_PROTOCOL_LINK","INVALID_LINK_FORMAT","BROKEN_WEB5_LINK","nodeType","url","combinedSections","definitions","getAllDefinitions","allowedKeywords","allowedImageSearchKeywords","baseParseContext","getContextualImage","contentParts","result","getContextualImageFilename","isWeb5ImageUrl","filename","getComponentCount","setMeta","key","value","getMeta","trace","isMatchDebugEnabled","logMatchDebug","n","definition","isPlacementOnly","pattern","patterns","_parts$find","_context$intent","validatePattern","valid","error","parsedNodes","astEndIndex","maxNodes","maxConsumedNodes","matchedNodes","parts","nodesToParts","parseContext","reportDiagnostic","parse","DROP_SECTION","leadingHtmlCommentMeta","find","p","meta","id","singleInstance","isNullComponent","nullComponent","Component","resolvedSectionOptions","resolveSectionOptions","patternValidation","astStartIndex"],"sources":["../../../src/component/componentParser.ts"],"sourcesContent":["/**\n * Markdown → component orchestrator. Lifted from\n * `web50-server-ui/src/utils/componentParser.ts` per DL #088 B9.5.\n *\n * The lift replaces three app-side singletons with options:\n * - `getAppRegistry()` → `options.registry`\n * - `getClientConfigSync(clientId)` → `options.clientConfig`\n * - `setLastDiagnosticsCollector(...)` → returned in the result object\n *\n * Adds a `placement` option that flows into every `registry.resolveSection`\n * call so the placement bundle can pick the placement variant of each section.\n *\n * The app-side `componentParser.ts` is a thin wrapper around this orchestrator\n * that pre-binds its singletons and a product-payload enrichment callback.\n */\nimport type { RootContent } from 'mdast';\nimport React from 'react';\n\nimport { validatePattern } from '../patternValidator';\nimport { nodesToParts } from '../match/astToParts';\nimport { isWeb5ImageUrl } from '../types/link-types';\nimport { findInvalidWeb5Links } from '../utils/web5LinkValidator';\nimport { DIAGNOSTIC_TYPES, type DiagnosticType } from './diagnosticTypes';\nimport { ComponentTracking } from '../utils/componentTracking';\nimport { isMatchDebugEnabled, logMatchDebug } from '../utils/matchDebug';\nimport { DiagnosticsCollector } from '../utils/diagnosticsCollector';\nimport {\n parseAstToMarkdown,\n parseMarkdownToAst,\n} from '../utils/unifiedMarkdownParser';\nimport { preprocessMarkdown } from '../utils/markdownPreprocessor';\nimport {\n getIntentFromMarkdown,\n type IntentInfo,\n} from '../utils/intentExtractor';\nimport { getContextualImageFilename } from '../utils/contentKeywordMatcher';\nimport { createPageSection } from '../utils/propsExtractor';\nimport type { PageSection } from '../types/page-section';\nimport type { ApiPayloadItem } from '../types/entity';\nimport type { ComponentRegistry } from '../registry';\nimport type { EntityCompProps, GeneralTextCompProps } from './types';\nimport type { SectionDefinition, ParseContext } from './section-definition';\nimport { DROP_SECTION } from './section-definition';\nimport type {\n EnrichEntityProps,\n ParserClientConfig,\n ParserContext,\n} from './parser-types';\n\nexport type { ComponentMatch, ParserContext } from './parser-types';\n\nexport interface ParseMarkdownOptions {\n /** Required — replaces the app-side `getAppRegistry()` singleton. */\n registry: ComponentRegistry<React.FC<any>>;\n /** Replaces `getClientConfigSync(clientId)` — caller resolves it first. */\n clientConfig?: ParserClientConfig | null;\n /** When true, resolveSection prefers placement variants (DL #088 D3.1). */\n placement?: boolean;\n /**\n * Placement slot id (the `data-web5-placement` value) — forwarded to\n * `resolveSection` so a section can resolve a per-placement variant. Only\n * meaningful with `placement: true`.\n */\n placementId?: string;\n /** App-specific payload-to-entity enrichment; omitted by the placement bundle. */\n enrichEntityProps?: EnrichEntityProps;\n /** Reuse an existing collector (e.g. for streaming) instead of creating one. */\n diagnosticsCollector?: DiagnosticsCollector;\n clientId?: string;\n intentInfo?: IntentInfo | null;\n payload?: ApiPayloadItem[];\n disableContextualImages?: boolean;\n}\n\nexport interface ParseMarkdownResult {\n sections: PageSection[];\n tracking: ComponentTracking;\n diagnosticsCollector: DiagnosticsCollector;\n}\n\nfunction isEntityCompProps(props: unknown): props is EntityCompProps {\n return (\n typeof props === 'object' &&\n props !== null &&\n Array.isArray((props as EntityCompProps).items)\n );\n}\n\n/**\n * Section types whose props are `EntityCompProps` and therefore participate in\n * payload enrichment. `entityCollection` is `entity` narrowed to collection\n * links — it produces the same props and arrives under the same\n * `semantic: items` descriptor, so leaving it out would silently strip its\n * items of their catalog data (image, title) and render the section blank.\n */\nconst ENRICHABLE_ENTITY_SECTION_TYPES = new Set(['entity', 'entityCollection']);\n\nfunction isItemsFromContentSection(\n sectionType: string,\n semantic?: string,\n serverSectionId?: string,\n): boolean {\n if (!ENRICHABLE_ENTITY_SECTION_TYPES.has(sectionType)) {\n return false;\n }\n const normalizedSemantic = semantic?.toLowerCase().replace(/_/g, '-');\n const normalizedId = serverSectionId?.toLowerCase().replace(/_/g, '-');\n return (\n normalizedSemantic === 'items' ||\n normalizedSemantic === 'items-from-content' ||\n normalizedId?.includes('items-from-content') === true\n );\n}\n\n/**\n * Merges new sections with existing sections, maintaining stable references\n * for unchanged sections to prevent unnecessary rerenders.\n */\nexport function mergeSectionsWithStableReferences(\n existingSections: PageSection[],\n newSections: PageSection[],\n): PageSection[] {\n if (existingSections.length === 0) {\n return newSections;\n }\n if (newSections.length < existingSections.length) {\n return newSections;\n }\n\n const merged: PageSection[] = [];\n\n for (let i = 0; i < existingSections.length; i++) {\n const existing = existingSections[i];\n const updated = newSections[i];\n\n if (!updated) {\n merged.push(existing);\n continue;\n }\n\n const existingLength = existing.sourceMarkdown?.length || 0;\n const updatedLength = updated.sourceMarkdown?.length || 0;\n\n if (existingLength === updatedLength) {\n existing.sourceMarkdown = updated.sourceMarkdown;\n existing.component = updated.component;\n existing.componentOptions = updated.componentOptions;\n existing.debugProps = updated.debugProps;\n // V3 (DL #106): a skeleton and its real section both have empty\n // sourceMarkdown, so without carrying this flag the slot would stay a\n // skeleton forever (its real component never rendering).\n existing.isSkeleton = updated.isSkeleton;\n merged.push(existing);\n } else {\n merged.push(updated);\n }\n }\n\n if (newSections.length > existingSections.length) {\n const newSectionsToAdd = newSections.slice(existingSections.length);\n merged.push(...newSectionsToAdd);\n }\n\n return merged;\n}\n\nfunction combineAdjacentGeneralTextSections(\n sections: PageSection[],\n registry: ComponentRegistry<React.FC<any>>,\n placement?: boolean,\n placementId?: string,\n): PageSection[] {\n if (sections.length === 0) {\n return sections;\n }\n\n const combined: PageSection[] = [];\n let i = 0;\n\n while (i < sections.length) {\n const currentSection = sections[i];\n if (currentSection.sectionType === 'fallback') {\n const sectionsToCombine: PageSection[] = [currentSection];\n let j = i + 1;\n\n while (j < sections.length && sections[j].sectionType === 'fallback') {\n sectionsToCombine.push(sections[j]);\n j++;\n }\n\n if (sectionsToCombine.length > 1) {\n const mergedSection = mergeGeneralTextSections(\n sectionsToCombine,\n combined.length,\n registry,\n placement,\n placementId,\n );\n combined.push(mergedSection);\n i = j;\n } else {\n combined.push(currentSection);\n i++;\n }\n } else {\n combined.push(currentSection);\n i++;\n }\n }\n\n return combined;\n}\n\nfunction mergeGeneralTextSections(\n sections: PageSection[],\n index: number,\n registry: ComponentRegistry<React.FC<any>>,\n placement?: boolean,\n placementId?: string,\n): PageSection {\n if (sections.length === 0) {\n throw new Error('Cannot merge empty sections array');\n }\n if (sections.length === 1) {\n return sections[0];\n }\n\n const mergedSourceMarkdown = sections\n .map((section) => section.sourceMarkdown || '')\n .filter((markdown) => markdown.trim().length > 0)\n .join('\\n\\n');\n\n const mergedProps: GeneralTextCompProps = {\n markdown: mergedSourceMarkdown,\n };\n\n const FallbackComponent = registry.resolveSection('fallback', {\n placement,\n placementId,\n });\n const mergedComponent = React.createElement(FallbackComponent, mergedProps);\n\n return createPageSection({\n sectionType: 'fallback',\n componentName:\n (FallbackComponent as React.FC).displayName || FallbackComponent.name,\n index,\n component: mergedComponent,\n sourceMarkdown: mergedSourceMarkdown,\n debugProps: mergedProps,\n });\n}\n\nexport function parseMarkdownToComponents(\n pageMarkdown: string,\n options: ParseMarkdownOptions,\n): ParseMarkdownResult {\n const {\n registry,\n clientConfig,\n placement,\n placementId,\n enrichEntityProps,\n clientId,\n intentInfo: providedIntent,\n payload,\n disableContextualImages: explicitDisableImages,\n } = options;\n\n const { markdown: preprocessedMarkdown, diagnostics: preprocessDiagnostics } =\n preprocessMarkdown(pageMarkdown);\n\n // Validate the emitted intent against this client's own registered intents\n // (its taxonomy), falling back to core's DEFAULT_INTENTS when the registry\n // declares none.\n const knownIntents = registry.getKnownIntents();\n const intentInfo =\n providedIntent ??\n getIntentFromMarkdown(preprocessedMarkdown, {\n validIntents: knownIntents.length > 0 ? knownIntents : undefined,\n });\n\n const allNodes: RootContent[] = [\n ...parseMarkdownToAst(preprocessedMarkdown).children,\n ];\n const nodes: RootContent[] = [...allNodes];\n\n const sections: PageSection[] = [];\n const tracking = new ComponentTracking();\n const diagnosticsCollector =\n options.diagnosticsCollector ?? new DiagnosticsCollector();\n\n for (const d of preprocessDiagnostics) {\n diagnosticsCollector.report({\n diagnosticType: d.type as DiagnosticType,\n sectionType: 'preprocessor',\n sectionIndex: -1,\n details: `${d.original} → ${d.normalized}`,\n });\n }\n\n const disableContextualImages =\n explicitDisableImages ??\n clientConfig?.features?.disableContextualImagesEnrichment ??\n false;\n\n const context: ParserContext = {\n registry,\n clientConfig,\n placement,\n placementId,\n enrichEntityProps,\n clientId,\n intent: intentInfo,\n tracking,\n disableContextualImages,\n diagnosticsCollector,\n payload,\n };\n let currentGlobalIndex = 0;\n\n while (nodes.length > 0) {\n const startIndex = currentGlobalIndex;\n const { section, parsedCount } = tryParseComponent(\n nodes,\n sections.length,\n context,\n );\n\n if (!parsedCount) {\n break;\n }\n\n if (section) {\n section.sourceMarkdown = parseAstToMarkdown(nodes.slice(0, parsedCount));\n sections.push(section);\n\n const endIndex = startIndex + parsedCount;\n tracking.addRange(\n section.sectionType,\n startIndex,\n endIndex,\n sections.length - 1,\n );\n } else {\n const endIndex = startIndex + parsedCount;\n tracking.addRange('', startIndex, endIndex, -1);\n }\n\n currentGlobalIndex += parsedCount;\n nodes.splice(0, parsedCount);\n }\n\n for (const link of findInvalidWeb5Links(allNodes)) {\n let diagnosticType: DiagnosticType;\n let label: string;\n switch (link.reason) {\n case 'legacy':\n diagnosticType = DIAGNOSTIC_TYPES.LEGACY_PROTOCOL_LINK;\n label = 'legacy protocol';\n break;\n case 'empty':\n diagnosticType = DIAGNOSTIC_TYPES.INVALID_LINK_FORMAT;\n label = 'empty href';\n break;\n default:\n diagnosticType = DIAGNOSTIC_TYPES.BROKEN_WEB5_LINK;\n label = 'web5://';\n break;\n }\n diagnosticsCollector.report({\n diagnosticType,\n sectionType: 'parser',\n sectionIndex: -1,\n details: `Invalid ${label} URL in ${link.nodeType}: ${link.url}`.slice(\n 0,\n 200,\n ),\n });\n }\n\n const combinedSections = combineAdjacentGeneralTextSections(\n sections,\n registry,\n placement,\n placementId,\n );\n\n return {\n sections: combinedSections,\n tracking,\n diagnosticsCollector,\n };\n}\n\nexport function tryParseComponent(\n nodes: RootContent[],\n sectionIndex: number,\n context: ParserContext,\n): { section?: PageSection; parsedCount?: number } {\n if (!nodes?.length) {\n return {};\n }\n\n const registry = context.registry;\n const placement = context.placement;\n const placementId = context.placementId;\n const definitions = registry.getAllDefinitions();\n\n const clientConfig = context.clientConfig ?? null;\n const allowedKeywords = clientConfig?.allowedImageSearchKeywords ?? [];\n const disableContextualImages = context.disableContextualImages ?? false;\n\n const baseParseContext: ParseContext = {\n getContextualImage:\n disableContextualImages || allowedKeywords.length === 0\n ? undefined\n : (contentParts) => {\n const result = getContextualImageFilename(\n contentParts,\n allowedKeywords,\n '',\n context.tracking,\n );\n return isWeb5ImageUrl(result.filename) ? result : null;\n },\n getComponentCount: context.tracking\n ? (sectionType) => context.tracking!.getComponentCount(sectionType)\n : undefined,\n setMeta: context.tracking\n ? (sectionType, key, value) =>\n context.tracking!.setMeta(sectionType, key, value)\n : undefined,\n getMeta: context.tracking\n ? (sectionType, key) => context.tracking!.getMeta(sectionType, key)\n : undefined,\n };\n\n // Debug-only trace (`?web5DebugMatch=1`). The registry order line doubles as\n // a \"is my definition even registered?\" check — a definition missing from it\n // never reached `register()` (stale client bundle / web5-core version skew).\n const trace = isMatchDebugEnabled();\n if (trace) {\n logMatchDebug(\n `block #${sectionIndex} [${nodes.map((n) => n.type).join(', ')}]`,\n );\n logMatchDebug(\n ` registry order: ${definitions.map((d) => d.sectionType).join(' > ')}`,\n );\n }\n\n for (const { sectionType, definition } of definitions) {\n // Placement-only definitions (registered with `{ placement: true }`\n // variants and no non-placement variant) must not match in a non-placement\n // render (the main app) — their markdown should fall through to the generic\n // sections there. Skip them unless this is a placement parse.\n if (!placement && registry.isPlacementOnly(sectionType)) {\n if (trace) {\n logMatchDebug(` ${sectionType}: skipped (placement-only)`);\n }\n continue;\n }\n for (const pattern of definition.patterns) {\n const result = validatePattern(nodes, pattern);\n if (!result.valid) {\n if (trace) {\n logMatchDebug(\n ` ${sectionType}: no match — ${\n result.error ?? 'pattern did not match'\n }\\n pattern: ${pattern}`,\n );\n }\n continue;\n }\n\n let parsedNodes =\n result.astEndIndex !== undefined && result.astEndIndex >= 0\n ? result.astEndIndex + 1\n : result.endIndex >= 0\n ? result.endIndex + 1\n : 1;\n\n const maxNodes = (\n definition as SectionDefinition & { maxConsumedNodes?: number }\n ).maxConsumedNodes;\n if (typeof maxNodes === 'number' && parsedNodes > maxNodes) {\n parsedNodes = maxNodes;\n }\n\n const matchedNodes = nodes.slice(0, parsedNodes);\n const parts = nodesToParts(matchedNodes);\n const parseContext: ParseContext = {\n ...baseParseContext,\n reportDiagnostic: context.diagnosticsCollector\n ? (type, details) => {\n context.diagnosticsCollector!.report({\n diagnosticType: type,\n sectionType,\n sectionIndex,\n details: details.slice(0, 200),\n });\n }\n : undefined,\n };\n let props = definition.parse(parts, parseContext);\n\n // The definition claimed the block and then decided its content is not\n // worth rendering. Consume the nodes and emit no component — returning\n // `null` here instead would let the same heading and table fall through\n // to the raw-markdown fallback, which is the outcome the drop exists to\n // avoid.\n if (props === DROP_SECTION) {\n if (trace) {\n logMatchDebug(\n ` ${sectionType}: matched ${parsedNodes} node(s) but parse() dropped the section — rendering nothing`,\n );\n }\n return { parsedCount: parsedNodes };\n }\n\n if (props === null) {\n if (trace) {\n logMatchDebug(\n ` ${sectionType}: pattern matched ${parsedNodes} node(s) but parse() returned null — falling through`,\n );\n }\n continue;\n }\n\n if (trace) {\n logMatchDebug(\n ` ${sectionType}: MATCHED ${parsedNodes} node(s) via ${pattern}`,\n );\n }\n\n const leadingHtmlCommentMeta = parts.find(\n (p) => p.type === 'htmlComment' && p.meta,\n )?.meta;\n const semantic = leadingHtmlCommentMeta?.semantic as string | undefined;\n const serverSectionId = leadingHtmlCommentMeta?.id as string | undefined;\n\n if (\n isEntityCompProps(props) &&\n isItemsFromContentSection(sectionType, semantic, serverSectionId) &&\n context.enrichEntityProps\n ) {\n props = context.enrichEntityProps(props, {\n payload: context.payload,\n clientConfig,\n sectionType,\n semantic,\n serverSectionId,\n });\n }\n\n if (\n definition.singleInstance &&\n context.tracking &&\n context.tracking.getComponentCount(sectionType) > 0\n ) {\n if (trace) {\n logMatchDebug(\n ` ${sectionType}: dropped (singleInstance, already rendered once)`,\n );\n }\n continue;\n }\n\n const isNullComponent =\n (definition as SectionDefinition & { nullComponent?: boolean })\n .nullComponent === true;\n if (isNullComponent) {\n return { parsedCount: parsedNodes };\n }\n\n const intent = context.intent?.intent;\n const Component = registry.resolveSection(sectionType, {\n intent,\n semantic,\n placement,\n placementId,\n });\n const resolvedSectionOptions = registry.resolveSectionOptions(\n sectionType,\n { intent, semantic, placement, placementId },\n );\n const component = React.createElement(Component, props);\n const componentName =\n Component.displayName || Component.name || undefined;\n\n const section = createPageSection({\n sectionType,\n componentName,\n semantic,\n componentOptions: resolvedSectionOptions?.componentOptions,\n index: sectionIndex,\n id: serverSectionId,\n component,\n sourceMarkdown: '',\n debugProps: {\n ...props,\n patternValidation: {\n astStartIndex: result.astStartIndex,\n astEndIndex: result.astEndIndex,\n endIndex: result.endIndex,\n },\n },\n });\n\n return { section, parsedCount: parsedNodes };\n }\n }\n\n if (trace) {\n logMatchDebug(' no definition claimed this block');\n }\n\n return {};\n}\n"],"mappings":";;;;;;;AAgBA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IA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C;MAAY,CAC7C,CAAC;MACD,MAAMV,SAAS,gBAAG8B,cAAK,CAACC,aAAa,CAACiH,SAAS,EAAE9K,KAAK,CAAC;MACvD,MAAM+D,aAAa,GACjB+G,SAAS,CAAC9G,WAAW,IAAI8G,SAAS,CAAC7G,IAAI,IAAIqB,SAAS;MAEtD,MAAMnC,OAAO,GAAG,IAAAW,iCAAiB,EAAC;QAChCvD,WAAW;QACXwD,aAAa;QACbvD,QAAQ;QACRuB,gBAAgB,EAAEgJ,sBAAsB,oBAAtBA,sBAAsB,CAAEhJ,gBAAgB;QAC1DgB,KAAK,EAAEoD,YAAY;QACnBuE,EAAE,EAAEjK,eAAe;QACnBqB,SAAS;QACTF,cAAc,EAAE,EAAE;QAClBI,UAAU,EAAE;UACV,GAAGhC,KAAK;UACRiL,iBAAiB,EAAE;YACjBC,aAAa,EAAE7C,MAAM,CAAC6C,aAAa;YACnCtB,WAAW,EAAEvB,MAAM,CAACuB,WAAW;YAC/B5C,QAAQ,EAAEqB,MAAM,CAACrB;UACnB;QACF;MACF,CAAC,CAAC;MAEF,OAAO;QAAE7D,OAAO;QAAE0D,WAAW,EAAE8C;MAAY,CAAC;IAC9C;EACF;EAEA,IAAIb,KAAK,EAAE;IACT,IAAAE,yBAAa,EAAC,oCAAoC,CAAC;EACrD;EAEA,OAAO,CAAC,CAAC;AACX","ignoreList":[]}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
+
exports.DROP_SECTION = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Sentinel a `parse()` may return: this block IS mine — consume its nodes — but
|
|
7
|
+
* render nothing.
|
|
8
|
+
*
|
|
9
|
+
* Distinct from `null`, which *rejects* the match and lets the block fall through
|
|
10
|
+
* to the next definition, and ultimately to `FallbackSectionDefinition`, which
|
|
11
|
+
* would re-render the same heading and table as raw markdown. Return this instead
|
|
12
|
+
* when a section matched but its content is unusable and showing a degraded
|
|
13
|
+
* version is worse than showing nothing at all.
|
|
14
|
+
*/
|
|
15
|
+
const DROP_SECTION = exports.DROP_SECTION = Symbol('web5:drop-section');
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
18
|
//# sourceMappingURL=section-definition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/component/section-definition.ts"],"sourcesContent":["import type { FC } from 'react';\nimport type { Part } from '../parts/parts';\nimport type { PropsOf, SectionFixture } from './types';\nimport type { DiagnosticType } from './diagnosticTypes';\n\nexport interface ContextualImageResult {\n filename: string;\n alt: string;\n isFromText: boolean;\n}\n\nexport interface ParseContext {\n /** Returns a contextual image://keyword URL based on content keywords. null = no match. */\n getContextualImage?: (\n contentParts: (string | undefined | null)[],\n ) => ContextualImageResult | null;\n /** Returns how many times a given sectionType has been matched so far in this parse run. */\n getComponentCount?: (sectionType: string) => number;\n /** Store a value scoped to a sectionType for the duration of the parse run. */\n setMeta?: (sectionType: string, key: string, value: unknown) => void;\n /** Retrieve a value previously stored via setMeta. */\n getMeta?: (sectionType: string, key: string) => unknown;\n /** Report a markdown diagnostic (e.g. broken link, invalid format). */\n reportDiagnostic?: (type: DiagnosticType, details: string) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SectionDefinition<T extends FC<any> = FC<any>> {\n sectionType: string;\n patterns: string[];\n singleInstance?: boolean;\n /** Cap the number of AST nodes consumed per match (e.g., 1 for the fallback parser). */\n maxConsumedNodes?: number;\n defaults?: PropsOf<T>;\n fixtures: SectionFixture<PropsOf<T>>[];\n parse(parts: Part[], context?: ParseContext): PropsOf<T> | null;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["DROP_SECTION","exports","Symbol"],"sources":["../../../src/component/section-definition.ts"],"sourcesContent":["import type { FC } from 'react';\nimport type { Part } from '../parts/parts';\nimport type { PropsOf, SectionFixture } from './types';\nimport type { DiagnosticType } from './diagnosticTypes';\n\nexport interface ContextualImageResult {\n filename: string;\n alt: string;\n isFromText: boolean;\n}\n\nexport interface ParseContext {\n /** Returns a contextual image://keyword URL based on content keywords. null = no match. */\n getContextualImage?: (\n contentParts: (string | undefined | null)[],\n ) => ContextualImageResult | null;\n /** Returns how many times a given sectionType has been matched so far in this parse run. */\n getComponentCount?: (sectionType: string) => number;\n /** Store a value scoped to a sectionType for the duration of the parse run. */\n setMeta?: (sectionType: string, key: string, value: unknown) => void;\n /** Retrieve a value previously stored via setMeta. */\n getMeta?: (sectionType: string, key: string) => unknown;\n /** Report a markdown diagnostic (e.g. broken link, invalid format). */\n reportDiagnostic?: (type: DiagnosticType, details: string) => void;\n}\n\n/**\n * Sentinel a `parse()` may return: this block IS mine — consume its nodes — but\n * render nothing.\n *\n * Distinct from `null`, which *rejects* the match and lets the block fall through\n * to the next definition, and ultimately to `FallbackSectionDefinition`, which\n * would re-render the same heading and table as raw markdown. Return this instead\n * when a section matched but its content is unusable and showing a degraded\n * version is worse than showing nothing at all.\n */\nexport const DROP_SECTION: unique symbol = Symbol('web5:drop-section');\nexport type DropSection = typeof DROP_SECTION;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SectionDefinition<T extends FC<any> = FC<any>> {\n sectionType: string;\n patterns: string[];\n singleInstance?: boolean;\n /** Cap the number of AST nodes consumed per match (e.g., 1 for the fallback parser). */\n maxConsumedNodes?: number;\n defaults?: PropsOf<T>;\n fixtures: SectionFixture<PropsOf<T>>[];\n parse(parts: Part[], context?: ParseContext): PropsOf<T> | null | DropSection;\n}\n"],"mappings":";;;;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAA2B,GAAAC,OAAA,CAAAD,YAAA,GAAGE,MAAM,CAAC,mBAAmB,CAAC;;AAGtE","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
7
7
|
var _reactMarkdown = _interopRequireDefault(require("react-markdown"));
|
|
8
8
|
var _remarkGfm = _interopRequireDefault(require("remark-gfm"));
|
|
9
9
|
var _entityLinkParser = require("../../utils/entityLinkParser");
|
|
10
|
+
var _markdownPreprocessor = require("../../utils/markdownPreprocessor");
|
|
10
11
|
var _linkTypes = require("../../types/link-types");
|
|
11
12
|
var _utils = require("../../lib/utils");
|
|
12
13
|
var _useWeb5Link = require("../../hooks/useWeb5Link");
|
|
@@ -28,7 +29,8 @@ function decodeWeb5Path(path) {
|
|
|
28
29
|
const MarkdownText = ({
|
|
29
30
|
children: markdownChildren,
|
|
30
31
|
className = '',
|
|
31
|
-
codeClassName = 'bg-muted px-1 py-0.5 rounded text-xs font-mono'
|
|
32
|
+
codeClassName = 'bg-muted px-1 py-0.5 rounded text-xs font-mono',
|
|
33
|
+
inline = false
|
|
32
34
|
}) => {
|
|
33
35
|
const {
|
|
34
36
|
isActionRegistered
|
|
@@ -36,12 +38,7 @@ const MarkdownText = ({
|
|
|
36
38
|
const {
|
|
37
39
|
reportDiagnostic
|
|
38
40
|
} = (0, _ComponentDependenciesContext.useComponentDependencies)();
|
|
39
|
-
|
|
40
|
-
// Fix malformed markdown links with space between ] and ( e.g. [text] (url) → [text](url)
|
|
41
|
-
const fixMalformedLinks = markdown => {
|
|
42
|
-
return markdown.replace(/\]\s+\(/g, '](');
|
|
43
|
-
};
|
|
44
|
-
const processedMarkdown = fixMalformedLinks(markdownChildren);
|
|
41
|
+
const processedMarkdown = (0, _markdownPreprocessor.fixMalformedLinks)(markdownChildren);
|
|
45
42
|
// Custom URL transform: only render valid URLs (react-markdown v9+ strips non-http by default)
|
|
46
43
|
const urlTransform = url => {
|
|
47
44
|
const validated = (0, _entityLinkParser.validateLinkUrl)(url);
|
|
@@ -50,12 +47,14 @@ const MarkdownText = ({
|
|
|
50
47
|
}
|
|
51
48
|
return validated;
|
|
52
49
|
};
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
const Wrapper = inline ? 'span' : 'div';
|
|
51
|
+
const wrapperClassName = inline ? className || undefined : (0, _utils.cn)('prose prose-slate max-w-none', className);
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(Wrapper, {
|
|
53
|
+
className: wrapperClassName,
|
|
55
54
|
__self: void 0,
|
|
56
55
|
__source: {
|
|
57
56
|
fileName: _jsxFileName,
|
|
58
|
-
lineNumber:
|
|
57
|
+
lineNumber: 80,
|
|
59
58
|
columnNumber: 5
|
|
60
59
|
}
|
|
61
60
|
}, /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, {
|
|
@@ -64,13 +63,13 @@ const MarkdownText = ({
|
|
|
64
63
|
components: {
|
|
65
64
|
p: ({
|
|
66
65
|
children
|
|
67
|
-
}) => /*#__PURE__*/_react.default.createElement("p", {
|
|
66
|
+
}) => inline ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children) : /*#__PURE__*/_react.default.createElement("p", {
|
|
68
67
|
className: "mb-4 leading-relaxed",
|
|
69
68
|
__self: void 0,
|
|
70
69
|
__source: {
|
|
71
70
|
fileName: _jsxFileName,
|
|
72
|
-
lineNumber:
|
|
73
|
-
columnNumber:
|
|
71
|
+
lineNumber: 89,
|
|
72
|
+
columnNumber: 15
|
|
74
73
|
}
|
|
75
74
|
}, children),
|
|
76
75
|
code: ({
|
|
@@ -84,7 +83,7 @@ const MarkdownText = ({
|
|
|
84
83
|
__self: void 0,
|
|
85
84
|
__source: {
|
|
86
85
|
fileName: _jsxFileName,
|
|
87
|
-
lineNumber:
|
|
86
|
+
lineNumber: 95,
|
|
88
87
|
columnNumber: 17
|
|
89
88
|
}
|
|
90
89
|
}, children);
|
|
@@ -94,7 +93,7 @@ const MarkdownText = ({
|
|
|
94
93
|
__self: void 0,
|
|
95
94
|
__source: {
|
|
96
95
|
fileName: _jsxFileName,
|
|
97
|
-
lineNumber:
|
|
96
|
+
lineNumber: 106,
|
|
98
97
|
columnNumber: 15
|
|
99
98
|
}
|
|
100
99
|
}, children);
|
|
@@ -107,7 +106,7 @@ const MarkdownText = ({
|
|
|
107
106
|
__self: void 0,
|
|
108
107
|
__source: {
|
|
109
108
|
fileName: _jsxFileName,
|
|
110
|
-
lineNumber:
|
|
109
|
+
lineNumber: 113,
|
|
111
110
|
columnNumber: 15
|
|
112
111
|
}
|
|
113
112
|
}, children);
|
|
@@ -119,7 +118,7 @@ const MarkdownText = ({
|
|
|
119
118
|
__self: void 0,
|
|
120
119
|
__source: {
|
|
121
120
|
fileName: _jsxFileName,
|
|
122
|
-
lineNumber:
|
|
121
|
+
lineNumber: 118,
|
|
123
122
|
columnNumber: 33
|
|
124
123
|
}
|
|
125
124
|
}, children),
|
|
@@ -130,7 +129,7 @@ const MarkdownText = ({
|
|
|
130
129
|
__self: void 0,
|
|
131
130
|
__source: {
|
|
132
131
|
fileName: _jsxFileName,
|
|
133
|
-
lineNumber:
|
|
132
|
+
lineNumber: 120,
|
|
134
133
|
columnNumber: 13
|
|
135
134
|
}
|
|
136
135
|
}, children),
|
|
@@ -141,7 +140,7 @@ const MarkdownText = ({
|
|
|
141
140
|
__self: void 0,
|
|
142
141
|
__source: {
|
|
143
142
|
fileName: _jsxFileName,
|
|
144
|
-
lineNumber:
|
|
143
|
+
lineNumber: 123,
|
|
145
144
|
columnNumber: 13
|
|
146
145
|
}
|
|
147
146
|
}, children),
|
|
@@ -152,7 +151,7 @@ const MarkdownText = ({
|
|
|
152
151
|
__self: void 0,
|
|
153
152
|
__source: {
|
|
154
153
|
fileName: _jsxFileName,
|
|
155
|
-
lineNumber:
|
|
154
|
+
lineNumber: 128,
|
|
156
155
|
columnNumber: 13
|
|
157
156
|
}
|
|
158
157
|
}, children),
|
|
@@ -163,7 +162,7 @@ const MarkdownText = ({
|
|
|
163
162
|
__self: void 0,
|
|
164
163
|
__source: {
|
|
165
164
|
fileName: _jsxFileName,
|
|
166
|
-
lineNumber:
|
|
165
|
+
lineNumber: 133,
|
|
167
166
|
columnNumber: 13
|
|
168
167
|
}
|
|
169
168
|
}, children),
|
|
@@ -174,7 +173,7 @@ const MarkdownText = ({
|
|
|
174
173
|
__self: void 0,
|
|
175
174
|
__source: {
|
|
176
175
|
fileName: _jsxFileName,
|
|
177
|
-
lineNumber:
|
|
176
|
+
lineNumber: 138,
|
|
178
177
|
columnNumber: 13
|
|
179
178
|
}
|
|
180
179
|
}, children),
|
|
@@ -185,7 +184,7 @@ const MarkdownText = ({
|
|
|
185
184
|
__self: void 0,
|
|
186
185
|
__source: {
|
|
187
186
|
fileName: _jsxFileName,
|
|
188
|
-
lineNumber:
|
|
187
|
+
lineNumber: 143,
|
|
189
188
|
columnNumber: 13
|
|
190
189
|
}
|
|
191
190
|
}, children),
|
|
@@ -196,7 +195,7 @@ const MarkdownText = ({
|
|
|
196
195
|
__self: void 0,
|
|
197
196
|
__source: {
|
|
198
197
|
fileName: _jsxFileName,
|
|
199
|
-
lineNumber:
|
|
198
|
+
lineNumber: 148,
|
|
200
199
|
columnNumber: 13
|
|
201
200
|
}
|
|
202
201
|
}, children),
|
|
@@ -207,7 +206,7 @@ const MarkdownText = ({
|
|
|
207
206
|
__self: void 0,
|
|
208
207
|
__source: {
|
|
209
208
|
fileName: _jsxFileName,
|
|
210
|
-
lineNumber:
|
|
209
|
+
lineNumber: 153,
|
|
211
210
|
columnNumber: 13
|
|
212
211
|
}
|
|
213
212
|
}, children),
|
|
@@ -218,14 +217,14 @@ const MarkdownText = ({
|
|
|
218
217
|
__self: void 0,
|
|
219
218
|
__source: {
|
|
220
219
|
fileName: _jsxFileName,
|
|
221
|
-
lineNumber:
|
|
220
|
+
lineNumber: 158,
|
|
222
221
|
columnNumber: 13
|
|
223
222
|
}
|
|
224
223
|
}, /*#__PURE__*/_react.default.createElement(_table.Table, {
|
|
225
224
|
__self: void 0,
|
|
226
225
|
__source: {
|
|
227
226
|
fileName: _jsxFileName,
|
|
228
|
-
lineNumber:
|
|
227
|
+
lineNumber: 159,
|
|
229
228
|
columnNumber: 15
|
|
230
229
|
}
|
|
231
230
|
}, children)),
|
|
@@ -235,7 +234,7 @@ const MarkdownText = ({
|
|
|
235
234
|
__self: void 0,
|
|
236
235
|
__source: {
|
|
237
236
|
fileName: _jsxFileName,
|
|
238
|
-
lineNumber:
|
|
237
|
+
lineNumber: 162,
|
|
239
238
|
columnNumber: 36
|
|
240
239
|
}
|
|
241
240
|
}, children),
|
|
@@ -245,7 +244,7 @@ const MarkdownText = ({
|
|
|
245
244
|
__self: void 0,
|
|
246
245
|
__source: {
|
|
247
246
|
fileName: _jsxFileName,
|
|
248
|
-
lineNumber:
|
|
247
|
+
lineNumber: 163,
|
|
249
248
|
columnNumber: 36
|
|
250
249
|
}
|
|
251
250
|
}, children),
|
|
@@ -255,7 +254,7 @@ const MarkdownText = ({
|
|
|
255
254
|
__self: void 0,
|
|
256
255
|
__source: {
|
|
257
256
|
fileName: _jsxFileName,
|
|
258
|
-
lineNumber:
|
|
257
|
+
lineNumber: 164,
|
|
259
258
|
columnNumber: 33
|
|
260
259
|
}
|
|
261
260
|
}, children),
|
|
@@ -265,7 +264,7 @@ const MarkdownText = ({
|
|
|
265
264
|
__self: void 0,
|
|
266
265
|
__source: {
|
|
267
266
|
fileName: _jsxFileName,
|
|
268
|
-
lineNumber:
|
|
267
|
+
lineNumber: 165,
|
|
269
268
|
columnNumber: 33
|
|
270
269
|
}
|
|
271
270
|
}, children),
|
|
@@ -275,7 +274,7 @@ const MarkdownText = ({
|
|
|
275
274
|
__self: void 0,
|
|
276
275
|
__source: {
|
|
277
276
|
fileName: _jsxFileName,
|
|
278
|
-
lineNumber:
|
|
277
|
+
lineNumber: 166,
|
|
279
278
|
columnNumber: 33
|
|
280
279
|
}
|
|
281
280
|
}, children),
|
|
@@ -286,7 +285,7 @@ const MarkdownText = ({
|
|
|
286
285
|
__self: void 0,
|
|
287
286
|
__source: {
|
|
288
287
|
fileName: _jsxFileName,
|
|
289
|
-
lineNumber:
|
|
288
|
+
lineNumber: 168,
|
|
290
289
|
columnNumber: 13
|
|
291
290
|
}
|
|
292
291
|
}, children),
|
|
@@ -297,7 +296,7 @@ const MarkdownText = ({
|
|
|
297
296
|
__self: void 0,
|
|
298
297
|
__source: {
|
|
299
298
|
fileName: _jsxFileName,
|
|
300
|
-
lineNumber:
|
|
299
|
+
lineNumber: 173,
|
|
301
300
|
columnNumber: 13
|
|
302
301
|
}
|
|
303
302
|
}, children),
|
|
@@ -308,7 +307,7 @@ const MarkdownText = ({
|
|
|
308
307
|
__self: void 0,
|
|
309
308
|
__source: {
|
|
310
309
|
fileName: _jsxFileName,
|
|
311
|
-
lineNumber:
|
|
310
|
+
lineNumber: 177,
|
|
312
311
|
columnNumber: 33
|
|
313
312
|
}
|
|
314
313
|
}, children),
|
|
@@ -326,7 +325,7 @@ const MarkdownText = ({
|
|
|
326
325
|
__self: void 0,
|
|
327
326
|
__source: {
|
|
328
327
|
fileName: _jsxFileName,
|
|
329
|
-
lineNumber:
|
|
328
|
+
lineNumber: 193,
|
|
330
329
|
columnNumber: 19
|
|
331
330
|
}
|
|
332
331
|
}, children);
|
|
@@ -338,7 +337,7 @@ const MarkdownText = ({
|
|
|
338
337
|
__self: void 0,
|
|
339
338
|
__source: {
|
|
340
339
|
fileName: _jsxFileName,
|
|
341
|
-
lineNumber:
|
|
340
|
+
lineNumber: 199,
|
|
342
341
|
columnNumber: 15
|
|
343
342
|
}
|
|
344
343
|
}, children);
|
|
@@ -348,7 +347,7 @@ const MarkdownText = ({
|
|
|
348
347
|
__self: void 0,
|
|
349
348
|
__source: {
|
|
350
349
|
fileName: _jsxFileName,
|
|
351
|
-
lineNumber:
|
|
350
|
+
lineNumber: 204,
|
|
352
351
|
columnNumber: 21
|
|
353
352
|
}
|
|
354
353
|
}),
|
|
@@ -370,7 +369,7 @@ const MarkdownText = ({
|
|
|
370
369
|
__self: void 0,
|
|
371
370
|
__source: {
|
|
372
371
|
fileName: _jsxFileName,
|
|
373
|
-
lineNumber:
|
|
372
|
+
lineNumber: 215,
|
|
374
373
|
columnNumber: 17
|
|
375
374
|
}
|
|
376
375
|
});
|
|
@@ -389,7 +388,7 @@ const MarkdownText = ({
|
|
|
389
388
|
__self: void 0,
|
|
390
389
|
__source: {
|
|
391
390
|
fileName: _jsxFileName,
|
|
392
|
-
lineNumber:
|
|
391
|
+
lineNumber: 236,
|
|
393
392
|
columnNumber: 15
|
|
394
393
|
}
|
|
395
394
|
}, /*#__PURE__*/_react.default.createElement(_OptimizedImage.OptimizedImage, {
|
|
@@ -401,7 +400,7 @@ const MarkdownText = ({
|
|
|
401
400
|
__self: void 0,
|
|
402
401
|
__source: {
|
|
403
402
|
fileName: _jsxFileName,
|
|
404
|
-
lineNumber:
|
|
403
|
+
lineNumber: 237,
|
|
405
404
|
columnNumber: 17
|
|
406
405
|
}
|
|
407
406
|
}));
|
|
@@ -410,7 +409,7 @@ const MarkdownText = ({
|
|
|
410
409
|
__self: void 0,
|
|
411
410
|
__source: {
|
|
412
411
|
fileName: _jsxFileName,
|
|
413
|
-
lineNumber:
|
|
412
|
+
lineNumber: 81,
|
|
414
413
|
columnNumber: 7
|
|
415
414
|
}
|
|
416
415
|
}, processedMarkdown));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactMarkdown","_remarkGfm","_entityLinkParser","_linkTypes","_utils","_useWeb5Link","_ComponentDependenciesContext","_diagnosticTypes","_table","_UnifiedLink","_OptimizedImage","_SmartIcon","_jsxFileName","decodeWeb5Path","path","decodeURIComponent","MarkdownText","children","markdownChildren","className","codeClassName","isActionRegistered","useWeb5Link","reportDiagnostic","useComponentDependencies","fixMalformedLinks","markdown","replace","processedMarkdown","urlTransform","url","validated","validateLinkUrl","DIAGNOSTIC_TYPES","BROKEN_WEB5_LINK","default","createElement","cn","__self","__source","fileName","lineNumber","columnNumber","remarkPlugins","remarkGfm","components","p","code","inlineClassName","isBlock","includes","pre","em","strong","h1","h2","h3","h4","h5","h6","blockquote","table","Table","thead","TableHeader","tbody","TableBody","tr","TableRow","th","TableHead","td","TableCell","ul","ol","li","a","href","parsed","parseWeb5Url","type","Web5UrlType","ACTION","actionName","UNKNOWN_WEB5_ACTION","UnifiedLink","variant","hr","img","src","alt","ICON","SmartIcon","iconHint","label","undefined","IMAGE","IMAGE_RESOLUTION_FAILED","Fragment","OptimizedImage","filename","objectFit","layout","exports"],"sources":["../../../../src/components/ui/MarkdownText.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport { parseWeb5Url, validateLinkUrl } from '../../utils/entityLinkParser';\nimport { Web5UrlType } from '../../types/link-types';\nimport { cn } from '../../lib/utils';\nimport { useWeb5Link } from '../../hooks/useWeb5Link';\nimport { useComponentDependencies } from '../../context/ComponentDependenciesContext';\nimport { DIAGNOSTIC_TYPES } from '../../component/diagnosticTypes';\nimport {\n Table,\n TableHeader,\n TableBody,\n TableRow,\n TableHead,\n TableCell,\n} from './table';\nimport { UnifiedLink } from './UnifiedLink';\nimport { OptimizedImage } from './OptimizedImage';\nimport { SmartIcon } from './SmartIcon';\n\n/** Decode a web5:// url path, tolerating malformed escape sequences. */\nfunction decodeWeb5Path(path: string): string {\n try {\n return decodeURIComponent(path);\n } catch {\n return path;\n }\n}\n\ninterface MarkdownTextProps {\n children: string;\n className?: string;\n codeClassName?: string;\n}\n\nexport const MarkdownText: FC<MarkdownTextProps> = ({\n children: markdownChildren,\n className = '',\n codeClassName = 'bg-muted px-1 py-0.5 rounded text-xs font-mono',\n}) => {\n const { isActionRegistered } = useWeb5Link();\n const { reportDiagnostic } = useComponentDependencies();\n\n // Fix malformed markdown links with space between ] and ( e.g. [text] (url) → [text](url)\n const fixMalformedLinks = (markdown: string): string => {\n return markdown.replace(/\\]\\s+\\(/g, '](');\n };\n\n const processedMarkdown = fixMalformedLinks(markdownChildren);\n // Custom URL transform: only render valid URLs (react-markdown v9+ strips non-http by default)\n const urlTransform = (url: string) => {\n const validated = validateLinkUrl(url);\n if (!validated) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.BROKEN_WEB5_LINK,\n 'markdownText',\n `URL stripped: \"${url}\"`,\n );\n }\n return validated;\n };\n\n return (\n <div className={cn('prose prose-slate max-w-none', className)}>\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n urlTransform={urlTransform}\n components={{\n p: ({ children }) => (\n <p className=\"mb-4 leading-relaxed\">{children}</p>\n ),\n code: ({ children, className: inlineClassName }) => {\n const isBlock = inlineClassName?.includes('language-');\n if (isBlock) {\n return (\n <code\n className={cn(\n 'block bg-muted p-4 rounded-md text-sm font-mono overflow-x-auto',\n inlineClassName,\n )}\n >\n {children}\n </code>\n );\n }\n return (\n <code className={cn(codeClassName, inlineClassName)}>\n {children}\n </code>\n );\n },\n pre: ({ children }) => {\n return (\n <pre className=\"mb-4 overflow-x-auto [&>code]:block [&>code]:my-0\">\n {children}\n </pre>\n );\n },\n em: ({ children }) => <em className=\"italic\">{children}</em>,\n strong: ({ children }) => (\n <strong className=\"font-bold\">{children}</strong>\n ),\n h1: ({ children }) => (\n <h1 className=\"text-4xl font-bold text-foreground mb-4 mt-6\">\n {children}\n </h1>\n ),\n h2: ({ children }) => (\n <h2 className=\"text-3xl font-bold text-foreground mb-3 mt-6\">\n {children}\n </h2>\n ),\n h3: ({ children }) => (\n <h3 className=\"text-2xl font-semibold text-foreground mb-3 mt-5\">\n {children}\n </h3>\n ),\n h4: ({ children }) => (\n <h4 className=\"text-xl font-semibold text-foreground mb-2 mt-4\">\n {children}\n </h4>\n ),\n h5: ({ children }) => (\n <h5 className=\"text-lg font-semibold text-foreground mb-2 mt-4\">\n {children}\n </h5>\n ),\n h6: ({ children }) => (\n <h6 className=\"text-base font-semibold text-foreground mb-2 mt-3\">\n {children}\n </h6>\n ),\n blockquote: ({ children }) => (\n <blockquote className=\"border-l-4 border-border pl-4 italic text-muted-foreground my-4\">\n {children}\n </blockquote>\n ),\n table: ({ children }) => (\n <div className=\"my-6\">\n <Table>{children}</Table>\n </div>\n ),\n thead: ({ children }) => <TableHeader>{children}</TableHeader>,\n tbody: ({ children }) => <TableBody>{children}</TableBody>,\n tr: ({ children }) => <TableRow>{children}</TableRow>,\n th: ({ children }) => <TableHead>{children}</TableHead>,\n td: ({ children }) => <TableCell>{children}</TableCell>,\n ul: ({ children }) => (\n <ul className=\"list-disc list-outside mb-4 space-y-2 text-foreground pl-6\">\n {children}\n </ul>\n ),\n ol: ({ children }) => (\n <ol className=\"list-decimal list-outside mb-4 space-y-2 text-foreground pl-6\">\n {children}\n </ol>\n ),\n li: ({ children }) => <li className=\"text-foreground\">{children}</li>,\n a: ({ children, href: url }) => {\n // Validate web5://action/ links — render as plain text if unregistered\n if (url) {\n const parsed = parseWeb5Url(url);\n if (\n parsed &&\n parsed.type === Web5UrlType.ACTION &&\n !isActionRegistered(parsed.actionName)\n ) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.UNKNOWN_WEB5_ACTION,\n 'markdownText',\n `Unregistered action: \"${parsed.actionName}\"`,\n );\n return (\n <span className=\"text-muted-foreground\">{children}</span>\n );\n }\n }\n\n return (\n <UnifiedLink href={url} variant=\"inline\">\n {children}\n </UnifiedLink>\n );\n },\n hr: () => <hr className=\"my-6 border-border\" />,\n img: ({ src, alt }) => {\n const parsed = src ? parseWeb5Url(src) : null;\n\n // `web5://icon/…` references a named icon, not a bitmap (KPI /\n // metrics blocks emit these). Render it via SmartIcon, which\n // resolves through the `resolveIcons` dependency and degrades to an\n // empty inline placeholder when no resolver is present — never a\n // broken-image box.\n if (parsed?.type === Web5UrlType.ICON) {\n return (\n <SmartIcon\n iconHint={decodeWeb5Path(parsed.path)}\n label={alt || undefined}\n />\n );\n }\n\n // Only `web5://image/` resolves to a real asset. Any other web5://\n // scheme used as an image source would fall through to a raw\n // <img src=\"web5://…\"> the browser can't load, rendering a \"Failed\n // to load image\" box — skip it (keep the alt text if present).\n if (parsed && parsed.type !== Web5UrlType.IMAGE) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.IMAGE_RESOLUTION_FAILED,\n 'markdownText',\n `Unsupported web5:// image source: \"${src}\"`,\n );\n return alt ? <>{alt}</> : null;\n }\n\n return (\n <span className=\"block my-4\">\n <OptimizedImage\n filename={src ?? ''}\n alt={alt ?? ''}\n className=\"w-full rounded-md\"\n objectFit=\"cover\"\n layout=\"intrinsic\"\n />\n </span>\n );\n },\n }}\n >\n {processedMarkdown}\n </ReactMarkdown>\n </div>\n );\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,6BAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AAQA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,eAAA,GAAAX,OAAA;AACA,IAAAY,UAAA,GAAAZ,OAAA;AAAwC,IAAAa,YAAA;AAExC;AACA,SAASC,cAAcA,CAACC,IAAY,EAAU;EAC5C,IAAI;IACF,OAAOC,kBAAkB,CAACD,IAAI,CAAC;EACjC,CAAC,CAAC,MAAM;IACN,OAAOA,IAAI;EACb;AACF;AAQO,MAAME,YAAmC,GAAGA,CAAC;EAClDC,QAAQ,EAAEC,gBAAgB;EAC1BC,SAAS,GAAG,EAAE;EACdC,aAAa,GAAG;AAClB,CAAC,KAAK;EACJ,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAC,wBAAW,EAAC,CAAC;EAC5C,MAAM;IAAEC;EAAiB,CAAC,GAAG,IAAAC,sDAAwB,EAAC,CAAC;;EAEvD;EACA,MAAMC,iBAAiB,GAAIC,QAAgB,IAAa;IACtD,OAAOA,QAAQ,CAAC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UAC7BkF,SAAS,EAAC,OAAO;UACjBC,MAAM,EAAC,WAAW;UAAAhE,MAAA;UAAAC,QAAA;YAAAC,QAAA,EAAA5B,YAAA;YAAA6B,UAAA;YAAAC,YAAA;UAAA;QAAA,CACnB,CACG,CAAC;MAEX;IACF,CAAE;IAAAJ,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAA5B,YAAA;MAAA6B,UAAA;MAAAC,YAAA;IAAA;EAAA,GAEDd,iBACY,CACZ,CAAC;AAEV,CAAC;AAAC2E,OAAA,CAAAvF,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactMarkdown","_remarkGfm","_entityLinkParser","_markdownPreprocessor","_linkTypes","_utils","_useWeb5Link","_ComponentDependenciesContext","_diagnosticTypes","_table","_UnifiedLink","_OptimizedImage","_SmartIcon","_jsxFileName","decodeWeb5Path","path","decodeURIComponent","MarkdownText","children","markdownChildren","className","codeClassName","inline","isActionRegistered","useWeb5Link","reportDiagnostic","useComponentDependencies","processedMarkdown","fixMalformedLinks","urlTransform","url","validated","validateLinkUrl","DIAGNOSTIC_TYPES","BROKEN_WEB5_LINK","Wrapper","wrapperClassName","undefined","cn","default","createElement","__self","__source","fileName","lineNumber","columnNumber","remarkPlugins","remarkGfm","components","p","Fragment","code","inlineClassName","isBlock","includes","pre","em","strong","h1","h2","h3","h4","h5","h6","blockquote","table","Table","thead","TableHeader","tbody","TableBody","tr","TableRow","th","TableHead","td","TableCell","ul","ol","li","a","href","parsed","parseWeb5Url","type","Web5UrlType","ACTION","actionName","UNKNOWN_WEB5_ACTION","UnifiedLink","variant","hr","img","src","alt","ICON","SmartIcon","iconHint","label","IMAGE","IMAGE_RESOLUTION_FAILED","OptimizedImage","filename","objectFit","layout","exports"],"sources":["../../../../src/components/ui/MarkdownText.tsx"],"sourcesContent":["import React, { FC } from 'react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport { parseWeb5Url, validateLinkUrl } from '../../utils/entityLinkParser';\nimport { fixMalformedLinks } from '../../utils/markdownPreprocessor';\nimport { Web5UrlType } from '../../types/link-types';\nimport { cn } from '../../lib/utils';\nimport { useWeb5Link } from '../../hooks/useWeb5Link';\nimport { useComponentDependencies } from '../../context/ComponentDependenciesContext';\nimport { DIAGNOSTIC_TYPES } from '../../component/diagnosticTypes';\nimport {\n Table,\n TableHeader,\n TableBody,\n TableRow,\n TableHead,\n TableCell,\n} from './table';\nimport { UnifiedLink } from './UnifiedLink';\nimport { OptimizedImage } from './OptimizedImage';\nimport { SmartIcon } from './SmartIcon';\n\n/** Decode a web5:// url path, tolerating malformed escape sequences. */\nfunction decodeWeb5Path(path: string): string {\n try {\n return decodeURIComponent(path);\n } catch {\n return path;\n }\n}\n\ninterface MarkdownTextProps {\n children: string;\n className?: string;\n codeClassName?: string;\n /**\n * Render a single line of *inline* markdown — links, bold, italic, code —\n * with no `prose` wrapper and no paragraph margins.\n *\n * The default (block) mode wraps output in `prose prose-slate`, which sets\n * its own font size and body color. That is right for a standalone passage\n * and wrong inside text the caller has already styled: a list item body or a\n * label would silently lose its variant's size, weight and theme color to\n * prose's slate palette. Use `inline` there so the surrounding element keeps\n * control of typography, and keep the content to one line — block markdown\n * (lists, tables, headings) has no place inside a span.\n */\n inline?: boolean;\n}\n\nexport const MarkdownText: FC<MarkdownTextProps> = ({\n children: markdownChildren,\n className = '',\n codeClassName = 'bg-muted px-1 py-0.5 rounded text-xs font-mono',\n inline = false,\n}) => {\n const { isActionRegistered } = useWeb5Link();\n const { reportDiagnostic } = useComponentDependencies();\n\n const processedMarkdown = fixMalformedLinks(markdownChildren);\n // Custom URL transform: only render valid URLs (react-markdown v9+ strips non-http by default)\n const urlTransform = (url: string) => {\n const validated = validateLinkUrl(url);\n if (!validated) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.BROKEN_WEB5_LINK,\n 'markdownText',\n `URL stripped: \"${url}\"`,\n );\n }\n return validated;\n };\n\n const Wrapper = inline ? 'span' : 'div';\n const wrapperClassName = inline\n ? className || undefined\n : cn('prose prose-slate max-w-none', className);\n\n return (\n <Wrapper className={wrapperClassName}>\n <ReactMarkdown\n remarkPlugins={[remarkGfm]}\n urlTransform={urlTransform}\n components={{\n p: ({ children }) =>\n inline ? (\n <>{children}</>\n ) : (\n <p className=\"mb-4 leading-relaxed\">{children}</p>\n ),\n code: ({ children, className: inlineClassName }) => {\n const isBlock = inlineClassName?.includes('language-');\n if (isBlock) {\n return (\n <code\n className={cn(\n 'block bg-muted p-4 rounded-md text-sm font-mono overflow-x-auto',\n inlineClassName,\n )}\n >\n {children}\n </code>\n );\n }\n return (\n <code className={cn(codeClassName, inlineClassName)}>\n {children}\n </code>\n );\n },\n pre: ({ children }) => {\n return (\n <pre className=\"mb-4 overflow-x-auto [&>code]:block [&>code]:my-0\">\n {children}\n </pre>\n );\n },\n em: ({ children }) => <em className=\"italic\">{children}</em>,\n strong: ({ children }) => (\n <strong className=\"font-bold\">{children}</strong>\n ),\n h1: ({ children }) => (\n <h1 className=\"text-4xl font-bold text-foreground mb-4 mt-6\">\n {children}\n </h1>\n ),\n h2: ({ children }) => (\n <h2 className=\"text-3xl font-bold text-foreground mb-3 mt-6\">\n {children}\n </h2>\n ),\n h3: ({ children }) => (\n <h3 className=\"text-2xl font-semibold text-foreground mb-3 mt-5\">\n {children}\n </h3>\n ),\n h4: ({ children }) => (\n <h4 className=\"text-xl font-semibold text-foreground mb-2 mt-4\">\n {children}\n </h4>\n ),\n h5: ({ children }) => (\n <h5 className=\"text-lg font-semibold text-foreground mb-2 mt-4\">\n {children}\n </h5>\n ),\n h6: ({ children }) => (\n <h6 className=\"text-base font-semibold text-foreground mb-2 mt-3\">\n {children}\n </h6>\n ),\n blockquote: ({ children }) => (\n <blockquote className=\"border-l-4 border-border pl-4 italic text-muted-foreground my-4\">\n {children}\n </blockquote>\n ),\n table: ({ children }) => (\n <div className=\"my-6\">\n <Table>{children}</Table>\n </div>\n ),\n thead: ({ children }) => <TableHeader>{children}</TableHeader>,\n tbody: ({ children }) => <TableBody>{children}</TableBody>,\n tr: ({ children }) => <TableRow>{children}</TableRow>,\n th: ({ children }) => <TableHead>{children}</TableHead>,\n td: ({ children }) => <TableCell>{children}</TableCell>,\n ul: ({ children }) => (\n <ul className=\"list-disc list-outside mb-4 space-y-2 text-foreground pl-6\">\n {children}\n </ul>\n ),\n ol: ({ children }) => (\n <ol className=\"list-decimal list-outside mb-4 space-y-2 text-foreground pl-6\">\n {children}\n </ol>\n ),\n li: ({ children }) => <li className=\"text-foreground\">{children}</li>,\n a: ({ children, href: url }) => {\n // Validate web5://action/ links — render as plain text if unregistered\n if (url) {\n const parsed = parseWeb5Url(url);\n if (\n parsed &&\n parsed.type === Web5UrlType.ACTION &&\n !isActionRegistered(parsed.actionName)\n ) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.UNKNOWN_WEB5_ACTION,\n 'markdownText',\n `Unregistered action: \"${parsed.actionName}\"`,\n );\n return (\n <span className=\"text-muted-foreground\">{children}</span>\n );\n }\n }\n\n return (\n <UnifiedLink href={url} variant=\"inline\">\n {children}\n </UnifiedLink>\n );\n },\n hr: () => <hr className=\"my-6 border-border\" />,\n img: ({ src, alt }) => {\n const parsed = src ? parseWeb5Url(src) : null;\n\n // `web5://icon/…` references a named icon, not a bitmap (KPI /\n // metrics blocks emit these). Render it via SmartIcon, which\n // resolves through the `resolveIcons` dependency and degrades to an\n // empty inline placeholder when no resolver is present — never a\n // broken-image box.\n if (parsed?.type === Web5UrlType.ICON) {\n return (\n <SmartIcon\n iconHint={decodeWeb5Path(parsed.path)}\n label={alt || undefined}\n />\n );\n }\n\n // Only `web5://image/` resolves to a real asset. Any other web5://\n // scheme used as an image source would fall through to a raw\n // <img src=\"web5://…\"> the browser can't load, rendering a \"Failed\n // to load image\" box — skip it (keep the alt text if present).\n if (parsed && parsed.type !== Web5UrlType.IMAGE) {\n reportDiagnostic?.(\n DIAGNOSTIC_TYPES.IMAGE_RESOLUTION_FAILED,\n 'markdownText',\n `Unsupported web5:// image source: \"${src}\"`,\n );\n return alt ? <>{alt}</> : null;\n }\n\n return (\n <span className=\"block my-4\">\n <OptimizedImage\n filename={src ?? ''}\n alt={alt ?? ''}\n className=\"w-full rounded-md\"\n objectFit=\"cover\"\n layout=\"intrinsic\"\n />\n </span>\n );\n },\n }}\n >\n {processedMarkdown}\n </ReactMarkdown>\n </Wrapper>\n );\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,qBAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,6BAAA,GAAAR,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAQA,IAAAW,YAAA,GAAAX,OAAA;AACA,IAAAY,eAAA,GAAAZ,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AAAwC,IAAAc,YAAA;AAExC;AACA,SAASC,cAAcA,CAACC,IAAY,EAAU;EAC5C,IAAI;IACF,OAAOC,kBAAkB,CAACD,IAAI,CAAC;EACjC,CAAC,CAAC,MAAM;IACN,OAAOA,IAAI;EACb;AACF;AAqBO,MAAME,YAAmC,GAAGA,CAAC;EAClDC,QAAQ,EAAEC,gBAAgB;EAC1BC,SAAS,GAAG,EAAE;EACdC,aAAa,GAAG,gDAAgD;EAChEC,MAAM,GAAG;AACX,CAAC,KAAK;EACJ,MAAM;IAAEC;EAAmB,CAAC,GAAG,IAAAC,wBAAW,EAAC,CAAC;EAC5C,MAAM;IAAEC;EAAiB,CAAC,GAAG,IAAAC,sDAAwB,EAAC,CA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