@measured/puck-plugin-heading-analyzer 0.21.0-canary.5c9698fb → 0.21.0-canary.6dae6cb7
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.css +149 -5
- package/dist/index.d.mts +10 -19
- package/dist/index.d.ts +10 -19
- package/dist/index.js +243 -90
- package/dist/index.mjs +240 -87
- package/package.json +2 -2
package/dist/index.css
CHANGED
@@ -1,18 +1,162 @@
|
|
1
1
|
/* css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css/#css-module-data */
|
2
|
-
.
|
2
|
+
._HeadingAnalyzer_116v6_1 {
|
3
3
|
display: block;
|
4
|
-
padding: 16px;
|
5
4
|
}
|
6
|
-
._HeadingAnalyzer-
|
5
|
+
._HeadingAnalyzer-cssWarning_116v6_5 {
|
7
6
|
display: none !important;
|
8
7
|
}
|
9
|
-
.
|
8
|
+
._HeadingAnalyzerItem_116v6_9 {
|
10
9
|
display: inline;
|
11
10
|
}
|
12
|
-
._HeadingAnalyzerItem--
|
11
|
+
._HeadingAnalyzerItem--missing_116v6_13 {
|
13
12
|
color: var(--puck-color-red-04);
|
14
13
|
}
|
15
14
|
|
15
|
+
/* css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css/#css-module-data */
|
16
|
+
._SidebarSection_8boj8_1 {
|
17
|
+
display: flex;
|
18
|
+
position: relative;
|
19
|
+
flex-direction: column;
|
20
|
+
color: var(--puck-color-black);
|
21
|
+
}
|
22
|
+
._SidebarSection_8boj8_1:last-of-type {
|
23
|
+
flex-grow: 1;
|
24
|
+
}
|
25
|
+
._SidebarSection-title_8boj8_12 {
|
26
|
+
background: var(--puck-color-white);
|
27
|
+
padding: 16px;
|
28
|
+
border-bottom: 1px solid var(--puck-color-grey-09);
|
29
|
+
border-top: 1px solid var(--puck-color-grey-09);
|
30
|
+
overflow-x: auto;
|
31
|
+
}
|
32
|
+
._SidebarSection--noBorderTop_8boj8_20 > ._SidebarSection-title_8boj8_12 {
|
33
|
+
border-top: 0px;
|
34
|
+
}
|
35
|
+
._SidebarSection-content_8boj8_24 {
|
36
|
+
padding: 16px;
|
37
|
+
}
|
38
|
+
._SidebarSection--noPadding_8boj8_28 > ._SidebarSection-content_8boj8_24 {
|
39
|
+
padding: 0px;
|
40
|
+
}
|
41
|
+
._SidebarSection--noPadding_8boj8_28 > ._SidebarSection-content_8boj8_24:last-child {
|
42
|
+
padding-bottom: 4px;
|
43
|
+
}
|
44
|
+
._SidebarSection_8boj8_1:last-of-type ._SidebarSection-content_8boj8_24 {
|
45
|
+
border-bottom: none;
|
46
|
+
flex-grow: 1;
|
47
|
+
}
|
48
|
+
._SidebarSection-breadcrumbLabel_8boj8_41 {
|
49
|
+
background: none;
|
50
|
+
border: 0;
|
51
|
+
border-radius: 2px;
|
52
|
+
color: var(--puck-color-azure-04);
|
53
|
+
cursor: pointer;
|
54
|
+
font: inherit;
|
55
|
+
flex-shrink: 0;
|
56
|
+
padding: 0;
|
57
|
+
transition: color 50ms ease-in;
|
58
|
+
}
|
59
|
+
._SidebarSection-breadcrumbLabel_8boj8_41:focus-visible {
|
60
|
+
outline: 2px solid var(--puck-color-azure-05);
|
61
|
+
outline-offset: 2px;
|
62
|
+
}
|
63
|
+
@media (hover: hover) and (pointer: fine) {
|
64
|
+
._SidebarSection-breadcrumbLabel_8boj8_41:hover {
|
65
|
+
color: var(--puck-color-azure-03);
|
66
|
+
transition: none;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
._SidebarSection-breadcrumbLabel_8boj8_41:active {
|
70
|
+
color: var(--puck-color-azure-02);
|
71
|
+
transition: none;
|
72
|
+
}
|
73
|
+
._SidebarSection-breadcrumbs_8boj8_70 {
|
74
|
+
align-items: center;
|
75
|
+
display: flex;
|
76
|
+
gap: 4px;
|
77
|
+
}
|
78
|
+
._SidebarSection-breadcrumb_8boj8_41 {
|
79
|
+
align-items: center;
|
80
|
+
display: flex;
|
81
|
+
gap: 4px;
|
82
|
+
}
|
83
|
+
._SidebarSection-heading_8boj8_82 {
|
84
|
+
padding-inline-end: 16px;
|
85
|
+
}
|
86
|
+
._SidebarSection-loadingOverlay_8boj8_86 {
|
87
|
+
background: var(--puck-color-white);
|
88
|
+
display: flex;
|
89
|
+
justify-content: center;
|
90
|
+
align-items: center;
|
91
|
+
height: 100%;
|
92
|
+
width: 100%;
|
93
|
+
top: 0;
|
94
|
+
position: absolute;
|
95
|
+
z-index: 1;
|
96
|
+
pointer-events: all;
|
97
|
+
box-sizing: border-box;
|
98
|
+
opacity: 0.8;
|
99
|
+
}
|
100
|
+
|
101
|
+
/* css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css/#css-module-data */
|
102
|
+
._Heading_qxrry_1 {
|
103
|
+
display: block;
|
104
|
+
color: var(--puck-color-black);
|
105
|
+
font-weight: 700;
|
106
|
+
margin: 0;
|
107
|
+
}
|
108
|
+
._Heading_qxrry_1 b {
|
109
|
+
font-weight: 700;
|
110
|
+
}
|
111
|
+
._Heading--xxxxl_qxrry_12 {
|
112
|
+
font-size: var(--puck-font-size-xxxxl);
|
113
|
+
letter-spacing: 0.08ch;
|
114
|
+
font-weight: 800;
|
115
|
+
}
|
116
|
+
._Heading--xxxl_qxrry_18 {
|
117
|
+
font-size: var(--puck-font-size-xxxl);
|
118
|
+
}
|
119
|
+
._Heading--xxl_qxrry_22 {
|
120
|
+
font-size: var(--puck-font-size-xxl);
|
121
|
+
}
|
122
|
+
._Heading--xl_qxrry_26 {
|
123
|
+
font-size: var(--puck-font-size-xl);
|
124
|
+
}
|
125
|
+
._Heading--l_qxrry_30 {
|
126
|
+
font-size: var(--puck-font-size-l);
|
127
|
+
}
|
128
|
+
._Heading--m_qxrry_34 {
|
129
|
+
font-size: var(--puck-font-size-m);
|
130
|
+
}
|
131
|
+
._Heading--s_qxrry_38 {
|
132
|
+
font-size: var(--puck-font-size-s);
|
133
|
+
}
|
134
|
+
._Heading--xs_qxrry_42 {
|
135
|
+
font-size: var(--puck-font-size-xs);
|
136
|
+
}
|
137
|
+
|
138
|
+
/* css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css/#css-module-data */
|
139
|
+
@keyframes _loader-animation_nacdm_1 {
|
140
|
+
0% {
|
141
|
+
transform: rotate(0deg) scale(1);
|
142
|
+
}
|
143
|
+
50% {
|
144
|
+
transform: rotate(180deg) scale(0.8);
|
145
|
+
}
|
146
|
+
100% {
|
147
|
+
transform: rotate(360deg) scale(1);
|
148
|
+
}
|
149
|
+
}
|
150
|
+
._Loader_nacdm_13 {
|
151
|
+
background: transparent;
|
152
|
+
border-radius: 100%;
|
153
|
+
border: 2px solid currentColor;
|
154
|
+
border-bottom-color: transparent;
|
155
|
+
display: inline-block;
|
156
|
+
animation: _loader-animation_nacdm_1 1s 0s infinite linear;
|
157
|
+
animation-fill-mode: both;
|
158
|
+
}
|
159
|
+
|
16
160
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css/#css-module-data */
|
17
161
|
._OutlineList_w4lzv_1 {
|
18
162
|
color: var(--puck-color-grey-03);
|
package/dist/index.d.mts
CHANGED
@@ -210,6 +210,7 @@ UserField extends BaseField = {}> = {
|
|
210
210
|
fields: Fields<FieldProps>;
|
211
211
|
lastFields: Fields<FieldProps>;
|
212
212
|
lastData: DataShape | null;
|
213
|
+
metadata: Metadata;
|
213
214
|
appState: AppState;
|
214
215
|
parent: ComponentData | null;
|
215
216
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
@@ -249,7 +250,7 @@ type ConfigInternal<Props extends DefaultComponents = DefaultComponents, RootPro
|
|
249
250
|
root?: RootConfigInternal<RootProps, UserField>;
|
250
251
|
};
|
251
252
|
type DefaultComponents = Record<string, any>;
|
252
|
-
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps =
|
253
|
+
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps = any, CategoryName extends string = string> = PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, never> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number]> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, infer ParamFields> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], ParamFields[keyof ParamFields] & BaseField> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, any> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], {}> : ConfigInternal<PropsOrParams, RootProps, CategoryName>;
|
253
254
|
type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends ConfigInternal<infer PropsOrParams, infer RootProps, infer CategoryName, infer UserField> ? {
|
254
255
|
props: PropsOrParams;
|
255
256
|
rootProps: RootProps & DefaultRootFieldProps;
|
@@ -301,7 +302,6 @@ type Metadata = {
|
|
301
302
|
type ItemWithId = {
|
302
303
|
_arrayId: string;
|
303
304
|
_originalIndex: number;
|
304
|
-
_currentIndex: number;
|
305
305
|
};
|
306
306
|
type ArrayState = {
|
307
307
|
items: ItemWithId[];
|
@@ -312,7 +312,6 @@ type UiState = {
|
|
312
312
|
rightSideBarVisible: boolean;
|
313
313
|
leftSideBarWidth?: number | null;
|
314
314
|
rightSideBarWidth?: number | null;
|
315
|
-
mobilePanelExpanded?: boolean;
|
316
315
|
itemSelector: ItemSelector | null;
|
317
316
|
arrayState: Record<string, ArrayState | undefined>;
|
318
317
|
previewMode: "interactive" | "edit";
|
@@ -325,7 +324,7 @@ type UiState = {
|
|
325
324
|
isDragging: boolean;
|
326
325
|
viewports: {
|
327
326
|
current: {
|
328
|
-
width: number
|
327
|
+
width: number;
|
329
328
|
height: number | "auto";
|
330
329
|
};
|
331
330
|
controlsVisible: boolean;
|
@@ -334,9 +333,6 @@ type UiState = {
|
|
334
333
|
field: {
|
335
334
|
focus?: string | null;
|
336
335
|
};
|
337
|
-
plugin: {
|
338
|
-
current: string | null;
|
339
|
-
};
|
340
336
|
};
|
341
337
|
type AppState<UserData extends Data = Data> = {
|
342
338
|
data: UserData;
|
@@ -370,7 +366,7 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
|
|
370
366
|
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
371
367
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
372
368
|
} : T;
|
373
|
-
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps =
|
369
|
+
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
374
370
|
components?: Components;
|
375
371
|
root?: RootProps;
|
376
372
|
categories?: CategoryNames;
|
@@ -386,11 +382,6 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
386
382
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
387
383
|
never
|
388
384
|
] ? False : True;
|
389
|
-
type RenderFunc<Props extends {
|
390
|
-
[key: string]: any;
|
391
|
-
} = {
|
392
|
-
children: ReactNode;
|
393
|
-
}> = (props: Props) => ReactElement;
|
394
385
|
|
395
386
|
type MapFnParams<ThisField = Field> = {
|
396
387
|
value: any;
|
@@ -414,6 +405,11 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
414
405
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
415
406
|
}>;
|
416
407
|
|
408
|
+
type RenderFunc<Props extends {
|
409
|
+
[key: string]: any;
|
410
|
+
} = {
|
411
|
+
children: ReactNode;
|
412
|
+
}> = (props: Props) => ReactElement;
|
417
413
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
418
414
|
type OverrideKey = (typeof overrideKeys)[number];
|
419
415
|
type OverridesGeneric<Shape extends {
|
@@ -484,7 +480,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
484
480
|
|
485
481
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
486
482
|
type Viewport = {
|
487
|
-
width: number
|
483
|
+
width: number;
|
488
484
|
height?: number | "auto";
|
489
485
|
label?: string;
|
490
486
|
icon?: iconTypes | ReactNode;
|
@@ -498,13 +494,8 @@ type Permissions = {
|
|
498
494
|
insert: boolean;
|
499
495
|
} & Record<string, boolean>;
|
500
496
|
type Plugin<UserConfig extends Config = Config> = {
|
501
|
-
name?: string;
|
502
|
-
label?: string;
|
503
|
-
icon?: ReactNode;
|
504
|
-
render?: () => ReactElement;
|
505
497
|
overrides?: Partial<Overrides<UserConfig>>;
|
506
498
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
507
|
-
mobilePanelHeight?: "toggle" | "min-content";
|
508
499
|
};
|
509
500
|
type Slot<Props extends {
|
510
501
|
[key: string]: DefaultComponentProps;
|
package/dist/index.d.ts
CHANGED
@@ -210,6 +210,7 @@ UserField extends BaseField = {}> = {
|
|
210
210
|
fields: Fields<FieldProps>;
|
211
211
|
lastFields: Fields<FieldProps>;
|
212
212
|
lastData: DataShape | null;
|
213
|
+
metadata: Metadata;
|
213
214
|
appState: AppState;
|
214
215
|
parent: ComponentData | null;
|
215
216
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
@@ -249,7 +250,7 @@ type ConfigInternal<Props extends DefaultComponents = DefaultComponents, RootPro
|
|
249
250
|
root?: RootConfigInternal<RootProps, UserField>;
|
250
251
|
};
|
251
252
|
type DefaultComponents = Record<string, any>;
|
252
|
-
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps =
|
253
|
+
type Config<PropsOrParams extends LeftOrExactRight<PropsOrParams, DefaultComponents, ConfigParams> = DefaultComponents | ConfigParams, RootProps extends DefaultComponentProps = any, CategoryName extends string = string> = PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, never> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number]> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, infer ParamFields> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], ParamFields[keyof ParamFields] & BaseField> : PropsOrParams extends ConfigParams<infer ParamComponents, infer ParamRoot, infer ParamCategoryName, any> ? ConfigInternal<ParamComponents, ParamRoot, ParamCategoryName[number], {}> : ConfigInternal<PropsOrParams, RootProps, CategoryName>;
|
253
254
|
type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends ConfigInternal<infer PropsOrParams, infer RootProps, infer CategoryName, infer UserField> ? {
|
254
255
|
props: PropsOrParams;
|
255
256
|
rootProps: RootProps & DefaultRootFieldProps;
|
@@ -301,7 +302,6 @@ type Metadata = {
|
|
301
302
|
type ItemWithId = {
|
302
303
|
_arrayId: string;
|
303
304
|
_originalIndex: number;
|
304
|
-
_currentIndex: number;
|
305
305
|
};
|
306
306
|
type ArrayState = {
|
307
307
|
items: ItemWithId[];
|
@@ -312,7 +312,6 @@ type UiState = {
|
|
312
312
|
rightSideBarVisible: boolean;
|
313
313
|
leftSideBarWidth?: number | null;
|
314
314
|
rightSideBarWidth?: number | null;
|
315
|
-
mobilePanelExpanded?: boolean;
|
316
315
|
itemSelector: ItemSelector | null;
|
317
316
|
arrayState: Record<string, ArrayState | undefined>;
|
318
317
|
previewMode: "interactive" | "edit";
|
@@ -325,7 +324,7 @@ type UiState = {
|
|
325
324
|
isDragging: boolean;
|
326
325
|
viewports: {
|
327
326
|
current: {
|
328
|
-
width: number
|
327
|
+
width: number;
|
329
328
|
height: number | "auto";
|
330
329
|
};
|
331
330
|
controlsVisible: boolean;
|
@@ -334,9 +333,6 @@ type UiState = {
|
|
334
333
|
field: {
|
335
334
|
focus?: string | null;
|
336
335
|
};
|
337
|
-
plugin: {
|
338
|
-
current: string | null;
|
339
|
-
};
|
340
336
|
};
|
341
337
|
type AppState<UserData extends Data = Data> = {
|
342
338
|
data: UserData;
|
@@ -370,7 +366,7 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
|
|
370
366
|
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
371
367
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
372
368
|
} : T;
|
373
|
-
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps =
|
369
|
+
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
374
370
|
components?: Components;
|
375
371
|
root?: RootProps;
|
376
372
|
categories?: CategoryNames;
|
@@ -386,11 +382,6 @@ type LeftOrExactRight<Union, Left, Right> = (Left & Union extends Right ? Exact<
|
|
386
382
|
type AssertHasValue<T, True = T, False = never> = [keyof T] extends [
|
387
383
|
never
|
388
384
|
] ? False : True;
|
389
|
-
type RenderFunc<Props extends {
|
390
|
-
[key: string]: any;
|
391
|
-
} = {
|
392
|
-
children: ReactNode;
|
393
|
-
}> = (props: Props) => ReactElement;
|
394
385
|
|
395
386
|
type MapFnParams<ThisField = Field> = {
|
396
387
|
value: any;
|
@@ -414,6 +405,11 @@ G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>, UserField extends
|
|
414
405
|
[Type in UserField["type"]]: FieldTransformFn<ExtractField<UserField, Type>>;
|
415
406
|
}>;
|
416
407
|
|
408
|
+
type RenderFunc<Props extends {
|
409
|
+
[key: string]: any;
|
410
|
+
} = {
|
411
|
+
children: ReactNode;
|
412
|
+
}> = (props: Props) => ReactElement;
|
417
413
|
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "drawer", "drawerItem", "componentOverlay", "outline", "puck", "preview"];
|
418
414
|
type OverrideKey = (typeof overrideKeys)[number];
|
419
415
|
type OverridesGeneric<Shape extends {
|
@@ -484,7 +480,7 @@ type DragAxis = "dynamic" | "y" | "x";
|
|
484
480
|
|
485
481
|
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
486
482
|
type Viewport = {
|
487
|
-
width: number
|
483
|
+
width: number;
|
488
484
|
height?: number | "auto";
|
489
485
|
label?: string;
|
490
486
|
icon?: iconTypes | ReactNode;
|
@@ -498,13 +494,8 @@ type Permissions = {
|
|
498
494
|
insert: boolean;
|
499
495
|
} & Record<string, boolean>;
|
500
496
|
type Plugin<UserConfig extends Config = Config> = {
|
501
|
-
name?: string;
|
502
|
-
label?: string;
|
503
|
-
icon?: ReactNode;
|
504
|
-
render?: () => ReactElement;
|
505
497
|
overrides?: Partial<Overrides<UserConfig>>;
|
506
498
|
fieldTransforms?: FieldTransforms<UserConfig>;
|
507
|
-
mobilePanelHeight?: "toggle" | "min-content";
|
508
499
|
};
|
509
500
|
type Slot<Props extends {
|
510
501
|
[key: string]: DefaultComponentProps;
|
package/dist/index.js
CHANGED
@@ -313,21 +313,21 @@ init_react_import();
|
|
313
313
|
|
314
314
|
// src/HeadingAnalyzer.tsx
|
315
315
|
init_react_import();
|
316
|
-
var
|
316
|
+
var import_react11 = require("react");
|
317
317
|
|
318
318
|
// css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
|
319
319
|
init_react_import();
|
320
|
-
var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "
|
320
|
+
var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
|
321
321
|
|
322
322
|
// src/HeadingAnalyzer.tsx
|
323
323
|
var import_puck = require("@measured/puck");
|
324
324
|
|
325
|
-
// ../core/components/
|
325
|
+
// ../core/components/SidebarSection/index.tsx
|
326
326
|
init_react_import();
|
327
327
|
|
328
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
328
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
329
329
|
init_react_import();
|
330
|
-
var styles_module_default = { "
|
330
|
+
var styles_module_default = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
|
331
331
|
|
332
332
|
// ../core/lib/get-class-name-factory.ts
|
333
333
|
init_react_import();
|
@@ -356,50 +356,29 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
356
356
|
};
|
357
357
|
var get_class_name_factory_default = getClassNameFactory;
|
358
358
|
|
359
|
-
// ../core/components/
|
359
|
+
// ../core/components/Heading/index.tsx
|
360
|
+
init_react_import();
|
361
|
+
|
362
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
363
|
+
init_react_import();
|
364
|
+
var styles_module_default2 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
|
365
|
+
|
366
|
+
// ../core/components/Heading/index.tsx
|
360
367
|
var import_jsx_runtime = require("react/jsx-runtime");
|
361
|
-
var getClassName = get_class_name_factory_default("
|
362
|
-
var
|
363
|
-
|
364
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: getClassName(), children });
|
365
|
-
};
|
366
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
367
|
-
OutlineList.Item = ({
|
368
|
-
children,
|
369
|
-
onClick
|
370
|
-
}) => {
|
368
|
+
var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
|
369
|
+
var Heading = ({ children, rank, size = "m" }) => {
|
370
|
+
const Tag = rank ? `h${rank}` : "span";
|
371
371
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
372
|
-
|
372
|
+
Tag,
|
373
373
|
{
|
374
|
-
className:
|
375
|
-
|
374
|
+
className: getClassName({
|
375
|
+
[size]: true
|
376
|
+
}),
|
376
377
|
children
|
377
378
|
}
|
378
379
|
);
|
379
380
|
};
|
380
381
|
|
381
|
-
// ../core/lib/scroll-into-view.ts
|
382
|
-
init_react_import();
|
383
|
-
var scrollIntoView = (el) => {
|
384
|
-
const oldStyle = __spreadValues({}, el.style);
|
385
|
-
el.style.scrollMargin = "256px";
|
386
|
-
if (el) {
|
387
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
388
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
389
|
-
}
|
390
|
-
};
|
391
|
-
|
392
|
-
// ../core/lib/get-frame.ts
|
393
|
-
init_react_import();
|
394
|
-
var getFrame = () => {
|
395
|
-
if (typeof window === "undefined") return;
|
396
|
-
let frameEl = document.querySelector("#preview-frame");
|
397
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
398
|
-
return frameEl.contentDocument || document;
|
399
|
-
}
|
400
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
401
|
-
};
|
402
|
-
|
403
382
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
404
383
|
init_react_import();
|
405
384
|
|
@@ -487,29 +466,15 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
487
466
|
return Component;
|
488
467
|
};
|
489
468
|
|
490
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
469
|
+
// ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
491
470
|
init_react_import();
|
492
|
-
var
|
493
|
-
["path", { d: "
|
494
|
-
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
495
|
-
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
496
|
-
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
471
|
+
var ChevronRight = createLucideIcon("ChevronRight", [
|
472
|
+
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
497
473
|
]);
|
498
474
|
|
499
|
-
// ../core/lib/
|
500
|
-
init_react_import();
|
501
|
-
|
502
|
-
// ../core/lib/filter.ts
|
503
|
-
init_react_import();
|
504
|
-
|
505
|
-
// ../core/lib/data/reorder.ts
|
506
|
-
init_react_import();
|
507
|
-
|
508
|
-
// ../core/lib/data/replace.ts
|
509
|
-
init_react_import();
|
510
|
-
|
511
|
-
// ../core/lib/use-reset-auto-zoom.ts
|
475
|
+
// ../core/lib/use-breadcrumbs.ts
|
512
476
|
init_react_import();
|
477
|
+
var import_react10 = require("react");
|
513
478
|
|
514
479
|
// ../core/store/index.ts
|
515
480
|
init_react_import();
|
@@ -607,7 +572,7 @@ var walkField = ({
|
|
607
572
|
return map({
|
608
573
|
value: mappedContent,
|
609
574
|
parentId: id,
|
610
|
-
propName:
|
575
|
+
propName: propPath,
|
611
576
|
field: fields[propKey],
|
612
577
|
propPath
|
613
578
|
});
|
@@ -1479,8 +1444,7 @@ init_react_import();
|
|
1479
1444
|
var defaultViewports = [
|
1480
1445
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1481
1446
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1482
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1483
|
-
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
1447
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1484
1448
|
];
|
1485
1449
|
|
1486
1450
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
@@ -1874,7 +1838,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1874
1838
|
const id = "id" in item.props ? item.props.id : "root";
|
1875
1839
|
if (shouldRunResolver) {
|
1876
1840
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1877
|
-
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1841
|
+
if (trigger !== "force" && item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1878
1842
|
return { node: resolved, didChange: false };
|
1879
1843
|
}
|
1880
1844
|
const changed = getChanged(item, oldItem);
|
@@ -1965,8 +1929,7 @@ var defaultAppState = {
|
|
1965
1929
|
options: [],
|
1966
1930
|
controlsVisible: true
|
1967
1931
|
},
|
1968
|
-
field: { focus: null }
|
1969
|
-
plugin: { current: null }
|
1932
|
+
field: { focus: null }
|
1970
1933
|
},
|
1971
1934
|
indexes: {
|
1972
1935
|
nodes: {},
|
@@ -1982,7 +1945,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
1982
1945
|
subscribeWithSelector((set, get) => {
|
1983
1946
|
var _a, _b;
|
1984
1947
|
return __spreadProps(__spreadValues({
|
1985
|
-
instanceId: generateId(),
|
1986
1948
|
state: defaultAppState,
|
1987
1949
|
config: { components: {} },
|
1988
1950
|
componentState: {},
|
@@ -2153,14 +2115,203 @@ var createAppStore = (initialAppStore) => create()(
|
|
2153
2115
|
})
|
2154
2116
|
);
|
2155
2117
|
var appStoreContext = (0, import_react9.createContext)(createAppStore());
|
2118
|
+
function useAppStore(selector) {
|
2119
|
+
const context = (0, import_react9.useContext)(appStoreContext);
|
2120
|
+
return useStore(context, selector);
|
2121
|
+
}
|
2122
|
+
function useAppStoreApi() {
|
2123
|
+
return (0, import_react9.useContext)(appStoreContext);
|
2124
|
+
}
|
2125
|
+
|
2126
|
+
// ../core/lib/use-breadcrumbs.ts
|
2127
|
+
var useBreadcrumbs = (renderCount) => {
|
2128
|
+
const selectedId = useAppStore((s) => {
|
2129
|
+
var _a;
|
2130
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
2131
|
+
});
|
2132
|
+
const config = useAppStore((s) => s.config);
|
2133
|
+
const path = useAppStore((s) => {
|
2134
|
+
var _a;
|
2135
|
+
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2136
|
+
});
|
2137
|
+
const appStore = useAppStoreApi();
|
2138
|
+
return (0, import_react10.useMemo)(() => {
|
2139
|
+
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2140
|
+
var _a, _b, _c;
|
2141
|
+
const [componentId] = zoneCompound.split(":");
|
2142
|
+
if (componentId === "root") {
|
2143
|
+
return {
|
2144
|
+
label: "Page",
|
2145
|
+
selector: null
|
2146
|
+
};
|
2147
|
+
}
|
2148
|
+
const node = appStore.getState().state.indexes.nodes[componentId];
|
2149
|
+
const parentId = node.path[node.path.length - 1];
|
2150
|
+
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
2151
|
+
const index = contentIds.indexOf(componentId);
|
2152
|
+
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
2153
|
+
return {
|
2154
|
+
label,
|
2155
|
+
selector: node ? {
|
2156
|
+
index,
|
2157
|
+
zone: node.path[node.path.length - 1]
|
2158
|
+
} : null
|
2159
|
+
};
|
2160
|
+
})) || [];
|
2161
|
+
if (renderCount) {
|
2162
|
+
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
2163
|
+
}
|
2164
|
+
return breadcrumbs;
|
2165
|
+
}, [path, renderCount]);
|
2166
|
+
};
|
2167
|
+
|
2168
|
+
// ../core/components/Loader/index.tsx
|
2169
|
+
init_react_import();
|
2170
|
+
|
2171
|
+
// ../core/lib/index.ts
|
2172
|
+
init_react_import();
|
2173
|
+
|
2174
|
+
// ../core/lib/filter.ts
|
2175
|
+
init_react_import();
|
2176
|
+
|
2177
|
+
// ../core/lib/data/reorder.ts
|
2178
|
+
init_react_import();
|
2179
|
+
|
2180
|
+
// ../core/lib/data/replace.ts
|
2181
|
+
init_react_import();
|
2182
|
+
|
2183
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
2184
|
+
init_react_import();
|
2156
2185
|
|
2157
2186
|
// ../core/lib/get-zoom-config.ts
|
2158
2187
|
init_react_import();
|
2159
2188
|
|
2189
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2190
|
+
init_react_import();
|
2191
|
+
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2192
|
+
|
2193
|
+
// ../core/components/Loader/index.tsx
|
2194
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
2195
|
+
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2196
|
+
var Loader = (_a) => {
|
2197
|
+
var _b = _a, {
|
2198
|
+
color,
|
2199
|
+
size = 16
|
2200
|
+
} = _b, props = __objRest(_b, [
|
2201
|
+
"color",
|
2202
|
+
"size"
|
2203
|
+
]);
|
2204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2205
|
+
"span",
|
2206
|
+
__spreadValues({
|
2207
|
+
className: getClassName2(),
|
2208
|
+
style: {
|
2209
|
+
width: size,
|
2210
|
+
height: size,
|
2211
|
+
color
|
2212
|
+
},
|
2213
|
+
"aria-label": "loading"
|
2214
|
+
}, props)
|
2215
|
+
);
|
2216
|
+
};
|
2217
|
+
|
2218
|
+
// ../core/components/SidebarSection/index.tsx
|
2219
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
2220
|
+
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2221
|
+
var SidebarSection = ({
|
2222
|
+
children,
|
2223
|
+
title,
|
2224
|
+
background,
|
2225
|
+
showBreadcrumbs,
|
2226
|
+
noBorderTop,
|
2227
|
+
noPadding,
|
2228
|
+
isLoading
|
2229
|
+
}) => {
|
2230
|
+
const setUi = useAppStore((s) => s.setUi);
|
2231
|
+
const breadcrumbs = useBreadcrumbs(1);
|
2232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
2233
|
+
"div",
|
2234
|
+
{
|
2235
|
+
className: getClassName3({ noBorderTop, noPadding }),
|
2236
|
+
style: { background },
|
2237
|
+
children: [
|
2238
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("title"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumbs"), children: [
|
2239
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: getClassName3("breadcrumb"), children: [
|
2240
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
2241
|
+
"button",
|
2242
|
+
{
|
2243
|
+
type: "button",
|
2244
|
+
className: getClassName3("breadcrumbLabel"),
|
2245
|
+
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
2246
|
+
children: breadcrumb.label
|
2247
|
+
}
|
2248
|
+
),
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, { size: 16 })
|
2250
|
+
] }, i)) : null,
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
|
2252
|
+
] }) }),
|
2253
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("content"), children }),
|
2254
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 32 }) })
|
2255
|
+
]
|
2256
|
+
}
|
2257
|
+
);
|
2258
|
+
};
|
2259
|
+
|
2260
|
+
// ../core/components/OutlineList/index.tsx
|
2261
|
+
init_react_import();
|
2262
|
+
|
2263
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
2264
|
+
init_react_import();
|
2265
|
+
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2266
|
+
|
2267
|
+
// ../core/components/OutlineList/index.tsx
|
2268
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
2269
|
+
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2270
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2271
|
+
var OutlineList = ({ children }) => {
|
2272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: getClassName4(), children });
|
2273
|
+
};
|
2274
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem({ clickable: true }), children });
|
2275
|
+
OutlineList.Item = ({
|
2276
|
+
children,
|
2277
|
+
onClick
|
2278
|
+
}) => {
|
2279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
2280
|
+
"li",
|
2281
|
+
{
|
2282
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
2283
|
+
onClick,
|
2284
|
+
children
|
2285
|
+
}
|
2286
|
+
);
|
2287
|
+
};
|
2288
|
+
|
2289
|
+
// ../core/lib/scroll-into-view.ts
|
2290
|
+
init_react_import();
|
2291
|
+
var scrollIntoView = (el) => {
|
2292
|
+
const oldStyle = __spreadValues({}, el.style);
|
2293
|
+
el.style.scrollMargin = "256px";
|
2294
|
+
if (el) {
|
2295
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
2296
|
+
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
2297
|
+
}
|
2298
|
+
};
|
2299
|
+
|
2300
|
+
// ../core/lib/get-frame.ts
|
2301
|
+
init_react_import();
|
2302
|
+
var getFrame = () => {
|
2303
|
+
if (typeof window === "undefined") return;
|
2304
|
+
let frameEl = document.querySelector("#preview-frame");
|
2305
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
2306
|
+
return frameEl.contentDocument || document;
|
2307
|
+
}
|
2308
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
2309
|
+
};
|
2310
|
+
|
2160
2311
|
// src/HeadingAnalyzer.tsx
|
2161
2312
|
var import_react_from_json = __toESM(require("react-from-json"));
|
2162
|
-
var
|
2163
|
-
var
|
2313
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
2314
|
+
var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2164
2315
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2165
2316
|
var ReactFromJSON = import_react_from_json.default.default || import_react_from_json.default;
|
2166
2317
|
var getOutline = ({ frame } = {}) => {
|
@@ -2215,8 +2366,8 @@ function buildHierarchy(frame) {
|
|
2215
2366
|
var usePuck = (0, import_puck.createUsePuck)();
|
2216
2367
|
var HeadingAnalyzer = () => {
|
2217
2368
|
const data = usePuck((s) => s.appState.data);
|
2218
|
-
const [hierarchy, setHierarchy] = (0,
|
2219
|
-
(0,
|
2369
|
+
const [hierarchy, setHierarchy] = (0, import_react11.useState)([]);
|
2370
|
+
(0, import_react11.useEffect)(() => {
|
2220
2371
|
const frame = getFrame();
|
2221
2372
|
let entry = frame == null ? void 0 : frame.querySelector(`[data-puck-entry]`);
|
2222
2373
|
const createHierarchy = () => {
|
@@ -2251,11 +2402,11 @@ var HeadingAnalyzer = () => {
|
|
2251
2402
|
frameObserver.disconnect();
|
2252
2403
|
};
|
2253
2404
|
}, [data]);
|
2254
|
-
return /* @__PURE__ */ (0,
|
2255
|
-
/* @__PURE__ */ (0,
|
2405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: getClassName5(), children: [
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
2256
2407
|
"small",
|
2257
2408
|
{
|
2258
|
-
className:
|
2409
|
+
className: getClassName5("cssWarning"),
|
2259
2410
|
style: {
|
2260
2411
|
color: "var(--puck-color-red-04)",
|
2261
2412
|
display: "block",
|
@@ -2264,19 +2415,19 @@ var HeadingAnalyzer = () => {
|
|
2264
2415
|
children: [
|
2265
2416
|
"Heading analyzer styles not loaded. Please review the",
|
2266
2417
|
" ",
|
2267
|
-
/* @__PURE__ */ (0,
|
2418
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2268
2419
|
"."
|
2269
2420
|
]
|
2270
2421
|
}
|
2271
2422
|
),
|
2272
|
-
hierarchy.length === 0 && /* @__PURE__ */ (0,
|
2273
|
-
/* @__PURE__ */ (0,
|
2423
|
+
hierarchy.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: "No headings." }),
|
2424
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
2274
2425
|
ReactFromJSON,
|
2275
2426
|
{
|
2276
2427
|
mapping: {
|
2277
|
-
Root: (props) => /* @__PURE__ */ (0,
|
2278
|
-
OutlineListItem: (props) => /* @__PURE__ */ (0,
|
2279
|
-
/* @__PURE__ */ (0,
|
2428
|
+
Root: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: props.children }),
|
2429
|
+
OutlineListItem: (props) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(OutlineList.Item, { children: [
|
2430
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList.Clickable, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
2280
2431
|
"small",
|
2281
2432
|
{
|
2282
2433
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2294,14 +2445,14 @@ var HeadingAnalyzer = () => {
|
|
2294
2445
|
}, 2e3);
|
2295
2446
|
}
|
2296
2447
|
},
|
2297
|
-
children: props.missing ? /* @__PURE__ */ (0,
|
2298
|
-
/* @__PURE__ */ (0,
|
2448
|
+
children: props.missing ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
2299
2450
|
"H",
|
2300
2451
|
props.rank
|
2301
2452
|
] }),
|
2302
2453
|
": Missing"
|
2303
|
-
] }) : /* @__PURE__ */ (0,
|
2304
|
-
/* @__PURE__ */ (0,
|
2454
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2455
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("b", { children: [
|
2305
2456
|
"H",
|
2306
2457
|
props.rank
|
2307
2458
|
] }),
|
@@ -2310,7 +2461,7 @@ var HeadingAnalyzer = () => {
|
|
2310
2461
|
] })
|
2311
2462
|
}
|
2312
2463
|
) }),
|
2313
|
-
/* @__PURE__ */ (0,
|
2464
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(OutlineList, { children: props.children })
|
2314
2465
|
] })
|
2315
2466
|
},
|
2316
2467
|
entry: {
|
@@ -2331,10 +2482,12 @@ var HeadingAnalyzer = () => {
|
|
2331
2482
|
] });
|
2332
2483
|
};
|
2333
2484
|
var headingAnalyzer = {
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2485
|
+
overrides: {
|
2486
|
+
fields: ({ children, itemSelector }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
2487
|
+
children,
|
2488
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeadingAnalyzer, {}) }) })
|
2489
|
+
] })
|
2490
|
+
}
|
2338
2491
|
};
|
2339
2492
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2340
2493
|
/*! Bundled license information:
|
@@ -2378,7 +2531,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2378
2531
|
* See the LICENSE file in the root directory of this source tree.
|
2379
2532
|
*)
|
2380
2533
|
|
2381
|
-
lucide-react/dist/esm/icons/
|
2534
|
+
lucide-react/dist/esm/icons/chevron-right.js:
|
2382
2535
|
(**
|
2383
2536
|
* @license lucide-react v0.468.0 - ISC
|
2384
2537
|
*
|
package/dist/index.mjs
CHANGED
@@ -305,17 +305,17 @@ import { useEffect as useEffect5, useState } from "react";
|
|
305
305
|
|
306
306
|
// css-module:/home/runner/work/puck/puck/packages/plugin-heading-analyzer/src/HeadingAnalyzer.module.css#css-module
|
307
307
|
init_react_import();
|
308
|
-
var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "
|
308
|
+
var HeadingAnalyzer_module_default = { "HeadingAnalyzer": "_HeadingAnalyzer_116v6_1", "HeadingAnalyzer-cssWarning": "_HeadingAnalyzer-cssWarning_116v6_5", "HeadingAnalyzerItem": "_HeadingAnalyzerItem_116v6_9", "HeadingAnalyzerItem--missing": "_HeadingAnalyzerItem--missing_116v6_13" };
|
309
309
|
|
310
310
|
// src/HeadingAnalyzer.tsx
|
311
311
|
import { createUsePuck } from "@measured/puck";
|
312
312
|
|
313
|
-
// ../core/components/
|
313
|
+
// ../core/components/SidebarSection/index.tsx
|
314
314
|
init_react_import();
|
315
315
|
|
316
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/
|
316
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
317
317
|
init_react_import();
|
318
|
-
var styles_module_default = { "
|
318
|
+
var styles_module_default = { "SidebarSection": "_SidebarSection_8boj8_1", "SidebarSection-title": "_SidebarSection-title_8boj8_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_8boj8_20", "SidebarSection-content": "_SidebarSection-content_8boj8_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_8boj8_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_8boj8_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_8boj8_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_8boj8_41", "SidebarSection-heading": "_SidebarSection-heading_8boj8_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_8boj8_86" };
|
319
319
|
|
320
320
|
// ../core/lib/get-class-name-factory.ts
|
321
321
|
init_react_import();
|
@@ -344,50 +344,29 @@ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (op
|
|
344
344
|
};
|
345
345
|
var get_class_name_factory_default = getClassNameFactory;
|
346
346
|
|
347
|
-
// ../core/components/
|
347
|
+
// ../core/components/Heading/index.tsx
|
348
|
+
init_react_import();
|
349
|
+
|
350
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
351
|
+
init_react_import();
|
352
|
+
var styles_module_default2 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
|
353
|
+
|
354
|
+
// ../core/components/Heading/index.tsx
|
348
355
|
import { jsx } from "react/jsx-runtime";
|
349
|
-
var getClassName = get_class_name_factory_default("
|
350
|
-
var
|
351
|
-
|
352
|
-
return /* @__PURE__ */ jsx("ul", { className: getClassName(), children });
|
353
|
-
};
|
354
|
-
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx("div", { className: getClassNameItem({ clickable: true }), children });
|
355
|
-
OutlineList.Item = ({
|
356
|
-
children,
|
357
|
-
onClick
|
358
|
-
}) => {
|
356
|
+
var getClassName = get_class_name_factory_default("Heading", styles_module_default2);
|
357
|
+
var Heading = ({ children, rank, size = "m" }) => {
|
358
|
+
const Tag = rank ? `h${rank}` : "span";
|
359
359
|
return /* @__PURE__ */ jsx(
|
360
|
-
|
360
|
+
Tag,
|
361
361
|
{
|
362
|
-
className:
|
363
|
-
|
362
|
+
className: getClassName({
|
363
|
+
[size]: true
|
364
|
+
}),
|
364
365
|
children
|
365
366
|
}
|
366
367
|
);
|
367
368
|
};
|
368
369
|
|
369
|
-
// ../core/lib/scroll-into-view.ts
|
370
|
-
init_react_import();
|
371
|
-
var scrollIntoView = (el) => {
|
372
|
-
const oldStyle = __spreadValues({}, el.style);
|
373
|
-
el.style.scrollMargin = "256px";
|
374
|
-
if (el) {
|
375
|
-
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
376
|
-
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
377
|
-
}
|
378
|
-
};
|
379
|
-
|
380
|
-
// ../core/lib/get-frame.ts
|
381
|
-
init_react_import();
|
382
|
-
var getFrame = () => {
|
383
|
-
if (typeof window === "undefined") return;
|
384
|
-
let frameEl = document.querySelector("#preview-frame");
|
385
|
-
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
386
|
-
return frameEl.contentDocument || document;
|
387
|
-
}
|
388
|
-
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
389
|
-
};
|
390
|
-
|
391
370
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
392
371
|
init_react_import();
|
393
372
|
|
@@ -475,29 +454,15 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
475
454
|
return Component;
|
476
455
|
};
|
477
456
|
|
478
|
-
// ../../node_modules/lucide-react/dist/esm/icons/
|
457
|
+
// ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
479
458
|
init_react_import();
|
480
|
-
var
|
481
|
-
["path", { d: "
|
482
|
-
["path", { d: "M4 18V6", key: "1rz3zl" }],
|
483
|
-
["path", { d: "M12 18V6", key: "zqpxq5" }],
|
484
|
-
["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
|
459
|
+
var ChevronRight = createLucideIcon("ChevronRight", [
|
460
|
+
["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
|
485
461
|
]);
|
486
462
|
|
487
|
-
// ../core/lib/
|
488
|
-
init_react_import();
|
489
|
-
|
490
|
-
// ../core/lib/filter.ts
|
491
|
-
init_react_import();
|
492
|
-
|
493
|
-
// ../core/lib/data/reorder.ts
|
494
|
-
init_react_import();
|
495
|
-
|
496
|
-
// ../core/lib/data/replace.ts
|
497
|
-
init_react_import();
|
498
|
-
|
499
|
-
// ../core/lib/use-reset-auto-zoom.ts
|
463
|
+
// ../core/lib/use-breadcrumbs.ts
|
500
464
|
init_react_import();
|
465
|
+
import { useMemo } from "react";
|
501
466
|
|
502
467
|
// ../core/store/index.ts
|
503
468
|
init_react_import();
|
@@ -595,7 +560,7 @@ var walkField = ({
|
|
595
560
|
return map({
|
596
561
|
value: mappedContent,
|
597
562
|
parentId: id,
|
598
|
-
propName:
|
563
|
+
propName: propPath,
|
599
564
|
field: fields[propKey],
|
600
565
|
propPath
|
601
566
|
});
|
@@ -1467,8 +1432,7 @@ init_react_import();
|
|
1467
1432
|
var defaultViewports = [
|
1468
1433
|
{ width: 360, height: "auto", icon: "Smartphone", label: "Small" },
|
1469
1434
|
{ width: 768, height: "auto", icon: "Tablet", label: "Medium" },
|
1470
|
-
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1471
|
-
{ width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
|
1435
|
+
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
1472
1436
|
];
|
1473
1437
|
|
1474
1438
|
// ../../node_modules/zustand/esm/vanilla.mjs
|
@@ -1862,7 +1826,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
1862
1826
|
const id = "id" in item.props ? item.props.id : "root";
|
1863
1827
|
if (shouldRunResolver) {
|
1864
1828
|
const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
|
1865
|
-
if (item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1829
|
+
if (trigger !== "force" && item && (0, import_fast_deep_equal2.default)(item, oldItem)) {
|
1866
1830
|
return { node: resolved, didChange: false };
|
1867
1831
|
}
|
1868
1832
|
const changed = getChanged(item, oldItem);
|
@@ -1953,8 +1917,7 @@ var defaultAppState = {
|
|
1953
1917
|
options: [],
|
1954
1918
|
controlsVisible: true
|
1955
1919
|
},
|
1956
|
-
field: { focus: null }
|
1957
|
-
plugin: { current: null }
|
1920
|
+
field: { focus: null }
|
1958
1921
|
},
|
1959
1922
|
indexes: {
|
1960
1923
|
nodes: {},
|
@@ -1970,7 +1933,6 @@ var createAppStore = (initialAppStore) => create()(
|
|
1970
1933
|
subscribeWithSelector((set, get) => {
|
1971
1934
|
var _a, _b;
|
1972
1935
|
return __spreadProps(__spreadValues({
|
1973
|
-
instanceId: generateId(),
|
1974
1936
|
state: defaultAppState,
|
1975
1937
|
config: { components: {} },
|
1976
1938
|
componentState: {},
|
@@ -2141,14 +2103,203 @@ var createAppStore = (initialAppStore) => create()(
|
|
2141
2103
|
})
|
2142
2104
|
);
|
2143
2105
|
var appStoreContext = createContext(createAppStore());
|
2106
|
+
function useAppStore(selector) {
|
2107
|
+
const context = useContext(appStoreContext);
|
2108
|
+
return useStore(context, selector);
|
2109
|
+
}
|
2110
|
+
function useAppStoreApi() {
|
2111
|
+
return useContext(appStoreContext);
|
2112
|
+
}
|
2113
|
+
|
2114
|
+
// ../core/lib/use-breadcrumbs.ts
|
2115
|
+
var useBreadcrumbs = (renderCount) => {
|
2116
|
+
const selectedId = useAppStore((s) => {
|
2117
|
+
var _a;
|
2118
|
+
return (_a = s.selectedItem) == null ? void 0 : _a.props.id;
|
2119
|
+
});
|
2120
|
+
const config = useAppStore((s) => s.config);
|
2121
|
+
const path = useAppStore((s) => {
|
2122
|
+
var _a;
|
2123
|
+
return (_a = s.state.indexes.nodes[selectedId]) == null ? void 0 : _a.path;
|
2124
|
+
});
|
2125
|
+
const appStore = useAppStoreApi();
|
2126
|
+
return useMemo(() => {
|
2127
|
+
const breadcrumbs = (path == null ? void 0 : path.map((zoneCompound) => {
|
2128
|
+
var _a, _b, _c;
|
2129
|
+
const [componentId] = zoneCompound.split(":");
|
2130
|
+
if (componentId === "root") {
|
2131
|
+
return {
|
2132
|
+
label: "Page",
|
2133
|
+
selector: null
|
2134
|
+
};
|
2135
|
+
}
|
2136
|
+
const node = appStore.getState().state.indexes.nodes[componentId];
|
2137
|
+
const parentId = node.path[node.path.length - 1];
|
2138
|
+
const contentIds = ((_a = appStore.getState().state.indexes.zones[parentId]) == null ? void 0 : _a.contentIds) || [];
|
2139
|
+
const index = contentIds.indexOf(componentId);
|
2140
|
+
const label = node ? (_c = (_b = config.components[node.data.type]) == null ? void 0 : _b.label) != null ? _c : node.data.type : "Component";
|
2141
|
+
return {
|
2142
|
+
label,
|
2143
|
+
selector: node ? {
|
2144
|
+
index,
|
2145
|
+
zone: node.path[node.path.length - 1]
|
2146
|
+
} : null
|
2147
|
+
};
|
2148
|
+
})) || [];
|
2149
|
+
if (renderCount) {
|
2150
|
+
return breadcrumbs.slice(breadcrumbs.length - renderCount);
|
2151
|
+
}
|
2152
|
+
return breadcrumbs;
|
2153
|
+
}, [path, renderCount]);
|
2154
|
+
};
|
2155
|
+
|
2156
|
+
// ../core/components/Loader/index.tsx
|
2157
|
+
init_react_import();
|
2158
|
+
|
2159
|
+
// ../core/lib/index.ts
|
2160
|
+
init_react_import();
|
2161
|
+
|
2162
|
+
// ../core/lib/filter.ts
|
2163
|
+
init_react_import();
|
2164
|
+
|
2165
|
+
// ../core/lib/data/reorder.ts
|
2166
|
+
init_react_import();
|
2167
|
+
|
2168
|
+
// ../core/lib/data/replace.ts
|
2169
|
+
init_react_import();
|
2170
|
+
|
2171
|
+
// ../core/lib/use-reset-auto-zoom.ts
|
2172
|
+
init_react_import();
|
2144
2173
|
|
2145
2174
|
// ../core/lib/get-zoom-config.ts
|
2146
2175
|
init_react_import();
|
2147
2176
|
|
2177
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
2178
|
+
init_react_import();
|
2179
|
+
var styles_module_default3 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
2180
|
+
|
2181
|
+
// ../core/components/Loader/index.tsx
|
2182
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
2183
|
+
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default3);
|
2184
|
+
var Loader = (_a) => {
|
2185
|
+
var _b = _a, {
|
2186
|
+
color,
|
2187
|
+
size = 16
|
2188
|
+
} = _b, props = __objRest(_b, [
|
2189
|
+
"color",
|
2190
|
+
"size"
|
2191
|
+
]);
|
2192
|
+
return /* @__PURE__ */ jsx2(
|
2193
|
+
"span",
|
2194
|
+
__spreadValues({
|
2195
|
+
className: getClassName2(),
|
2196
|
+
style: {
|
2197
|
+
width: size,
|
2198
|
+
height: size,
|
2199
|
+
color
|
2200
|
+
},
|
2201
|
+
"aria-label": "loading"
|
2202
|
+
}, props)
|
2203
|
+
);
|
2204
|
+
};
|
2205
|
+
|
2206
|
+
// ../core/components/SidebarSection/index.tsx
|
2207
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
2208
|
+
var getClassName3 = get_class_name_factory_default("SidebarSection", styles_module_default);
|
2209
|
+
var SidebarSection = ({
|
2210
|
+
children,
|
2211
|
+
title,
|
2212
|
+
background,
|
2213
|
+
showBreadcrumbs,
|
2214
|
+
noBorderTop,
|
2215
|
+
noPadding,
|
2216
|
+
isLoading
|
2217
|
+
}) => {
|
2218
|
+
const setUi = useAppStore((s) => s.setUi);
|
2219
|
+
const breadcrumbs = useBreadcrumbs(1);
|
2220
|
+
return /* @__PURE__ */ jsxs(
|
2221
|
+
"div",
|
2222
|
+
{
|
2223
|
+
className: getClassName3({ noBorderTop, noPadding }),
|
2224
|
+
style: { background },
|
2225
|
+
children: [
|
2226
|
+
/* @__PURE__ */ jsx3("div", { className: getClassName3("title"), children: /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumbs"), children: [
|
2227
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ jsxs("div", { className: getClassName3("breadcrumb"), children: [
|
2228
|
+
/* @__PURE__ */ jsx3(
|
2229
|
+
"button",
|
2230
|
+
{
|
2231
|
+
type: "button",
|
2232
|
+
className: getClassName3("breadcrumbLabel"),
|
2233
|
+
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
2234
|
+
children: breadcrumb.label
|
2235
|
+
}
|
2236
|
+
),
|
2237
|
+
/* @__PURE__ */ jsx3(ChevronRight, { size: 16 })
|
2238
|
+
] }, i)) : null,
|
2239
|
+
/* @__PURE__ */ jsx3("div", { className: getClassName3("heading"), children: /* @__PURE__ */ jsx3(Heading, { rank: "2", size: "xs", children: title }) })
|
2240
|
+
] }) }),
|
2241
|
+
/* @__PURE__ */ jsx3("div", { className: getClassName3("content"), children }),
|
2242
|
+
isLoading && /* @__PURE__ */ jsx3("div", { className: getClassName3("loadingOverlay"), children: /* @__PURE__ */ jsx3(Loader, { size: 32 }) })
|
2243
|
+
]
|
2244
|
+
}
|
2245
|
+
);
|
2246
|
+
};
|
2247
|
+
|
2248
|
+
// ../core/components/OutlineList/index.tsx
|
2249
|
+
init_react_import();
|
2250
|
+
|
2251
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/OutlineList/styles.module.css#css-module
|
2252
|
+
init_react_import();
|
2253
|
+
var styles_module_default4 = { "OutlineList": "_OutlineList_w4lzv_1", "OutlineListItem": "_OutlineListItem_w4lzv_25", "OutlineListItem--clickable": "_OutlineListItem--clickable_w4lzv_45" };
|
2254
|
+
|
2255
|
+
// ../core/components/OutlineList/index.tsx
|
2256
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
2257
|
+
var getClassName4 = get_class_name_factory_default("OutlineList", styles_module_default4);
|
2258
|
+
var getClassNameItem = get_class_name_factory_default("OutlineListItem", styles_module_default4);
|
2259
|
+
var OutlineList = ({ children }) => {
|
2260
|
+
return /* @__PURE__ */ jsx4("ul", { className: getClassName4(), children });
|
2261
|
+
};
|
2262
|
+
OutlineList.Clickable = ({ children }) => /* @__PURE__ */ jsx4("div", { className: getClassNameItem({ clickable: true }), children });
|
2263
|
+
OutlineList.Item = ({
|
2264
|
+
children,
|
2265
|
+
onClick
|
2266
|
+
}) => {
|
2267
|
+
return /* @__PURE__ */ jsx4(
|
2268
|
+
"li",
|
2269
|
+
{
|
2270
|
+
className: getClassNameItem({ clickable: !!onClick }),
|
2271
|
+
onClick,
|
2272
|
+
children
|
2273
|
+
}
|
2274
|
+
);
|
2275
|
+
};
|
2276
|
+
|
2277
|
+
// ../core/lib/scroll-into-view.ts
|
2278
|
+
init_react_import();
|
2279
|
+
var scrollIntoView = (el) => {
|
2280
|
+
const oldStyle = __spreadValues({}, el.style);
|
2281
|
+
el.style.scrollMargin = "256px";
|
2282
|
+
if (el) {
|
2283
|
+
el == null ? void 0 : el.scrollIntoView({ behavior: "smooth" });
|
2284
|
+
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
2285
|
+
}
|
2286
|
+
};
|
2287
|
+
|
2288
|
+
// ../core/lib/get-frame.ts
|
2289
|
+
init_react_import();
|
2290
|
+
var getFrame = () => {
|
2291
|
+
if (typeof window === "undefined") return;
|
2292
|
+
let frameEl = document.querySelector("#preview-frame");
|
2293
|
+
if ((frameEl == null ? void 0 : frameEl.tagName) === "IFRAME") {
|
2294
|
+
return frameEl.contentDocument || document;
|
2295
|
+
}
|
2296
|
+
return (frameEl == null ? void 0 : frameEl.ownerDocument) || document;
|
2297
|
+
};
|
2298
|
+
|
2148
2299
|
// src/HeadingAnalyzer.tsx
|
2149
2300
|
import ReactFromJSONModule from "react-from-json";
|
2150
|
-
import { Fragment, jsx as
|
2151
|
-
var
|
2301
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
2302
|
+
var getClassName5 = get_class_name_factory_default("HeadingAnalyzer", HeadingAnalyzer_module_default);
|
2152
2303
|
var getClassNameItem2 = get_class_name_factory_default("HeadingAnalyzerItem", HeadingAnalyzer_module_default);
|
2153
2304
|
var ReactFromJSON = ReactFromJSONModule.default || ReactFromJSONModule;
|
2154
2305
|
var getOutline = ({ frame } = {}) => {
|
@@ -2239,11 +2390,11 @@ var HeadingAnalyzer = () => {
|
|
2239
2390
|
frameObserver.disconnect();
|
2240
2391
|
};
|
2241
2392
|
}, [data]);
|
2242
|
-
return /* @__PURE__ */
|
2243
|
-
/* @__PURE__ */
|
2393
|
+
return /* @__PURE__ */ jsxs2("div", { className: getClassName5(), children: [
|
2394
|
+
/* @__PURE__ */ jsxs2(
|
2244
2395
|
"small",
|
2245
2396
|
{
|
2246
|
-
className:
|
2397
|
+
className: getClassName5("cssWarning"),
|
2247
2398
|
style: {
|
2248
2399
|
color: "var(--puck-color-red-04)",
|
2249
2400
|
display: "block",
|
@@ -2252,19 +2403,19 @@ var HeadingAnalyzer = () => {
|
|
2252
2403
|
children: [
|
2253
2404
|
"Heading analyzer styles not loaded. Please review the",
|
2254
2405
|
" ",
|
2255
|
-
/* @__PURE__ */
|
2406
|
+
/* @__PURE__ */ jsx5("a", { href: "https://github.com/measuredco/puck/blob/main/packages/plugin-heading-analyzer/README.md", children: "README" }),
|
2256
2407
|
"."
|
2257
2408
|
]
|
2258
2409
|
}
|
2259
2410
|
),
|
2260
|
-
hierarchy.length === 0 && /* @__PURE__ */
|
2261
|
-
/* @__PURE__ */
|
2411
|
+
hierarchy.length === 0 && /* @__PURE__ */ jsx5("div", { children: "No headings." }),
|
2412
|
+
/* @__PURE__ */ jsx5(OutlineList, { children: /* @__PURE__ */ jsx5(
|
2262
2413
|
ReactFromJSON,
|
2263
2414
|
{
|
2264
2415
|
mapping: {
|
2265
|
-
Root: (props) => /* @__PURE__ */
|
2266
|
-
OutlineListItem: (props) => /* @__PURE__ */
|
2267
|
-
/* @__PURE__ */
|
2416
|
+
Root: (props) => /* @__PURE__ */ jsx5(Fragment, { children: props.children }),
|
2417
|
+
OutlineListItem: (props) => /* @__PURE__ */ jsxs2(OutlineList.Item, { children: [
|
2418
|
+
/* @__PURE__ */ jsx5(OutlineList.Clickable, { children: /* @__PURE__ */ jsx5(
|
2268
2419
|
"small",
|
2269
2420
|
{
|
2270
2421
|
className: getClassNameItem2({ missing: props.missing }),
|
@@ -2282,14 +2433,14 @@ var HeadingAnalyzer = () => {
|
|
2282
2433
|
}, 2e3);
|
2283
2434
|
}
|
2284
2435
|
},
|
2285
|
-
children: props.missing ? /* @__PURE__ */
|
2286
|
-
/* @__PURE__ */
|
2436
|
+
children: props.missing ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
2437
|
+
/* @__PURE__ */ jsxs2("b", { children: [
|
2287
2438
|
"H",
|
2288
2439
|
props.rank
|
2289
2440
|
] }),
|
2290
2441
|
": Missing"
|
2291
|
-
] }) : /* @__PURE__ */
|
2292
|
-
/* @__PURE__ */
|
2442
|
+
] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
2443
|
+
/* @__PURE__ */ jsxs2("b", { children: [
|
2293
2444
|
"H",
|
2294
2445
|
props.rank
|
2295
2446
|
] }),
|
@@ -2298,7 +2449,7 @@ var HeadingAnalyzer = () => {
|
|
2298
2449
|
] })
|
2299
2450
|
}
|
2300
2451
|
) }),
|
2301
|
-
/* @__PURE__ */
|
2452
|
+
/* @__PURE__ */ jsx5(OutlineList, { children: props.children })
|
2302
2453
|
] })
|
2303
2454
|
},
|
2304
2455
|
entry: {
|
@@ -2319,10 +2470,12 @@ var HeadingAnalyzer = () => {
|
|
2319
2470
|
] });
|
2320
2471
|
};
|
2321
2472
|
var headingAnalyzer = {
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2473
|
+
overrides: {
|
2474
|
+
fields: ({ children, itemSelector }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
|
2475
|
+
children,
|
2476
|
+
/* @__PURE__ */ jsx5("div", { style: { display: itemSelector ? "none" : "block" }, children: /* @__PURE__ */ jsx5(SidebarSection, { title: "Heading Outline", children: /* @__PURE__ */ jsx5(HeadingAnalyzer, {}) }) })
|
2477
|
+
] })
|
2478
|
+
}
|
2326
2479
|
};
|
2327
2480
|
var HeadingAnalyzer_default = headingAnalyzer;
|
2328
2481
|
export {
|
@@ -2369,7 +2522,7 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
2369
2522
|
* See the LICENSE file in the root directory of this source tree.
|
2370
2523
|
*)
|
2371
2524
|
|
2372
|
-
lucide-react/dist/esm/icons/
|
2525
|
+
lucide-react/dist/esm/icons/chevron-right.js:
|
2373
2526
|
(**
|
2374
2527
|
* @license lucide-react v0.468.0 - ISC
|
2375
2528
|
*
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck-plugin-heading-analyzer",
|
3
|
-
"version": "0.21.0-canary.
|
3
|
+
"version": "0.21.0-canary.6dae6cb7",
|
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.21.0-canary.
|
28
|
+
"@measured/puck": "^0.21.0-canary.6dae6cb7",
|
29
29
|
"@types/react": "^19.0.1",
|
30
30
|
"@types/react-dom": "^19.0.2",
|
31
31
|
"eslint": "^7.32.0",
|