@seatmap.pro/renderer 1.59.3 → 1.60.1

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.
Files changed (3) hide show
  1. package/lib/index.d.ts +128 -78
  2. package/lib/index.js +1 -1
  3. package/package.json +44 -24
package/lib/index.d.ts CHANGED
@@ -78,6 +78,25 @@ interface IBaseSector {
78
78
  * Whether the sector is currently selected.
79
79
  */
80
80
  selected?: boolean;
81
+ /**
82
+ * Shape metadata for the sector (GA section shapes with text, color, etc.)
83
+ */
84
+ shapes?: ReadonlyArray<IShapeMetadata>;
85
+ }
86
+ /**
87
+ * Shape metadata from the API response.
88
+ */
89
+ interface IShapeMetadata {
90
+ id?: string;
91
+ text?: string;
92
+ textColor?: string;
93
+ textPosition?: string;
94
+ width?: number;
95
+ height?: number;
96
+ top?: number;
97
+ left?: number;
98
+ angle?: number;
99
+ order?: number;
81
100
  }
82
101
  /**
83
102
  * Interface representing the schema data transfer object from the API.
@@ -122,8 +141,7 @@ interface IPlainSeatsDTO {
122
141
  * Contains the core properties of a seat as received from the backend.
123
142
  * @hidden
124
143
  */
125
- interface ISeatDTO extends IBaseSeat {
126
- }
144
+ type ISeatDTO = IBaseSeat;
127
145
  /**
128
146
  * Interface representing a row in the venue.
129
147
  * @hidden
@@ -140,8 +158,7 @@ interface IRowDTO {
140
158
  * Contains the core properties of a sector as received from the backend.
141
159
  * @hidden
142
160
  */
143
- interface ISectorDTO extends IBaseSector {
144
- }
161
+ type ISectorDTO = IBaseSector;
145
162
  /**
146
163
  * Interface representing the SVG background data transfer object from the API.
147
164
  * @hidden
@@ -437,22 +454,20 @@ interface IDragSrcEvent<T> {
437
454
  };
438
455
  shiftKey?: boolean;
439
456
  altKey?: boolean;
457
+ metaKey?: boolean;
440
458
  }
441
459
  /**
442
460
  * @hidden
443
461
  */
444
- interface IDragStartSrcEvent extends IDragSrcEvent<SrcEventType.DRAG_START> {
445
- }
462
+ type IDragStartSrcEvent = IDragSrcEvent<SrcEventType.DRAG_START>;
446
463
  /**
447
464
  * @hidden
448
465
  */
449
- interface IDragMoveSrcEvent extends IDragSrcEvent<SrcEventType.DRAG_MOVE> {
450
- }
466
+ type IDragMoveSrcEvent = IDragSrcEvent<SrcEventType.DRAG_MOVE>;
451
467
  /**
452
468
  * @hidden
453
469
  */
454
- interface IDragEndSrcEvent extends IDragSrcEvent<SrcEventType.DRAG_END> {
455
- }
470
+ type IDragEndSrcEvent = IDragSrcEvent<SrcEventType.DRAG_END>;
456
471
  /**
457
472
  * @hidden
458
473
  */
@@ -467,6 +482,7 @@ interface IClickSrcEvent {
467
482
  seat?: ISeat;
468
483
  shiftKey?: boolean;
469
484
  altKey?: boolean;
485
+ metaKey?: boolean;
470
486
  }
471
487
  /**
472
488
  * @hidden
@@ -521,6 +537,7 @@ interface IRectSelectDestEvent {
521
537
  isStart?: boolean;
522
538
  isFinish?: boolean;
523
539
  isRowsMode?: boolean;
540
+ isSectionsMode?: boolean;
524
541
  rect: {
525
542
  x: number;
526
543
  y: number;
@@ -614,6 +631,7 @@ interface ISectionClickDestEvent {
614
631
  y: number;
615
632
  };
616
633
  section: ISection;
634
+ isSectionsMode?: boolean;
617
635
  }
618
636
 
619
637
  /**
@@ -624,6 +642,7 @@ interface IGaInfo {
624
642
  name: string;
625
643
  transform: TransformArray;
626
644
  isTable?: boolean;
645
+ textColor?: string;
627
646
  }
628
647
  /**
629
648
  * @hidden
@@ -871,6 +890,14 @@ interface ISection {
871
890
  * The type of the section.
872
891
  */
