meno-core 1.0.52 → 1.0.53

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 (135) hide show
  1. package/build-astro.ts +183 -13
  2. package/build-next.ts +1361 -0
  3. package/build-static.ts +7 -5
  4. package/dist/bin/cli.js +2 -2
  5. package/dist/build-static.js +6 -6
  6. package/dist/chunks/{chunk-HNLUO36W.js → chunk-GZHGVVW3.js} +2 -2
  7. package/dist/chunks/chunk-GZHGVVW3.js.map +7 -0
  8. package/dist/chunks/{chunk-LPVETICS.js → chunk-H3GJ4H2U.js} +185 -1
  9. package/dist/chunks/chunk-H3GJ4H2U.js.map +7 -0
  10. package/dist/chunks/{chunk-CXCBV2M7.js → chunk-IGYR22T6.js} +76 -270
  11. package/dist/chunks/chunk-IGYR22T6.js.map +7 -0
  12. package/dist/chunks/{chunk-LHLHPYSP.js → chunk-JGP5A3Y5.js} +12 -11
  13. package/dist/chunks/chunk-JGP5A3Y5.js.map +7 -0
  14. package/dist/chunks/{chunk-7NIC4I3V.js → chunk-JGWFTO6P.js} +167 -21
  15. package/dist/chunks/chunk-JGWFTO6P.js.map +7 -0
  16. package/dist/chunks/{chunk-EDQSMAMP.js → chunk-O3NAGJP4.js} +85 -4
  17. package/dist/chunks/chunk-O3NAGJP4.js.map +7 -0
  18. package/dist/chunks/{chunk-H4JSCDNW.js → chunk-QB2LNO4W.js} +24 -1
  19. package/dist/chunks/chunk-QB2LNO4W.js.map +7 -0
  20. package/dist/chunks/{chunk-A725KYFK.js → chunk-R6XHAFBF.js} +561 -112
  21. package/dist/chunks/chunk-R6XHAFBF.js.map +7 -0
  22. package/dist/chunks/{chunk-J23ZX5AP.js → chunk-X754AHS5.js} +277 -1
  23. package/dist/chunks/chunk-X754AHS5.js.map +7 -0
  24. package/dist/chunks/{chunk-2QK6U5UK.js → chunk-YBLHKYFF.js} +12 -2
  25. package/dist/chunks/chunk-YBLHKYFF.js.map +7 -0
  26. package/dist/chunks/{constants-GWBAD66U.js → constants-STK2YBIW.js} +2 -2
  27. package/dist/entries/server-router.js +7 -7
  28. package/dist/lib/client/index.js +354 -59
  29. package/dist/lib/client/index.js.map +4 -4
  30. package/dist/lib/server/index.js +1458 -190
  31. package/dist/lib/server/index.js.map +4 -4
  32. package/dist/lib/shared/index.js +202 -34
  33. package/dist/lib/shared/index.js.map +4 -4
  34. package/dist/lib/test-utils/index.js +1 -1
  35. package/entries/client-router.tsx +5 -165
  36. package/lib/client/ErrorBoundary.test.tsx +27 -25
  37. package/lib/client/ErrorBoundary.tsx +34 -19
  38. package/lib/client/core/ComponentBuilder.ts +19 -2
  39. package/lib/client/core/builders/embedBuilder.ts +8 -4
  40. package/lib/client/core/builders/listBuilder.ts +23 -4
  41. package/lib/client/fontFamiliesService.test.ts +76 -0
  42. package/lib/client/fontFamiliesService.ts +69 -0
  43. package/lib/client/hmrCssReload.ts +160 -0
  44. package/lib/client/hooks/useColorVariables.ts +2 -0
  45. package/lib/client/index.ts +4 -0
  46. package/lib/client/meno-filter/ui.ts +2 -0
  47. package/lib/client/routing/RouteLoader.test.ts +2 -2
  48. package/lib/client/routing/RouteLoader.ts +8 -2
  49. package/lib/client/routing/Router.tsx +81 -15
  50. package/lib/client/scripts/ScriptExecutor.test.ts +143 -0
  51. package/lib/client/scripts/ScriptExecutor.ts +56 -2
  52. package/lib/client/styles/StyleInjector.ts +20 -5
  53. package/lib/client/styles/UtilityClassCollector.ts +7 -1
  54. package/lib/client/styles/cspNonce.test.ts +67 -0
  55. package/lib/client/styles/cspNonce.ts +63 -0
  56. package/lib/client/templateEngine.test.ts +80 -0
  57. package/lib/client/templateEngine.ts +5 -0
  58. package/lib/server/astro/cmsPageEmitter.ts +35 -5
  59. package/lib/server/astro/componentEmitter.ts +61 -5
  60. package/lib/server/astro/nodeToAstro.ts +149 -11
  61. package/lib/server/astro/normalizeOrphanTemplateProps.test.ts +264 -0
  62. package/lib/server/astro/normalizeOrphanTemplateProps.ts +184 -0
  63. package/lib/server/createServer.ts +11 -0
  64. package/lib/server/draftPageStore.ts +49 -0
  65. package/lib/server/fileWatcher.ts +62 -2
  66. package/lib/server/index.ts +13 -1
  67. package/lib/server/providers/fileSystemPageProvider.ts +8 -0
  68. package/lib/server/routes/api/components.ts +9 -4
  69. package/lib/server/routes/api/core-routes.ts +2 -2
  70. package/lib/server/routes/api/pages.ts +14 -22
  71. package/lib/server/routes/api/shared.ts +56 -0
  72. package/lib/server/routes/index.ts +90 -0
  73. package/lib/server/routes/pages.ts +13 -6
  74. package/lib/server/services/componentService.test.ts +199 -2
  75. package/lib/server/services/componentService.ts +354 -49
  76. package/lib/server/services/fileWatcherService.ts +4 -24
  77. package/lib/server/services/pageService.test.ts +23 -0
  78. package/lib/server/services/pageService.ts +124 -6
  79. package/lib/server/ssr/attributeBuilder.ts +8 -2
  80. package/lib/server/ssr/buildErrorOverlay.ts +1 -1
  81. package/lib/server/ssr/errorOverlay.test.ts +21 -2
  82. package/lib/server/ssr/errorOverlay.ts +38 -11
  83. package/lib/server/ssr/htmlGenerator.test.ts +53 -13
  84. package/lib/server/ssr/htmlGenerator.ts +71 -27
  85. package/lib/server/ssr/liveReloadIntegration.test.ts +123 -2
  86. package/lib/server/ssr/ssrRenderer.test.ts +67 -0
  87. package/lib/server/ssr/ssrRenderer.ts +94 -9
  88. package/lib/server/websocketManager.ts +0 -1
  89. package/lib/shared/componentRefs.ts +45 -0
  90. package/lib/shared/constants.ts +8 -0
  91. package/lib/shared/cssGeneration.ts +2 -0
  92. package/lib/shared/cssProperties.ts +184 -0
  93. package/lib/shared/expressionEvaluator.ts +54 -0
  94. package/lib/shared/fontCss.ts +101 -0
  95. package/lib/shared/fontLoader.ts +8 -86
  96. package/lib/shared/friendlyError.test.ts +87 -0
  97. package/lib/shared/friendlyError.ts +121 -0
  98. package/lib/shared/hrefRefs.test.ts +130 -0
  99. package/lib/shared/hrefRefs.ts +100 -0
  100. package/lib/shared/index.ts +52 -0
  101. package/lib/shared/inlineSvgStyleRules.test.ts +108 -0
  102. package/lib/shared/inlineSvgStyleRules.ts +134 -0
  103. package/lib/shared/interfaces/contentProvider.ts +13 -0
  104. package/lib/shared/itemTemplateUtils.test.ts +14 -0
  105. package/lib/shared/itemTemplateUtils.ts +4 -1
  106. package/lib/shared/registry/NodeTypeDefinition.ts +1 -1
  107. package/lib/shared/registry/nodeTypes/LinkNodeType.ts +1 -1
  108. package/lib/shared/slugTranslator.test.ts +24 -0
  109. package/lib/shared/slugTranslator.ts +24 -0
  110. package/lib/shared/styleNodeUtils.ts +4 -1
  111. package/lib/shared/tree/PathBuilder.test.ts +128 -1
  112. package/lib/shared/tree/PathBuilder.ts +83 -31
  113. package/lib/shared/types/comment.ts +99 -0
  114. package/lib/shared/types/index.ts +12 -0
  115. package/lib/shared/types/rendering.ts +8 -0
  116. package/lib/shared/utilityClassConfig.ts +4 -2
  117. package/lib/shared/utilityClassMapper.test.ts +24 -0
  118. package/lib/shared/validation/commentValidators.ts +69 -0
  119. package/lib/shared/validation/index.ts +1 -0
  120. package/lib/shared/viewportUnits.integration.test.ts +42 -0
  121. package/lib/shared/viewportUnits.test.ts +103 -0
  122. package/lib/shared/viewportUnits.ts +63 -0
  123. package/lib/test-utils/dom-setup.ts +6 -0
  124. package/package.json +1 -1
  125. package/dist/chunks/chunk-2QK6U5UK.js.map +0 -7
  126. package/dist/chunks/chunk-7NIC4I3V.js.map +0 -7
  127. package/dist/chunks/chunk-A725KYFK.js.map +0 -7
  128. package/dist/chunks/chunk-CXCBV2M7.js.map +0 -7
  129. package/dist/chunks/chunk-EDQSMAMP.js.map +0 -7
  130. package/dist/chunks/chunk-H4JSCDNW.js.map +0 -7
  131. package/dist/chunks/chunk-HNLUO36W.js.map +0 -7
  132. package/dist/chunks/chunk-J23ZX5AP.js.map +0 -7
  133. package/dist/chunks/chunk-LHLHPYSP.js.map +0 -7
  134. package/dist/chunks/chunk-LPVETICS.js.map +0 -7
  135. /package/dist/chunks/{constants-GWBAD66U.js.map → constants-STK2YBIW.js.map} +0 -0
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Comment Validators
3
+ * Zod schema + validator for pinned comments.
4
+ */
5
+
6
+ import { z } from 'zod';
7
+ import type { ZodError } from 'zod';
8
+ import type { Comment } from '../types/comment';
9
+ import { COMMENT_STATUSES } from '../types/comment';
10
+ import type { ValidationResult, ValidationError } from './validators';
11
+
12
+ export const CommentStatusSchema = z.enum(COMMENT_STATUSES as unknown as [string, ...string[]]);
13
+
14
+ export const CommentAuthorSchema = z.object({
15
+ login: z.string().min(1),
16
+ name: z.string().optional(),
17
+ avatarUrl: z.string().optional(),
18
+ });
19
+
20
+ export const CommentNodeIdentitySchema = z.object({
21
+ kind: z.enum(['component', 'node']),
22
+ name: z.string().min(1),
23
+ label: z.string().optional(),
24
+ });
25
+
26
+ export const CommentAnchorSchema = z.object({
27
+ nodePath: z.array(z.number().int().nonnegative()),
28
+ nodeIdentity: CommentNodeIdentitySchema,
29
+ offsetXPercent: z.number().min(0).max(1),
30
+ offsetYPercent: z.number().min(0).max(1),
31
+ breakpoint: z.string().optional(),
32
+ });
33
+
34
+ export const CommentThreadEntrySchema = z.object({
35
+ id: z.string().min(1),
36
+ author: CommentAuthorSchema,
37
+ createdAt: z.string().min(1),
38
+ text: z.string(),
39
+ statusChange: CommentStatusSchema.nullable(),
40
+ });
41
+
42
+ export const CommentSchema = z.object({
43
+ _id: z.string().min(1),
44
+ _filename: z.string().min(1),
45
+ _pagePath: z.string().min(1),
46
+ _seq: z.number().int().nonnegative(),
47
+ _createdAt: z.string().min(1),
48
+ _updatedAt: z.string().min(1),
49
+ _commitSha: z.string().nullable(),
50
+ anchor: CommentAnchorSchema,
51
+ status: CommentStatusSchema,
52
+ thread: z.array(CommentThreadEntrySchema).min(1),
53
+ });
54
+
55
+ function zodToValidationErrors(zodError: ZodError): ValidationError[] {
56
+ return zodError.errors.map(err => ({
57
+ path: err.path.join('.') || 'root',
58
+ message: err.message,
59
+ code: 'INVALID_TYPE' as const,
60
+ }));
61
+ }
62
+
63
+ export function validateComment(data: unknown): ValidationResult<Comment> {
64
+ const result = CommentSchema.safeParse(data);
65
+ if (result.success) {
66
+ return { valid: true, data: result.data as Comment };
67
+ }
68
+ return { valid: false, errors: zodToValidationErrors(result.error) };
69
+ }
@@ -6,3 +6,4 @@ export * from './schemas';
6
6
  export * from './validators';
