@contentstack/studio-core 1.4.0-alpha-20260721T1325-1838437.0 → 1.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/internal-components/Button.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,MAAM,GACjB,OAAO,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,4CASrD,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/internal-components/Button.tsx"],"names":[],"mappings":"AAmBA,eAAO,MAAM,MAAM,GACjB,OAAO,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,4CASrD,CAAC"}
@@ -11,8 +11,11 @@ function ensureInterFontLoaded() {
11
11
  const link = document.createElement("link");
12
12
  link.id = INTER_FONT_ID;
13
13
  link.rel = "stylesheet";
14
+ // Load the 400–700 range, not just 600: Studio chrome uses regular (400) text
15
+ // too (e.g. the section-slot default-section hint, COMS-1770). With only a 600
16
+ // face present, the browser renders 400 text using the 600 face — i.e. bold.
14
17
  link.href =
15
- "https://fonts.googleapis.com/css2?family=Inter:wght@600&display=swap";
18
+ "https://fonts.googleapis.com/css2?family=Inter:wght@400..700&display=swap";
16
19
  document.head.appendChild(link);
17
20
  }
18
21
  const Button = (props) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../src/internal-components/Button.tsx"],"sourcesContent":[null],"names":["_jsx","gooberCss"],"mappings":";;;;AAGA,MAAM,aAAa,GAAG,sBAAsB;AAE5C,SAAS,qBAAqB,GAAA;IAC5B,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE;AACrC,IAAA,IAAI,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC;QAAE;IAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC;AAC3C,IAAA,IAAI,CAAC,EAAE,GAAG,aAAa;AACvB,IAAA,IAAI,CAAC,GAAG,GAAG,YAAY;AACvB,IAAA,IAAI,CAAC,IAAI;AACP,QAAA,sEAAsE;AACxE,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;AACjC;AAEO,MAAM,MAAM,GAAG,CACpB,KAAoD,KAClD;AACF,IAAA,qBAAqB,EAAE;IACvB,QACEA,mBACM,KAAK,EACT,SAAS,EAAE,CAAA,EAAG,YAAY,CAACC,GAAS,CAAC,CAAC,kBAAkB,CAAA,CAAA,EAAI,KAAK,CAAC,SAAS,IAAI,EAAE,CAAA,CAAE,EAAA,CACnF;AAEN;;;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../src/internal-components/Button.tsx"],"sourcesContent":[null],"names":["_jsx","gooberCss"],"mappings":";;;;AAGA,MAAM,aAAa,GAAG,sBAAsB;AAE5C,SAAS,qBAAqB,GAAA;IAC5B,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE;AACrC,IAAA,IAAI,QAAQ,CAAC,cAAc,CAAC,aAAa,CAAC;QAAE;IAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC;AAC3C,IAAA,IAAI,CAAC,EAAE,GAAG,aAAa;AACvB,IAAA,IAAI,CAAC,GAAG,GAAG,YAAY;;;;AAIvB,IAAA,IAAI,CAAC,IAAI;AACP,QAAA,2EAA2E;AAC7E,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;AACjC;AAEO,MAAM,MAAM,GAAG,CACpB,KAAoD,KAClD;AACF,IAAA,qBAAqB,EAAE;IACvB,QACEA,mBACM,KAAK,EACT,SAAS,EAAE,CAAA,EAAG,YAAY,CAACC,GAAS,CAAC,CAAC,kBAAkB,CAAA,CAAA,EAAI,KAAK,CAAC,SAAS,IAAI,EAAE,CAAA,CAAE,EAAA,CACnF;AAEN;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAkC,EAChC,UAAU,EACV,SAAS,EACT,WAAW,EACX,wBAAwB,EACzB,MAAM,6BAA6B,CAAC;AAErC,eAAO,IAAI,GAAG,EAAE,SAAS,GAAG,IAAW,CAAC;AACxC,eAAO,IAAI,QAAQ,EAAE,wBAAwB,GAAG,IAAW,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,SAAS;qBACH,UAAU;uHAgBghyB,CAAC;mHAAoJ,CAAC;;;CAPlsyB,CAAC;AAEF,wBAAgB,SAAS,CAAC,UAAU,CAAC,EAAE,WAAW;;;;SAIjD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA,OAAkC,EAChC,UAAU,EACV,SAAS,EACT,WAAW,EACX,wBAAwB,EACzB,MAAM,6BAA6B,CAAC;AAErC,eAAO,IAAI,GAAG,EAAE,SAAS,GAAG,IAAW,CAAC;AACxC,eAAO,IAAI,QAAQ,EAAE,wBAAwB,GAAG,IAAW,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,SAAS;qBACH,UAAU;uHAgB6j1B,CAAC;mHAAoJ,CAAC;;;CAP/u1B,CAAC;AAEF,wBAAgB,SAAS,CAAC,UAAU,CAAC,EAAE,WAAW;;;;SAIjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"extract-styles.d.ts","sourceRoot":"","sources":["../../src/style-extractor/extract-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAoCzD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,KAAG,MAoC5D,CAAC"}
