@brunoalz/smartgesti-site-editor 1.4.2 → 1.5.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.
- package/dist/editor/BlockSelector.js +4 -2
- package/dist/editor/BlockSelector.js.map +1 -1
- package/dist/engine/export/exporters/layout/GridExporter.d.ts.map +1 -1
- package/dist/engine/export/exporters/layout/GridExporter.js +29 -12
- package/dist/engine/export/exporters/layout/GridExporter.js.map +1 -1
- package/dist/engine/export/exporters/sections/BlogPostExporters.d.ts +2 -0
- package/dist/engine/export/exporters/sections/BlogPostExporters.d.ts.map +1 -1
- package/dist/engine/export/exporters/sections/BlogPostExporters.js +183 -119
- package/dist/engine/export/exporters/sections/BlogPostExporters.js.map +1 -1
- package/dist/engine/export/exporters/sections/index.d.ts.map +1 -1
- package/dist/engine/export/exporters/sections/index.js +26 -24
- package/dist/engine/export/exporters/sections/index.js.map +1 -1
- package/dist/engine/index.js +97 -95
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/plugins/builtin/blog/manifest.d.ts.map +1 -1
- package/dist/engine/plugins/builtin/blog/manifest.js +160 -72
- package/dist/engine/plugins/builtin/blog/manifest.js.map +1 -1
- package/dist/engine/plugins/contentHydration.js +144 -68
- package/dist/engine/plugins/contentHydration.js.map +1 -1
- package/dist/engine/registry/blocks/layout/grid.d.ts.map +1 -1
- package/dist/engine/registry/blocks/layout/grid.js +10 -4
- package/dist/engine/registry/blocks/layout/grid.js.map +1 -1
- package/dist/engine/registry/blocks/sections/blogRecentPosts.d.ts +3 -0
- package/dist/engine/registry/blocks/sections/blogRecentPosts.d.ts.map +1 -0
- package/dist/engine/registry/blocks/sections/blogRecentPosts.js +29 -0
- package/dist/engine/registry/blocks/sections/blogRecentPosts.js.map +1 -0
- package/dist/engine/registry/blocks/sections/blogTagCloud.d.ts +3 -0
- package/dist/engine/registry/blocks/sections/blogTagCloud.d.ts.map +1 -0
- package/dist/engine/registry/blocks/sections/blogTagCloud.js +31 -0
- package/dist/engine/registry/blocks/sections/blogTagCloud.js.map +1 -0
- package/dist/engine/registry/blocks/sections/index.d.ts +2 -0
- package/dist/engine/registry/blocks/sections/index.d.ts.map +1 -1
- package/dist/engine/render/renderers/layout/GridRenderer.d.ts.map +1 -1
- package/dist/engine/render/renderers/layout/GridRenderer.js +21 -18
- package/dist/engine/render/renderers/layout/GridRenderer.js.map +1 -1
- package/dist/engine/render/renderers/sections/BlogPostDetailRenderer.d.ts.map +1 -1
- package/dist/engine/render/renderers/sections/BlogPostDetailRenderer.js +66 -47
- package/dist/engine/render/renderers/sections/BlogPostDetailRenderer.js.map +1 -1
- package/dist/engine/render/renderers/sections/BlogPostGridRenderer.d.ts.map +1 -1
- package/dist/engine/render/renderers/sections/BlogPostGridRenderer.js +175 -32
- package/dist/engine/render/renderers/sections/BlogPostGridRenderer.js.map +1 -1
- package/dist/engine/render/renderers/sections/BlogRecentPostsRenderer.d.ts +3 -0
- package/dist/engine/render/renderers/sections/BlogRecentPostsRenderer.d.ts.map +1 -0
- package/dist/engine/render/renderers/sections/BlogRecentPostsRenderer.js +148 -0
- package/dist/engine/render/renderers/sections/BlogRecentPostsRenderer.js.map +1 -0
- package/dist/engine/render/renderers/sections/BlogTagCloudRenderer.d.ts +3 -0
- package/dist/engine/render/renderers/sections/BlogTagCloudRenderer.d.ts.map +1 -0
- package/dist/engine/render/renderers/sections/BlogTagCloudRenderer.js +134 -0
- package/dist/engine/render/renderers/sections/BlogTagCloudRenderer.js.map +1 -0
- package/dist/engine/render/renderers/sections/index.js +20 -16
- package/dist/engine/render/renderers/sections/index.js.map +1 -1
- package/dist/engine/schema/siteDocument.d.ts +57 -2
- package/dist/engine/schema/siteDocument.d.ts.map +1 -1
- package/dist/engine/schema/siteDocument.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -106
- package/dist/index.js.map +1 -1
- package/dist/viewer/LandingPageViewer.js +11 -11
- package/dist/viewer/LandingPageViewer.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pluginRegistry as f } from "../../pluginRegistry.js";
|
|
2
2
|
import { logger as d } from "../../../../utils/logger.js";
|
|
3
|
-
const
|
|
3
|
+
const m = "plugin-blog-home-grid", c = [
|
|
4
4
|
{
|
|
5
5
|
title: "Feira de Ciências 2026: Inovação e Criatividade",
|
|
6
6
|
excerpt: "Nossos alunos apresentaram projetos incríveis na Feira de Ciências deste ano. Confira os destaques e premiações!",
|
|
@@ -58,8 +58,8 @@ const u = "plugin-blog-home-grid", h = [
|
|
|
58
58
|
<p>Os três projetos finalistas representarão nossa escola na <strong>Feira Regional de Ciências</strong>, que acontecerá em março na capital. Os alunos já estão se preparando para levar suas apresentações a um público ainda maior.</p>
|
|
59
59
|
<p>Parabéns a todos os participantes, professores orientadores e famílias que apoiaram essa jornada de descobertas!</p>
|
|
60
60
|
`.trim();
|
|
61
|
-
function
|
|
62
|
-
return { ...JSON.parse(JSON.stringify(
|
|
61
|
+
function b(t, n) {
|
|
62
|
+
return { ...JSON.parse(JSON.stringify(t)), id: n };
|
|
63
63
|
}
|
|
64
64
|
const y = {
|
|
65
65
|
manifest: {
|
|
@@ -69,7 +69,7 @@ const y = {
|
|
|
69
69
|
description: "Blog com posts, categorias e tags",
|
|
70
70
|
icon: "FileText",
|
|
71
71
|
capabilities: {
|
|
72
|
-
blocks: ["blogPostCard", "blogPostGrid", "blogPostDetail", "blogCategoryFilter", "blogSearchBar"],
|
|
72
|
+
blocks: ["blogPostCard", "blogPostGrid", "blogPostDetail", "blogCategoryFilter", "blogSearchBar", "blogRecentPosts", "blogTagCloud"],
|
|
73
73
|
pageTemplates: [
|
|
74
74
|
{
|
|
75
75
|
id: "blog-listing",
|
|
@@ -94,7 +94,6 @@ const y = {
|
|
|
94
94
|
paramMapping: { slug: ":slug" }
|
|
95
95
|
},
|
|
96
96
|
editRestrictions: {
|
|
97
|
-
lockedStructure: !0,
|
|
98
97
|
nonRemovable: !0
|
|
99
98
|
}
|
|
100
99
|
}
|
|
@@ -128,53 +127,53 @@ const y = {
|
|
|
128
127
|
requiredPages: ["blog-listing", "blog-post"]
|
|
129
128
|
}
|
|
130
129
|
},
|
|
131
|
-
onActivate(
|
|
130
|
+
onActivate(t) {
|
|
132
131
|
d.debug("Blog plugin activating...");
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
const e = o.findIndex((
|
|
132
|
+
const n = new Set(t.pages.map((e) => e.id)), o = [...t.pages], i = t.pages.find((e) => e.slug === "home") || t.pages[0], l = i?.structure.find((e) => e.type === "navbar"), r = i?.structure.find((e) => e.type === "footer");
|
|
133
|
+
if (i && l) {
|
|
134
|
+
const e = o.findIndex((a) => a.id === i.id);
|
|
136
135
|
if (e >= 0) {
|
|
137
|
-
const
|
|
138
|
-
if (!
|
|
136
|
+
const a = l.props, s = Array.isArray(a.links) ? [...a.links] : [];
|
|
137
|
+
if (!s.some(
|
|
139
138
|
(p) => p.href === "/p/blog"
|
|
140
139
|
)) {
|
|
141
|
-
const p =
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
o[e] = { ...o[e], structure:
|
|
140
|
+
const p = s.length > 0 ? s.length - 1 : 0;
|
|
141
|
+
s.splice(p, 0, { text: "Blog", href: "/p/blog" });
|
|
142
|
+
const h = o[e].structure.map((u) => u.id === l.id ? { ...u, props: { ...u.props, links: s } } : u);
|
|
143
|
+
o[e] = { ...o[e], structure: h }, d.debug("Blog link added to home navbar"), l.props = { ...a, links: s };
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
|
-
if (
|
|
149
|
-
const e = o.findIndex((
|
|
150
|
-
(
|
|
147
|
+
if (i) {
|
|
148
|
+
const e = o.findIndex((s) => s.id === i.id), a = i.structure.some(
|
|
149
|
+
(s) => s.id === m
|
|
151
150
|
);
|
|
152
|
-
if (e >= 0 && !
|
|
153
|
-
const
|
|
154
|
-
id:
|
|
151
|
+
if (e >= 0 && !a) {
|
|
152
|
+
const s = {
|
|
153
|
+
id: m,
|
|
155
154
|
type: "blogPostGrid",
|
|
156
155
|
props: {
|
|
157
156
|
title: "Blog",
|
|
158
157
|
subtitle: "Últimas publicações",
|
|
159
158
|
columns: 3,
|
|
160
|
-
cards:
|
|
159
|
+
cards: c,
|
|
161
160
|
variant: "default",
|
|
162
161
|
showViewAll: !0,
|
|
163
162
|
viewAllText: "Ver todos os posts",
|
|
164
163
|
viewAllHref: "/site/p/blog"
|
|
165
164
|
}
|
|
166
165
|
}, g = [...o[e].structure], p = g.findIndex(
|
|
167
|
-
(
|
|
166
|
+
(h) => h.type === "footer"
|
|
168
167
|
);
|
|
169
|
-
p >= 0 ? g.splice(p, 0,
|
|
168
|
+
p >= 0 ? g.splice(p, 0, s) : g.push(s), o[e] = {
|
|
170
169
|
...o[e],
|
|
171
170
|
structure: g
|
|
172
171
|
}, d.debug("Blog section injected into home page");
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
|
-
if (!
|
|
174
|
+
if (!n.has("blog")) {
|
|
176
175
|
const e = [];
|
|
177
|
-
|
|
176
|
+
l && e.push(b(l, "blog-page-navbar")), e.push({
|
|
178
177
|
id: "blog-page-hero",
|
|
179
178
|
type: "hero",
|
|
180
179
|
props: {
|
|
@@ -202,9 +201,9 @@ const y = {
|
|
|
202
201
|
type: "blogCategoryFilter",
|
|
203
202
|
props: {
|
|
204
203
|
title: "",
|
|
205
|
-
categories:
|
|
206
|
-
name:
|
|
207
|
-
slug:
|
|
204
|
+
categories: c.map((a) => ({
|
|
205
|
+
name: a.category,
|
|
206
|
+
slug: a.category.toLowerCase().replace(/\s+/g, "-"),
|
|
208
207
|
count: 1
|
|
209
208
|
})),
|
|
210
209
|
variant: "chips",
|
|
@@ -220,13 +219,13 @@ const y = {
|
|
|
220
219
|
title: "",
|
|
221
220
|
subtitle: "",
|
|
222
221
|
columns: 3,
|
|
223
|
-
cards:
|
|
222
|
+
cards: c,
|
|
224
223
|
variant: "default",
|
|
225
224
|
showViewAll: !1,
|
|
226
225
|
viewAllText: "Ver todos",
|
|
227
226
|
viewAllHref: "/site/p/blog"
|
|
228
227
|
}
|
|
229
|
-
}),
|
|
228
|
+
}), r && e.push(b(r, "blog-page-footer")), o.push({
|
|
230
229
|
id: "blog",
|
|
231
230
|
name: "Blog",
|
|
232
231
|
slug: "blog",
|
|
@@ -235,32 +234,114 @@ const y = {
|
|
|
235
234
|
structure: e,
|
|
236
235
|
dataSource: {
|
|
237
236
|
provider: "blog-posts",
|
|
238
|
-
mode: "list"
|
|
237
|
+
mode: "list",
|
|
238
|
+
defaultParams: { limit: 15 }
|
|
239
239
|
}
|
|
240
240
|
}), d.debug("Blog listing page created");
|
|
241
241
|
}
|
|
242
|
-
if (!
|
|
242
|
+
if (!n.has("blog-post")) {
|
|
243
243
|
const e = [];
|
|
244
|
-
|
|
245
|
-
id: "blog-detail-
|
|
246
|
-
type: "
|
|
244
|
+
l && e.push(b(l, "post-page-navbar")), e.push({
|
|
245
|
+
id: "blog-detail-layout",
|
|
246
|
+
type: "grid",
|
|
247
247
|
props: {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
248
|
+
colTemplate: "1fr 320px",
|
|
249
|
+
gap: "2rem",
|
|
250
|
+
children: [
|
|
251
|
+
// Coluna principal: blogPostDetail
|
|
252
|
+
{
|
|
253
|
+
id: "blog-detail-main",
|
|
254
|
+
type: "blogPostDetail",
|
|
255
|
+
props: {
|
|
256
|
+
title: "Feira de Ciências 2026: Inovação e Criatividade",
|
|
257
|
+
content: v,
|
|
258
|
+
featuredImage: "https://images.unsplash.com/photo-1567168544230-3b9e5ec47659?w=1200&h=600&fit=crop",
|
|
259
|
+
date: "05 Fev 2026",
|
|
260
|
+
category: "Eventos",
|
|
261
|
+
authorVariant: "inline",
|
|
262
|
+
readingTime: "5 min de leitura",
|
|
263
|
+
tags: ["Feira de Ciências", "Eventos", "Sustentabilidade", "Projetos"],
|
|
264
|
+
showFeaturedImage: !0,
|
|
265
|
+
showAuthor: !0,
|
|
266
|
+
showDate: !0,
|
|
267
|
+
showTags: !0,
|
|
268
|
+
showReadingTime: !0,
|
|
269
|
+
contentMaxWidth: "720px"
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
// Sidebar: stack vertical com widgets
|
|
273
|
+
{
|
|
274
|
+
id: "blog-detail-sidebar",
|
|
275
|
+
type: "stack",
|
|
276
|
+
props: {
|
|
277
|
+
direction: "col",
|
|
278
|
+
gap: "1.5rem",
|
|
279
|
+
children: [
|
|
280
|
+
{
|
|
281
|
+
id: "blog-sidebar-search",
|
|
282
|
+
type: "blogSearchBar",
|
|
283
|
+
props: {
|
|
284
|
+
placeholder: "Buscar posts...",
|
|
285
|
+
variant: "simple",
|
|
286
|
+
showIcon: !0,
|
|
287
|
+
searchUrl: "/site/p/blog"
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
id: "blog-sidebar-categories",
|
|
292
|
+
type: "blogCategoryFilter",
|
|
293
|
+
props: {
|
|
294
|
+
title: "Categorias",
|
|
295
|
+
categories: c.map((a) => ({
|
|
296
|
+
name: a.category,
|
|
297
|
+
slug: a.category.toLowerCase().replace(/\s+/g, "-"),
|
|
298
|
+
count: 1
|
|
299
|
+
})),
|
|
300
|
+
variant: "list",
|
|
301
|
+
showCount: !0,
|
|
302
|
+
showAll: !0,
|
|
303
|
+
allLabel: "Todas",
|
|
304
|
+
filterUrl: "/site/p/blog"
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
id: "blog-sidebar-recent",
|
|
309
|
+
type: "blogRecentPosts",
|
|
310
|
+
props: {
|
|
311
|
+
title: "Posts Recentes",
|
|
312
|
+
count: 5,
|
|
313
|
+
showThumbnail: !0,
|
|
314
|
+
showDate: !0,
|
|
315
|
+
showCategory: !1,
|
|
316
|
+
posts: c.map((a) => ({
|
|
317
|
+
title: a.title,
|
|
318
|
+
slug: a.linkHref.replace("/site/p/blog/", ""),
|
|
319
|
+
date: a.date,
|
|
320
|
+
image: a.image,
|
|
321
|
+
category: a.category
|
|
322
|
+
}))
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: "blog-sidebar-tags",
|
|
327
|
+
type: "blogTagCloud",
|
|
328
|
+
props: {
|
|
329
|
+
title: "Tags",
|
|
330
|
+
tags: [
|
|
331
|
+
{ name: "Eventos", count: 3 },
|
|
332
|
+
{ name: "Educação", count: 2 },
|
|
333
|
+
{ name: "Institucional", count: 1 },
|
|
334
|
+
{ name: "Sustentabilidade", count: 1 }
|
|
335
|
+
],
|
|
336
|
+
variant: "badges"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
]
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
]
|
|
262
343
|
}
|
|
263
|
-
}),
|
|
344
|
+
}), r && e.push(b(r, "post-page-footer")), o.push({
|
|
264
345
|
id: "blog-post",
|
|
265
346
|
name: "Post",
|
|
266
347
|
slug: "blog/:slug",
|
|
@@ -274,46 +355,53 @@ const y = {
|
|
|
274
355
|
paramMapping: { slug: ":slug" }
|
|
275
356
|
},
|
|
276
357
|
editRestrictions: {
|
|
277
|
-
lockedStructure: !0,
|
|
278
358
|
nonRemovable: !0
|
|
279
359
|
}
|
|
280
|
-
}), d.debug("Blog post detail page created");
|
|
360
|
+
}), d.debug("Blog post detail page created with sidebar layout");
|
|
281
361
|
}
|
|
282
362
|
return {
|
|
283
|
-
...
|
|
363
|
+
...t,
|
|
284
364
|
pages: o
|
|
285
365
|
};
|
|
286
366
|
},
|
|
287
|
-
onDeactivate(
|
|
367
|
+
onDeactivate(t) {
|
|
288
368
|
d.debug("Blog plugin deactivating...");
|
|
289
|
-
const
|
|
290
|
-
let
|
|
291
|
-
return
|
|
292
|
-
(
|
|
293
|
-
) && (
|
|
294
|
-
(
|
|
295
|
-
)),
|
|
296
|
-
if (
|
|
297
|
-
const e =
|
|
298
|
-
return
|
|
299
|
-
}),
|
|
369
|
+
const n = t.pages.filter((o) => o.pluginId !== "blog").map((o) => {
|
|
370
|
+
let i = o.structure;
|
|
371
|
+
return i.some(
|
|
372
|
+
(r) => r.id === m
|
|
373
|
+
) && (i = i.filter(
|
|
374
|
+
(r) => r.id !== m
|
|
375
|
+
)), i = i.map((r) => {
|
|
376
|
+
if (r.type !== "navbar") return r;
|
|
377
|
+
const e = r.props, a = Array.isArray(e.links) ? e.links : [], s = a.filter((g) => g.href !== "/p/blog");
|
|
378
|
+
return s.length !== a.length ? { ...r, props: { ...e, links: s } } : r;
|
|
379
|
+
}), i !== o.structure ? { ...o, structure: i } : o;
|
|
300
380
|
});
|
|
301
381
|
return d.debug(
|
|
302
|
-
`Removed ${
|
|
382
|
+
`Removed ${t.pages.length - n.length} blog page(s) and injected section`
|
|
303
383
|
), {
|
|
304
|
-
...
|
|
305
|
-
pages:
|
|
384
|
+
...t,
|
|
385
|
+
pages: n
|
|
306
386
|
};
|
|
307
387
|
},
|
|
308
|
-
getEditorRestrictions(
|
|
309
|
-
if (
|
|
388
|
+
getEditorRestrictions(t) {
|
|
389
|
+
if (t === "blogPostDetail")
|
|
310
390
|
return {
|
|
311
391
|
lockedFields: ["content", "date"]
|
|
312
392
|
};
|
|
313
|
-
if (
|
|
393
|
+
if (t === "blogCategoryFilter")
|
|
314
394
|
return {
|
|
315
395
|
lockedFields: ["categories"]
|
|
316
396
|
};
|
|
397
|
+
if (t === "blogRecentPosts")
|
|
398
|
+
return {
|
|
399
|
+
lockedFields: ["posts"]
|
|
400
|
+
};
|
|
401
|
+
if (t === "blogTagCloud")
|
|
402
|
+
return {
|
|
403
|
+
lockedFields: ["tags"]
|
|
404
|
+
};
|
|
317
405
|
}
|
|
318
406
|
};
|
|
319
407
|
f.register(y);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sources":["../../../../../src/engine/plugins/builtin/blog/manifest.ts"],"sourcesContent":["/**\n * Blog Plugin Manifest\n * Plugin para blog com posts, categorias e tags.\n *\n * onActivate:\n * 1. Injeta seção blogPostGrid na home page (antes do footer)\n * 2. Cria página \"Blog\" com navbar + grid de posts + footer\n * 3. Cria página \"Post\" com navbar + detalhe do post + footer\n *\n * onDeactivate:\n * 1. Remove a seção injetada na home page\n * 2. Remove as páginas do plugin\n */\n\nimport type { PluginRegistration } from \"../../types\";\nimport type { SiteDocument, Block, BlockType } from \"../../../schema/siteDocument\";\nimport { pluginRegistry } from \"../../pluginRegistry\";\nimport { logger } from \"../../../../utils/logger\";\n\n// ─── ID usado para a seção de blog injetada na home page ───\nconst BLOG_HOME_SECTION_ID = \"plugin-blog-home-grid\";\n\n// ─── Sample blog cards para preview ───\nconst SAMPLE_BLOG_CARDS = [\n {\n title: \"Feira de Ciências 2026: Inovação e Criatividade\",\n excerpt:\n \"Nossos alunos apresentaram projetos incríveis na Feira de Ciências deste ano. Confira os destaques e premiações!\",\n image:\n \"https://images.unsplash.com/photo-1567168544230-3b9e5ec47659?w=800&h=400&fit=crop\",\n category: \"Eventos\",\n date: \"05 Fev 2026\",\n linkHref: \"/site/p/blog/feira-de-ciencias-2026\",\n linkText: \"Ler mais\",\n },\n {\n title: \"Matrículas Abertas para o Segundo Semestre\",\n excerpt:\n \"Garanta a vaga do seu filho na melhor escola da região. Condições especiais para matrículas antecipadas.\",\n image:\n \"https://images.unsplash.com/photo-1523050854058-8df90110c9f1?w=800&h=400&fit=crop\",\n category: \"Institucional\",\n date: \"01 Fev 2026\",\n linkHref: \"/site/p/blog/matriculas-segundo-semestre\",\n linkText: \"Ler mais\",\n },\n {\n title: \"5 Dicas para Preparar seu Filho para o Ano Letivo\",\n excerpt:\n \"Dicas práticas para uma transição tranquila e um início de ano produtivo para toda a família.\",\n image:\n \"https://images.unsplash.com/photo-1503676260728-1c00da094a0b?w=800&h=400&fit=crop\",\n category: \"Educação\",\n date: \"28 Jan 2026\",\n linkHref: \"/site/p/blog/dicas-preparar-ano-letivo\",\n linkText: \"Ler mais\",\n },\n];\n\n// ─── Conteúdo HTML rico para o post de exemplo ───\nconst SAMPLE_POST_CONTENT = `\n<h2>O que é a Feira de Ciências?</h2>\n<p>A Feira de Ciências é um evento anual que celebra a curiosidade, a pesquisa e a criatividade dos nossos alunos. Nesta edição especial de 2026, recebemos mais de <strong>500 visitantes</strong> e contamos com a participação de todas as turmas do Ensino Fundamental e Médio.</p>\n<p>Este ano, o tema central foi <em>\"Ciência e Sustentabilidade\"</em>, incentivando os estudantes a desenvolverem projetos que aliassem inovação tecnológica com responsabilidade ambiental.</p>\n\n<h2>Destaques da Edição 2026</h2>\n<p>Entre os mais de 50 projetos apresentados, alguns se destacaram pela originalidade e impacto:</p>\n<ul>\n <li><strong>Jardim Sustentável Inteligente</strong> — Alunos do 5º ano desenvolveram um sistema de irrigação automática usando sensores de umidade e placa Arduino.</li>\n <li><strong>Robótica Educacional</strong> — A turma do 8º ano criou um robô que auxilia no ensino de matemática para crianças do 1º ao 3º ano.</li>\n <li><strong>Energia Solar na Escola</strong> — Projeto do 2º ano do Ensino Médio demonstrou como painéis solares poderiam reduzir em 40% o consumo de energia da escola.</li>\n</ul>\n\n<blockquote>\n <p>\"A Feira de Ciências é um dos momentos mais importantes do nosso calendário escolar. Ver a dedicação e o brilho nos olhos dos alunos ao apresentarem seus projetos nos enche de orgulho e nos motiva a continuar investindo em educação de qualidade.\"</p>\n <p><strong>— Prof. Maria Silva, Coordenadora Pedagógica</strong></p>\n</blockquote>\n\n<h2>Premiações</h2>\n<p>O júri, composto por professores universitários e profissionais da área de tecnologia, selecionou os três melhores projetos:</p>\n<ol>\n <li><strong>1º Lugar:</strong> Jardim Sustentável Inteligente (5º ano)</li>\n <li><strong>2º Lugar:</strong> Energia Solar na Escola (2º EM)</li>\n <li><strong>3º Lugar:</strong> Robótica Educacional (8º ano)</li>\n</ol>\n\n<h2>Próximos Passos</h2>\n<p>Os três projetos finalistas representarão nossa escola na <strong>Feira Regional de Ciências</strong>, que acontecerá em março na capital. Os alunos já estão se preparando para levar suas apresentações a um público ainda maior.</p>\n<p>Parabéns a todos os participantes, professores orientadores e famílias que apoiaram essa jornada de descobertas!</p>\n`.trim();\n\n/**\n * Deep-clone um bloco com novo ID\n */\nfunction cloneBlock(block: Block, newId: string): Block {\n const cloned: Block = JSON.parse(JSON.stringify(block));\n return { ...cloned, id: newId };\n}\n\nexport const blogPlugin: PluginRegistration = {\n manifest: {\n id: \"blog\",\n version: \"1.0.0\",\n name: \"Blog\",\n description: \"Blog com posts, categorias e tags\",\n icon: \"FileText\",\n\n capabilities: {\n blocks: [\"blogPostCard\", \"blogPostGrid\", \"blogPostDetail\", \"blogCategoryFilter\", \"blogSearchBar\"],\n\n pageTemplates: [\n {\n id: \"blog-listing\",\n name: \"Blog\",\n slug: \"blog\",\n pluginId: \"blog\",\n structure: [],\n dataSource: {\n provider: \"blog-posts\",\n mode: \"list\",\n },\n },\n {\n id: \"blog-post\",\n name: \"Post\",\n slug: \"blog/:slug\",\n pluginId: \"blog\",\n structure: [],\n dataSource: {\n provider: \"blog-posts\",\n mode: \"single\",\n paramMapping: { slug: \":slug\" },\n },\n editRestrictions: {\n lockedStructure: true,\n nonRemovable: true,\n },\n },\n ],\n\n dataSchemas: [\n {\n type: \"blog-post\",\n label: \"Blog Post\",\n fields: [\n { name: \"title\", type: \"string\", required: true, label: \"Title\" },\n { name: \"slug\", type: \"string\", required: true, label: \"Slug\" },\n { name: \"excerpt\", type: \"string\", label: \"Excerpt\" },\n { name: \"content\", type: \"richtext\", required: true, label: \"Content\" },\n { name: \"featuredImage\", type: \"image\", label: \"Featured Image\" },\n { name: \"category\", type: \"string\", label: \"Category\" },\n { name: \"tags\", type: \"array\", label: \"Tags\" },\n { name: \"authorVariant\", type: \"string\", label: \"Author Variant\" },\n { name: \"readingTime\", type: \"number\", label: \"Reading Time\" },\n { name: \"metaTitle\", type: \"string\", label: \"Meta Title (SEO)\" },\n { name: \"metaDescription\", type: \"string\", label: \"Meta Description (SEO)\" },\n { name: \"ogImage\", type: \"image\", label: \"Open Graph Image\" },\n ],\n },\n ],\n\n contentProviders: [\"blog-posts\", \"blog-categories\"],\n },\n\n restrictions: {\n lockedFields: {\n blogPostDetail: [\"content\", \"date\"],\n },\n requiredPages: [\"blog-listing\", \"blog-post\"],\n },\n },\n\n onActivate(document: SiteDocument): SiteDocument {\n logger.debug(\"Blog plugin activating...\");\n\n const existingPageIds = new Set(document.pages.map((p) => p.id));\n const newPages = [...document.pages];\n\n // ── Encontrar home page para clonar navbar/footer ──\n const homePage =\n document.pages.find((p) => p.slug === \"home\") || document.pages[0];\n\n const homeNavbar = homePage?.structure.find((b) => b.type === \"navbar\");\n const homeFooter = homePage?.structure.find((b) => b.type === \"footer\");\n\n // ── 1. Adicionar link \"Blog\" à navbar da home page ──\n // Preserva os links existentes e apenas insere \"Blog\" antes do último item.\n if (homePage && homeNavbar) {\n const homeIdx = newPages.findIndex((p) => p.id === homePage.id);\n if (homeIdx >= 0) {\n const navbarProps = homeNavbar.props as Record<string, any>;\n const existingLinks: Array<{ text: string; href: string }> =\n Array.isArray(navbarProps.links) ? [...navbarProps.links] : [];\n const hasBlogLink = existingLinks.some(\n (l) => l.href === \"/p/blog\",\n );\n\n if (!hasBlogLink) {\n // Inserir \"Blog\" antes do último link (geralmente \"Contato\")\n const insertIdx = existingLinks.length > 0 ? existingLinks.length - 1 : 0;\n existingLinks.splice(insertIdx, 0, { text: \"Blog\", href: \"/p/blog\" });\n\n // Atualizar navbar na home page com o novo link\n const updatedStructure = newPages[homeIdx].structure.map((b) => {\n if (b.id === homeNavbar.id) {\n return { ...b, props: { ...b.props, links: existingLinks } } as Block;\n }\n return b;\n });\n newPages[homeIdx] = { ...newPages[homeIdx], structure: updatedStructure };\n logger.debug(\"Blog link added to home navbar\");\n\n // Atualizar referência para que clones nas páginas do blog usem navbar com link\n // (homeNavbar é const, então criamos a versão atualizada para uso nos clones)\n (homeNavbar as any).props = { ...navbarProps, links: existingLinks };\n }\n }\n }\n\n // ── 2. Injetar seção de blog na home page (antes do footer) ──\n if (homePage) {\n const homeIdx = newPages.findIndex((p) => p.id === homePage.id);\n const alreadyInjected = homePage.structure.some(\n (b) => b.id === BLOG_HOME_SECTION_ID,\n );\n\n if (homeIdx >= 0 && !alreadyInjected) {\n const blogHomeSection: Block = {\n id: BLOG_HOME_SECTION_ID,\n type: \"blogPostGrid\",\n props: {\n title: \"Blog\",\n subtitle: \"Últimas publicações\",\n columns: 3,\n cards: SAMPLE_BLOG_CARDS,\n variant: \"default\",\n showViewAll: true,\n viewAllText: \"Ver todos os posts\",\n viewAllHref: \"/site/p/blog\",\n },\n } as Block;\n\n const updatedStructure = [...newPages[homeIdx].structure];\n const footerIdx = updatedStructure.findIndex(\n (b) => b.type === \"footer\",\n );\n\n if (footerIdx >= 0) {\n updatedStructure.splice(footerIdx, 0, blogHomeSection);\n } else {\n updatedStructure.push(blogHomeSection);\n }\n\n newPages[homeIdx] = {\n ...newPages[homeIdx],\n structure: updatedStructure,\n };\n logger.debug(\"Blog section injected into home page\");\n }\n }\n\n // ── 3. Criar página \"Blog\" (listagem completa) ──\n if (!existingPageIds.has(\"blog\")) {\n const blogPageStructure: Block[] = [];\n\n // Navbar clonada da home\n if (homeNavbar) {\n blogPageStructure.push(cloneBlock(homeNavbar, \"blog-page-navbar\"));\n }\n\n // Hero banner do blog\n blogPageStructure.push({\n id: \"blog-page-hero\",\n type: \"hero\",\n props: {\n title: \"Blog\",\n subtitle: \"Novidades & Publicações\",\n description:\n \"Acompanhe as últimas novidades, eventos e conquistas da nossa comunidade escolar.\",\n variant: \"centered\",\n align: \"center\",\n overlay: true,\n overlayColor: \"rgba(79, 70, 229, 0.9)\",\n background: \"#4f46e5\",\n minHeight: \"280px\",\n },\n } as Block);\n\n // Search bar\n blogPageStructure.push({\n id: \"blog-search-bar\",\n type: \"blogSearchBar\",\n props: {\n placeholder: \"Buscar posts...\",\n variant: \"simple\",\n showIcon: true,\n searchUrl: \"/site/p/blog\",\n },\n } as Block);\n\n // Category filter\n blogPageStructure.push({\n id: \"blog-category-filter\",\n type: \"blogCategoryFilter\",\n props: {\n title: \"\",\n categories: SAMPLE_BLOG_CARDS.map((c) => ({\n name: c.category,\n slug: c.category.toLowerCase().replace(/\\s+/g, \"-\"),\n count: 1,\n })),\n variant: \"chips\",\n showCount: false,\n showAll: true,\n allLabel: \"Todas\",\n filterUrl: \"/site/p/blog\",\n },\n } as Block);\n\n // Grid de posts\n blogPageStructure.push({\n id: \"blog-grid-main\",\n type: \"blogPostGrid\",\n props: {\n title: \"\",\n subtitle: \"\",\n columns: 3,\n cards: SAMPLE_BLOG_CARDS,\n variant: \"default\",\n showViewAll: false,\n viewAllText: \"Ver todos\",\n viewAllHref: \"/site/p/blog\",\n },\n } as Block);\n\n // Footer clonado da home\n if (homeFooter) {\n blogPageStructure.push(cloneBlock(homeFooter, \"blog-page-footer\"));\n }\n\n newPages.push({\n id: \"blog\",\n name: \"Blog\",\n slug: \"blog\",\n pluginId: \"blog\",\n pageTemplateId: \"blog-listing\",\n structure: blogPageStructure,\n dataSource: {\n provider: \"blog-posts\",\n mode: \"list\",\n },\n });\n logger.debug(\"Blog listing page created\");\n }\n\n // ── 4. Criar página \"Post\" (detalhe) ──\n if (!existingPageIds.has(\"blog-post\")) {\n const postPageStructure: Block[] = [];\n\n if (homeNavbar) {\n postPageStructure.push(cloneBlock(homeNavbar, \"post-page-navbar\"));\n }\n\n postPageStructure.push({\n id: \"blog-detail-main\",\n type: \"blogPostDetail\",\n props: {\n title: \"Feira de Ciências 2026: Inovação e Criatividade\",\n content: SAMPLE_POST_CONTENT,\n featuredImage:\n \"https://images.unsplash.com/photo-1567168544230-3b9e5ec47659?w=1200&h=600&fit=crop\",\n date: \"05 Fev 2026\",\n category: \"Eventos\",\n authorVariant: \"inline\",\n readingTime: \"5 min de leitura\",\n tags: [\"Feira de Ciências\", \"Eventos\", \"Sustentabilidade\", \"Projetos\"],\n showFeaturedImage: true,\n showAuthor: true,\n showDate: true,\n showTags: true,\n showReadingTime: true,\n contentMaxWidth: \"720px\",\n },\n } as Block);\n\n if (homeFooter) {\n postPageStructure.push(cloneBlock(homeFooter, \"post-page-footer\"));\n }\n\n newPages.push({\n id: \"blog-post\",\n name: \"Post\",\n slug: \"blog/:slug\",\n pluginId: \"blog\",\n pageTemplateId: \"blog-post\",\n isDynamic: true,\n structure: postPageStructure,\n dataSource: {\n provider: \"blog-posts\",\n mode: \"single\",\n paramMapping: { slug: \":slug\" },\n },\n editRestrictions: {\n lockedStructure: true,\n nonRemovable: true,\n },\n });\n logger.debug(\"Blog post detail page created\");\n }\n\n return {\n ...document,\n pages: newPages,\n };\n },\n\n onDeactivate(document: SiteDocument): SiteDocument {\n logger.debug(\"Blog plugin deactivating...\");\n\n const newPages = document.pages\n // Remover páginas do plugin\n .filter((page) => page.pluginId !== \"blog\")\n // Remover seção de blog injetada + link \"Blog\" da navbar\n .map((page) => {\n let structure = page.structure;\n\n // Remover seção de blog injetada\n const hasInjected = structure.some(\n (b) => b.id === BLOG_HOME_SECTION_ID,\n );\n if (hasInjected) {\n structure = structure.filter(\n (b) => b.id !== BLOG_HOME_SECTION_ID,\n );\n }\n\n // Remover link \"Blog\" (/p/blog) da navbar\n structure = structure.map((b) => {\n if (b.type !== \"navbar\") return b;\n const props = b.props as Record<string, any>;\n const links: Array<{ text: string; href: string }> = Array.isArray(props.links) ? props.links : [];\n const filtered = links.filter((l) => l.href !== \"/p/blog\");\n if (filtered.length !== links.length) {\n return { ...b, props: { ...props, links: filtered } } as Block;\n }\n return b;\n });\n\n if (structure !== page.structure) {\n return { ...page, structure };\n }\n return page;\n });\n\n logger.debug(\n `Removed ${document.pages.length - newPages.length} blog page(s) and injected section`,\n );\n\n return {\n ...document,\n pages: newPages,\n };\n },\n\n getEditorRestrictions(blockType: BlockType) {\n if (blockType === \"blogPostDetail\") {\n return {\n lockedFields: [\"content\", \"date\"],\n };\n }\n if (blockType === \"blogCategoryFilter\") {\n return {\n lockedFields: [\"categories\"],\n };\n }\n return undefined;\n },\n};\n\n// Auto-registrar o plugin (side effect — como os blocos fazem com componentRegistry)\npluginRegistry.register(blogPlugin);\n"],"names":["BLOG_HOME_SECTION_ID","SAMPLE_BLOG_CARDS","SAMPLE_POST_CONTENT","cloneBlock","block","newId","blogPlugin","document","logger","existingPageIds","p","newPages","homePage","homeNavbar","b","homeFooter","homeIdx","navbarProps","existingLinks","l","insertIdx","updatedStructure","alreadyInjected","blogHomeSection","footerIdx","blogPageStructure","c","postPageStructure","page","structure","props","links","filtered","blockType","pluginRegistry"],"mappings":";;AAoBA,MAAMA,IAAuB,yBAGvBC,IAAoB;AAAA,EACxB;AAAA,IACE,OAAO;AAAA,IACP,SACE;AAAA,IACF,OACE;AAAA,IACF,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEZ;AAAA,IACE,OAAO;AAAA,IACP,SACE;AAAA,IACF,OACE;AAAA,IACF,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEZ;AAAA,IACE,OAAO;AAAA,IACP,SACE;AAAA,IACF,OACE;AAAA,IACF,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAEd,GAGMC,IAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6B1B,KAAA;AAKF,SAASC,EAAWC,GAAcC,GAAsB;AAEtD,SAAO,EAAE,GADa,KAAK,MAAM,KAAK,UAAUD,CAAK,CAAC,GAClC,IAAIC,EA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CAAU;"}
|
|
1
|
+
{"version":3,"file":"manifest.js","sources":["../../../../../src/engine/plugins/builtin/blog/manifest.ts"],"sourcesContent":["/**\n * Blog Plugin Manifest\n * Plugin para blog com posts, categorias e tags.\n *\n * onActivate:\n * 1. Injeta seção blogPostGrid na home page (antes do footer)\n * 2. Cria página \"Blog\" com navbar + grid de posts + footer\n * 3. Cria página \"Post\" com navbar + detalhe do post + footer\n *\n * onDeactivate:\n * 1. Remove a seção injetada na home page\n * 2. Remove as páginas do plugin\n */\n\nimport type { PluginRegistration } from \"../../types\";\nimport type { SiteDocument, Block, BlockType } from \"../../../schema/siteDocument\";\nimport { pluginRegistry } from \"../../pluginRegistry\";\nimport { logger } from \"../../../../utils/logger\";\n\n// ─── ID usado para a seção de blog injetada na home page ───\nconst BLOG_HOME_SECTION_ID = \"plugin-blog-home-grid\";\n\n// ─── Sample blog cards para preview ───\nconst SAMPLE_BLOG_CARDS = [\n {\n title: \"Feira de Ciências 2026: Inovação e Criatividade\",\n excerpt:\n \"Nossos alunos apresentaram projetos incríveis na Feira de Ciências deste ano. Confira os destaques e premiações!\",\n image:\n \"https://images.unsplash.com/photo-1567168544230-3b9e5ec47659?w=800&h=400&fit=crop\",\n category: \"Eventos\",\n date: \"05 Fev 2026\",\n linkHref: \"/site/p/blog/feira-de-ciencias-2026\",\n linkText: \"Ler mais\",\n },\n {\n title: \"Matrículas Abertas para o Segundo Semestre\",\n excerpt:\n \"Garanta a vaga do seu filho na melhor escola da região. Condições especiais para matrículas antecipadas.\",\n image:\n \"https://images.unsplash.com/photo-1523050854058-8df90110c9f1?w=800&h=400&fit=crop\",\n category: \"Institucional\",\n date: \"01 Fev 2026\",\n linkHref: \"/site/p/blog/matriculas-segundo-semestre\",\n linkText: \"Ler mais\",\n },\n {\n title: \"5 Dicas para Preparar seu Filho para o Ano Letivo\",\n excerpt:\n \"Dicas práticas para uma transição tranquila e um início de ano produtivo para toda a família.\",\n image:\n \"https://images.unsplash.com/photo-1503676260728-1c00da094a0b?w=800&h=400&fit=crop\",\n category: \"Educação\",\n date: \"28 Jan 2026\",\n linkHref: \"/site/p/blog/dicas-preparar-ano-letivo\",\n linkText: \"Ler mais\",\n },\n];\n\n// ─── Conteúdo HTML rico para o post de exemplo ───\nconst SAMPLE_POST_CONTENT = `\n<h2>O que é a Feira de Ciências?</h2>\n<p>A Feira de Ciências é um evento anual que celebra a curiosidade, a pesquisa e a criatividade dos nossos alunos. Nesta edição especial de 2026, recebemos mais de <strong>500 visitantes</strong> e contamos com a participação de todas as turmas do Ensino Fundamental e Médio.</p>\n<p>Este ano, o tema central foi <em>\"Ciência e Sustentabilidade\"</em>, incentivando os estudantes a desenvolverem projetos que aliassem inovação tecnológica com responsabilidade ambiental.</p>\n\n<h2>Destaques da Edição 2026</h2>\n<p>Entre os mais de 50 projetos apresentados, alguns se destacaram pela originalidade e impacto:</p>\n<ul>\n <li><strong>Jardim Sustentável Inteligente</strong> — Alunos do 5º ano desenvolveram um sistema de irrigação automática usando sensores de umidade e placa Arduino.</li>\n <li><strong>Robótica Educacional</strong> — A turma do 8º ano criou um robô que auxilia no ensino de matemática para crianças do 1º ao 3º ano.</li>\n <li><strong>Energia Solar na Escola</strong> — Projeto do 2º ano do Ensino Médio demonstrou como painéis solares poderiam reduzir em 40% o consumo de energia da escola.</li>\n</ul>\n\n<blockquote>\n <p>\"A Feira de Ciências é um dos momentos mais importantes do nosso calendário escolar. Ver a dedicação e o brilho nos olhos dos alunos ao apresentarem seus projetos nos enche de orgulho e nos motiva a continuar investindo em educação de qualidade.\"</p>\n <p><strong>— Prof. Maria Silva, Coordenadora Pedagógica</strong></p>\n</blockquote>\n\n<h2>Premiações</h2>\n<p>O júri, composto por professores universitários e profissionais da área de tecnologia, selecionou os três melhores projetos:</p>\n<ol>\n <li><strong>1º Lugar:</strong> Jardim Sustentável Inteligente (5º ano)</li>\n <li><strong>2º Lugar:</strong> Energia Solar na Escola (2º EM)</li>\n <li><strong>3º Lugar:</strong> Robótica Educacional (8º ano)</li>\n</ol>\n\n<h2>Próximos Passos</h2>\n<p>Os três projetos finalistas representarão nossa escola na <strong>Feira Regional de Ciências</strong>, que acontecerá em março na capital. Os alunos já estão se preparando para levar suas apresentações a um público ainda maior.</p>\n<p>Parabéns a todos os participantes, professores orientadores e famílias que apoiaram essa jornada de descobertas!</p>\n`.trim();\n\n/**\n * Deep-clone um bloco com novo ID\n */\nfunction cloneBlock(block: Block, newId: string): Block {\n const cloned: Block = JSON.parse(JSON.stringify(block));\n return { ...cloned, id: newId };\n}\n\nexport const blogPlugin: PluginRegistration = {\n manifest: {\n id: \"blog\",\n version: \"1.0.0\",\n name: \"Blog\",\n description: \"Blog com posts, categorias e tags\",\n icon: \"FileText\",\n\n capabilities: {\n blocks: [\"blogPostCard\", \"blogPostGrid\", \"blogPostDetail\", \"blogCategoryFilter\", \"blogSearchBar\", \"blogRecentPosts\", \"blogTagCloud\"],\n\n pageTemplates: [\n {\n id: \"blog-listing\",\n name: \"Blog\",\n slug: \"blog\",\n pluginId: \"blog\",\n structure: [],\n dataSource: {\n provider: \"blog-posts\",\n mode: \"list\",\n },\n },\n {\n id: \"blog-post\",\n name: \"Post\",\n slug: \"blog/:slug\",\n pluginId: \"blog\",\n structure: [],\n dataSource: {\n provider: \"blog-posts\",\n mode: \"single\",\n paramMapping: { slug: \":slug\" },\n },\n editRestrictions: {\n nonRemovable: true,\n },\n },\n ],\n\n dataSchemas: [\n {\n type: \"blog-post\",\n label: \"Blog Post\",\n fields: [\n { name: \"title\", type: \"string\", required: true, label: \"Title\" },\n { name: \"slug\", type: \"string\", required: true, label: \"Slug\" },\n { name: \"excerpt\", type: \"string\", label: \"Excerpt\" },\n { name: \"content\", type: \"richtext\", required: true, label: \"Content\" },\n { name: \"featuredImage\", type: \"image\", label: \"Featured Image\" },\n { name: \"category\", type: \"string\", label: \"Category\" },\n { name: \"tags\", type: \"array\", label: \"Tags\" },\n { name: \"authorVariant\", type: \"string\", label: \"Author Variant\" },\n { name: \"readingTime\", type: \"number\", label: \"Reading Time\" },\n { name: \"metaTitle\", type: \"string\", label: \"Meta Title (SEO)\" },\n { name: \"metaDescription\", type: \"string\", label: \"Meta Description (SEO)\" },\n { name: \"ogImage\", type: \"image\", label: \"Open Graph Image\" },\n ],\n },\n ],\n\n contentProviders: [\"blog-posts\", \"blog-categories\"],\n },\n\n restrictions: {\n lockedFields: {\n blogPostDetail: [\"content\", \"date\"],\n },\n requiredPages: [\"blog-listing\", \"blog-post\"],\n },\n },\n\n onActivate(document: SiteDocument): SiteDocument {\n logger.debug(\"Blog plugin activating...\");\n\n const existingPageIds = new Set(document.pages.map((p) => p.id));\n const newPages = [...document.pages];\n\n // ── Encontrar home page para clonar navbar/footer ──\n const homePage =\n document.pages.find((p) => p.slug === \"home\") || document.pages[0];\n\n const homeNavbar = homePage?.structure.find((b) => b.type === \"navbar\");\n const homeFooter = homePage?.structure.find((b) => b.type === \"footer\");\n\n // ── 1. Adicionar link \"Blog\" à navbar da home page ──\n // Preserva os links existentes e apenas insere \"Blog\" antes do último item.\n if (homePage && homeNavbar) {\n const homeIdx = newPages.findIndex((p) => p.id === homePage.id);\n if (homeIdx >= 0) {\n const navbarProps = homeNavbar.props as Record<string, any>;\n const existingLinks: Array<{ text: string; href: string }> =\n Array.isArray(navbarProps.links) ? [...navbarProps.links] : [];\n const hasBlogLink = existingLinks.some(\n (l) => l.href === \"/p/blog\",\n );\n\n if (!hasBlogLink) {\n // Inserir \"Blog\" antes do último link (geralmente \"Contato\")\n const insertIdx = existingLinks.length > 0 ? existingLinks.length - 1 : 0;\n existingLinks.splice(insertIdx, 0, { text: \"Blog\", href: \"/p/blog\" });\n\n // Atualizar navbar na home page com o novo link\n const updatedStructure = newPages[homeIdx].structure.map((b) => {\n if (b.id === homeNavbar.id) {\n return { ...b, props: { ...b.props, links: existingLinks } } as Block;\n }\n return b;\n });\n newPages[homeIdx] = { ...newPages[homeIdx], structure: updatedStructure };\n logger.debug(\"Blog link added to home navbar\");\n\n // Atualizar referência para que clones nas páginas do blog usem navbar com link\n // (homeNavbar é const, então criamos a versão atualizada para uso nos clones)\n (homeNavbar as any).props = { ...navbarProps, links: existingLinks };\n }\n }\n }\n\n // ── 2. Injetar seção de blog na home page (antes do footer) ──\n if (homePage) {\n const homeIdx = newPages.findIndex((p) => p.id === homePage.id);\n const alreadyInjected = homePage.structure.some(\n (b) => b.id === BLOG_HOME_SECTION_ID,\n );\n\n if (homeIdx >= 0 && !alreadyInjected) {\n const blogHomeSection: Block = {\n id: BLOG_HOME_SECTION_ID,\n type: \"blogPostGrid\",\n props: {\n title: \"Blog\",\n subtitle: \"Últimas publicações\",\n columns: 3,\n cards: SAMPLE_BLOG_CARDS,\n variant: \"default\",\n showViewAll: true,\n viewAllText: \"Ver todos os posts\",\n viewAllHref: \"/site/p/blog\",\n },\n } as Block;\n\n const updatedStructure = [...newPages[homeIdx].structure];\n const footerIdx = updatedStructure.findIndex(\n (b) => b.type === \"footer\",\n );\n\n if (footerIdx >= 0) {\n updatedStructure.splice(footerIdx, 0, blogHomeSection);\n } else {\n updatedStructure.push(blogHomeSection);\n }\n\n newPages[homeIdx] = {\n ...newPages[homeIdx],\n structure: updatedStructure,\n };\n logger.debug(\"Blog section injected into home page\");\n }\n }\n\n // ── 3. Criar página \"Blog\" (listagem completa) ──\n if (!existingPageIds.has(\"blog\")) {\n const blogPageStructure: Block[] = [];\n\n // Navbar clonada da home\n if (homeNavbar) {\n blogPageStructure.push(cloneBlock(homeNavbar, \"blog-page-navbar\"));\n }\n\n // Hero banner do blog\n blogPageStructure.push({\n id: \"blog-page-hero\",\n type: \"hero\",\n props: {\n title: \"Blog\",\n subtitle: \"Novidades & Publicações\",\n description:\n \"Acompanhe as últimas novidades, eventos e conquistas da nossa comunidade escolar.\",\n variant: \"centered\",\n align: \"center\",\n overlay: true,\n overlayColor: \"rgba(79, 70, 229, 0.9)\",\n background: \"#4f46e5\",\n minHeight: \"280px\",\n },\n } as Block);\n\n // Search bar\n blogPageStructure.push({\n id: \"blog-search-bar\",\n type: \"blogSearchBar\",\n props: {\n placeholder: \"Buscar posts...\",\n variant: \"simple\",\n showIcon: true,\n searchUrl: \"/site/p/blog\",\n },\n } as Block);\n\n // Category filter\n blogPageStructure.push({\n id: \"blog-category-filter\",\n type: \"blogCategoryFilter\",\n props: {\n title: \"\",\n categories: SAMPLE_BLOG_CARDS.map((c) => ({\n name: c.category,\n slug: c.category.toLowerCase().replace(/\\s+/g, \"-\"),\n count: 1,\n })),\n variant: \"chips\",\n showCount: false,\n showAll: true,\n allLabel: \"Todas\",\n filterUrl: \"/site/p/blog\",\n },\n } as Block);\n\n // Grid de posts\n blogPageStructure.push({\n id: \"blog-grid-main\",\n type: \"blogPostGrid\",\n props: {\n title: \"\",\n subtitle: \"\",\n columns: 3,\n cards: SAMPLE_BLOG_CARDS,\n variant: \"default\",\n showViewAll: false,\n viewAllText: \"Ver todos\",\n viewAllHref: \"/site/p/blog\",\n },\n } as Block);\n\n // Footer clonado da home\n if (homeFooter) {\n blogPageStructure.push(cloneBlock(homeFooter, \"blog-page-footer\"));\n }\n\n newPages.push({\n id: \"blog\",\n name: \"Blog\",\n slug: \"blog\",\n pluginId: \"blog\",\n pageTemplateId: \"blog-listing\",\n structure: blogPageStructure,\n dataSource: {\n provider: \"blog-posts\",\n mode: \"list\",\n defaultParams: { limit: 15 },\n },\n });\n logger.debug(\"Blog listing page created\");\n }\n\n // ── 4. Criar página \"Post\" (detalhe com sidebar) ──\n if (!existingPageIds.has(\"blog-post\")) {\n const postPageStructure: Block[] = [];\n\n if (homeNavbar) {\n postPageStructure.push(cloneBlock(homeNavbar, \"post-page-navbar\"));\n }\n\n // Grid layout: conteúdo principal + sidebar\n postPageStructure.push({\n id: \"blog-detail-layout\",\n type: \"grid\",\n props: {\n colTemplate: \"1fr 320px\",\n gap: \"2rem\",\n children: [\n // Coluna principal: blogPostDetail\n {\n id: \"blog-detail-main\",\n type: \"blogPostDetail\",\n props: {\n title: \"Feira de Ciências 2026: Inovação e Criatividade\",\n content: SAMPLE_POST_CONTENT,\n featuredImage:\n \"https://images.unsplash.com/photo-1567168544230-3b9e5ec47659?w=1200&h=600&fit=crop\",\n date: \"05 Fev 2026\",\n category: \"Eventos\",\n authorVariant: \"inline\",\n readingTime: \"5 min de leitura\",\n tags: [\"Feira de Ciências\", \"Eventos\", \"Sustentabilidade\", \"Projetos\"],\n showFeaturedImage: true,\n showAuthor: true,\n showDate: true,\n showTags: true,\n showReadingTime: true,\n contentMaxWidth: \"720px\",\n },\n },\n // Sidebar: stack vertical com widgets\n {\n id: \"blog-detail-sidebar\",\n type: \"stack\",\n props: {\n direction: \"col\",\n gap: \"1.5rem\",\n children: [\n {\n id: \"blog-sidebar-search\",\n type: \"blogSearchBar\",\n props: {\n placeholder: \"Buscar posts...\",\n variant: \"simple\",\n showIcon: true,\n searchUrl: \"/site/p/blog\",\n },\n },\n {\n id: \"blog-sidebar-categories\",\n type: \"blogCategoryFilter\",\n props: {\n title: \"Categorias\",\n categories: SAMPLE_BLOG_CARDS.map((c) => ({\n name: c.category,\n slug: c.category.toLowerCase().replace(/\\s+/g, \"-\"),\n count: 1,\n })),\n variant: \"list\",\n showCount: true,\n showAll: true,\n allLabel: \"Todas\",\n filterUrl: \"/site/p/blog\",\n },\n },\n {\n id: \"blog-sidebar-recent\",\n type: \"blogRecentPosts\",\n props: {\n title: \"Posts Recentes\",\n count: 5,\n showThumbnail: true,\n showDate: true,\n showCategory: false,\n posts: SAMPLE_BLOG_CARDS.map((c) => ({\n title: c.title,\n slug: c.linkHref.replace(\"/site/p/blog/\", \"\"),\n date: c.date,\n image: c.image,\n category: c.category,\n })),\n },\n },\n {\n id: \"blog-sidebar-tags\",\n type: \"blogTagCloud\",\n props: {\n title: \"Tags\",\n tags: [\n { name: \"Eventos\", count: 3 },\n { name: \"Educação\", count: 2 },\n { name: \"Institucional\", count: 1 },\n { name: \"Sustentabilidade\", count: 1 },\n ],\n variant: \"badges\",\n },\n },\n ],\n },\n },\n ] as Block[],\n },\n } as Block);\n\n if (homeFooter) {\n postPageStructure.push(cloneBlock(homeFooter, \"post-page-footer\"));\n }\n\n newPages.push({\n id: \"blog-post\",\n name: \"Post\",\n slug: \"blog/:slug\",\n pluginId: \"blog\",\n pageTemplateId: \"blog-post\",\n isDynamic: true,\n structure: postPageStructure,\n dataSource: {\n provider: \"blog-posts\",\n mode: \"single\",\n paramMapping: { slug: \":slug\" },\n },\n editRestrictions: {\n nonRemovable: true,\n },\n });\n logger.debug(\"Blog post detail page created with sidebar layout\");\n }\n\n return {\n ...document,\n pages: newPages,\n };\n },\n\n onDeactivate(document: SiteDocument): SiteDocument {\n logger.debug(\"Blog plugin deactivating...\");\n\n const newPages = document.pages\n // Remover páginas do plugin\n .filter((page) => page.pluginId !== \"blog\")\n // Remover seção de blog injetada + link \"Blog\" da navbar\n .map((page) => {\n let structure = page.structure;\n\n // Remover seção de blog injetada\n const hasInjected = structure.some(\n (b) => b.id === BLOG_HOME_SECTION_ID,\n );\n if (hasInjected) {\n structure = structure.filter(\n (b) => b.id !== BLOG_HOME_SECTION_ID,\n );\n }\n\n // Remover link \"Blog\" (/p/blog) da navbar\n structure = structure.map((b) => {\n if (b.type !== \"navbar\") return b;\n const props = b.props as Record<string, any>;\n const links: Array<{ text: string; href: string }> = Array.isArray(props.links) ? props.links : [];\n const filtered = links.filter((l) => l.href !== \"/p/blog\");\n if (filtered.length !== links.length) {\n return { ...b, props: { ...props, links: filtered } } as Block;\n }\n return b;\n });\n\n if (structure !== page.structure) {\n return { ...page, structure };\n }\n return page;\n });\n\n logger.debug(\n `Removed ${document.pages.length - newPages.length} blog page(s) and injected section`,\n );\n\n return {\n ...document,\n pages: newPages,\n };\n },\n\n getEditorRestrictions(blockType: BlockType) {\n if (blockType === \"blogPostDetail\") {\n return {\n lockedFields: [\"content\", \"date\"],\n };\n }\n if (blockType === \"blogCategoryFilter\") {\n return {\n lockedFields: [\"categories\"],\n };\n }\n if (blockType === \"blogRecentPosts\") {\n return {\n lockedFields: [\"posts\"],\n };\n }\n if (blockType === \"blogTagCloud\") {\n return {\n lockedFields: [\"tags\"],\n };\n }\n return undefined;\n },\n};\n\n// Auto-registrar o plugin (side effect — como os blocos fazem com componentRegistry)\npluginRegistry.register(blogPlugin);\n"],"names":["BLOG_HOME_SECTION_ID","SAMPLE_BLOG_CARDS","SAMPLE_POST_CONTENT","cloneBlock","block","newId","blogPlugin","document","logger","existingPageIds","p","newPages","homePage","homeNavbar","b","homeFooter","homeIdx","navbarProps","existingLinks","l","insertIdx","updatedStructure","alreadyInjected","blogHomeSection","footerIdx","blogPageStructure","c","postPageStructure","page","structure","props","links","filtered","blockType","pluginRegistry"],"mappings":";;AAoBA,MAAMA,IAAuB,yBAGvBC,IAAoB;AAAA,EACxB;AAAA,IACE,OAAO;AAAA,IACP,SACE;AAAA,IACF,OACE;AAAA,IACF,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEZ;AAAA,IACE,OAAO;AAAA,IACP,SACE;AAAA,IACF,OACE;AAAA,IACF,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEZ;AAAA,IACE,OAAO;AAAA,IACP,SACE;AAAA,IACF,OACE;AAAA,IACF,UAAU;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAEd,GAGMC,IAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6B1B,KAAA;AAKF,SAASC,EAAWC,GAAcC,GAAsB;AAEtD,SAAO,EAAE,GADa,KAAK,MAAM,KAAK,UAAUD,CAAK,CAAC,GAClC,IAAIC,EAAA;AAC1B;AAEO,MAAMC,IAAiC;AAAA,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