Skip to content

feat(toolbar): add theme Generate tab with coming soon placeholder#78

Open
sarahdayan wants to merge 31 commits intomainfrom
feat/theme-agent
Open

feat(toolbar): add theme Generate tab with coming soon placeholder#78
sarahdayan wants to merge 31 commits intomainfrom
feat/theme-agent

Conversation

@sarahdayan
Copy link
Member

@sarahdayan sarahdayan commented Mar 11, 2026

Summary

Restructures the toolbar's Theme tab into two sub-views (Customize and Generate) and removes the top-level AI tab. This lays the groundwork for the Theme Agent workstream.

Capture d’écran 2026-03-11 à 16 31 37 Capture d’écran 2026-03-11 à 16 31 43

What changes

Generate sub-view with "Coming soon" placeholder

The Theme tab now has a Customize | Generate view switcher below the global controls.

  • Customize is the existing manual variable editor, unchanged.
  • Generate shows a conversational UI shell: a sparkles icon, a "Describe your theme" prompt, example suggestions ("Clean and minimal like Apple", "Bold with sharp edges like Nike", "Warm earthy tones like Aesop"), a disabled textarea, and a "Coming soon" pill badge. Nothing is interactive — this is a painted door for the upcoming AI theme generation feature.

Preset selector and mode controls always visible

The preset dropdown, adaptive/fixed toggle, light/dark mode switcher, and "Reset all" button are always visible at the top of the Theme tab, regardless of which sub-view is active. Previously they were mixed into the variable editing area.

Top-level AI tab removed

The general-purpose AI chat tab is removed from the toolbar's tab bar. It was a broad chat scoped to the full experience, but we're pivoting toward contextual AI features embedded where they're most useful — theme generation inside the Theme tab, and eventually widget configuration assistance inside widget cards. The AI chat source code (ai-chat.tsx, ai/tools.ts) is preserved in the codebase for future reuse and tree-shaken out of the bundle.

sarahdayan and others added 22 commits March 10, 2026 12:00
- Add `@experiences/theme` package with `ThemeVariable` types and `generateThemeCss()` for generating light/dark CSS custom property blocks
- Integrate theme CSS generation into runtime middleware, replacing ad-hoc cssVariables injection
- Replace bundled satellite.css + upstream autocomplete.css with a local autocomplete.css, dropping the unused satellite theme
- Add `ThemeSwitcher` component to the React example for dev/demo theming
- Add `examples/shared/` with reusable theme definitions across JS and React examples
- Improve dev setup: local proxy serves dist files during development, file watching triggers HMR, `useAlgoliaExperiences` supports relative URLs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add createThemeOverridesSchema() that builds a Zod validation schema
from the theme variable catalog. Number variables get min/max/step
constraints, all fields include descriptions with units and defaults
for AI agent consumption. ThemeOverrides now accepts string | number
values with coercion at the CSS generation boundary.

Reorganize packages/theme into types.ts, lib/, and widgets/ for
clearer separation of concerns. Move autocomplete.css into
packages/runtime/src/styles/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test createThemeOverridesSchema validation (type checking, numeric
constraints, empty/partial objects), JSON Schema output (property keys,
types, descriptions, constraints), and generateThemeCss (light/dark
blocks, defaults, unit appending, unitless numbers, overrides,
per-mode overrides, unknown keys ignored).

Also add toJsonSchema() method and zod-to-json-schema dependency for
AI tool definition generation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The stylesheet is a product of the theme variable catalog, not the
runtime. Moving it to packages/theme/src/widgets/ co-locates it with
the variable definitions it consumes. The runtime build config now
reads the CSS from the theme package.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add "Format: R, G, B." to color variable descriptions so agents know
to return RGB triplets. Add min/max constraints (0–1) to all
alpha and opacity variables to prevent out-of-range values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wrap the overrides schema in `{ light, dark }` so agents return per-mode
values in a single tool call. Add constraints to `base-unit` and change
`font-weight-medium` from text to number with valid CSS weight range.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert 7 variables from unvalidated text to number type with min/max/step
constraints: font weights, header font size, item line height, transition
duration, detached modal top offset, and scrollbar color mix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace freeform text shadow variables with a constrained `shadow` type
that stores an array of structured layer objects (offsetX, offsetY, blur,
spread, color, opacity). This makes shadows validatable by the schema and
easier for AI agents to produce correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lations

The `step` constraint is a UI hint for slider increments, not a
validation rule. IEEE 754 rounding causes values like 0.15 to fail
`multipleOf(0.1)`, rejecting valid agent output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rrideValue

