meno-astro 0.1.11 → 0.1.13
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-ZUFECXGE.js → chunk-4ICB3SZG.js} +2 -2
- package/dist/chunks/chunk-5BVKIPKS.js +9 -0
- package/dist/chunks/chunk-5HBRX7IZ.js +506 -0
- package/dist/chunks/chunk-5HBRX7IZ.js.map +7 -0
- package/dist/chunks/{chunk-FTAXQYZ6.js → chunk-ANGVNS5N.js} +22 -11
- package/dist/chunks/chunk-ANGVNS5N.js.map +7 -0
- package/dist/chunks/{chunk-V4SUAPTT.js → chunk-LEJMZHGE.js} +173 -2
- package/dist/chunks/chunk-LEJMZHGE.js.map +7 -0
- package/dist/chunks/{chunk-D5DHUDKR.js → chunk-YC3WSC6M.js} +6 -26
- package/dist/chunks/chunk-YC3WSC6M.js.map +7 -0
- package/dist/chunks/{chunk-RDEADJXD.js → chunk-YJMWK222.js} +129 -568
- package/dist/chunks/chunk-YJMWK222.js.map +7 -0
- package/dist/lib/components/BaseLayout.astro +28 -5
- 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 +208 -23
- package/dist/lib/index.js.map +4 -4
- package/dist/lib/integration/index.js +474 -37
- 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-RDEADJXD.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-ZUFECXGE.js.map → chunk-4ICB3SZG.js.map} +0 -0
- /package/dist/chunks/{chunk-ZYQNHI3W.js.map → chunk-5BVKIPKS.js.map} +0 -0
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
classToStyle,
|
|
2
3
|
isStyleMapping,
|
|
3
4
|
responsiveStylesToClasses,
|
|
4
5
|
shortHash
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LEJMZHGE.js";
|
|
6
7
|
|
|
7
8
|
// lib/runtime/style.ts
|
|
8
|
-
var collected = /* @__PURE__ */ new Map();
|
|
9
|
-
function flushCollectedStyles() {
|
|
10
|
-
return Array.from(collected.values()).filter(Boolean).join("\n");
|
|
11
|
-
}
|
|
12
|
-
function resetStyleCollector() {
|
|
13
|
-
collected.clear();
|
|
14
|
-
}
|
|
15
9
|
function resolveMappingValue(mapping, props) {
|
|
16
10
|
if (!props) return void 0;
|
|
17
11
|
const propValue = props[mapping.prop];
|
|
@@ -55,6 +49,21 @@ function computeClassName(resolvedBase, resolvedInteractive, label) {
|
|
|
55
49
|
const prefix = label ? sanitizeLabel(label) : "";
|
|
56
50
|
return prefix ? `m_${prefix}_${hash}` : `m_${hash}`;
|
|
57
51
|
}
|
|
52
|
+
function classMergeKey(cls) {
|
|
53
|
+
const bp = cls.startsWith("t-") ? "t" : cls.startsWith("mob-") ? "mob" : "";
|
|
54
|
+
const entry = classToStyle(cls);
|
|
55
|
+
return entry ? `${bp}:${entry.prop}` : null;
|
|
56
|
+
}
|
|
57
|
+
function mergeInstanceClasses(own, instanceClass) {
|
|
58
|
+
const instance = instanceClass.split(/\s+/).filter(Boolean);
|
|
59
|
+
if (instance.length === 0) return own;
|
|
60
|
+
const overridden = new Set(instance.map(classMergeKey).filter(Boolean));
|
|
61
|
+
const kept = own.filter((cls) => {
|
|
62
|
+
const key = classMergeKey(cls);
|
|
63
|
+
return key === null || !overridden.has(key);
|
|
64
|
+
});
|
|
65
|
+
return [...kept, ...instance];
|
|
66
|
+
}
|
|
58
67
|
function style(styleObject, props, meta) {
|
|
59
68
|
const base = styleObject ?? {};
|
|
60
69
|
const resolvedBase = resolveMappingsInStyle(base, props);
|
|
@@ -68,14 +77,16 @@ function style(styleObject, props, meta) {
|
|
|
68
77
|
if (resolvedInteractive.length > 0) {
|
|
69
78
|
classes.push(computeClassName({}, resolvedInteractive, meta?.label));
|
|
70
79
|
}
|
|
80
|
+
if (meta?.root) {
|
|
81
|
+
const instanceClass = typeof props?.class === "string" ? props.class : "";
|
|
82
|
+
if (instanceClass.trim()) return mergeInstanceClasses(classes, instanceClass).join(" ");
|
|
83
|
+
}
|
|
71
84
|
return classes.join(" ");
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
export {
|
|
75
|
-
flushCollectedStyles,
|
|
76
|
-
resetStyleCollector,
|
|
77
88
|
resolveMappingsInStyle,
|
|
78
89
|
computeClassName,
|
|
79
90
|
style
|
|
80
91
|
};
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-ANGVNS5N.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../lib/runtime/style.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * meno-astro \u2014 `style()` runtime resolver (class-name only).\n *\n * Emitted `.astro` markup styles every node with `class={style(styleObject[, props][, meta])}`\n * (see `dialect/emit/emitNode.ts`). The `styleObject` is a Meno\n * `StyleObject` / `ResponsiveStyleObject` \u2014 `{ base, tablet, mobile }` where any value\n * may be a prop-binding `{ _mapping: true, prop, values }`. The optional `meta` carries\n * `interactive` (hover/etc. state rules), `label`, and `genClass`.\n *\n * `style()` ONLY computes and returns the element's class name(s) \u2014 the `class={...}`\n * value. It does NOT generate or collect CSS at render time. The actual utility +\n * interactive CSS is produced at BUILD time by the `meno()` integration, which scans\n * every `.astro` source and emits one global stylesheet served as the virtual module\n * `virtual:meno-utilities.css` (imported by BaseLayout's <head>); see\n * `integration/utilityCss.ts`. A render-time collector would always be empty anyway \u2014\n * Astro renders <head> (where the sheet is linked) before the <body> nodes that call\n * `style()`. That is exactly why the names produced here must be byte-identical to\n * meno-core's: the build-time scan generates the matching `.<class>` /\n * `.<class>:hover` rules.\n *\n * \u2500\u2500 Why a props argument \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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n * A `_mapping` value resolves against the *host component's prop values*, so the emitted\n * `style(styleObject, props, meta)` call threads a `props` scope and resolves each\n * `_mapping` to a concrete value *before* computing the class name. Unresolvable\n * mappings degrade gracefully (the bound property is dropped \u2014 never throws).\n *\n * \u2500\u2500 Reuse, not reinvention \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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n * Class-name computation is meno-core's, the same code the JSON runtime uses:\n * - `responsiveStylesToClasses` \u2014 the forward mapper that turns a resolved style into\n * utility class names (byte-identical to meno-core's ComponentBuilder).\n * - `shortHash` \u2014 meno-core's deterministic djb2 hash, so an interactive style maps to\n * a stable, element-scoped class the build-time scan can match.\n * - `isStyleMapping` \u2014 the `_mapping` type guard; mapping *resolution* mirrors\n * meno-core's `resolveExtractedMappings` (`mapping.values[String(propValue)]`).\n */\n\n// Narrow `meno-core/shared/*` subpath imports (the same convention `runtime/i18n.ts`\n// uses) rather than the broad `meno-core` barrel \u2014 the barrel re-exports the whole\n// shared surface, dragging unrelated modules (and their latent type errors) into this\n// package's type-check graph. We only need the style pipeline.\nimport {\n DEFAULT_BREAKPOINTS,\n type BreakpointConfig,\n} from 'meno-core/shared';\n// The reverse mapper (class \u2192 { prop, value }) \u2014 used to key classes by CSS property for\n// the instance-over-root merge (see mergeInstanceClasses).\nimport { classToStyle } from 'meno-core/shared';\nimport { generateInteractiveCSS } from 'meno-core/shared';\nimport { isStyleMapping } from 'meno-core/shared';\nimport { shortHash } from 'meno-core/shared';\n// The SAME forward mapper meno-core's JSON runtime (ComponentBuilder) uses \u2014 so the\n// emitted class names are byte-identical to Meno core. The utility CSS itself is\n// generated at BUILD time by the meno() integration (Astro renders <head> before\n// <body>, so a runtime collector would always be empty); style() only returns names.\nimport { responsiveStylesToClasses } from 'meno-core/shared';\nimport type {\n StyleObject,\n StyleValue,\n ResponsiveStyleObject,\n InteractiveStyles,\n InteractiveStyleRule,\n} from 'meno-core/shared/types';\n\n// ---------------------------------------------------------------------------\n// `meta` \u2014 the second/third argument shape emitted alongside the style object.\n// Mirrors `emitClassAttr` in dialect/emit/emitNode.ts.\n// ---------------------------------------------------------------------------\n\n/** The `meta` payload carried by `class={style(styleObject, meta)}`. */\nexport interface StyleMeta {\n /** Hover/focus/state rules (`.element:hover { \u2026 }`, etc.). */\n interactive?: InteractiveStyles;\n /** The node's editor label \u2014 folded into the (still content-derived) class name. */\n label?: string;\n /** The node's `generateElementClass` flag (carried for parity; not load-bearing here). */\n genClass?: boolean;\n /**\n * Emitted on the COMPONENT STRUCTURE ROOT's class attr: merge the instance class the\n * parent passed (`props.class` \u2014 a `class={style(\u2026, { instance: true })}` computed in\n * the parent's scope) over this element's own classes. meno-core merges instance\n * styles over the component root's styles before class generation; this is the\n * class-level equivalent (see mergeInstanceClasses).\n */\n root?: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// `_mapping` (prop-binding) resolution.\n// ---------------------------------------------------------------------------\n\n/**\n * Resolve a single `_mapping` value against `props`, returning the concrete CSS value\n * or `undefined` when it cannot be resolved (no props, prop unset, or value not in the\n * mapping's table). Semantics mirror meno-core's `resolveExtractedMappings`:\n * `mapping.values[String(props[mapping.prop])]`.\n */\nfunction resolveMappingValue(\n mapping: { prop: string; values: Record<string, string | number> },\n props: Record<string, unknown> | undefined,\n): string | number | undefined {\n if (!props) return undefined;\n const propValue = props[mapping.prop];\n if (propValue === undefined || propValue === null) return undefined;\n const resolved = mapping.values[String(propValue)];\n return resolved === undefined ? undefined : resolved;\n}\n\n/**\n * Return a copy of a flat StyleObject with every `_mapping` value replaced by its\n * prop-resolved concrete value. Unresolvable mappings are dropped (graceful\n * degradation \u2014 a missing prop must never throw, and an unresolved property simply\n * isn't emitted, falling back to the cascade/UA default). Plain values pass through.\n */\nfunction resolveMappingsInFlat(\n style: StyleObject,\n props: Record<string, unknown> | undefined,\n): StyleObject {\n const out: StyleObject = {};\n for (const [prop, value] of Object.entries(style)) {\n if (isStyleMapping(value)) {\n const resolved = resolveMappingValue(value, props);\n if (resolved !== undefined) out[prop] = resolved;\n // else: drop \u2014 unresolved mapping, no rule emitted.\n continue;\n }\n // A `{{template}}` value (e.g. `gap: \"{{gap}}px\"`) is per-instance and can't be a\n // static utility class \u2014 the emitter renders it via an inline `style` attr instead\n // (see emitInlineStyleAttr). Drop it here so no broken `.<hash> { gap: {{gap}}px }`\n // class is generated. Parity with meno-core's static/dynamic style split.\n if (typeof value === 'string' && value.includes('{{')) continue;\n out[prop] = value;\n }\n return out;\n}\n\n/** True when a StyleValue is the responsive `{ base/tablet/mobile }` shape. */\nfunction isResponsive(style: StyleValue): style is ResponsiveStyleObject {\n return (\n typeof style === 'object' &&\n style !== null &&\n ('base' in style || 'tablet' in style || 'mobile' in style)\n );\n}\n\n/**\n * Resolve `_mapping` values across a whole StyleValue (flat or responsive), per\n * breakpoint, against `props`. The result is a plain StyleValue with no `_mapping`\n * objects remaining \u2014 ready for meno-core's CSS generator.\n */\nexport function resolveMappingsInStyle(\n style: StyleValue,\n props: Record<string, unknown> | undefined,\n): StyleValue {\n if (isResponsive(style)) {\n const out: ResponsiveStyleObject = {};\n for (const [bp, bpStyle] of Object.entries(style)) {\n if (!bpStyle) continue;\n out[bp] = resolveMappingsInFlat(bpStyle, props);\n }\n return out;\n }\n return resolveMappingsInFlat(style as StyleObject, props);\n}\n\n// ---------------------------------------------------------------------------\n// Deterministic class name.\n// ---------------------------------------------------------------------------\n\n/** Lowercase + CSS-safe a label fragment for use in a class name. */\nfunction sanitizeLabel(label: string): string {\n return label\n .toLowerCase()\n .replace(/[^a-z0-9_-]/g, '_')\n .replace(/_+/g, '_')\n .replace(/^_|_$/g, '');\n}\n\n/**\n * Compute a deterministic class name from the *resolved* style payload (base style +\n * interactive rules) plus the optional label. Identical inputs \u21D2 identical class, so\n * two `style()` calls with the same styleObject dedupe to one CSS rule. The hash uses\n * meno-core's `shortHash` (djb2). A label prefix is added for human-readable selectors\n * but the hash still keys dedup, so distinct styles never collide on label alone.\n */\nexport function computeClassName(\n resolvedBase: StyleValue,\n resolvedInteractive: InteractiveStyles,\n label: string | undefined,\n): string {\n const fingerprint = JSON.stringify({ b: resolvedBase, i: resolvedInteractive });\n const hash = shortHash(fingerprint);\n const prefix = label ? sanitizeLabel(label) : '';\n return prefix ? `m_${prefix}_${hash}` : `m_${hash}`;\n}\n\n// ---------------------------------------------------------------------------\n// Instance-over-root class merge (component structure roots).\n// ---------------------------------------------------------------------------\n\n/**\n * Merge key for one utility class: breakpoint prefix + the CSS property the class\n * decodes to (meno-core's `classToStyle` reverse mapper). `null` when the class isn't a\n * recognized utility (interactive `m_\u2026` hash classes, dynamic-registry classes) \u2014 those\n * never participate in conflict detection and are always kept.\n */\nfunction classMergeKey(cls: string): string | null {\n const bp = cls.startsWith('t-') ? 't' : cls.startsWith('mob-') ? 'mob' : '';\n const entry = classToStyle(cls);\n return entry ? `${bp}:${entry.prop}` : null;\n}\n\n/**\n * Merge the instance class string (computed by the PARENT's `style(\u2026, { instance: true })`\n * call and passed via the component's `class` prop) over the root element's own classes.\n * Instance wins per (breakpoint, CSS property) \u2014 the class-level equivalent of meno-core's\n * instance-over-root style-object merge (which is why its `<img>` renders `h-auto` and no\n * `h-100p` when an instance overrides the component's `height`). Without property-aware\n * dropping, both classes would apply and stylesheet order \u2014 not the instance \u2014 would\n * decide the winner.\n */\nexport function mergeInstanceClasses(own: string[], instanceClass: string): string[] {\n const instance = instanceClass.split(/\\s+/).filter(Boolean);\n if (instance.length === 0) return own;\n const overridden = new Set(instance.map(classMergeKey).filter(Boolean) as string[]);\n const kept = own.filter((cls) => {\n const key = classMergeKey(cls);\n return key === null || !overridden.has(key);\n });\n return [...kept, ...instance];\n}\n\n// ---------------------------------------------------------------------------\n// style() \u2014 the emitter-facing resolver.\n// ---------------------------------------------------------------------------\n\n/**\n * Resolve a Meno style payload to its CSS class name(s). Pure \u2014 returns only the\n * `class={...}` value; the matching CSS is generated at build time (see the header).\n *\n * @param styleObject The node's style \u2014 flat `StyleObject` or responsive\n * `{ base, tablet, mobile }`. Values may be `_mapping` prop bindings.\n * @param props The host component's resolved prop values, used to resolve\n * `_mapping` bindings (the option-A contract). Optional: a style\n * with a `_mapping` but no `props` degrades gracefully (the bound\n * property is omitted rather than throwing).\n * @param meta Optional `{ interactive, label, genClass }` \u2014 interactive state\n * rules and label, as emitted.\n * @returns The element's CSS class name (the `class={style(...)}` value).\n */\nexport function style(\n styleObject: StyleValue | null | undefined,\n props?: Record<string, unknown>,\n meta?: StyleMeta,\n): string {\n const base = styleObject ?? {};\n\n // 1. Resolve prop-bound `_mapping` values to concrete CSS values using the host\n // component's props (the same resolution meno-core does at render).\n const resolvedBase = resolveMappingsInStyle(base, props);\n\n // 2. Base styles \u2192 meno-core utility classes (byte-identical to the JSON runtime).\n const classes = responsiveStylesToClasses(resolvedBase);\n\n // 3. Interactive (`:hover`, \u2026) styles aren't expressible as utility classes (they're\n // states), so meno-core scopes them to an element-specific class. Resolve their\n // `_mapping`s the same way and emit a DETERMINISTIC class so the build-time CSS\n // scan generates the matching `.<class>:hover { \u2026 }` rule. No interactive \u21D2 no\n // extra class.\n const resolvedInteractive: InteractiveStyles = (meta?.interactive ?? []).map(\n (rule): InteractiveStyleRule => ({\n ...rule,\n style: resolveMappingsInStyle(rule.style, props),\n }),\n );\n if (resolvedInteractive.length > 0) {\n classes.push(computeClassName({}, resolvedInteractive, meta?.label));\n }\n\n // 4. Component structure root (`meta.root`): merge the instance class the parent\n // passed (`props.class`) over this element's own classes \u2014 instance wins per\n // (breakpoint, property), mirroring meno-core's instance-over-root style merge.\n if (meta?.root) {\n const instanceClass = typeof props?.class === 'string' ? props.class : '';\n if (instanceClass.trim()) return mergeInstanceClasses(classes, instanceClass).join(' ');\n }\n\n return classes.join(' ');\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["style"]
|
|
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,13 @@ export {
|
|
|
4096
4264
|
serializeSortExpression,
|
|
4097
4265
|
parseFilterExpression,
|
|
4098
4266
|
serializeFilterExpression,
|
|
4267
|
+
buildSlugIndex,
|
|
4268
|
+
getLocaleLinks,
|
|
4269
|
+
resolveSlugToPageId,
|
|
4099
4270
|
fontFaceCss,
|
|
4100
4271
|
fontPreloadLinks,
|
|
4101
4272
|
mergeLibraries,
|
|
4102
4273
|
generateLibraryTags,
|
|
4103
4274
|
filterLibrariesByContext
|
|
4104
4275
|
};
|
|
4105
|
-
//# sourceMappingURL=chunk-
|
|
4276
|
+
//# sourceMappingURL=chunk-LEJMZHGE.js.map
|