@slicemachine/adapter-next 0.3.66-beta.3 → 0.3.66
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/AlternateGrid/javascript.jsx +1 -2
- package/dist/AlternateGrid/typescript.tsx +25 -26
- package/dist/CallToAction/javascript.jsx +1 -1
- package/dist/CallToAction/typescript.tsx +15 -16
- package/dist/CustomerLogos/javascript.jsx +1 -1
- package/dist/CustomerLogos/typescript.tsx +12 -13
- package/dist/Hero/javascript.jsx +1 -2
- package/dist/Hero/typescript.tsx +25 -26
- package/dist/hooks/slice-create.cjs +3 -2
- package/dist/hooks/slice-create.cjs.map +1 -1
- package/dist/hooks/slice-create.js +3 -2
- package/dist/hooks/slice-create.js.map +1 -1
- package/dist/simulator/SliceSimulator.cjs +4 -21
- package/dist/simulator/SliceSimulator.cjs.map +1 -1
- package/dist/simulator/SliceSimulator.d.ts +3 -3
- package/dist/simulator/SliceSimulator.js +4 -4
- package/dist/simulator/SliceSimulator.js.map +1 -1
- package/dist/simulator/SliceSimulatorWrapper.cjs.map +1 -1
- package/dist/simulator/SliceSimulatorWrapper.d.ts +2 -2
- package/dist/simulator/SliceSimulatorWrapper.js.map +1 -1
- package/dist/simulator/react-server/SliceSimulator.cjs +3 -20
- package/dist/simulator/react-server/SliceSimulator.cjs.map +1 -1
- package/dist/simulator/react-server/SliceSimulator.d.ts +2 -2
- package/dist/simulator/react-server/SliceSimulator.js +3 -3
- package/dist/simulator/react-server/SliceSimulator.js.map +1 -1
- package/package.json +3 -4
- package/src/hooks/slice-create.ts +3 -2
- package/src/simulator/SliceSimulator.tsx +7 -7
- package/src/simulator/SliceSimulatorWrapper.tsx +3 -3
- package/src/simulator/react-server/SliceSimulator.tsx +5 -5
|
@@ -7,9 +7,8 @@ import { PrismicRichText } from "@prismicio/react";
|
|
|
7
7
|
*
|
|
8
8
|
* @typedef {import("@prismicio/react").SliceComponentProps<PascalNameToReplaceSlice>} PascalNameToReplaceProps
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
10
|
+
* @type {import("react").FC<PascalNameToReplaceProps>}
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
12
|
const PascalNameToReplace = ({ slice }) => {
|
|
14
13
|
return (
|
|
15
14
|
<section
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { Content, isFilled } from "@prismicio/client";
|
|
3
3
|
import { SliceComponentProps, PrismicRichText } from "@prismicio/react";
|
|
4
|
+
import { PrismicNextImage } from "@prismicio/next";
|
|
4
5
|
|
|
5
6
|
export type PascalNameToReplaceProps =
|
|
6
7
|
SliceComponentProps<Content.PascalNameToReplaceSlice>;
|
|
7
8
|
|
|
8
|
-
const PascalNameToReplace = ({
|
|
9
|
-
slice,
|
|
10
|
-
}: PascalNameToReplaceProps): JSX.Element => {
|
|
9
|
+
const PascalNameToReplace: FC<PascalNameToReplaceProps> = ({ slice }) => {
|
|
11
10
|
return (
|
|
12
11
|
<section
|
|
13
12
|
data-slice-type={slice.slice_type}
|
|
@@ -90,32 +89,32 @@ const PascalNameToReplace = ({
|
|
|
90
89
|
background-color: #fff;
|
|
91
90
|
color: #333;
|
|
92
91
|
}
|
|
93
|
-
|
|
92
|
+
|
|
94
93
|
.es-alternate-grid__content {
|
|
95
94
|
display: grid;
|
|
96
95
|
gap: 1.5rem;
|
|
97
96
|
grid-auto-flow: dense;
|
|
98
97
|
}
|
|
99
|
-
|
|
98
|
+
|
|
100
99
|
@media (min-width: 640px) {
|
|
101
100
|
.es-alternate-grid__content--with-image {
|
|
102
101
|
grid-template-columns: repeat(2, 1fr);
|
|
103
102
|
}
|
|
104
103
|
}
|
|
105
|
-
|
|
104
|
+
|
|
106
105
|
@media (min-width: 1200px) {
|
|
107
106
|
.es-alternate-grid__content--with-image {
|
|
108
107
|
grid-template-columns: repeat(2, 1fr);
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
|
-
|
|
110
|
+
|
|
112
111
|
.es-alternate-grid__image {
|
|
113
112
|
width: auto;
|
|
114
113
|
height: auto;
|
|
115
114
|
max-width: 100%;
|
|
116
115
|
align-self: center;
|
|
117
116
|
}
|
|
118
|
-
|
|
117
|
+
|
|
119
118
|
.es-alternate-grid__image--left {
|
|
120
119
|
order: 1;
|
|
121
120
|
}
|
|
@@ -123,7 +122,7 @@ const PascalNameToReplace = ({
|
|
|
123
122
|
.es-alternate-grid__image--left + div {
|
|
124
123
|
order: 2;
|
|
125
124
|
}
|
|
126
|
-
|
|
125
|
+
|
|
127
126
|
.es-alternate-grid__image--right{
|
|
128
127
|
order: 2;
|
|
129
128
|
}
|
|
@@ -131,24 +130,24 @@ const PascalNameToReplace = ({
|
|
|
131
130
|
.es-alternate-grid__image--right + div {
|
|
132
131
|
order: 1;
|
|
133
132
|
}
|
|
134
|
-
|
|
133
|
+
|
|
135
134
|
.es-alternate-grid__primary-content {
|
|
136
135
|
display: grid;
|
|
137
136
|
gap: 2rem;
|
|
138
137
|
}
|
|
139
|
-
|
|
138
|
+
|
|
140
139
|
.es-alternate-grid__primary-content__intro {
|
|
141
140
|
display: grid;
|
|
142
141
|
gap: 0.5rem;
|
|
143
142
|
}
|
|
144
|
-
|
|
143
|
+
|
|
145
144
|
.es-alternate-grid__primary-content__intro__eyebrow {
|
|
146
145
|
color: #8592e0;
|
|
147
146
|
font-size: 1.15rem;
|
|
148
147
|
font-weight: 500;
|
|
149
148
|
margin: 0;
|
|
150
149
|
}
|
|
151
|
-
|
|
150
|
+
|
|
152
151
|
.es-alternate-grid__primary-content__intro__headline {
|
|
153
152
|
font-size: 1.625rem;
|
|
154
153
|
font-weight: 700;
|
|
@@ -157,25 +156,25 @@ const PascalNameToReplace = ({
|
|
|
157
156
|
.es-alternate-grid__primary-content__intro__headline * {
|
|
158
157
|
margin: 0;
|
|
159
158
|
}
|
|
160
|
-
|
|
159
|
+
|
|
161
160
|
@media (min-width: 640px) {
|
|
162
161
|
.es-alternate-grid__primary-content__intro__headline {
|
|
163
162
|
font-size: 2rem;
|
|
164
163
|
}
|
|
165
164
|
}
|
|
166
|
-
|
|
165
|
+
|
|
167
166
|
@media (min-width: 1024px) {
|
|
168
167
|
.es-alternate-grid__primary-content__intro__headline {
|
|
169
168
|
font-size: 2.5rem;
|
|
170
169
|
}
|
|
171
170
|
}
|
|
172
|
-
|
|
171
|
+
|
|
173
172
|
@media (min-width: 1200px) {
|
|
174
173
|
.es-alternate-grid__primary-content__intro__headline {
|
|
175
174
|
font-size: 2.75rem;
|
|
176
175
|
}
|
|
177
176
|
}
|
|
178
|
-
|
|
177
|
+
|
|
179
178
|
.es-alternate-grid__primary-content__intro__description {
|
|
180
179
|
font-size: 1.15rem;
|
|
181
180
|
max-width: 38rem;
|
|
@@ -184,29 +183,29 @@ const PascalNameToReplace = ({
|
|
|
184
183
|
.es-alternate-grid__primary-content__intro__description > p {
|
|
185
184
|
margin: 0;
|
|
186
185
|
}
|
|
187
|
-
|
|
186
|
+
|
|
188
187
|
@media (min-width: 1200px) {
|
|
189
188
|
.es-alternate-grid__primary-content__intro__description {
|
|
190
189
|
font-size: 1.4rem;
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
|
-
|
|
192
|
+
|
|
194
193
|
.es-alternate-grid__primary-content__items {
|
|
195
194
|
display: grid;
|
|
196
195
|
gap: 2rem;
|
|
197
196
|
}
|
|
198
|
-
|
|
197
|
+
|
|
199
198
|
@media (min-width: 640px) {
|
|
200
199
|
.es-alternate-grid__primary-content__items {
|
|
201
200
|
grid-template-columns: repeat(2, 1fr);
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
|
-
|
|
203
|
+
|
|
205
204
|
.es-alternate-grid__item {
|
|
206
205
|
display: grid;
|
|
207
206
|
align-content: start;
|
|
208
207
|
}
|
|
209
|
-
|
|
208
|
+
|
|
210
209
|
.es-alternate-grid__item__heading {
|
|
211
210
|
font-weight: 700;
|
|
212
211
|
font-size: 1.17rem;
|
|
@@ -217,11 +216,11 @@ const PascalNameToReplace = ({
|
|
|
217
216
|
.es-alternate-grid__item__heading * {
|
|
218
217
|
margin: 0;
|
|
219
218
|
}
|
|
220
|
-
|
|
219
|
+
|
|
221
220
|
.es-alternate-grid__item__description {
|
|
222
221
|
font-size: 0.9rem;
|
|
223
222
|
}
|
|
224
|
-
|
|
223
|
+
|
|
225
224
|
.es-alternate-grid__item__description * {
|
|
226
225
|
margin: 0;
|
|
227
226
|
}
|
|
@@ -7,7 +7,7 @@ import { PrismicRichText } from "@prismicio/react";
|
|
|
7
7
|
*
|
|
8
8
|
* @typedef {import("@prismicio/react").SliceComponentProps<PascalNameToReplaceSlice>} PascalNameToReplaceProps
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
10
|
+
* @type {import("react").FC<PascalNameToReplaceProps>}
|
|
11
11
|
*/
|
|
12
12
|
const PascalNameToReplace = ({ slice }) => {
|
|
13
13
|
const alignment = slice.variation === "alignLeft" ? "left" : "center";
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { Content, isFilled } from "@prismicio/client";
|
|
3
|
+
import { SliceComponentProps, PrismicRichText } from "@prismicio/react";
|
|
2
4
|
import { PrismicNextLink, PrismicNextImage } from "@prismicio/next";
|
|
3
|
-
import { PrismicRichText, SliceComponentProps } from "@prismicio/react";
|
|
4
5
|
|
|
5
6
|
export type PascalNameToReplaceProps =
|
|
6
7
|
SliceComponentProps<Content.PascalNameToReplaceSlice>;
|
|
7
8
|
|
|
8
|
-
const PascalNameToReplace = ({
|
|
9
|
-
slice,
|
|
10
|
-
}: PascalNameToReplaceProps): JSX.Element => {
|
|
9
|
+
const PascalNameToReplace: FC<PascalNameToReplaceProps> = ({ slice }) => {
|
|
11
10
|
const alignment = slice.variation === "alignLeft" ? "left" : "center";
|
|
12
11
|
|
|
13
12
|
return (
|
|
@@ -46,49 +45,49 @@ const PascalNameToReplace = ({
|
|
|
46
45
|
.es-bounded {
|
|
47
46
|
padding: 8vw 2rem;
|
|
48
47
|
}
|
|
49
|
-
|
|
48
|
+
|
|
50
49
|
.es-bounded__content {
|
|
51
50
|
margin-left: auto;
|
|
52
51
|
margin-right: auto;
|
|
53
52
|
}
|
|
54
|
-
|
|
53
|
+
|
|
55
54
|
@media screen and (min-width: 640px) {
|
|
56
55
|
.es-bounded__content {
|
|
57
56
|
max-width: 90%;
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
|
-
|
|
59
|
+
|
|
61
60
|
@media screen and (min-width: 896px) {
|
|
62
61
|
.es-bounded__content {
|
|
63
62
|
max-width: 80%;
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
|
-
|
|
65
|
+
|
|
67
66
|
@media screen and (min-width: 1280px) {
|
|
68
67
|
.es-bounded__content {
|
|
69
68
|
max-width: 75%;
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
|
|
71
|
+
|
|
73
72
|
.es-call-to-action {
|
|
74
73
|
font-family: system-ui, sans-serif;
|
|
75
74
|
background-color: #fff;
|
|
76
75
|
color: #333;
|
|
77
76
|
}
|
|
78
|
-
|
|
77
|
+
|
|
79
78
|
.es-call-to-action__image {
|
|
80
79
|
max-width: 14rem;
|
|
81
80
|
height: auto;
|
|
82
81
|
width: auto;
|
|
83
82
|
justify-self: ${alignment};
|
|
84
83
|
}
|
|
85
|
-
|
|
84
|
+
|
|
86
85
|
.es-call-to-action__content {
|
|
87
86
|
display: grid;
|
|
88
87
|
gap: 1rem;
|
|
89
88
|
justify-items: ${alignment};
|
|
90
89
|
}
|
|
91
|
-
|
|
90
|
+
|
|
92
91
|
.es-call-to-action__content__heading {
|
|
93
92
|
font-size: 2rem;
|
|
94
93
|
font-weight: 700;
|
|
@@ -98,13 +97,13 @@ const PascalNameToReplace = ({
|
|
|
98
97
|
.es-call-to-action__content__heading * {
|
|
99
98
|
margin: 0;
|
|
100
99
|
}
|
|
101
|
-
|
|
100
|
+
|
|
102
101
|
.es-call-to-action__content__paragraph {
|
|
103
102
|
font-size: 1.15rem;
|
|
104
103
|
max-width: 38rem;
|
|
105
104
|
text-align: ${alignment};
|
|
106
105
|
}
|
|
107
|
-
|
|
106
|
+
|
|
108
107
|
.es-call-to-action__button {
|
|
109
108
|
justify-self: ${alignment};
|
|
110
109
|
border-radius: 0.25rem;
|
|
@@ -117,7 +116,7 @@ const PascalNameToReplace = ({
|
|
|
117
116
|
background-color: #16745f;
|
|
118
117
|
color: #fff;
|
|
119
118
|
}
|
|
120
|
-
|
|
119
|
+
|
|
121
120
|
.es-call-to-action__button:hover {
|
|
122
121
|
background-color: #0d5e4c;
|
|
123
122
|
}
|
|
@@ -7,7 +7,7 @@ import { PrismicNextLink, PrismicNextImage } from "@prismicio/next";
|
|
|
7
7
|
*
|
|
8
8
|
* @typedef {import("@prismicio/react").SliceComponentProps<PascalNameToReplaceSlice>} PascalNameToReplaceProps
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
10
|
+
* @type {import("react").FC<PascalNameToReplaceProps>}
|
|
11
11
|
*/
|
|
12
12
|
const PascalNameToReplace = ({ slice }) => {
|
|
13
13
|
return (
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { Content, isFilled } from "@prismicio/client";
|
|
2
3
|
import { SliceComponentProps, PrismicRichText } from "@prismicio/react";
|
|
3
4
|
import { PrismicNextLink, PrismicNextImage } from "@prismicio/next";
|
|
4
5
|
|
|
5
6
|
export type PascalNameToReplaceProps =
|
|
6
7
|
SliceComponentProps<Content.PascalNameToReplaceSlice>;
|
|
7
8
|
|
|
8
|
-
const PascalNameToReplace = ({
|
|
9
|
-
slice,
|
|
10
|
-
}: PascalNameToReplaceProps): JSX.Element => {
|
|
9
|
+
const PascalNameToReplace: FC<PascalNameToReplaceProps> = ({ slice }) => {
|
|
11
10
|
return (
|
|
12
11
|
<section
|
|
13
12
|
data-slice-type={slice.slice_type}
|
|
@@ -65,13 +64,13 @@ const PascalNameToReplace = ({
|
|
|
65
64
|
background-color: #f4f0ec;
|
|
66
65
|
color: #333;
|
|
67
66
|
}
|
|
68
|
-
|
|
67
|
+
|
|
69
68
|
.es-customer-logos__content {
|
|
70
69
|
display: grid;
|
|
71
70
|
gap: 2rem;
|
|
72
71
|
justify-items: center;
|
|
73
72
|
}
|
|
74
|
-
|
|
73
|
+
|
|
75
74
|
.es-customer-logos__heading {
|
|
76
75
|
color: #8592e0;
|
|
77
76
|
font-size: 1.5rem;
|
|
@@ -81,8 +80,8 @@ const PascalNameToReplace = ({
|
|
|
81
80
|
|
|
82
81
|
.es-customer-logos__heading * {
|
|
83
82
|
margin: 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
83
|
+
}
|
|
84
|
+
|
|
86
85
|
.es-customer-logos__logos {
|
|
87
86
|
display: grid;
|
|
88
87
|
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
|
@@ -92,29 +91,29 @@ const PascalNameToReplace = ({
|
|
|
92
91
|
list-style-type: none;
|
|
93
92
|
width: 100%;
|
|
94
93
|
}
|
|
95
|
-
|
|
94
|
+
|
|
96
95
|
@media (min-width: 1200px) {
|
|
97
96
|
.es-customer-logos__logos {
|
|
98
97
|
margin-left: -3rem;
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
|
-
|
|
100
|
+
|
|
102
101
|
.es-customer-logos__logo {
|
|
103
102
|
margin: 0;
|
|
104
103
|
display: flex;
|
|
105
104
|
justify-content: center;
|
|
106
105
|
}
|
|
107
|
-
|
|
106
|
+
|
|
108
107
|
@media (min-width: 1200px) {
|
|
109
108
|
.es-customer-logos__logo {
|
|
110
109
|
margin-left: 3rem;
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
|
-
|
|
112
|
+
|
|
114
113
|
.es-customer-logos__logo__link__image {
|
|
115
114
|
max-width: 10rem;
|
|
116
115
|
}
|
|
117
|
-
|
|
116
|
+
|
|
118
117
|
.es-customer-logos__button {
|
|
119
118
|
justify-self: center;
|
|
120
119
|
text-decoration: underline;
|
package/dist/Hero/javascript.jsx
CHANGED
|
@@ -7,9 +7,8 @@ import { PrismicRichText } from "@prismicio/react";
|
|
|
7
7
|
*
|
|
8
8
|
* @typedef {import("@prismicio/react").SliceComponentProps<PascalNameToReplaceSlice>} PascalNameToReplaceProps
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
10
|
+
* @type {import("react").FC<PascalNameToReplaceProps>}
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
12
|
const PascalNameToReplace = ({ slice }) => {
|
|
14
13
|
return (
|
|
15
14
|
<section
|
package/dist/Hero/typescript.tsx
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { Content, isFilled } from "@prismicio/client";
|
|
3
3
|
import { SliceComponentProps, PrismicRichText } from "@prismicio/react";
|
|
4
|
+
import { PrismicNextLink, PrismicNextImage } from "@prismicio/next";
|
|
4
5
|
|
|
5
6
|
export type PascalNameToReplaceProps =
|
|
6
7
|
SliceComponentProps<Content.PascalNameToReplaceSlice>;
|
|
7
8
|
|
|
8
|
-
const PascalNameToReplace = ({
|
|
9
|
-
slice,
|
|
10
|
-
}: PascalNameToReplaceProps): JSX.Element => {
|
|
9
|
+
const PascalNameToReplace: FC<PascalNameToReplaceProps> = ({ slice }) => {
|
|
11
10
|
return (
|
|
12
11
|
<section
|
|
13
12
|
data-slice-type={slice.slice_type}
|
|
@@ -64,106 +63,106 @@ const PascalNameToReplace = ({
|
|
|
64
63
|
min-width: 0px;
|
|
65
64
|
position: relative;
|
|
66
65
|
}
|
|
67
|
-
|
|
66
|
+
|
|
68
67
|
.es-fullpage-hero {
|
|
69
68
|
font-family: system-ui, sans-serif;
|
|
70
69
|
background-color: #fff;
|
|
71
70
|
color: #333;
|
|
72
71
|
}
|
|
73
|
-
|
|
72
|
+
|
|
74
73
|
.es-fullpage-hero__image {
|
|
75
74
|
max-width: 100%;
|
|
76
75
|
height: auto;
|
|
77
76
|
align-self: center;
|
|
78
77
|
}
|
|
79
|
-
|
|
78
|
+
|
|
80
79
|
.es-fullpage-hero__image--left > div:first-child {
|
|
81
80
|
order: 1;
|
|
82
81
|
}
|
|
83
|
-
|
|
82
|
+
|
|
84
83
|
.es-fullpage-hero__image--left > div:nth-child(2) {
|
|
85
84
|
order: 2;
|
|
86
85
|
}
|
|
87
|
-
|
|
86
|
+
|
|
88
87
|
.es-fullpage-hero__image--right > div:first-child {
|
|
89
88
|
order: 2;
|
|
90
89
|
}
|
|
91
|
-
|
|
90
|
+
|
|
92
91
|
.es-fullpage-hero__image--right > div:nth-child(2) {
|
|
93
92
|
order: 1;
|
|
94
93
|
}
|
|
95
|
-
|
|
94
|
+
|
|
96
95
|
.es-fullpage-hero__content {
|
|
97
96
|
display: flex;
|
|
98
97
|
flex-direction: column;
|
|
99
98
|
gap: 2rem;
|
|
100
99
|
}
|
|
101
|
-
|
|
100
|
+
|
|
102
101
|
.es-fullpage-hero__content-right {
|
|
103
102
|
display: flex;
|
|
104
103
|
flex-direction: column;
|
|
105
104
|
justify-content: space-around;
|
|
106
105
|
padding: 1.5rem;
|
|
107
106
|
}
|
|
108
|
-
|
|
107
|
+
|
|
109
108
|
@media (min-width: 1080px) {
|
|
110
109
|
.es-fullpage-hero__content {
|
|
111
110
|
flex-direction: row;
|
|
112
111
|
}
|
|
113
|
-
|
|
112
|
+
|
|
114
113
|
.es-fullpage-hero__content > div {
|
|
115
114
|
width: 50%;
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
|
-
|
|
117
|
+
|
|
119
118
|
.es-fullpage-hero__content__intro {
|
|
120
119
|
display: grid;
|
|
121
120
|
gap: 1rem;
|
|
122
121
|
}
|
|
123
|
-
|
|
122
|
+
|
|
124
123
|
.es-fullpage-hero__content__intro__eyebrow {
|
|
125
124
|
color: #47C1AF;
|
|
126
125
|
font-size: 1.15rem;
|
|
127
126
|
font-weight: 500;
|
|
128
127
|
margin: 0;
|
|
129
128
|
}
|
|
130
|
-
|
|
129
|
+
|
|
131
130
|
.es-fullpage-hero__content__intro__headline {
|
|
132
131
|
font-size: 1.625rem;
|
|
133
132
|
font-weight: 700;
|
|
134
133
|
}
|
|
135
|
-
|
|
134
|
+
|
|
136
135
|
.es-fullpage-hero__content__intro__headline * {
|
|
137
136
|
margin: 0;
|
|
138
137
|
}
|
|
139
|
-
|
|
138
|
+
|
|
140
139
|
@media (min-width: 640px) {
|
|
141
140
|
.es-fullpage-hero__content__intro__headline {
|
|
142
141
|
font-size: 2rem;
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
|
-
|
|
144
|
+
|
|
146
145
|
@media (min-width: 1024px) {
|
|
147
146
|
.es-fullpage-hero__content__intro__headline {
|
|
148
147
|
font-size: 2.5rem;
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
|
-
|
|
150
|
+
|
|
152
151
|
@media (min-width: 1200px) {
|
|
153
152
|
.es-fullpage-hero__content__intro__headline {
|
|
154
153
|
font-size: 2.75rem;
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
|
-
|
|
156
|
+
|
|
158
157
|
.es-fullpage-hero__content__intro__description {
|
|
159
158
|
font-size: 1.15rem;
|
|
160
159
|
max-width: 38rem;
|
|
161
160
|
}
|
|
162
|
-
|
|
161
|
+
|
|
163
162
|
.es-fullpage-hero__content__intro__description > p {
|
|
164
163
|
margin: 0;
|
|
165
164
|
}
|
|
166
|
-
|
|
165
|
+
|
|
167
166
|
@media (min-width: 1200px) {
|
|
168
167
|
.es-fullpage-hero__content__intro__description {
|
|
169
168
|
font-size: 1.4rem;
|
|
@@ -180,7 +179,7 @@ const PascalNameToReplace = ({
|
|
|
180
179
|
background-color: #16745f;
|
|
181
180
|
color: #fff;
|
|
182
181
|
}
|
|
183
|
-
|
|
182
|
+
|
|
184
183
|
.es-call-to-action__link:hover {
|
|
185
184
|
background-color: #0d5e4c;
|
|
186
185
|
}
|
|
@@ -20,6 +20,7 @@ const createComponentFile = async ({ data, helpers, actions, options }) => {
|
|
|
20
20
|
contents = data.componentContents;
|
|
21
21
|
} else if (isTypeScriptProject) {
|
|
22
22
|
contents = commonTags.stripIndent`
|
|
23
|
+
import { FC } from "react";
|
|
23
24
|
import { Content } from "@prismicio/client";
|
|
24
25
|
import { SliceComponentProps } from "@prismicio/react";
|
|
25
26
|
|
|
@@ -31,7 +32,7 @@ const createComponentFile = async ({ data, helpers, actions, options }) => {
|
|
|
31
32
|
/**
|
|
32
33
|
* Component for "${data.model.name}" Slices.
|
|
33
34
|
*/
|
|
34
|
-
const ${pascalName} = ({ slice }
|
|
35
|
+
const ${pascalName}: FC<${pascalName}Props> = ({ slice }) => {
|
|
35
36
|
return (
|
|
36
37
|
<section
|
|
37
38
|
data-slice-type={slice.slice_type}
|
|
@@ -49,7 +50,7 @@ const createComponentFile = async ({ data, helpers, actions, options }) => {
|
|
|
49
50
|
/**
|
|
50
51
|
* @typedef {import("@prismicio/client").Content.${pascalName}Slice} ${pascalName}Slice
|
|
51
52
|
* @typedef {import("@prismicio/react").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props
|
|
52
|
-
* @
|
|
53
|
+
* @type {import("react").FC<${pascalName}Props>}
|
|
53
54
|
*/
|
|
54
55
|
const ${pascalName} = ({ slice }) => {
|
|
55
56
|
return (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-create.cjs","sources":["../../../src/hooks/slice-create.ts"],"sourcesContent":["import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tupsertGlobalTypeScriptTypes,\n\twriteSliceFile,\n\twriteSliceModel,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\nimport { getJSFileExtension } from \"../lib/getJSFileExtension\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createComponentFile = async ({\n\tdata,\n\thelpers,\n\tactions,\n\toptions,\n}: Args) => {\n\tconst extension = await getJSFileExtension({ helpers, options, jsx: true });\n\tconst filename = `index.${extension}`;\n\tconst pascalName = pascalCase(data.model.name);\n\n\tlet contents: string;\n\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.componentContents) {\n\t\tcontents = data.componentContents;\n\t} else if (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\timport { Content } from \"@prismicio/client\";\n\t\t\timport { SliceComponentProps } from \"@prismicio/react\";\n\n\t\t\t/**\n\t\t\t * Props for \\`${pascalName}\\`.\n\t\t\t */\n\t\t\texport type ${pascalName}Props = SliceComponentProps<Content.${pascalName}Slice>;\n\n\t\t\t/**\n\t\t\t * Component for \"${data.model.name}\" Slices.\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }
|
|
1
|
+
{"version":3,"file":"slice-create.cjs","sources":["../../../src/hooks/slice-create.ts"],"sourcesContent":["import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tupsertGlobalTypeScriptTypes,\n\twriteSliceFile,\n\twriteSliceModel,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\nimport { getJSFileExtension } from \"../lib/getJSFileExtension\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createComponentFile = async ({\n\tdata,\n\thelpers,\n\tactions,\n\toptions,\n}: Args) => {\n\tconst extension = await getJSFileExtension({ helpers, options, jsx: true });\n\tconst filename = `index.${extension}`;\n\tconst pascalName = pascalCase(data.model.name);\n\n\tlet contents: string;\n\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.componentContents) {\n\t\tcontents = data.componentContents;\n\t} else if (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\timport { FC } from \"react\";\n\t\t\timport { Content } from \"@prismicio/client\";\n\t\t\timport { SliceComponentProps } from \"@prismicio/react\";\n\n\t\t\t/**\n\t\t\t * Props for \\`${pascalName}\\`.\n\t\t\t */\n\t\t\texport type ${pascalName}Props = SliceComponentProps<Content.${pascalName}Slice>;\n\n\t\t\t/**\n\t\t\t * Component for \"${data.model.name}\" Slices.\n\t\t\t */\n\t\t\tconst ${pascalName}: FC<${pascalName}Props> = ({ slice }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${data.model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName}\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t/**\n\t\t\t * @typedef {import(\"@prismicio/client\").Content.${pascalName}Slice} ${pascalName}Slice\n\t\t\t * @typedef {import(\"@prismicio/react\").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props\n\t\t\t * @type {import(\"react\").FC<${pascalName}Props>}\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${data.model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName};\n\t\t`;\n\t}\n\n\tawait writeSliceFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\tfilename,\n\t\tcontents,\n\t\tformat: options.format,\n\t\tactions,\n\t\thelpers,\n\t});\n};\n\nexport const sliceCreate: SliceCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\twriteSliceModel({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\tmodel: data.model,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t}),\n\t\t\tcreateComponentFile({ data, ...context }),\n\t\t]),\n\t);\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertSliceLibraryIndexFile({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\t...context,\n\t\t\t}),\n\t\t\tupsertGlobalTypeScriptTypes({\n\t\t\t\tfilename: context.options.generatedTypesFilePath,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t\tactions: context.actions,\n\t\t\t}),\n\t\t]),\n\t);\n};\n"],"names":["getJSFileExtension","pascalCase","checkIsTypeScriptProject","stripIndent","writeSliceFile","rejectIfNecessary","writeSliceModel","upsertSliceLibraryIndexFile","upsertGlobalTypeScriptTypes"],"mappings":";;;;;;;;;AAwBA,MAAM,sBAAsB,OAAO,EAClC,MACA,SACA,SACA,cACU;AACJ,QAAA,YAAY,MAAMA,mBAAAA,mBAAmB,EAAE,SAAS,SAAS,KAAK,MAAM;AAC1E,QAAM,WAAW,SAAS;AAC1B,QAAM,aAAaC,WAAA,WAAW,KAAK,MAAM,IAAI;AAEzC,MAAA;AAEE,QAAA,sBAAsB,MAAMC,kDAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,MAAI,KAAK,mBAAmB;AAC3B,eAAW,KAAK;AAAA,aACN,qBAAqB;AACpB,eAAAC,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,oBAMO;AAAA;AAAA,iBAEH,iDAAiD;AAAA;AAAA;AAAA,uBAG3C,KAAK,MAAM;AAAA;AAAA,WAEvB,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAMK,KAAK,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKzB;AAAA;AAAA,EAAA,OAEZ;AACK,eAAAA,WAAAA;AAAAA;AAAAA,sDAEyC,oBAAoB;AAAA,iEACT,qBAAqB;AAAA,kCACpD;AAAA;AAAA,WAEvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAMuB,KAAK,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKzB;AAAA;AAAA,EAEnB;AAEA,QAAMC,kBAAe;AAAA,IACpB,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ;AAAA,IACA;AAAA,IACA,QAAQ,QAAQ;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AACF;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AAEFC,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBC,mBAAgB;AAAA,MACf,WAAW,KAAK;AAAA,MAChB,OAAO,KAAK;AAAA,MACZ,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,IACD,oBAAoB,EAAE,MAAM,GAAG,SAAS;AAAA,EACxC,CAAA,CAAC;AAIFD,sCAAA,MAAM,QAAQ,WAAW;AAAA,IACxBE,wDAA4B;AAAA,MAC3B,WAAW,KAAK;AAAA,MAChB,GAAG;AAAA,IAAA,CACH;AAAA,IACDC,+BAA4B;AAAA,MAC3B,UAAU,QAAQ,QAAQ;AAAA,MAC1B,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,MACjB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,EACD,CAAA,CAAC;AAEJ;;"}
|
|
@@ -18,6 +18,7 @@ const createComponentFile = async ({ data, helpers, actions, options }) => {
|
|
|
18
18
|
contents = data.componentContents;
|
|
19
19
|
} else if (isTypeScriptProject) {
|
|
20
20
|
contents = stripIndent`
|
|
21
|
+
import { FC } from "react";
|
|
21
22
|
import { Content } from "@prismicio/client";
|
|
22
23
|
import { SliceComponentProps } from "@prismicio/react";
|
|
23
24
|
|
|
@@ -29,7 +30,7 @@ const createComponentFile = async ({ data, helpers, actions, options }) => {
|
|
|
29
30
|
/**
|
|
30
31
|
* Component for "${data.model.name}" Slices.
|
|
31
32
|
*/
|
|
32
|
-
const ${pascalName} = ({ slice }
|
|
33
|
+
const ${pascalName}: FC<${pascalName}Props> = ({ slice }) => {
|
|
33
34
|
return (
|
|
34
35
|
<section
|
|
35
36
|
data-slice-type={slice.slice_type}
|
|
@@ -47,7 +48,7 @@ const createComponentFile = async ({ data, helpers, actions, options }) => {
|
|
|
47
48
|
/**
|
|
48
49
|
* @typedef {import("@prismicio/client").Content.${pascalName}Slice} ${pascalName}Slice
|
|
49
50
|
* @typedef {import("@prismicio/react").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props
|
|
50
|
-
* @
|
|
51
|
+
* @type {import("react").FC<${pascalName}Props>}
|
|
51
52
|
*/
|
|
52
53
|
const ${pascalName} = ({ slice }) => {
|
|
53
54
|
return (
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice-create.js","sources":["../../../src/hooks/slice-create.ts"],"sourcesContent":["import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tupsertGlobalTypeScriptTypes,\n\twriteSliceFile,\n\twriteSliceModel,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\nimport { getJSFileExtension } from \"../lib/getJSFileExtension\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createComponentFile = async ({\n\tdata,\n\thelpers,\n\tactions,\n\toptions,\n}: Args) => {\n\tconst extension = await getJSFileExtension({ helpers, options, jsx: true });\n\tconst filename = `index.${extension}`;\n\tconst pascalName = pascalCase(data.model.name);\n\n\tlet contents: string;\n\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.componentContents) {\n\t\tcontents = data.componentContents;\n\t} else if (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\timport { Content } from \"@prismicio/client\";\n\t\t\timport { SliceComponentProps } from \"@prismicio/react\";\n\n\t\t\t/**\n\t\t\t * Props for \\`${pascalName}\\`.\n\t\t\t */\n\t\t\texport type ${pascalName}Props = SliceComponentProps<Content.${pascalName}Slice>;\n\n\t\t\t/**\n\t\t\t * Component for \"${data.model.name}\" Slices.\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }
|
|
1
|
+
{"version":3,"file":"slice-create.js","sources":["../../../src/hooks/slice-create.ts"],"sourcesContent":["import type {\n\tSliceCreateHook,\n\tSliceCreateHookData,\n\tSliceMachineContext,\n} from \"@slicemachine/plugin-kit\";\nimport {\n\tupsertGlobalTypeScriptTypes,\n\twriteSliceFile,\n\twriteSliceModel,\n} from \"@slicemachine/plugin-kit/fs\";\nimport { stripIndent } from \"common-tags\";\n\nimport { checkIsTypeScriptProject } from \"../lib/checkIsTypeScriptProject\";\nimport { getJSFileExtension } from \"../lib/getJSFileExtension\";\nimport { pascalCase } from \"../lib/pascalCase\";\nimport { rejectIfNecessary } from \"../lib/rejectIfNecessary\";\nimport { upsertSliceLibraryIndexFile } from \"../lib/upsertSliceLibraryIndexFile\";\n\nimport type { PluginOptions } from \"../types\";\n\ntype Args = {\n\tdata: SliceCreateHookData;\n} & SliceMachineContext<PluginOptions>;\n\nconst createComponentFile = async ({\n\tdata,\n\thelpers,\n\tactions,\n\toptions,\n}: Args) => {\n\tconst extension = await getJSFileExtension({ helpers, options, jsx: true });\n\tconst filename = `index.${extension}`;\n\tconst pascalName = pascalCase(data.model.name);\n\n\tlet contents: string;\n\n\tconst isTypeScriptProject = await checkIsTypeScriptProject({\n\t\thelpers,\n\t\toptions,\n\t});\n\n\tif (data.componentContents) {\n\t\tcontents = data.componentContents;\n\t} else if (isTypeScriptProject) {\n\t\tcontents = stripIndent`\n\t\t\timport { FC } from \"react\";\n\t\t\timport { Content } from \"@prismicio/client\";\n\t\t\timport { SliceComponentProps } from \"@prismicio/react\";\n\n\t\t\t/**\n\t\t\t * Props for \\`${pascalName}\\`.\n\t\t\t */\n\t\t\texport type ${pascalName}Props = SliceComponentProps<Content.${pascalName}Slice>;\n\n\t\t\t/**\n\t\t\t * Component for \"${data.model.name}\" Slices.\n\t\t\t */\n\t\t\tconst ${pascalName}: FC<${pascalName}Props> = ({ slice }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${data.model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName}\n\t\t`;\n\t} else {\n\t\tcontents = stripIndent`\n\t\t\t/**\n\t\t\t * @typedef {import(\"@prismicio/client\").Content.${pascalName}Slice} ${pascalName}Slice\n\t\t\t * @typedef {import(\"@prismicio/react\").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props\n\t\t\t * @type {import(\"react\").FC<${pascalName}Props>}\n\t\t\t */\n\t\t\tconst ${pascalName} = ({ slice }) => {\n\t\t\t\treturn (\n\t\t\t\t\t<section\n\t\t\t\t\t\tdata-slice-type={slice.slice_type}\n\t\t\t\t\t\tdata-slice-variation={slice.variation}\n\t\t\t\t\t>\n\t\t\t\t\t\tPlaceholder component for ${data.model.id} (variation: {slice.variation}) Slices\n\t\t\t\t\t</section>\n\t\t\t\t);\n\t\t\t};\n\n\t\t\texport default ${pascalName};\n\t\t`;\n\t}\n\n\tawait writeSliceFile({\n\t\tlibraryID: data.libraryID,\n\t\tmodel: data.model,\n\t\tfilename,\n\t\tcontents,\n\t\tformat: options.format,\n\t\tactions,\n\t\thelpers,\n\t});\n};\n\nexport const sliceCreate: SliceCreateHook<PluginOptions> = async (\n\tdata,\n\tcontext,\n) => {\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\twriteSliceModel({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\tmodel: data.model,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t}),\n\t\t\tcreateComponentFile({ data, ...context }),\n\t\t]),\n\t);\n\n\trejectIfNecessary(\n\t\tawait Promise.allSettled([\n\t\t\tupsertSliceLibraryIndexFile({\n\t\t\t\tlibraryID: data.libraryID,\n\t\t\t\t...context,\n\t\t\t}),\n\t\t\tupsertGlobalTypeScriptTypes({\n\t\t\t\tfilename: context.options.generatedTypesFilePath,\n\t\t\t\tformat: context.options.format,\n\t\t\t\thelpers: context.helpers,\n\t\t\t\tactions: context.actions,\n\t\t\t}),\n\t\t]),\n\t);\n};\n"],"names":[],"mappings":";;;;;;;AAwBA,MAAM,sBAAsB,OAAO,EAClC,MACA,SACA,SACA,cACU;AACJ,QAAA,YAAY,MAAM,mBAAmB,EAAE,SAAS,SAAS,KAAK,MAAM;AAC1E,QAAM,WAAW,SAAS;AAC1B,QAAM,aAAa,WAAW,KAAK,MAAM,IAAI;AAEzC,MAAA;AAEE,QAAA,sBAAsB,MAAM,yBAAyB;AAAA,IAC1D;AAAA,IACA;AAAA,EAAA,CACA;AAED,MAAI,KAAK,mBAAmB;AAC3B,eAAW,KAAK;AAAA,aACN,qBAAqB;AACpB,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAMO;AAAA;AAAA,iBAEH,iDAAiD;AAAA;AAAA;AAAA,uBAG3C,KAAK,MAAM;AAAA;AAAA,WAEvB,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAMK,KAAK,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKzB;AAAA;AAAA,EAAA,OAEZ;AACK,eAAA;AAAA;AAAA,sDAEyC,oBAAoB;AAAA,iEACT,qBAAqB;AAAA,kCACpD;AAAA;AAAA,WAEvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAMuB,KAAK,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,oBAKzB;AAAA;AAAA,EAEnB;AAEA,QAAM,eAAe;AAAA,IACpB,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,IACZ;AAAA,IACA;AAAA,IACA,QAAQ,QAAQ;AAAA,IAChB;AAAA,IACA;AAAA,EAAA,CACA;AACF;AAEa,MAAA,cAA8C,OAC1D,MACA,YACG;AAEF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,gBAAgB;AAAA,MACf,WAAW,KAAK;AAAA,MAChB,OAAO,KAAK;AAAA,MACZ,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,IACD,oBAAoB,EAAE,MAAM,GAAG,SAAS;AAAA,EACxC,CAAA,CAAC;AAIF,oBAAA,MAAM,QAAQ,WAAW;AAAA,IACxB,4BAA4B;AAAA,MAC3B,WAAW,KAAK;AAAA,MAChB,GAAG;AAAA,IAAA,CACH;AAAA,IACD,4BAA4B;AAAA,MAC3B,UAAU,QAAQ,QAAQ;AAAA,MAC1B,QAAQ,QAAQ,QAAQ;AAAA,MACxB,SAAS,QAAQ;AAAA,MACjB,SAAS,QAAQ;AAAA,IAAA,CACjB;AAAA,EACD,CAAA,CAAC;AAEJ;"}
|
|
@@ -3,34 +3,17 @@
|
|
|
3
3
|
"use strict";
|
|
4
4
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
5
5
|
const jsxRuntime = require("react/jsx-runtime");
|
|
6
|
-
const
|
|
6
|
+
const react = require("react");
|
|
7
7
|
const kit = require("@prismicio/simulator/kit");
|
|
8
8
|
const SliceSimulatorWrapper = require("./SliceSimulatorWrapper.cjs");
|
|
9
|
-
function _interopNamespaceDefault(e) {
|
|
10
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
11
|
-
if (e) {
|
|
12
|
-
for (const k in e) {
|
|
13
|
-
if (k !== "default") {
|
|
14
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: () => e[k]
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
n.default = e;
|
|
23
|
-
return Object.freeze(n);
|
|
24
|
-
}
|
|
25
|
-
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
26
9
|
const simulatorManager = new kit.SimulatorManager();
|
|
27
10
|
const SliceSimulator = ({ background, zIndex, className, ...restProps }) => {
|
|
28
11
|
if (!("sliceZone" in restProps)) {
|
|
29
12
|
throw new Error("A sliceZone prop must be provided when <SliceZone> is rendered in a Client Component. Add a sliceZone prop or convert your simulator to a Server Component with the getSlices helper.");
|
|
30
13
|
}
|
|
31
|
-
const [slices, setSlices] =
|
|
32
|
-
const [message, setMessage] =
|
|
33
|
-
|
|
14
|
+
const [slices, setSlices] = react.useState(() => kit.getDefaultSlices());
|
|
15
|
+
const [message, setMessage] = react.useState(() => kit.getDefaultMessage());
|
|
16
|
+
react.useEffect(() => {
|
|
34
17
|
simulatorManager.state.on(kit.StateEventType.Slices, (_slices) => {
|
|
35
18
|
setSlices(_slices);
|
|
36
19
|
}, "simulator-slices");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceSimulator.cjs","sources":["../../../src/simulator/SliceSimulator.tsx"],"sourcesContent":["\"use client\";\n\nimport
|
|
1
|
+
{"version":3,"file":"SliceSimulator.cjs","sources":["../../../src/simulator/SliceSimulator.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentType, FC, useEffect, useState } from \"react\";\n\nimport {\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSimulatorManager,\n\tSliceSimulatorState,\n\tStateEventType,\n\tgetDefaultMessage,\n\tgetDefaultSlices,\n} from \"@prismicio/simulator/kit\";\n\nimport { SliceSimulatorWrapper } from \"./SliceSimulatorWrapper\";\n\nconst simulatorManager = new SimulatorManager();\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"];\n};\n\nexport type SliceSimulatorProps = {\n\tclassName?: string;\n} & Omit<BaseSliceSimulatorProps, \"state\"> &\n\t(\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * React component to render simulated Slices.\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * ```tsx\n\t\t\t\t * import { SliceSimulator } from \"@slicemachine/adapter-next/simulator\";\n\t\t\t\t * import { SliceZone } from \"@prismicio/react\";\n\t\t\t\t *\n\t\t\t\t * import { components } from \"../slices\";\n\t\t\t\t *\n\t\t\t\t * <SliceSimulator\n\t\t\t\t * \tsliceZone={({ slices }) => (\n\t\t\t\t * \t\t<SliceZone slices={slices} components={components} />\n\t\t\t\t * \t)}\n\t\t\t\t * />;\n\t\t\t\t * ```\n\t\t\t\t */\n\t\t\t\tsliceZone: ComponentType<SliceSimulatorSliceZoneProps>;\n\t\t }\n\t\t| {\n\t\t\t\tchildren: React.ReactNode;\n\t\t }\n\t);\n\n/**\n * Simulate slices in isolation. The slice simulator enables live slice\n * development in Slice Machine and live previews in the Page Builder.\n */\nexport const SliceSimulator: FC<SliceSimulatorProps> = ({\n\tbackground,\n\tzIndex,\n\tclassName,\n\t...restProps\n}) => {\n\tif (!(\"sliceZone\" in restProps)) {\n\t\tthrow new Error(\n\t\t\t\"A sliceZone prop must be provided when <SliceZone> is rendered in a Client Component. Add a sliceZone prop or convert your simulator to a Server Component with the getSlices helper.\",\n\t\t);\n\t}\n\n\tconst [slices, setSlices] = useState(() => getDefaultSlices());\n\tconst [message, setMessage] = useState(() => getDefaultMessage());\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices);\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t);\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Message,\n\t\t\t(_message) => {\n\t\t\t\tsetMessage(_message);\n\t\t\t},\n\t\t\t\"simulator-message\",\n\t\t);\n\n\t\tsimulatorManager.init();\n\n\t\treturn () => {\n\t\t\tsimulatorManager.state.off(StateEventType.Slices, \"simulator-slices\");\n\n\t\t\tsimulatorManager.state.off(StateEventType.Message, \"simulator-message\");\n\t\t};\n\t}, []);\n\n\tconst SliceZoneComp = restProps.sliceZone;\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={slices.length > 0}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<SliceZoneComp slices={slices} />\n\t\t</SliceSimulatorWrapper>\n\t);\n};\n"],"names":["useEffect"],"mappings":";;;;;;;;AAeA;AAwCa;AAMR;AACG;AACkL;AAIzL;AACA;AAEAA;AACC;AAGE;AAAiB;AAInB;AAGE;AAAmB;AAKrB;AAEA;AACC;AAEA;AAAsE;AAAA;AAIxE;AAEA;AAWD;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentType, FC } from "react";
|
|
2
2
|
import { SliceSimulatorProps as BaseSliceSimulatorProps, SliceSimulatorState } from "@prismicio/simulator/kit";
|
|
3
3
|
export type SliceSimulatorSliceZoneProps = {
|
|
4
4
|
slices: SliceSimulatorState["slices"];
|
|
@@ -24,7 +24,7 @@ export type SliceSimulatorProps = {
|
|
|
24
24
|
* />;
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
sliceZone:
|
|
27
|
+
sliceZone: ComponentType<SliceSimulatorSliceZoneProps>;
|
|
28
28
|
} | {
|
|
29
29
|
children: React.ReactNode;
|
|
30
30
|
});
|
|
@@ -32,4 +32,4 @@ export type SliceSimulatorProps = {
|
|
|
32
32
|
* Simulate slices in isolation. The slice simulator enables live slice
|
|
33
33
|
* development in Slice Machine and live previews in the Page Builder.
|
|
34
34
|
*/
|
|
35
|
-
export declare const SliceSimulator:
|
|
35
|
+
export declare const SliceSimulator: FC<SliceSimulatorProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use client';
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import { useState, useEffect } from "react";
|
|
5
5
|
import { SimulatorManager, getDefaultSlices, getDefaultMessage, StateEventType } from "@prismicio/simulator/kit";
|
|
6
6
|
import { SliceSimulatorWrapper } from "./SliceSimulatorWrapper.js";
|
|
7
7
|
const simulatorManager = new SimulatorManager();
|
|
@@ -9,9 +9,9 @@ const SliceSimulator = ({ background, zIndex, className, ...restProps }) => {
|
|
|
9
9
|
if (!("sliceZone" in restProps)) {
|
|
10
10
|
throw new Error("A sliceZone prop must be provided when <SliceZone> is rendered in a Client Component. Add a sliceZone prop or convert your simulator to a Server Component with the getSlices helper.");
|
|
11
11
|
}
|
|
12
|
-
const [slices, setSlices] =
|
|
13
|
-
const [message, setMessage] =
|
|
14
|
-
|
|
12
|
+
const [slices, setSlices] = useState(() => getDefaultSlices());
|
|
13
|
+
const [message, setMessage] = useState(() => getDefaultMessage());
|
|
14
|
+
useEffect(() => {
|
|
15
15
|
simulatorManager.state.on(StateEventType.Slices, (_slices) => {
|
|
16
16
|
setSlices(_slices);
|
|
17
17
|
}, "simulator-slices");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceSimulator.js","sources":["../../../src/simulator/SliceSimulator.tsx"],"sourcesContent":["\"use client\";\n\nimport
|
|
1
|
+
{"version":3,"file":"SliceSimulator.js","sources":["../../../src/simulator/SliceSimulator.tsx"],"sourcesContent":["\"use client\";\n\nimport { ComponentType, FC, useEffect, useState } from \"react\";\n\nimport {\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSimulatorManager,\n\tSliceSimulatorState,\n\tStateEventType,\n\tgetDefaultMessage,\n\tgetDefaultSlices,\n} from \"@prismicio/simulator/kit\";\n\nimport { SliceSimulatorWrapper } from \"./SliceSimulatorWrapper\";\n\nconst simulatorManager = new SimulatorManager();\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"];\n};\n\nexport type SliceSimulatorProps = {\n\tclassName?: string;\n} & Omit<BaseSliceSimulatorProps, \"state\"> &\n\t(\n\t\t| {\n\t\t\t\t/**\n\t\t\t\t * React component to render simulated Slices.\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * ```tsx\n\t\t\t\t * import { SliceSimulator } from \"@slicemachine/adapter-next/simulator\";\n\t\t\t\t * import { SliceZone } from \"@prismicio/react\";\n\t\t\t\t *\n\t\t\t\t * import { components } from \"../slices\";\n\t\t\t\t *\n\t\t\t\t * <SliceSimulator\n\t\t\t\t * \tsliceZone={({ slices }) => (\n\t\t\t\t * \t\t<SliceZone slices={slices} components={components} />\n\t\t\t\t * \t)}\n\t\t\t\t * />;\n\t\t\t\t * ```\n\t\t\t\t */\n\t\t\t\tsliceZone: ComponentType<SliceSimulatorSliceZoneProps>;\n\t\t }\n\t\t| {\n\t\t\t\tchildren: React.ReactNode;\n\t\t }\n\t);\n\n/**\n * Simulate slices in isolation. The slice simulator enables live slice\n * development in Slice Machine and live previews in the Page Builder.\n */\nexport const SliceSimulator: FC<SliceSimulatorProps> = ({\n\tbackground,\n\tzIndex,\n\tclassName,\n\t...restProps\n}) => {\n\tif (!(\"sliceZone\" in restProps)) {\n\t\tthrow new Error(\n\t\t\t\"A sliceZone prop must be provided when <SliceZone> is rendered in a Client Component. Add a sliceZone prop or convert your simulator to a Server Component with the getSlices helper.\",\n\t\t);\n\t}\n\n\tconst [slices, setSlices] = useState(() => getDefaultSlices());\n\tconst [message, setMessage] = useState(() => getDefaultMessage());\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices);\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t);\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Message,\n\t\t\t(_message) => {\n\t\t\t\tsetMessage(_message);\n\t\t\t},\n\t\t\t\"simulator-message\",\n\t\t);\n\n\t\tsimulatorManager.init();\n\n\t\treturn () => {\n\t\t\tsimulatorManager.state.off(StateEventType.Slices, \"simulator-slices\");\n\n\t\t\tsimulatorManager.state.off(StateEventType.Message, \"simulator-message\");\n\t\t};\n\t}, []);\n\n\tconst SliceZoneComp = restProps.sliceZone;\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={slices.length > 0}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<SliceZoneComp slices={slices} />\n\t\t</SliceSimulatorWrapper>\n\t);\n};\n"],"names":[],"mappings":";;;;;;AAeA;AAwCa;AAMR;AACG;AACkL;AAIzL;AACA;AAEA;AACC;AAGE;AAAiB;AAInB;AAGE;AAAmB;AAKrB;AAEA;AACC;AAEA;AAAsE;AAAA;AAIxE;AAEA;AAWD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceSimulatorWrapper.cjs","sources":["../../../src/simulator/SliceSimulatorWrapper.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport {\n\tSliceSimulatorProps,\n\tdisableEventHandler,\n\tgetDefaultProps,\n\tonClickHandler,\n\tsimulatorClass,\n\tsimulatorRootClass,\n} from \"@prismicio/simulator/kit\";\n\ntype SliceSimulatorWrapperProps = {\n\tchildren: ReactNode;\n\tclassName?: string;\n\tmessage?: string;\n\thasSlices: boolean;\n} & Omit<SliceSimulatorProps, \"state\">;\n\n/**\n * A wrapper for the slice simulator that isolates the given children from the\n * page's layout.\n */\nexport const SliceSimulatorWrapper = ({\n\tclassName,\n\tchildren,\n\tzIndex,\n\tbackground,\n\tmessage,\n\thasSlices,\n}
|
|
1
|
+
{"version":3,"file":"SliceSimulatorWrapper.cjs","sources":["../../../src/simulator/SliceSimulatorWrapper.tsx"],"sourcesContent":["import { FC, ReactNode } from \"react\";\nimport {\n\tSliceSimulatorProps,\n\tdisableEventHandler,\n\tgetDefaultProps,\n\tonClickHandler,\n\tsimulatorClass,\n\tsimulatorRootClass,\n} from \"@prismicio/simulator/kit\";\n\ntype SliceSimulatorWrapperProps = {\n\tchildren: ReactNode;\n\tclassName?: string;\n\tmessage?: string;\n\thasSlices: boolean;\n} & Omit<SliceSimulatorProps, \"state\">;\n\n/**\n * A wrapper for the slice simulator that isolates the given children from the\n * page's layout.\n */\nexport const SliceSimulatorWrapper: FC<SliceSimulatorWrapperProps> = ({\n\tclassName,\n\tchildren,\n\tzIndex,\n\tbackground,\n\tmessage,\n\thasSlices,\n}) => {\n\tconst defaultProps = getDefaultProps();\n\n\treturn (\n\t\t<div\n\t\t\tclassName={[simulatorClass, className].filter(Boolean).join(\" \")}\n\t\t\tstyle={{\n\t\t\t\tzIndex:\n\t\t\t\t\ttypeof zIndex === \"undefined\"\n\t\t\t\t\t\t? defaultProps.zIndex\n\t\t\t\t\t\t: zIndex ?? undefined,\n\t\t\t\tposition: \"fixed\",\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\twidth: \"100%\",\n\t\t\t\theight: \"100vh\",\n\t\t\t\toverflow: \"auto\",\n\t\t\t\tbackground:\n\t\t\t\t\ttypeof background === \"undefined\"\n\t\t\t\t\t\t? defaultProps.background\n\t\t\t\t\t\t: background ?? undefined,\n\t\t\t}}\n\t\t>\n\t\t\t{message ? (\n\t\t\t\t<article dangerouslySetInnerHTML={{ __html: message }} />\n\t\t\t) : hasSlices ? (\n\t\t\t\t<div\n\t\t\t\t\tid=\"root\"\n\t\t\t\t\tclassName={simulatorRootClass}\n\t\t\t\t\tonClickCapture={onClickHandler as unknown as React.MouseEventHandler}\n\t\t\t\t\tonSubmitCapture={\n\t\t\t\t\t\tdisableEventHandler as unknown as React.FormEventHandler\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n};\n"],"names":["getDefaultProps","_jsx","simulatorClass","simulatorRootClass","onClickHandler","disableEventHandler"],"mappings":";;;;AAqBa,MAAA,wBAAwD,CAAC,EACrE,WACA,UACA,QACA,YACA,SACA,gBACI;AACJ,QAAM,eAAeA,IAAAA;AAErB,SACCC,wBACC,WAAW,CAACC,IAAAA,gBAAgB,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAC/D,OAAO;AAAA,IACN,QACC,OAAO,WAAW,cACf,aAAa,SACb,UAAU;AAAA,IACd,UAAU;AAAA,IACV,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YACC,OAAO,eAAe,cACnB,aAAa,aACb,cAAc;AAAA,EAGlB,GAAA,UAAA,UACAD,WAAA,IAAS,WAAA,EAAA,yBAAyB,EAAE,QAAQ,QAAS,EAAA,CAAA,IAClD,YACHA,WAAAA,IAAA,OAAA,EACC,IAAG,QACH,WAAWE,IAAAA,oBACX,gBAAgBC,IAAAA,gBAChB,iBACCC,IAAwD,qBAAA,SAAA,CAGhD,IAEP,KACC,CAAA;AAER;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
2
|
import { SliceSimulatorProps } from "@prismicio/simulator/kit";
|
|
3
3
|
type SliceSimulatorWrapperProps = {
|
|
4
4
|
children: ReactNode;
|
|
@@ -10,5 +10,5 @@ type SliceSimulatorWrapperProps = {
|
|
|
10
10
|
* A wrapper for the slice simulator that isolates the given children from the
|
|
11
11
|
* page's layout.
|
|
12
12
|
*/
|
|
13
|
-
export declare const SliceSimulatorWrapper:
|
|
13
|
+
export declare const SliceSimulatorWrapper: FC<SliceSimulatorWrapperProps>;
|
|
14
14
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceSimulatorWrapper.js","sources":["../../../src/simulator/SliceSimulatorWrapper.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport {\n\tSliceSimulatorProps,\n\tdisableEventHandler,\n\tgetDefaultProps,\n\tonClickHandler,\n\tsimulatorClass,\n\tsimulatorRootClass,\n} from \"@prismicio/simulator/kit\";\n\ntype SliceSimulatorWrapperProps = {\n\tchildren: ReactNode;\n\tclassName?: string;\n\tmessage?: string;\n\thasSlices: boolean;\n} & Omit<SliceSimulatorProps, \"state\">;\n\n/**\n * A wrapper for the slice simulator that isolates the given children from the\n * page's layout.\n */\nexport const SliceSimulatorWrapper = ({\n\tclassName,\n\tchildren,\n\tzIndex,\n\tbackground,\n\tmessage,\n\thasSlices,\n}
|
|
1
|
+
{"version":3,"file":"SliceSimulatorWrapper.js","sources":["../../../src/simulator/SliceSimulatorWrapper.tsx"],"sourcesContent":["import { FC, ReactNode } from \"react\";\nimport {\n\tSliceSimulatorProps,\n\tdisableEventHandler,\n\tgetDefaultProps,\n\tonClickHandler,\n\tsimulatorClass,\n\tsimulatorRootClass,\n} from \"@prismicio/simulator/kit\";\n\ntype SliceSimulatorWrapperProps = {\n\tchildren: ReactNode;\n\tclassName?: string;\n\tmessage?: string;\n\thasSlices: boolean;\n} & Omit<SliceSimulatorProps, \"state\">;\n\n/**\n * A wrapper for the slice simulator that isolates the given children from the\n * page's layout.\n */\nexport const SliceSimulatorWrapper: FC<SliceSimulatorWrapperProps> = ({\n\tclassName,\n\tchildren,\n\tzIndex,\n\tbackground,\n\tmessage,\n\thasSlices,\n}) => {\n\tconst defaultProps = getDefaultProps();\n\n\treturn (\n\t\t<div\n\t\t\tclassName={[simulatorClass, className].filter(Boolean).join(\" \")}\n\t\t\tstyle={{\n\t\t\t\tzIndex:\n\t\t\t\t\ttypeof zIndex === \"undefined\"\n\t\t\t\t\t\t? defaultProps.zIndex\n\t\t\t\t\t\t: zIndex ?? undefined,\n\t\t\t\tposition: \"fixed\",\n\t\t\t\ttop: 0,\n\t\t\t\tleft: 0,\n\t\t\t\twidth: \"100%\",\n\t\t\t\theight: \"100vh\",\n\t\t\t\toverflow: \"auto\",\n\t\t\t\tbackground:\n\t\t\t\t\ttypeof background === \"undefined\"\n\t\t\t\t\t\t? defaultProps.background\n\t\t\t\t\t\t: background ?? undefined,\n\t\t\t}}\n\t\t>\n\t\t\t{message ? (\n\t\t\t\t<article dangerouslySetInnerHTML={{ __html: message }} />\n\t\t\t) : hasSlices ? (\n\t\t\t\t<div\n\t\t\t\t\tid=\"root\"\n\t\t\t\t\tclassName={simulatorRootClass}\n\t\t\t\t\tonClickCapture={onClickHandler as unknown as React.MouseEventHandler}\n\t\t\t\t\tonSubmitCapture={\n\t\t\t\t\t\tdisableEventHandler as unknown as React.FormEventHandler\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</div>\n\t);\n};\n"],"names":["_jsx"],"mappings":";;AAqBa,MAAA,wBAAwD,CAAC,EACrE,WACA,UACA,QACA,YACA,SACA,gBACI;AACJ,QAAM,eAAe;AAErB,SACCA,aACC,WAAW,CAAC,gBAAgB,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAC/D,OAAO;AAAA,IACN,QACC,OAAO,WAAW,cACf,aAAa,SACb,UAAU;AAAA,IACd,UAAU;AAAA,IACV,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,YACC,OAAO,eAAe,cACnB,aAAa,aACb,cAAc;AAAA,EAGlB,GAAA,UAAA,UACAA,IAAS,WAAA,EAAA,yBAAyB,EAAE,QAAQ,QAAS,EAAA,CAAA,IAClD,YACHA,IAAA,OAAA,EACC,IAAG,QACH,WAAW,oBACX,gBAAgB,gBAChB,iBACC,qBAAwD,SAAA,CAGhD,IAEP,KACC,CAAA;AAER;"}
|
|
@@ -3,37 +3,20 @@
|
|
|
3
3
|
"use strict";
|
|
4
4
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
5
5
|
const jsxRuntime = require("react/jsx-runtime");
|
|
6
|
-
const
|
|
6
|
+
const react = require("react");
|
|
7
7
|
const navigation = require("next/navigation");
|
|
8
8
|
const kit = require("@prismicio/simulator/kit");
|
|
9
9
|
const lzString = require("lz-string");
|
|
10
10
|
const SliceSimulatorWrapper = require("../SliceSimulatorWrapper.cjs");
|
|
11
11
|
const getSlices = require("./getSlices.cjs");
|
|
12
|
-
function _interopNamespaceDefault(e) {
|
|
13
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
14
|
-
if (e) {
|
|
15
|
-
for (const k in e) {
|
|
16
|
-
if (k !== "default") {
|
|
17
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: () => e[k]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
n.default = e;
|
|
26
|
-
return Object.freeze(n);
|
|
27
|
-
}
|
|
28
|
-
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
29
12
|
const STATE_PARAMS_KEY = "state";
|
|
30
13
|
const simulatorManager = new kit.SimulatorManager();
|
|
31
14
|
const SliceSimulator = ({ children, background, zIndex, className }) => {
|
|
32
|
-
const [message, setMessage] =
|
|
15
|
+
const [message, setMessage] = react.useState(() => kit.getDefaultMessage());
|
|
33
16
|
const router = navigation.useRouter();
|
|
34
17
|
const state = typeof window !== "undefined" ? new URL(window.location.href).searchParams.get(STATE_PARAMS_KEY) : void 0;
|
|
35
18
|
const hasSlices = getSlices.getSlices(state).length > 0;
|
|
36
|
-
|
|
19
|
+
react.useEffect(() => {
|
|
37
20
|
simulatorManager.state.on(kit.StateEventType.Slices, (newSlices) => {
|
|
38
21
|
const url = new URL(window.location.href);
|
|
39
22
|
url.searchParams.set(STATE_PARAMS_KEY, lzString.compressToEncodedURIComponent(JSON.stringify(newSlices)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceSimulator.cjs","sources":["../../../../src/simulator/react-server/SliceSimulator.tsx"],"sourcesContent":["// This `<SliceSimulator>` is only accessible from Server Components.\n\n\"use client\";\n\nimport
|
|
1
|
+
{"version":3,"file":"SliceSimulator.cjs","sources":["../../../../src/simulator/react-server/SliceSimulator.tsx"],"sourcesContent":["// This `<SliceSimulator>` is only accessible from Server Components.\n\n\"use client\";\n\nimport { FC, useEffect, useState } from \"react\";\n\nimport { useRouter } from \"next/navigation\";\nimport {\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSimulatorManager,\n\tStateEventType,\n\tgetDefaultMessage,\n} from \"@prismicio/simulator/kit\";\nimport { compressToEncodedURIComponent } from \"lz-string\";\n\nimport { SliceSimulatorWrapper } from \"../SliceSimulatorWrapper\";\nimport { getSlices } from \"./getSlices\";\n\nconst STATE_PARAMS_KEY = \"state\";\n\nconst simulatorManager = new SimulatorManager();\n\nexport type SliceSimulatorProps = Omit<BaseSliceSimulatorProps, \"state\"> & {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n};\n\nexport const SliceSimulator: FC<SliceSimulatorProps> = ({\n\tchildren,\n\tbackground,\n\tzIndex,\n\tclassName,\n}) => {\n\tconst [message, setMessage] = useState(() => getDefaultMessage());\n\tconst router = useRouter();\n\n\tconst state =\n\t\ttypeof window !== \"undefined\"\n\t\t\t? new URL(window.location.href).searchParams.get(STATE_PARAMS_KEY)\n\t\t\t: undefined;\n\tconst hasSlices = getSlices(state).length > 0;\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(newSlices) => {\n\t\t\t\tconst url = new URL(window.location.href);\n\t\t\t\turl.searchParams.set(\n\t\t\t\t\tSTATE_PARAMS_KEY,\n\t\t\t\t\tcompressToEncodedURIComponent(JSON.stringify(newSlices)),\n\t\t\t\t);\n\n\t\t\t\twindow.history.replaceState(null, \"\", url);\n\t\t\t\t// Wait until the next tick to prevent URL state race conditions.\n\t\t\t\tsetTimeout(() => router.refresh(), 0);\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t);\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Message,\n\t\t\t(newMessage) => setMessage(newMessage),\n\t\t\t\"simulator-message\",\n\t\t);\n\n\t\tsimulatorManager.init();\n\n\t\treturn () => {\n\t\t\tsimulatorManager.state.off(StateEventType.Slices, \"simulator-slices\");\n\n\t\t\tsimulatorManager.state.off(StateEventType.Message, \"simulator-message\");\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={hasSlices}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t{children}\n\t\t</SliceSimulatorWrapper>\n\t);\n};\n"],"names":["useEffect"],"mappings":";;;;;;;;;;;AAkBA;AAEA;AAOO;AAMN;AACA;AAEA;AAIA;AAEAA;AACC;AAGE;AACI;AAKJ;AAEA;AAAoC;AAIrB;AAMjB;AAEA;AACC;AAEA;AAAsE;AAAA;AAKvE;AAUF;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from "react";
|
|
2
2
|
import { SliceSimulatorProps as BaseSliceSimulatorProps } from "@prismicio/simulator/kit";
|
|
3
3
|
export type SliceSimulatorProps = Omit<BaseSliceSimulatorProps, "state"> & {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
className?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const SliceSimulator:
|
|
7
|
+
export declare const SliceSimulator: FC<SliceSimulatorProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use client';
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import { useState, useEffect } from "react";
|
|
5
5
|
import { useRouter } from "next/navigation";
|
|
6
6
|
import { SimulatorManager, getDefaultMessage, StateEventType } from "@prismicio/simulator/kit";
|
|
7
7
|
import { compressToEncodedURIComponent } from "lz-string";
|
|
@@ -10,11 +10,11 @@ import { getSlices } from "./getSlices.js";
|
|
|
10
10
|
const STATE_PARAMS_KEY = "state";
|
|
11
11
|
const simulatorManager = new SimulatorManager();
|
|
12
12
|
const SliceSimulator = ({ children, background, zIndex, className }) => {
|
|
13
|
-
const [message, setMessage] =
|
|
13
|
+
const [message, setMessage] = useState(() => getDefaultMessage());
|
|
14
14
|
const router = useRouter();
|
|
15
15
|
const state = typeof window !== "undefined" ? new URL(window.location.href).searchParams.get(STATE_PARAMS_KEY) : void 0;
|
|
16
16
|
const hasSlices = getSlices(state).length > 0;
|
|
17
|
-
|
|
17
|
+
useEffect(() => {
|
|
18
18
|
simulatorManager.state.on(StateEventType.Slices, (newSlices) => {
|
|
19
19
|
const url = new URL(window.location.href);
|
|
20
20
|
url.searchParams.set(STATE_PARAMS_KEY, compressToEncodedURIComponent(JSON.stringify(newSlices)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceSimulator.js","sources":["../../../../src/simulator/react-server/SliceSimulator.tsx"],"sourcesContent":["// This `<SliceSimulator>` is only accessible from Server Components.\n\n\"use client\";\n\nimport
|
|
1
|
+
{"version":3,"file":"SliceSimulator.js","sources":["../../../../src/simulator/react-server/SliceSimulator.tsx"],"sourcesContent":["// This `<SliceSimulator>` is only accessible from Server Components.\n\n\"use client\";\n\nimport { FC, useEffect, useState } from \"react\";\n\nimport { useRouter } from \"next/navigation\";\nimport {\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSimulatorManager,\n\tStateEventType,\n\tgetDefaultMessage,\n} from \"@prismicio/simulator/kit\";\nimport { compressToEncodedURIComponent } from \"lz-string\";\n\nimport { SliceSimulatorWrapper } from \"../SliceSimulatorWrapper\";\nimport { getSlices } from \"./getSlices\";\n\nconst STATE_PARAMS_KEY = \"state\";\n\nconst simulatorManager = new SimulatorManager();\n\nexport type SliceSimulatorProps = Omit<BaseSliceSimulatorProps, \"state\"> & {\n\tchildren: React.ReactNode;\n\tclassName?: string;\n};\n\nexport const SliceSimulator: FC<SliceSimulatorProps> = ({\n\tchildren,\n\tbackground,\n\tzIndex,\n\tclassName,\n}) => {\n\tconst [message, setMessage] = useState(() => getDefaultMessage());\n\tconst router = useRouter();\n\n\tconst state =\n\t\ttypeof window !== \"undefined\"\n\t\t\t? new URL(window.location.href).searchParams.get(STATE_PARAMS_KEY)\n\t\t\t: undefined;\n\tconst hasSlices = getSlices(state).length > 0;\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(newSlices) => {\n\t\t\t\tconst url = new URL(window.location.href);\n\t\t\t\turl.searchParams.set(\n\t\t\t\t\tSTATE_PARAMS_KEY,\n\t\t\t\t\tcompressToEncodedURIComponent(JSON.stringify(newSlices)),\n\t\t\t\t);\n\n\t\t\t\twindow.history.replaceState(null, \"\", url);\n\t\t\t\t// Wait until the next tick to prevent URL state race conditions.\n\t\t\t\tsetTimeout(() => router.refresh(), 0);\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t);\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Message,\n\t\t\t(newMessage) => setMessage(newMessage),\n\t\t\t\"simulator-message\",\n\t\t);\n\n\t\tsimulatorManager.init();\n\n\t\treturn () => {\n\t\t\tsimulatorManager.state.off(StateEventType.Slices, \"simulator-slices\");\n\n\t\t\tsimulatorManager.state.off(StateEventType.Message, \"simulator-message\");\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={hasSlices}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t{children}\n\t\t</SliceSimulatorWrapper>\n\t);\n};\n"],"names":[],"mappings":";;;;;;;;;AAkBA;AAEA;AAOO;AAMN;AACA;AAEA;AAIA;AAEA;AACC;AAGE;AACI;AAKJ;AAEA;AAAoC;AAIrB;AAMjB;AAEA;AACC;AAEA;AAAsE;AAAA;AAKvE;AAUF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slicemachine/adapter-next",
|
|
3
|
-
"version": "0.3.66
|
|
3
|
+
"version": "0.3.66",
|
|
4
4
|
"description": "Slice Machine adapter for Next.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@prismicio/simulator": "^0.1.4",
|
|
70
70
|
"@prismicio/types-internal": "3.3.0",
|
|
71
|
-
"@slicemachine/plugin-kit": "0.4.65
|
|
71
|
+
"@slicemachine/plugin-kit": "0.4.65",
|
|
72
72
|
"common-tags": "^1.8.2",
|
|
73
73
|
"fp-ts": "^2.13.1",
|
|
74
74
|
"io-ts": "^2.2.20",
|
|
@@ -113,6 +113,5 @@
|
|
|
113
113
|
},
|
|
114
114
|
"publishConfig": {
|
|
115
115
|
"access": "public"
|
|
116
|
-
}
|
|
117
|
-
"stableVersion": "0.3.65"
|
|
116
|
+
}
|
|
118
117
|
}
|
|
@@ -43,6 +43,7 @@ const createComponentFile = async ({
|
|
|
43
43
|
contents = data.componentContents;
|
|
44
44
|
} else if (isTypeScriptProject) {
|
|
45
45
|
contents = stripIndent`
|
|
46
|
+
import { FC } from "react";
|
|
46
47
|
import { Content } from "@prismicio/client";
|
|
47
48
|
import { SliceComponentProps } from "@prismicio/react";
|
|
48
49
|
|
|
@@ -54,7 +55,7 @@ const createComponentFile = async ({
|
|
|
54
55
|
/**
|
|
55
56
|
* Component for "${data.model.name}" Slices.
|
|
56
57
|
*/
|
|
57
|
-
const ${pascalName} = ({ slice }
|
|
58
|
+
const ${pascalName}: FC<${pascalName}Props> = ({ slice }) => {
|
|
58
59
|
return (
|
|
59
60
|
<section
|
|
60
61
|
data-slice-type={slice.slice_type}
|
|
@@ -72,7 +73,7 @@ const createComponentFile = async ({
|
|
|
72
73
|
/**
|
|
73
74
|
* @typedef {import("@prismicio/client").Content.${pascalName}Slice} ${pascalName}Slice
|
|
74
75
|
* @typedef {import("@prismicio/react").SliceComponentProps<${pascalName}Slice>} ${pascalName}Props
|
|
75
|
-
* @
|
|
76
|
+
* @type {import("react").FC<${pascalName}Props>}
|
|
76
77
|
*/
|
|
77
78
|
const ${pascalName} = ({ slice }) => {
|
|
78
79
|
return (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { ComponentType, FC, useEffect, useState } from "react";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
SliceSimulatorProps as BaseSliceSimulatorProps,
|
|
@@ -42,7 +42,7 @@ export type SliceSimulatorProps = {
|
|
|
42
42
|
* />;
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
sliceZone:
|
|
45
|
+
sliceZone: ComponentType<SliceSimulatorSliceZoneProps>;
|
|
46
46
|
}
|
|
47
47
|
| {
|
|
48
48
|
children: React.ReactNode;
|
|
@@ -53,22 +53,22 @@ export type SliceSimulatorProps = {
|
|
|
53
53
|
* Simulate slices in isolation. The slice simulator enables live slice
|
|
54
54
|
* development in Slice Machine and live previews in the Page Builder.
|
|
55
55
|
*/
|
|
56
|
-
export const SliceSimulator = ({
|
|
56
|
+
export const SliceSimulator: FC<SliceSimulatorProps> = ({
|
|
57
57
|
background,
|
|
58
58
|
zIndex,
|
|
59
59
|
className,
|
|
60
60
|
...restProps
|
|
61
|
-
}
|
|
61
|
+
}) => {
|
|
62
62
|
if (!("sliceZone" in restProps)) {
|
|
63
63
|
throw new Error(
|
|
64
64
|
"A sliceZone prop must be provided when <SliceZone> is rendered in a Client Component. Add a sliceZone prop or convert your simulator to a Server Component with the getSlices helper.",
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
const [slices, setSlices] =
|
|
69
|
-
const [message, setMessage] =
|
|
68
|
+
const [slices, setSlices] = useState(() => getDefaultSlices());
|
|
69
|
+
const [message, setMessage] = useState(() => getDefaultMessage());
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
useEffect(() => {
|
|
72
72
|
simulatorManager.state.on(
|
|
73
73
|
StateEventType.Slices,
|
|
74
74
|
(_slices) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
2
|
import {
|
|
3
3
|
SliceSimulatorProps,
|
|
4
4
|
disableEventHandler,
|
|
@@ -19,14 +19,14 @@ type SliceSimulatorWrapperProps = {
|
|
|
19
19
|
* A wrapper for the slice simulator that isolates the given children from the
|
|
20
20
|
* page's layout.
|
|
21
21
|
*/
|
|
22
|
-
export const SliceSimulatorWrapper = ({
|
|
22
|
+
export const SliceSimulatorWrapper: FC<SliceSimulatorWrapperProps> = ({
|
|
23
23
|
className,
|
|
24
24
|
children,
|
|
25
25
|
zIndex,
|
|
26
26
|
background,
|
|
27
27
|
message,
|
|
28
28
|
hasSlices,
|
|
29
|
-
}
|
|
29
|
+
}) => {
|
|
30
30
|
const defaultProps = getDefaultProps();
|
|
31
31
|
|
|
32
32
|
return (
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
"use client";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { FC, useEffect, useState } from "react";
|
|
6
6
|
|
|
7
7
|
import { useRouter } from "next/navigation";
|
|
8
8
|
import {
|
|
@@ -25,13 +25,13 @@ export type SliceSimulatorProps = Omit<BaseSliceSimulatorProps, "state"> & {
|
|
|
25
25
|
className?: string;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export const SliceSimulator = ({
|
|
28
|
+
export const SliceSimulator: FC<SliceSimulatorProps> = ({
|
|
29
29
|
children,
|
|
30
30
|
background,
|
|
31
31
|
zIndex,
|
|
32
32
|
className,
|
|
33
|
-
}
|
|
34
|
-
const [message, setMessage] =
|
|
33
|
+
}) => {
|
|
34
|
+
const [message, setMessage] = useState(() => getDefaultMessage());
|
|
35
35
|
const router = useRouter();
|
|
36
36
|
|
|
37
37
|
const state =
|
|
@@ -40,7 +40,7 @@ export const SliceSimulator = ({
|
|
|
40
40
|
: undefined;
|
|
41
41
|
const hasSlices = getSlices(state).length > 0;
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
useEffect(() => {
|
|
44
44
|
simulatorManager.state.on(
|
|
45
45
|
StateEventType.Slices,
|
|
46
46
|
(newSlices) => {
|