@momentumcms/server-core 0.1.10 → 0.2.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.2.0 (2026-02-17)
2
+
3
+ ### 🚀 Features
4
+
5
+ - add named tabs support with nested data grouping and tab UI improvements ([63ab63e](https://github.com/DonaldMurillo/momentum-cms/commit/63ab63e))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Claude Opus 4.6
10
+ - Donald Murillo @DonaldMurillo
11
+
1
12
  ## 0.1.10 (2026-02-17)
2
13
 
3
14
  ### 🩹 Fixes
package/index.cjs CHANGED
@@ -344,12 +344,26 @@ var ReferentialIntegrityError = class extends Error {
344
344
  this.constraint = constraint;
345
345
  }
346
346
  };
347
+ function isNamedTab(tab) {
348
+ return typeof tab.name === "string" && tab.name.length > 0;
349
+ }
347
350
  function flattenDataFields(fields) {
348
351
  const result = [];
349
352
  for (const field of fields) {
350
353
  if (field.type === "tabs") {
351
354
  for (const tab of field.tabs) {
352
- result.push(...flattenDataFields(tab.fields));
355
+ if (isNamedTab(tab)) {
356
+ const syntheticGroup = {
357
+ name: tab.name,
358
+ type: "group",
359
+ label: tab.label,
360
+ description: tab.description,
361
+ fields: tab.fields
362
+ };
363
+ result.push(syntheticGroup);
364
+ } else {
365
+ result.push(...flattenDataFields(tab.fields));
366
+ }
353
367
  }
354
368
  } else if (field.type === "collapsible" || field.type === "row") {
355
369
  result.push(...flattenDataFields(field.fields));
@@ -802,7 +816,20 @@ async function runFieldHooks(hookType, fields, data, req, operation) {
802
816
  for (const field of fields) {
803
817
  if (field.type === "tabs") {
804
818
  for (const tab of field.tabs) {
805
- processedData = await runFieldHooks(hookType, tab.fields, processedData, req, operation);
819
+ if (isNamedTab(tab)) {
820
+ const nested = processedData[tab.name];
821
+ if (nested && typeof nested === "object" && !Array.isArray(nested)) {
822
+ processedData[tab.name] = await runFieldHooks(
823
+ hookType,
824
+ tab.fields,
825
+ nested,
826
+ req,
827
+ operation
828
+ );
829
+ }
830
+ } else {
831
+ processedData = await runFieldHooks(hookType, tab.fields, processedData, req, operation);
832
+ }
806
833
  }
807
834
  continue;
808
835
  }
package/index.js CHANGED
@@ -263,12 +263,26 @@ var ReferentialIntegrityError = class extends Error {
263
263
  this.constraint = constraint;
264
264
  }
265
265
  };
266
+ function isNamedTab(tab) {
267
+ return typeof tab.name === "string" && tab.name.length > 0;
268
+ }
266
269
  function flattenDataFields(fields) {
267
270
  const result = [];
268
271
  for (const field of fields) {
269
272
  if (field.type === "tabs") {
270
273
  for (const tab of field.tabs) {
271
- result.push(...flattenDataFields(tab.fields));
274
+ if (isNamedTab(tab)) {
275
+ const syntheticGroup = {
276
+ name: tab.name,
277
+ type: "group",
278
+ label: tab.label,
279
+ description: tab.description,
280
+ fields: tab.fields
281
+ };
282
+ result.push(syntheticGroup);
283
+ } else {
284
+ result.push(...flattenDataFields(tab.fields));
285
+ }
272
286
  }
273
287
  } else if (field.type === "collapsible" || field.type === "row") {
274
288
  result.push(...flattenDataFields(field.fields));
@@ -721,7 +735,20 @@ async function runFieldHooks(hookType, fields, data, req, operation) {
721
735
  for (const field of fields) {
722
736
  if (field.type === "tabs") {
723
737
  for (const tab of field.tabs) {
724
- processedData = await runFieldHooks(hookType, tab.fields, processedData, req, operation);
738
+ if (isNamedTab(tab)) {
739
+ const nested = processedData[tab.name];
740
+ if (nested && typeof nested === "object" && !Array.isArray(nested)) {
741
+ processedData[tab.name] = await runFieldHooks(
742
+ hookType,
743
+ tab.fields,
744
+ nested,
745
+ req,
746
+ operation
747
+ );
748
+ }
749
+ } else {
750
+ processedData = await runFieldHooks(hookType, tab.fields, processedData, req, operation);
751
+ }
725
752
  }
726
753
  continue;
727
754
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momentumcms/server-core",
3
- "version": "0.1.10",
3
+ "version": "0.2.0",
4
4
  "description": "Framework-agnostic server handlers for Momentum CMS",
5
5
  "license": "MIT",
6
6
  "author": "Momentum CMS Contributors",