Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
015092e773 | ||
|
|
f4d969ad29 | ||
|
|
fad5d778e8 | ||
|
|
0f073b963e |
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Entry point: @intecion/ipal-kit/env
|
||||
*
|
||||
* Environment validation ONLY — zero imports beyond this module, no Payload,
|
||||
* no Node built-ins, no React. Safe for Next's instrumentation.ts, which Next
|
||||
* also compiles for the Edge runtime: importing the package root there drags in
|
||||
* Payload / file-type / fs and crashes Turbopack ("Export fileTypeFromFile
|
||||
* doesn't exist in target module").
|
||||
*
|
||||
* // src/instrumentation.ts
|
||||
* import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
|
||||
* export function register() {
|
||||
* if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true }))
|
||||
* }
|
||||
*/
|
||||
export { assertEnv, ipalEnvRules } from '../modules/env/index.js';
|
||||
export type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from '../modules/env/index.js';
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Entry point: @intecion/ipal-kit/env
|
||||
*
|
||||
* Environment validation ONLY — zero imports beyond this module, no Payload,
|
||||
* no Node built-ins, no React. Safe for Next's instrumentation.ts, which Next
|
||||
* also compiles for the Edge runtime: importing the package root there drags in
|
||||
* Payload / file-type / fs and crashes Turbopack ("Export fileTypeFromFile
|
||||
* doesn't exist in target module").
|
||||
*
|
||||
* // src/instrumentation.ts
|
||||
* import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
|
||||
* export function register() {
|
||||
* if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true }))
|
||||
* }
|
||||
*/ export { assertEnv, ipalEnvRules } from '../modules/env/index.js';
|
||||
|
||||
//# sourceMappingURL=env.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/exports/env.ts"],"sourcesContent":["/**\n * Entry point: @intecion/ipal-kit/env\n *\n * Environment validation ONLY — zero imports beyond this module, no Payload,\n * no Node built-ins, no React. Safe for Next's instrumentation.ts, which Next\n * also compiles for the Edge runtime: importing the package root there drags in\n * Payload / file-type / fs and crashes Turbopack (\"Export fileTypeFromFile\n * doesn't exist in target module\").\n *\n * // src/instrumentation.ts\n * import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'\n * export function register() {\n * if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true }))\n * }\n */\nexport { assertEnv, ipalEnvRules } from '../modules/env/index.js'\nexport type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from '../modules/env/index.js'\n"],"names":["assertEnv","ipalEnvRules"],"mappings":"AAAA;;;;;;;;;;;;;;CAcC,GACD,SAASA,SAAS,EAAEC,YAAY,QAAQ,0BAAyB"}
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@
|
||||
}
|
||||
switch(kind){
|
||||
case 'boolean':
|
||||
if (!/^(true|false|1|0|yes|no)$/i.test(value)) {
|
||||
if (!/^(?:true|false|1|0|yes|no)$/i.test(value)) {
|
||||
return `${name} must be a boolean (true/false/1/0/yes/no, got "${value}")`;
|
||||
}
|
||||
break;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+13
-2
@@ -59,8 +59,19 @@
|
||||
kind: 'url'
|
||||
}, {
|
||||
name: 'R2_PUBLIC_URL',
|
||||
description: 'Public base URL media is served from',
|
||||
kind: 'url'
|
||||
description: 'Public base URL media is served from (custom domain of the bucket)',
|
||||
// Production: absolute URL (https://media.example.com). Outside production a
|
||||
// site-relative path ('/media') is accepted — buildR2Storage prefixes it with
|
||||
// NEXT_PUBLIC_SERVER_URL (e.g. a dev rewrite /media → bucket).
|
||||
validate: (v)=>{
|
||||
if (/^https?:\/\/[^/\s]+/i.test(v)) {
|
||||
return true;
|
||||
}
|
||||
if (v.startsWith('/') && process.env.NODE_ENV !== 'production') {
|
||||
return true;
|
||||
}
|
||||
return v.startsWith('/') ? `R2_PUBLIC_URL must be an absolute URL in production (got "${v}") — e.g. https://media.example.com` : `R2_PUBLIC_URL must be an absolute URL (https://…) or, outside production, a path starting with "/" (got "${v}")`;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (emailGraph) {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+4
-9
@@ -33,14 +33,9 @@ type CreateContentHelpersArgs = {
|
||||
settingsSlug?: string;
|
||||
/**
|
||||
* Browser look of `sitemapRoute` (/sitemap.xml). Default: built-in style,
|
||||
* header = Site Settings `siteName` (default locale), credit "Technology by
|
||||
* Intecion.com". `false` = raw XML. `{ credit: false }` hides the credit line.
|
||||
* header "XML Sitemap", credit "Technology by Intecion.com". `false` = raw XML.
|
||||
*/
|
||||
sitemapStyle?: {
|
||||
title?: string;
|
||||
} & Omit<SitemapStyleOptions, 'title'> | false;
|
||||
/** Site Settings field with the site name (sitemap header). Default 'siteName'. */
|
||||
siteNameField?: string;
|
||||
sitemapStyle?: false | SitemapStyleOptions;
|
||||
};
|
||||
/**
|
||||
* Bundles the per-request data helpers a frontend needs — the same cached
|
||||
@@ -68,7 +63,7 @@ type CreateContentHelpersArgs = {
|
||||
* a URL is, fetching gets the listing. Metadata generation needs the first and
|
||||
* not the second, and a page component composes them in two obvious lines.
|
||||
*/
|
||||
export declare function createContentHelpers({ baseUrl, config, content, i18n, pagesSlug, robots: robotsOptions, settingsSlug, sitemapStyle, siteNameField, }: CreateContentHelpersArgs): {
|
||||
export declare function createContentHelpers({ baseUrl, config, content, i18n, pagesSlug, robots: robotsOptions, settingsSlug, sitemapStyle, }: CreateContentHelpersArgs): {
|
||||
generatePageMetadata: (locale: string, segments: string[] | undefined, page?: number) => Promise<PageMetadata>;
|
||||
generateStaticParams: () => Promise<Array<{
|
||||
locale: string;
|
||||
@@ -84,6 +79,6 @@ export declare function createContentHelpers({ baseUrl, config, content, i18n, p
|
||||
resolveRoute: (locale: string, segments: string[] | undefined, page: number) => Promise<null | ResolvedRoute>;
|
||||
robots: () => RobotsRules;
|
||||
sitemap: () => Promise<SitemapEntry[]>;
|
||||
sitemapRoute: (req?: Request) => Promise<Response>;
|
||||
sitemapRoute: (req: Request) => Promise<Response>;
|
||||
};
|
||||
export {};
|
||||
|
||||
+2
-13
@@ -27,7 +27,7 @@ import { buildRobots, buildSitemapEntries, createPageMetadata, createSitemapRout
|
||||
* `resolveRoute` and `getEntries` are separate on purpose: routing decides what
|
||||
* a URL is, fetching gets the listing. Metadata generation needs the first and
|
||||
* not the second, and a page component composes them in two obvious lines.
|
||||
*/ export function createContentHelpers({ baseUrl, config, content, i18n, pagesSlug = 'pages', robots: robotsOptions, settingsSlug = 'site-settings', sitemapStyle, siteNameField = 'siteName' }) {
|
||||
*/ export function createContentHelpers({ baseUrl, config, content, i18n, pagesSlug = 'pages', robots: robotsOptions, settingsSlug = 'site-settings', sitemapStyle }) {
|
||||
const origin = baseUrl ?? process.env.NEXT_PUBLIC_SERVER_URL ?? '';
|
||||
const getCachedPayload = cache(async ()=>getPayload({
|
||||
config: await config
|
||||
@@ -318,18 +318,7 @@ import { buildRobots, buildSitemapEntries, createPageMetadata, createSitemapRout
|
||||
* export { sitemapRoute as GET } from '@/lib/content'
|
||||
* export const dynamic = 'force-dynamic'
|
||||
*/ const sitemapRoute = createSitemapRouteHandler(sitemap, {
|
||||
style: sitemapStyle === false ? false : {
|
||||
...sitemapStyle,
|
||||
title: sitemapStyle?.title ?? (async ()=>{
|
||||
const locale = i18n?.defaultLocale;
|
||||
if (!locale) {
|
||||
return undefined;
|
||||
}
|
||||
const s = await getSettings(locale);
|
||||
const name = s?.[siteNameField];
|
||||
return typeof name === 'string' ? name : undefined;
|
||||
})
|
||||
}
|
||||
style: sitemapStyle ?? {}
|
||||
});
|
||||
return {
|
||||
generatePageMetadata,
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+2
-1
@@ -68,7 +68,8 @@
|
||||
"'none'"
|
||||
]
|
||||
};
|
||||
if (r2Url) {
|
||||
// Site-relative R2_PUBLIC_URL ('/media', dev) is same-origin — already covered by 'self'.
|
||||
if (r2Url && /^https?:\/\//i.test(r2Url)) {
|
||||
src['img-src'].push(r2Url);
|
||||
}
|
||||
if (turnstile) {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -56,4 +56,4 @@ export type SitemapRouteOptions = {
|
||||
* `GET /sitemap.xml` → XML (crawlers), `GET /sitemap.xml?style` → its CSS.
|
||||
* Don't keep app/sitemap.ts next to it — two sitemaps confuse crawlers.
|
||||
*/
|
||||
export declare function createSitemapRouteHandler(sitemap: () => Promise<SitemapEntry[]>, opts?: SitemapRouteOptions): (req?: Request) => Promise<Response>;
|
||||
export declare function createSitemapRouteHandler(sitemap: () => Promise<SitemapEntry[]>, opts?: SitemapRouteOptions): (req: Request) => Promise<Response>;
|
||||
|
||||
Vendored
+5
-3
@@ -61,9 +61,11 @@ import { buildSitemapCss, SITEMAP_STYLE_PARAM } from './sitemapStyle.js';
|
||||
* Don't keep app/sitemap.ts next to it — two sitemaps confuse crawlers.
|
||||
*/ export function createSitemapRouteHandler(sitemap, opts = {}) {
|
||||
const style = opts.cssUrl ? false : opts.style === false ? false : opts.style ?? {};
|
||||
// `req` is required: Next 16 type-checks the first argument of a route handler
|
||||
// (`Request | undefined` fails the build). A zero-argument call is not supported.
|
||||
return async (req)=>{
|
||||
const url = req ? new URL(req.url) : null;
|
||||
if (style && url?.searchParams.has(SITEMAP_STYLE_PARAM)) {
|
||||
const url = new URL(req.url);
|
||||
if (style && url.searchParams.has(SITEMAP_STYLE_PARAM)) {
|
||||
let title;
|
||||
try {
|
||||
title = typeof style.title === 'function' ? await style.title() : style.title;
|
||||
@@ -81,7 +83,7 @@ import { buildSitemapCss, SITEMAP_STYLE_PARAM } from './sitemapStyle.js';
|
||||
}
|
||||
});
|
||||
}
|
||||
const cssUrl = opts.cssUrl ?? (style ? `${url?.pathname ?? '/sitemap.xml'}?${SITEMAP_STYLE_PARAM}` : undefined);
|
||||
const cssUrl = opts.cssUrl ?? (style ? `${url.pathname}?${SITEMAP_STYLE_PARAM}` : undefined);
|
||||
try {
|
||||
const entries = await sitemap();
|
||||
const xml = buildSitemapXml(entries, {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -12,7 +12,7 @@ export type SitemapStyleOptions = {
|
||||
* "Technology by Intecion.com". `false` hides it.
|
||||
*/
|
||||
credit?: false | string;
|
||||
/** Header line. Default: the site name from Site Settings (sitemapRoute), else "XML Sitemap". */
|
||||
/** Header line. Default "XML Sitemap". */
|
||||
title?: string;
|
||||
};
|
||||
/** Query parameter on the sitemap URL that returns the stylesheet instead of XML. */
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+5
-1
@@ -45,8 +45,12 @@
|
||||
// (media.klient.pl → bucket) set R2_PUBLIC_URL so Payload generates URLs
|
||||
// pointing there. Without it, uploads work but images don't display publicly.
|
||||
// See docs/storage.md.
|
||||
const publicUrl = process.env.R2_PUBLIC_URL?.replace(/\/$/, '') // strip trailing slash
|
||||
// Site-relative value ('/media', dev only — ipalEnvRules rejects it in production)
|
||||
// → prefixed with NEXT_PUBLIC_SERVER_URL so Payload still stores absolute URLs.
|
||||
const rawPublicUrl = process.env.R2_PUBLIC_URL?.trim().replace(/\/$/, '') // strip trailing slash
|
||||
;
|
||||
const serverUrl = process.env.NEXT_PUBLIC_SERVER_URL?.trim().replace(/\/$/, '');
|
||||
const publicUrl = rawPublicUrl?.startsWith('/') && serverUrl ? `${serverUrl}${rawPublicUrl}` : rawPublicUrl;
|
||||
// generateFileURL is a PER-COLLECTION option in @payloadcms/storage-s3 (not a
|
||||
// top-level one) — R2 needs it to point served URLs at the custom domain
|
||||
// instead of the private S3 endpoint. Each collection gets either `true`
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* @intecion/ipal-kit/fluid.css — fluid type & spacing scale (variables only, no classes).
|
||||
* Scales smoothly from a 360px to a 1280px viewport; rem-based, so browser zoom and
|
||||
* user font size still work (WCAG 1.4.4). Opt-in:
|
||||
*
|
||||
* @import "tailwindcss";
|
||||
* @import "@intecion/ipal-kit/fluid.css";
|
||||
* @theme inline {
|
||||
* --text-display: var(--ipal-fs-display);
|
||||
* --text-h1: var(--ipal-fs-h1);
|
||||
* --text-h2: var(--ipal-fs-h2);
|
||||
* --text-h3: var(--ipal-fs-h3);
|
||||
* --text-lead: var(--ipal-fs-lg);
|
||||
* --spacing-section: var(--ipal-space-section);
|
||||
* --spacing-gutter: var(--ipal-space-gutter);
|
||||
* --spacing-gap: var(--ipal-space-gap);
|
||||
* }
|
||||
* → text-h1, text-display, py-section, px-gutter, gap-gap
|
||||
*
|
||||
* The design (DESIGN.md) decides the numbers: override any variable in the project's
|
||||
* :root — the plugin only removes the clamp() maths from every project.
|
||||
*/
|
||||
:root {
|
||||
--ipal-fs-sm: clamp(0.875rem, 0.8505rem + 0.1087vw, 0.9375rem); /* 0.875→0.9375rem · small print, captions */
|
||||
--ipal-fs-base: clamp(1rem, 0.9511rem + 0.2174vw, 1.125rem); /* 1→1.125rem · body text */
|
||||
--ipal-fs-lg: clamp(1.125rem, 1.0272rem + 0.4348vw, 1.375rem); /* 1.125→1.375rem · lead / intro */
|
||||
--ipal-fs-h3: clamp(1.25rem, 1.0543rem + 0.8696vw, 1.75rem); /* 1.25→1.75rem · h3 */
|
||||
--ipal-fs-h2: clamp(1.5rem, 1.1087rem + 1.7391vw, 2.5rem); /* 1.5→2.5rem · h2 — section headings */
|
||||
--ipal-fs-h1: clamp(2rem, 1.413rem + 2.6087vw, 3.5rem); /* 2→3.5rem · h1 — page heading */
|
||||
--ipal-fs-display: clamp(2.5rem, 1.7174rem + 3.4783vw, 4.5rem); /* 2.5→4.5rem · hero / display */
|
||||
--ipal-space-gap: clamp(1rem, 0.6087rem + 1.7391vw, 2rem); /* 1→2rem · gap between items in a section */
|
||||
--ipal-space-gutter: clamp(1rem, 0.413rem + 2.6087vw, 2.5rem); /* 1→2.5rem · container side padding */
|
||||
--ipal-space-section: clamp(3rem, 1.2391rem + 7.8261vw, 7.5rem); /* 3→7.5rem · vertical padding of a section */
|
||||
}
|
||||
+7
-3
@@ -168,7 +168,7 @@ src/
|
||||
sitemap.xml/route.ts # sitemapRoute z lib/content + force-dynamic (wygląd z pluginu)
|
||||
robots.ts # z lib/content
|
||||
api/health/route.ts # createHealthRoute
|
||||
instrumentation.ts # assertEnv(ipalEnvRules({...}))
|
||||
instrumentation.ts # assertEnv(ipalEnvRules({...})) z '@intecion/ipal-kit/env'
|
||||
fields/ # sectionHeader.ts, sectionSettings.ts (linki: z pluginu)
|
||||
components/
|
||||
ui/ # prymitywy: CMSLink, Button, Media, Section, SectionHeader
|
||||
@@ -221,7 +221,7 @@ Bez skrótów (`HeroSection`, nie `HeroSec`). Nie twórz `lib/pages.ts`,
|
||||
7. **`export const dynamic = 'force-dynamic'`** na trasach czytających bazę:
|
||||
`manifest.ts`, `sitemap.xml/route.ts`, `llms.txt`, `api/health`. Handlery
|
||||
pluginu mają try/catch, ale `dynamic` musi być w pliku trasy.
|
||||
8. **`instrumentation.ts`** z `assertEnv(ipalEnvRules({...}))` (env.md).
|
||||
8. **`instrumentation.ts`** z `assertEnv(ipalEnvRules({...}))` importowanym z **`@intecion/ipal-kit/env`** (root ciągnie Payload → crash Edge/Turbopack), w `if (process.env.NEXT_RUNTIME === 'nodejs')` (env.md).
|
||||
9. **RSC domyślnie.** `'use client'` tylko dla stanu/interakcji, w osobnym pliku;
|
||||
sekcja zostaje serwerowa i podaje mu dane. Sekrety: `import 'server-only'`.
|
||||
10. **Bloki nie importują `lib/*`** (cykl). Dane server-side → `enhanceProps`.
|
||||
@@ -535,6 +535,10 @@ bloku nie importował Reacta). Kod: [kod-sekcji.md](./skills/ipal-block/resource
|
||||
ze źródła `DESIGN.md`. W komponentach tylko tokeny (`bg-primary`), **nigdy**
|
||||
`bg-[#ff6600]` ani hex.
|
||||
- Tokeny pluginu mapuj na projekt: `--ipal-primary: var(--color-primary)`.
|
||||
- Płynna typografia i odstępy: `@import "@intecion/ipal-kit/fluid.css"` + mapowanie w
|
||||
`@theme` (`text-h1`, `py-section`, `px-gutter` — PROGRAMISTA §2.5). Nie pisz `clamp()`
|
||||
w komponentach; inne wartości z `DESIGN.md` → nadpisz zmienne `--ipal-*` w `:root`.
|
||||
- JSON-LD tylko przez `<JsonLdGraph>` z `/rsc` — nigdy własny `<script dangerouslySetInnerHTML>`.
|
||||
- Fonty przez `next/font`, podpięte zmienną CSS do `@theme`.
|
||||
- Bez CSS Modules i `style={{…}}` — wyjątek: wartość dynamiczna z danych.
|
||||
- Warianty → `Record<Variant, string>`, nie łańcuchy ternary.
|
||||
@@ -581,7 +585,7 @@ Przykładowy `styles.css`: [kod-sekcji.md](./skills/ipal-block/resources/kod-sek
|
||||
| Nagłówki, CSP, 2FA | `buildSecurityHeaders`, `buildCsp`, `twoFactor` (wstrzyknięty `payloadTotp`) | security.md |
|
||||
| Media, R2 | `buildR2Storage(['media'], { s3Storage })` (adapter wstrzyknięty), `normalizeFilenameHook`, `buildOptimizeUploadHook` + `buildOptimizeUploadField`, `MediaPreconnect` | storage.md |
|
||||
| Email | `email: mailAdapter()` | email.md |
|
||||
| Walidacja env | `assertEnv(ipalEnvRules({...}))` | env.md |
|
||||
| Walidacja env | `assertEnv(ipalEnvRules({...}))` z `@intecion/ipal-kit/env` | env.md |
|
||||
|
||||
**Compliance (PL/EU) — mechanizm z pluginu, treść od klienta:** strony polityk
|
||||
jako System Pages, `CookieBanner` + `CookieButton`, checkbox `consent` w
|
||||
|
||||
@@ -167,7 +167,13 @@ report WARNING "files that usually duplicate the plugin" "§3 plugin has resolve
|
||||
report ERROR "project copy of link fields" "links.md — use buildLinkField / buildLinksField / resolveLinkHref from the plugin" \
|
||||
"$(ls src/fields/link.ts src/lib/links.ts 2>/dev/null; g "from '@/fields/link'|from '@/lib/links'" src --include=*.ts --include=*.tsx)"
|
||||
report ERROR "manual Lexical rendering" "§7 use RenderRichText" \
|
||||
"$(g 'node\.type *===|dangerouslySetInnerHTML' src --include=*.tsx)"
|
||||
"$(g 'node\.type *===' src --include=*.tsx | nc 'node')"
|
||||
HTML=$(node "$(dirname "$0")/html-check.mjs" src)
|
||||
while IFS= read -r rule; do
|
||||
[ -z "$rule" ] && continue
|
||||
level=${rule%%|*}; title=${rule#*|}
|
||||
report "$level" "$title" "§7 / seo.md" "$(printf '%s\n' "$HTML" | grep -F "$rule|" | cut -d'|' -f3-)"
|
||||
done <<< "$(printf '%s\n' "$HTML" | cut -d'|' -f1-2 | sort -u)"
|
||||
|
||||
# --- Compile & build ---
|
||||
if [ "$QUICK" -eq 0 ]; then
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env node
|
||||
// Raw HTML in JSX (dangerouslySetInnerHTML), classified — prints "LEVEL|rule|file:line", exit 0.
|
||||
// node html-check.mjs src
|
||||
// - inline JSON-LD (<script type="application/ld+json">) without '<' escaping → ERROR (XSS:
|
||||
// a "</script>" typed in the panel breaks out of the tag) → JsonLdGraph from /rsc
|
||||
// - inline JSON-LD with escaping → WARNING (works; JsonLdGraph is the shared version)
|
||||
// - anything else → WARNING (rich text → RenderRichText; other HTML must be sanitized)
|
||||
import { readFileSync, readdirSync, statSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
|
||||
const files = []
|
||||
const walk = (p) => {
|
||||
let st
|
||||
try { st = statSync(p) } catch { return }
|
||||
if (st.isDirectory()) { if (!/node_modules|\.next/.test(p)) for (const n of readdirSync(p)) walk(join(p, n)) }
|
||||
else if (/\.(tsx|jsx)$/.test(p)) files.push(p)
|
||||
}
|
||||
process.argv.slice(2).forEach(walk)
|
||||
|
||||
for (const file of files) {
|
||||
// blank out comments (keeps offsets/line numbers)
|
||||
const src = readFileSync(file, 'utf8')
|
||||
.replace(/\/\*[\s\S]*?\*\//g, (c) => c.replace(/[^\n]/g, ' '))
|
||||
.replace(/(^|[^:'"`])\/\/.*$/gm, (c, p) => p + ' '.repeat(c.length - p.length))
|
||||
for (const m of src.matchAll(/dangerouslySetInnerHTML/g)) {
|
||||
// the element this prop belongs to: from its opening "<tag" to the end of the prop's {{ … }}
|
||||
const open = src.lastIndexOf('<', m.index)
|
||||
const close = src.indexOf('}}', m.index)
|
||||
const el = src.slice(open, close < 0 ? m.index + 400 : close + 2)
|
||||
const at = `${file}:${src.slice(0, m.index).split('\n').length}`
|
||||
if (/^<script\b/.test(el) && /application\/ld\+json/.test(el)) {
|
||||
if (/u003c|replace\(\/</.test(el)) console.log(`WARNING|inline JSON-LD — use <JsonLdGraph schemas={[…]}/> from @intecion/ipal-kit/rsc (seo.md)|${at}`)
|
||||
else console.log(`ERROR|unescaped JSON-LD in <script> — XSS via "</script>" in panel text; use <JsonLdGraph/> from @intecion/ipal-kit/rsc|${at}`)
|
||||
} else {
|
||||
console.log(`WARNING|raw HTML (dangerouslySetInnerHTML) — rich text → RenderRichText; other HTML must be sanitized|${at}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,8 @@ tej procedury. Pytasz tylko, gdy brakuje czegoś, czego nie możesz uzyskać sam
|
||||
| build pada `ENOTFOUND` / Mongoose | trasa czyta bazę w buildzie bez bazy | sitemap/robots/llms: `export const dynamic = 'force-dynamic'` (tylko one) |
|
||||
| `slug.join is not a function` | `[slug]` zamiast `[[...slug]]` | zmień nazwę folderu |
|
||||
| `Missing <html> and <body>` | layout `[locale]` bez `<html>` po usunięciu root layoutu | `<html lang>` i `<body>` w `[locale]/layout.tsx` |
|
||||
| `Export fileTypeFromFile doesn't exist in target module` (Turbopack, start dev) | `instrumentation.ts` importuje z roota pakietu → Payload w bundlu Edge | import z `@intecion/ipal-kit/env` + `NEXT_RUNTIME === 'nodejs'` (env.md) |
|
||||
| `R2_PUBLIC_URL must be a valid URL (got "/media")` | stara wersja reguły / produkcja ze ścieżką względną | dev: `/media` dozwolone od nowej wersji; produkcja: pełny URL domeny bucketu |
|
||||
| `server-only` w kliencie | import z `@intecion/ipal-kit/server` w `'use client'` | wywołuj przez server action |
|
||||
|
||||
### Panel (`/admin`)
|
||||
|
||||
@@ -32,7 +32,7 @@ tylko, gdy użytkownik o to poprosi. Pełna budowa strony: skill **ipal-site**.
|
||||
`not-found.tsx` z `LocaleView` — bez `headers()`, wersja na każdy język (PROGRAMISTA §2.6–2.8, pages.md).
|
||||
7. **SEO i bezpieczeństwo** — sitemap (`sitemap.xml/route.ts` = `sitemapRoute`, bez CSS w `public/`), robots, manifest, llms.txt, health
|
||||
(wszystkie z `force-dynamic`), `htmlLimitedBots`, `buildSecurityHeaders`,
|
||||
`instrumentation.ts` z `assertEnv` (PROGRAMISTA §2.8–2.9).
|
||||
`instrumentation.ts` z `assertEnv` z `@intecion/ipal-kit/env` (PROGRAMISTA §2.8–2.9, env.md).
|
||||
8. **Nawigacja** — skill **ipal-nav**.
|
||||
9. `pnpm generate:types`, `pnpm payload generate:importmap`, skill **ipal-audit**
|
||||
(pełny), lista kroków w panelu dla użytkownika (PROGRAMISTA §2.11).
|
||||
|
||||
+20
-2
@@ -158,8 +158,23 @@ export default { plugins: { '@tailwindcss/postcss': {} } }
|
||||
```css
|
||||
/* src/app/(frontend)/styles.css */
|
||||
@import "tailwindcss";
|
||||
@import "@intecion/ipal-kit/fluid.css"; /* opcjonalnie: płynna skala typografii i odstępów */
|
||||
@source "../../../node_modules/@intecion/ipal-kit/dist/**/*.js";
|
||||
|
||||
@theme inline {
|
||||
--text-display: var(--ipal-fs-display);
|
||||
--text-h1: var(--ipal-fs-h1);
|
||||
--text-h2: var(--ipal-fs-h2);
|
||||
--text-h3: var(--ipal-fs-h3);
|
||||
--text-lead: var(--ipal-fs-lg);
|
||||
--spacing-section: var(--ipal-space-section);
|
||||
--spacing-gutter: var(--ipal-space-gutter);
|
||||
--spacing-gap: var(--ipal-space-gap);
|
||||
}
|
||||
```
|
||||
`fluid.css` to same zmienne `clamp()` (360 → 1280 px, w `rem`) — klasy `text-h1`,
|
||||
`py-section`, `px-gutter`. Liczby z `DESIGN.md` nadpisujesz w `:root` projektu
|
||||
(`--ipal-fs-h1: clamp(…)`); formuł nie piszesz od zera.
|
||||
Bez `@source` komponenty pluginu (baner cookies, Turnstile) są bez stylów.
|
||||
Kolory komponentów pluginu: `--ipal-primary`, `--ipal-radius` (consent.md).
|
||||
|
||||
@@ -305,7 +320,7 @@ export const dynamic = 'force-dynamic'
|
||||
export const GET = createHealthRoute({ getCachedPayload })
|
||||
```
|
||||
Jeden sitemap: `sitemap.xml/route.ts` **albo** `sitemap.ts` — nigdy oba. Nagłówek
|
||||
sitemapy = `siteName` z Site Settings, pod nim „Technology by Intecion.com”; zmiana
|
||||
sitemapy = „XML Sitemap”, pod nim „Technology by Intecion.com”; zmiana
|
||||
przez `createContentHelpers({ sitemapStyle })` (seo.md).
|
||||
|
||||
### 2.9 next.config.ts i instrumentation.ts
|
||||
@@ -325,7 +340,7 @@ export default withPayload({
|
||||
})
|
||||
```
|
||||
CSP (`buildCsp`) — najpierw `report-only`, po sprawdzeniu konsoli `enforce`
|
||||
(security.md). `src/instrumentation.ts`: `assertEnv(ipalEnvRules({...}))` (env.md).
|
||||
(security.md). `src/instrumentation.ts`: `assertEnv(ipalEnvRules({...}))` z **`@intecion/ipal-kit/env`**, tylko gdy `NEXT_RUNTIME === 'nodejs'` (env.md).
|
||||
|
||||
### 2.10 Generowanie i start
|
||||
```bash
|
||||
@@ -472,6 +487,9 @@ Rób po jednej pozycji, buduj, sprawdzaj. Kolejność wg wagi:
|
||||
| 15d | brak limitów na za duże obrazy / wideo w Media | `buildOptimizeUploadHook()` + `buildOptimizeUploadField()`, migracja pola | storage.md |
|
||||
| 15e | tablice „Add Row”, wiersze „Item 01”, `cta1`/`cta2`, etykiety PL w panelu | `labels` + `rowLabel()` na tablicach, sloty → tablica (z migracją!), etykiety EN — AGENT.md §6.5a; po aktualizacji pluginu **`pnpm payload generate:importmap`** (buildLinksField używa `RowLabel`) | links.md |
|
||||
| 15f | `public/sitemap.css` + własna trasa / `app/sitemap.ts` | `app/sitemap.xml/route.ts`: `export { sitemapRoute as GET } from '@/lib/content'` + `force-dynamic`; usuń `public/sitemap.css` i `app/sitemap.ts` | seo.md |
|
||||
| 15g | `instrumentation.ts` importuje z roota (crash Edge/Turbopack: `fileTypeFromFile`) | `import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'` + `if (process.env.NEXT_RUNTIME !== 'nodejs') return`; usuń dynamiczny `await import` | env.md |
|
||||
| 15h | `<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(…) }}>` | `<JsonLdGraph schemas={[…]} />` z `@intecion/ipal-kit/rsc` (escapuje `<` — bez tego `</script>` w panelu = XSS) | seo.md |
|
||||
| 15i | własne formuły `clamp()` w `styles.css` | `@import "@intecion/ipal-kit/fluid.css"` + mapowanie w `@theme` (§2.5) | — |
|
||||
| 16 | 404 na sztywno | rola 404 w System Pages + `getNotFoundPage` | pages.md |
|
||||
| 16a | `privacyPolicy: { label: 'Polityka prywatności', … }` w layoucie | usuń cały parametr; tekst wpisz w Cookie Settings → Privacy link label | consent.md |
|
||||
| 17 | Opcjonalnie — AI/GEO | Markdown per strona, llms-full, boty AI w robots, MCP, wyszukiwarka, speakable, aiSummary | content.md, seo.md, mcp.md |
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ Zrób wg PROGRAMISTA.md §2.8–2.9 i seo.md:
|
||||
- next.config.ts: htmlLimitedBots, buildSecurityHeaders,
|
||||
- metadata strony przez generatePageMetadata z lib/content (wspólny cache), favicon przez buildIconsMetadata,
|
||||
- JSON-LD w root layoucie: Organization + WebSite (seo.md) z danych z panelu,
|
||||
- src/instrumentation.ts z assertEnv(ipalEnvRules(...)) (env.md).
|
||||
- src/instrumentation.ts z assertEnv(ipalEnvRules(...)) importowanym z @intecion/ipal-kit/env (env.md).
|
||||
CSP jeszcze nie — będzie w kroku 14.
|
||||
Plan najpierw.
|
||||
```
|
||||
|
||||
+19
-4
@@ -20,14 +20,21 @@ Najlepsze miejsce to `instrumentation.ts` (Next woła `register()` raz przy
|
||||
starcie serwera):
|
||||
|
||||
```ts
|
||||
// instrumentation.ts
|
||||
import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit'
|
||||
// src/instrumentation.ts
|
||||
import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
|
||||
|
||||
export function register() {
|
||||
if (process.env.NEXT_RUNTIME !== 'nodejs') return // Edge: brak process.env serwera
|
||||
assertEnv(ipalEnvRules({ storage: true, emailGraph: true, turnstile: true }))
|
||||
}
|
||||
```
|
||||
|
||||
> **Import z `@intecion/ipal-kit/env`, nie z roota.** Next kompiluje
|
||||
> `instrumentation.ts` także dla Edge. Root pakietu ciągnie Payload, `file-type`,
|
||||
> `fs` — Turbopack pada (`Export fileTypeFromFile doesn't exist in target module`).
|
||||
> `/env` to tylko walidator, zero zależności. Root nadal eksportuje `assertEnv`
|
||||
> (np. dla `payload.config.ts`).
|
||||
|
||||
Alternatywnie na górze `payload.config.ts` (ładuje się i w buildzie, i w
|
||||
runtime). Działa tylko po stronie serwera (czyta `process.env`) — NIE importuj
|
||||
do komponentu klienckiego.
|
||||
@@ -114,6 +121,14 @@ redeployów.
|
||||
## Eksport
|
||||
|
||||
```ts
|
||||
import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit'
|
||||
import type { EnvRule, EnvKind, AssertEnvOptions, IpalEnvFeatures } from '@intecion/ipal-kit'
|
||||
import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
|
||||
import type { EnvRule, EnvKind, AssertEnvOptions, IpalEnvFeatures } from '@intecion/ipal-kit/env'
|
||||
```
|
||||
|
||||
## `R2_PUBLIC_URL` — produkcja vs dev
|
||||
|
||||
`ipalEnvRules({ storage: true })` wymaga w **produkcji** pełnego URL-a
|
||||
(`https://media.klient.pl`). Poza produkcją dopuszcza ścieżkę względną
|
||||
(`/media`) — `buildR2Storage` dokleja do niej `NEXT_PUBLIC_SERVER_URL`, CSP jej nie
|
||||
dodaje (to `'self'`), `MediaPreconnect` ją pomija. Dev bez bucketu: nie ustawiaj
|
||||
`R2_*` wcale i nie włączaj `storage` — media lądują na dysku.
|
||||
|
||||
+1
-3
@@ -1079,7 +1079,7 @@ export { sitemapRoute as GET } from '@/lib/content'
|
||||
export const dynamic = 'force-dynamic'
|
||||
```
|
||||
|
||||
- **Nagłówek** = `siteName` z Site Settings (język domyślny); brak → „XML Sitemap”.
|
||||
- **Nagłówek** = „XML Sitemap” (bez nazwy firmy/strony).
|
||||
- **Linia pod nagłówkiem** = dostawca technologii: „Technology by Intecion.com”.
|
||||
- To CSS na XML (`<?xml-stylesheet type="text/css"?>`, standard W3C) — **nie XSLT**,
|
||||
które przeglądarki wycofują. Google ignoruje dyrektywę; zero wpływu na SEO.
|
||||
@@ -1090,9 +1090,7 @@ createContentHelpers({
|
||||
config, content, i18n: i18nConfig,
|
||||
sitemapStyle: { accent: '#0f766e' }, // kolor akcentu
|
||||
// sitemapStyle: { credit: false }, // bez linii dostawcy
|
||||
// sitemapStyle: { title: 'Sitemap' }, // stały nagłówek zamiast siteName
|
||||
// sitemapStyle: false, // surowy XML (natywny widok przeglądarki)
|
||||
// siteNameField: 'name', // gdy pole nazwy w Site Settings ma inną nazwę
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ S3. Dodaj zmienną i przekaż ją do adaptera:
|
||||
```bash
|
||||
# .env
|
||||
R2_PUBLIC_URL=https://media.klient.pl
|
||||
# dev z rewrite /media → bucket: R2_PUBLIC_URL=/media (tylko poza produkcją; env.md)
|
||||
```
|
||||
|
||||
Adapter `buildR2Storage` czyta ją i ustawia jako bazowy URL mediów (jeśli
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@intecion/ipal-kit",
|
||||
"version": "1.8.8",
|
||||
"version": "1.8.10",
|
||||
"description": "Intecion Payload Advanced Library — a Payload CMS 3 plugin: i18n, SEO, forms, consent, analytics, blog/archives.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Entry point: @intecion/ipal-kit/env
|
||||
*
|
||||
* Environment validation ONLY — zero imports beyond this module, no Payload,
|
||||
* no Node built-ins, no React. Safe for Next's instrumentation.ts, which Next
|
||||
* also compiles for the Edge runtime: importing the package root there drags in
|
||||
* Payload / file-type / fs and crashes Turbopack ("Export fileTypeFromFile
|
||||
* doesn't exist in target module").
|
||||
*
|
||||
* // src/instrumentation.ts
|
||||
* import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
|
||||
* export function register() {
|
||||
* if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true }))
|
||||
* }
|
||||
*/
|
||||
export { assertEnv, ipalEnvRules } from '../modules/env/index.js'
|
||||
export type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from '../modules/env/index.js'
|
||||
Vendored
+1
-1
@@ -43,7 +43,7 @@ function checkValue(rule: EnvRule, value: string): null | string {
|
||||
|
||||
switch (kind) {
|
||||
case 'boolean':
|
||||
if (!/^(true|false|1|0|yes|no)$/i.test(value)) {
|
||||
if (!/^(?:true|false|1|0|yes|no)$/i.test(value)) {
|
||||
return `${name} must be a boolean (true/false/1/0/yes/no, got "${value}")`
|
||||
}
|
||||
break
|
||||
|
||||
Vendored
+15
-6
@@ -53,11 +53,7 @@ export function ipalEnvRules(features: IpalEnvFeatures = {}): EnvRule[] {
|
||||
const rules: EnvRule[] = [
|
||||
{ name: databaseVar, description: 'Database connection string (e.g. MongoDB URI)' },
|
||||
{ name: secretVar, description: 'Payload secret used to sign tokens' },
|
||||
{
|
||||
name: serverUrlVar,
|
||||
description: 'Public site origin, e.g. https://example.com',
|
||||
kind: 'url',
|
||||
},
|
||||
{ name: serverUrlVar, description: 'Public site origin, e.g. https://example.com', kind: 'url' },
|
||||
{
|
||||
name: 'NODE_ENV',
|
||||
description: 'Node environment',
|
||||
@@ -72,7 +68,20 @@ export function ipalEnvRules(features: IpalEnvFeatures = {}): EnvRule[] {
|
||||
{ name: 'R2_ACCESS_KEY_ID', description: 'R2 access key id' },
|
||||
{ name: 'R2_SECRET_ACCESS_KEY', description: 'R2 secret access key' },
|
||||
{ name: 'R2_ENDPOINT', description: 'R2 S3 API endpoint URL', kind: 'url' },
|
||||
{ name: 'R2_PUBLIC_URL', description: 'Public base URL media is served from', kind: 'url' },
|
||||
{
|
||||
name: 'R2_PUBLIC_URL',
|
||||
description: 'Public base URL media is served from (custom domain of the bucket)',
|
||||
// Production: absolute URL (https://media.example.com). Outside production a
|
||||
// site-relative path ('/media') is accepted — buildR2Storage prefixes it with
|
||||
// NEXT_PUBLIC_SERVER_URL (e.g. a dev rewrite /media → bucket).
|
||||
validate: (v) => {
|
||||
if (/^https?:\/\/[^/\s]+/i.test(v)) {return true}
|
||||
if (v.startsWith('/') && process.env.NODE_ENV !== 'production') {return true}
|
||||
return v.startsWith('/')
|
||||
? `R2_PUBLIC_URL must be an absolute URL in production (got "${v}") — e.g. https://media.example.com`
|
||||
: `R2_PUBLIC_URL must be an absolute URL (https://…) or, outside production, a path starting with "/" (got "${v}")`
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -41,12 +41,9 @@ type CreateContentHelpersArgs = {
|
||||
settingsSlug?: string
|
||||
/**
|
||||
* Browser look of `sitemapRoute` (/sitemap.xml). Default: built-in style,
|
||||
* header = Site Settings `siteName` (default locale), credit "Technology by
|
||||
* Intecion.com". `false` = raw XML. `{ credit: false }` hides the credit line.
|
||||
* header "XML Sitemap", credit "Technology by Intecion.com". `false` = raw XML.
|
||||
*/
|
||||
sitemapStyle?: { title?: string } & Omit<SitemapStyleOptions, 'title'> | false
|
||||
/** Site Settings field with the site name (sitemap header). Default 'siteName'. */
|
||||
siteNameField?: string
|
||||
sitemapStyle?: false | SitemapStyleOptions
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +81,6 @@ export function createContentHelpers({
|
||||
robots: robotsOptions,
|
||||
settingsSlug = 'site-settings',
|
||||
sitemapStyle,
|
||||
siteNameField = 'siteName',
|
||||
}: CreateContentHelpersArgs) {
|
||||
const origin = baseUrl ?? process.env.NEXT_PUBLIC_SERVER_URL ?? ''
|
||||
const getCachedPayload = cache(
|
||||
@@ -401,23 +397,7 @@ export function createContentHelpers({
|
||||
* export { sitemapRoute as GET } from '@/lib/content'
|
||||
* export const dynamic = 'force-dynamic'
|
||||
*/
|
||||
const sitemapRoute = createSitemapRouteHandler(sitemap, {
|
||||
style:
|
||||
sitemapStyle === false
|
||||
? false
|
||||
: {
|
||||
...sitemapStyle,
|
||||
title:
|
||||
sitemapStyle?.title ??
|
||||
(async () => {
|
||||
const locale = i18n?.defaultLocale
|
||||
if (!locale) {return undefined}
|
||||
const s = (await getSettings(locale)) as Record<string, unknown>
|
||||
const name = s?.[siteNameField]
|
||||
return typeof name === 'string' ? name : undefined
|
||||
}),
|
||||
},
|
||||
})
|
||||
const sitemapRoute = createSitemapRouteHandler(sitemap, { style: sitemapStyle ?? {} })
|
||||
|
||||
return {
|
||||
generatePageMetadata,
|
||||
|
||||
@@ -76,7 +76,8 @@ export function buildCsp(args: BuildCspArgs = {}): { key: string; value: string
|
||||
'object-src': ["'none'"], // block <object>/<embed> (Flash-era attack surface)
|
||||
}
|
||||
|
||||
if (r2Url) {src['img-src'].push(r2Url)}
|
||||
// Site-relative R2_PUBLIC_URL ('/media', dev) is same-origin — already covered by 'self'.
|
||||
if (r2Url && /^https?:\/\//i.test(r2Url)) {src['img-src'].push(r2Url)}
|
||||
|
||||
if (turnstile) {
|
||||
src['script-src'].push('https://challenges.cloudflare.com')
|
||||
@@ -110,7 +111,6 @@ export function buildCsp(args: BuildCspArgs = {}): { key: string; value: string
|
||||
.map(([dir, values]) => `${dir} ${values.join(' ')}`)
|
||||
.join('; ')
|
||||
|
||||
const key =
|
||||
mode === 'report-only' ? 'Content-Security-Policy-Report-Only' : 'Content-Security-Policy'
|
||||
const key = mode === 'report-only' ? 'Content-Security-Policy-Report-Only' : 'Content-Security-Policy'
|
||||
return { key, value }
|
||||
}
|
||||
|
||||
@@ -89,13 +89,15 @@ export type SitemapRouteOptions = {
|
||||
export function createSitemapRouteHandler(
|
||||
sitemap: () => Promise<SitemapEntry[]>,
|
||||
opts: SitemapRouteOptions = {},
|
||||
): (req?: Request) => Promise<Response> {
|
||||
): (req: Request) => Promise<Response> {
|
||||
const style = opts.cssUrl ? false : opts.style === false ? false : (opts.style ?? {})
|
||||
|
||||
return async (req?: Request) => {
|
||||
const url = req ? new URL(req.url) : null
|
||||
// `req` is required: Next 16 type-checks the first argument of a route handler
|
||||
// (`Request | undefined` fails the build). A zero-argument call is not supported.
|
||||
return async (req: Request) => {
|
||||
const url = new URL(req.url)
|
||||
|
||||
if (style && url?.searchParams.has(SITEMAP_STYLE_PARAM)) {
|
||||
if (style && url.searchParams.has(SITEMAP_STYLE_PARAM)) {
|
||||
let title: string | undefined
|
||||
try {
|
||||
title = typeof style.title === 'function' ? await style.title() : style.title
|
||||
@@ -111,7 +113,7 @@ export function createSitemapRouteHandler(
|
||||
})
|
||||
}
|
||||
|
||||
const cssUrl = opts.cssUrl ?? (style ? `${url?.pathname ?? '/sitemap.xml'}?${SITEMAP_STYLE_PARAM}` : undefined)
|
||||
const cssUrl = opts.cssUrl ?? (style ? `${url.pathname}?${SITEMAP_STYLE_PARAM}` : undefined)
|
||||
try {
|
||||
const entries = await sitemap()
|
||||
const xml = buildSitemapXml(entries, { cssUrl })
|
||||
|
||||
@@ -13,7 +13,7 @@ export type SitemapStyleOptions = {
|
||||
* "Technology by Intecion.com". `false` hides it.
|
||||
*/
|
||||
credit?: false | string
|
||||
/** Header line. Default: the site name from Site Settings (sitemapRoute), else "XML Sitemap". */
|
||||
/** Header line. Default "XML Sitemap". */
|
||||
title?: string
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,12 @@ export const buildR2Storage = (
|
||||
// (media.klient.pl → bucket) set R2_PUBLIC_URL so Payload generates URLs
|
||||
// pointing there. Without it, uploads work but images don't display publicly.
|
||||
// See docs/storage.md.
|
||||
const publicUrl = process.env.R2_PUBLIC_URL?.replace(/\/$/, '') // strip trailing slash
|
||||
// Site-relative value ('/media', dev only — ipalEnvRules rejects it in production)
|
||||
// → prefixed with NEXT_PUBLIC_SERVER_URL so Payload still stores absolute URLs.
|
||||
const rawPublicUrl = process.env.R2_PUBLIC_URL?.trim().replace(/\/$/, '') // strip trailing slash
|
||||
const serverUrl = process.env.NEXT_PUBLIC_SERVER_URL?.trim().replace(/\/$/, '')
|
||||
const publicUrl =
|
||||
rawPublicUrl?.startsWith('/') && serverUrl ? `${serverUrl}${rawPublicUrl}` : rawPublicUrl
|
||||
|
||||
// generateFileURL is a PER-COLLECTION option in @payloadcms/storage-s3 (not a
|
||||
// top-level one) — R2 needs it to point served URLs at the custom domain
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* @intecion/ipal-kit/fluid.css — fluid type & spacing scale (variables only, no classes).
|
||||
* Scales smoothly from a 360px to a 1280px viewport; rem-based, so browser zoom and
|
||||
* user font size still work (WCAG 1.4.4). Opt-in:
|
||||
*
|
||||
* @import "tailwindcss";
|
||||
* @import "@intecion/ipal-kit/fluid.css";
|
||||
* @theme inline {
|
||||
* --text-display: var(--ipal-fs-display);
|
||||
* --text-h1: var(--ipal-fs-h1);
|
||||
* --text-h2: var(--ipal-fs-h2);
|
||||
* --text-h3: var(--ipal-fs-h3);
|
||||
* --text-lead: var(--ipal-fs-lg);
|
||||
* --spacing-section: var(--ipal-space-section);
|
||||
* --spacing-gutter: var(--ipal-space-gutter);
|
||||
* --spacing-gap: var(--ipal-space-gap);
|
||||
* }
|
||||
* → text-h1, text-display, py-section, px-gutter, gap-gap
|
||||
*
|
||||
* The design (DESIGN.md) decides the numbers: override any variable in the project's
|
||||
* :root — the plugin only removes the clamp() maths from every project.
|
||||
*/
|
||||
:root {
|
||||
--ipal-fs-sm: clamp(0.875rem, 0.8505rem + 0.1087vw, 0.9375rem); /* 0.875→0.9375rem · small print, captions */
|
||||
--ipal-fs-base: clamp(1rem, 0.9511rem + 0.2174vw, 1.125rem); /* 1→1.125rem · body text */
|
||||
--ipal-fs-lg: clamp(1.125rem, 1.0272rem + 0.4348vw, 1.375rem); /* 1.125→1.375rem · lead / intro */
|
||||
--ipal-fs-h3: clamp(1.25rem, 1.0543rem + 0.8696vw, 1.75rem); /* 1.25→1.75rem · h3 */
|
||||
--ipal-fs-h2: clamp(1.5rem, 1.1087rem + 1.7391vw, 2.5rem); /* 1.5→2.5rem · h2 — section headings */
|
||||
--ipal-fs-h1: clamp(2rem, 1.413rem + 2.6087vw, 3.5rem); /* 2→3.5rem · h1 — page heading */
|
||||
--ipal-fs-display: clamp(2.5rem, 1.7174rem + 3.4783vw, 4.5rem); /* 2.5→4.5rem · hero / display */
|
||||
--ipal-space-gap: clamp(1rem, 0.6087rem + 1.7391vw, 2rem); /* 1→2rem · gap between items in a section */
|
||||
--ipal-space-gutter: clamp(1rem, 0.413rem + 2.6087vw, 2.5rem); /* 1→2.5rem · container side padding */
|
||||
--ipal-space-section: clamp(3rem, 1.2391rem + 7.8261vw, 7.5rem); /* 3→7.5rem · vertical padding of a section */
|
||||
}
|
||||
Reference in New Issue
Block a user