Import instead of code: panel forms (steps, choice lists, dates), layout, page route, GEO routes, links, section fields

- Forms: step and checkboxGroup field types (radio, date on), server validation for them,
  useBuilderForm (logic) + BuilderForm (unstyled default) + RenderForm (/rsc: rich text,
  bound action, public part of the form only — the Emails tab never reaches the browser)
- Notifications: next / back / stepOf texts
- createContentHelpers: getSiteShell, getFormTexts, getLinkOptions, resolveLink, resolveNav,
  resolvePageRedirect, one-line route handlers (llms, llms-full, md, mcp, health, indexnow, manifest)
- /rsc: SiteProviders, createPageRoute, createNotFoundPage
- resolveLink / resolveNav / homeSlugFrom, buildSectionHeaderField / buildSectionSettingsField
- Dev sandbox frontend built on these imports; tests (unit + real Payload)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-16 11:32:46 +02:00
co-authored by Claude Opus 5.5
parent 0cfd846dd1
commit 412bf953a8
44 changed files with 2015 additions and 20 deletions
@@ -64,6 +64,21 @@ export function useTurnstile(): {
if (!ctx) {
throw new Error('useTurnstile must be used within <TurnstileProvider>')
}
return useTurnstileFrom(ctx)
}
const NO_PROVIDER: TurnstileContextValue = { setToken: () => {}, siteKey: null, token: null }
/**
* useTurnstile without the provider requirement: outside <TurnstileProvider>
* it reports `enabled: false` (no widget, no token) instead of throwing. For
* shared components (BuilderForm) that must not crash a page missing the provider.
*/
export function useOptionalTurnstile(): ReturnType<typeof useTurnstile> {
return useTurnstileFrom(use(TurnstileContext) ?? NO_PROVIDER)
}
function useTurnstileFrom(ctx: TurnstileContextValue): ReturnType<typeof useTurnstile> {
const { setToken, siteKey, token } = ctx
const reset = useCallback(() => setToken(null), [setToken])
+1 -1
View File
@@ -3,4 +3,4 @@
// the server-only verify never leaks into a browser bundle.
export { Turnstile } from './Turnstile.js'
export type { TurnstileProps } from './Turnstile.js'
export { TurnstileProvider, useTurnstile } from './TurnstileProvider.js'
export { TurnstileProvider, useOptionalTurnstile, useTurnstile } from './TurnstileProvider.js'