{"version":3,"file":"bespunky-angular-cdk-timeline-abstraction-ticks.mjs","sources":["../../../../libs/angular-cdk/timeline/abstraction/ticks/src/core/timeline-tick.ts","../../../../libs/angular-cdk/timeline/abstraction/ticks/src/render/timeline-tick-renderer.ts","../../../../libs/angular-cdk/timeline/abstraction/ticks/src/render/tick-data.ts","../../../../libs/angular-cdk/timeline/abstraction/ticks/src/bespunky-angular-cdk-timeline-abstraction-ticks.ts"],"sourcesContent":["import { BehaviorSubject, Observable   } from 'rxjs';\nimport { ViewContainerRef, TemplateRef } from '@angular/core';\nimport { Destroyable                   } from '@bespunky/angular-zen/core';\n\nimport { TimelineCamera, TimelineConfig                                 } from '@bespunky/angular-cdk/timeline/abstraction';\nimport { TickData                                                       } from '../render/tick-data';\nimport { DatesBetweenGenerator, DayFactor, TickLabeler, WidthCalculator } from './types';\n\n/**\n * Represents a tick scale and provides tools to easily render it.\n *\n * @export\n * @abstract\n * @class TimelineTick\n */\nexport abstract class TimelineTick extends Destroyable\n{\n    /**\n     * The id of the tick scale (e.g. 'years', 'months', etc.).\n     * \n     * Currently not used anywhere. Kept for future reference.\n     *\n     * @defaultValue ''\n     * @type {BehaviorSubject<string>}\n     */\n    public readonly id          : BehaviorSubject<string>                = new BehaviorSubject('');\n    /**\n     * The minimum level of zoom at which the tick scale should render on the timeline. When the zoom level\n     * reaches a lower number, the tick scale will disappear from the screen.\n     *\n     * @defaultValue 0\n     * @type {BehaviorSubject<number>}\n     */\n    public readonly minZoom     : BehaviorSubject<number>                = new BehaviorSubject(0);\n    /**\n     * The maximum level of zoom at which the tick scale should render on the timeline. When the zoom level\n     * reaches a higher number, the tick scale will disappear from the screen.\n     *\n     * @defaultValue 100\n     * @type {BehaviorSubject<number>}\n     */\n    public readonly maxZoom     : BehaviorSubject<number>                = new BehaviorSubject(100);\n    /**\n     * A labeling function that will be used to produce and provide the label matching a specific date on\n     * the timeline. When not provided, the date will be used as the value.\n     *\n     * @type {BehaviorSubject<TickLabeler>}\n     */\n    public readonly label       : BehaviorSubject<TickLabeler>           = new BehaviorSubject((value => value) as TickLabeler);\n    /**\n     * A function that generates an array of all dates that exist between two specified dates, truncated to\n     * the level of the tick. The returned dates will be used to calculate the position of the ticks to render\n     * for this scale.\n     * \n     * For example, between 20/12/2020 11:30 and 5/3/2021 12:00 there are:\n     * 1 date for a year  (1/1/2021 00:00)\n     * 3 dates for months (1/1/2021 00:00, 1/2/2021 00:00, 1/3/2021 00:00)\n     * ...\n     *\n     * @defaultValue () => []\n     * @type {BehaviorSubject<DatesBetweenGenerator>}\n     */\n    public readonly datesBetween: BehaviorSubject<DatesBetweenGenerator> = new BehaviorSubject((() => []) as DatesBetweenGenerator);\n    /**\n     * The factor defining the relationship between one day and the tick level.\n     *\n     * Example:\n     * For hours, this would be 24. \n     * For minutes, this would be 24 hours x 60 minutes = 1440.\n     * For months, this would be a function that calculates the number of days according to the specified month.\n     * \n     * @defaultValue 1\n     * @type {BehaviorSubject<DayFactor>}\n     */\n    public readonly dayFactor   : BehaviorSubject<DayFactor>             = new BehaviorSubject(1 as DayFactor);\n\n    /**\n     * The view container in which ticks should be rendered.\n     *\n     * @abstract\n     * @type {ViewContainerRef}\n     */\n    abstract readonly view    : ViewContainerRef;\n    /**\n     * The reference to the template to duplicate and render for each tick on the screen.\n     *\n     * @abstract\n     * @type {TemplateRef<unknown>}\n     */\n    abstract readonly template: TemplateRef<unknown>;\n\n    /**\n     * Notifies when ticks should render and unrender. Also used as an activation switch for `itemsToRender`.\n     * \n     * The observable depends on the current zoom level and the defined min/maxZoom properties.\n     *\n     * @abstract\n     * @type {Observable<boolean>}\n     */\n    abstract readonly shouldRender: Observable<boolean>;\n    /**\n     * Provides the function that will be used to calculate the width of a specific tick according to the day factor.\n     *\n     * @abstract\n     * @type {Observable<WidthCalculator>}\n     */\n    abstract readonly width        : Observable<WidthCalculator>;\n    /**\n     * Generates the tick items to render according to what fits on the screen.\n     * The generated array includes the additional items needed as virtualization buffer for both sides as specified in\n     * the `state.ticksBuffer` factor.\n     *\n     * The observable depends on zoom, view center, view bounds, buffer size, and base tick size. Any change\n     * would trigger the regeneration of the items.\n     * \n     * @abstract\n     * @type {Observable<TickData[]>}\n     */\n    abstract readonly itemsToRender: Observable<TickData[]>;\n\n    abstract readonly config: TimelineConfig;\n    abstract readonly camera: TimelineCamera;\n}","import { Destroyable } from '@bespunky/angular-zen/core';\n\nimport { TimelineTick } from '../core/timeline-tick';\nimport { TickData     } from './tick-data';\nimport { RenderedTick } from './rendered-tick';\n\n/**\n * Provides the bases for a services that handles tick rendering.\n *\n * @export\n * @abstract\n * @class TimelineTickRenderer\n * @extends {Destroyable}\n */\nexport abstract class TimelineTickRenderer extends Destroyable\n{\n    /**\n     * A map of all rendered tick views for each tick level. Used for view recycling.\n     *\n     * @type {{ [tickId: string]: RenderedTick[] }}\n     */\n    public readonly ticksInView: { [tickId: string]: RenderedTick[] } = {};\n    \n    abstract renderTicks(tick: TimelineTick, items: TickData[]): void;\n    abstract unrenderTicks(tick: TimelineTick): void;\n}","export class TickData\n{\n    constructor(\n        public readonly positionX      : number,\n        public readonly positionY      : number,\n        public readonly screenPositionX: number,\n        public readonly screenPositionY: number,\n        public readonly value          : Date,\n        public readonly width          : number,\n        public readonly label          : string | number,\n        public readonly sizeUnit       : number\n    ) { }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAQA;;;;;;AAMG;AACG,MAAgB,YAAa,SAAQ,WAAW,CAAA;AAAtD,IAAA,WAAA,GAAA;;AAEI;;;;;;;AAOG;AACa,QAAA,IAAA,CAAA,EAAE,GAAqD,IAAI,eAAe,CAAC,EAAE,CAAC,CAAC;AAC/F;;;;;;AAMG;AACa,QAAA,IAAA,CAAA,OAAO,GAAgD,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;AAC9F;;;;;;AAMG;AACa,QAAA,IAAA,CAAA,OAAO,GAAgD,IAAI,eAAe,CAAC,GAAG,CAAC,CAAC;AAChG;;;;;AA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