Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@internetarchive/collection-browser

Package Overview
Dependencies
Maintainers
15
Versions
607
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internetarchive/collection-browser - npm Package Compare versions

Comparing version 0.0.1-alpha.32 to 0.0.1-alpha.33

dist/src/language-code-handler/language-code-handler.d.ts

1

dist/src/collection-browser.d.ts

@@ -60,2 +60,3 @@ import { LitElement, PropertyValues, TemplateResult } from 'lit';

private contentContainer;
private languageCodeHandler;
/**

@@ -62,0 +63,0 @@ * When we're animated scrolling to the page, we don't want to fetch

@@ -18,2 +18,3 @@ import { __decorate } from "tslib";

import chevronIcon from './assets/img/icons/chevron';
import { LanguageCodeHandler } from './language-code-handler/language-code-handler';
let CollectionBrowser = class CollectionBrowser extends LitElement {

@@ -50,2 +51,3 @@ constructor() {

this.mobileFacetsVisible = false;
this.languageCodeHandler = new LanguageCodeHandler();
/**

@@ -250,2 +252,3 @@ * When we're animated scrolling to the page, we don't want to fetch

.collectionNameCache=${this.collectionNameCache}
.languageCodeHandler=${this.languageCodeHandler}
?collapsableFacets=${this.mobileView}

@@ -490,3 +493,12 @@ ?facetsLoading=${this.facetDataLoading}

for (const [key, facetState] of facetEntries) {
facetValuesArray.push(`${facetState === 'hidden' ? '-' : ''}"${key}"`);
const plusMinusPrefix = facetState === 'hidden' ? '-' : '';
if (facetName === 'language') {
const languages = this.languageCodeHandler.getCodeArrayFromCodeString(key);
for (const language of languages) {
facetValuesArray.push(`${plusMinusPrefix}"${language}"`);
}
}
else {
facetValuesArray.push(`${plusMinusPrefix}"${key}"`);
}
}

@@ -493,0 +505,0 @@ const valueQuery = facetValuesArray.join(` OR `);

@@ -8,2 +8,3 @@ import { LitElement, PropertyValues, TemplateResult } from 'lit';

import { FacetOption, SelectedFacets } from './models';
import { LanguageCodeHandlerInterface } from './language-code-handler/language-code-handler';
export declare class CollectionFacets extends LitElement {

@@ -18,2 +19,3 @@ aggregations?: Record<string, Aggregation>;

collapsableFacets: boolean;
languageCodeHandler?: LanguageCodeHandlerInterface;
collectionNameCache?: CollectionNameCacheInterface;

@@ -20,0 +22,0 @@ openFacets: Record<FacetOption, boolean>;

21

dist/src/collection-facets.js

@@ -13,3 +13,2 @@ import { __decorate } from "tslib";

import { defaultSelectedFacets, } from './models';
import { codeToLanguageMap, languageToCodeMap } from './language-code-mapping';
const facetDisplayOrder = [

@@ -156,3 +155,3 @@ 'mediatype',

const buckets = Object.entries(selectedFacets).map(([value, facetState]) => {
var _a;
var _a, _b;
let displayText = value;

@@ -162,3 +161,4 @@ // for selected languages, we store the language code instead of the

if (option === 'language') {
displayText = (_a = codeToLanguageMap[value]) !== null && _a !== void 0 ? _a : value;
displayText =
(_b = (_a = this.languageCodeHandler) === null || _a === void 0 ? void 0 : _a.getLanguageNameFromCodeString(value)) !== null && _b !== void 0 ? _b : value;
}

@@ -180,2 +180,7 @@ return {

}
// private languageDelimiter = '•••';
// private getLanguageName(languageCode: string): string {
// const split = languageCode.split(this.languageDelimiter);
// return languageCode;
// }
/**

@@ -195,2 +200,3 @@ * Converts the raw `aggregations` to `FacetGroups`, which are easier to use

const facetBuckets = castedBuckets.map(bucket => {
var _a, _b;
let bucketKey = bucket.key;

@@ -200,4 +206,6 @@ // for languages, we need to search by language code instead of the

if (option === 'language') {
const languageCodeKey = languageToCodeMap[bucket.key];
bucketKey = languageCodeKey !== null && languageCodeKey !== void 0 ? languageCodeKey : bucket.key;
// const languageCodeKey = languageToCodeMap[bucket.key];
bucketKey =
(_b = (_a = this.languageCodeHandler) === null || _a === void 0 ? void 0 : _a.getCodeStringFromLanguageName(`${bucket.key}`)) !== null && _b !== void 0 ? _b : bucket.key;
// bucketKey = languageCodeKey ?? bucket.key;
}

@@ -526,2 +534,5 @@ return {

property({ type: Object })
], CollectionFacets.prototype, "languageCodeHandler", void 0);
__decorate([
property({ type: Object })
], CollectionFacets.prototype, "collectionNameCache", void 0);

@@ -528,0 +539,0 @@ __decorate([

@@ -6,3 +6,3 @@ {

"author": "Internet Archive",
"version": "0.0.1-alpha.32",
"version": "0.0.1-alpha.33",
"main": "dist/index.js",

@@ -9,0 +9,0 @@ "module": "dist/index.js",

@@ -54,2 +54,3 @@ /* eslint-disable import/no-duplicates */