Move isShadowLayers to its own predicates/ folder, strengthen the check
to require both offsetX and blur, and add unit tests. Export
ThemeOverrideValue from types.ts to remove the duplicate declaration in
generate-theme-css.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move test files from a top-level __tests__/ directory to colocated
__tests__/ folders within each source module (lib/, predicates/).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add 8 curated theme presets (Default, Minimal, Bold, Soft, Warm,
Nature, Elegant, Brutalist) with a preset selector UI in the theme
editor. Each preset provides distinct light and dark overrides for
colors, typography, borders, shadows, spacing, and more.

- Add ThemePreset type and preset definitions in theme package
- Add PresetSelector component with color swatch previews
- Wire preset application through panel and app components
- Move autocomplete files under autocomplete/ subfolder
- Remove redundant theme switcher from examples
- Fix hexToRgbTriplet spacing, shadow field double label,
  generateThemeCss null safety, and onSave dependency array

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the redundant `themeMode` field from the API payload and
ExperienceApiResponse type. The mode is now inferred from the
cssVariables shape: flat object means fixed, `{ light, dark }` means
adaptive.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Theme CSS is now injected once from the top-level experience config
instead of per-widget. Remove the onCssVariableChange callback chain,
CssVariablesEditor component, and cssVariables from widget parameters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show an empty state with a link to the manual tab when no autocomplete
widget is present in the experience.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show a paintbrush icon in the autocomplete block card header (next to
locate and delete) that navigates to the Theme tab.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Neutral gray, compact preset for unbranded site search that blends into any page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sarahdayan sarahdayan requested a review from dhayab as a code owner March 11, 2026 15:25
sarahdayan and others added 7 commits March 12, 2026 11:29
# Conflicts:
#	examples/react/src/App.tsx
#	packages/runtime/src/experiences/middleware.ts
#	packages/runtime/src/experiences/widget.tsx
#	packages/runtime/tsdown.config.ts
#	packages/theme/package.json
#	packages/theme/src/lib/__tests__/create-theme-overrides-schema.test.ts
#	packages/theme/src/lib/__tests__/generate-theme-css.test.ts
#	packages/theme/src/lib/generate-theme-css.ts
#	packages/theme/src/types.ts
The merge brought in main's flat `autocomplete.ts` and `autocomplete.css`
which are superseded by the subdirectory structure (`autocomplete/variables.ts`,
`autocomplete/presets.ts`, `autocomplete/autocomplete.css`). Remove the
duplicates and update the shared example import.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The toolbar's Theme tab replaces the dev theme switcher.
The React example was cleaned up during the merge but the
JS example was missed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Missed search.html and product.html in the previous cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mponent

The toolbar's Theme tab replaces the dev theme switcher.
Remove examples/shared/, the Vite alias, and the unused
React ThemeSwitcher component.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Loading an experience with a custom theme no longer marks variables as
dirty. "Reset all" now restores the initially loaded theme rather than
switching to the Default preset.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restructure the Theme tab into two sub-views:
- **Customize**: manual variable editing (existing behavior)
- **Generate**: AI-powered theme generation (coming soon)

The Generate view shows a conversational UI shell with example
prompts and a disabled input, signaling upcoming AI theming
capabilities. This lays the groundwork for the Theme Agent
workstream.

The top-level AI tab is removed from the toolbar. It was a
general-purpose chat scoped to the full experience, but we're
pivoting toward contextual AI features embedded where they're
most useful (e.g., theme generation inside the Theme tab). The
AI chat code is preserved in the codebase for future reuse.

Preset selector and mode controls (adaptive/fixed, light/dark)
are always visible above the view switcher, regardless of which
sub-view is active.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Base automatically changed from feat/manual-editor to main March 12, 2026 16:37
Merge main into feat/theme-agent, combining:
- AI tab (main): Panel-level AiChat with lazy mounting
- Theme Generate tab (feat/theme-agent): ThemeEditor sub-view with ThemeAgentChat
- onMoveBlock callback for block reordering across indices

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify
Copy link

netlify bot commented Mar 12, 2026

Deploy Preview for algolia-experiences-react ready!

Name Link
🔨 Latest commit 2f2cde0
🔍 Latest deploy log https://app.netlify.com/projects/algolia-experiences-react/deploys/69b2eef090598e0008dfbe8e
😎 Deploy Preview https://deploy-preview-78--algolia-experiences-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Mar 12, 2026

Deploy Preview for algolia-experiences-js ready!

Name Link
🔨 Latest commit 2f2cde0
🔍 Latest deploy log https://app.netlify.com/projects/algolia-experiences-js/deploys/69b2eef0e83828000802ab7d
😎 Deploy Preview https://deploy-preview-78--algolia-experiences-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant