@terrafirmagreg-team/ui 0.0.0-stage → 0.1.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 (215) hide show
  1. package/package.json +93 -3
  2. package/src/components/blocks/button/icon-button.tsx +48 -0
  3. package/src/components/blocks/canvas/chevron-edge.tsx +134 -0
  4. package/src/components/blocks/canvas/flow-canvas.tsx +177 -0
  5. package/src/components/blocks/canvas/flow-toolbar.tsx +32 -0
  6. package/src/components/blocks/canvas/flow-viewport.tsx +243 -0
  7. package/src/components/blocks/git/github-info.tsx +77 -0
  8. package/src/components/blocks/lang/content.tsx +22 -0
  9. package/src/components/blocks/lang/flag.tsx +24 -0
  10. package/src/components/blocks/lang/link.tsx +22 -0
  11. package/src/components/blocks/lang/redirect.tsx +47 -0
  12. package/src/components/blocks/lang/switcher.tsx +53 -0
  13. package/src/components/blocks/lang/untranslated-callout.tsx +28 -0
  14. package/src/components/blocks/link/link-preview.tsx +256 -0
  15. package/src/components/blocks/list/row.tsx +91 -0
  16. package/src/components/blocks/media/glb/model.tsx +243 -0
  17. package/src/components/blocks/media/glb/scene.tsx +372 -0
  18. package/src/components/blocks/media/glb/viewer.tsx +51 -0
  19. package/src/components/blocks/media/image.tsx +135 -0
  20. package/src/components/blocks/media/slideshow.tsx +177 -0
  21. package/src/components/blocks/nav/breadcrumb.tsx +50 -0
  22. package/src/components/blocks/nav/link.tsx +85 -0
  23. package/src/components/blocks/nav/site-menu.tsx +77 -0
  24. package/src/components/blocks/nav/site-title.tsx +60 -0
  25. package/src/components/blocks/nav/switcher.tsx +205 -0
  26. package/src/components/blocks/page/empty-state.tsx +31 -0
  27. package/src/components/blocks/page/heading.tsx +53 -0
  28. package/src/components/blocks/page/pager.tsx +112 -0
  29. package/src/components/blocks/readability/menu.tsx +431 -0
  30. package/src/components/blocks/readability/track.tsx +164 -0
  31. package/src/components/blocks/search/command.tsx +79 -0
  32. package/src/components/blocks/search/dialog.tsx +712 -0
  33. package/src/components/blocks/search/provider.tsx +117 -0
  34. package/src/components/blocks/sidebar.tsx +406 -0
  35. package/src/components/blocks/theme/toggle.tsx +71 -0
  36. package/src/components/blocks/tooltip/hint.tsx +27 -0
  37. package/src/components/blocks/viewer/controls.tsx +279 -0
  38. package/src/components/blocks/viewer/float-bar.tsx +50 -0
  39. package/src/components/layouts/layout.tsx +93 -0
  40. package/src/components/layouts/left-sidebar/content.tsx +62 -0
  41. package/src/components/layouts/left-sidebar/context.tsx +54 -0
  42. package/src/components/layouts/left-sidebar/expand.tsx +22 -0
  43. package/src/components/layouts/left-sidebar/footer.tsx +105 -0
  44. package/src/components/layouts/left-sidebar/index.ts +28 -0
  45. package/src/components/layouts/left-sidebar/items.tsx +102 -0
  46. package/src/components/layouts/left-sidebar/search.tsx +74 -0
  47. package/src/components/layouts/left-sidebar/sidebar.tsx +188 -0
  48. package/src/components/layouts/left-sidebar/tree.tsx +156 -0
  49. package/src/components/layouts/right-sidebar.tsx +95 -0
  50. package/src/components/layouts/tree-context.tsx +41 -0
  51. package/src/components/mdx/accordion.tsx +184 -0
  52. package/src/components/mdx/banner.tsx +154 -0
  53. package/src/components/mdx/callout.tsx +96 -0
  54. package/src/components/mdx/card.tsx +49 -0
  55. package/src/components/mdx/codeblock.tsx +249 -0
  56. package/src/components/mdx/collapsible.tsx +32 -0
  57. package/src/components/mdx/files.tsx +62 -0
  58. package/src/components/mdx/glow-header.tsx +40 -0
  59. package/src/components/mdx/gradient-text.tsx +27 -0
  60. package/src/components/mdx/image-zoom.tsx +314 -0
  61. package/src/components/mdx/mermaid.tsx +16 -0
  62. package/src/components/mdx/multiblock.tsx +18 -0
  63. package/src/components/mdx/preview.tsx +100 -0
  64. package/src/components/mdx/steps.tsx +9 -0
  65. package/src/components/mdx/table.tsx +13 -0
  66. package/src/components/mdx/tabs.tsx +353 -0
  67. package/src/components/mdx/type-table.tsx +170 -0
  68. package/src/components/ui/accordion.tsx +71 -0
  69. package/src/components/ui/alert-dialog.tsx +187 -0
  70. package/src/components/ui/alert.tsx +75 -0
  71. package/src/components/ui/aspect-ratio.tsx +22 -0
  72. package/src/components/ui/attachment.tsx +207 -0
  73. package/src/components/ui/avatar.tsx +108 -0
  74. package/src/components/ui/badge.tsx +51 -0
  75. package/src/components/ui/breadcrumb.tsx +124 -0
  76. package/src/components/ui/bubble.tsx +127 -0
  77. package/src/components/ui/button-group.tsx +87 -0
  78. package/src/components/ui/button.tsx +57 -0
  79. package/src/components/ui/calendar.tsx +221 -0
  80. package/src/components/ui/card.tsx +102 -0
  81. package/src/components/ui/carousel.tsx +242 -0
  82. package/src/components/ui/chart.tsx +371 -0
  83. package/src/components/ui/checkbox.tsx +28 -0
  84. package/src/components/ui/collapsible.tsx +21 -0
  85. package/src/components/ui/combobox.tsx +297 -0
  86. package/src/components/ui/command.tsx +198 -0
  87. package/src/components/ui/context-menu.tsx +270 -0
  88. package/src/components/ui/dialog.tsx +160 -0
  89. package/src/components/ui/direction.tsx +6 -0
  90. package/src/components/ui/drawer.tsx +227 -0
  91. package/src/components/ui/dropdown-menu.tsx +269 -0
  92. package/src/components/ui/empty.tsx +103 -0
  93. package/src/components/ui/field.tsx +238 -0
  94. package/src/components/ui/hover-card.tsx +50 -0
  95. package/src/components/ui/input-group.tsx +158 -0
  96. package/src/components/ui/input-otp.tsx +86 -0
  97. package/src/components/ui/input.tsx +19 -0
  98. package/src/components/ui/item.tsx +201 -0
  99. package/src/components/ui/kbd.tsx +26 -0
  100. package/src/components/ui/label.tsx +19 -0
  101. package/src/components/ui/marker.tsx +70 -0
  102. package/src/components/ui/menubar.tsx +280 -0
  103. package/src/components/ui/message-scroller.tsx +131 -0
  104. package/src/components/ui/message.tsx +91 -0
  105. package/src/components/ui/native-select.tsx +60 -0
  106. package/src/components/ui/navigation-menu.tsx +167 -0
  107. package/src/components/ui/pagination.tsx +130 -0
  108. package/src/components/ui/popover.tsx +91 -0
  109. package/src/components/ui/progress.tsx +82 -0
  110. package/src/components/ui/questionnaire.tsx +324 -0
  111. package/src/components/ui/radio-group.tsx +37 -0
  112. package/src/components/ui/resizable.tsx +49 -0
  113. package/src/components/ui/scroll-area.tsx +54 -0
  114. package/src/components/ui/select.tsx +200 -0
  115. package/src/components/ui/separator.tsx +24 -0
  116. package/src/components/ui/sheet.tsx +138 -0
  117. package/src/components/ui/sidebar.tsx +730 -0
  118. package/src/components/ui/skeleton.tsx +13 -0
  119. package/src/components/ui/slider.tsx +51 -0
  120. package/src/components/ui/spinner.tsx +10 -0
  121. package/src/components/ui/switch.tsx +31 -0
  122. package/src/components/ui/table.tsx +115 -0
  123. package/src/components/ui/tabs.tsx +81 -0
  124. package/src/components/ui/textarea.tsx +17 -0
  125. package/src/components/ui/toast.tsx +234 -0
  126. package/src/components/ui/toggle-group.tsx +89 -0
  127. package/src/components/ui/toggle.tsx +44 -0
  128. package/src/components/ui/tooltip.tsx +65 -0
  129. package/src/hooks/canvas/use-flow-hover.ts +18 -0
  130. package/src/hooks/canvas/use-flow-viewport-persist.ts +33 -0
  131. package/src/hooks/lang.ts +8 -0
  132. package/src/hooks/layout.ts +18 -0
  133. package/src/hooks/page/use-fit-pages.ts +91 -0
  134. package/src/hooks/page/use-location-search.ts +25 -0
  135. package/src/hooks/page/use-page-preview.ts +40 -0
  136. package/src/hooks/page/use-paged-list.ts +20 -0
  137. package/src/hooks/readability/provider.ts +86 -0
  138. package/src/hooks/search/dialog.ts +41 -0
  139. package/src/hooks/search/provider.ts +25 -0
  140. package/src/hooks/search/use-highlight-query.ts +51 -0
  141. package/src/hooks/sidebar.ts +63 -0
  142. package/src/hooks/use-async-value.ts +57 -0
  143. package/src/hooks/use-close-on-scroll.ts +23 -0
  144. package/src/hooks/use-copy-button.ts +46 -0
  145. package/src/hooks/use-cycle-index.ts +75 -0
  146. package/src/hooks/use-document-title.ts +9 -0
  147. package/src/hooks/use-element-size.ts +35 -0
  148. package/src/hooks/use-external-meta.ts +132 -0
  149. package/src/hooks/use-hot-key.ts +33 -0
  150. package/src/hooks/use-hover-follow.ts +54 -0
  151. package/src/hooks/use-in-view.ts +30 -0
  152. package/src/hooks/use-last-value.ts +15 -0
  153. package/src/hooks/use-marquee.ts +51 -0
  154. package/src/hooks/use-media-query.ts +14 -0
  155. package/src/hooks/use-mobile.ts +19 -0
  156. package/src/hooks/use-modifier-keys.ts +31 -0
  157. package/src/hooks/use-on-change.ts +35 -0
  158. package/src/hooks/use-pane-keys.ts +28 -0
  159. package/src/hooks/use-swipe.ts +26 -0
  160. package/src/hooks/use-tree.ts +102 -0
  161. package/src/hooks/viewer/use-in-float-bar.ts +6 -0
  162. package/src/hooks/viewer/use-viewer-prefs.ts +77 -0
  163. package/src/lib/canvas/edge.ts +173 -0
  164. package/src/lib/canvas/geometry.ts +53 -0
  165. package/src/lib/canvas/state.ts +47 -0
  166. package/src/lib/canvas/viewport.ts +37 -0
  167. package/src/lib/canvas/xyflow.ts +1 -0
  168. package/src/lib/config.ts +81 -0
  169. package/src/lib/mdx/callout.ts +20 -0
  170. package/src/lib/mdx/gradient.ts +15 -0
  171. package/src/lib/mdx/mermaid.ts +14 -0
  172. package/src/lib/media/crop-opaque.ts +76 -0
  173. package/src/lib/media/nearby-indexes.ts +6 -0
  174. package/src/lib/media/trim-transparent.ts +117 -0
  175. package/src/lib/readability/config.ts +10 -0
  176. package/src/lib/readability/spotlight.ts +186 -0
  177. package/src/lib/readability/store.ts +146 -0
  178. package/src/lib/tree.ts +92 -0
  179. package/src/lib/utils/async-cache.ts +32 -0
  180. package/src/lib/utils/cn.ts +1 -0
  181. package/src/lib/utils/format.ts +22 -0
  182. package/src/lib/utils/history.ts +9 -0
  183. package/src/lib/utils/merge-refs.ts +13 -0
  184. package/src/lib/utils/nav-active.ts +58 -0
  185. package/src/lib/utils/stored-value.ts +136 -0
  186. package/src/lib/utils/urls.ts +17 -0
  187. package/src/locales/en_us.json +119 -0
  188. package/src/locales/pl_pl.json +35 -0
  189. package/src/locales/ru_ru.json +119 -0
  190. package/src/locales/uk_ua.json +35 -0
  191. package/src/locales/zh_cn.json +17 -0
  192. package/src/locales/zh_tw.json +17 -0
  193. package/src/locales.ts +5 -0
  194. package/src/provider.tsx +141 -0
  195. package/src/types/canvas.ts +49 -0
  196. package/src/types/glb.ts +25 -0
  197. package/src/types/nav.ts +95 -0
  198. package/src/types/preview.ts +9 -0
  199. package/src/types/readability.ts +28 -0
  200. package/src/types/search.ts +56 -0
  201. package/src/types/tree.ts +18 -0
  202. package/src/types/viewer.ts +53 -0
  203. package/styles/content/base.css +194 -0
  204. package/styles/content/default-colors.css +51 -0
  205. package/styles/content/shiki.css +108 -0
  206. package/styles/content/typography.mjs +3941 -0
  207. package/styles/content.css +7 -0
  208. package/styles/image-zoom.css +83 -0
  209. package/styles/layout.css +28 -0
  210. package/styles/left-sidebar.css +140 -0
  211. package/styles/readability.css +50 -0
  212. package/styles/right-sidebar.css +6 -0
  213. package/styles/workspace.css +26 -0
  214. package/styles.css +413 -0
  215. package/README.md +0 -3
