@agent-cms/agentcms 0.0.0-stage → 0.1.1
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/LICENSE +143 -0
- package/README.md +1119 -2
- package/changelog.json +31 -0
- package/dist/admin/admin-files.json +48 -0
- package/dist/admin/assets/CodeEditor-Wx1WlF3h.js +24 -0
- package/dist/admin/assets/flexweg-logo-CdtuqAFA.png +0 -0
- package/dist/admin/assets/index-DFVZw8E0.js +5460 -0
- package/dist/admin/assets/index-DMcGogR2.css +1 -0
- package/dist/admin/assets/sql-wasm-Bfkbn6Oa.js +2 -0
- package/dist/admin/assets/sql-wasm-C1U8OeUW.wasm +0 -0
- package/dist/admin/assets/sql-wasm-V5jTDcrT.js +1 -0
- package/dist/admin/config.js +11 -0
- package/dist/admin/external.default.json +72 -0
- package/dist/admin/index.html +116 -0
- package/dist/admin/plugins/core-seo/bundle.js +55 -0
- package/dist/admin/plugins/core-seo/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-archives/bundle.js +1414 -0
- package/dist/admin/plugins/flexweg-archives/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-multilang/bundle.js +1187 -0
- package/dist/admin/plugins/flexweg-multilang/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-rss/bundle.js +1354 -0
- package/dist/admin/plugins/flexweg-rss/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-search/bundle.js +1243 -0
- package/dist/admin/plugins/flexweg-search/manifest.json +7 -0
- package/dist/admin/plugins/flexweg-sitemaps/bundle.js +1293 -0
- package/dist/admin/plugins/flexweg-sitemaps/manifest.json +7 -0
- package/dist/admin/runtime/cms-runtime.js +164 -0
- package/dist/admin/runtime/react-dom-client.js +13 -0
- package/dist/admin/runtime/react-dom.js +16 -0
- package/dist/admin/runtime/react-i18next.js +21 -0
- package/dist/admin/runtime/react-jsx-runtime.js +17 -0
- package/dist/admin/runtime/react.js +55 -0
- package/dist/admin/themes/corporate/bundle.js +14465 -0
- package/dist/admin/themes/corporate/manifest.json +7 -0
- package/dist/admin/themes/corporate/theme.css +2 -0
- package/dist/admin/themes/magazine/bundle.js +10229 -0
- package/dist/admin/themes/magazine/manifest.json +7 -0
- package/dist/admin/themes/magazine/theme.css +2 -0
- package/dist/admin/themes/marketplace-core/bundle.js +11213 -0
- package/dist/admin/themes/marketplace-core/manifest.json +7 -0
- package/dist/admin/themes/marketplace-core/theme.css +1613 -0
- package/dist/admin/themes/portfolio/bundle.js +9195 -0
- package/dist/admin/themes/portfolio/manifest.json +7 -0
- package/dist/admin/themes/portfolio/theme.css +2 -0
- package/dist/admin/themes/storefront/bundle.js +13172 -0
- package/dist/admin/themes/storefront/manifest.json +7 -0
- package/dist/admin/themes/storefront/theme.css +2 -0
- package/dist/agent/agentcms.mjs +1711 -0
- package/dist/agent/chunks/hosting-BftlDdsL.mjs +117 -0
- package/dist/agent/chunks/index-BG05qslv.mjs +3608 -0
- package/dist/agent/chunks/install-DnmgOT3F.mjs +577 -0
- package/dist/agent/chunks/plan-BrM8ztEp.mjs +245 -0
- package/dist/agent/chunks/registry-C9TSnZ77.mjs +53517 -0
- package/dist/agent/chunks/siteAdd-BcXhN9fk.mjs +118 -0
- package/dist/agent/chunks/sql-wasm-GjJDiefO.mjs +10 -0
- package/dist/agent/chunks/sqljs-DjSCStJ0.mjs +20 -0
- package/dist/agent/vendor/sql-wasm.cjs +188 -0
- package/dist/theme-assets/corporate-menu.js +266 -0
- package/dist/theme-assets/corporate-posts.js +571 -0
- package/dist/theme-assets/corporate.css +2 -0
- package/dist/theme-assets/default-menu.js +266 -0
- package/dist/theme-assets/default-posts.js +378 -0
- package/dist/theme-assets/default.css +1 -0
- package/dist/theme-assets/magazine-menu.js +227 -0
- package/dist/theme-assets/magazine-posts.js +361 -0
- package/dist/theme-assets/magazine.css +2 -0
- package/dist/theme-assets/portfolio-filters.js +104 -0
- package/dist/theme-assets/portfolio-menu.js +240 -0
- package/dist/theme-assets/portfolio-posts.js +358 -0
- package/dist/theme-assets/portfolio.css +2 -0
- package/dist/theme-assets/storefront-catalog.js +504 -0
- package/dist/theme-assets/storefront-menu.js +239 -0
- package/dist/theme-assets/storefront-posts.js +404 -0
- package/dist/theme-assets/storefront.css +2 -0
- package/dist/version.json +9 -0
- package/package.json +101 -4
- package/plugin/.claude-plugin/plugin.json +16 -0
- package/plugin/skills/agentcms-install/SKILL.md +110 -0
- package/plugin/skills/agentcms-install/references/cloudflare.md +15 -0
- package/plugin/skills/agentcms-install/references/flexweg.md +11 -0
- package/plugin/skills/agentcms-install/references/github.md +67 -0
- package/plugin/skills/agentcms-install/references/gitlab.md +15 -0
- package/plugin/skills/agentcms-install/references/s3.md +81 -0
- package/plugin/skills/agentcms-manage/SKILL.md +92 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Corporate theme — runtime menu loader.
|
|
3
|
+
*
|
|
4
|
+
* Same contract as the default + magazine themes: fetches /data/menu.json
|
|
5
|
+
* and paints every `[data-cms-menu]` container on the page. The corporate
|
|
6
|
+
* header ships TWO such containers — the inline horizontal nav (visible
|
|
7
|
+
* md+) and the off-canvas burger overlay (always present, opens on
|
|
8
|
+
* burger-toggle click). Both get populated from the same menu data,
|
|
9
|
+
* styled differently by their parent classes.
|
|
10
|
+
*
|
|
11
|
+
* Differences vs magazine:
|
|
12
|
+
* - The injected logo `<img>` gets utility classes that fit the
|
|
13
|
+
* corporate header height (`h-8 w-auto`).
|
|
14
|
+
* - Inline nav links carry the corporate hover styling via
|
|
15
|
+
* `data-cms-menu-inline` rendering — see the `paint` function
|
|
16
|
+
* branch below.
|
|
17
|
+
*/
|
|
18
|
+
(function () {
|
|
19
|
+
"use strict";
|
|
20
|
+
|
|
21
|
+
// ─── Base path ────────────────────────────────────────────────────
|
|
22
|
+
// Sites served from a sub-folder (e.g. GitHub Pages project sites)
|
|
23
|
+
// carry <meta name="x-cms-base" content="/repo/"> in <head>; no meta
|
|
24
|
+
// means the site lives at the domain root. URLs built at runtime from
|
|
25
|
+
// JSON data go through withBase() so they land under that folder.
|
|
26
|
+
var BASE = (function () {
|
|
27
|
+
var meta = document.querySelector('meta[name="x-cms-base"]');
|
|
28
|
+
var b = (meta && meta.getAttribute("content")) || "/";
|
|
29
|
+
if (b.charAt(0) !== "/") b = "/" + b;
|
|
30
|
+
if (b.charAt(b.length - 1) !== "/") b += "/";
|
|
31
|
+
return b;
|
|
32
|
+
})();
|
|
33
|
+
|
|
34
|
+
function withBase(url) {
|
|
35
|
+
if (BASE === "/" || !url) return url;
|
|
36
|
+
// Absolute URLs (http:, mailto:, data:, …), protocol-relative and
|
|
37
|
+
// fragment-only links pass through.
|
|
38
|
+
if (/^([a-z][a-z0-9+.-]*:|\/\/|#)/i.test(url)) return url;
|
|
39
|
+
if (url.indexOf(BASE) === 0 || url === BASE.slice(0, -1)) return url;
|
|
40
|
+
return BASE + (url.charAt(0) === "/" ? url.slice(1) : url);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function fetchMenu() {
|
|
44
|
+
return fetch(withBase("/data/menu.json"), { credentials: "omit" })
|
|
45
|
+
.then(function (res) {
|
|
46
|
+
if (!res.ok) throw new Error("HTTP " + res.status);
|
|
47
|
+
return res.json();
|
|
48
|
+
})
|
|
49
|
+
.catch(function (err) {
|
|
50
|
+
console.warn("[cms] menu.json load failed:", err);
|
|
51
|
+
return null;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function samePath(href) {
|
|
56
|
+
try {
|
|
57
|
+
var url = new URL(href, window.location.origin);
|
|
58
|
+
var here = window.location.pathname.replace(/\/index\.html$/, "/");
|
|
59
|
+
var there = url.pathname.replace(/\/index\.html$/, "/");
|
|
60
|
+
return here === there;
|
|
61
|
+
} catch (e) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Picks the per-language label from item.labels (set by the admin
|
|
67
|
+
// in the menu builder) based on <html lang>, with a region-stripped
|
|
68
|
+
// fallback so "en-US" matches "en". Mono-lingual sites just return
|
|
69
|
+
// item.label.
|
|
70
|
+
function pickLabel(item) {
|
|
71
|
+
var lang = (document.documentElement.getAttribute("lang") || "").trim();
|
|
72
|
+
if (lang && item.labels && typeof item.labels[lang] === "string" && item.labels[lang]) {
|
|
73
|
+
return item.labels[lang];
|
|
74
|
+
}
|
|
75
|
+
if (lang && lang.indexOf("-") > 0) {
|
|
76
|
+
var base = lang.split("-")[0];
|
|
77
|
+
if (item.labels && typeof item.labels[base] === "string" && item.labels[base]) {
|
|
78
|
+
return item.labels[base];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return item.label || "";
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Burger / off-canvas list item: simple <a> with optional nested <ul>
|
|
85
|
+
// for children. Kept identical to the magazine theme so the styling
|
|
86
|
+
// in `.burger-menu` works without extra branches.
|
|
87
|
+
function renderBurgerItem(item) {
|
|
88
|
+
var li = document.createElement("li");
|
|
89
|
+
var a = document.createElement("a");
|
|
90
|
+
a.href = withBase(item.href) || "#";
|
|
91
|
+
a.textContent = pickLabel(item);
|
|
92
|
+
if (samePath(a.href)) {
|
|
93
|
+
a.setAttribute("aria-current", "page");
|
|
94
|
+
}
|
|
95
|
+
li.appendChild(a);
|
|
96
|
+
if (item.children && item.children.length) {
|
|
97
|
+
var sub = document.createElement("ul");
|
|
98
|
+
sub.className = "menu-children";
|
|
99
|
+
item.children.forEach(function (child) {
|
|
100
|
+
sub.appendChild(renderBurgerItem(child));
|
|
101
|
+
});
|
|
102
|
+
li.appendChild(sub);
|
|
103
|
+
}
|
|
104
|
+
return li;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Inline header nav: horizontal flex of <a> elements. The active
|
|
108
|
+
// page gets `text-secondary font-bold`; siblings get the default
|
|
109
|
+
// `text-on-surface-variant` + hover-to-secondary state. We don't
|
|
110
|
+
// render children (a corporate top nav stays one level deep).
|
|
111
|
+
function renderInlineItem(item) {
|
|
112
|
+
var a = document.createElement("a");
|
|
113
|
+
a.href = withBase(item.href) || "#";
|
|
114
|
+
a.textContent = pickLabel(item);
|
|
115
|
+
var active = samePath(a.href);
|
|
116
|
+
if (active) {
|
|
117
|
+
a.setAttribute("aria-current", "page");
|
|
118
|
+
a.className = "text-secondary font-bold transition-colors";
|
|
119
|
+
} else {
|
|
120
|
+
a.className =
|
|
121
|
+
"text-on-surface-variant font-medium hover:text-secondary transition-colors";
|
|
122
|
+
}
|
|
123
|
+
return a;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function paint(menu) {
|
|
127
|
+
if (!menu) return;
|
|
128
|
+
document.querySelectorAll("[data-cms-menu]").forEach(function (host) {
|
|
129
|
+
var key = host.getAttribute("data-cms-menu");
|
|
130
|
+
var items = (menu && menu[key]) || [];
|
|
131
|
+
var inline = host.hasAttribute("data-cms-menu-inline");
|
|
132
|
+
|
|
133
|
+
if (inline) {
|
|
134
|
+
// Replace direct children with horizontal links. The host
|
|
135
|
+
// itself is the `<nav>` flex container.
|
|
136
|
+
host.innerHTML = "";
|
|
137
|
+
items.forEach(function (item) {
|
|
138
|
+
host.appendChild(renderInlineItem(item));
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
var list = host.querySelector("ul");
|
|
142
|
+
if (!list) return;
|
|
143
|
+
list.innerHTML = "";
|
|
144
|
+
items.forEach(function (item) {
|
|
145
|
+
list.appendChild(renderBurgerItem(item));
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Hide empty inline / footer hosts so they don't reserve
|
|
150
|
+
// whitespace. Skip #burger-menu: it's `position: fixed` (no
|
|
151
|
+
// layout impact) AND any `hidden` attribute would `display:
|
|
152
|
+
// none` the panel, which the `.burger-menu.is-open { transform:
|
|
153
|
+
// translate(0) }` rule can never override — the burger toggle
|
|
154
|
+
// would open an invisible panel. Visibility of the burger UI is
|
|
155
|
+
// gated by the burger TOGGLE button below instead.
|
|
156
|
+
var isBurgerMenu = host.id === "burger-menu";
|
|
157
|
+
if (items.length === 0 && !isBurgerMenu) {
|
|
158
|
+
host.setAttribute("hidden", "");
|
|
159
|
+
} else {
|
|
160
|
+
host.removeAttribute("hidden");
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
// Hide the burger TOGGLE button when the header menu has no
|
|
164
|
+
// items — otherwise users see a button that opens an empty
|
|
165
|
+
// off-canvas panel and conclude "the burger is broken".
|
|
166
|
+
var headerItems = (menu && menu.header) || [];
|
|
167
|
+
document.querySelectorAll(".burger-toggle").forEach(function (toggle) {
|
|
168
|
+
if (headerItems.length === 0) {
|
|
169
|
+
toggle.setAttribute("hidden", "");
|
|
170
|
+
} else {
|
|
171
|
+
toggle.removeAttribute("hidden");
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
paintBranding(menu);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Swap the wordmark for an <img> when the theme has a logo
|
|
178
|
+
// configured. Falls back to the static text in every other case.
|
|
179
|
+
function paintBranding(menu) {
|
|
180
|
+
var branding = menu && menu.branding;
|
|
181
|
+
var logoUrl = branding && branding.logoUrl;
|
|
182
|
+
if (!logoUrl) return;
|
|
183
|
+
document.querySelectorAll("[data-cms-brand]").forEach(function (host) {
|
|
184
|
+
var alt = host.textContent || "";
|
|
185
|
+
var img = document.createElement("img");
|
|
186
|
+
img.src = withBase(logoUrl);
|
|
187
|
+
img.alt = alt;
|
|
188
|
+
// Comfortable height for the corporate header bar (h-20 / 5rem).
|
|
189
|
+
img.className = "h-8 w-auto";
|
|
190
|
+
img.loading = "lazy";
|
|
191
|
+
host.innerHTML = "";
|
|
192
|
+
host.appendChild(img);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function ensureCloseButton(menu) {
|
|
197
|
+
if (menu.querySelector(".burger-close")) return menu.querySelector(".burger-close");
|
|
198
|
+
var close = document.createElement("button");
|
|
199
|
+
close.type = "button";
|
|
200
|
+
close.className = "burger-close";
|
|
201
|
+
close.setAttribute("aria-label", "Close menu");
|
|
202
|
+
close.innerHTML =
|
|
203
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>';
|
|
204
|
+
menu.insertBefore(close, menu.firstChild);
|
|
205
|
+
return close;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function ensureBackdrop() {
|
|
209
|
+
var existing = document.querySelector(".burger-backdrop");
|
|
210
|
+
if (existing) return existing;
|
|
211
|
+
var backdrop = document.createElement("div");
|
|
212
|
+
backdrop.className = "burger-backdrop";
|
|
213
|
+
backdrop.setAttribute("aria-hidden", "true");
|
|
214
|
+
document.body.appendChild(backdrop);
|
|
215
|
+
return backdrop;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function wireBurger() {
|
|
219
|
+
var toggle = document.querySelector(".burger-toggle");
|
|
220
|
+
var menu = document.getElementById("burger-menu");
|
|
221
|
+
if (!toggle || !menu) return;
|
|
222
|
+
|
|
223
|
+
var close = ensureCloseButton(menu);
|
|
224
|
+
var backdrop = ensureBackdrop();
|
|
225
|
+
|
|
226
|
+
function setOpen(open) {
|
|
227
|
+
toggle.setAttribute("aria-expanded", open ? "true" : "false");
|
|
228
|
+
menu.classList.toggle("is-open", open);
|
|
229
|
+
backdrop.classList.toggle("is-open", open);
|
|
230
|
+
document.body.classList.toggle("burger-open", open);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
toggle.addEventListener("click", function () {
|
|
234
|
+
var isOpen = toggle.getAttribute("aria-expanded") === "true";
|
|
235
|
+
setOpen(!isOpen);
|
|
236
|
+
});
|
|
237
|
+
close.addEventListener("click", function () {
|
|
238
|
+
setOpen(false);
|
|
239
|
+
});
|
|
240
|
+
backdrop.addEventListener("click", function () {
|
|
241
|
+
setOpen(false);
|
|
242
|
+
});
|
|
243
|
+
document.addEventListener("keydown", function (e) {
|
|
244
|
+
if (e.key === "Escape") setOpen(false);
|
|
245
|
+
});
|
|
246
|
+
menu.addEventListener("click", function (e) {
|
|
247
|
+
if (e.target.tagName === "A") setOpen(false);
|
|
248
|
+
});
|
|
249
|
+
document.addEventListener("pointerdown", function (e) {
|
|
250
|
+
if (toggle.getAttribute("aria-expanded") !== "true") return;
|
|
251
|
+
if (menu.contains(e.target)) return;
|
|
252
|
+
if (toggle.contains(e.target)) return;
|
|
253
|
+
setOpen(false);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function ready(fn) {
|
|
258
|
+
if (document.readyState !== "loading") fn();
|
|
259
|
+
else document.addEventListener("DOMContentLoaded", fn);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
ready(function () {
|
|
263
|
+
wireBurger();
|
|
264
|
+
fetchMenu().then(paint);
|
|
265
|
+
});
|
|
266
|
+
})();
|