meno-core 1.0.48 → 1.0.50
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/build-astro.ts +6 -2
- package/dist/build-static.js +7 -7
- package/dist/chunks/{chunk-D5E3OKSL.js → chunk-56EUSC6D.js} +5 -5
- package/dist/chunks/{chunk-3FHJUHAS.js → chunk-7NIC4I3V.js} +300 -43
- package/dist/chunks/chunk-7NIC4I3V.js.map +7 -0
- package/dist/chunks/{chunk-B2RTLDXY.js → chunk-AZQYF6KE.js} +132 -1
- package/dist/chunks/chunk-AZQYF6KE.js.map +7 -0
- package/dist/chunks/{chunk-TPQ7APVQ.js → chunk-CVLFID6V.js} +473 -73
- package/dist/chunks/chunk-CVLFID6V.js.map +7 -0
- package/dist/chunks/{chunk-NP76N4HQ.js → chunk-EDQSMAMP.js} +13 -2
- package/dist/chunks/{chunk-NP76N4HQ.js.map → chunk-EDQSMAMP.js.map} +2 -2
- package/dist/chunks/{chunk-RQSTH2BS.js → chunk-H4JSCDNW.js} +2 -2
- package/dist/chunks/{chunk-EK4KESLU.js → chunk-J23ZX5AP.js} +8 -2
- package/dist/chunks/{chunk-EK4KESLU.js.map → chunk-J23ZX5AP.js.map} +2 -2
- package/dist/chunks/{chunk-UUA5LEWF.js → chunk-LPVETICS.js} +156 -8
- package/dist/chunks/chunk-LPVETICS.js.map +7 -0
- package/dist/chunks/{chunk-BJRKEPMP.js → chunk-PQ2HRXDR.js} +5 -2
- package/dist/chunks/chunk-PQ2HRXDR.js.map +7 -0
- package/dist/chunks/{chunk-NKUV77SR.js → chunk-YWJJD5D6.js} +133 -37
- package/dist/chunks/chunk-YWJJD5D6.js.map +7 -0
- package/dist/chunks/{configService-IGJEC3MC.js → configService-VOY2MY2K.js} +3 -3
- package/dist/entries/server-router.js +9 -9
- package/dist/entries/server-router.js.map +2 -2
- package/dist/lib/client/index.js +92 -32
- package/dist/lib/client/index.js.map +3 -3
- package/dist/lib/server/index.js +14 -12
- package/dist/lib/server/index.js.map +2 -2
- package/dist/lib/shared/index.js +46 -10
- package/dist/lib/shared/index.js.map +3 -3
- package/entries/server-router.tsx +6 -2
- package/lib/client/core/ComponentBuilder.test.ts +34 -0
- package/lib/client/core/ComponentBuilder.ts +33 -4
- package/lib/client/core/builders/embedBuilder.ts +28 -7
- package/lib/client/core/builders/linkNodeBuilder.ts +28 -7
- package/lib/client/core/builders/localeListBuilder.ts +30 -11
- package/lib/client/styles/StyleInjector.ts +3 -2
- package/lib/client/templateEngine.ts +24 -0
- package/lib/client/theme.ts +4 -4
- package/lib/server/cssGenerator.test.ts +64 -1
- package/lib/server/cssGenerator.ts +48 -9
- package/lib/server/fileWatcher.test.ts +134 -0
- package/lib/server/fileWatcher.ts +100 -32
- package/lib/server/jsonLoader.ts +1 -0
- package/lib/server/providers/fileSystemCMSProvider.test.ts +163 -0
- package/lib/server/providers/fileSystemCMSProvider.ts +240 -19
- package/lib/server/routes/index.ts +1 -1
- package/lib/server/routes/pages.ts +23 -1
- package/lib/server/services/cmsService.test.ts +246 -0
- package/lib/server/services/cmsService.ts +122 -5
- package/lib/server/services/configService.ts +6 -0
- package/lib/server/services/fileWatcherService.ts +17 -0
- package/lib/server/ssr/attributeBuilder.ts +41 -0
- package/lib/server/ssr/htmlGenerator.test.ts +113 -0
- package/lib/server/ssr/htmlGenerator.ts +62 -7
- package/lib/server/ssr/liveReloadIntegration.test.ts +209 -0
- package/lib/server/ssr/ssrRenderer.test.ts +564 -0
- package/lib/server/ssr/ssrRenderer.ts +228 -49
- package/lib/server/webflow/buildWebflow.ts +1 -1
- package/lib/server/websocketManager.test.ts +61 -6
- package/lib/server/websocketManager.ts +25 -1
- package/lib/shared/cssGeneration.test.ts +267 -1
- package/lib/shared/cssGeneration.ts +240 -18
- package/lib/shared/cssProperties.test.ts +275 -1
- package/lib/shared/cssProperties.ts +223 -7
- package/lib/shared/interfaces/contentProvider.ts +39 -6
- package/lib/shared/pathSecurity.ts +16 -0
- package/lib/shared/responsiveScaling.test.ts +143 -0
- package/lib/shared/responsiveScaling.ts +253 -2
- package/lib/shared/themeDefaults.test.ts +3 -3
- package/lib/shared/themeDefaults.ts +3 -3
- package/lib/shared/types/api.ts +10 -1
- package/lib/shared/types/cms.ts +46 -12
- package/lib/shared/types/index.ts +1 -0
- package/lib/shared/utilityClassConfig.ts +3 -0
- package/lib/shared/utilityClassMapper.test.ts +123 -0
- package/lib/shared/utilityClassMapper.ts +179 -8
- package/lib/shared/validation/schemas.test.ts +93 -0
- package/lib/shared/validation/schemas.ts +71 -16
- package/lib/shared/validation/validators.ts +26 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-3FHJUHAS.js.map +0 -7
- package/dist/chunks/chunk-B2RTLDXY.js.map +0 -7
- package/dist/chunks/chunk-BJRKEPMP.js.map +0 -7
- package/dist/chunks/chunk-NKUV77SR.js.map +0 -7
- package/dist/chunks/chunk-TPQ7APVQ.js.map +0 -7
- package/dist/chunks/chunk-UUA5LEWF.js.map +0 -7
- /package/dist/chunks/{chunk-D5E3OKSL.js.map → chunk-56EUSC6D.js.map} +0 -0
- /package/dist/chunks/{chunk-RQSTH2BS.js.map → chunk-H4JSCDNW.js.map} +0 -0
- /package/dist/chunks/{configService-IGJEC3MC.js.map → configService-VOY2MY2K.js.map} +0 -0
|
@@ -378,14 +378,15 @@ function getPropertyPriority(property) {
|
|
|
378
378
|
return CSS_PROPERTY_PRIORITY[property] ?? 3;
|
|
379
379
|
}
|
|
380
380
|
var CSS_PROPERTY_GROUPS = {
|
|
381
|
-
"Layout": ["display"
|
|
382
|
-
"
|
|
383
|
-
"
|
|
384
|
-
"
|
|
381
|
+
"Layout": ["display"],
|
|
382
|
+
"Spacing": ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
|
|
383
|
+
"Size": ["width", "height", "minWidth", "maxWidth", "minHeight", "maxHeight", "aspectRatio"],
|
|
384
|
+
"Position": ["position", "top", "right", "bottom", "left", "inset", "zIndex"],
|
|
385
|
+
"Flexbox": ["flex", "flexDirection", "flexWrap", "flexFlow", "justifyContent", "alignItems", "alignContent", "gap", "rowGap", "columnGap", "alignSelf", "flexGrow", "flexShrink", "flexBasis", "order"],
|
|
385
386
|
"Grid": ["grid", "gridTemplateColumns", "gridTemplateRows", "gridTemplateAreas", "gridGap", "gridColumn", "gridRow", "gridArea", "gridAutoFlow", "gridAutoColumns", "gridAutoRows", "justifyItems", "justifySelf", "placeContent", "placeItems", "placeSelf"],
|
|
386
|
-
"Typography": ["
|
|
387
|
+
"Typography": ["fontWeight", "fontSize", "fontFamily", "fontStyle", "lineHeight", "color", "textAlign", "textDecoration", "textTransform", "letterSpacing", "wordSpacing", "wordBreak", "overflowWrap", "textIndent", "verticalAlign"],
|
|
387
388
|
"Background": ["background", "backgroundColor", "backgroundImage", "backgroundSize", "backgroundPosition", "backgroundRepeat", "opacity"],
|
|
388
|
-
"Borders": ["
|
|
389
|
+
"Borders": ["borderRadius", "borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "border", "borderWidth", "borderStyle", "borderColor", "borderTop", "borderRight", "borderBottom", "borderLeft"],
|
|
389
390
|
"Outline": ["outline", "outlineWidth", "outlineStyle", "outlineColor", "outlineOffset"],
|
|
390
391
|
"Effects": ["boxShadow", "textShadow", "filter", "backdropFilter", "transform", "transformOrigin", "transition", "animation", "backfaceVisibility", "mixBlendMode", "clipPath"],
|
|
391
392
|
"Overflow": ["overflow", "overflowX", "overflowY", "whiteSpace", "textOverflow", "visibility", "content"],
|
|
@@ -402,6 +403,97 @@ function getPropertyGroup(propertyName) {
|
|
|
402
403
|
}
|
|
403
404
|
return "Other";
|
|
404
405
|
}
|
|
406
|
+
var VISUAL_MODE_PROPERTIES = {
|
|
407
|
+
"Layout": ["display"],
|
|
408
|
+
"Grid": ["gridTemplateColumns"],
|
|
409
|
+
"Flexbox": ["flexDirection", "flexWrap", "justifyContent", "alignItems", "gap", "flexGrow", "flexShrink", "flexBasis"],
|
|
410
|
+
"Spacing": ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
|
|
411
|
+
"Size": ["width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight"],
|
|
412
|
+
"Position": ["position", "top", "right", "bottom", "left", "zIndex"],
|
|
413
|
+
"Typography": ["fontFamily", "fontWeight", "fontSize", "lineHeight", "color", "letterSpacing", "textAlign", "textTransform", "textDecoration"],
|
|
414
|
+
"Background": ["backgroundColor", "backgroundImage", "backgroundSize", "backgroundPosition", "backgroundRepeat", "opacity"],
|
|
415
|
+
"Borders": ["borderRadius", "borderWidth", "borderStyle", "borderColor"],
|
|
416
|
+
"Effects": ["boxShadow", "transform", "transition", "filter"],
|
|
417
|
+
"Overflow": ["overflow", "whiteSpace"],
|
|
418
|
+
"Interaction": ["cursor", "pointerEvents"]
|
|
419
|
+
};
|
|
420
|
+
var VISUAL_MODE_PROPERTIES_SET = new Set(
|
|
421
|
+
Object.values(VISUAL_MODE_PROPERTIES).flat()
|
|
422
|
+
);
|
|
423
|
+
function isVisualModeProperty(prop) {
|
|
424
|
+
return VISUAL_MODE_PROPERTIES_SET.has(prop);
|
|
425
|
+
}
|
|
426
|
+
var isFlexDisplay = (d) => d === "flex" || d === "inline-flex";
|
|
427
|
+
var isGridDisplay = (d) => d === "grid" || d === "inline-grid";
|
|
428
|
+
var isListTag = (t) => t === "ul" || t === "ol" || t === "li";
|
|
429
|
+
var isMediaTag = (t) => t === "img" || t === "video";
|
|
430
|
+
var VISUAL_MODE_RULES = {
|
|
431
|
+
// Flex/Grid CONTAINER props — own display must be flex/grid.
|
|
432
|
+
flexDirection: (ctx) => isFlexDisplay(ctx.display),
|
|
433
|
+
flexWrap: (ctx) => isFlexDisplay(ctx.display),
|
|
434
|
+
justifyContent: (ctx) => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),
|
|
435
|
+
alignItems: (ctx) => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),
|
|
436
|
+
alignContent: (ctx) => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),
|
|
437
|
+
gap: (ctx) => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),
|
|
438
|
+
rowGap: (ctx) => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),
|
|
439
|
+
columnGap: (ctx) => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),
|
|
440
|
+
gridTemplateColumns: (ctx) => isGridDisplay(ctx.display),
|
|
441
|
+
gridTemplateRows: (ctx) => isGridDisplay(ctx.display),
|
|
442
|
+
gridTemplateAreas: (ctx) => isGridDisplay(ctx.display),
|
|
443
|
+
gridGap: (ctx) => isGridDisplay(ctx.display),
|
|
444
|
+
gridAutoFlow: (ctx) => isGridDisplay(ctx.display),
|
|
445
|
+
gridAutoColumns: (ctx) => isGridDisplay(ctx.display),
|
|
446
|
+
gridAutoRows: (ctx) => isGridDisplay(ctx.display),
|
|
447
|
+
justifyItems: (ctx) => isGridDisplay(ctx.display),
|
|
448
|
+
placeItems: (ctx) => isGridDisplay(ctx.display),
|
|
449
|
+
placeContent: (ctx) => isGridDisplay(ctx.display),
|
|
450
|
+
// Flex/Grid ITEM props — PARENT display must be flex/grid.
|
|
451
|
+
flex: (ctx) => isFlexDisplay(ctx.parentDisplay),
|
|
452
|
+
flexFlow: (ctx) => isFlexDisplay(ctx.parentDisplay),
|
|
453
|
+
flexGrow: (ctx) => isFlexDisplay(ctx.parentDisplay),
|
|
454
|
+
flexShrink: (ctx) => isFlexDisplay(ctx.parentDisplay),
|
|
455
|
+
flexBasis: (ctx) => isFlexDisplay(ctx.parentDisplay),
|
|
456
|
+
alignSelf: (ctx) => isFlexDisplay(ctx.parentDisplay) || isGridDisplay(ctx.parentDisplay),
|
|
457
|
+
justifySelf: (ctx) => isGridDisplay(ctx.parentDisplay),
|
|
458
|
+
placeSelf: (ctx) => isGridDisplay(ctx.parentDisplay),
|
|
459
|
+
order: (ctx) => isFlexDisplay(ctx.parentDisplay) || isGridDisplay(ctx.parentDisplay),
|
|
460
|
+
gridArea: (ctx) => isGridDisplay(ctx.parentDisplay),
|
|
461
|
+
gridColumn: (ctx) => isGridDisplay(ctx.parentDisplay),
|
|
462
|
+
gridRow: (ctx) => isGridDisplay(ctx.parentDisplay),
|
|
463
|
+
// Position-dependent inset properties.
|
|
464
|
+
top: (ctx) => ctx.position !== "static",
|
|
465
|
+
right: (ctx) => ctx.position !== "static",
|
|
466
|
+
bottom: (ctx) => ctx.position !== "static",
|
|
467
|
+
left: (ctx) => ctx.position !== "static",
|
|
468
|
+
inset: (ctx) => ctx.position !== "static",
|
|
469
|
+
zIndex: (ctx) => ctx.position !== "static",
|
|
470
|
+
// Tag-based.
|
|
471
|
+
objectFit: (ctx) => isMediaTag(ctx.tagName),
|
|
472
|
+
objectPosition: (ctx) => isMediaTag(ctx.tagName),
|
|
473
|
+
listStyle: (ctx) => isListTag(ctx.tagName),
|
|
474
|
+
listStyleType: (ctx) => isListTag(ctx.tagName),
|
|
475
|
+
listStylePosition: (ctx) => isListTag(ctx.tagName),
|
|
476
|
+
// Padding/margin shorthand-vs-longhand auto-toggle.
|
|
477
|
+
// When ANY longhand is set, hide shorthand; otherwise hide longhands.
|
|
478
|
+
padding: (ctx) => !ctx.hasPaddingLonghand,
|
|
479
|
+
paddingTop: (ctx) => ctx.hasPaddingLonghand,
|
|
480
|
+
paddingRight: (ctx) => ctx.hasPaddingLonghand,
|
|
481
|
+
paddingBottom: (ctx) => ctx.hasPaddingLonghand,
|
|
482
|
+
paddingLeft: (ctx) => ctx.hasPaddingLonghand,
|
|
483
|
+
margin: (ctx) => !ctx.hasMarginLonghand,
|
|
484
|
+
marginTop: (ctx) => ctx.hasMarginLonghand,
|
|
485
|
+
marginRight: (ctx) => ctx.hasMarginLonghand,
|
|
486
|
+
marginBottom: (ctx) => ctx.hasMarginLonghand,
|
|
487
|
+
marginLeft: (ctx) => ctx.hasMarginLonghand,
|
|
488
|
+
// Background-image-only props — meaningless without a background image.
|
|
489
|
+
backgroundPosition: (ctx) => ctx.hasBackgroundImage,
|
|
490
|
+
backgroundSize: (ctx) => ctx.hasBackgroundImage,
|
|
491
|
+
backgroundRepeat: (ctx) => ctx.hasBackgroundImage
|
|
492
|
+
};
|
|
493
|
+
function isVisualModeRowVisible(prop, ctx) {
|
|
494
|
+
const rule = VISUAL_MODE_RULES[prop];
|
|
495
|
+
return rule ? rule(ctx) : true;
|
|
496
|
+
}
|
|
405
497
|
function matchesAbbreviation(property, input) {
|
|
406
498
|
if (!input) return false;
|
|
407
499
|
let propertyIndex = 0;
|
|
@@ -424,6 +516,18 @@ function matchesAbbreviation(property, input) {
|
|
|
424
516
|
}
|
|
425
517
|
return true;
|
|
426
518
|
}
|
|
519
|
+
var PROPERTY_SHORTCUTS = {
|
|
520
|
+
pl: "paddingLeft",
|
|
521
|
+
pr: "paddingRight",
|
|
522
|
+
pt: "paddingTop",
|
|
523
|
+
pu: "paddingTop",
|
|
524
|
+
pb: "paddingBottom",
|
|
525
|
+
ml: "marginLeft",
|
|
526
|
+
mr: "marginRight",
|
|
527
|
+
mt: "marginTop",
|
|
528
|
+
mu: "marginTop",
|
|
529
|
+
mb: "marginBottom"
|
|
530
|
+
};
|
|
427
531
|
function filterCSSProperties(input) {
|
|
428
532
|
const normalizedInput = (input ?? "").trim();
|
|
429
533
|
if (!normalizedInput) {
|
|
@@ -437,10 +541,15 @@ function filterCSSProperties(input) {
|
|
|
437
541
|
// Don't duplicate startsWith matches
|
|
438
542
|
);
|
|
439
543
|
const byPriority = (a, b) => getPropertyPriority(a) - getPropertyPriority(b);
|
|
440
|
-
|
|
544
|
+
const combined = [
|
|
441
545
|
...startsWithMatches.sort(byPriority),
|
|
442
546
|
...abbreviationMatches.sort(byPriority)
|
|
443
547
|
];
|
|
548
|
+
const shortcut = PROPERTY_SHORTCUTS[normalizedInput.toLowerCase()];
|
|
549
|
+
if (shortcut) {
|
|
550
|
+
return [shortcut, ...combined.filter((prop) => prop !== shortcut)];
|
|
551
|
+
}
|
|
552
|
+
return combined;
|
|
444
553
|
}
|
|
445
554
|
function getPropertyValues(propertyName) {
|
|
446
555
|
const values = CSS_PROPERTIES_DEFINITION[propertyName]?.values;
|
|
@@ -462,6 +571,39 @@ function filterPropertyValues(propertyName, input) {
|
|
|
462
571
|
function getPropertyType(propertyName) {
|
|
463
572
|
return CSS_PROPERTIES_DEFINITION[propertyName]?.type;
|
|
464
573
|
}
|
|
574
|
+
var UNITLESS_PROPERTIES = /* @__PURE__ */ new Set([
|
|
575
|
+
"fontWeight",
|
|
576
|
+
"lineHeight",
|
|
577
|
+
"opacity",
|
|
578
|
+
"fillOpacity",
|
|
579
|
+
"strokeOpacity",
|
|
580
|
+
"stopOpacity",
|
|
581
|
+
"zIndex",
|
|
582
|
+
"order",
|
|
583
|
+
"flexGrow",
|
|
584
|
+
"flexShrink",
|
|
585
|
+
"flex",
|
|
586
|
+
"columnCount",
|
|
587
|
+
"columns",
|
|
588
|
+
"tabSize",
|
|
589
|
+
"orphans",
|
|
590
|
+
"widows",
|
|
591
|
+
"gridRow",
|
|
592
|
+
"gridColumn",
|
|
593
|
+
"gridRowStart",
|
|
594
|
+
"gridRowEnd",
|
|
595
|
+
"gridColumnStart",
|
|
596
|
+
"gridColumnEnd",
|
|
597
|
+
"animationIterationCount",
|
|
598
|
+
"aspectRatio",
|
|
599
|
+
"scale"
|
|
600
|
+
]);
|
|
601
|
+
function appendsPxByDefault(propertyName) {
|
|
602
|
+
if (UNITLESS_PROPERTIES.has(propertyName)) return false;
|
|
603
|
+
const def = CSS_PROPERTIES_DEFINITION[propertyName];
|
|
604
|
+
if (def?.type === "select" || def?.type === "boolean" || def?.type === "number") return false;
|
|
605
|
+
return true;
|
|
606
|
+
}
|
|
465
607
|
|
|
466
608
|
// lib/shared/errorLogger.ts
|
|
467
609
|
var errorHandler = null;
|
|
@@ -507,12 +649,18 @@ export {
|
|
|
507
649
|
CSS_PROPERTIES,
|
|
508
650
|
CSS_PROPERTY_GROUPS,
|
|
509
651
|
getPropertyGroup,
|
|
652
|
+
VISUAL_MODE_PROPERTIES,
|
|
653
|
+
isVisualModeProperty,
|
|
654
|
+
VISUAL_MODE_RULES,
|
|
655
|
+
isVisualModeRowVisible,
|
|
510
656
|
filterCSSProperties,
|
|
511
657
|
getPropertyValues,
|
|
512
658
|
filterPropertyValues,
|
|
513
659
|
getPropertyType,
|
|
660
|
+
UNITLESS_PROPERTIES,
|
|
661
|
+
appendsPxByDefault,
|
|
514
662
|
setErrorHandler,
|
|
515
663
|
logRuntimeError,
|
|
516
664
|
logNetworkError
|
|
517
665
|
};
|
|
518
|
-
//# sourceMappingURL=chunk-
|
|
666
|
+
//# sourceMappingURL=chunk-LPVETICS.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../lib/shared/cssProperties.ts", "../../lib/shared/errorLogger.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * CSS Property Definition structure\n */\ninterface CSSPropertyDefinition {\n values?: readonly string[];\n type?: 'string' | 'select' | 'boolean' | 'number';\n}\n\n/**\n * CSS Properties with their valid values and metadata\n * Used for autocomplete suggestions for both property names and values\n */\nexport const CSS_PROPERTIES_DEFINITION: Record<string, CSSPropertyDefinition> = {\n // Display & Layout\n display: {\n values: ['block', 'flex', 'grid', 'inline', 'inline-block', 'inline-flex', 'inline-grid', 'none'],\n type: 'select',\n },\n position: {\n values: ['static', 'relative', 'absolute', 'fixed', 'sticky'],\n type: 'select',\n },\n top: { type: 'string' },\n right: { type: 'string' },\n bottom: { type: 'string' },\n left: { type: 'string' },\n inset: { type: 'string' },\n zIndex: { type: 'number' },\n\n // Dimensions\n width: { type: 'string' },\n height: { type: 'string' },\n minWidth: { type: 'string' },\n maxWidth: { type: 'string' },\n minHeight: { type: 'string' },\n maxHeight: { type: 'string' },\n aspectRatio: { type: 'string' },\n\n // Spacing\n margin: { type: 'string' },\n marginTop: { type: 'string' },\n marginRight: { type: 'string' },\n marginBottom: { type: 'string' },\n marginLeft: { type: 'string' },\n padding: { type: 'string' },\n paddingTop: { type: 'string' },\n paddingRight: { type: 'string' },\n paddingBottom: { type: 'string' },\n paddingLeft: { type: 'string' },\n gap: { type: 'string' },\n rowGap: { type: 'string' },\n columnGap: { type: 'string' },\n\n // Borders\n border: { type: 'string' },\n borderWidth: { type: 'string' },\n borderStyle: {\n values: ['solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'inset', 'outset', 'none'],\n type: 'select',\n },\n borderColor: { type: 'string' },\n borderTop: { type: 'string' },\n borderRight: { type: 'string' },\n borderBottom: { type: 'string' },\n borderLeft: { type: 'string' },\n borderRadius: { type: 'string' },\n borderTopLeftRadius: { type: 'string' },\n borderTopRightRadius: { type: 'string' },\n borderBottomLeftRadius: { type: 'string' },\n borderBottomRightRadius: { type: 'string' },\n\n // Background & Colors\n background: { type: 'string' },\n backgroundColor: { type: 'string' },\n backgroundImage: { type: 'string' },\n backgroundSize: {\n values: ['auto', 'cover', 'contain'],\n type: 'select',\n },\n backgroundPosition: {\n values: ['top', 'bottom', 'left', 'right', 'center'],\n type: 'select',\n },\n backgroundRepeat: {\n values: ['repeat', 'repeat-x', 'repeat-y', 'no-repeat'],\n type: 'select',\n },\n color: { type: 'string' },\n opacity: { type: 'number' },\n\n // Flexbox\n flex: { type: 'string' },\n flexDirection: {\n values: ['row', 'column', 'row-reverse', 'column-reverse'],\n type: 'select',\n },\n flexWrap: {\n values: ['nowrap', 'wrap', 'wrap-reverse'],\n type: 'select',\n },\n flexFlow: { type: 'string' },\n justifyContent: {\n values: ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly'],\n type: 'select',\n },\n alignItems: {\n values: ['flex-start', 'flex-end', 'center', 'stretch', 'baseline'],\n type: 'select',\n },\n alignContent: {\n values: ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'stretch'],\n type: 'select',\n },\n alignSelf: {\n values: ['auto', 'flex-start', 'flex-end', 'center', 'stretch', 'baseline'],\n type: 'select',\n },\n flexGrow: { type: 'number' },\n flexShrink: { type: 'number' },\n flexBasis: { type: 'string' },\n order: { type: 'number' },\n\n // Grid\n grid: { type: 'string' },\n gridTemplateColumns: { type: 'string' },\n gridTemplateRows: { type: 'string' },\n gridTemplateAreas: { type: 'string' },\n gridGap: { type: 'string' },\n gridColumn: { type: 'string' },\n gridRow: { type: 'string' },\n gridArea: { type: 'string' },\n gridAutoFlow: {\n values: ['row', 'column', 'row dense', 'column dense'],\n type: 'select',\n },\n gridAutoColumns: { type: 'string' },\n gridAutoRows: { type: 'string' },\n justifyItems: {\n values: ['start', 'end', 'center', 'stretch'],\n type: 'select',\n },\n justifySelf: {\n values: ['auto', 'start', 'end', 'center', 'stretch'],\n type: 'select',\n },\n placeContent: { type: 'string' },\n placeItems: { type: 'string' },\n placeSelf: { type: 'string' },\n\n // Text & Font\n fontSize: { type: 'string' },\n fontWeight: {\n values: ['100', '200', '300', '400', '500', '600', '700', '800', '900', 'normal', 'bold'],\n type: 'select',\n },\n fontFamily: { type: 'string' },\n fontStyle: {\n values: ['normal', 'italic', 'oblique'],\n type: 'select',\n },\n lineHeight: { type: 'string' },\n textAlign: {\n values: ['left', 'right', 'center', 'justify', 'start', 'end'],\n type: 'select',\n },\n textDecoration: {\n values: ['none', 'underline', 'overline', 'line-through'],\n type: 'select',\n },\n textTransform: {\n values: ['none', 'capitalize', 'uppercase', 'lowercase'],\n type: 'select',\n },\n letterSpacing: { type: 'string' },\n wordSpacing: { type: 'string' },\n wordBreak: {\n values: ['normal', 'break-all', 'keep-all', 'break-word'],\n type: 'select',\n },\n overflowWrap: {\n values: ['normal', 'break-word', 'anywhere'],\n type: 'select',\n },\n textIndent: { type: 'string' },\n verticalAlign: {\n values: ['baseline', 'top', 'middle', 'bottom', 'text-top', 'text-bottom', 'sub', 'super'],\n type: 'select',\n },\n\n // Box Shadow & Effects\n boxShadow: { type: 'string' },\n textShadow: { type: 'string' },\n filter: { type: 'string' },\n backdropFilter: { type: 'string' },\n transform: { type: 'string' },\n transformOrigin: { type: 'string' },\n transition: { type: 'string' },\n animation: { type: 'string' },\n backfaceVisibility: {\n values: ['visible', 'hidden'],\n type: 'select',\n },\n mixBlendMode: {\n values: ['normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'],\n type: 'select',\n },\n clipPath: { type: 'string' },\n\n // Overflow & Content\n overflow: {\n values: ['visible', 'hidden', 'scroll', 'auto'],\n type: 'select',\n },\n overflowX: {\n values: ['visible', 'hidden', 'scroll', 'auto'],\n type: 'select',\n },\n overflowY: {\n values: ['visible', 'hidden', 'scroll', 'auto'],\n type: 'select',\n },\n whiteSpace: {\n values: ['normal', 'nowrap', 'pre', 'pre-wrap', 'pre-line'],\n type: 'select',\n },\n textOverflow: {\n values: ['clip', 'ellipsis'],\n type: 'select',\n },\n visibility: {\n values: ['visible', 'hidden', 'collapse'],\n type: 'select',\n },\n content: { type: 'string' },\n\n // Cursor & Interaction\n cursor: {\n values: ['auto', 'default', 'pointer', 'wait', 'text', 'move', 'not-allowed', 'help'],\n type: 'select',\n },\n pointerEvents: {\n values: ['auto', 'none'],\n type: 'select',\n },\n userSelect: {\n values: ['auto', 'none', 'text', 'all'],\n type: 'select',\n },\n\n // Outline\n outline: { type: 'string' },\n outlineWidth: { type: 'string' },\n outlineStyle: {\n values: ['none', 'solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'inset', 'outset'],\n type: 'select',\n },\n outlineColor: { type: 'string' },\n outlineOffset: { type: 'string' },\n\n // Lists\n listStyle: { type: 'string' },\n listStyleType: {\n values: ['none', 'disc', 'circle', 'square', 'decimal', 'decimal-leading-zero', 'lower-roman', 'upper-roman', 'lower-alpha', 'upper-alpha'],\n type: 'select',\n },\n listStylePosition: {\n values: ['inside', 'outside'],\n type: 'select',\n },\n\n // Miscellaneous\n float: {\n values: ['left', 'right', 'none'],\n type: 'select',\n },\n clear: {\n values: ['left', 'right', 'both', 'none'],\n type: 'select',\n },\n boxSizing: {\n values: ['content-box', 'border-box'],\n type: 'select',\n },\n objectFit: {\n values: ['fill', 'contain', 'cover', 'scale-down'],\n type: 'select',\n },\n objectPosition: {\n values: ['top', 'bottom', 'left', 'right', 'center'],\n type: 'select',\n },\n resize: {\n values: ['none', 'both', 'horizontal', 'vertical'],\n type: 'select',\n },\n scrollBehavior: {\n values: ['auto', 'smooth'],\n type: 'select',\n },\n accentColor: { type: 'string' },\n\n // SVG\n stroke: { type: 'string' },\n strokeWidth: { type: 'string' },\n strokeDasharray: { type: 'string' },\n strokeDashoffset: { type: 'string' },\n strokeLinecap: {\n values: ['butt', 'round', 'square'],\n type: 'select',\n },\n strokeLinejoin: {\n values: ['miter', 'round', 'bevel'],\n type: 'select',\n },\n strokeOpacity: { type: 'number' },\n fill: { type: 'string' },\n fillOpacity: { type: 'number' },\n fillRule: {\n values: ['nonzero', 'evenodd'],\n type: 'select',\n },\n};\n\n/**\n * Common CSS properties for autocomplete suggestions (camelCase for React/JS)\n * Derived from CSS_PROPERTIES_DEFINITION keys\n */\nexport const CSS_PROPERTIES = Object.keys(CSS_PROPERTIES_DEFINITION);\n\n/**\n * Popularity tiers for CSS properties (lower = more common).\n * Properties not listed default to tier 3.\n * Used to sort autocomplete suggestions within each match group.\n */\nconst CSS_PROPERTY_PRIORITY: Record<string, number> = {\n // Tier 1: Most commonly used\n display: 1,\n position: 1,\n width: 1,\n height: 1,\n margin: 1,\n padding: 1,\n color: 1,\n backgroundColor: 1,\n fontSize: 1,\n fontWeight: 1,\n border: 1,\n borderRadius: 1,\n flex: 1,\n flexDirection: 1,\n justifyContent: 1,\n alignItems: 1,\n gap: 1,\n opacity: 1,\n overflow: 1,\n zIndex: 1,\n top: 1,\n right: 1,\n bottom: 1,\n left: 1,\n cursor: 1,\n background: 1,\n boxShadow: 1,\n transition: 1,\n transform: 1,\n lineHeight: 1,\n textAlign: 1,\n\n // Tier 2: Common but less frequent\n maxWidth: 2,\n maxHeight: 2,\n minWidth: 3,\n minHeight: 3,\n marginTop: 2,\n marginBottom: 2,\n marginLeft: 2,\n marginRight: 2,\n paddingTop: 2,\n paddingBottom: 2,\n paddingLeft: 2,\n paddingRight: 2,\n fontFamily: 2,\n fontStyle: 2,\n textDecoration: 2,\n textTransform: 2,\n letterSpacing: 2,\n borderWidth: 2,\n borderStyle: 2,\n borderColor: 2,\n borderBottom: 2,\n borderTop: 2,\n flexWrap: 2,\n flexGrow: 2,\n flexShrink: 2,\n flexBasis: 2,\n alignSelf: 2,\n gridTemplateColumns: 2,\n gridTemplateRows: 2,\n backgroundImage: 2,\n backgroundSize: 2,\n backgroundPosition: 2,\n whiteSpace: 2,\n textOverflow: 2,\n visibility: 2,\n pointerEvents: 2,\n userSelect: 2,\n boxSizing: 2,\n objectFit: 2,\n filter: 2,\n animation: 2,\n outline: 2,\n inset: 2,\n};\n\nfunction getPropertyPriority(property: string): number {\n return CSS_PROPERTY_PRIORITY[property] ?? 3;\n}\n\n/**\n * CSS Property Groups for organizing styles in the editor\n * Order determines display order in the UI\n */\nexport const CSS_PROPERTY_GROUPS: Record<string, string[]> = {\n 'Layout': ['display'],\n 'Spacing': ['margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],\n 'Size': ['width', 'height', 'minWidth', 'maxWidth', 'minHeight', 'maxHeight', 'aspectRatio'],\n 'Position': ['position', 'top', 'right', 'bottom', 'left', 'inset', 'zIndex'],\n 'Flexbox': ['flex', 'flexDirection', 'flexWrap', 'flexFlow', 'justifyContent', 'alignItems', 'alignContent', 'gap', 'rowGap', 'columnGap', 'alignSelf', 'flexGrow', 'flexShrink', 'flexBasis', 'order'],\n 'Grid': ['grid', 'gridTemplateColumns', 'gridTemplateRows', 'gridTemplateAreas', 'gridGap', 'gridColumn', 'gridRow', 'gridArea', 'gridAutoFlow', 'gridAutoColumns', 'gridAutoRows', 'justifyItems', 'justifySelf', 'placeContent', 'placeItems', 'placeSelf'],\n 'Typography': ['fontWeight', 'fontSize', 'fontFamily', 'fontStyle', 'lineHeight', 'color', 'textAlign', 'textDecoration', 'textTransform', 'letterSpacing', 'wordSpacing', 'wordBreak', 'overflowWrap', 'textIndent', 'verticalAlign'],\n 'Background': ['background', 'backgroundColor', 'backgroundImage', 'backgroundSize', 'backgroundPosition', 'backgroundRepeat', 'opacity'],\n 'Borders': ['borderRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'border', 'borderWidth', 'borderStyle', 'borderColor', 'borderTop', 'borderRight', 'borderBottom', 'borderLeft'],\n 'Outline': ['outline', 'outlineWidth', 'outlineStyle', 'outlineColor', 'outlineOffset'],\n 'Effects': ['boxShadow', 'textShadow', 'filter', 'backdropFilter', 'transform', 'transformOrigin', 'transition', 'animation', 'backfaceVisibility', 'mixBlendMode', 'clipPath'],\n 'Overflow': ['overflow', 'overflowX', 'overflowY', 'whiteSpace', 'textOverflow', 'visibility', 'content'],\n 'Interaction': ['cursor', 'pointerEvents', 'userSelect'],\n 'Lists': ['listStyle', 'listStyleType', 'listStylePosition'],\n 'Other': ['float', 'clear', 'boxSizing', 'objectFit', 'objectPosition', 'resize', 'scrollBehavior', 'accentColor'],\n 'SVG': ['stroke', 'strokeWidth', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeOpacity', 'fill', 'fillOpacity', 'fillRule'],\n};\n\n/**\n * Get the group name for a CSS property\n * @param propertyName - The CSS property name\n * @returns The group name or 'Other' if not found\n */\nexport function getPropertyGroup(propertyName: string): string {\n for (const [groupName, properties] of Object.entries(CSS_PROPERTY_GROUPS)) {\n if (properties.includes(propertyName)) {\n return groupName;\n }\n }\n return 'Other';\n}\n\n/**\n * Subset of CSS properties shown as \"always-visible\" rows in the visual style\n * editor mode (Webflow-like). Each property here renders even when unset, so\n * the user can see at a glance which properties are available and click an\n * empty row to start typing a value.\n *\n * Keys must be group names from CSS_PROPERTY_GROUPS so the visual editor can\n * reuse the same group headers as list mode.\n */\nexport const VISUAL_MODE_PROPERTIES: Record<string, string[]> = {\n 'Layout': ['display'],\n 'Grid': ['gridTemplateColumns'],\n 'Flexbox': ['flexDirection', 'flexWrap', 'justifyContent', 'alignItems', 'gap', 'flexGrow', 'flexShrink', 'flexBasis'],\n 'Spacing': ['margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],\n 'Size': ['width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight'],\n 'Position': ['position', 'top', 'right', 'bottom', 'left', 'zIndex'],\n 'Typography': ['fontFamily', 'fontWeight', 'fontSize', 'lineHeight', 'color', 'letterSpacing', 'textAlign', 'textTransform', 'textDecoration'],\n 'Background': ['backgroundColor', 'backgroundImage', 'backgroundSize', 'backgroundPosition', 'backgroundRepeat', 'opacity'],\n 'Borders': ['borderRadius', 'borderWidth', 'borderStyle', 'borderColor'],\n 'Effects': ['boxShadow', 'transform', 'transition', 'filter'],\n 'Overflow': ['overflow', 'whiteSpace'],\n 'Interaction': ['cursor', 'pointerEvents'],\n};\n\nconst VISUAL_MODE_PROPERTIES_SET = new Set(\n Object.values(VISUAL_MODE_PROPERTIES).flat()\n);\n\n/**\n * True if `prop` belongs to the always-visible visual-mode list.\n */\nexport function isVisualModeProperty(prop: string): boolean {\n return VISUAL_MODE_PROPERTIES_SET.has(prop);\n}\n\n/**\n * Context used by visual-mode visibility rules. Captures everything a rule\n * needs to decide whether a property row is meaningful for the currently\n * selected element. Built once per render in `StyleEditor`.\n */\nexport interface VisualModeRuleContext {\n /** Effective `display` of the selected element \u2014 getComputedStyle().display\n * with declared (instance/inherited/effective) merge as fallback when the\n * iframe hasn't loaded yet. Defaults to 'block'. */\n display: string;\n /** Effective `display` of the DOM parent \u2014 used for flex/grid item props\n * whose applicability depends on the parent's layout mode. '' when no\n * parent is reachable (root element, iframe missing). */\n parentDisplay: string;\n /** Effective `position` of the selected element. Defaults to 'static'. */\n position: string;\n /** Lowercase HTML tag name of the selected element ('div', 'img', 'ul'\u2026). */\n tagName: string;\n /** True if any of paddingTop / paddingRight / paddingBottom / paddingLeft\n * is set anywhere in the cascade (instance + inherited + effective).\n * When true, the panel shows the four longhand rows and hides `padding`. */\n hasPaddingLonghand: boolean;\n /** Same as `hasPaddingLonghand` for the four `margin*` longhands. */\n hasMarginLonghand: boolean;\n /** True if `backgroundImage` (or the `background` shorthand) is set anywhere\n * in the cascade. Drives visibility of background-image-only properties\n * like `backgroundPosition` / `backgroundSize` / `backgroundRepeat`. */\n hasBackgroundImage: boolean;\n}\n\nexport type VisualModeRule = (ctx: VisualModeRuleContext) => boolean;\n\nconst isFlexDisplay = (d: string) => d === 'flex' || d === 'inline-flex';\nconst isGridDisplay = (d: string) => d === 'grid' || d === 'inline-grid';\nconst isListTag = (t: string) => t === 'ul' || t === 'ol' || t === 'li';\nconst isMediaTag = (t: string) => t === 'img' || t === 'video';\n\n/**\n * Visibility rules for the visual-mode style panel. Each entry is a predicate\n * that returns true when the row should be rendered for the current element\n * context. Properties without an entry are always visible. Properties that\n * are *explicitly set* on the element bypass these rules (the explicit-value\n * override is enforced by the caller, not here).\n */\nexport const VISUAL_MODE_RULES: Record<string, VisualModeRule> = {\n // Flex/Grid CONTAINER props \u2014 own display must be flex/grid.\n flexDirection: ctx => isFlexDisplay(ctx.display),\n flexWrap: ctx => isFlexDisplay(ctx.display),\n justifyContent: ctx => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),\n alignItems: ctx => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),\n alignContent: ctx => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),\n gap: ctx => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),\n rowGap: ctx => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),\n columnGap: ctx => isFlexDisplay(ctx.display) || isGridDisplay(ctx.display),\n gridTemplateColumns: ctx => isGridDisplay(ctx.display),\n gridTemplateRows: ctx => isGridDisplay(ctx.display),\n gridTemplateAreas: ctx => isGridDisplay(ctx.display),\n gridGap: ctx => isGridDisplay(ctx.display),\n gridAutoFlow: ctx => isGridDisplay(ctx.display),\n gridAutoColumns: ctx => isGridDisplay(ctx.display),\n gridAutoRows: ctx => isGridDisplay(ctx.display),\n justifyItems: ctx => isGridDisplay(ctx.display),\n placeItems: ctx => isGridDisplay(ctx.display),\n placeContent: ctx => isGridDisplay(ctx.display),\n\n // Flex/Grid ITEM props \u2014 PARENT display must be flex/grid.\n flex: ctx => isFlexDisplay(ctx.parentDisplay),\n flexFlow: ctx => isFlexDisplay(ctx.parentDisplay),\n flexGrow: ctx => isFlexDisplay(ctx.parentDisplay),\n flexShrink: ctx => isFlexDisplay(ctx.parentDisplay),\n flexBasis: ctx => isFlexDisplay(ctx.parentDisplay),\n alignSelf: ctx => isFlexDisplay(ctx.parentDisplay) || isGridDisplay(ctx.parentDisplay),\n justifySelf: ctx => isGridDisplay(ctx.parentDisplay),\n placeSelf: ctx => isGridDisplay(ctx.parentDisplay),\n order: ctx => isFlexDisplay(ctx.parentDisplay) || isGridDisplay(ctx.parentDisplay),\n gridArea: ctx => isGridDisplay(ctx.parentDisplay),\n gridColumn: ctx => isGridDisplay(ctx.parentDisplay),\n gridRow: ctx => isGridDisplay(ctx.parentDisplay),\n\n // Position-dependent inset properties.\n top: ctx => ctx.position !== 'static',\n right: ctx => ctx.position !== 'static',\n bottom: ctx => ctx.position !== 'static',\n left: ctx => ctx.position !== 'static',\n inset: ctx => ctx.position !== 'static',\n zIndex: ctx => ctx.position !== 'static',\n\n // Tag-based.\n objectFit: ctx => isMediaTag(ctx.tagName),\n objectPosition: ctx => isMediaTag(ctx.tagName),\n listStyle: ctx => isListTag(ctx.tagName),\n listStyleType: ctx => isListTag(ctx.tagName),\n listStylePosition: ctx => isListTag(ctx.tagName),\n\n // Padding/margin shorthand-vs-longhand auto-toggle.\n // When ANY longhand is set, hide shorthand; otherwise hide longhands.\n padding: ctx => !ctx.hasPaddingLonghand,\n paddingTop: ctx => ctx.hasPaddingLonghand,\n paddingRight: ctx => ctx.hasPaddingLonghand,\n paddingBottom: ctx => ctx.hasPaddingLonghand,\n paddingLeft: ctx => ctx.hasPaddingLonghand,\n margin: ctx => !ctx.hasMarginLonghand,\n marginTop: ctx => ctx.hasMarginLonghand,\n marginRight: ctx => ctx.hasMarginLonghand,\n marginBottom: ctx => ctx.hasMarginLonghand,\n marginLeft: ctx => ctx.hasMarginLonghand,\n\n // Background-image-only props \u2014 meaningless without a background image.\n backgroundPosition: ctx => ctx.hasBackgroundImage,\n backgroundSize: ctx => ctx.hasBackgroundImage,\n backgroundRepeat: ctx => ctx.hasBackgroundImage,\n};\n\n/**\n * True if `prop` should be visible in the visual-mode panel given `ctx`.\n * Properties without an entry in `VISUAL_MODE_RULES` default to visible.\n * Callers are responsible for the explicit-value override (a property that\n * the user has set must remain visible regardless of the rule outcome).\n */\nexport function isVisualModeRowVisible(prop: string, ctx: VisualModeRuleContext): boolean {\n const rule = VISUAL_MODE_RULES[prop];\n return rule ? rule(ctx) : true;\n}\n\n/**\n * Check if property matches the abbreviation pattern\n * For example, \"bC\" matches \"backgroundColor\" (b\u2192b, C\u2192C capital letter)\n */\nfunction matchesAbbreviation(property: string, input: string): boolean {\n if (!input) return false;\n\n let propertyIndex = 0;\n\n for (let inputIndex = 0; inputIndex < input.length; inputIndex++) {\n const inputChar = input[inputIndex];\n let found = false;\n\n // Search from current position to end of property for a match at a word boundary\n while (propertyIndex < property.length) {\n const propChar = property[propertyIndex];\n // Word boundary = first character OR capital letter\n const isWordBoundary = propertyIndex === 0 ||\n (propChar === propChar.toUpperCase() && propChar !== propChar.toLowerCase());\n\n if (isWordBoundary && inputChar.toLowerCase() === propChar.toLowerCase()) {\n // Match found at word boundary\n found = true;\n propertyIndex++; // Move past this character for next search\n break;\n }\n\n propertyIndex++;\n }\n\n if (!found) {\n return false; // Couldn't find this input character at a word boundary\n }\n }\n\n return true;\n}\n\n/**\n * Direction-abbreviation shortcuts. When the user types one of these exact\n * inputs, the mapped property is forced to the top of the suggestions list\n * (ahead of startsWith matches like `placeContent` for \"pl\"). \"u\" stands for\n * \"up\" \u2014 a natural mnemonic for `Top`.\n */\nconst PROPERTY_SHORTCUTS: Record<string, string> = {\n pl: 'paddingLeft',\n pr: 'paddingRight',\n pt: 'paddingTop',\n pu: 'paddingTop',\n pb: 'paddingBottom',\n ml: 'marginLeft',\n mr: 'marginRight',\n mt: 'marginTop',\n mu: 'marginTop',\n mb: 'marginBottom',\n};\n\n/**\n * Filter CSS properties based on input value\n * Supports both startsWith matching and camelCase abbreviation matching\n */\nexport function filterCSSProperties(input: string): string[] {\n const normalizedInput = (input ?? '').trim();\n if (!normalizedInput) {\n return CSS_PROPERTIES.slice(0, 15); // Show first 15 by default\n }\n\n // First, try startsWith matching (exact prefix match)\n const startsWithMatches = CSS_PROPERTIES.filter(prop =>\n prop.toLowerCase().startsWith(normalizedInput.toLowerCase())\n );\n\n // Then, try abbreviation/fuzzy matching\n const abbreviationMatches = CSS_PROPERTIES.filter(prop =>\n matchesAbbreviation(prop, normalizedInput) &&\n !startsWithMatches.includes(prop) // Don't duplicate startsWith matches\n );\n\n // Sort each group by popularity, then combine: exact matches first, then fuzzy matches\n const byPriority = (a: string, b: string) =>\n getPropertyPriority(a) - getPropertyPriority(b);\n\n const combined = [\n ...startsWithMatches.sort(byPriority),\n ...abbreviationMatches.sort(byPriority),\n ];\n\n const shortcut = PROPERTY_SHORTCUTS[normalizedInput.toLowerCase()];\n if (shortcut) {\n return [shortcut, ...combined.filter(prop => prop !== shortcut)];\n }\n\n return combined;\n}\n\n/**\n * Get available values for a specific CSS property\n * @param propertyName - The CSS property name (e.g., 'flexDirection')\n * @returns Array of valid values for the property, or empty array if property has no predefined values\n */\nexport function getPropertyValues(propertyName: string): string[] {\n const values = CSS_PROPERTIES_DEFINITION[propertyName]?.values;\n return values ? Array.from(values) : [];\n}\n\n/**\n * Filter values for a specific CSS property based on input\n * Supports substring matching and returns values that contain the input\n * @param propertyName - The CSS property name (e.g., 'flexDirection')\n * @param input - The user input to filter values by\n * @returns Filtered array of valid values for the property\n */\nexport function filterPropertyValues(propertyName: string, input: string): string[] {\n const values = getPropertyValues(propertyName);\n if (!values.length) {\n return []; // No predefined values for this property\n }\n\n const normalizedInput = (input ?? '').trim().toLowerCase();\n if (!normalizedInput) {\n return values; // Return all values if no input\n }\n\n // Filter values that contain the input (substring match)\n return values.filter(value =>\n value.toLowerCase().includes(normalizedInput)\n );\n}\n\n/**\n * Get the property type for a CSS property\n * @param propertyName - The CSS property name\n * @returns The property type ('string' | 'select' | 'boolean' | 'number') or undefined\n */\nexport function getPropertyType(propertyName: string): 'string' | 'select' | 'boolean' | 'number' | undefined {\n return CSS_PROPERTIES_DEFINITION[propertyName]?.type;\n}\n\n/**\n * CSS properties whose numeric values are unitless by spec \u2014 `font-weight: 400`,\n * `line-height: 1.5`, `opacity: 0.8`, `z-index: 10`, etc. The auto-px commit\n * normalizer must NOT append `px` to bare numbers for these.\n */\nexport const UNITLESS_PROPERTIES: ReadonlySet<string> = new Set([\n 'fontWeight', 'lineHeight',\n 'opacity', 'fillOpacity', 'strokeOpacity', 'stopOpacity',\n 'zIndex', 'order',\n 'flexGrow', 'flexShrink', 'flex',\n 'columnCount', 'columns', 'tabSize', 'orphans', 'widows',\n 'gridRow', 'gridColumn', 'gridRowStart', 'gridRowEnd',\n 'gridColumnStart', 'gridColumnEnd',\n 'animationIterationCount',\n 'aspectRatio',\n 'scale',\n]);\n\n/**\n * Whether bare numeric values for `propertyName` should be treated as pixels at\n * commit time (e.g. typing `52` for `width` becomes `52px`). Unitless props,\n * `select`/`boolean` keyword props, and existing `number`-typed entries return false.\n */\nexport function appendsPxByDefault(propertyName: string): boolean {\n if (UNITLESS_PROPERTIES.has(propertyName)) return false;\n const def = CSS_PROPERTIES_DEFINITION[propertyName];\n if (def?.type === 'select' || def?.type === 'boolean' || def?.type === 'number') return false;\n return true;\n}\n", "/**\n * Error Logger\n * Centralized error logging with optional telemetry integration\n */\n\nimport type { ErrorCategory } from './errors';\n\ninterface ErrorLogEntry {\n location: string;\n category: ErrorCategory;\n error: unknown;\n context?: Record<string, unknown>;\n timestamp: number;\n}\n\ntype ErrorHandler = (entry: ErrorLogEntry) => void;\n\nlet errorHandler: ErrorHandler | null = null;\n\n/**\n * Set custom error handler (for telemetry integration)\n */\nexport function setErrorHandler(handler: ErrorHandler | null): void {\n errorHandler = handler;\n}\n\n/**\n * Check if running in development mode\n */\nfunction isDevelopment(): boolean {\n // Check for Node.js environment\n if (typeof process !== 'undefined' && process.env?.NODE_ENV) {\n return process.env.NODE_ENV === 'development';\n }\n // Browser environment - assume development if no production indicators\n return true;\n}\n\n/**\n * Log runtime error with context\n * Use for graceful degradation scenarios where error is handled but should be visible\n */\nexport function logRuntimeError(\n location: string,\n error: unknown,\n context?: Record<string, unknown>\n): void {\n const entry: ErrorLogEntry = {\n location,\n category: 'runtime',\n error,\n context,\n timestamp: Date.now(),\n };\n\n // Development: always log to console\n if (isDevelopment()) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n console.error(`[${location}] ${errorMessage}`, context ?? '');\n }\n\n // Custom handler (telemetry, etc.)\n errorHandler?.(entry);\n}\n\n/**\n * Log network/API error\n */\nexport function logNetworkError(\n location: string,\n error: unknown,\n context?: Record<string, unknown>\n): void {\n const entry: ErrorLogEntry = {\n location,\n category: 'network',\n error,\n context,\n timestamp: Date.now(),\n };\n\n if (isDevelopment()) {\n console.error(`[${location}] Network error:`, error, context ?? '');\n }\n\n errorHandler?.(entry);\n}\n"],
|
|
5
|
+
"mappings": ";AAYO,IAAM,4BAAmE;AAAA;AAAA,EAE9E,SAAS;AAAA,IACP,QAAQ,CAAC,SAAS,QAAQ,QAAQ,UAAU,gBA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U,QAAO;AACxF,SAAO;AACT;;;AC3vBA,IAAI,eAAoC;AAKjC,SAAS,gBAAgB,SAAoC;AAClE,iBAAe;AACjB;AAKA,SAAS,gBAAyB;AAEhC,MAAI,OAAO,YAAY,eAAe,QAAQ,KAAK,UAAU;AAC3D,WAAO,QAAQ,IAAI,aAAa;AAAA,EAClC;AAEA,SAAO;AACT;AAMO,SAAS,gBACd,UACA,OACA,SACM;AACN,QAAM,QAAuB;AAAA,IAC3B;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,WAAW,KAAK,IAAI;AAAA,EACtB;AAGA,MAAI,cAAc,GAAG;AACnB,UAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC1E,YAAQ,MAAM,IAAI,QAAQ,KAAK,YAAY,IAAI,WAAW,EAAE;AAAA,EAC9D;AAGA,iBAAe,KAAK;AACtB;AAKO,SAAS,gBACd,UACA,OACA,SACM;AACN,QAAM,QAAuB;AAAA,IAC3B;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,WAAW,KAAK,IAAI;AAAA,EACtB;AAEA,MAAI,cAAc,GAAG;AACnB,YAAQ,MAAM,IAAI,QAAQ,oBAAoB,OAAO,WAAW,EAAE;AAAA,EACpE;AAEA,iBAAe,KAAK;AACtB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
DEFAULT_RESPONSIVE_SCALES,
|
|
13
13
|
migrateI18nConfig,
|
|
14
14
|
normalizeBreakpointConfig
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-AZQYF6KE.js";
|
|
16
16
|
|
|
17
17
|
// lib/server/services/configService.ts
|
|
18
18
|
var ConfigService = class {
|
|
@@ -112,7 +112,10 @@ var ConfigService = class {
|
|
|
112
112
|
const userScales = this.config.responsiveScales;
|
|
113
113
|
return {
|
|
114
114
|
enabled: userScales.enabled ?? DEFAULT_RESPONSIVE_SCALES.enabled,
|
|
115
|
+
mode: userScales.mode ?? DEFAULT_RESPONSIVE_SCALES.mode,
|
|
115
116
|
baseReference: userScales.baseReference ?? DEFAULT_RESPONSIVE_SCALES.baseReference,
|
|
117
|
+
fluidRange: userScales.fluidRange ?? (DEFAULT_RESPONSIVE_SCALES.fluidRange ? { ...DEFAULT_RESPONSIVE_SCALES.fluidRange } : void 0),
|
|
118
|
+
siteMargin: userScales.siteMargin ?? (DEFAULT_RESPONSIVE_SCALES.siteMargin ? { ...DEFAULT_RESPONSIVE_SCALES.siteMargin } : void 0),
|
|
116
119
|
fontSize: this.mergeScaleCategory(
|
|
117
120
|
userScales.fontSize,
|
|
118
121
|
DEFAULT_RESPONSIVE_SCALES.fontSize
|
|
@@ -235,4 +238,4 @@ export {
|
|
|
235
238
|
ConfigService,
|
|
236
239
|
configService
|
|
237
240
|
};
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
241
|
+
//# sourceMappingURL=chunk-PQ2HRXDR.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../lib/server/services/configService.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Config Service\n * Centralized configuration loading and access\n *\n * Consolidates multiple config loaders into a single service that loads\n * the project.config.json file once and exposes typed sections.\n */\n\nimport type { BreakpointConfig, BreakpointConfigInput, BreakpointEntry } from '../../shared/breakpoints';\nimport { DEFAULT_BREAKPOINTS, normalizeBreakpointConfig } from '../../shared/breakpoints';\nimport type { ResponsiveScales, BreakpointScales } from '../../shared/responsiveScaling';\nimport { DEFAULT_RESPONSIVE_SCALES } from '../../shared/responsiveScaling';\nimport type { I18nConfig } from '../../shared/types/components';\nimport type { LibrariesConfig, JSLibraryConfig, CSSLibraryConfig } from '../../shared/types/libraries';\nimport type { CSPConfig } from '../../shared/types/config';\nimport type { CustomCodeConfig } from '../../shared/types/api';\nimport type { RemConversionConfig } from '../../shared/pxToRem';\nimport { DEFAULT_REM_CONFIG } from '../../shared/pxToRem';\nimport { DEFAULT_I18N_CONFIG, migrateI18nConfig } from '../../shared/i18n';\nimport { projectPaths } from '../projectContext';\nimport { readTextFile, fileExists } from '../runtime';\n\n/**\n * Icons configuration\n */\nexport interface IconsConfig {\n favicon?: string;\n faviconDark?: string;\n appleTouchIcon?: string;\n}\n\n/**\n * Raw project config structure from project.config.json\n */\nexport type ImageFormat = 'webp' | 'avif';\n\ninterface RawProjectConfig {\n breakpoints?: BreakpointConfigInput;\n responsiveScales?: Partial<ResponsiveScales>;\n i18n?: unknown;\n icons?: IconsConfig;\n libraries?: LibrariesConfig;\n csp?: CSPConfig;\n baseComponent?: string;\n imageFormat?: ImageFormat;\n remConversion?: Partial<RemConversionConfig>;\n customCode?: CustomCodeConfig;\n showMenoBadge?: boolean;\n}\n\n/**\n * ConfigService\n * Loads project configuration once and provides typed access to sections\n */\nexport class ConfigService {\n private config: RawProjectConfig | null = null;\n private loaded = false;\n\n /**\n * Load configuration from project.config.json\n * Safe to call multiple times - only loads once\n */\n async load(): Promise<void> {\n if (this.loaded) {\n return;\n }\n\n try {\n if (await fileExists(projectPaths.config())) {\n const content = await readTextFile(projectPaths.config());\n this.config = JSON.parse(content);\n }\n } catch {\n // Fall through to defaults\n this.config = null;\n }\n\n this.loaded = true;\n }\n\n /**\n * Check if configuration has been loaded\n */\n isLoaded(): boolean {\n return this.loaded;\n }\n\n /**\n * Reset the service (for testing)\n */\n reset(): void {\n this.config = null;\n this.loaded = false;\n }\n\n /**\n * Get breakpoint configuration\n * Returns validated and normalized breakpoints (always object format)\n * Supports both legacy format { tablet: 1024 } and new format { tablet: { breakpoint: 1024, previewPoint: 768 } }\n */\n getBreakpoints(): BreakpointConfig {\n if (!this.config?.breakpoints || typeof this.config.breakpoints !== 'object') {\n return { ...DEFAULT_BREAKPOINTS };\n }\n\n // Validate breakpoint values before normalization\n const validInput: BreakpointConfigInput = {};\n for (const [key, value] of Object.entries(this.config.breakpoints)) {\n if (typeof value === 'number' && value > 0) {\n // Legacy format: number\n validInput[key] = value;\n } else if (typeof value === 'object' && value !== null) {\n // New format: object with breakpoint and optional previewPoint\n const entry = value as BreakpointEntry;\n if (typeof entry.breakpoint === 'number' && entry.breakpoint > 0) {\n validInput[key] = {\n breakpoint: entry.breakpoint,\n previewPoint: typeof entry.previewPoint === 'number' && entry.previewPoint > 0\n ? entry.previewPoint\n : entry.breakpoint,\n };\n }\n }\n }\n\n // Return normalized breakpoints or defaults if none valid\n if (Object.keys(validInput).length === 0) {\n return { ...DEFAULT_BREAKPOINTS };\n }\n\n return normalizeBreakpointConfig(validInput);\n }\n\n /**\n * Get i18n configuration\n * Automatically migrates old string[] format to LocaleConfig[] format\n */\n getI18n(): I18nConfig {\n if (!this.config?.i18n) {\n return { ...DEFAULT_I18N_CONFIG };\n }\n\n return migrateI18nConfig(this.config.i18n);\n }\n\n /**\n * Deep merge scale categories, preserving user-defined breakpoints\n * while filling in missing values from defaults\n */\n private mergeScaleCategory(\n userScales: BreakpointScales | undefined,\n defaultScales: BreakpointScales | undefined\n ): BreakpointScales | undefined {\n if (!userScales && !defaultScales) return undefined;\n if (!userScales) return defaultScales ? { ...defaultScales } : undefined;\n if (!defaultScales) return { ...userScales };\n\n // User scales take precedence, but include defaults for breakpoints not specified\n return {\n ...defaultScales,\n ...userScales,\n };\n }\n\n /**\n * Get responsive scales configuration\n * Supports dynamic breakpoints - scales are keyed by breakpoint name\n * Deep merges scale categories to preserve user breakpoint definitions\n */\n getResponsiveScales(): ResponsiveScales {\n if (!this.config?.responsiveScales || typeof this.config.responsiveScales !== 'object') {\n return { ...DEFAULT_RESPONSIVE_SCALES };\n }\n\n const userScales = this.config.responsiveScales;\n\n return {\n enabled: userScales.enabled ?? DEFAULT_RESPONSIVE_SCALES.enabled,\n mode: (userScales as { mode?: 'breakpoints' | 'fluid' }).mode ?? DEFAULT_RESPONSIVE_SCALES.mode,\n baseReference: userScales.baseReference ?? DEFAULT_RESPONSIVE_SCALES.baseReference,\n fluidRange: (userScales as { fluidRange?: { min: number; max: number } }).fluidRange\n ?? (DEFAULT_RESPONSIVE_SCALES.fluidRange ? { ...DEFAULT_RESPONSIVE_SCALES.fluidRange } : undefined),\n siteMargin: (userScales as { siteMargin?: { min: number; max: number } }).siteMargin\n ?? (DEFAULT_RESPONSIVE_SCALES.siteMargin ? { ...DEFAULT_RESPONSIVE_SCALES.siteMargin } : undefined),\n fontSize: this.mergeScaleCategory(\n userScales.fontSize as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.fontSize\n ),\n padding: this.mergeScaleCategory(\n userScales.padding as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.padding\n ),\n margin: this.mergeScaleCategory(\n userScales.margin as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.margin\n ),\n gap: this.mergeScaleCategory(\n userScales.gap as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.gap\n ),\n borderRadius: this.mergeScaleCategory(\n userScales.borderRadius as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.borderRadius\n ),\n size: this.mergeScaleCategory(\n userScales.size as BreakpointScales | undefined,\n DEFAULT_RESPONSIVE_SCALES.size\n ),\n };\n }\n\n /**\n * Get rem conversion configuration\n */\n getRemConversion(): RemConversionConfig {\n if (!this.config?.remConversion || typeof this.config.remConversion !== 'object') {\n return { ...DEFAULT_REM_CONFIG };\n }\n return {\n enabled: this.config.remConversion.enabled ?? DEFAULT_REM_CONFIG.enabled,\n baseFontSize: this.config.remConversion.baseFontSize ?? DEFAULT_REM_CONFIG.baseFontSize,\n };\n }\n\n /**\n * Get icons configuration\n * Returns empty object if not configured\n */\n getIcons(): IconsConfig {\n if (!this.config?.icons || typeof this.config.icons !== 'object') {\n return {};\n }\n\n return this.config.icons;\n }\n\n /**\n * Get libraries configuration\n * Returns empty arrays if not configured\n * Normalizes string URLs to object format for backwards compatibility\n */\n getLibraries(): LibrariesConfig {\n if (!this.config?.libraries || typeof this.config.libraries !== 'object') {\n return { js: [], css: [] };\n }\n\n const libs = this.config.libraries;\n\n // Normalize JS libraries: support both string URLs and object format\n const normalizedJs = Array.isArray(libs.js)\n ? libs.js.map((lib) =>\n typeof lib === 'string' ? { url: lib } : lib\n ) as JSLibraryConfig[]\n : [];\n\n // Normalize CSS libraries: support both string URLs and object format\n const normalizedCss = Array.isArray(libs.css)\n ? libs.css.map((lib) =>\n typeof lib === 'string' ? { url: lib } : lib\n ) as CSSLibraryConfig[]\n : [];\n\n return {\n js: normalizedJs,\n css: normalizedCss,\n };\n }\n\n /**\n * Get CSP configuration\n * Returns empty object if not configured\n */\n getCSP(): CSPConfig {\n if (!this.config?.csp || typeof this.config.csp !== 'object') {\n return {};\n }\n\n return this.config.csp;\n }\n\n /**\n * Get base component name for new pages\n * Returns undefined if not configured\n */\n getBaseComponent(): string | undefined {\n if (!this.config?.baseComponent || typeof this.config.baseComponent !== 'string') {\n return undefined;\n }\n return this.config.baseComponent;\n }\n\n /**\n * Get image format setting\n * Returns 'webp' (default) or 'avif'\n */\n getCustomCode(): CustomCodeConfig {\n if (!this.config?.customCode || typeof this.config.customCode !== 'object') {\n return {};\n }\n return this.config.customCode;\n }\n\n getShowMenoBadge(): boolean {\n return this.config?.showMenoBadge === true;\n }\n\n getImageFormat(): ImageFormat {\n if (this.config?.imageFormat === 'avif') return 'avif';\n return 'webp';\n }\n\n /**\n * Get raw config value by key (for extension)\n */\n getRaw<T>(key: string): T | undefined {\n if (!this.config) {\n return undefined;\n }\n return (this.config as Record<string, unknown>)[key] as T | undefined;\n }\n}\n\n/**\n * Singleton instance for global access\n * Use this for convenience, or create your own instance for testing\n */\nexport const configService = new ConfigService();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAsDO,IAAM,gBAAN,MAAoB;AAAA,EACjB,SAAkC;AAAA,EAClC,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAMjB,MAAM,OAAsB;AAC1B,QAAI,KAAK,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