@stainless-api/docs-ui 0.1.0-beta.8 → 0.1.0-beta.80

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 (155) hide show
  1. package/dist/chunk-BYypO7fO.js +18 -0
  2. package/dist/components/MaskedInput.d.ts +14 -0
  3. package/dist/components/MaskedInput.js +76 -0
  4. package/dist/components/breadcrumbs.d.ts +25 -0
  5. package/dist/components/breadcrumbs.js +64 -0
  6. package/dist/components/icons.d.ts +65 -0
  7. package/dist/components/icons.js +941 -0
  8. package/dist/components/index.d.ts +16 -0
  9. package/dist/components/index.js +75 -0
  10. package/dist/components/method.d.ts +59 -0
  11. package/dist/components/method.js +97 -0
  12. package/dist/components/overview.d.ts +39 -0
  13. package/dist/components/overview.js +139 -0
  14. package/dist/components/primitives.d.ts +107 -0
  15. package/dist/components/primitives.js +253 -0
  16. package/dist/components/properties.d.ts +54 -0
  17. package/dist/components/properties.js +140 -0
  18. package/dist/components/sdk-sidebar.d.ts +15 -0
  19. package/dist/components/sdk-sidebar.js +52 -0
  20. package/dist/components/sdk.d.ts +128 -0
  21. package/dist/components/sdk.js +490 -0
  22. package/dist/components/snippets.d.ts +71 -0
  23. package/dist/components/snippets.js +184 -0
  24. package/dist/components/stl-sidebar.d.ts +58 -0
  25. package/dist/components/stl-sidebar.js +114 -0
  26. package/dist/contexts/component-generics.d.ts +30 -0
  27. package/dist/contexts/component-generics.js +33 -0
  28. package/dist/contexts/component-types.d.ts +8 -0
  29. package/dist/contexts/component-types.js +0 -0
  30. package/dist/contexts/component.d.ts +21 -0
  31. package/dist/contexts/component.js +24 -0
  32. package/dist/contexts/docs.d.ts +62 -0
  33. package/dist/contexts/docs.js +91 -0
  34. package/dist/contexts/index.d.ts +13 -0
  35. package/dist/contexts/index.js +45 -0
  36. package/dist/contexts/markdown.d.ts +22 -0
  37. package/dist/contexts/markdown.js +49 -0
  38. package/dist/contexts/navigation.d.ts +29 -0
  39. package/dist/contexts/navigation.js +24 -0
  40. package/dist/contexts/use-components.d.ts +6 -0
  41. package/dist/contexts/use-components.js +8 -0
  42. package/dist/index-pvh-w1xa.d.ts +1776 -0
  43. package/dist/index.d.ts +7 -0
  44. package/dist/index.js +9 -7542
  45. package/dist/languages/cli.d.ts +38 -0
  46. package/dist/languages/cli.js +167 -0
  47. package/dist/languages/csharp.d.ts +42 -0
  48. package/dist/languages/csharp.js +284 -0
  49. package/dist/languages/go.d.ts +40 -0
  50. package/dist/languages/go.js +304 -0
  51. package/dist/languages/http.d.ts +46 -0
  52. package/dist/languages/http.js +391 -0
  53. package/dist/languages/index.d.ts +51 -0
  54. package/dist/languages/index.js +33 -0
  55. package/dist/languages/java.d.ts +43 -0
  56. package/dist/languages/java.js +404 -0
  57. package/dist/languages/php.d.ts +40 -0
  58. package/dist/languages/php.js +313 -0
  59. package/dist/languages/python.d.ts +40 -0
  60. package/dist/languages/python.js +270 -0
  61. package/dist/languages/ruby.d.ts +40 -0
  62. package/dist/languages/ruby.js +388 -0
  63. package/dist/languages/terraform.d.ts +48 -0
  64. package/dist/languages/terraform.js +244 -0
  65. package/dist/languages/typescript.d.ts +40 -0
  66. package/dist/languages/typescript.js +450 -0
  67. package/dist/markdown/index.d.ts +11 -0
  68. package/dist/markdown/index.js +80 -0
  69. package/dist/markdown/md.d.ts +15 -0
  70. package/dist/markdown/md.js +41 -0
  71. package/dist/markdown/printer.d.ts +13 -0
  72. package/dist/markdown/printer.js +76 -0
  73. package/dist/markdown/utils.d.ts +21 -0
  74. package/dist/markdown/utils.js +31 -0
  75. package/dist/routing.d.ts +61 -0
  76. package/dist/routing.js +176 -150
  77. package/dist/spec.d.ts +65 -0
  78. package/dist/spec.js +167 -0
  79. package/dist/style.d.ts +177 -0
  80. package/dist/style.js +178 -0
  81. package/dist/styles/main.css +788 -752
  82. package/dist/styles/main.js +0 -0
  83. package/dist/styles/primitives.css +326 -458
  84. package/dist/styles/primitives.js +0 -0
  85. package/dist/styles/resets.css +32 -41
  86. package/dist/styles/resets.js +0 -0
  87. package/dist/styles/search.css +192 -270
  88. package/dist/styles/search.js +0 -0
  89. package/dist/styles/sidebar.css +182 -69
  90. package/dist/styles/sidebar.js +0 -0
  91. package/dist/styles/variables.css +28 -89
  92. package/dist/styles/variables.js +0 -0
  93. package/dist/styles.css +3333 -0
  94. package/dist/styles.mjs +1 -0
  95. package/dist/use-strict-context-L0c8JKg4.js +16 -0
  96. package/dist/utils.d.ts +20 -0
  97. package/dist/utils.js +54 -0
  98. package/package.json +74 -22
  99. package/dist/mcp.js +0 -16003
  100. package/dist/styles/snippets.css +0 -132
  101. package/src/components/breadcrumbs.tsx +0 -94
  102. package/src/components/chat.tsx +0 -154
  103. package/src/components/dropdown.tsx +0 -91
  104. package/src/components/icons.tsx +0 -584
  105. package/src/components/index.ts +0 -9
  106. package/src/components/method.tsx +0 -146
  107. package/src/components/overview.tsx +0 -160
  108. package/src/components/primitives.tsx +0 -284
  109. package/src/components/properties.tsx +0 -130
  110. package/src/components/scripts/dropdown.ts +0 -78
  111. package/src/components/sdk.tsx +0 -403
  112. package/src/components/sidebar.tsx +0 -99
  113. package/src/components/snippets.tsx +0 -180
  114. package/src/contexts/component-generics.tsx +0 -48
  115. package/src/contexts/component-types.tsx +0 -5
  116. package/src/contexts/component.tsx +0 -32
  117. package/src/contexts/docs.tsx +0 -75
  118. package/src/contexts/index.tsx +0 -17
  119. package/src/contexts/markdown.tsx +0 -43
  120. package/src/contexts/navigation.tsx +0 -44
  121. package/src/contexts/search.tsx +0 -28
  122. package/src/contexts/use-components.tsx +0 -4
  123. package/src/index.ts +0 -6
  124. package/src/languages/go.tsx +0 -281
  125. package/src/languages/http.tsx +0 -321
  126. package/src/languages/index.ts +0 -26
  127. package/src/languages/java.tsx +0 -358
  128. package/src/languages/python.tsx +0 -255
  129. package/src/languages/ruby.tsx +0 -320
  130. package/src/languages/typescript.tsx +0 -393
  131. package/src/markdown/index.ts +0 -107
  132. package/src/markdown/md.ts +0 -45
  133. package/src/markdown/utils.ts +0 -49
  134. package/src/routing.ts +0 -238
  135. package/src/search/form.tsx +0 -127
  136. package/src/search/index.tsx +0 -1
  137. package/src/search/indexer.ts +0 -246
  138. package/src/search/mcp.ts +0 -61
  139. package/src/search/printer.tsx +0 -86
  140. package/src/search/providers/algolia.ts +0 -88
  141. package/src/search/providers/fuse.ts +0 -19
  142. package/src/search/providers/pagefind.ts +0 -17
  143. package/src/search/providers/walker.ts +0 -30
  144. package/src/search/results.tsx +0 -182
  145. package/src/search/state.ts +0 -64
  146. package/src/search/types.ts +0 -116
  147. package/src/style.ts +0 -196
  148. package/src/styles/main.css +0 -986
  149. package/src/styles/primitives.css +0 -580
  150. package/src/styles/resets.css +0 -39
  151. package/src/styles/search.css +0 -341
  152. package/src/styles/sidebar.css +0 -85
  153. package/src/styles/snippets.css +0 -130
  154. package/src/styles/variables.css +0 -86
  155. package/src/utils.ts +0 -41
