Skip to content

createdbymahmood/vision-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

469 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React + TypeScript + Vite

Documentation

  • docs/user-guide.md
  • docs/keyboard-shortcuts.md
  • docs/scene-json-schema.md
  • docs/developer-setup.md
  • docs/known-limitations.md

Release Workflow

  • Use pnpm release:patch, pnpm release:minor, or pnpm release:major.
  • Each command requires a clean git working tree and a non-detached branch.
  • The command runs a push preflight check, then bumps package.json version, creates chore(release): vX.Y.Z commit and vX.Y.Z tag, then pushes both.
  • If pushing fails after tag creation, the script deletes the created tag (local and remote if needed) before exiting.
  • Pushing the tag triggers .github/workflows/release-on-tag.yml, which installs with pnpm, builds the library, and publishes to GitHub Packages.
  • CI rejects the release when the pushed tag does not match package.json.version.
  • CI uses GITHUB_TOKEN for package publishing.

Required Props

The VisionSimulator export is local-only: it loads and saves scene data from localStorage via Zustand persistence (scoped by visionSimulatorId).

mapboxToken is optional but required for Mapbox map tiles and location search.

import {VisionSimulator} from '@vega-tek-hub/vision-simulator-v2'

interface AppProps {
  visionSimulatorId: string
  mapboxToken?: string
  mode?: 'editor' | 'preview'
}

export const App: React.FC<AppProps> = ({
  mapboxToken,
  visionSimulatorId,
}) => {
  return (
    <VisionSimulator
      mapboxToken={mapboxToken}
      mode='editor'
      visionSimulatorId={visionSimulatorId}
    />
  )
}

Mode Prop

mode is optional and defaults to 'editor'.

  • mode='editor': full editor UI and standard preview toggle behavior.
  • mode='preview': simulation-only view (no top bar or editor surfaces).
<VisionSimulator
  mapboxToken={mapboxToken}
  mode='preview'
  visionSimulatorId={visionSimulatorId}
/>
<VisionSimulator
  mapboxToken={mapboxToken}
  mode='editor'
  visionSimulatorId={visionSimulatorId}
/>

UI Overrides Styling

uiOverrides components are rendered in the normal DOM tree and use the app's regular stylesheet pipeline.

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

Note: This will impact Vite dev & build performances.

Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:

export default defineConfig([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      // Other configs...

      // Remove tseslint.configs.recommended and replace with this
      tseslint.configs.recommendedTypeChecked,
      // Alternatively, use this for stricter rules
      tseslint.configs.strictTypeChecked,
      // Optionally, add this for stylistic rules
      tseslint.configs.stylisticTypeChecked,

      // Other configs...
    ],
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
])

You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:

// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'

export default defineConfig([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      // Other configs...
      // Enable lint rules for React
      reactX.configs['recommended-typescript'],
      // Enable lint rules for React DOM
      reactDom.configs.recommended,
    ],
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
])

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors