Skip to content

Commit

Permalink
Update Lit and chai (#4922)
Browse files Browse the repository at this point in the history
* updated chai

* try to update Lit

* update TS
  • Loading branch information
elalish authored Oct 28, 2024
1 parent b8d6b32 commit 976796f
Show file tree
Hide file tree
Showing 75 changed files with 1,633 additions and 1,467 deletions.
2,884 changes: 1,523 additions & 1,361 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
"eslint-plugin-wc": "^1.3.0",
"http-server": "^14.1.1",
"husky": "^7.0.1",
"typescript": "4.8.4"
"typescript": "5.6.3"
}
}
14 changes: 6 additions & 8 deletions packages/model-viewer-effects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"filter"
],
"dependencies": {
"lit": "^2.2.3",
"lit": "^3.2.1",
"postprocessing": "^6.35.3"
},
"peerDependencies": {
Expand All @@ -83,15 +83,13 @@
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-replace": "^6.0.1",
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.1",
"@types/mocha": "^10.0.9",
"@types/pngjs": "^6.0.1",
"@types/three": "^0.164.0",
"@ungap/event-target": "^0.2.3",
"@web/test-runner": "^0.16.1",
"@web/test-runner-playwright": "^0.10.0",
"@esm-bundle/chai": "4.3.4",
"chai": "^4.3.6",
"@web/test-runner": "^0.19.0",
"@web/test-runner-playwright": "^0.11.0",
"chai": "^5.1.2",
"focus-visible": "^5.2.0",
"http-server": "^14.1.1",
"mocha": "^10.0.0",
Expand All @@ -102,7 +100,7 @@
"rollup-plugin-polyfill": "^3.0.0",
"@rollup/plugin-terser": "^0.4.4",
"three": "^0.169.0",
"typescript": "4.8.4"
"typescript": "5.6.3"
},
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {ModelViewerElement} from '@google/model-viewer';
import {expect} from 'chai';
import {DotScreenEffect, Effect, EffectPass, GridEffect} from 'postprocessing';
import {Camera} from 'three';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {ModelViewerElement} from '@google/model-viewer';
import {expect} from 'chai';

import {ColorGradeEffect, EffectComposer} from '../../model-viewer-effects.js';
import {ArraysAreEqual, assetPath, AverageHSL, CompareArrays, createModelViewerElement, rafPasses, screenshot, waitForEvent} from '../utilities.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer-effects/src/test/utilities-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {ModelViewerElement} from '@google/model-viewer';
import {Renderer} from '@google/model-viewer/lib/three-components/Renderer.js';
import {expect} from 'chai';

import {$effectComposer} from '../effect-composer.js';
import {EffectComposer} from '../model-viewer-effects.js';
Expand Down
13 changes: 6 additions & 7 deletions packages/model-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"3d"
],
"dependencies": {
"lit": "^2.7.2",
"lit": "^3.2.1",
"@monogrid/gainmap-js": "^3.0.1"
},
"peerDependencies": {
Expand All @@ -93,14 +93,13 @@
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-replace": "^6.0.1",
"@types/chai": "^4.3.1",
"@types/mocha": "^9.1.1",
"@types/mocha": "^10.0.9",
"@types/pngjs": "^6.0.1",
"@types/three": "^0.164.0",
"@ungap/event-target": "^0.2.3",
"@web/test-runner": "^0.16.1",
"@web/test-runner-playwright": "^0.10.0",
"@esm-bundle/chai": "4.3.4",
"@web/test-runner": "^0.19.0",
"@web/test-runner-playwright": "^0.11.0",
"chai": "^5.1.2",
"http-server": "^14.1.1",
"mocha": "^10.0.0",
"npm-run-all": "^4.1.5",
Expand All @@ -109,7 +108,7 @@
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-polyfill": "^3.0.0",
"@rollup/plugin-terser": "^0.4.4",
"typescript": "4.8.4",
"typescript": "5.6.3",
"three": "^0.169.0"
},
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/model-viewer/src/features/scene-graph/material.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class Material extends ThreeDOMElement implements MaterialInterface {
return (this[$correlatedObjects] as Set<MeshPhysicalMaterial>)
.values()
.next()
.value;
.value!;
}

