Expand props (#2948)
This PR expands the tldraw / tldraweditor component props. ### Change Type - [x] `patch` — Bug fix
This commit is contained in:
parent
b2cb0d27b0
commit
ad902be5e6
6 changed files with 60 additions and 28 deletions
|
@ -15,6 +15,7 @@ import { computed } from '@tldraw/state';
|
|||
import { EmbedDefinition } from '@tldraw/tlschema';
|
||||
import { EMPTY_ARRAY } from '@tldraw/state';
|
||||
import { EventEmitter } from 'eventemitter3';
|
||||
import { Expand } from '@tldraw/utils';
|
||||
import { HistoryEntry } from '@tldraw/store';
|
||||
import { IndexKey } from '@tldraw/utils';
|
||||
import { JsonObject } from '@tldraw/utils';
|
||||
|
@ -2031,7 +2032,7 @@ export interface TldrawEditorBaseProps {
|
|||
}
|
||||
|
||||
// @public
|
||||
export type TldrawEditorProps = TldrawEditorBaseProps & ({
|
||||
export type TldrawEditorProps = Expand<TldrawEditorBaseProps & ({
|
||||
store: TLStore | TLStoreWithStatus;
|
||||
} | {
|
||||
store?: undefined;
|
||||
|
@ -2040,7 +2041,7 @@ export type TldrawEditorProps = TldrawEditorBaseProps & ({
|
|||
persistenceKey?: string;
|
||||
sessionId?: string;
|
||||
defaultName?: string;
|
||||
});
|
||||
})>;
|
||||
|
||||
// @public (undocumented)
|
||||
export type TLEditorComponents = Partial<{
|
||||
|
|
|
@ -36448,6 +36448,15 @@
|
|||
"kind": "Content",
|
||||
"text": "export type TldrawEditorProps = "
|
||||
},
|
||||
{
|
||||
"kind": "Reference",
|
||||
"text": "Expand",
|
||||
"canonicalReference": "@tldraw/utils!Expand:type"
|
||||
},
|
||||
{
|
||||
"kind": "Content",
|
||||
"text": "<"
|
||||
},
|
||||
{
|
||||
"kind": "Reference",
|
||||
"text": "TldrawEditorBaseProps",
|
||||
|
@ -36509,7 +36518,7 @@
|
|||
},
|
||||
{
|
||||
"kind": "Content",
|
||||
"text": ">;\n persistenceKey?: string;\n sessionId?: string;\n defaultName?: string;\n})"
|
||||
"text": ">;\n persistenceKey?: string;\n sessionId?: string;\n defaultName?: string;\n})>"
|
||||
},
|
||||
{
|
||||
"kind": "Content",
|
||||
|
@ -36521,7 +36530,7 @@
|
|||
"name": "TldrawEditorProps",
|
||||
"typeTokenRange": {
|
||||
"startIndex": 1,
|
||||
"endIndex": 15
|
||||
"endIndex": 17
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { SerializedStore, Store, StoreSnapshot } from '@tldraw/store'
|
||||
import { TLRecord, TLStore } from '@tldraw/tlschema'
|
||||
import { Required, annotateError } from '@tldraw/utils'
|
||||
import { Expand, Required, annotateError } from '@tldraw/utils'
|
||||
import React, {
|
||||
memo,
|
||||
useCallback,
|
||||
|
@ -41,20 +41,22 @@ import { TLStoreWithStatus } from './utils/sync/StoreWithStatus'
|
|||
*
|
||||
* @public
|
||||
**/
|
||||
export type TldrawEditorProps = TldrawEditorBaseProps &
|
||||
(
|
||||
| {
|
||||
store: TLStore | TLStoreWithStatus
|
||||
}
|
||||
| {
|
||||
store?: undefined
|
||||
snapshot?: StoreSnapshot<TLRecord>
|
||||
initialData?: SerializedStore<TLRecord>
|
||||
persistenceKey?: string
|
||||
sessionId?: string
|
||||
defaultName?: string
|
||||
}
|
||||
)
|
||||
export type TldrawEditorProps = Expand<
|
||||
TldrawEditorBaseProps &
|
||||
(
|
||||
| {
|
||||
store: TLStore | TLStoreWithStatus
|
||||
}
|
||||
| {
|
||||
store?: undefined
|
||||
snapshot?: StoreSnapshot<TLRecord>
|
||||
initialData?: SerializedStore<TLRecord>
|
||||
persistenceKey?: string
|
||||
sessionId?: string
|
||||
defaultName?: string
|
||||
}
|
||||
)
|
||||
>
|
||||
|
||||
/**
|
||||
* Base props for the {@link @tldraw/tldraw#Tldraw} and {@link TldrawEditor} components.
|
||||
|
|
|
@ -1169,7 +1169,7 @@ export class TextShapeUtil extends ShapeUtil<TLTextShape> {
|
|||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type TLComponents = TLEditorComponents & TLUiComponents;
|
||||
export type TLComponents = Expand<TLEditorComponents & TLUiComponents>;
|
||||
|
||||
// @public (undocumented)
|
||||
export function Tldraw(props: TldrawProps): JSX_2.Element;
|
||||
|
@ -1216,7 +1216,7 @@ export type TldrawImageProps = Expand<{
|
|||
} & Partial<TLSvgOptions>>;
|
||||
|
||||
// @public (undocumented)
|
||||
export type TldrawProps = (Omit<TldrawUiProps, 'components'> & Omit<TldrawEditorBaseProps, 'components'> & {
|
||||
export type TldrawProps = Expand<(Omit<TldrawUiProps, 'components'> & Omit<TldrawEditorBaseProps, 'components'> & {
|
||||
components?: TLComponents;
|
||||
}) & Partial<TLExternalContentProps> & ({
|
||||
store: TLStore | TLStoreWithStatus;
|
||||
|
@ -1226,7 +1226,7 @@ export type TldrawProps = (Omit<TldrawUiProps, 'components'> & Omit<TldrawEditor
|
|||
sessionId?: string;
|
||||
defaultName?: string;
|
||||
snapshot?: StoreSnapshot<TLRecord>;
|
||||
});
|
||||
})>;
|
||||
|
||||
// @public (undocumented)
|
||||
export function TldrawScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX_2.Element | null;
|
||||
|
|
|
@ -13626,6 +13626,15 @@
|
|||
"kind": "Content",
|
||||
"text": "export type TLComponents = "
|
||||
},
|
||||
{
|
||||
"kind": "Reference",
|
||||
"text": "Expand",
|
||||
"canonicalReference": "@tldraw/utils!Expand:type"
|
||||
},
|
||||
{
|
||||
"kind": "Content",
|
||||
"text": "<"
|
||||
},
|
||||
{
|
||||
"kind": "Reference",
|
||||
"text": "TLEditorComponents",
|
||||
|
@ -13640,6 +13649,10 @@
|
|||
"text": "TLUiComponents",
|
||||
"canonicalReference": "@tldraw/tldraw!TLUiComponents:type"
|
||||
},
|
||||
{
|
||||
"kind": "Content",
|
||||
"text": ">"
|
||||
},
|
||||
{
|
||||
"kind": "Content",
|
||||
"text": ";"
|
||||
|
@ -13650,7 +13663,7 @@
|
|||
"name": "TLComponents",
|
||||
"typeTokenRange": {
|
||||
"startIndex": 1,
|
||||
"endIndex": 4
|
||||
"endIndex": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -14113,9 +14126,14 @@
|
|||
"kind": "Content",
|
||||
"text": "export type TldrawProps = "
|
||||
},
|
||||
{
|
||||
"kind": "Reference",
|
||||
"text": "Expand",
|
||||
"canonicalReference": "@tldraw/utils!Expand:type"
|
||||
},
|
||||
{
|
||||
"kind": "Content",
|
||||
"text": "("
|
||||
"text": "<("
|
||||
},
|
||||
{
|
||||
"kind": "Reference",
|
||||
|
@ -14214,7 +14232,7 @@
|
|||
},
|
||||
{
|
||||
"kind": "Content",
|
||||
"text": ">;\n})"
|
||||
"text": ">;\n})>"
|
||||
},
|
||||
{
|
||||
"kind": "Content",
|
||||
|
@ -14226,7 +14244,7 @@
|
|||
"name": "TldrawProps",
|
||||
"typeTokenRange": {
|
||||
"startIndex": 1,
|
||||
"endIndex": 24
|
||||
"endIndex": 25
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
Editor,
|
||||
ErrorScreen,
|
||||
Expand,
|
||||
LoadingScreen,
|
||||
StoreSnapshot,
|
||||
TLEditorComponents,
|
||||
|
@ -36,10 +37,10 @@ import { usePreloadAssets } from './ui/hooks/usePreloadAssets'
|
|||
import { useDefaultEditorAssetsWithOverrides } from './utils/static-assets/assetUrls'
|
||||
|
||||
/**@public */
|
||||
export type TLComponents = TLEditorComponents & TLUiComponents
|
||||
export type TLComponents = Expand<TLEditorComponents & TLUiComponents>
|
||||
|
||||
/** @public */
|
||||
export type TldrawProps =
|
||||
export type TldrawProps = Expand<
|
||||
// combine components from base editor and ui
|
||||
(Omit<TldrawUiProps, 'components'> &
|
||||
Omit<TldrawEditorBaseProps, 'components'> & {
|
||||
|
@ -62,6 +63,7 @@ export type TldrawProps =
|
|||
snapshot?: StoreSnapshot<TLRecord>
|
||||
}
|
||||
)
|
||||
>
|
||||
|
||||
/** @public */
|
||||
export function Tldraw(props: TldrawProps) {
|
||||
|
|
Loading…
Reference in a new issue