meno-core 1.0.45 → 1.0.46

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.
Files changed (56) hide show
  1. package/build-astro.ts +214 -63
  2. package/dist/bin/cli.js +2 -2
  3. package/dist/build-static.js +7 -7
  4. package/dist/chunks/{chunk-NZTSJS5C.js → chunk-2QK6U5UK.js} +3 -2
  5. package/dist/chunks/{chunk-NZTSJS5C.js.map → chunk-2QK6U5UK.js.map} +2 -2
  6. package/dist/chunks/{chunk-BZQKEJQY.js → chunk-77ZB6353.js} +29 -18
  7. package/dist/chunks/chunk-77ZB6353.js.map +7 -0
  8. package/dist/chunks/{chunk-TVH3TC2T.js → chunk-C6U5T5S5.js} +6 -6
  9. package/dist/chunks/{chunk-5ZASE4IG.js → chunk-FED5MME6.js} +234 -11
  10. package/dist/chunks/{chunk-5ZASE4IG.js.map → chunk-FED5MME6.js.map} +3 -3
  11. package/dist/chunks/{chunk-5Z5VQRTJ.js → chunk-I7YIGZXT.js} +4 -4
  12. package/dist/chunks/{chunk-5Z5VQRTJ.js.map → chunk-I7YIGZXT.js.map} +2 -2
  13. package/dist/chunks/{chunk-OUNJ76QM.js → chunk-ORN7S4AP.js} +5 -5
  14. package/dist/chunks/{chunk-GYF3ABI3.js → chunk-UUA5LEWF.js} +3 -3
  15. package/dist/chunks/{chunk-GYF3ABI3.js.map → chunk-UUA5LEWF.js.map} +2 -2
  16. package/dist/chunks/{chunk-WQSG5WHC.js → chunk-ZTKHJQ2Z.js} +2 -2
  17. package/dist/chunks/{chunk-F7MA62WG.js → chunk-ZWYDT3QJ.js} +3 -3
  18. package/dist/chunks/{configService-6KTT6GRT.js → configService-DYCUEURL.js} +3 -3
  19. package/dist/chunks/{constants-L5IKLB6U.js → constants-GWBAD66U.js} +2 -2
  20. package/dist/entries/server-router.js +7 -7
  21. package/dist/lib/client/index.js +4 -4
  22. package/dist/lib/server/index.js +586 -142
  23. package/dist/lib/server/index.js.map +3 -3
  24. package/dist/lib/shared/index.js +7 -3
  25. package/dist/lib/shared/index.js.map +2 -2
  26. package/dist/lib/test-utils/index.js +1 -1
  27. package/lib/client/templateEngine.test.ts +64 -0
  28. package/lib/server/astro/astroEmitHelpers.ts +18 -0
  29. package/lib/server/astro/cmsPageEmitter.ts +31 -1
  30. package/lib/server/astro/componentEmitter.test.ts +59 -0
  31. package/lib/server/astro/componentEmitter.ts +43 -10
  32. package/lib/server/astro/cssCollector.ts +58 -11
  33. package/lib/server/astro/nodeToAstro.test.ts +397 -5
  34. package/lib/server/astro/nodeToAstro.ts +478 -63
  35. package/lib/server/astro/pageEmitter.ts +31 -1
  36. package/lib/server/astro/tailwindMapper.test.ts +119 -0
  37. package/lib/server/astro/tailwindMapper.ts +67 -1
  38. package/lib/server/runtime/httpServer.ts +12 -4
  39. package/lib/server/ssr/htmlGenerator.ts +1 -1
  40. package/lib/server/ssr/jsCollector.ts +2 -2
  41. package/lib/server/ssr/ssrRenderer.test.ts +32 -0
  42. package/lib/server/ssr/ssrRenderer.ts +26 -11
  43. package/lib/shared/constants.ts +1 -0
  44. package/lib/shared/cssGeneration.test.ts +109 -3
  45. package/lib/shared/cssGeneration.ts +98 -13
  46. package/lib/shared/cssNamedColors.ts +47 -0
  47. package/lib/shared/cssProperties.ts +2 -2
  48. package/lib/shared/index.ts +1 -0
  49. package/package.json +1 -1
  50. package/dist/chunks/chunk-BZQKEJQY.js.map +0 -7
  51. /package/dist/chunks/{chunk-TVH3TC2T.js.map → chunk-C6U5T5S5.js.map} +0 -0
  52. /package/dist/chunks/{chunk-OUNJ76QM.js.map → chunk-ORN7S4AP.js.map} +0 -0
  53. /package/dist/chunks/{chunk-WQSG5WHC.js.map → chunk-ZTKHJQ2Z.js.map} +0 -0
  54. /package/dist/chunks/{chunk-F7MA62WG.js.map → chunk-ZWYDT3QJ.js.map} +0 -0
  55. /package/dist/chunks/{configService-6KTT6GRT.js.map → configService-DYCUEURL.js.map} +0 -0
  56. /package/dist/chunks/{constants-L5IKLB6U.js.map → constants-GWBAD66U.js.map} +0 -0
