fiboui 2.8.5 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -92,7 +92,27 @@ declare class Observable<T> implements Subscribable<T> {
92
92
  unsubscribeEffect(effect: Effect): void;
93
93
  private notify;
94
94
  }
95
+ type GestureMask = "all" | "gesture" | "subviews" | "none";
96
+ type TapLocation = {
97
+ x: number;
98
+ y: number;
99
+ };
95
100
  declare abstract class GestureBuilder {
101
+ protected _enabled: boolean;
102
+ protected _including: GestureMask;
103
+ /** When true, wrappers must not stopPropagation (simultaneous). */
104
+ protected _bubble: boolean;
105
+ /** @internal Fired when the gesture successfully recognizes (Sequence / Exclusive). */
106
+ protected _onRecognized?: () => void;
107
+ enabled(value?: boolean): this;
108
+ /** SwiftUI `gesture(_:including:)`. */
109
+ including(mask: GestureMask): this;
110
+ /** Internal — set by SimultaneousGesture / `.simultaneousGesture`. */
111
+ bubble(value?: boolean): this;
112
+ /** @internal Used by SequenceGesture / ExclusiveGesture. */
113
+ onRecognized(callback: () => void): this;
114
+ /** @internal */
115
+ protected notifyRecognized(): void;
96
116
  abstract wrap(children: React$1.ReactNode): React$1.ReactNode;
97
117
  }
