@caelo-cms/shared 0.11.2 → 0.11.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.
- package/dist/ai-tools.d.ts +8 -0
- package/dist/ai-tools.d.ts.map +1 -1
- package/dist/build-page.d.ts +16 -0
- package/dist/build-page.d.ts.map +1 -1
- package/dist/content.d.ts +24 -0
- package/dist/content.d.ts.map +1 -1
- package/dist/content.js +40 -0
- package/dist/content.js.map +1 -1
- package/dist/lists/fields.d.ts +2 -0
- package/dist/lists/fields.d.ts.map +1 -1
- package/dist/lists/fields.js +3 -2
- package/dist/lists/fields.js.map +1 -1
- package/dist/lists/index.d.ts +2 -0
- package/dist/lists/index.d.ts.map +1 -1
- package/dist/lists/index.js +2 -0
- package/dist/lists/index.js.map +1 -1
- package/dist/lists/list-type.d.ts +4 -1
- package/dist/lists/list-type.d.ts.map +1 -1
- package/dist/lists/list-type.js +2 -0
- package/dist/lists/list-type.js.map +1 -1
- package/dist/lists/paginated-render.d.ts +38 -0
- package/dist/lists/paginated-render.d.ts.map +1 -0
- package/dist/lists/paginated-render.js +45 -0
- package/dist/lists/paginated-render.js.map +1 -0
- package/dist/lists/pagination.d.ts +95 -0
- package/dist/lists/pagination.d.ts.map +1 -0
- package/dist/lists/pagination.js +136 -0
- package/dist/lists/pagination.js.map +1 -0
- package/dist/lists/resolve.d.ts +65 -0
- package/dist/lists/resolve.d.ts.map +1 -1
- package/dist/lists/resolve.js +166 -20
- package/dist/lists/resolve.js.map +1 -1
- package/dist/live-events.d.ts.map +1 -1
- package/dist/live-events.js +12 -1
- package/dist/live-events.js.map +1 -1
- package/dist/markup-structure.d.ts +25 -0
- package/dist/markup-structure.d.ts.map +1 -1
- package/dist/markup-structure.js +88 -1
- package/dist/markup-structure.js.map +1 -1
- package/dist/media.d.ts +13 -0
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +40 -0
- package/dist/media.js.map +1 -1
- package/dist/nested-module-render.d.ts +13 -0
- package/dist/nested-module-render.d.ts.map +1 -1
- package/dist/nested-module-render.js +22 -1
- package/dist/nested-module-render.js.map +1 -1
- package/dist/template-engine.d.ts +4 -1
- package/dist/template-engine.d.ts.map +1 -1
- package/dist/template-engine.js +6 -4
- package/dist/template-engine.js.map +1 -1
- package/dist/template-sections.d.ts.map +1 -1
- package/dist/template-sections.js +1 -0
- package/dist/template-sections.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/content.ts +43 -0
- package/src/lists/fields.ts +3 -2
- package/src/lists/index.ts +2 -0
- package/src/lists/list-type.ts +2 -0
- package/src/lists/paginated-render.ts +77 -0
- package/src/lists/pagination.test.ts +422 -0
- package/src/lists/pagination.ts +160 -0
- package/src/lists/resolve.ts +254 -22
- package/src/live-events.ts +12 -1
- package/src/markup-structure.test.ts +27 -0
- package/src/markup-structure.ts +96 -1
- package/src/media.ts +43 -0
- package/src/nested-module-render.ts +25 -1
- package/src/template-engine.ts +9 -4
- package/src/template-sections.ts +1 -0
- package/src/version.ts +1 -1
package/src/template-engine.ts
CHANGED
|
@@ -85,6 +85,7 @@ import Mustache from "mustache";
|
|
|
85
85
|
import { MODULE_FIELD_SECTION_KINDS, type ModuleFieldKind } from "./content.js";
|
|
86
86
|
import { type LinkResolver, resolveLinkRefsInHtml } from "./link-refs.js";
|
|
87
87
|
import { type SourceDef, sourceDefSchema } from "./lists/list-type.js";
|
|
88
|
+
import type { ListPaginationSettings } from "./lists/pagination.js";
|
|
88
89
|
import type { ListHolder, ListPageContext } from "./lists/resolve.js";
|
|
89
90
|
import { stripCdataGuards } from "./strip-cdata.js";
|
|
90
91
|
import { renderSections } from "./template-sections.js";
|
|
@@ -110,20 +111,21 @@ export interface TemplateField {
|
|
|
110
111
|
readonly bind?: "local" | "shared" | "source";
|
|
111
112
|
readonly list?: string;
|
|
112
113
|
readonly source?: SourceDef;
|
|
114
|
+
/** #1257 — a paginated source field. */
|
|
115
|
+
readonly paginate?: ListPaginationSettings;
|
|
113
116
|
}
|
|
114
117
|
|
|
115
118
|
/**
|
|
116
|
-
* Parse a stored `modules.fields` jsonb (
|
|
119
|
+
* Parse a stored `modules.fields` jsonb (the parsed array) into the
|
|
117
120
|
* fields the engine renders with: name, kind (absent = `text`), default,
|
|
118
121
|
* and a `list` field's binding. A typo'd kind passes through as is — the
|
|
119
122
|
* engine reports it loudly (kind-mismatch) instead of the parser hiding
|
|
120
123
|
* it. Entries without a string name are skipped; they cannot be rendered.
|
|
121
124
|
*/
|
|
122
125
|
export function templateFieldsFromJson(raw: unknown): TemplateField[] {
|
|
123
|
-
|
|
124
|
-
if (!Array.isArray(parsed)) return [];
|
|
126
|
+
if (!Array.isArray(raw)) return [];
|
|
125
127
|
const out: TemplateField[] = [];
|
|
126
|
-
for (const f of
|
|
128
|
+
for (const f of raw) {
|
|
127
129
|
if (!f || typeof f !== "object") continue;
|
|
128
130
|
const o = f as Record<string, unknown>;
|
|
129
131
|
if (typeof o.name !== "string") continue;
|
|
@@ -137,6 +139,9 @@ export function templateFieldsFromJson(raw: unknown): TemplateField[] {
|
|
|
137
139
|
// A source that fails its schema stays absent: the resolver then
|
|
138
140
|
// reports `list-malformed:<field>[source]` instead of guessing.
|
|
139
141
|
...(sourceDefSchema.safeParse(o.source).success ? { source: o.source as SourceDef } : {}),
|
|
142
|
+
// Passed as stored: the resolver validates it and reports a
|
|
143
|
+
// malformed one as `list-malformed:<field>[paginate]`.
|
|
144
|
+
...(o.paginate !== undefined ? { paginate: o.paginate as ListPaginationSettings } : {}),
|
|
140
145
|
});
|
|
141
146
|
}
|
|
142
147
|
return out;
|
package/src/template-sections.ts
CHANGED
|
@@ -407,6 +407,7 @@ class SectionRenderer {
|
|
|
407
407
|
...(field.list !== undefined ? { list: field.list } : {}),
|
|
408
408
|
...(field.source !== undefined ? { source: field.source } : {}),
|
|
409
409
|
...(field.default !== undefined ? { default: field.default } : {}),
|
|
410
|
+
...(field.paginate !== undefined ? { paginate: field.paginate } : {}),
|
|
410
411
|
};
|
|
411
412
|
const value = Object.hasOwn(env.values, name) ? env.values[name] : undefined;
|
|
412
413
|
const res = env.lists.resolveField(spec, value, env.holder);
|