873
892
  type?: string | null;
893
+ /**
894
+ * The total number of seats in the section.
895
+ */
896
+ seatCount?: number;
897
+ /**
898
+ * Text color for the section label (e.g., GA section name).
899
+ */
900
+ textColor?: string;
874
901
  }
875
902
  /**
876
903
  * Visual and interaction states that can be applied to entities
@@ -1686,6 +1713,15 @@ interface IRendererSettings {
1686
1713
  * Section is passed as a param to the handler (see ISection).
1687
1714
  */
1688
1715
  onSectionClick?: (section: ISection) => void;
1716
+ /**
1717
+ * Fires after section selection was updated in selectSections mode.
1718
+ *
1719
+ * @remarks
1720
+ *
1721
+ * Called with the full array of currently selected sections after any
1722
+ * selection change (single click toggle or rect drag selection).
1723
+ */
1724
+ onSectionsSelectionChange?: (sections: ISection[]) => void;
1689
1725
  /**
1690
1726
  * Fires before the zoom animation started.
1691
1727
  */
@@ -1897,6 +1933,11 @@ declare class OutlineLayer {
1897
1933
  constructor(context: Context);
1898
1934
  destroy(): void;
1899
1935
  applyOutlineAttributes(element: Element, source: OutlineSource, section: ISector): void;
1936
+ /**
1937
+ * Apply per-section textColor from shape metadata to text path elements.
1938
+ * Inline style overrides the generic CSS theme color.
1939
+ */
1940
+ private applyShapeTextColor;
1900
1941
  setOutlineStates(id: number | undefined, states: OutlineStates | null): void;
1901
1942
  getOutlineStates(id: number): IEntityStates | undefined;
1902
1943
  highlightSection(id?: number, clear?: boolean): void;
@@ -1988,7 +2029,7 @@ interface IStageLayer {
1988
2029
  redraw: () => void;
1989
2030
  drawOffscreenCanvas: () => void;
1990
2031
  drawOnscreenCanvas: (scale: number, translate: IPoint) => void;
1991
- getVisibleSeats: () => any[];
2032
+ getVisibleSeats: () => ISeat[];
1992
2033
  updateSize: () => void;
1993
2034
  sectionViewActive: boolean;
1994
2035
  getAnimationState: () => {
@@ -2007,61 +2048,6 @@ interface IStageLayer {
2007
2048
  captureSeatmap: () => Promise<HTMLImageElement | null>;
2008
2049
  }
2009
2050
 
2010
- /**
2011
- * @hidden
2012
- */
2013
- interface IRendererAnimation {
2014
- /**
2015
- * Optional animation type hint to allow branching behavior in the renderer
2016
- * - "transform": default zoom/pan animations using scale/translate
2017
- * - "pan": dedicated pan animation using translate only
2018
- * - "rotation": continuous 3D rotation animation
2019
- */
2020
- type?: 'transform' | 'pan' | 'rotation';
2021
- startTime?: number;
2022
- duration: number;
2023
- fromScale: number;
2024
- toScale: number;
2025
- fromTranslate?: IPoint;
2026
- translate?: IPoint;
2027
- toTranslate: IPoint;
2028
- relativeTranslate?: IPoint;
2029
- frame: number;
2030
- inProgress: boolean;
2031
- /**
2032
- * Custom per-frame handler used for non-transform animations (e.g., rotation)
2033
- * Receives high-resolution time and elapsed milliseconds since start
2034
- */
2035
- onFrame?: (now: number, elapsedMs: number) => void;
2036
- /**
2037
- * When true, the animation never auto-finishes and must be explicitly stopped
2038
- */
2039
- isContinuous?: boolean;
2040
- /**
2041
- * Rotation-specific fields used when type === 'rotation'
2042
- */
2043
- angle?: number;
2044
- lastRotationZ?: number;
2045
- /**
2046
- * 3D transform interpolation fields for combined animations
2047
- */
2048
- fromRotationZ?: number;
2049
- toRotationZ?: number;
2050
- fromTiltX?: number;
2051
- toTiltX?: number;
2052
- fromPerspectiveZ?: number;
2053
- toPerspectiveZ?: number;
2054
- /** Called once when the animation finishes */
2055
- onComplete?: () => void;
2056
- }
2057
- interface IRendererSequenceStep {
2058
- zoomTo?: number;
2059
- destination?: IPoint;
2060
- rotateTo?: number;
2061
- tiltTo?: number;
2062
- perspectiveTo?: number;
2063
- durationMs?: number;
2064
- }
2065
2051
  /**
2066
2052
  * Interface for the base Renderer functionality.
2067
2053
  * Defines the core methods and properties that all renderer implementations must provide.
@@ -2275,8 +2261,6 @@ interface IRenderer {
2275
2261
  clearMarkers: () => void;
2276
2262
  getMarkers: () => IMarker[];
2277
2263
  getResolvedMarkers: () => IResolvedMarker[];
2278
- }
2279
- interface IRenderer {
2280
2264
  /**
2281
2265
  * Runs a sequence of composite animations. Each step can include zoom, pan (via destination), and rotation.
2282
2266
  */
@@ -2290,6 +2274,61 @@ interface IRenderer {
2290
2274
  durationMs?: number;
2291
2275
  }) => void;
2292
2276
  }
2277
+ /**
2278
+ * @hidden
2279
+ */
2280
+ interface IRendererAnimation {
2281
+ /**
2282
+ * Optional animation type hint to allow branching behavior in the renderer
2283
+ * - "transform": default zoom/pan animations using scale/translate
2284
+ * - "pan": dedicated pan animation using translate only
2285
+ * - "rotation": continuous 3D rotation animation
2286
+ */
2287
+ type?: 'transform' | 'pan' | 'rotation';
2288
+ startTime?: number;
2289
+ duration: number;
2290
+ fromScale: number;
2291
+ toScale: number;
2292
+ fromTranslate?: IPoint;
2293
+ translate?: IPoint;
2294
+ toTranslate: IPoint;
2295
+ relativeTranslate?: IPoint;
2296
+ frame: number;
2297
+ inProgress: boolean;
2298
+ /**
2299
+ * Custom per-frame handler used for non-transform animations (e.g., rotation)
2300
+ * Receives high-resolution time and elapsed milliseconds since start
2301
+ */
2302
+ onFrame?: (now: number, elapsedMs: number) => void;
2303
+ /**
2304
+ * When true, the animation never auto-finishes and must be explicitly stopped
2305
+ */
2306
+ isContinuous?: boolean;
2307
+ /**
2308
+ * Rotation-specific fields used when type === 'rotation'
2309
+ */
2310
+ angle?: number;
2311
+ lastRotationZ?: number;
2312
+ /**
2313
+ * 3D transform interpolation fields for combined animations
2314
+ */
2315
+ fromRotationZ?: number;
2316
+ toRotationZ?: number;
2317
+ fromTiltX?: number;
2318
+ toTiltX?: number;
2319
+ fromPerspectiveZ?: number;
2320
+ toPerspectiveZ?: number;
2321
+ /** Called once when the animation finishes */
2322
+ onComplete?: () => void;
2323
+ }
2324
+ interface IRendererSequenceStep {
2325
+ zoomTo?: number;
2326
+ destination?: IPoint;
2327
+ rotateTo?: number;
2328
+ tiltTo?: number;
2329
+ perspectiveTo?: number;
2330
+ durationMs?: number;
2331
+ }
2293
2332
 
2294
2333
  type DataManagerEvent = 'sectionsChanged' | 'seatsChanged' | 'dataInvalidated' | 'dataLoaded';
2295
2334
  type DataManagerEventCallback = (entityId?: number) => void;
@@ -2710,7 +2749,7 @@ declare class Renderer implements IRenderer {
2710
2749
  *
2711
2750
  * @param ids Array of internal seat IDs
2712
2751
  */
2713
- enableSeatsByIds(ids: number[]): void;
2752
+ enableSeatsByIds(_ids: number[]): void;
2714
2753
  /**
2715
2754
  * Marks seats as unavailable and removes them from cart.
2716
2755
  *
@@ -2772,7 +2811,7 @@ declare class Renderer implements IRenderer {
2772
2811
  */
2773
2812
  getSeatSelection(): IExtendedSeat[];
2774
2813
  setSectionSelection(sections?: number[] | string[]): void;
2775
- getSvgSectionBySelection(): ISectorDTO[];
2814
+ getSvgSectionBySelection(): IBaseSector[];
2776
2815
  disableSvgSectionsByIds(ids: number[], options?: {
2777
2816
  resetAll?: boolean;
2778
2817
  }): void;
@@ -2813,7 +2852,7 @@ declare class Renderer implements IRenderer {
2813
2852
  *
2814
2853
  * @returns Row data
2815
2854
  */
2816
- getRowById(id: number): IRowDTO;
2855
+ getRowById(id: number): IRowDTO | undefined;
2817
2856
  /**
2818
2857
  * Returns only visible seats with coords relative to canvas
2819
2858
  */
@@ -2821,9 +2860,12 @@ declare class Renderer implements IRenderer {
2821
2860
  getSectionsWithCoords(): ISectionWithCoords[];
2822
2861
  private handleDestPan;
2823
2862
  private handleDestRectSelect;
2863
+ private handleRectSelectSections;
2864
+ private fireSelectedSections;
2824
2865
  private handleDestDeselect;
2825
2866
  private getGaSectionByOutline;
2826
2867
  private getSectionByOutline;
2868
+ private buildSectionFromId;
2827
2869
  private getSectorRectByOutline;
2828
2870
  /**
2829
2871
  * Handles pan-zoom destination events from the state machine.
@@ -3021,7 +3063,7 @@ interface IAdminRendererSettings extends IRendererSettings {
3021
3063
  * Extends the base Renderer with admin-specific functionality.
3022
3064
  */
3023
3065
  declare class SeatmapAdminRenderer extends Renderer {
3024
- static readonly VERSION = "1.59.3";
3066
+ static readonly VERSION = "1.60.1";
3025
3067
  protected apiClient: BookingApiClient;
3026
3068
  /**
3027
3069
  * Creates a new instance of the AdminRenderer.
@@ -3062,8 +3104,13 @@ declare class SeatmapAdminRenderer extends Renderer {
3062
3104
  /**
3063
3105
  * Sets the interaction mode for the component and updates visibility of the outline layer.
3064
3106
  *
3065
- * @param mode - The interaction mode to set. When set to 'pan', the outline layer is hidden.
3066
- * For any other mode, the outline layer is shown.
3107
+ * @param mode - The interaction mode to set:
3108
+ * - 'pan': Pan/zoom navigation, outline layer hidden
3109
+ * - 'select': Seat selection (click/drag), GA section click supported
3110
+ * - 'selectRows': Row-based seat selection
3111
+ * - 'selectSections': Section-level click (fires onSectionClick for all section types)
3112
+ *
3113
+ * When set to 'pan', the outline layer is hidden. For any other mode, the outline layer is shown.
3067
3114
  *
3068
3115
  * @returns A boolean indicating whether the mode change was successful.
3069
3116
  * Returns true if the outline layer exists and the mode was set.
@@ -3074,8 +3121,11 @@ declare class SeatmapAdminRenderer extends Renderer {
3074
3121
  * // Set mode to 'pan' - will hide outline layer
3075
3122
  * component.setMode('pan');
3076
3123
  *
3077
- * // Set mode to 'select' - will show outline layer
3124
+ * // Set mode to 'select' - will show outline layer, seat-level interactions
3078
3125
  * component.setMode('select');
3126
+ *
3127
+ * // Set mode to 'selectSections' - section clicks fire onSectionClick for all sections
3128
+ * component.setMode('selectSections');
3079
3129
  * ```
3080
3130
  */
3081
3131
  setMode(mode: string): boolean;
@@ -3175,7 +3225,7 @@ interface IBookingRendererSettings extends IRendererSettings {
3175
3225
  * Extends the base Renderer with booking-specific functionality.
3176
3226
  */
3177
3227
  declare class SeatmapBookingRenderer extends Renderer {
3178
- static readonly VERSION = "1.59.3";
3228
+ static readonly VERSION = "1.60.1";
3179
3229
  private apiClient;
3180
3230
  private stats;
3181
3231
  private tags?;
@@ -3263,7 +3313,7 @@ declare class SeatmapBookingRenderer extends Renderer {
3263
3313
  * Package version information
3264
3314
  * This file is automatically updated during the build process
3265
3315
  */
3266
- declare const VERSION = "1.59.3";
3316
+ declare const VERSION = "1.60.1";
3267
3317
 
3268
3318
  declare const defaultZoomSettings: IZoomSettings;
3269
3319
  declare const mergeSettings: (defaults: IRendererSettings, settings?: Partial<IRendererSettings>) => IRendererSettings & Partial<IRendererSettings>;
@@ -3306,4 +3356,4 @@ declare class RotationAnimation {
3306
3356
  getAnimation(): IRotationAnimation | null;
3307
3357
  }
3308
3358
 
3309
- export { BookingApiClient, type ById, type ColorById, type ColorSequenceSettings, DataManager, type DataManagerEvent, type DataManagerEventCallback, type DeepPartial, type DestEvent, DestEventType, type IAdminRendererSettings, type IBackgroundImageLoadedEvent, type IBaseSeat, type IBaseSector, type IBasicSeatStyle, type IBeforeSeatDrawEvent, type IBookingRendererSettings, type ICart, type ICartGa, type ICartSeat, type IClickSrcEvent, type IColoredPrice, type IConfigurationDTO, type IDeselectDestEvent, type IDragEndSrcEvent, type IDragMoveSrcEvent, type IDragStartSrcEvent, type IEntityStates, type IExtendedSeat, type ILoadProgressEvent, type ILoaderSettings, type ILoaderTheme, type IMarker, type IMarkerSettings, type IMinimapSettings, type IMouseMoveSrcEvent, type IPanDestEvent, type IPanZoomDestEvent, type IPlainSeatsDTO, type IPngBackgroundDTO, type IPoint, type IPrice, type IPriceDTO, type IPriceId, type IPriceListDTO, type IRectSelectDestEvent, type IRemovedCartGa, type IRenderer, type IRendererAnimation, type IRendererMachineContext, type IRendererSeatStyleSettings, type IRendererSettings, type IRendererSvgSectionStylesSetting, type IRendererTheme, type IResolvedMarker, type IRowDTO, type ISVGBackgroundDTO, type ISchemaDTO, type ISeat, type ISeatCartSwitchDestEvent, type ISeatDTO, type ISeatMetadata, type ISeatMouseEnterDestEvent, type ISeatMouseLeaveDestEvent, type ISeatPriceScheme, type ISeatSelectDestEvent, type ISeatStyle, type ISection, type ISectionClickDestEvent, type ISectionMetadata, type ISectionMouseEnterDestEvent, type ISectionMouseLeaveDestEvent, type ISectionRect, type ISectionWithCoords, type ISector, type ISectorDTO, type ISpecialPrice, type ISpecialState, type ISvgSectionStyle, type IVenueDTO, type IVisibilitySettings, type IZoomSettings, type InteractionZoomStrategy, type InteractionZoomStrategyType, type LoaderStyle, type LoadingPhase, type MarkerAppearance, type MarkerTarget, type MinimapPosition, type Nullable, Renderer, type RendererMachine, type RendererMachineReducer, type RendererMachineService, RendererSelectMode, RendererTargetType, type RequestMetrics, RotationAnimation, type SeatFilter, type SeatInteractionState, SeatmapAdminRenderer, SeatmapBookingRenderer, type SrcEvent, SrcEventType, StateManager, type StateManagerEvent, type StateManagerEventCallback, type TransformArray, VERSION, convertPricesToColored, convertPricesToColoredById, defaultZoomSettings, mergeSettings, sortPrices };
3359
+ export { BookingApiClient, type ById, type ColorById, type ColorSequenceSettings, DataManager, type DataManagerEvent, type DataManagerEventCallback, type DeepPartial, type DestEvent, DestEventType, type IAdminRendererSettings, type IBackgroundImageLoadedEvent, type IBaseSeat, type IBaseSector, type IBasicSeatStyle, type IBeforeSeatDrawEvent, type IBookingRendererSettings, type ICart, type ICartGa, type ICartSeat, type IClickSrcEvent, type IColoredPrice, type IConfigurationDTO, type IDeselectDestEvent, type IDragEndSrcEvent, type IDragMoveSrcEvent, type IDragStartSrcEvent, type IEntityStates, type IExtendedSeat, type ILoadProgressEvent, type ILoaderSettings, type ILoaderTheme, type IMarker, type IMarkerSettings, type IMinimapSettings, type IMouseMoveSrcEvent, type IPanDestEvent, type IPanZoomDestEvent, type IPlainSeatsDTO, type IPngBackgroundDTO, type IPoint, type IPrice, type IPriceDTO, type IPriceId, type IPriceListDTO, type IRectSelectDestEvent, type IRemovedCartGa, type IRenderer, type IRendererAnimation, type IRendererMachineContext, type IRendererSeatStyleSettings, type IRendererSettings, type IRendererSvgSectionStylesSetting, type IRendererTheme, type IResolvedMarker, type IRowDTO, type ISVGBackgroundDTO, type ISchemaDTO, type ISeat, type ISeatCartSwitchDestEvent, type ISeatDTO, type ISeatMetadata, type ISeatMouseEnterDestEvent, type ISeatMouseLeaveDestEvent, type ISeatPriceScheme, type ISeatSelectDestEvent, type ISeatStyle, type ISection, type ISectionClickDestEvent, type ISectionMetadata, type ISectionMouseEnterDestEvent, type ISectionMouseLeaveDestEvent, type ISectionRect, type ISectionWithCoords, type ISector, type ISectorDTO, type IShapeMetadata, type ISpecialPrice, type ISpecialState, type ISvgSectionStyle, type IVenueDTO, type IVisibilitySettings, type IZoomSettings, type InteractionZoomStrategy, type InteractionZoomStrategyType, type LoaderStyle, type LoadingPhase, type MarkerAppearance, type MarkerTarget, type MinimapPosition, type Nullable, Renderer, type RendererMachine, type RendererMachineReducer, type RendererMachineService, RendererSelectMode, RendererTargetType, type RequestMetrics, RotationAnimation, type SeatFilter, type SeatInteractionState, SeatmapAdminRenderer, SeatmapBookingRenderer, type SrcEvent, SrcEventType, StateManager, type StateManagerEvent, type StateManagerEventCallback, type TransformArray, VERSION, convertPricesToColored, convertPricesToColoredById, defaultZoomSettings, mergeSettings, sortPrices };