constructor(
Expand Down Expand Up @@ -98,7 +98,7 @@ export class Material extends ThreeDOMElement implements MaterialInterface {
new PBRMetallicRoughness(onUpdate, correlatedMaterials);

const {normalMap, aoMap, emissiveMap} =
correlatedMaterials.values().next().value;
correlatedMaterials.values().next().value!;

this[$normalTexture] = new TextureInfo(
onUpdate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class PrimitiveNode extends Node {
if (baseMaterial != null) {
this.mesh.material = baseMaterial;
} else {
this.mesh.material = backingMaterials.values().next().value;
this.mesh.material = backingMaterials.values().next().value!;
}

this.parser.assignFinalMaterial(this.mesh);
Expand Down Expand Up @@ -247,7 +247,8 @@ export class PrimitiveNode extends Node {
const map = this.mesh.userData.variantMaterials! as
Map<number, UserDataVariantMapping>;
map.set(variantIndex, {
material: materialVariant[$correlatedObjects]!.values().next().value,
material: materialVariant[$correlatedObjects]!.values().next().value as
ThreeMaterial,
gltfMaterialIndex: materialVariant.index,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class PBRMetallicRoughness extends ThreeDOMElement implements
onUpdate: () => void, correlatedMaterials: Set<MeshPhysicalMaterial>) {
super(onUpdate, correlatedMaterials);

const {map, metalnessMap} = correlatedMaterials.values().next().value;
const {map, metalnessMap} = correlatedMaterials.values().next().value!;

this[$baseColorTexture] =
new TextureInfo(onUpdate, TextureUsage.Base, map, correlatedMaterials);
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/decorators-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';
import {ReactiveElement} from 'lit';
import {property} from 'lit/decorators.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/features/animation-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {$scene} from '../../model-viewer-base.js';
import {ModelViewerElement} from '../../model-viewer.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/features/annotation-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';
import {Vector3} from 'three';

import {$needsRender, $scene, toVector3D, Vector2D, Vector3D} from '../../model-viewer-base.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/features/ar-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {IS_ANDROID, IS_IOS} from '../../constants.js';
import {$openIOSARQuickLook, $openSceneViewer} from '../../features/ar.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/features/controls-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';
import {Camera, Vector3} from 'three';

import {$controls, $promptAnimatedContainer, $promptElement, CameraChangeDetails, cameraOrbitIntrinsics, ControlsInterface, DEFAULT_FOV_DEG, DEFAULT_MIN_FOV_DEG, INTERACTION_PROMPT, SphericalPosition} from '../../features/controls.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';
import {Texture} from 'three';

import {BASE_OPACITY} from '../../features/environment.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/features/loading-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {$defaultPosterElement, $posterContainerElement} from '../../features/loading.js';
import {$scene, $userInputElement} from '../../model-viewer-base.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';
import {Mesh, MeshStandardMaterial} from 'three';

import {$currentGLTF} from '../../features/scene-graph.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {MeshStandardMaterial, Texture as ThreeTexture} from 'three';
import {expect} from 'chai';
import {Material, MeshStandardMaterial, Texture as ThreeTexture} from 'three';

import {$threeTexture} from '../../../features/scene-graph/image.js';
import {$lazyLoadGLTFInfo} from '../../../features/scene-graph/material.js';
Expand Down Expand Up @@ -164,10 +164,11 @@ suite('scene-graph/material', () => {

test('test alpha cutoff expect disabled by default', async () => {
await loadModel(HELMET_GLB_PATH);
expect(element.model!.materials[0]![$correlatedObjects]
?.values()
.next()
.value.alphaTest)
expect((element.model!.materials[0]![$correlatedObjects]
?.values()
.next()
.value as Material)
.alphaTest)
.to.be.equal(0);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';
import {MeshStandardMaterial} from 'three/src/materials/MeshStandardMaterial.js';
import {Mesh} from 'three/src/objects/Mesh.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';
import {MeshStandardMaterial} from 'three/src/materials/MeshStandardMaterial.js';

import {$primitivesList, $variantData, Model} from '../../../../features/scene-graph/model.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {TextureInfo} from '../../../features/scene-graph/texture-info.js';
import {ModelViewerElement} from '../../../model-viewer.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';
import {Texture as ThreeTexture} from 'three';

import {$threeTexture} from '../../../features/scene-graph/image.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/features/staging-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {CameraChangeDetails} from '../../features/controls.js';
import {ModelViewerElement} from '../../model-viewer.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/model-viewer-base-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {$renderer, $scene, $userInputElement} from '../model-viewer-base.js';
import {ModelViewerElement} from '../model-viewer.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/model-viewer-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {$renderer} from '../model-viewer-base.js';
import {ModelViewerElement} from '../model-viewer.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/styles/conversions-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {degreesToRadians, lengthToBaseMeters, normalizeUnit, radiansToDegrees} from '../../styles/conversions.js';
import {numberNode} from '../../styles/parsers.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {enumerationDeserializer} from '../../styles/deserializers.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/styles/evaluators-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {CalcEvaluator, EnvEvaluator, OperatorEvaluator, PercentageEvaluator, SphericalIntrinsics, StyleEvaluator} from '../../styles/evaluators.js';
import {numberNode} from '../../styles/parsers.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/styles/parsers-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {ASTWalker, IdentNode, NumberNode, numberNode, parseExpressions} from '../../styles/parsers.js';
import {expressionNode, functionNode, hexNode, identNode, operatorNode} from '../helpers.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import {parseExpressions} from '../../styles/parsers.js';
import {EnvironmentState, StyleEffector} from '../../styles/style-effector.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/model-viewer/src/test/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type Constructor<T = object> = {
new (...args: any[]): T
};

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

export const BasicSpecTemplate =
(ModelViewerElementAccessor: () => Constructor<ModelViewerElementBase>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';
import {Matrix4, PerspectiveCamera, Vector2, Vector3} from 'three';

import {$scene} from '../../model-viewer-base.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

import {expect} from '@esm-bundle/chai';
import {expect} from 'chai';

import ModelViewerElementBase from '../../model-viewer-base.js';
import {$evictionPolicy, CachingGLTFLoader} from '../../three-components/CachingGLTFLoader.js';
Expand Down
Loading

0 comments on commit 976796f

Please sign in to comment.