2023-04-25 11:01:25 +00:00
|
|
|
// Important! don't move this tlschema re-export to lib/index.ts, doing so causes esbuild to produce
|
|
|
|
// incorrect output. https://github.com/evanw/esbuild/issues/1737
|
|
|
|
|
2023-05-22 08:18:01 +00:00
|
|
|
export {
|
|
|
|
getIndexAbove,
|
|
|
|
getIndexBelow,
|
|
|
|
getIndexBetween,
|
|
|
|
getIndices,
|
|
|
|
getIndicesAbove,
|
|
|
|
getIndicesBelow,
|
|
|
|
getIndicesBetween,
|
|
|
|
sortByIndex,
|
|
|
|
} from '@tldraw/indices'
|
2023-04-25 11:01:25 +00:00
|
|
|
// eslint-disable-next-line local/no-export-star
|
|
|
|
export * from '@tldraw/tlschema'
|
|
|
|
export { getHashForString } from '@tldraw/utils'
|
|
|
|
export {
|
|
|
|
ErrorScreen,
|
|
|
|
LoadingScreen,
|
|
|
|
TldrawEditor,
|
|
|
|
type TldrawEditorProps,
|
|
|
|
} from './lib/TldrawEditor'
|
|
|
|
export {
|
|
|
|
App,
|
|
|
|
isShapeWithHandles,
|
|
|
|
type AnimationOptions,
|
|
|
|
type AppOptions,
|
|
|
|
type TLChange,
|
|
|
|
} from './lib/app/App'
|
2023-05-23 12:32:42 +00:00
|
|
|
export { TLArrowUtil } from './lib/app/shapeutils/TLArrowUtil/TLArrowUtil'
|
|
|
|
export { TLBookmarkUtil } from './lib/app/shapeutils/TLBookmarkUtil/TLBookmarkUtil'
|
2023-04-25 11:01:25 +00:00
|
|
|
export { TLBoxUtil } from './lib/app/shapeutils/TLBoxUtil'
|
2023-05-23 12:32:42 +00:00
|
|
|
export { TLDrawUtil } from './lib/app/shapeutils/TLDrawUtil/TLDrawUtil'
|
|
|
|
export { TLEmbedUtil } from './lib/app/shapeutils/TLEmbedUtil/TLEmbedUtil'
|
|
|
|
export { TLFrameUtil } from './lib/app/shapeutils/TLFrameUtil/TLFrameUtil'
|
|
|
|
export { TLGeoUtil } from './lib/app/shapeutils/TLGeoUtil/TLGeoUtil'
|
|
|
|
export { TLGroupUtil } from './lib/app/shapeutils/TLGroupUtil/TLGroupUtil'
|
|
|
|
export { TLImageUtil } from './lib/app/shapeutils/TLImageUtil/TLImageUtil'
|
|
|
|
export { TLLineUtil, getSplineForLineShape } from './lib/app/shapeutils/TLLineUtil/TLLineUtil'
|
|
|
|
export { TLNoteUtil } from './lib/app/shapeutils/TLNoteUtil/TLNoteUtil'
|
2023-04-25 11:01:25 +00:00
|
|
|
export {
|
|
|
|
TLShapeUtil,
|
|
|
|
type OnBeforeCreateHandler,
|
|
|
|
type OnBeforeUpdateHandler,
|
|
|
|
type OnBindingChangeHandler,
|
|
|
|
type OnChildrenChangeHandler,
|
|
|
|
type OnClickHandler,
|
|
|
|
type OnDoubleClickHandleHandler,
|
|
|
|
type OnDoubleClickHandler,
|
|
|
|
type OnDragHandler,
|
|
|
|
type OnEditEndHandler,
|
|
|
|
type OnHandleChangeHandler,
|
|
|
|
type OnResizeEndHandler,
|
|
|
|
type OnResizeHandler,
|
|
|
|
type OnResizeStartHandler,
|
|
|
|
type OnRotateEndHandler,
|
|
|
|
type OnRotateHandler,
|
|
|
|
type OnRotateStartHandler,
|
|
|
|
type OnTranslateEndHandler,
|
|
|
|
type OnTranslateHandler,
|
|
|
|
type OnTranslateStartHandler,
|
add docs for TLShapeUtil (#1215)
This PR adds docs for the methods in the TLShapeUtil class.
I think that it's a good page to have docs on, as it shows people what's
possible with the custom shape API.
Currently, our docs are not showing `@param` info for lots of methods,
including the ones added in this PR.
I'll do fix for that in a follow-up PR, so that it's easier to review.
---
Note: Moving forward, we probably want to consider **_where_** these
docs are shown, and how we achieve that.
For example, do we put the docs for these methods in:
* The docs page for the `TLShapeUtil` class?
* The docs pages for the handler types, eg:
[`OnResizeHandler`](http://localhost:3000/gen/editor/OnResizeHandler-type)?
* Both?
Right now, I opted for putting them in the the TLShapeUtil class, as it
keeps them all in one place, and it's what we already do for some
others.
We should consider both - what works best for the docs? and what works
best for code editors?
---
This PR also includes a fix to our pre-commit step that @SomeHats did.
2023-05-05 14:05:25 +00:00
|
|
|
type TLResizeInfo,
|
2023-04-25 11:01:25 +00:00
|
|
|
type TLResizeMode,
|
|
|
|
type TLShapeUtilConstructor,
|
|
|
|
type TLShapeUtilFlag,
|
|
|
|
} from './lib/app/shapeutils/TLShapeUtil'
|
2023-05-23 12:32:42 +00:00
|
|
|
export { INDENT, TLTextUtil } from './lib/app/shapeutils/TLTextUtil/TLTextUtil'
|
|
|
|
export { TLVideoUtil } from './lib/app/shapeutils/TLVideoUtil/TLVideoUtil'
|
2023-04-25 11:01:25 +00:00
|
|
|
export { StateNode, type StateNodeConstructor } from './lib/app/statechart/StateNode'
|
|
|
|
export { TLBoxTool, type TLBoxLike } from './lib/app/statechart/TLBoxTool/TLBoxTool'
|
|
|
|
export { type ClipboardPayload, type TLClipboardModel } from './lib/app/types/clipboard-types'
|
2023-05-11 22:14:58 +00:00
|
|
|
export { type TLEventMap, type TLEventMapHandler } from './lib/app/types/emit-types'
|
2023-04-25 11:01:25 +00:00
|
|
|
export {
|
|
|
|
EVENT_NAME_MAP,
|
|
|
|
type TLBaseEventInfo,
|
|
|
|
type TLCLickEventName,
|
|
|
|
type TLCancelEvent,
|
|
|
|
type TLCancelEventInfo,
|
|
|
|
type TLClickEvent,
|
|
|
|
type TLClickEventInfo,
|
|
|
|
type TLCompleteEvent,
|
|
|
|
type TLCompleteEventInfo,
|
|
|
|
type TLEventHandlers,
|
|
|
|
type TLEventInfo,
|
|
|
|
type TLEventName,
|
|
|
|
type TLInterruptEvent,
|
|
|
|
type TLInterruptEventInfo,
|
|
|
|
type TLKeyboardEvent,
|
|
|
|
type TLKeyboardEventInfo,
|
|
|
|
type TLKeyboardEventName,
|
|
|
|
type TLPinchEvent,
|
|
|
|
type TLPinchEventInfo,
|
|
|
|
type TLPinchEventName,
|
|
|
|
type TLPointerEvent,
|
|
|
|
type TLPointerEventInfo,
|
|
|
|
type TLPointerEventName,
|
|
|
|
type TLPointerEventTarget,
|
|
|
|
type TLTickEvent,
|
|
|
|
type TLWheelEvent,
|
|
|
|
type TLWheelEventInfo,
|
|
|
|
type UiEnterHandler,
|
|
|
|
type UiEvent,
|
|
|
|
type UiEventType,
|
|
|
|
type UiExitHandler,
|
|
|
|
} from './lib/app/types/event-types'
|
|
|
|
export {
|
|
|
|
type TLCommand,
|
|
|
|
type TLCommandHandler,
|
|
|
|
type TLHistoryEntry,
|
|
|
|
type TLMark,
|
|
|
|
} from './lib/app/types/history-types'
|
|
|
|
export { type RequiredKeys, type TLEasingType } from './lib/app/types/misc-types'
|
|
|
|
export { type TLResizeHandle, type TLSelectionHandle } from './lib/app/types/selection-types'
|
2023-05-05 13:10:36 +00:00
|
|
|
export {
|
|
|
|
defaultEditorAssetUrls,
|
|
|
|
setDefaultEditorAssetUrls,
|
|
|
|
type EditorAssetUrls,
|
|
|
|
} from './lib/assetUrls'
|
2023-04-25 11:01:25 +00:00
|
|
|
export { Canvas } from './lib/components/Canvas'
|
|
|
|
export { DefaultErrorFallback } from './lib/components/DefaultErrorFallback'
|
|
|
|
export {
|
|
|
|
ErrorBoundary,
|
|
|
|
OptionalErrorBoundary,
|
|
|
|
type ErrorBoundaryProps,
|
|
|
|
} from './lib/components/ErrorBoundary'
|
|
|
|
export { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'
|
|
|
|
export { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'
|
|
|
|
export {
|
|
|
|
type ErrorSyncedStore,
|
|
|
|
type InitializingSyncedStore,
|
|
|
|
type ReadySyncedStore,
|
|
|
|
type SyncedStore,
|
|
|
|
} from './lib/config/SyncedStore'
|
2023-05-25 09:54:29 +00:00
|
|
|
export { USER_COLORS } from './lib/config/TLUserPreferences'
|
2023-04-25 11:01:25 +00:00
|
|
|
export { TldrawEditorConfig } from './lib/config/TldrawEditorConfig'
|
|
|
|
export {
|
|
|
|
ANIMATION_MEDIUM_MS,
|
|
|
|
ANIMATION_SHORT_MS,
|
|
|
|
ARROW_LABEL_FONT_SIZES,
|
|
|
|
BOUND_ARROW_OFFSET,
|
|
|
|
DEFAULT_ANIMATION_OPTIONS,
|
|
|
|
DEFAULT_BOOKMARK_HEIGHT,
|
|
|
|
DEFAULT_BOOKMARK_WIDTH,
|
|
|
|
DOUBLE_CLICK_DURATION,
|
|
|
|
DRAG_DISTANCE,
|
|
|
|
FONT_ALIGNMENT,
|
|
|
|
FONT_FAMILIES,
|
|
|
|
FONT_SIZES,
|
|
|
|
GRID_INCREMENT,
|
|
|
|
GRID_STEPS,
|
|
|
|
HAND_TOOL_FRICTION,
|
|
|
|
HASH_PATERN_ZOOM_NAMES,
|
|
|
|
ICON_SIZES,
|
|
|
|
LABEL_FONT_SIZES,
|
|
|
|
MAJOR_NUDGE_FACTOR,
|
|
|
|
MAX_ASSET_HEIGHT,
|
|
|
|
MAX_ASSET_WIDTH,
|
|
|
|
MAX_PAGES,
|
|
|
|
MAX_SHAPES_PER_PAGE,
|
|
|
|
MAX_ZOOM,
|
|
|
|
MINOR_NUDGE_FACTOR,
|
|
|
|
MIN_ARROW_LENGTH,
|
|
|
|
MIN_ZOOM,
|
|
|
|
MULTI_CLICK_DURATION,
|
|
|
|
REMOVE_SYMBOL,
|
|
|
|
RICH_TYPES,
|
|
|
|
ROTATING_SHADOWS,
|
|
|
|
STYLES,
|
|
|
|
SVG_PADDING,
|
|
|
|
TEXT_PROPS,
|
|
|
|
WAY_TOO_BIG_ARROW_BEND_FACTOR,
|
|
|
|
ZOOMS,
|
|
|
|
} from './lib/constants'
|
|
|
|
export { normalizeWheel } from './lib/hooks/shared'
|
|
|
|
export { useApp } from './lib/hooks/useApp'
|
|
|
|
export { useContainer } from './lib/hooks/useContainer'
|
|
|
|
export type { TLEditorComponents } from './lib/hooks/useEditorComponents'
|
2023-05-03 13:48:46 +00:00
|
|
|
export { usePeerIds } from './lib/hooks/usePeerIds'
|
|
|
|
export { usePresence } from './lib/hooks/usePresence'
|
2023-04-25 11:01:25 +00:00
|
|
|
export { useQuickReactor } from './lib/hooks/useQuickReactor'
|
|
|
|
export { useReactor } from './lib/hooks/useReactor'
|
|
|
|
export { WeakMapCache } from './lib/utils/WeakMapCache'
|
|
|
|
export {
|
|
|
|
ACCEPTED_ASSET_TYPE,
|
|
|
|
ACCEPTED_IMG_TYPE,
|
|
|
|
ACCEPTED_VID_TYPE,
|
|
|
|
containBoxSize,
|
|
|
|
createAssetShapeAtPoint,
|
|
|
|
createBookmarkShapeAtPoint,
|
|
|
|
createEmbedShapeAtPoint,
|
|
|
|
createShapesFromFiles,
|
|
|
|
dataUrlToFile,
|
|
|
|
getFileMetaData,
|
|
|
|
getImageSizeFromSrc,
|
|
|
|
getMediaAssetFromFile,
|
|
|
|
getResizedImageDataUrl,
|
|
|
|
getValidHttpURLList,
|
|
|
|
getVideoSizeFromSrc,
|
|
|
|
isImage,
|
|
|
|
isSvgText,
|
|
|
|
isValidHttpURL,
|
|
|
|
} from './lib/utils/assets'
|
|
|
|
export { buildFromV1Document, type LegacyTldrawDocument } from './lib/utils/buildFromV1Document'
|
|
|
|
export {
|
|
|
|
checkFlag,
|
|
|
|
fileToBase64,
|
|
|
|
getIncrementedName,
|
|
|
|
isSerializable,
|
|
|
|
snapToGrid,
|
|
|
|
uniqueId,
|
|
|
|
} from './lib/utils/data'
|
Feature flags rework (#1474)
This diff tweaks our `debugFlags` framework to support setting different
default value for different environments, makes it easier to define
feature flags, and makes feature flags show up in the debug menu by
default. With this change, feature flags will default to being enabled
in dev and preview environments, but disabled in production.
Specify a feature flag like this:
```ts
const featureFlags = {
myCoolNewFeature: createFeatureFlag('myCoolNewFeature')
}
```
optionally, pass a second value to control its defaults:
```ts
const featureFlags = {
featureEnabledInProduction: createFeatureFlag('someFeature', { all: true }),
customEnabled: createFeatureFlag('otherFeature', {development: true, staging: false, production: false}),
}
```
In code, the value can be read using `featureFlags.myFeature.value`.
Remember to wrap reading it in a reactive context!
### Change Type
- [x] `patch` — Bug Fix
### Test Plan
-
### Release Notes
[internal only change]
2023-05-30 13:06:15 +00:00
|
|
|
export { debugFlags, featureFlags, type DebugFlag } from './lib/utils/debug-flags'
|
2023-04-25 11:01:25 +00:00
|
|
|
export {
|
|
|
|
loopToHtmlElement,
|
|
|
|
preventDefault,
|
|
|
|
releasePointerCapture,
|
|
|
|
rotateBoxShadow,
|
|
|
|
setPointerCapture,
|
|
|
|
truncateStringWithEllipsis,
|
|
|
|
usePrefersReducedMotion,
|
|
|
|
} from './lib/utils/dom'
|
|
|
|
export {
|
|
|
|
getEmbedInfo,
|
|
|
|
getEmbedInfoUnsafely,
|
|
|
|
matchEmbedUrl,
|
|
|
|
matchUrl,
|
|
|
|
type EmbedResult,
|
|
|
|
} from './lib/utils/embeds'
|
|
|
|
export {
|
|
|
|
downloadDataURLAsFile,
|
|
|
|
getSvgAsDataUrl,
|
|
|
|
getSvgAsDataUrlSync,
|
|
|
|
getSvgAsImage,
|
|
|
|
getSvgAsString,
|
|
|
|
getTextBoundingBox,
|
|
|
|
isGeoShape,
|
|
|
|
isNoteShape,
|
|
|
|
type TLCopyType,
|
|
|
|
type TLExportType,
|
|
|
|
} from './lib/utils/export'
|
|
|
|
export { hardResetApp } from './lib/utils/hard-reset'
|
|
|
|
export { isAnimated, isGIF } from './lib/utils/is-gif-animated'
|
|
|
|
export { setPropsForNextShape } from './lib/utils/props-for-next-shape'
|
|
|
|
export { refreshPage } from './lib/utils/refresh-page'
|
|
|
|
export {
|
|
|
|
applyRotationToSnapshotShapes,
|
|
|
|
getRotationSnapshot,
|
|
|
|
type RotationSnapshot,
|
|
|
|
} from './lib/utils/rotation'
|
|
|
|
export { runtime, setRuntimeOverrides } from './lib/utils/runtime'
|
|
|
|
export {
|
|
|
|
blobAsString,
|
|
|
|
correctSpacesToNbsp,
|
|
|
|
dataTransferItemAsString,
|
|
|
|
defaultEmptyAs,
|
|
|
|
} from './lib/utils/string'
|
|
|
|
export { getPointerInfo, getSvgPathFromStroke, getSvgPathFromStrokePoints } from './lib/utils/svg'
|
|
|
|
export { openWindow } from './lib/utils/window-open'
|