@@ -16,10 +16,10 @@ import {
16
16
  parseJSON,
17
17
  resolveSlugToPageId,
18
18
  variableService
19
- } from "./chunk-BZQKEJQY.js";
19
+ } from "./chunk-77ZB6353.js";
20
20
  import {
21
21
  configService
22
- } from "./chunk-WQSG5WHC.js";
22
+ } from "./chunk-ZTKHJQ2Z.js";
23
23
  import {
24
24
  bundleFile,
25
25
  createRuntimeServer,
@@ -29,7 +29,7 @@ import {
29
29
  projectPaths,
30
30
  resolvePackagePath,
31
31
  resolveProjectPath
32
- } from "./chunk-5Z5VQRTJ.js";
32
+ } from "./chunk-I7YIGZXT.js";
33
33
  import {
34
34
  fileExists,
35
35
  hashContent,
@@ -45,7 +45,7 @@ import {
45
45
  } from "./chunk-KITQJYZV.js";
46
46
  import {
47
47
  addItemUrls
48
- } from "./chunk-5ZASE4IG.js";
48
+ } from "./chunk-FED5MME6.js";
49
49
  import {
50
50
  parseLocaleFromPath
51
51
  } from "./chunk-XSWR3QLI.js";
@@ -56,7 +56,7 @@ import {
56
56
  SERVER_PORT,
57
57
  WEBSOCKET_STATES,
58
58
  init_constants
59
- } from "./chunk-NZTSJS5C.js";
59
+ } from "./chunk-2QK6U5UK.js";
60
60
 
61
61
  // lib/server/pageCache.ts