@@ -1,180 +0,0 @@
1
- import * as React from 'react';
2
- import { CheckIcon, CircleAlertIcon, CopyIcon, LucideIcon } from 'lucide-react';
3
- import { useDeclaration, useHighlight, useLanguage, useSnippet } from '../contexts';
4
- import { useComponents } from '../contexts/use-components';
5
- import style from '../style';
6
- import clsx from 'clsx';
7
- import type * as SDKJSON from '~/lib/json-spec-v2/types';
8
- import type { TransformRequestSnippetFn } from './sdk';
9
- import { Button } from '@stainless-api/ui-primitives';
10
-
11
- export type SnippetCodeProps = {
12
- content: string;
13
- signature?: string;
14
- language?: string;
15
- };
16
-
17
- export function SnippetCode({ content, language }: SnippetCodeProps) {
18
- const lang = useLanguage();
19
- const highlighted = useHighlight(content, language || lang);
20
-
21
- return (
22
- <div className={style.SnippetCode}>
23
- <pre className={style.SnippetCodeContent} data-stldocs-copy-content>
24
- <code
25
- className={(language as string) === 'json' ? 'snippet-json' : 'snippet'}
26
- dangerouslySetInnerHTML={{ __html: highlighted }}
27
- />
28
- </pre>
29
- </div>
30
- );
31
- }
32
-
33
- export type SnippetProps = {
34
- method: SDKJSON.Method;
35
- requestTitle?: React.ReactNode;
36
- transformRequestSnippet?: TransformRequestSnippetFn;
37
- };
38
-
39
- export type SnippetContainerProps = {
40
- children: React.ReactNode;
41
- signature?: string;
42
- };
43
-
44
- export function SnippetContainer({ children }: SnippetContainerProps) {
45
- return <div className={clsx(style.Snippet)}>{children}</div>;
46
- }
47
-
48
- export type SnippetRequestContainerProps = {
49
- children?: React.ReactNode;
50
- signature?: string;
51
- };
52
-
53
- export function SnippetRequestContainer({ children }: SnippetRequestContainerProps) {
54
- return <div>{children}</div>;
55
- }
56
-
57
- export function Snippet({ requestTitle, method, transformRequestSnippet }: SnippetProps) {
58
- const Docs = useComponents();
59
- const language = useLanguage();
60
- const [CopyButtonIcon, setCopyIcon] = React.useState<LucideIcon>(CopyIcon);
61
-
62
- let snippet = useSnippet(method.stainlessPath, null, language === 'http' ? 'curl' : 'default');
63
- const decl = useDeclaration(method.stainlessPath);
64
-
65
- const signature = 'qualified' in decl ? decl.qualified : undefined;
66
- const responses = method.exampleResponses;
67
-
68
- if (transformRequestSnippet) {
69
- snippet = transformRequestSnippet({ snippet, language });
70
- }
71
-
72
- async function handleCopy() {
73
- try {
74
- await navigator.clipboard.writeText(snippet);
75
- setCopyIcon(CheckIcon);
76
- } catch {
77
- setCopyIcon(CircleAlertIcon);
78
- }
79
-
80
- setTimeout(() => setCopyIcon(CopyIcon), 1000);
81
- }
82
-
83
- return (
84
- <Docs.SnippetContainer signature={signature}>
85
- {snippet && (
86
- <Docs.SnippetRequestContainer signature={signature}>
87
- <div className={style.SnippetRequest} data-stldocs-copy-parent>
88
- <div className={style.SnippetRequestTitle}>
89
- <div className={style.SnippetRequestTitleMethod}>
90
- <Docs.MethodRoute httpMethod={method.httpMethod} iconOnly />
91
- <h5>{method.summary}</h5>
92
- </div>
93
- <div className={style.SnippetRequestTitleContent}>{requestTitle}</div>
94
- <Button variant="ghost" data-stldocs-snippet-copy>
95
- <CopyButtonIcon size={16} className={style.Icon} onClick={handleCopy} />
96
- </Button>
97
- </div>
98
- <Docs.SnippetCode content={snippet} signature={signature} />
99
- </div>
100
- </Docs.SnippetRequestContainer>
101
- )}
102
- {responses && <Docs.SnippetResponse responses={responses} />}
103
- </Docs.SnippetContainer>
104
- );
105
- }
106
-
107
- export function SnippetResponse({ responses }: { responses: SDKJSON.Method['exampleResponses'] }) {
108
- const { SnippetCode } = useComponents();
109
-
110
- if (!responses) {
111
- return null;
112
- }
113
-
114
- const mappedResponses = Object.keys(responses)
115
- .map((key) => {
116
- // Get the first response type ie application/json or text/plain
117
- const responseType = Object.keys(responses[key])[0];
118
- const response = responses[key][responseType];
119
-
120
- const examples = response?.examples;
121
-
122
- if (!examples) return null;
123
-
124
- // Get the first example type, ie Example or html
125
- const exampleType = Object.keys(examples)[0];
126
- let value = examples[exampleType]?.value;
127
-
128
- if (!value) return null;
129
-
130
- if (responseType === 'application/json') {
131
- value = JSON.stringify(value, null, 2);
132
- }
133
-
134
- return {
135
- responseCode: key,
136
- content: value,
137
- };
138
- })
139
- .filter(Boolean);
140
-
141
- if (mappedResponses.length === 0) return null;
142
-
143
- return (
144
- <div className={style.SnippetMultiResponse}>
145
- <div className={clsx(style.Snippet)}>
146
- <div
147
- className={clsx(
148
- style.SnippetResponseTab,
149
- mappedResponses.length === 1 && style.SnippetResponseTabSingleReturn,
150
- )}
151
- >
152
- {mappedResponses.map(({ responseCode }, index) => (
153
- <button
154
- className={clsx(
155
- style.SnippetResponseTabItem,
156
- index === 0 && style.SnippetResponseTabItemActive,
157
- )}
158
- key={`snippet-response-tab-item-${responseCode}-${index}`}
159
- data-snippet-response-tab-id={`snippet-response-tab-${responseCode}-${index}`}
160
- disabled={mappedResponses.length === 1}
161
- >
162
- {responseCode} example
163
- </button>
164
- ))}
165
- </div>
166
- {mappedResponses.map(({ responseCode, content }, index) => {
167
- return (
168
- <div
169
- className={clsx(style.SnippetResponsePane, index === 0 && style.SnippetResponsePaneActive)}
170
- key={`snippet-response-${responseCode}-${index}`}
171
- data-snippet-response-pane-id={`snippet-response-tab-${responseCode}-${index}`}
172
- >
173
- <SnippetCode content={content} language="json" />
174
- </div>
175
- );
176
- })}
177
- </div>
178
- </div>
179
- );
180
- }
@@ -1,48 +0,0 @@
1
- // This file should never import from ../components or ../languages to avoid circular dependencies
2
-
3
- import * as React from 'react';
4
-
5
- type DeepPartialMap<L> = { [K in keyof L]?: Partial<L[K]> };
6
-
7
- export type ComponentsContextType<C, L> = {
8
- components: C;
9
- language: L;
10
- };
11
-
12
- const ComponentContext = React.createContext<ComponentsContextType<any, any> | null>(null);
13
- ComponentContext.displayName = 'ComponentContext';
14
-
15
- export function useComponents<C = unknown>() {
16
- const ctx = React.useContext(ComponentContext);
17
- if (!ctx) throw new Error('useComponents must be used within a ComponentContext.Provider');
18
- return ctx.components as C;
19
- }
20
-
21
- export function customizeComponents<C, L>(
22
- defaults: { components: C; language: L },
23
- overrides: { components?: Partial<C>; language?: DeepPartialMap<L> } = {},
24
- ): { components: C; language: L } {
25
- const mergedComponents = { ...defaults.components, ...(overrides.components ?? {}) } as C;
26
-
27
- const mergedLanguage = Object.keys(defaults.language as Record<string, unknown>).reduce(
28
- (acc, key) => {
29
- acc[key] = { ...(defaults.language as any)[key], ...(overrides.language?.[key] ?? {}) };
30
- return acc;
31
- },
32
- {} as any as L,
33
- );
34
-
35
- return { components: mergedComponents, language: mergedLanguage };
36
- }
37
-
38
- export function ComponentProvider<C, L>({
39
- value,
40
- children,
41
- }: {
42
- value: ComponentsContextType<C, L>;
43
- children: React.ReactNode;
44
- }) {
45
- return <ComponentContext.Provider value={value}>{children}</ComponentContext.Provider>;
46
- }
47
-
48
- export { ComponentContext };
@@ -1,5 +0,0 @@
1
- import type * as DefaultComponents from '../components';
2
- import type * as DefaultLanguage from '../languages';
3
-
4
- export type AppComponents = typeof DefaultComponents;
5
- export type AppLanguage = typeof DefaultLanguage;
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import * as DefaultComponents from '../components';
3
- import * as DefaultLanguage from '../languages';
4
- import {
5
- ComponentProvider as GenericComponentProvider,
6
- customizeComponents,
7
- type ComponentsContextType,
8
- } from './component-generics';
9
-
10
- export type AppComponents = typeof DefaultComponents;
11
- export type AppLanguage = typeof DefaultLanguage;
12
-
13
- export const defaultContextValue: ComponentsContextType<AppComponents, AppLanguage> = {
14
- components: DefaultComponents,
15
- language: DefaultLanguage,
16
- };
17
-
18
- export function ComponentProvider({
19
- components,
20
- language,
21
- children,
22
- }: {
23
- components?: Partial<AppComponents>;
24
- language?: { [K in keyof AppLanguage]?: Partial<AppLanguage[K]> };
25
- children: React.ReactNode;
26
- }) {
27
- const value = React.useMemo(
28
- () => customizeComponents(defaultContextValue, { components, language }),
29
- [components, language],
30
- );
31
- return <GenericComponentProvider value={value}>{children}</GenericComponentProvider>;
32
- }
@@ -1,75 +0,0 @@
1
- import * as React from 'react';
2
- import type { Spec, SpecLanguage } from '~/lib/json-spec-v2/types';
3
-
4
- export type ContentPanelLayout = 'double-pane' | 'single-pane';
5
- export type PropertySettingsType = {
6
- types?: 'simple' | 'rich';
7
- includeModelProperties?: boolean;
8
- collapseDescription?: boolean;
9
- expandDepth?: number;
10
- };
11
-
12
- export type DocsContextType = {
13
- language: SpecLanguage;
14
- spec: Spec | null;
15
- settings?: {
16
- properties?: PropertySettingsType;
17
- contentPanelLayout?: ContentPanelLayout;
18
- virtualExpanders?: boolean;
19
- };
20
- };
21
-
22
- const DocsContextDefaults: DocsContextType = {
23
- settings: {},
24
- language: 'node',
25
- spec: null,
26
- };
27
-
28
- const DocsContext = React.createContext<DocsContextType>(DocsContextDefaults);
29
-
30
- export function useDocs() {
31
- return React.useContext(DocsContext);
32
- }
33
-
34
- export function useSpec() {
35
- return useDocs().spec;
36
- }
37
-
38
- export function useSettings() {
39
- return useDocs().settings;
40
- }
41
-
42
- export function useSnippet(stainlessPath: string, language?: SpecLanguage, variant?: string) {
43
- const snippetLanguage = [language ?? useLanguage(), variant ?? 'default'].join('.');
44
-
45
- return useSpec()?.snippets?.[snippetLanguage]?.[stainlessPath];
46
- }
47
-
48
- export function useDeclaration(stainlessPath: string, language?: SpecLanguage) {
49
- return useSpec()?.decls?.[language ?? useLanguage()]?.[stainlessPath];
50
- }
51
-
52
- export function useResource(name: string) {
53
- return useSpec()?.resources?.[name];
54
- }
55
-
56
- export function useLanguage() {
57
- return useDocs().language;
58
- }
59
-
60
- export function useContentPanelLayout() {
61
- return useDocs().settings?.contentPanelLayout ?? 'double-pane';
62
- }
63
-
64
- export type DocsProviderProps = DocsContextType & { children: React.ReactNode };
65
-
66
- export function DocsProvider({ spec, language, settings, children }: DocsProviderProps) {
67
- const value = {
68
- ...DocsContextDefaults,
69
- spec,
70
- settings: settings ?? DocsContextDefaults.settings,
71
- language: language ?? DocsContextDefaults.language,
72
- };
73
-
74
- return <DocsContext.Provider value={value}>{children}</DocsContext.Provider>;
75
- }
@@ -1,17 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentContext } from './component-generics';
3
- import { useLanguage } from './docs';
4
- import { LanguageComponentDefinition } from '../languages';
5
-
6
- // DO NOT re-export component contexts from here. Only export generics.
7
- export * from './navigation';
8
- export * from './markdown';
9
- export * from './component-generics';
10
- export * from './search';
11
- export * from './docs';
12
-
13
- export function useLanguageComponents() {
14
- const language = useLanguage();
15
- const context = React.useContext(ComponentContext);
16
- return context.language[language] as LanguageComponentDefinition;
17
- }
@@ -1,43 +0,0 @@
1
- import * as React from 'react';
2
- import { useLanguage } from './docs';
3
-
4
- const HighlightLanguageMappings = {
5
- node: 'typescript',
6
- http: 'bash',
7
- };
8
-
9
- export type MarkdownContext = {
10
- highlight?: (content: string, language?: string) => string | Promise<string>;
11
- render?: (content: string) => string;
12
- };
13
-
14
- export const MarkdownContext = React.createContext<MarkdownContext>({
15
- highlight: (content) => content,
16
- render: (content) => content,
17
- });
18
-
19
- export const useMarkdownContext = () => React.useContext(MarkdownContext);
20
-
21
- export function useRenderMarkdown(content?: string) {
22
- const { render } = React.useContext(MarkdownContext);
23
- return React.useMemo(() => (content ? render(content) : undefined), [content, render]);
24
- }
25
-
26
- export function useHighlight(content?: string, language?: string) {
27
- const { highlight } = React.useContext(MarkdownContext);
28
- const lang = language ?? useLanguage();
29
-
30
- return React.useMemo(() => {
31
- const highlightLanguage = HighlightLanguageMappings[lang] ?? lang;
32
- const rendered = highlight(content, highlightLanguage);
33
- return typeof rendered === 'string' ? rendered : React.use(rendered);
34
- }, [content, language, highlight]);
35
- }
36
-
37
- export type MarkdownProviderProps = MarkdownContext & {
38
- children: React.ReactNode;
39
- };
40
-
41
- export function MarkdownProvider({ render, highlight, children }: MarkdownProviderProps) {
42
- return <MarkdownContext.Provider value={{ render, highlight }}>{children}</MarkdownContext.Provider>;
43
- }
@@ -1,44 +0,0 @@
1
- import * as React from 'react';
2
- import { DocsLanguage } from '../routing';
3
-
4
- export type NavigationHandler = (
5
- ev: React.MouseEvent | null,
6
- opts: {
7
- href: string;
8
- language: DocsLanguage;
9
- stainlessPath: string;
10
- scroll: boolean;
11
- },
12
- ) => void;
13
-
14
- export type NavigationContextType = {
15
- basePath?: string;
16
- selectedPath?: string;
17
- navigationPath?: string[];
18
- onNavigate?: NavigationHandler;
19
- };
20
-
21
- const Defaults: NavigationContextType = {
22
- basePath: '/',
23
- };
24
-
25
- const NavigationContext = React.createContext<NavigationContextType>(Defaults);
26
-
27
- export function useNavigation() {
28
- return React.useContext(NavigationContext);
29
- }
30
-
31
- export type NavigationProviderProps = NavigationContextType & {
32
- children: React.ReactNode;
33
- };
34
-
35
- export function NavigationProvider({
36
- basePath,
37
- selectedPath,
38
- onNavigate,
39
- children,
40
- }: NavigationProviderProps) {
41
- const value = { ...Defaults, onNavigate, basePath, selectedPath };
42
-
43
- return <NavigationContext.Provider value={value}>{children}</NavigationContext.Provider>;
44
- }
@@ -1,28 +0,0 @@
1
- import * as React from 'react';
2
- import { search } from '../search/providers/algolia';
3
- import { SearchParams, SearchSettings } from '../search/types';
4
-
5
- export type SearchContextType = {
6
- settings: SearchSettings;
7
- onSelect?: (stainlessPath: string) => void;
8
- pageFind?: string;
9
- };
10
-
11
- const SearchContext = React.createContext<SearchContextType>(null);
12
-
13
- export function useSearchContext() {
14
- return React.useContext(SearchContext);
15
- }
16
-
17
- export function useSearch() {
18
- const { settings } = useSearchContext();
19
- return (params: SearchParams) => search({ settings, params });
20
- }
21
-
22
- export type SearchProviderProps = SearchContextType & {
23
- children: React.ReactNode;
24
- };
25
-
26
- export function SearchProvider({ children, ...props }: SearchProviderProps) {
27
- return <SearchContext value={props}>{children}</SearchContext>;
28
- }
@@ -1,4 +0,0 @@
1
- import { useComponents as base } from './component-generics';
2
- import type { AppComponents } from './component-types';
3
-
4
- export const useComponents = () => base<AppComponents>();
package/src/index.ts DELETED
@@ -1,6 +0,0 @@
1
- export * as contexts from './contexts';
2
- export * as components from './components';
3
- export * as languages from './languages';
4
- export * as routing from './routing';
5
- export * as utils from './utils';
6
- export { default as style } from './style';