soinproduction-gutenberg 0.1.13 → 0.1.15
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/README.md +4 -0
- package/adapters/wordpress/blueprint.ts +2 -2
- package/adapters/wordpress/renderer.php +7 -3
- package/components/buttons/implementation/content.tsx +4 -2
- package/components/heading/editor.tsx +8 -10
- package/components/heading/index.tsx +1 -1
- package/components/link/index.tsx +21 -0
- package/components/link/manifest.json +4 -0
- package/core/editor/inline-link.tsx +28 -0
- package/core/editor/styles.css +11 -0
- package/core/fields/editor.tsx +28 -4
- package/core/fields/render.tsx +1 -1
- package/dist/adapters/wordpress/blueprint.d.ts +2 -0
- package/dist/adapters/wordpress/blueprint.js +3 -2
- package/dist/adapters/wordpress/blueprint.js.map +2 -2
- package/dist/adapters/wordpress/renderer.php +7 -3
- package/dist/components/buttons/implementation/content.d.ts +2 -1
- package/dist/components/buttons/implementation/content.js +3 -2
- package/dist/components/buttons/implementation/content.js.map +2 -2
- package/dist/components/heading/editor.d.ts +1 -1
- package/dist/components/heading/editor.js +9 -11
- package/dist/components/heading/editor.js.map +2 -2
- package/dist/components/heading/index.js +1 -1
- package/dist/components/heading/index.js.map +2 -2
- package/dist/components/link/index.d.ts +19 -0
- package/dist/components/link/index.js +32 -0
- package/dist/components/link/index.js.map +7 -0
- package/dist/components/link/manifest.json +4 -0
- package/dist/core/editor/inline-link.d.ts +2 -0
- package/dist/core/editor/inline-link.js +42 -0
- package/dist/core/editor/inline-link.js.map +7 -0
- package/dist/core/editor/styles.css +11 -0
- package/dist/core/fields/editor.js +42 -16
- package/dist/core/fields/editor.js.map +2 -2
- package/dist/core/fields/render.js +1 -1
- package/dist/core/fields/render.js.map +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +2 -2
- package/index.tsx +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -185,3 +185,7 @@ Every component with `buttonPosition` accepts exact edge coordinates as well as
|
|
|
185
185
|
```
|
|
186
186
|
|
|
187
187
|
Bare numbers are pixels; explicit CSS units such as `px`, `rem`, `em` and `%` are supported. Negative values move the control outside its edge. Numeric coordinates use exact CSS insets without the legacy percentage translation; `top left` and the other existing alignments retain their current behavior. An omitted axis defaults to bottom/right at zero, and `center` centers horizontally. Offsets affect editor controls only, without changing saved content or frontend markup. Flow `Drag` also supports the same syntax through `toolbarPosition` (or `buttonPosition` when no toolbar position is specified).
|
|
188
|
+
|
|
189
|
+
## Plain links
|
|
190
|
+
|
|
191
|
+
`<Link name="action" label="Link" icon="custom:library:arrow" className="..." />` uses the same stored `{text, url, linkId, modalId, icon}` value as `Button`, with plain link presentation in both views. Existing values and field names stay intact when replacing a Button. Caption text edits on the canvas; the link control or Ctrl/Cmd+K edits the destination, and Ctrl/Cmd+Shift+K removes it. Section classes own its appearance.
|
|
@@ -3,7 +3,7 @@ import {Children, Fragment, isValidElement, type ReactNode} from 'react';
|
|
|
3
3
|
const marker = (name: string) => Object.assign((_props: any) => null, {kitName: name});
|
|
4
4
|
export const Section = marker('Section'), Text = marker('Text'), Heading = marker('Heading'),
|
|
5
5
|
Paragraphs = marker('Paragraphs'), Image = marker('Image'), Icon = marker('Icon'),
|
|
6
|
-
Background = marker('Background'), Buttons = marker('Buttons'), SocialLinks = marker('SocialLinks'), Button = marker('Button'), List = marker('List'),
|
|
6
|
+
Background = marker('Background'), Buttons = marker('Buttons'), SocialLinks = marker('SocialLinks'), Button = marker('Button'), Link = marker('Link'), List = marker('List'),
|
|
7
7
|
PricingPlans = marker('PricingPlans'), ReviewsCarousel = marker('ReviewsCarousel'), Form = marker('Form'), Records = marker('Records'), Categories = marker('Categories'), RecordEdit = marker('RecordEdit'), RecordImage = marker('RecordImage'),
|
|
8
8
|
RecordDate = marker('RecordDate'), RecordTitle = marker('RecordTitle'), RecordExcerpt = marker('RecordExcerpt'), RecordLink = marker('RecordLink'),
|
|
9
9
|
RecordIndex = marker('RecordIndex'), Drag = marker('Drag'), Cols = marker('Cols'), Toggle = marker('Toggle'),
|
|
@@ -32,7 +32,7 @@ function describe(node: ReactNode): any[] {
|
|
|
32
32
|
export function section(meta: any, View: () => ReactNode) {
|
|
33
33
|
const template = describe(View());
|
|
34
34
|
const mark=(nodes:any[])=>{for(const node of nodes){if(node.type==='Section')node.props['data-site-section']='site/'+meta.slug;mark(node.children??[]);}};mark(template);
|
|
35
|
-
const staticTypes = new Set(['#text','Section','Text','Heading','Paragraphs','Image','Icon','Background','Buttons','SocialLinks','Button','Show','Toggle','Choice']);
|
|
35
|
+
const staticTypes = new Set(['#text','Section','Text','Heading','Paragraphs','Image','Icon','Background','Buttons','SocialLinks','Button','Link','Show','Toggle','Choice']);
|
|
36
36
|
const isStatic = (nodes:any[]):boolean => nodes.every(node => (staticTypes.has(node.type) || /^[a-z]/.test(node.type)) && isStatic(node.children ?? []));
|
|
37
37
|
return {name: 'site/' + meta.slug, title: meta.title, template, static: isStatic(template)};
|
|
38
38
|
}
|
|
@@ -58,19 +58,19 @@ function background_poster(string $url): string {
|
|
|
58
58
|
$id=attachment_url_to_postid($url);
|
|
59
59
|
return $id?(wp_get_attachment_image_url($id,'large')?:$url):$url;
|
|
60
60
|
}
|
|
61
|
-
function button(array $value,?string $fallback=null,array $site=[],string $extra_class=''): string {
|
|
61
|
+
function button(array $value,?string $fallback=null,array $site=[],string $extra_class='',bool $unstyled=false): string {
|
|
62
62
|
if(empty($value['text']))return '';
|
|
63
63
|
$url=$value['url']??'#';$id=(int)($value['modalId']??0);
|
|
64
64
|
if($id)foreach($site['modals']??[] as $modal)if($modal['id']===$id)$url='#modal-'.($modal['slug']??$id);
|
|
65
65
|
if(!empty($value['linkId']))$url=get_permalink((int)$value['linkId'])?:$url;
|
|
66
66
|
$style=$value['style']??$fallback;
|
|
67
|
-
$class
|
|
67
|
+
$class=$unstyled?'site-link':match($style){'text'=>'site-text-link eyebrow !text-foreground transition-colors hover:!text-flame','accent'=>'btn-primary !bg-flame !text-flame-foreground hover:!opacity-90','outline'=>'btn-ghost','light-outline'=>'btn-ghost !border-background/40 hover:!bg-background hover:!text-foreground',default=>'btn-primary'};
|
|
68
68
|
$label=wp_kses_post($value['text']);$metadata=$value['metadata']??[];
|
|
69
69
|
foreach($site['icons']??[] as $icon)if(($icon['value']??'')===($metadata['siteButtonIcon']??null)){
|
|
70
70
|
$mask='url("data:image/svg+xml,'.rawurlencode($icon['svg']).'")';
|
|
71
71
|
$label=tag('span',['class'=>'site-button-label site-button-icon-'.(($metadata['siteButtonIconPosition']??'')==='before'?'before':'after'),'style'=>'--site-button-icon:'.$mask],$label);break;
|
|
72
72
|
}
|
|
73
|
-
return tag('a',['href'=>esc_url($url),'class'=>trim($class.' '.$extra_class),'data-modal-plan'=>$value['plan']??null],$label);
|
|
73
|
+
return tag('a',['href'=>esc_url($url),'class'=>trim($class.' '.$extra_class),'data-modal-plan'=>$value['plan']??null,'target'=>$value['linkTarget']??null,'rel'=>$value['rel']??null],$label);
|
|
74
74
|
}
|
|
75
75
|
function social_links(array $links, string $class = '', string $style = 'text'): string {
|
|
76
76
|
$labels = ['instagram'=>'Instagram', 'facebook'=>'Facebook', 'telegram'=>'Telegram', 'youtube'=>'YouTube', 'tiktok'=>'TikTok', 'linkedin'=>'LinkedIn'];
|
|
@@ -225,6 +225,10 @@ function node(array $node,array $context): string {
|
|
|
225
225
|
case 'Toggle':return ($value??($p['default']??false))?classed_content($class,nodes($children,$context)):'';
|
|
226
226
|
case 'Show':
|
|
227
227
|
$visible=is_array($p['when'])?(bool)array_filter($p['when'],fn($key)=>trim(wp_strip_all_tags((string)($data[$key]??'')))!==''):(isset($p['is'])?($data[$p['when']]??null)===$p['is']:!empty($data[$p['when']]));return $visible?classed_content($class,nodes($children,$context)):'';
|
|
228
|
+
case 'Link':
|
|
229
|
+
$link=is_array($value)?$value:[];
|
|
230
|
+
$link['metadata']=array_replace($link['metadata']??[],['siteButtonIcon'=>$link['icon']??($p['icon']??''),'siteButtonIconPosition'=>$link['iconPosition']??'after']);
|
|
231
|
+
return button($link,null,$site,$class,true);
|
|
228
232
|
case 'Button':return button(is_array($value)?$value:[],$p['style']??null,$site,$class);
|
|
229
233
|
case 'SocialLinks':return social_links($site['settings']['socialLinks']??[],$class,$p['buttonStyle']??'text');
|
|
230
234
|
case 'Buttons':$html='';foreach(is_array($value)?$value:[] as $i=>$button)$html.=button($button,$p['styles'][$i]??null,$site);return tag('div',['class'=>'site-actions '.($class?:'flex flex-wrap gap-3')],$html);
|
|
@@ -15,10 +15,12 @@ export { buttonClasses } from '../../../core/ui/button-appearance.js';
|
|
|
15
15
|
export function ContentButton({
|
|
16
16
|
attributes,
|
|
17
17
|
fixedLayout = false,
|
|
18
|
+
unstyled = false,
|
|
18
19
|
className,
|
|
19
20
|
}: {
|
|
20
21
|
attributes: any;
|
|
21
22
|
fixedLayout?: boolean;
|
|
23
|
+
unstyled?: boolean;
|
|
22
24
|
className?: string;
|
|
23
25
|
}) {
|
|
24
26
|
const context = useContext(ContentContext);
|
|
@@ -26,7 +28,7 @@ export function ContentButton({
|
|
|
26
28
|
const cardPlan = useContext(BookingPlanContext);
|
|
27
29
|
const linkedUrl = recordUrl(context.site, attributes.metadata?.siteLinkId);
|
|
28
30
|
const a = linkedUrl ? {...attributes, url: linkedUrl} : attributes;
|
|
29
|
-
const classes = [buttonClasses(a.className), className].filter(Boolean).join(' ');
|
|
31
|
+
const classes = [unstyled ? 'site-link' : buttonClasses(a.className), className].filter(Boolean).join(' ');
|
|
30
32
|
const isBooking = String(a.url ?? '').startsWith('/booking');
|
|
31
33
|
const plan = isBooking
|
|
32
34
|
? new URL(a.url, 'http://local').searchParams.get('plan') ?? 'hour'
|
|
@@ -79,7 +81,7 @@ export function ContentButton({
|
|
|
79
81
|
<ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>
|
|
80
82
|
</button>
|
|
81
83
|
);
|
|
82
|
-
return isBooking ? (
|
|
84
|
+
return isBooking && !unstyled ? (
|
|
83
85
|
<BookingButton style={widthStyle} plan={(cardPlan ?? plan) as any} className={classes}>
|
|
84
86
|
<ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>
|
|
85
87
|
</BookingButton>
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import {onListItemFocus,selectedListItem} from '../../core/fields/item-focus.js';
|
|
2
|
+
import {type KeyboardEvent} from 'react';
|
|
4
3
|
import { headingTags, headingStyles, isHeadingTag, isHeadingStyle, type HeadingSettings } from './model.js';
|
|
5
4
|
declare const wp: any;
|
|
6
5
|
|
|
7
6
|
export function HeadingSettingsControl(props: any) {
|
|
8
|
-
|
|
7
|
+
// A grouped row owns all its controls; canvas headings must not add sibling panels.
|
|
8
|
+
return props.options?.itemPanel && !props.controls ? null : headingSettings(props);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const selected = useSyncExternalStore(onListItemFocus, selectedListItem, () => '');
|
|
12
|
-
return selected === props.options?.itemFocusKey ? headingSettings(props) : null;
|
|
13
|
-
}
|
|
14
|
-
function headingSettings({ field, value = {}, setValue, options = {} }: any) {
|
|
10
|
+
function headingSettings({ field, value = {}, setValue, options = {}, controls = false }: any) {
|
|
15
11
|
const { InspectorControls } = wp.blockEditor;
|
|
16
12
|
const { PanelBody, Button } = wp.components;
|
|
17
13
|
const defaults = options.defaults ?? {};
|
|
@@ -35,7 +31,7 @@ function headingSettings({ field, value = {}, setValue, options = {} }: any) {
|
|
|
35
31
|
select(key, next);
|
|
36
32
|
event.currentTarget.querySelector<HTMLButtonElement>(`[data-heading-value="${next}"]`)?.focus();
|
|
37
33
|
};
|
|
38
|
-
|
|
34
|
+
const fields = <>
|
|
39
35
|
{([{key:'tag',label:'HTML tag',fallback:defaults.tag ?? 'h2'},
|
|
40
36
|
{key:'textStyle',label:'Heading style',fallback:defaults.textStyle}] as const).map(({key,label,fallback}) => {
|
|
41
37
|
const choices: readonly string[] = key === 'tag' ? headingTags : headingStyles;
|
|
@@ -51,5 +47,7 @@ function headingSettings({ field, value = {}, setValue, options = {} }: any) {
|
|
|
51
47
|
</div>
|
|
52
48
|
</fieldset>;
|
|
53
49
|
})}
|
|
54
|
-
|
|
50
|
+
</>;
|
|
51
|
+
return controls ? <details className="site-item-heading-settings"><summary>Heading settings</summary>{fields}</details> :
|
|
52
|
+
<InspectorControls><PanelBody title={field.label ?? 'Heading'} initialOpen>{fields}</PanelBody></InspectorControls>;
|
|
55
53
|
}
|
|
@@ -27,6 +27,6 @@ export function HeadingView({ name, label, level = 2, tag, textStyle, className
|
|
|
27
27
|
/** `level` remains compatible; `tag` and `textStyle` set independent editor defaults. */
|
|
28
28
|
export const Heading = kit<HeadingProps>(
|
|
29
29
|
'heading',
|
|
30
|
-
({ label, level = 2, tag }) => ({ type: 'richText', tag: resolveHeading(undefined, { level, tag }).tag, label: label ?? 'Heading' }),
|
|
30
|
+
({ label, level = 2, tag, textStyle }) => ({ type: 'richText', tag: resolveHeading(undefined, { level, tag }).tag, label: label ?? 'Heading', controlOptions: { headingDefaults: resolveHeading(undefined, { level, tag, textStyle }) } }),
|
|
31
31
|
(props) => <HeadingView {...props} />
|
|
32
32
|
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Field, useField } from '../../core/fields/render.js';
|
|
3
|
+
import { ContentButton } from '../buttons/implementation/content.js';
|
|
4
|
+
import { kit, type Props } from '../../shared/index.js';
|
|
5
|
+
|
|
6
|
+
/** An editable text link: it keeps the existing link value, without button presentation. */
|
|
7
|
+
export const Link = kit<Props & { icon?: string }>(
|
|
8
|
+
'link',
|
|
9
|
+
({label, icon}) => ({type:'link', label:label ?? 'Link', controlOptions:{appearance:'link', icon}}),
|
|
10
|
+
({name, className, icon}) => {
|
|
11
|
+
const scope=useField(name);
|
|
12
|
+
if(scope.edit) return <Field name={name} className={className} />;
|
|
13
|
+
const value=scope.value ?? {};
|
|
14
|
+
if(!value.text) return null;
|
|
15
|
+
return <ContentButton unstyled fixedLayout className={className} attributes={{
|
|
16
|
+
text:value.text, url:value.url, linkTarget:value.linkTarget, rel:value.rel,
|
|
17
|
+
metadata:{siteLinkId:value.linkId,siteModalId:value.modalId,siteModalPlan:value.plan,
|
|
18
|
+
siteButtonIcon:value.icon ?? icon,siteButtonIconPosition:value.iconPosition},
|
|
19
|
+
}} />;
|
|
20
|
+
}
|
|
21
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { ButtonLabel } from '../icons/button.js';
|
|
3
|
+
import { EditorAction } from '../ui/editor-action.js';
|
|
4
|
+
import { LinkModal } from './manual-record.js';
|
|
5
|
+
declare const wp:any;
|
|
6
|
+
|
|
7
|
+
/** Inline caption editing and a URL control share the same plain surface as the frontend. */
|
|
8
|
+
export function InlineLinkEditor({value={},setValue,className='',label='Link'}:any){
|
|
9
|
+
const [open,setOpen]=useState(false);
|
|
10
|
+
const setUrl=(url:string)=>setValue({...value,url,linkId:0,modalId:0});
|
|
11
|
+
return <span className={['site-link','site-inline-link',className].filter(Boolean).join(' ')}
|
|
12
|
+
onClick={event=>event.stopPropagation()}
|
|
13
|
+
onKeyDownCapture={event=>{
|
|
14
|
+
if(!(event.metaKey||event.ctrlKey)||event.key.toLowerCase()!=='k')return;
|
|
15
|
+
event.preventDefault();event.stopPropagation();
|
|
16
|
+
if(event.shiftKey)setUrl('');else setOpen(true);
|
|
17
|
+
}}>
|
|
18
|
+
<ButtonLabel attributes={{metadata:{siteButtonIcon:value.icon,siteButtonIconPosition:value.iconPosition}}}>
|
|
19
|
+
<wp.blockEditor.RichText tagName="span" aria-label={label} value={value.text??''} placeholder={label+'…'}
|
|
20
|
+
allowedFormats={['core/bold','core/italic','core/strikethrough']}
|
|
21
|
+
onChange={(text:string)=>setValue({...value,text})} />
|
|
22
|
+
</ButtonLabel>
|
|
23
|
+
<span className="site-button-tools" contentEditable={false}>
|
|
24
|
+
<EditorAction action="link" label="Edit link" onClick={()=>setOpen(true)} />
|
|
25
|
+
</span>
|
|
26
|
+
{open&&<LinkModal url={value.url??''} onChange={setUrl} onClose={()=>setOpen(false)} />}
|
|
27
|
+
</span>;
|
|
28
|
+
}
|
package/core/editor/styles.css
CHANGED
|
@@ -1214,3 +1214,14 @@
|
|
|
1214
1214
|
/* Empty backgrounds keep a small, readable action beside the media controls. */
|
|
1215
1215
|
.site-background-tools>.site-media-select-action.components-button.is-empty.is-compact{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;gap:6px;width:auto;max-width:100%;height:32px;min-height:32px;padding:0 10px;border:1px solid var(--sp-ui-border-strong,#c3c4c7);border-radius:2px;background:var(--sp-ui-surface,#fff);color:var(--sp-ui-ink,#1e1e1e);white-space:nowrap;}
|
|
1216
1216
|
.site-background-tools>.site-media-select-action.components-button.is-empty.is-compact:hover{border-color:var(--sp-ui-accent,#3858e9);background:var(--sp-ui-accent-soft,#f0f0f0);color:var(--sp-ui-accent,#3858e9);}
|
|
1217
|
+
|
|
1218
|
+
/* Plain links retain their section styling on the canvas; only the URL tool floats. */
|
|
1219
|
+
.site-inline-link{position:relative;}
|
|
1220
|
+
.site-inline-link:hover>.site-button-tools,.site-inline-link:focus-within>.site-button-tools{opacity:1;}
|
|
1221
|
+
.site-inline-link .block-editor-rich-text__editable{display:inline;font:inherit;line-height:inherit;color:inherit;}
|
|
1222
|
+
|
|
1223
|
+
/* Content controls stay inside their collection row, in markup order. */
|
|
1224
|
+
.site-item-settings .site-item-field + .site-item-field { margin-top: 24px; }
|
|
1225
|
+
.site-item-field-label { display: block; margin-bottom: 12px; }
|
|
1226
|
+
.site-item-heading-settings { margin-top: 12px; }
|
|
1227
|
+
.site-item-heading-settings > summary { cursor: pointer; margin-bottom: 12px; }
|
package/core/fields/editor.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { updateHeadingSettings } from '../../components/heading/model.js';
|
|
2
|
+
import { InlineLinkEditor } from '../editor/inline-link.js';
|
|
1
3
|
import { ButtonIconSettings } from '../editor/button-icon-settings.js';
|
|
2
4
|
import { CollectionDisplaySettings } from '../editor/collection-display.js';
|
|
3
5
|
import { GripVertical, Plus } from 'lucide-react';
|
|
@@ -41,8 +43,9 @@ function ItemSettings({ field, value, setValue, site, options }: Props) {
|
|
|
41
43
|
useEffect(() => {
|
|
42
44
|
let frame = 0;
|
|
43
45
|
const reveal = (selected: string) => {
|
|
44
|
-
if (!key
|
|
45
|
-
setOpen(
|
|
46
|
+
if (!key) return;
|
|
47
|
+
setOpen(selected === key);
|
|
48
|
+
if (selected !== key) return;
|
|
46
49
|
cancelAnimationFrame(frame);
|
|
47
50
|
frame = requestAnimationFrame(() => {
|
|
48
51
|
frame = requestAnimationFrame(() => panel.current?.scrollIntoView({ behavior: 'smooth', block: 'start' }));
|
|
@@ -123,7 +126,7 @@ function MediaPicker({ value, setValue, label = 'Image' }: any) {
|
|
|
123
126
|
</div>
|
|
124
127
|
);
|
|
125
128
|
}
|
|
126
|
-
function LinkControls({ value = {}, setValue, site = {} }: any) {
|
|
129
|
+
function LinkControls({ value = {}, setValue, site = {}, textLabel = 'Button text' }: any) {
|
|
127
130
|
const { TextControl, ComboboxControl } = wp.components;
|
|
128
131
|
const modalId = Number(value.modalId) || 0;
|
|
129
132
|
const pages = editorEnvironment().linkRecords?.(site) ?? [];
|
|
@@ -138,7 +141,7 @@ function LinkControls({ value = {}, setValue, site = {} }: any) {
|
|
|
138
141
|
return (
|
|
139
142
|
<>
|
|
140
143
|
<TextControl
|
|
141
|
-
label=
|
|
144
|
+
label={textLabel}
|
|
142
145
|
value={value.text ?? ''}
|
|
143
146
|
onChange={(text: string) => setValue({ ...value, text })}
|
|
144
147
|
/>
|
|
@@ -184,6 +187,8 @@ function FieldControls({ schema, value, onChange, site }: any) {
|
|
|
184
187
|
return (
|
|
185
188
|
<div className="site-field-controls">
|
|
186
189
|
{schema.map((field: FieldDefinition) => (
|
|
190
|
+
<div key={field.name} className="site-item-field" data-field-name={field.name}>
|
|
191
|
+
{['custom', 'media', 'link'].includes(field.type) && <strong className="site-item-field-label">{labelOf(field)}</strong>}
|
|
187
192
|
<FieldEditor
|
|
188
193
|
key={field.name}
|
|
189
194
|
controls
|
|
@@ -193,6 +198,16 @@ function FieldControls({ schema, value, onChange, site }: any) {
|
|
|
193
198
|
setValue={(next) => onChange({ ...value, [field.name]: next })}
|
|
194
199
|
site={site}
|
|
195
200
|
/>
|
|
201
|
+
{Boolean(field.controlOptions?.headingDefaults) && <FieldEditor
|
|
202
|
+
controls
|
|
203
|
+
name={field.name}
|
|
204
|
+
field={{name: field.name, type: 'custom', control: 'heading-settings', label: labelOf(field)}}
|
|
205
|
+
value={value.__headings?.[field.name] ?? {}}
|
|
206
|
+
setValue={next => onChange(updateHeadingSettings(value, field.name, next))}
|
|
207
|
+
site={site}
|
|
208
|
+
options={{defaults: field.controlOptions?.headingDefaults}}
|
|
209
|
+
/>}
|
|
210
|
+
</div>
|
|
196
211
|
))}
|
|
197
212
|
</div>
|
|
198
213
|
);
|
|
@@ -611,6 +626,15 @@ function FieldEditor(props: Props) {
|
|
|
611
626
|
</>
|
|
612
627
|
);
|
|
613
628
|
}
|
|
629
|
+
if (field.type === 'link' && field.controlOptions?.appearance === 'link') {
|
|
630
|
+
const link=value?.icon===undefined && typeof field.controlOptions.icon==='string'
|
|
631
|
+
? {...(value??{}),icon:field.controlOptions.icon} : value??{};
|
|
632
|
+
const settings=<LinkControls value={link} setValue={setValue} site={site} textLabel="Link text" />;
|
|
633
|
+
return controls ? settings : <>
|
|
634
|
+
{!props.options?.itemPanel && inspector(settings)}
|
|
635
|
+
<InlineLinkEditor value={link} setValue={setValue} className={props.className} label={label} />
|
|
636
|
+
</>;
|
|
637
|
+
}
|
|
614
638
|
if (field.type === 'link')
|
|
615
639
|
return controls ? (
|
|
616
640
|
<LinkControls value={value} setValue={setValue} site={site} />
|
package/core/fields/render.tsx
CHANGED
|
@@ -336,7 +336,7 @@ export function Repeater({ name, children, className, renderRow, addText, button
|
|
|
336
336
|
const scope = useField(name);
|
|
337
337
|
const rows = Array.isArray(scope.value) ? scope.value : [];
|
|
338
338
|
const grouped = Boolean(scope.field.controlOptions?.itemPanels);
|
|
339
|
-
const settings = scope.field.fields?.filter(field =>
|
|
339
|
+
const settings = scope.field.fields?.filter(field => grouped || field.settings) ?? [];
|
|
340
340
|
const id=useId().replace(/[^a-zA-Z0-9_-]/g,'');
|
|
341
341
|
const root=useFieldScope();
|
|
342
342
|
const render=(offset:number,limit?:number) => (
|
|
@@ -19,6 +19,8 @@ export declare const Section: ((_props: any) => null) & {
|
|
|
19
19
|
kitName: string;
|
|
20
20
|
}, Button: ((_props: any) => null) & {
|
|
21
21
|
kitName: string;
|
|
22
|
+
}, Link: ((_props: any) => null) & {
|
|
23
|
+
kitName: string;
|
|
22
24
|
}, List: ((_props: any) => null) & {
|
|
23
25
|
kitName: string;
|
|
24
26
|
}, PricingPlans: ((_props: any) => null) & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Children, Fragment, isValidElement } from "react";
|
|
2
2
|
const marker = (name) => Object.assign((_props) => null, { kitName: name });
|
|
3
|
-
const Section = marker("Section"), Text = marker("Text"), Heading = marker("Heading"), Paragraphs = marker("Paragraphs"), Image = marker("Image"), Icon = marker("Icon"), Background = marker("Background"), Buttons = marker("Buttons"), SocialLinks = marker("SocialLinks"), Button = marker("Button"), List = marker("List"), PricingPlans = marker("PricingPlans"), ReviewsCarousel = marker("ReviewsCarousel"), Form = marker("Form"), Records = marker("Records"), Categories = marker("Categories"), RecordEdit = marker("RecordEdit"), RecordImage = marker("RecordImage"), RecordDate = marker("RecordDate"), RecordTitle = marker("RecordTitle"), RecordExcerpt = marker("RecordExcerpt"), RecordLink = marker("RecordLink"), RecordIndex = marker("RecordIndex"), Drag = marker("Drag"), Cols = marker("Cols"), Toggle = marker("Toggle"), Choice = marker("Choice"), Show = marker("Show"), Area = marker("Area"), Gallery = marker("Gallery"), Accordion = marker("Accordion"), AccordionItem = marker("AccordionItem"), AccordionTrigger = marker("AccordionTrigger"), AccordionContent = marker("AccordionContent"), AccordionProgress = marker("AccordionProgress"), Slider = marker("Slider"), SliderButton = marker("SliderButton"), SliderPagination = marker("SliderPagination"), RecordText = marker("RecordText"), RecordContent = marker("RecordContent"), Media = marker("Media");
|
|
3
|
+
const Section = marker("Section"), Text = marker("Text"), Heading = marker("Heading"), Paragraphs = marker("Paragraphs"), Image = marker("Image"), Icon = marker("Icon"), Background = marker("Background"), Buttons = marker("Buttons"), SocialLinks = marker("SocialLinks"), Button = marker("Button"), Link = marker("Link"), List = marker("List"), PricingPlans = marker("PricingPlans"), ReviewsCarousel = marker("ReviewsCarousel"), Form = marker("Form"), Records = marker("Records"), Categories = marker("Categories"), RecordEdit = marker("RecordEdit"), RecordImage = marker("RecordImage"), RecordDate = marker("RecordDate"), RecordTitle = marker("RecordTitle"), RecordExcerpt = marker("RecordExcerpt"), RecordLink = marker("RecordLink"), RecordIndex = marker("RecordIndex"), Drag = marker("Drag"), Cols = marker("Cols"), Toggle = marker("Toggle"), Choice = marker("Choice"), Show = marker("Show"), Area = marker("Area"), Gallery = marker("Gallery"), Accordion = marker("Accordion"), AccordionItem = marker("AccordionItem"), AccordionTrigger = marker("AccordionTrigger"), AccordionContent = marker("AccordionContent"), AccordionProgress = marker("AccordionProgress"), Slider = marker("Slider"), SliderButton = marker("SliderButton"), SliderPagination = marker("SliderPagination"), RecordText = marker("RecordText"), RecordContent = marker("RecordContent"), Media = marker("Media");
|
|
4
4
|
function describe(node) {
|
|
5
5
|
return Children.toArray(node).flatMap((child) => {
|
|
6
6
|
if (!isValidElement(child)) return [{ type: "#text", value: String(child) }];
|
|
@@ -25,7 +25,7 @@ function section(meta, View) {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
mark(template);
|
|
28
|
-
const staticTypes = /* @__PURE__ */ new Set(["#text", "Section", "Text", "Heading", "Paragraphs", "Image", "Icon", "Background", "Buttons", "SocialLinks", "Button", "Show", "Toggle", "Choice"]);
|
|
28
|
+
const staticTypes = /* @__PURE__ */ new Set(["#text", "Section", "Text", "Heading", "Paragraphs", "Image", "Icon", "Background", "Buttons", "SocialLinks", "Button", "Link", "Show", "Toggle", "Choice"]);
|
|
29
29
|
const isStatic = (nodes) => nodes.every((node) => (staticTypes.has(node.type) || /^[a-z]/.test(node.type)) && isStatic(node.children ?? []));
|
|
30
30
|
return { name: "site/" + meta.slug, title: meta.title, template, static: isStatic(template) };
|
|
31
31
|
}
|
|
@@ -48,6 +48,7 @@ export {
|
|
|
48
48
|
Heading,
|
|
49
49
|
Icon,
|
|
50
50
|
Image,
|
|
51
|
+
Link,
|
|
51
52
|
List,
|
|
52
53
|
Media,
|
|
53
54
|
Paragraphs,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../adapters/wordpress/blueprint.ts"],
|
|
4
|
-
"sourcesContent": ["import {Children, Fragment, isValidElement, type ReactNode} from 'react';\n\nconst marker = (name: string) => Object.assign((_props: any) => null, {kitName: name});\nexport const Section = marker('Section'), Text = marker('Text'), Heading = marker('Heading'),\n Paragraphs = marker('Paragraphs'), Image = marker('Image'), Icon = marker('Icon'),\n Background = marker('Background'), Buttons = marker('Buttons'), SocialLinks = marker('SocialLinks'), Button = marker('Button'), List = marker('List'),\n PricingPlans = marker('PricingPlans'), ReviewsCarousel = marker('ReviewsCarousel'), Form = marker('Form'), Records = marker('Records'), Categories = marker('Categories'), RecordEdit = marker('RecordEdit'), RecordImage = marker('RecordImage'),\n RecordDate = marker('RecordDate'), RecordTitle = marker('RecordTitle'), RecordExcerpt = marker('RecordExcerpt'), RecordLink = marker('RecordLink'),\n RecordIndex = marker('RecordIndex'), Drag = marker('Drag'), Cols = marker('Cols'), Toggle = marker('Toggle'),\n Choice = marker('Choice'), Show = marker('Show'), Area = marker('Area'), Gallery = marker('Gallery'),\n Accordion = marker('Accordion'), AccordionItem = marker('AccordionItem'), AccordionTrigger = marker('AccordionTrigger'), AccordionContent = marker('AccordionContent'), AccordionProgress = marker('AccordionProgress'),\n Slider = marker('Slider'), SliderButton = marker('SliderButton'), SliderPagination = marker('SliderPagination'), RecordText = marker('RecordText'), RecordContent = marker('RecordContent'), Media = marker('Media');\n\nfunction describe(node: ReactNode): any[] {\n return Children.toArray(node).flatMap(child => {\n if (!isValidElement(child)) return [{type: '#text', value: String(child)}];\n if (child.type === Fragment) return describe((child.props as any).children);\n const onlyTag = (child.type as any).kitOnlyTag === true;\n const sourceProps = onlyTag ? (child.props as any).elementProps : child.props;\n const props = {...sourceProps as any};\n delete props.children;\n const type = onlyTag ? (child.props as any).tag : typeof child.type === 'string' ? child.type : (child.type as any).kitName;\n // Stateful project components mount through the existing browser island.\n // Preserve declarative children as the PHP fallback, without serializing callback props.\n if (!type) return [{type: 'ClientComponent', props: {}, children: describe((child.props as any).children)}];\n if (type === 'Categories' && props.tab !== undefined) props.tab = describe(props.tab);\n for (const [key, value] of Object.entries(props)) if (typeof value === 'function') throw new Error(`WordPress compiler: callback ${key} cannot be serialized`);\n return [{type, props, children: describe((sourceProps as any).children)}];\n });\n}\n\nexport function section(meta: any, View: () => ReactNode) {\n const template = describe(View());\n const mark=(nodes:any[])=>{for(const node of nodes){if(node.type==='Section')node.props['data-site-section']='site/'+meta.slug;mark(node.children??[]);}};mark(template);\n const staticTypes = new Set(['#text','Section','Text','Heading','Paragraphs','Image','Icon','Background','Buttons','SocialLinks','Button','Show','Toggle','Choice']);\n const isStatic = (nodes:any[]):boolean => nodes.every(node => (staticTypes.has(node.type) || /^[a-z]/.test(node.type)) && isStatic(node.children ?? []));\n return {name: 'site/' + meta.slug, title: meta.title, template, static: isStatic(template)};\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAQ,UAAU,UAAU,sBAAqC;AAEjE,MAAM,SAAS,CAAC,SAAiB,OAAO,OAAO,CAAC,WAAgB,MAAM,EAAC,SAAS,KAAI,CAAC;AAC9E,MAAM,UAAU,OAAO,SAAS,GAAG,OAAO,OAAO,MAAM,GAAG,UAAU,OAAO,SAAS,GACvF,aAAa,OAAO,YAAY,GAAG,QAAQ,OAAO,OAAO,GAAG,OAAO,OAAO,MAAM,GAChF,aAAa,OAAO,YAAY,GAAG,UAAU,OAAO,SAAS,GAAG,cAAc,OAAO,aAAa,GAAG,SAAS,OAAO,QAAQ,GAAG,OAAO,OAAO,MAAM,
|
|
4
|
+
"sourcesContent": ["import {Children, Fragment, isValidElement, type ReactNode} from 'react';\n\nconst marker = (name: string) => Object.assign((_props: any) => null, {kitName: name});\nexport const Section = marker('Section'), Text = marker('Text'), Heading = marker('Heading'),\n Paragraphs = marker('Paragraphs'), Image = marker('Image'), Icon = marker('Icon'),\n Background = marker('Background'), Buttons = marker('Buttons'), SocialLinks = marker('SocialLinks'), Button = marker('Button'), Link = marker('Link'), List = marker('List'),\n PricingPlans = marker('PricingPlans'), ReviewsCarousel = marker('ReviewsCarousel'), Form = marker('Form'), Records = marker('Records'), Categories = marker('Categories'), RecordEdit = marker('RecordEdit'), RecordImage = marker('RecordImage'),\n RecordDate = marker('RecordDate'), RecordTitle = marker('RecordTitle'), RecordExcerpt = marker('RecordExcerpt'), RecordLink = marker('RecordLink'),\n RecordIndex = marker('RecordIndex'), Drag = marker('Drag'), Cols = marker('Cols'), Toggle = marker('Toggle'),\n Choice = marker('Choice'), Show = marker('Show'), Area = marker('Area'), Gallery = marker('Gallery'),\n Accordion = marker('Accordion'), AccordionItem = marker('AccordionItem'), AccordionTrigger = marker('AccordionTrigger'), AccordionContent = marker('AccordionContent'), AccordionProgress = marker('AccordionProgress'),\n Slider = marker('Slider'), SliderButton = marker('SliderButton'), SliderPagination = marker('SliderPagination'), RecordText = marker('RecordText'), RecordContent = marker('RecordContent'), Media = marker('Media');\n\nfunction describe(node: ReactNode): any[] {\n return Children.toArray(node).flatMap(child => {\n if (!isValidElement(child)) return [{type: '#text', value: String(child)}];\n if (child.type === Fragment) return describe((child.props as any).children);\n const onlyTag = (child.type as any).kitOnlyTag === true;\n const sourceProps = onlyTag ? (child.props as any).elementProps : child.props;\n const props = {...sourceProps as any};\n delete props.children;\n const type = onlyTag ? (child.props as any).tag : typeof child.type === 'string' ? child.type : (child.type as any).kitName;\n // Stateful project components mount through the existing browser island.\n // Preserve declarative children as the PHP fallback, without serializing callback props.\n if (!type) return [{type: 'ClientComponent', props: {}, children: describe((child.props as any).children)}];\n if (type === 'Categories' && props.tab !== undefined) props.tab = describe(props.tab);\n for (const [key, value] of Object.entries(props)) if (typeof value === 'function') throw new Error(`WordPress compiler: callback ${key} cannot be serialized`);\n return [{type, props, children: describe((sourceProps as any).children)}];\n });\n}\n\nexport function section(meta: any, View: () => ReactNode) {\n const template = describe(View());\n const mark=(nodes:any[])=>{for(const node of nodes){if(node.type==='Section')node.props['data-site-section']='site/'+meta.slug;mark(node.children??[]);}};mark(template);\n const staticTypes = new Set(['#text','Section','Text','Heading','Paragraphs','Image','Icon','Background','Buttons','SocialLinks','Button','Link','Show','Toggle','Choice']);\n const isStatic = (nodes:any[]):boolean => nodes.every(node => (staticTypes.has(node.type) || /^[a-z]/.test(node.type)) && isStatic(node.children ?? []));\n return {name: 'site/' + meta.slug, title: meta.title, template, static: isStatic(template)};\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAQ,UAAU,UAAU,sBAAqC;AAEjE,MAAM,SAAS,CAAC,SAAiB,OAAO,OAAO,CAAC,WAAgB,MAAM,EAAC,SAAS,KAAI,CAAC;AAC9E,MAAM,UAAU,OAAO,SAAS,GAAG,OAAO,OAAO,MAAM,GAAG,UAAU,OAAO,SAAS,GACvF,aAAa,OAAO,YAAY,GAAG,QAAQ,OAAO,OAAO,GAAG,OAAO,OAAO,MAAM,GAChF,aAAa,OAAO,YAAY,GAAG,UAAU,OAAO,SAAS,GAAG,cAAc,OAAO,aAAa,GAAG,SAAS,OAAO,QAAQ,GAAG,OAAO,OAAO,MAAM,GAAG,OAAO,OAAO,MAAM,GAC3K,eAAe,OAAO,cAAc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
61
|
-
function button(array $value,?string $fallback=null,array $site=[],string $extra_class=''): string {
|
|
61
|
+
function button(array $value,?string $fallback=null,array $site=[],string $extra_class='',bool $unstyled=false): string {
|
|
62
62
|
if(empty($value['text']))return '';
|
|
63
63
|
$url=$value['url']??'#';$id=(int)($value['modalId']??0);
|
|
64
64
|
if($id)foreach($site['modals']??[] as $modal)if($modal['id']===$id)$url='#modal-'.($modal['slug']??$id);
|
|
65
65
|
if(!empty($value['linkId']))$url=get_permalink((int)$value['linkId'])?:$url;
|
|
66
66
|
$style=$value['style']??$fallback;
|
|
67
|
-
$class
|
|
67
|
+
$class=$unstyled?'site-link':match($style){'text'=>'site-text-link eyebrow !text-foreground transition-colors hover:!text-flame','accent'=>'btn-primary !bg-flame !text-flame-foreground hover:!opacity-90','outline'=>'btn-ghost','light-outline'=>'btn-ghost !border-background/40 hover:!bg-background hover:!text-foreground',default=>'btn-primary'};
|
|
68
68
|
$label=wp_kses_post($value['text']);$metadata=$value['metadata']??[];
|
|
69
69
|
foreach($site['icons']??[] as $icon)if(($icon['value']??'')===($metadata['siteButtonIcon']??null)){
|
|
70
70
|
$mask='url("data:image/svg+xml,'.rawurlencode($icon['svg']).'")';
|
|
71
71
|
$label=tag('span',['class'=>'site-button-label site-button-icon-'.(($metadata['siteButtonIconPosition']??'')==='before'?'before':'after'),'style'=>'--site-button-icon:'.$mask],$label);break;
|
|
72
72
|
}
|
|
73
|
-
return tag('a',['href'=>esc_url($url),'class'=>trim($class.' '.$extra_class),'data-modal-plan'=>$value['plan']??null],$label);
|
|
73
|
+
return tag('a',['href'=>esc_url($url),'class'=>trim($class.' '.$extra_class),'data-modal-plan'=>$value['plan']??null,'target'=>$value['linkTarget']??null,'rel'=>$value['rel']??null],$label);
|
|
74
74
|
}
|
|
75
75
|
function social_links(array $links, string $class = '', string $style = 'text'): string {
|
|
76
76
|
$labels = ['instagram'=>'Instagram', 'facebook'=>'Facebook', 'telegram'=>'Telegram', 'youtube'=>'YouTube', 'tiktok'=>'TikTok', 'linkedin'=>'LinkedIn'];
|
|
@@ -225,6 +225,10 @@ function node(array $node,array $context): string {
|
|
|
225
225
|
case 'Toggle':return ($value??($p['default']??false))?classed_content($class,nodes($children,$context)):'';
|
|
226
226
|
case 'Show':
|
|
227
227
|
$visible=is_array($p['when'])?(bool)array_filter($p['when'],fn($key)=>trim(wp_strip_all_tags((string)($data[$key]??'')))!==''):(isset($p['is'])?($data[$p['when']]??null)===$p['is']:!empty($data[$p['when']]));return $visible?classed_content($class,nodes($children,$context)):'';
|
|
228
|
+
case 'Link':
|
|
229
|
+
$link=is_array($value)?$value:[];
|
|
230
|
+
$link['metadata']=array_replace($link['metadata']??[],['siteButtonIcon'=>$link['icon']??($p['icon']??''),'siteButtonIconPosition'=>$link['iconPosition']??'after']);
|
|
231
|
+
return button($link,null,$site,$class,true);
|
|
228
232
|
case 'Button':return button(is_array($value)?$value:[],$p['style']??null,$site,$class);
|
|
229
233
|
case 'SocialLinks':return social_links($site['settings']['socialLinks']??[],$class,$p['buttonStyle']??'text');
|
|
230
234
|
case 'Buttons':$html='';foreach(is_array($value)?$value:[] as $i=>$button)$html.=button($button,$p['styles'][$i]??null,$site);return tag('div',['class'=>'site-actions '.($class?:'flex flex-wrap gap-3')],$html);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { buttonClasses } from '../../../core/ui/button-appearance.js';
|
|
2
2
|
/** Shared link/modal behavior. Layout belongs to the section using this button. */
|
|
3
|
-
export declare function ContentButton({ attributes, fixedLayout, className, }: {
|
|
3
|
+
export declare function ContentButton({ attributes, fixedLayout, unstyled, className, }: {
|
|
4
4
|
attributes: any;
|
|
5
5
|
fixedLayout?: boolean;
|
|
6
|
+
unstyled?: boolean;
|
|
6
7
|
className?: string;
|
|
7
8
|
}): import("react").JSX.Element;
|
|
@@ -13,6 +13,7 @@ import { buttonClasses as buttonClasses2 } from "../../../core/ui/button-appeara
|
|
|
13
13
|
function ContentButton({
|
|
14
14
|
attributes,
|
|
15
15
|
fixedLayout = false,
|
|
16
|
+
unstyled = false,
|
|
16
17
|
className
|
|
17
18
|
}) {
|
|
18
19
|
const context = useContext(ContentContext);
|
|
@@ -20,7 +21,7 @@ function ContentButton({
|
|
|
20
21
|
const cardPlan = useContext(BookingPlanContext);
|
|
21
22
|
const linkedUrl = recordUrl(context.site, attributes.metadata?.siteLinkId);
|
|
22
23
|
const a = linkedUrl ? { ...attributes, url: linkedUrl } : attributes;
|
|
23
|
-
const classes = [buttonClasses(a.className), className].filter(Boolean).join(" ");
|
|
24
|
+
const classes = [unstyled ? "site-link" : buttonClasses(a.className), className].filter(Boolean).join(" ");
|
|
24
25
|
const isBooking = String(a.url ?? "").startsWith("/booking");
|
|
25
26
|
const plan = isBooking ? new URL(a.url, "http://local").searchParams.get("plan") ?? "hour" : "hour";
|
|
26
27
|
const widthStyle = !fixedLayout && a.width ? {
|
|
@@ -52,7 +53,7 @@ function ContentButton({
|
|
|
52
53
|
}
|
|
53
54
|
if (String(a.url ?? "").includes("#modal-"))
|
|
54
55
|
return /* @__PURE__ */ jsx("button", { disabled: true, style: widthStyle, className: classes, children: /* @__PURE__ */ jsx(ButtonLabel, { attributes: a, children: richNodes(a.text) }) });
|
|
55
|
-
return isBooking ? /* @__PURE__ */ jsx(BookingButton, { style: widthStyle, plan: cardPlan ?? plan, className: classes, children: /* @__PURE__ */ jsx(ButtonLabel, { attributes: a, children: richNodes(a.text) }) }) : /* @__PURE__ */ jsx("a", { style: widthStyle, className: classes, href: a.url ?? "#", target: a.linkTarget, rel: a.rel, children: /* @__PURE__ */ jsx(ButtonLabel, { attributes: a, children: richNodes(a.text) }) });
|
|
56
|
+
return isBooking && !unstyled ? /* @__PURE__ */ jsx(BookingButton, { style: widthStyle, plan: cardPlan ?? plan, className: classes, children: /* @__PURE__ */ jsx(ButtonLabel, { attributes: a, children: richNodes(a.text) }) }) : /* @__PURE__ */ jsx("a", { style: widthStyle, className: classes, href: a.url ?? "#", target: a.linkTarget, rel: a.rel, children: /* @__PURE__ */ jsx(ButtonLabel, { attributes: a, children: richNodes(a.text) }) });
|
|
56
57
|
}
|
|
57
58
|
export {
|
|
58
59
|
ContentButton,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../components/buttons/implementation/content.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\nimport { recordUrl } from '../../../core/content/links.js';\nimport { ContentContext } from '../../../core/content/context.js';\nimport { richNodes } from '../../../core/content/rich-text.js';\nimport { ButtonLabel } from '../../../core/icons/button.js';\nimport { BookingButton, BookingPlanContext } from './booking.js';\nimport { ModalContext } from '../../../modules/modals/context.js';\nimport { modalFromUrl, modalUrl } from '../../../modules/modals/links.js';\nimport { useContext } from 'react';\n\nimport { buttonClasses } from '../../../core/ui/button-appearance.js';\nexport { buttonClasses } from '../../../core/ui/button-appearance.js';\n\n/** Shared link/modal behavior. Layout belongs to the section using this button. */\nexport function ContentButton({\n attributes,\n fixedLayout = false,\n className,\n}: {\n attributes: any;\n fixedLayout?: boolean;\n className?: string;\n}) {\n const context = useContext(ContentContext);\n const openModal = useContext(ModalContext);\n const cardPlan = useContext(BookingPlanContext);\n const linkedUrl = recordUrl(context.site, attributes.metadata?.siteLinkId);\n const a = linkedUrl ? {...attributes, url: linkedUrl} : attributes;\n const classes = [buttonClasses(a.className), className].filter(Boolean).join(' ');\n const isBooking = String(a.url ?? '').startsWith('/booking');\n const plan = isBooking\n ? new URL(a.url, 'http://local').searchParams.get('plan') ?? 'hour'\n : 'hour';\n const widthStyle =\n !fixedLayout && a.width\n ? {\n width: a.width + '%',\n flexBasis: a.width + '%',\n }\n : undefined;\n const match = modalFromUrl(a.url, context.site.modals ?? []);\n const modalId =\n Number(a.metadata?.siteModalId) ||\n match?.modal.id ||\n Number(String(a.url ?? '').match(/^\\/modal\\/(\\d+)/)?.[1]);\n if (modalId) {\n const selected = (context.site.modals ?? []).find((m: any) => m.id === modalId);\n const selectedPlan =\n cardPlan ??\n a.metadata?.siteModalPlan ??\n match?.plan ??\n new URL(a.url || '/', 'http://local').searchParams.get('plan') ??\n 'hour';\n if (!selected)\n return (\n <button disabled style={widthStyle} className={classes}>\n <ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>\n </button>\n );\n return (\n <a\n data-modal-plan={selectedPlan}\n href={modalUrl(selected)}\n style={widthStyle}\n className={classes}\n onClick={(event) => {\n if (event.defaultPrevented) return;\n event.preventDefault();\n openModal(modalId, selectedPlan);\n }}\n >\n <ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>\n </a>\n );\n }\n if (String(a.url ?? '').includes('#modal-'))\n return (\n <button disabled style={widthStyle} className={classes}>\n <ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>\n </button>\n );\n return isBooking ? (\n <BookingButton style={widthStyle} plan={(cardPlan ?? plan) as any} className={classes}>\n <ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>\n </BookingButton>\n ) : (\n <a style={widthStyle} className={classes} href={a.url ?? '#'} target={a.linkTarget} rel={a.rel}>\n <ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>\n </a>\n );\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["'use client';\nimport { recordUrl } from '../../../core/content/links.js';\nimport { ContentContext } from '../../../core/content/context.js';\nimport { richNodes } from '../../../core/content/rich-text.js';\nimport { ButtonLabel } from '../../../core/icons/button.js';\nimport { BookingButton, BookingPlanContext } from './booking.js';\nimport { ModalContext } from '../../../modules/modals/context.js';\nimport { modalFromUrl, modalUrl } from '../../../modules/modals/links.js';\nimport { useContext } from 'react';\n\nimport { buttonClasses } from '../../../core/ui/button-appearance.js';\nexport { buttonClasses } from '../../../core/ui/button-appearance.js';\n\n/** Shared link/modal behavior. Layout belongs to the section using this button. */\nexport function ContentButton({\n attributes,\n fixedLayout = false,\n unstyled = false,\n className,\n}: {\n attributes: any;\n fixedLayout?: boolean;\n unstyled?: boolean;\n className?: string;\n}) {\n const context = useContext(ContentContext);\n const openModal = useContext(ModalContext);\n const cardPlan = useContext(BookingPlanContext);\n const linkedUrl = recordUrl(context.site, attributes.metadata?.siteLinkId);\n const a = linkedUrl ? {...attributes, url: linkedUrl} : attributes;\n const classes = [unstyled ? 'site-link' : buttonClasses(a.className), className].filter(Boolean).join(' ');\n const isBooking = String(a.url ?? '').startsWith('/booking');\n const plan = isBooking\n ? new URL(a.url, 'http://local').searchParams.get('plan') ?? 'hour'\n : 'hour';\n const widthStyle =\n !fixedLayout && a.width\n ? {\n width: a.width + '%',\n flexBasis: a.width + '%',\n }\n : undefined;\n const match = modalFromUrl(a.url, context.site.modals ?? []);\n const modalId =\n Number(a.metadata?.siteModalId) ||\n match?.modal.id ||\n Number(String(a.url ?? '').match(/^\\/modal\\/(\\d+)/)?.[1]);\n if (modalId) {\n const selected = (context.site.modals ?? []).find((m: any) => m.id === modalId);\n const selectedPlan =\n cardPlan ??\n a.metadata?.siteModalPlan ??\n match?.plan ??\n new URL(a.url || '/', 'http://local').searchParams.get('plan') ??\n 'hour';\n if (!selected)\n return (\n <button disabled style={widthStyle} className={classes}>\n <ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>\n </button>\n );\n return (\n <a\n data-modal-plan={selectedPlan}\n href={modalUrl(selected)}\n style={widthStyle}\n className={classes}\n onClick={(event) => {\n if (event.defaultPrevented) return;\n event.preventDefault();\n openModal(modalId, selectedPlan);\n }}\n >\n <ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>\n </a>\n );\n }\n if (String(a.url ?? '').includes('#modal-'))\n return (\n <button disabled style={widthStyle} className={classes}>\n <ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>\n </button>\n );\n return isBooking && !unstyled ? (\n <BookingButton style={widthStyle} plan={(cardPlan ?? plan) as any} className={classes}>\n <ButtonLabel attributes={a}>{richNodes(a.text)}</ButtonLabel>\n </BookingButton>\n ) : (\n <a style={widthStyle} className={classes} href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@@
|
|
|
1
|
-
export declare function HeadingSettingsControl(props: any): import("react").JSX.Element;
|
|
1
|
+
export declare function HeadingSettingsControl(props: any): import("react").JSX.Element | null;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useSyncExternalStore } from "react";
|
|
4
|
-
import { onListItemFocus, selectedListItem } from "../../core/fields/item-focus.js";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
3
|
import { headingTags, headingStyles, isHeadingTag, isHeadingStyle } from "./model.js";
|
|
6
4
|
function HeadingSettingsControl(props) {
|
|
7
|
-
return props.options?.itemPanel
|
|
5
|
+
return props.options?.itemPanel && !props.controls ? null : headingSettings(props);
|
|
8
6
|
}
|
|
9
|
-
function
|
|
10
|
-
const selected = useSyncExternalStore(onListItemFocus, selectedListItem, () => "");
|
|
11
|
-
return selected === props.options?.itemFocusKey ? headingSettings(props) : null;
|
|
12
|
-
}
|
|
13
|
-
function headingSettings({ field, value = {}, setValue, options = {} }) {
|
|
7
|
+
function headingSettings({ field, value = {}, setValue, options = {}, controls = false }) {
|
|
14
8
|
const { InspectorControls } = wp.blockEditor;
|
|
15
9
|
const { PanelBody, Button } = wp.components;
|
|
16
10
|
const defaults = options.defaults ?? {};
|
|
@@ -32,7 +26,7 @@ function headingSettings({ field, value = {}, setValue, options = {} }) {
|
|
|
32
26
|
select(key, next);
|
|
33
27
|
event.currentTarget.querySelector(`[data-heading-value="${next}"]`)?.focus();
|
|
34
28
|
};
|
|
35
|
-
|
|
29
|
+
const fields = /* @__PURE__ */ jsx(Fragment, { children: [
|
|
36
30
|
{ key: "tag", label: "HTML tag", fallback: defaults.tag ?? "h2" },
|
|
37
31
|
{ key: "textStyle", label: "Heading style", fallback: defaults.textStyle }
|
|
38
32
|
].map(({ key, label, fallback }) => {
|
|
@@ -67,7 +61,11 @@ function headingSettings({ field, value = {}, setValue, options = {} }) {
|
|
|
67
61
|
tag
|
|
68
62
|
)) })
|
|
69
63
|
] }, key);
|
|
70
|
-
}) })
|
|
64
|
+
}) });
|
|
65
|
+
return controls ? /* @__PURE__ */ jsxs("details", { className: "site-item-heading-settings", children: [
|
|
66
|
+
/* @__PURE__ */ jsx("summary", { children: "Heading settings" }),
|
|
67
|
+
fields
|
|
68
|
+
] }) : /* @__PURE__ */ jsx(InspectorControls, { children: /* @__PURE__ */ jsx(PanelBody, { title: field.label ?? "Heading", initialOpen: true, children: fields }) });
|
|
71
69
|
}
|
|
72
70
|
export {
|
|
73
71
|
HeadingSettingsControl
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../components/heading/editor.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\nimport {
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["'use client';\nimport {type KeyboardEvent} from 'react';\nimport { headingTags, headingStyles, isHeadingTag, isHeadingStyle, type HeadingSettings } from './model.js';\ndeclare const wp: any;\n\nexport function HeadingSettingsControl(props: any) {\n // A grouped row owns all its controls; canvas headings must not add sibling panels.\n return props.options?.itemPanel && !props.controls ? null : headingSettings(props);\n}\nfunction headingSettings({ field, value = {}, setValue, options = {}, controls = false }: any) {\n const { InspectorControls } = wp.blockEditor;\n const { PanelBody, Button } = wp.components;\n const defaults = options.defaults ?? {};\n const select = (key: keyof HeadingSettings, selected: string) => {\n const next = { ...value };\n if (key === 'tag' ? isHeadingTag(selected) : isHeadingStyle(selected)) next[key] = selected;\n else next[key] = undefined;\n setValue(next);\n };\n const navigate = (event: KeyboardEvent<HTMLDivElement>, key: keyof HeadingSettings) => {\n const current = (event.target as HTMLElement).closest<HTMLElement>('[data-heading-value]');\n if (!current) return;\n const choices: readonly string[] = key === 'tag' ? headingTags : headingStyles;\n const index = choices.indexOf(current.dataset.headingValue ?? '');\n const target = event.key === 'Home' ? 0 : event.key === 'End' ? choices.length - 1 :\n ['ArrowRight', 'ArrowDown'].includes(event.key) ? (index + 1) % choices.length :\n ['ArrowLeft', 'ArrowUp'].includes(event.key) ? (index + choices.length - 1) % choices.length : null;\n if (target === null) return;\n event.preventDefault();\n const next = choices[target];\n select(key, next);\n event.currentTarget.querySelector<HTMLButtonElement>(`[data-heading-value=\"${next}\"]`)?.focus();\n };\n const fields = <>\n {([{key:'tag',label:'HTML tag',fallback:defaults.tag ?? 'h2'},\n {key:'textStyle',label:'Heading style',fallback:defaults.textStyle}] as const).map(({key,label,fallback}) => {\n const choices: readonly string[] = key === 'tag' ? headingTags : headingStyles;\n const valid = key === 'tag' ? isHeadingTag : isHeadingStyle;\n const selected = valid(value[key]) ? value[key] : fallback;\n return <fieldset className=\"site-heading-setting\" key={key}>\n <legend><span>{label}</span><Button variant=\"link\" disabled={!valid(value[key])}\n aria-label={`Reset ${label.toLowerCase()} to section default`} onClick={() => select(key, '')}>Reset</Button></legend>\n <div className={key === 'tag' ? 'site-heading-options is-tag' : 'site-heading-options'} role=\"radiogroup\" aria-label={label} onKeyDown={event => navigate(event,key)}>\n {choices.map((tag,index) => <Button key={tag} type=\"button\" role=\"radio\" aria-checked={selected === tag}\n tabIndex={selected === tag || (!valid(selected) && index === 0) ? 0 : -1}\n data-heading-value={tag} onClick={() => select(key,tag)}>{tag.startsWith('h') ? tag.toUpperCase() : tag}</Button>)}\n </div>\n </fieldset>;\n })}\n </>;\n return controls ? <details className=\"site-item-heading-settings\"><summary>Heading settings</summary>{fields}</details> :\n <InspectorControls><PanelBody title={field.label ?? 'Heading'} initialOpen>{fields}</PanelBody></InspectorControls>;\n}\n"],
|
|
5
|
+
"mappings": ";AAiCiB,mBAOD,KAAR,YAPS;AA/BjB,SAAS,aAAa,eAAe,cAAc,sBAA4C;AAGxF,SAAS,uBAAuB,OAAY;AAEjD,SAAO,MAAM,SAAS,aAAa,CAAC,MAAM,WAAW,OAAO,gBAAgB,KAAK;AACnF;AACA,SAAS,gBAAgB,EAAE,OAAO,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eadingView({ name, label, level = 2, tag, textStyle, className }) {
|
|
|
23
23
|
}
|
|
24
24
|
const Heading = kit(
|
|
25
25
|
"heading",
|
|
26
|
-
({ label, level = 2, tag }) => ({ type: "richText", tag: resolveHeading(void 0, { level, tag }).tag, label: label ?? "Heading" }),
|
|
26
|
+
({ label, level = 2, tag, textStyle }) => ({ type: "richText", tag: resolveHeading(void 0, { level, tag }).tag, label: label ?? "Heading", controlOptions: { headingDefaults: resolveHeading(void 0, { level, tag, textStyle }) } }),
|
|
27
27
|
(props) => /* @__PURE__ */ jsx(HeadingView, { ...props })
|
|
28
28
|
);
|
|
29
29
|
export {
|