import chevronIcon from './assets/img/icons/chevron';
import { LanguageCodeHandler } from './language-code-handler/language-code-handler';

@@ -146,2 +147,4 @@ @customElement('collection-browser')

private languageCodeHandler = new LanguageCodeHandler();
/**

@@ -369,2 +372,3 @@ * When we're animated scrolling to the page, we don't want to fetch

.collectionNameCache=${this.collectionNameCache}
.languageCodeHandler=${this.languageCodeHandler}
?collapsableFacets=${this.mobileView}

@@ -645,3 +649,13 @@ ?facetsLoading=${this.facetDataLoading}

for (const [key, facetState] of facetEntries) {
facetValuesArray.push(`${facetState === 'hidden' ? '-' : ''}"${key}"`);
const plusMinusPrefix = facetState === 'hidden' ? '-' : '';
if (facetName === 'language') {
const languages =
this.languageCodeHandler.getCodeArrayFromCodeString(key);
for (const language of languages) {
facetValuesArray.push(`${plusMinusPrefix}"${language}"`);
}
} else {
facetValuesArray.push(`${plusMinusPrefix}"${key}"`);
}
}

@@ -648,0 +662,0 @@ const valueQuery = facetValuesArray.join(` OR `);

@@ -27,3 +27,3 @@ /* eslint-disable import/no-duplicates */

} from './models';
import { codeToLanguageMap, languageToCodeMap } from './language-code-mapping';
import { LanguageCodeHandlerInterface } from './language-code-handler/language-code-handler';

@@ -76,2 +76,5 @@ const facetDisplayOrder: FacetOption[] = [

@property({ type: Object })
languageCodeHandler?: LanguageCodeHandlerInterface;
@property({ type: Object })
collectionNameCache?: CollectionNameCacheInterface;

@@ -222,3 +225,6 @@

if (option === 'language') {
displayText = codeToLanguageMap[value] ?? value;
displayText =
this.languageCodeHandler?.getLanguageNameFromCodeString(
value
) ?? value;
}

@@ -245,2 +251,10 @@ return {

// private languageDelimiter = '•••';
// private getLanguageName(languageCode: string): string {
// const split = languageCode.split(this.languageDelimiter);
// return languageCode;
// }
/**

@@ -262,4 +276,8 @@ * Converts the raw `aggregations` to `FacetGroups`, which are easier to use

if (option === 'language') {
const languageCodeKey = languageToCodeMap[bucket.key];
bucketKey = languageCodeKey ?? bucket.key;
// const languageCodeKey = languageToCodeMap[bucket.key];
bucketKey =
this.languageCodeHandler?.getCodeStringFromLanguageName(
`${bucket.key}`
) ?? bucket.key;
// bucketKey = languageCodeKey ?? bucket.key;
}

@@ -266,0 +284,0 @@ return {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc