Skip to content
Merged

Updates #1199

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
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
coverage
dist
e2e
node_modules
test
website/.next
website/node_modules
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,7 @@ Next.js 16 documentation and demo site in `website/`. Imports library via local
- `ConfigContext` — centralized tour configuration for demos
- `website/src/components/` — 33 components (ConfigPanel, custom tour components, code blocks, navigation)
- `website/src/config/` — sidebar nav, default values, hero content

## Visual Customization
- Visual/cosmetic options (colors, borders, sizes) belong in `styles.*`, not as new Options fields.
- Before adding a new option for appearance, check if it fits an existing or new `styles` key.
Binary file modified e2e/__snapshots__/scroll/step1-beacon-chromium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step1-beacon-firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step1-beacon-webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step1-tooltip-chromium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step1-tooltip-firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step1-tooltip-webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step2-tooltip-chromium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step2-tooltip-firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step2-tooltip-webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step3-tooltip-chromium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step3-tooltip-firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step3-tooltip-webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step4-tooltip-chromium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step4-tooltip-firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step4-tooltip-webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step5-tooltip-chromium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step5-tooltip-firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/step5-tooltip-webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/tour-end-chromium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/tour-end-firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/__snapshots__/scroll/tour-end-webkit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.18.2",
"@gilbarbara/eslint-config": "^1.0.4",
"@gilbarbara/eslint-config": "^1.1.0",
"@gilbarbara/prettier-config": "^1.0.0",
"@gilbarbara/tsconfig": "^1.0.0",
"@playwright/test": "^1.58.2",
"@size-limit/preset-big-lib": "^12.0.1",
"@swc/core": "^1.15.18",
"@swc/core": "^1.15.21",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
Expand All @@ -69,23 +69,22 @@
"@types/scrollparent": "^2.0.3",
"@types/use-sync-external-store": "^1.5.0",
"@vitejs/plugin-react-swc": "^4.3.0",
"@vitest/coverage-v8": "^4.1.0",
"caniuse-lite": "^1.0.30001780",
"@vitest/coverage-v8": "^4.1.2",
"cross-env": "^10.1.0",
"del-cli": "^7.0.0",
"eslint": "^9.39.2",
"husky": "^9.1.7",
"jest-extended": "^7.0.0",
"jsdom": "^29.0.0",
"jsdom": "^29.0.1",
"prettier": "^3.8.1",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"repo-tools": "^0.3.1",
"size-limit": "^12.0.1",
"tsdown": "^0.21.4",
"tsdown": "^0.21.7",
"typescript": "^5.9.3",
"vite-tsconfig-paths": "^6.1.1",
"vitest": "^4.1.0"
"vitest": "^4.1.2"
},
"scripts": {
"build": "tsdown",
Expand Down
918 changes: 497 additions & 421 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/components/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ export default function JoyrideOverlay(props: OverlayProps) {
}}
/>
)}
{coverPath && Object.keys(styles.spotlight).length > 0 && (
<path d={coverPath} fill="none" style={{ pointerEvents: 'none' }} {...styles.spotlight} />
)}
</svg>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export default function getStyles(props: Props, step: StepMerged) {
...overlay,
backgroundColor: step.overlayColor,
},
spotlight: {},
tooltip: {
backgroundColor: step.backgroundColor,
borderRadius: 5,
Expand Down
4 changes: 3 additions & 1 deletion src/types/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CSSProperties, ReactNode } from 'react';
import type { CSSProperties, ReactNode, SVGAttributes } from 'react';

import { ACTIONS, EVENTS, LIFECYCLE, ORIGIN, STATUS } from '~/literals';

