@r2digisolutions/components 0.19.16 → 0.19.18
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/components/atoms/Slider/Slider.stories.d.ts +8 -1
- package/dist/components/atoms/Slider/Slider.stories.js +17 -1
- package/dist/components/atoms/Slider/Slider.svelte +89 -64
- package/dist/components/atoms/Slider/Slider.svelte.d.ts +3 -1
- package/dist/components/atoms/Slider/SliderStory.svelte +4 -2
- package/dist/components/atoms/Slider/SliderStory.svelte.d.ts +2 -1
- package/dist/components/molecules/BulkActionBar/BulkActionBar.stories.d.ts +1 -1
- package/dist/components/molecules/CanvasInspector/CanvasInspector.svelte +61 -29
- package/dist/components/molecules/ColorPicker/ColorPicker.svelte +5 -1
- package/dist/components/molecules/ColorPicker/ColorPicker.svelte.d.ts +1 -1
- package/dist/components/molecules/MediaStage/MediaStage.svelte +7 -1
- package/dist/components/molecules/NewsletterSignup/NewsletterSignup.stories.d.ts +1 -1
- package/dist/components/molecules/PropertyField/PropertyField.svelte +51 -30
- package/dist/components/molecules/PropertyField/PropertyField.svelte.d.ts +5 -1
- package/dist/components/molecules/PropertyField/PropertyFieldStory.svelte +2 -1
- package/dist/components/molecules/Select/Select.svelte +2 -1
- package/dist/components/molecules/Select/Select.svelte.d.ts +1 -1
- package/dist/components/organisms/CanvasEditor/CanvasEditor.svelte +2 -1
- package/dist/components/organisms/Menubar/Menubar.svelte +271 -53
- package/dist/components/organisms/Menubar/Menubar.svelte.d.ts +4 -0
- package/dist/components/organisms/Menubar/MenubarStory.svelte +53 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/canvasDocument.d.ts +11 -1
- package/dist/utils/canvasDocument.js +31 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import FileUploader from '../../organisms/FileUploader/FileUploader.svelte';
|
|
13
13
|
import {
|
|
14
14
|
alignLayerRect,
|
|
15
|
+
applyTextAutoSize,
|
|
15
16
|
isCanvasFieldModified,
|
|
16
17
|
resetCanvasField,
|
|
17
18
|
type CanvasAlign,
|
|
@@ -272,8 +273,10 @@
|
|
|
272
273
|
|
|
273
274
|
function patchRect(partial: Partial<CanvasLayer['rect']>) {
|
|
274
275
|
if (!layer || !doc) return;
|
|
276
|
+
const prev = layer.rect;
|
|
275
277
|
const rect = { ...layer.rect, ...partial };
|
|
276
|
-
|
|
278
|
+
const synced = syncSlotFromRect({ ...layer, rect }, parentContentSize);
|
|
279
|
+
onchange?.(applyTextAutoSize(layer, synced, prev, rect));
|
|
277
280
|
}
|
|
278
281
|
|
|
279
282
|
function applyAlign(align: CanvasAlign) {
|
|
@@ -282,9 +285,9 @@
|
|
|
282
285
|
return;
|
|
283
286
|
}
|
|
284
287
|
if (!layer || !doc) return;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
});
|
|
288
|
+
const prev = layer.rect;
|
|
289
|
+
const rect = alignLayerRect(layer.rect, { width: doc.width, height: doc.height }, align);
|
|
290
|
+
onchange?.(applyTextAutoSize(layer, { ...layer, rect }, prev, rect));
|
|
288
291
|
}
|
|
289
292
|
|
|
290
293
|
function replaceMedia(files: File[]) {
|
|
@@ -326,6 +329,7 @@
|
|
|
326
329
|
onexpose={(v) => toggleExpose('visible', 'Visible', v)}
|
|
327
330
|
modified={fieldModified('visible')}
|
|
328
331
|
onreset={() => resetField('visible')}
|
|
332
|
+
valueAlign="end"
|
|
329
333
|
>
|
|
330
334
|
<Toggle
|
|
331
335
|
checked={layer.visible}
|
|
@@ -337,6 +341,7 @@
|
|
|
337
341
|
label="Locked"
|
|
338
342
|
modified={fieldModified('locked')}
|
|
339
343
|
onreset={() => resetField('locked')}
|
|
344
|
+
valueAlign="end"
|
|
340
345
|
>
|
|
341
346
|
<Toggle checked={layer.locked} onchange={(v) => patch({ locked: v })} size="sm" />
|
|
342
347
|
</PropertyField>
|
|
@@ -349,12 +354,13 @@
|
|
|
349
354
|
>
|
|
350
355
|
<Slider
|
|
351
356
|
size="sm"
|
|
357
|
+
variant="inset"
|
|
352
358
|
min={0}
|
|
353
359
|
max={1}
|
|
354
360
|
step={0.01}
|
|
355
361
|
value={layer.opacity}
|
|
356
362
|
showValue
|
|
357
|
-
valuePosition="
|
|
363
|
+
valuePosition="inline"
|
|
358
364
|
oninput={(v) => patch({ opacity: v })}
|
|
359
365
|
/>
|
|
360
366
|
</PropertyField>
|
|
@@ -397,6 +403,7 @@
|
|
|
397
403
|
/>
|
|
398
404
|
{:else if prop.field === 'fill' || prop.field === 'color' || prop.field === 'stroke' || prop.field === 'textBackground'}
|
|
399
405
|
<ColorPicker
|
|
406
|
+
size="xs"
|
|
400
407
|
value={String(current ?? '#000000')}
|
|
401
408
|
showSwatches={false}
|
|
402
409
|
onchange={(v) => onoverride?.({ propId: prop.id, value: v })}
|
|
@@ -457,7 +464,7 @@
|
|
|
457
464
|
{@const slots = listFillableSlotsForInstance(doc, parentWidget?.id ?? '')}
|
|
458
465
|
<PropertyField label="Fill slot">
|
|
459
466
|
<Select
|
|
460
|
-
size="
|
|
467
|
+
size="xs"
|
|
461
468
|
options={[
|
|
462
469
|
{ value: '', label: 'Host (default)' },
|
|
463
470
|
...slots.map((s) => ({ value: s, label: s }))
|
|
@@ -469,7 +476,7 @@
|
|
|
469
476
|
{/if}
|
|
470
477
|
<PropertyField label="Anchors">
|
|
471
478
|
<Select
|
|
472
|
-
size="
|
|
479
|
+
size="xs"
|
|
473
480
|
options={anchorOptions}
|
|
474
481
|
value={currentAnchorPreset()}
|
|
475
482
|
onchange={(v) => setAnchorPreset(v)}
|
|
@@ -481,7 +488,7 @@
|
|
|
481
488
|
</p>
|
|
482
489
|
<PropertyField label="Size rule">
|
|
483
490
|
<Select
|
|
484
|
-
size="
|
|
491
|
+
size="xs"
|
|
485
492
|
options={sizeRuleOptions}
|
|
486
493
|
value={layer.slot?.sizeRule === 'auto' ? 'fixed' : (layer.slot?.sizeRule ?? 'fixed')}
|
|
487
494
|
onchange={(v) =>
|
|
@@ -500,7 +507,7 @@
|
|
|
500
507
|
<div class="grid grid-cols-2 gap-2">
|
|
501
508
|
<PropertyField label={parentKind === 'hBox' ? 'Align Y' : 'Align X'}>
|
|
502
509
|
<Select
|
|
503
|
-
size="
|
|
510
|
+
size="xs"
|
|
504
511
|
options={alignAxisOptions}
|
|
505
512
|
value={String(
|
|
506
513
|
parentKind === 'hBox'
|
|
@@ -528,8 +535,8 @@
|
|
|
528
535
|
</div>
|
|
529
536
|
{/if}
|
|
530
537
|
{#if showContainerPadding}
|
|
531
|
-
<div class="grid grid-cols-2 gap-
|
|
532
|
-
<PropertyField label="Pad L">
|
|
538
|
+
<div class="grid grid-cols-2 gap-x-1 gap-y-0.5">
|
|
539
|
+
<PropertyField label="Pad L" labelWidth="2.75rem" compact>
|
|
533
540
|
<Input
|
|
534
541
|
type="number"
|
|
535
542
|
size="sm"
|
|
@@ -553,7 +560,7 @@
|
|
|
553
560
|
}}
|
|
554
561
|
/>
|
|
555
562
|
</PropertyField>
|
|
556
|
-
<PropertyField label="Pad T">
|
|
563
|
+
<PropertyField label="Pad T" labelWidth="2.75rem" compact>
|
|
557
564
|
<Input
|
|
558
565
|
type="number"
|
|
559
566
|
size="sm"
|
|
@@ -577,7 +584,7 @@
|
|
|
577
584
|
}}
|
|
578
585
|
/>
|
|
579
586
|
</PropertyField>
|
|
580
|
-
<PropertyField label="Pad R">
|
|
587
|
+
<PropertyField label="Pad R" labelWidth="2.75rem" compact>
|
|
581
588
|
<Input
|
|
582
589
|
type="number"
|
|
583
590
|
size="sm"
|
|
@@ -601,7 +608,7 @@
|
|
|
601
608
|
}}
|
|
602
609
|
/>
|
|
603
610
|
</PropertyField>
|
|
604
|
-
<PropertyField label="Pad B">
|
|
611
|
+
<PropertyField label="Pad B" labelWidth="2.75rem" compact>
|
|
605
612
|
<Input
|
|
606
613
|
type="number"
|
|
607
614
|
size="sm"
|
|
@@ -631,6 +638,7 @@
|
|
|
631
638
|
label="Clip children"
|
|
632
639
|
modified={fieldModified('clipChildren')}
|
|
633
640
|
onreset={() => resetField('clipChildren')}
|
|
641
|
+
valueAlign="end"
|
|
634
642
|
>
|
|
635
643
|
<Toggle
|
|
636
644
|
checked={!!layer.clipChildren || layer.kind === 'scrollBox'}
|
|
@@ -724,8 +732,8 @@
|
|
|
724
732
|
</div>
|
|
725
733
|
</div>
|
|
726
734
|
|
|
727
|
-
<div class="grid grid-cols-2 gap-
|
|
728
|
-
<PropertyField label="X">
|
|
735
|
+
<div class="grid grid-cols-2 gap-x-1 gap-y-0.5">
|
|
736
|
+
<PropertyField label="X" labelWidth="1.25rem" compact>
|
|
729
737
|
<Input
|
|
730
738
|
type="number"
|
|
731
739
|
size="sm"
|
|
@@ -735,7 +743,7 @@
|
|
|
735
743
|
patchRect({ x: Number((e.currentTarget as HTMLInputElement).value) })}
|
|
736
744
|
/>
|
|
737
745
|
</PropertyField>
|
|
738
|
-
<PropertyField label="Y">
|
|
746
|
+
<PropertyField label="Y" labelWidth="1.25rem" compact>
|
|
739
747
|
<Input
|
|
740
748
|
type="number"
|
|
741
749
|
size="sm"
|
|
@@ -745,7 +753,7 @@
|
|
|
745
753
|
patchRect({ y: Number((e.currentTarget as HTMLInputElement).value) })}
|
|
746
754
|
/>
|
|
747
755
|
</PropertyField>
|
|
748
|
-
<PropertyField label="W">
|
|
756
|
+
<PropertyField label="W" labelWidth="1.25rem" compact>
|
|
749
757
|
<Input
|
|
750
758
|
type="number"
|
|
751
759
|
size="sm"
|
|
@@ -754,7 +762,7 @@
|
|
|
754
762
|
patchRect({ w: Number((e.currentTarget as HTMLInputElement).value) })}
|
|
755
763
|
/>
|
|
756
764
|
</PropertyField>
|
|
757
|
-
<PropertyField label="H">
|
|
765
|
+
<PropertyField label="H" labelWidth="1.25rem" compact>
|
|
758
766
|
<Input
|
|
759
767
|
type="number"
|
|
760
768
|
size="sm"
|
|
@@ -781,12 +789,13 @@
|
|
|
781
789
|
>
|
|
782
790
|
<Slider
|
|
783
791
|
size="sm"
|
|
792
|
+
variant="inset"
|
|
784
793
|
min={-180}
|
|
785
794
|
max={180}
|
|
786
795
|
step={1}
|
|
787
796
|
value={layer.rotation ?? 0}
|
|
788
797
|
showValue
|
|
789
|
-
valuePosition="
|
|
798
|
+
valuePosition="inline"
|
|
790
799
|
unit="°"
|
|
791
800
|
oninput={(v) => patch({ rotation: v })}
|
|
792
801
|
/>
|
|
@@ -801,12 +810,13 @@
|
|
|
801
810
|
>
|
|
802
811
|
<Slider
|
|
803
812
|
size="sm"
|
|
813
|
+
variant="inset"
|
|
804
814
|
min={0}
|
|
805
815
|
max={64}
|
|
806
816
|
step={1}
|
|
807
817
|
value={layer.shadowBlur ?? 0}
|
|
808
818
|
showValue
|
|
809
|
-
valuePosition="
|
|
819
|
+
valuePosition="inline"
|
|
810
820
|
unit="px"
|
|
811
821
|
oninput={(v) => patch({ shadowBlur: v })}
|
|
812
822
|
/>
|
|
@@ -817,6 +827,7 @@
|
|
|
817
827
|
onreset={() => resetField('shadowColor')}
|
|
818
828
|
>
|
|
819
829
|
<ColorPicker
|
|
830
|
+
size="xs"
|
|
820
831
|
value={layer.shadowColor ?? '#000000'}
|
|
821
832
|
showSwatches={false}
|
|
822
833
|
onchange={(v) => patch({ shadowColor: v })}
|
|
@@ -829,12 +840,13 @@
|
|
|
829
840
|
>
|
|
830
841
|
<Slider
|
|
831
842
|
size="sm"
|
|
843
|
+
variant="inset"
|
|
832
844
|
min={0}
|
|
833
845
|
max={40}
|
|
834
846
|
step={1}
|
|
835
847
|
value={layer.blur ?? 0}
|
|
836
848
|
showValue
|
|
837
|
-
valuePosition="
|
|
849
|
+
valuePosition="inline"
|
|
838
850
|
unit="px"
|
|
839
851
|
oninput={(v) => patch({ blur: v })}
|
|
840
852
|
/>
|
|
@@ -874,7 +886,7 @@
|
|
|
874
886
|
onreset={() => resetField('objectFit')}
|
|
875
887
|
>
|
|
876
888
|
<Select
|
|
877
|
-
size="
|
|
889
|
+
size="xs"
|
|
878
890
|
options={fitOptions}
|
|
879
891
|
value={layer.objectFit ?? 'cover'}
|
|
880
892
|
onchange={(v) => patch({ objectFit: v as CanvasLayer['objectFit'] })}
|
|
@@ -889,12 +901,13 @@
|
|
|
889
901
|
>
|
|
890
902
|
<Slider
|
|
891
903
|
size="sm"
|
|
904
|
+
variant="inset"
|
|
892
905
|
min={0}
|
|
893
906
|
max={200}
|
|
894
907
|
step={1}
|
|
895
908
|
value={layer.borderRadius ?? 0}
|
|
896
909
|
showValue
|
|
897
|
-
valuePosition="
|
|
910
|
+
valuePosition="inline"
|
|
898
911
|
unit="px"
|
|
899
912
|
oninput={(v) => patch({ borderRadius: v })}
|
|
900
913
|
/>
|
|
@@ -917,6 +930,18 @@
|
|
|
917
930
|
oninput={(e) => patch({ text: (e.currentTarget as HTMLTextAreaElement).value })}
|
|
918
931
|
/>
|
|
919
932
|
</PropertyField>
|
|
933
|
+
<PropertyField
|
|
934
|
+
label="Auto size"
|
|
935
|
+
modified={fieldModified('autoSize')}
|
|
936
|
+
onreset={() => resetField('autoSize')}
|
|
937
|
+
valueAlign="end"
|
|
938
|
+
>
|
|
939
|
+
<Toggle
|
|
940
|
+
checked={layer.autoSize ?? layer.kind === 'text'}
|
|
941
|
+
onchange={(v) => patch({ autoSize: v })}
|
|
942
|
+
size="sm"
|
|
943
|
+
/>
|
|
944
|
+
</PropertyField>
|
|
920
945
|
<PropertyField
|
|
921
946
|
label="Size"
|
|
922
947
|
exposed={exposedFlag('fontSize')}
|
|
@@ -934,7 +959,7 @@
|
|
|
934
959
|
</PropertyField>
|
|
935
960
|
<PropertyField label="Weight">
|
|
936
961
|
<Select
|
|
937
|
-
size="
|
|
962
|
+
size="xs"
|
|
938
963
|
options={weightOptions}
|
|
939
964
|
value={String(layer.fontWeight ?? 600)}
|
|
940
965
|
onchange={(v) => patch({ fontWeight: v })}
|
|
@@ -942,7 +967,7 @@
|
|
|
942
967
|
</PropertyField>
|
|
943
968
|
<PropertyField label="Style">
|
|
944
969
|
<Select
|
|
945
|
-
size="
|
|
970
|
+
size="xs"
|
|
946
971
|
options={styleOptions}
|
|
947
972
|
value={layer.fontStyle ?? 'normal'}
|
|
948
973
|
onchange={(v) => patch({ fontStyle: v as CanvasLayer['fontStyle'] })}
|
|
@@ -950,7 +975,7 @@
|
|
|
950
975
|
</PropertyField>
|
|
951
976
|
<PropertyField label="Decoration">
|
|
952
977
|
<Select
|
|
953
|
-
size="
|
|
978
|
+
size="xs"
|
|
954
979
|
options={decoOptions}
|
|
955
980
|
value={layer.textDecoration ?? 'none'}
|
|
956
981
|
onchange={(v) => patch({ textDecoration: v as CanvasLayer['textDecoration'] })}
|
|
@@ -958,7 +983,7 @@
|
|
|
958
983
|
</PropertyField>
|
|
959
984
|
<PropertyField label="Align">
|
|
960
985
|
<Select
|
|
961
|
-
size="
|
|
986
|
+
size="xs"
|
|
962
987
|
options={alignOptions}
|
|
963
988
|
value={layer.textAlign ?? 'left'}
|
|
964
989
|
onchange={(v) => patch({ textAlign: v as CanvasLayer['textAlign'] })}
|
|
@@ -972,6 +997,7 @@
|
|
|
972
997
|
onreset={() => resetField('color')}
|
|
973
998
|
>
|
|
974
999
|
<ColorPicker
|
|
1000
|
+
size="xs"
|
|
975
1001
|
value={layer.color ?? '#0f172a'}
|
|
976
1002
|
onchange={(v) => patch({ color: v })}
|
|
977
1003
|
/>
|
|
@@ -985,6 +1011,7 @@
|
|
|
985
1011
|
onreset={() => resetField('textBackground')}
|
|
986
1012
|
>
|
|
987
1013
|
<ColorPicker
|
|
1014
|
+
size="xs"
|
|
988
1015
|
value={layer.textBackground ?? '#ffffff'}
|
|
989
1016
|
alpha
|
|
990
1017
|
onchange={(v) => patch({ textBackground: v })}
|
|
@@ -1000,6 +1027,7 @@
|
|
|
1000
1027
|
onreset={() => resetField('fill')}
|
|
1001
1028
|
>
|
|
1002
1029
|
<ColorPicker
|
|
1030
|
+
size="xs"
|
|
1003
1031
|
value={layer.fill ?? '#fef08a'}
|
|
1004
1032
|
onchange={(v) => patch({ fill: v })}
|
|
1005
1033
|
/>
|
|
@@ -1037,6 +1065,7 @@
|
|
|
1037
1065
|
onreset={() => resetField('fill')}
|
|
1038
1066
|
>
|
|
1039
1067
|
<ColorPicker
|
|
1068
|
+
size="xs"
|
|
1040
1069
|
value={layer.fill ?? '#3b82f6'}
|
|
1041
1070
|
onchange={(v) => patch({ fill: v })}
|
|
1042
1071
|
/>
|
|
@@ -1051,12 +1080,13 @@
|
|
|
1051
1080
|
>
|
|
1052
1081
|
<Slider
|
|
1053
1082
|
size="sm"
|
|
1083
|
+
variant="inset"
|
|
1054
1084
|
min={0}
|
|
1055
1085
|
max={200}
|
|
1056
1086
|
step={1}
|
|
1057
1087
|
value={layer.borderRadius ?? 0}
|
|
1058
1088
|
showValue
|
|
1059
|
-
valuePosition="
|
|
1089
|
+
valuePosition="inline"
|
|
1060
1090
|
unit="px"
|
|
1061
1091
|
oninput={(v) => patch({ borderRadius: v })}
|
|
1062
1092
|
/>
|
|
@@ -1070,6 +1100,7 @@
|
|
|
1070
1100
|
onreset={() => resetField('stroke')}
|
|
1071
1101
|
>
|
|
1072
1102
|
<ColorPicker
|
|
1103
|
+
size="xs"
|
|
1073
1104
|
value={layer.stroke ?? '#000000'}
|
|
1074
1105
|
onchange={(v) => patch({ stroke: v })}
|
|
1075
1106
|
/>
|
|
@@ -1125,6 +1156,7 @@
|
|
|
1125
1156
|
{/if}
|
|
1126
1157
|
<PropertyField label="Background">
|
|
1127
1158
|
<ColorPicker
|
|
1159
|
+
size="xs"
|
|
1128
1160
|
value={doc.background || '#ffffff'}
|
|
1129
1161
|
alpha
|
|
1130
1162
|
onchange={(v) => patchDoc({ background: v })}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createId } from '../../../utils/id.js';
|
|
3
3
|
|
|
4
4
|
export type ColorFormat = 'hex' | 'rgb' | 'hsl';
|
|
5
|
-
type ColorPickerSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
type ColorPickerSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
6
6
|
|
|
7
7
|
interface ColorPickerProps {
|
|
8
8
|
value?: string;
|
|
@@ -49,24 +49,28 @@
|
|
|
49
49
|
}: ColorPickerProps = $props();
|
|
50
50
|
|
|
51
51
|
const triggerSizeClasses: Record<ColorPickerSize, string> = {
|
|
52
|
+
xs: 'h-7 gap-1.5 rounded-lg px-1.5',
|
|
52
53
|
sm: 'h-8 gap-2 rounded-lg px-2',
|
|
53
54
|
md: 'h-10 gap-2.5 rounded-xl px-2.5',
|
|
54
55
|
lg: 'h-12 gap-3 rounded-xl px-3'
|
|
55
56
|
};
|
|
56
57
|
|
|
57
58
|
const swatchSizeClasses: Record<ColorPickerSize, string> = {
|
|
59
|
+
xs: 'h-4 w-4 rounded',
|
|
58
60
|
sm: 'h-5 w-5 rounded-md',
|
|
59
61
|
md: 'h-7 w-7 rounded-lg',
|
|
60
62
|
lg: 'h-8 w-8 rounded-lg'
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
const valueSizeClasses: Record<ColorPickerSize, string> = {
|
|
66
|
+
xs: 'text-xs',
|
|
64
67
|
sm: 'text-sm',
|
|
65
68
|
md: 'text-sm',
|
|
66
69
|
lg: 'text-base'
|
|
67
70
|
};
|
|
68
71
|
|
|
69
72
|
const chevronSizeClasses: Record<ColorPickerSize, string> = {
|
|
73
|
+
xs: 'h-3 w-3',
|
|
70
74
|
sm: 'h-3.5 w-3.5',
|
|
71
75
|
md: 'h-4 w-4',
|
|
72
76
|
lg: 'h-4 w-4'
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
type MarqueeRect as MarqueeBox
|
|
17
17
|
} from '../../../utils/marqueeSelect.js';
|
|
18
18
|
import {
|
|
19
|
+
applyTextAutoSize,
|
|
19
20
|
createCanvasGuide,
|
|
20
21
|
pathPointsToDoc,
|
|
21
22
|
rebakePathLayer,
|
|
@@ -410,7 +411,12 @@
|
|
|
410
411
|
return;
|
|
411
412
|
}
|
|
412
413
|
|
|
413
|
-
const updated =
|
|
414
|
+
const updated = applyTextAutoSize(
|
|
415
|
+
source,
|
|
416
|
+
absToLocalUpdate(source, nextAbs),
|
|
417
|
+
prevAbs,
|
|
418
|
+
nextAbs
|
|
419
|
+
);
|
|
414
420
|
draftLayers = layers.map((l) => (l.id === updated.id ? updated : l));
|
|
415
421
|
// If somehow interact end already fired without draft, commit immediately.
|
|
416
422
|
if (interactCount === 0) commitDraft();
|
|
@@ -2,7 +2,7 @@ import type { StoryObj } from '@storybook/svelte';
|
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
4
|
component: import("svelte").Component<{
|
|
5
|
-
example?: "error" | "success" | "
|
|
5
|
+
example?: "error" | "success" | "inline" | "banner" | "card" | "stacked" | "minimal" | "consent";
|
|
6
6
|
title?: string;
|
|
7
7
|
description?: string;
|
|
8
8
|
variant?: import("./NewsletterSignup.svelte.ts").NewsletterVariant;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
interface PropertyFieldProps {
|
|
11
11
|
label: string;
|
|
12
|
-
/**
|
|
12
|
+
/** Fixed label column width (CSS). Use rem for UE-style alignment across the panel. */
|
|
13
13
|
labelWidth?: string;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
class?: string;
|
|
@@ -24,52 +24,73 @@
|
|
|
24
24
|
modified?: boolean;
|
|
25
25
|
/** Reset this property to its default (UE details panel). */
|
|
26
26
|
onreset?: () => void;
|
|
27
|
+
/** Align control in the value column. Defaults to stretch/fill. */
|
|
28
|
+
valueAlign?: 'start' | 'end' | 'stretch';
|
|
29
|
+
/** Skip reset gutter — for dense 2-col rows (X/Y/W/H). */
|
|
30
|
+
compact?: boolean;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
const {
|
|
30
34
|
label,
|
|
31
|
-
labelWidth = '
|
|
35
|
+
labelWidth = '7rem',
|
|
32
36
|
disabled = false,
|
|
33
37
|
class: className = '',
|
|
34
38
|
children,
|
|
35
39
|
exposed = null,
|
|
36
40
|
onexpose,
|
|
37
41
|
modified = false,
|
|
38
|
-
onreset
|
|
42
|
+
onreset,
|
|
43
|
+
valueAlign = 'stretch',
|
|
44
|
+
compact = false
|
|
39
45
|
}: PropertyFieldProps = $props();
|
|
40
46
|
|
|
41
47
|
const canReset = $derived(!!onreset && modified && !disabled);
|
|
48
|
+
const columns = $derived(
|
|
49
|
+
compact ? `${labelWidth} minmax(0, 1fr)` : `1.25rem ${labelWidth} minmax(0, 1fr)`
|
|
50
|
+
);
|
|
42
51
|
</script>
|
|
43
52
|
|
|
44
53
|
<div
|
|
45
54
|
class={[
|
|
46
|
-
'grid min-h-7 items-center gap-2 px-1 py-0.5',
|
|
55
|
+
'grid min-h-7 items-center gap-x-2 px-1 py-0.5',
|
|
47
56
|
'rounded-sm hover:bg-surface-overlay/70',
|
|
48
57
|
disabled && 'pointer-events-none opacity-50',
|
|
49
58
|
className
|
|
50
59
|
]}
|
|
51
|
-
style:grid-template-columns={
|
|
60
|
+
style:grid-template-columns={columns}
|
|
52
61
|
>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
{#if !compact}
|
|
63
|
+
<!-- Reset gutter: always reserved so every row shares the same label/value columns -->
|
|
64
|
+
<span class="flex h-7 w-5 items-center justify-center">
|
|
65
|
+
{#if canReset}
|
|
66
|
+
<Tooltip content="Reset to default" side="top">
|
|
67
|
+
<IconButton
|
|
68
|
+
label="Reset to default"
|
|
69
|
+
size="xs"
|
|
70
|
+
class="text-amber-500 hover:bg-amber-500/10 hover:text-amber-600 dark:text-amber-400 dark:hover:text-amber-300"
|
|
71
|
+
onclick={() => onreset?.()}
|
|
72
|
+
>
|
|
73
|
+
<RotateCcw class="h-3 w-3" strokeWidth={2.5} />
|
|
74
|
+
</IconButton>
|
|
75
|
+
</Tooltip>
|
|
76
|
+
{/if}
|
|
77
|
+
</span>
|
|
78
|
+
{/if}
|
|
79
|
+
|
|
80
|
+
<span class="flex min-w-0 items-center justify-start gap-0.5 text-left" title={label}>
|
|
81
|
+
<Text
|
|
82
|
+
size="xs"
|
|
83
|
+
tone={canReset ? 'primary' : 'secondary'}
|
|
84
|
+
as="span"
|
|
85
|
+
class={['min-w-0 flex-1 truncate font-medium', canReset && 'text-amber-700 dark:text-amber-400']}
|
|
86
|
+
>
|
|
87
|
+
{label}
|
|
88
|
+
</Text>
|
|
68
89
|
{#if exposed !== null}
|
|
69
90
|
<IconButton
|
|
70
91
|
label={exposed ? 'Hide from instances' : 'Expose on instances'}
|
|
71
92
|
size="xs"
|
|
72
|
-
class={exposed ? 'text-brand-600' : 'text-muted'}
|
|
93
|
+
class={['shrink-0', exposed ? 'text-brand-600' : 'text-muted']}
|
|
73
94
|
onclick={() => onexpose?.(!exposed)}
|
|
74
95
|
>
|
|
75
96
|
{#if exposed}
|
|
@@ -79,16 +100,16 @@
|
|
|
79
100
|
{/if}
|
|
80
101
|
</IconButton>
|
|
81
102
|
{/if}
|
|
82
|
-
<Text
|
|
83
|
-
size="xs"
|
|
84
|
-
tone={canReset ? 'primary' : 'secondary'}
|
|
85
|
-
as="span"
|
|
86
|
-
class={['truncate font-medium', canReset && 'text-amber-700 dark:text-amber-400']}
|
|
87
|
-
>
|
|
88
|
-
{label}
|
|
89
|
-
</Text>
|
|
90
103
|
</span>
|
|
91
|
-
|
|
104
|
+
|
|
105
|
+
<div
|
|
106
|
+
class={[
|
|
107
|
+
'flex min-h-7 min-w-0 items-center',
|
|
108
|
+
valueAlign === 'end' && 'justify-end',
|
|
109
|
+
valueAlign === 'start' && 'justify-start',
|
|
110
|
+
valueAlign === 'stretch' && '[&>*]:min-w-0 [&>*]:w-full'
|
|
111
|
+
]}
|
|
112
|
+
>
|
|
92
113
|
{#if children}
|
|
93
114
|
{@render children()}
|
|
94
115
|
{/if}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
interface PropertyFieldProps {
|
|
3
3
|
label: string;
|
|
4
|
-
/**
|
|
4
|
+
/** Fixed label column width (CSS). Use rem for UE-style alignment across the panel. */
|
|
5
5
|
labelWidth?: string;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
class?: string;
|
|
@@ -16,6 +16,10 @@ interface PropertyFieldProps {
|
|
|
16
16
|
modified?: boolean;
|
|
17
17
|
/** Reset this property to its default (UE details panel). */
|
|
18
18
|
onreset?: () => void;
|
|
19
|
+
/** Align control in the value column. Defaults to stretch/fill. */
|
|
20
|
+
valueAlign?: 'start' | 'end' | 'stretch';
|
|
21
|
+
/** Skip reset gutter — for dense 2-col rows (X/Y/W/H). */
|
|
22
|
+
compact?: boolean;
|
|
19
23
|
}
|
|
20
24
|
declare const PropertyField: import("svelte").Component<PropertyFieldProps, {}, "">;
|
|
21
25
|
type PropertyField = ReturnType<typeof PropertyField>;
|
|
@@ -24,12 +24,13 @@
|
|
|
24
24
|
>
|
|
25
25
|
<Slider
|
|
26
26
|
size="sm"
|
|
27
|
+
variant="inset"
|
|
27
28
|
min={0}
|
|
28
29
|
max={1}
|
|
29
30
|
step={0.01}
|
|
30
31
|
bind:value={opacity}
|
|
31
32
|
showValue
|
|
32
|
-
valuePosition="
|
|
33
|
+
valuePosition="inline"
|
|
33
34
|
/>
|
|
34
35
|
</PropertyField>
|
|
35
36
|
<p class="px-1 pt-1 text-[10px] text-muted">
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* and highlight it. Defaults to true.
|
|
29
29
|
*/
|
|
30
30
|
flyToSelected?: boolean;
|
|
31
|
-
size?: 'sm' | 'md' | 'lg';
|
|
31
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
32
32
|
class?: string;
|
|
33
33
|
onchange?: (value: string) => void;
|
|
34
34
|
}
|
|
@@ -160,6 +160,7 @@
|
|
|
160
160
|
);
|
|
161
161
|
|
|
162
162
|
const sizeClasses = {
|
|
163
|
+
xs: 'h-7 text-xs px-2 gap-1.5 rounded-lg',
|
|
163
164
|
sm: 'h-8 text-sm px-3',
|
|
164
165
|
md: 'h-10 text-sm px-3.5',
|
|
165
166
|
lg: 'h-12 text-base px-4'
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import {
|
|
21
21
|
CANVAS_PRESETS,
|
|
22
22
|
alignLayerRect,
|
|
23
|
+
applyTextAutoSize,
|
|
23
24
|
createCanvasGuide,
|
|
24
25
|
createCanvasLayer,
|
|
25
26
|
createPathFromDocPoints,
|
|
@@ -664,7 +665,7 @@
|
|
|
664
665
|
alignment: l.slot?.alignment,
|
|
665
666
|
order: l.slot?.order
|
|
666
667
|
};
|
|
667
|
-
return { ...l, rect, slot };
|
|
668
|
+
return applyTextAutoSize(l, { ...l, rect, slot }, l.rect, rect);
|
|
668
669
|
})
|
|
669
670
|
);
|
|
670
671
|
}
|