Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
868 changes: 258 additions & 610 deletions bun.lock

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"turbo": "^2.5.8",
"vercel": "^39.4.2"
},
"packageManager": "bun@1.2.15",
"packageManager": "bun@1.3.0",
"overrides": {
"@codemirror/state": "6.4.1",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"react": "catalog:",
"react-dom": "catalog:",
"esbuild": "0.24.2"
Expand All @@ -35,7 +37,12 @@
"workspaces": {
"packages": ["packages/*"],
"catalog": {
"@tsconfig/strictest": "^2.0.6",
"@tsconfig/node20": "^20.1.6",
"@gitbook/api": "0.143.2",
"@scalar/api-client-react": "^1.3.46",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"assert-never": "^1.4.0",
"bidc": "^0.0.2",
"bun-types": "^1.1.20",
Expand All @@ -44,7 +51,7 @@
"react-dom": "^19.0.0",
"tsdown": "^0.15.6",
"typescript": "^5.5.3",
"usehooks-ts": "^3.1.0"
"usehooks-ts": "^3.1.1"
}
},
"patchedDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/browser-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@gitbook/icons": "workspace:"
},
"devDependencies": {
"bun-types": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
Expand Down
1 change: 1 addition & 0 deletions packages/cache-tags/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"assert-never": "catalog:"
},
"devDependencies": {
"bun-types": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
Expand Down
1 change: 1 addition & 0 deletions packages/colors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"sideEffects": false,
"version": "0.4.2",
"devDependencies": {
"bun-types": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
Expand Down
1 change: 1 addition & 0 deletions packages/embed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"react": "*"
},
"devDependencies": {
"@types/react": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
"react": "catalog:"
Expand Down
5 changes: 4 additions & 1 deletion packages/expr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
"eval-estree-expression": "github:jonschlinkert/eval-estree-expression#9cf28d2"
},
"devDependencies": {
"@tsconfig/strictest": "catalog:",
"@tsconfig/node20": "catalog:",
"@types/escodegen": "^0.0.10",
"@types/estree": "^1.0.6",
"@types/json-schema": "^7.0.15",
"bun-types": "catalog:",
"tsdown": "catalog:"
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
"build": "tsdown",
Expand Down
1 change: 1 addition & 0 deletions packages/fonts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@gitbook/api": "catalog:"
},
"devDependencies": {
"bun-types": "catalog:",
"google-font-metadata": "^6.0.7",
"tsdown": "catalog:",
"typescript": "catalog:"
Expand Down
19 changes: 12 additions & 7 deletions packages/gitbook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@
"version": "0.19.2",
"private": true,
"dependencies": {
"@cloudflare/workers-types": "^4.20251011.0",
"@gitbook/api": "catalog:",
"@gitbook/browser-types": "workspace:*",
"@gitbook/cache-tags": "workspace:*",
"@gitbook/colors": "workspace:*",
"@gitbook/emoji-codepoints": "workspace:*",
"@gitbook/expr": "workspace:*",
"@gitbook/embed": "workspace:*",
"@gitbook/fonts": "workspace:*",
"@gitbook/icons": "workspace:*",
"@gitbook/openapi-parser": "workspace:*",
"@gitbook/react-contentkit": "workspace:*",
"@gitbook/react-math": "workspace:*",
"@gitbook/react-openapi": "workspace:*",
"@modelcontextprotocol/sdk": "^1.17.5",
"@opennextjs/cloudflare": "^1.9.2",
"@opennextjs/aws": "^3.8.5",
"@opennextjs/cloudflare": "^1.11.0",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.1.12",
"@radix-ui/react-hover-card": "^1.1.15",
Expand All @@ -33,12 +36,10 @@
"classnames": "catalog:",
"direction": "^2.0.1",
"event-iterator": "^2.0.0",
"framer-motion": "^10.16.14",
"image-size": "^2.0.2",
"js-cookie": "^3.0.5",
"jsontoxml": "^1.0.1",
"jwt-decode": "^4.0.0",
"mathjax": "^3.2.2",
"mcp-handler": "^1.0.2",
"mdast-util-from-markdown": "^2.0.2",
"mdast-util-frontmatter": "^2.0.1",
Expand All @@ -47,7 +48,7 @@
"memoizee": "^0.4.17",
"micromark-extension-frontmatter": "^2.0.0",
"micromark-extension-gfm": "^3.0.0",
"motion": "^12.23.12",
"motion": "^12.23.24",
"next": "15.4.0",
"next-themes": "^0.4.6",
"nuqs": "^2.2.3",
Expand All @@ -56,6 +57,8 @@
"openapi-types": "^12.1.3",
"p-map": "^7.0.3",
"quick-lru": "^7.0.1",
"react": "catalog:",
"react-dom": "catalog:",
"react-hotkeys-hook": "^4.4.1",
"rehype-sanitize": "^6.0.0",
"rehype-stringify": "^10.0.1",
Expand All @@ -79,6 +82,7 @@
"devDependencies": {
"@argos-ci/playwright": "^5.0.9",
"@playwright/test": "^1.54.2",
"@scalar/api-client-react": "catalog:",
"@tailwindcss/postcss": "^4.1.11",
"@types/js-cookie": "^3.0.6",
"@types/jsontoxml": "^1.0.5",
Expand All @@ -87,8 +91,8 @@
"@types/node": "^20",
"@types/object-hash": "^3.0.6",
"@types/parse-cache-control": "^1.0.4",
"@types/react": "18.3.13",
"@types/react-dom": "18.3.1",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@types/rison": "^0.0.9",
"bun-types": "catalog:",
"deepmerge": "^4.3.1",
Expand All @@ -99,7 +103,8 @@
"tailwindcss": "^4.1.11",
"ts-essentials": "^10.0.1",
"typescript": "catalog:",
"vercel": "^39.3.0"
"vercel": "^39.3.0",
"wrangler": "^4.43.0"
},
"scripts": {
"generate": "./scripts/generate.sh",
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/AIChat/AIChatMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AIChatFollowupSuggestions } from './AiChatFollowupSuggestions';
export function AIChatMessages(props: {
chat: AIChatState;
chatController: AIChatController;
lastUserMessageRef?: React.RefObject<HTMLDivElement>;
lastUserMessageRef?: React.RefObject<HTMLDivElement | null>;
}) {
const { chat, chatController, lastUserMessageRef } = props;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function HideToolbarButton(props: HideToolbarButtonProps) {
}
setOpen(false);
};
// @ts-expect-error wrong type for ref
useOnClickOutside(ref, handleClickOutsideArcMenu);

// Close arc menu on scroll
Expand Down
6 changes: 5 additions & 1 deletion packages/gitbook/src/components/AdminToolbar/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
useReducedMotion,
useSpring,
} from 'motion/react';
import React from 'react';
import React, { isValidElement } from 'react';
import { AnimatedLogo } from './AnimatedLogo';
import { useToolbarControls } from './ToolbarControlsContext';

Expand Down Expand Up @@ -291,6 +291,10 @@ function ToolbarButtonWrapper(props: {
x: springX,
};

if (!isValidElement<{ motionValues: typeof motionValues }>(child)) {
return null;
}

return React.cloneElement(child, {
motionValues,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const calculateSpacing = (

export function useMagnificationEffect(props: {
childrenCount: number;
containerRef: React.RefObject<HTMLElement>;
containerRef: React.RefObject<HTMLElement | null>;
config?: MagnificationConfig;
}) {
const { childrenCount, containerRef, config } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function PageCoverImage({ imgs, y }: { imgs: Images; y: number }) {
const containerRef = useRef<HTMLDivElement>(null);

const container = useResizeObserver({
// @ts-expect-error wrong types
ref: containerRef,
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { Icon, type IconName } from '@gitbook/icons';
import { motion } from 'framer-motion';
import { motion } from 'motion/react';
import React from 'react';

import { type ClassValue, tcls } from '@/lib/tailwind';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const TOC_ITEM_OFFSET = 100;
* Scrolls the table of contents container to the page item when it's initially active.
*/
export function useScrollToActiveTOCItem(props: {
anchorRef: React.RefObject<HTMLAnchorElement>;
anchorRef: React.RefObject<HTMLAnchorElement | null>;
isActive: boolean;
}) {
const { isActive, anchorRef } = props;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { Icon } from '@gitbook/icons';
import { motion } from 'framer-motion';
import { motion } from 'motion/react';
import React, { useRef } from 'react';

import { tcls } from '@/lib/tailwind';
Expand Down Expand Up @@ -196,9 +196,9 @@ function Descendants(props: {
const { isVisible, children } = props;
return (
<motion.div
className="overflow-hidden"
animate={isVisible ? show : hide}
initial={isVisible ? show : hide}
style={{ overflow: 'hidden' }}
>
{children}
</motion.div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const HAS_INTERSECTION_OBSERVER = typeof IntersectionObserver !== 'undefined';
* Return true if the element has been in the viewport once.
*/
export function useHasBeenInViewport(
containerRef: React.RefObject<HTMLElement>,
containerRef: React.RefObject<HTMLElement | null>,
options?: Pick<IntersectionObserverInit, 'root' | 'rootMargin' | 'threshold'>
) {
const [visible, setVisible] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const HAS_INTERSECTION_OBSERVER = typeof IntersectionObserver !== 'undefined';
* Watch an element to know when it is in the viewport.
*/
export function useInViewportListener(
containerRef: React.RefObject<HTMLElement>,
containerRef: React.RefObject<HTMLElement | null>,
listener: (isIntersecting: boolean, disconnect: () => void) => void,
options?: Pick<IntersectionObserverInit, 'root' | 'rootMargin' | 'threshold'>
) {
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/hooks/useScrollListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { type RefObject, useEffect, useLayoutEffect, useRef } from 'react';
*/
export function useScrollListener(
listener: (event: Event) => void,
elementRef: RefObject<HTMLElement | Window> | null
elementRef: RefObject<HTMLElement | Window | null> | null
) {
const listenerRef = useRef(listener);
useLayoutEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { stagger, useAnimate } from 'framer-motion';
import { stagger, useAnimate } from 'motion/react';
import React, { useLayoutEffect } from 'react';

const show = {
Expand Down
4 changes: 2 additions & 2 deletions packages/gitbook/src/intl/translate.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { isValidElement } from 'react';

import type { TranslationKey, TranslationLanguage } from './translations';

Expand Down Expand Up @@ -70,7 +70,7 @@ function reactToString(el: React.ReactNode): string {
return el.map(reactToString).join('');
}

if (typeof el === 'object' && 'props' in el) {
if (isValidElement<{ children: string[] }>(el)) {
return el.props.children.map(reactToString).join('');
}

Expand Down
2 changes: 2 additions & 0 deletions packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"@gitbook/fontawesome-pro": "1.0.15"
},
"devDependencies": {
"bun-types": "catalog:",
"@types/react": "catalog:",
"react": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
Expand Down
4 changes: 2 additions & 2 deletions packages/openapi-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"@scalar/openapi-types": "^0.3.7"
},
"devDependencies": {
"@tsconfig/strictest": "^2.0.6",
"@tsconfig/node20": "^20.1.6",
"@tsconfig/strictest": "catalog:",
"@tsconfig/node20": "catalog:",
"@types/swagger2openapi": "^7.0.4",
"bun-types": "catalog:",
"tsdown": "catalog:",
Expand Down
2 changes: 2 additions & 0 deletions packages/react-contentkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"react": "*"
},
"devDependencies": {
"@types/react": "catalog:",
"react": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
Expand Down
1 change: 1 addition & 0 deletions packages/react-contentkit/src/ElementWebframe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export function ElementWebframe(props: ContentKitClientElementProps<ContentKitWe
return sendMessage({ state });
}, [element.data, renderer.state, sendMessage]);

// @ts-expect-error type definition is wrong for useResizeObserver
const { width: observedWidth = 0 } = useResizeObserver({ ref: iframeRef });
const liveWidth = observedWidth || iframeRef.current?.clientWidth || 0;

Expand Down
5 changes: 5 additions & 0 deletions packages/react-math/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@
"sideEffects": false,
"dependencies": {
"katex": "^0.16.25",
"mathjax": "^3.2.2",
"object-hash": "^3.0.0"
},
"peerDependencies": {
"react": "*"
},
"devDependencies": {
"@types/katex": "^0.16.7",
"@types/react": "catalog:",
"bun-types": "catalog:",
"react": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
Expand Down
Loading