From ab4fcbfc44704f4f4cd3456ea27d49342d9c0c5e Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sat, 19 Aug 2023 15:35:28 +0200 Subject: [PATCH] chore: downgrade prettier v3 is breaking vuepress for unknown reasons --- build/prepare-changelog.mjs | 3 +-- package.json | 2 +- .../core/src/adapters/EquirectangularAdapter.ts | 10 +--------- packages/core/src/buttons/MenuButton.ts | 8 ++++++-- packages/core/src/services/EventsHandler.ts | 6 ++++-- packages/gallery-plugin/src/constants.ts | 8 ++++++-- packages/map-plugin/src/MapPlugin.ts | 2 +- .../map-plugin/src/components/MapComponent.ts | 6 +++--- packages/markers-plugin/src/Marker.ts | 11 ++++------- packages/markers-plugin/src/MarkersPlugin.ts | 12 +++++++----- packages/markers-plugin/src/constants.ts | 8 ++++++-- packages/settings-plugin/src/constants.ts | 17 +++++++++++++---- packages/shared/tiles-utils.ts | 9 +-------- yarn.lock | 8 ++++---- 14 files changed, 58 insertions(+), 52 deletions(-) diff --git a/build/prepare-changelog.mjs b/build/prepare-changelog.mjs index 4a61e261a..c50d2a2d9 100644 --- a/build/prepare-changelog.mjs +++ b/build/prepare-changelog.mjs @@ -39,8 +39,7 @@ ${log .map((line) => line.trim()) .filter((line) => !line.startsWith('chore')) .map((line) => `- ${line}`) - .join('\n') -}`; + .join('\n')}`; console.log(content); writeFileAndExit(content); diff --git a/package.json b/package.json index 81156c17a..c4b776216 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "marked": "^4.2.3", "mocha": "^10.2.0", "postcss": "^8.4.21", - "prettier": "^3.0.1", + "prettier": "^2.8.8", "raw-loader": "^4.0.2", "sass": "^1.65.1", "scss-bundle": "^3.1.2", diff --git a/packages/core/src/adapters/EquirectangularAdapter.ts b/packages/core/src/adapters/EquirectangularAdapter.ts index fca0df916..dffce0026 100644 --- a/packages/core/src/adapters/EquirectangularAdapter.ts +++ b/packages/core/src/adapters/EquirectangularAdapter.ts @@ -4,14 +4,7 @@ import type { Viewer } from '../Viewer'; import { SPHERE_RADIUS } from '../data/constants'; import { SYSTEM } from '../data/system'; import { PanoData, PanoDataProvider, TextureData } from '../model'; -import { - createTexture, - firstNonNull, - getConfigParser, - getXMPValue, - isNil, - logWarn -} from '../utils'; +import { createTexture, firstNonNull, getConfigParser, getXMPValue, isNil, logWarn } from '../utils'; import { AbstractAdapter } from './AbstractAdapter'; import { interpolationWorkerSrc } from './interpolationWorker'; @@ -339,5 +332,4 @@ export class EquirectangularAdapter extends AbstractAdapter { croppedY: croppedY, }; } - } diff --git a/packages/core/src/buttons/MenuButton.ts b/packages/core/src/buttons/MenuButton.ts index 075b3d4c7..819566715 100644 --- a/packages/core/src/buttons/MenuButton.ts +++ b/packages/core/src/buttons/MenuButton.ts @@ -10,12 +10,16 @@ const MENU_TEMPLATE = (buttons: AbstractButton[], title: string) => `

${ICONS.menu} ${title}

    - ${buttons.map((button) => ` + ${buttons + .map( + (button) => `
  • ${button.content} ${button.title}
  • - `).join('')} + ` + ) + .join('')}
`; diff --git a/packages/core/src/services/EventsHandler.ts b/packages/core/src/services/EventsHandler.ts index 8f3525bbd..d2e8a9f3b 100644 --- a/packages/core/src/services/EventsHandler.ts +++ b/packages/core/src/services/EventsHandler.ts @@ -640,8 +640,10 @@ export class EventsHandler extends AbstractService { * Checks if the cursor was move beyond the move threshold */ private __moveThresholdReached(clientX: number, clientY: number) { - return Math.abs(clientX - this.data.startMouseX) >= this.moveThreshold - || Math.abs(clientY - this.data.startMouseY) >= this.moveThreshold; + return ( + Math.abs(clientX - this.data.startMouseX) >= this.moveThreshold + || Math.abs(clientY - this.data.startMouseY) >= this.moveThreshold + ); } /** diff --git a/packages/gallery-plugin/src/constants.ts b/packages/gallery-plugin/src/constants.ts index 9c2c84446..207a70544 100644 --- a/packages/gallery-plugin/src/constants.ts +++ b/packages/gallery-plugin/src/constants.ts @@ -25,7 +25,9 @@ export const ACTIVE_CLASS = 'psv-gallery-item--active'; * @internal */ export const ITEMS_TEMPLATE = (items: GalleryItem[], size: Size) => ` -${items.map((item) => ` +${items + .map( + (item) => ` -`).join('')} +` + ) + .join('')} `; diff --git a/packages/map-plugin/src/MapPlugin.ts b/packages/map-plugin/src/MapPlugin.ts index fa55365b6..7678baa71 100644 --- a/packages/map-plugin/src/MapPlugin.ts +++ b/packages/map-plugin/src/MapPlugin.ts @@ -43,7 +43,7 @@ const getConfig = utils.getConfigParser( return utils.cleanCssPosition(position, { allowCenter: false, cssOrder: true }) || defValue; }, rotation: (rotation) => utils.parseAngle(rotation), - coneColor: (coneColor) => coneColor ? new Color(coneColor).getStyle() : null, + coneColor: (coneColor) => (coneColor ? new Color(coneColor).getStyle() : null), defaultZoom: (defaultZoom) => Math.log(defaultZoom / 100), maxZoom: (maxZoom) => Math.log(maxZoom / 100), minZoom: (minZoom) => Math.log(minZoom / 100), diff --git a/packages/map-plugin/src/components/MapComponent.ts b/packages/map-plugin/src/components/MapComponent.ts index a2e738465..f57775c5e 100644 --- a/packages/map-plugin/src/components/MapComponent.ts +++ b/packages/map-plugin/src/components/MapComponent.ts @@ -493,9 +493,9 @@ export class MapComponent extends AbstractComponent { } context.restore(); }); - + const pinImage = this.__loadImage(this.config.pinImage); - if (pinImage || this.config.coneColor && this.config.coneSize) { + if (pinImage || (this.config.coneColor && this.config.coneSize)) { const pinPos = projectPoint(offset, yawAndRotation, zoom); const x = canvasVirtualCenterX - pinPos.x; @@ -510,7 +510,7 @@ export class MapComponent extends AbstractComponent { // draw the cone if (this.config.coneColor && this.config.coneSize) { const fov = MathUtils.degToRad(this.viewer.state.hFov); - const a1 = - Math.PI / 2 - fov / 2; + const a1 = -Math.PI / 2 - fov / 2; const a2 = a1 + fov; const c = this.config.coneSize; diff --git a/packages/markers-plugin/src/Marker.ts b/packages/markers-plugin/src/Marker.ts index 392cb3146..66280f6cd 100644 --- a/packages/markers-plugin/src/Marker.ts +++ b/packages/markers-plugin/src/Marker.ts @@ -640,13 +640,10 @@ export class Marker { if (this.viewer.config.requestHeaders) { this.loader.setRequestHeader(this.viewer.config.requestHeaders(this.config.imageLayer)); } - mesh.material.map = this.loader.load( - this.config.imageLayer, - (texture) => { - texture.anisotropy = 4; - this.viewer.needsUpdate(); - } - ); + mesh.material.map = this.loader.load(this.config.imageLayer, (texture) => { + texture.anisotropy = 4; + this.viewer.needsUpdate(); + }); this.definition = this.config.imageLayer; } diff --git a/packages/markers-plugin/src/MarkersPlugin.ts b/packages/markers-plugin/src/MarkersPlugin.ts index 5cf3d25d2..21a5888bf 100644 --- a/packages/markers-plugin/src/MarkersPlugin.ts +++ b/packages/markers-plugin/src/MarkersPlugin.ts @@ -638,9 +638,9 @@ export class MarkersPlugin extends AbstractConfigurablePlugin< viewerPosition, mouseover }: { - zoomLevel: number, - viewerPosition: Position, - mouseover: boolean + zoomLevel: number; + viewerPosition: Position; + mouseover: boolean; }) { if (mouseover !== null && marker.config.hoverScale) { marker.domElement.style.transition = `scale ${marker.config.hoverScale.duration}ms ${marker.config.hoverScale.easing}`; @@ -655,11 +655,13 @@ export class MarkersPlugin extends AbstractConfigurablePlugin< * It tests if the point is in the general direction of the camera, then check if it's in the viewport */ private __isMarkerVisible(marker: Marker, position: Point): boolean { - return marker.state.positions3D[0].dot(this.viewer.state.direction) > 0 + return ( + marker.state.positions3D[0].dot(this.viewer.state.direction) > 0 && position.x + marker.state.size.width >= 0 && position.x - marker.state.size.width <= this.viewer.state.size.width && position.y + marker.state.size.height >= 0 - && position.y - marker.state.size.height <= this.viewer.state.size.height; + && position.y - marker.state.size.height <= this.viewer.state.size.height + ); } /** diff --git a/packages/markers-plugin/src/constants.ts b/packages/markers-plugin/src/constants.ts index 90bc5dbdc..bb33a9b88 100644 --- a/packages/markers-plugin/src/constants.ts +++ b/packages/markers-plugin/src/constants.ts @@ -50,12 +50,16 @@ export const MARKERS_LIST_TEMPLATE = (markers: Marker[], title: string) => `

${icon} ${title}

    - ${markers.map((marker) => ` + ${markers + .map( + (marker) => `
  • ${marker.type === 'image' ? `` : ''} ${marker.getListContent()}
  • - `).join('')} + ` + ) + .join('')}
`; diff --git a/packages/settings-plugin/src/constants.ts b/packages/settings-plugin/src/constants.ts index 47cfeef19..b50219a55 100644 --- a/packages/settings-plugin/src/constants.ts +++ b/packages/settings-plugin/src/constants.ts @@ -34,12 +34,16 @@ export const SETTINGS_TEMPLATE_: Record = { */ export const SETTINGS_TEMPLATE = (settings: BaseSetting[], optionsCurrent: (s: OptionsSetting) => string) => `
    - ${settings.map((setting) => ` + ${settings + .map( + (setting) => `
  • ${SETTINGS_TEMPLATE_[setting.type](setting as OptionsSetting, optionsCurrent)}
  • - `).join('')} + ` + ) + .join('')}
`; @@ -53,12 +57,17 @@ export const SETTING_OPTIONS_TEMPLATE = (setting: OptionsSetting, optionActive: ${chevron} ${setting.label} - ${setting.options().map((option) => ` + ${setting + .options() + .map( + (option) => `
  • ${optionActive(option) ? check : ''} ${option.label}
  • - `).join('')} + ` + ) + .join('')} `; diff --git a/packages/shared/tiles-utils.ts b/packages/shared/tiles-utils.ts index c3a8a29cc..b3df30e92 100644 --- a/packages/shared/tiles-utils.ts +++ b/packages/shared/tiles-utils.ts @@ -1,12 +1,5 @@ import { PSVError, utils } from '@photo-sphere-viewer/core'; -import { - BufferGeometry, - LineSegments, - Material, - MeshBasicMaterial, - Object3D, - WireframeGeometry, -} from 'three'; +import { BufferGeometry, LineSegments, Material, MeshBasicMaterial, Object3D, WireframeGeometry } from 'three'; /** * Checks if the zoomRange properties are coherent diff --git a/yarn.lock b/yarn.lock index 8f86806a7..0a9446f07 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8362,10 +8362,10 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.0.tgz#c7df58393c9ba77d6fba3921ae01faf994fb9dc9" integrity sha512-9Lmg8hTFZKG0Asr/kW9Bp8tJjRVluO8EJQVfY2T7FMw9T5jy4I/Uvx0Rca/XWf50QQ1/SS48+6IJWnrb+2yemA== -prettier@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.1.tgz#65271fc9320ce4913c57747a70ce635b30beaa40" - integrity sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ== +prettier@^2.8.8: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== pretty-bytes@^5.3.0: version "5.6.0"