@wix/web5-core 1.57.2 → 1.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/client/clientBundleUrl.js +40 -0
  2. package/dist/cjs/client/clientBundleUrl.js.map +1 -0
  3. package/dist/cjs/client/mergeClientConfig.js +59 -0
  4. package/dist/cjs/client/mergeClientConfig.js.map +1 -0
  5. package/dist/cjs/component/componentDefinitions/EntityCollectionSectionDefinition.js +159 -0
  6. package/dist/cjs/component/componentDefinitions/EntityCollectionSectionDefinition.js.map +1 -0
  7. package/dist/cjs/component/componentDefinitions/index.js +7 -1
  8. package/dist/cjs/component/componentDefinitions/index.js.map +1 -1
  9. package/dist/cjs/component/componentParser.js +38 -1
  10. package/dist/cjs/component/componentParser.js.map +1 -1
  11. package/dist/cjs/components/ui/SearchSection.css +66 -9
  12. package/dist/cjs/components/ui/SearchSection.js +23 -19
  13. package/dist/cjs/components/ui/SearchSection.js.map +1 -1
  14. package/dist/cjs/index.js +15 -3
  15. package/dist/cjs/index.js.map +1 -1
  16. package/dist/cjs/styles/prompt-input-tokens.css +41 -34
  17. package/dist/cjs/utils/matchDebug.js +93 -0
  18. package/dist/cjs/utils/matchDebug.js.map +1 -0
  19. package/dist/esm/client/clientBundleUrl.js +36 -0
  20. package/dist/esm/client/clientBundleUrl.js.map +1 -0
  21. package/dist/esm/client/mergeClientConfig.js +55 -0
  22. package/dist/esm/client/mergeClientConfig.js.map +1 -0
  23. package/dist/esm/component/componentDefinitions/EntityCollectionSectionDefinition.js +154 -0
  24. package/dist/esm/component/componentDefinitions/EntityCollectionSectionDefinition.js.map +1 -0
  25. package/dist/esm/component/componentDefinitions/index.js +7 -1
  26. package/dist/esm/component/componentDefinitions/index.js.map +1 -1
  27. package/dist/esm/component/componentParser.js +38 -1
  28. package/dist/esm/component/componentParser.js.map +1 -1
  29. package/dist/esm/components/ui/SearchSection.css +66 -9
  30. package/dist/esm/components/ui/SearchSection.js +5 -1
  31. package/dist/esm/components/ui/SearchSection.js.map +1 -1
  32. package/dist/esm/index.js +8 -1
  33. package/dist/esm/index.js.map +1 -1
  34. package/dist/esm/styles/prompt-input-tokens.css +41 -34
  35. package/dist/esm/utils/matchDebug.js +85 -0
  36. package/dist/esm/utils/matchDebug.js.map +1 -0
  37. package/dist/types/client/clientBundleUrl.d.ts +17 -0
  38. package/dist/types/client/clientBundleUrl.d.ts.map +1 -0
  39. package/dist/types/client/mergeClientConfig.d.ts +28 -0
  40. package/dist/types/client/mergeClientConfig.d.ts.map +1 -0
  41. package/dist/types/component/componentDefinitions/EntityCollectionSectionDefinition.d.ts +51 -0
  42. package/dist/types/component/componentDefinitions/EntityCollectionSectionDefinition.d.ts.map +1 -0
  43. package/dist/types/component/componentDefinitions/index.d.ts +1 -0
  44. package/dist/types/component/componentDefinitions/index.d.ts.map +1 -1
  45. package/dist/types/component/componentParser.d.ts.map +1 -1
  46. package/dist/types/components/ui/SearchSection.d.ts.map +1 -1
  47. package/dist/types/index.d.ts +4 -1
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/dist/types/utils/matchDebug.d.ts +38 -0
  50. package/dist/types/utils/matchDebug.d.ts.map +1 -0
  51. package/package.json +2 -2
  52. package/src/components/ui/SearchSection.css +66 -9
  53. package/src/styles/prompt-input-tokens.css +41 -34
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_patternValidator","_astToParts","_linkTypes","_web5LinkValidator","_diagnosticTypes","_componentTracking","_diagnosticsCollector","_unifiedMarkdownParser","_markdownPreprocessor","_intentExtractor","_contentKeywordMatcher","_propsExtractor","isEntityCompProps","props","Array","isArray","items","isItemsFromContentSection","sectionType","semantic","serverSectionId","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","definition","isPlacementOnly","pattern","patterns","_parts$find","_context$intent","validatePattern","valid","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 {\n DiagnosticsCollector,\n} from '../utils/diagnosticsCollector';\nimport {\n parseAstToMarkdown,\n parseMarkdownToAst,\n} from '../utils/unifiedMarkdownParser';\nimport { preprocessMarkdown } from '../utils/markdownPreprocessor';\nimport { getIntentFromMarkdown, type IntentInfo } 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 {\n EntityCompProps,\n GeneralTextCompProps,\n} 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\nfunction isItemsFromContentSection(\n sectionType: string,\n semantic?: string,\n serverSectionId?: string,\n): boolean {\n if (sectionType !== 'entity') {\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 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 continue;\n }\n for (const pattern of definition.patterns) {\n const result = validatePattern(nodes, pattern);\n if (!result.valid) {\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 continue;\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 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 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,qBAAA,GAAAP,OAAA;AAGA,IAAAQ,sBAAA,GAAAR,OAAA;AAIA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,sBAAA,GAAAX,OAAA;AACA,IAAAY,eAAA,GAAAZ,OAAA;AAlCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkEA,SAASa,iBAAiBA,CAACC,KAAc,EAA4B;EACnE,OACE,OAAOA,KAAK,KAAK,QAAQ,IACzBA,KAAK,KAAK,IAAI,IACdC,KAAK,CAACC,OAAO,CAAEF,KAAK,CAAqBG,KAAK,CAAC;AAEnD;AAEA,SAASC,yBAAyBA,CAChCC,WAAmB,EACnBC,QAAiB,EACjBC,eAAwB,EAC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oreList":[]}
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;AACA;;AAiEA,SAASc,iBAAiBA,CAACC,KA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CAAC;IAC9C;EACF;EAEA,IAAIb,KAAK,EAAE;IACT,IAAAE,yBAAa,EAAC,oCAAoC,CAAC;EACrD;EAEA,OAAO,CAAC,CAAC;AACX","ignoreList":[]}
@@ -152,15 +152,20 @@
152
152
  flex-direction: column-reverse;
153
153
  }
154
154
 
155
+ /* Chips stack vertically above the pill, left-aligned to it, and share the
156
+ pill's width so the two edges line up as it expands on focus. */
155
157
  .web5-prompt-shell__chips {
156
158
  display: flex;
157
- flex-wrap: wrap;
158
- justify-content: center;
159
+ flex-direction: column;
160
+ flex-wrap: nowrap;
161
+ align-items: flex-start;
162
+ justify-content: flex-start;
159
163
  gap: var(--pi-chip-gap);
160
164
  margin: 0 auto;
161
165
  width: 100%;
162
- max-width: 835px;
166
+ max-width: var(--pi-content-max-w);
163
167
  overflow: hidden;
168
+ /* `max-width` omitted for the same reason as `.web5-prompt-search__inner`. */
164
169
  transition: transform var(--pi-transition-medium),
165
170
  opacity var(--pi-transition-medium), max-height var(--pi-transition-medium);
166
171
  pointer-events: auto;
@@ -169,10 +174,45 @@
169
174
  .web5-prompt-shell__chips--visible {
170
175
  transform: translateY(0);
171
176
  opacity: 1;
172
- max-height: 8rem;
177
+ max-height: 260px;
173
178
  overflow: visible;
174
179
  }
175
180
 
181
+ /* Each chip rises into place, the one nearest the pill first. */
182
+ @keyframes web5-prompt-chip-float-up {
183
+ from {
184
+ opacity: 0;
185
+ transform: translateY(12px);
186
+ }
187
+ to {
188
+ opacity: 1;
189
+ transform: translateY(0);
190
+ }
191
+ }
192
+
193
+ .web5-prompt-shell__chips--visible .web5-prompt-chip {
194
+ animation: web5-prompt-chip-float-up 400ms cubic-bezier(0.22, 0.61, 0.36, 1)
195
+ both;
196
+ }
197
+
198
+ .web5-prompt-shell__chips--visible .web5-prompt-chip:nth-child(1) {
199
+ animation-delay: 400ms;
200
+ }
201
+
202
+ .web5-prompt-shell__chips--visible .web5-prompt-chip:nth-child(2) {
203
+ animation-delay: 300ms;
204
+ }
205
+
206
+ .web5-prompt-shell__chips--visible .web5-prompt-chip:nth-child(n + 3) {
207
+ animation-delay: 200ms;
208
+ }
209
+
210
+ @media (prefers-reduced-motion: reduce) {
211
+ .web5-prompt-shell__chips--visible .web5-prompt-chip {
212
+ animation: none;
213
+ }
214
+ }
215
+
176
216
  .web5-prompt-shell__chips--hidden {
177
217
  transform: translateY(1rem);
178
218
  opacity: 0;
@@ -189,6 +229,7 @@
189
229
  border: 1px solid var(--pi-chip-border, transparent);
190
230
  border-radius: var(--pi-chip-radius);
191
231
  background: var(--pi-chip-bg);
232
+ backdrop-filter: blur(var(--pi-chip-blur));
192
233
  box-shadow: var(--pi-chip-shadow);
193
234
  color: var(--pi-chip-text);
194
235
  font-family: var(--pi-field-font-family);
@@ -209,7 +250,7 @@
209
250
  /* Inset ring so the focus indicator isn't clipped by the chips container's overflow: hidden */
210
251
  .web5-prompt-chip:focus-visible {
211
252
  outline: none;
212
- box-shadow: inset 0 0 0 2px rgba(128, 0, 177, 0.8), var(--pi-chip-shadow);
253
+ box-shadow: inset 0 0 0 2px var(--pi-chip-focus-ring), var(--pi-chip-shadow);
213
254
  }
214
255
 
215
256
  .web5-prompt-search {
@@ -220,12 +261,26 @@
220
261
 
221
262
  .web5-prompt-search__inner {
222
263
  position: relative;
223
- width: min(100%, var(--pi-content-max-w));
264
+ /* `width: 100%` + a plain-length `max-width`, not `width: min(100%, )`:
265
+ Chrome cannot interpolate between two min() values, which would freeze the
266
+ focus transition below at 0 progress. */
267
+ width: 100%;
268
+ max-width: var(--pi-content-max-w);
224
269
  min-width: min(100%, var(--pi-content-min-w));
225
270
  margin-inline: auto;
271
+ /* `max-width` is deliberately NOT transitioned: with a transition declared on
272
+ it, Chrome never runs the swap and the pill stays pinned at the idle width
273
+ (verified against the seed widget, which shares this rule shape). The widen
274
+ is therefore instant rather than the mock's 250ms ease. */
226
275
  pointer-events: auto;
227
276
  }
228
277
 
278
+ /* Focus widens the pill (and the chip column above it) from the idle width. */
279
+ .web5-prompt-shell--focused .web5-prompt-search__inner,
280
+ .web5-prompt-shell--focused .web5-prompt-shell__chips {
281
+ max-width: var(--pi-content-max-w-focused);
282
+ }
283
+
229
284
  .web5-prompt-field-wrap {
230
285
  position: relative;
231
286
  display: flex;
@@ -243,6 +298,7 @@
243
298
  border: var(--pi-field-border-width) solid var(--pi-field-border);
244
299
  border-radius: var(--pi-field-radius-pill);
245
300
  background: var(--pi-field-bg);
301
+ backdrop-filter: blur(var(--pi-field-blur));
246
302
  box-shadow: var(--pi-field-shadow);
247
303
  transition: min-height var(--pi-transition-medium),
248
304
  border-radius var(--pi-transition-medium),
@@ -264,7 +320,8 @@
264
320
  min-width: 0;
265
321
  min-height: var(--pi-field-line-height);
266
322
  max-height: calc(var(--pi-field-max-h) - var(--pi-field-line-height));
267
- padding: 0 56px 0 0;
323
+ /* Clear the absolutely-positioned submit button. */
324
+ padding: 0 calc(var(--pi-submit-size) + 8px) 0 0;
268
325
  border: 0;
269
326
  outline: none;
270
327
  background: transparent;
@@ -481,12 +538,12 @@
481
538
  font-size: max(16px, var(--pi-field-font-size));
482
539
  }
483
540
 
541
+ /* Keeps the chip fill: `--pi-chip-text` is light, so a transparent chip on
542
+ the white mobile panel would be unreadable. */
484
543
  .web5-prompt-chip {
485
544
  width: 100%;
486
545
  justify-content: flex-start;
487
546
  padding: 10px 18px;
488
- background: transparent;
489
- box-shadow: none;
490
547
  font-size: 16px;
491
548
  line-height: 20px;
492
549
  white-space: normal;
@@ -363,7 +363,11 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
363
363
  };
364
364
  const showHint = inputValue === '' && !isFocused && !isCollapsed;
365
365
  return /*#__PURE__*/_react.default.createElement("div", {
366
- className: (0, _utils.cn)('web5-prompt-shell', isCollapsed && 'web5-prompt-shell--collapsed', className),
366
+ className: (0, _utils.cn)('web5-prompt-shell', isCollapsed && 'web5-prompt-shell--collapsed',
367
+ // Widens the pill while the field or a chip holds focus. Driven by
368
+ // `hasFocusInside` rather than `isFocused` so clicking a chip (which
369
+ // preventDefaults its mousedown) doesn't collapse the width mid-click.
370
+ hasFocusInside && !isCollapsed && 'web5-prompt-shell--focused', className),
367
371
  __self: this,
368
372
  __source: {
369
373
  fileName: _jsxFileName,
@@ -375,7 +379,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
375
379
  __self: this,
376
380
  __source: {
377
381
  fileName: _jsxFileName,
378
- lineNumber: 376,
382
+ lineNumber: 380,
379
383
  columnNumber: 7
380
384
  }
381
385
  }, /*#__PURE__*/_react.default.createElement("button", {
@@ -388,7 +392,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
388
392
  __self: this,
389
393
  __source: {
390
394
  fileName: _jsxFileName,
391
- lineNumber: 377,
395
+ lineNumber: 381,
392
396
  columnNumber: 9
393
397
  }
394
398
  }, effectiveCollapsedLabel), /*#__PURE__*/_react.default.createElement("div", {
@@ -399,7 +403,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
399
403
  __self: this,
400
404
  __source: {
401
405
  fileName: _jsxFileName,
402
- lineNumber: 388,
406
+ lineNumber: 392,
403
407
  columnNumber: 9
404
408
  }
405
409
  }, contextBanner, /*#__PURE__*/_react.default.createElement("div", {
@@ -407,7 +411,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
407
411
  __self: this,
408
412
  __source: {
409
413
  fileName: _jsxFileName,
410
- lineNumber: 395,
414
+ lineNumber: 399,
411
415
  columnNumber: 11
412
416
  }
413
417
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -415,7 +419,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
415
419
  __self: this,
416
420
  __source: {
417
421
  fileName: _jsxFileName,
418
- lineNumber: 396,
422
+ lineNumber: 400,
419
423
  columnNumber: 13
420
424
  }
421
425
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -424,7 +428,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
424
428
  __self: this,
425
429
  __source: {
426
430
  fileName: _jsxFileName,
427
- lineNumber: 402,
431
+ lineNumber: 406,
428
432
  columnNumber: 15
429
433
  }
430
434
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -432,7 +436,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
432
436
  __self: this,
433
437
  __source: {
434
438
  fileName: _jsxFileName,
435
- lineNumber: 403,
439
+ lineNumber: 407,
436
440
  columnNumber: 17
437
441
  }
438
442
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -440,7 +444,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
440
444
  __self: this,
441
445
  __source: {
442
446
  fileName: _jsxFileName,
443
- lineNumber: 404,
447
+ lineNumber: 408,
444
448
  columnNumber: 19
445
449
  }
446
450
  }, /*#__PURE__*/_react.default.createElement("textarea", {
@@ -459,7 +463,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
459
463
  __self: this,
460
464
  __source: {
461
465
  fileName: _jsxFileName,
462
- lineNumber: 411,
466
+ lineNumber: 415,
463
467
  columnNumber: 21
464
468
  }
465
469
  }), /*#__PURE__*/_react.default.createElement("div", {
@@ -467,7 +471,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
467
471
  __self: this,
468
472
  __source: {
469
473
  fileName: _jsxFileName,
470
- lineNumber: 426,
474
+ lineNumber: 430,
471
475
  columnNumber: 21
472
476
  }
473
477
  }, showHint && /*#__PURE__*/_react.default.createElement("span", {
@@ -476,7 +480,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
476
480
  __self: this,
477
481
  __source: {
478
482
  fileName: _jsxFileName,
479
- lineNumber: 428,
483
+ lineNumber: 432,
480
484
  columnNumber: 25
481
485
  }
482
486
  }, "Press ", /*#__PURE__*/_react.default.createElement("kbd", {
@@ -484,7 +488,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
484
488
  __self: this,
485
489
  __source: {
486
490
  fileName: _jsxFileName,
487
- lineNumber: 429,
491
+ lineNumber: 433,
488
492
  columnNumber: 33
489
493
  }
490
494
  }, "/"), ' ', "to search"), onVoiceInput && /*#__PURE__*/_react.default.createElement("button", {
@@ -496,14 +500,14 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
496
500
  __self: this,
497
501
  __source: {
498
502
  fileName: _jsxFileName,
499
- lineNumber: 434,
503
+ lineNumber: 438,
500
504
  columnNumber: 25
501
505
  }
502
506
  }, /*#__PURE__*/_react.default.createElement(MicrophoneIcon, {
503
507
  __self: this,
504
508
  __source: {
505
509
  fileName: _jsxFileName,
506
- lineNumber: 441,
510
+ lineNumber: 445,
507
511
  columnNumber: 27
508
512
  }
509
513
  })), /*#__PURE__*/_react.default.createElement("button", {
@@ -516,7 +520,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
516
520
  __self: this,
517
521
  __source: {
518
522
  fileName: _jsxFileName,
519
- lineNumber: 444,
523
+ lineNumber: 448,
520
524
  columnNumber: 23
521
525
  }
522
526
  }, submitLabel ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
@@ -524,7 +528,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
524
528
  __self: this,
525
529
  __source: {
526
530
  fileName: _jsxFileName,
527
- lineNumber: 458,
531
+ lineNumber: 462,
528
532
  columnNumber: 29
529
533
  }
530
534
  }, submitLabel), /*#__PURE__*/_react.default.createElement(ArrowRightIcon, {
@@ -533,7 +537,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
533
537
  __self: this,
534
538
  __source: {
535
539
  fileName: _jsxFileName,
536
- lineNumber: 461,
540
+ lineNumber: 465,
537
541
  columnNumber: 29
538
542
  }
539
543
  })) : /*#__PURE__*/_react.default.createElement(PromptSendIcon, {
@@ -542,7 +546,7 @@ const SearchSection = exports.SearchSection = /*#__PURE__*/(0, _react.forwardRef
542
546
  __self: this,
543
547
  __source: {
544
548
  fileName: _jsxFileName,
545
- lineNumber: 467,
549
+ lineNumber: 471,
546
550
  columnNumber: 27
547
551
  }
548
552
  })))))), chipsMarkup)))));