Skip to content

Commit

Permalink
Automatic update to new version.
Browse files Browse the repository at this point in the history
  • Loading branch information
thaibault committed Oct 16, 2024
1 parent 23e44a8 commit 6b96d55
Show file tree
Hide file tree
Showing 4 changed files with 337 additions and 298 deletions.
75 changes: 38 additions & 37 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ loading ?
experiencing a compiler bug.
*/
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
(globalContext.window?.google?.maps as Maps|undefined)?.mockup
(globalContext.window?.google?.maps as Maps | undefined)?.mockup
)
static renderUnsafe = true
static _name = 'StoreLocator'
Expand All @@ -399,32 +399,32 @@ loading ?
loaded = false

@property({type: object})
configuration: Partial<Configuration<Store>>|undefined
configuration: Partial<Configuration<Store>> | undefined
resolvedConfiguration: Configuration<Store> = {} as Configuration<Store>
urlConfiguration: null|PlainObject = null
urlConfiguration: null | PlainObject = null

// eslint-disable-next-line @typescript-eslint/no-unused-vars
filter = (_store: Store): boolean => true
items: Array<Item> = []
searchResultsStyleProperties: Mapping<number|string> = {}
searchResultsStyleProperties: Mapping<number | string> = {}
seenLocations: Array<string> = []
transformStore: (store: Store) => Store = identity

highlightedItem: Item|null = null
openWindow: Partial<InfoWindow>|null = null
highlightedItem: Item | null = null
openWindow: Partial<InfoWindow> | null = null
searchBoxInitialized = false
searchResultRange: Array<number>|null = null
searchResultRange: Array<number> | null = null
searchResults: Array<Item> = []
searchSegments: Array<string> = []
searchText: null|string = null
searchText: null | string = null
searchWords: Array<string> = []
searchResultsDirty = false

@property()
name = 'storeLocator'

@property({type: any})
default: Item|null = null
default: Item | null = null
dirty = false
@property({type: boolean, writeAttribute: true})
disabled = false
Expand All @@ -434,12 +434,12 @@ loading ?
required = false
valid = true
@property({type: any})
value: Item|null = null
value: Item | null = null

// NOTE: Will be initialized during bootstrapping.
map = null as unknown as MapImpl
markerClusterer: MarkerClusterer|null = null
resetMarkerCluster: null|(() => void) = null
markerClusterer: MarkerClusterer | null = null
resetMarkerCluster: null | (() => void) = null

readonly self = StoreLocator

Expand Down Expand Up @@ -527,7 +527,8 @@ loading ?

