From faa4ad679c4107bd4fca6b51add26bb5a938278a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rados=C5=82aw=20Smoli=C5=84ski?=
Date: Mon, 19 Oct 2026 21:32:40 +0200
Subject: [PATCH] Theme switcher, table of contents, missing-page redirect,
form placeholders and time field; audit and revalidate fixes
- buildRevalidateHook skips outside Next (no NEXT_RUNTIME) and with context.disableRevalidate
- BuilderForm focuses only on a real step change (no scroll to the form on remount)
- mediaImageProps: placeholder colour only for JPEG (placeholderColor); hook stores no colour for transparent images
- buildLinkField: interface name per shape (CmsLink, CmsLinkPlain, CmsLinkNoLabel) + interfaceName option
- Cookie Settings: buttons.save -> buttons.savePreferences (Mongoose reserved name)
- ThemeScript, ThemeSwitcher, useTheme; Site Settings defaultTheme 'system' + themeToggleLabel; Turnstile follows page theme
- extractHeadings, RenderRichText headingIds, TableOfContents, buildTableOfContentsField
- createPageRoute onMissing: 'redirectHome'
- Form builder: localized placeholder on text/email/textarea/number, new time field
- ipal-audit: no false positive for object keys between JSX elements; /md route not reported as dynamic
Co-Authored-By: Claude Opus 5.5
---
dev/payload-types.ts | 308 +++++++++++++++++-
docs/CHANGELOG.md | 38 +++
docs/README.md | 3 +-
docs/agent/skills/ipal-audit/scripts/audit.sh | 3 +-
.../skills/ipal-audit/scripts/jsx-text.mjs | 5 +-
.../skills/ipal-block/resources/kod-sekcji.md | 3 +-
docs/agent/skills/ipal-upgrade/SKILL.md | 7 +
docs/consent.md | 1 +
docs/dev/PROGRAMISTA.md | 8 +
docs/forms.md | 10 +-
docs/hooks.md | 5 +
docs/links.md | 6 +-
docs/pages.md | 9 +
docs/richtext.md | 30 ++
docs/storage.md | 4 +
docs/theme.md | 85 +++++
src/exports/client.ts | 9 +-
src/exports/rsc.ts | 3 +
src/globals/CookieSettings/fields.ts | 3 +-
src/globals/SiteSettings/fields/theme.ts | 13 +-
src/index.ts | 8 +-
src/modules/consent/getConsentTexts.ts | 8 +-
src/modules/forms/BuilderForm.tsx | 15 +-
src/modules/forms/RenderForm.tsx | 4 +-
src/modules/forms/builderBlocks.ts | 28 ++
src/modules/forms/builderTypes.ts | 2 +-
src/modules/forms/formsPluginConfig.ts | 17 +-
src/modules/forms/index.ts | 2 +-
src/modules/forms/types.ts | 2 +
src/modules/forms/useBuilderForm.ts | 3 +-
src/modules/forms/validateSubmission.ts | 5 +
src/modules/frontend/SiteProviders.tsx | 9 +
src/modules/frontend/createContentHelpers.ts | 4 +
src/modules/frontend/pageRoute.tsx | 28 +-
src/modules/hooks/buildRevalidateHook.ts | 19 +-
src/modules/links/buildLinkField.ts | 17 +-
src/modules/media/mediaProps.ts | 20 +-
src/modules/media/placeholder.ts | 5 +-
src/modules/richtext/RenderRichText.tsx | 58 +++-
src/modules/richtext/TableOfContents.tsx | 83 +++++
src/modules/richtext/headings.ts | 80 +++++
src/modules/richtext/index.ts | 2 +
src/modules/theme/ThemeScript.tsx | 17 +
src/modules/theme/ThemeSwitcher.tsx | 52 +++
src/modules/theme/index.ts | 2 +
src/modules/theme/theme.ts | 60 ++++
src/modules/theme/useTheme.ts | 62 ++++
src/modules/turnstile/Turnstile.tsx | 32 +-
src/modules/turnstile/TurnstileProvider.tsx | 6 +-
src/modules/turnstile/client.ts | 2 +-
test/formSecurity.test.ts | 7 +
test/links.test.ts | 10 +
test/media.test.ts | 20 +-
test/pageRouteMissing.test.ts | 42 +++
test/tableOfContents.test.ts | 72 ++++
55 files changed, 1298 insertions(+), 58 deletions(-)
create mode 100644 docs/theme.md
create mode 100644 src/modules/richtext/TableOfContents.tsx
create mode 100644 src/modules/richtext/headings.ts
create mode 100644 src/modules/theme/ThemeScript.tsx
create mode 100644 src/modules/theme/ThemeSwitcher.tsx
create mode 100644 src/modules/theme/index.ts
create mode 100644 src/modules/theme/theme.ts
create mode 100644 src/modules/theme/useTheme.ts
create mode 100644 test/pageRouteMissing.test.ts
create mode 100644 test/tableOfContents.test.ts
diff --git a/dev/payload-types.ts b/dev/payload-types.ts
index 652173e..d1c9cd2 100644
--- a/dev/payload-types.ts
+++ b/dev/payload-types.ts
@@ -213,6 +213,19 @@ export interface Form {
width?: number | null;
required?: boolean | null;
defaultValue?: boolean | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'checkbox';
@@ -231,6 +244,23 @@ export interface Form {
label?: string | null;
width?: number | null;
required?: boolean | null;
+ /**
+ * Hint shown inside the empty field, e.g. "e.g. 10:00–12:00". Empty → none.
+ */
+ placeholder?: string | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'email';
@@ -251,6 +281,19 @@ export interface Form {
};
[k: string]: unknown;
} | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'message';
@@ -261,6 +304,23 @@ export interface Form {
width?: number | null;
defaultValue?: number | null;
required?: boolean | null;
+ /**
+ * Hint shown inside the empty field, e.g. "e.g. 10:00–12:00". Empty → none.
+ */
+ placeholder?: string | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'number';
@@ -279,6 +339,19 @@ export interface Form {
}[]
| null;
required?: boolean | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'select';
@@ -298,6 +371,23 @@ export interface Form {
width?: number | null;
defaultValue?: string | null;
required?: boolean | null;
+ /**
+ * Hint shown inside the empty field, e.g. "e.g. 10:00–12:00". Empty → none.
+ */
+ placeholder?: string | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'text';
@@ -308,6 +398,23 @@ export interface Form {
width?: number | null;
defaultValue?: string | null;
required?: boolean | null;
+ /**
+ * Hint shown inside the empty field, e.g. "e.g. 10:00–12:00". Empty → none.
+ */
+ placeholder?: string | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'textarea';
@@ -335,6 +442,19 @@ export interface Form {
* Empty = no limit.
*/
maxSelected?: number | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'checkboxGroup';
@@ -345,6 +465,19 @@ export interface Form {
width?: number | null;
required?: boolean | null;
defaultValue?: string | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'date';
@@ -362,6 +495,19 @@ export interface Form {
}[]
| null;
required?: boolean | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'radio';
@@ -372,10 +518,48 @@ export interface Form {
*/
title?: string | null;
description?: string | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
id?: string | null;
blockName?: string | null;
blockType: 'step';
}
+ | {
+ /**
+ * Technical name, e.g. "services" — no spaces.
+ */
+ name: string;
+ label?: string | null;
+ width?: number | null;
+ required?: boolean | null;
+ /**
+ * Leave empty to always show. Otherwise this appears only when the field named below has one of the values — e.g. field "areas", values "web, it".
+ */
+ showWhen?: {
+ /**
+ * Technical name of another field.
+ */
+ field?: string | null;
+ /**
+ * Comma-separated option values. Empty = when that field is filled in or ticked.
+ */
+ values?: string | null;
+ };
+ id?: string | null;
+ blockName?: string | null;
+ blockType: 'time';
+ }
)[]
| null;
submitButtonLabel?: string | null;
@@ -701,6 +885,12 @@ export interface FormsSelect {
width?: T;
required?: T;
defaultValue?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -721,6 +911,13 @@ export interface FormsSelect {
label?: T;
width?: T;
required?: T;
+ placeholder?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -728,6 +925,12 @@ export interface FormsSelect {
| T
| {
message?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -739,6 +942,13 @@ export interface FormsSelect {
width?: T;
defaultValue?: T;
required?: T;
+ placeholder?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -758,6 +968,12 @@ export interface FormsSelect {
id?: T;
};
required?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -779,6 +995,13 @@ export interface FormsSelect {
width?: T;
defaultValue?: T;
required?: T;
+ placeholder?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -790,6 +1013,13 @@ export interface FormsSelect {
width?: T;
defaultValue?: T;
required?: T;
+ placeholder?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -809,6 +1039,12 @@ export interface FormsSelect {
};
minSelected?: T;
maxSelected?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -820,6 +1056,12 @@ export interface FormsSelect {
width?: T;
required?: T;
defaultValue?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -838,6 +1080,12 @@ export interface FormsSelect {
id?: T;
};
required?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -846,6 +1094,28 @@ export interface FormsSelect {
| {
title?: T;
description?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
+ id?: T;
+ blockName?: T;
+ };
+ time?:
+ | T
+ | {
+ name?: T;
+ label?: T;
+ width?: T;
+ required?: T;
+ showWhen?:
+ | T
+ | {
+ field?: T;
+ values?: T;
+ };
id?: T;
blockName?: T;
};
@@ -991,13 +1261,17 @@ export interface SiteSetting {
*/
favicon?: (number | null) | Media;
/**
- * Theme applied on a visitor’s first visit.
+ * Theme applied on a visitor’s first visit. System = the visitor’s device setting.
*/
- defaultTheme: 'light' | 'dark';
+ defaultTheme: 'light' | 'dark' | 'system';
/**
* Show a light/dark switch on the site.
*/
allowThemeToggle?: boolean | null;
+ /**
+ * Name of the switch read by screen readers, e.g. "Dark mode".
+ */
+ themeToggleLabel?: string | null;
updatedAt?: string | null;
createdAt?: string | null;
}
@@ -1092,6 +1366,14 @@ export interface CookieSetting {
* Raise by 1 when you add a tool or change the cookie policy — every visitor is asked for consent again.
*/
policyVersion: number;
+ /**
+ * Small label above the banner title, e.g. "Privacy & cookies". Empty → not shown.
+ */
+ eyebrow?: string | null;
+ /**
+ * Banner heading, e.g. "We respect your privacy". Empty → not shown.
+ */
+ title?: string | null;
/**
* Main consent message shown in the banner.
*/
@@ -1100,6 +1382,14 @@ export interface CookieSetting {
* Heading for the detailed settings panel.
*/
settingsTitle?: string | null;
+ /**
+ * Intro under the settings heading — what cookies are for and that the choice can be changed later.
+ */
+ settingsDescription?: string | null;
+ /**
+ * Badge next to the Necessary category, e.g. "Always active". Empty → a disabled switch/checkbox is shown instead.
+ */
+ alwaysActiveLabel?: string | null;
/**
* Text of the privacy-policy link in the banner, e.g. "Privacy policy". The link target is the page assigned as Privacy Policy in Site Settings → System Pages. Empty → the page title is used.
*/
@@ -1111,8 +1401,12 @@ export interface CookieSetting {
acceptAll?: string | null;
reject?: string | null;
settings?: string | null;
- save?: string | null;
+ savePreferences?: string | null;
back?: string | null;
+ /**
+ * Screen-reader label of the ✕ button in the settings dialog.
+ */
+ close?: string | null;
};
/**
* Per-category titles and descriptions.
@@ -1206,6 +1500,7 @@ export interface SiteSettingsSelect {
favicon?: T;
defaultTheme?: T;
allowThemeToggle?: T;
+ themeToggleLabel?: T;
updatedAt?: T;
createdAt?: T;
globalType?: T;
@@ -1259,8 +1554,12 @@ export interface SiteIntegrationsSelect {
*/
export interface CookieSettingsSelect {
policyVersion?: T;
+ eyebrow?: T;
+ title?: T;
message?: T;
settingsTitle?: T;
+ settingsDescription?: T;
+ alwaysActiveLabel?: T;
privacyLinkLabel?: T;
buttons?:
| T
@@ -1268,8 +1567,9 @@ export interface CookieSettingsSelect {
acceptAll?: T;
reject?: T;
settings?: T;
- save?: T;
+ savePreferences?: T;
back?: T;
+ close?: T;
};
categories?:
| T
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index b13169b..a57880c 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -8,6 +8,44 @@ wersji naraz przejdź po kolei wszystkie sekcje „Wymaga zmian w projekcie” o
wersji, którą masz. Nowe wydanie = nowa sekcja na górze; najstarsze usuwamy
dopiero powyżej 20.
+## 1.11.1
+
+### Nowe
+- **Motyw jasny / ciemny** — `` (`/rsc`, albo ``) ustawia `data-theme` i
+ `color-scheme` na `` przed malowaniem; `` bez stylów (`role="switch"`), `useTheme()`,
+ `applyTheme` (`/client`). Wybór w `localStorage` (`ipal-theme`), synchronizacja kart. Site Settings → Theme:
+ `defaultTheme: 'system'`, `themeToggleLabel`; `getSiteShell(locale).theme`. Opis: theme.md.
+- **Turnstile w motywie strony** — `turnstileTheme` domyślnie `'page'` (bez motywu strony = `'auto'` jak dotąd).
+- **Spis treści** — `extractHeadings`, `RenderRichText headingIds` (te same id), `` (`/client`,
+ `aria-current="location"`), `buildTableOfContentsField()`. Opis: richtext.md.
+- **Brak strony → strona główna** — `createPageRoute(…, { redirect, onMissing: 'redirectHome' })` albo własna funkcja.
+- **Formularze** — pole „Placeholder” (localized) w blokach text, email, textarea, number; nowy typ **Time**
+ (`HH:MM`, walidowany na serwerze).
+- `buildLinkField({ interfaceName })`.
+
+### Poprawki
+- **`buildRevalidateHook` poza Next** — bez `NEXT_RUNTIME` (`payload run`, seed, migracje) albo z
+ `context.disableRevalidate` hook nic nie robi. Wcześniej: `Invariant: static generation store missing`.
+- **`BuilderForm` nie przewija strony do formularza** — fokus tylko przy zmianie kroku. Wcześniej React
+ uruchamiał efekt ponownie (Next przywracający odwiedzoną stronę, StrictMode) i fokus skakał na pierwsze pole.
+- **Kolor placeholdera pod przezroczystymi obrazami** — `mediaImageProps` daje `backgroundColor` tylko dla JPEG
+ (`placeholderColor`), hook nie liczy koloru dla obrazów z alfą. Koniec czarnych prostokątów pod logotypami.
+- **Typ linku nie zależy od kolejności pól** — każdy kształt ma własną nazwę: `CmsLink`, `CmsLinkPlain`
+ (`appearances: false`), `CmsLinkNoLabel`, `CmsLinkPlainNoLabel`. Wszystkie pasują do `CmsLink`.
+- **Ostrzeżenie Mongoose przy każdym starcie** — pole Cookie Settings `buttons.save` → `buttons.savePreferences`
+ (`save` to nazwa zarezerwowana). API frontu bez zmian (`texts.buttons.save`).
+- **ipal-audit** — klucze obiektu między elementami JSX (`narrow: , wide: `) nie są już zgłaszane jako
+ tekst na sztywno; reguła „page routes rendered dynamically” pomija trasę `/md/[locale]` (route handlery są `force-dynamic` z założenia).
+
+### Wymaga zmian w projekcie
+- Migracja (Postgres/SQLite): `pnpm payload migrate:create` — nowe pola (placeholder, time, `themeToggleLabel`,
+ wartość `system`), zmiana nazwy `buttons_save` → `buttons_save_preferences`: gdy drizzle zapyta o kolumnę,
+ wybierz **rename**; inaczej tekst przycisku wróci do domyślnego „Save preferences” i trzeba go wpisać w panelu.
+ MongoDB: bez migracji; plugin próbuje odczytać starą wartość, ale sprawdź przycisk „Zapisz” w banerze i w razie
+ potrzeby wpisz tekst w Cookie Settings → Buttons → Save.
+- `pnpm payload generate:types` — linki bez stylu / bez etykiety mają nowe nazwy typów; kod z `CmsLink` działa dalej.
+- Usuń obejścia z PROGRAMISTA §6 poz. 38–45 (komentarze `WORKAROUND ipal-kit` w projekcie). `pnpm ipal:skills` (nowy audyt).
+
## 1.11.0
### Nowe
diff --git a/docs/README.md b/docs/README.md
index 47ae91e..83da091 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -28,10 +28,11 @@ Szczegóły API — jeden plik na moduł:
| Komunikaty formularzy | [notifications.md](./notifications.md) |
| Strony systemowe, 404, generateStaticParams | [pages.md](./pages.md) |
| Helpery Payload | [payload-helpers.md](./payload-helpers.md) |
-| Rich text | [richtext.md](./richtext.md) |
+| Rich text, spis treści | [richtext.md](./richtext.md) |
| Nagłówki, CSP, 2FA | [security.md](./security.md) |
| SEO, metadata, sitemap, JSON-LD, llms.txt | [seo.md](./seo.md) |
| Auto-slug | [slug.md](./slug.md) |
+| Motyw jasny / ciemny, przełącznik | [theme.md](./theme.md) |
| Media, R2 | [storage.md](./storage.md) |
| Turnstile | [turnstile.md](./turnstile.md) |
| White-label panelu | [white-label.md](./white-label.md) |
diff --git a/docs/agent/skills/ipal-audit/scripts/audit.sh b/docs/agent/skills/ipal-audit/scripts/audit.sh
index 9f50951..55ec133 100644
--- a/docs/agent/skills/ipal-audit/scripts/audit.sh
+++ b/docs/agent/skills/ipal-audit/scripts/audit.sh
@@ -320,7 +320,8 @@ if [ "$QUICK" -eq 0 ]; then
echo "== pnpm build =="
BUILD_LOG=$(mktemp)
if pnpm -s build >"$BUILD_LOG" 2>&1; then
- DYN=$(grep -E '^[│├└ ]*ƒ .*\[locale\]' "$BUILD_LOG" || true)
+ # Only page routes under /[locale]: route handlers (/md/[locale]/…, sitemap, llms) are force-dynamic by design.
+ DYN=$(grep -E '^[│├└ ]*ƒ /\[locale\]' "$BUILD_LOG" || true)
report WARNING "page routes rendered dynamically (ƒ)" "§4 expected ● SSG — does the build see the DB?" "$DYN"
else
ERRORS=$((ERRORS + 1)); echo "[ERROR] build failed — last lines:"; tail -30 "$BUILD_LOG" | sed 's/^/ /'
diff --git a/docs/agent/skills/ipal-audit/scripts/jsx-text.mjs b/docs/agent/skills/ipal-audit/scripts/jsx-text.mjs
index f194987..a5367c3 100644
--- a/docs/agent/skills/ipal-audit/scripts/jsx-text.mjs
+++ b/docs/agent/skills/ipal-audit/scripts/jsx-text.mjs
@@ -21,6 +21,9 @@ const WORD = /\p{L}{2,}/u
// Text right after a closing/self-closing tag may be the JS that follows the JSX
// expression (` : null`, `) }`, `
\n const id = …`) — not visible text.
const JS_CODE = /(^|\s)(return|const|let|var|if|else|export|import|await|typeof)\b|=>|[=;`]|^\s*[:?)\]}]|&&|\|\|/
+// JSX elements as values in an object literal: `narrow: ,\n wide: ` leaves
+// ", wide:" between the two elements — a property key, not visible text.
+const OBJECT_KEY = /^\s*,\s*(?:[A-Za-z_$][\w$]*|'[^']*'|"[^"]*")\s*:\s*$/
const files = []
const walk = (p) => {
@@ -44,7 +47,7 @@ for (const file of files) {
const src = stripComments(readFileSync(file, 'utf8'))
for (const m of src.matchAll(OPEN_OR_CLOSE)) {
const text = m[1].replace(/\s+/g, ' ').trim()
- if (!text || !WORD.test(text) || JS_CODE.test(text)) continue
+ if (!text || !WORD.test(text) || JS_CODE.test(text) || OBJECT_KEY.test(text)) continue
if (/&[a-z]+;/.test(text) && !WORD.test(text.replace(/&[a-z]+;/g, ''))) continue
console.log(`${file}:${lineOf(src, m.index + m[0].length - m[1].length)}: ${text.slice(0, 80)}`)
}
diff --git a/docs/agent/skills/ipal-block/resources/kod-sekcji.md b/docs/agent/skills/ipal-block/resources/kod-sekcji.md
index b406289..52ec42b 100644
--- a/docs/agent/skills/ipal-block/resources/kod-sekcji.md
+++ b/docs/agent/skills/ipal-block/resources/kod-sekcji.md
@@ -21,7 +21,8 @@ buildLinkField({ disableLabel: true, appearances: false }) // klikalna cała k
Jeden kształt linku: typ (`internal` strona / `external` URL, mailto, tel, #anchor /
`file` upload), `label` (localized), `newTab`, `appearance`. W `payload-types.ts`
-powstaje typ `CmsLink`. Opcje: `relationTo` (domyślnie `'pages'`), `uploadTo`
+powstaje typ `CmsLink` (bez stylu: `CmsLinkPlain`, bez etykiety: `CmsLinkNoLabel`; wszystkie
+pasują do `CmsLink`; własna nazwa: `interfaceName`). Opcje: `relationTo` (domyślnie `'pages'`), `uploadTo`
(domyślnie `'media'`), `required`.
diff --git a/docs/agent/skills/ipal-upgrade/SKILL.md b/docs/agent/skills/ipal-upgrade/SKILL.md
index df0dd81..39eed00 100644
--- a/docs/agent/skills/ipal-upgrade/SKILL.md
+++ b/docs/agent/skills/ipal-upgrade/SKILL.md
@@ -43,6 +43,13 @@ przeglądarce (formularz: wysyłka + mail; strona: 200, 404, metadata). Postgres
`storage` w `ipalEnvRules`, własny graf JSON-LD produktów (→ `pageJsonLd.entries` + `buildProductJsonLd`),
własny RenderBlocks dla `h1` (→ `isFirst`). Linki do wpisów: `buildLinkField({ relationTo: [...] })` z migracją danych.
+**→ 1.11.1 (PROGRAMISTA §6, poz. 38–45):** usuń obejścia (komentarze `WORKAROUND ipal-kit`) — warunek
+`NEXT_RUNTIME` wokół `revalidatePath`, strażnik fokusu formularza, własny motyw (→ `ThemeScript`/`ThemeSwitcher`),
+własny spis treści (→ `extractHeadings` + `TableOfContents` + `headingIds`), łapanie `notFound` dla przekierowania
+(→ `onMissing: 'redirectHome'`), kolor tła tylko dla JPEG w ``, typowanie przez `ButtonAppearance` zamiast
+`CmsLink['appearance']` (typy linków bez stylu to teraz `CmsLinkPlain`). Cookie Settings: `buttons.save` →
+`buttons.savePreferences` — w `migrate:create` wybierz **rename** kolumny, żeby zachować teksty.
+
## 2. Inwentaryzacja (bez zmian w kodzie)
Dla **każdej** pozycji tabeli PROGRAMISTA §6 pokaż dowód (grep / plik), czy
dotyczy projektu. Uruchom skill **ipal-audit** (`--quick`) i dołącz wynik.
diff --git a/docs/consent.md b/docs/consent.md
index b371c1b..a4695d0 100644
--- a/docs/consent.md
+++ b/docs/consent.md
@@ -207,6 +207,7 @@ Teksty z panelu (**Cookie Settings**, per język) — puste pole = element się
| `settingsDescription` | opis pod tytułem ustawień |
| `alwaysActiveLabel` | znacznik przy „Niezbędne” zamiast wyłączonego przełącznika |
| `buttons.close` | etykieta przycisku ✕ dla czytników ekranu (puste → „Close”) |
+| `buttons.savePreferences` | „Zapisz” w ustawieniach (do 1.11.0 pole `save` — nazwa zarezerwowana w Mongoose; w kodzie dalej `texts.buttons.save`) |
Nowe pola w globalu = migracja w projektach na Postgres/SQLite (`payload migrate:create`); MongoDB bez zmian.
diff --git a/docs/dev/PROGRAMISTA.md b/docs/dev/PROGRAMISTA.md
index ff8fc88..65b3d90 100644
--- a/docs/dev/PROGRAMISTA.md
+++ b/docs/dev/PROGRAMISTA.md
@@ -549,6 +549,14 @@ Rób po jednej pozycji, buduj, sprawdzaj. Kolejność wg wagi:
| 35 | **1.11.0** — dodatkowe relacje „kategorie” obok linków, linki do wpisów jako URL | `buildLinkField({ relationTo: ['pages', 'categories'] })` (migracja danych linków) | links.md |
| 36 | **1.11.0** — JSON-LD produktu / kategorii składany w projekcie, `jsonLd: false` | `pageJsonLd.entries` + `buildProductJsonLd`, z powrotem `jsonLd` w `createPageRoute` | seo.md |
| 37 | **1.11.0** — własny RenderBlocks w trasie strony tylko dla `h1` pierwszej sekcji; `storage` w `ipalEnvRules` warunkowany NODE_ENV; ręczne `remotePatterns` / `dangerouslyAllowLocalIP` dla localhost | `isFirst` z `createPageRoute`; `ipalEnvRules({ storage: true })`; `buildImagesConfig()` | pages.md, env.md, storage.md |
+| 38 | **1.11.1** — `revalidatePath` owinięte warunkiem `process.env.NEXT_RUNTIME` (seed / `payload run` padał) | usuń warunek — hook sam pomija rewalidację poza Next; celowo: `context: { disableRevalidate: true }` | hooks.md |
+| 39 | **1.11.1** — strażnik fokusu wokół `RenderForm` (strona przewijała się do formularza po powrocie) | usuń — `BuilderForm` przenosi fokus tylko przy zmianie kroku | forms.md |
+| 40 | **1.11.1** — własny `ThemeScript` / przełącznik motywu / `useSyncExternalStore` na `data-theme` | `` (albo ``), ``, `useTheme`; ten sam klucz `ipal-theme` — wybór odwiedzających zostaje. Postgres: `migrate:create` (`system`, `themeToggleLabel`) | theme.md |
+| 41 | **1.11.1** — własne `anchors.ts` / `TableOfContents` / konwerter nagłówków z `id` | `extractHeadings`, `` (`/client`), `RenderRichText headingIds`, `buildTableOfContentsField()` (ten sam kształt `show`/`label` — bez migracji danych) | richtext.md |
+| 42 | **1.11.1** — `notFound` łapany w `page.tsx`, żeby przekierować na stronę główną | `createPageRoute(…, { redirect, onMissing: 'redirectHome' })` | pages.md |
+| 43 | **1.11.1** — `` ustawia kolor tła tylko dla JPEG | usuń warunek — `mediaImageProps` robi to sam (`placeholderColor`) | storage.md |
+| 44 | **1.11.1** — `CmsLink['appearance']` zastąpione własnym typem, bo typ zależał od kolejności pól | typy per kształt: `CmsLink`, `CmsLinkPlain`, `CmsLinkNoLabel`; `pnpm generate:types` i popraw importy | links.md |
+| 45 | **1.11.1** — opis formatu w etykiecie pola formularza / godzina jako tekst | pole **Placeholder** w panelu, typ **Time**; Postgres: `migrate:create` | forms.md |
| 33 | **1.9.2** — `src/fields/sectionHeader.ts`, `sectionSettings.ts`, `lib/navigation.ts`, ręczne `resolveLinkHref` w `CMSLink` | `buildSectionHeaderField`, `buildSectionSettingsField` (ten sam kształt danych — bez migracji), `resolveNav`, `resolveLink` z `lib/content` | blocks.md, links.md |
Po aktualizacji pakietu: `pnpm ipal:skills` (nowe wersje skilli), `pnpm payload generate:importmap`, `rm -rf .next`, restart dev, grep nowego symbolu w
diff --git a/docs/forms.md b/docs/forms.md
index eff27af..ad508e0 100644
--- a/docs/forms.md
+++ b/docs/forms.md
@@ -43,7 +43,7 @@ ipalKit({
forms: {
redirectRelationships: ['pages'], // formularz może przekierować na Page
// fields: { date: false, payment: true, … }, // domyślnie: text, textarea, email, number, date,
- // // select, radio, checkbox, checkboxGroup, message, step
+ // // time, select, radio, checkbox, checkboxGroup, message, step
},
})
```
@@ -80,14 +80,20 @@ formularza** — Local API czyta z `overrideAccess`, więc dokument ma zakładk
ręczne `` wysyłało je w HTML. Pod spodem `BuilderForm` (klient).
### Typy pól w panelu
-text, email, textarea, number, **date**, select, **radio**, checkbox, **Checkbox group**,
+text, email, textarea, number, **date**, **time** (1.11.1), select, **radio**, checkbox, **Checkbox group**,
message, **Step** (+ country/state jako tekst). Wyłączenie typu: `forms.fields: { date: false }`.
+**Placeholder** (1.11.1): text, email, textarea i number mają lokalizowane pole „Placeholder” — podpowiedź
+w pustym polu („np. 10:00–12:00”). `BuilderForm` i `useBuilderForm` (`getInputProps`, `getTextareaProps`)
+przekazują je same. Własny blok z tym polem: `withPlaceholder(block)` / `placeholderField` z roota;
+blok godziny: `timeBlock`. Nowe pola w blokach formularzy = migracja (`pnpm payload migrate:create`).
+
| Typ | Wartość | Serwer sprawdza |
|---|---|---|
| radio, select | jedna wartość | tylko wartości z panelu |
| Checkbox group | `string[]` (zapis: „www, seo”) | tylko wartości z panelu, bez duplikatów, `minSelected`/`maxSelected` |
| date | `YYYY-MM-DD` | prawdziwa data |
+| time | `HH:MM` (``) | godzina 00:00–23:59 |
| Step | — (podział) | nie jest polem |
### Formularz krokowy
diff --git a/docs/hooks.md b/docs/hooks.md
index 475aab6..9bae9d7 100644
--- a/docs/hooks.md
+++ b/docs/hooks.md
@@ -37,6 +37,11 @@ by wywaliło Payload przy generate:importmap / czystym Node). Projekt podaje.
Obsługuje: wszystkie języki, root (home), zmianę slug (rewaliduje stary I nowy
path — stary URL nie serwuje starej treści), delete.
+**Poza serwerem Next** (1.11.1) hook nic nie robi: `pnpm payload run`, seed przez `tsx`, migracje —
+brak `process.env.NEXT_RUNTIME`. Wcześniej Next rzucał `Invariant: static generation store missing`
+i seed padał. Celowe pominięcie (masowy import w aplikacji): `context: { disableRevalidate: true }`
+w wywołaniu Local API.
+
---
## setPublishedAtHook — auto-data publikacji
diff --git a/docs/links.md b/docs/links.md
index a58fac1..0b45aa1 100644
--- a/docs/links.md
+++ b/docs/links.md
@@ -51,7 +51,11 @@ puste → „Feature 02”. Komponent: `@intecion/ipal-kit/admin#RowLabel`. Zasa
Wartość linku: `type` (`internal` strona · `external` URL, `mailto:`, `tel:`,
`#anchor` · `file` upload), `page`, `url`, `file`, `label` (localized), `newTab`,
-`appearance`. W `payload-types.ts` powstaje typ **`CmsLink`**.
+`appearance`. W `payload-types.ts` powstaje typ **`CmsLink`**; link bez stylu (`appearances: false`)
+ma typ `CmsLinkPlain`, bez etykiety (`disableLabel`) — `CmsLinkNoLabel`, oba naraz — `CmsLinkPlainNoLabel`
+(od 1.11.1; wcześniej wszystkie nazywały się `CmsLink` i typ zależał od kolejności pól). Każdy z nich
+pasuje do `CmsLink`, więc `CMSLink` przyjmuje je bez zmian. Różne listy `appearances` albo `relationTo`
+w jednym projekcie → nadaj własną nazwę: `buildLinkField({ interfaceName: 'CategoryLink', … })`.
Plik do pobrania to link typu `file` — **nie** osobne pole `pdfUrl`.
diff --git a/docs/pages.md b/docs/pages.md
index 719e824..de53c6f 100644
--- a/docs/pages.md
+++ b/docs/pages.md
@@ -85,6 +85,15 @@ blockProps, render, jsonLd })` — PROGRAMISTA §2.8. `render` daje własny wido
(`route.type`: `page | home | archive | entry`), reszta zostaje domyślna.
Opcja `redirect` (z `next/navigation`) włącza tryb „strona w budowie” — [construction.md](./construction.md).
+**Brak strony → strona główna** (1.11.1): `onMissing: 'redirectHome'` (wymaga `redirect`) — adres bez strony
+i bez starego sluga (np. wycofane `/pl/uslugi`) przekierowuje (307) na stronę główną w tym samym języku
+(System Pages → Homepage). Bez przypisanej strony głównej albo gdy brakuje jej samej → zwykłe 404.
+Domyślnie `'notFound'`; własna decyzja: `onMissing: ({ locale, segments }) => redirect(…)`.
+
+```tsx
+const route = createPageRoute(content, { blocks: blockRegistry, notFound, permanentRedirect, redirect, onMissing: 'redirectHome' })
+```
+
Ręcznie (pełny plik — gdy potrzebujesz czegoś, czego `createNotFoundPage` nie ma):
```tsx
diff --git a/docs/richtext.md b/docs/richtext.md
index db12f72..a4a9fd6 100644
--- a/docs/richtext.md
+++ b/docs/richtext.md
@@ -53,6 +53,36 @@ const converters: JSXConvertersFunction = ({ defaultConverters }) => ({
Spread `defaultConverters` — nadpisujesz tylko te węzły, które chcesz. Reszta
(listy, tabele, obrazy, linki) działa z oficjalnej obsługi Payload.
+## Spis treści i kotwice nagłówków (1.11.1)
+
+Długie dokumenty (polityka prywatności, regulamin) — spis treści z linkami do sekcji.
+Id nagłówków w spisie i w treści liczy ta sama funkcja, więc się nie rozjadą.
+
+```tsx
+// config bloku
+import { buildTableOfContentsField } from '@intecion/ipal-kit'
+fields: [buildTableOfContentsField(), { name: 'content', type: 'richText' }] // grupa tableOfContents: show, label
+
+// komponent bloku (RSC)
+import { extractHeadings, RenderRichText } from '@intecion/ipal-kit/rsc'
+import { TableOfContents } from '@intecion/ipal-kit/client'
+
+const items = block.tableOfContents?.show ? extractHeadings(block.content) : [] // [{ id, text, level }]
+{items.length ? : null}
+
+```
+
+- `extractHeadings(content, { levels: ['h2'] })` — nagłówki w kolejności z tekstu; id = `toSlug(tekst)`,
+ powtórzenia `-2`, `-3`, puste nagłówki pomijane. Także z roota: `import { extractHeadings, headingText } from '@intecion/ipal-kit'`.
+- `RenderRichText headingIds` — `true` (h2) albo `{ levels, className }`. Twój konwerter `heading` dalej
+ renderuje nagłówek; plugin dokłada `id` (i `className`, np. `scroll-mt-*` pod przyklejonym nagłówkiem).
+- `` — bez stylów: `