Docs in English (part 1), seeding guide, Coolify deployment

- Translate to English every doc the code branches did not touch: AGENT.md,
  developer guide, vibe, CHANGELOG, docs index, module pages, all skills
  except ipal-seo-check (14 pages follow after the security/SEO merge).
  Placeholder marker is now [TO FILL: …]; skill resources renamed to
  section-code.md / nav-code.md. AGENT.md and the ipal-skills pointer
  block say the docs are in English.
- docs/seeding.md: create-only, natural keys, never delete, no users or
  secrets, empty-field globals, fallbackLocale: false, dry run, backup and
  restore, production update guard, seeds vs migrations, Coolify Terminal.
  Seed templates gain --dry-run, the SEED_UPDATE production guard
  (IPAL_SEED_ALLOW_PROD_UPDATE), skip of edited records and a summary.
  "Seeding on production" rule block in AGENT.md.
- Coolify is the single deployment path (deployment, env, developer guide,
  ipal-setup): build vs runtime env, migrations on container start
  (prodMigrations), health check and rolling updates, rollback, backups and
  restore, DNS/Let's Encrypt/CAA. R2: custom domain needs a Cloudflare zone;
  default is media served by the app (R2_PUBLIC_URL empty).
- docsConsistency: no Polish prose outside code/quoted data (pending pages
  listed); IPAL_* names may also be read by shipped skill templates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-22 17:39:03 +02:00