if (this.loaded && name === 'value') {
const givenValue: unknown = value
value = this.mapValue(value as Item|null|number|string|Store)
value =
this.mapValue(value as Item | null | number | string | Store)
if (givenValue !== value) {
this.setPropertyValue(name, value)

Expand Down Expand Up @@ -722,11 +723,11 @@ loading ?
if (!name)
name = this.resolvedConfiguration.name

const parameter: Array<string>|null|string =
getURLParameter(name) as Array<string>|null|string
const parameter: Array<string> | null | string =
getURLParameter(name) as Array<string> | null | string
if (typeof parameter === 'string') {
const evaluated: EvaluationResult<null|PlainObject> =
evaluate<null|PlainObject>(decodeURI(parameter))
const evaluated: EvaluationResult<null | PlainObject> =
evaluate<null | PlainObject>(decodeURI(parameter))

if (evaluated.error) {
console.warn(
Expand Down Expand Up @@ -787,12 +788,12 @@ loading ?

if (
globalContext.window &&
(globalContext.window.google as {maps: unknown}|undefined)?.maps
(globalContext.window.google as {maps: unknown} | undefined)?.maps
) {
this.self.maps = globalContext.window.google.maps

if (!applicationInterfaceLoadCallbacks.resolved)
void timeout((): Promise<void>|void =>
void timeout((): Promise<void> | void =>
applicationInterfaceLoadCallbacks.resolve()
)
} else if (!loadInitialized) {
Expand All @@ -808,7 +809,7 @@ loading ?
globalContext.window &&
(
globalContext.window.google as
{maps: unknown}|undefined
{maps: unknown} | undefined
)?.maps
) {
this.self.maps = globalContext.window.google.maps
Expand Down Expand Up @@ -837,7 +838,7 @@ loading ?
))
.done(callback)
.fail((
response: JQuery.jqXHR<string|undefined>,
response: JQuery.jqXHR<string | undefined>,
error: JQuery.Ajax.ErrorTextStatus
) => {
void applicationInterfaceLoadCallbacks.reject(error)
Expand Down Expand Up @@ -970,7 +971,7 @@ loading ?
* @param value - Value to initialize.
* @returns Determined value.
*/
mapValue(value?: Item|null|number|Store|string): Item|null {
mapValue(value?: Item | null | number | Store | string): Item | null {
if (![null, undefined].includes(value as null)) {
const hasID: boolean =
typeof value === 'object' &&
Expand Down Expand Up @@ -1017,7 +1018,7 @@ loading ?
// Adapt rendered html in map.
if (this.slots.input) {
// Focus input instead of whole locator.
const wrapper: HTMLDivElement|null =
const wrapper: HTMLDivElement | null =
this.root.querySelector('div[tabindex]')
if (wrapper)
wrapper.removeAttribute('tabindex')
Expand All @@ -1031,13 +1032,13 @@ loading ?
shortcutsButtons[0].setAttribute('tabindex', '-1')

if (this.slots.link) {
const wrapper: HTMLDivElement|null =
const wrapper: HTMLDivElement | null =
shortcutsButtons[shortcutsButtons.length - 1]
.closest('.gmnoprint')
if (wrapper) {
const sibling =
wrapper.cloneNode(true) as HTMLDivElement
const button: HTMLButtonElement|null =
const button: HTMLButtonElement | null =
sibling.querySelector('button')
if (button) {
button.before(this.slots.link)
Expand Down Expand Up @@ -1355,7 +1356,7 @@ loading ?
throw new Error('Missing search results slot.')

this.searchResultsStyleProperties = {}
const allStyleProperties: Mapping<number|string> =
const allStyleProperties: Mapping<number | string> =
$(this.slots.input).Tools('style')
for (const propertyName in allStyleProperties)
if (
Expand All @@ -1366,7 +1367,7 @@ loading ?
this.searchResultsStyleProperties[propertyName] =
allStyleProperties[propertyName]

const outerHeight: number|undefined =
const outerHeight: number | undefined =
$(this.slots.input).outerHeight(true)
if (outerHeight)
this.searchResultsStyleProperties.marginTop = outerHeight
Expand Down Expand Up @@ -1553,7 +1554,7 @@ loading ?
location: this.map.getCenter(),
query: this.searchText
},
(places: Array<MapPlaceResult>|null): void => {
(places: Array<MapPlaceResult> | null): void => {
if (places)
this.handleGenericSearchResults(places)

Expand All @@ -1579,7 +1580,7 @@ loading ?
const searchOptions: SearchConfiguration =
this.resolvedConfiguration.search as SearchConfiguration

const center: MapPosition|undefined = this.map.getCenter()
const center: MapPosition | undefined = this.map.getCenter()
/*
NOTE: Since google text search doesn't support sorting by distance
we have to sort by our own.
Expand Down Expand Up @@ -1667,7 +1668,7 @@ loading ?
const searchOptions: SearchConfiguration =
this.resolvedConfiguration.search as SearchConfiguration
const numberOfGenericSearchResults: number = results.length
const defaultProperties: Array<string>|null =
const defaultProperties: Array<string> | null =
Object.prototype.hasOwnProperty.call(searchOptions, 'properties') ?
searchOptions.properties :
null
Expand Down Expand Up @@ -1756,7 +1757,7 @@ loading ?
if (second.foundWords.length < first.foundWords.length)
return -1

const center: MapPosition|undefined = this.map.getCenter()
const center: MapPosition | undefined = this.map.getCenter()

let firstDistance = 0
let secondDistance = 0
Expand Down Expand Up @@ -1905,21 +1906,21 @@ loading ?
searchBox,
'places_changed',
(): void => {
const givenPlaces: Array<MapPlaceResult>|undefined =
const givenPlaces: Array<MapPlaceResult> | undefined =
searchBox.getPlaces()

if (!Array.isArray(givenPlaces))
return

this.ensurePlaceLocations(givenPlaces)
.then((places: Array<MapPlaceResult>): void => {
const foundPlace: MapPlaceResult|null =
const foundPlace: MapPlaceResult | null =
this.determineBestSearchResult(places)

if (foundPlace) {
let shortestDistanceInMeter: number =
Number.MAX_VALUE
let matchingItem: Item|undefined
let matchingItem: Item | undefined
for (const item of this.items) {
let distanceInMeter = 0
if (
Expand Down Expand Up @@ -2070,10 +2071,10 @@ loading ?
*/
determineBestSearchResult(
candidates: Array<MapPlaceResult>
): MapPlaceResult|null {
const center: MapPosition|undefined = this.map.getCenter()
): MapPlaceResult | null {
const center: MapPosition | undefined = this.map.getCenter()

let result: null|MapPlaceResult = null
let result: null | MapPlaceResult = null
if (center && candidates.length) {
let shortestDistanceInMeter: number = Number.MAX_VALUE
for (const candidate of candidates) {
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,33 @@
"@googlemaps/markerclusterer": "^2.5.3"
},
"devDependencies": {
"@babel/eslint-parser": "^7.25.7",
"@babel/eslint-parser": "^7.25.8",
"@babel/runtime": "^7.25.7",
"@stylistic/eslint-plugin-ts": "^2.9.0",
"@types/ejs": "^3.1.5",
"@types/google-maps": "^3.2.6",
"@types/html-minifier": "^4.0.5",
"@types/jquery": "^3.5.31",
"@types/jsdom": "^21.1.7",
"@types/node": "^22.7.4",
"@types/node": "^22.7.5",
"@types/prop-types": "^15.7.13",
"@types/supercluster": "^7.1.3",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.8.0",
"@typescript-eslint/eslint-plugin": "^8.9.0",
"@typescript-eslint/parser": "^8.9.0",
"@webcomponents/webcomponentsjs": "^2.8.0",
"clientnode": "^3.0.1201",
"documentation-website": "^1.0.335",
"clientnode": "^3.0.1205",
"documentation-website": "^1.0.336",
"eslint": "^9.12.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-jsdoc": "^50.3.1",
"eslint-plugin-jsdoc": "^50.4.1",
"jest": "^29.7.0",
"jquery": "^3.7.1",
"jsdoc": "^4.0.3",
"node-fetch": "^3.3.2",
"prop-types": "^15.8.1",
"typescript-eslint": "^8.8.0",
"web-component-wrapper": "^0.0.499",
"weboptimizer": "^2.0.1519",
"typescript-eslint": "^8.9.0",
"web-component-wrapper": "^0.0.501",
"weboptimizer": "^2.0.1522",
"webpack-dev-server": "^5.1.0"
},
"peerDependencies": {
Expand Down
Loading

0 comments on commit 6b96d55

Please sign in to comment.