diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..ddcb07d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,33 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - main + - pages-demo +permissions: + contents: write + +jobs: + build-and-deploy: + concurrency: ci-${{ github.ref }} + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v3 + + - name: Enable Corepack 📦 + run: | + corepack enable + corepack prepare yarn@4.0.2 --activate + + + - name: Build 🔧 + run: | + yarn install + yarn build + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: dist \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index cd1e745..9f6fcd1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -10,7 +10,7 @@ export default function YjsExample() { MainMenu: CustomMainMenu, }} onMount={onMount} - persistenceKey='funcArrows' + persistenceKey='scoped-propagators' /> ) diff --git a/src/DeltaTime.ts b/src/propagators/DeltaTime.ts similarity index 100% rename from src/DeltaTime.ts rename to src/propagators/DeltaTime.ts diff --git a/src/Geo.ts b/src/propagators/Geo.ts similarity index 98% rename from src/Geo.ts rename to src/propagators/Geo.ts index a48b862..7489b38 100644 --- a/src/Geo.ts +++ b/src/propagators/Geo.ts @@ -1,4 +1,4 @@ -import { SpatialIndex } from "@/SpatialIndex" +import { SpatialIndex } from "@/propagators/SpatialIndex" import { Editor, TLShape, TLShapeId, VecLike, polygonsIntersect } from "tldraw" export class Geo { diff --git a/src/propagators/ScopedPropagators.ts b/src/propagators/ScopedPropagators.ts index ff4dd8b..14d7d81 100644 --- a/src/propagators/ScopedPropagators.ts +++ b/src/propagators/ScopedPropagators.ts @@ -1,11 +1,20 @@ -import { DeltaTime } from "@/DeltaTime" -import { Geo } from "@/Geo" -import { Edge, getArrowsFromShape, getEdge } from "@/tlgraph" -import { isShapeOfType, updateProps } from "@/utils" +import { DeltaTime } from "@/propagators/DeltaTime" +import { Geo } from "@/propagators/Geo" +import { Edge, getArrowsFromShape, getEdge } from "@/propagators/tlgraph" +import { isShapeOfType, updateProps } from "@/propagators/utils" import { Editor, TLArrowShape, TLBinding, TLGroupShape, TLShape, TLShapeId } from "tldraw" type Prefix = 'click' | 'tick' | 'geo' | '' +export function registerDefaultPropagators(editor: Editor) { + registerPropagators(editor, [ + ChangePropagator, + ClickPropagator, + TickPropagator, + SpatialPropagator, + ]) +} + function isPropagatorOfType(arrow: TLShape, prefix: Prefix) { if (!isShapeOfType(arrow, 'arrow')) return false const regex = new RegExp(`^\\s*${prefix}\\s*\\{`) diff --git a/src/SpatialIndex.ts b/src/propagators/SpatialIndex.ts similarity index 100% rename from src/SpatialIndex.ts rename to src/propagators/SpatialIndex.ts diff --git a/src/tlgraph.ts b/src/propagators/tlgraph.ts similarity index 98% rename from src/tlgraph.ts rename to src/propagators/tlgraph.ts index d090773..c2f249b 100644 --- a/src/tlgraph.ts +++ b/src/propagators/tlgraph.ts @@ -1,4 +1,4 @@ -import { isShapeOfType } from "@/utils"; +import { isShapeOfType } from "@/propagators/utils"; import { Editor, TLArrowBinding, TLArrowShape, TLShape, TLShapeId } from "tldraw"; export interface Edge { diff --git a/src/utils.ts b/src/propagators/utils.ts similarity index 100% rename from src/utils.ts rename to src/propagators/utils.ts