pagiera 0.2.0-alpha.33

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 (192) hide show
  1. package/README.md +528 -0
  2. package/dist/adapters.d.ts +89 -0
  3. package/dist/adapters.d.ts.map +1 -0
  4. package/dist/adapters.js +2 -0
  5. package/dist/adapters.js.map +1 -0
  6. package/dist/client.d.ts +22 -0
  7. package/dist/client.d.ts.map +1 -0
  8. package/dist/client.js +33 -0
  9. package/dist/client.js.map +1 -0
  10. package/dist/data.js +210 -0
  11. package/dist/data.js.map +7 -0
  12. package/dist/document.d.ts +63 -0
  13. package/dist/document.d.ts.map +1 -0
  14. package/dist/document.js +25 -0
  15. package/dist/document.js.map +1 -0
  16. package/dist/editor.d.ts +14 -0
  17. package/dist/editor.d.ts.map +1 -0
  18. package/dist/editor.js +59 -0
  19. package/dist/editor.js.map +1 -0
  20. package/dist/full-editor.d.ts +53 -0
  21. package/dist/full-editor.js +11117 -0
  22. package/dist/full-editor.js.map +7 -0
  23. package/dist/full.css +3498 -0
  24. package/dist/index.d.ts +8 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +7 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/internal/app/api/ai-design/route.d.ts +3 -0
  29. package/dist/internal/app/api/ai-design/route.d.ts.map +1 -0
  30. package/dist/internal/app/api/ai-design/route.js +165 -0
  31. package/dist/internal/app/api/ai-design/route.js.map +1 -0
  32. package/dist/internal/app/p/editor/ai-panel.d.ts +27 -0
  33. package/dist/internal/app/p/editor/ai-panel.d.ts.map +1 -0
  34. package/dist/internal/app/p/editor/ai-panel.js +77 -0
  35. package/dist/internal/app/p/editor/ai-panel.js.map +1 -0
  36. package/dist/internal/app/p/editor/data-modal.d.ts +26 -0
  37. package/dist/internal/app/p/editor/data-modal.d.ts.map +1 -0
  38. package/dist/internal/app/p/editor/data-modal.js +94 -0
  39. package/dist/internal/app/p/editor/data-modal.js.map +1 -0
  40. package/dist/internal/app/p/editor/data-panel.d.ts +18 -0
  41. package/dist/internal/app/p/editor/data-panel.d.ts.map +1 -0
  42. package/dist/internal/app/p/editor/data-panel.js +45 -0
  43. package/dist/internal/app/p/editor/data-panel.js.map +1 -0
  44. package/dist/internal/app/p/editor/editor.d.ts +51 -0
  45. package/dist/internal/app/p/editor/editor.d.ts.map +1 -0
  46. package/dist/internal/app/p/editor/editor.js +1551 -0
  47. package/dist/internal/app/p/editor/editor.js.map +1 -0
  48. package/dist/internal/app/p/editor/fields.d.ts +111 -0
  49. package/dist/internal/app/p/editor/fields.d.ts.map +1 -0
  50. package/dist/internal/app/p/editor/fields.js +141 -0
  51. package/dist/internal/app/p/editor/fields.js.map +1 -0
  52. package/dist/internal/app/p/editor/inspector.d.ts +38 -0
  53. package/dist/internal/app/p/editor/inspector.d.ts.map +1 -0
  54. package/dist/internal/app/p/editor/inspector.js +336 -0
  55. package/dist/internal/app/p/editor/inspector.js.map +1 -0
  56. package/dist/internal/app/p/editor/library.d.ts +18 -0
  57. package/dist/internal/app/p/editor/library.d.ts.map +1 -0
  58. package/dist/internal/app/p/editor/library.js +61 -0
  59. package/dist/internal/app/p/editor/library.js.map +1 -0
  60. package/dist/internal/app/p/editor/parts.d.ts +75 -0
  61. package/dist/internal/app/p/editor/parts.d.ts.map +1 -0
  62. package/dist/internal/app/p/editor/parts.js +261 -0
  63. package/dist/internal/app/p/editor/parts.js.map +1 -0
  64. package/dist/internal/app/p/editor/templates-panel.d.ts +6 -0
  65. package/dist/internal/app/p/editor/templates-panel.d.ts.map +1 -0
  66. package/dist/internal/app/p/editor/templates-panel.js +12 -0
  67. package/dist/internal/app/p/editor/templates-panel.js.map +1 -0
  68. package/dist/internal/app/p/editor/use-canvas-view.d.ts +24 -0
  69. package/dist/internal/app/p/editor/use-canvas-view.d.ts.map +1 -0
  70. package/dist/internal/app/p/editor/use-canvas-view.js +242 -0
  71. package/dist/internal/app/p/editor/use-canvas-view.js.map +1 -0
  72. package/dist/internal/app/p/editor/use-editor.d.ts +48 -0
  73. package/dist/internal/app/p/editor/use-editor.d.ts.map +1 -0
  74. package/dist/internal/app/p/editor/use-editor.js +224 -0
  75. package/dist/internal/app/p/editor/use-editor.js.map +1 -0
  76. package/dist/internal/app/p/editor/variables-panel.d.ts +8 -0
  77. package/dist/internal/app/p/editor/variables-panel.d.ts.map +1 -0
  78. package/dist/internal/app/p/editor/variables-panel.js +52 -0
  79. package/dist/internal/app/p/editor/variables-panel.js.map +1 -0
  80. package/dist/internal/components/ui/select.d.ts +12 -0
  81. package/dist/internal/components/ui/select.d.ts.map +1 -0
  82. package/dist/internal/components/ui/select.js +32 -0
  83. package/dist/internal/components/ui/select.js.map +1 -0
  84. package/dist/internal/drizzle/index.d.ts +6 -0
  85. package/dist/internal/drizzle/index.d.ts.map +1 -0
  86. package/dist/internal/drizzle/index.js +20 -0
  87. package/dist/internal/drizzle/index.js.map +1 -0
  88. package/dist/internal/drizzle/schema.d.ts +405 -0
  89. package/dist/internal/drizzle/schema.d.ts.map +1 -0
  90. package/dist/internal/drizzle/schema.js +70 -0
  91. package/dist/internal/drizzle/schema.js.map +1 -0
  92. package/dist/internal/lib/data/context.d.ts +8 -0
  93. package/dist/internal/lib/data/context.d.ts.map +1 -0
  94. package/dist/internal/lib/data/context.js +17 -0
  95. package/dist/internal/lib/data/context.js.map +1 -0
  96. package/dist/internal/lib/data/source.d.ts +54 -0
  97. package/dist/internal/lib/data/source.d.ts.map +1 -0
  98. package/dist/internal/lib/data/source.js +229 -0
  99. package/dist/internal/lib/data/source.js.map +1 -0
  100. package/dist/internal/lib/editor/ai-types.d.ts +44 -0
  101. package/dist/internal/lib/editor/ai-types.d.ts.map +1 -0
  102. package/dist/internal/lib/editor/ai-types.js +2 -0
  103. package/dist/internal/lib/editor/ai-types.js.map +1 -0
  104. package/dist/internal/lib/editor/arrange.d.ts +12 -0
  105. package/dist/internal/lib/editor/arrange.d.ts.map +1 -0
  106. package/dist/internal/lib/editor/arrange.js +72 -0
  107. package/dist/internal/lib/editor/arrange.js.map +1 -0
  108. package/dist/internal/lib/editor/cascade.d.ts +39 -0
  109. package/dist/internal/lib/editor/cascade.d.ts.map +1 -0
  110. package/dist/internal/lib/editor/cascade.js +86 -0
  111. package/dist/internal/lib/editor/cascade.js.map +1 -0
  112. package/dist/internal/lib/editor/icon.d.ts +6 -0
  113. package/dist/internal/lib/editor/icon.d.ts.map +1 -0
  114. package/dist/internal/lib/editor/icon.js +13 -0
  115. package/dist/internal/lib/editor/icon.js.map +1 -0
  116. package/dist/internal/lib/editor/presets.d.ts +10 -0
  117. package/dist/internal/lib/editor/presets.d.ts.map +1 -0
  118. package/dist/internal/lib/editor/presets.js +83 -0
  119. package/dist/internal/lib/editor/presets.js.map +1 -0
  120. package/dist/internal/lib/editor/showcase.d.ts +14 -0
  121. package/dist/internal/lib/editor/showcase.d.ts.map +1 -0
  122. package/dist/internal/lib/editor/showcase.js +219 -0
  123. package/dist/internal/lib/editor/showcase.js.map +1 -0
  124. package/dist/internal/lib/editor/site-templates.d.ts +4 -0
  125. package/dist/internal/lib/editor/site-templates.d.ts.map +1 -0
  126. package/dist/internal/lib/editor/site-templates.js +156 -0
  127. package/dist/internal/lib/editor/site-templates.js.map +1 -0
  128. package/dist/internal/lib/editor/snap.d.ts +34 -0
  129. package/dist/internal/lib/editor/snap.d.ts.map +1 -0
  130. package/dist/internal/lib/editor/snap.js +70 -0
  131. package/dist/internal/lib/editor/snap.js.map +1 -0
  132. package/dist/internal/lib/editor/style.d.ts +53 -0
  133. package/dist/internal/lib/editor/style.d.ts.map +1 -0
  134. package/dist/internal/lib/editor/style.js +313 -0
  135. package/dist/internal/lib/editor/style.js.map +1 -0
  136. package/dist/internal/lib/editor/tree.d.ts +72 -0
  137. package/dist/internal/lib/editor/tree.d.ts.map +1 -0
  138. package/dist/internal/lib/editor/tree.js +301 -0
  139. package/dist/internal/lib/editor/tree.js.map +1 -0
  140. package/dist/internal/lib/editor/types.d.ts +273 -0
  141. package/dist/internal/lib/editor/types.d.ts.map +1 -0
  142. package/dist/internal/lib/editor/types.js +411 -0
  143. package/dist/internal/lib/editor/types.js.map +1 -0
  144. package/dist/internal/lib/editor/validate.d.ts +20 -0
  145. package/dist/internal/lib/editor/validate.d.ts.map +1 -0
  146. package/dist/internal/lib/editor/validate.js +467 -0
  147. package/dist/internal/lib/editor/validate.js.map +1 -0
  148. package/dist/internal/lib/pages.d.ts +83 -0
  149. package/dist/internal/lib/pages.d.ts.map +1 -0
  150. package/dist/internal/lib/pages.js +294 -0
  151. package/dist/internal/lib/pages.js.map +1 -0
  152. package/dist/internal/lib/render/bind.d.ts +18 -0
  153. package/dist/internal/lib/render/bind.d.ts.map +1 -0
  154. package/dist/internal/lib/render/bind.js +28 -0
  155. package/dist/internal/lib/render/bind.js.map +1 -0
  156. package/dist/internal/lib/render/css.d.ts +31 -0
  157. package/dist/internal/lib/render/css.d.ts.map +1 -0
  158. package/dist/internal/lib/render/css.js +239 -0
  159. package/dist/internal/lib/render/css.js.map +1 -0
  160. package/dist/internal/lib/render/load-data.d.ts +15 -0
  161. package/dist/internal/lib/render/load-data.d.ts.map +1 -0
  162. package/dist/internal/lib/render/load-data.js +39 -0
  163. package/dist/internal/lib/render/load-data.js.map +1 -0
  164. package/dist/internal/lib/render/page-render.d.ts +17 -0
  165. package/dist/internal/lib/render/page-render.d.ts.map +1 -0
  166. package/dist/internal/lib/render/page-render.js +117 -0
  167. package/dist/internal/lib/render/page-render.js.map +1 -0
  168. package/dist/internal/lib/utils.d.ts +3 -0
  169. package/dist/internal/lib/utils.d.ts.map +1 -0
  170. package/dist/internal/lib/utils.js +6 -0
  171. package/dist/internal/lib/utils.js.map +1 -0
  172. package/dist/manrope-data.d.ts +3 -0
  173. package/dist/manrope-data.d.ts.map +1 -0
  174. package/dist/manrope-data.js +3 -0
  175. package/dist/manrope-data.js.map +1 -0
  176. package/dist/page.d.ts +9 -0
  177. package/dist/page.d.ts.map +1 -0
  178. package/dist/page.js +148 -0
  179. package/dist/page.js.map +1 -0
  180. package/dist/provider.d.ts +14 -0
  181. package/dist/provider.d.ts.map +1 -0
  182. package/dist/provider.js +45 -0
  183. package/dist/provider.js.map +1 -0
  184. package/dist/runtime.d.ts +8 -0
  185. package/dist/runtime.js +717 -0
  186. package/dist/runtime.js.map +7 -0
  187. package/dist/server.d.ts +31 -0
  188. package/dist/server.js +2267 -0
  189. package/dist/server.js.map +7 -0
  190. package/dist/styles.css +300 -0
  191. package/package.json +94 -0
  192. package/thumbnail.png +0 -0
