@measured/puck-plugin-heading-analyzer 0.20.0-canary.274fe3d9 → 0.20.0-canary.2ce4c22c
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/index.d.mts +41 -2
- package/dist/index.d.ts +41 -2
- package/dist/index.js +78 -46
- package/dist/index.mjs +78 -46
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
@@ -19,6 +19,7 @@ type BaseField = {
|
|
19
19
|
type TextField = BaseField & {
|
20
20
|
type: "text";
|
21
21
|
placeholder?: string;
|
22
|
+
contentEditable?: boolean;
|
22
23
|
};
|
23
24
|
type NumberField = BaseField & {
|
24
25
|
type: "number";
|
@@ -30,6 +31,7 @@ type NumberField = BaseField & {
|
|
30
31
|
type TextareaField = BaseField & {
|
31
32
|
type: "textarea";
|
32
33
|
placeholder?: string;
|
34
|
+
contentEditable?: boolean;
|
33
35
|
};
|
34
36
|
type SelectField = BaseField & {
|
35
37
|
type: "select";
|
@@ -107,6 +109,7 @@ type CustomFieldRender<Value extends any> = (props: {
|
|
107
109
|
type CustomField<Value extends any> = BaseField & {
|
108
110
|
type: "custom";
|
109
111
|
render: CustomFieldRender<Value>;
|
112
|
+
contentEditable?: boolean;
|
110
113
|
};
|
111
114
|
type SlotField = BaseField & {
|
112
115
|
type: "slot";
|
@@ -122,6 +125,10 @@ type FieldProps<F = Field<any>, ValueType = any> = {
|
|
122
125
|
readOnly?: boolean;
|
123
126
|
};
|
124
127
|
|
128
|
+
type ExtractField<T extends Field["type"]> = Extract<Field, {
|
129
|
+
type: T;
|
130
|
+
}>;
|
131
|
+
|
125
132
|
type Metadata = {
|
126
133
|
[key: string]: any;
|
127
134
|
};
|
@@ -137,6 +144,8 @@ type ArrayState = {
|
|
137
144
|
type UiState = {
|
138
145
|
leftSideBarVisible: boolean;
|
139
146
|
rightSideBarVisible: boolean;
|
147
|
+
leftSideBarWidth?: number | null;
|
148
|
+
rightSideBarWidth?: number | null;
|
140
149
|
itemSelector: ItemSelector | null;
|
141
150
|
arrayState: Record<string, ArrayState | undefined>;
|
142
151
|
previewMode: "interactive" | "edit";
|
@@ -160,12 +169,29 @@ type UiState = {
|
|
160
169
|
};
|
161
170
|
};
|
162
171
|
|
172
|
+
type MapFnParams<ThisField = Field> = {
|
173
|
+
value: any;
|
174
|
+
parentId: string;
|
175
|
+
propName: string;
|
176
|
+
field: ThisField;
|
177
|
+
propPath: string;
|
178
|
+
};
|
179
|
+
|
180
|
+
type FieldTransformFnParams<T> = Omit<MapFnParams<T>, "parentId"> & {
|
181
|
+
isReadOnly: boolean;
|
182
|
+
componentId: string;
|
183
|
+
};
|
184
|
+
type FieldTransformFn<T = any> = (params: FieldTransformFnParams<T>) => any;
|
185
|
+
type FieldTransforms = Partial<{
|
186
|
+
[FieldType in Field["type"]]: FieldTransformFn<ExtractField<FieldType>>;
|
187
|
+
}>;
|
188
|
+
|
163
189
|
type RenderFunc<Props extends {
|
164
190
|
[key: string]: any;
|
165
191
|
} = {
|
166
192
|
children: ReactNode;
|
167
193
|
}> = (props: Props) => ReactElement;
|
168
|
-
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "
|
194
|
+
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
169
195
|
type OverrideKey = (typeof overrideKeys)[number];
|
170
196
|
type OverridesGeneric<Shape extends {
|
171
197
|
[key in OverrideKey]: any;
|
@@ -203,11 +229,23 @@ type Overrides = OverridesGeneric<{
|
|
203
229
|
children: ReactNode;
|
204
230
|
name: string;
|
205
231
|
}>;
|
232
|
+
drawer: RenderFunc;
|
233
|
+
drawerItem: RenderFunc<{
|
234
|
+
children: ReactNode;
|
235
|
+
name: string;
|
236
|
+
}>;
|
206
237
|
iframe: RenderFunc<{
|
207
238
|
children: ReactNode;
|
208
239
|
document?: Document;
|
209
240
|
}>;
|
210
241
|
outline: RenderFunc;
|
242
|
+
componentOverlay: RenderFunc<{
|
243
|
+
children: ReactNode;
|
244
|
+
hover: boolean;
|
245
|
+
isSelected: boolean;
|
246
|
+
componentId: string;
|
247
|
+
componentType: string;
|
248
|
+
}>;
|
211
249
|
puck: RenderFunc;
|
212
250
|
}>;
|
213
251
|
type FieldRenderFunctions = Omit<{
|
@@ -233,7 +271,8 @@ type Viewport = {
|
|
233
271
|
};
|
234
272
|
|
235
273
|
type Plugin = {
|
236
|
-
overrides
|
274
|
+
overrides?: Partial<Overrides>;
|
275
|
+
fieldTransforms?: FieldTransforms;
|
237
276
|
};
|
238
277
|
|
239
278
|
declare const headingAnalyzer: Plugin;
|
package/dist/index.d.ts
CHANGED
@@ -19,6 +19,7 @@ type BaseField = {
|
|
19
19
|
type TextField = BaseField & {
|
20
20
|
type: "text";
|
21
21
|
placeholder?: string;
|
22
|
+
contentEditable?: boolean;
|
22
23
|
};
|
23
24
|
type NumberField = BaseField & {
|
24
25
|
type: "number";
|
@@ -30,6 +31,7 @@ type NumberField = BaseField & {
|
|
30
31
|
type TextareaField = BaseField & {
|
31
32
|
type: "textarea";
|
32
33
|
placeholder?: string;
|
34
|
+
contentEditable?: boolean;
|
33
35
|
};
|
34
36
|
type SelectField = BaseField & {
|
35
37
|
type: "select";
|
@@ -107,6 +109,7 @@ type CustomFieldRender<Value extends any> = (props: {
|
|
107
109
|
type CustomField<Value extends any> = BaseField & {
|
108
110
|
type: "custom";
|
109
111
|
render: CustomFieldRender<Value>;
|
112
|
+
contentEditable?: boolean;
|
110
113
|
};
|
111
114
|
type SlotField = BaseField & {
|
112
115
|
type: "slot";
|
@@ -122,6 +125,10 @@ type FieldProps<F = Field<any>, ValueType = any> = {
|
|
122
125
|
readOnly?: boolean;
|
123
126
|
};
|
124
127
|
|
128
|
+
type ExtractField<T extends Field["type"]> = Extract<Field, {
|
129
|
+
type: T;
|
130
|
+
}>;
|
131
|
+
|
125
132
|
type Metadata = {
|
126
133
|
[key: string]: any;
|
127
134
|
};
|
@@ -137,6 +144,8 @@ type ArrayState = {
|
|
137
144
|
type UiState = {
|
138
145
|
leftSideBarVisible: boolean;
|
139
146
|
rightSideBarVisible: boolean;
|
147
|
+
leftSideBarWidth?: number | null;
|
148
|
+
rightSideBarWidth?: number | null;
|
140
149
|
itemSelector: ItemSelector | null;
|
141
150
|
arrayState: Record<string, ArrayState | undefined>;
|
142
151
|
previewMode: "interactive" | "edit";
|
@@ -160,12 +169,29 @@ type UiState = {
|
|
160
169
|
};
|
161
170
|
};
|
162
171
|
|
172
|
+
type MapFnParams<ThisField = Field> = {
|
173
|
+
value: any;
|
174
|
+
parentId: string;
|
175
|
+
propName: string;
|
176
|
+
field: ThisField;
|
177
|
+
propPath: string;
|
178
|
+
};
|
179
|
+
|
180
|
+
type FieldTransformFnParams<T> = Omit<MapFnParams<T>, "parentId"> & {
|
181
|
+
isReadOnly: boolean;
|
182
|
+
componentId: string;
|
183
|
+
};
|
184
|
+
type FieldTransformFn<T = any> = (params: FieldTransformFnParams<T>) => any;
|
185
|
+
type FieldTransforms = Partial<{
|
186
|
+
[FieldType in Field["type"]]: FieldTransformFn<ExtractField<FieldType>>;
|
187
|
+
}>;
|
188
|
+
|
163
189
|
type RenderFunc<Props extends {
|
164
190
|
[key: string]: any;
|
165
191
|
} = {
|
166
192
|
children: ReactNode;
|
167
193
|
}> = (props: Props) => ReactElement;
|
168
|
-
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "
|
194
|
+
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
169
195
|
type OverrideKey = (typeof overrideKeys)[number];
|
170
196
|
type OverridesGeneric<Shape extends {
|
171
197
|
[key in OverrideKey]: any;
|
@@ -203,11 +229,23 @@ type Overrides = OverridesGeneric<{
|
|
203
229
|
children: ReactNode;
|
204
230
|
name: string;
|
205
231
|
}>;
|
232
|
+
drawer: RenderFunc;
|
233
|
+
drawerItem: RenderFunc<{
|
234
|
+
children: ReactNode;
|
235
|
+
name: string;
|
236
|
+
}>;
|
206
237
|
iframe: RenderFunc<{
|
207
238
|
children: ReactNode;
|
208
239
|
document?: Document;
|
209
240
|
}>;
|
210
241
|
outline: RenderFunc;
|
242
|
+
componentOverlay: RenderFunc<{
|
243
|
+
children: ReactNode;
|
244
|
+
hover: boolean;
|
245
|
+
isSelected: boolean;
|
246
|
+
componentId: string;
|
247
|
+
componentType: string;
|
248
|
+
}>;
|
211
249
|
puck: RenderFunc;
|
212
250
|
}>;
|
213
251
|
type FieldRenderFunctions = Omit<{
|
@@ -233,7 +271,8 @@ type Viewport = {
|
|
233
271
|
};
|
234
272
|
|
235
273
|
type Plugin = {
|
236
|
-
overrides
|
274
|
+
overrides?: Partial<Overrides>;
|
275
|
+
fieldTransforms?: FieldTransforms;
|
237
276
|
};
|
238
277
|
|
239
278
|
declare const headingAnalyzer: Plugin;
|
package/dist/index.js
CHANGED
@@ -521,7 +521,7 @@ function forRelatedZones(item, data, cb, path = []) {
|
|
521
521
|
});
|
522
522
|
}
|
523
523
|
|
524
|
-
// ../core/lib/data/map-
|
524
|
+
// ../core/lib/data/map-fields.ts
|
525
525
|
init_react_import();
|
526
526
|
|
527
527
|
// ../core/lib/data/default-slots.ts
|
@@ -531,14 +531,14 @@ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
|
|
531
531
|
value
|
532
532
|
);
|
533
533
|
|
534
|
-
// ../core/lib/data/map-
|
534
|
+
// ../core/lib/data/map-fields.ts
|
535
535
|
var isPromise = (v) => !!v && typeof v.then === "function";
|
536
536
|
var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
|
537
537
|
var containsPromise = (arr) => arr.some(isPromise);
|
538
538
|
var walkField = ({
|
539
539
|
value,
|
540
540
|
fields,
|
541
|
-
|
541
|
+
mappers,
|
542
542
|
propKey = "",
|
543
543
|
propPath = "",
|
544
544
|
id = "",
|
@@ -546,7 +546,9 @@ var walkField = ({
|
|
546
546
|
recurseSlots = false
|
547
547
|
}) => {
|
548
548
|
var _a, _b, _c;
|
549
|
-
|
549
|
+
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
550
|
+
const map = mappers[fieldType];
|
551
|
+
if (map && fieldType === "slot") {
|
550
552
|
const content = value || [];
|
551
553
|
const mappedContent = recurseSlots ? content.map((el) => {
|
552
554
|
var _a2;
|
@@ -558,7 +560,7 @@ var walkField = ({
|
|
558
560
|
return walkField({
|
559
561
|
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
560
562
|
fields: fields2,
|
561
|
-
|
563
|
+
mappers,
|
562
564
|
id: el.props.id,
|
563
565
|
config,
|
564
566
|
recurseSlots
|
@@ -567,7 +569,21 @@ var walkField = ({
|
|
567
569
|
if (containsPromise(mappedContent)) {
|
568
570
|
return Promise.all(mappedContent);
|
569
571
|
}
|
570
|
-
return map(
|
572
|
+
return map({
|
573
|
+
value: mappedContent,
|
574
|
+
parentId: id,
|
575
|
+
propName: propKey,
|
576
|
+
field: fields[propKey],
|
577
|
+
propPath
|
578
|
+
});
|
579
|
+
} else if (map && fields[propKey]) {
|
580
|
+
return map({
|
581
|
+
value,
|
582
|
+
parentId: id,
|
583
|
+
propName: propKey,
|
584
|
+
field: fields[propKey],
|
585
|
+
propPath
|
586
|
+
});
|
571
587
|
}
|
572
588
|
if (value && typeof value === "object") {
|
573
589
|
if (Array.isArray(value)) {
|
@@ -577,7 +593,7 @@ var walkField = ({
|
|
577
593
|
(el, idx) => walkField({
|
578
594
|
value: el,
|
579
595
|
fields: arrayFields,
|
580
|
-
|
596
|
+
mappers,
|
581
597
|
propKey,
|
582
598
|
propPath: `${propPath}[${idx}]`,
|
583
599
|
id,
|
@@ -596,7 +612,7 @@ var walkField = ({
|
|
596
612
|
return walkObject({
|
597
613
|
value,
|
598
614
|
fields: objectFields,
|
599
|
-
|
615
|
+
mappers,
|
600
616
|
id,
|
601
617
|
getPropPath: (k) => `${propPath}.${k}`,
|
602
618
|
config,
|
@@ -609,7 +625,7 @@ var walkField = ({
|
|
609
625
|
var walkObject = ({
|
610
626
|
value,
|
611
627
|
fields,
|
612
|
-
|
628
|
+
mappers,
|
613
629
|
id,
|
614
630
|
getPropPath,
|
615
631
|
config,
|
@@ -619,7 +635,7 @@ var walkObject = ({
|
|
619
635
|
const opts = {
|
620
636
|
value: v,
|
621
637
|
fields,
|
622
|
-
|
638
|
+
mappers,
|
623
639
|
propKey: k,
|
624
640
|
propPath: getPropPath(k),
|
625
641
|
id,
|
@@ -641,14 +657,14 @@ var walkObject = ({
|
|
641
657
|
}
|
642
658
|
return flatten(newProps);
|
643
659
|
};
|
644
|
-
function
|
660
|
+
function mapFields(item, mappers, config, recurseSlots = false) {
|
645
661
|
var _a, _b, _c, _d, _e;
|
646
662
|
const itemType = "type" in item ? item.type : "root";
|
647
663
|
const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
|
648
664
|
const newProps = walkObject({
|
649
665
|
value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
|
650
666
|
fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
|
651
|
-
|
667
|
+
mappers,
|
652
668
|
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
653
669
|
getPropPath: (k) => k,
|
654
670
|
config,
|
@@ -671,7 +687,7 @@ var import_flat = __toESM(require_flat());
|
|
671
687
|
// ../core/lib/data/strip-slots.ts
|
672
688
|
init_react_import();
|
673
689
|
var stripSlots = (data, config) => {
|
674
|
-
return
|
690
|
+
return mapFields(data, { slot: () => null }, config);
|
675
691
|
};
|
676
692
|
|
677
693
|
// ../core/lib/data/flatten-node.ts
|
@@ -724,18 +740,21 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
|
|
724
740
|
const mappedItem = mapNodeOrSkip(item, path, index);
|
725
741
|
if (!mappedItem) return item;
|
726
742
|
const id = mappedItem.props.id;
|
727
|
-
const newProps = __spreadProps(__spreadValues({},
|
743
|
+
const newProps = __spreadProps(__spreadValues({}, mapFields(
|
728
744
|
mappedItem,
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
745
|
+
{
|
746
|
+
slot: ({ value, parentId: parentId2, propPath }) => {
|
747
|
+
const content = value;
|
748
|
+
const zoneCompound = `${parentId2}:${propPath}`;
|
749
|
+
const [_2, newContent2] = processContent(
|
750
|
+
path,
|
751
|
+
zoneCompound,
|
752
|
+
content,
|
753
|
+
"slot",
|
754
|
+
parentId2
|
755
|
+
);
|
756
|
+
return newContent2;
|
757
|
+
}
|
739
758
|
},
|
740
759
|
config
|
741
760
|
).props), {
|
@@ -910,11 +929,14 @@ init_react_import();
|
|
910
929
|
function walkTree(data, config, callbackFn) {
|
911
930
|
var _a, _b;
|
912
931
|
const walkItem = (item) => {
|
913
|
-
return
|
932
|
+
return mapFields(
|
914
933
|
item,
|
915
|
-
|
916
|
-
|
917
|
-
|
934
|
+
{
|
935
|
+
slot: ({ value, parentId, propName }) => {
|
936
|
+
var _a2;
|
937
|
+
const content = value;
|
938
|
+
return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
|
939
|
+
}
|
918
940
|
},
|
919
941
|
config,
|
920
942
|
true
|
@@ -1834,24 +1856,27 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1834
1856
|
resolvedItem.readOnly = readOnly;
|
1835
1857
|
}
|
1836
1858
|
}
|
1837
|
-
let itemWithResolvedChildren = yield
|
1859
|
+
let itemWithResolvedChildren = yield mapFields(
|
1838
1860
|
resolvedItem,
|
1839
|
-
|
1840
|
-
|
1841
|
-
content
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1861
|
+
{
|
1862
|
+
slot: (_02) => __async(void 0, [_02], function* ({ value }) {
|
1863
|
+
const content = value;
|
1864
|
+
return yield Promise.all(
|
1865
|
+
content.map(
|
1866
|
+
(childItem) => __async(void 0, null, function* () {
|
1867
|
+
return (yield resolveComponentData(
|
1868
|
+
childItem,
|
1869
|
+
config,
|
1870
|
+
metadata,
|
1871
|
+
onResolveStart,
|
1872
|
+
onResolveEnd,
|
1873
|
+
trigger
|
1874
|
+
)).node;
|
1875
|
+
})
|
1876
|
+
)
|
1877
|
+
);
|
1878
|
+
})
|
1879
|
+
},
|
1855
1880
|
config
|
1856
1881
|
);
|
1857
1882
|
if (shouldRunResolver && onResolveEnd) {
|
@@ -1933,7 +1958,8 @@ var createAppStore = (initialAppStore) => create()(
|
|
1933
1958
|
},
|
1934
1959
|
status: "LOADING",
|
1935
1960
|
iframe: {},
|
1936
|
-
metadata: {}
|
1961
|
+
metadata: {},
|
1962
|
+
fieldTransforms: {}
|
1937
1963
|
}, initialAppStore), {
|
1938
1964
|
fields: createFieldsSlice(set, get),
|
1939
1965
|
history: createHistorySlice(set, get),
|
@@ -2154,6 +2180,12 @@ init_react_import();
|
|
2154
2180
|
// ../core/lib/data/replace.ts
|
2155
2181
|
init_react_import();
|
2156
2182
|
|
2183
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
2184
|
+
init_react_import();
|
2185
|
+
|
2186
|
+
// ../core/lib/get-zoom-config.ts
|
2187
|
+
init_react_import();
|
2188
|
+
|
2157
2189
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2158
2190
|
init_react_import();
|
2159
2191
|
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
package/dist/index.mjs
CHANGED
@@ -509,7 +509,7 @@ function forRelatedZones(item, data, cb, path = []) {
|
|
509
509
|
});
|
510
510
|
}
|
511
511
|
|
512
|
-
// ../core/lib/data/map-
|
512
|
+
// ../core/lib/data/map-fields.ts
|
513
513
|
init_react_import();
|
514
514
|
|
515
515
|
// ../core/lib/data/default-slots.ts
|
@@ -519,14 +519,14 @@ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
|
|
519
519
|
value
|
520
520
|
);
|
521
521
|
|
522
|
-
// ../core/lib/data/map-
|
522
|
+
// ../core/lib/data/map-fields.ts
|
523
523
|
var isPromise = (v) => !!v && typeof v.then === "function";
|
524
524
|
var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
|
525
525
|
var containsPromise = (arr) => arr.some(isPromise);
|
526
526
|
var walkField = ({
|
527
527
|
value,
|
528
528
|
fields,
|
529
|
-
|
529
|
+
mappers,
|
530
530
|
propKey = "",
|
531
531
|
propPath = "",
|
532
532
|
id = "",
|
@@ -534,7 +534,9 @@ var walkField = ({
|
|
534
534
|
recurseSlots = false
|
535
535
|
}) => {
|
536
536
|
var _a, _b, _c;
|
537
|
-
|
537
|
+
const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
|
538
|
+
const map = mappers[fieldType];
|
539
|
+
if (map && fieldType === "slot") {
|
538
540
|
const content = value || [];
|
539
541
|
const mappedContent = recurseSlots ? content.map((el) => {
|
540
542
|
var _a2;
|
@@ -546,7 +548,7 @@ var walkField = ({
|
|
546
548
|
return walkField({
|
547
549
|
value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
|
548
550
|
fields: fields2,
|
549
|
-
|
551
|
+
mappers,
|
550
552
|
id: el.props.id,
|
551
553
|
config,
|
552
554
|
recurseSlots
|
@@ -555,7 +557,21 @@ var walkField = ({
|
|
555
557
|
if (containsPromise(mappedContent)) {
|
556
558
|
return Promise.all(mappedContent);
|
557
559
|
}
|
558
|
-
return map(
|
560
|
+
return map({
|
561
|
+
value: mappedContent,
|
562
|
+
parentId: id,
|
563
|
+
propName: propKey,
|
564
|
+
field: fields[propKey],
|
565
|
+
propPath
|
566
|
+
});
|
567
|
+
} else if (map && fields[propKey]) {
|
568
|
+
return map({
|
569
|
+
value,
|
570
|
+
parentId: id,
|
571
|
+
propName: propKey,
|
572
|
+
field: fields[propKey],
|
573
|
+
propPath
|
574
|
+
});
|
559
575
|
}
|
560
576
|
if (value && typeof value === "object") {
|
561
577
|
if (Array.isArray(value)) {
|
@@ -565,7 +581,7 @@ var walkField = ({
|
|
565
581
|
(el, idx) => walkField({
|
566
582
|
value: el,
|
567
583
|
fields: arrayFields,
|
568
|
-
|
584
|
+
mappers,
|
569
585
|
propKey,
|
570
586
|
propPath: `${propPath}[${idx}]`,
|
571
587
|
id,
|
@@ -584,7 +600,7 @@ var walkField = ({
|
|
584
600
|
return walkObject({
|
585
601
|
value,
|
586
602
|
fields: objectFields,
|
587
|
-
|
603
|
+
mappers,
|
588
604
|
id,
|
589
605
|
getPropPath: (k) => `${propPath}.${k}`,
|
590
606
|
config,
|
@@ -597,7 +613,7 @@ var walkField = ({
|
|
597
613
|
var walkObject = ({
|
598
614
|
value,
|
599
615
|
fields,
|
600
|
-
|
616
|
+
mappers,
|
601
617
|
id,
|
602
618
|
getPropPath,
|
603
619
|
config,
|
@@ -607,7 +623,7 @@ var walkObject = ({
|
|
607
623
|
const opts = {
|
608
624
|
value: v,
|
609
625
|
fields,
|
610
|
-
|
626
|
+
mappers,
|
611
627
|
propKey: k,
|
612
628
|
propPath: getPropPath(k),
|
613
629
|
id,
|
@@ -629,14 +645,14 @@ var walkObject = ({
|
|
629
645
|
}
|
630
646
|
return flatten(newProps);
|
631
647
|
};
|
632
|
-
function
|
648
|
+
function mapFields(item, mappers, config, recurseSlots = false) {
|
633
649
|
var _a, _b, _c, _d, _e;
|
634
650
|
const itemType = "type" in item ? item.type : "root";
|
635
651
|
const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
|
636
652
|
const newProps = walkObject({
|
637
653
|
value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
|
638
654
|
fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
|
639
|
-
|
655
|
+
mappers,
|
640
656
|
id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
|
641
657
|
getPropPath: (k) => k,
|
642
658
|
config,
|
@@ -659,7 +675,7 @@ var import_flat = __toESM(require_flat());
|
|
659
675
|
// ../core/lib/data/strip-slots.ts
|
660
676
|
init_react_import();
|
661
677
|
var stripSlots = (data, config) => {
|
662
|
-
return
|
678
|
+
return mapFields(data, { slot: () => null }, config);
|
663
679
|
};
|
664
680
|
|
665
681
|
// ../core/lib/data/flatten-node.ts
|
@@ -712,18 +728,21 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
|
|
712
728
|
const mappedItem = mapNodeOrSkip(item, path, index);
|
713
729
|
if (!mappedItem) return item;
|
714
730
|
const id = mappedItem.props.id;
|
715
|
-
const newProps = __spreadProps(__spreadValues({},
|
731
|
+
const newProps = __spreadProps(__spreadValues({}, mapFields(
|
716
732
|
mappedItem,
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
733
|
+
{
|
734
|
+
slot: ({ value, parentId: parentId2, propPath }) => {
|
735
|
+
const content = value;
|
736
|
+
const zoneCompound = `${parentId2}:${propPath}`;
|
737
|
+
const [_2, newContent2] = processContent(
|
738
|
+
path,
|
739
|
+
zoneCompound,
|
740
|
+
content,
|
741
|
+
"slot",
|
742
|
+
parentId2
|
743
|
+
);
|
744
|
+
return newContent2;
|
745
|
+
}
|
727
746
|
},
|
728
747
|
config
|
729
748
|
).props), {
|
@@ -898,11 +917,14 @@ init_react_import();
|
|
898
917
|
function walkTree(data, config, callbackFn) {
|
899
918
|
var _a, _b;
|
900
919
|
const walkItem = (item) => {
|
901
|
-
return
|
920
|
+
return mapFields(
|
902
921
|
item,
|
903
|
-
|
904
|
-
|
905
|
-
|
922
|
+
{
|
923
|
+
slot: ({ value, parentId, propName }) => {
|
924
|
+
var _a2;
|
925
|
+
const content = value;
|
926
|
+
return (_a2 = callbackFn(content, { parentId, propName })) != null ? _a2 : content;
|
927
|
+
}
|
906
928
|
},
|
907
929
|
config,
|
908
930
|
true
|
@@ -1822,24 +1844,27 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1822
1844
|
resolvedItem.readOnly = readOnly;
|
1823
1845
|
}
|
1824
1846
|
}
|
1825
|
-
let itemWithResolvedChildren = yield
|
1847
|
+
let itemWithResolvedChildren = yield mapFields(
|
1826
1848
|
resolvedItem,
|
1827
|
-
|
1828
|
-
|
1829
|
-
content
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1849
|
+
{
|
1850
|
+
slot: (_02) => __async(void 0, [_02], function* ({ value }) {
|
1851
|
+
const content = value;
|
1852
|
+
return yield Promise.all(
|
1853
|
+
content.map(
|
1854
|
+
(childItem) => __async(void 0, null, function* () {
|
1855
|
+
return (yield resolveComponentData(
|
1856
|
+
childItem,
|
1857
|
+
config,
|
1858
|
+
metadata,
|
1859
|
+
onResolveStart,
|
1860
|
+
onResolveEnd,
|
1861
|
+
trigger
|
1862
|
+
)).node;
|
1863
|
+
})
|
1864
|
+
)
|
1865
|
+
);
|
1866
|
+
})
|
1867
|
+
},
|
1843
1868
|
config
|
1844
1869
|
);
|
1845
1870
|
if (shouldRunResolver && onResolveEnd) {
|
@@ -1921,7 +1946,8 @@ var createAppStore = (initialAppStore) => create()(
|
|
1921
1946
|
},
|
1922
1947
|
status: "LOADING",
|
1923
1948
|
iframe: {},
|
1924
|
-
metadata: {}
|
1949
|
+
metadata: {},
|
1950
|
+
fieldTransforms: {}
|
1925
1951
|
}, initialAppStore), {
|
1926
1952
|
fields: createFieldsSlice(set, get),
|
1927
1953
|
history: createHistorySlice(set, get),
|
@@ -2142,6 +2168,12 @@ init_react_import();
|
|
2142
2168
|
// ../core/lib/data/replace.ts
|
2143
2169
|
init_react_import();
|
2144
2170
|
|
2171
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
2172
|
+
init_react_import();
|
2173
|
+
|
2174
|
+
// ../core/lib/get-zoom-config.ts
|
2175
|
+
init_react_import();
|
2176
|
+
|
2145
2177
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2146
2178
|
init_react_import();
|
2147
2179
|
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck-plugin-heading-analyzer",
|
3
|
-
"version": "0.20.0-canary.
|
3
|
+
"version": "0.20.0-canary.2ce4c22c",
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"dist"
|
26
26
|
],
|
27
27
|
"devDependencies": {
|
28
|
-
"@measured/puck": "^0.20.0-canary.
|
28
|
+
"@measured/puck": "^0.20.0-canary.2ce4c22c",
|
29
29
|
"@types/react": "^19.0.1",
|
30
30
|
"@types/react-dom": "^19.0.2",
|
31
31
|
"eslint": "^7.32.0",
|