62
62
  var PageCache = class {
@@ -3221,4 +3221,4 @@ export {
3221
3221
  createServer,
3222
3222
  FileSystemPageProvider
3223
3223
  };
3224
- //# sourceMappingURL=chunk-TVH3TC2T.js.map
3224
+ //# sourceMappingURL=chunk-C6U5T5S5.js.map
@@ -5,6 +5,7 @@ import {
5
5
  convertPxToRem,
6
6
  getBreakpointName,
7
7
  getBreakpointValues,
8
+ getScaleMultiplier,
8
9
  isI18nValue,
9
10
  resolveI18nInProps,
10
11
  resolveI18nValue,
@@ -18,7 +19,7 @@ import {
18
19
  import {
19
20
  NODE_TYPE,
20
21
  init_constants
21
- } from "./chunk-NZTSJS5C.js";
22
+ } from "./chunk-2QK6U5UK.js";
22
23
  import {
23
24
  __esm,
24
25
  __export,
@@ -3824,6 +3825,170 @@ function isCurrentLink(href, currentPagePath) {
3824
3825
  return normalizePath(href) === normalizePath(currentPagePath);
3825
3826
  }
3826
3827
 
3828
+ // lib/shared/cssNamedColors.ts
3829
+ var CSS_NAMED_COLORS = /* @__PURE__ */ new Set([
3830
+ // CSS Level 4 named colors
3831
+ "aliceblue",
3832
+ "antiquewhite",
3833
+ "aqua",
3834
+ "aquamarine",
3835
+ "azure",
3836
+ "beige",
3837
+ "bisque",
3838
+ "black",
3839
+ "blanchedalmond",
3840
+ "blue",
3841
+ "blueviolet",
3842
+ "brown",
3843
+ "burlywood",
3844
+ "cadetblue",
3845
+ "chartreuse",
3846
+ "chocolate",
3847
+ "coral",
3848
+ "cornflowerblue",
3849
+ "cornsilk",
3850
+ "crimson",
3851
+ "cyan",
3852
+ "darkblue",
3853
+ "darkcyan",
3854
+ "darkgoldenrod",
3855
+ "darkgray",
3856
+ "darkgreen",
3857
+ "darkgrey",
3858
+ "darkkhaki",
3859
+ "darkmagenta",
3860
+ "darkolivegreen",
3861
+ "darkorange",
3862
+ "darkorchid",
3863
+ "darkred",
3864
+ "darksalmon",
3865
+ "darkseagreen",
3866
+ "darkslateblue",
3867
+ "darkslategray",
3868
+ "darkslategrey",
3869
+ "darkturquoise",
3870
+ "darkviolet",
3871
+ "deeppink",
3872
+ "deepskyblue",
3873
+ "dimgray",
3874
+ "dimgrey",
3875
+ "dodgerblue",
3876
+ "firebrick",
3877
+ "floralwhite",
3878
+ "forestgreen",
3879
+ "fuchsia",
3880
+ "gainsboro",
3881
+ "ghostwhite",
3882
+ "gold",
3883
+ "goldenrod",
3884
+ "gray",
3885
+ "green",
3886
+ "greenyellow",
3887
+ "grey",
3888
+ "honeydew",
3889
+ "hotpink",
3890
+ "indianred",
3891
+ "indigo",
3892
+ "ivory",
3893
+ "khaki",
3894
+ "lavender",
3895
+ "lavenderblush",
3896
+ "lawngreen",
3897
+ "lemonchiffon",
3898
+ "lightblue",
3899
+ "lightcoral",
3900
+ "lightcyan",
3901
+ "lightgoldenrodyellow",
3902
+ "lightgray",
3903
+ "lightgreen",
3904
+ "lightgrey",
3905
+ "lightpink",
3906
+ "lightsalmon",
3907
+ "lightseagreen",
3908
+ "lightskyblue",
3909
+ "lightslategray",
3910
+ "lightslategrey",
3911
+ "lightsteelblue",
3912
+ "lightyellow",
3913
+ "lime",
3914
+ "limegreen",
3915
+ "linen",
3916
+ "magenta",
3917
+ "maroon",
3918
+ "mediumaquamarine",
3919
+ "mediumblue",
3920
+ "mediumorchid",
3921
+ "mediumpurple",
3922
+ "mediumseagreen",
3923
+ "mediumslateblue",
3924
+ "mediumspringgreen",
3925
+ "mediumturquoise",
3926
+ "mediumvioletred",
3927
+ "midnightblue",
3928
+ "mintcream",
3929
+ "mistyrose",
3930
+ "moccasin",
3931
+ "navajowhite",
3932
+ "navy",
3933
+ "oldlace",
3934
+ "olive",
3935
+ "olivedrab",
3936
+ "orange",
3937
+ "orangered",
3938
+ "orchid",
3939
+ "palegoldenrod",
3940
+ "palegreen",
3941
+ "paleturquoise",
3942
+ "palevioletred",
3943
+ "papayawhip",
3944
+ "peachpuff",
3945
+ "peru",
3946
+ "pink",
3947
+ "plum",
3948
+ "powderblue",
3949
+ "purple",
3950
+ "rebeccapurple",
3951
+ "red",
3952
+ "rosybrown",
3953
+ "royalblue",
3954
+ "saddlebrown",
3955
+ "salmon",
3956
+ "sandybrown",
3957
+ "seagreen",
3958
+ "seashell",
3959
+ "sienna",
3960
+ "silver",
3961
+ "skyblue",
3962
+ "slateblue",
3963
+ "slategray",
3964
+ "slategrey",
3965
+ "snow",
3966
+ "springgreen",
3967
+ "steelblue",
3968
+ "tan",
3969
+ "teal",
3970
+ "thistle",
3971
+ "tomato",
3972
+ "turquoise",
3973
+ "violet",
3974
+ "wheat",
3975
+ "white",
3976
+ "whitesmoke",
3977
+ "yellow",
3978
+ "yellowgreen",
3979
+ // CSS color keywords
3980
+ "transparent",
3981
+ "currentcolor",
3982
+ // CSS-wide keywords (should never be wrapped in var())
3983
+ "inherit",
3984
+ "initial",
3985
+ "unset",
3986
+ "revert"
3987
+ ]);
3988
+ function isCssNamedColor(value) {
3989
+ return CSS_NAMED_COLORS.has(value.toLowerCase());
3990
+ }
3991
+
3827
3992
  // lib/shared/cssGeneration.ts
3828
3993
  var SORTED_PREFIXES = Object.keys(prefixToCSSProperty).sort((a, b) => b.length - a.length);
3829
3994
  var cssPropertyOrderMap = (() => {
@@ -4080,6 +4245,9 @@ function generateRuleForClass(className) {
4080
4245
  }
4081
4246
  if (prefix === "bgc" || prefix === "bg" || prefix === "c" || prefix === "bc") {
4082
4247
  if (!value.startsWith("#") && !value.includes("rgb") && !value.includes("px")) {
4248
+ if (isCssNamedColor(value)) {
4249
+ return `${cssProp}: ${value};`;
4250
+ }
4083
4251
  return `${cssProp}: var(--${value});`;
4084
4252
  }
4085
4253
  }
@@ -4364,12 +4532,16 @@ function styleObjectToCSS(style) {
4364
4532
  }
4365
4533
  return declarations.join("; ");
4366
4534
  }
4367
- function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = DEFAULT_BREAKPOINTS, remConfig) {
4535
+ function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = DEFAULT_BREAKPOINTS, remConfig, responsiveScales) {
4368
4536
  const css = [];
4369
4537
  const breakpointValues = getBreakpointValues(breakpoints);
4538
+ const scalingEnabled = responsiveScales?.enabled === true;
4370
4539
  for (const rule of interactiveStyles) {
4371
4540
  const { prefix, postfix, style } = rule;
4372
4541
  const fullSelector = `${prefix || ""}.${elementClass}${postfix || ""}`;
4542
+ const sortedBreakpoints = Object.entries(breakpointValues).sort(
4543
+ ([, a], [, b]) => b - a
4544
+ );
4373
4545
  if (isResponsiveStyle2(style)) {
4374
4546
  const responsive = style;
4375
4547
  if (responsive.base && Object.keys(responsive.base).length > 0) {
@@ -4378,13 +4550,25 @@ function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = D
4378
4550
  css.push(`${fullSelector} { ${properties}; }`);
4379
4551
  }
4380
4552
  }
4381
- const sortedBreakpoints = Object.entries(breakpointValues).sort(
4382
- ([, a], [, b]) => b - a
4383
- );
4384
4553
  for (const [breakpointName, breakpointValue] of sortedBreakpoints) {
4385
- const breakpointStyles = responsive[breakpointName];
4386
- if (breakpointStyles && Object.keys(breakpointStyles).length > 0) {
4387
- const properties = applyRemConversion(styleObjectToCSS(breakpointStyles), remConfig);
4554
+ const explicit = responsive[breakpointName];
4555
+ let merged = null;
4556
+ if (explicit && Object.keys(explicit).length > 0) {
4557
+ merged = { ...explicit };
4558
+ }
4559
+ if (scalingEnabled && responsive.base) {
4560
+ const scaled = scaleStyleForBreakpoint(
4561
+ responsive.base,
4562
+ responsiveScales,
4563
+ breakpointName,
4564
+ new Set(Object.keys(explicit ?? {}))
4565
+ );
4566
+ if (Object.keys(scaled).length > 0) {
4567
+ merged = { ...merged ?? {}, ...scaled };
4568
+ }
4569
+ }
4570
+ if (merged && Object.keys(merged).length > 0) {
4571
+ const properties = applyRemConversion(styleObjectToCSS(merged), remConfig);
4388
4572
  if (properties) {
4389
4573
  css.push(
4390
4574
  `@media (max-width: ${breakpointValue}px) { ${fullSelector} { ${properties}; } }`
@@ -4399,15 +4583,52 @@ function generateInteractiveCSS(elementClass, interactiveStyles, breakpoints = D
4399
4583
  if (properties) {
4400
4584
  css.push(`${fullSelector} { ${properties}; }`);
4401
4585
  }
4586
+ if (scalingEnabled) {
4587
+ for (const [breakpointName, breakpointValue] of sortedBreakpoints) {
4588
+ const scaled = scaleStyleForBreakpoint(
4589
+ flatStyle,
4590
+ responsiveScales,
4591
+ breakpointName,
4592
+ /* @__PURE__ */ new Set()
4593
+ );
4594
+ if (Object.keys(scaled).length === 0) continue;
4595
+ const scaledProps = applyRemConversion(styleObjectToCSS(scaled), remConfig);
4596
+ if (!scaledProps) continue;
4597
+ css.push(
4598
+ `@media (max-width: ${breakpointValue}px) { ${fullSelector} { ${scaledProps}; } }`
4599
+ );
4600
+ }
4601
+ }
4402
4602
  }
4403
4603
  }
4404
4604
  }
4405
4605
  return css.join("\n");
4406
4606
  }
4407
- function generateAllInteractiveCSS(interactiveStylesMap, breakpoints = DEFAULT_BREAKPOINTS, remConfig) {
4607
+ function scaleStyleForBreakpoint(baseStyle, responsiveScales, breakpointName, skipProperties) {
4608
+ const result = {};
4609
+ const baseRef = responsiveScales.baseReference ?? 16;
4610
+ for (const [property, value] of Object.entries(baseStyle)) {
4611
+ if (skipProperties.has(property)) continue;
4612
+ if (typeof value === "object" && value !== null && "_mapping" in value) continue;
4613
+ if (value == null) continue;
4614
+ const strValue = String(value);
4615
+ if (strValue === "") continue;
4616
+ const scale = getScaleMultiplier(
4617
+ responsiveScales,
4618
+ property,
4619
+ breakpointName
4620
+ );
4621
+ if (scale == null) continue;
4622
+ const scaledValue = scalePropertyValue(strValue, baseRef, scale);
4623
+ if (scaledValue == null || scaledValue === strValue) continue;
4624
+ result[property] = scaledValue;
4625
+ }
4626
+ return result;
4627
+ }
4628
+ function generateAllInteractiveCSS(interactiveStylesMap, breakpoints = DEFAULT_BREAKPOINTS, remConfig, responsiveScales) {
4408
4629
  const cssBlocks = [];
4409
4630
  for (const [elementClass, styles] of interactiveStylesMap) {
4410
- const css = generateInteractiveCSS(elementClass, styles, breakpoints, remConfig);
4631
+ const css = generateInteractiveCSS(elementClass, styles, breakpoints, remConfig, responsiveScales);
4411
4632
  if (css) {
4412
4633
  cssBlocks.push(css);
4413
4634
  }
@@ -4579,6 +4800,8 @@ export {
4579
4800
  createStyleMappingFromProps,
4580
4801
  normalizePath,
4581
4802
  isCurrentLink,
4803
+ CSS_NAMED_COLORS,
4804
+ isCssNamedColor,
4582
4805
  sortClassesByPropertyOrder,
4583
4806
  generateRuleForClass,
4584
4807
  generateUtilityCSS,
@@ -4587,4 +4810,4 @@ export {
4587
4810
  generateInteractiveCSS,
4588
4811
  generateAllInteractiveCSS
4589
4812
  };
4590
- //# sourceMappingURL=chunk-5ZASE4IG.js.map
4813
+ //# sourceMappingURL=chunk-FED5MME6.js.map