@webround/editor 0.0.0-stage → 0.3.0

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 (227) hide show
  1. package/dist/blocks.d.ts +90 -0
  2. package/dist/blocks.js +119 -0
  3. package/dist/bridge.d.ts +96 -0
  4. package/dist/bridge.js +970 -0
  5. package/dist/check/aria.d.ts +19 -0
  6. package/dist/check/aria.js +106 -0
  7. package/dist/check/cli.d.ts +3 -0
  8. package/dist/check/cli.js +30 -0
  9. package/dist/check/css.d.ts +13 -0
  10. package/dist/check/css.js +63 -0
  11. package/dist/check/html.d.ts +8 -0
  12. package/dist/check/html.js +29 -0
  13. package/dist/check/index.d.ts +4 -0
  14. package/dist/check/index.js +5 -0
  15. package/dist/check/links.d.ts +7 -0
  16. package/dist/check/links.js +23 -0
  17. package/dist/check/orphans.d.ts +20 -0
  18. package/dist/check/orphans.js +57 -0
  19. package/dist/check/producer-code.d.ts +53 -0
  20. package/dist/check/producer-code.js +379 -0
  21. package/dist/check/producer-dom.d.ts +21 -0
  22. package/dist/check/producer-dom.js +52 -0
  23. package/dist/check/project.d.ts +20 -0
  24. package/dist/check/project.js +51 -0
  25. package/dist/check/rules.d.ts +7 -0
  26. package/dist/check/rules.js +517 -0
  27. package/dist/check/types.d.ts +160 -0
  28. package/dist/check/types.js +22 -0
  29. package/dist/components/WrAltcha.d.ts +5 -0
  30. package/dist/components/WrAltcha.js +8 -0
  31. package/dist/components/WrButton.d.ts +8 -0
  32. package/dist/components/WrButton.js +34 -0
  33. package/dist/components/WrForm.d.ts +6 -0
  34. package/dist/components/WrForm.js +29 -0
  35. package/dist/components/WrFormPrivacy.d.ts +4 -0
  36. package/dist/components/WrFormPrivacy.js +7 -0
  37. package/dist/components/WrFormSuccess.d.ts +4 -0
  38. package/dist/components/WrFormSuccess.js +12 -0
  39. package/dist/components/WrIframe.d.ts +12 -0
  40. package/dist/components/WrIframe.js +30 -0
  41. package/dist/components/WrImage.d.ts +9 -0
  42. package/dist/components/WrImage.js +28 -0
  43. package/dist/components/WrInput.d.ts +8 -0
  44. package/dist/components/WrInput.js +29 -0
  45. package/dist/components/WrLink.d.ts +10 -0
  46. package/dist/components/WrLink.js +38 -0
  47. package/dist/components/WrNav.d.ts +26 -0
  48. package/dist/components/WrNav.js +30 -0
  49. package/dist/components/WrSection.d.ts +11 -0
  50. package/dist/components/WrSection.js +5 -0
  51. package/dist/components/WrShared.d.ts +12 -0
  52. package/dist/components/WrShared.js +20 -0
  53. package/dist/components/WrText.d.ts +11 -0
  54. package/dist/components/WrText.js +41 -0
  55. package/dist/components/WrVideo.d.ts +9 -0
  56. package/dist/components/WrVideo.js +73 -0
  57. package/dist/components/text-editor/CodeThemeContext.d.ts +8 -0
  58. package/dist/components/text-editor/CodeThemeContext.js +10 -0
  59. package/dist/components/text-editor/ExampleTheme.d.ts +77 -0
  60. package/dist/components/text-editor/ExampleTheme.js +76 -0
  61. package/dist/components/text-editor/ToolbarContext.d.ts +17 -0
  62. package/dist/components/text-editor/ToolbarContext.js +32 -0
  63. package/dist/components/text-editor/WrTextEditor.d.ts +13 -0
  64. package/dist/components/text-editor/WrTextEditor.js +48 -0
  65. package/dist/components/text-editor/common/constants.d.ts +109 -0
  66. package/dist/components/text-editor/common/constants.js +58 -0
  67. package/dist/components/text-editor/common/surface.d.ts +3 -0
  68. package/dist/components/text-editor/common/surface.js +8 -0
  69. package/dist/components/text-editor/common/utils.d.ts +7 -0
  70. package/dist/components/text-editor/common/utils.js +78 -0
  71. package/dist/components/text-editor/hooks/useLexicalCommitOnBlur.d.ts +5 -0
  72. package/dist/components/text-editor/hooks/useLexicalCommitOnBlur.js +41 -0
  73. package/dist/components/text-editor/hooks/useLexicalMarkdown.d.ts +33 -0
  74. package/dist/components/text-editor/hooks/useLexicalMarkdown.js +284 -0
  75. package/dist/components/text-editor/nodes/CodeBlockNode.d.ts +23 -0
  76. package/dist/components/text-editor/nodes/CodeBlockNode.js +138 -0
  77. package/dist/components/text-editor/nodes/HorizontalRuleNode.d.ts +13 -0
  78. package/dist/components/text-editor/nodes/HorizontalRuleNode.js +22 -0
  79. package/dist/components/text-editor/plugins/CodeBlockPlugin.d.ts +2 -0
  80. package/dist/components/text-editor/plugins/CodeBlockPlugin.js +38 -0
  81. package/dist/components/text-editor/plugins/FontPlugin.d.ts +12 -0
  82. package/dist/components/text-editor/plugins/FontPlugin.js +114 -0
  83. package/dist/components/text-editor/plugins/FontSizePlugin.d.ts +7 -0
  84. package/dist/components/text-editor/plugins/FontSizePlugin.js +105 -0
  85. package/dist/components/text-editor/plugins/FontWeightPlugin.d.ts +6 -0
  86. package/dist/components/text-editor/plugins/FontWeightPlugin.js +103 -0
  87. package/dist/components/text-editor/plugins/HTMLTagPlugin.d.ts +7 -0
  88. package/dist/components/text-editor/plugins/HTMLTagPlugin.js +82 -0
  89. package/dist/components/text-editor/plugins/HorizontalRulePlugin.d.ts +2 -0
  90. package/dist/components/text-editor/plugins/HorizontalRulePlugin.js +35 -0
  91. package/dist/components/text-editor/plugins/LineSpacingPlugin.d.ts +7 -0
  92. package/dist/components/text-editor/plugins/LineSpacingPlugin.js +83 -0
  93. package/dist/components/text-editor/plugins/LinkPlugin.d.ts +8 -0
  94. package/dist/components/text-editor/plugins/LinkPlugin.js +183 -0
  95. package/dist/components/text-editor/plugins/ListToolbarPlugin.d.ts +7 -0
  96. package/dist/components/text-editor/plugins/ListToolbarPlugin.js +40 -0
  97. package/dist/components/text-editor/plugins/LoadContentPlugin.d.ts +4 -0
  98. package/dist/components/text-editor/plugins/LoadContentPlugin.js +63 -0
  99. package/dist/components/text-editor/plugins/MarkdownExportPlugin.d.ts +4 -0
  100. package/dist/components/text-editor/plugins/MarkdownExportPlugin.js +17 -0
  101. package/dist/components/text-editor/plugins/MarkdownPastePlugin.d.ts +2 -0
  102. package/dist/components/text-editor/plugins/MarkdownPastePlugin.js +45 -0
  103. package/dist/components/text-editor/plugins/SanitizePastePlugin.d.ts +3 -0
  104. package/dist/components/text-editor/plugins/SanitizePastePlugin.js +40 -0
  105. package/dist/components/text-editor/plugins/TextAlignPlugin.d.ts +7 -0
  106. package/dist/components/text-editor/plugins/TextAlignPlugin.js +65 -0
  107. package/dist/components/text-editor/plugins/TextColorPlugin.d.ts +7 -0
  108. package/dist/components/text-editor/plugins/TextColorPlugin.js +117 -0
  109. package/dist/components/text-editor/plugins/ToolbarPlugin.d.ts +10 -0
  110. package/dist/components/text-editor/plugins/ToolbarPlugin.js +73 -0
  111. package/dist/components/text-editor/theme-colors.d.ts +11 -0
  112. package/dist/components/text-editor/theme-colors.js +28 -0
  113. package/dist/context/WrAppContext.d.ts +35 -0
  114. package/dist/context/WrAppContext.js +113 -0
  115. package/dist/context/WrLayout.d.ts +15 -0
  116. package/dist/context/WrLayout.js +22 -0
  117. package/dist/context/WrPageContext.d.ts +28 -0
  118. package/dist/context/WrPageContext.js +282 -0
  119. package/dist/context/restoreValues.d.ts +2 -0
  120. package/dist/context/restoreValues.js +6 -0
  121. package/dist/contrast.d.ts +45 -0
  122. package/dist/contrast.js +122 -0
  123. package/dist/drop.d.ts +7 -0
  124. package/dist/drop.js +51 -0
  125. package/dist/gaps.d.ts +14 -0
  126. package/dist/gaps.js +50 -0
  127. package/dist/hooks/useWrMessage.d.ts +5 -0
  128. package/dist/hooks/useWrMessage.js +24 -0
  129. package/dist/hooks/useWrSave.d.ts +2 -0
  130. package/dist/hooks/useWrSave.js +11 -0
  131. package/dist/index.css +467 -0
  132. package/dist/index.d.ts +20 -0
  133. package/dist/index.js +20 -0
  134. package/dist/interactive.d.ts +8 -0
  135. package/dist/interactive.js +13 -0
  136. package/dist/measure-rules.d.ts +34 -0
  137. package/dist/measure-rules.js +54 -0
  138. package/dist/measure.d.ts +11 -0
  139. package/dist/measure.js +139 -0
  140. package/dist/messages.d.ts +860 -0
  141. package/dist/messages.js +2 -0
  142. package/dist/nav.d.ts +5 -0
  143. package/dist/nav.js +10 -0
  144. package/dist/operations/animations-store.d.ts +6 -0
  145. package/dist/operations/animations-store.js +63 -0
  146. package/dist/operations/cli.d.ts +3 -0
  147. package/dist/operations/cli.js +52 -0
  148. package/dist/operations/comments-store.d.ts +17 -0
  149. package/dist/operations/comments-store.js +62 -0
  150. package/dist/operations/context.d.ts +12 -0
  151. package/dist/operations/context.js +35 -0
  152. package/dist/operations/define.d.ts +81 -0
  153. package/dist/operations/define.js +86 -0
  154. package/dist/operations/index.d.ts +6 -0
  155. package/dist/operations/index.js +6 -0
  156. package/dist/operations/ops/check.d.ts +5 -0
  157. package/dist/operations/ops/check.js +53 -0
  158. package/dist/operations/ops/comments.d.ts +6 -0
  159. package/dist/operations/ops/comments.js +133 -0
  160. package/dist/operations/ops/content.d.ts +16 -0
  161. package/dist/operations/ops/content.js +73 -0
  162. package/dist/operations/ops/json.d.ts +4 -0
  163. package/dist/operations/ops/json.js +27 -0
  164. package/dist/operations/ops/langs.d.ts +4 -0
  165. package/dist/operations/ops/langs.js +32 -0
  166. package/dist/operations/ops/nodes.d.ts +8 -0
  167. package/dist/operations/ops/nodes.js +270 -0
  168. package/dist/operations/ops/pages.d.ts +8 -0
  169. package/dist/operations/ops/pages.js +154 -0
  170. package/dist/operations/ops/project.d.ts +36 -0
  171. package/dist/operations/ops/project.js +97 -0
  172. package/dist/operations/ops/seo.d.ts +17 -0
  173. package/dist/operations/ops/seo.js +358 -0
  174. package/dist/operations/ops/style.d.ts +76 -0
  175. package/dist/operations/ops/style.js +268 -0
  176. package/dist/operations/ops/stylesets.d.ts +9 -0
  177. package/dist/operations/ops/stylesets.js +145 -0
  178. package/dist/operations/ops/theme.d.ts +6 -0
  179. package/dist/operations/ops/theme.js +304 -0
  180. package/dist/operations/registry.d.ts +8 -0
  181. package/dist/operations/registry.js +19 -0
  182. package/dist/operations/stylesets-store.d.ts +50 -0
  183. package/dist/operations/stylesets-store.js +216 -0
  184. package/dist/registry.d.ts +5 -0
  185. package/dist/registry.js +24 -0
  186. package/dist/save.d.ts +65 -0
  187. package/dist/save.js +86 -0
  188. package/dist/schema.d.ts +69 -0
  189. package/dist/schema.js +110 -0
  190. package/dist/scope.d.ts +41 -0
  191. package/dist/scope.js +44 -0
  192. package/dist/vite-plugins/ast.d.ts +3 -0
  193. package/dist/vite-plugins/ast.js +238 -0
  194. package/dist/vite-plugins/core-swap.d.ts +3 -0
  195. package/dist/vite-plugins/core-swap.js +57 -0
  196. package/dist/vite-plugins/create-page.d.ts +4 -0
  197. package/dist/vite-plugins/create-page.js +59 -0
  198. package/dist/vite-plugins/guard.d.ts +15 -0
  199. package/dist/vite-plugins/guard.js +35 -0
  200. package/dist/vite-plugins/head.d.ts +13 -0
  201. package/dist/vite-plugins/head.js +53 -0
  202. package/dist/vite-plugins/index.d.ts +7 -0
  203. package/dist/vite-plugins/index.js +7 -0
  204. package/dist/vite-plugins/jsx-tree.d.ts +118 -0
  205. package/dist/vite-plugins/jsx-tree.js +686 -0
  206. package/dist/vite-plugins/langs.d.ts +3 -0
  207. package/dist/vite-plugins/langs.js +44 -0
  208. package/dist/vite-plugins/operations.d.ts +10 -0
  209. package/dist/vite-plugins/operations.js +66 -0
  210. package/dist/vite-plugins/pages-api.d.ts +3 -0
  211. package/dist/vite-plugins/pages-api.js +112 -0
  212. package/dist/vite-plugins/pages.d.ts +3 -0
  213. package/dist/vite-plugins/pages.js +64 -0
  214. package/dist/vite-plugins/read.d.ts +3 -0
  215. package/dist/vite-plugins/read.js +45 -0
  216. package/dist/vite-plugins/seo-files.d.ts +8 -0
  217. package/dist/vite-plugins/seo-files.js +42 -0
  218. package/dist/vite-plugins/theme.d.ts +3 -0
  219. package/dist/vite-plugins/theme.js +207 -0
  220. package/dist/vite-plugins/update.d.ts +3 -0
  221. package/dist/vite-plugins/update.js +46 -0
  222. package/dist/vite-plugins/wr-plugins.d.ts +15 -0
  223. package/dist/vite-plugins/wr-plugins.js +34 -0
  224. package/dist/vite-plugins.d.ts +11 -0
  225. package/dist/vite-plugins.js +518 -0
  226. package/package.json +96 -5
  227. package/README.md +0 -3