@@ -0,0 +1,141 @@
1
+ 'use client';
2
+ import Link from 'next/link';
3
+ import {
4
+ createContext,
5
+ useContext,
6
+ useMemo,
7
+ type ComponentProps,
8
+ type ComponentType,
9
+ type ReactNode,
10
+ } from 'react';
11
+ import { flushSync } from 'react-dom';
12
+ import { DirectionProvider } from '@base-ui/react/direction-provider';
13
+ import {
14
+ ThemeProvider,
15
+ useTheme,
16
+ type ThemeProviderProps,
17
+ } from 'next-themes';
18
+ import { TranslationProvider } from '@terrafirmagreg-team/translate';
19
+ import { useHotKey } from '@terrafirmagreg-team/ui/hooks/use-hot-key';
20
+
21
+ export type UiLinkProps = { href: string; prefetch?: boolean } & Omit<
22
+ ComponentProps<'a'>,
23
+ 'href'
24
+ >;
25
+
26
+ export type UiComponents = {
27
+ Link?: ComponentType<UiLinkProps>;
28
+ };
29
+
30
+ const defaults: Required<UiComponents> = {
31
+ Link: Link as ComponentType<UiLinkProps>,
32
+ };
33
+
34
+ const UiComponentsContext = createContext<UiComponents | null>(null);
35
+
36
+ export function UiProvider({
37
+ components,
38
+ translations,
39
+ children,
40
+ }: {
41
+ components?: UiComponents;
42
+ translations?: Record<string, string>;
43
+ children: ReactNode;
44
+ }) {
45
+ const parent = useContext(UiComponentsContext);
46
+ const merged = useMemo(
47
+ () => ({ ...parent, ...components }),
48
+ [parent, components],
49
+ );
50
+ const inner = (
51
+ <UiComponentsContext.Provider value={merged}>
52
+ {children}
53
+ </UiComponentsContext.Provider>
54
+ );
55
+ if (!translations) return inner;
56
+ return (
57
+ <TranslationProvider translations={translations}>
58
+ {inner}
59
+ </TranslationProvider>
60
+ );
61
+ }
62
+
63
+ export function useUiComponents(): Required<UiComponents> {
64
+ return { ...defaults, ...useContext(UiComponentsContext) };
65
+ }
66
+
67
+ export interface ThemeOptions extends ThemeProviderProps {
68
+
69
+ enabled?: boolean;
70
+
71
+
72
+ hotKey?: string | ((e: KeyboardEvent) => boolean) | false;
73
+ }
74
+
75
+
76
+ function ThemeHotKey({
77
+ hotKey,
78
+ }: {
79
+ hotKey: Exclude<ThemeOptions['hotKey'], false | undefined>;
80
+ }) {
81
+ const { setTheme, resolvedTheme } = useTheme();
82
+
83
+ useHotKey(
84
+ (e) => {
85
+
86
+ const matched =
87
+ typeof hotKey === 'string'
88
+ ? !e.metaKey &&
89
+ !e.ctrlKey &&
90
+ !e.altKey &&
91
+ e.key.toLowerCase() === hotKey.toLowerCase()
92
+ : hotKey(e);
93
+ if (!matched) return;
94
+
95
+ e.preventDefault();
96
+ const next = resolvedTheme === 'dark' ? 'light' : 'dark';
97
+ if (document?.startViewTransition) {
98
+ document.startViewTransition(() => flushSync(() => setTheme(next)));
99
+ } else {
100
+ setTheme(next);
101
+ }
102
+ },
103
+ { ignoreTyping: true },
104
+ );
105
+
106
+ return null;
107
+ }
108
+
109
+
110
+ export function UiRootProvider({
111
+ children,
112
+ dir = 'ltr',
113
+ theme = {},
114
+ }: {
115
+ children?: ReactNode;
116
+
117
+ dir?: 'rtl' | 'ltr';
118
+
119
+ theme?: ThemeOptions;
120
+ }) {
121
+ let body = children;
122
+
123
+ if (theme?.enabled !== false) {
124
+ const { enabled: _, hotKey = 'd', ...themeProps } = theme;
125
+
126
+ body = (
127
+ <ThemeProvider
128
+ attribute="class"
129
+ defaultTheme="system"
130
+ enableSystem
131
+ disableTransitionOnChange
132
+ {...themeProps}
133
+ >
134
+ {hotKey !== false && <ThemeHotKey hotKey={hotKey} />}
135
+ {body}
136
+ </ThemeProvider>
137
+ );
138
+ }
139
+
140
+ return <DirectionProvider direction={dir}>{body}</DirectionProvider>;
141
+ }
@@ -0,0 +1,49 @@
1
+ export type FlowPoint = { x: number; y: number };
2
+
3
+ export type FlowRect = { x: number; y: number; width: number; height: number };
4
+
5
+ export type FlowContentBox = {
6
+ midX: number;
7
+ midY: number;
8
+ width: number;
9
+ height: number;
10
+ };
11
+
12
+ export type FlowSizedNode = {
13
+ position: FlowPoint;
14
+ width?: number | null;
15
+ height?: number | null;
16
+ };
17
+
18
+ export type StoredViewport = { x: number; y: number; zoom: number };
19
+
20
+ export type ChevronEdgeHighlight = 'incoming' | 'outgoing' | undefined;
21
+
22
+ export type FlowHoverValue = {
23
+ id: string | null;
24
+ setId: (id: string | null) => void;
25
+ };
26
+
27
+ export type FlowCanvasViewport = {
28
+ storageKey: string;
29
+ resetKey: string;
30
+ selectedId?: string | null;
31
+
32
+ initFocusId?: string | null;
33
+ suppressPanRef?: { current: string | null };
34
+
35
+ userMovedRef?: { current: boolean };
36
+ focusZoom?: number;
37
+
38
+ minZoom?: number;
39
+ maxZoom?: number;
40
+ restoreViewport?: boolean;
41
+ ready?: boolean;
42
+
43
+ persist?: boolean;
44
+ };
45
+
46
+ export type FlowToolbarProps = {
47
+ onFit?: () => void;
48
+ search?: { label: string; onOpen: () => void };
49
+ };
@@ -0,0 +1,25 @@
1
+ import type { OrbitControls } from '@react-three/drei';
2
+ import type { ComponentRef } from 'react';
3
+
4
+ export type GlbOrbitControls = ComponentRef<typeof OrbitControls>;
5
+
6
+ export type GlbHomeView = {
7
+ position: [number, number, number];
8
+ target: [number, number, number];
9
+ };
10
+
11
+ export type GlbSceneHandle = {
12
+ zoomBy: (factor: number) => void;
13
+ reset: () => void;
14
+ };
15
+
16
+ export type GlbSessionProps = {
17
+ src?: string | null;
18
+ sources?: string[];
19
+ title?: string;
20
+ scale?: number;
21
+ offset?: number;
22
+ bare?: boolean;
23
+
24
+ resolveResource?: (resourceUrl: string, modelUrl: string) => string | undefined;
25
+ };
@@ -0,0 +1,95 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+
3
+ export type SwitcherOption = {
4
+ value: string;
5
+ title: ReactNode;
6
+ description?: ReactNode;
7
+ icon?: ReactNode;
8
+ url?: string;
9
+ disabled?: boolean;
10
+ };
11
+
12
+ export type SwitcherProps = Omit<ComponentProps<'button'>, 'onSelect'> & {
13
+ options: SwitcherOption[];
14
+ selected?: string;
15
+ onSelect?: (value: string) => void;
16
+ placeholder?: ReactNode;
17
+ icon?: ReactNode;
18
+ header?: ReactNode;
19
+ side?: 'top' | 'bottom' | 'left' | 'right';
20
+ };
21
+
22
+ export type LinkProps = ComponentProps<'a'> & {
23
+ href?: string;
24
+ external?: boolean;
25
+ prefetch?: boolean;
26
+ children?: ReactNode;
27
+ };
28
+
29
+ interface Filterable {
30
+
31
+ on?: 'menu' | 'nav' | 'all';
32
+ }
33
+
34
+ interface WithHref {
35
+ url: string;
36
+
37
+ active?: 'url' | 'nested-url' | 'none';
38
+ external?: boolean;
39
+ }
40
+
41
+ export interface MainItemType extends WithHref, Filterable {
42
+ type?: 'main';
43
+ icon?: ReactNode;
44
+ text: ReactNode;
45
+ description?: ReactNode;
46
+ }
47
+
48
+ export interface IconItemType extends WithHref, Filterable {
49
+ type: 'icon';
50
+
51
+ label?: string;
52
+ icon: ReactNode;
53
+ text: ReactNode;
54
+
55
+ secondary?: boolean;
56
+ }
57
+
58
+ export interface ButtonItemType extends WithHref, Filterable {
59
+ type: 'button';
60
+ icon?: ReactNode;
61
+ text: ReactNode;
62
+
63
+ secondary?: boolean;
64
+ }
65
+
66
+ export interface MenuItemType extends Partial<WithHref>, Filterable {
67
+ type: 'menu';
68
+ icon?: ReactNode;
69
+ text: ReactNode;
70
+ items: (
71
+ | (MainItemType & {
72
+
73
+ menu?: ComponentProps<'a'> & {
74
+ banner?: ReactNode;
75
+ };
76
+ })
77
+ | CustomItemType
78
+ )[];
79
+
80
+ secondary?: boolean;
81
+ }
82
+
83
+ export interface CustomItemType extends Filterable {
84
+ type: 'custom';
85
+
86
+ secondary?: boolean;
87
+ children: ReactNode;
88
+ }
89
+
90
+ export type LinkItemType =
91
+ | MainItemType
92
+ | IconItemType
93
+ | ButtonItemType
94
+ | MenuItemType
95
+ | CustomItemType;
@@ -0,0 +1,9 @@
1
+ export type PreviewIcon =
2
+ | { type: 'icon'; name: string }
3
+ | { type: 'entry'; kind: string; id: string; dataset?: string };
4
+
5
+ export type PagePreviewData = {
6
+ title: string;
7
+ description?: string;
8
+ icon?: PreviewIcon;
9
+ };
@@ -0,0 +1,28 @@
1
+ export const readabilityLayouts = [
2
+ 'full',
3
+ 'sidebar',
4
+ 'both',
5
+ 'original',
6
+ ] as const;
7
+ export type ReadabilityLayout = (typeof readabilityLayouts)[number];
8
+
9
+ export const spotlightStyles = ['under', 'aside'] as const;
10
+ export type SpotlightStyle = (typeof spotlightStyles)[number];
11
+
12
+ export type ReadabilityState = {
13
+ layout: ReadabilityLayout;
14
+ pageWidth: number;
15
+ contentWidth: number;
16
+ spotlight: boolean;
17
+ spotlightStyle: SpotlightStyle;
18
+ };
19
+
20
+ export type ReadabilityValue = ReadabilityState & {
21
+ coarsePointer: boolean;
22
+ smallScreen: boolean;
23
+ setLayout: (layout: ReadabilityLayout) => void;
24
+ setPageWidth: (value: number) => void;
25
+ setContentWidth: (value: number) => void;
26
+ setSpotlight: (enabled: boolean) => void;
27
+ setSpotlightStyle: (style: SpotlightStyle) => void;
28
+ };
@@ -0,0 +1,56 @@
1
+ import type { Dialog } from '@base-ui/react/dialog';
2
+ import type { Root } from 'hast';
3
+ import type { ReactNode } from 'react';
4
+
5
+ export interface SharedProps {
6
+ open: boolean;
7
+ onOpenChange: (open: boolean) => void;
8
+ dialogHandle: Dialog.Handle<unknown>;
9
+ }
10
+
11
+ export interface SortedResult<Content = string> {
12
+ id: string;
13
+ url: string;
14
+ type: 'page' | 'heading' | 'text';
15
+ content: Content;
16
+
17
+ breadcrumbs?: Content[];
18
+
19
+ table?: string;
20
+ }
21
+
22
+ export type ReactSortedResult = SortedResult<ReactNode>;
23
+
24
+ export interface SearchResultRecord extends SortedResult {
25
+
26
+ hastContent: Root;
27
+ }
28
+
29
+ export interface SearchResultTable {
30
+ type: 'table';
31
+
32
+ id: string;
33
+ columns: number;
34
+
35
+ header?: Root;
36
+ rows: SearchResultRecord[];
37
+ }
38
+
39
+ export type SearchResultItem = SearchResultRecord | SearchResultTable;
40
+
41
+ export interface SearchResult {
42
+
43
+ query: string;
44
+ items: SearchResultItem[];
45
+ }
46
+
47
+ export type SearchItemType =
48
+ | ((ReactSortedResult | SearchResultRecord) & {
49
+ external?: boolean;
50
+ })
51
+ | {
52
+ id: string;
53
+ type: 'action';
54
+ node: ReactNode;
55
+ onSelect: () => void;
56
+ };
@@ -0,0 +1,18 @@
1
+ import type * as PageTree from '@terrafirmagreg-team/translate/types/tree';
2
+ import type { ReactNode } from 'react';
3
+
4
+ export interface TreeContextValue {
5
+
6
+ root: PageTree.Root | PageTree.Folder;
7
+ full: PageTree.Root;
8
+ }
9
+
10
+ export interface TabOption {
11
+ url: string;
12
+ title?: ReactNode;
13
+ icon?: ReactNode;
14
+ description?: ReactNode;
15
+ unlisted?: boolean;
16
+ $folder?: PageTree.Folder;
17
+ urls?: Set<string>;
18
+ }
@@ -0,0 +1,53 @@
1
+ import type { ReactNode, RefObject } from 'react';
2
+
3
+ export type ZoomControlsProps = {
4
+ onZoomIn: () => void;
5
+ onZoomOut: () => void;
6
+ onFit?: () => void;
7
+ fitLabel?: string;
8
+ };
9
+
10
+ export type PagerControlsProps = {
11
+ index: number;
12
+ count: number;
13
+ onSelect: (index: number) => void;
14
+ };
15
+
16
+ export type ExpandButtonProps = {
17
+ target: RefObject<HTMLElement | null>;
18
+ };
19
+
20
+ export type ViewerSliderSetting = {
21
+ label: ReactNode;
22
+ icon?: ReactNode;
23
+ value: number;
24
+ onChange: (value: number) => void;
25
+ min?: number;
26
+ max?: number;
27
+ step?: number;
28
+ format?: (value: number) => string;
29
+ disabled?: boolean;
30
+ live?: boolean;
31
+ };
32
+
33
+ export type ViewerToggleSetting = {
34
+ label: ReactNode;
35
+ icon?: ReactNode;
36
+ checked: boolean;
37
+ onChange: (value: boolean) => void;
38
+ };
39
+
40
+ export type ViewerSettingsProps = {
41
+ label: string;
42
+ sliders?: ViewerSliderSetting[];
43
+ toggles?: ViewerToggleSetting[];
44
+ };
45
+
46
+ export type ViewerControlsProps = {
47
+ start?: ReactNode;
48
+ pager?: PagerControlsProps;
49
+ zoom?: ZoomControlsProps;
50
+ expand?: ExpandButtonProps;
51
+ extra?: ReactNode;
52
+ settings?: ViewerSettingsProps;
53
+ };
@@ -0,0 +1,194 @@
1
+ :root {
2
+ --sidebar-drawer-offset: 100%;
3
+ }
4
+
5
+ [dir='rtl'] {
6
+ --sidebar-drawer-offset: -100%;
7
+ }
8
+
9
+ @theme {
10
+ --animate-fade-in: fade-in 300ms ease;
11
+ --animate-fade-out: fade-out 300ms ease;
12
+
13
+ /* slide in from below, or from above when `--roll` is -1 */
14
+ --animate-roll-in: roll-in 320ms cubic-bezier(0.22, 1, 0.36, 1);
15
+
16
+ --animate-dialog-in: dialog-in 300ms cubic-bezier(0.16, 1, 0.3, 1);
17
+ --animate-dialog-out: dialog-out 300ms cubic-bezier(0.16, 1, 0.3, 1);
18
+
19
+ --animate-popover-in: popover-in 100ms ease;
20
+ --animate-popover-out: popover-out 100ms ease;
21
+
22
+ --animate-sidebar-in: sidebar-in 250ms ease;
23
+ --animate-sidebar-out: sidebar-out 250ms ease;
24
+
25
+ @keyframes sidebar-in {
26
+ from {
27
+ transform: translateX(var(--sidebar-drawer-offset));
28
+ }
29
+ }
30
+
31
+ @keyframes sidebar-out {
32
+ to {
33
+ transform: translateX(var(--sidebar-drawer-offset));
34
+ }
35
+ }
36
+
37
+ @keyframes dialog-in {
38
+ from {
39
+ transform: scale(1.06);
40
+ opacity: 0;
41
+ }
42
+ to {
43
+ transform: scale(1);
44
+ }
45
+ }
46
+
47
+ @keyframes dialog-out {
48
+ from {
49
+ transform: scale(1);
50
+ }
51
+ to {
52
+ transform: scale(1.04);
53
+ opacity: 0;
54
+ }
55
+ }
56
+
57
+ @keyframes popover-in {
58
+ from {
59
+ opacity: 0;
60
+ transform: scale(0.9);
61
+ }
62
+ }
63
+
64
+ @keyframes popover-out {
65
+ to {
66
+ opacity: 0;
67
+ transform: scale(0.9);
68
+ }
69
+ }
70
+
71
+ @keyframes fade-in {
72
+ from {
73
+ opacity: 0;
74
+ }
75
+ to {
76
+ opacity: 1;
77
+ }
78
+ }
79
+
80
+ @keyframes roll-in {
81
+ from {
82
+ opacity: 0;
83
+ translate: 0 calc(var(--roll, 1) * 0.6em);
84
+ filter: blur(2px);
85
+ }
86
+ }
87
+
88
+ @keyframes fade-out {
89
+ from {
90
+ opacity: 1;
91
+ }
92
+ to {
93
+ opacity: 0;
94
+ }
95
+ }
96
+ }
97
+
98
+ @layer base {
99
+ *,
100
+ ::after,
101
+ ::before,
102
+ ::backdrop,
103
+ ::file-selector-button {
104
+ border-color: var(--color-border, currentColor);
105
+ }
106
+
107
+ body {
108
+ background-color: var(--color-background);
109
+ color: var(--color-foreground);
110
+ }
111
+ }
112
+
113
+ @utility scroll-container {
114
+ &::-webkit-scrollbar {
115
+ width: 5px;
116
+ height: 5px;
117
+ }
118
+
119
+ &::-webkit-scrollbar-thumb {
120
+ border-radius: 5px;
121
+ background: var(--color-border);
122
+ }
123
+
124
+ &::-webkit-scrollbar-track {
125
+ background: transparent;
126
+ }
127
+
128
+ &::-webkit-scrollbar-corner {
129
+ display: none;
130
+ }
131
+ }
132
+
133
+ @utility fd-steps {
134
+ counter-reset: step;
135
+ position: relative;
136
+ @apply ps-6 ms-2 border-s sm:ms-4 sm:ps-7;
137
+ }
138
+
139
+ @utility fd-step {
140
+ &:before {
141
+ background-color: var(--color-secondary);
142
+ color: var(--color-secondary-foreground);
143
+ content: counter(step);
144
+ counter-increment: step;
145
+ justify-content: center;
146
+ align-items: center;
147
+ font-size: 0.875rem;
148
+ line-height: 1.25rem;
149
+ display: flex;
150
+ position: absolute;
151
+ @apply size-8 -inset-s-4 rounded-full;
152
+ }
153
+ }
154
+
155
+ @utility prose-no-margin {
156
+ & > :first-child {
157
+ margin-top: 0;
158
+ }
159
+
160
+ & > :last-child {
161
+ margin-bottom: 0;
162
+ }
163
+ }
164
+
165
+ @variant dark (&:where(.dark, .dark *));
166
+
167
+ /* define/override layout variables */
168
+ @variant layout {
169
+ #docs-layout:has(&),
170
+ #notebook-layout:has(&),
171
+ #home-layout:has(&),
172
+ #flux-layout:has(&),
173
+ #glass-layout:has(&),
174
+ #spacious-layout:has(&) {
175
+ @slot;
176
+ }
177
+ }
178
+
179
+ /* to transition the columns alone */
180
+ @property --sidebar-col {
181
+ syntax: '<length>';
182
+ inherits: true;
183
+ initial-value: 0px;
184
+ }
185
+
186
+ @property --ai-chat-col {
187
+ syntax: '<length>';
188
+ inherits: true;
189
+ initial-value: 0px;
190
+ }
191
+
192
+ .fd-page-tree-item-name {
193
+ @apply inline-flex items-center gap-1 w-full;
194
+ }