meno-core 1.1.5 → 1.1.7
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-RLBV2R6J.js → chunk-KX2LPIZZ.js} +68 -1
- package/dist/chunks/{chunk-RLBV2R6J.js.map → chunk-KX2LPIZZ.js.map} +2 -2
- package/dist/chunks/{chunk-H6EOTPJA.js → chunk-WOJS25K3.js} +45 -13
- package/dist/chunks/chunk-WOJS25K3.js.map +7 -0
- package/dist/lib/client/index.js +56 -12
- package/dist/lib/client/index.js.map +2 -2
- package/dist/lib/server/index.js +85 -19
- package/dist/lib/server/index.js.map +3 -3
- package/dist/lib/shared/index.js +7 -1
- package/dist/lib/shared/index.js.map +1 -1
- package/lib/client/core/ComponentBuilder.test.ts +137 -0
- package/lib/client/core/ComponentBuilder.ts +52 -13
- package/lib/client/core/builders/embedBuilder.ts +15 -1
- package/lib/client/core/builders/linkNodeBuilder.ts +15 -1
- package/lib/client/core/builders/localeListBuilder.ts +15 -1
- package/lib/client/templateEngine.test.ts +106 -3
- package/lib/client/templateEngine.ts +50 -10
- package/lib/server/ssr/htmlGenerator.test.ts +105 -2
- package/lib/server/ssr/htmlGenerator.ts +92 -32
- package/lib/server/ssr/ssrRenderer.test.ts +133 -0
- package/lib/server/ssr/ssrRenderer.ts +59 -14
- package/lib/shared/attributeNodeUtils.test.ts +25 -0
- package/lib/shared/attributeNodeUtils.ts +9 -1
- package/lib/shared/templateStyleVars.ts +49 -0
- package/lib/shared/utilityClassMapper.test.ts +80 -0
- package/lib/shared/utilityClassMapper.ts +116 -0
- package/package.json +1 -1
- package/dist/chunks/chunk-H6EOTPJA.js.map +0 -7
|
@@ -6100,6 +6100,70 @@ function classesToStyles(classes, knownTokens) {
|
|
|
6100
6100
|
const hasAny = Object.keys(styles.base || {}).length > 0 || Object.keys(styles.tablet || {}).length > 0 || Object.keys(styles.mobile || {}).length > 0;
|
|
6101
6101
|
return hasAny ? styles : null;
|
|
6102
6102
|
}
|
|
6103
|
+
var COLOR_ROOT_TO_PROP = {
|
|
6104
|
+
text: "color",
|
|
6105
|
+
bg: "backgroundColor",
|
|
6106
|
+
border: "borderColor",
|
|
6107
|
+
accent: "accentColor",
|
|
6108
|
+
outline: "outlineColor",
|
|
6109
|
+
decoration: "textDecorationColor",
|
|
6110
|
+
caret: "caretColor",
|
|
6111
|
+
fill: "fill",
|
|
6112
|
+
stroke: "stroke"
|
|
6113
|
+
};
|
|
6114
|
+
function classMergeKey(className) {
|
|
6115
|
+
const { breakpoint, base } = splitVariantPrefix(className);
|
|
6116
|
+
let bp = normalizeBreakpointVariant(breakpoint) ?? "";
|
|
6117
|
+
if (bp === "lg") bp = "tablet";
|
|
6118
|
+
else if (bp === "sm") bp = "mobile";
|
|
6119
|
+
const entry = classToStyle(className);
|
|
6120
|
+
if (entry) return `${bp}|${entry.prop}`;
|
|
6121
|
+
const dash = base.indexOf("-");
|
|
6122
|
+
if (dash > 0) {
|
|
6123
|
+
const prop = COLOR_ROOT_TO_PROP[base.slice(0, dash)];
|
|
6124
|
+
if (prop && /^[a-zA-Z][\w-]*$/.test(base.slice(dash + 1))) return `${bp}|${prop}`;
|
|
6125
|
+
}
|
|
6126
|
+
return null;
|
|
6127
|
+
}
|
|
6128
|
+
function mergeInstanceClasses(own, instanceClass) {
|
|
6129
|
+
const instance = instanceClass.split(/\s+/).filter(Boolean);
|
|
6130
|
+
if (instance.length === 0) return own;
|
|
6131
|
+
const overridden = new Set(instance.map(classMergeKey).filter((k) => k !== null));
|
|
6132
|
+
const kept = own.filter((cls) => {
|
|
6133
|
+
const key = classMergeKey(cls);
|
|
6134
|
+
return key === null || !overridden.has(key);
|
|
6135
|
+
});
|
|
6136
|
+
return [...kept, ...instance];
|
|
6137
|
+
}
|
|
6138
|
+
function stripClassOverriddenStyleProps(style, instanceClass) {
|
|
6139
|
+
if (!style || typeof style !== "object") return null;
|
|
6140
|
+
const overridden = new Set(
|
|
6141
|
+
instanceClass.split(/\s+/).filter(Boolean).map(classMergeKey).filter((k) => k !== null)
|
|
6142
|
+
);
|
|
6143
|
+
if (overridden.size === 0) return style;
|
|
6144
|
+
const stripBucket = (bucket, bp) => {
|
|
6145
|
+
const out = {};
|
|
6146
|
+
for (const [prop, value] of Object.entries(bucket)) {
|
|
6147
|
+
if (!overridden.has(`${bp}|${prop}`)) out[prop] = value;
|
|
6148
|
+
}
|
|
6149
|
+
return out;
|
|
6150
|
+
};
|
|
6151
|
+
if (isResponsiveStyle(style)) {
|
|
6152
|
+
const out = {};
|
|
6153
|
+
let changed = false;
|
|
6154
|
+
for (const [bpName, bucket] of Object.entries(style)) {
|
|
6155
|
+
if (!bucket || typeof bucket !== "object") continue;
|
|
6156
|
+
const stripped = stripBucket(bucket, bpName === "base" ? "" : bpName);
|
|
6157
|
+
if (Object.keys(stripped).length !== Object.keys(bucket).length) changed = true;
|
|
6158
|
+
if (Object.keys(stripped).length > 0) out[bpName] = stripped;
|
|
6159
|
+
}
|
|
6160
|
+
if (!changed) return style;
|
|
6161
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
6162
|
+
}
|
|
6163
|
+
const flat = stripBucket(style, "");
|
|
6164
|
+
if (Object.keys(flat).length === Object.keys(style).length) return style;
|
|
6165
|
+
return Object.keys(flat).length > 0 ? flat : null;
|
|
6166
|
+
}
|
|
6103
6167
|
function isClassableStyleValue(value) {
|
|
6104
6168
|
if (typeof value === "number") return true;
|
|
6105
6169
|
if (typeof value === "string") return !value.includes("{{");
|
|
@@ -7401,6 +7465,9 @@ export {
|
|
|
7401
7465
|
responsiveStylesToClasses,
|
|
7402
7466
|
classToStyle,
|
|
7403
7467
|
classesToStyles,
|
|
7468
|
+
classMergeKey,
|
|
7469
|
+
mergeInstanceClasses,
|
|
7470
|
+
stripClassOverriddenStyleProps,
|
|
7404
7471
|
isClassableStyleValue,
|
|
7405
7472
|
splitStyleByClassability,
|
|
7406
7473
|
styleHasMapping,
|
|
@@ -7451,4 +7518,4 @@ export {
|
|
|
7451
7518
|
generateInteractiveCSS,
|
|
7452
7519
|
generateAllInteractiveCSS
|
|
7453
7520
|
};
|
|
7454
|
-
//# sourceMappingURL=chunk-
|
|
7521
|
+
//# sourceMappingURL=chunk-KX2LPIZZ.js.map
|