@internetarchive/histogram-date-range 1.2.2-alpha-webdev7377.2 → 1.2.2-alpha-webdev7377.3

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.
@@ -272,12 +272,15 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
272
272
  const x = target.x.baseVal.value + this.sliderWidth / 2;
273
273
  const dataset = target.dataset;
274
274
  const itemsText = `item${dataset.numItems !== '1' ? 's' : ''}`;
275
+ const datesText = dataset.binStart === dataset.binEnd
276
+ ? `${dataset.binStart}` // If start/end are the same, just render a single value
277
+ : `${dataset.binStart} - ${dataset.binEnd}`;
275
278
  const formattedNumItems = Number(dataset.numItems).toLocaleString();
276
279
  this._tooltipOffset =
277
280
  x + (this._binWidth - this.sliderWidth - this.tooltipWidth) / 2;
278
281
  this._tooltipContent = html `
279
282
  ${formattedNumItems} ${itemsText}<br />
280
- ${dataset.binStart} - ${dataset.binEnd}
283
+ ${datesText}
281
284
  `;
282
285
  this._tooltipVisible = true;
283
286
  }
@@ -1 +1 @@
1
- {"version":3,"file":"histogram-date-range.js","sourceRoot":"","sources":["../../src/histogram-date-range.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAC;AAChD,OAAO,KAAK,MAAM,WAAW,CAAC;AAC9B,OAAO,iBAAiB,MAAM,oCAAoC,CAAC;AACnE,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,OAAO,EAEP,GAAG,GAGJ,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEhC,kFAAkF;AAClF,MAAM,KAAK,GAAG,GAAG,CAAC;AAClB,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,MAAM,YAAY,GAAG,EAA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Z;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAAkB;AACnB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gDAAqB;AAElB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8DAA4B;AAG/C;IAAR,KAAK,EAAE;0DAA4B;AAC3B;IAAR,KAAK,EAAE;2DAA0C;AACzC;IAAR,KAAK,EAAE;2DAAiC;AAChC;IAAR,KAAK,EAAE;uDAA6B;AAC5B;IAAR,KAAK,EAAE;sDAA4B;AA6HP;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAE3B;AAQW;IAAX,QAAQ,EAAE;yDAEV;AAsBW;IAAX,QAAQ,EAAE;yDAEV;AA3LU,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAk2B9B;SAl2BY,kBAAkB","sourcesContent":["import '@internetarchive/ia-activity-indicator';\nimport dayjs from 'dayjs/esm';\nimport customParseFormat from 'dayjs/esm/plugin/customParseFormat';\nimport {\n css,\n html,\n LitElement,\n nothing,\n PropertyValues,\n svg,\n SVGTemplateResult,\n TemplateResult,\n} from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\n\ndayjs.extend(customParseFormat);\n\n// these values can be overridden via the component's HTML (camelCased) attributes\nconst WIDTH = 180;\nconst HEIGHT = 40;\nconst SLIDER_WIDTH = 10;\nconst TOOLTIP_WIDTH = 125;\nconst TOOLTIP_HEIGHT = 30;\nconst DATE_FORMAT = 'YYYY';\nconst MISSING_DATA = 'no data';\nconst UPDATE_DEBOUNCE_DELAY_MS = 0;\n\n// this constant is not set up to be overridden\nconst SLIDER_CORNER_SIZE = 4;\n\n// these CSS custom props can be overridden from the HTML that is invoking this component\nconst sliderColor = css`var(--histogramDateRangeSliderColor, #4B65FE)`;\nconst selectedRangeColor = css`var(--histogramDateRangeSelectedRangeColor, #DBE0FF)`;\nconst barIncludedFill = css`var(--histogramDateRangeBarIncludedFill, #2C2C2C)`;\nconst activityIndicatorColor = css`var(--histogramDateRangeActivityIndicator, #2C2C2C)`;\nconst barExcludedFill = css`var(--histogramDateRangeBarExcludedFill, #CCCCCC)`;\nconst inputRowMargin = css`var(--histogramDateRangeInputRowMargin, 0)`;\nconst inputBorder = css`var(--histogramDateRangeInputBorder, 0.5px solid #2C2C2C)`;\nconst inputWidth = css`var(--histogramDateRangeInputWidth, 35px)`;\nconst inputFontSize = css`var(--histogramDateRangeInputFontSize, 1.2rem)`;\nconst inputFontFamily = css`var(--histogramDateRangeInputFontFamily, sans-serif)`;\nconst tooltipBackgroundColor = css`var(--histogramDateRangeTooltipBackgroundColor, #2C2C2C)`;\nconst tooltipTextColor = css`var(--histogramDateRangeTooltipTextColor, #FFFFFF)`;\nconst tooltipFontSize = css`var(--histogramDateRangeTooltipFontSize, 1.1rem)`;\nconst tooltipFontFamily = css`var(--histogramDateRangeTooltipFontFamily, sans-serif)`;\n\ntype SliderId = 'slider-min' | 'slider-max';\n\ninterface HistogramItem {\n value: number;\n height: number;\n binStart: string;\n binEnd: string;\n}\n\ninterface BarDataset extends DOMStringMap {\n numItems: string;\n binStart: string;\n binEnd: string;\n}\n\n@customElement('histogram-date-range')\nexport class HistogramDateRange extends LitElement {\n /* eslint-disable lines-between-class-members */\n\n // public reactive properties that can be set via HTML attributes\n @property({ type: Number }) width = WIDTH;\n @property({ type: Number }) height = HEIGHT;\n @property({ type: Number }) sliderWidth = SLIDER_WIDTH;\n @property({ type: Number }) tooltipWidth = TOOLTIP_WIDTH;\n @property({ type: Number }) tooltipHeight = TOOLTIP_HEIGHT;\n @property({ type: Number }) updateDelay = UPDATE_DEBOUNCE_DELAY_MS;\n @property({ type: String }) dateFormat = DATE_FORMAT;\n /** Optional; falls back to `dateFormat` if not provided */\n @property({ type: String }) tooltipDateFormat?: string;\n @property({ type: String }) missingDataMessage = MISSING_DATA;\n @property({ type: String }) minDate = '';\n @property({ type: String }) maxDate = '';\n @property({ type: Boolean }) disabled = false;\n @property({ type: Array }) bins: number[] = [];\n /** If true, update events will not be canceled by the date inputs receiving focus */\n @property({ type: Boolean }) updateWhileFocused = false;\n\n // internal reactive properties not exposed as attributes\n @state() private _tooltipOffset = 0;\n @state() private _tooltipContent?: TemplateResult;\n @state() private _tooltipVisible = false;\n @state() private _isDragging = false;\n @state() private _isLoading = false;\n\n // non-reactive properties (changes don't auto-trigger re-rendering)\n private _minSelectedDate = '';\n private _maxSelectedDate = '';\n private _minDateMS = 0;\n private _maxDateMS = 0;\n private _dragOffset = 0;\n private _histWidth = 0;\n private _binWidth = 0;\n private _currentSlider?: SVGRectElement;\n private _histData: HistogramItem[] = [];\n private _emitUpdatedEventTimer?: ReturnType<typeof setTimeout>;\n private _previousDateRange = '';\n\n /* eslint-enable lines-between-class-members */\n\n disconnectedCallback(): void {\n this.removeListeners();\n super.disconnectedCallback();\n }\n\n willUpdate(changedProps: PropertyValues): void {\n // check for changes that would affect bin data calculations\n if (\n changedProps.has('bins') ||\n changedProps.has('minDate') ||\n changedProps.has('maxDate') ||\n changedProps.has('minSelectedDate') ||\n changedProps.has('maxSelectedDate') ||\n changedProps.has('width') ||\n changedProps.has('height')\n ) {\n this.handleDataUpdate();\n }\n }\n\n /**\n * Set private properties that depend on the attribute bin data\n *\n * We're caching these values and not using getters to avoid recalculating all\n * of the hist data every time the user drags a slider or hovers over a bar\n * creating a tooltip.\n */\n private handleDataUpdate(): void {\n if (!this.hasBinData) {\n return;\n }\n this._histWidth = this.width - this.sliderWidth * 2;\n this._minDateMS = this.getMSFromString(this.minDate);\n this._maxDateMS = this.getMSFromString(this.maxDate);\n this._binWidth = this._histWidth / this._numBins;\n this._previousDateRange = this.currentDateRangeString;\n this._histData = this.calculateHistData();\n this.minSelectedDate = this.minSelectedDate\n ? this.minSelectedDate\n : this.minDate;\n this.maxSelectedDate = this.maxSelectedDate\n ? this.maxSelectedDate\n : this.maxDate;\n }\n\n /**\n * Rounds the given timestamp to the nearest start of a new month\n */\n private roundToMonth(timestamp: number): number {\n const date = new Date(timestamp);\n const [y, m, d] = [date.getFullYear(), date.getMonth(), date.getDate()];\n\n return d < 15\n ? new Date(y, m, 1).getTime()\n : new Date(y, m + 1, 1).getTime();\n }\n\n private calculateHistData(): HistogramItem[] {\n const { bins, height, dateRangeMS, _numBins, _minDateMS } = this;\n const minValue = Math.min(...this.bins);\n const maxValue = Math.max(...this.bins);\n // if there is no difference between the min and max values, use a range of\n // 1 because log scaling will fail if the range is 0\n const valueRange = minValue === maxValue ? 1 : Math.log1p(maxValue);\n const valueScale = height / valueRange;\n const dateScale = dateRangeMS / _numBins;\n return bins.map((v: number, i: number) => {\n const binStartMS = this.roundToMonth(i * dateScale + _minDateMS);\n const binEndMS = this.roundToMonth((i + 1) * dateScale + _minDateMS) - 1;\n return {\n value: v,\n // use log scaling for the height of the bar to prevent tall bars from\n // making the smaller ones too small to see\n height: Math.floor(Math.log1p(v) * valueScale),\n binStart: this.formatDate(binStartMS, this.resolvedTooltipDateFormat),\n binEnd: this.formatDate(binEndMS, this.resolvedTooltipDateFormat),\n };\n });\n }\n\n private get hasBinData(): boolean {\n return this._numBins > 0;\n }\n\n private get _numBins(): number {\n if (!this.bins || !this.bins.length) {\n return 0;\n }\n return this.bins.length;\n }\n\n private get histogramLeftEdgeX(): number {\n return this.sliderWidth;\n }\n\n private get histogramRightEdgeX(): number {\n return this.width - this.sliderWidth;\n }\n\n /**\n * Returns the consumer-specified tooltip date format if set, falling back to\n * the general `dateFormat` property and then the default format if none is set.\n */\n private get resolvedTooltipDateFormat(): string {\n return this.tooltipDateFormat ?? this.dateFormat ?? DATE_FORMAT;\n }\n\n /** component's loading (and disabled) state */\n @property({ type: Boolean }) get loading(): boolean {\n return this._isLoading;\n }\n\n set loading(value: boolean) {\n this.disabled = value;\n this._isLoading = value;\n }\n\n /** formatted minimum date of selected date range */\n @property() get minSelectedDate(): string {\n return this.formatDate(this.getMSFromString(this._minSelectedDate));\n }\n\n /** updates minSelectedDate if new date is valid */\n set minSelectedDate(rawDate: string) {\n if (!this._minSelectedDate) {\n // because the values needed to calculate valid max/min values are not\n // available during the lit init when it's populating properties from\n // attributes, fall back to just the raw date if nothing is already set\n this._minSelectedDate = rawDate;\n return;\n }\n const proposedDateMS = this.getMSFromString(rawDate);\n const isValidDate = !Number.isNaN(proposedDateMS);\n const isNotTooRecent =\n proposedDateMS <= this.getMSFromString(this.maxSelectedDate);\n if (isValidDate && isNotTooRecent) {\n this._minSelectedDate = this.formatDate(proposedDateMS);\n }\n this.requestUpdate();\n }\n\n /** formatted maximum date of selected date range */\n @property() get maxSelectedDate(): string {\n return this.formatDate(this.getMSFromString(this._maxSelectedDate));\n }\n\n /** updates maxSelectedDate if new date is valid */\n set maxSelectedDate(rawDate: string) {\n if (!this._maxSelectedDate) {\n // because the values needed to calculate valid max/min values are not\n // available during the lit init when it's populating properties from\n // attributes, fall back to just the raw date if nothing is already set\n this._maxSelectedDate = rawDate;\n return;\n }\n const proposedDateMS = this.getMSFromString(rawDate);\n const isValidDate = !Number.isNaN(proposedDateMS);\n const isNotTooOld =\n proposedDateMS >= this.getMSFromString(this.minSelectedDate);\n if (isValidDate && isNotTooOld) {\n this._maxSelectedDate = this.formatDate(proposedDateMS);\n }\n this.requestUpdate();\n }\n\n /** horizontal position of min date slider */\n get minSliderX(): number {\n const x = this.translateDateToPosition(this.minSelectedDate);\n return this.validMinSliderX(x);\n }\n\n /** horizontal position of max date slider */\n get maxSliderX(): number {\n const x = this.translateDateToPosition(this.maxSelectedDate);\n return this.validMaxSliderX(x);\n }\n\n private get dateRangeMS(): number {\n return this._maxDateMS - this._minDateMS;\n }\n\n private showTooltip(e: PointerEvent): void {\n if (this._isDragging || this.disabled) {\n return;\n }\n const target = e.currentTarget as SVGRectElement;\n const x = target.x.baseVal.value + this.sliderWidth / 2;\n const dataset = target.dataset as BarDataset;\n const itemsText = `item${dataset.numItems !== '1' ? 's' : ''}`;\n const formattedNumItems = Number(dataset.numItems).toLocaleString();\n\n this._tooltipOffset =\n x + (this._binWidth - this.sliderWidth - this.tooltipWidth) / 2;\n\n this._tooltipContent = html`\n ${formattedNumItems} ${itemsText}<br />\n ${dataset.binStart} - ${dataset.binEnd}\n `;\n this._tooltipVisible = true;\n }\n\n private hideTooltip(): void {\n this._tooltipContent = undefined;\n this._tooltipVisible = false;\n }\n\n // use arrow functions (rather than standard JS class instance methods) so\n // that `this` is bound to the histogramDateRange object and not the event\n // target. for more info see\n // https://lit-element.polymer-project.org/guide/events#using-this-in-event-listeners\n private drag = (e: PointerEvent): void => {\n // prevent selecting text or other ranges while dragging, especially in Safari\n e.preventDefault();\n if (this.disabled) {\n return;\n }\n this.setDragOffset(e);\n this._isDragging = true;\n this.addListeners();\n this.cancelPendingUpdateEvent();\n };\n\n private drop = (): void => {\n if (this._isDragging) {\n this.removeListeners();\n this.beginEmitUpdateProcess();\n }\n this._isDragging = false;\n };\n\n /**\n * Adjust the date range based on slider movement\n *\n * @param e PointerEvent from the slider being moved\n */\n private move = (e: PointerEvent): void => {\n const histogramClientX = this.getBoundingClientRect().x;\n const newX = e.clientX - histogramClientX - this._dragOffset;\n const slider = this._currentSlider as SVGRectElement;\n if ((slider.id as SliderId) === 'slider-min') {\n this.minSelectedDate = this.translatePositionToDate(\n this.validMinSliderX(newX)\n );\n } else {\n this.maxSelectedDate = this.translatePositionToDate(\n this.validMaxSliderX(newX)\n );\n }\n };\n\n /**\n * Constrain a proposed value for the minimum (left) slider\n *\n * If the value is less than the leftmost valid position, then set it to the\n * left edge of the histogram (ie the slider width). If the value is greater\n * than the rightmost valid position (the position of the max slider), then\n * set it to the position of the max slider\n */\n private validMinSliderX(newX: number): number {\n // allow the left slider to go right only to the right slider, even if the\n // max selected date is out of range\n const rightLimit = Math.min(\n this.translateDateToPosition(this.maxSelectedDate),\n this.histogramRightEdgeX\n );\n newX = this.clamp(newX, this.histogramLeftEdgeX, rightLimit);\n const isInvalid =\n Number.isNaN(newX) || rightLimit < this.histogramLeftEdgeX;\n return isInvalid ? this.histogramLeftEdgeX : newX;\n }\n\n /**\n * Constrain a proposed value for the maximum (right) slider\n *\n * If the value is greater than the rightmost valid position, then set it to\n * the right edge of the histogram (ie histogram width - slider width). If the\n * value is less than the leftmost valid position (the position of the min\n * slider), then set it to the position of the min slider\n */\n private validMaxSliderX(newX: number): number {\n // allow the right slider to go left only to the left slider, even if the\n // min selected date is out of range\n const leftLimit = Math.max(\n this.histogramLeftEdgeX,\n this.translateDateToPosition(this.minSelectedDate)\n );\n newX = this.clamp(newX, leftLimit, this.histogramRightEdgeX);\n const isInvalid =\n Number.isNaN(newX) || leftLimit > this.histogramRightEdgeX;\n return isInvalid ? this.histogramRightEdgeX : newX;\n }\n\n private addListeners(): void {\n window.addEventListener('pointermove', this.move);\n window.addEventListener('pointerup', this.drop);\n window.addEventListener('pointercancel', this.drop);\n }\n\n private removeListeners(): void {\n window.removeEventListener('pointermove', this.move);\n window.removeEventListener('pointerup', this.drop);\n window.removeEventListener('pointercancel', this.drop);\n }\n\n /**\n * start a timer to emit an update event. this timer can be canceled (and the\n * event not emitted) if user drags a slider or focuses a date input within\n * the update delay\n */\n private beginEmitUpdateProcess(): void {\n this.cancelPendingUpdateEvent();\n this._emitUpdatedEventTimer = setTimeout(() => {\n if (this.currentDateRangeString === this._previousDateRange) {\n // don't emit duplicate event if no change since last emitted event\n return;\n }\n this._previousDateRange = this.currentDateRangeString;\n const options = {\n detail: {\n minDate: this.minSelectedDate,\n maxDate: this.maxSelectedDate,\n },\n bubbles: true,\n composed: true,\n };\n this.dispatchEvent(new CustomEvent('histogramDateRangeUpdated', options));\n }, this.updateDelay);\n }\n\n private cancelPendingUpdateEvent(): void {\n if (this._emitUpdatedEventTimer === undefined) {\n return;\n }\n clearTimeout(this._emitUpdatedEventTimer);\n this._emitUpdatedEventTimer = undefined;\n }\n\n /**\n * find position of pointer in relation to the current slider\n */\n private setDragOffset(e: PointerEvent): void {\n this._currentSlider = e.currentTarget as SVGRectElement;\n const sliderX =\n (this._currentSlider.id as SliderId) === 'slider-min'\n ? this.minSliderX\n : this.maxSliderX;\n const histogramClientX = this.getBoundingClientRect().x;\n this._dragOffset = e.clientX - histogramClientX - sliderX;\n }\n\n /**\n * @param x horizontal position of slider\n * @returns string representation of date\n */\n private translatePositionToDate(x: number): string {\n // use Math.ceil to round up to fix case where input like 1/1/2010 would get\n // translated to 12/31/2009\n const milliseconds = Math.ceil(\n ((x - this.sliderWidth) * this.dateRangeMS) / this._histWidth\n );\n return this.formatDate(this._minDateMS + milliseconds);\n }\n\n /**\n * Returns slider x-position corresponding to given date\n *\n * @param date\n * @returns x-position of slider\n */\n private translateDateToPosition(date: string): number {\n const milliseconds = this.getMSFromString(date);\n return (\n this.sliderWidth +\n ((milliseconds - this._minDateMS) * this._histWidth) / this.dateRangeMS\n );\n }\n\n /** ensure that the returned value is between minValue and maxValue */\n private clamp(x: number, minValue: number, maxValue: number): number {\n return Math.min(Math.max(x, minValue), maxValue);\n }\n\n private handleInputFocus(): void {\n if (!this.updateWhileFocused) {\n this.cancelPendingUpdateEvent();\n }\n }\n\n private handleMinDateInput(e: Event): void {\n const target = e.currentTarget as HTMLInputElement;\n if (target.value !== this.minSelectedDate) {\n this.minSelectedDate = target.value;\n this.beginEmitUpdateProcess();\n }\n }\n\n private handleMaxDateInput(e: Event): void {\n const target = e.currentTarget as HTMLInputElement;\n if (target.value !== this.maxSelectedDate) {\n this.maxSelectedDate = target.value;\n this.beginEmitUpdateProcess();\n }\n }\n\n private handleKeyUp(e: KeyboardEvent): void {\n if (e.key === 'Enter') {\n const target = e.currentTarget as HTMLInputElement;\n target.blur();\n if (target.id === 'date-min') {\n this.handleMinDateInput(e);\n } else if (target.id === 'date-max') {\n this.handleMaxDateInput(e);\n }\n }\n }\n\n private get currentDateRangeString(): string {\n return `${this.minSelectedDate}:${this.maxSelectedDate}`;\n }\n\n private getMSFromString(date: unknown): number {\n // It's possible that `date` is not a string in certain situations.\n // For instance if you use LitElement bindings and the date is `2000`,\n // it will be treated as a number instead of a string. This just makes sure\n // we're dealing with a string.\n const stringified = typeof date === 'string' ? date : String(date);\n const digitGroupCount = (stringified.split(/(\\d+)/).length - 1) / 2;\n if (digitGroupCount === 1) {\n // if there's just a single set of digits, assume it's a year\n const dateObj = new Date(0, 0); // start at January 1, 1900\n dateObj.setFullYear(Number(stringified)); // override year\n return dateObj.getTime(); // get time in milliseconds\n }\n return dayjs(stringified, [this.dateFormat, DATE_FORMAT]).valueOf();\n }\n\n /**\n * expand or narrow the selected range by moving the slider nearest the\n * clicked bar to the outer edge of the clicked bar\n *\n * @param e Event click event from a histogram bar\n */\n private handleBarClick(e: Event): void {\n const dataset = (e.currentTarget as SVGRectElement).dataset as BarDataset;\n // use the midpoint of the width of the clicked bar to determine which is\n // the nearest slider\n const clickPosition =\n (this.getMSFromString(dataset.binStart) +\n this.getMSFromString(dataset.binEnd)) /\n 2;\n const distanceFromMinSlider = Math.abs(\n clickPosition - this.getMSFromString(this.minSelectedDate)\n );\n const distanceFromMaxSlider = Math.abs(\n clickPosition - this.getMSFromString(this.maxSelectedDate)\n );\n // update the selected range by moving the nearer slider\n if (distanceFromMinSlider < distanceFromMaxSlider) {\n this.minSelectedDate = dataset.binStart;\n } else {\n this.maxSelectedDate = dataset.binEnd;\n }\n this.beginEmitUpdateProcess();\n }\n\n private get minSliderTemplate(): SVGTemplateResult {\n // width/height in pixels of curved part of the sliders (like\n // border-radius); used as part of a SVG quadratic curve. see\n // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands\n const cs = SLIDER_CORNER_SIZE;\n\n const sliderShape = `\n M${this.minSliderX},0\n h-${this.sliderWidth - cs}\n q-${cs},0 -${cs},${cs}\n v${this.height - cs * 2}\n q0,${cs} ${cs},${cs}\n h${this.sliderWidth - cs}\n `;\n return this.generateSliderSVG(this.minSliderX, 'slider-min', sliderShape);\n }\n\n private get maxSliderTemplate(): SVGTemplateResult {\n const cs = SLIDER_CORNER_SIZE;\n const sliderShape = `\n M${this.maxSliderX},0\n h${this.sliderWidth - cs}\n q${cs},0 ${cs},${cs}\n v${this.height - cs * 2}\n q0,${cs} -${cs},${cs}\n h-${this.sliderWidth - cs}\n `;\n return this.generateSliderSVG(this.maxSliderX, 'slider-max', sliderShape);\n }\n\n private generateSliderSVG(\n sliderPositionX: number,\n id: SliderId,\n sliderShape: string\n ): SVGTemplateResult {\n // whether the curved part of the slider is facing towards the left (1), ie\n // minimum, or facing towards the right (-1), ie maximum\n const k = id === 'slider-min' ? 1 : -1;\n\n return svg`\n <svg\n id=\"${id}\"\n class=\"\n ${this.disabled ? '' : 'draggable'}\n ${this._isDragging ? 'dragging' : ''}\"\n @pointerdown=\"${this.drag}\"\n >\n <path d=\"${sliderShape} z\" fill=\"${sliderColor}\" />\n <rect\n x=\"${\n sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k\n }\"\n y=\"${this.height / 3}\"\n width=\"1\"\n height=\"${this.height / 3}\"\n fill=\"white\"\n />\n <rect\n x=\"${\n sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k\n }\"\n y=\"${this.height / 3}\"\n width=\"1\"\n height=\"${this.height / 3}\"\n fill=\"white\"\n />\n </svg>\n `;\n }\n\n get selectedRangeTemplate(): SVGTemplateResult {\n return svg`\n <rect\n x=\"${this.minSliderX}\"\n y=\"0\"\n width=\"${this.maxSliderX - this.minSliderX}\"\n height=\"${this.height}\"\n fill=\"${selectedRangeColor}\"\n />`;\n }\n\n get histogramTemplate(): SVGTemplateResult[] {\n const xScale = this._histWidth / this._numBins;\n const barWidth = xScale - 1;\n let x = this.sliderWidth; // start at the left edge of the histogram\n\n // the stroke-dasharray style below creates a transparent border around the\n // right edge of the bar, which prevents user from encountering a gap\n // between adjacent bars (eg when viewing the tooltips or when trying to\n // extend the range by clicking on a bar)\n return this._histData.map(data => {\n const bar = svg`\n <rect\n class=\"bar\"\n style='stroke-dasharray: 0 ${barWidth} ${data.height} ${barWidth} 0 ${\n data.height\n };'\n x=\"${x}\"\n y=\"${this.height - data.height}\"\n width=\"${barWidth}\"\n height=\"${data.height}\"\n @pointerenter=\"${this.showTooltip}\"\n @pointerleave=\"${this.hideTooltip}\"\n @click=\"${this.handleBarClick}\"\n fill=\"${\n x + barWidth >= this.minSliderX && x <= this.maxSliderX\n ? barIncludedFill\n : barExcludedFill\n }\"\n data-num-items=\"${data.value}\"\n data-bin-start=\"${data.binStart}\"\n data-bin-end=\"${data.binEnd}\"\n />`;\n x += xScale;\n return bar;\n });\n }\n\n private formatDate(dateMS: number, format: string = this.dateFormat): string {\n if (Number.isNaN(dateMS)) {\n return '';\n }\n const date = dayjs(dateMS);\n if (date.year() < 1000) {\n // years before 1000 don't play well with dayjs custom formatting, so fall\n // back to displaying only the year\n return String(date.year());\n }\n return date.format(format);\n }\n\n /**\n * NOTE: we are relying on the lit `live` directive in the template to\n * ensure that the change to minSelectedDate is noticed and the input value\n * gets properly re-rendered. see\n * https://lit.dev/docs/templates/directives/#live\n */\n get minInputTemplate(): TemplateResult {\n return html`\n <input\n id=\"date-min\"\n placeholder=\"${this.dateFormat}\"\n type=\"text\"\n @focus=\"${this.handleInputFocus}\"\n @blur=\"${this.handleMinDateInput}\"\n @keyup=\"${this.handleKeyUp}\"\n .value=\"${live(this.minSelectedDate)}\"\n ?disabled=\"${this.disabled}\"\n />\n `;\n }\n\n get maxInputTemplate(): TemplateResult {\n return html`\n <input\n id=\"date-max\"\n placeholder=\"${this.dateFormat}\"\n type=\"text\"\n @focus=\"${this.handleInputFocus}\"\n @blur=\"${this.handleMaxDateInput}\"\n @keyup=\"${this.handleKeyUp}\"\n .value=\"${live(this.maxSelectedDate)}\"\n ?disabled=\"${this.disabled}\"\n />\n `;\n }\n\n get minLabelTemplate(): TemplateResult {\n return html`<label for=\"date-min\" class=\"sr-only\">Minimum date:</label>`;\n }\n\n get maxLabelTemplate(): TemplateResult {\n return html`<label for=\"date-max\" class=\"sr-only\">Maximum date:</label>`;\n }\n\n get tooltipTemplate(): TemplateResult {\n return html`\n <style>\n #tooltip {\n width: ${this.tooltipWidth}px;\n height: ${this.tooltipHeight}px;\n top: ${-9 - this.tooltipHeight}px;\n left: ${this._tooltipOffset}px;\n display: ${this._tooltipVisible ? 'block' : 'none'};\n }\n #tooltip:after {\n left: ${this.tooltipWidth / 2}px;\n }\n </style>\n <div id=\"tooltip\">${this._tooltipContent}</div>\n `;\n }\n\n private get noDataTemplate(): TemplateResult {\n return html`\n <div class=\"missing-data-message\">${this.missingDataMessage}</div>\n `;\n }\n\n private get activityIndicatorTemplate(): TemplateResult | typeof nothing {\n if (!this.loading) {\n return nothing;\n }\n return html`\n <ia-activity-indicator mode=\"processing\"> </ia-activity-indicator>\n `;\n }\n\n static styles = css`\n .missing-data-message {\n text-align: center;\n }\n #container {\n margin: 0;\n touch-action: none;\n position: relative;\n }\n .disabled {\n opacity: 0.3;\n }\n ia-activity-indicator {\n position: absolute;\n left: calc(50% - 10px);\n top: 10px;\n width: 20px;\n height: 20px;\n --activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);\n --activityIndicatorLoadingRingColor: ${activityIndicatorColor};\n }\n\n /* prevent selection from interfering with tooltip, especially on mobile */\n /* https://stackoverflow.com/a/4407335/1163042 */\n .noselect {\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -moz-user-select: none; /* Old versions of Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none; /* current Chrome, Edge, Opera and Firefox */\n }\n .bar {\n /* create a transparent border around the hist bars to prevent \"gaps\" and\n flickering when moving around between bars. this also helps with handling\n clicks on the bars, preventing users from being able to click in between\n bars */\n stroke: rgba(0, 0, 0, 0);\n /* ensure transparent stroke wide enough to cover gap between bars */\n stroke-width: 2px;\n }\n .bar:hover {\n /* highlight currently hovered bar */\n fill-opacity: 0.7;\n }\n .disabled .bar:hover {\n /* ensure no visual hover interaction when disabled */\n fill-opacity: 1;\n }\n /****** histogram ********/\n #tooltip {\n position: absolute;\n background: ${tooltipBackgroundColor};\n color: ${tooltipTextColor};\n text-align: center;\n border-radius: 3px;\n padding: 2px;\n font-size: ${tooltipFontSize};\n font-family: ${tooltipFontFamily};\n touch-action: none;\n pointer-events: none;\n }\n #tooltip:after {\n content: '';\n position: absolute;\n margin-left: -5px;\n top: 100%;\n /* arrow */\n border: 5px solid ${tooltipTextColor};\n border-color: ${tooltipBackgroundColor} transparent transparent\n transparent;\n }\n /****** slider ********/\n .draggable:hover {\n cursor: grab;\n }\n .dragging {\n cursor: grabbing !important;\n }\n /****** inputs ********/\n #inputs {\n display: flex;\n justify-content: center;\n margin: ${inputRowMargin};\n }\n #inputs .dash {\n position: relative;\n bottom: -1px;\n align-self: center; /* Otherwise the dash sticks to the top while the inputs grow */\n }\n input {\n width: ${inputWidth};\n margin: 0 3px;\n border: ${inputBorder};\n border-radius: 2px !important;\n text-align: center;\n font-size: ${inputFontSize};\n font-family: ${inputFontFamily};\n }\n .sr-only {\n position: absolute !important;\n width: 1px !important;\n height: 1px !important;\n margin: 0 !important;\n padding: 0 !important;\n border: 0 !important;\n overflow: hidden !important;\n white-space: nowrap !important;\n clip: rect(1px, 1px, 1px, 1px) !important;\n -webkit-clip-path: inset(50%) !important;\n clip-path: inset(50%) !important;\n }\n `;\n\n render(): TemplateResult {\n if (!this.hasBinData) {\n return this.noDataTemplate;\n }\n return html`\n <div\n id=\"container\"\n class=\"\n noselect\n ${this._isDragging ? 'dragging' : ''}\n \"\n style=\"width: ${this.width}px\"\n >\n ${this.activityIndicatorTemplate} ${this.tooltipTemplate}\n <div\n class=\"inner-container\n ${this.disabled ? 'disabled' : ''}\"\n >\n <svg\n width=\"${this.width}\"\n height=\"${this.height}\"\n @pointerleave=\"${this.drop}\"\n >\n ${this.selectedRangeTemplate}\n <svg id=\"histogram\">${this.histogramTemplate}</svg>\n ${this.minSliderTemplate} ${this.maxSliderTemplate}\n </svg>\n <div id=\"inputs\">\n ${this.minLabelTemplate} ${this.minInputTemplate}\n <div class=\"dash\">-</div>\n ${this.maxLabelTemplate} ${this.maxInputTemplate}\n <slot name=\"inputs-right-side\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n\n// help TypeScript provide strong typing when interacting with DOM APIs\n// https://stackoverflow.com/questions/65148695/lit-element-typescript-project-global-interface-declaration-necessary\ndeclare global {\n interface HTMLElementTagNameMap {\n 'histogram-date-range': HistogramDateRange;\n }\n}\n"]}
1
+ {"version":3,"file":"histogram-date-range.js","sourceRoot":"","sources":["../../src/histogram-date-range.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAC;AAChD,OAAO,KAAK,MAAM,WAAW,CAAC;AAC9B,OAAO,iBAAiB,MAAM,oCAAoC,CAAC;AACnE,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,OAAO,EAEP,GAAG,GAGJ,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEhC,kFAAkF;AAClF,MAAM,KAAK,GAAG,GAAG,CAAC;AAClB,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,YAAY,GAAG,SAAS,CAAC;AAC/B,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAEnC,+CAA+C;AAC/C,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,yFAAyF;AACzF,MAAM,WAAW,GAAG,GAAG,CAAA,+CAA+C,CAAC;AACvE,MAAM,kBAAkB,GAAG,GAAG,CAAA,s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,OAAO,EAAE,CAAC;8DAA4B;AAG/C;IAAR,KAAK,EAAE;0DAA4B;AAC3B;IAAR,KAAK,EAAE;2DAA0C;AACzC;IAAR,KAAK,EAAE;2DAAiC;AAChC;IAAR,KAAK,EAAE;uDAA6B;AAC5B;IAAR,KAAK,EAAE;sDAA4B;AA6HP;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAE3B;AAQW;IAAX,QAAQ,EAAE;yDAEV;AAsBW;IAAX,QAAQ,EAAE;yDAEV;AA3LU,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAq2B9B;SAr2BY,kBAAkB","sourcesContent":["import '@internetarchive/ia-activity-indicator';\nimport dayjs from 'dayjs/esm';\nimport customParseFormat from 'dayjs/esm/plugin/customParseFormat';\nimport {\n css,\n html,\n LitElement,\n nothing,\n PropertyValues,\n svg,\n SVGTemplateResult,\n TemplateResult,\n} from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\n\ndayjs.extend(customParseFormat);\n\n// these values can be overridden via the component's HTML (camelCased) attributes\nconst WIDTH = 180;\nconst HEIGHT = 40;\nconst SLIDER_WIDTH = 10;\nconst TOOLTIP_WIDTH = 125;\nconst TOOLTIP_HEIGHT = 30;\nconst DATE_FORMAT = 'YYYY';\nconst MISSING_DATA = 'no data';\nconst UPDATE_DEBOUNCE_DELAY_MS = 0;\n\n// this constant is not set up to be overridden\nconst SLIDER_CORNER_SIZE = 4;\n\n// these CSS custom props can be overridden from the HTML that is invoking this component\nconst sliderColor = css`var(--histogramDateRangeSliderColor, #4B65FE)`;\nconst selectedRangeColor = css`var(--histogramDateRangeSelectedRangeColor, #DBE0FF)`;\nconst barIncludedFill = css`var(--histogramDateRangeBarIncludedFill, #2C2C2C)`;\nconst activityIndicatorColor = css`var(--histogramDateRangeActivityIndicator, #2C2C2C)`;\nconst barExcludedFill = css`var(--histogramDateRangeBarExcludedFill, #CCCCCC)`;\nconst inputRowMargin = css`var(--histogramDateRangeInputRowMargin, 0)`;\nconst inputBorder = css`var(--histogramDateRangeInputBorder, 0.5px solid #2C2C2C)`;\nconst inputWidth = css`var(--histogramDateRangeInputWidth, 35px)`;\nconst inputFontSize = css`var(--histogramDateRangeInputFontSize, 1.2rem)`;\nconst inputFontFamily = css`var(--histogramDateRangeInputFontFamily, sans-serif)`;\nconst tooltipBackgroundColor = css`var(--histogramDateRangeTooltipBackgroundColor, #2C2C2C)`;\nconst tooltipTextColor = css`var(--histogramDateRangeTooltipTextColor, #FFFFFF)`;\nconst tooltipFontSize = css`var(--histogramDateRangeTooltipFontSize, 1.1rem)`;\nconst tooltipFontFamily = css`var(--histogramDateRangeTooltipFontFamily, sans-serif)`;\n\ntype SliderId = 'slider-min' | 'slider-max';\n\ninterface HistogramItem {\n value: number;\n height: number;\n binStart: string;\n binEnd: string;\n}\n\ninterface BarDataset extends DOMStringMap {\n numItems: string;\n binStart: string;\n binEnd: string;\n}\n\n@customElement('histogram-date-range')\nexport class HistogramDateRange extends LitElement {\n /* eslint-disable lines-between-class-members */\n\n // public reactive properties that can be set via HTML attributes\n @property({ type: Number }) width = WIDTH;\n @property({ type: Number }) height = HEIGHT;\n @property({ type: Number }) sliderWidth = SLIDER_WIDTH;\n @property({ type: Number }) tooltipWidth = TOOLTIP_WIDTH;\n @property({ type: Number }) tooltipHeight = TOOLTIP_HEIGHT;\n @property({ type: Number }) updateDelay = UPDATE_DEBOUNCE_DELAY_MS;\n @property({ type: String }) dateFormat = DATE_FORMAT;\n /** Optional; falls back to `dateFormat` if not provided */\n @property({ type: String }) tooltipDateFormat?: string;\n @property({ type: String }) missingDataMessage = MISSING_DATA;\n @property({ type: String }) minDate = '';\n @property({ type: String }) maxDate = '';\n @property({ type: Boolean }) disabled = false;\n @property({ type: Array }) bins: number[] = [];\n /** If true, update events will not be canceled by the date inputs receiving focus */\n @property({ type: Boolean }) updateWhileFocused = false;\n\n // internal reactive properties not exposed as attributes\n @state() private _tooltipOffset = 0;\n @state() private _tooltipContent?: TemplateResult;\n @state() private _tooltipVisible = false;\n @state() private _isDragging = false;\n @state() private _isLoading = false;\n\n // non-reactive properties (changes don't auto-trigger re-rendering)\n private _minSelectedDate = '';\n private _maxSelectedDate = '';\n private _minDateMS = 0;\n private _maxDateMS = 0;\n private _dragOffset = 0;\n private _histWidth = 0;\n private _binWidth = 0;\n private _currentSlider?: SVGRectElement;\n private _histData: HistogramItem[] = [];\n private _emitUpdatedEventTimer?: ReturnType<typeof setTimeout>;\n private _previousDateRange = '';\n\n /* eslint-enable lines-between-class-members */\n\n disconnectedCallback(): void {\n this.removeListeners();\n super.disconnectedCallback();\n }\n\n willUpdate(changedProps: PropertyValues): void {\n // check for changes that would affect bin data calculations\n if (\n changedProps.has('bins') ||\n changedProps.has('minDate') ||\n changedProps.has('maxDate') ||\n changedProps.has('minSelectedDate') ||\n changedProps.has('maxSelectedDate') ||\n changedProps.has('width') ||\n changedProps.has('height')\n ) {\n this.handleDataUpdate();\n }\n }\n\n /**\n * Set private properties that depend on the attribute bin data\n *\n * We're caching these values and not using getters to avoid recalculating all\n * of the hist data every time the user drags a slider or hovers over a bar\n * creating a tooltip.\n */\n private handleDataUpdate(): void {\n if (!this.hasBinData) {\n return;\n }\n this._histWidth = this.width - this.sliderWidth * 2;\n this._minDateMS = this.getMSFromString(this.minDate);\n this._maxDateMS = this.getMSFromString(this.maxDate);\n this._binWidth = this._histWidth / this._numBins;\n this._previousDateRange = this.currentDateRangeString;\n this._histData = this.calculateHistData();\n this.minSelectedDate = this.minSelectedDate\n ? this.minSelectedDate\n : this.minDate;\n this.maxSelectedDate = this.maxSelectedDate\n ? this.maxSelectedDate\n : this.maxDate;\n }\n\n /**\n * Rounds the given timestamp to the nearest start of a new month\n */\n private roundToMonth(timestamp: number): number {\n const date = new Date(timestamp);\n const [y, m, d] = [date.getFullYear(), date.getMonth(), date.getDate()];\n\n return d < 15\n ? new Date(y, m, 1).getTime()\n : new Date(y, m + 1, 1).getTime();\n }\n\n private calculateHistData(): HistogramItem[] {\n const { bins, height, dateRangeMS, _numBins, _minDateMS } = this;\n const minValue = Math.min(...this.bins);\n const maxValue = Math.max(...this.bins);\n // if there is no difference between the min and max values, use a range of\n // 1 because log scaling will fail if the range is 0\n const valueRange = minValue === maxValue ? 1 : Math.log1p(maxValue);\n const valueScale = height / valueRange;\n const dateScale = dateRangeMS / _numBins;\n return bins.map((v: number, i: number) => {\n const binStartMS = this.roundToMonth(i * dateScale + _minDateMS);\n const binEndMS = this.roundToMonth((i + 1) * dateScale + _minDateMS) - 1;\n return {\n value: v,\n // use log scaling for the height of the bar to prevent tall bars from\n // making the smaller ones too small to see\n height: Math.floor(Math.log1p(v) * valueScale),\n binStart: this.formatDate(binStartMS, this.resolvedTooltipDateFormat),\n binEnd: this.formatDate(binEndMS, this.resolvedTooltipDateFormat),\n };\n });\n }\n\n private get hasBinData(): boolean {\n return this._numBins > 0;\n }\n\n private get _numBins(): number {\n if (!this.bins || !this.bins.length) {\n return 0;\n }\n return this.bins.length;\n }\n\n private get histogramLeftEdgeX(): number {\n return this.sliderWidth;\n }\n\n private get histogramRightEdgeX(): number {\n return this.width - this.sliderWidth;\n }\n\n /**\n * Returns the consumer-specified tooltip date format if set, falling back to\n * the general `dateFormat` property and then the default format if none is set.\n */\n private get resolvedTooltipDateFormat(): string {\n return this.tooltipDateFormat ?? this.dateFormat ?? DATE_FORMAT;\n }\n\n /** component's loading (and disabled) state */\n @property({ type: Boolean }) get loading(): boolean {\n return this._isLoading;\n }\n\n set loading(value: boolean) {\n this.disabled = value;\n this._isLoading = value;\n }\n\n /** formatted minimum date of selected date range */\n @property() get minSelectedDate(): string {\n return this.formatDate(this.getMSFromString(this._minSelectedDate));\n }\n\n /** updates minSelectedDate if new date is valid */\n set minSelectedDate(rawDate: string) {\n if (!this._minSelectedDate) {\n // because the values needed to calculate valid max/min values are not\n // available during the lit init when it's populating properties from\n // attributes, fall back to just the raw date if nothing is already set\n this._minSelectedDate = rawDate;\n return;\n }\n const proposedDateMS = this.getMSFromString(rawDate);\n const isValidDate = !Number.isNaN(proposedDateMS);\n const isNotTooRecent =\n proposedDateMS <= this.getMSFromString(this.maxSelectedDate);\n if (isValidDate && isNotTooRecent) {\n this._minSelectedDate = this.formatDate(proposedDateMS);\n }\n this.requestUpdate();\n }\n\n /** formatted maximum date of selected date range */\n @property() get maxSelectedDate(): string {\n return this.formatDate(this.getMSFromString(this._maxSelectedDate));\n }\n\n /** updates maxSelectedDate if new date is valid */\n set maxSelectedDate(rawDate: string) {\n if (!this._maxSelectedDate) {\n // because the values needed to calculate valid max/min values are not\n // available during the lit init when it's populating properties from\n // attributes, fall back to just the raw date if nothing is already set\n this._maxSelectedDate = rawDate;\n return;\n }\n const proposedDateMS = this.getMSFromString(rawDate);\n const isValidDate = !Number.isNaN(proposedDateMS);\n const isNotTooOld =\n proposedDateMS >= this.getMSFromString(this.minSelectedDate);\n if (isValidDate && isNotTooOld) {\n this._maxSelectedDate = this.formatDate(proposedDateMS);\n }\n this.requestUpdate();\n }\n\n /** horizontal position of min date slider */\n get minSliderX(): number {\n const x = this.translateDateToPosition(this.minSelectedDate);\n return this.validMinSliderX(x);\n }\n\n /** horizontal position of max date slider */\n get maxSliderX(): number {\n const x = this.translateDateToPosition(this.maxSelectedDate);\n return this.validMaxSliderX(x);\n }\n\n private get dateRangeMS(): number {\n return this._maxDateMS - this._minDateMS;\n }\n\n private showTooltip(e: PointerEvent): void {\n if (this._isDragging || this.disabled) {\n return;\n }\n const target = e.currentTarget as SVGRectElement;\n const x = target.x.baseVal.value + this.sliderWidth / 2;\n const dataset = target.dataset as BarDataset;\n const itemsText = `item${dataset.numItems !== '1' ? 's' : ''}`;\n const datesText = dataset.binStart === dataset.binEnd\n ? `${dataset.binStart}` // If start/end are the same, just render a single value\n : `${dataset.binStart} - ${dataset.binEnd}`;\n const formattedNumItems = Number(dataset.numItems).toLocaleString();\n\n this._tooltipOffset =\n x + (this._binWidth - this.sliderWidth - this.tooltipWidth) / 2;\n\n this._tooltipContent = html`\n ${formattedNumItems} ${itemsText}<br />\n ${datesText}\n `;\n this._tooltipVisible = true;\n }\n\n private hideTooltip(): void {\n this._tooltipContent = undefined;\n this._tooltipVisible = false;\n }\n\n // use arrow functions (rather than standard JS class instance methods) so\n // that `this` is bound to the histogramDateRange object and not the event\n // target. for more info see\n // https://lit-element.polymer-project.org/guide/events#using-this-in-event-listeners\n private drag = (e: PointerEvent): void => {\n // prevent selecting text or other ranges while dragging, especially in Safari\n e.preventDefault();\n if (this.disabled) {\n return;\n }\n this.setDragOffset(e);\n this._isDragging = true;\n this.addListeners();\n this.cancelPendingUpdateEvent();\n };\n\n private drop = (): void => {\n if (this._isDragging) {\n this.removeListeners();\n this.beginEmitUpdateProcess();\n }\n this._isDragging = false;\n };\n\n /**\n * Adjust the date range based on slider movement\n *\n * @param e PointerEvent from the slider being moved\n */\n private move = (e: PointerEvent): void => {\n const histogramClientX = this.getBoundingClientRect().x;\n const newX = e.clientX - histogramClientX - this._dragOffset;\n const slider = this._currentSlider as SVGRectElement;\n if ((slider.id as SliderId) === 'slider-min') {\n this.minSelectedDate = this.translatePositionToDate(\n this.validMinSliderX(newX)\n );\n } else {\n this.maxSelectedDate = this.translatePositionToDate(\n this.validMaxSliderX(newX)\n );\n }\n };\n\n /**\n * Constrain a proposed value for the minimum (left) slider\n *\n * If the value is less than the leftmost valid position, then set it to the\n * left edge of the histogram (ie the slider width). If the value is greater\n * than the rightmost valid position (the position of the max slider), then\n * set it to the position of the max slider\n */\n private validMinSliderX(newX: number): number {\n // allow the left slider to go right only to the right slider, even if the\n // max selected date is out of range\n const rightLimit = Math.min(\n this.translateDateToPosition(this.maxSelectedDate),\n this.histogramRightEdgeX\n );\n newX = this.clamp(newX, this.histogramLeftEdgeX, rightLimit);\n const isInvalid =\n Number.isNaN(newX) || rightLimit < this.histogramLeftEdgeX;\n return isInvalid ? this.histogramLeftEdgeX : newX;\n }\n\n /**\n * Constrain a proposed value for the maximum (right) slider\n *\n * If the value is greater than the rightmost valid position, then set it to\n * the right edge of the histogram (ie histogram width - slider width). If the\n * value is less than the leftmost valid position (the position of the min\n * slider), then set it to the position of the min slider\n */\n private validMaxSliderX(newX: number): number {\n // allow the right slider to go left only to the left slider, even if the\n // min selected date is out of range\n const leftLimit = Math.max(\n this.histogramLeftEdgeX,\n this.translateDateToPosition(this.minSelectedDate)\n );\n newX = this.clamp(newX, leftLimit, this.histogramRightEdgeX);\n const isInvalid =\n Number.isNaN(newX) || leftLimit > this.histogramRightEdgeX;\n return isInvalid ? this.histogramRightEdgeX : newX;\n }\n\n private addListeners(): void {\n window.addEventListener('pointermove', this.move);\n window.addEventListener('pointerup', this.drop);\n window.addEventListener('pointercancel', this.drop);\n }\n\n private removeListeners(): void {\n window.removeEventListener('pointermove', this.move);\n window.removeEventListener('pointerup', this.drop);\n window.removeEventListener('pointercancel', this.drop);\n }\n\n /**\n * start a timer to emit an update event. this timer can be canceled (and the\n * event not emitted) if user drags a slider or focuses a date input within\n * the update delay\n */\n private beginEmitUpdateProcess(): void {\n this.cancelPendingUpdateEvent();\n this._emitUpdatedEventTimer = setTimeout(() => {\n if (this.currentDateRangeString === this._previousDateRange) {\n // don't emit duplicate event if no change since last emitted event\n return;\n }\n this._previousDateRange = this.currentDateRangeString;\n const options = {\n detail: {\n minDate: this.minSelectedDate,\n maxDate: this.maxSelectedDate,\n },\n bubbles: true,\n composed: true,\n };\n this.dispatchEvent(new CustomEvent('histogramDateRangeUpdated', options));\n }, this.updateDelay);\n }\n\n private cancelPendingUpdateEvent(): void {\n if (this._emitUpdatedEventTimer === undefined) {\n return;\n }\n clearTimeout(this._emitUpdatedEventTimer);\n this._emitUpdatedEventTimer = undefined;\n }\n\n /**\n * find position of pointer in relation to the current slider\n */\n private setDragOffset(e: PointerEvent): void {\n this._currentSlider = e.currentTarget as SVGRectElement;\n const sliderX =\n (this._currentSlider.id as SliderId) === 'slider-min'\n ? this.minSliderX\n : this.maxSliderX;\n const histogramClientX = this.getBoundingClientRect().x;\n this._dragOffset = e.clientX - histogramClientX - sliderX;\n }\n\n /**\n * @param x horizontal position of slider\n * @returns string representation of date\n */\n private translatePositionToDate(x: number): string {\n // use Math.ceil to round up to fix case where input like 1/1/2010 would get\n // translated to 12/31/2009\n const milliseconds = Math.ceil(\n ((x - this.sliderWidth) * this.dateRangeMS) / this._histWidth\n );\n return this.formatDate(this._minDateMS + milliseconds);\n }\n\n /**\n * Returns slider x-position corresponding to given date\n *\n * @param date\n * @returns x-position of slider\n */\n private translateDateToPosition(date: string): number {\n const milliseconds = this.getMSFromString(date);\n return (\n this.sliderWidth +\n ((milliseconds - this._minDateMS) * this._histWidth) / this.dateRangeMS\n );\n }\n\n /** ensure that the returned value is between minValue and maxValue */\n private clamp(x: number, minValue: number, maxValue: number): number {\n return Math.min(Math.max(x, minValue), maxValue);\n }\n\n private handleInputFocus(): void {\n if (!this.updateWhileFocused) {\n this.cancelPendingUpdateEvent();\n }\n }\n\n private handleMinDateInput(e: Event): void {\n const target = e.currentTarget as HTMLInputElement;\n if (target.value !== this.minSelectedDate) {\n this.minSelectedDate = target.value;\n this.beginEmitUpdateProcess();\n }\n }\n\n private handleMaxDateInput(e: Event): void {\n const target = e.currentTarget as HTMLInputElement;\n if (target.value !== this.maxSelectedDate) {\n this.maxSelectedDate = target.value;\n this.beginEmitUpdateProcess();\n }\n }\n\n private handleKeyUp(e: KeyboardEvent): void {\n if (e.key === 'Enter') {\n const target = e.currentTarget as HTMLInputElement;\n target.blur();\n if (target.id === 'date-min') {\n this.handleMinDateInput(e);\n } else if (target.id === 'date-max') {\n this.handleMaxDateInput(e);\n }\n }\n }\n\n private get currentDateRangeString(): string {\n return `${this.minSelectedDate}:${this.maxSelectedDate}`;\n }\n\n private getMSFromString(date: unknown): number {\n // It's possible that `date` is not a string in certain situations.\n // For instance if you use LitElement bindings and the date is `2000`,\n // it will be treated as a number instead of a string. This just makes sure\n // we're dealing with a string.\n const stringified = typeof date === 'string' ? date : String(date);\n const digitGroupCount = (stringified.split(/(\\d+)/).length - 1) / 2;\n if (digitGroupCount === 1) {\n // if there's just a single set of digits, assume it's a year\n const dateObj = new Date(0, 0); // start at January 1, 1900\n dateObj.setFullYear(Number(stringified)); // override year\n return dateObj.getTime(); // get time in milliseconds\n }\n return dayjs(stringified, [this.dateFormat, DATE_FORMAT]).valueOf();\n }\n\n /**\n * expand or narrow the selected range by moving the slider nearest the\n * clicked bar to the outer edge of the clicked bar\n *\n * @param e Event click event from a histogram bar\n */\n private handleBarClick(e: Event): void {\n const dataset = (e.currentTarget as SVGRectElement).dataset as BarDataset;\n // use the midpoint of the width of the clicked bar to determine which is\n // the nearest slider\n const clickPosition =\n (this.getMSFromString(dataset.binStart) +\n this.getMSFromString(dataset.binEnd)) /\n 2;\n const distanceFromMinSlider = Math.abs(\n clickPosition - this.getMSFromString(this.minSelectedDate)\n );\n const distanceFromMaxSlider = Math.abs(\n clickPosition - this.getMSFromString(this.maxSelectedDate)\n );\n // update the selected range by moving the nearer slider\n if (distanceFromMinSlider < distanceFromMaxSlider) {\n this.minSelectedDate = dataset.binStart;\n } else {\n this.maxSelectedDate = dataset.binEnd;\n }\n this.beginEmitUpdateProcess();\n }\n\n private get minSliderTemplate(): SVGTemplateResult {\n // width/height in pixels of curved part of the sliders (like\n // border-radius); used as part of a SVG quadratic curve. see\n // https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands\n const cs = SLIDER_CORNER_SIZE;\n\n const sliderShape = `\n M${this.minSliderX},0\n h-${this.sliderWidth - cs}\n q-${cs},0 -${cs},${cs}\n v${this.height - cs * 2}\n q0,${cs} ${cs},${cs}\n h${this.sliderWidth - cs}\n `;\n return this.generateSliderSVG(this.minSliderX, 'slider-min', sliderShape);\n }\n\n private get maxSliderTemplate(): SVGTemplateResult {\n const cs = SLIDER_CORNER_SIZE;\n const sliderShape = `\n M${this.maxSliderX},0\n h${this.sliderWidth - cs}\n q${cs},0 ${cs},${cs}\n v${this.height - cs * 2}\n q0,${cs} -${cs},${cs}\n h-${this.sliderWidth - cs}\n `;\n return this.generateSliderSVG(this.maxSliderX, 'slider-max', sliderShape);\n }\n\n private generateSliderSVG(\n sliderPositionX: number,\n id: SliderId,\n sliderShape: string\n ): SVGTemplateResult {\n // whether the curved part of the slider is facing towards the left (1), ie\n // minimum, or facing towards the right (-1), ie maximum\n const k = id === 'slider-min' ? 1 : -1;\n\n return svg`\n <svg\n id=\"${id}\"\n class=\"\n ${this.disabled ? '' : 'draggable'}\n ${this._isDragging ? 'dragging' : ''}\"\n @pointerdown=\"${this.drag}\"\n >\n <path d=\"${sliderShape} z\" fill=\"${sliderColor}\" />\n <rect\n x=\"${\n sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k\n }\"\n y=\"${this.height / 3}\"\n width=\"1\"\n height=\"${this.height / 3}\"\n fill=\"white\"\n />\n <rect\n x=\"${\n sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k\n }\"\n y=\"${this.height / 3}\"\n width=\"1\"\n height=\"${this.height / 3}\"\n fill=\"white\"\n />\n </svg>\n `;\n }\n\n get selectedRangeTemplate(): SVGTemplateResult {\n return svg`\n <rect\n x=\"${this.minSliderX}\"\n y=\"0\"\n width=\"${this.maxSliderX - this.minSliderX}\"\n height=\"${this.height}\"\n fill=\"${selectedRangeColor}\"\n />`;\n }\n\n get histogramTemplate(): SVGTemplateResult[] {\n const xScale = this._histWidth / this._numBins;\n const barWidth = xScale - 1;\n let x = this.sliderWidth; // start at the left edge of the histogram\n\n // the stroke-dasharray style below creates a transparent border around the\n // right edge of the bar, which prevents user from encountering a gap\n // between adjacent bars (eg when viewing the tooltips or when trying to\n // extend the range by clicking on a bar)\n return this._histData.map(data => {\n const bar = svg`\n <rect\n class=\"bar\"\n style='stroke-dasharray: 0 ${barWidth} ${data.height} ${barWidth} 0 ${\n data.height\n };'\n x=\"${x}\"\n y=\"${this.height - data.height}\"\n width=\"${barWidth}\"\n height=\"${data.height}\"\n @pointerenter=\"${this.showTooltip}\"\n @pointerleave=\"${this.hideTooltip}\"\n @click=\"${this.handleBarClick}\"\n fill=\"${\n x + barWidth >= this.minSliderX && x <= this.maxSliderX\n ? barIncludedFill\n : barExcludedFill\n }\"\n data-num-items=\"${data.value}\"\n data-bin-start=\"${data.binStart}\"\n data-bin-end=\"${data.binEnd}\"\n />`;\n x += xScale;\n return bar;\n });\n }\n\n private formatDate(dateMS: number, format: string = this.dateFormat): string {\n if (Number.isNaN(dateMS)) {\n return '';\n }\n const date = dayjs(dateMS);\n if (date.year() < 1000) {\n // years before 1000 don't play well with dayjs custom formatting, so fall\n // back to displaying only the year\n return String(date.year());\n }\n return date.format(format);\n }\n\n /**\n * NOTE: we are relying on the lit `live` directive in the template to\n * ensure that the change to minSelectedDate is noticed and the input value\n * gets properly re-rendered. see\n * https://lit.dev/docs/templates/directives/#live\n */\n get minInputTemplate(): TemplateResult {\n return html`\n <input\n id=\"date-min\"\n placeholder=\"${this.dateFormat}\"\n type=\"text\"\n @focus=\"${this.handleInputFocus}\"\n @blur=\"${this.handleMinDateInput}\"\n @keyup=\"${this.handleKeyUp}\"\n .value=\"${live(this.minSelectedDate)}\"\n ?disabled=\"${this.disabled}\"\n />\n `;\n }\n\n get maxInputTemplate(): TemplateResult {\n return html`\n <input\n id=\"date-max\"\n placeholder=\"${this.dateFormat}\"\n type=\"text\"\n @focus=\"${this.handleInputFocus}\"\n @blur=\"${this.handleMaxDateInput}\"\n @keyup=\"${this.handleKeyUp}\"\n .value=\"${live(this.maxSelectedDate)}\"\n ?disabled=\"${this.disabled}\"\n />\n `;\n }\n\n get minLabelTemplate(): TemplateResult {\n return html`<label for=\"date-min\" class=\"sr-only\">Minimum date:</label>`;\n }\n\n get maxLabelTemplate(): TemplateResult {\n return html`<label for=\"date-max\" class=\"sr-only\">Maximum date:</label>`;\n }\n\n get tooltipTemplate(): TemplateResult {\n return html`\n <style>\n #tooltip {\n width: ${this.tooltipWidth}px;\n height: ${this.tooltipHeight}px;\n top: ${-9 - this.tooltipHeight}px;\n left: ${this._tooltipOffset}px;\n display: ${this._tooltipVisible ? 'block' : 'none'};\n }\n #tooltip:after {\n left: ${this.tooltipWidth / 2}px;\n }\n </style>\n <div id=\"tooltip\">${this._tooltipContent}</div>\n `;\n }\n\n private get noDataTemplate(): TemplateResult {\n return html`\n <div class=\"missing-data-message\">${this.missingDataMessage}</div>\n `;\n }\n\n private get activityIndicatorTemplate(): TemplateResult | typeof nothing {\n if (!this.loading) {\n return nothing;\n }\n return html`\n <ia-activity-indicator mode=\"processing\"> </ia-activity-indicator>\n `;\n }\n\n static styles = css`\n .missing-data-message {\n text-align: center;\n }\n #container {\n margin: 0;\n touch-action: none;\n position: relative;\n }\n .disabled {\n opacity: 0.3;\n }\n ia-activity-indicator {\n position: absolute;\n left: calc(50% - 10px);\n top: 10px;\n width: 20px;\n height: 20px;\n --activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);\n --activityIndicatorLoadingRingColor: ${activityIndicatorColor};\n }\n\n /* prevent selection from interfering with tooltip, especially on mobile */\n /* https://stackoverflow.com/a/4407335/1163042 */\n .noselect {\n -webkit-touch-callout: none; /* iOS Safari */\n -webkit-user-select: none; /* Safari */\n -moz-user-select: none; /* Old versions of Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n user-select: none; /* current Chrome, Edge, Opera and Firefox */\n }\n .bar {\n /* create a transparent border around the hist bars to prevent \"gaps\" and\n flickering when moving around between bars. this also helps with handling\n clicks on the bars, preventing users from being able to click in between\n bars */\n stroke: rgba(0, 0, 0, 0);\n /* ensure transparent stroke wide enough to cover gap between bars */\n stroke-width: 2px;\n }\n .bar:hover {\n /* highlight currently hovered bar */\n fill-opacity: 0.7;\n }\n .disabled .bar:hover {\n /* ensure no visual hover interaction when disabled */\n fill-opacity: 1;\n }\n /****** histogram ********/\n #tooltip {\n position: absolute;\n background: ${tooltipBackgroundColor};\n color: ${tooltipTextColor};\n text-align: center;\n border-radius: 3px;\n padding: 2px;\n font-size: ${tooltipFontSize};\n font-family: ${tooltipFontFamily};\n touch-action: none;\n pointer-events: none;\n }\n #tooltip:after {\n content: '';\n position: absolute;\n margin-left: -5px;\n top: 100%;\n /* arrow */\n border: 5px solid ${tooltipTextColor};\n border-color: ${tooltipBackgroundColor} transparent transparent\n transparent;\n }\n /****** slider ********/\n .draggable:hover {\n cursor: grab;\n }\n .dragging {\n cursor: grabbing !important;\n }\n /****** inputs ********/\n #inputs {\n display: flex;\n justify-content: center;\n margin: ${inputRowMargin};\n }\n #inputs .dash {\n position: relative;\n bottom: -1px;\n align-self: center; /* Otherwise the dash sticks to the top while the inputs grow */\n }\n input {\n width: ${inputWidth};\n margin: 0 3px;\n border: ${inputBorder};\n border-radius: 2px !important;\n text-align: center;\n font-size: ${inputFontSize};\n font-family: ${inputFontFamily};\n }\n .sr-only {\n position: absolute !important;\n width: 1px !important;\n height: 1px !important;\n margin: 0 !important;\n padding: 0 !important;\n border: 0 !important;\n overflow: hidden !important;\n white-space: nowrap !important;\n clip: rect(1px, 1px, 1px, 1px) !important;\n -webkit-clip-path: inset(50%) !important;\n clip-path: inset(50%) !important;\n }\n `;\n\n render(): TemplateResult {\n if (!this.hasBinData) {\n return this.noDataTemplate;\n }\n return html`\n <div\n id=\"container\"\n class=\"\n noselect\n ${this._isDragging ? 'dragging' : ''}\n \"\n style=\"width: ${this.width}px\"\n >\n ${this.activityIndicatorTemplate} ${this.tooltipTemplate}\n <div\n class=\"inner-container\n ${this.disabled ? 'disabled' : ''}\"\n >\n <svg\n width=\"${this.width}\"\n height=\"${this.height}\"\n @pointerleave=\"${this.drop}\"\n >\n ${this.selectedRangeTemplate}\n <svg id=\"histogram\">${this.histogramTemplate}</svg>\n ${this.minSliderTemplate} ${this.maxSliderTemplate}\n </svg>\n <div id=\"inputs\">\n ${this.minLabelTemplate} ${this.minInputTemplate}\n <div class=\"dash\">-</div>\n ${this.maxLabelTemplate} ${this.maxInputTemplate}\n <slot name=\"inputs-right-side\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n\n// help TypeScript provide strong typing when interacting with DOM APIs\n// https://stackoverflow.com/questions/65148695/lit-element-typescript-project-global-interface-declaration-necessary\ndeclare global {\n interface HTMLElementTagNameMap {\n 'histogram-date-range': HistogramDateRange;\n }\n}\n"]}
@@ -223,11 +223,12 @@ export let HistogramDateRange = class extends LitElement {
223
223
  const x = target.x.baseVal.value + this.sliderWidth / 2;
224
224
  const dataset = target.dataset;
225
225
  const itemsText = `item${dataset.numItems !== "1" ? "s" : ""}`;
226
+ const datesText = dataset.binStart === dataset.binEnd ? `${dataset.binStart}` : `${dataset.binStart} - ${dataset.binEnd}`;
226
227
  const formattedNumItems = Number(dataset.numItems).toLocaleString();
227
228
  this._tooltipOffset = x + (this._binWidth - this.sliderWidth - this.tooltipWidth) / 2;
228
229
  this._tooltipContent = html`
229
230
  ${formattedNumItems} ${itemsText}<br />
230
- ${dataset.binStart} - ${dataset.binEnd}
231
+ ${datesText}
231
232
  `;
232
233
  this._tooltipVisible = true;
233
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/histogram-date-range",
3
- "version": "1.2.2-alpha-webdev7377.2",
3
+ "version": "1.2.2-alpha-webdev7377.3",
4
4
  "description": "Internet Archive histogram date range picker",
5
5
  "license": "AGPL-3.0-only",
6
6
  "main": "dist/index.js",
@@ -293,6 +293,9 @@ export class HistogramDateRange extends LitElement {
293
293
  const x = target.x.baseVal.value + this.sliderWidth / 2;
294
294
  const dataset = target.dataset as BarDataset;
295
295
  const itemsText = `item${dataset.numItems !== '1' ? 's' : ''}`;
296
+ const datesText = dataset.binStart === dataset.binEnd
297
+ ? `${dataset.binStart}` // If start/end are the same, just render a single value
298
+ : `${dataset.binStart} - ${dataset.binEnd}`;
296
299
  const formattedNumItems = Number(dataset.numItems).toLocaleString();
297
300
 
298
301
  this._tooltipOffset =
@@ -300,7 +303,7 @@ export class HistogramDateRange extends LitElement {
300
303
 
301
304
  this._tooltipContent = html`
302
305
  ${formattedNumItems} ${itemsText}<br />
303
- ${dataset.binStart} - ${dataset.binEnd}
306
+ ${datesText}
304
307
  `;
305
308
  this._tooltipVisible = true;
306
309
  }