From 19b29623e088b204417d4ad70f20b7cd378deb0a Mon Sep 17 00:00:00 2001 From: Orion Reed Date: Wed, 18 Dec 2024 19:07:52 -0500 Subject: [PATCH] simplify imports setup --- .prettierrc | 8 +++++-- bun.lockb | Bin 32138 -> 32978 bytes labs/folk-arrow.ts | 12 +++++------ labs/folk-base-connection.ts | 8 +++---- labs/folk-base-set.ts | 4 +--- labs/folk-distance-field.ts | 12 +++++------ labs/folk-graph.ts | 3 +-- labs/folk-hull.ts | 4 ++-- labs/folk-ink.ts | 8 +++---- labs/folk-map.ts | 11 +++++----- labs/folk-physics.ts | 20 +++++++++--------- labs/folk-projector.ts | 2 +- labs/folk-proximity.ts | 5 ++--- labs/folk-rope.ts | 7 ++----- labs/folk-sand.glsl.ts | 2 +- labs/folk-sand.ts | 12 +++++------ labs/folk-shape.ts | 30 +++++++++++++-------------- labs/folk-space-projector.ts | 2 +- labs/folk-space-radial.ts | 8 ++----- labs/folk-space.ts | 4 ++-- labs/folk-spreadsheet.ts | 10 ++++----- labs/folk-toolset.ts | 3 +-- labs/folk-xanadu.ts | 18 ++++++++-------- lib/index.ts | 13 +++++------- package.json | 3 ++- website/canvas/src/folk-metronome.ts | 2 +- website/canvas/src/folk-timer.ts | 2 +- 27 files changed, 97 insertions(+), 116 deletions(-) diff --git a/.prettierrc b/.prettierrc index 1435ec0..eb7bff1 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,9 @@ { "singleQuote": true, "printWidth": 120, - "htmlWhitespaceSensitivity": "strict" -} + "htmlWhitespaceSensitivity": "strict", + "plugins": [ + "prettier-plugin-organize-imports" + ], + "organizeImportsSkipDestructiveCodeActions": true +} \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index a6b5631cdf56bffec1ab9a42ceb766d00f62f13b..75922242c6a5b3acdf232f43548a115979087132 100755 GIT binary patch delta 4647 zcmd5--?!cU zyZ7C1^+WdYo8mh2fKRegzFG9R`|P?Adl#+gSUaR_*C&nlt2=$7Q|oRgNh=2rb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>0RgMF zxd}|`2N-IL%ENk($GF1Eu?rB9J&ejivZW{D$P??54#!bntjo9vk?SFo*(rU?O5t%X z>6Dc`aW3Nm1Y$0g#5tvBWg16@0Vhc{9YIE$jrw9-()VoSvAU!a(5x<=Kx0<7)M}@2 z874b<0LSgrC%d?X#$>lt9#7#mm((9m9>9rs>a*o`V+S%J1_-8w;Zze_T}d~hgd7Y? zNjIYK$KaGY=Bs8V5VOOan*Isct+;%G!%eoMeVmNUrS+8mq+-Hg}t^J!9cxpfYXZg5GA zlIf#2plyLxL{m$Bv~j74GIPD$OPh0jl#*+rv(QRtvC~J#p*`;O@=`htZL8Bn`FUPm z78uBjGU4mS~Tbr6GIv!UhdYwx>k0zhnD{FWL1x#FJ2 zT=YVv-y(uL53&p*j`|desq)ShM@J1r9Q@)(BAOQm$Z!QdNGW8hOuAikrUW87S_CPC z6hLqjVJjeaLY70^5Le(tRVsJf0g7R>Rgip0F~kG$LPS+}LBt$YSK)(X^#|_sb#gjh zoi3eW6kgLK;5#)|K0zg`rmhC<5}mG-`5d|eFa3fZNH#R2pWhM{ z^s1vp^>U_up?_@0fA;(|$#OAh*RT8^HtyQAWY74upyeQS)ysDMiO?|iwfvQyt~Y~r zP9ya)pGy<)(jOR=e?GYP+wX0*1-)A78rs(%Bncg*{A}m3o}gWSvh;cf*Ijxsyf|nH zP)UQ#C+XgX3|>Z0H^_GV6_I-E`SnxlepD~<#>Ht4F<0$0*??9M^teRyyfJh2ldI0( zf5^bo(;Q3E(izh)^5w3hsqqPx?*}dWD4|id>lgoL?db>Jy3kr1v`_vr)WEkVnrNcxrEYS-Uhqh|+(qv8ra2s&8kZ|FcW-O?n->o2#g;=@1L z``sUR1ifS{ZEvz>>F=M|sB^_BTMI|AMA>PMth5ZKzl4&1v#(--z1^T%GSil_PMJq%yPLmZtH(Kl r=RnURIhlv~M)TFOpenStreetMap', - }) + }), ); this.#map.setView( (this.getAttribute('coordinates') || '0, 0').split(',').map(Number) as LatLngExpression, - Number(this.getAttribute('zoom') || 13) + Number(this.getAttribute('zoom') || 13), ); return root; diff --git a/labs/folk-physics.ts b/labs/folk-physics.ts index 52d3d44..efc0c39 100644 --- a/labs/folk-physics.ts +++ b/labs/folk-physics.ts @@ -1,9 +1,9 @@ -import { DOMRectTransform } from '@lib/DOMRectTransform.ts'; -import { FolkBaseSet } from './folk-base-set.ts'; -import { PropertyValues } from '@lit/reactive-element'; -import { FolkShape } from './folk-shape'; import RAPIER, { init } from '@dimforge/rapier2d-compat'; -import { TransformIntegrator } from '@lib/EffectIntegrator.ts'; +import { DOMRectTransform, TransformIntegrator } from '@lib'; +import { PropertyValues } from '@lit/reactive-element'; +import { FolkBaseSet } from './folk-base-set.ts'; +import { FolkShape } from './folk-shape'; + await init(); export class FolkPhysics extends FolkBaseSet { @@ -72,7 +72,7 @@ export class FolkPhysics extends FolkBaseSet { const bodyDesc = RAPIER.RigidBodyDesc.dynamic() .setTranslation( (rect.x + rect.width / 2) * FolkPhysics.PHYSICS_SCALE, - (rect.y + rect.height / 2) * FolkPhysics.PHYSICS_SCALE + (rect.y + rect.height / 2) * FolkPhysics.PHYSICS_SCALE, ) .setRotation(rect.rotation); @@ -81,7 +81,7 @@ export class FolkPhysics extends FolkBaseSet { // Scale down the collider size const colliderDesc = RAPIER.ColliderDesc.cuboid( (rect.width / 2) * FolkPhysics.PHYSICS_SCALE, - (rect.height / 2) * FolkPhysics.PHYSICS_SCALE + (rect.height / 2) * FolkPhysics.PHYSICS_SCALE, ).setTranslation(0, 0); this.world!.createCollider(colliderDesc, body); @@ -101,7 +101,7 @@ export class FolkPhysics extends FolkBaseSet { x: (rect.x + rect.width / 2) * FolkPhysics.PHYSICS_SCALE, y: (rect.y + rect.height / 2) * FolkPhysics.PHYSICS_SCALE, }, - true + true, ); body.setRotation(rect.rotation, true); } else if (body.bodyType() === RAPIER.RigidBodyType.KinematicPositionBased) { @@ -111,7 +111,7 @@ export class FolkPhysics extends FolkBaseSet { this.world!.removeCollider(collider, true); const newColliderDesc = RAPIER.ColliderDesc.cuboid( (rect.width / 2) * FolkPhysics.PHYSICS_SCALE, - (rect.height / 2) * FolkPhysics.PHYSICS_SCALE + (rect.height / 2) * FolkPhysics.PHYSICS_SCALE, ).setTranslation(0, 0); this.world!.createCollider(newColliderDesc, body); } @@ -151,7 +151,7 @@ export class FolkPhysics extends FolkBaseSet { x: (result.x + result.width / 2) * FolkPhysics.PHYSICS_SCALE, y: (result.y + result.height / 2) * FolkPhysics.PHYSICS_SCALE, }, - true + true, ); body.setRotation(result.rotation, true); } diff --git a/labs/folk-projector.ts b/labs/folk-projector.ts index c8896bd..2ef5a3e 100644 --- a/labs/folk-projector.ts +++ b/labs/folk-projector.ts @@ -1,4 +1,4 @@ -import { DOMRectTransform } from '@lib/DOMRectTransform'; +import { DOMRectTransform } from '@lib'; import { FolkShape } from './folk-shape'; declare global { diff --git a/labs/folk-proximity.ts b/labs/folk-proximity.ts index 2f99478..230b3cf 100644 --- a/labs/folk-proximity.ts +++ b/labs/folk-proximity.ts @@ -1,5 +1,4 @@ -import { aabbIntersection } from '@lib/collision.ts'; -import { TransformEvent } from '@lib/TransformEvent.ts'; +import { aabbIntersection, TransformEvent } from '@lib'; import { FolkHull } from './folk-hull'; import { FolkShape } from './folk-shape.ts'; @@ -178,7 +177,7 @@ export class FolkProximity extends HTMLElement { const isInCluster = Array.from(cluster.sourceElements) .filter((element) => el !== element) .some((element) => - aabbIntersection(el.getTransformDOMRect(), (element as FolkShape).getTransformDOMRect(), PROXIMITY) + aabbIntersection(el.getTransformDOMRect(), (element as FolkShape).getTransformDOMRect(), PROXIMITY), ); if (!isInCluster) { diff --git a/labs/folk-rope.ts b/labs/folk-rope.ts index 4597e71..4b8c40b 100644 --- a/labs/folk-rope.ts +++ b/labs/folk-rope.ts @@ -1,12 +1,9 @@ // This is a rewrite of https://github.com/guerrillacontra/html5-es6-physics-rope -import { Vector } from '@lib/Vector.ts'; -import type { Point } from '@lib/types.ts'; -import { DOMRectTransform } from '@lib/DOMRectTransform.ts'; -import { FolkBaseConnection } from './folk-base-connection.ts'; +import { AnimationFrameController, AnimationFrameControllerHost, DOMRectTransform, Vector, type Point } from '@lib'; import { css, PropertyValues } from '@lit/reactive-element'; -import { AnimationFrameController, AnimationFrameControllerHost } from '@lib/animation-frame-controller.ts'; import { property } from '@lit/reactive-element/decorators.js'; +import { FolkBaseConnection } from './folk-base-connection.ts'; // Each rope part is one of these uses a high precision variant of Störmer–Verlet integration to keep the simulation consistent otherwise it would "explode"! interface RopePoint { diff --git a/labs/folk-sand.glsl.ts b/labs/folk-sand.glsl.ts index 5428de6..f700467 100644 --- a/labs/folk-sand.glsl.ts +++ b/labs/folk-sand.glsl.ts @@ -1,4 +1,4 @@ -import { glsl } from '@lib/tags.ts'; +import { glsl } from '@lib/tags'; /** Falling sand shaders using block cellular automata with Margolus offsets. * Based on "Probabilistic Cellular Automata for Granular Media in Video Games" (https://arxiv.org/abs/2008.06341) diff --git a/labs/folk-sand.ts b/labs/folk-sand.ts index 76085a3..e91e20f 100644 --- a/labs/folk-sand.ts +++ b/labs/folk-sand.ts @@ -1,17 +1,15 @@ -import { WebGLUtils } from '@lib/webgl.ts'; +import { DOMRectTransform, WebGLUtils } from '@lib'; +import { css, PropertyValues } from '@lit/reactive-element'; +import { FolkBaseSet } from './folk-base-set.ts'; import { collisionFragmentShader, collisionVertexShader, - simulationShader, distanceFieldInitShader, distanceFieldPropagationShader, - visualizationShader, + simulationShader, vertexShader, + visualizationShader, } from './folk-sand.glsl.ts'; -import { requestAnimationFrame } from '@lib/rAF.ts'; -import { FolkBaseSet } from './folk-base-set.ts'; -import { css, PropertyValues } from '@lit/reactive-element'; -import { DOMRectTransform } from '@lib/DOMRectTransform.ts'; export class FolkSand extends FolkBaseSet { static override tagName = 'folk-sand'; diff --git a/labs/folk-shape.ts b/labs/folk-shape.ts index 4f45c22..1552223 100644 --- a/labs/folk-shape.ts +++ b/labs/folk-shape.ts @@ -1,10 +1,6 @@ -import { css, html } from '@lib/tags'; -import { ResizeObserverManager } from '@lib/resize-observer'; -import { Point } from '@lib/types'; -import { DOMRectTransform, DOMRectTransformReadonly } from '@lib/DOMRectTransform'; -import { Vector } from '@lib/Vector'; import { getResizeCursorUrl, getRotateCursorUrl } from '@labs/utils/cursors'; -import { TransformEvent } from '@lib/TransformEvent'; +import { DOMRectTransform, DOMRectTransformReadonly, Point, ResizeObserverManager, TransformEvent, Vector } from '@lib'; +import { css, html } from '@lib/tags'; const resizeObserver = new ResizeObserverManager(); @@ -277,21 +273,23 @@ export class FolkShape extends HTMLElement { // Ideally we would creating these lazily on first focus, but the resize handlers need to be around for delegate focus to work. // Maybe can add the first resize handler here, and lazily instantiate the rest when needed? // I can see it becoming important at scale - this.#shadow.setHTMLUnsafe(html` - - - - - - - -
`); + this.#shadow.setHTMLUnsafe( + html` + + + + + + + +
`, + ); this.#handles = Object.fromEntries( Array.from(this.#shadow.querySelectorAll('[part]')).map((el) => [ el.getAttribute('part') as ResizeHandle | RotateHandle, el as HTMLElement, - ]) + ]), ) as Record; this.#updateCursors(); diff --git a/labs/folk-space-projector.ts b/labs/folk-space-projector.ts index 84c5f32..d0f067d 100644 --- a/labs/folk-space-projector.ts +++ b/labs/folk-space-projector.ts @@ -1,8 +1,8 @@ +import { DOMRectTransform } from '@lib'; import { css, PropertyValues } from '@lit/reactive-element'; import { FolkBaseSet } from './folk-base-set'; import { FolkShape } from './folk-shape'; import { CellTemplate, FolkSpreadsheet, FolkSpreadSheetCell, templateCells } from './folk-spreadsheet'; -import { DOMRectTransform } from '@lib/DOMRectTransform'; FolkShape.define(); FolkSpreadsheet.define(); diff --git a/labs/folk-space-radial.ts b/labs/folk-space-radial.ts index e249a29..0da88dd 100644 --- a/labs/folk-space-radial.ts +++ b/labs/folk-space-radial.ts @@ -1,11 +1,7 @@ -import { DOMRectTransform } from '@lib/DOMRectTransform'; +import { DOMRectTransform, Experimental, TransformEvent, Vector } from '@lib'; import { css, type PropertyValues } from '@lit/reactive-element'; -import { TransformEvent } from '@lib/TransformEvent'; -import { FolkShape } from './folk-shape'; -import { Experimental } from '@lib/Experimental'; import { FolkBaseSet } from './folk-base-set'; -import { Vector } from '@lib/Vector'; -import type { Point } from '@lib/types'; +import { FolkShape } from './folk-shape'; export class FolkSpaceRadial extends FolkBaseSet { static override tagName = 'folk-space-radial'; diff --git a/labs/folk-space.ts b/labs/folk-space.ts index 4f4db9e..6e7d1c7 100644 --- a/labs/folk-space.ts +++ b/labs/folk-space.ts @@ -1,6 +1,6 @@ -import { css, PropertyValues } from '@lit/reactive-element'; -import { FolkElement } from '@lib/folk-element'; +import { FolkElement } from '@lib'; import { html } from '@lib/tags'; +import { css } from '@lit/reactive-element'; declare global { interface HTMLElementTagNameMap { diff --git a/labs/folk-spreadsheet.ts b/labs/folk-spreadsheet.ts index 222310c..80b4891 100644 --- a/labs/folk-spreadsheet.ts +++ b/labs/folk-spreadsheet.ts @@ -1,4 +1,4 @@ -import { css, html } from '@lib/tags'; +import { css } from '@lib/tags'; // hardcoded column and row numbers const styles = css` @@ -155,7 +155,7 @@ export function templateCells(numberOfRows: number, numberOfColumns: number, cel tabindex="0" ${expression ? `expression="${expression}"` : ''} ${readonly ? 'readonly' : ''} - >` + >`, ); } } @@ -229,7 +229,7 @@ export class FolkSpreadsheet extends HTMLElement { const rows = Array.from({ length: rowNames.size }).map((_, i) => i + 1); this.#columns.setHTMLUnsafe( - columns.map((column) => `${column}`).join('\n') + columns.map((column) => `${column}`).join('\n'), ); this.#rows.setHTMLUnsafe(rows.map((row) => `${row}`).join('\n')); @@ -245,7 +245,7 @@ export class FolkSpreadsheet extends HTMLElement { (column) => `s-header[column="${column}"], ::slotted(folk-cell[column="${column}"]) { grid-column: ${ getColumnIndex(column) + 1 - }; }` + }; }`, ) .join('\n')} @@ -485,7 +485,7 @@ export class FolkSpreadSheetCell extends HTMLElement { const [, column, row] = dep.split(/([A-Z]+)(\d+)/s); return this.#getCell(column, row); }) - .filter((cell) => cell !== null) + .filter((cell) => cell !== null), ); this.#dependencies.forEach((dep) => dep.addEventListener('propagate', this)); diff --git a/labs/folk-toolset.ts b/labs/folk-toolset.ts index f32b448..5653e61 100644 --- a/labs/folk-toolset.ts +++ b/labs/folk-toolset.ts @@ -1,5 +1,4 @@ -import type { DOMRectTransform } from '@lib/DOMRectTransform'; -import { Vector } from '@lib/Vector'; +import { Vector } from '@lib'; import { FolkEventPropagator } from './folk-event-propagator'; import { FolkShape } from './folk-shape'; diff --git a/labs/folk-xanadu.ts b/labs/folk-xanadu.ts index 2016a94..21db962 100644 --- a/labs/folk-xanadu.ts +++ b/labs/folk-xanadu.ts @@ -1,7 +1,7 @@ -import { FolkBaseConnection } from './folk-base-connection.js'; -import { verticesToPolygon } from '@lib/utils.js'; -import type { Point } from '@lib/types.js'; +import type { Point } from '@lib'; +import { verticesToPolygon } from '@lib/utils'; import { PropertyValues } from '@lit/reactive-element'; +import { FolkBaseConnection } from './folk-base-connection.js'; export class FolkXanadu extends FolkBaseConnection { static override tagName = 'folk-xanadu'; @@ -37,15 +37,15 @@ export class FolkXanadu extends FolkBaseConnection { // To trace the link we need to rotate the vertices of the source to start on the bottom right corner. const maxRightCoordinate = Math.max.apply( null, - sourceVertices.map((vertex) => vertex.x) + sourceVertices.map((vertex) => vertex.x), ); const maxBottomCoordinate = Math.max.apply( null, - sourceVertices.filter((vertex) => vertex.x === maxRightCoordinate).map((vertex) => vertex.y) + sourceVertices.filter((vertex) => vertex.x === maxRightCoordinate).map((vertex) => vertex.y), ); const index = sourceVertices.findIndex( - (vertex) => vertex.x === maxRightCoordinate && vertex.y === maxBottomCoordinate + (vertex) => vertex.x === maxRightCoordinate && vertex.y === maxBottomCoordinate, ); sourceVertices = sourceVertices.slice(index).concat(sourceVertices.slice(0, index)); @@ -62,7 +62,7 @@ function computeInlineVertices(rects: DOMRect[]): Point[] { width: Math.round(rect.width), x: Math.round(rect.x), y: Math.round(rect.y), - }) + }), ); if (rects.length === 0) return []; @@ -86,11 +86,11 @@ function computeInlineVertices(rects: DOMRect[]): Point[] { const maxRightCoordinate = Math.max.apply( null, - rects.map((rect) => rect.right) + rects.map((rect) => rect.right), ); const maxBottomCoordinate = Math.max.apply( null, - rects.filter((rect) => rect.right === maxRightCoordinate).map((rect) => rect.bottom) + rects.filter((rect) => rect.right === maxRightCoordinate).map((rect) => rect.bottom), ); vertices.push({ diff --git a/lib/index.ts b/lib/index.ts index cfc3859..2c45ab1 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -3,32 +3,29 @@ export * from './animation-frame-controller'; export * from './rAF'; // Core utilities and types -export * from './types'; -export * from './utils'; -export * from './Vector'; export * from './Matrix'; +export * from './types'; +export * from './Vector'; // DOM and transformation +export * from '../labs/utils/cursors'; export * from './DOMRectTransform'; export * from './TransformEvent'; -export * from '../labs/utils/cursors'; // Observers export * from './client-rect-observer'; -export * from './resize-observer'; export * from './folk-observer'; +export * from './resize-observer'; // Integration and effects -export * from './EffectIntegrator'; export * from './collision'; +export * from './EffectIntegrator'; // Base elements and components export * from './folk-element'; // WebGL utilities export * from './webgl'; -// Template literal tags -export * from './tags'; // Experimental features export * from './Experimental'; diff --git a/package.json b/package.json index 830519e..62033d4 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "webcola": "^3.4.0" }, "devDependencies": { + "prettier-plugin-organize-imports": "^4.1.0", "@types/leaflet": "^1.9.14", "@types/node": "^22.10.1", "@webgpu/types": "^0.1.51", @@ -29,4 +30,4 @@ "typescript": "^5.7.2", "vite": "^6.0.3" } -} +} \ No newline at end of file diff --git a/website/canvas/src/folk-metronome.ts b/website/canvas/src/folk-metronome.ts index dba04e6..3daaa12 100644 --- a/website/canvas/src/folk-metronome.ts +++ b/website/canvas/src/folk-metronome.ts @@ -1,4 +1,4 @@ -import { FolkElement } from '@lib/folk-element'; +import { FolkElement } from '@lib'; declare global { interface HTMLElementTagNameMap { diff --git a/website/canvas/src/folk-timer.ts b/website/canvas/src/folk-timer.ts index f33c9c6..3e53d65 100644 --- a/website/canvas/src/folk-timer.ts +++ b/website/canvas/src/folk-timer.ts @@ -1,4 +1,4 @@ -import { FolkElement } from '@lib/folk-element'; +import { FolkElement } from '@lib'; declare global { interface HTMLElementTagNameMap {