@contentful/create-studio-experiences 3.8.11-dev-20261008T0347-32313d5.0 → 4.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/create-studio-experiences",
3
- "version": "3.8.11-dev-20261008T0347-32313d5.0",
3
+ "version": "4.0.0",
4
4
  "description": "A CLI tool to get up and running with Contentful Studio Experiences quickly",
5
5
  "homepage": "https://github.com/contentful/experience-builder/tree/next/packages/create-studio-experiences#readme",
6
6
  "repository": {
@@ -59,5 +59,5 @@
59
59
  "open": "^11.0.0",
60
60
  "yargs": "^18.1.0"
61
61
  },
62
- "gitHead": "5d25955904dc772ba071c0e4b99c7649554b2679"
62
+ "gitHead": "fd20ef004b00a7451027a10ac9cb7bbd8d971c7e"
63
63
  }
@@ -1,6 +1,7 @@
1
1
  import PageLayout from '@/components/PageLayout';
2
2
  import { getExperience } from '@/getExperience';
3
3
  import { detachExperienceStyles } from '@contentful/experiences-sdk-react';
4
+ import '../../../design-tokens';
4
5
 
5
6
  type Page = {
6
7
  params: Promise<{ locale?: string; slug?: string; preview?: string }>;
@@ -0,0 +1,130 @@
1
+ import { defineDesignTokens } from '@contentful/experiences-sdk-react';
2
+
3
+ const textColorTokens = {
4
+ Primary: '#1890ff',
5
+ Heading: '#262626',
6
+ HeadingInverse: '#ffffff',
7
+ Paragraph: '#262626',
8
+ ParagraphLight: '#878787',
9
+ ParagraphInverse: '#ffffff',
10
+ };
11
+
12
+ const fontSizeTokens = {
13
+ XS: '14px',
14
+ S: '16px',
15
+ M: '20px',
16
+ L: '24px',
17
+ XL: '32px',
18
+ '2XL': '48px',
19
+ '3XL': '64px',
20
+ '4XL': '84px',
21
+ };
22
+
23
+ const lineHeightTokens = {
24
+ Paragraph: '150%',
25
+ Heading: '125%',
26
+ };
27
+
28
+ defineDesignTokens({
29
+ textColor: textColorTokens,
30
+ fontSize: fontSizeTokens,
31
+ lineHeight: lineHeightTokens,
32
+ color: {
33
+ Neutral: '#fafafa',
34
+ Warm: '#faf4f3',
35
+ Red: '#fff1f0',
36
+ Orange: '#fff7e6',
37
+ Gold: '#fffbe6',
38
+ Lime: '#fcffe6',
39
+ Cyan: '#e6fffb',
40
+ Blue: '#e6f7ff',
41
+ Purple: '#f9f0ff',
42
+ Magenta: '#fff0f6',
43
+ },
44
+ spacing: {
45
+ XXS: '8px',
46
+ XS: '12px',
47
+ S: '16px',
48
+ M: '24px',
49
+ L: '32px',
50
+ XL: '40px',
51
+ '2XL': '48px',
52
+ '3XL': '64px',
53
+ '4XL': '128px',
54
+ },
55
+ sizing: {
56
+ Layout: '960px',
57
+ 'Content Block': '480px',
58
+ },
59
+ border: {
60
+ Card: {
61
+ width: '1px',
62
+ style: 'solid',
63
+ color: '#fafafa',
64
+ },
65
+ 'Card Bold': {
66
+ width: '2px',
67
+ style: 'solid',
68
+ color: '#f0f0f0',
69
+ },
70
+ },
71
+ borderRadius: {
72
+ M: '8px',
73
+ },
74
+ text: {
75
+ 'Hero H1': {
76
+ fontSize: fontSizeTokens['3XL'],
77
+ fontWeight: '600',
78
+ lineHeight: lineHeightTokens.Heading,
79
+ color: textColorTokens.ParagraphInverse,
80
+ },
81
+ 'Hero Paragraph': {
82
+ fontSize: fontSizeTokens.S,
83
+ fontWeight: '500',
84
+ lineHeight: lineHeightTokens.Paragraph,
85
+ color: textColorTokens.ParagraphInverse,
86
+ },
87
+ H1: {
88
+ fontSize: fontSizeTokens['3XL'],
89
+ fontWeight: '600',
90
+ lineHeight: lineHeightTokens.Heading,
91
+ color: textColorTokens.Heading,
92
+ },
93
+ H2: {
94
+ fontSize: fontSizeTokens.XL,
95
+ fontWeight: '600',
96
+ lineHeight: lineHeightTokens.Heading,
97
+ color: textColorTokens.Heading,
98
+ },
99
+ H3: {
100
+ fontSize: fontSizeTokens.L,
101
+ fontWeight: '600',
102
+ lineHeight: lineHeightTokens.Heading,
103
+ color: textColorTokens.Heading,
104
+ },
105
+ H4: {
106
+ fontSize: fontSizeTokens.M,
107
+ fontWeight: '600',
108
+ lineHeight: lineHeightTokens.Heading,
109
+ color: textColorTokens.Heading,
110
+ },
111
+ H5: {
112
+ fontSize: fontSizeTokens.S,
113
+ fontWeight: '600',
114
+ lineHeight: lineHeightTokens.Heading,
115
+ color: textColorTokens.Heading,
116
+ },
117
+ Paragraph: {
118
+ fontSize: fontSizeTokens.S,
119
+ fontWeight: '500',
120
+ lineHeight: lineHeightTokens.Paragraph,
121
+ color: textColorTokens.Paragraph,
122
+ },
123
+ 'Paragraph Large': {
124
+ fontSize: fontSizeTokens.M,
125
+ fontWeight: '500',
126
+ lineHeight: lineHeightTokens.Paragraph,
127
+ color: textColorTokens.Paragraph,
128
+ },
129
+ },
130
+ });
@@ -1,139 +1,11 @@
1
- import { defineComponents, defineDesignTokens } from '@contentful/experiences-sdk-react';
1
+ import { defineComponents } from '@contentful/experiences-sdk-react';
2
2
  import { ButtonComponentRegistration } from './components/ButtonComponentRegistration';
3
3
  import { RatingStarsComponentRegistration } from '@/components/RatingStarsComponentRegistration';
4
4
  import { CardComponentRegistration } from './components/CardComponentRegistration';
5
+ import './design-tokens';
5
6
 
6
7
  defineComponents([
7
8
  ButtonComponentRegistration,
8
9
  RatingStarsComponentRegistration,
9
10
  CardComponentRegistration,
10
11
  ]);
11
-
12
- const textColorTokens = {
13
- Primary: '#1890ff',
14
- Heading: '#262626',
15
- HeadingInverse: '#ffffff',
16
- Paragraph: '#262626',
17
- ParagraphLight: '#878787',
18
- ParagraphInverse: '#ffffff',
19
- };
20
-
21
- const fontSizeTokens = {
22
- XS: '14px',
23
- S: '16px',
24
- M: '20px',
25
- L: '24px',
26
- XL: '32px',
27
- '2XL': '48px',
28
- '3XL': '64px',
29
- '4XL': '84px',
30
- };
31
-
32
- const lineHeightTokens = {
33
- Paragraph: '150%',
34
- Heading: '125%',
35
- };
36
-
37
- defineDesignTokens({
38
- textColor: textColorTokens,
39
- fontSize: fontSizeTokens,
40
- lineHeight: lineHeightTokens,
41
- color: {
42
- Neutral: '#fafafa',
43
- Warm: '#faf4f3',
44
- Red: '#fff1f0',
45
- Orange: '#fff7e6',
46
- Gold: '#fffbe6',
47
- Lime: '#fcffe6',
48
- Cyan: '#e6fffb',
49
- Blue: '#e6f7ff',
50
- Purple: '#f9f0ff',
51
- Magenta: '#fff0f6',
52
- },
53
- spacing: {
54
- XXS: '8px',
55
- XS: '12px',
56
- S: '16px',
57
- M: '24px',
58
- L: '32px',
59
- XL: '40px',
60
- '2XL': '48px',
61
- '3XL': '64px',
62
- '4XL': '128px',
63
- },
64
- sizing: {
65
- Layout: '960px',
66
- 'Content Block': '480px',
67
- },
68
- border: {
69
- Card: {
70
- width: '1px',
71
- style: 'solid',
72
- color: '#fafafa',
73
- },
74
- 'Card Bold': {
75
- width: '2px',
76
- style: 'solid',
77
- color: '#f0f0f0',
78
- },
79
- },
80
- borderRadius: {
81
- M: '8px',
82
- },
83
- text: {
84
- 'Hero H1': {
85
- fontSize: fontSizeTokens['3XL'],
86
- fontWeight: '600',
87
- lineHeight: lineHeightTokens.Heading,
88
- color: textColorTokens.ParagraphInverse,
89
- },
90
- 'Hero Paragraph': {
91
- fontSize: fontSizeTokens.S,
92
- fontWeight: '500',
93
- lineHeight: lineHeightTokens.Paragraph,
94
- color: textColorTokens.ParagraphInverse,
95
- },
96
- H1: {
97
- fontSize: fontSizeTokens['3XL'],
98
- fontWeight: '600',
99
- lineHeight: lineHeightTokens.Heading,
100
- color: textColorTokens.Heading,
101
- },
102
- H2: {
103
- fontSize: fontSizeTokens.XL,
104
- fontWeight: '600',
105
- lineHeight: lineHeightTokens.Heading,
106
- color: textColorTokens.Heading,
107
- },
108
- H3: {
109
- fontSize: fontSizeTokens.L,
110
- fontWeight: '600',
111
- lineHeight: lineHeightTokens.Heading,
112
- color: textColorTokens.Heading,
113
- },
114
- H4: {
115
- fontSize: fontSizeTokens.M,
116
- fontWeight: '600',
117
- lineHeight: lineHeightTokens.Heading,
118
- color: textColorTokens.Heading,
119
- },
120
- H5: {
121
- fontSize: fontSizeTokens.S,
122
- fontWeight: '600',
123
- lineHeight: lineHeightTokens.Heading,
124
- color: textColorTokens.Heading,
125
- },
126
- Paragraph: {
127
- fontSize: fontSizeTokens.S,
128
- fontWeight: '500',
129
- lineHeight: lineHeightTokens.Paragraph,
130
- color: textColorTokens.Paragraph,
131
- },
132
- 'Paragraph Large': {
133
- fontSize: fontSizeTokens.M,
134
- fontWeight: '500',
135
- lineHeight: lineHeightTokens.Paragraph,
136
- color: textColorTokens.Paragraph,
137
- },
138
- },
139
- });
@@ -0,0 +1,76 @@
1
+ import { describe, it, expect, vi } from 'vitest';
2
+ import { createExperience } from '@contentful/experiences-core';
3
+ import type { Entry } from 'contentful';
4
+ import { getExperience } from '../src/getExperience';
5
+ import ExperiencePage from '../src/app/[locale]/[slug]/page';
6
+
7
+ vi.mock('@contentful/experiences-sdk-react', async () => {
8
+ const { defineDesignTokens, detachExperienceStyles } =
9
+ await import('@contentful/experiences-core');
10
+ return { defineDesignTokens, detachExperienceStyles };
11
+ });
12
+ vi.mock('../src/getExperience', () => ({ getExperience: vi.fn() }));
13
+ vi.mock('../src/components/PageLayout', () => ({ default: () => null }));
14
+
15
+ describe('server-rendered experience styles', () => {
16
+ it('resolves template design tokens before serializing the experience', async () => {
17
+ const entry: Entry = {
18
+ metadata: { tags: [] },
19
+ sys: {
20
+ id: 'test-experience',
21
+ type: 'Entry',
22
+ locale: 'en-US',
23
+ revision: 1,
24
+ publishedVersion: 1,
25
+ createdAt: '2026-10-07T00:00:00Z',
26
+ updatedAt: '2026-10-07T00:00:00Z',
27
+ space: { sys: { id: 'test-space', type: 'Link', linkType: 'Space' } },
28
+ environment: { sys: { id: 'master', type: 'Link', linkType: 'Environment' } },
29
+ contentType: { sys: { id: 'experience', type: 'Link', linkType: 'ContentType' } },
30
+ },
31
+ fields: {
32
+ title: 'Test experience',
33
+ slug: 'home-page',
34
+ dataSource: {},
35
+ unboundValues: {},
36
+ usedComponents: [],
37
+ componentTree: {
38
+ schemaVersion: '2023-09-28',
39
+ breakpoints: [
40
+ { id: 'desktop', query: '*', displayName: 'All sizes', previewSize: '100%' },
41
+ ],
42
+ children: [
43
+ {
44
+ id: 'token-component',
45
+ definitionId: 'custom-component',
46
+ children: [],
47
+ variables: {
48
+ cfPadding: { type: 'DesignValue', valuesByBreakpoint: { desktop: '${spacing.M}' } },
49
+ cfWidth: {
50
+ type: 'DesignValue',
51
+ valuesByBreakpoint: { desktop: '${sizing.Layout}' },
52
+ },
53
+ },
54
+ },
55
+ ],
56
+ },
57
+ },
58
+ };
59
+ const experience = createExperience({
60
+ experienceEntry: entry,
61
+ referencedEntries: [],
62
+ referencedAssets: [],
63
+ locale: 'en-US',
64
+ });
65
+ vi.mocked(getExperience).mockResolvedValue({ experience });
66
+
67
+ const page = await ExperiencePage({
68
+ params: Promise.resolve({ locale: 'en-US', slug: 'home-page' }),
69
+ searchParams: Promise.resolve({}),
70
+ });
71
+ const { stylesheet } = page.props;
72
+
73
+ expect(stylesheet).toContain('padding:24px;');
74
+ expect(stylesheet).toContain('width:960px;');
75
+ });
76
+ });
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'vitest/config';
2
+ import { fileURLToPath } from 'node:url';
3
+
4
+ export default defineConfig({
5
+ resolve: {
6
+ alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
7
+ },
8
+ test: { environment: 'node' },
9
+ });