1
+ {"version":3,"file":"extract-styles.d.ts","sourceRoot":"","sources":["../../src/style-extractor/extract-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAkDzD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,KAAG,MAwD5D,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { extractCss, css } from 'goober';
2
2
  import { handleNodeStyles } from '../utils/handle-responsive-styles.util.js';
3
+ import { decompressSpec } from '@contentstack/studio-internal';
3
4
  import { Button } from '../internal-components/Button.js';
4
5
 
5
6
  let rootExtracted = "";
@@ -25,6 +26,16 @@ const extractStylesInternal = (node, collectedStyleSheet = "") => {
25
26
  const generatedStyles = extractCss();
26
27
  return collectedStyleSheet + generatedStyles;
27
28
  };
29
+ /**
30
+ * A composition entry's `ui` is typed as a `Node` but is persisted compressed,
31
+ * so at runtime it arrives as a `"zlib:"` string. Mirrors the same normalisation
32
+ * the SDK does before rendering.
33
+ */
34
+ const resolveUiNode = (ui) => {
35
+ if (!ui)
36
+ return null;
37
+ return typeof ui === "string" ? decompressSpec(ui) : ui;
38
+ };
28
39
  /**
29
40
  * Extracts and concatenates CSS styles from a list of composition specifications.
30
41
  *
@@ -50,15 +61,37 @@ const extractStyles = (specs) => {
50
61
  }
51
62
  // extract styles for each composition
52
63
  const styles = [];
64
+ // Section compositions are shared, so the same one can appear many times on a
65
+ // page. Extract each distinct composition once.
66
+ const seenSections = new Set();
53
67
  specs.forEach((compositionSpec) => {
54
68
  if (!compositionSpec)
55
69
  return;
56
70
  // Use the UI node directly as it's now the page node
57
71
  const node = compositionSpec.ui;
58
72
  const style = extractStylesInternal(node);
59
- if (!style)
60
- return;
61
- styles.push(style);
73
+ if (style)
74
+ styles.push(style);
75
+ // A page's `ui` only covers the page's own nodes. Every section it embeds
76
+ // is a separate composition carrying its own `ui` tree, and its styles are
77
+ // registered nowhere else — so without this the browser paints all
78
+ // section content unstyled until goober re-injects after hydration.
79
+ compositionSpec.sectionCompositions?.forEach((sectionEntry) => {
80
+ if (!sectionEntry)
81
+ return;
82
+ const sectionKey = sectionEntry.uid;
83
+ if (sectionKey) {
84
+ if (seenSections.has(sectionKey))
85
+ return;
86
+ seenSections.add(sectionKey);
87
+ }
88
+ const sectionNode = resolveUiNode(sectionEntry.ui);
89
+ if (!sectionNode)
90
+ return;
91
+ const sectionStyle = extractStylesInternal(sectionNode);
92
+ if (sectionStyle)
93
+ styles.push(sectionStyle);
94
+ });
62
95
  });
63
96
  // style for open in studio button
64
97
  css({
@@ -1 +1 @@
1
- {"version":3,"file":"extract-styles.js","sources":["../../src/style-extractor/extract-styles.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAMA,IAAI,aAAa,GAAW,EAAE;AAC9B,MAAM,qBAAqB,GAAG,CAC5B,IAAU,EACV,mBAAA,GAA8B,EAAE,KAC9B;AACF,IAAA,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK;AAC5B,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI;;AAG5B,IAAA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,KAAI;AAClD,QAAA,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE;AACxB,YAAA,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,CAAiC;AACxE,YAAA,MAAM,cAAc,GAAG,eAAe,CAAC,IAAI;YAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC,IAAI,EAAE;AAChD,YAAA,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,KAAI;gBACzB,IAAI,QAAQ,CAAC,QAAQ,EAAE,OAAO,KAAK,KAAK,EAAE;oBACxC;gBACF;gBACA,mBAAmB;AACjB,oBAAA,qBAAqB,CAAC,QAAQ,EAAE,mBAAmB,CAA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;;AAEF,IAAA,GAAG,CAAC;AACF,QAAA,QAAQ,EAAE,UAAU;AACpB,QAAA,MAAM,EAAE,MAAM;AACd,QAAA,qBAAqB,EAAE;AACrB,YAAA,QAAQ,EAAE,UAAU;AACpB,YAAA,OAAO,EAAE,MAAM;AAChB,SAAA;AACD,QAAA,SAAS,EAAE;AACT,YAAA,qBAAqB,EAAE;AACrB,gBAAA,OAAO,EAAE,MAAM;AAChB,aAAA;AACF,SAAA;AACF,KAAA,CAAC;IACF,MAAM,CAAC,EAAE,CAAC;AACV,IAAA,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;IACzB,OAAO,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AACxC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentstack/studio-core",
3
- "version": "1.4.0-alpha-20260721T1325-1838437.0",
3
+ "version": "1.4.1",
4
4
  "description": "Provides utility to fetch spec for composable component",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -40,8 +40,9 @@
40
40
  "tsup": "^8.5.0"
41
41
  },
42
42
  "dependencies": {
43
- "@contentstack/studio-client": "^3.0.0-alpha-20260721T1325-1838437.0",
44
- "@contentstack/studio-registry": "^1.8.0-alpha-20260721T1325-1838437.0",
43
+ "@contentstack/studio-client": "^3.1.0",
44
+ "@contentstack/studio-internal": "^1.6.0",
45
+ "@contentstack/studio-registry": "^1.9.0",
45
46
  "classnames": "^2.5.1",
46
47
  "goober": "^2.1.16"
47
48
  },
@@ -49,5 +50,5 @@
49
50
  "react": "^18.0.0 || ^19.0.0",
50
51
  "react-dom": "^18.0.0 || ^19.0.0"
51
52
  },
52
- "gitHead": "53aad4129b8169dcbe52b2674b541ca491c2b624"
53
+ "gitHead": "1e35733997b7c0e030296d3ebcf053aee69151a3"
53
54
  }