nodality 1.0.166 → 1.0.168
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/nodality.js +312 -0
- package/layout/animator.js +1 -1
- package/layout/audio.js +1 -1
- package/layout/audionew.js +1 -1
- package/layout/base-2.js +1 -1
- package/layout/base.js +1 -1
- package/layout/beta-desktop-bar.js +1 -1
- package/layout/beta-mobile-bar.js +1 -1
- package/layout/box.js +1 -1
- package/layout/button.js +1 -1
- package/layout/cards.js +1 -1
- package/layout/center.js +1 -1
- package/layout/checkbox.js +1 -1
- package/layout/circle.js +1 -1
- package/layout/clean-row.js +1 -1
- package/layout/code.js +1 -1
- package/layout/container.js +1 -1
- package/layout/custom.js +1 -1
- package/layout/div-image.js +1 -1
- package/layout/dropdown-2025.js +1 -1
- package/layout/dropdown.js +1 -1
- package/layout/empty-element.js +1 -1
- package/layout/external-stylesheet.js +1 -1
- package/layout/flex-card.js +1 -1
- package/layout/flex-grid.js +1 -1
- package/layout/flex-row.js +1 -1
- package/layout/footer.js +1 -1
- package/layout/form-components/custom.js +1 -1
- package/layout/form-components/data-list.js +1 -1
- package/layout/form-components/floating-input.js +1 -1
- package/layout/form-components/form-all.js +1 -1
- package/layout/form-components/form.js +1 -1
- package/layout/form-components/image-picker.js +1 -1
- package/layout/form-components/picker.js +1 -1
- package/layout/form-components/radio.js +1 -1
- package/layout/form-components/radiogroup.js +1 -1
- package/layout/form-components/range.js +1 -1
- package/layout/free.js +1 -1
- package/layout/grid-new.js +1 -1
- package/layout/grid-switcher.js +1 -1
- package/layout/grid.js +1 -1
- package/layout/group.js +1 -1
- package/layout/header.js +1 -1
- package/layout/horizontal-scroller.js +1 -1
- package/layout/image-old.js +1 -1
- package/layout/image.js +1 -1
- package/layout/index.js +1 -1
- package/layout/label.js +1 -1
- package/layout/link.js +1 -1
- package/layout/list-OLD.js +1 -1
- package/layout/list.js +1 -1
- package/layout/meta-adder.js +1 -1
- package/layout/modal-2025.js +1 -1
- package/layout/modernwrap.js +1 -1
- package/layout/multiswitcher.js +1 -1
- package/layout/multiswitcherBeta.js +1 -1
- package/layout/nav-bar.js +1 -1
- package/layout/nav-factor/custom-div.js +1 -1
- package/layout/navBar-OLD.js +1 -1
- package/layout/new-flat-adder.js +1 -1
- package/layout/new-nav-bar.js +1 -1
- package/layout/offset-container.js +1 -1
- package/layout/polygon.js +1 -1
- package/layout/prerender-site.js +16 -2
- package/layout/prerender.js +15 -5
- package/layout/progress.js +1 -1
- package/layout/row.js +1 -1
- package/layout/saved-new-nav-bar.js +1 -1
- package/layout/scroll-video.js +1 -1
- package/layout/side-bar.js +1 -1
- package/layout/side-nav-bar.js +1 -1
- package/layout/simple-bar.js +1 -1
- package/layout/slider-2025.js +1 -1
- package/layout/spacer.js +1 -1
- package/layout/stack.js +1 -1
- package/layout/styler.js +1 -1
- package/layout/svg.js +1 -1
- package/layout/switcher.js +1 -1
- package/layout/table.js +1 -1
- package/layout/text-field.js +1 -1
- package/layout/text.js +1 -1
- package/layout/ulist.js +1 -1
- package/layout/video.js +1 -1
- package/layout/without-new.js +1 -1
- package/layout/wrap.js +1 -1
- package/layout/zoom-card.js +1 -1
- package/lib/card-getter.js +1 -1
- package/lib/data.js +48 -0
- package/lib/designer.js +1 -1
- package/lib/element-mapper.js +1 -1
- package/lib/keyframe-animation.js +1 -1
- package/lib/link-getter.js +1 -1
- package/lib/scroll-video.js +1 -1
- package/lib/seo.js +198 -0
- package/lib/stacker.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/transform-anim.js +1 -1
- package/package.json +4 -2
package/layout/group.js
CHANGED
package/layout/header.js
CHANGED
package/layout/image-old.js
CHANGED
package/layout/image.js
CHANGED
package/layout/index.js
CHANGED
package/layout/label.js
CHANGED
package/layout/link.js
CHANGED
package/layout/list-OLD.js
CHANGED
package/layout/list.js
CHANGED
package/layout/meta-adder.js
CHANGED
package/layout/modal-2025.js
CHANGED
package/layout/modernwrap.js
CHANGED
package/layout/multiswitcher.js
CHANGED
package/layout/nav-bar.js
CHANGED
package/layout/navBar-OLD.js
CHANGED
package/layout/new-flat-adder.js
CHANGED
package/layout/new-nav-bar.js
CHANGED
package/layout/polygon.js
CHANGED
package/layout/prerender-site.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* nodality v1.0.
|
|
2
|
+
* nodality v1.0.168
|
|
3
3
|
* (c) 2026 Filip Vabrousek
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -146,6 +146,16 @@ export async function prerenderSite(config) {
|
|
|
146
146
|
await runChild(config, locale);
|
|
147
147
|
const elapsed = ((Date.now() - startedAt) / 1000).toFixed(1);
|
|
148
148
|
console.log(`✅ Prerender done in ${elapsed}s — ${config.pages.length} page(s)`);
|
|
149
|
+
// Single-locale sitemap (1.0.168+). Earlier versions only wrote
|
|
150
|
+
// a sitemap on multi-locale builds, so single-locale projects had
|
|
151
|
+
// to bolt on their own `scripts/generate-sitemap.mjs`. We now
|
|
152
|
+
// emit on every build unless the caller explicitly opts out
|
|
153
|
+
// with `sitemap: false`. URLs are origin + page.html, lastmod is
|
|
154
|
+
// build time, no hreflang (single locale has nothing to alternate).
|
|
155
|
+
if (config.sitemap !== false) {
|
|
156
|
+
await writeSitemap(config);
|
|
157
|
+
console.log(`✅ Sitemap regenerated — ${config.pages.length} URL(s)`);
|
|
158
|
+
}
|
|
149
159
|
return;
|
|
150
160
|
}
|
|
151
161
|
|
|
@@ -399,6 +409,10 @@ function urlFor(config, locale, page) {
|
|
|
399
409
|
|
|
400
410
|
/** hreflang alternates for one page (all locales + x-default). */
|
|
401
411
|
function alternatesFor(config, page) {
|
|
412
|
+
// Single-locale builds (incl. the implicit untagged-locale case)
|
|
413
|
+
// have nothing to alternate to — emitting `xhtml:link rel="alternate"`
|
|
414
|
+
// with the same URL as the `<loc>` would just clutter the sitemap.
|
|
415
|
+
if (config.locales.length <= 1) return [];
|
|
402
416
|
const xDefault = config.xDefaultLocale || config.defaultLocale;
|
|
403
417
|
const alts = config.locales.map((l) => ({ hreflang: l, href: urlFor(config, l, page) }));
|
|
404
418
|
alts.push({ hreflang: "x-default", href: urlFor(config, xDefault, page) });
|
|
@@ -427,7 +441,7 @@ async function writeSitemap(config) {
|
|
|
427
441
|
` <lastmod>${now}</lastmod>\n` +
|
|
428
442
|
` <changefreq>${changefreq}</changefreq>\n` +
|
|
429
443
|
` <priority>${priority}</priority>\n` +
|
|
430
|
-
altLines + "\n" +
|
|
444
|
+
(altLines ? altLines + "\n" : "") +
|
|
431
445
|
` </url>`
|
|
432
446
|
);
|
|
433
447
|
}
|
package/layout/prerender.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* nodality v1.0.
|
|
2
|
+
* nodality v1.0.168
|
|
3
3
|
* (c) 2026 Filip Vabrousek
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -312,11 +312,21 @@ export async function prerender({
|
|
|
312
312
|
"requestAnimationFrame", "cancelAnimationFrame", "getComputedStyle",
|
|
313
313
|
"fetch", "dataLayer", "gtag",
|
|
314
314
|
"DOMParser", "XMLSerializer", "Range", "NodeFilter",
|
|
315
|
+
// `SVGElement` is bridged so library code that does
|
|
316
|
+
// `obj.svg instanceof SVGElement` (button.js, custom icons, …)
|
|
317
|
+
// doesn't throw `ReferenceError: SVGElement is not defined` under
|
|
318
|
+
// jsdom. The previous policy of NOT shimming it caused per-page
|
|
319
|
+
// render aborts on every detail page that used a UList with
|
|
320
|
+
// bullets — projects had to drop a `globalThis.SVGElement = class
|
|
321
|
+
// {}` stub into `_globals.js` to paper over it. SVG-related
|
|
322
|
+
// checks return `false` for non-real-SVG values at SSG time, same
|
|
323
|
+
// as in the browser when the value isn't an SVG node.
|
|
324
|
+
"SVGElement", "SVGSVGElement",
|
|
315
325
|
// Deliberately NOT shimming the browser `Image` / `HTMLImageElement`
|
|
316
|
-
//
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
//
|
|
326
|
+
// constructors — Nodality exports its own `Image` class and
|
|
327
|
+
// `nodality/_globals.js` writes it to `globalThis`. The browser
|
|
328
|
+
// copies would clobber it and break every `new Image().set(…)`
|
|
329
|
+
// call in the entries.
|
|
320
330
|
];
|
|
321
331
|
// Some Node versions (22+) make certain globals — most notably
|
|
322
332
|
// `navigator` — getter-only on `globalThis`, which means a plain
|
package/layout/progress.js
CHANGED
package/layout/row.js
CHANGED
package/layout/scroll-video.js
CHANGED
package/layout/side-bar.js
CHANGED
package/layout/side-nav-bar.js
CHANGED
package/layout/simple-bar.js
CHANGED
package/layout/slider-2025.js
CHANGED
package/layout/spacer.js
CHANGED
package/layout/stack.js
CHANGED
package/layout/styler.js
CHANGED
package/layout/svg.js
CHANGED
package/layout/switcher.js
CHANGED
package/layout/table.js
CHANGED
package/layout/text-field.js
CHANGED
package/layout/text.js
CHANGED
package/layout/ulist.js
CHANGED
package/layout/video.js
CHANGED
package/layout/without-new.js
CHANGED
package/layout/wrap.js
CHANGED
package/layout/zoom-card.js
CHANGED
package/lib/card-getter.js
CHANGED
package/lib/data.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* nodality v1.0.168
|
|
3
|
+
* (c) 2026 Filip Vabrousek
|
|
4
|
+
* License: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const IS_NODE = typeof process !== "undefined" && !!process.versions?.node;
|
|
8
|
+
|
|
9
|
+
export async function loadJson(name, { fallback = undefined } = {}) {
|
|
10
|
+
try {
|
|
11
|
+
if (IS_NODE) {
|
|
12
|
+
// ESM JSON imports require the `with { type: "json" }` attribute.
|
|
13
|
+
// The path is interpreted relative to THIS file's URL, so the
|
|
14
|
+
// page entry's `upload/pages/` location implicitly resolves to
|
|
15
|
+
// `upload/<name>`. Consumers don't need to think about it.
|
|
16
|
+
const mod = await import(`./../../upload/${name}`, { with: { type: "json" } })
|
|
17
|
+
.catch(async () => {
|
|
18
|
+
// Fall back to a relative-from-cwd resolution for projects
|
|
19
|
+
// that don't follow the `upload/` convention. Same shape;
|
|
20
|
+
// process.cwd() is the project root at prerender time.
|
|
21
|
+
const fs = await import("node:fs");
|
|
22
|
+
const path = await import("node:path");
|
|
23
|
+
const cwd = process.cwd();
|
|
24
|
+
// Try upload/<name> then plain <name>.
|
|
25
|
+
for (const rel of [path.join("upload", name), name]) {
|
|
26
|
+
const abs = path.resolve(cwd, rel);
|
|
27
|
+
if (fs.existsSync(abs)) {
|
|
28
|
+
return { default: JSON.parse(fs.readFileSync(abs, "utf8")) };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
throw new Error(`loadJson: ${name} not found (tried ./upload/${name} and ./${name})`);
|
|
32
|
+
});
|
|
33
|
+
return mod.default ?? mod;
|
|
34
|
+
}
|
|
35
|
+
const res = await fetch(`./${name}`);
|
|
36
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
37
|
+
return await res.json();
|
|
38
|
+
} catch (err) {
|
|
39
|
+
if (fallback !== undefined) {
|
|
40
|
+
// Soft fail — caller asked for a fallback rather than a throw.
|
|
41
|
+
if (typeof console !== "undefined") {
|
|
42
|
+
console.warn(`[loadJson] ${name} failed (${err?.message ?? err}) — using fallback`);
|
|
43
|
+
}
|
|
44
|
+
return fallback;
|
|
45
|
+
}
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
}
|
package/lib/designer.js
CHANGED
package/lib/element-mapper.js
CHANGED
package/lib/link-getter.js
CHANGED
package/lib/scroll-video.js
CHANGED