@mui/internal-docs-infra 0.10.1-canary.3 → 0.10.1-canary.5
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/CodeHighlighter/CodeHighlighterClient.d.mts +1 -1
- package/CodeHighlighter/CodeHighlighterContext.d.mts +2 -2
- package/CodeHighlighter/CodeHighlighterFallbackContext.d.mts +1 -1
- package/CodeHighlighter/codeToFallbackProps.d.mts +1 -1
- package/abstractCreateDemo/abstractCreateDemo.d.mts +1 -1
- package/createDemoData/createDemoData.d.mts +2 -2
- package/package.json +2 -2
- package/pipeline/hastUtils/getHastTextContent.d.mts +9 -0
- package/pipeline/hastUtils/getHastTextContent.mjs +25 -0
- package/pipeline/hastUtils/index.d.mts +1 -0
- package/pipeline/hastUtils/index.mjs +1 -0
- package/pipeline/loadCodeVariant/diffHast.d.mts +1 -1
- package/pipeline/loadCodeVariant/hasAllCodeVariants.d.mts +1 -1
- package/pipeline/loadCodeVariant/maybeCodeInitialData.d.mts +1 -1
- package/pipeline/loadServerTypes/hastTypeUtils.d.mts +3 -9
- package/pipeline/loadServerTypes/hastTypeUtils.mjs +2 -27
- package/pipeline/loadServerTypesMeta/createOptimizedProgram.d.mts +1 -1
- package/pipeline/loadServerTypesMeta/formatClass.d.mts +1 -1
- package/pipeline/loadServerTypesMeta/formatComponent.d.mts +1 -1
- package/pipeline/loadServerTypesMeta/formatFunction.d.mts +1 -1
- package/pipeline/loadServerTypesMeta/formatHook.d.mts +1 -1
- package/pipeline/loadServerTypesMeta/formatRaw.d.mts +1 -1
- package/pipeline/loadServerTypesMeta/loadServerTypesMeta.d.mts +5 -5
- package/pipeline/loadServerTypesMeta/processTypes.d.mts +1 -1
- package/pipeline/parseSource/addLineGutters.mjs +13 -3
- package/pipeline/syncPageIndex/metadataToMarkdown.d.mts +1 -1
- package/pipeline/transformHtmlCodeInline/transformHtmlCodeInline.mjs +2 -12
- package/pipeline/transformMarkdownMetadata/types.d.mts +1 -1
- package/useCode/useCode.d.mts +1 -1
- package/useCode/useCopyFunctionality.d.mts +1 -1
- package/useCode/useTransformManagement.d.mts +1 -1
- package/useSearch/types.d.mts +2 -2
- package/useType/useType.d.mts +1 -1
- package/useType/useTypeProp.d.mts +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CodeHighlighterClientProps } from "./types.mjs";
|
|
1
|
+
import { type CodeHighlighterClientProps } from "./types.mjs";
|
|
2
2
|
export declare function CodeHighlighterClient(props: CodeHighlighterClientProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Code, ControlledCode } from "./types.mjs";
|
|
3
|
-
import { Selection } from "../CodeControllerContext/index.mjs";
|
|
2
|
+
import { type Code, type ControlledCode } from "./types.mjs";
|
|
3
|
+
import { type Selection } from "../CodeControllerContext/index.mjs";
|
|
4
4
|
export interface CodeHighlighterContextType {
|
|
5
5
|
code?: Code;
|
|
6
6
|
setCode?: React.Dispatch<React.SetStateAction<ControlledCode | undefined>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ContentLoadingVariant } from "./types.mjs";
|
|
2
|
+
import { type ContentLoadingVariant } from "./types.mjs";
|
|
3
3
|
export interface CodeHighlighterFallbackContext extends ContentLoadingVariant {
|
|
4
4
|
extraVariants?: Record<string, ContentLoadingVariant>;
|
|
5
5
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BaseContentLoadingProps, Code } from "./types.mjs";
|
|
1
|
+
import { type BaseContentLoadingProps, type Code } from "./types.mjs";
|
|
2
2
|
export declare function codeToFallbackProps(variant: string, code?: Code, fileName?: string, needsAllFiles?: boolean, needsAllVariants?: boolean): BaseContentLoadingProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Code, CodeHighlighterProps, ContentLoadingProps, ContentProps, LoadCodeMeta, LoadSource, LoadVariantMeta, ParseSource, SourceEnhancers } from "../CodeHighlighter/types.mjs";
|
|
3
|
-
import { DemoGlobalData } from "../createDemoData/types.mjs";
|
|
3
|
+
import { type DemoGlobalData } from "../createDemoData/types.mjs";
|
|
4
4
|
type CreateDemoMeta = {
|
|
5
5
|
name?: string;
|
|
6
6
|
slug?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CreateDemoDataMeta, DemoData, DemoGlobalData, DemoGlobalProvider } from "./types.mjs";
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { type CreateDemoDataMeta, type DemoData, type DemoGlobalData, type DemoGlobalProvider } from "./types.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Creates demo data for displaying code examples with syntax highlighting.
|
|
5
5
|
* A variant is a different implementation style of the same component.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-docs-infra",
|
|
3
|
-
"version": "0.10.1-canary.
|
|
3
|
+
"version": "0.10.1-canary.5",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "MUI Infra - internal documentation creation tools.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -643,5 +643,5 @@
|
|
|
643
643
|
"bin": {
|
|
644
644
|
"docs-infra": "./cli/index.mjs"
|
|
645
645
|
},
|
|
646
|
-
"gitSha": "
|
|
646
|
+
"gitSha": "b5ecb08ed447855ed858e123d924a08949b6ad6d"
|
|
647
647
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Root as HastRoot, Element, Text, RootContent } from 'hast';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts all text content from a HAST node recursively.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getHastTextContent(node: HastRoot | Element | Text | RootContent): string;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the direct text content of a HAST element (non-recursive, first level only).
|
|
8
|
+
*/
|
|
9
|
+
export declare function getShallowTextContent(element: Element): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts all text content from a HAST node recursively.
|
|
3
|
+
*/
|
|
4
|
+
export function getHastTextContent(node) {
|
|
5
|
+
if (node.type === 'text') {
|
|
6
|
+
return node.value || '';
|
|
7
|
+
}
|
|
8
|
+
if ('children' in node && Array.isArray(node.children)) {
|
|
9
|
+
return node.children.map(child => getHastTextContent(child)).join('');
|
|
10
|
+
}
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Gets the direct text content of a HAST element (non-recursive, first level only).
|
|
16
|
+
*/
|
|
17
|
+
export function getShallowTextContent(element) {
|
|
18
|
+
let text = '';
|
|
19
|
+
for (const child of element.children) {
|
|
20
|
+
if (child.type === 'text') {
|
|
21
|
+
text += child.value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return text;
|
|
25
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Nodes } from 'hast';
|
|
2
|
-
import { ParseSource, Transforms } from "../../CodeHighlighter/types.mjs";
|
|
2
|
+
import { type ParseSource, type Transforms } from "../../CodeHighlighter/types.mjs";
|
|
3
3
|
export declare function diffHast(source: string, parsedSource: Nodes, filename: string, transforms: Transforms, parseSource: ParseSource): Promise<Record<string, any>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Code, VariantExtraFiles, VariantSource } from "../../CodeHighlighter/types.mjs";
|
|
1
|
+
import { type Code, type VariantExtraFiles, type VariantSource } from "../../CodeHighlighter/types.mjs";
|
|
2
2
|
/**
|
|
3
3
|
* Type guard function that determines if we have sufficient data to render a code highlighter
|
|
4
4
|
* component immediately, or if we need to start loading data first.
|
|
@@ -4,20 +4,14 @@
|
|
|
4
4
|
* These utilities work on already-highlighted HAST nodes to detect type patterns
|
|
5
5
|
* (unions, functions, objects) and derive shortType/detailedType variants.
|
|
6
6
|
*/
|
|
7
|
-
import type { Root as HastRoot, Element
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
export declare function getHastTextContent(node: HastRoot | Element | Text | RootContent): string;
|
|
7
|
+
import type { Root as HastRoot, Element } from 'hast';
|
|
8
|
+
import { getHastTextContent, getShallowTextContent } from "../hastUtils/index.mjs";
|
|
9
|
+
export { getHastTextContent, getShallowTextContent };
|
|
12
10
|
/**
|
|
13
11
|
* Checks if a HAST element has a specific CSS class.
|
|
14
12
|
* Handles both string and array class representations.
|
|
15
13
|
*/
|
|
16
14
|
export declare function hasClass(element: Element, className: string): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Gets the direct text content of a HAST element (non-recursive, first level only).
|
|
19
|
-
*/
|
|
20
|
-
export declare function getShallowTextContent(element: Element): string;
|
|
21
15
|
/**
|
|
22
16
|
* Checks if a HAST element is a span with class `line`.
|
|
23
17
|
*/
|
|
@@ -5,20 +5,8 @@
|
|
|
5
5
|
* (unions, functions, objects) and derive shortType/detailedType variants.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { compressHast } from "../hastUtils/index.mjs";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Extracts all text content from a HAST node recursively.
|
|
12
|
-
*/
|
|
13
|
-
export function getHastTextContent(node) {
|
|
14
|
-
if (node.type === 'text') {
|
|
15
|
-
return node.value || '';
|
|
16
|
-
}
|
|
17
|
-
if ('children' in node && Array.isArray(node.children)) {
|
|
18
|
-
return node.children.map(child => getHastTextContent(child)).join('');
|
|
19
|
-
}
|
|
20
|
-
return '';
|
|
21
|
-
}
|
|
8
|
+
import { compressHast, getHastTextContent, getShallowTextContent } from "../hastUtils/index.mjs";
|
|
9
|
+
export { getHastTextContent, getShallowTextContent };
|
|
22
10
|
|
|
23
11
|
/**
|
|
24
12
|
* Checks if a HAST element has a specific CSS class.
|
|
@@ -35,19 +23,6 @@ export function hasClass(element, className) {
|
|
|
35
23
|
return false;
|
|
36
24
|
}
|
|
37
25
|
|
|
38
|
-
/**
|
|
39
|
-
* Gets the direct text content of a HAST element (non-recursive, first level only).
|
|
40
|
-
*/
|
|
41
|
-
export function getShallowTextContent(element) {
|
|
42
|
-
let text = '';
|
|
43
|
-
for (const child of element.children) {
|
|
44
|
-
if (child.type === 'text') {
|
|
45
|
-
text += child.value;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return text;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
26
|
/**
|
|
52
27
|
* Checks if a HAST element is a span with class `line`.
|
|
53
28
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as tae from 'typescript-api-extractor';
|
|
1
|
+
import type * as tae from 'typescript-api-extractor';
|
|
2
2
|
import { type FormattedParameter, type FormatInlineTypeOptions, type DescriptionReplacement } from "./format.mjs";
|
|
3
3
|
import { type TypeRewriteContext } from "./rewriteTypes.mjs";
|
|
4
4
|
import type { ExternalTypesCollector } from "./externalTypes.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as tae from 'typescript-api-extractor';
|
|
1
|
+
import type * as tae from 'typescript-api-extractor';
|
|
2
2
|
import { type FormattedProperty, type FormattedEnumMember, type FormatInlineTypeOptions, type DescriptionReplacement } from "./format.mjs";
|
|
3
3
|
import { type TypeRewriteContext } from "./rewriteTypes.mjs";
|
|
4
4
|
import type { ExternalTypesCollector } from "./externalTypes.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as tae from 'typescript-api-extractor';
|
|
1
|
+
import type * as tae from 'typescript-api-extractor';
|
|
2
2
|
import { type FormattedParameter, type FormattedProperty, type FormatInlineTypeOptions, type DescriptionReplacement } from "./format.mjs";
|
|
3
3
|
import { type TypeRewriteContext } from "./rewriteTypes.mjs";
|
|
4
4
|
import type { ExternalTypesCollector } from "./externalTypes.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as tae from 'typescript-api-extractor';
|
|
1
|
+
import type * as tae from 'typescript-api-extractor';
|
|
2
2
|
import { type FormattedProperty, type FormattedParameter, type FormatInlineTypeOptions, type DescriptionReplacement } from "./format.mjs";
|
|
3
3
|
import { type TypeRewriteContext } from "./rewriteTypes.mjs";
|
|
4
4
|
import type { ExternalTypesCollector } from "./externalTypes.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as tae from 'typescript-api-extractor';
|
|
1
|
+
import type * as tae from 'typescript-api-extractor';
|
|
2
2
|
import { type FormattedProperty, type FormatInlineTypeOptions, type DescriptionReplacement } from "./format.mjs";
|
|
3
3
|
import { type TypeRewriteContext } from "./rewriteTypes.mjs";
|
|
4
4
|
import type { ExternalTypesCollector } from "./externalTypes.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ClassTypeMeta as ClassType } from "./formatClass.mjs";
|
|
2
|
-
import { ComponentTypeMeta as ComponentType } from "./formatComponent.mjs";
|
|
3
|
-
import { HookTypeMeta as HookType } from "./formatHook.mjs";
|
|
4
|
-
import { FunctionTypeMeta as FunctionType } from "./formatFunction.mjs";
|
|
5
|
-
import { RawTypeMeta as RawType, type ReExportInfo } from "./formatRaw.mjs";
|
|
1
|
+
import { type ClassTypeMeta as ClassType } from "./formatClass.mjs";
|
|
2
|
+
import { type ComponentTypeMeta as ComponentType } from "./formatComponent.mjs";
|
|
3
|
+
import { type HookTypeMeta as HookType } from "./formatHook.mjs";
|
|
4
|
+
import { type FunctionTypeMeta as FunctionType } from "./formatFunction.mjs";
|
|
5
|
+
import { type RawTypeMeta as RawType, type ReExportInfo } from "./formatRaw.mjs";
|
|
6
6
|
import { type FormattedProperty, type FormattedEnumMember, type FormattedParameter, type FormatInlineTypeOptions, type DescriptionReplacement } from "./format.mjs";
|
|
7
7
|
import type { OrderingConfig } from "../loadServerTypesText/order.mjs";
|
|
8
8
|
import { type OrganizeTypesResult } from "../loadServerTypesText/organizeTypesByExport.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CompilerOptions } from 'typescript';
|
|
2
|
-
import { ExportNode } from 'typescript-api-extractor';
|
|
2
|
+
import { type ExportNode } from 'typescript-api-extractor';
|
|
3
3
|
import { type PerformanceLog } from "./performanceTracking.mjs";
|
|
4
4
|
export interface VariantResult {
|
|
5
5
|
exports: ExportNode[];
|
|
@@ -127,16 +127,26 @@ export function starryNightGutter(tree, sourceLines, frameSize = 120) {
|
|
|
127
127
|
replacement.push(createFrame(frameLines));
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
// If there are multiple frames and sourceLines provided, add dataAsString to each frame
|
|
130
|
+
// If there are multiple frames and sourceLines provided, add dataAsString to each frame.
|
|
131
|
+
// Every frame except the last covers `frameSize` source lines, each of which
|
|
132
|
+
// was followed by a newline separator in the original source, so its text
|
|
133
|
+
// ends with a trailing '\n'. The final frame only carries a trailing newline
|
|
134
|
+
// if the source itself ends with one. Without this trailing '\n', the
|
|
135
|
+
// plain-text fallback and the highlighted render disagree by exactly one
|
|
136
|
+
// newline per non-final frame, which causes a layout shift during lazy
|
|
137
|
+
// hydration when a frame toggles between the two.
|
|
131
138
|
if (replacement.length > 1 && sourceLines) {
|
|
132
|
-
|
|
139
|
+
const lastIndex = replacement.length - 1;
|
|
140
|
+
for (let frameIndex = 0; frameIndex < replacement.length; frameIndex += 1) {
|
|
141
|
+
const frame = replacement[frameIndex];
|
|
133
142
|
if (frame.type === 'element' && frame.tagName === 'span' && frame.properties?.className === 'frame') {
|
|
134
143
|
// Extract line range from child .line elements
|
|
135
144
|
const lineChildren = frame.children.filter(c => c.type === 'element' && c.properties?.className === 'line' && typeof c.properties.dataLn === 'number');
|
|
136
145
|
if (lineChildren.length > 0) {
|
|
137
146
|
const startLine = Number(lineChildren[0].properties.dataLn) - 1;
|
|
138
147
|
const endLine = Number(lineChildren[lineChildren.length - 1].properties.dataLn);
|
|
139
|
-
|
|
148
|
+
const joined = sourceLines.slice(startLine, endLine).join('\n');
|
|
149
|
+
frame.properties.dataAsString = frameIndex < lastIndex ? `${joined}\n` : joined;
|
|
140
150
|
}
|
|
141
151
|
}
|
|
142
152
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Root } from 'mdast';
|
|
2
2
|
import type { ExtractedMetadata } from "../transformMarkdownMetadata/types.mjs";
|
|
3
|
-
import { Audience } from "../../createSitemap/types.mjs";
|
|
3
|
+
import { type Audience } from "../../createSitemap/types.mjs";
|
|
4
4
|
export interface PageMetadata extends ExtractedMetadata {
|
|
5
5
|
/** The slug/path for this page (e.g., 'button', 'checkbox') */
|
|
6
6
|
slug: string;
|
|
@@ -2,6 +2,7 @@ import { createStarryNight } from '@wooorm/starry-night';
|
|
|
2
2
|
import { visit } from 'unist-util-visit';
|
|
3
3
|
import { grammars, extensionMap } from "../parseSource/grammars.mjs";
|
|
4
4
|
import { extendSyntaxTokens } from "../parseSource/extendSyntaxTokens.mjs";
|
|
5
|
+
import { getHastTextContent } from "../hastUtils/index.mjs";
|
|
5
6
|
import { removePrefixFromHighlightedNodes } from "./removePrefixFromHighlightedNodes.mjs";
|
|
6
7
|
const STARRY_NIGHT_KEY = '__docs_infra_starry_night_instance__';
|
|
7
8
|
|
|
@@ -56,18 +57,7 @@ export default function transformHtmlCodeInline(options = {}) {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
// Extract all text content from children (handles multiple text nodes and newlines)
|
|
59
|
-
const
|
|
60
|
-
return children.map(child => {
|
|
61
|
-
if (child.type === 'text') {
|
|
62
|
-
return child.value;
|
|
63
|
-
}
|
|
64
|
-
if (child.type === 'element' && 'children' in child) {
|
|
65
|
-
return getTextContent(child.children);
|
|
66
|
-
}
|
|
67
|
-
return '';
|
|
68
|
-
}).join('');
|
|
69
|
-
};
|
|
70
|
-
const source = getTextContent(node.children);
|
|
60
|
+
const source = node.children.map(child => getHastTextContent(child)).join('');
|
|
71
61
|
if (!source) {
|
|
72
62
|
return;
|
|
73
63
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PhrasingContent } from 'mdast';
|
|
2
|
-
import { Audience } from "../../createSitemap/types.mjs";
|
|
2
|
+
import { type Audience } from "../../createSitemap/types.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Base options for syncing page indexes.
|
|
5
5
|
* Shared between extractToIndex (markdown metadata) and updateParentIndex (types).
|
package/useCode/useCode.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { ContentProps, SourceEnhancers } from "../CodeHighlighter/types.mjs";
|
|
3
|
-
import { UseCopierOpts } from "../useCopier/index.mjs";
|
|
3
|
+
import { type UseCopierOpts } from "../useCopier/index.mjs";
|
|
4
4
|
export type UseCodeOpts = {
|
|
5
5
|
preClassName?: string;
|
|
6
6
|
preRef?: React.Ref<HTMLPreElement>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { UseCopierOpts } from "../useCopier/index.mjs";
|
|
2
|
+
import { type UseCopierOpts } from "../useCopier/index.mjs";
|
|
3
3
|
import type { VariantSource } from "../CodeHighlighter/types.mjs";
|
|
4
4
|
interface UseCopyFunctionalityProps {
|
|
5
5
|
selectedFile: VariantSource | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Code, VariantCode } from "../CodeHighlighter/types.mjs";
|
|
2
2
|
import { createTransformedFiles } from "./useCodeUtils.mjs";
|
|
3
|
-
import { CodeHighlighterContextType } from "../CodeHighlighter/CodeHighlighterContext.mjs";
|
|
3
|
+
import { type CodeHighlighterContextType } from "../CodeHighlighter/CodeHighlighterContext.mjs";
|
|
4
4
|
interface UseTransformManagementProps {
|
|
5
5
|
context?: CodeHighlighterContextType;
|
|
6
6
|
effectiveCode: Code;
|
package/useSearch/types.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElapsedTime, Orama, SearchParams } from '@orama/orama';
|
|
1
|
+
import { type ElapsedTime, type Orama, type Result, type SearchParams } from '@orama/orama';
|
|
2
2
|
import type { Sitemap, SitemapPage, SitemapSection, SitemapPart, SitemapExport, SitemapSectionData } from "../createSitemap/types.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Base search result structure that can be extended by consumers
|
|
@@ -140,7 +140,7 @@ export interface UseSearchOptions {
|
|
|
140
140
|
/** Custom function to flatten sitemap pages into search results */
|
|
141
141
|
flattenPage?: (page: SitemapPage, sectionData: SitemapSectionData) => SearchResult[];
|
|
142
142
|
/** Custom function to format Orama search hits into typed results */
|
|
143
|
-
formatResult?: <TDocument = unknown>(hit:
|
|
143
|
+
formatResult?: <TDocument = unknown>(hit: Result<TDocument>) => SearchResult;
|
|
144
144
|
}
|
|
145
145
|
export type SearchBy<T> = Pick<SearchParams<Orama<T>>, 'facets' | 'groupBy' | 'limit' | 'offset' | 'where'>;
|
|
146
146
|
/**
|
package/useType/useType.d.mts
CHANGED