@internetarchive/collection-browser 1.8.0 → 1.9.1-alpha.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.
@@ -1 +1 @@
1
- {"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAOzD,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,0BAA0B,CAAC;AAClC,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,mBAAmB,GAIpB,MAAM,+BAA+B,CAAC;AAGvC,IAAa,cAAc,sBAA3B,MAAa,cACX,SAAQ,iBAAiB;IAD3B;QAME;;;;;;;;;;;;WAYG;;QASH,uFAAuF;QAC1D,oBAAe,GAAG,KAAK,CAAC;IAoUvD,CAAC;IA/SC,MAAM;;QACJ,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,KAAK,MAAM,CAAC;QACnD,MAAM,iBAAiB,GACrB,MAAA,MAAA,IAAI,CAAC,mBAAmB,0CAAE,WAAW,EAAE,mCAAI,OAAO,CAAC;QACrD,OAAO,IAAI,CAAA;kCACmB,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO;UAC1D,IAAI,CAAC,eAAe,KAAK,aAAa;YACtC,CAAC,CAAC,IAAI,CAAC,cAAc;YACrB,CAAC,CAAC,IAAI,CAAC,YAA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AAE,CAAC;uDAAmC;AAElC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAgD;AAG3E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACwB;AAGtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAKrD;IADC,KAAK,CAAC,YAAY,CAAC;iDACe;AAGnC;IADC,KAAK,CAAC,iBAAiB,CAAC;iDACS;AApCvB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAgW1B;SAhWY,cAAc","sourcesContent":["import { css, html, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { TileDisplayMode } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport { BaseTileComponent } from './base-tile-component';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends BaseTileComponent\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n */\n\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n return html`\n <div id=\"container\" class=${isGridMode ? 'hoverable' : nothing}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=${this.linkTileHref}\n aria-label=${this.model?.title ?? 'Untitled item'}\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n )}\n >\n ${this.tile}\n </a>\n `;\n }\n\n private get linkTileHref(): string | typeof nothing {\n if (!this.model?.identifier || this.baseNavigationUrl == null)\n return nothing;\n\n // Use the server-specified href if available.\n // Otherwise, construct a details page URL from the item identifier.\n if (this.model.href) {\n return `${this.baseNavigationUrl}${this.model.href}`;\n }\n\n return this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n this.model.mediatype === 'collection'\n );\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode]\n );\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n private tileInfoButtonPressed(\n e: CustomEvent<{ x: number; y: number }>\n ): void {\n this.hoverPaneController?.toggleHoverPane({\n coords: e.detail,\n enableTouchBackdrop: true,\n });\n }\n\n private get tile() {\n const {\n model,\n collectionPagePath,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n creatorFilter,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .loggedIn=${this.loggedIn}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n #container.hoverable:hover {\n box-shadow: 0 0 6px 2px rgba(8, 8, 32, 0.8);\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 2;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAOzD,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yBAAyB,CAAC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AI,CAAC,YAAY;sBACrB,IAAI,CAAC,QAAQ;;6BAEN,CAAC;YACxB,KAAK,aAAa;gBAChB,OAAO,IAAI,CAAA;mBACA,KAAK;gCACQ,kBAAkB;iCACjB,IAAI,CAAC,mBAAmB;0BAC/B,YAAY;2BACX,aAAa;+BACT,iBAAiB;uBACzB,SAAS;2BACL,aAAa;8BACV,gBAAgB;0BACpB,IAAI,CAAC,YAAY;sBACrB,IAAI,CAAC,QAAQ;;qBAEd,CAAC;YAChB;gBACE,OAAO,OAAO,CAAC;SAClB;IACH,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+DT,CAAC;IACJ,CAAC;CACF,CAAA;AA3TC,+EAA+E;AACvD,uCAAwB,GAG5C;IACF,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,KAAK;IACpB,aAAa,EAAE,KAAK;CACpB,CAAA;AA3B0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAmC;AAElC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAgD;AAG3E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACwB;AAGtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAKrD;IADC,KAAK,CAAC,YAAY,CAAC;iDACe;AAGnC;IADC,KAAK,CAAC,iBAAiB,CAAC;iDACS;AApCvB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAiW1B;SAjWY,cAAc","sourcesContent":["import { css, html, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { TileDisplayMode } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport { BaseTileComponent } from './base-tile-component';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends BaseTileComponent\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n */\n\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n return html`\n <div id=\"container\" class=${isGridMode ? 'hoverable' : nothing}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=${this.linkTileHref}\n aria-label=${this.model?.title ?? 'Untitled item'}\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n )}\n >\n ${this.tile}\n </a>\n `;\n }\n\n private get linkTileHref(): string | typeof nothing {\n if (!this.model?.identifier || this.baseNavigationUrl == null)\n return nothing;\n\n // Use the server-specified href if available.\n // Otherwise, construct a details page URL from the item identifier.\n if (this.model.href) {\n return `${this.baseNavigationUrl}${this.model.href}`;\n }\n\n return this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n this.model.mediatype === 'collection'\n );\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode]\n );\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n private tileInfoButtonPressed(\n e: CustomEvent<{ x: number; y: number }>\n ): void {\n this.hoverPaneController?.toggleHoverPane({\n coords: e.detail,\n enableTouchBackdrop: true,\n });\n }\n\n private get tile() {\n const {\n model,\n collectionPagePath,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n creatorFilter,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .loggedIn=${this.loggedIn}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --tileBackgroundColor: var(--ia-theme-secondary-background-color, #fff);\n --imageBlockBackgroundColor: var(--ia-theme-primary-background-color, #f1f1f4);\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n #container.hoverable:hover {\n box-shadow: 0 0 6px 2px rgba(8, 8, 32, 0.8);\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 2;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n `;\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { SearchType } from '@internetarchive/search-service';
2
2
  import { expect } from '@open-wc/testing';
3
- import { getDefaultSelectedFacets } from '../src/models';
3
+ import { SortField, getDefaultSelectedFacets } from '../src/models';
4
4
  import { RestorationStateHandler } from '../src/restoration-state-handler';
5
5
  describe('Restoration state handler', () => {
6
6
  it('should restore query from URL', async () => {
@@ -163,6 +163,58 @@ describe('Restoration state handler', () => {
163
163
  expect(restorationState.selectedSort).to.equal('date');
164
164
  expect(restorationState.sortDirection).to.equal('asc');
165
165
  });
166
+ it('should restore sort from URL (space format)', async () => {
167
+ const handler = new RestorationStateHandler({ context: 'search' });
168
+ const url = new URL(window.location.href);
169
+ url.search = '?sort=foo+desc';
170
+ window.history.replaceState({ path: url.href }, '', url.href);
171
+ const restorationState = handler.getRestorationState();
172
+ expect(restorationState.selectedSort).to.equal('unrecognized');
173
+ expect(restorationState.sortDirection).to.equal('desc');
174
+ });
175
+ it('should restore unrecognized sort from URL (prefix format)', async () => {
176
+ const handler = new RestorationStateHandler({ context: 'search' });
177
+ const url = new URL(window.location.href);
178
+ url.search = '?sort=-foo';
179
+ window.history.replaceState({ path: url.href }, '', url.href);
180
+ const restorationState = handler.getRestorationState();
181
+ expect(restorationState.selectedSort).to.equal('unrecognized');
182
+ expect(restorationState.sortDirection).to.equal('desc');
183
+ });
184
+ it('should save direction to URL even for unrecognized sort fields', async () => {
185
+ const url = new URL(window.location.href);
186
+ url.search = '?sort=foo';
187
+ window.history.replaceState({ path: url.href }, '', url.href);
188
+ const handler = new RestorationStateHandler({ context: 'search' });
189
+ handler.persistState({
190
+ selectedSort: SortField.unrecognized,
191
+ sortDirection: 'desc',
192
+ selectedFacets: getDefaultSelectedFacets(),
193
+ });
194
+ expect(window.location.search).to.equal('?sort=-foo');
195
+ });
196
+ it('should keep existing direction for unrecognized sort fields when unspecified in state', async () => {
197
+ const url = new URL(window.location.href);
198
+ url.search = '?sort=foo+desc';
199
+ window.history.replaceState({ path: url.href }, '', url.href);
200
+ const handler = new RestorationStateHandler({ context: 'search' });
201
+ handler.persistState({
202
+ selectedSort: SortField.unrecognized,
203
+ selectedFacets: getDefaultSelectedFacets(),
204
+ });
205
+ expect(window.location.search).to.equal('?sort=-foo');
206
+ });
207
+ it('should just ignore unrecognized sort fields w/ unknown formats', async () => {
208
+ const url = new URL(window.location.href);
209
+ url.search = '?sort=+foo';
210
+ window.history.replaceState({ path: url.href }, '', url.href);
211
+ const handler = new RestorationStateHandler({ context: 'search' });
212
+ handler.persistState({
213
+ selectedSort: SortField.unrecognized,
214
+ selectedFacets: getDefaultSelectedFacets(),
215
+ });
216
+ expect(window.location.search).to.equal('?sort=+foo');
217
+ });
166
218
  it('should not save current page state to the URL for page 1', async () => {
167
219
  const url = new URL(window.location.href);
168
220
  url.search = '';
@@ -1 +1 @@
1
- {"version":3,"file":"restoration-state-handler.test.js","sourceRoot":"","sources":["../../test/restoration-state-handler.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,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I,uBAAuB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEnE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,GAAG,CAAC,MAAM,GAAG,uBAAuB,CAAC;QACrC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAE9D,qEAAqE;QACrE,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;QACvD,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QAEvC,wFAAwF;QACxF,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAC3D,qBAAqB,CACtB,CAAC;QACF,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { SearchType } from '@internetarchive/search-service';\nimport { expect } from '@open-wc/testing';\nimport { getDefaultSelectedFacets } from '../src/models';\nimport { RestorationStateHandler } from '../src/restoration-state-handler';\n\ndescribe('Restoration state handler', () => {\n it('should restore query from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?query=boop';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.baseQuery).to.equal('boop');\n });\n\n it('should restore metadata search type from URL without valid sin', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sin=foo';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.searchType).to.equal(SearchType.METADATA);\n });\n\n it('should restore metadata search type if sin explicitly empty in URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sin=';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.searchType).to.equal(SearchType.METADATA);\n });\n\n it('should restore full text search type from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sin=TXT';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.searchType).to.equal(SearchType.FULLTEXT);\n });\n\n it('should restore page number from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?page=42';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.currentPage).to.equal(42);\n });\n\n it('should restore selected year facets from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=year:\"2018\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.year['2018'].state).to.equal(\n 'selected'\n );\n });\n\n it('should ignore unrecognized facet types in URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=foo:\"bar\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets).to.deep.equal(\n getDefaultSelectedFacets()\n );\n });\n\n it('should restore selected date range facets from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=year:\"2018+TO+2021\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.minSelectedDate).to.equal('2018');\n expect(restorationState.maxSelectedDate).to.equal('2021');\n });\n\n it('should restore creator filter from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=firstCreator:F';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedCreatorFilter).to.equal('F');\n });\n\n it('should restore title filter from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=firstTitle:F';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedTitleFilter).to.equal('F');\n });\n\n it('should restore other selected facets from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=subject:\"foo\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.subject.foo.state).to.equal(\n 'selected'\n );\n });\n\n it('should restore negative facets from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?not[]=year:2018';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.year['2018'].state).to.equal(\n 'hidden'\n );\n });\n\n it('should restore multiple selected/negative facets from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search =\n '?and[]=collection:\"foo\"&and[]=collection:\"bar\"&not[]=collection:\"baz\"&not[]=collection:\"boop\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n\n expect(restorationState.selectedFacets.collection.foo.state).to.equal(\n 'selected'\n );\n expect(restorationState.selectedFacets.collection.bar.state).to.equal(\n 'selected'\n );\n\n expect(restorationState.selectedFacets.collection.baz.state).to.equal(\n 'hidden'\n );\n expect(restorationState.selectedFacets.collection.boop.state).to.equal(\n 'hidden'\n );\n });\n\n it('negative facets take precedence if both present in URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=collection:\"foo\"&not[]=collection:\"foo\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.collection.foo.state).to.equal(\n 'hidden'\n );\n });\n\n it('should restore selected facets with numbers in the square brackets', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[12]=subject:\"foo\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.subject.foo.state).to.equal(\n 'selected'\n );\n });\n\n it('should restore negative facets with numbers in the square brackets', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?not[12]=year:2018';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.year['2018'].state).to.equal(\n 'hidden'\n );\n });\n\n it('should restore sort from URL (space format)', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sort=date+desc';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedSort).to.equal('date');\n expect(restorationState.sortDirection).to.equal('desc');\n });\n\n it('should restore sort from URL (prefix format, desc)', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sort=-date';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedSort).to.equal('date');\n expect(restorationState.sortDirection).to.equal('desc');\n });\n\n it('should restore sort from URL (prefix format, asc)', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sort=date';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedSort).to.equal('date');\n expect(restorationState.sortDirection).to.equal('asc');\n });\n\n it('should not save current page state to the URL for page 1', async () => {\n const url = new URL(window.location.href);\n url.search = '';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n handler.persistState({\n currentPage: 1,\n selectedFacets: getDefaultSelectedFacets(),\n });\n\n expect(window.location.search).to.be.empty;\n });\n\n it('should save current page state to the URL when page > 1', async () => {\n const url = new URL(window.location.href);\n url.search = '';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n handler.persistState({\n currentPage: 2,\n selectedFacets: getDefaultSelectedFacets(),\n });\n\n expect(window.location.search).to.equal('?page=2');\n });\n\n it('should upgrade legacy search params to new ones', async () => {\n const url = new URL(window.location.href);\n url.search = '?q=foo';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n const restorationState = handler.getRestorationState();\n expect(restorationState.baseQuery).to.equal('foo');\n\n handler.persistState(restorationState);\n expect(window.location.search).to.equal('?query=foo');\n });\n\n it('should remove empty sin param', async () => {\n const url = new URL(window.location.href);\n url.search = '?sin=';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n\n handler.persistState({ selectedFacets: getDefaultSelectedFacets() });\n expect(window.location.search).to.equal('');\n });\n\n it('round trip load/persist should erase numbers in square brackets', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[0]=subject:\"foo\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n // Load state from the URL and immediately persist it back to the URL\n const restorationState = handler.getRestorationState();\n handler.persistState(restorationState);\n\n // Ensure the new URL includes the \"normalized\" facet parameter and not the numbered one\n expect(decodeURIComponent(window.location.search)).to.include(\n 'and[]=subject:\"foo\"'\n );\n expect(new URL(window.location.href).searchParams.get('and[0]')).to.be.null;\n });\n});\n"]}
1
+ {"version":3,"file":"restoration-state-handler.test.js","sourceRoot":"","sources":["../../test/restoration-state-handler.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,OAAO,GAAG,IAAI,uBAAuB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEnE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,GAAG,CAAC,MAAM,GAAG,aAAa,CAAC;QAC3B,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAE9D,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;QACvD,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;QAC9E,MAAM,OAAO,GAAG,IAAI,uBAAuB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEnE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,GAA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AAE,KAAK,IAAI,EAAE;QAC/E,MAAM,OAAO,GAAG,IAAI,uBAAuB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QAEnE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,GAAG,CAAC,MAAM,GAAG,uBAAuB,CAAC;QACrC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAE9D,qEAAqE;QACrE,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;QACvD,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QAEvC,wFAAwF;QACxF,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAC3D,qBAAqB,CACtB,CAAC;QACF,MAAM,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { SearchType } from '@internetarchive/search-service';\nimport { expect } from '@open-wc/testing';\nimport { SortField, getDefaultSelectedFacets } from '../src/models';\nimport { RestorationStateHandler } from '../src/restoration-state-handler';\n\ndescribe('Restoration state handler', () => {\n it('should restore query from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?query=boop';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.baseQuery).to.equal('boop');\n });\n\n it('should restore metadata search type from URL without valid sin', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sin=foo';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.searchType).to.equal(SearchType.METADATA);\n });\n\n it('should restore metadata search type if sin explicitly empty in URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sin=';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.searchType).to.equal(SearchType.METADATA);\n });\n\n it('should restore full text search type from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sin=TXT';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.searchType).to.equal(SearchType.FULLTEXT);\n });\n\n it('should restore page number from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?page=42';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.currentPage).to.equal(42);\n });\n\n it('should restore selected year facets from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=year:\"2018\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.year['2018'].state).to.equal(\n 'selected'\n );\n });\n\n it('should ignore unrecognized facet types in URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=foo:\"bar\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets).to.deep.equal(\n getDefaultSelectedFacets()\n );\n });\n\n it('should restore selected date range facets from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=year:\"2018+TO+2021\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.minSelectedDate).to.equal('2018');\n expect(restorationState.maxSelectedDate).to.equal('2021');\n });\n\n it('should restore creator filter from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=firstCreator:F';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedCreatorFilter).to.equal('F');\n });\n\n it('should restore title filter from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=firstTitle:F';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedTitleFilter).to.equal('F');\n });\n\n it('should restore other selected facets from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=subject:\"foo\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.subject.foo.state).to.equal(\n 'selected'\n );\n });\n\n it('should restore negative facets from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?not[]=year:2018';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.year['2018'].state).to.equal(\n 'hidden'\n );\n });\n\n it('should restore multiple selected/negative facets from URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search =\n '?and[]=collection:\"foo\"&and[]=collection:\"bar\"&not[]=collection:\"baz\"&not[]=collection:\"boop\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n\n expect(restorationState.selectedFacets.collection.foo.state).to.equal(\n 'selected'\n );\n expect(restorationState.selectedFacets.collection.bar.state).to.equal(\n 'selected'\n );\n\n expect(restorationState.selectedFacets.collection.baz.state).to.equal(\n 'hidden'\n );\n expect(restorationState.selectedFacets.collection.boop.state).to.equal(\n 'hidden'\n );\n });\n\n it('negative facets take precedence if both present in URL', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[]=collection:\"foo\"&not[]=collection:\"foo\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.collection.foo.state).to.equal(\n 'hidden'\n );\n });\n\n it('should restore selected facets with numbers in the square brackets', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[12]=subject:\"foo\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.subject.foo.state).to.equal(\n 'selected'\n );\n });\n\n it('should restore negative facets with numbers in the square brackets', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?not[12]=year:2018';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedFacets.year['2018'].state).to.equal(\n 'hidden'\n );\n });\n\n it('should restore sort from URL (space format)', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sort=date+desc';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedSort).to.equal('date');\n expect(restorationState.sortDirection).to.equal('desc');\n });\n\n it('should restore sort from URL (prefix format, desc)', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sort=-date';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedSort).to.equal('date');\n expect(restorationState.sortDirection).to.equal('desc');\n });\n\n it('should restore sort from URL (prefix format, asc)', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sort=date';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedSort).to.equal('date');\n expect(restorationState.sortDirection).to.equal('asc');\n });\n\n it('should restore sort from URL (space format)', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sort=foo+desc';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedSort).to.equal('unrecognized');\n expect(restorationState.sortDirection).to.equal('desc');\n });\n\n it('should restore unrecognized sort from URL (prefix format)', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?sort=-foo';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const restorationState = handler.getRestorationState();\n expect(restorationState.selectedSort).to.equal('unrecognized');\n expect(restorationState.sortDirection).to.equal('desc');\n });\n\n it('should save direction to URL even for unrecognized sort fields', async () => {\n const url = new URL(window.location.href);\n url.search = '?sort=foo';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n handler.persistState({\n selectedSort: SortField.unrecognized,\n sortDirection: 'desc',\n selectedFacets: getDefaultSelectedFacets(),\n });\n\n expect(window.location.search).to.equal('?sort=-foo');\n });\n\n it('should keep existing direction for unrecognized sort fields when unspecified in state', async () => {\n const url = new URL(window.location.href);\n url.search = '?sort=foo+desc';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n handler.persistState({\n selectedSort: SortField.unrecognized,\n selectedFacets: getDefaultSelectedFacets(),\n });\n\n expect(window.location.search).to.equal('?sort=-foo');\n });\n\n it('should just ignore unrecognized sort fields w/ unknown formats', async () => {\n const url = new URL(window.location.href);\n url.search = '?sort=+foo';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n handler.persistState({\n selectedSort: SortField.unrecognized,\n selectedFacets: getDefaultSelectedFacets(),\n });\n\n expect(window.location.search).to.equal('?sort=+foo');\n });\n\n it('should not save current page state to the URL for page 1', async () => {\n const url = new URL(window.location.href);\n url.search = '';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n handler.persistState({\n currentPage: 1,\n selectedFacets: getDefaultSelectedFacets(),\n });\n\n expect(window.location.search).to.be.empty;\n });\n\n it('should save current page state to the URL when page > 1', async () => {\n const url = new URL(window.location.href);\n url.search = '';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n handler.persistState({\n currentPage: 2,\n selectedFacets: getDefaultSelectedFacets(),\n });\n\n expect(window.location.search).to.equal('?page=2');\n });\n\n it('should upgrade legacy search params to new ones', async () => {\n const url = new URL(window.location.href);\n url.search = '?q=foo';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n const restorationState = handler.getRestorationState();\n expect(restorationState.baseQuery).to.equal('foo');\n\n handler.persistState(restorationState);\n expect(window.location.search).to.equal('?query=foo');\n });\n\n it('should remove empty sin param', async () => {\n const url = new URL(window.location.href);\n url.search = '?sin=';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n const handler = new RestorationStateHandler({ context: 'search' });\n\n handler.persistState({ selectedFacets: getDefaultSelectedFacets() });\n expect(window.location.search).to.equal('');\n });\n\n it('round trip load/persist should erase numbers in square brackets', async () => {\n const handler = new RestorationStateHandler({ context: 'search' });\n\n const url = new URL(window.location.href);\n url.search = '?and[0]=subject:\"foo\"';\n window.history.replaceState({ path: url.href }, '', url.href);\n\n // Load state from the URL and immediately persist it back to the URL\n const restorationState = handler.getRestorationState();\n handler.persistState(restorationState);\n\n // Ensure the new URL includes the \"normalized\" facet parameter and not the numbered one\n expect(decodeURIComponent(window.location.search)).to.include(\n 'and[]=subject:\"foo\"'\n );\n expect(new URL(window.location.href).searchParams.get('and[0]')).to.be.null;\n });\n});\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "1.8.0",
6
+ "version": "1.9.1-alpha.0",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -47,7 +47,6 @@ import './sort-filter-bar/sort-filter-bar';
47
47
  import {
48
48
  SelectedFacets,
49
49
  SortField,
50
- SortFieldToMetadataField,
51
50
  CollectionBrowserContext,
52
51
  getDefaultSelectedFacets,
53
52
  TileModel,
@@ -57,8 +56,8 @@ import {
57
56
  PrefixFilterCounts,
58
57
  prefixFilterAggregationKeys,
59
58
  FacetEventDetails,
60
- MetadataFieldToSortField,
61
- MetadataSortField,
59
+ sortOptionFromAPIString,
60
+ SORT_OPTIONS,
62
61
  } from './models';
63
62
  import {
64
63
  RestorationStateHandlerInterface,
@@ -608,12 +607,20 @@ export class CollectionBrowser
608
607
  }
609
608
 
610
609
  private selectedSortChanged(): void {
611
- if ([SortField.default, SortField.relevance].includes(this.selectedSort)) {
610
+ const sortOption = SORT_OPTIONS[this.selectedSort];
611
+ if (!sortOption.handledBySearchService) {
612
612
  this.sortParam = null;
613
613
  return;
614
614
  }
615
- const sortField = SortFieldToMetadataField[this.selectedSort];
616
- if (!this.sortDirection) this.sortDirection = 'desc';
615
+
616
+ // If the sort option specified in the URL is unrecognized, we just use it as-is
617
+ const urlSortParam = new URL(window.location.href).searchParams.get('sort');
618
+ const sortField =
619
+ sortOption.searchServiceKey ?? urlSortParam?.replace(/^-/, '');
620
+
621
+ // If the sort direction is still null at this point, then we assume ascending
622
+ // (i.e., it was unrecognized and had no directional flag)
623
+ if (!this.sortDirection) this.sortDirection = 'asc';
617
624
 
618
625
  if (!sortField) return;
619
626
  this.sortParam = { field: sortField, direction: this.sortDirection };
@@ -1272,7 +1279,6 @@ export class CollectionBrowser
1272
1279
  const restorationState: RestorationState = {
1273
1280
  displayMode: this.displayMode,
1274
1281
  searchType: this.searchType,
1275
- sortParam: this.sortParam ?? undefined,
1276
1282
  selectedSort: this.selectedSort,
1277
1283
  sortDirection: this.sortDirection ?? undefined,
1278
1284
  selectedFacets: this.selectedFacets ?? getDefaultSelectedFacets(),
@@ -1858,7 +1864,8 @@ export class CollectionBrowser
1858
1864
  dir = 'asc';
1859
1865
  }
1860
1866
 
1861
- const sortField = MetadataFieldToSortField[field as MetadataSortField];
1867
+ const sortOption = sortOptionFromAPIString(field);
1868
+ const sortField = sortOption.field;
1862
1869
  if (sortField && sortField !== SortField.default) {
1863
1870
  this.defaultSortField = sortField;
1864
1871
  this.defaultSortDirection = dir as SortDirection;
@@ -2187,7 +2194,7 @@ export class CollectionBrowser
2187
2194
  padding-left: 1rem;
2188
2195
  padding-right: 1rem;
2189
2196
  margin-top: var(--rightColumnMarginTop, 0);
2190
- background: #fff;
2197
+ background: var(--ia-theme-secondary-background-color, #fff);
2191
2198
  }
2192
2199
 
2193
2200
  .mobile #right-column {