@@ -0,0 +1,90 @@
1
+ export type WrBlockCategory = 'layout' | 'element' | 'section';
2
+ export interface WrBlock {
3
+ /** Anche la chiave dei testi (etichetta e descrizione) nell'editor, e della sua icona. */
4
+ id: string;
5
+ category: WrBlockCategory;
6
+ /** Markup JSX da inserire: uno o più elementi, tutti componenti Wr* al primo livello se deve essere annullabile. */
7
+ jsx: string;
8
+ }
9
+ export declare const WR_BLOCKS: readonly [{
10
+ readonly id: "section";
11
+ readonly category: WrBlockCategory;
12
+ readonly jsx: string;
13
+ }, {
14
+ readonly id: "container";
15
+ readonly category: WrBlockCategory;
16
+ readonly jsx: string;
17
+ }, {
18
+ readonly id: "stack";
19
+ readonly category: WrBlockCategory;
20
+ readonly jsx: string;
21
+ }, {
22
+ readonly id: "row";
23
+ readonly category: WrBlockCategory;
24
+ readonly jsx: string;
25
+ }, {
26
+ readonly id: "columns-2";
27
+ readonly category: WrBlockCategory;
28
+ readonly jsx: string;
29
+ }, {
30
+ readonly id: "columns-3";
31
+ readonly category: WrBlockCategory;
32
+ readonly jsx: string;
33
+ }, {
34
+ readonly id: "grid";
35
+ readonly category: WrBlockCategory;
36
+ readonly jsx: string;
37
+ }, {
38
+ readonly id: "heading";
39
+ readonly category: WrBlockCategory;
40
+ readonly jsx: string;
41
+ }, {
42
+ readonly id: "text";
43
+ readonly category: WrBlockCategory;
44
+ readonly jsx: string;
45
+ }, {
46
+ readonly id: "button";
47
+ readonly category: WrBlockCategory;
48
+ readonly jsx: string;
49
+ }, {
50
+ readonly id: "link";
51
+ readonly category: WrBlockCategory;
52
+ readonly jsx: string;
53
+ }, {
54
+ readonly id: "image";
55
+ readonly category: WrBlockCategory;
56
+ readonly jsx: string;
57
+ }, {
58
+ readonly id: "video";
59
+ readonly category: WrBlockCategory;
60
+ readonly jsx: string;
61
+ }, {
62
+ readonly id: "contact-form";
63
+ readonly category: WrBlockCategory;
64
+ readonly jsx: string;
65
+ }, {
66
+ readonly id: "embed";
67
+ readonly category: WrBlockCategory;
68
+ readonly jsx: string;
69
+ }, {
70
+ readonly id: "hero";
71
+ readonly category: WrBlockCategory;
72
+ readonly jsx: string;
73
+ }, {
74
+ readonly id: "features";
75
+ readonly category: WrBlockCategory;
76
+ readonly jsx: string;
77
+ }, {
78
+ readonly id: "image-text";
79
+ readonly category: WrBlockCategory;
80
+ readonly jsx: string;
81
+ }, {
82
+ readonly id: "cta";
83
+ readonly category: WrBlockCategory;
84
+ readonly jsx: string;
85
+ }];
86
+ export type WrBlockId = (typeof WR_BLOCKS)[number]['id'];
87
+ export declare const WR_BLOCK_CATEGORIES: readonly WrBlockCategory[];
88
+ /** I blocchi di una categoria, nell'ordine del catalogo. */
89
+ export declare const blocksOf: (category: WrBlockCategory, blocks?: readonly WrBlock[]) => WrBlock[];
90
+ //# sourceMappingURL=blocks.d.ts.map
package/dist/blocks.js ADDED
@@ -0,0 +1,119 @@
1
+ // Il catalogo dei blocchi che l'editor sa aggiungere a una pagina.
2
+ //
3
+ // Un blocco è DATO, non logica: un id, una categoria e del JSX. Quel JSX è lo stesso che uno sviluppatore scriverebbe a mano o che
4
+ // un'AI produrrebbe (vedi INSERT.md): l'interfaccia lo manda così com'è a `wr:node:insert`, e il plugin sceglie gli id liberi, indenta
5
+ // e importa. Aggiungere un blocco = aggiungere una voce qui, senza toccare altro.
6
+ //
7
+ // Regole dei blocchi (le stesse da seguire scrivendone di nuovi):
8
+ // - Layout con classi Tailwind, mobile-first: la base è il telefono, `md:` il tablet, `lg:` il desktop. Niente `style` inline.
9
+ // - Colori solo dai token semantici del template (bg-page, text-fg, text-muted, bg-surface, border-line, bg-accent, text-on-accent…):
10
+ // seguono il tema chiaro e scuro del sito senza varianti `dark:`.
11
+ // - Il testo iniziale sta nel codice (`html="…"` su WrText, i figli su WrLink e WrButton), non in JSON: il JSON nasce solo
12
+ // quando l'utente lo modifica o lo traduce. Per questo un blocco non porta mai valori JSON con sé.
13
+ // - Gli id dicono cosa sono; se già presi il plugin li rinumera.
14
+ const block = (id, category, jsx) => ({ id, category, jsx: jsx.trim() });
15
+ export const WR_BLOCKS = [
16
+ // ── Layout ─────────────────────────────────────────────────────────────
17
+ block('section', 'layout', `
18
+ <WrSection id="section" className="flex flex-col gap-6 px-6 py-16" />`),
19
+ block('container', 'layout', `
20
+ <WrSection id="container" className="mx-auto flex w-full max-w-5xl flex-col gap-6 px-6" />`),
21
+ block('stack', 'layout', `
22
+ <WrSection id="stack" className="flex flex-col gap-4" />`),
23
+ block('row', 'layout', `
24
+ <WrSection id="row" className="flex flex-col gap-4 md:flex-row md:items-center" />`),
25
+ block('columns-2', 'layout', `
26
+ <WrSection id="columns" className="mx-auto grid w-full max-w-5xl grid-cols-1 gap-6 px-6 py-12 md:grid-cols-2">
27
+ <WrSection id="column-a" className="flex flex-col gap-4" />
28
+ <WrSection id="column-b" className="flex flex-col gap-4" />
29
+ </WrSection>`),
30
+ block('columns-3', 'layout', `
31
+ <WrSection id="columns" className="mx-auto grid w-full max-w-5xl grid-cols-1 gap-6 px-6 py-12 md:grid-cols-3">
32
+ <WrSection id="column-a" className="flex flex-col gap-4" />
33
+ <WrSection id="column-b" className="flex flex-col gap-4" />
34
+ <WrSection id="column-c" className="flex flex-col gap-4" />
35
+ </WrSection>`),
36
+ block('grid', 'layout', `
37
+ <WrSection id="grid" className="mx-auto grid w-full max-w-5xl grid-cols-1 gap-6 px-6 py-12 sm:grid-cols-2 lg:grid-cols-4">
38
+ <WrSection id="cell-a" className="flex flex-col gap-4" />
39
+ <WrSection id="cell-b" className="flex flex-col gap-4" />
40
+ <WrSection id="cell-c" className="flex flex-col gap-4" />
41
+ <WrSection id="cell-d" className="flex flex-col gap-4" />
42
+ </WrSection>`),
43
+ // ── Elementi ───────────────────────────────────────────────────────────
44
+ block('heading', 'element', `
45
+ <WrText id="heading" className="text-3xl font-bold tracking-tight text-fg md:text-4xl" html="<h2 class='editor-heading-h2'>Titolo della sezione</h2>" />`),
46
+ block('text', 'element', `
47
+ <WrText id="text" className="text-base text-muted" html="<p class='editor-paragraph'>Scrivi qui il tuo testo.</p>" />`),
48
+ block('button', 'element', `
49
+ <WrButton id="button" className="rounded-full bg-accent px-6 py-3 font-semibold text-on-accent transition-colors hover:bg-accent-hover">Pulsante</WrButton>`),
50
+ block('link', 'element', `
51
+ <WrLink id="link" href="#" className="font-medium text-accent-text">Link</WrLink>`),
52
+ block('image', 'element', `
53
+ <WrImage id="image" src="https://placehold.co/1200x800?text=Immagine" className="h-auto w-full rounded-xl object-cover" />`),
54
+ block('video', 'element', `
55
+ <WrVideo id="video" controls className="aspect-video w-full rounded-xl bg-surface-2" />`),
56
+ block('contact-form', 'section', `
57
+ <WrSection id="contact" className="mx-auto flex w-full max-w-xl flex-col gap-6 px-6 py-16">
58
+ <WrText id="contact-title" className="text-3xl font-bold tracking-tight text-fg" html="<h2 class='editor-heading-h2'>Scrivici</h2>" />
59
+ <WrForm id="contact-form" className="flex flex-col gap-4">
60
+ <WrInput id="contact-name" type="text" required className="w-full rounded-xl border border-line bg-page px-4 py-3 text-fg placeholder:text-muted focus:outline-none focus:ring-2 focus:ring-accent" label="Nome" placeholder="Il tuo nome" />
61
+ <WrInput id="contact-email" type="email" required className="w-full rounded-xl border border-line bg-page px-4 py-3 text-fg placeholder:text-muted focus:outline-none focus:ring-2 focus:ring-accent" label="Email" placeholder="nome@esempio.it" />
62
+ <WrInput id="contact-message" type="textarea" required className="w-full rounded-xl border border-line bg-page px-4 py-3 text-fg placeholder:text-muted focus:outline-none focus:ring-2 focus:ring-accent" label="Messaggio" placeholder="Come possiamo aiutarti?" />
63
+ <WrAltcha id="contact-altcha" />
64
+ <WrFormPrivacy id="contact-privacy">
65
+ <WrText id="contact-privacy-text" html="<p class='editor-paragraph'>Ho letto la <a href='/privacy-policy'>privacy policy</a> e acconsento al trattamento dei miei dati.</p>" />
66
+ </WrFormPrivacy>
67
+ <WrButton id="contact-send" type="submit" className="mx-auto rounded-full bg-accent px-6 py-3 font-semibold text-on-accent transition-colors hover:bg-accent-hover disabled:cursor-not-allowed disabled:opacity-50">Invia</WrButton>
68
+ <WrFormSuccess id="contact-success" className="rounded-xl border border-line bg-surface p-6 text-center">
69
+ <WrText id="contact-success-text" className="text-fg" html="<p class='editor-paragraph'>Grazie! Abbiamo ricevuto il tuo messaggio.</p>" />
70
+ </WrFormSuccess>
71
+ </WrForm>
72
+ </WrSection>`),
73
+ block('embed', 'element', `
74
+ <WrIframe id="embed" src="about:blank" title="Contenuto incorporato" allowFullScreen className="aspect-video w-full rounded-xl border border-line bg-surface-2" />`),
75
+ // ── Sezioni (composizioni pronte) ──────────────────────────────────────
76
+ block('hero', 'section', `
77
+ <WrSection id="hero" className="flex flex-col items-center gap-6 px-6 py-20 text-center md:py-28">
78
+ <WrText id="hero-title" className="max-w-3xl text-4xl font-extrabold tracking-tight text-fg md:text-6xl" html="<h1 class='editor-heading-h1'>Un titolo che dice tutto</h1>" />
79
+ <WrText id="hero-text" className="max-w-xl text-lg text-muted" html="<p class='editor-paragraph'>Una frase che spiega cosa offri e perché valga la pena restare.</p>" />
80
+ <WrLink id="hero-cta" href="#" className="rounded-full bg-accent px-7 py-3 font-semibold text-on-accent transition-colors hover:bg-accent-hover">Inizia</WrLink>
81
+ </WrSection>`),
82
+ block('features', 'section', `
83
+ <WrSection id="features" className="mx-auto flex w-full max-w-5xl flex-col gap-10 px-6 py-16">
84
+ <WrText id="features-title" className="text-center text-3xl font-bold tracking-tight text-fg md:text-4xl" html="<h2 class='editor-heading-h2'>Perché sceglierci</h2>" />
85
+ <WrSection id="features-grid" className="grid grid-cols-1 gap-6 md:grid-cols-3">
86
+ <WrSection id="feature-1" className="flex flex-col gap-2 rounded-xl border border-line bg-surface p-6">
87
+ <WrText id="feature-1-title" className="text-lg font-semibold text-fg" html="<h3 class='editor-heading-h3'>Primo vantaggio</h3>" />
88
+ <WrText id="feature-1-text" className="text-muted" html="<p class='editor-paragraph'>Spiega in poche parole di cosa si tratta.</p>" />
89
+ </WrSection>
90
+ <WrSection id="feature-2" className="flex flex-col gap-2 rounded-xl border border-line bg-surface p-6">
91
+ <WrText id="feature-2-title" className="text-lg font-semibold text-fg" html="<h3 class='editor-heading-h3'>Secondo vantaggio</h3>" />
92
+ <WrText id="feature-2-text" className="text-muted" html="<p class='editor-paragraph'>Spiega in poche parole di cosa si tratta.</p>" />
93
+ </WrSection>
94
+ <WrSection id="feature-3" className="flex flex-col gap-2 rounded-xl border border-line bg-surface p-6">
95
+ <WrText id="feature-3-title" className="text-lg font-semibold text-fg" html="<h3 class='editor-heading-h3'>Terzo vantaggio</h3>" />
96
+ <WrText id="feature-3-text" className="text-muted" html="<p class='editor-paragraph'>Spiega in poche parole di cosa si tratta.</p>" />
97
+ </WrSection>
98
+ </WrSection>
99
+ </WrSection>`),
100
+ block('image-text', 'section', `
101
+ <WrSection id="image-text" className="mx-auto grid w-full max-w-5xl grid-cols-1 items-center gap-10 px-6 py-16 md:grid-cols-2">
102
+ <WrImage id="image-text-image" src="https://placehold.co/1200x900?text=Immagine" className="h-auto w-full rounded-xl object-cover" />
103
+ <WrSection id="image-text-body" className="flex flex-col items-start gap-4">
104
+ <WrText id="image-text-title" className="text-3xl font-bold tracking-tight text-fg" html="<h2 class='editor-heading-h2'>Racconta la tua storia</h2>" />
105
+ <WrText id="image-text-text" className="text-muted" html="<p class='editor-paragraph'>Un paragrafo accanto a un'immagine funziona sempre.</p>" />
106
+ <WrLink id="image-text-cta" href="#" className="font-medium text-accent-text">Scopri di più</WrLink>
107
+ </WrSection>
108
+ </WrSection>`),
109
+ block('cta', 'section', `
110
+ <WrSection id="cta" className="mx-auto my-16 flex w-full max-w-4xl flex-col items-center gap-5 rounded-2xl bg-accent-soft px-6 py-14 text-center">
111
+ <WrText id="cta-title" className="text-3xl font-bold tracking-tight text-fg" html="<h2 class='editor-heading-h2'>Pronto a iniziare?</h2>" />
112
+ <WrText id="cta-text" className="max-w-xl text-muted" html="<p class='editor-paragraph'>Invita a fare il passo successivo con una frase chiara.</p>" />
113
+ <WrButton id="cta-button" className="rounded-full bg-accent px-7 py-3 font-semibold text-on-accent transition-colors hover:bg-accent-hover">Contattaci</WrButton>
114
+ </WrSection>`),
115
+ ];
116
+ export const WR_BLOCK_CATEGORIES = ['layout', 'element', 'section'];
117
+ /** I blocchi di una categoria, nell'ordine del catalogo. */
118
+ export const blocksOf = (category, blocks = WR_BLOCKS) => blocks.filter(b => b.category === category);
119
+ //# sourceMappingURL=blocks.js.map
@@ -0,0 +1,96 @@
1
+ import { type WrScope } from './scope';
2
+ import type { WrEditorOutbound, WrAnchor, WrAnchorMode, WrStyleGetResponse } from './messages';
3
+ export declare function setWrNavigate(navigate: (to: string) => void): void;
4
+ export declare function setWrHistory(undo: () => void, redo: () => void): void;
5
+ export declare function setWrPageFile(file: string): void;
6
+ export declare function setWrPageName(pageName: string): void;
7
+ declare let wrAstHistoryPush: ((elementId: string, key: string, prevValue: string | boolean | number | undefined, nextValue: string | boolean | number, scope: WrScope) => void) | null;
8
+ export declare function setWrAstHistoryPush(fn: typeof wrAstHistoryPush): void;
9
+ declare let wrStyleHistoryPush: ((elementId: string, prevClassName: string, nextClassName: string, scope: WrScope) => void) | null;
10
+ export declare function setWrStyleHistoryPush(fn: typeof wrStyleHistoryPush): void;
11
+ export interface WrNodeHistoryEntry {
12
+ op: 'insert' | 'delete';
13
+ /** File e JSON su cui è stato fatto: l'undo e il redo lavorano lì, ovunque sia chi li chiede. */
14
+ scope: WrScope;
15
+ /** Radici coinvolte: una per la delete, una o più per l'insert (l'undo le rimuove tutte). */
16
+ elementIds: string[];
17
+ jsx: string;
18
+ anchor: WrAnchor | null;
19
+ anchorMode: WrAnchorMode;
20
+ /** Solo per op 'delete': id di tutto il sottoalbero rimosso, per leggerne i valori JSON correnti. */
21
+ removedIds?: string[];
22
+ /** Solo per op 'insert': valori JSON iniziali dei nuovi nodi. */
23
+ jsonSeed?: Record<string, unknown>;
24
+ }
25
+ /** Uno spostamento: l'undo lo rifà al contrario, e il redo lo ripete. */
26
+ export interface WrMoveHistoryEntry {
27
+ scope: WrScope;
28
+ elementId: string;
29
+ from: {
30
+ anchor: WrAnchor;
31
+ mode: WrAnchorMode;
32
+ };
33
+ to: {
34
+ anchor: WrAnchor;
35
+ mode: WrAnchorMode;
36
+ };
37
+ }
38
+ declare let wrMoveHistoryPush: ((entry: WrMoveHistoryEntry) => void) | null;
39
+ export declare function setWrMoveHistoryPush(fn: typeof wrMoveHistoryPush): void;
40
+ declare let wrNodeHistoryPush: ((entry: WrNodeHistoryEntry) => void) | null;
41
+ export declare function setWrNodeHistoryPush(fn: typeof wrNodeHistoryPush): void;
42
+ export declare function fetchNode(elementId: string, scope?: WrScope | null): Promise<{
43
+ fields: string[];
44
+ values: Record<string, string | boolean | number>;
45
+ }>;
46
+ /** Come è stilato un elemento (le sue classi, per proprietà e breakpoint), nella forma che l'editor mostra. */
47
+ export declare function fetchStyle(elementId: string, scope?: WrScope | null): Promise<WrStyleGetResponse>;
48
+ /** Rimette le classi di un elemento esattamente come dette (l'undo e il redo di una modifica di stile). */
49
+ export declare function restoreStyle(elementId: string, className: string, scope?: WrScope | null): Promise<boolean>;
50
+ /** value === null rimuove l'attributo (usato solo internamente, dall'undo). */
51
+ export declare function putNode(elementId: string, key: string, value: string | boolean | number | null, scope?: WrScope | null): Promise<boolean>;
52
+ /** Cancella il nodo intero (e i suoi discendenti) dal TSX. Ritorna anche cosa/dove, per l'undo. */
53
+ export interface DeletedNode {
54
+ removedIds: string[];
55
+ removedJsx: string;
56
+ anchor: WrAnchor | null;
57
+ anchorMode: WrAnchorMode;
58
+ }
59
+ /**
60
+ * `{ error }` = l'operazione non l'ha cancellato e dice perché (es. la radice di un header); `null` = niente da fare (nessun file).
61
+ * Insieme al nodo se ne vanno i valori JSON suoi e dei discendenti: lo fa l'operazione, per tutti.
62
+ */
63
+ export declare function deleteNode(elementId: string, scope?: WrScope | null): Promise<DeletedNode | {
64
+ error: string;
65
+ } | null>;
66
+ export interface InsertRawResult {
67
+ ok: boolean;
68
+ ids: string[];
69
+ rootIds: string[];
70
+ undoable: boolean;
71
+ idMap: Record<string, string>;
72
+ /** Il markup come è finito nel file (id finali): quello che un redo deve reinserire. */
73
+ jsx: string;
74
+ code?: string;
75
+ error?: string;
76
+ }
77
+ /** Sposta un elemento (con ciò che contiene) in un altro punto dello stesso file. Ritorna dov'era, per annullare. */
78
+ export type MoveNodeResult = {
79
+ ok: true;
80
+ from: {
81
+ anchor: WrAnchor;
82
+ mode: WrAnchorMode;
83
+ };
84
+ } | {
85
+ ok: false;
86
+ code?: string;
87
+ error: string;
88
+ };
89
+ export declare function moveNode(elementId: string, anchor: WrAnchor, anchorMode: WrAnchorMode, scope?: WrScope | null): Promise<MoveNodeResult>;
90
+ export declare function insertRawNode(anchor: WrAnchor, anchorMode: WrAnchorMode, rawJsx: string, uniqueIds?: boolean, scope?: WrScope | null, jsonSeed?: Record<string, unknown>): Promise<InsertRawResult>;
91
+ export declare function postToEditor(msg: WrEditorOutbound, transfer?: Transferable[]): void;
92
+ export declare function refreshSelection(id: string): void;
93
+ export declare function postHistoryState(canUndo: boolean, canRedo: boolean): void;
94
+ export declare function initWrBridge(editorOrigin: string): () => void;
95
+ export {};
96
+ //# sourceMappingURL=bridge.d.ts.map