Expand Down Expand Up @@ -295,6 +295,8 @@ export interface Styles {
loader: CSSProperties;
/** Overlay backdrop styles. */
overlay: CSSProperties;
/** Spotlight styles (SVG Path). */
spotlight: SVGAttributes<SVGPathElement>;
/** Tooltip wrapper styles. */
tooltip: CSSProperties;
/** Tooltip inner container styles. */
Expand Down
5 changes: 5 additions & 0 deletions test/__snapshots__/styles.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ exports[`styles > should return styles.arrow.color over options.arrowColor (comp
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#ffffff",
"borderRadius": 5,
Expand Down Expand Up @@ -298,6 +299,7 @@ exports[`styles > should return styles.arrow.color over options.arrowColor (step
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#ffffff",
"borderRadius": 5,
Expand Down Expand Up @@ -464,6 +466,7 @@ exports[`styles > should return the default styles 1`] = `
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#ffffff",
"borderRadius": 5,
Expand Down Expand Up @@ -630,6 +633,7 @@ exports[`styles > should return the inherited props' styles 1`] = `
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#00f",
"borderRadius": 5,
Expand Down Expand Up @@ -796,6 +800,7 @@ exports[`styles > should return the step's styles 1`] = `
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#000",
"borderRadius": 5,
Expand Down
2 changes: 1 addition & 1 deletion test/hooks/useLifecycleEffect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ describe('useLifecycleEffect', () => {

expect(() => {
rerender({ ...options, step: stepB, state: state2, previousState: state1 });
}).not.toThrowError();
}).not.toThrow();

expect(options.emitEvent).toHaveBeenCalledWith(
EVENTS.STEP_AFTER,
Expand Down
2 changes: 1 addition & 1 deletion test/hooks/usePortalElement.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('usePortalElement', () => {
// Simulate external removal before unmount
portal?.remove();

expect(() => unmount()).not.toThrowError();
expect(() => unmount()).not.toThrow();
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/hooks/useTourEngine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ describe('useTourEngine', () => {
it('should not crash with empty steps', () => {
expect(() => {
renderHook(() => useTourEngine(createProps({ steps: [] })));
}).not.toThrowError();
}).not.toThrow();
});

it('should use TOOLTIP for center placement (beacon hidden)', async () => {
Expand Down
6 changes: 6 additions & 0 deletions test/modules/__snapshots__/step.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ exports[`step > getMergedStep > should allow options to override defaultStep 1`]
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#ffffff",
"borderRadius": 5,
Expand Down Expand Up @@ -410,6 +411,7 @@ exports[`step > getMergedStep > should allow step props to override options 1`]
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#ffffff",
"borderRadius": 5,
Expand Down Expand Up @@ -582,6 +584,7 @@ exports[`step > getMergedStep > should include styles in the merged step 1`] = `
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#ffffff",
"borderRadius": 5,
Expand Down Expand Up @@ -801,6 +804,7 @@ exports[`step > getMergedStep > should merge defaultStep values 1`] = `
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#ffffff",
"borderRadius": 5,
Expand Down Expand Up @@ -1047,6 +1051,7 @@ exports[`step > getMergedStep > should merge scrollOffset from props 1`] = `
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#ffffff",
"borderRadius": 5,
Expand Down Expand Up @@ -1272,6 +1277,7 @@ exports[`step > getMergedStep > should preserve unset options defaults when part
"top": 0,
"zIndex": 100,
},
"spotlight": {},
"tooltip": {
"backgroundColor": "#ffffff",
"borderRadius": 5,
Expand Down
4 changes: 2 additions & 2 deletions test/modules/helpers.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ describe('helpers', () => {

it('should throw for bad inputs', () => {
// @ts-expect-error - invalid value
expect(() => omit(['a'])).toThrowError('Expected an object');
expect(() => omit(['a'])).toThrow('Expected an object');
});
});

Expand All @@ -282,7 +282,7 @@ describe('helpers', () => {

it('should throw for bad inputs', () => {
// @ts-expect-error - invalid value
expect(() => pick(['a'])).toThrowError('Expected an object');
expect(() => pick(['a'])).toThrow('Expected an object');
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/modules/store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ describe('store', () => {

expect(() => {
store.dispatch(createEventData({ type: EVENTS.TOOLTIP }), mockControls);
}).not.toThrowError();
}).not.toThrow();
});

it('should isolate errors between handlers', () => {
Expand Down
35 changes: 35 additions & 0 deletions website/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM node:22-alpine AS base

RUN corepack enable && corepack prepare pnpm@latest --activate
Comment thread
gilbarbara marked this conversation as resolved.

FROM base AS builder

WORKDIR /app
COPY . .

RUN pnpm install --frozen-lockfile && \
pnpm --dir website install --frozen-lockfile && \
pnpm build && \
pnpm --dir website build

FROM base AS runner

WORKDIR /app

ENV NODE_ENV=production

RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs

COPY --from=builder /app/website/public ./website/public
COPY --from=builder --chown=nextjs:nodejs /app/website/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/website/.next/static ./website/.next/static

USER nextjs

EXPOSE 3000

ENV PORT=3000
ENV HOSTNAME=0.0.0.0

CMD ["node", "website/server.js"]
14 changes: 14 additions & 0 deletions website/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
website:
build:
context: ..
dockerfile: website/Dockerfile
environment:
- NODE_ENV=production
restart: unless-stopped
Comment thread
gilbarbara marked this conversation as resolved.
networks:
- joyride-network

networks:
joyride-network:
driver: bridge
1 change: 1 addition & 0 deletions website/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const vendoredRsc = path.resolve(
);

const nextConfig: NextConfig = {
output: 'standalone',
pageExtensions: ['ts', 'tsx'],
reactStrictMode: true,
outputFileTracingRoot: path.resolve(import.meta.dirname, '..'),
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"scripts": {
"dev": "next dev --webpack",
"build": "next build --webpack",
"start": "next start",
"start": "./scripts/start.sh",
"lint": "eslint --fix src",
"typecheck": "tsc --noEmit"
},
Expand Down
14 changes: 14 additions & 0 deletions website/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
set -e

STANDALONE_DIR=".next/standalone/website"

if [ ! -d "$STANDALONE_DIR" ]; then
echo "Error: standalone build not found. Run 'pnpm build' first."
exit 1
fi

[ -d "$STANDALONE_DIR/public" ] || cp -r public "$STANDALONE_DIR/public"
[ -d "$STANDALONE_DIR/.next/static" ] || cp -r .next/static "$STANDALONE_DIR/.next/static"

exec node "$STANDALONE_DIR/server.js"
2 changes: 1 addition & 1 deletion website/src/app/demos/overview/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import Overview from './Overview';

export const metadata: Metadata = { title: 'Overview (Demo)' };

export default function BasicPage() {
export default function OverviewPage() {
return <Overview />;
}
25 changes: 22 additions & 3 deletions website/src/app/demos/scroll/Scroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import { useConfig } from '~/context/ConfigContext';
import useTheme from '~/hooks/useTheme';
import { getTourColors, logGroup, mergeProps } from '~/modules/helpers';

import Code from '~/components/Code';
import Container from '~/components/Container';
import Tip from '~/components/Tip';

interface State {
run: boolean;
Expand All @@ -18,8 +20,15 @@ interface State {

const steps: Step[] = [
{
content:
'This showcase lives inside a scrollable container. The tour scrolls within it automatically.',
content: (
<div>
<p>This tour scrolls inside a custom container automatically.</p>
<Tip>
This demo uses <Code color="primary">styles.spotlight</Code> to add a subtle border around
the spotlight.
</Tip>
</div>
),
target: '.ds__header',
title: 'Custom Scroll Parent',
},
Expand Down Expand Up @@ -77,7 +86,17 @@ export default function Scroll() {
({
continuous: true,
scrollToFirstStep: true,
options: getTourColors(isDarkMode),
options: {
...getTourColors(isDarkMode),
spotlightPadding: 16,
spotlightRadius: 16,
},
styles: {
spotlight: {
stroke: isDarkMode ? '#ff5e5e99' : '#ff5e5e',
strokeWidth: '2px',
},
},
}) satisfies Omit<Props, 'steps'>,
[isDarkMode],
);
Expand Down
Loading
Loading