meno-astro 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/chunk-5BVKIPKS.js +9 -0
- package/dist/chunks/{chunk-D5DHUDKR.js → chunk-ENCYNJWV.js} +6 -26
- package/dist/chunks/chunk-ENCYNJWV.js.map +7 -0
- package/dist/chunks/{chunk-V4SUAPTT.js → chunk-GITHFAZG.js} +174 -2
- package/dist/chunks/chunk-GITHFAZG.js.map +7 -0
- package/dist/chunks/{chunk-S4IA22D6.js → chunk-MCIBOYQT.js} +125 -567
- package/dist/chunks/chunk-MCIBOYQT.js.map +7 -0
- package/dist/chunks/{chunk-ZUFECXGE.js → chunk-P2SFVSXG.js} +2 -2
- package/dist/chunks/{chunk-FTAXQYZ6.js → chunk-Q43GCLMA.js} +22 -11
- package/dist/chunks/chunk-Q43GCLMA.js.map +7 -0
- package/dist/chunks/chunk-SYOR6LP4.js +506 -0
- package/dist/chunks/chunk-SYOR6LP4.js.map +7 -0
- package/dist/lib/components/BaseLayout.astro +28 -5
- package/dist/lib/components/Embed.astro +9 -4
- package/dist/lib/components/Link.astro +10 -1
- package/dist/lib/components/LocaleList.astro +23 -26
- package/dist/lib/components/LocaleRoute.astro +55 -0
- package/dist/lib/components/index.js +1 -1
- package/dist/lib/dialect/index.js +4 -4
- package/dist/lib/index.js +250 -24
- package/dist/lib/index.js.map +4 -4
- package/dist/lib/integration/index.js +560 -17
- package/dist/lib/integration/index.js.map +4 -4
- package/dist/lib/runtime/localeMiddleware.js +4 -4
- package/package.json +7 -1
- package/dist/chunks/chunk-D5DHUDKR.js.map +0 -7
- package/dist/chunks/chunk-FTAXQYZ6.js.map +0 -7
- package/dist/chunks/chunk-S4IA22D6.js.map +0 -7
- package/dist/chunks/chunk-V4SUAPTT.js.map +0 -7
- package/dist/chunks/chunk-WKW2JJ35.js +0 -30
- package/dist/chunks/chunk-WKW2JJ35.js.map +0 -7
- package/dist/chunks/chunk-ZYQNHI3W.js +0 -16
- /package/dist/chunks/{chunk-ZYQNHI3W.js.map → chunk-5BVKIPKS.js.map} +0 -0
- /package/dist/chunks/{chunk-ZUFECXGE.js.map → chunk-P2SFVSXG.js.map} +0 -0
|
@@ -3,36 +3,16 @@ import {
|
|
|
3
3
|
extractLocaleFromPath,
|
|
4
4
|
isI18nValue,
|
|
5
5
|
resolveI18nValue
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
__require
|
|
9
|
-
} from "./chunk-ZYQNHI3W.js";
|
|
6
|
+
} from "./chunk-GITHFAZG.js";
|
|
10
7
|
|
|
11
8
|
// lib/runtime/i18n.ts
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
try {
|
|
15
|
-
const { AsyncLocalStorage } = __require("node:async_hooks");
|
|
16
|
-
store = new AsyncLocalStorage();
|
|
17
|
-
} catch {
|
|
18
|
-
store = void 0;
|
|
19
|
-
}
|
|
9
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
|
+
var store = new AsyncLocalStorage();
|
|
20
11
|
function runWithLocale(locale, config, fn) {
|
|
21
|
-
|
|
22
|
-
if (store) {
|
|
23
|
-
return store.run(ctx, fn);
|
|
24
|
-
}
|
|
25
|
-
const prev = fallbackContext;
|
|
26
|
-
fallbackContext = ctx;
|
|
27
|
-
try {
|
|
28
|
-
return fn();
|
|
29
|
-
} finally {
|
|
30
|
-
fallbackContext = prev;
|
|
31
|
-
}
|
|
12
|
+
return store.run({ locale, config }, fn);
|
|
32
13
|
}
|
|
33
14
|
function getLocaleContext() {
|
|
34
|
-
|
|
35
|
-
return fallbackContext;
|
|
15
|
+
return store.getStore();
|
|
36
16
|
}
|
|
37
17
|
function localeFromAstro(astro, config) {
|
|
38
18
|
if (astro?.currentLocale) return astro.currentLocale;
|
|
@@ -88,4 +68,4 @@ export {
|
|
|
88
68
|
deriveLocale,
|
|
89
69
|
createLocaleMiddleware
|
|
90
70
|
};
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
71
|
+
//# sourceMappingURL=chunk-ENCYNJWV.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../lib/runtime/i18n.ts", "../../lib/runtime/middleware.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * meno-astro \u2014 i18n runtime resolver.\n *\n * Emitted `.astro` markup carries i18n values verbatim and wraps them in a single-arg\n * `i18n({ _i18n: true, en: \"About\", pl: \"O nas\" })` call (see the dialect spec \u00A79). This\n * module implements that `i18n()` resolver plus the locale-context seam the future\n * `BaseLayout`/middleware will drive per route/locale.\n *\n * It reuses meno-core's primitives wholesale (`isI18nValue`, `resolveI18nValue`,\n * `extractLocaleFromPath`, `DEFAULT_I18N_CONFIG`) \u2014 no resolution logic is reinvented\n * here. The only new machinery is the `AsyncLocalStorage`-backed locale context.\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport {\n isI18nValue,\n resolveI18nValue,\n extractLocaleFromPath,\n DEFAULT_I18N_CONFIG,\n} from 'meno-core/shared';\nimport type { I18nConfig, I18nValue } from 'meno-core/shared/types';\n\n/** The per-render locale context: the active locale + the project's i18n config. */\nexport interface LocaleContextValue {\n locale: string;\n config: I18nConfig;\n}\n\n// ---------------------------------------------------------------------------\n// Locale context store.\n//\n// SSR is concurrent: two requests for different locales can be in flight at once,\n// so a plain module variable would race. `AsyncLocalStorage` (node:async_hooks)\n// scopes the context to the async call tree of `runWithLocale`, so it survives the\n// `await` boundaries of an async render and every `i18n()` call in that tree reads\n// its own request's locale.\n//\n// ALS is a HARD dependency: it is unconditionally available in Node 18+ (this\n// package's build target) and in Bun, so we import it statically and `store` is\n// always defined. (An earlier version loaded it via `require('node:async_hooks')`\n// in a try/catch with a synchronous module-variable fallback. In the published ESM\n// bundle esbuild compiled that `require` to a shim that THREW, so the fallback took\n// over \u2014 and because it restored its variable synchronously, before the async\n// render promise resolved, every render leaked back to the default locale. The\n// static import removes that failure mode and the fallback entirely.)\n// ---------------------------------------------------------------------------\n\nconst store = new AsyncLocalStorage<LocaleContextValue>();\n\n/**\n * Run `fn` with `{ locale, config }` as the active locale context. This is the seam the\n * future `BaseLayout`/middleware calls once per route/locale; everything rendered inside\n * (and `i18n()` calls within it) sees this locale. Returns `fn`'s return value.\n */\nexport function runWithLocale<T>(\n locale: string,\n config: I18nConfig,\n fn: () => T,\n): T {\n return store.run({ locale, config }, fn);\n}\n\n/** Read the current locale context, or `undefined` if none is active. */\nexport function getLocaleContext(): LocaleContextValue | undefined {\n return store.getStore();\n}\n\n// ---------------------------------------------------------------------------\n// Astro-global \u2192 locale derivation.\n// ---------------------------------------------------------------------------\n\n/** The slice of the Astro global this module reads. */\nexport interface AstroLike {\n currentLocale?: string | null;\n url?: { pathname?: string } | null;\n}\n\n/**\n * Derive the active locale from an Astro global:\n * 1. `astro.currentLocale` (Astro's own i18n routing answer), else\n * 2. the locale prefix on `astro.url.pathname` (e.g. `/pl/about` \u2192 `pl`), else\n * 3. `config.defaultLocale`.\n */\nexport function localeFromAstro(astro: AstroLike | null | undefined, config: I18nConfig): string {\n if (astro?.currentLocale) return astro.currentLocale;\n const pathname = astro?.url?.pathname;\n if (typeof pathname === 'string') {\n const { locale } = extractLocaleFromPath(pathname, config);\n if (locale) return locale;\n }\n return config.defaultLocale;\n}\n\n// ---------------------------------------------------------------------------\n// i18n() \u2014 the emitter-facing resolver.\n// ---------------------------------------------------------------------------\n\n/**\n * Accepted second argument to `i18n()`. The single-arg call shape stays primary; this\n * override only narrows the locale/config when a caller already has them:\n * - a bare locale string (`\"pl\"`),\n * - `{ locale?, config? }`,\n * - an Astro-like `{ currentLocale?, url? }` (normalized via `localeFromAstro`).\n */\nexport type I18nOverride =\n | string\n | { locale?: string; config?: I18nConfig }\n | AstroLike;\n\n/** Resolve `override` (if any) to a concrete `{ locale, config }`, falling back to context/defaults. */\nfunction resolveLocaleAndConfig(override?: I18nOverride): LocaleContextValue {\n const ctx = getLocaleContext();\n const baseConfig = ctx?.config ?? DEFAULT_I18N_CONFIG;\n const baseLocale = ctx?.locale ?? baseConfig.defaultLocale;\n\n if (override === undefined) {\n return { locale: baseLocale, config: baseConfig };\n }\n\n if (typeof override === 'string') {\n return { locale: override, config: baseConfig };\n }\n\n // Plain { locale?, config? } override.\n if ('locale' in override || 'config' in override) {\n const config = override.config ?? baseConfig;\n const locale = override.locale ?? ctx?.locale ?? config.defaultLocale;\n return { locale, config };\n }\n\n // Astro-like override ({ currentLocale?, url? }).\n const config = baseConfig;\n return { locale: localeFromAstro(override as AstroLike, config), config };\n}\n\n/**\n * Resolve an i18n value to the active locale's string (or array, for list props).\n *\n * - Non-i18n values pass through unchanged (so the emitter can wrap any prop/attr/href\n * value uniformly).\n * - i18n values resolve via meno-core's `resolveI18nValue` fallback chain\n * (exact locale \u2192 defaultLocale \u2192 first available \u2192 empty string/array).\n * - Locale/config come from `override` if given, else the active `runWithLocale` context,\n * else `DEFAULT_I18N_CONFIG`'s default locale \u2014 a no-context call never throws.\n *\n * Single-arg `i18n(value)` is the primary call shape; `override` is optional.\n */\nexport function i18n<V>(value: V, override?: I18nOverride): V extends I18nValue ? string | unknown[] : V;\nexport function i18n(value: unknown, override?: I18nOverride): unknown {\n if (!isI18nValue(value)) return value;\n const { locale, config } = resolveLocaleAndConfig(override);\n return resolveI18nValue(value, locale, config);\n}\n", "/**\n * meno-astro \u2014 locale middleware factory.\n *\n * \u2500\u2500 Why middleware (and not BaseLayout) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n * In Astro, the `i18n(...)` calls in a *page body* execute in the page component's\n * render scope, NOT inside `BaseLayout`'s frontmatter \u2014 so BaseLayout cannot wrap them\n * in `runWithLocale`. Astro **middleware**, by contrast, wraps the whole page render per\n * request (SSR) / per prerender (static): `onRequest(context, next)` runs `next()` to\n * render the matched route, and anything we establish around that `next()` call is in\n * scope for the entire page + all its components.\n *\n * So the locale seam is: `onRequest = (ctx, next) =>\n * runWithLocale(deriveLocale(ctx, config), config, () => next())`. The\n * `AsyncLocalStorage` context that `runWithLocale` opens is then read by every `i18n()`\n * call anywhere in that render tree (see `runtime/i18n.ts`).\n *\n * This module exports a **pure, testable factory** `createLocaleMiddleware(config)` plus\n * the `deriveLocale` policy it uses. The actual module Astro injects\n * (`runtime/localeMiddleware.ts`) wraps this factory, loading the project config once.\n *\n * \u2500\u2500 Typing without the `astro` dependency \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n * `meno-astro` does not (yet) depend on `astro`, and no Astro toolchain is wired into\n * this package's test/type-check. Rather than import `MiddlewareHandler` /\n * `APIContext` from `astro` (which would not resolve here), we type against a **minimal\n * structural slice** of Astro's documented middleware contract:\n * - `context.currentLocale?: string` \u2014 Astro's own i18n-routing answer.\n * - `context.url?: URL` \u2014 the request URL (for path-prefix fallback).\n * - `next(): Promise<Response> | Response` \u2014 render the matched route.\n * Astro's real `MiddlewareHandler` is assignable to this shape, so the injected module\n * (`onRequest`) is correct-by-design against the documented API. The unit tests drive a\n * mock context with exactly this surface.\n */\n\nimport { runWithLocale, localeFromAstro } from './i18n';\nimport type { I18nConfig } from 'meno-core/shared/types';\n\n/**\n * The minimal slice of Astro's middleware `APIContext` this middleware reads.\n * Astro's real `APIContext` is structurally assignable to this.\n */\nexport interface LocaleMiddlewareContext {\n /** Astro's resolved locale for the current route (from its native i18n routing). */\n currentLocale?: string | null;\n /** The request URL \u2014 used for the `/pl/\u2026` path-prefix fallback. */\n url?: URL | { pathname?: string } | null;\n}\n\n/**\n * The minimal slice of Astro's `MiddlewareHandler` signature this factory returns.\n * `next` renders the matched route and yields its `Response`; the return value of the\n * handler is that same `Response`. Astro's real `MiddlewareHandler` is assignable here.\n */\nexport type LocaleMiddleware = (\n context: LocaleMiddlewareContext,\n next: () => Promise<Response> | Response,\n) => Promise<Response> | Response;\n\n/**\n * Derive the active locale for a request from its Astro context, against `config`:\n * 1. `context.currentLocale` \u2014 trust Astro's native i18n routing when it has an answer,\n * 2. else `localeFromAstro(context, config)` \u2014 the `/<locale>/\u2026` URL path-prefix\n * (which itself falls back to `config.defaultLocale`),\n * 3. else `config.defaultLocale` \u2014 a final guard (e.g. a falsy `currentLocale` AND a\n * missing/blank URL).\n *\n * Exported for direct unit testing of the policy in isolation.\n */\nexport function deriveLocale(context: LocaleMiddlewareContext, config: I18nConfig): string {\n if (context?.currentLocale) return context.currentLocale;\n // localeFromAstro reads `{ currentLocale, url: { pathname } }`; our context matches.\n const fromAstro = localeFromAstro(context as { currentLocale?: string | null; url?: { pathname?: string } | null }, config);\n return fromAstro || config.defaultLocale;\n}\n\n/**\n * Build a locale middleware bound to a concrete {@link I18nConfig}. The returned handler\n * derives the request's locale (via {@link deriveLocale}) and runs the rest of the render\n * (`next`) inside `runWithLocale(locale, config, \u2026)`, so every `i18n()` call in the page +\n * its components resolves to that locale.\n *\n * Pure and synchronous to construct (no filesystem / no Astro coupling), so a test can\n * call it with a mock `context` + mock `next` and assert end-to-end resolution.\n */\nexport function createLocaleMiddleware(config: I18nConfig): LocaleMiddleware {\n return (context, next) => {\n const locale = deriveLocale(context ?? {}, config);\n return runWithLocale(locale, config, () => next());\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAaA,SAAS,yBAAyB;AAkClC,IAAM,QAAQ,IAAI,kBAAsC;AAOjD,SAAS,cACd,QACA,QACA,IACG;AACH,SAAO,MAAM,IAAI,EAAE,QAAQ,OAAO,GAAG,EAAE;AACzC;AAGO,SAAS,mBAAmD;AACjE,SAAO,MAAM,SAAS;AACxB;AAkBO,SAAS,gBAAgB,OAAqC,QAA4B;AAC/F,MAAI,OAAO,cAAe,QAAO,MAAM;AACvC,QAAM,WAAW,OAAO,KAAK;AAC7B,MAAI,OAAO,aAAa,UAAU;AAChC,UAAM,EAAE,OAAO,IAAI,sBAAsB,UAAU,MAAM;AACzD,QAAI,OAAQ,QAAO;AAAA,EACrB;AACA,SAAO,OAAO;AAChB;AAmBA,SAAS,uBAAuB,UAA6C;AAC3E,QAAM,MAAM,iBAAiB;AAC7B,QAAM,aAAa,KAAK,UAAU;AAClC,QAAM,aAAa,KAAK,UAAU,WAAW;AAE7C,MAAI,aAAa,QAAW;AAC1B,WAAO,EAAE,QAAQ,YAAY,QAAQ,WAAW;AAAA,EAClD;AAEA,MAAI,OAAO,aAAa,UAAU;AAChC,WAAO,EAAE,QAAQ,UAAU,QAAQ,WAAW;AAAA,EAChD;AAGA,MAAI,YAAY,YAAY,YAAY,UAAU;AAChD,UAAMA,UAAS,SAAS,UAAU;AAClC,UAAM,SAAS,SAAS,UAAU,KAAK,UAAUA,QAAO;AACxD,WAAO,EAAE,QAAQ,QAAAA,QAAO;AAAA,EAC1B;AAGA,QAAM,SAAS;AACf,SAAO,EAAE,QAAQ,gBAAgB,UAAuB,MAAM,GAAG,OAAO;AAC1E;AAeO,SAAS,KAAK,OAAgB,UAAkC;AACrE,MAAI,CAAC,YAAY,KAAK,EAAG,QAAO;AAChC,QAAM,EAAE,QAAQ,OAAO,IAAI,uBAAuB,QAAQ;AAC1D,SAAO,iBAAiB,OAAO,QAAQ,MAAM;AAC/C;;;ACrFO,SAAS,aAAa,SAAkC,QAA4B;AACzF,MAAI,SAAS,cAAe,QAAO,QAAQ;AAE3C,QAAM,YAAY,gBAAgB,SAAkF,MAAM;AAC1H,SAAO,aAAa,OAAO;AAC7B;AAWO,SAAS,uBAAuB,QAAsC;AAC3E,SAAO,CAAC,SAAS,SAAS;AACxB,UAAM,SAAS,aAAa,WAAW,CAAC,GAAG,MAAM;AACjD,WAAO,cAAc,QAAQ,QAAQ,MAAM,KAAK,CAAC;AAAA,EACnD;AACF;",
|
|
6
|
+
"names": ["config"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__esm
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5BVKIPKS.js";
|
|
4
4
|
|
|
5
5
|
// ../core/lib/shared/constants.ts
|
|
6
6
|
var SERVER_PORT, SERVE_PORT, NODE_TYPE;
|
|
@@ -1648,6 +1648,70 @@ function serializeValue(value) {
|
|
|
1648
1648
|
return String(value);
|
|
1649
1649
|
}
|
|
1650
1650
|
|
|
1651
|
+
// ../core/lib/shared/slugTranslator.ts
|
|
1652
|
+
function buildSlugIndex(mappings) {
|
|
1653
|
+
const index = /* @__PURE__ */ new Map();
|
|
1654
|
+
for (const mapping of mappings) {
|
|
1655
|
+
for (const [locale, slug] of Object.entries(mapping.slugs)) {
|
|
1656
|
+
const key = `${locale}:${slug}`;
|
|
1657
|
+
index.set(key, {
|
|
1658
|
+
pageId: mapping.pageId,
|
|
1659
|
+
slugs: mapping.slugs
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
return index;
|
|
1664
|
+
}
|
|
1665
|
+
function findPageBySlug(slug, locale, index) {
|
|
1666
|
+
const key = `${locale}:${slug}`;
|
|
1667
|
+
return index.get(key);
|
|
1668
|
+
}
|
|
1669
|
+
function translatePath(currentPath, targetLocale, currentLocale, defaultLocale, index) {
|
|
1670
|
+
let slug = currentPath;
|
|
1671
|
+
if (slug.startsWith("/")) {
|
|
1672
|
+
slug = slug.substring(1);
|
|
1673
|
+
}
|
|
1674
|
+
if (currentLocale !== defaultLocale) {
|
|
1675
|
+
if (slug.startsWith(`${currentLocale}/`)) {
|
|
1676
|
+
slug = slug.substring(currentLocale.length + 1);
|
|
1677
|
+
} else if (slug === currentLocale) {
|
|
1678
|
+
slug = "";
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
if (slug === "" || slug === "/") {
|
|
1682
|
+
slug = "";
|
|
1683
|
+
}
|
|
1684
|
+
let entry = findPageBySlug(slug, currentLocale, index);
|
|
1685
|
+
if (!entry && currentLocale !== defaultLocale) {
|
|
1686
|
+
entry = findPageBySlug(slug, defaultLocale, index);
|
|
1687
|
+
}
|
|
1688
|
+
if (!entry) {
|
|
1689
|
+
if (targetLocale === defaultLocale) {
|
|
1690
|
+
return slug === "" ? "/" : `/${slug}`;
|
|
1691
|
+
}
|
|
1692
|
+
return slug === "" ? `/${targetLocale}` : `/${targetLocale}/${slug}`;
|
|
1693
|
+
}
|
|
1694
|
+
const targetSlug = entry.slugs[targetLocale] ?? entry.slugs[defaultLocale] ?? slug;
|
|
1695
|
+
if (targetLocale === defaultLocale) {
|
|
1696
|
+
return targetSlug === "" ? "/" : `/${targetSlug}`;
|
|
1697
|
+
}
|
|
1698
|
+
return targetSlug === "" ? `/${targetLocale}` : `/${targetLocale}/${targetSlug}`;
|
|
1699
|
+
}
|
|
1700
|
+
function getLocaleLinks(currentPath, currentLocale, i18nConfig, index) {
|
|
1701
|
+
return i18nConfig.locales.map((localeConfig) => ({
|
|
1702
|
+
locale: localeConfig.code,
|
|
1703
|
+
langTag: localeConfig.langTag,
|
|
1704
|
+
name: localeConfig.name,
|
|
1705
|
+
nativeName: localeConfig.nativeName,
|
|
1706
|
+
path: translatePath(currentPath, localeConfig.code, currentLocale, i18nConfig.defaultLocale, index),
|
|
1707
|
+
isCurrent: localeConfig.code === currentLocale
|
|
1708
|
+
}));
|
|
1709
|
+
}
|
|
1710
|
+
function resolveSlugToPageId(slug, locale, index) {
|
|
1711
|
+
const entry = findPageBySlug(slug, locale, index);
|
|
1712
|
+
return entry?.pageId;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1651
1715
|
// ../core/lib/shared/types/cms.ts
|
|
1652
1716
|
var IRREGULAR_PLURALS = {
|
|
1653
1717
|
categories: "category",
|
|
@@ -2580,6 +2644,74 @@ var specialValueMappings = {
|
|
|
2580
2644
|
// Note: CSS functions (blur, translateY, scale, rotate, repeat) are now handled
|
|
2581
2645
|
// dynamically in utilityClassMapper.ts - no need to hardcode specific values here
|
|
2582
2646
|
};
|
|
2647
|
+
var classToStyleSpecialCases = {
|
|
2648
|
+
f: { prop: "display", value: "flex" },
|
|
2649
|
+
"fd-col": { prop: "flexDirection", value: "column" },
|
|
2650
|
+
"fd-row": { prop: "flexDirection", value: "row" },
|
|
2651
|
+
g: { prop: "display", value: "grid" },
|
|
2652
|
+
b: { prop: "display", value: "block" },
|
|
2653
|
+
i: { prop: "display", value: "inline" },
|
|
2654
|
+
ib: { prop: "display", value: "inline-block" },
|
|
2655
|
+
h: { prop: "display", value: "none" },
|
|
2656
|
+
"if": { prop: "display", value: "inline-flex" },
|
|
2657
|
+
ig: { prop: "display", value: "inline-grid" },
|
|
2658
|
+
"jc-c": { prop: "justifyContent", value: "center" },
|
|
2659
|
+
"jc-s": { prop: "justifyContent", value: "flex-start" },
|
|
2660
|
+
"jc-e": { prop: "justifyContent", value: "flex-end" },
|
|
2661
|
+
"jc-b": { prop: "justifyContent", value: "space-between" },
|
|
2662
|
+
"jc-a": { prop: "justifyContent", value: "space-around" },
|
|
2663
|
+
"jc-ev": { prop: "justifyContent", value: "space-evenly" },
|
|
2664
|
+
"ai-c": { prop: "alignItems", value: "center" },
|
|
2665
|
+
"ai-s": { prop: "alignItems", value: "flex-start" },
|
|
2666
|
+
"ai-e": { prop: "alignItems", value: "flex-end" },
|
|
2667
|
+
"ai-st": { prop: "alignItems", value: "stretch" },
|
|
2668
|
+
"ai-b": { prop: "alignItems", value: "baseline" },
|
|
2669
|
+
"o-h": { prop: "overflow", value: "hidden" },
|
|
2670
|
+
"o-a": { prop: "overflow", value: "auto" },
|
|
2671
|
+
"o-s": { prop: "overflow", value: "scroll" },
|
|
2672
|
+
"o-v": { prop: "overflow", value: "visible" },
|
|
2673
|
+
"cursor-pointer": { prop: "cursor", value: "pointer" },
|
|
2674
|
+
"cursor-default": { prop: "cursor", value: "default" },
|
|
2675
|
+
"pe-none": { prop: "pointerEvents", value: "none" },
|
|
2676
|
+
"pe-auto": { prop: "pointerEvents", value: "auto" },
|
|
2677
|
+
"us-none": { prop: "userSelect", value: "none" },
|
|
2678
|
+
"us-auto": { prop: "userSelect", value: "auto" },
|
|
2679
|
+
"us-text": { prop: "userSelect", value: "text" },
|
|
2680
|
+
"us-all": { prop: "userSelect", value: "all" },
|
|
2681
|
+
"whs-normal": { prop: "whiteSpace", value: "normal" },
|
|
2682
|
+
"whs-nowrap": { prop: "whiteSpace", value: "nowrap" },
|
|
2683
|
+
"whs-pre": { prop: "whiteSpace", value: "pre" },
|
|
2684
|
+
"whs-pre-wrap": { prop: "whiteSpace", value: "pre-wrap" },
|
|
2685
|
+
"whs-pre-line": { prop: "whiteSpace", value: "pre-line" },
|
|
2686
|
+
// Grid template columns
|
|
2687
|
+
"gtc-2": { prop: "gridTemplateColumns", value: "repeat(2, 1fr)" },
|
|
2688
|
+
"gtc-3": { prop: "gridTemplateColumns", value: "repeat(3, 1fr)" },
|
|
2689
|
+
"gtc-4": { prop: "gridTemplateColumns", value: "repeat(4, 1fr)" },
|
|
2690
|
+
"gtc-5": { prop: "gridTemplateColumns", value: "repeat(5, 1fr)" },
|
|
2691
|
+
"gtc-6": { prop: "gridTemplateColumns", value: "repeat(6, 1fr)" },
|
|
2692
|
+
// Backdrop filter
|
|
2693
|
+
"bdf-blur-4": { prop: "backdropFilter", value: "blur(4px)" },
|
|
2694
|
+
"bdf-blur-8": { prop: "backdropFilter", value: "blur(8px)" },
|
|
2695
|
+
"bdf-blur-10": { prop: "backdropFilter", value: "blur(10px)" },
|
|
2696
|
+
// Transform
|
|
2697
|
+
"tm-ty-0": { prop: "transform", value: "translateY(0)" },
|
|
2698
|
+
"tm-ty-n10": { prop: "transform", value: "translateY(-10px)" },
|
|
2699
|
+
"tm-ty-n50p": { prop: "transform", value: "translateY(-50%)" },
|
|
2700
|
+
// Filter
|
|
2701
|
+
"flt-blur-1": { prop: "filter", value: "blur(1px)" },
|
|
2702
|
+
// Shadow presets (reverse mapping)
|
|
2703
|
+
"sh-0": { prop: "boxShadow", value: "none" },
|
|
2704
|
+
"sh-1": { prop: "boxShadow", value: "0 1px 2px rgba(0, 0, 0, 0.05)" },
|
|
2705
|
+
"sh-2": { prop: "boxShadow", value: "0 4px 12px rgba(0, 0, 0, 0.1)" },
|
|
2706
|
+
"sh-3": { prop: "boxShadow", value: "0 8px 24px rgba(0, 0, 0, 0.15)" },
|
|
2707
|
+
"sh-4": { prop: "boxShadow", value: "0 12px 32px rgba(0, 0, 0, 0.2)" },
|
|
2708
|
+
// Gradient presets (reverse mapping)
|
|
2709
|
+
"gr-1": { prop: "background", value: "linear-gradient(90deg, rgba(10,22,40,0.85) 0%, rgba(10,22,40,0.2) 100%)" },
|
|
2710
|
+
"gr-2": { prop: "background", value: "linear-gradient(0deg, #a9e8fd, #00aee8 25%, #0f1335 72%)" },
|
|
2711
|
+
// Border presets (reverse mapping)
|
|
2712
|
+
"bd-0": { prop: "border", value: "1px solid var(--border)" },
|
|
2713
|
+
"bd-1": { prop: "border", value: "1px solid var(--border-light)" }
|
|
2714
|
+
};
|
|
2583
2715
|
var shadowPresets = {
|
|
2584
2716
|
"0": "none",
|
|
2585
2717
|
"1": "0 1px 2px rgba(0, 0, 0, 0.05)",
|
|
@@ -3834,6 +3966,41 @@ function responsiveStylesToClasses(styles, options) {
|
|
|
3834
3966
|
}
|
|
3835
3967
|
return classes;
|
|
3836
3968
|
}
|
|
3969
|
+
function classToStyle(className) {
|
|
3970
|
+
let cleanClass = className;
|
|
3971
|
+
let responsivePrefix = "";
|
|
3972
|
+
if (className.startsWith("t-")) {
|
|
3973
|
+
responsivePrefix = "t";
|
|
3974
|
+
cleanClass = className.slice(2);
|
|
3975
|
+
} else if (className.startsWith("mob-")) {
|
|
3976
|
+
responsivePrefix = "mob";
|
|
3977
|
+
cleanClass = className.slice(4);
|
|
3978
|
+
}
|
|
3979
|
+
if (classToStyleSpecialCases[cleanClass]) {
|
|
3980
|
+
return classToStyleSpecialCases[cleanClass];
|
|
3981
|
+
}
|
|
3982
|
+
const match = cleanClass.match(/^([a-z-]+)-(.*?)$/);
|
|
3983
|
+
if (!match) return null;
|
|
3984
|
+
const [, prefix, value] = match;
|
|
3985
|
+
let prop = "";
|
|
3986
|
+
for (const [key, val] of Object.entries(propertyMap)) {
|
|
3987
|
+
if (val === prefix) {
|
|
3988
|
+
prop = key;
|
|
3989
|
+
break;
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3992
|
+
if (!prop) return null;
|
|
3993
|
+
if (/^h[0-9a-z]+$/.test(value)) {
|
|
3994
|
+
const registered = getStyleValue(cleanClass);
|
|
3995
|
+
if (registered != null) {
|
|
3996
|
+
return { prop, value: String(registered) };
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
if (value.includes("background") || value.includes("text") || value.includes("border")) {
|
|
4000
|
+
return { prop, value: `var(--${value})` };
|
|
4001
|
+
}
|
|
4002
|
+
return { prop, value };
|
|
4003
|
+
}
|
|
3837
4004
|
|
|
3838
4005
|
// ../core/lib/shared/elementClassName.ts
|
|
3839
4006
|
function shortHash2(input) {
|
|
@@ -4083,6 +4250,7 @@ export {
|
|
|
4083
4250
|
generateUtilityCSS,
|
|
4084
4251
|
generateInteractiveCSS,
|
|
4085
4252
|
responsiveStylesToClasses,
|
|
4253
|
+
classToStyle,
|
|
4086
4254
|
shortHash2 as shortHash,
|
|
4087
4255
|
DEFAULT_I18N_CONFIG,
|
|
4088
4256
|
migrateI18nConfig,
|
|
@@ -4096,10 +4264,14 @@ export {
|
|
|
4096
4264
|
serializeSortExpression,
|
|
4097
4265
|
parseFilterExpression,
|
|
4098
4266
|
serializeFilterExpression,
|
|
4267
|
+
buildSlugIndex,
|
|
4268
|
+
translatePath,
|
|
4269
|
+
getLocaleLinks,
|
|
4270
|
+
resolveSlugToPageId,
|
|
4099
4271
|
fontFaceCss,
|
|
4100
4272
|
fontPreloadLinks,
|
|
4101
4273
|
mergeLibraries,
|
|
4102
4274
|
generateLibraryTags,
|
|
4103
4275
|
filterLibrariesByContext
|
|
4104
4276
|
};
|
|
4105
|
-
//# sourceMappingURL=chunk-
|
|
4277
|
+
//# sourceMappingURL=chunk-GITHFAZG.js.map
|