7
7
  export * from './propValidator';
8
8
  export * from './cmsValidators';
9
+ export * from './commentValidators';
@@ -0,0 +1,42 @@
1
+ import { describe, it, expect } from 'bun:test';
2
+ import { generateAllInteractiveCSS } from './cssGeneration';
3
+ import { rewriteViewportUnits } from './viewportUnits';
4
+ import type { InteractiveStyles } from './types';
5
+
6
+ describe('viewport-unit rewrite — user-bug repro path', () => {
7
+ it('rewrites Layout.json-style min-height: 100vh emitted via generateInteractiveCSS', () => {
8
+ // Mirrors the user's Layout component:
9
+ // { style: { base: { backgroundColor: "var(--bg)", minHeight: "100vh" } } }
10
+ // Studio collects this into the InteractiveStyles map keyed by the element
11
+ // class, and generateInteractiveCSS emits the CSS that ships to the iframe.
12
+ const interactiveStyles: InteractiveStyles = [{
13
+ prefix: '',
14
+ postfix: '',
15
+ style: { base: { minHeight: '100vh', backgroundColor: 'var(--bg)' } },
16
+ }];
17
+ const map = new Map<string, InteractiveStyles>([['c_layout_root', interactiveStyles]]);
18
+
19
+ const css = generateAllInteractiveCSS(map);
20
+ // generateInteractiveCSS itself emits the raw vh value …
21
+ expect(css).toContain('min-height: 100vh');
22
+
23
+ // … and the boundary rewrite (which htmlGenerator/StyleInjector apply
24
+ // before injecting into the iframe) converts it.
25
+ const rewritten = rewriteViewportUnits(css);
26
+ expect(rewritten).toContain('min-height: calc(var(--design-vh, 1vh) * 100)');
27
+ expect(rewritten).not.toContain('min-height: 100vh');
28
+ });
29
+
30
+ it('leaves non-vh values in the same rule untouched', () => {
31
+ const interactiveStyles: InteractiveStyles = [{
32
+ prefix: '',
33
+ postfix: '',
34
+ style: { base: { minHeight: '100vh', padding: '24px', color: 'red' } },
35
+ }];
36
+ const map = new Map<string, InteractiveStyles>([['c_a', interactiveStyles]]);
37
+ const rewritten = rewriteViewportUnits(generateAllInteractiveCSS(map));
38
+
39
+ expect(rewritten).toContain('padding: 24px');
40
+ expect(rewritten).toContain('min-height: calc(var(--design-vh, 1vh) * 100)');
41
+ });
42
+ });
@@ -0,0 +1,103 @@
1
+ import { describe, it, expect } from 'bun:test';
2
+ import { rewriteViewportUnits } from './viewportUnits';
3
+
4
+ describe('rewriteViewportUnits', () => {
5
+ it('rewrites basic vh values in declarations', () => {
6
+ expect(rewriteViewportUnits('min-height: 100vh;')).toBe(
7
+ 'min-height: calc(var(--design-vh, 1vh) * 100);'
8
+ );
9
+ });
10
+
11
+ it('rewrites vw values', () => {
12
+ expect(rewriteViewportUnits('width: 50vw;')).toBe(
13
+ 'width: calc(var(--design-vw, 1vw) * 50);'
14
+ );
15
+ });
16
+
17
+ it('handles negative values', () => {
18
+ expect(rewriteViewportUnits('top: -100vh;')).toBe(
19
+ 'top: calc(var(--design-vh, 1vh) * -100);'
20
+ );
21
+ });
22
+
23
+ it('handles decimal values', () => {
24
+ expect(rewriteViewportUnits('height: 33.5vh;')).toBe(
25
+ 'height: calc(var(--design-vh, 1vh) * 33.5);'
26
+ );
27
+ expect(rewriteViewportUnits('height: .5vh;')).toBe(
28
+ 'height: calc(var(--design-vh, 1vh) * .5);'
29
+ );
30
+ });
31
+
32
+ it('handles small/large/dynamic viewport units', () => {
33
+ expect(rewriteViewportUnits('h: 100svh; w: 100lvw; x: 100dvh;')).toBe(
34
+ 'h: calc(var(--design-svh, 1svh) * 100); w: calc(var(--design-lvw, 1lvw) * 100); x: calc(var(--design-dvh, 1dvh) * 100);'
35
+ );
36
+ });
37
+
38
+ it('preserves vh inside calc()', () => {
39
+ expect(rewriteViewportUnits('height: calc(100vh - 20px);')).toBe(
40
+ 'height: calc(calc(var(--design-vh, 1vh) * 100) - 20px);'
41
+ );
42
+ });
43
+
44
+ it('rewrites vh inside transform functions', () => {
45
+ expect(rewriteViewportUnits('transform: translateY(-100vh);')).toBe(
46
+ 'transform: translateY(calc(var(--design-vh, 1vh) * -100));'
47
+ );
48
+ });
49
+
50
+ it('does NOT rewrite vh inside class selectors with utility prefix', () => {
51
+ // Utility class names like `.mh-100vh` must stay literal in selectors
52
+ // even though the same string is a real value elsewhere in the file.
53
+ const input = '.mh-100vh { min-height: 100vh; }';
54
+ const expected = '.mh-100vh { min-height: calc(var(--design-vh, 1vh) * 100); }';
55
+ expect(rewriteViewportUnits(input)).toBe(expected);
56
+ });
57
+
58
+ it('does NOT rewrite vh inside hyphenated identifiers', () => {
59
+ expect(rewriteViewportUnits('var(--my-100vh-thing)')).toBe('var(--my-100vh-thing)');
60
+ expect(rewriteViewportUnits('.foo-100vh-bar')).toBe('.foo-100vh-bar');
61
+ });
62
+
63
+ it('does NOT rewrite px / em / rem / % values', () => {
64
+ expect(rewriteViewportUnits('padding: 10px; margin: 1em; height: 50%;')).toBe(
65
+ 'padding: 10px; margin: 1em; height: 50%;'
66
+ );
67
+ });
68
+
69
+ it('handles multiple values in one rule', () => {
70
+ expect(rewriteViewportUnits('inset: 10vh 5vw 20vh 5vw;')).toBe(
71
+ 'inset: calc(var(--design-vh, 1vh) * 10) calc(var(--design-vw, 1vw) * 5) calc(var(--design-vh, 1vh) * 20) calc(var(--design-vw, 1vw) * 5);'
72
+ );
73
+ });
74
+
75
+ it('handles a full stylesheet with selectors and media queries', () => {
76
+ const input = `
77
+ .layout { min-height: 100vh; }
78
+ @media (max-width: 768px) {
79
+ .hero { height: 50vh; }
80
+ }
81
+ .mh-100vh { min-height: 100vh; }
82
+ `;
83
+ const result = rewriteViewportUnits(input);
84
+ // Selector tokens preserved
85
+ expect(result).toContain('.mh-100vh');
86
+ // Values rewritten
87
+ expect(result).toContain('min-height: calc(var(--design-vh, 1vh) * 100);');
88
+ expect(result).toContain('height: calc(var(--design-vh, 1vh) * 50);');
89
+ // @media query argument rewritten (768 has no vh suffix, stays as-is)
90
+ expect(result).toContain('@media (max-width: 768px)');
91
+ });
92
+
93
+ it('is a no-op on empty / vh-free input', () => {
94
+ expect(rewriteViewportUnits('')).toBe('');
95
+ expect(rewriteViewportUnits('color: red;')).toBe('color: red;');
96
+ });
97
+
98
+ it('handles 0vh (zero with unit) without producing invalid output', () => {
99
+ expect(rewriteViewportUnits('top: 0vh;')).toBe(
100
+ 'top: calc(var(--design-vh, 1vh) * 0);'
101
+ );
102
+ });
103
+ });
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Viewport unit rewriter for design canvas mode.
3
+ *
4
+ * Background: in the studio's design canvas, the iframe element's CSS height
5
+ * is sized to its reported content height so that pan/zoom can show the whole
6
+ * page. Because `vh` resolves against the iframe's viewport (= the iframe
7
+ * element's CSS height), any content using `min-height: 100vh` couples
8
+ * iframe.height to content.height. The moment a vertical offset (margin-top,
9
+ * padding-top, etc.) is layered on top of vh-bound content, every measurement
10
+ * cycle grows the frame by that offset — runaway feedback.
11
+ *
12
+ * Fix: rewrite every viewport-relative length so it resolves through a CSS
13
+ * custom property that the design-mode runtime can pin to a stable pixel
14
+ * value. The variable falls back to the original unit, so when it's not set
15
+ * (page mode, production build, anything outside the studio) behavior is
16
+ * byte-identical to before the rewrite.
17
+ *
18
+ * Examples:
19
+ * 100vh → calc(var(--design-vh, 1vh) * 100)
20
+ * -50.5dvh → calc(var(--design-dvh, 1dvh) * -50.5)
21
+ * calc(100vh - 20px) → calc(calc(var(--design-vh, 1vh) * 100) - 20px)
22
+ *
23
+ * Covered units: vh/vw and the small/large/dynamic variants (svh, lvh, dvh,
24
+ * svw, lvw, dvw). vw is included for symmetry even though horizontal feedback
25
+ * isn't currently possible (frame width is user-controlled, not content-driven).
26
+ */
27
+
28
+ // A number (possibly negative, with optional decimal), an optional size keyword
29
+ // (s/l/d), and `vh` or `vw` as a complete token. The negative lookbehind on
30
+ // `[\w-]` rejects matches that sit inside identifiers — e.g. utility class
31
+ // names like `.mh-100vh` keep their literal name in the selector even though
32
+ // the same string appears as a value elsewhere in the stylesheet.
33
+ const VIEWPORT_UNIT_RE = /(?<![\w-])(-?\d*\.?\d+)(s|l|d)?(vh|vw)\b/g;
34
+
35
+ /**
36
+ * Rewrite viewport-relative lengths inside any CSS-shaped string (full
37
+ * stylesheet, a single declaration value, an inline `style` attribute body).
38
+ * Safe to apply unconditionally — the var() fallback preserves original
39
+ * behavior when no `--design-*` variables are set.
40
+ */
41
+ export function rewriteViewportUnits(input: string): string {
42
+ if (!input) return input;
43
+ return input.replace(VIEWPORT_UNIT_RE, (_match, num: string, sizeKw: string | undefined, axis: string) => {
44
+ const unit = `${sizeKw ?? ''}${axis}`;
45
+ return `calc(var(--design-${unit}, 1${unit}) * ${num})`;
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Names of the CSS custom properties the runtime sets/clears to switch
51
+ * between design-mode (stable px) and page-mode (no override, vh = actual
52
+ * viewport). Exported so the iframe runtime and parent stay in sync.
53
+ */
54
+ export const DESIGN_VIEWPORT_VARS = [
55
+ '--design-vh',
56
+ '--design-svh',
57
+ '--design-lvh',
58
+ '--design-dvh',
59
+ '--design-vw',
60
+ '--design-svw',
61
+ '--design-lvw',
62
+ '--design-dvw',
63
+ ] as const;
@@ -14,6 +14,12 @@ const window = new Window({
14
14
  height: 1080,
15
15
  });
16
16
 
17
+ // happy-dom >=20.9 references `window.SyntaxError` from its selector parser's
18
+ // error path but never defines it on the Window, so EVERY querySelector/
19
+ // querySelectorAll throws a TypeError ("undefined is not a constructor"). Real
20
+ // browsers expose it on window — mirror that so DOM queries work in tests.
21
+ (window as unknown as { SyntaxError: typeof SyntaxError }).SyntaxError = SyntaxError;
22
+
17
23
  // Register globals
18
24
  const globalAny = globalThis as any;
19
25
  globalAny.window = window;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meno-core",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "meno": "./dist/bin/cli.js"
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../lib/shared/constants.ts"],
4
- "sourcesContent": ["/**\n * Shared constants used across the application\n */\n\n// Read PORT from environment variable, fallback to 3000\n// Safe for browser environments where process is not defined\nexport const SERVER_PORT = typeof process !== 'undefined' && process.env?.PORT\n ? parseInt(process.env.PORT, 10)\n : 3000;\n\n// Port for serving built static files (SSR preview)\n// Reads MENO_SERVE_PORT env var so each project instance can get its own port\nexport const SERVE_PORT = typeof process !== 'undefined' && process.env?.MENO_SERVE_PORT\n ? parseInt(process.env.MENO_SERVE_PORT, 10)\n : 8080;\n\nexport const API_ROUTES = {\n PAGES: '/api/pages',\n COMPONENTS: '/api/components',\n PAGE_CONTENT: '/api/page-content', // Returns raw JSON text for a page\n PAGE_DATA: '/api/page-data', // Returns parsed JSON for a specific page\n COMPONENT_DATA: '/api/component-data', // Returns parsed JSON for a specific component\n SAVE_PAGE: '/api/save-page',\n SAVE_COMPONENT: '/api/save-component',\n SAVE_COMPONENT_JS: '/api/save-component-js', // Save JavaScript to .js file\n SAVE_COMPONENT_CSS: '/api/save-component-css', // Save CSS to .css file\n COMPONENT_CATEGORY: '/api/component-category', // Move component to category folder\n COMPONENT_FOLDER: '/api/component-folder', // Create component folder\n COMPONENT_FOLDERS: '/api/component-folders', // List all component folders\n COMPONENT_JS: '/api/component-js', // Get JavaScript from .js file\n CONFIG: '/api/config', // Get project config\n SAVE_CONFIG: '/api/save-config', // Save project config\n COMPONENTS_CONFIG: '/api/components-config', // Get components config\n SAVE_COMPONENTS_CONFIG: '/api/save-components-config', // Save components config\n SELECTION: '/api/selection', // Editor selection state (for AI integration)\n // CMS API routes\n CMS_COLLECTIONS: '/api/cms/collections', // List all CMS collections\n CMS_BASE: '/api/cms', // Base path for CMS item operations\n // Colors API routes\n COLORS_CONFIG: '/api/colors-config', // Get full colors config\n SAVE_COLORS: '/api/save-colors', // Save colors config\n // Page deletion\n DELETE_PAGE: '/api/delete-page', // Delete a page\n // Page folder management\n PAGE_FOLDER: '/api/page-folder', // Create page folder\n PAGE_FOLDERS: '/api/page-folders', // List all page folders\n MOVE_PAGE: '/api/move-page', // Move page to folder\n // Component preview\n COMPONENT_PREVIEW: '/api/component-preview', // Render component preview HTML\n // Website import\n IMPORT_WEBSITE: '/api/import-website', // Import external website for reference\n IMPORTED_WEBSITES: '/api/imported-websites', // List imported website folders\n ANALYZE_WEBSITE: '/api/analyze-website', // Analyze imported website into section map\n CONVERT_TO_MENO: '/api/convert-to-meno', // Convert imported HTML to flat Meno page JSON\n EXTRACT_CONTENT: '/api/extract-content', // Extract content from imported website for template mapping\n GENERATE_WIREFRAME_PROMPT: '/api/generate-wireframe-prompt', // Generate wireframe conversion prompt from extraction\n GENERATE_DESIGN_TOKEN_PROMPT: '/api/generate-design-token-prompt', // Generate design token extraction prompt\n GENERATE_CONTENT_PROMPT: '/api/generate-content-prompt', // Generate content conversion prompt using existing components\n GENERATE_SIMPLIFIED_PROMPT: '/api/generate-simplified-prompt', // Generate simplified prompt for Claude Code with Chrome extension\n // Multi-page import routes\n FETCH_SITEMAP: '/api/fetch-sitemap', // Fetch & parse sitemap.xml\n IMPORT_PAGE: '/api/import-page', // Import a single subpage\n ANALYZE_PAGE: '/api/analyze-page', // Analyze a subpage\n EXTRACT_PAGE_CONTENT: '/api/extract-page-content', // Extract content from a subpage\n GENERATE_HOMEPAGE_PROMPT: '/api/generate-homepage-prompt', // Homepage prompt with site structure\n GENERATE_PAGE_PROMPT: '/api/generate-page-prompt', // Per-page/template prompt\n LOAD_WEBSITE_IMPORT: '/api/load-website-import', // Load saved website import data from disk\n // Variables API routes\n VARIABLES_STATUS: '/api/variables-status', // Get variables config with status\n VARIABLES_CSS: '/api/variables-css', // Get generated CSS custom properties\n SAVE_VARIABLES: '/api/save-variables', // Save variables config\n // Enums API routes\n ENUMS: '/api/enums', // Get enums config\n SAVE_ENUMS: '/api/save-enums', // Save enums config\n // Component usage\n COMPONENT_USAGE: '/api/component-usage', // Get component usage across project\n} as const;\n\nexport const HMR_ROUTE = '/hmr';\n\nexport const FILE_PATTERNS = {\n PAGES: './pages',\n COMPONENTS: './components',\n} as const;\n\nexport const DEFAULT_TIMEOUT = 5000;\n\nexport const WEBSOCKET_STATES = {\n CONNECTING: 0,\n OPEN: 1,\n CLOSING: 2,\n CLOSED: 3,\n} as const;\n\n// Timeout constants\nexport const NOT_FOUND_TIMEOUT_MS = 300;\nexport const TAB_SWITCH_DELAY_MS = 100;\nexport const IFRAME_HIGHLIGHT_DELAY_MS = 100;\nexport const TREE_SCROLL_DELAY_MS = 200;\nexport const HOVER_HIGHLIGHT_DELAY_MS = 50; // Delay before highlighting tree item after expansion\n\n// Server configuration\nexport const MAX_PORT_ATTEMPTS = 10;\n\n// Message types for iframe-parent communication\nexport const IFRAME_MESSAGE_TYPES = {\n DELETE_ELEMENT: 'DELETE_ELEMENT',\n TOGGLE_SELECTING_MODE: 'TOGGLE_SELECTING_MODE',\n SET_TAB: 'SET_TAB',\n COPY_ELEMENT: 'COPY_ELEMENT',\n PASTE_ELEMENT: 'PASTE_ELEMENT',\n PASTE_ELEMENT_AFTER: 'PASTE_ELEMENT_AFTER',\n ARROW_UP: 'ARROW_UP',\n ARROW_DOWN: 'ARROW_DOWN',\n ARROW_LEFT: 'ARROW_LEFT',\n ARROW_RIGHT: 'ARROW_RIGHT',\n OPEN_COMMAND_PALETTE: 'OPEN_COMMAND_PALETTE',\n EDIT_COMPONENT: 'EDIT_COMPONENT',\n NAVIGATE_BACK: 'NAVIGATE_BACK',\n TOGGLE_ADDING_STYLE: 'TOGGLE_ADDING_STYLE',\n MOVE_ELEMENT_UP: 'MOVE_ELEMENT_UP',\n MOVE_ELEMENT_DOWN: 'MOVE_ELEMENT_DOWN',\n NEST_INTO_PREVIOUS_SIBLING: 'NEST_INTO_PREVIOUS_SIBLING',\n NEST_INTO_NEXT_SIBLING: 'NEST_INTO_NEXT_SIBLING',\n SELECTION_CHANGED: 'SELECTION_CHANGED',\n CMS_CONTEXT_UPDATE: 'CMS_CONTEXT_UPDATE',\n CMS_CONTEXT_REQUEST: 'CMS_CONTEXT_REQUEST',\n INTERACTIVE_CSS_UPDATE: 'INTERACTIVE_CSS_UPDATE',\n INTERACTIVE_STYLES_UPDATE: 'INTERACTIVE_STYLES_UPDATE', // Registry data from iframe to editor\n UNDO_REQUEST: 'UNDO_REQUEST',\n REDO_REQUEST: 'REDO_REQUEST',\n TOGGLE_INTERACTIVITY_EDITOR: 'TOGGLE_INTERACTIVITY_EDITOR',\n SET_BREAKPOINT: 'SET_BREAKPOINT',\n PAGE_DATA_PREVIEW: 'PAGE_DATA_PREVIEW', // Editor \u2192 Iframe for component hover preview\n PAGE_DATA_PREVIEW_REVERT: 'PAGE_DATA_PREVIEW_REVERT', // Editor \u2192 Iframe to revert preview\n PAGE_DATA_COMMITTED: 'PAGE_DATA_COMMITTED', // Editor \u2192 Iframe for committed mutations\n COMPONENT_DEFINITION_COMMITTED: 'COMPONENT_DEFINITION_COMMITTED', // Editor \u2192 Iframe for component definition updates\n CSS_VARIABLE_UPDATE: 'CSS_VARIABLE_UPDATE', // Editor \u2192 Iframe for instant CSS variable preview\n DUPLICATE_ELEMENT: 'DUPLICATE_ELEMENT',\n MAKE_COMPONENT: 'MAKE_COMPONENT',\n SWAP_TO_COMPONENT: 'SWAP_TO_COMPONENT',\n SMART_CONNECT: 'SMART_CONNECT',\n} as const;\n\n// Component node type constants\nexport const NODE_TYPE = {\n NODE: 'node',\n COMPONENT: 'component',\n SLOT: 'slot',\n EMBED: 'embed',\n LINK: 'link',\n LOCALE_LIST: 'locale-list',\n LIST: 'list',\n} as const;\n\nexport type NodeType = typeof NODE_TYPE[keyof typeof NODE_TYPE];\n\n// Special path identifiers for component editing\nexport const SPECIAL_PATHS = {\n COMPONENT_INTERFACE: 'component_interface',\n COMPONENT_JAVASCRIPT: 'component_javascript',\n COMPONENT_CSS: 'component_css',\n COMPONENT_LIBRARIES: 'component_libraries',\n COMPONENT_ACCEPTS_STYLES: 'component_acceptsStyles',\n STRUCTURE_STYLE: 'structure_style',\n} as const;\n\n// Component type configuration\nexport interface ComponentTypeConfig {\n id: string;\n label: string;\n color: string;\n description?: string;\n}\n\nexport const DEFAULT_COMPONENT_TYPES: ComponentTypeConfig[] = [\n { id: 'ui', label: 'UI', color: '#3b82f6' },\n { id: 'layout', label: 'Layout', color: '#10b981' },\n { id: 'content', label: 'Content', color: '#f59e0b' },\n];\n\nexport const DEFAULT_ICON_COLOR = '#6b7280';\n\n/**\n * Marker for raw HTML content that should not be escaped\n * Used by rich-text fields to signal that content should render as HTML\n */\nexport const RAW_HTML_PREFIX = '<!--MENO_RAW_HTML-->';\n\n"],
5
- "mappings": ";;;;;AAAA,IAMa,aAMA,YAIA,YA8DA,WAEA,eAKA,iBAEA,kBAQA,sBACA,qBACA,2BACA,sBACA,0BAGA,mBAGA,sBAwCA,WAaA,eAiBA,yBAMA,oBAMA;AA3Lb;AAAA;AAMO,IAAM,cAAc,OAAO,YAAY,eAAe,QAAQ,KAAK,OACtE,SAAS,QAAQ,IAAI,MAAM,EAAE,IAC7B;AAIG,IAAM,aAAa,OAAO,YAAY,eAAe,QAAQ,KAAK,kBACrE,SAAS,QAAQ,IAAI,iBAAiB,EAAE,IACxC;AAEG,IAAM,aAAa;AAAA,MACxB,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,cAAc;AAAA;AAAA,MACd,WAAW;AAAA;AAAA,MACX,gBAAgB;AAAA;AAAA,MAChB,WAAW;AAAA,MACX,gBAAgB;AAAA,MAChB,mBAAmB;AAAA;AAAA,MACnB,oBAAoB;AAAA;AAAA,MACpB,oBAAoB;AAAA;AAAA,MACpB,kBAAkB;AAAA;AAAA,MAClB,mBAAmB;AAAA;AAAA,MACnB,cAAc;AAAA;AAAA,MACd,QAAQ;AAAA;AAAA,MACR,aAAa;AAAA;AAAA,MACb,mBAAmB;AAAA;AAAA,MACnB,wBAAwB;AAAA;AAAA,MACxB,WAAW;AAAA;AAAA;AAAA,MAEX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