Skip to content

Commit

Permalink
chore: downgrade prettier
Browse files Browse the repository at this point in the history
v3 is breaking vuepress for unknown reasons
  • Loading branch information
mistic100 committed Aug 19, 2023
1 parent 0313d9b commit ab4fcbf
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 52 deletions.
3 changes: 1 addition & 2 deletions build/prepare-changelog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 1 addition & 9 deletions packages/core/src/adapters/EquirectangularAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -339,5 +332,4 @@ export class EquirectangularAdapter extends AbstractAdapter<string, Texture> {
croppedY: croppedY,
};
}

}
8 changes: 6 additions & 2 deletions packages/core/src/buttons/MenuButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ const MENU_TEMPLATE = (buttons: AbstractButton[], title: string) => `
<div class="psv-panel-menu psv-panel-menu--stripped">
<h1 class="psv-panel-menu-title">${ICONS.menu} ${title}</h1>
<ul class="psv-panel-menu-list">
${buttons.map((button) => `
${buttons
.map(
(button) => `
<li data-psv-button="${button.id}" class="psv-panel-menu-item" tabindex="0">
<span class="psv-panel-menu-item-icon">${button.content}</span>
<span class="psv-panel-menu-item-label">${button.title}</span>
</li>
`).join('')}
`
)
.join('')}
</ul>
</div>
`;
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/services/EventsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

/**
Expand Down
8 changes: 6 additions & 2 deletions packages/gallery-plugin/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ export const ACTIVE_CLASS = 'psv-gallery-item--active';
* @internal
*/
export const ITEMS_TEMPLATE = (items: GalleryItem[], size: Size) => `
${items.map((item) => `
${items
.map(
(item) => `
<div class="psv-gallery-item" data-${GALLERY_ITEM_DATA_KEY}="${item.id}" style="width:${size.width}px">
<div class="psv-gallery-item-wrapper" style="padding-bottom:calc(100% * ${size.height} / ${size.width})">
${item.name ? `<div class="psv-gallery-item-title"><span>${item.name}</span></div>` : ''}
<svg class="psv-gallery-item-thumb" viewBox="0 0 200 200" preserveAspectRatio="xMidYMid slice"><use href="#psvGalleryBlankIcon"></use></svg>
${item.thumbnail ? `<div class="psv-gallery-item-thumb" data-src="${item.thumbnail}"></div>` : ''}
</div>
</div>
`).join('')}
`
)
.join('')}
`;
2 changes: 1 addition & 1 deletion packages/map-plugin/src/MapPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const getConfig = utils.getConfigParser<MapPluginConfig, ParsedMapPluginConfig>(
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),
Expand Down
6 changes: 3 additions & 3 deletions packages/map-plugin/src/components/MapComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
11 changes: 4 additions & 7 deletions packages/markers-plugin/src/Marker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
12 changes: 7 additions & 5 deletions packages/markers-plugin/src/MarkersPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand All @@ -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
);
}

/**
Expand Down
8 changes: 6 additions & 2 deletions packages/markers-plugin/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ export const MARKERS_LIST_TEMPLATE = (markers: Marker[], title: string) => `
<div class="psv-panel-menu psv-panel-menu--stripped">
<h1 class="psv-panel-menu-title">${icon} ${title}</h1>
<ul class="psv-panel-menu-list">
${markers.map((marker) => `
${markers
.map(
(marker) => `
<li data-${MARKER_DATA_KEY}="${marker.id}" class="psv-panel-menu-item" tabindex="0">
${marker.type === 'image' ? `<span class="psv-panel-menu-item-icon"><img src="${marker.definition}"/></span>` : ''}
<span class="psv-panel-menu-item-label">${marker.getListContent()}</span>
</li>
`).join('')}
`
)
.join('')}
</ul>
</div>
`;
17 changes: 13 additions & 4 deletions packages/settings-plugin/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ export const SETTINGS_TEMPLATE_: Record<BaseSetting['type'], any> = {
*/
export const SETTINGS_TEMPLATE = (settings: BaseSetting[], optionsCurrent: (s: OptionsSetting) => string) => `
<ul class="psv-settings-list">
${settings.map((setting) => `
${settings
.map(
(setting) => `
<li class="psv-settings-item" tabindex="0"
data-${SETTING_DATA_KEY}="${setting.id}" data-${OPTION_DATA_KEY}="${ID_ENTER}">
${SETTINGS_TEMPLATE_[setting.type](setting as OptionsSetting, optionsCurrent)}
</li>
`).join('')}
`
)
.join('')}
</ul>
`;

Expand All @@ -53,12 +57,17 @@ export const SETTING_OPTIONS_TEMPLATE = (setting: OptionsSetting, optionActive:
<span class="psv-settings-item-icon">${chevron}</span>
<span class="psv-settings-item-label">${setting.label}</span>
</li>
${setting.options().map((option) => `
${setting
.options()
.map(
(option) => `
<li class="psv-settings-item" tabindex="0"
data-${SETTING_DATA_KEY}="${setting.id}" data-${OPTION_DATA_KEY}="${option.id}">
<span class="psv-settings-item-icon">${optionActive(option) ? check : ''}</span>
<span class="psv-settings-item-value">${option.label}</span>
</li>
`).join('')}
`
)
.join('')}
</ul>
`;
9 changes: 1 addition & 8 deletions packages/shared/tiles-utils.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ab4fcbf

Please sign in to comment.