@prismicio/types-internal 3.12.0-alpha.1 → 3.12.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/lib/content/Document.d.ts +6 -24
- package/lib/content/Document.js +2 -1
- package/lib/customtypes/CustomType.js +9 -6
- package/lib/customtypes/Section.js +8 -3
- package/lib/customtypes/widgets/Group.js +20 -20
- package/lib/customtypes/widgets/slices/CompositeSlice.js +22 -9
- package/lib/customtypes/widgets/slices/SharedSlice.js +37 -18
- package/lib/customtypes/widgets/slices/Slices.js +16 -9
- package/package.json +1 -1
- package/src/content/Document.ts +2 -1
- package/src/customtypes/CustomType.ts +9 -6
- package/src/customtypes/Section.ts +9 -3
- package/src/customtypes/widgets/Group.ts +21 -20
- package/src/customtypes/widgets/slices/CompositeSlice.ts +22 -9
- package/src/customtypes/widgets/slices/SharedSlice.ts +38 -23
- package/src/customtypes/widgets/slices/Slices.ts +15 -9
- package/CHANGELOG.md +0 -764
|
@@ -123,7 +123,7 @@ export function traverseSlices<T extends DynamicSlices | StaticSlices>(args: {
|
|
|
123
123
|
|
|
124
124
|
if (!slices.config?.choices) return slices
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
let choices: Record<string, typeof slices.config.choices[string]> | undefined
|
|
127
127
|
for (const [key, prevModel] of Object.entries(slices.config.choices)) {
|
|
128
128
|
const path = [...prevPath, key]
|
|
129
129
|
let model
|
|
@@ -165,14 +165,20 @@ export function traverseSlices<T extends DynamicSlices | StaticSlices>(args: {
|
|
|
165
165
|
break
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
if (model !== prevModel) {
|
|
169
|
+
if (!choices) choices = { ...slices.config.choices }
|
|
170
|
+
choices[key] = model as typeof slices.config.choices[string]
|
|
171
|
+
}
|
|
169
172
|
}
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
// returns the traversed model instead of a new one if it didn't change
|
|
175
|
+
return choices
|
|
176
|
+
? {
|
|
177
|
+
...slices,
|
|
178
|
+
config: {
|
|
179
|
+
...slices.config,
|
|
180
|
+
choices,
|
|
181
|
+
},
|
|
182
|
+
}
|
|
183
|
+
: slices
|
|
178
184
|
}
|