@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.
Files changed (73) hide show
  1. package/dist/ai-tools.d.ts +8 -0
  2. package/dist/ai-tools.d.ts.map +1 -1
  3. package/dist/build-page.d.ts +16 -0
  4. package/dist/build-page.d.ts.map +1 -1
  5. package/dist/content.d.ts +24 -0
  6. package/dist/content.d.ts.map +1 -1
  7. package/dist/content.js +40 -0
  8. package/dist/content.js.map +1 -1
  9. package/dist/lists/fields.d.ts +2 -0
  10. package/dist/lists/fields.d.ts.map +1 -1
  11. package/dist/lists/fields.js +3 -2
  12. package/dist/lists/fields.js.map +1 -1
  13. package/dist/lists/index.d.ts +2 -0
  14. package/dist/lists/index.d.ts.map +1 -1
  15. package/dist/lists/index.js +2 -0
  16. package/dist/lists/index.js.map +1 -1
  17. package/dist/lists/list-type.d.ts +4 -1
  18. package/dist/lists/list-type.d.ts.map +1 -1
  19. package/dist/lists/list-type.js +2 -0
  20. package/dist/lists/list-type.js.map +1 -1
  21. package/dist/lists/paginated-render.d.ts +38 -0
  22. package/dist/lists/paginated-render.d.ts.map +1 -0
  23. package/dist/lists/paginated-render.js +45 -0
  24. package/dist/lists/paginated-render.js.map +1 -0
  25. package/dist/lists/pagination.d.ts +95 -0
  26. package/dist/lists/pagination.d.ts.map +1 -0
  27. package/dist/lists/pagination.js +136 -0
  28. package/dist/lists/pagination.js.map +1 -0
  29. package/dist/lists/resolve.d.ts +65 -0
  30. package/dist/lists/resolve.d.ts.map +1 -1
  31. package/dist/lists/resolve.js +166 -20
  32. package/dist/lists/resolve.js.map +1 -1
  33. package/dist/live-events.d.ts.map +1 -1
  34. package/dist/live-events.js +12 -1
  35. package/dist/live-events.js.map +1 -1
  36. package/dist/markup-structure.d.ts +25 -0
  37. package/dist/markup-structure.d.ts.map +1 -1
  38. package/dist/markup-structure.js +88 -1
  39. package/dist/markup-structure.js.map +1 -1
  40. package/dist/media.d.ts +13 -0
  41. package/dist/media.d.ts.map +1 -1
  42. package/dist/media.js +40 -0
  43. package/dist/media.js.map +1 -1
  44. package/dist/nested-module-render.d.ts +13 -0
  45. package/dist/nested-module-render.d.ts.map +1 -1
  46. package/dist/nested-module-render.js +22 -1
  47. package/dist/nested-module-render.js.map +1 -1
  48. package/dist/template-engine.d.ts +4 -1
  49. package/dist/template-engine.d.ts.map +1 -1
  50. package/dist/template-engine.js +6 -4
  51. package/dist/template-engine.js.map +1 -1
  52. package/dist/template-sections.d.ts.map +1 -1
  53. package/dist/template-sections.js +1 -0
  54. package/dist/template-sections.js.map +1 -1
  55. package/dist/version.d.ts +2 -2
  56. package/dist/version.js +1 -1
  57. package/package.json +1 -1
  58. package/src/content.ts +43 -0
  59. package/src/lists/fields.ts +3 -2
  60. package/src/lists/index.ts +2 -0
  61. package/src/lists/list-type.ts +2 -0
  62. package/src/lists/paginated-render.ts +77 -0
  63. package/src/lists/pagination.test.ts +422 -0
  64. package/src/lists/pagination.ts +160 -0
  65. package/src/lists/resolve.ts +254 -22
  66. package/src/live-events.ts +12 -1
  67. package/src/markup-structure.test.ts +27 -0
  68. package/src/markup-structure.ts +96 -1
  69. package/src/media.ts +43 -0
  70. package/src/nested-module-render.ts +25 -1
  71. package/src/template-engine.ts +9 -4
  72. package/src/template-sections.ts +1 -0
  73. package/src/version.ts +1 -1
@@ -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 (array or JSON text) into the
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
- const parsed = typeof raw === "string" ? (JSON.parse(raw) as unknown) : raw;
124
- if (!Array.isArray(parsed)) return [];
126
+ if (!Array.isArray(raw)) return [];
125
127
  const out: TemplateField[] = [];
126
- for (const f of parsed) {
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;
@@ -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);
package/src/version.ts CHANGED
@@ -22,7 +22,7 @@
22
22
  * follow standard SemVer.
23
23
  */
24
24
 
25
- export const CAELO_VERSION = "0.11.2";
25
+ export const CAELO_VERSION = "0.11.4";
26
26
 
27
27
  /**
28
28
  * Deprecated alias for back-compat — early P17 work spelled this