@contentstack/studio-core 1.4.0 → 1.4.2
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/internal-components/Button.d.ts.map +1 -1
- package/dist/internal-components/Button.js +4 -1
- package/dist/internal-components/Button.js.map +1 -1
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/style-extractor/extract-styles.d.ts.map +1 -1
- package/dist/style-extractor/extract-styles.js +36 -3
- package/dist/style-extractor/extract-styles.js.map +1 -1
- package/package.json +5 -5
- package/LICENSE +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/internal-components/Button.tsx"],"names":[],"mappings":"
|
|
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@
|
|
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
|
|
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;;;;"}
|
package/dist/sdk/index.d.ts.map
CHANGED
|
@@ -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;
|
|
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;uHAgBu63B,CAAC;mHAAoJ,CAAC;;;CAPzl4B,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;
|
|
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 (
|
|
60
|
-
|
|
61
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"extract-styles.js","sources":["../../src/style-extractor/extract-styles.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAUA,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,M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
|
"description": "Provides utility to fetch spec for composable component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"tsup": "^8.5.0"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@contentstack/studio-client": "^3.
|
|
44
|
-
"@contentstack/studio-
|
|
43
|
+
"@contentstack/studio-client": "^3.2.0",
|
|
44
|
+
"@contentstack/studio-internal": "^1.7.0",
|
|
45
|
+
"@contentstack/studio-registry": "^1.10.0",
|
|
45
46
|
"classnames": "^2.5.1",
|
|
46
47
|
"goober": "^2.1.16"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"react": "^18.0.0 || ^19.0.0",
|
|
50
51
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
51
|
-
}
|
|
52
|
-
"gitHead": "0a4e62965622cd47c743978ebdcda4f74515fc6e"
|
|
52
|
+
}
|
|
53
53
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Contentstack
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|