98
118
  interface AnimationOptions {
@@ -360,6 +380,144 @@ declare const When: {
360
380
  };
361
381
  type When = (typeof When)[keyof typeof When];
362
382
  type WhenStyle = React$1.CSSProperties | string | ((builder: any) => void);
383
+ declare const Size: {
384
+ readonly full: "full";
385
+ readonly screen: "screen";
386
+ readonly fit: "fit";
387
+ readonly min: "min";
388
+ readonly max: "max";
389
+ /** SwiftUI `.infinity` — expand to the space the parent proposes (`100%`). */
390
+ readonly infinity: "infinity";
391
+ };
392
+ type Size = (typeof Size)[keyof typeof Size];
393
+ declare const StackAlign: {
394
+ readonly center: "center";
395
+ readonly top: "top";
396
+ readonly bottom: "bottom";
397
+ readonly left: "left";
398
+ readonly right: "right";
399
+ readonly topLeft: "topLeft";
400
+ readonly topRight: "topRight";
401
+ readonly bottomLeft: "bottomLeft";
402
+ readonly bottomRight: "bottomRight";
403
+ /** SwiftUI `leading` → `left` */
404
+ readonly leading: "left";
405
+ /** SwiftUI `trailing` → `right` */
406
+ readonly trailing: "right";
407
+ /** SwiftUI `topLeading` → `topLeft` */
408
+ readonly topLeading: "topLeft";
409
+ /** SwiftUI `topTrailing` → `topRight` */
410
+ readonly topTrailing: "topRight";
411
+ /** SwiftUI `bottomLeading` → `bottomLeft` */
412
+ readonly bottomLeading: "bottomLeft";
413
+ /** SwiftUI `bottomTrailing` → `bottomRight` */
414
+ readonly bottomTrailing: "bottomRight";
415
+ };
416
+ type StackAlign = (typeof StackAlign)[keyof typeof StackAlign];
417
+ type FrameSize = number | string | Size;
418
+ interface FrameSpec {
419
+ width?: FrameSize;
420
+ height?: FrameSize;
421
+ minWidth?: FrameSize;
422
+ idealWidth?: FrameSize;
423
+ maxWidth?: FrameSize;
424
+ minHeight?: FrameSize;
425
+ idealHeight?: FrameSize;
426
+ maxHeight?: FrameSize;
427
+ alignment?: StackAlign | keyof typeof StackAlign;
428
+ }
429
+ type ClipShapeName = "circle" | "rounded" | "square";
430
+ interface OffsetSpec {
431
+ x?: number;
432
+ y?: number;
433
+ }
434
+ interface FixedSizeSpec {
435
+ horizontal?: boolean;
436
+ vertical?: boolean;
437
+ }
438
+ interface LayerSpec {
439
+ kind: "overlay" | "background";
440
+ child: FiboChild | (() => FiboChild);
441
+ alignment: StackAlign | keyof typeof StackAlign;
442
+ }
443
+ type ContentShapeName = "rectangle" | ClipShapeName;
444
+ type GeometryRect = {
445
+ x: number;
446
+ y: number;
447
+ width: number;
448
+ height: number;
449
+ };
450
+ type ContainerRelativeFrameSpec = {
451
+ axis?: "horizontal" | "vertical" | "both";
452
+ /** Divisions of the container (SwiftUI `count`). Default 1. */
453
+ count?: number;
454
+ /** Spans claimed (SwiftUI `span`). Default 1. */
455
+ span?: number;
456
+ };
457
+ type AlignmentGuideName = "leading" | "trailing" | "top" | "bottom" | "centerX" | "centerY" | string;
458
+ type AlignmentGuideDims = {
459
+ width: number;
460
+ height: number;
461
+ };
462
+ type AlignmentGuideSpec = {
463
+ guide: AlignmentGuideName;
464
+ /** Absolute guide position, or compute from own size (SwiftUI `ViewDimensions`). */
465
+ compute: number | ((dims: AlignmentGuideDims) => number);
466
+ };
467
+ type MatchedGeometrySpec = {
468
+ id: string;
469
+ namespace?: string;
470
+ /** SwiftUI `isSource` — source owns the shared geometry. Default true. */
471
+ isSource?: boolean;
472
+ };
473
+ type PreferenceKeyDef<T> = {
474
+ readonly __preferenceKey: true;
475
+ readonly id: string | symbol;
476
+ readonly defaultValue: T;
477
+ reduce: (value: T, nextValue: T) => T;
478
+ };
479
+ type PreferenceWriteSpec = {
480
+ key: PreferenceKeyDef<any>;
481
+ value: unknown;
482
+ };
483
+ type PreferenceReadSpec = {
484
+ key: PreferenceKeyDef<any>;
485
+ onChange: (value: any) => void;
486
+ };
487
+ declare const Edge: {
488
+ readonly top: "top";
489
+ readonly bottom: "bottom";
490
+ readonly leading: "leading";
491
+ readonly trailing: "trailing";
492
+ };
493
+ type Edge = (typeof Edge)[keyof typeof Edge];
494
+ declare const EdgeSet: {
495
+ readonly top: "top";
496
+ readonly bottom: "bottom";
497
+ readonly leading: "leading";
498
+ readonly trailing: "trailing";
499
+ readonly horizontal: "horizontal";
500
+ readonly vertical: "vertical";
501
+ readonly all: "all";
502
+ };
503
+ type EdgeSet = (typeof EdgeSet)[keyof typeof EdgeSet];
504
+ type EdgeInsetsValue = {
505
+ top?: number | string;
506
+ bottom?: number | string;
507
+ leading?: number | string;
508
+ trailing?: number | string;
509
+ /** CSS left — alias of leading in LTR */
510
+ left?: number | string;
511
+ /** CSS right — alias of trailing in LTR */
512
+ right?: number | string;
513
+ };
514
+ type SafeAreaInsetEdge = Edge | "top" | "bottom" | "leading" | "trailing" | "left" | "right";
515
+ type SafeAreaInsetSpec = {
516
+ edge: SafeAreaInsetEdge;
517
+ content: FiboChild | (() => FiboChild);
518
+ /** Gap between inset bar and content. Default 0. */
519
+ spacing?: number;
520
+ };
363
521
  interface SpringOptions {
364
522
  stiffness?: number;
365
523
  damping?: number;
@@ -569,7 +727,29 @@ declare abstract class FiboBuilder {
569
727
  /** @internal Direct `method(signal.value)` calls replayed when that signal changes. */
570
728
  protected _replays: Array<() => void>;
571
729
  protected _isObserver: boolean;
572
- protected _gesture?: GestureBuilder;
730
+ /** Normal-priority gestures (SwiftUI `.gesture`). Last = outermost. */
731
+ protected _gestures: GestureBuilder[];
732
+ /** SwiftUI `.simultaneousGesture` — bubble / no stopPropagation. */
733
+ protected _simultaneousGestures: GestureBuilder[];
734
+ /** SwiftUI `.highPriorityGesture` — wrapped last (outermost / capture wins). */
735
+ protected _highPriorityGestures: GestureBuilder[];
736
+ protected _offset?: OffsetSpec;
737
+ protected _clipped: boolean;
738
+ protected _clipShape?: ClipShapeName | string;
739
+ protected _contentShape?: ContentShapeName | string;
740
+ protected _fixedSize?: FixedSizeSpec;
741
+ protected _layoutPriority?: number;
742
+ protected _layers: LayerSpec[];
743
+ protected _onGeometryChange?: (rect: GeometryRect) => void;
744
+ protected _compositingGroup: boolean;
745
+ protected _viewMask?: string;
746
+ protected _containerRelativeFrame?: ContainerRelativeFrameSpec;
747
+ protected _alignmentGuide?: AlignmentGuideSpec;
748
+ protected _matchedGeometry?: MatchedGeometrySpec;
749
+ protected _preferences: PreferenceWriteSpec[];
750
+ protected _preferenceReaders: PreferenceReadSpec[];
751
+ protected _safeAreaInsets: SafeAreaInsetSpec[];
752
+ protected _navigationTitle?: string;
573
753
  protected _animationConfig?: Partial<AnimationOptions>;
574
754
  protected _animatedProps: Map<string, Signal<any>>;
575
755
  protected _transforms: string[];
@@ -598,6 +778,11 @@ declare abstract class FiboBuilder {
598
778
  protected _explicitScrollMargin: boolean;
599
779
  /** Shrink-wrap: skip the default `w-full` / `self-stretch` on Row and Column. */
600
780
  protected _hug: boolean;
781
+ /**
782
+ * SwiftUI `.frame(...)` wrappers (outer → inner order of application).
783
+ * Applied in `assembleBuilder` so every widget gets the same DX.
784
+ */
785
+ protected _frames: FrameSpec[];
601
786
  /**
602
787
  * Unset every CSS property on this component and what it renders inside.
603
788
  * Chain `.style()`, `.px()`, `.flex()` and the rest after this to put back only what you want.
@@ -609,6 +794,109 @@ declare abstract class FiboBuilder {
609
794
  protected isReset(): boolean;
610
795
  hug(): this;
611
796
  protected isHug(): boolean;
797
+ /**
798
+ * SwiftUI `View.frame` — invisible box around this view.
799
+ *
800
+ * ```ts
801
+ * Image(url).frame({ width: 300, height: 400 })
802
+ * Text('★★★★').frame({
803
+ * maxWidth: Size.infinity,
804
+ * maxHeight: Size.infinity,
805
+ * alignment: StackAlign.topTrailing,
806
+ * })
807
+ * ```
808
+ *
809
+ * Chainable: each `.frame()` wraps the previous (same as SwiftUI).
810
+ */
811
+ frame(spec: FrameSpec): this;
812
+ /**
813
+ * SwiftUI `.offset(x:y:)` — visual translate; layout size stays.
814
+ * `.offset(8)` ≡ `{ x: 8, y: 8 }`; `.offset({ x: 4 })` only horizontal.
815
+ */
816
+ offset(value: number | OffsetSpec): this;
817
+ /** SwiftUI `.clipped()` — overflow hidden to bounds. */
818
+ clipped(): this;
819
+ /**
820
+ * SwiftUI `.clipShape` — `'circle' | 'rounded' | 'square'` or any CSS radius
821
+ * (`'8px'`, `'50%'`). Clips drawing; hit-testing still follows layout unless
822
+ * you also set {@link contentShape}.
823
+ */
824
+ clipShape(shape: ClipShapeName | string): this;
825
+ /**
826
+ * SwiftUI `.contentShape` — region used for hit-testing (tap / long-press).
827
+ * Default `'rectangle'` = full frame box, even over transparent pixels.
828
+ *
829
+ * ```ts
830
+ * ZStack()…frame({ width: 300, height: 400 })
831
+ * .clipShape('8px')
832
+ * .contentShape('rectangle')
833
+ * .onTapGesture(open)
834
+ * ```
835
+ */
836
+ contentShape(shape?: ContentShapeName | string): this;
837
+ /**
838
+ * SwiftUI `.fixedSize(horizontal:vertical:)` — hug content on those axes.
839
+ * Defaults both axes when called with no args.
840
+ */
841
+ fixedSize(spec?: FixedSizeSpec | boolean): this;
842
+ /**
843
+ * SwiftUI `.layoutPriority` — higher resists compression and claims free space.
844
+ * Web: flex-grow / flex-shrink (not a full multi-axis proposal solver).
845
+ */
846
+ layoutPriority(value: number): this;
847
+ /** SwiftUI `.compositingGroup()`. */
848
+ compositingGroup(): this;
849
+ /** SwiftUI `.mask` — shape name or CSS mask-image value. */
850
+ mask(shapeOrCss: ClipShapeName | "rectangle" | string): this;
851
+ /** SwiftUI `containerRelativeFrame`. */
852
+ containerRelativeFrame(axis?: ContainerRelativeFrameSpec["axis"] | ContainerRelativeFrameSpec, count?: number, span?: number): this;
853
+ /**
854
+ * SwiftUI `alignmentGuide` — named guide + absolute value or compute from size.
855
+ * ```ts
856
+ * Text('Hi').alignmentGuide('leading', (d) => d.width / 2)
857
+ * ```
858
+ */
859
+ alignmentGuide(guide: AlignmentGuideName, compute: number | ((dims: {
860
+ width: number;
861
+ height: number;
862
+ }) => number)): this;
863
+ /**
864
+ * SwiftUI `matchedGeometryEffect` — shared view-transition id + measured rect.
865
+ * ```ts
866
+ * Image(url).matchedGeometryEffect('hero', { namespace: 'gallery', isSource: true })
867
+ * ```
868
+ */
869
+ matchedGeometryEffect(id: string, namespaceOrOpts?: string | {
870
+ namespace?: string;
871
+ isSource?: boolean;
872
+ }): this;
873
+ /** SwiftUI `.preference(key:value:)` — contribute upward to `.onPreferenceChange`. */
874
+ preference<T>(key: PreferenceKeyDef<T>, value: T): this;
875
+ /** SwiftUI `.onPreferenceChange` — reduce descendant preferences. */
876
+ onPreferenceChange<T>(key: PreferenceKeyDef<T>, onChange: (value: T) => void): this;
877
+ /**
878
+ * SwiftUI `.safeAreaInset(edge:)` — reserve a bar on one edge; content fills the rest.
879
+ * Distinct from `SafeArea` (notch padding) and `proxy.safeAreaInsets` (read-only).
880
+ */
881
+ safeAreaInset(edge: SafeAreaInsetEdge, content: SafeAreaInsetSpec["content"], spacing?: number): this;
882
+ /**
883
+ * SwiftUI `.navigationTitle` — stores title for Scaffold (see `Scaffold.navigationTitle`).
884
+ * On non-Scaffold builders, sets `aria-label` / data attribute only (no extra chrome bar).
885
+ */
886
+ navigationTitle(title: string): this;
887
+ /**
888
+ * SwiftUI `.overlay(alignment:) { }` — layer above this view.
889
+ * ```ts
890
+ * Image(url).overlay(Text('NEW'), StackAlign.topTrailing)
891
+ * ```
892
+ */
893
+ overlay(child: FiboChild | (() => FiboChild), alignment?: StackAlign | keyof typeof StackAlign): this;
894
+ /**
895
+ * SwiftUI `.background(alignment:) { }` — layer behind this view.
896
+ */
897
+ background(child: FiboChild | (() => FiboChild), alignment?: StackAlign | keyof typeof StackAlign): this;
898
+ /** SwiftUI `onGeometryChange` — fires on mount + resize. */
899
+ onGeometryChange(handler: (rect: GeometryRect) => void): this;
612
900
  id(value: string): this;
613
901
  /**
614
902
  * Scroll target. Same as `.id()`, plus `scroll-margin-top` so the section
@@ -632,7 +920,18 @@ declare abstract class FiboBuilder {
632
920
  private setBoxShorthand;
633
921
  paddingHorizontal(value: string | number): this;
634
922
  paddingVertical(value: string | number): this;
923
+ /**
924
+ * SwiftUI `.padding`:
925
+ * - `.padding(8)` — all sides
926
+ * - `.padding(EdgeSet.horizontal, 12)` — Edge.Set + value
927
+ * - `.padding({ top: 8, leading: 12 })` — EdgeInsets
928
+ */
635
929
  padding(value: string | number): this;
930
+ padding(edges: EdgeSet, value: string | number): this;
931
+ padding(insets: EdgeInsetsValue): this;
932
+ /** SwiftUI `.padding` with {@link EdgeSet} — alias clarity. */
933
+ /** @deprecated Prefer `.padding(EdgeSet, n)` — same implementation. */
934
+ paddingEdges(edges: EdgeSet, value: string | number): this;
636
935
  marginHorizontal(value: string | number): this;
637
936
  marginVertical(value: string | number): this;
638
937
  margin(value: string | number): this;
@@ -742,6 +1041,9 @@ declare abstract class FiboBuilder {
742
1041
  * (the Scaffold body) cannot divide the viewport across these children.
743
1042
  * `400`, `'320px'`, `Size.full`, and `Space.md` all count. `flex(1)` afterwards
744
1043
  * opts back into sharing space.
1044
+ *
1045
+ * Percentages / `auto` do not lock `min-*` — `minWidth: 100%` on a flex
1046
+ * child fights clamping and lets long text blow past the ZStack box.
745
1047
  */
746
1048
  private lockAxis;
747
1049
  width(value: string | number): this;
@@ -772,8 +1074,58 @@ declare abstract class FiboBuilder {
772
1074
  translateX(value: Signal<number> | number): this;
773
1075
  translateY(value: Signal<number> | number): this;
774
1076
  scale(value: Signal<number> | number): this;
1077
+ /** SwiftUI `scaleEffect` — alias of {@link scale}. */
1078
+ scaleEffect(value: Signal<number> | number): this;
775
1079
  rotate(degrees: Signal<number> | number): this;
1080
+ /** SwiftUI `rotationEffect` — alias of {@link rotate} (degrees). */
1081
+ rotationEffect(degrees: Signal<number> | number): this;
1082
+ /**
1083
+ * SwiftUI `.allowsHitTesting` — when `false`, this view and descendants
1084
+ * ignore pointer hits (`pointer-events: none`).
1085
+ */
1086
+ allowsHitTesting(value?: boolean): this;
1087
+ /**
1088
+ * SwiftUI scroll target id — used by {@link ScrollViewReader} `.scrollTo(id)`.
1089
+ * Sets `data-scroll-id` on the host.
1090
+ */
1091
+ scrollTarget(id: string): this;
1092
+ /**
1093
+ * SwiftUI: taps on *containers* (ZStack / Column / …) only hit drawn content
1094
+ * unless `.contentShape(Rectangle())` is set. We default that shape when the
1095
+ * first gesture is attached and the caller did not set one — same as the
1096
+ * usual SwiftUI fix, without forcing it on chrome-only views.
1097
+ */
1098
+ protected ensureGestureContentShape(): void;
1099
+ /**
1100
+ * SwiftUI `.gesture` — attach Tap / LongPress / Drag / Magnify / Rotate / …
1101
+ * Chainable: each call wraps the previous (outermost = last).
1102
+ */
776
1103
  gesture(gesture: GestureBuilder): this;
1104
+ /** SwiftUI `.simultaneousGesture` — runs alongside other gestures (no steal). */
1105
+ simultaneousGesture(gesture: GestureBuilder): this;
1106
+ /** SwiftUI `.highPriorityGesture` — recognized before the view's own gestures. */
1107
+ highPriorityGesture(gesture: GestureBuilder): this;
1108
+ /**
1109
+ * Sugar for {@link TapGesture}`.onEnd(handler)`.
1110
+ * Note: `Button` / `List` / `ListTile` keep domain-specific `.onPress`.
1111
+ */
1112
+ onPress(handler: () => void): this;
1113
+ /** Flutter-style alias of {@link onPress}. */
1114
+ onTap(handler: () => void): this;
1115
+ /**
1116
+ * SwiftUI `onTapGesture(count:perform:)` — default count 1.
1117
+ * Pass a location callback for SpatialTap behavior.
1118
+ */
1119
+ onTapGesture(countOrHandler: number | ((location?: TapLocation) => void) | (() => void), handler?: ((location?: TapLocation) => void) | (() => void)): this;
1120
+ /**
1121
+ * SwiftUI `onLongPressGesture(minimumDuration:perform:onPressingChanged:)`.
1122
+ */
1123
+ onLongPressGesture(handlerOrOpts: (() => void) | {
1124
+ minimumDuration?: number;
1125
+ maximumDistance?: number;
1126
+ perform: () => void;
1127
+ onPressingChanged?: (pressing: boolean) => void;
1128
+ }, onPressingChanged?: (pressing: boolean) => void): this;
777
1129
  animation(config: Partial<AnimationOptions>): this;
778
1130
  protected hasStateManagement(): boolean;
779
1131
  className(className: string): this;
package/dist/structure.js CHANGED
@@ -1,14 +1,14 @@
1
- import { aA as r, aC as e, aB as o } from "./client-BzMPiV64.js";
2
- import { A as t, B as d, C as i, c as l, d as n, G as B, b as T, L as f, P as m, T as p, a as x } from "./index-B9YuBkEv.js";
1
+ import { aF as r, aH as e, aG as o } from "./client-3NdKI2xE.js";
2
+ import { A as C, B as d, C as i, c as l, d as n, G, b as T, L as f, P as m, T as p, a as x } from "./index-BaTO66yA.js";
3
3
  export {
4
- t as AssetCard,
4
+ C as AssetCard,
5
5
  d as Banner,
6
6
  r as Box,
7
7
  i as Card,
8
8
  e as Collapse,
9
9
  l as CollectionCard,
10
10
  n as ContentCard,
11
- B as Grid,
11
+ G as Grid,
12
12
  T as GridItem,
13
13
  o as List,
14
14
  f as ListTile,