@@ -0,0 +1,8 @@
1
+ export { createDocument, type PagieraBreakpoint, type PagieraDocument, type PagieraElement, type PagieraRootStyle, } from "./document.js";
2
+ export { PagieraPage, type PagieraPageProps } from "./page.js";
3
+ export { PagieraEditor, type PagieraEditorAdapters, type PagieraEditorProps } from "./editor.js";
4
+ export type { PagieraAdapters, PagieraDataPreview, PagieraPageSummary, PagieraSaveResult, } from "./adapters.js";
5
+ export { createPagieraClient, type PagieraClientOptions } from "./client.js";
6
+ export { PagieraProvider, usePagieraFonts, type PagieraFont, type PagieraResolvedFont } from "./provider.js";
7
+ export declare const PAGIERA_VERSION = "0.2.0-alpha.33";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjG,YAAY,EACR,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE7G,eAAO,MAAM,eAAe,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { createDocument, } from "./document.js";
2
+ export { PagieraPage } from "./page.js";
3
+ export { PagieraEditor } from "./editor.js";
4
+ export { createPagieraClient } from "./client.js";
5
+ export { PagieraProvider, usePagieraFonts } from "./provider.js";
6
+ export const PAGIERA_VERSION = "0.2.0-alpha.33";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,GAKjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAyB,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAuD,MAAM,aAAa,CAAC;AAOjG,OAAO,EAAE,mBAAmB,EAA6B,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,eAAe,EAA8C,MAAM,eAAe,CAAC;AAE7G,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const maxDuration = 120;
2
+ export declare function POST(request: Request): Promise<Response>;
3
+ //# sourceMappingURL=route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app/api/ai-design/route.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,MAAM,CAAC;AAkE/B,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,qBA2G1C"}
@@ -0,0 +1,165 @@
1
+ import { createOpenRouter } from "@openrouter/ai-sdk-provider";
2
+ import { generateText, Output } from "ai";
3
+ import { z } from "zod";
4
+ import { ELEMENT_TYPES } from "@/lib/editor/types";
5
+ export const maxDuration = 120;
6
+ const styleSchema = z
7
+ .object({
8
+ x: z.number().optional(), y: z.number().optional(), constraintX: z.enum(["start", "center", "end", "stretch"]).optional(), constraintY: z.enum(["start", "center", "end", "stretch"]).optional(), w: z.number().positive().optional(), h: z.number().positive().optional(),
9
+ widthMode: z.enum(["fixed", "fill", "auto"]).optional(), heightMode: z.enum(["fixed", "fill", "auto"]).optional(),
10
+ layout: z.enum(["absolute", "stack"]).optional(), direction: z.enum(["row", "column"]).optional(),
11
+ gap: z.number().nonnegative().optional(), padT: z.number().nonnegative().optional(), padR: z.number().nonnegative().optional(), padB: z.number().nonnegative().optional(), padL: z.number().nonnegative().optional(),
12
+ justify: z.enum(["start", "center", "end", "between"]).optional(), align: z.enum(["start", "center", "end", "stretch"]).optional(), wrap: z.boolean().optional(), columns: z.number().int().min(1).max(12).optional(),
13
+ bg: z.string().optional(), gradient: z.string().optional(), color: z.string().optional(), radius: z.number().nonnegative().optional(), opacity: z.number().min(0).max(100).optional(),
14
+ borderW: z.number().nonnegative().optional(), borderC: z.string().optional(), borderStyle: z.enum(["solid", "dashed", "dotted"]).optional(), shadow: z.string().optional(), rotate: z.number().optional(),
15
+ fontSize: z.number().positive().optional(), fontWeight: z.string().optional(), lineHeight: z.number().positive().optional(), letterSpacing: z.number().optional(), textAlign: z.enum(["left", "center", "right", "justify"]).optional(), textTransform: z.enum(["none", "uppercase", "lowercase", "capitalize"]).optional(),
16
+ overflow: z.enum(["visible", "hidden", "auto", "scroll"]).optional(), position: z.enum(["static", "sticky"]).optional(), stickyOffset: z.number().optional(),
17
+ bgImage: z.string().optional(), bgSize: z.enum(["cover", "contain", "auto"]).optional(), bgPosition: z.string().optional(), backdropBlur: z.number().nonnegative().optional(), blur: z.number().nonnegative().optional(), scale: z.number().min(1).max(500).optional().describe("Percentage scale: 100 is normal, 102 is two percent larger"), aspectRatio: z.string().optional(),
18
+ entrance: z.enum(["none", "fade", "up", "down", "left", "right", "zoom"]).optional(), entranceDuration: z.number().nonnegative().optional(), entranceDelay: z.number().nonnegative().optional(), entranceCurve: z.enum(["ease", "spring"]).optional(), entranceBezier: z.string().optional(), springStiffness: z.number().positive().optional(), springDamping: z.number().positive().optional(), cursor: z.enum(["auto", "default", "pointer", "text", "grab", "zoom-in", "none"]).optional(), hidden: z.boolean().optional(),
19
+ })
20
+ .strict();
21
+ const bindingsSchema = z.record(z.string(), z.string().max(60)).optional();
22
+ const interactionSchema = z.object({ trigger: z.literal("click"), action: z.enum(["navigate", "scroll-to", "toggle-layer", "show-layer", "hide-layer"]), value: z.string().max(2000), target: z.enum(["_self", "_blank"]).optional() }).optional();
23
+ const loopSchema = z.object({ type: z.enum(["pulse", "float", "spin"]), duration: z.number().min(100).max(20000) }).optional();
24
+ const planSchema = z.object({
25
+ message: z.string().max(600),
26
+ steps: z.array(z.string().max(180)).min(1).max(6),
27
+ operations: z.array(z.discriminatedUnion("kind", [
28
+ z.object({ kind: z.literal("add"), ref: z.string().min(1).max(60), type: z.enum(ELEMENT_TYPES), parentId: z.string().nullable().optional(), content: z.string().max(5000).optional(), src: z.string().max(2000).optional(), href: z.string().max(2000).optional(), style: styleSchema.optional(), tabletStyle: styleSchema.optional(), mobileStyle: styleSchema.optional(), hoverStyle: styleSchema.optional(), pressStyle: styleSchema.optional(), loop: loopSchema, draggable: z.boolean().optional(), styleBindings: bindingsSchema, interaction: interactionSchema }),
29
+ z.object({ kind: z.literal("update"), id: z.string(), content: z.string().max(5000).optional(), src: z.string().max(2000).optional(), href: z.string().max(2000).optional(), style: styleSchema.optional(), tabletStyle: styleSchema.optional(), mobileStyle: styleSchema.optional(), hoverStyle: styleSchema.optional(), pressStyle: styleSchema.optional(), loop: loopSchema, draggable: z.boolean().optional(), styleBindings: bindingsSchema, interaction: interactionSchema }),
30
+ z.object({ kind: z.literal("remove"), id: z.string() }),
31
+ z.object({ kind: z.literal("page"), style: z.object({ documentMode: z.enum(["page", "component"]).optional(), maxWidth: z.number().min(1).max(4000).optional(), canvasHeight: z.number().min(1).max(12000).optional(), fullWidth: z.boolean().optional(), bg: z.string().optional(), layout: z.enum(["absolute", "stack"]).optional(), direction: z.enum(["row", "column"]).optional(), gap: z.number().nonnegative().optional(), padT: z.number().nonnegative().optional(), padR: z.number().nonnegative().optional(), padB: z.number().nonnegative().optional(), padL: z.number().nonnegative().optional(), align: z.enum(["start", "center", "end", "stretch"]).optional(), fontFamily: z.string().optional(), variables: z.array(z.object({ id: z.string().max(60), name: z.string().max(60), type: z.enum(["color", "number"]), value: z.union([z.string(), z.number()]) })).max(24).optional() }).strict() }),
32
+ ])).max(100),
33
+ });
34
+ const blueprintSchema = z.object({
35
+ intent: z.enum(["conversation", "modify", "build-page"]),
36
+ direction: z.string().max(500),
37
+ palette: z.object({
38
+ background: z.string(),
39
+ surface: z.string(),
40
+ primary: z.string(),
41
+ text: z.string(),
42
+ muted: z.string(),
43
+ border: z.string(),
44
+ }),
45
+ typography: z.object({
46
+ heading: z.string(),
47
+ body: z.string(),
48
+ scale: z.array(z.number()).min(3).max(7),
49
+ }),
50
+ signature: z.object({
51
+ visualMotif: z.string().max(240),
52
+ heroComposition: z.string().max(320),
53
+ motionRhythm: z.string().max(240),
54
+ avoid: z.array(z.string().max(120)).min(3).max(8),
55
+ }),
56
+ sections: z.array(z.object({
57
+ name: z.string(),
58
+ purpose: z.string(),
59
+ composition: z.string(),
60
+ details: z.array(z.string()).min(2).max(8),
61
+ })).max(12),
62
+ });
63
+ export async function POST(request) {
64
+ const apiKey = process.env.OPENROUTER_API_KEY;
65
+ if (!apiKey)
66
+ return Response.json({ error: "OPENROUTER_API_KEY is not configured." }, { status: 503 });
67
+ try {
68
+ const body = (await request.json());
69
+ if (typeof body.prompt !== "string" || !body.prompt.trim())
70
+ return Response.json({ error: "Prompt is required." }, { status: 400 });
71
+ const openrouter = createOpenRouter({ apiKey });
72
+ const model = openrouter(process.env.OPENROUTER_MODEL ?? "anthropic/claude-sonnet-4.5");
73
+ const requestContext = {
74
+ request: body.prompt.slice(0, 4000),
75
+ activeBreakpoint: body.breakpoint,
76
+ recentConversation: body.history,
77
+ document: body.document,
78
+ };
79
+ const { output: blueprint } = await generateText({
80
+ model,
81
+ maxRetries: 2,
82
+ maxOutputTokens: 5000,
83
+ output: Output.object({ schema: blueprintSchema, name: "pagiera_blueprint" }),
84
+ system: `You are an award-winning digital art director and UX architect. Plan before building.
85
+ Create a specific, contemporary visual direction—not generic SaaS filler. Establish one exact palette, typography hierarchy, spacing rhythm and a section-by-section composition. The signature must name one repeatable visual motif, a concrete asymmetric hero composition, a motion rhythm and explicit clichés to avoid.
86
+ For a full page, plan 5-8 substantial sections with meaningful visual variety: navigation, hero, proof, editorial or feature storytelling, metrics/testimonial, conversion CTA and footer. Each section needs layered details, not only a heading and paragraph.
87
+ Avoid the default AI look: endless equal cards, centered text in every section, neon purple gradients, excessive pills, fake dashboard rectangles, glow on everything, and identical rounded boxes. Mix editorial whitespace with one or two dense moments. Each section must have a distinct silhouette while sharing the same system.
88
+ Use the existing document intelligently. If the user asks a conversational question, set intent=conversation and keep sections empty. Preserve good existing work unless replacement was requested.
89
+ Treat motion as part of the visual direction: define a restrained entrance rhythm, one shared easing character, and a clear focal moment. Animation must reinforce hierarchy rather than decorate every node.`,
90
+ prompt: JSON.stringify(requestContext).slice(0, 60000),
91
+ });
92
+ const { output: draft } = await generateText({
93
+ model,
94
+ maxRetries: 2,
95
+ maxOutputTokens: 24000,
96
+ output: Output.object({ schema: planSchema, name: "pagiera_design_plan" }),
97
+ system: `You are Pagiera's senior web designer. Turn the request into precise editor operations.
98
+ Use only existing element IDs from the document for update/remove/parentId. For newly added parents, reference their ref in later parentId fields.
99
+ Build polished, production-ready layouts with strong hierarchy, spacing, responsive-friendly fill/auto sizing, accessible contrast, and concise real copy. Follow approvedBlueprint.signature literally so the result has an identifiable art direction.
100
+ Compose complete pages from recognizable sections: Navbar, Hero, social proof, feature grid, CTA and Footer. A Navbar is a row Section with justify=between and align=center; a Footer is a spacious Section with grouped link Containers. Do not output a random pile of Text and Button nodes.
101
+ Sections and containers should normally use stack layout. Prefer full-width Sections, auto heights and nested Containers. Put siblings in a stack parent rather than positioning them manually.
102
+ Use Frame for bounded visual compositions, Stack for row/column groups, and Grid for repeated cards. For full page builds create page variables for the exact palette and core spacing values, then bind repeated style properties with styleBindings. IDs in styleBindings must match those page variables.
103
+ Alignment rules are strict: justify controls the parent's main axis; align controls its cross axis. To center a column vertically and horizontally use justify=center and align=center. A child with widthMode=fill cannot visibly center on the cross axis, so use fixed/auto for centered content and fill only when it should stretch. Use textAlign=center for centered copy.
104
+ Before operations, provide 2-6 short implementation steps in the steps field.
105
+ Create one coherent design system per page: choose exactly one page background, one surface color, one primary accent, one main text color and one muted text color. Reuse those exact values throughout all operations. Do not introduce unrelated colors section by section. Use at most one subtle gradient and only when it supports the chosen palette.
106
+ Use consistent spacing (8/12/16/24/32/48/64/96), restrained radii, modern typography, generous whitespace, and no placeholder copy. Never invent unsupported element types.
107
+ Implement every blueprint section with enough nested elements to make it visually complete. Full-page builds should normally contain 22-55 purposeful operations. Quality, composition and hierarchy matter more than node count. Add responsive tabletStyle/mobileStyle for structural, spacing and typography changes.
108
+ Do not make every section a centered column or every feature an equal card. Use at least three composition patterns across a full page: asymmetric split, editorial text/media, structured grid, horizontal proof strip, oversized statement or layered visual frame. Keep readable content inside a consistent inner Container while Section backgrounds may fill the viewport.
109
+ Headings should use a deliberate type scale and tight line height; body copy should stay readable and constrained. Buttons must size to content unless intentionally full width on mobile. Never use fixed heights for text-heavy sections.
110
+ Create Framer-quality motion choreography. Stagger related entranceDelay values by 60-120ms, reuse a coherent entranceBezier, and choose spring only for expressive focal elements. Add restrained hoverStyle to interactive buttons/cards and pressStyle to primary controls. At most one subtle ornamental element may use a pulse, float, or spin loop. Enable draggable only when it has an intentional product interaction. Never animate every element or mix unrelated easing styles.
111
+ Scale values are percentages: 100 is the resting size, a subtle hover is 101-103, and a press is 97-99. Never output CSS multipliers such as 1.02 or 0.98.
112
+ Use custom font families already registered in document.rootStyle.customFonts by their exact names when they suit the direction. Never invent a font URL or an unregistered custom family; otherwise use the document's existing font stack.
113
+ Use interaction for real navigation buttons and scroll-to navigation items. Build reusable visual patterns consistently so they can later become component masters and variants.
114
+ Responsive navbars should create the hidden mobile menu layer before the menu trigger, then set the trigger interaction to toggle-layer using that earlier ref. Use show-layer/hide-layer for overlays and close buttons. Tablet/mobile layouts must reorganize rather than merely shrink.
115
+ If the request is conversational or needs no visual change, return no operations and answer in message. Do not remove existing work unless explicitly asked.`,
116
+ prompt: JSON.stringify({ ...requestContext, approvedBlueprint: blueprint }).slice(0, 90000),
117
+ });
118
+ if (!draft)
119
+ throw new Error("The model returned an empty design plan.");
120
+ let finalPlan = draft;
121
+ if (blueprint.intent === "build-page" && draft.operations.length > 0) {
122
+ try {
123
+ const { output: polished } = await generateText({
124
+ model,
125
+ maxRetries: 1,
126
+ maxOutputTokens: 26000,
127
+ output: Output.object({ schema: planSchema, name: "pagiera_polished_design_plan" }),
128
+ system: `You are the final design director and implementation reviewer for Pagiera. Return a complete replacement plan, not commentary.
129
+ Audit the draft ruthlessly, then rewrite its operations into a refined, buildable landing page. Preserve the user's intent and approved palette, but remove generic AI aesthetics.
130
+
131
+ QUALITY GATE:
132
+ - Every add parentId must reference an existing document ID or an earlier add ref. Parents always precede children.
133
+ - Page uses stack/column flow. Full-width Sections contain bounded inner Containers. Text-heavy sections use auto height.
134
+ - Desktop composition feels art-directed, not templated. Use varied silhouettes and asymmetric hierarchy without random absolute positioning.
135
+ - Tablet and mobile overrides prevent overflow, collapse rows/grids, reduce padding and maintain readable type. Mobile must never be a scaled-down desktop screenshot.
136
+ - Use one exact color system, one radius language and one shadow language. Remove gratuitous gradients, glass, glow, pills and borders.
137
+ - Motion is a coherent sequence: restrained staggered entrances, meaningful hover/press feedback, no more than one ambient loop.
138
+ - Copy is specific and credible. Remove placeholder metrics, lorem ipsum and repetitive labels.
139
+ - Keep 22-55 purposeful operations when building a full page. Do not lose required sections while simplifying.
140
+
141
+ Return only the corrected plan matching the schema. Its message should briefly describe the finished visual direction and its steps should describe what was actually built.`,
142
+ prompt: JSON.stringify({ requestContext, approvedBlueprint: blueprint, draftPlan: draft }).slice(0, 115000),
143
+ });
144
+ if (polished?.operations.length)
145
+ finalPlan = polished;
146
+ }
147
+ catch (polishError) {
148
+ console.warn("AI polish pass failed; returning valid draft", polishError);
149
+ }
150
+ }
151
+ return Response.json(finalPlan);
152
+ }
153
+ catch (reason) {
154
+ const rawMessage = reason instanceof Error ? reason.message : "Unknown AI provider error";
155
+ console.error("AI design request failed", reason);
156
+ const truncated = /unexpected end|unterminated|parse|json|no object generated|length|token/i.test(rawMessage);
157
+ return Response.json({
158
+ error: truncated
159
+ ? "AI yanıtı tamamlanmadan kesildi. İstek otomatik olarak korunuyor; tekrar deneyebilir veya daha küçük bir bölüm isteyebilirsin."
160
+ : `AI tasarımı oluşturulamadı: ${rawMessage.slice(0, 240)}`,
161
+ code: truncated ? "INCOMPLETE_AI_RESPONSE" : "AI_PROVIDER_ERROR",
162
+ }, { status: truncated ? 422 : 502 });
163
+ }
164
+ }
165
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../../../../src/internal/app/api/ai-design/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,MAAM,WAAW,GAAG,CAAC;KAChB,MAAM,CAAC;IACJ,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,MA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AE,CACpC,CAAC;IACN,CAAC;AACL,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { AiDesignPlan } from "@/lib/editor/ai-types";
2
+ import type { Breakpoint, CanvasElement, RootStyle } from "@/lib/editor/types";
3
+ type Message = {
4
+ role: "user" | "assistant";
5
+ text: string;
6
+ steps?: string[];
7
+ };
8
+ export type AiDesignRequest = {
9
+ prompt: string;
10
+ breakpoint: Breakpoint;
11
+ history: Message[];
12
+ document: {
13
+ rootStyle: RootStyle;
14
+ elements: unknown[];
15
+ };
16
+ };
17
+ export type AiDesignGenerator = (request: AiDesignRequest) => Promise<AiDesignPlan>;
18
+ export declare function AiPanel({ pageId, elements, rootStyle, breakpoint, onApply, generate }: {
19
+ pageId: string;
20
+ elements: CanvasElement[];
21
+ rootStyle: RootStyle;
22
+ breakpoint: Breakpoint;
23
+ onApply: (plan: AiDesignPlan) => void;
24
+ generate?: AiDesignGenerator;
25
+ }): import("react").JSX.Element;
26
+ export {};
27
+ //# sourceMappingURL=ai-panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-panel.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app/p/editor/ai-panel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/E,KAAK,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE9E,MAAM,MAAM,eAAe,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,QAAQ,EAAE;QAAE,SAAS,EAAE,SAAS,CAAC;QAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAEpF,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAA;CAAE,+BAgFvP"}
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { IconArrowUp, IconCheck, IconSparkles } from "@tabler/icons-react";
4
+ import { useEffect, useRef, useState } from "react";
5
+ export function AiPanel({ pageId, elements, rootStyle, breakpoint, onApply, generate }) {
6
+ const [messages, setMessages] = useState([]);
7
+ const [input, setInput] = useState("");
8
+ const [busy, setBusy] = useState(false);
9
+ const [phase, setPhase] = useState(null);
10
+ const [error, setError] = useState(null);
11
+ const endRef = useRef(null);
12
+ const [restoredPage, setRestoredPage] = useState(null);
13
+ useEffect(() => {
14
+ try {
15
+ const saved = localStorage.getItem(`pagiera:ai-chat:${pageId}`);
16
+ setMessages(saved ? JSON.parse(saved) : []);
17
+ }
18
+ catch {
19
+ // Corrupt/private storage must not disable the assistant.
20
+ setMessages([]);
21
+ }
22
+ setRestoredPage(pageId);
23
+ }, [pageId]);
24
+ useEffect(() => {
25
+ if (restoredPage !== pageId)
26
+ return;
27
+ try {
28
+ localStorage.setItem(`pagiera:ai-chat:${pageId}`, JSON.stringify(messages.slice(-40)));
29
+ }
30
+ catch {
31
+ // Storage is an enhancement; the current conversation still works.
32
+ }
33
+ endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
34
+ }, [messages, pageId, restoredPage]);
35
+ const submit = async () => {
36
+ const prompt = input.trim();
37
+ if (!prompt || busy)
38
+ return;
39
+ const nextMessages = [...messages, { role: "user", text: prompt }];
40
+ setMessages(nextMessages);
41
+ setInput("");
42
+ setBusy(true);
43
+ setPhase("analyzing");
44
+ setError(null);
45
+ const planningTimer = window.setTimeout(() => setPhase("planning"), 900);
46
+ const buildingTimer = window.setTimeout(() => setPhase("building"), 2200);
47
+ const polishingTimer = window.setTimeout(() => setPhase("polishing"), 6500);
48
+ try {
49
+ const request = { prompt, breakpoint, history: nextMessages.slice(-6), document: { rootStyle, elements: elements.map(({ id, type, name, parentId, content, src, href, base, overrides, hover, press, loop, draggable, styleBindings, componentRole, componentId, variant, interaction, code }) => ({ id, type, name, parentId, content, src, href, base, overrides, hover, press, loop, draggable, styleBindings, componentRole, componentId, variant, interaction, code })) } };
50
+ if (!generate)
51
+ throw new Error("No AI adapter configured.");
52
+ const response = await generate(request);
53
+ const result = response;
54
+ if (!result || typeof result !== "object" || !("operations" in result) || !Array.isArray(result.operations))
55
+ throw new Error("AI geçerli bir tasarım planı döndürmedi. İsteğin korundu, tekrar deneyebilirsin.");
56
+ const plan = result;
57
+ onApply(plan);
58
+ setMessages((current) => [...current, { role: "assistant", text: plan.message || `Applied ${plan.operations.length} changes.`, steps: plan.steps }]);
59
+ }
60
+ catch (reason) {
61
+ setInput(prompt);
62
+ setError(reason instanceof Error ? reason.message : "AI request failed.");
63
+ }
64
+ finally {
65
+ window.clearTimeout(planningTimer);
66
+ window.clearTimeout(buildingTimer);
67
+ window.clearTimeout(polishingTimer);
68
+ setBusy(false);
69
+ setPhase(null);
70
+ }
71
+ };
72
+ return _jsxs("div", { className: "flex h-full min-h-0 flex-col overflow-hidden", children: [_jsxs("div", { className: "min-h-0 flex-1 space-y-3 overflow-y-auto p-3", children: [messages.length === 0 && _jsxs("div", { className: "rounded-xl border border-ed-border bg-ed-subtle p-4", children: [_jsx(IconSparkles, { size: 18, className: "mb-3 text-ed-accent" }), _jsx("p", { className: "text-xs font-semibold text-ed-text", children: "Design with AI" }), _jsx("p", { className: "mt-1 text-[11px] leading-relaxed text-ed-muted", children: "Describe a section, restyle the page, or ask for a complete landing page. Every change remains undoable." }), _jsx("div", { className: "mt-3 space-y-1.5", children: ["Create a dark SaaS hero", "Turn this into a portfolio", "Improve spacing and typography"].map((suggestion) => _jsx("button", { type: "button", onClick: () => setInput(suggestion), className: "block w-full rounded-lg bg-ed-field px-2.5 py-2 text-left text-[10px] text-ed-muted hover:bg-ed-field-hover hover:text-ed-text", children: suggestion }, suggestion)) })] }), messages.map((message, index) => _jsxs("div", { className: `flex gap-2.5 ${message.role === "user" ? "justify-end" : "items-start"}`, children: [message.role === "assistant" && _jsx("span", { className: "flex size-7 shrink-0 items-center justify-center rounded-lg bg-ed-accent/15 text-ed-accent", children: _jsx(IconSparkles, { size: 14 }) }), _jsxs("div", { className: `max-w-[calc(100%-38px)] rounded-2xl px-3 py-2.5 text-[11px] leading-relaxed ${message.role === "user" ? "rounded-br-md bg-ed-accent text-white" : "rounded-tl-md border border-ed-border bg-ed-subtle text-ed-text"}`, children: [message.steps && message.steps.length > 0 && _jsx("div", { className: "mb-2.5 space-y-1.5", children: message.steps.map((step, stepIndex) => _jsxs("div", { className: "flex gap-2 text-[10px] text-ed-muted", children: [_jsx("span", { className: "flex size-4 shrink-0 items-center justify-center rounded-full bg-emerald-500/15 text-emerald-400", children: _jsx(IconCheck, { size: 10 }) }), _jsxs("span", { children: [_jsxs("b", { className: "text-ed-text", children: [stepIndex + 1, "."] }), " ", step] })] }, step)) }), _jsx("p", { children: message.text })] })] }, `${message.role}-${index}`)), busy && _jsxs("div", { className: "flex items-start gap-2.5", children: [_jsx("span", { className: "flex size-7 shrink-0 animate-pulse items-center justify-center rounded-lg bg-ed-accent/15 text-ed-accent", children: _jsx(IconSparkles, { size: 14 }) }), _jsx("div", { className: "flex-1 rounded-2xl rounded-tl-md border border-ed-border bg-ed-subtle p-3", children: _jsx("div", { className: "space-y-2", children: [["analyzing", "Analyzing your page"], ["planning", "Creating an art direction"], ["building", "Building the layout"], ["polishing", "Polishing responsive details"]].map(([key, label], index) => { const order = ["analyzing", "planning", "building", "polishing"]; const activeIndex = order.indexOf(phase ?? "analyzing"); const done = index < activeIndex; const active = index === activeIndex; return _jsxs("div", { className: `flex items-center gap-2 text-[10px] ${active ? "text-ed-text" : done ? "text-emerald-400" : "text-ed-faint"}`, children: [_jsx("span", { className: `size-1.5 rounded-full ${active ? "animate-pulse bg-ed-accent" : done ? "bg-emerald-400" : "bg-ed-border"}` }), label] }, key); }) }) })] }), error && _jsx("p", { className: "rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2 text-[10px] text-red-300", children: error }), _jsx("div", { ref: endRef })] }), _jsx("form", { className: "border-t border-ed-border p-3", onSubmit: (event) => { event.preventDefault(); void submit(); }, children: _jsxs("div", { className: "flex items-end gap-2 rounded-xl border border-ed-border bg-ed-field p-2 focus-within:border-ed-accent", children: [_jsx("textarea", { value: input, onChange: (event) => setInput(event.target.value), onKeyDown: (event) => { if (event.key === "Enter" && !event.shiftKey) {
73
+ event.preventDefault();
74
+ void submit();
75
+ } }, placeholder: "Ask AI to design\u2026", rows: 2, className: "min-h-10 flex-1 resize-none bg-transparent text-[11px] text-ed-text outline-none placeholder:text-ed-faint" }), _jsx("button", { type: "submit", disabled: !input.trim() || busy, className: "flex size-7 shrink-0 items-center justify-center rounded-lg bg-ed-accent text-white disabled:opacity-30", children: _jsx(IconArrowUp, { size: 14 }) })] }) })] });
76
+ }
77
+ //# sourceMappingURL=ai-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-panel.js","sourceRoot":"","sources":["../../../../../src/internal/app/p/editor/ai-panel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,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AS,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;gCAAC,KAAK,CAAC,cAAc,EAAE,CAAC;gCAAC,KAAK,MAAM,EAAE,CAAC;4BAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAC,wBAAmB,EAAC,IAAI,EAAE,CAAC,EAAE,SAAS,EAAC,4GAA4G,GAAG,EAAA,iBAAQ,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,SAAS,EAAC,yGAAyG,YAAC,KAAC,WAAW,IAAC,IAAI,EAAE,EAAE,GAAI,GAAS,IAAM,GAAO,IACjyB,CAAC;AACX,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { type DataSource } from "@/lib/editor/types";
2
+ import type { SourceSample } from "./data-panel";
3
+ export type SourcePreview = {
4
+ status: "ok";
5
+ rows: Array<Record<string, unknown>>;
6
+ keys: string[];
7
+ total: number;
8
+ } | {
9
+ status: "error";
10
+ message: string;
11
+ };
12
+ export type SourcePreviewer = (source: DataSource, sampleQuery: string) => Promise<SourcePreview>;
13
+ /**
14
+ * The full request builder. A source has enough moving parts — URL, query,
15
+ * headers, the path into the payload, and the response itself — that editing
16
+ * it in a 240px rail meant guessing; here everything is visible at once.
17
+ */
18
+ export declare function DataSourceModal({ source, sample, onChange, onSample, onClose, preview, }: {
19
+ source: DataSource;
20
+ sample?: SourceSample;
21
+ onChange: (changes: Partial<DataSource>) => void;
22
+ onSample: (sample: SourceSample) => void;
23
+ onClose: () => void;
24
+ preview: SourcePreviewer;
25
+ }): import("react").JSX.Element;
26
+ //# sourceMappingURL=data-modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-modal.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app/p/editor/data-modal.tsx"],"names":[],"mappings":"AAYA,OAAO,EACH,KAAK,UAAU,EAKlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,aAAa,GACnB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrF;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3C,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAIlG;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAC5B,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,GACV,EAAE;IACC,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACjD,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,eAAe,CAAC;CAC5B,+BAsRA"}
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { IconAlertTriangle, IconCheck, IconPlayerPlay, IconPlus, IconTrash, IconX, } from "@tabler/icons-react";
4
+ import { AnimatePresence, motion } from "motion/react";
5
+ import { useEffect, useState, useTransition } from "react";
6
+ import { HTTP_METHODS, sendsBody, } from "@/lib/editor/types";
7
+ /**
8
+ * The full request builder. A source has enough moving parts — URL, query,
9
+ * headers, the path into the payload, and the response itself — that editing
10
+ * it in a 240px rail meant guessing; here everything is visible at once.
11
+ */
12
+ export function DataSourceModal({ source, sample, onChange, onSample, onClose, preview, }) {
13
+ const [tab, setTab] = useState("params");
14
+ const method = source.method ?? "GET";
15
+ const [error, setError] = useState(null);
16
+ const [rows, setRows] = useState(sample?.rows ?? []);
17
+ const [keys, setKeys] = useState(sample?.keys ?? []);
18
+ const [testQuery, setTestQuery] = useState("");
19
+ const [busy, startTest] = useTransition();
20
+ useEffect(() => {
21
+ const onKey = (event) => {
22
+ if (event.key === "Escape")
23
+ onClose();
24
+ };
25
+ window.addEventListener("keydown", onKey);
26
+ return () => window.removeEventListener("keydown", onKey);
27
+ }, [onClose]);
28
+ const bodyError = (() => {
29
+ if (!sendsBody(method))
30
+ return null;
31
+ const raw = source.body?.trim();
32
+ if (!raw)
33
+ return null;
34
+ // Tokens are not valid JSON on their own, so check the resolved shape
35
+ // with placeholders swapped for a string.
36
+ try {
37
+ JSON.parse(raw.replace(/{{[^}]*}}/g, "x"));
38
+ return null;
39
+ }
40
+ catch {
41
+ return "This is not valid JSON yet.";
42
+ }
43
+ })();
44
+ const run = () => {
45
+ startTest(async () => {
46
+ const result = await preview(source, testQuery);
47
+ if (result.status === "error") {
48
+ setError(result.message);
49
+ return;
50
+ }
51
+ setError(null);
52
+ setRows(result.rows);
53
+ setKeys(result.keys);
54
+ setTab("response");
55
+ onSample({ keys: result.keys, rows: result.rows });
56
+ });
57
+ };
58
+ return (_jsxs(motion.div, { className: "fixed inset-0 z-[200] flex items-center justify-center p-8", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.15 }, children: [_jsx("button", { type: "button", "aria-label": "Close dialog", tabIndex: -1, onClick: onClose, className: "absolute inset-0 cursor-default bg-black/60 backdrop-blur-sm" }), _jsxs(motion.div, { role: "dialog", "aria-modal": "true", "aria-label": `Data source: ${source.name}`, className: "relative flex h-full max-h-[680px] w-full max-w-[860px] flex-col overflow-hidden rounded-2xl border border-ed-border bg-ed-surface shadow-2xl", initial: { opacity: 0, scale: 0.97, y: 12 }, animate: { opacity: 1, scale: 1, y: 0 }, exit: { opacity: 0, scale: 0.97, y: 12 }, transition: { type: "spring", stiffness: 420, damping: 32 }, children: [_jsxs("header", { className: "flex shrink-0 items-center gap-3 border-b border-ed-border px-5 py-4", children: [_jsx("input", { type: "text", value: source.name, "aria-label": "Source name", onChange: (e) => onChange({ name: e.target.value }), className: "min-w-0 flex-1 bg-transparent text-[15px] font-semibold text-ed-text outline-none" }), _jsx("button", { type: "button", onClick: onClose, "aria-label": "Close", className: "rounded-lg p-1.5 text-ed-faint transition-colors hover:bg-ed-field hover:text-ed-text", children: _jsx(IconX, { size: 16 }) })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-2 border-b border-ed-border px-5 py-3", children: [_jsx("select", { "aria-label": "HTTP method", value: method, onChange: (e) => onChange({ method: e.target.value }), className: "shrink-0 cursor-pointer rounded-md bg-ed-field px-2 py-1.5 font-mono text-[11px] font-semibold text-ed-text outline-none [&>option]:bg-ed-surface", children: HTTP_METHODS.map((m) => (_jsx("option", { value: m, children: m }, m))) }), _jsx("input", { type: "text", value: source.url, "aria-label": "Request URL", placeholder: "https://api.example.com/posts", onChange: (e) => onChange({ url: e.target.value }), className: "min-w-0 flex-1 rounded-md bg-ed-field px-3 py-1.5 font-mono text-[12px] text-ed-text outline-none transition-colors focus:bg-ed-field-hover placeholder:text-ed-faint" }), _jsxs("button", { type: "button", onClick: run, disabled: busy, className: "flex shrink-0 items-center gap-1.5 rounded-md bg-ed-accent px-3.5 py-1.5 text-[12px] font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-50", children: [_jsx(IconPlayerPlay, { size: 13 }), busy ? "Sending…" : "Send"] }), _jsxs("select", { "aria-label": "Behavior when the API returns 404", value: source.onNotFound ?? "empty", onChange: (event) => onChange({
59
+ onNotFound: event.target.value,
60
+ }), title: "Choose what the published page does when this API returns 404", className: "shrink-0 cursor-pointer rounded-md bg-ed-field px-2 py-1.5 text-[11px] font-medium text-ed-muted outline-none [&>option]:bg-ed-surface", children: [_jsx("option", { value: "empty", children: "404: Keep page" }), _jsx("option", { value: "page-404", children: "404: Page not found" })] })] }), _jsx("nav", { className: "flex shrink-0 gap-1 border-b border-ed-border px-5", children: [
61
+ ["params", `Query${source.params?.length ? ` (${source.params.length})` : ""}`],
62
+ ...(sendsBody(method)
63
+ ? [["body", source.body?.trim() ? "Body •" : "Body"]]
64
+ : []),
65
+ ["headers", `Headers${source.headers?.length ? ` (${source.headers.length})` : ""}`],
66
+ ["response", `Response${rows.length ? ` (${rows.length})` : ""}`],
67
+ ].map(([value, label]) => (_jsxs("button", { type: "button", onClick: () => setTab(value), className: `relative px-3 py-2.5 text-[12px] transition-colors ${tab === value
68
+ ? "text-ed-text"
69
+ : "text-ed-muted hover:text-ed-text"}`, children: [label, tab === value && (_jsx(motion.span, { layoutId: "data-tab", className: "absolute inset-x-2 -bottom-px h-0.5 rounded-full bg-ed-accent", transition: { type: "spring", stiffness: 500, damping: 40 } }))] }, value))) }), _jsx("div", { className: "custom-scrollbar flex-1 overflow-y-auto px-5 py-4", children: _jsxs(motion.div, { initial: { opacity: 0, y: 6 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.14 }, children: [tab === "params" && (_jsx(PairTable, { pairs: source.params ?? [], valueHint: "value, {{query.id}} or {{params.slug}}", onChange: (params) => onChange({ params }), note: "Empty values are dropped, so an unset filter is simply not sent." })), tab === "body" && (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("textarea", { value: source.body ?? "", "aria-label": "Request body", spellCheck: false, placeholder: `{\n "title": "{{query.title}}"\n}`, onChange: (e) => onChange({ body: e.target.value }), className: "min-h-[280px] resize-y rounded-lg bg-ed-field p-3 font-mono text-[12px] leading-relaxed text-ed-text outline-none transition-colors focus:bg-ed-surface focus:ring-1 focus:ring-inset focus:ring-[var(--ed-accent)]/60 placeholder:text-ed-faint" }), _jsxs("p", { className: "text-[11px] leading-relaxed text-ed-faint", children: ["Sent as", " ", _jsx("code", { className: "rounded bg-ed-field px-1 font-mono", children: "application/json" }), ". Tokens work here too. A body is never cached, so the request runs on every render."] }), bodyError && (_jsxs("p", { className: "flex items-center gap-1.5 text-[11px] text-amber-500", children: [_jsx(IconAlertTriangle, { size: 13 }), bodyError] }))] })), tab === "headers" && (_jsx(PairTable, { pairs: source.headers ?? [], valueHint: "e.g. Bearer \u2026", onChange: (headers) => onChange({ headers }), note: "Headers are sent from the server, so a key never reaches the browser \u2014 but it is stored with the page, so treat it as shared with anyone who can edit this site." })), tab === "response" && (_jsx(ResponseView, { rows: rows, keys: keys, path: source.path, onPath: (path) => onChange({ path }) }))] }, tab) }), _jsxs("footer", { className: "flex shrink-0 items-center gap-3 border-t border-ed-border px-5 py-3", children: [_jsx("label", { htmlFor: "data-test-query", className: "shrink-0 text-[11px] text-ed-faint", children: "Test with" }), _jsx("input", { id: "data-test-query", type: "text", value: testQuery, placeholder: "uid=1&limit=5", onChange: (e) => setTestQuery(e.target.value), className: "min-w-0 flex-1 rounded-md bg-ed-field px-3 py-1.5 font-mono text-[11px] text-ed-text outline-none placeholder:text-ed-faint" }), _jsx(AnimatePresence, { children: error ? (_jsxs(motion.span, { initial: { opacity: 0, x: 6 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0 }, className: "flex items-center gap-1.5 text-[11px] text-red-400", children: [_jsx(IconAlertTriangle, { size: 13 }), error] }, "err")) : rows.length > 0 ? (_jsxs(motion.span, { initial: { opacity: 0, x: 6 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0 }, className: "flex items-center gap-1.5 text-[11px] text-emerald-500", children: [_jsx(IconCheck, { size: 13 }), rows.length, " rows"] }, "ok")) : null })] })] })] }));
70
+ }
71
+ function PairTable({ pairs, valueHint, note, onChange, }) {
72
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [pairs.map((pair, index) => (
73
+ // Rows are appended and deleted, never reordered, so position is
74
+ // a stable identity here.
75
+ // biome-ignore lint/suspicious/noArrayIndexKey: positional identity is stable for this list
76
+ _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("input", { type: "text", value: pair.key, "aria-label": "Name", placeholder: "name", onChange: (e) => onChange(pairs.map((p, i) => i === index ? { ...p, key: e.target.value } : p)), className: "w-[240px] shrink-0 rounded-md bg-ed-field px-3 py-2 font-mono text-[12px] text-ed-text outline-none transition-colors focus:bg-ed-field-hover placeholder:text-ed-faint" }), _jsx("input", { type: "text", value: pair.value, "aria-label": "Value", placeholder: valueHint, onChange: (e) => onChange(pairs.map((p, i) => i === index ? { ...p, value: e.target.value } : p)), className: "min-w-0 flex-1 rounded-md bg-ed-field px-3 py-2 font-mono text-[12px] text-ed-text outline-none transition-colors focus:bg-ed-field-hover placeholder:text-ed-faint" }), _jsx("button", { type: "button", "aria-label": "Remove row", onClick: () => onChange(pairs.filter((_, i) => i !== index)), className: "shrink-0 rounded-md p-2 text-ed-faint transition-colors hover:bg-ed-field hover:text-red-400", children: _jsx(IconTrash, { size: 13 }) })] }, index))), _jsxs("button", { type: "button", onClick: () => onChange([...pairs, { key: "", value: "" }]), className: "flex items-center justify-center gap-1.5 rounded-md border border-dashed border-ed-border py-2.5 text-[12px] text-ed-muted transition-colors hover:border-ed-accent hover:text-ed-text", children: [_jsx(IconPlus, { size: 14 }), "Add row"] }), _jsxs("p", { className: "pt-1 text-[11px] leading-relaxed text-ed-faint", children: [note, " Use", " ", _jsx("code", { className: "rounded bg-ed-field px-1 font-mono", children: "{{query.name}}" }), " ", "to read the visitor's URL, or", " ", _jsx("code", { className: "rounded bg-ed-field px-1 font-mono", children: "{{params.slug}}" }), " ", "for a dynamic path such as ", _jsx("span", { className: "text-ed-muted", children: "blog/:slug" }), ", or", " ", _jsx("code", { className: "rounded bg-ed-field px-1 font-mono", children: "{{page.slug}}" }), " ", "for the page."] })] }));
77
+ }
78
+ function ResponseView({ rows, keys, path, onPath, }) {
79
+ if (rows.length === 0) {
80
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center gap-2 py-16 text-center", children: [_jsx("p", { className: "text-[13px] text-ed-muted", children: "No response yet" }), _jsxs("p", { className: "max-w-[380px] text-[11px] leading-relaxed text-ed-faint", children: ["Press ", _jsx("b", { children: "Send" }), " to call the endpoint. If the list is nested inside the payload, set the path below \u2014 for example", " ", _jsx("code", { className: "rounded bg-ed-field px-1 font-mono", children: "data.items" }), "."] }), _jsx("input", { type: "text", value: path, "aria-label": "Path to the list", placeholder: "path to the list", onChange: (e) => onPath(e.target.value), className: "mt-2 w-[240px] rounded-md bg-ed-field px-3 py-2 text-center font-mono text-[12px] text-ed-text outline-none placeholder:text-ed-faint" })] }));
81
+ }
82
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("label", { htmlFor: "data-path", className: "shrink-0 text-[11px] text-ed-faint", children: "List path" }), _jsx("input", { id: "data-path", type: "text", value: path, placeholder: "(payload is already a list)", onChange: (e) => onPath(e.target.value), className: "min-w-0 flex-1 rounded-md bg-ed-field px-3 py-1.5 font-mono text-[12px] text-ed-text outline-none placeholder:text-ed-faint" })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-[11px] font-semibold uppercase tracking-wide text-ed-faint", children: "Fields you can bind" }), _jsx("div", { className: "flex flex-wrap gap-1.5", children: keys.map((key) => (_jsx("span", { className: "rounded-md bg-ed-field px-2 py-1 font-mono text-[11px] text-ed-muted", children: key }, key))) })] }), _jsxs("div", { children: [_jsx("p", { className: "mb-2 text-[11px] font-semibold uppercase tracking-wide text-ed-faint", children: "First rows" }), _jsx("div", { className: "overflow-x-auto rounded-lg border border-ed-border", children: _jsxs("table", { className: "w-full border-collapse text-left", children: [_jsx("thead", { children: _jsx("tr", { className: "border-b border-ed-border bg-ed-subtle", children: keys.map((key) => (_jsx("th", { className: "whitespace-nowrap px-3 py-2 font-mono text-[10px] font-semibold uppercase text-ed-faint", children: key }, key))) }) }), _jsx("tbody", { children: rows.slice(0, 6).map((row, index) => (
83
+ // Rows come from an API and have no guaranteed id.
84
+ // biome-ignore lint/suspicious/noArrayIndexKey: a response row has no stable key
85
+ _jsx("tr", { className: "border-b border-ed-border last:border-0", children: keys.map((key) => (_jsx("td", { className: "max-w-[220px] truncate px-3 py-2 text-[11px] text-ed-muted", children: formatCell(row[key]) }, key))) }, index))) })] }) })] })] }));
86
+ }
87
+ function formatCell(value) {
88
+ if (value === null || value === undefined)
89
+ return "—";
90
+ if (typeof value === "object")
91
+ return Array.isArray(value) ? "[…]" : "{…}";
92
+ return String(value);
93
+ }
94
+ //# sourceMappingURL=data-modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-modal.js","sourceRoot":"","sources":["../../../../../src/internal/app/p/editor/data-modal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACH,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,QAAQ,EACR,SAAS,EACT,KAAK,GACR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAEH,YAAY,EAGZ,SAAS,GACZ,MAAM,oBAAoB,CAAC;AAU5B;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,EAC5B,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,GAQV;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAM,QAAQ,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC;IACtC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAC5B,MAAM,EAAE,IAAI,IAAI,EAA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AAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAC3E,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { DataSource } from "@/lib/editor/types";
2
+ import { type SourcePreviewer } from "./data-modal";
3
+ export type SourceSample = {
4
+ keys: string[];
5
+ rows: Array<Record<string, unknown>>;
6
+ };
7
+ /**
8
+ * The rail lists sources and their state; editing one opens the modal, where
9
+ * the URL, query, headers and response all fit on screen at once.
10
+ */
11
+ export declare function DataPanel({ sources, samples, onChange, onSample, preview, }: {
12
+ sources: DataSource[];
13
+ samples: Record<string, SourceSample>;
14
+ onChange: (updater: (prev: DataSource[]) => DataSource[]) => void;
15
+ onSample: (sourceId: string, sample: SourceSample) => void;
16
+ preview: SourcePreviewer;
17
+ }): import("react").JSX.Element;
18
+ //# sourceMappingURL=data-panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-panel.d.ts","sourceRoot":"","sources":["../../../../../src/internal/app/p/editor/data-panel.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAE,CAAC;AAEpF;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACtB,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,GACV,EAAE;IACC,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,CAAC;IAClE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3D,OAAO,EAAE,eAAe,CAAC;CAC5B,+BA0GA"}