create-skybridge 0.0.0-dev.1fc2094 → 0.0.0-dev.1fd0170

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 (78) hide show
  1. package/dist/index.js +24 -46
  2. package/package.json +2 -2
  3. package/templates/blank/node_modules/.bin/alpic +2 -2
  4. package/templates/blank/node_modules/.bin/tsx +2 -2
  5. package/templates/blank/node_modules/.bin/vite +2 -2
  6. package/templates/blank/package.json +6 -6
  7. package/templates/blank/vite.config.ts +6 -0
  8. package/templates/demo/node_modules/.bin/alpic +2 -2
  9. package/templates/demo/node_modules/.bin/tsx +2 -2
  10. package/templates/demo/node_modules/.bin/vite +2 -2
  11. package/templates/demo/package.json +10 -10
  12. package/templates/demo/vite.config.ts +6 -0
  13. package/templates/ecom/.dockerignore +0 -4
  14. package/templates/ecom/.env.template +0 -2
  15. package/templates/ecom/.ladle/components.tsx +0 -26
  16. package/templates/ecom/.ladle/config.mjs +0 -11
  17. package/templates/ecom/.ladle/vite.config.ts +0 -11
  18. package/templates/ecom/AGENTS.md +0 -2
  19. package/templates/ecom/Dockerfile +0 -53
  20. package/templates/ecom/README.md +0 -92
  21. package/templates/ecom/_gitignore +0 -9
  22. package/templates/ecom/alpic.json +0 -3
  23. package/templates/ecom/node_modules/.bin/alpic +0 -21
  24. package/templates/ecom/node_modules/.bin/ladle +0 -21
  25. package/templates/ecom/node_modules/.bin/sb +0 -21
  26. package/templates/ecom/node_modules/.bin/skybridge +0 -21
  27. package/templates/ecom/node_modules/.bin/tsc +0 -21
  28. package/templates/ecom/node_modules/.bin/tsserver +0 -21
  29. package/templates/ecom/node_modules/.bin/tsx +0 -21
  30. package/templates/ecom/node_modules/.bin/vite +0 -21
  31. package/templates/ecom/package.json +0 -41
  32. package/templates/ecom/src/components/chip.css.ts +0 -56
  33. package/templates/ecom/src/components/chip.stories.tsx +0 -26
  34. package/templates/ecom/src/components/chip.tsx +0 -41
  35. package/templates/ecom/src/components/empty-state.stories.tsx +0 -3
  36. package/templates/ecom/src/components/empty-state.tsx +0 -12
  37. package/templates/ecom/src/components/expandable-text.css.ts +0 -49
  38. package/templates/ecom/src/components/expandable-text.stories.tsx +0 -20
  39. package/templates/ecom/src/components/expandable-text.tsx +0 -53
  40. package/templates/ecom/src/components/image-gallery.css.ts +0 -172
  41. package/templates/ecom/src/components/image-gallery.stories.tsx +0 -30
  42. package/templates/ecom/src/components/image-gallery.tsx +0 -163
  43. package/templates/ecom/src/components/product-card.css.ts +0 -159
  44. package/templates/ecom/src/components/product-card.stories.tsx +0 -58
  45. package/templates/ecom/src/components/product-card.tsx +0 -102
  46. package/templates/ecom/src/components/product-carousel.css.ts +0 -134
  47. package/templates/ecom/src/components/product-carousel.stories.tsx +0 -64
  48. package/templates/ecom/src/components/product-carousel.tsx +0 -202
  49. package/templates/ecom/src/components/variant-picker.css.ts +0 -27
  50. package/templates/ecom/src/components/variant-picker.stories.tsx +0 -64
  51. package/templates/ecom/src/components/variant-picker.tsx +0 -82
  52. package/templates/ecom/src/components/view-frame.css.ts +0 -22
  53. package/templates/ecom/src/components/view-frame.tsx +0 -27
  54. package/templates/ecom/src/config.ts +0 -12
  55. package/templates/ecom/src/design/contract.css.ts +0 -39
  56. package/templates/ecom/src/design/fonts.css +0 -15
  57. package/templates/ecom/src/design/primitives.css.ts +0 -101
  58. package/templates/ecom/src/design/recipes/typography.css.ts +0 -75
  59. package/templates/ecom/src/design/sprinkles.css.ts +0 -128
  60. package/templates/ecom/src/design/themes/dark.css.ts +0 -36
  61. package/templates/ecom/src/design/themes/light.css.ts +0 -36
  62. package/templates/ecom/src/design/tokens.ts +0 -8
  63. package/templates/ecom/src/helpers.ts +0 -4
  64. package/templates/ecom/src/i18n.ts +0 -35
  65. package/templates/ecom/src/index.css +0 -9
  66. package/templates/ecom/src/lib/cx.ts +0 -9
  67. package/templates/ecom/src/lib/format.ts +0 -9
  68. package/templates/ecom/src/lib/variants.ts +0 -79
  69. package/templates/ecom/src/server.ts +0 -43
  70. package/templates/ecom/src/tools/render-carousel.ts +0 -241
  71. package/templates/ecom/src/tools/search-products.ts +0 -185
  72. package/templates/ecom/src/types.ts +0 -15
  73. package/templates/ecom/src/views/carousel/detail/detail.css.ts +0 -115
  74. package/templates/ecom/src/views/carousel/detail/detail.stories.tsx +0 -115
  75. package/templates/ecom/src/views/carousel/detail/index.tsx +0 -240
  76. package/templates/ecom/src/views/carousel/index.tsx +0 -234
  77. package/templates/ecom/tsconfig.json +0 -11
  78. package/templates/ecom/vite.config.ts +0 -8
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/typescript@6.0.3/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/typescript@6.0.3/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@"
19
- else
20
- exec node "$basedir/../typescript/bin/tsc" "$@"
21
- fi
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/typescript@6.0.3/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/typescript@6.0.3/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@"
19
- else
20
- exec node "$basedir/../typescript/bin/tsserver" "$@"
21
- fi
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/tsx@4.23.0/node_modules/tsx/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/tsx@4.23.0/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/tsx@4.23.0/node_modules/tsx/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/tsx@4.23.0/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@"
19
- else
20
- exec node "$basedir/../tsx/dist/cli.mjs" "$@"
21
- fi
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
- basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
-
4
- case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*)
6
- if command -v cygpath > /dev/null 2>&1; then
7
- basedir=`cygpath -w "$basedir"`
8
- fi
9
- ;;
10
- esac
11
-
12
- if [ -z "$NODE_PATH" ]; then
13
- export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@8.1.3_@types+node@24.13.2_esbuild@0.28.1_jiti@2.7.0_terser@5.44.1_tsx@4.23.0_yaml@2.8.2/node_modules/vite/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@8.1.3_@types+node@24.13.2_esbuild@0.28.1_jiti@2.7.0_terser@5.44.1_tsx@4.23.0_yaml@2.8.2/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
14
- else
15
- export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@8.1.3_@types+node@24.13.2_esbuild@0.28.1_jiti@2.7.0_terser@5.44.1_tsx@4.23.0_yaml@2.8.2/node_modules/vite/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/vite@8.1.3_@types+node@24.13.2_esbuild@0.28.1_jiti@2.7.0_terser@5.44.1_tsx@4.23.0_yaml@2.8.2/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
16
- fi
17
- if [ -x "$basedir/node" ]; then
18
- exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
19
- else
20
- exec node "$basedir/../vite/bin/vite.js" "$@"
21
- fi
@@ -1,41 +0,0 @@
1
- {
2
- "name": "skybridge-ecom",
3
- "version": "0.0.1",
4
- "private": true,
5
- "description": "Skybridge MCP ecommerce template",
6
- "type": "module",
7
- "scripts": {
8
- "dev": "skybridge dev",
9
- "dev:tunnel": "skybridge dev --tunnel",
10
- "build": "skybridge build",
11
- "start": "skybridge start",
12
- "deploy": "alpic deploy",
13
- "ladle": "ladle serve",
14
- "ladle:build": "ladle build"
15
- },
16
- "dependencies": {
17
- "react": "^19.2.4",
18
- "react-dom": "^19.2.4",
19
- "skybridge": "^0.0.0-dev.1fc2094",
20
- "vite": "^8.1.3",
21
- "zod": "^4.4.3"
22
- },
23
- "devDependencies": {
24
- "@ladle/react": "^5.1.1",
25
- "@skybridge/devtools": "^1.2.4",
26
- "@types/node": "^24.13.2",
27
- "@types/react": "^19.2.14",
28
- "@types/react-dom": "^19.2.3",
29
- "@vanilla-extract/css": "^1.20.1",
30
- "@vanilla-extract/recipes": "^0.5.7",
31
- "@vanilla-extract/sprinkles": "^1.6.5",
32
- "@vanilla-extract/vite-plugin": "^5.2.2",
33
- "@vitejs/plugin-react": "^6.0.1",
34
- "alpic": "^1.147.1",
35
- "tsx": "^4.23.0",
36
- "typescript": "^6.0.3"
37
- },
38
- "engines": {
39
- "node": ">=24.18.0"
40
- }
41
- }
@@ -1,56 +0,0 @@
1
- import { style } from "@vanilla-extract/css";
2
- import { recipe } from "@vanilla-extract/recipes";
3
- import { colors, primitives } from "../design/tokens";
4
-
5
- // A selectable pill used for option values (sizes, colors…). `selected` and
6
- // `disabled` are driven by the variant picker from the sparse variant list.
7
- // @todo: tune the chip to your brand (radius, borders, selected treatment).
8
- export const chip = recipe({
9
- base: {
10
- display: "inline-flex",
11
- alignItems: "center",
12
- gap: primitives.space["4xs"],
13
- minHeight: "44px", // touch target
14
- padding: `${primitives.space["4xs"]} ${primitives.space["3xs"]}`,
15
- borderRadius: primitives.radius.m,
16
- border: `${primitives.stroke.thin} solid ${colors.border.subtle}`,
17
- backgroundColor: colors.surface.extraLight,
18
- color: colors.content.intense,
19
- fontFamily: primitives.font.family.primary,
20
- fontSize: primitives.font.size.s,
21
- cursor: "pointer",
22
- transition: "border-color 150ms ease",
23
- "@media": {
24
- "(prefers-reduced-motion: reduce)": { transition: "none" },
25
- },
26
- },
27
- variants: {
28
- selected: {
29
- true: {
30
- borderColor: colors.common.accent,
31
- borderWidth: primitives.stroke.medium,
32
- },
33
- false: {},
34
- },
35
- disabled: {
36
- // Unreachable value given the other choices: greyed and struck, but kept
37
- // visible so the client sees the axis exists (never silently hidden).
38
- true: {
39
- cursor: "not-allowed",
40
- opacity: 0.4,
41
- textDecoration: "line-through",
42
- },
43
- false: {},
44
- },
45
- },
46
- defaultVariants: { selected: false, disabled: false },
47
- });
48
-
49
- // Small color/material swatch shown before the label on image chips.
50
- export const swatch = style({
51
- width: "20px",
52
- height: "20px",
53
- borderRadius: primitives.radius.full,
54
- objectFit: "cover",
55
- display: "block",
56
- });
@@ -1,26 +0,0 @@
1
- import { Chip } from "./chip";
2
-
3
- const SWATCH =
4
- "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Crect width='20' height='20' fill='%233b6cf0'/%3E%3C/svg%3E";
5
-
6
- const row = {
7
- display: "flex",
8
- gap: 8,
9
- flexWrap: "wrap" as const,
10
- maxWidth: 320,
11
- };
12
-
13
- export const States = () => (
14
- <div style={row}>
15
- <Chip label="M" />
16
- <Chip label="L" selected />
17
- <Chip label="XL" disabled />
18
- </div>
19
- );
20
-
21
- export const WithSwatch = () => (
22
- <div style={row}>
23
- <Chip label="Blue" media={SWATCH} selected />
24
- <Chip label="Black" media={SWATCH} />
25
- </div>
26
- );
@@ -1,41 +0,0 @@
1
- import * as styles from "./chip.css";
2
-
3
- type ChipProps = {
4
- label: string;
5
- selected?: boolean;
6
- disabled?: boolean;
7
- onSelect?: () => void;
8
- // Optional swatch image (e.g. one per color); omit for a plain text chip.
9
- media?: string;
10
- };
11
-
12
- /**
13
- * One option value as a selectable pill. Rendered as a `radio` inside the
14
- * variant picker's `radiogroup`; the picker owns selection state and passes
15
- * `selected`/`disabled` computed from the sparse variant list.
16
- */
17
- export function Chip({
18
- label,
19
- selected,
20
- disabled,
21
- onSelect,
22
- media,
23
- }: ChipProps) {
24
- return (
25
- // biome-ignore lint/a11y/useSemanticElements: custom radio; a styled button carries the swatch and disabled state a native radio cannot, inside the picker radiogroup.
26
- <button
27
- type="button"
28
- role="radio"
29
- aria-checked={selected ?? false}
30
- aria-disabled={disabled ?? false}
31
- disabled={disabled}
32
- className={styles.chip({ selected, disabled })}
33
- onClick={disabled ? undefined : onSelect}
34
- >
35
- {media ? (
36
- <img className={styles.swatch} src={media} alt="" draggable={false} />
37
- ) : null}
38
- {label}
39
- </button>
40
- );
41
- }
@@ -1,3 +0,0 @@
1
- import { EmptyState } from "./empty-state";
2
-
3
- export const NoResults = () => <EmptyState message="No products to show." />;
@@ -1,12 +0,0 @@
1
- import { sprinkles, text } from "../design/tokens";
2
-
3
- /** Centered message shown when there is nothing to render (e.g. no results). */
4
- export function EmptyState({ message }: { message: string }) {
5
- return (
6
- <div
7
- className={sprinkles({ p: "l", textAlign: "center", color: "subtle" })}
8
- >
9
- <p className={text({ style: "bodyM" })}>{message}</p>
10
- </div>
11
- );
12
- }
@@ -1,49 +0,0 @@
1
- import { style } from "@vanilla-extract/css";
2
- import { recipe } from "@vanilla-extract/recipes";
3
- import { colors, primitives } from "../design/tokens";
4
-
5
- // @todo: collapsed height before "read more" appears. Tune to your type scale.
6
- const COLLAPSED_MAX_HEIGHT = "6em";
7
-
8
- export const container = style({
9
- display: "flex",
10
- flexDirection: "column",
11
- alignItems: "flex-start",
12
- gap: primitives.space["4xs"],
13
- });
14
-
15
- // `clamp` caps the height (applied whenever collapsed, so overflow can be
16
- // measured); `fade` masks the last line to a soft cutoff instead of an ellipsis
17
- // and is applied only when the text actually overflows (never on short copy).
18
- export const body = recipe({
19
- base: {
20
- color: colors.content.intense,
21
- whiteSpace: "pre-line", // preserve paragraph breaks from the source
22
- },
23
- variants: {
24
- clamp: {
25
- true: { maxHeight: COLLAPSED_MAX_HEIGHT, overflow: "hidden" },
26
- false: {},
27
- },
28
- fade: {
29
- true: {
30
- maskImage:
31
- "linear-gradient(to bottom, black 0%, black 55%, transparent 100%)",
32
- WebkitMaskImage:
33
- "linear-gradient(to bottom, black 0%, black 55%, transparent 100%)",
34
- },
35
- false: {},
36
- },
37
- },
38
- defaultVariants: { clamp: false, fade: false },
39
- });
40
-
41
- export const toggle = style({
42
- padding: 0,
43
- border: "none",
44
- background: "none",
45
- color: colors.common.accent,
46
- fontFamily: primitives.font.family.primary,
47
- fontSize: primitives.font.size.s,
48
- cursor: "pointer",
49
- });
@@ -1,20 +0,0 @@
1
- import { ExpandableText } from "./expandable-text";
2
-
3
- const frame = { maxWidth: 360 };
4
-
5
- const LONG =
6
- "A relaxed-fit jacket in water-repellent cotton.\n\nDropped shoulders, a two-way zip, and ribbed cuffs. Fully lined, with two zip pockets at the front and one inside. Designed to layer over a knit through the cooler months, and cut long enough to sit past the hip.";
7
-
8
- export const Long = () => (
9
- <div style={frame}>
10
- <ExpandableText>{LONG}</ExpandableText>
11
- </div>
12
- );
13
-
14
- export const Short = () => (
15
- <div style={frame}>
16
- <ExpandableText>
17
- A short description that never needs a toggle.
18
- </ExpandableText>
19
- </div>
20
- );
@@ -1,53 +0,0 @@
1
- import { useLayoutEffect, useRef, useState } from "react";
2
- import { text } from "../design/tokens";
3
- import { useLabels } from "../i18n";
4
- import { cx } from "../lib/cx";
5
- import * as styles from "./expandable-text.css";
6
-
7
- /**
8
- * Clamps long copy to a few lines with a "read more" toggle. Truncation is
9
- * measured, not assumed: the toggle only appears when the text actually
10
- * overflows the collapsed height, so short copy shows no button.
11
- */
12
- export function ExpandableText({ children }: { children: string }) {
13
- const labels = useLabels();
14
- const bodyRef = useRef<HTMLParagraphElement>(null);
15
- const [expanded, setExpanded] = useState(false);
16
- const [overflows, setOverflows] = useState(false);
17
-
18
- const collapsed = !expanded;
19
-
20
- // Measure against the collapsed height (the clamp is applied whenever
21
- // collapsed, so scrollHeight vs clientHeight is meaningful). Re-run when the
22
- // text changes (e.g. the client switches variant) so the toggle tracks it.
23
- // biome-ignore lint/correctness/useExhaustiveDependencies: children re-triggers the measure, it is not read in the body.
24
- useLayoutEffect(() => {
25
- const el = bodyRef.current;
26
- if (el && collapsed) {
27
- setOverflows(el.scrollHeight > el.clientHeight + 1);
28
- }
29
- }, [children, collapsed]);
30
-
31
- return (
32
- <div className={styles.container}>
33
- <p
34
- ref={bodyRef}
35
- className={cx(
36
- text({ style: "bodyS" }),
37
- styles.body({ clamp: collapsed, fade: collapsed && overflows }),
38
- )}
39
- >
40
- {children}
41
- </p>
42
- {overflows ? (
43
- <button
44
- type="button"
45
- className={styles.toggle}
46
- onClick={() => setExpanded((v) => !v)}
47
- >
48
- {expanded ? labels.readLess : labels.readMore}
49
- </button>
50
- ) : null}
51
- </div>
52
- );
53
- }
@@ -1,172 +0,0 @@
1
- import { globalStyle, style } from "@vanilla-extract/css";
2
- import { colors, primitives } from "../design/tokens";
3
-
4
- export const gallery = style({
5
- position: "relative",
6
- });
7
-
8
- // Rail mode only (THUMBNAIL_RAIL): lay the rail beside the image on desktop. The
9
- // breakpoint matches the PDP's two-column grid and resolves against the same
10
- // `.detail` container, so the rail appears exactly when the page goes two-column.
11
- export const galleryRail = style({
12
- "@container": {
13
- "(min-width: 560px)": {
14
- display: "flex",
15
- flexDirection: "row",
16
- gap: primitives.space["2xs"],
17
- // Top-align so the rail sits beside the image; the rail's own max-height
18
- // (set from the measured image height) caps it and scrolls the excess.
19
- alignItems: "flex-start",
20
- },
21
- },
22
- });
23
-
24
- // Image column: the positioning context for the overlaid chevrons, and the flex
25
- // child that takes the width left of the rail on desktop.
26
- export const mainCol = style({
27
- position: "relative",
28
- minWidth: 0,
29
- "@container": {
30
- "(min-width: 560px)": { flex: 1 },
31
- },
32
- });
33
-
34
- // Scroll-snap track: one image per view. Native swipe on touch; the chevrons
35
- // are the pointer affordance. Scrollbar hidden.
36
- export const track = style({
37
- display: "flex",
38
- overflowX: "auto",
39
- scrollSnapType: "x mandatory",
40
- scrollBehavior: "smooth",
41
- scrollbarWidth: "none",
42
- borderRadius: primitives.radius.m,
43
- "@media": {
44
- "(prefers-reduced-motion: reduce)": { scrollBehavior: "auto" },
45
- },
46
- });
47
-
48
- globalStyle(`${track}::-webkit-scrollbar`, { display: "none" });
49
-
50
- export const slide = style({
51
- flex: "0 0 100%",
52
- scrollSnapAlign: "start",
53
- // Reserve the box so images load without shifting the page. @todo: use the
54
- // same aspect ratio / fit you chose for the card from the real image sample.
55
- aspectRatio: "1",
56
- backgroundColor: colors.surface.subtle,
57
- });
58
-
59
- export const image = style({
60
- width: "100%",
61
- height: "100%",
62
- objectFit: "contain",
63
- display: "block",
64
- pointerEvents: "none",
65
- userSelect: "none",
66
- });
67
-
68
- // Prev/next chevrons, vertically centered, disabled at the ends.
69
- export const nav = style({
70
- position: "absolute",
71
- top: "50%",
72
- transform: "translateY(-50%)",
73
- display: "grid",
74
- placeItems: "center",
75
- width: "36px",
76
- height: "36px",
77
- padding: 0,
78
- borderRadius: primitives.radius.full,
79
- border: `${primitives.stroke.thin} solid ${colors.border.subtle}`,
80
- backgroundColor: colors.surface.extraLight,
81
- color: colors.content.intense,
82
- cursor: "pointer",
83
- transition: "opacity 150ms ease",
84
- selectors: {
85
- "&:disabled": { opacity: 0, pointerEvents: "none" },
86
- },
87
- });
88
-
89
- export const navPrev = style({ left: primitives.space["3xs"] });
90
- export const navNext = style({ right: primitives.space["3xs"] });
91
-
92
- // Position indicator: a thin track with a fill sized to (index + 1) / count.
93
- // @todo: style to your brand — height, track/fill colors, radius, width, and placement.
94
- export const progress = style({
95
- height: "3px",
96
- marginTop: primitives.space["3xs"],
97
- borderRadius: primitives.radius.full,
98
- backgroundColor: colors.border.thin,
99
- overflow: "hidden",
100
- });
101
-
102
- export const progressFill = style({
103
- height: "100%",
104
- borderRadius: primitives.radius.full,
105
- backgroundColor: colors.content.intense,
106
- transition: "width 200ms ease",
107
- "@media": {
108
- "(prefers-reduced-motion: reduce)": { transition: "none" },
109
- },
110
- });
111
-
112
- // In rail mode the rail conveys position on desktop, so the progress bar is
113
- // mobile-only there.
114
- export const progressMobileOnly = style({
115
- "@container": {
116
- "(min-width: 560px)": { display: "none" },
117
- },
118
- });
119
-
120
- // Desktop thumbnail rail (THUMBNAIL_RAIL). Hidden on mobile, where the swipe
121
- // track + progress bar own navigation. Capped to the image height via an inline
122
- // max-height and scrolls the excess. @todo: tune the rail width / thumb size.
123
- export const rail = style({
124
- display: "none",
125
- "@container": {
126
- "(min-width: 560px)": {
127
- display: "flex",
128
- flexDirection: "column",
129
- flexShrink: 0,
130
- gap: primitives.space["2xs"],
131
- width: "64px",
132
- minHeight: 0,
133
- overflowY: "auto",
134
- scrollbarWidth: "none",
135
- },
136
- },
137
- });
138
-
139
- globalStyle(`${rail}::-webkit-scrollbar`, { display: "none" });
140
-
141
- export const thumb = style({
142
- boxSizing: "border-box",
143
- flexShrink: 0,
144
- width: "100%",
145
- aspectRatio: "1",
146
- minHeight: 0, // let aspect-ratio win over the flex-item default min-height
147
- padding: primitives.space["4xs"],
148
- borderRadius: primitives.radius.m,
149
- border: `${primitives.stroke.thin} solid ${colors.border.subtle}`,
150
- backgroundColor: colors.surface.extraLight,
151
- cursor: "pointer",
152
- transition: "border-color 150ms ease",
153
- "@media": {
154
- "(prefers-reduced-motion: reduce)": { transition: "none" },
155
- },
156
- });
157
-
158
- // Selected thumb: thicker, accented border. border-box keeps the width swap from
159
- // shifting the rail layout.
160
- export const thumbActive = style({
161
- borderColor: colors.common.accent,
162
- borderWidth: primitives.stroke.medium,
163
- });
164
-
165
- export const thumbImage = style({
166
- width: "100%",
167
- height: "100%",
168
- objectFit: "contain",
169
- display: "block",
170
- pointerEvents: "none",
171
- userSelect: "none",
172
- });
@@ -1,30 +0,0 @@
1
- import { ImageGallery } from "./image-gallery";
2
-
3
- function shot(fill: string) {
4
- return `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Crect width='400' height='400' fill='%23${fill}'/%3E%3Ccircle cx='200' cy='200' r='110' fill='%23ffffff' fill-opacity='0.5'/%3E%3C/svg%3E`;
5
- }
6
-
7
- // The gallery's desktop layout (and the optional THUMBNAIL_RAIL) query a
8
- // `container-type` host, which the PDP's `.detail` provides in the app. The
9
- // story supplies its own so it previews at a realistic width and renders
10
- // correctly whichever way THUMBNAIL_RAIL is set — swipe when off, rail when on.
11
- const frame = {
12
- containerType: "inline-size" as const,
13
- width: 600,
14
- maxWidth: "100%",
15
- };
16
-
17
- export const Multiple = () => (
18
- <div style={frame}>
19
- <ImageGallery
20
- media={[shot("e1e1e1"), shot("c9d4f5"), shot("f5d4c9")]}
21
- alt="Product"
22
- />
23
- </div>
24
- );
25
-
26
- export const Single = () => (
27
- <div style={frame}>
28
- <ImageGallery media={[shot("e1e1e1")]} alt="Product" />
29
- </div>
30
- );