@brightsideoy/kama 1.0.0-alpha.20 → 1.0.0-alpha.22
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/bin/cli.js +3 -62
- package/content/definitions/blocks/form.yaml +20 -0
- package/content/definitions/blocks/image-gallery.yaml +34 -0
- package/content/definitions/blocks/youtube.yaml +8 -0
- package/content/definitions/field-sets/access.yaml +10 -0
- package/content/definitions/field-sets/page-base.yaml +16 -1
- package/content/definitions/forms/.gitkeep +0 -0
- package/content/{forms → definitions/forms}/contact.yaml +0 -6
- package/content/{forms → definitions/forms}/subscription.yaml +0 -6
- package/content/definitions/taxonomies/media-tag.yaml +15 -0
- package/definitions/editor/default.ts +15 -1
- package/dist/assets/AssetEditor-D9sz6bfN.css +1 -0
- package/dist/assets/AssetEditor-DW0KuNhg.js +1 -0
- package/dist/assets/CmsBadge-DnHEoBs-.js +1 -0
- package/dist/assets/CmsButton-DjIeMqGt.js +1 -0
- package/dist/assets/CmsDataRow-BKQ3_7BX.js +1 -0
- package/dist/assets/CmsFieldTaxonomy-CVlKL-l2.css +1 -0
- package/dist/assets/CmsFieldTaxonomy-ZB3iCGJl.js +1 -0
- package/dist/assets/CmsHelp-y1my4i_c.js +1 -0
- package/dist/assets/CmsImagePreview-cWi-cfCr.js +1 -0
- package/dist/assets/CmsPublisher-BOylClC7.js +3 -0
- package/dist/assets/CmsUserCenter-D9SqVAd7.js +1 -0
- package/dist/assets/EditorSplitPreview-c4y6AaHo.js +1 -0
- package/dist/assets/EditorSplitPreview-eID9z4gI.css +1 -0
- package/dist/assets/FormsWorkspace-5Mk4ulr5.js +1 -0
- package/dist/assets/FormsWorkspace-DPTcxMpw.css +1 -0
- package/dist/assets/NodeContextMenu-qV4OaL33.js +1 -0
- package/dist/assets/NodeEditor-CMVD5LSR.css +1 -0
- package/dist/assets/NodeEditor-DLhgHaBi.js +161 -0
- package/dist/assets/StatusPill-BAnTGDR_.js +1 -0
- package/dist/assets/TrashWorkspace-Cot9mtw0.js +1 -0
- package/dist/assets/{_plugin-vue_export-helper-CQxWhVtr.js → _plugin-vue_export-helper-BdT0OEbg.js} +1 -1
- package/dist/assets/circle-check-CB39w7cZ.js +1 -0
- package/dist/assets/createLucideIcon-BIiMnJpN.js +1 -0
- package/dist/assets/database-mgNVRFlp.js +1 -0
- package/dist/assets/folder-tree-BsiMujM5.js +1 -0
- package/dist/assets/globe-5RHPG-2-.js +1 -0
- package/dist/assets/history-ZSqpsbjQ.js +1 -0
- package/dist/assets/index-CXtujYMT.js +16 -0
- package/dist/assets/index-M4hAA5qU.css +1 -0
- package/dist/assets/layers-CH2VvrZT.js +1 -0
- package/dist/assets/loader-circle-CwP4GuFX.js +1 -0
- package/dist/assets/monitor-o1JOGzBn.js +1 -0
- package/dist/assets/panel-left-close-g4nIMIjy.js +1 -0
- package/dist/assets/plus-DwPH9Xh7.js +1 -0
- package/dist/assets/preload-helper-oCQc7Owg.js +1 -0
- package/dist/assets/rotate-ccw-tUaGL4DO.js +1 -0
- package/dist/assets/save-BUYaWIjt.js +1 -0
- package/dist/assets/schema-helpers-uuDCw8Rb.js +1 -0
- package/dist/assets/send-UE48lWD8.js +1 -0
- package/dist/assets/smartphone-CUB4k13p.js +1 -0
- package/dist/assets/trash-2-D8h6WxFK.js +1 -0
- package/dist/assets/useCmsState-Bc7cgBp5.js +1 -0
- package/dist/assets/useLocalStorage-DO_mDpwe.js +1 -0
- package/dist/assets/useNodes-DlRMd4Br.js +1 -0
- package/dist/assets/user-C5hzf6BE.js +1 -0
- package/dist/{dist-D_Q1y4Kh.js → dist-CVtRUnHl.js} +5418 -4277
- package/dist/index.html +32 -30
- package/dist/index.js +5228 -4097
- package/dist/nodemailer-Ccic7tRm-KQqZAWb5.js +7877 -0
- package/dist/nodemailer-Ccic7tRm.js +7908 -0
- package/dist/rolldown-runtime-B0aSnxlc.js +20 -0
- package/dist/schema-compiler.js +1 -1
- package/documentation/FORMS.md +165 -0
- package/package.json +7 -5
- package/schema.sql +23 -0
- package/templates/astro-starter/src/components/blocks/BlockRenderer.astro +7 -0
- package/templates/astro-starter/src/components/blocks/Form.astro +117 -65
- package/templates/astro-starter/src/components/global/NavigationMenu.astro +11 -3
- package/templates/astro-starter/src/lib/cms-fetch.ts +19 -0
- package/templates/astro-starter/src/pages/[...slug].astro +2 -4
- package/templates/astro-starter/src/pages/api/forms/[...path].ts +57 -0
- package/templates/kama-worker/index.js +1 -14
- package/templates/kama-worker/server.js +0 -2
- package/content/definitions/block-kama-forms.yaml +0 -5
- package/dist/assets/AssetEditor-D5j7pwcK.css +0 -1
- package/dist/assets/AssetEditor-Dt1zCR7_.js +0 -1
- package/dist/assets/CmsBadge-D0Ob9qPU.js +0 -1
- package/dist/assets/CmsButton-CbOfxvjr.js +0 -1
- package/dist/assets/CmsDataRow--H4iI_u_.js +0 -1
- package/dist/assets/CmsHelp-DyPJLGGi.js +0 -1
- package/dist/assets/CmsImagePreview-DuHPBzml.js +0 -1
- package/dist/assets/CmsPaneResizer-B62ZqsnE.js +0 -1
- package/dist/assets/CmsPublisher-DNLwjirk.js +0 -3
- package/dist/assets/CmsUserCenter-D3XDzKDC.js +0 -1
- package/dist/assets/EditorSplitPreview-BzKh4wFB.css +0 -1
- package/dist/assets/EditorSplitPreview-Cp2x0O_P.js +0 -1
- package/dist/assets/NodeContextMenu-C_HWBGeb.js +0 -1
- package/dist/assets/NodeEditor-CiXQKXK1.js +0 -147
- package/dist/assets/NodeEditor-pZI3gu4a.css +0 -1
- package/dist/assets/StatusPill-CbeW5SMT.js +0 -1
- package/dist/assets/TrashWorkspace-DgIg1v6t.js +0 -1
- package/dist/assets/circle-check-A-QeFqt3.js +0 -1
- package/dist/assets/database-hg5SqKLG.js +0 -1
- package/dist/assets/folder-tree-BWYot72H.js +0 -1
- package/dist/assets/globe-BraoljaN.js +0 -1
- package/dist/assets/history-pqIbKK9u.js +0 -1
- package/dist/assets/index-DQ6_RmCI.js +0 -14
- package/dist/assets/index-DcKiaRjI.css +0 -1
- package/dist/assets/layers-B6RgfpPR.js +0 -1
- package/dist/assets/loader-circle-BoUkhDjq.js +0 -1
- package/dist/assets/monitor-CrpvInqG.js +0 -1
- package/dist/assets/panel-left-close-CVFakVaA.js +0 -1
- package/dist/assets/plus-FQRsZBoJ.js +0 -1
- package/dist/assets/rotate-ccw-CWE4pOjs.js +0 -1
- package/dist/assets/save-Ctv8vW9H.js +0 -1
- package/dist/assets/schema-helpers-DvficKko.js +0 -1
- package/dist/assets/send-F-mJeL54.js +0 -1
- package/dist/assets/smartphone-EPce6VdP.js +0 -1
- package/dist/assets/trash-2-CAUF1KtI.js +0 -1
- package/dist/assets/useLocalStorage-C805uplI.js +0 -1
- package/dist/assets/useNodes-D2-VxsxR.js +0 -1
- package/dist/assets/user-IFlT6mYq.js +0 -1
- package/documentation/EXTENSIONS.md +0 -204
- package/extension-registry.js +0 -5
- package/templates/astro-starter/old_src/components/blocks/BlockRenderer.astro +0 -143
- package/templates/astro-starter/old_src/components/blocks/ColumnLayout.astro +0 -67
- package/templates/astro-starter/old_src/components/blocks/HeaderImage.astro +0 -126
- package/templates/astro-starter/old_src/components/blocks/Hero.astro +0 -218
- package/templates/astro-starter/old_src/components/blocks/HtmlBlock.astro +0 -25
- package/templates/astro-starter/old_src/components/blocks/ImageBlock.astro +0 -91
- package/templates/astro-starter/old_src/components/blocks/NodeList.astro +0 -274
- package/templates/astro-starter/old_src/components/blocks/TextBlock.astro +0 -15
- package/templates/astro-starter/old_src/components/global/Breadcrumb.astro +0 -108
- package/templates/astro-starter/old_src/components/global/Footer.astro +0 -50
- package/templates/astro-starter/old_src/components/global/Header.astro +0 -171
- package/templates/astro-starter/old_src/components/global/MetaHead.astro +0 -266
- package/templates/astro-starter/old_src/components/global/NavigationMenu.astro +0 -413
- package/templates/astro-starter/old_src/components/ui/KamaImage.astro +0 -180
- package/templates/astro-starter/old_src/layouts/SkeletonLayout.astro +0 -56
- package/templates/astro-starter/old_src/layouts/StandardLayout.astro +0 -63
- package/templates/astro-starter/old_src/lib/cms.ts +0 -219
- package/templates/astro-starter/old_src/lib/media/kama-image-service.ts +0 -67
- package/templates/astro-starter/old_src/lib/media/media-proxy.ts +0 -148
- package/templates/astro-starter/old_src/lib/media/media-url.ts +0 -112
- package/templates/astro-starter/old_src/middleware.ts +0 -536
- package/templates/astro-starter/old_src/pages/404.astro +0 -46
- package/templates/astro-starter/old_src/pages/[...slug].astro +0 -311
- package/templates/astro-starter/old_src/pages/api/load-nodes.ts +0 -68
- package/templates/astro-starter/old_src/pages/api/partials/node-cards.astro +0 -101
- package/templates/astro-starter/old_src/pages/llms-full.txt.ts +0 -171
- package/templates/astro-starter/old_src/pages/llms.txt.ts +0 -113
- package/templates/astro-starter/old_src/pages/media/[...path].ts +0 -14
- package/templates/astro-starter/old_src/pages/partials/footer.astro +0 -69
- package/templates/astro-starter/old_src/pages/partials/nav.astro +0 -141
- package/templates/astro-starter/old_src/styles/standard-theme.css +0 -157
- package/templates/astro-starter/old_src/utils/tiptap.ts +0 -113
- /package/dist/assets/{CmsPaneResizer-Dkidd4pI.css → preload-helper-Dkidd4pI.css} +0 -0
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
// src/components/blocks/BlockRenderer.astro
|
|
3
|
-
|
|
4
|
-
import ImageBlock from "@/components/blocks/ImageBlock.astro";
|
|
5
|
-
import HeaderImage from "@/components/blocks/HeaderImage.astro";
|
|
6
|
-
import ColumnLayout from "@/components/blocks/ColumnLayout.astro";
|
|
7
|
-
import HtmlBlock from "@/components/blocks/HtmlBlock.astro";
|
|
8
|
-
import NodeList from "@/components/blocks/NodeList.astro"; // 🎯 NEW IMPORT
|
|
9
|
-
import { extractHtml } from "@/utils/tiptap";
|
|
10
|
-
|
|
11
|
-
interface Block {
|
|
12
|
-
instanceId: number;
|
|
13
|
-
blockId?: string;
|
|
14
|
-
componentId: string;
|
|
15
|
-
data: Record<string, any>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface Props {
|
|
19
|
-
blocks?: Block[];
|
|
20
|
-
contentMap?: Record<string, any[]>;
|
|
21
|
-
region?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const { blocks = [], contentMap = {}, region = "main" } = Astro.props;
|
|
25
|
-
const safeBlocks = Array.isArray(blocks) ? blocks : [];
|
|
26
|
-
|
|
27
|
-
const visibleBlocks = safeBlocks.filter(b => {
|
|
28
|
-
if (!b || (!b.data && !b.componentId?.includes("column"))) return false;
|
|
29
|
-
|
|
30
|
-
const blockData = b.data || {};
|
|
31
|
-
if (
|
|
32
|
-
blockData.hidden === true ||
|
|
33
|
-
blockData.hidden === 1 ||
|
|
34
|
-
String(blockData.hidden) === "true"
|
|
35
|
-
) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const now = new Date();
|
|
40
|
-
if (blockData.startShowingAt) {
|
|
41
|
-
const start = new Date(blockData.startShowingAt);
|
|
42
|
-
if (!isNaN(start.getTime()) && now < start) return false;
|
|
43
|
-
}
|
|
44
|
-
if (blockData.stopShowingAt) {
|
|
45
|
-
const stop = new Date(blockData.stopShowingAt);
|
|
46
|
-
if (!isNaN(stop.getTime()) && now > stop) return false;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return true;
|
|
50
|
-
});
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
visibleBlocks.map((block, index) => {
|
|
55
|
-
const data = block.data || {};
|
|
56
|
-
const blockId = block.blockId || data.blockId || "";
|
|
57
|
-
const componentId = (block.componentId || "").toLowerCase();
|
|
58
|
-
|
|
59
|
-
// Check for any column layout ending in column or two-column
|
|
60
|
-
if (componentId.includes("column")) {
|
|
61
|
-
return <ColumnLayout blockId={blockId} contentMap={contentMap} />;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
switch (componentId) {
|
|
65
|
-
// 🎯 ADDED NODE LIST CASES
|
|
66
|
-
case "node-list":
|
|
67
|
-
case "nodelist":
|
|
68
|
-
case "article-list":
|
|
69
|
-
case "content-feed": {
|
|
70
|
-
return <NodeList data={data} />;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
case "header":
|
|
74
|
-
case "headline":
|
|
75
|
-
case "header-block":
|
|
76
|
-
case "header_block": {
|
|
77
|
-
const headline = extractHtml(data.headline || data.title);
|
|
78
|
-
const subhead = extractHtml(data.subhead || data.body);
|
|
79
|
-
return (
|
|
80
|
-
<header class="cms-block cms-block-header">
|
|
81
|
-
{headline && <Fragment set:html={headline} />}
|
|
82
|
-
{subhead && <Fragment set:html={subhead} />}
|
|
83
|
-
</header>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
case "text":
|
|
88
|
-
case "text-block":
|
|
89
|
-
case "text_block": {
|
|
90
|
-
const bodyText = extractHtml(data.body || data.text || data.content);
|
|
91
|
-
return (
|
|
92
|
-
<div class="cms-block cms-block-text">
|
|
93
|
-
<Fragment set:html={bodyText} />
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
case "html":
|
|
99
|
-
case "html-block":
|
|
100
|
-
case "html_block":
|
|
101
|
-
case "raw-html": {
|
|
102
|
-
return <HtmlBlock data={data} />;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
case "header-image":
|
|
106
|
-
case "header_image": {
|
|
107
|
-
return (
|
|
108
|
-
<HeaderImage data={data} region={region} isFirst={index === 0} />
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
case "image":
|
|
113
|
-
case "image-block":
|
|
114
|
-
case "image_block":
|
|
115
|
-
case "single_image":
|
|
116
|
-
case "single-image": {
|
|
117
|
-
return <ImageBlock data={data} region={region} isFirst={index === 0} />;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
default:
|
|
121
|
-
return import.meta.env.DEV ? (
|
|
122
|
-
<div class="unhandled-block">
|
|
123
|
-
<p>Unhandled component: {block.componentId}</p>
|
|
124
|
-
</div>
|
|
125
|
-
) : null;
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
<style>
|
|
131
|
-
.cms-block {
|
|
132
|
-
margin-bottom: 1.5rem;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.unhandled-block {
|
|
136
|
-
padding: 12px 16px;
|
|
137
|
-
border: 1px dashed #cbd5e1;
|
|
138
|
-
background: #f8fafc;
|
|
139
|
-
color: #64748b;
|
|
140
|
-
font-size: 13px;
|
|
141
|
-
margin-bottom: 1.5rem;
|
|
142
|
-
}
|
|
143
|
-
</style>
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
// src/components/blocks/ColumnLayout.astro
|
|
3
|
-
|
|
4
|
-
import BlockRenderer from "@/components/blocks/BlockRenderer.astro";
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
blockId: string;
|
|
8
|
-
contentMap: Record<string, any[]>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const { blockId, contentMap } = Astro.props;
|
|
12
|
-
|
|
13
|
-
const order = ["left", "middle", "right", "col1", "col2", "col3", "col4"];
|
|
14
|
-
|
|
15
|
-
// 1. Find all sub-regions belonging to this specific layout instance
|
|
16
|
-
const regionKeys = Object.keys(contentMap).filter(
|
|
17
|
-
key => blockId && key.startsWith(`${blockId}_`),
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
// 2. Sort keys logically (left -> middle -> right or col1 -> col2 -> col3)
|
|
21
|
-
const sortedKeys = regionKeys.sort((a, b) => {
|
|
22
|
-
const suffixA = a.replace(`${blockId}_`, "");
|
|
23
|
-
const suffixB = b.replace(`${blockId}_`, "");
|
|
24
|
-
const idxA = order.indexOf(suffixA);
|
|
25
|
-
const idxB = order.indexOf(suffixB);
|
|
26
|
-
|
|
27
|
-
if (idxA === -1 && idxB === -1) return a.localeCompare(b);
|
|
28
|
-
if (idxA === -1) return 1;
|
|
29
|
-
if (idxB === -1) return -1;
|
|
30
|
-
return idxA - idxB;
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const columnCount = Math.max(sortedKeys.length, 1);
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
<div class="cms-column-layout" style={`--col-count: ${columnCount}`}>
|
|
37
|
-
{
|
|
38
|
-
sortedKeys.map(key => {
|
|
39
|
-
const columnBlocks = contentMap[key] || [];
|
|
40
|
-
return (
|
|
41
|
-
<div class="column">
|
|
42
|
-
<!-- 🎯 Passes region={key} down to BlockRenderer -->
|
|
43
|
-
<BlockRenderer
|
|
44
|
-
blocks={columnBlocks}
|
|
45
|
-
contentMap={contentMap}
|
|
46
|
-
region={key}
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
|
-
);
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
</div>
|
|
53
|
-
|
|
54
|
-
<style>
|
|
55
|
-
.cms-column-layout {
|
|
56
|
-
display: grid;
|
|
57
|
-
gap: 2rem;
|
|
58
|
-
margin-bottom: 1.5rem;
|
|
59
|
-
grid-template-columns: 1fr;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@media (min-width: 768px) {
|
|
63
|
-
.cms-column-layout {
|
|
64
|
-
grid-template-columns: repeat(var(--col-count, 1), 1fr);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
</style>
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
// src/components/blocks/HeaderImage.astro
|
|
3
|
-
|
|
4
|
-
import KamaImage from "@/components/ui/KamaImage.astro";
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
data: {
|
|
8
|
-
image?: any;
|
|
9
|
-
image_meta?: any;
|
|
10
|
-
width?: number | string;
|
|
11
|
-
height?: number | string;
|
|
12
|
-
};
|
|
13
|
-
region?: string;
|
|
14
|
-
isFirst?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const { data, region = "main", isFirst = false } = Astro.props;
|
|
18
|
-
|
|
19
|
-
const img = data?.image;
|
|
20
|
-
|
|
21
|
-
if (!img) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Determine if this image is likely to be the Largest Contentful Paint.
|
|
27
|
-
*/
|
|
28
|
-
const isLcp = region === "header" || (region === "main" && isFirst);
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Determine grid column count from the region name.
|
|
32
|
-
*/
|
|
33
|
-
let columnCount = 1;
|
|
34
|
-
|
|
35
|
-
if (region.includes("_")) {
|
|
36
|
-
columnCount = 2;
|
|
37
|
-
|
|
38
|
-
if (region.includes("_middle") || region.includes("_col3")) {
|
|
39
|
-
columnCount = 3;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (region.includes("_col4")) {
|
|
43
|
-
columnCount = 4;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Default single-column layout (aligned to backend CDN buckets).
|
|
49
|
-
*/
|
|
50
|
-
let maxWidth = "1352";
|
|
51
|
-
let targetColumnWidth = 1352;
|
|
52
|
-
|
|
53
|
-
// 1-col: 1x/2x desktop and retina buckets
|
|
54
|
-
let optimizedWidths = [768, 1352, 1920, 2560];
|
|
55
|
-
let sizes = "(max-width: 1399px) calc(100vw - 48px), 1352px";
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Two-column layout.
|
|
59
|
-
*/
|
|
60
|
-
if (columnCount === 2) {
|
|
61
|
-
maxWidth = "660";
|
|
62
|
-
targetColumnWidth = 660;
|
|
63
|
-
|
|
64
|
-
optimizedWidths = [640, 768, 1024, 1352];
|
|
65
|
-
sizes =
|
|
66
|
-
"(max-width: 767px) calc(100vw - 48px), " +
|
|
67
|
-
"(max-width: 1399px) calc((100vw - 80px) / 2), " +
|
|
68
|
-
"660px";
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Three-column layout.
|
|
73
|
-
*/
|
|
74
|
-
else if (columnCount === 3) {
|
|
75
|
-
maxWidth = "429";
|
|
76
|
-
targetColumnWidth = 429;
|
|
77
|
-
|
|
78
|
-
optimizedWidths = [320, 640, 768, 1024];
|
|
79
|
-
sizes =
|
|
80
|
-
"(max-width: 767px) calc(100vw - 48px), " +
|
|
81
|
-
"(max-width: 1399px) calc((100vw - 112px) / 3), " +
|
|
82
|
-
"429px";
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Four-column layout.
|
|
87
|
-
*/
|
|
88
|
-
else if (columnCount === 4) {
|
|
89
|
-
maxWidth = "314";
|
|
90
|
-
targetColumnWidth = 314;
|
|
91
|
-
|
|
92
|
-
optimizedWidths = [320, 640, 768];
|
|
93
|
-
sizes =
|
|
94
|
-
"(max-width: 767px) calc(100vw - 48px), " +
|
|
95
|
-
"(max-width: 1399px) calc((100vw - 144px) / 4), " +
|
|
96
|
-
"314px";
|
|
97
|
-
}
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
<div class="cms-block cms-block-header-image" style={`--max-w: ${maxWidth}px;`}>
|
|
101
|
-
<KamaImage
|
|
102
|
-
image={img}
|
|
103
|
-
sizes={sizes}
|
|
104
|
-
desktopWidths={optimizedWidths}
|
|
105
|
-
idealWidth={targetColumnWidth}
|
|
106
|
-
class="responsive-header-image"
|
|
107
|
-
loading={isLcp ? "eager" : "lazy"}
|
|
108
|
-
fetchpriority={isLcp ? "high" : "auto"}
|
|
109
|
-
/>
|
|
110
|
-
</div>
|
|
111
|
-
|
|
112
|
-
<style>
|
|
113
|
-
.cms-block-header-image {
|
|
114
|
-
width: 100%;
|
|
115
|
-
max-width: var(--max-w, 1352px);
|
|
116
|
-
margin: 0 auto 1.5rem auto;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
:global(.responsive-header-image) {
|
|
120
|
-
width: 100%;
|
|
121
|
-
height: auto;
|
|
122
|
-
display: block;
|
|
123
|
-
border-radius: var(--cms-radius-md, 0.5rem);
|
|
124
|
-
max-width: 100%;
|
|
125
|
-
}
|
|
126
|
-
</style>
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
// src/components/blocks/Hero.astro
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
<section class="hero-container">
|
|
6
|
-
<div class="hero-content">
|
|
7
|
-
<!-- Sub-badge -->
|
|
8
|
-
<div class="hero-badge">
|
|
9
|
-
<span class="badge-dot"></span>
|
|
10
|
-
Freeware for Education & NGOs
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<!-- H1 Title with Slogan -->
|
|
14
|
-
<h1 class="hero-title">KAMA – Headless CMS on Edge</h1>
|
|
15
|
-
|
|
16
|
-
<!-- Subtitle -->
|
|
17
|
-
<p class="hero-subtitle">
|
|
18
|
-
Deploy sub-millisecond corporate web experiences with zero infrastructure
|
|
19
|
-
overhead. Built natively on Astro, Hono, and Cloudflare Workers (D1/R2).
|
|
20
|
-
</p>
|
|
21
|
-
|
|
22
|
-
<!-- Call to Action Buttons -->
|
|
23
|
-
<div class="hero-actions">
|
|
24
|
-
<a href="/docs/quick-start" class="btn btn-primary">
|
|
25
|
-
Get Started
|
|
26
|
-
<svg
|
|
27
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
28
|
-
width="16"
|
|
29
|
-
height="16"
|
|
30
|
-
viewBox="0 0 24 24"
|
|
31
|
-
fill="none"
|
|
32
|
-
stroke="currentColor"
|
|
33
|
-
stroke-width="2"
|
|
34
|
-
stroke-linecap="round"
|
|
35
|
-
stroke-linejoin="round"
|
|
36
|
-
class="btn-icon"
|
|
37
|
-
><path d="M5 12h14"></path><path d="m12 5 7 7-7 7"></path></svg
|
|
38
|
-
>
|
|
39
|
-
</a>
|
|
40
|
-
<a
|
|
41
|
-
href="https://github.com/brightside-ou/kama"
|
|
42
|
-
target="_blank"
|
|
43
|
-
rel="noopener noreferrer"
|
|
44
|
-
class="btn btn-secondary"
|
|
45
|
-
>
|
|
46
|
-
View on GitHub
|
|
47
|
-
</a>
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<!-- Tech Stack Highlights -->
|
|
51
|
-
<div class="hero-stack">
|
|
52
|
-
<span class="stack-label">Powered by edge infrastructure:</span>
|
|
53
|
-
<div class="stack-tags">
|
|
54
|
-
<span class="tag">Cloudflare Workers</span>
|
|
55
|
-
<span class="tag">D1 SQL</span>
|
|
56
|
-
<span class="tag">R2 Storage</span>
|
|
57
|
-
<span class="tag">Astro</span>
|
|
58
|
-
<span class="tag">Hono</span>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
</section>
|
|
63
|
-
|
|
64
|
-
<style>
|
|
65
|
-
.hero-container {
|
|
66
|
-
padding: 64px 0 48px;
|
|
67
|
-
background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
|
|
68
|
-
border-bottom: 1px solid #e2e8f0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.hero-content {
|
|
72
|
-
max-width: 860px;
|
|
73
|
-
margin: 0 auto;
|
|
74
|
-
text-align: center;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.hero-badge {
|
|
78
|
-
display: inline-flex;
|
|
79
|
-
align-items: center;
|
|
80
|
-
gap: 8px;
|
|
81
|
-
padding: 6px 14px;
|
|
82
|
-
background-color: #f0f9ff;
|
|
83
|
-
border: 1px solid #bae6fd;
|
|
84
|
-
color: #0369a1;
|
|
85
|
-
font-size: 0.875rem;
|
|
86
|
-
font-weight: 600;
|
|
87
|
-
margin-bottom: 24px;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.badge-dot {
|
|
91
|
-
width: 8px;
|
|
92
|
-
height: 8px;
|
|
93
|
-
background-color: #0284c7;
|
|
94
|
-
border-radius: 50% !important;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.hero-title {
|
|
98
|
-
font-size: 3rem;
|
|
99
|
-
font-weight: 800;
|
|
100
|
-
line-height: 1.15;
|
|
101
|
-
color: #0f172a;
|
|
102
|
-
letter-spacing: -0.03em;
|
|
103
|
-
margin-top: 0;
|
|
104
|
-
margin-bottom: 20px;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.hero-subtitle {
|
|
108
|
-
font-size: 1.25rem;
|
|
109
|
-
line-height: 1.6;
|
|
110
|
-
color: #475569;
|
|
111
|
-
max-width: 720px;
|
|
112
|
-
margin: 0 auto 36px;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.hero-actions {
|
|
116
|
-
display: flex;
|
|
117
|
-
align-items: center;
|
|
118
|
-
justify-content: center;
|
|
119
|
-
gap: 16px;
|
|
120
|
-
margin-bottom: 48px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.btn {
|
|
124
|
-
display: inline-flex;
|
|
125
|
-
align-items: center;
|
|
126
|
-
justify-content: center;
|
|
127
|
-
gap: 8px;
|
|
128
|
-
padding: 12px 28px;
|
|
129
|
-
font-size: 1rem;
|
|
130
|
-
font-weight: 600;
|
|
131
|
-
text-decoration: none;
|
|
132
|
-
transition: all 0.15s ease-in-out;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.btn-primary {
|
|
136
|
-
background-color: #0284c7;
|
|
137
|
-
color: #ffffff;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.btn-primary:hover {
|
|
141
|
-
background-color: #0369a1;
|
|
142
|
-
color: #ffffff;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.btn-secondary {
|
|
146
|
-
background-color: #ffffff;
|
|
147
|
-
color: #334155;
|
|
148
|
-
border: 1px solid #cbd5e1;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.btn-secondary:hover {
|
|
152
|
-
background-color: #f8fafc;
|
|
153
|
-
color: #0f172a;
|
|
154
|
-
border-color: #94a3b8;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.btn-icon {
|
|
158
|
-
transition: transform 0.15s ease;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.btn-primary:hover .btn-icon {
|
|
162
|
-
transform: translateX(4px);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.hero-stack {
|
|
166
|
-
display: flex;
|
|
167
|
-
flex-direction: column;
|
|
168
|
-
align-items: center;
|
|
169
|
-
gap: 12px;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.stack-label {
|
|
173
|
-
font-size: 0.8125rem;
|
|
174
|
-
text-transform: uppercase;
|
|
175
|
-
letter-spacing: 0.05em;
|
|
176
|
-
color: #64748b;
|
|
177
|
-
font-weight: 600;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.stack-tags {
|
|
181
|
-
display: flex;
|
|
182
|
-
flex-wrap: wrap;
|
|
183
|
-
justify-content: center;
|
|
184
|
-
gap: 8px;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.tag {
|
|
188
|
-
padding: 4px 10px;
|
|
189
|
-
background-color: #f1f5f9;
|
|
190
|
-
color: #334155;
|
|
191
|
-
font-size: 0.8125rem;
|
|
192
|
-
font-weight: 500;
|
|
193
|
-
border: 1px solid #e2e8f0;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
@media (max-width: 768px) {
|
|
197
|
-
.hero-container {
|
|
198
|
-
padding: 40px 0 32px;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.hero-title {
|
|
202
|
-
font-size: 2.125rem;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.hero-subtitle {
|
|
206
|
-
font-size: 1.05rem;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
.hero-actions {
|
|
210
|
-
flex-direction: column;
|
|
211
|
-
width: 100%;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.btn {
|
|
215
|
-
width: 100%;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
</style>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
// src/components/blocks/HtmlBlock.astro
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
data: {
|
|
6
|
-
body?: string;
|
|
7
|
-
html?: string;
|
|
8
|
-
content?: string;
|
|
9
|
-
text?: string;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const { data } = Astro.props;
|
|
14
|
-
|
|
15
|
-
// Fallback chain matching your schema's HTML field key ('body') and legacy aliases
|
|
16
|
-
const rawHtml = data?.body || data?.html || data?.content || data?.text || "";
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
rawHtml && (
|
|
21
|
-
<div class="cms-block cms-block-html">
|
|
22
|
-
<Fragment set:html={rawHtml} />
|
|
23
|
-
</div>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
// src/components/blocks/ImageBlock.astro
|
|
3
|
-
|
|
4
|
-
import KamaImage from "@/components/ui/KamaImage.astro";
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
data: {
|
|
8
|
-
image?: any;
|
|
9
|
-
width?: number | string;
|
|
10
|
-
height?: number | string;
|
|
11
|
-
};
|
|
12
|
-
region?: string;
|
|
13
|
-
isFirst?: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const { data, region = "main", isFirst = false } = Astro.props;
|
|
17
|
-
|
|
18
|
-
const img = data?.image;
|
|
19
|
-
const isLcp = region === "header" || (region === "main" && isFirst);
|
|
20
|
-
|
|
21
|
-
// 🎯 Detect column layout based on CMS region names
|
|
22
|
-
let columnCount = 1;
|
|
23
|
-
if (region.includes("_")) {
|
|
24
|
-
columnCount = 2;
|
|
25
|
-
if (region.includes("_middle") || region.includes("_col3")) columnCount = 3;
|
|
26
|
-
if (region.includes("_col4")) columnCount = 4;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// 🎯 Column Config Lookup (Target width, aligned CDN breakpoint widths, sizes)
|
|
30
|
-
const COLUMN_CONFIGS: Record<
|
|
31
|
-
number,
|
|
32
|
-
{ targetWidth: number; widths: number[]; sizes: string }
|
|
33
|
-
> = {
|
|
34
|
-
1: {
|
|
35
|
-
targetWidth: 1352,
|
|
36
|
-
widths: [768, 1352, 1920, 2560],
|
|
37
|
-
sizes: "(max-width: 1399px) calc(100vw - 48px), 1352px",
|
|
38
|
-
},
|
|
39
|
-
2: {
|
|
40
|
-
targetWidth: 660,
|
|
41
|
-
widths: [640, 768, 1024, 1352],
|
|
42
|
-
sizes:
|
|
43
|
-
"(max-width: 767px) calc(100vw - 48px), (max-width: 1399px) calc((100vw - 80px) / 2), 660px",
|
|
44
|
-
},
|
|
45
|
-
3: {
|
|
46
|
-
targetWidth: 429,
|
|
47
|
-
widths: [320, 640, 768, 1024],
|
|
48
|
-
sizes:
|
|
49
|
-
"(max-width: 767px) calc(100vw - 48px), (max-width: 1399px) calc((100vw - 112px) / 3), 429px",
|
|
50
|
-
},
|
|
51
|
-
4: {
|
|
52
|
-
targetWidth: 314,
|
|
53
|
-
widths: [320, 640, 768],
|
|
54
|
-
sizes:
|
|
55
|
-
"(max-width: 767px) calc(100vw - 48px), (max-width: 1399px) calc((100vw - 144px) / 4), 314px",
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const layout = COLUMN_CONFIGS[columnCount] || COLUMN_CONFIGS[1];
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
img && (
|
|
64
|
-
<div class="cms-block cms-block-image">
|
|
65
|
-
<KamaImage
|
|
66
|
-
image={img}
|
|
67
|
-
sizes={layout.sizes}
|
|
68
|
-
desktopWidths={layout.widths}
|
|
69
|
-
idealWidth={layout.targetWidth}
|
|
70
|
-
class="free-crop-image"
|
|
71
|
-
loading={isLcp ? "eager" : "lazy"}
|
|
72
|
-
fetchpriority={isLcp ? "high" : "auto"}
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
<style>
|
|
79
|
-
.cms-block-image {
|
|
80
|
-
width: 100%;
|
|
81
|
-
margin: 0 auto 1.5rem auto;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
:global(.free-crop-image) {
|
|
85
|
-
width: 100%;
|
|
86
|
-
height: auto;
|
|
87
|
-
object-fit: contain;
|
|
88
|
-
display: block;
|
|
89
|
-
border-radius: var(--cms-radius-md, 0.5rem);
|
|
90
|
-
}
|
|
91
|
-
</style>
|