co-authored by Claude Opus 5.5
parent 6e3979bae6
commit 2d9f3e15d4
47 changed files with 6102 additions and 5355 deletions
+45 -45
View File
@@ -1,30 +1,30 @@
# Motyw jasny / ciemny (1.11.1)
# Light / dark theme (1.11.1)
Logika motywu z pluginu, wygląd w projekcie. Plugin daje: skrypt przed malowaniem (bez mignięcia
jasnego motywu), przełącznik bez stylów, hook `useTheme`, pola w Site Settings → Theme i motyw
widżetu Turnstile zgodny ze stroną.
Theme logic from the plugin, the look in the project. The plugin provides: a pre-paint script (no flash
of the light theme), an unstyled switcher, the `useTheme` hook, fields in Site Settings → Theme, and a Turnstile
widget theme that matches the page.
## Jak to działa
## How it works
- Strony są ISR/SSG — jeden HTML dla wszystkich, więc motyw **nie** trafia do HTML z serwera.
- `<ThemeScript>` (skrypt inline, pierwsze dziecko `<body>`) ustawia `data-theme="light|dark"` i
`color-scheme` na `<html>` przed pierwszym malowaniem.
- Kolejność: wybór odwiedzającego z `localStorage` (klucz `ipal-theme`, tylko gdy „Allow theme toggle”)
→ Site Settings → Default theme → przy `System` ustawienie urządzenia (`prefers-color-scheme`).
- `localStorage`, nie cookie: to preferencja interfejsu, nie śledzi i nie wymaga zgody.
- Zmiana w jednej karcie przechodzi do pozostałych (zdarzenie `storage`).
- Pages are ISR/SSG — one HTML for everyone, so the theme does **not** go into the server HTML.
- `<ThemeScript>` (an inline script, the first child of `<body>`) sets `data-theme="light|dark"` and
`color-scheme` on `<html>` before the first paint.
- Order: the visitor's choice from `localStorage` (key `ipal-theme`, only when "Allow theme toggle" is on)
→ Site Settings → Default theme → with `System`, the device setting (`prefers-color-scheme`).
- `localStorage`, not a cookie: it is an interface preference, it does not track and needs no consent.
- A change in one tab carries over to the others (the `storage` event).
## Site Settings → Theme
| Pole | Znaczenie |
| Field | Meaning |
|---|---|
| `defaultTheme` | `light` · `dark` · `system` (od 1.11.1) |
| `allowThemeToggle` | pokazuj przełącznik; wybór odwiedzającego jest pamiętany |
| `themeToggleLabel` | nazwa przełącznika dla czytników ekranu, np. „Tryb ciemny” (localized, od 1.11.1) |
| `defaultTheme` | `light` · `dark` · `system` (since 1.11.1) |
| `allowThemeToggle` | show the switcher; the visitor's choice is remembered |
| `themeToggleLabel` | the switcher name for screen readers, e.g. "Tryb ciemny" (localized, since 1.11.1) |
`getSiteShell(locale).theme` → `{ defaultTheme, allowToggle, toggleLabel }` (`themeConfigFrom(settings)` z roota).
`getSiteShell(locale).theme` → `{ defaultTheme, allowToggle, toggleLabel }` (`themeConfigFrom(settings)` from the root entry).
## Podpięcie
## Wiring
```tsx
// src/app/(frontend)/[locale]/layout.tsx
@@ -32,17 +32,17 @@ const shell = await getSiteShell(locale)
return (
<html lang={locale} suppressHydrationWarning>
<body>
<SiteProviders shell={shell} theme> {/* theme → <ThemeScript> na początku */}
<SiteProviders shell={shell} theme> {/* theme → <ThemeScript> at the start */}
<Header themeLabel={shell.theme.allowToggle ? shell.theme.toggleLabel : null} … />
…
```
Bez `SiteProviders`: `import { ThemeScript } from '@intecion/ipal-kit/rsc'` i `<ThemeScript {...shell.theme} />`
jako pierwsze dziecko `<body>`. `suppressHydrationWarning` na `<html>` jest potrzebne — atrybut różni się
od HTML z serwera celowo.
Without `SiteProviders`: `import { ThemeScript } from '@intecion/ipal-kit/rsc'` and `<ThemeScript {...shell.theme} />`
as the first child of `<body>`. `suppressHydrationWarning` on `<html>` is needed — the attribute differs
from the server HTML on purpose.
```tsx
// przełącznik ('use client' albo w RSC — sam jest komponentem klienckim)
// switcher ('use client' or in an RSC — it is a client component itself)
import { ThemeSwitcher } from '@intecion/ipal-kit/client'
<ThemeSwitcher
@@ -52,46 +52,46 @@ import { ThemeSwitcher } from '@intecion/ipal-kit/client'
light: 'rounded-full p-2 bg-white dark:bg-transparent',
dark: 'rounded-full p-2 dark:bg-surface-raised',
}}
// renderIcon={(t) => (t === 'light' ? <SunIcon /> : <MoonIcon />)} // domyślnie lucide Sun / Moon
// renderIcon={(t) => (t === 'light' ? <SunIcon /> : <MoonIcon />)} // default lucide Sun / Moon
/>
```
`<button role="switch" aria-checked>` (zaznaczony = ciemny). Który przycisk wygląda na aktywny, ustala CSS
z atrybutu na `<html>` (`dark:`), nie stan Reacta — po hydratacji nic nie przeskakuje.
Haki: `data-ipal="theme-switch"`, `data-ipal-theme-icon="light|dark"`.
`<button role="switch" aria-checked>` (checked = dark). Which button looks active is decided by CSS
from the attribute on `<html>` (`dark:`), not React state — nothing jumps after hydration.
Hooks for styling: `data-ipal="theme-switch"`, `data-ipal-theme-icon="light|dark"`.
Własny przełącznik: `useTheme()` → `{ theme, setTheme, toggle }` (`theme` = `null` na serwerze);
`applyTheme(theme, { persist, transitionMs })`, `readDocumentTheme()`, stałe `THEME_ATTRIBUTE`,
`THEME_STORAGE_KEY`, `THEME_SWITCHING_ATTRIBUTE`, `isTheme` z `/client`. Z roota także
`isThemeSetting` i `themeScript({ allowToggle, defaultTheme })` (sam tekst skryptu).
Custom switcher: `useTheme()` → `{ theme, setTheme, toggle }` (`theme` = `null` on the server);
`applyTheme(theme, { persist, transitionMs })`, `readDocumentTheme()`, the constants `THEME_ATTRIBUTE`,
`THEME_STORAGE_KEY`, `THEME_SWITCHING_ATTRIBUTE`, `isTheme` from `/client`. From the root entry also
`isThemeSetting` and `themeScript({ allowToggle, defaultTheme })` (the script text only).
## CSS (Tailwind 4)
```css
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
/* płynne przejście kolorów tylko w chwili przełączenia (applyTheme: data-theme-switching, 300 ms) */
/* smooth color transition only at the moment of switching (applyTheme: data-theme-switching, 300 ms) */
[data-theme-switching] *, [data-theme-switching] *::before, [data-theme-switching] *::after {
transition: background-color 0.3s, border-color 0.3s, color 0.3s, fill 0.3s !important;
}
```
Tokeny ciemnego motywu (`surface`, `fg`…) zostają w `styles.css` projektu.
Dark theme tokens (`surface`, `fg`…) stay in the project's `styles.css`.
## Turnstile
`BuilderForm` / `RenderForm` → `turnstileTheme` domyślnie `'page'`: widżet bierze motyw strony
(`data-theme`); bez motywu strony — `'auto'` (motyw urządzenia), jak przed 1.11.1. Zmiana motywu
rysuje widżet od nowa (token trzeba zdobyć ponownie). Stały motyw: `turnstileTheme="light"`.
`BuilderForm` / `RenderForm` → `turnstileTheme` defaults to `'page'`: the widget takes the page theme
(`data-theme`); with no page theme — `'auto'` (device theme), as before 1.11.1. A theme change
redraws the widget (the token must be obtained again). A fixed theme: `turnstileTheme="light"`.
## Wyłączenie, nadpisanie, rozszerzenie
## Turn off, override, extend
- **Wyłączenie:** bez `SiteProviders theme` / `<ThemeScript>` motyw nie jest ustawiany (bazowy CSS);
`allowThemeToggle` wyłączony = wybór odwiedzającego ignorowany. Zakładka *Theme* w Site Settings jest
obecnie zawsze dodawana.
- **Nadpisanie:** `ThemeScript` przyjmuje `allowToggle` / `defaultTheme` wprost (nie musi czytać z panelu);
- **Turn off:** without `SiteProviders theme` / `<ThemeScript>` no theme is set (base CSS);
`allowThemeToggle` off = the visitor's choice is ignored. The *Theme* tab in Site Settings is
currently always added.
- **Override:** `ThemeScript` takes `allowToggle` / `defaultTheme` directly (it does not have to read from the admin panel);
`ThemeSwitcher` — `classNames`, `label`, `renderIcon`; `applyTheme(..., { persist, transitionMs })`.
- **Rozszerzenie:** własny przełącznik na `useTheme()`; `themeScript()` jako tekst skryptu do własnego
tagu; `themeConfigFrom(settings)` do odczytu ustawień.
Własne pola w Site Settings (np. dodatkowe tokeny) — `ipalKit({ siteSettingsFields })`, trafiają do
zakładki *Custom*.
- **Extend:** your own switcher on `useTheme()`; `themeScript()` as script text for your own
tag; `themeConfigFrom(settings)` to read the settings.
Your own fields in Site Settings (e.g. extra tokens) — `ipalKit({ siteSettingsFields })`, they go to the
*Custom* tab.