Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

context-wrapper.tsx 769B

1234567891011121314151617181920212223
  1. import * as React from 'react'
  2. import type { TLPageState, TLBounds } from '../types'
  3. import { mockDocument } from './mockDocument'
  4. import { mockUtils } from './mockUtils'
  5. import { useTLTheme, TLContext } from '../hooks'
  6. import { Inputs } from '+inputs'
  7. export const ContextWrapper: React.FC = ({ children }) => {
  8. useTLTheme()
  9. const rSelectionBounds = React.useRef<TLBounds>(null)
  10. const rPageState = React.useRef<TLPageState>(mockDocument.pageState)
  11. const [context] = React.useState(() => ({
  12. callbacks: {},
  13. shapeUtils: mockUtils,
  14. rSelectionBounds,
  15. rPageState,
  16. inputs: new Inputs(),
  17. }))
  18. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  19. return <TLContext.Provider value={context as any}>{children}</TLContext.Provider>
  20. }