@oktis-works/cms 0.19.2 → 0.19.4

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 (52) hide show
  1. package/dist/commands.d.ts.map +1 -1
  2. package/dist/commands.js +74 -70
  3. package/dist/commands.js.map +1 -1
  4. package/dist/extension-scaffold.d.ts.map +1 -1
  5. package/dist/extension-scaffold.js +19 -33
  6. package/dist/extension-scaffold.js.map +1 -1
  7. package/dist/generated/app-versions.js +3 -3
  8. package/dist/generated/theme-assets.d.ts.map +1 -1
  9. package/dist/generated/theme-assets.js +203 -553
  10. package/dist/generated/theme-assets.js.map +1 -1
  11. package/dist/install-loader.d.ts +13 -0
  12. package/dist/install-loader.d.ts.map +1 -1
  13. package/dist/install-loader.js +34 -2
  14. package/dist/install-loader.js.map +1 -1
  15. package/dist/plugins/mermaid-field/admin/components/MermaidField.tsx +135 -0
  16. package/dist/plugins/mermaid-field/admin/components/MermaidFieldRenderer.tsx +170 -0
  17. package/dist/plugins/mermaid-field/index.js +7 -0
  18. package/dist/plugins/mermaid-field/manifest.json +43 -0
  19. package/dist/prompt.d.ts +39 -5
  20. package/dist/prompt.d.ts.map +1 -1
  21. package/dist/prompt.js +147 -51
  22. package/dist/prompt.js.map +1 -1
  23. package/dist/scaffold.d.ts +4 -0
  24. package/dist/scaffold.d.ts.map +1 -1
  25. package/dist/scaffold.js +41 -0
  26. package/dist/scaffold.js.map +1 -1
  27. package/dist/theme-build.js +1 -1
  28. package/dist/theme-build.js.map +1 -1
  29. package/dist/theme-engine-assets.d.ts +2 -3
  30. package/dist/theme-engine-assets.d.ts.map +1 -1
  31. package/dist/theme-engine-assets.js +1 -2
  32. package/dist/theme-engine-assets.js.map +1 -1
  33. package/dist/themes/default/404.tsx +10 -0
  34. package/dist/themes/default/archive.tsx +34 -0
  35. package/dist/themes/default/home.tsx +54 -0
  36. package/dist/themes/default/index.tsx +19 -0
  37. package/dist/themes/default/page.tsx +19 -0
  38. package/dist/themes/default/single.tsx +33 -0
  39. package/dist/themes/default/src/entry-server.tsx +29 -0
  40. package/dist/themes/default/theme.json +17 -16
  41. package/package.json +4 -4
  42. package/dist/themes/default/404.astro +0 -8
  43. package/dist/themes/default/archive.astro +0 -52
  44. package/dist/themes/default/index.astro +0 -29
  45. package/dist/themes/default/page-about.astro +0 -52
  46. package/dist/themes/default/page-blog.astro +0 -52
  47. package/dist/themes/default/page-contact.astro +0 -56
  48. package/dist/themes/default/page-home.astro +0 -99
  49. package/dist/themes/default/page.astro +0 -35
  50. package/dist/themes/default/post-first-post.astro +0 -51
  51. package/dist/themes/default/post-second-post.astro +0 -51
  52. package/dist/themes/default/single.astro +0 -55
@@ -6,66 +6,50 @@
6
6
  // file drifts from the directory it mirrors.
7
7
  /** Complete default theme written by `okcms init` (paths relative to themes/default/). */
8
8
  export const DEFAULT_THEME_FILES = {
9
- "404.astro": `<main data-template="404" class="error-404">
10
- <div class="container">
11
- <h1>404</h1>
12
- <h2>Page not found</h2>
13
- <p>The page you are looking for does not exist or has been moved.</p>
14
- <a href="/" class="btn btn-primary">Back to the home page</a>
15
- </div>
16
- </main>`,
17
- "archive.astro": `<main data-template="archive" data-type="{{page.type}}" class="archive">
18
- <header class="archive-header">
19
- <div class="container">
20
- <h1 class="archive-title">{{page.title}}</h1>
21
- {{#if settings.theme.siteDescription}}
22
- <p class="archive-description">{{settings.theme.siteDescription}}</p>
23
- {{/if}}
24
- </div>
25
- </header>
26
-
27
- <section class="posts-section" aria-labelledby="posts-title">
28
- <div class="container">
29
- {{#if items}}
30
- <div class="posts-grid">
31
- {{#each items}}
32
- <article class="post-card">
33
- {{#if thumbnail.url}}
34
- <figure class="post-card__image">
35
- <a href="{{url}}">
36
- <img src="{{thumbnail.url}}" alt="{{thumbnail.alt}}" loading="lazy" />
37
- </a>
38
- </figure>
39
- {{/if}}
40
- <div class="post-card__content">
41
- <header class="post-card__header">
42
- <time class="post-card__date" datetime="{{published_at}}">
43
- {{#if published_at}}
44
- {{formatDate published_at}}
45
- {{/if}}
46
- </time>
47
- </header>
48
- <h2 class="post-card__title"><a href="{{url}}">{{title}}</a></h2>
49
- {{#if excerpt}}
50
- <p class="post-card__excerpt">{{excerpt}}</p>
51
- {{/if}}
52
- <a href="{{url}}" class="btn btn-outline">Continue reading</a>
9
+ "404.tsx": `export default function NotFound() {
10
+ return (
11
+ <main className="site error-404">
12
+ <h1>404</h1>
13
+ <h2>Page Not Found</h2>
14
+ <p>Sorry, we couldn't find the page you're looking for.</p>
15
+ <a href="/" className="btn btn-primary">Go Home</a>
16
+ </main>
17
+ );
18
+ }`,
19
+ "archive.tsx": `import type { ThemePageData } from '@oktis-works/theme-sdk';
20
+
21
+ export default function Archive({ page, items }: ThemePageData) {
22
+ return (
23
+ <main className="site archive">
24
+ <header className="archive-header">
25
+ <div className="container">
26
+ <h1 className="archive-title">{page.title}</h1>
27
+ {page.excerpt && <p className="archive-description">{page.excerpt}</p>}
28
+ </div>
29
+ </header>
30
+ <div className="container">
31
+ <section className="posts">
32
+ <div className="posts-grid">
33
+ {items.map((item) => (
34
+ <article className="post-card" key={String(item.slug)}>
35
+ <div className="post-card__content">
36
+ <div className="post-card__header">
37
+ <time className="post-card__date">{item.publishedAt ? new Date(item.publishedAt).toLocaleDateString() : ''}</time>
38
+ </div>
39
+ <h2 className="post-card__title">
40
+ <a href={\`/\${String(item.slug)}\`}>{String(item.title ?? '')}</a>
41
+ </h2>
42
+ {item.excerpt ? <p className="post-card__excerpt">{String(item.excerpt)}</p> : null}
43
+ <a href={\`/\${String(item.slug)}\`} className="btn btn-outline">Read More</a>
44
+ </div>
45
+ </article>
46
+ ))}
53
47
  </div>
54
- </article>
55
- {{/each}}
48
+ </section>
56
49
  </div>
57
-
58
- {{#if pagination}}
59
- <nav class="pagination" aria-label="Pagination">
60
- {{pagination}}
61
- </nav>
62
- {{/if}}
63
- {{else}}
64
- <p class="no-posts">No content published yet.</p>
65
- {{/if}}
66
- </div>
67
- </section>
68
- </main>`,
50
+ </main>
51
+ );
52
+ }`,
69
53
  "dist/theme.css": `/**
70
54
  * Tema Default do OkCMS — Design System CSS
71
55
  * Engine: css | Isolation: manual
@@ -1082,495 +1066,160 @@ export const DEFAULT_THEME_FILES = {
1082
1066
  }
1083
1067
  }
1084
1068
  `,
1085
- "index.astro": `<main data-template="index" data-type="{{page.type}}" class="page">
1086
- <header class="page-header">
1087
- <div class="container">
1088
- <h1>{{settings.theme.siteTitle || page.title}}</h1>
1089
- {{#if settings.theme.siteDescription}}
1090
- <p class="page-description">{{settings.theme.siteDescription}}</p>
1091
- {{/if}}
1092
- </div>
1093
- </header>
1094
-
1095
- <div class="page-content container">
1096
- {{#if (field "content")}}
1097
- <div class="entry-content">{{{field "content"}}}</div>
1098
- {{else if content.text}}
1099
- <p>{{content.text}}</p>
1100
- {{/if}}
1101
-
1102
- {{#if items}}
1103
- <section class="listing">
1104
- {{#each items}}
1105
- <article class="card entry entry--item">
1106
- <h2 class="entry__title"><a href="/{{slug}}">{{title}}</a></h2>
1107
- {{#if excerpt}}<p class="entry__excerpt">{{excerpt}}</p>{{/if}}
1108
- </article>
1109
- {{/each}}
1110
- </section>
1111
- {{/if}}
1112
- </div>
1113
- </main>
1114
- `,
1115
- "page-about.astro": `<main data-template="page-about" data-type="page" class="page-about">
1116
- <header class="site-header">
1117
- <nav class="nav" role="navigation" aria-label="Main navigation">
1118
- <a href="/" class="site-brand" aria-label="Home">
1119
- {{site.title}}
1120
- </a>
1121
- <ul class="nav-menu">
1122
- <li><a href="/about">{{#if menus.header.bySlug.about}}{{menus.header.bySlug.about.label}}{{else}}About{{/if}}</a></li>
1123
- <li><a href="#contact">Contact</a></li>
1124
- <li><a href="/blog">{{#if menus.header.bySlug.blog}}{{menus.header.bySlug.blog.label}}{{else}}Blog{{/if}}</a></li>
1125
- </ul>
1126
- </nav>
1127
- </header>
1128
-
1129
- <section class="page-header">
1130
- <div class="container">
1131
- <h1>{{field "title"}}</h1>
1132
- {{#if (field "excerpt")}}
1133
- <p class="page-excerpt">{{field "excerpt"}}</p>
1134
- {{/if}}
1135
- </div>
1136
- </header>
1137
-
1138
- <div class="page-content container">
1139
- {{#if (field "content")}}
1140
- <div class="entry-content">{{{field "content"}}}</div>
1141
- {{else if (field "blocks")}}
1142
- <div class="entry-content">
1143
- {{#each fields.blocks}}
1144
- {{#if (eq type 'heading')}}
1145
- <h{{level}}>{{content}}</h{{level}}>
1146
- {{else if (eq type 'paragraph')}}
1147
- <p>{{content}}</p>
1148
- {{else if (eq type 'image')}}
1149
- <figure><img src="{{content.url}}" alt="{{content.alt}}" /></figure>
1150
- {{/if}}
1151
- {{/each}}
1152
- </div>
1153
- {{/if}}
1154
- </div>
1155
- </main>
1156
-
1157
- <footer class="site-footer" role="contentinfo">
1158
- <div class="container">
1159
- <nav class="footer-nav" aria-label="Footer navigation">
1160
- {{#each menus.footer.items}}
1161
- <a href="{{url}}">{{label}}</a>
1162
- {{/each}}
1163
- </nav>
1164
- <p class="copyright">&copy; {{new Date().getFullYear()}} {{site.title}}. All rights reserved.</p>
1165
- </div>
1166
- </footer>
1167
- `,
1168
- "page-blog.astro": `<main data-template="page-blog" data-type="page" class="page-blog">
1169
- <header class="page-header">
1170
- <div class="container">
1171
- <h1>{{field "title"}}</h1>
1172
- {{#if (field "description")}}
1173
- <p class="page-description">{{field "description"}}</p>
1174
- {{/if}}
1175
- </div>
1176
- </header>
1177
-
1178
- <section class="posts-section" aria-labelledby="posts-title">
1179
- <div class="container">
1180
- {{#if items}}
1181
- <div class="posts-grid">
1182
- {{#each items}}
1183
- <article class="post-card">
1184
- {{#if thumbnail.url}}
1185
- <figure class="post-card__image">
1186
- <a href="{{url}}">
1187
- <img src="{{thumbnail.url}}" alt="{{thumbnail.alt}}" loading="lazy" />
1188
- </a>
1189
- </figure>
1190
- {{/if}}
1191
- <div class="post-card__content">
1192
- <header class="post-card__header">
1193
- <time class="post-card__date" datetime="{{published_at}}">
1194
- {{#if published_at}}
1195
- {{formatDate published_at}}
1196
- {{/if}}
1197
- </time>
1198
- </header>
1199
- <h2 class="post-card__title"><a href="{{url}}">{{title}}</a></h2>
1200
- {{#if excerpt}}
1201
- <p class="post-card__excerpt">{{excerpt}}</p>
1202
- {{/if}}
1203
- <a href="{{url}}" class="btn btn-outline">Continue reading</a>
1204
- </div>
1205
- </article>
1206
- {{/each}}
1207
- </div>
1208
-
1209
- {{#if pagination}}
1210
- <nav class="pagination" aria-label="Pagination">
1211
- {{pagination}}
1212
- </nav>
1213
- {{/if}}
1214
- {{else}}
1215
- <p class="no-posts">No articles published yet.</p>
1216
- {{/if}}
1217
- </div>
1218
- </section>
1219
- </main>
1220
- `,
1221
- "page-contact.astro": `<main data-template="page-contact" data-type="page" class="page-contact">
1222
- <header class="site-header">
1223
- <nav class="nav" role="navigation" aria-label="Main navigation">
1224
- <a href="/" class="site-brand" aria-label="Home">
1225
- {{site.title}}
1226
- </a>
1227
- <ul class="nav-menu">
1228
- <li><a href="/about">{{#if menus.header.bySlug.about}}{{menus.header.bySlug.about.label}}{{else}}About{{/if}}</a></li>
1229
- <li><a href="#contact">Contact</a></li>
1230
- <li><a href="/blog">{{#if menus.header.bySlug.blog}}{{menus.header.bySlug.blog.label}}{{else}}Blog{{/if}}</a></li>
1231
- </ul>
1232
- </nav>
1233
- </header>
1234
-
1235
- <section class="page-header">
1236
- <div class="container">
1237
- <h1>{{field "title"}}</h1>
1238
- {{#if (field "excerpt")}}
1239
- <p class="page-excerpt">{{field "excerpt"}}</p>
1240
- {{/if}}
1241
- </div>
1242
- </section>
1243
-
1244
- <section class="contact" id="contact" aria-labelledby="contact-title">
1245
- <div class="container">
1246
- <h2 id="contact-title">Get in Touch</h2>
1247
- <p class="contact-intro">{{settings.contactText || 'Fill out the form or send us an email at hello@example.com — we would love to hear from you.'}}</p>
1248
- <form class="contact-form" action="mailto:hello@example.com" method="POST" enctype="text/plain">
1249
- <div class="form-group">
1250
- <label for="contact-name">Name</label>
1251
- <input type="text" id="contact-name" name="name" required />
1069
+ "home.tsx": `import type { ThemePageData } from '@oktis-works/theme-sdk';
1070
+
1071
+ export default function Home({ site, items, settings }: ThemePageData) {
1072
+ const theme = (settings.theme ?? {}) as Record<string, unknown>;
1073
+ return (
1074
+ <main className="site">
1075
+ <header className="site-header">
1076
+ <div className="container">
1077
+ <h1>{String(theme.siteTitle ?? site.title)}</h1>
1078
+ <p>{site.description}</p>
1252
1079
  </div>
1253
- <div class="form-group">
1254
- <label for="contact-email">E-mail</label>
1255
- <input type="email" id="contact-email" name="email" required />
1080
+ </header>
1081
+ <section className="hero">
1082
+ <div className="hero-content">
1083
+ <h1>Welcome to {String(theme.siteTitle ?? site.title)}</h1>
1084
+ <p className="hero-subtitle">{site.description || 'A modern CMS built with React and TypeScript.'}</p>
1085
+ <a href="/blog" className="btn btn-primary">Read the Blog</a>
1256
1086
  </div>
1257
- <div class="form-group">
1258
- <label for="contact-message">Message</label>
1259
- <textarea id="contact-message" name="message" rows="5" required></textarea>
1087
+ </section>
1088
+ <section className="about-preview">
1089
+ <div className="container">
1090
+ <div className="about-content">
1091
+ <h2>About This Site</h2>
1092
+ <p>This is the default OkCMS theme, rebuilt with React SSR and island hydration.</p>
1093
+ <a href="/about" className="btn btn-secondary">Learn More</a>
1094
+ </div>
1260
1095
  </div>
1261
- <button type="submit" class="btn btn-primary">Send</button>
1262
- </form>
1263
- </div>
1264
- </section>
1265
- </main>
1266
-
1267
- <footer class="site-footer" role="contentinfo">
1268
- <div class="container">
1269
- <nav class="footer-nav" aria-label="Footer navigation">
1270
- {{#each menus.footer.items}}
1271
- <a href="{{url}}">{{label}}</a>
1272
- {{/each}}
1273
- </nav>
1274
- <p class="copyright">&copy; {{new Date().getFullYear()}} {{site.title}}. All rights reserved.</p>
1275
- </div>
1276
- </footer>
1277
- `,
1278
- "page-home.astro": `<main data-template="page-home" data-type="page" class="page-home">
1279
- <header class="site-header">
1280
- <nav class="nav" role="navigation" aria-label="Main navigation">
1281
- <a href="/" class="site-brand" aria-label="Home">
1282
- {{site.title}}
1283
- </a>
1284
- <ul class="nav-menu">
1285
- <li><a href="/about">{{#if menus.header.bySlug.about}}{{menus.header.bySlug.about.label}}{{else}}About{{/if}}</a></li>
1286
- <li><a href="#contact">Contact</a></li>
1287
- <li><a href="/blog">{{#if menus.header.bySlug.blog}}{{menus.header.bySlug.blog.label}}{{else}}Blog{{/if}}</a></li>
1288
- </ul>
1289
- </nav>
1290
- </header>
1291
-
1292
- <section class="hero" id="hero" aria-labelledby="hero-title">
1293
- <div class="hero-content">
1294
- <h1 id="hero-title">{{field "title"}}</h1>
1295
- {{#if (field "subtitle")}}
1296
- <p class="hero-subtitle">{{field "subtitle"}}</p>
1297
- {{/if}}
1298
- <a href="/blog" class="btn btn-primary" role="button">View Blog</a>
1299
- </div>
1300
- </section>
1301
-
1302
- <section class="about-preview" id="about" aria-labelledby="about-title">
1303
- <div class="container">
1304
- <h2 id="about-title">About Us</h2>
1305
- {{#if (field "aboutPreview.html")}}
1306
- <div class="about-content">{{{field "aboutPreview.html"}}}</div>
1307
- {{else}}
1308
- <p>About section content will appear here when configured.</p>
1309
- {{/if}}
1310
- <a href="/about" class="btn btn-secondary">Read more →</a>
1311
- </div>
1312
- </section>
1313
-
1314
- <section class="latest-posts" aria-labelledby="latest-title">
1315
- <div class="container">
1316
- <header class="section-header">
1317
- <h2 id="latest-title">Latest Articles</h2>
1318
- </header>
1319
- {{#if items}}
1320
- <div class="posts-grid">
1321
- {{#each items}}
1322
- <article class="post-card">
1323
- {{#if thumbnail.url}}
1324
- <figure class="post-card__image">
1325
- <img src="{{thumbnail.url}}" alt="{{thumbnail.alt}}" loading="lazy" />
1326
- </figure>
1327
- {{/if}}
1328
- <div class="post-card__content">
1329
- <h3 class="post-card__title"><a href="{{url}}">{{title}}</a></h3>
1330
- {{#if excerpt}}
1331
- <p class="post-card__excerpt">{{excerpt}}</p>
1332
- {{/if}}
1333
- <a href="{{url}}" class="btn btn-outline">Continue reading</a>
1096
+ </section>
1097
+ <section className="posts">
1098
+ <div className="container">
1099
+ <header className="section-header">
1100
+ <h2>Latest Posts</h2>
1101
+ </header>
1102
+ <div className="posts-grid">
1103
+ {items.map((item) => (
1104
+ <article className="post-card" key={String(item.slug)}>
1105
+ <div className="post-card__content">
1106
+ <div className="post-card__header">
1107
+ <time className="post-card__date">{item.publishedAt ? new Date(item.publishedAt).toLocaleDateString() : ''}</time>
1108
+ </div>
1109
+ <h2 className="post-card__title">
1110
+ <a href={\`/\${String(item.slug)}\`}>{String(item.title ?? '')}</a>
1111
+ </h2>
1112
+ {item.excerpt ? <p className="post-card__excerpt">{String(item.excerpt)}</p> : null}
1113
+ <a href={\`/\${String(item.slug)}\`} className="btn btn-outline">Read More</a>
1114
+ </div>
1115
+ </article>
1116
+ ))}
1334
1117
  </div>
1335
- </article>
1336
- {{/each}}
1337
- </div>
1338
- {{else}}
1339
- <p class="no-posts">No articles published yet.</p>
1340
- {{/if}}
1341
- </div>
1342
- </section>
1343
-
1344
- <section class="contact" id="contact" aria-labelledby="contact-title">
1345
- <div class="container">
1346
- <h2 id="contact-title">Get in Touch</h2>
1347
- <p class="contact-intro">{{settings.contactText || 'Fill out the form or send us an email at hello@example.com — we would love to hear from you.'}}</p>
1348
- <form class="contact-form" action="mailto:hello@example.com" method="POST" enctype="text/plain">
1349
- <div class="form-group">
1350
- <label for="contact-name">Name</label>
1351
- <input type="text" id="contact-name" name="name" required />
1352
1118
  </div>
1353
- <div class="form-group">
1354
- <label for="contact-email">E-mail</label>
1355
- <input type="email" id="contact-email" name="email" required />
1119
+ </section>
1120
+ </main>
1121
+ );
1122
+ }`,
1123
+ "index.tsx": `import type { ThemePageData } from '@oktis-works/theme-sdk';
1124
+
1125
+ export default function Index({ page, content }: ThemePageData) {
1126
+ return (
1127
+ <main className="site page">
1128
+ <header className="page-header">
1129
+ <div className="container">
1130
+ <h1>{page.title}</h1>
1131
+ {page.excerpt && <p className="page-excerpt">{page.excerpt}</p>}
1356
1132
  </div>
1357
- <div class="form-group">
1358
- <label for="contact-message">Message</label>
1359
- <textarea id="contact-message" name="message" rows="5" required></textarea>
1133
+ </header>
1134
+ <div className="page-content">
1135
+ <div className="container">
1136
+ <div className="entry-content" dangerouslySetInnerHTML={{ __html: String(content.html ?? '') }} />
1360
1137
  </div>
1361
- <button type="submit" class="btn btn-primary">Send</button>
1362
- </form>
1363
- </div>
1364
- </section>
1365
- </main>
1366
-
1367
- <footer class="site-footer" role="contentinfo">
1368
- <div class="container">
1369
- <nav class="footer-nav" aria-label="Footer navigation">
1370
- {{#each menus.footer.items}}
1371
- <a href="{{url}}">{{label}}</a>
1372
- {{/each}}
1373
- </nav>
1374
- <p class="copyright">&copy; {{new Date().getFullYear()}} {{site.title}}. All rights reserved.</p>
1375
- </div>
1376
- </footer>
1377
- `,
1378
- "page.astro": `<main data-template="page" data-type="{{page.type}}" class="page">
1379
- <header class="page-header">
1380
- <div class="container">
1381
- <h1>{{field "title"}}</h1>
1382
- {{#if (field "excerpt")}}
1383
- <p class="page-excerpt">{{field "excerpt"}}</p>
1384
- {{/if}}
1385
- {{#if settings.theme.siteDescription}}
1386
- <p class="site-description">{{settings.theme.siteDescription}}</p>
1387
- {{/if}}
1388
- </div>
1389
- </header>
1390
-
1391
- <div class="page-content container">
1392
- {{#if (field "content")}}
1393
- <div class="entry-content">{{{field "content"}}}</div>
1394
- {{else if (field "blocks")}}
1395
- <div class="entry-content">
1396
- {{#each fields.blocks}}
1397
- {{#if (eq type 'heading')}}
1398
- <h{{level}}>{{content}}</h{{level}}>
1399
- {{else if (eq type 'paragraph')}}
1400
- <p>{{content}}</p>
1401
- {{else if (eq type 'image')}}
1402
- <figure><img src="{{content.url}}" alt="{{content.alt}}" /></figure>
1403
- {{/if}}
1404
- {{/each}}
1405
- </div>
1406
- {{/if}}
1407
- </div>
1408
- </main>
1409
-
1410
- {{#if jsonLd}}
1411
- <script type="application/ld+json">{{{jsonLd}}}</script>
1412
- {{/if}}
1413
- `,
1414
- "post-first-post.astro": `<article data-template="post-first-post" data-type="post" class="post post-single">
1415
- <header class="post-header">
1416
- <div class="container">
1417
- <h1 class="post-title">{{field "title"}}</h1>
1418
- <div class="post-meta">
1419
- <time datetime="{{content.published_at}}" class="post-date">
1420
- {{#if content.published_at}}
1421
- {{formatDate content.published_at}}
1422
- {{/if}}
1423
- </time>
1424
1138
  </div>
1425
- </div>
1426
- </header>
1427
-
1428
- <div class="post-body container">
1429
- {{#if (field "content")}}
1430
- <div class="entry-content">{{{field "content"}}}</div>
1431
- {{else if (field "blocks")}}
1432
- <div class="entry-content">
1433
- {{#each fields.blocks}}
1434
- {{#if (eq type 'heading')}}
1435
- <h{{level}}>{{content}}</h{{level}}>
1436
- {{else if (eq type 'paragraph')}}
1437
- <p>{{content}}</p>
1438
- {{else if (eq type 'image')}}
1439
- <figure><img src="{{content.url}}" alt="{{content.alt}}" /></figure>
1440
- {{/if}}
1441
- {{/each}}
1442
- </div>
1443
- {{/if}}
1444
- </div>
1445
-
1446
- <footer class="post-footer">
1447
- <div class="container">
1448
- <nav class="post-nav" aria-label="Post navigation">
1449
- {{#if prevPost}}
1450
- <a href="/{{page.type}}/{{prevPost.slug}}" class="post-nav__prev" rel="prev">
1451
- <span class="post-nav__label">Previous article</span>
1452
- <span class="post-nav__title">{{prevPost.title}}</span>
1453
- </a>
1454
- {{/if}}
1455
- {{#if nextPost}}
1456
- <a href="/{{page.type}}/{{nextPost.slug}}" class="post-nav__next" rel="next">
1457
- <span class="post-nav__label">Next article</span>
1458
- <span class="post-nav__title">{{nextPost.title}}</span>
1459
- </a>
1460
- {{/if}}
1461
- </nav>
1462
- </div>
1463
- </footer>
1464
- </article>
1465
- `,
1466
- "post-second-post.astro": `<article data-template="post-second-post" data-type="post" class="post post-single">
1467
- <header class="post-header">
1468
- <div class="container">
1469
- <h1 class="post-title">{{field "title"}}</h1>
1470
- <div class="post-meta">
1471
- <time datetime="{{content.published_at}}" class="post-date">
1472
- {{#if content.published_at}}
1473
- {{formatDate content.published_at}}
1474
- {{/if}}
1475
- </time>
1139
+ </main>
1140
+ );
1141
+ }`,
1142
+ "page.tsx": `import type { ThemePageData } from '@oktis-works/theme-sdk';
1143
+
1144
+ export default function Page({ page, content }: ThemePageData) {
1145
+ return (
1146
+ <main className="site page">
1147
+ <header className="page-header">
1148
+ <div className="container">
1149
+ <h1>{page.title}</h1>
1150
+ {page.excerpt && <p className="page-excerpt">{page.excerpt}</p>}
1151
+ </div>
1152
+ </header>
1153
+ <div className="page-content">
1154
+ <div className="container">
1155
+ <div className="entry-content" dangerouslySetInnerHTML={{ __html: String(content.html ?? '') }} />
1156
+ </div>
1476
1157
  </div>
1477
- </div>
1478
- </header>
1479
-
1480
- <div class="post-body container">
1481
- {{#if (field "content")}}
1482
- <div class="entry-content">{{{field "content"}}}</div>
1483
- {{else if (field "blocks")}}
1484
- <div class="entry-content">
1485
- {{#each fields.blocks}}
1486
- {{#if (eq type 'heading')}}
1487
- <h{{level}}>{{content}}</h{{level}}>
1488
- {{else if (eq type 'paragraph')}}
1489
- <p>{{content}}</p>
1490
- {{else if (eq type 'image')}}
1491
- <figure><img src="{{content.url}}" alt="{{content.alt}}" /></figure>
1492
- {{/if}}
1493
- {{/each}}
1494
- </div>
1495
- {{/if}}
1496
- </div>
1497
-
1498
- <footer class="post-footer">
1499
- <div class="container">
1500
- <nav class="post-nav" aria-label="Post navigation">
1501
- {{#if prevPost}}
1502
- <a href="/{{page.type}}/{{prevPost.slug}}" class="post-nav__prev" rel="prev">
1503
- <span class="post-nav__label">Previous article</span>
1504
- <span class="post-nav__title">{{prevPost.title}}</span>
1505
- </a>
1506
- {{/if}}
1507
- {{#if nextPost}}
1508
- <a href="/{{page.type}}/{{nextPost.slug}}" class="post-nav__next" rel="next">
1509
- <span class="post-nav__label">Next article</span>
1510
- <span class="post-nav__title">{{nextPost.title}}</span>
1511
- </a>
1512
- {{/if}}
1513
- </nav>
1514
- </div>
1515
- </footer>
1516
- </article>
1517
- `,
1518
- "single.astro": `<article data-template="single" data-type="{{page.type}}" class="post post-single">
1519
- <header class="post-header">
1520
- <div class="container">
1521
- <h1 class="post-title">{{field "title"}}</h1>
1522
- <div class="post-meta">
1523
- <time datetime="{{content.published_at}}" class="post-date">
1524
- {{#if content.published_at}}
1525
- {{formatDate content.published_at}}
1526
- {{/if}}
1527
- </time>
1158
+ </main>
1159
+ );
1160
+ }`,
1161
+ "single.tsx": `import type { ThemePageData } from '@oktis-works/theme-sdk';
1162
+
1163
+ export default function Single({ page, content }: ThemePageData) {
1164
+ return (
1165
+ <article className="site single post-single">
1166
+ <div className="container">
1167
+ <header className="post-header">
1168
+ <h1 className="post-title">{page.title}</h1>
1169
+ <div className="post-meta">
1170
+ <time className="post-date">{page.publishedAt ? new Date(page.publishedAt).toLocaleDateString() : ''}</time>
1171
+ </div>
1172
+ </header>
1173
+ <div className="post-body" dangerouslySetInnerHTML={{ __html: String(content.html ?? '') }} />
1174
+ <footer className="post-footer">
1175
+ <nav className="post-nav" aria-label="Post navigation">
1176
+ {page.previous && (
1177
+ <a href={\`/\${String(page.previous.slug)}\`} className="post-nav__prev">
1178
+ <span className="post-nav__label">Previous</span>
1179
+ <span className="post-nav__title">{String(page.previous.title)}</span>
1180
+ </a>
1181
+ )}
1182
+ {page.next && (
1183
+ <a href={\`/\${String(page.next.slug)}\`} className="post-nav__next">
1184
+ <span className="post-nav__label">Next</span>
1185
+ <span className="post-nav__title">{String(page.next.title)}</span>
1186
+ </a>
1187
+ )}
1188
+ </nav>
1189
+ </footer>
1528
1190
  </div>
1529
- </div>
1530
- </header>
1531
-
1532
- <div class="post-body container">
1533
- {{#if (field "content")}}
1534
- <div class="entry-content">{{{field "content"}}}</div>
1535
- {{else if (field "blocks")}}
1536
- <div class="entry-content">
1537
- {{#each fields.blocks}}
1538
- {{#if (eq type 'heading')}}
1539
- <h{{level}}>{{content}}</h{{level}}>
1540
- {{else if (eq type 'paragraph')}}
1541
- <p>{{content}}</p>
1542
- {{else if (eq type 'image')}}
1543
- <figure><img src="{{content.url}}" alt="{{content.alt}}" /></figure>
1544
- {{/if}}
1545
- {{/each}}
1546
- </div>
1547
- {{/if}}
1548
- </div>
1549
-
1550
- <footer class="post-footer">
1551
- <div class="container">
1552
- <nav class="post-nav" aria-label="Post navigation">
1553
- {{#if prevPost}}
1554
- <a href="{{prevPost.url || ('/' + page.type + '/' + prevPost.slug)}}" class="post-nav__prev" rel="prev">
1555
- <span class="post-nav__label">Previous article</span>
1556
- <span class="post-nav__title">{{prevPost.title}}</span>
1557
- </a>
1558
- {{/if}}
1559
- {{#if nextPost}}
1560
- <a href="{{nextPost.url || ('/' + page.type + '/' + nextPost.slug)}}" class="post-nav__next" rel="next">
1561
- <span class="post-nav__label">Next article</span>
1562
- <span class="post-nav__title">{{nextPost.title}}</span>
1563
- </a>
1564
- {{/if}}
1565
- </nav>
1566
- </div>
1567
- </footer>
1568
- </article>
1569
-
1570
- {{#if jsonLd}}
1571
- <script type="application/ld+json">{{{jsonLd}}}</script>
1572
- {{/if}}
1573
- `,
1191
+ </article>
1192
+ );
1193
+ }`,
1194
+ "src/entry-server.tsx": `import Home from '../home';
1195
+ import Index from '../index';
1196
+ import Single from '../single';
1197
+ import Page from '../page';
1198
+ import Archive from '../archive';
1199
+ import NotFound from '../404';
1200
+ import { renderToStaticMarkup } from 'react-dom/server';
1201
+ import type { FC } from 'react';
1202
+ import type { ThemePageData, ThemeRenderContext, ThemeRenderOutput } from '@oktis-works/theme-sdk';
1203
+
1204
+ const templates: Record<string, FC<ThemePageData>> = {
1205
+ 'home': Home,
1206
+ 'index': Index,
1207
+ 'single': Single,
1208
+ 'page': Page,
1209
+ 'archive': Archive,
1210
+ '404': NotFound,
1211
+ };
1212
+
1213
+ export const templateKeys = Object.keys(templates);
1214
+
1215
+ export function render(
1216
+ key: string,
1217
+ data: ThemePageData,
1218
+ _ctx?: ThemeRenderContext
1219
+ ): ThemeRenderOutput {
1220
+ const Component = templates[key] ?? templates['404'];
1221
+ return { html: renderToStaticMarkup(<Component {...data} />) };
1222
+ }`,
1574
1223
  "src/theme.css": `/**
1575
1224
  * Tema Default do OkCMS — Design System CSS
1576
1225
  * Engine: css | Isolation: manual
@@ -2588,8 +2237,8 @@ export const DEFAULT_THEME_FILES = {
2588
2237
  `,
2589
2238
  "theme.json": `{
2590
2239
  "name": "default",
2591
- "version": "0.36.2",
2592
- "description": "Default OkCMS theme — hierarchical templates with real content interpolation + Static Front Page",
2240
+ "version": "0.37.0",
2241
+ "description": "Default OkCMS theme — React SSR with island hydration",
2593
2242
  "type": "theme",
2594
2243
  "author": "Oktis Works",
2595
2244
  "compatibility": {
@@ -2598,30 +2247,31 @@ export const DEFAULT_THEME_FILES = {
2598
2247
  "screenshots": [
2599
2248
  "screenshot.png"
2600
2249
  ],
2250
+ "render": {
2251
+ "engine": "react",
2252
+ "apiVersion": 1,
2253
+ "hydration": "islands",
2254
+ "entry": "src/entry-server.tsx"
2255
+ },
2256
+ "stylesConfig": {
2257
+ "engine": "css",
2258
+ "isolation": true,
2259
+ "entry": "src/theme.css",
2260
+ "output": "dist/theme.css"
2261
+ },
2601
2262
  "provides": {
2602
2263
  "layouts": [
2603
- "page-home",
2604
- "page-about",
2605
- "page-contact",
2606
- "page-blog",
2607
- "post-first-post",
2608
- "post-second-post",
2609
- "page",
2264
+ "home",
2265
+ "index",
2610
2266
  "single",
2267
+ "page",
2611
2268
  "archive",
2612
- "index",
2613
2269
  "404"
2614
2270
  ],
2615
2271
  "assets": [
2616
2272
  "dist/theme.css"
2617
2273
  ]
2618
2274
  },
2619
- "stylesConfig": {
2620
- "engine": "css",
2621
- "isolation": "manual",
2622
- "entry": "src/theme.css",
2623
- "output": "dist/theme.css"
2624
- },
2625
2275
  "settings": [
2626
2276
  {
2627
2277
  "name": "siteTitle",