Remove (optional) from jsdocs (#2109)
This PR removes all mentions of "(optional)" from our jsdocs. This is for: * consistency — many of our jsdocs don't mention "(optional)" for optional parameters. The developer is expected to use the type definition to find this out. But it's a bit unclear because we use "(optional)" in many places too. * docs site — on our docs site, we use type definitions to figure out what is optional, and what isn't. We use that info to denote optional parameters. It looks funny having two "(optional)"s on a page. We *could* strip them, but it's probably better to just remove them at the source. <img width="526" alt="image" src="https://github.com/tldraw/tldraw/assets/15892272/b5b65a2b-2923-42a9-a2d3-9b1d9d55cd3d"> ### Change Type - [x] `documentation` — Changes to the documentation only[^2] ### Release Notes - dev: Removed duplicate/inconsistent `(optional)`s from docs
This commit is contained in:
parent
23ab6ff870
commit
828848f8af
9 changed files with 43 additions and 43 deletions
|
@ -164,15 +164,15 @@ export interface TLEditorOptions {
|
||||||
*/
|
*/
|
||||||
getContainer: () => HTMLElement
|
getContainer: () => HTMLElement
|
||||||
/**
|
/**
|
||||||
* (optional) A user defined externally to replace the default user.
|
* A user defined externally to replace the default user.
|
||||||
*/
|
*/
|
||||||
user?: TLUser
|
user?: TLUser
|
||||||
/**
|
/**
|
||||||
* (optional) The editor's initial active tool (or other state node id).
|
* The editor's initial active tool (or other state node id).
|
||||||
*/
|
*/
|
||||||
initialState?: string
|
initialState?: string
|
||||||
/**
|
/**
|
||||||
* (optional) Whether to infer dark mode from the user's system preferences. Defaults to false.
|
* Whether to infer dark mode from the user's system preferences. Defaults to false.
|
||||||
*/
|
*/
|
||||||
inferDarkMode?: boolean
|
inferDarkMode?: boolean
|
||||||
}
|
}
|
||||||
|
@ -817,8 +817,8 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param markId - The mark's id, usually the reason for adding the mark.
|
* @param markId - The mark's id, usually the reason for adding the mark.
|
||||||
* @param onUndo - (optional) Whether to stop at the mark when undoing.
|
* @param onUndo - Whether to stop at the mark when undoing.
|
||||||
* @param onRedo - (optional) Whether to stop at the mark when redoing.
|
* @param onRedo - Whether to stop at the mark when redoing.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -1160,7 +1160,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* Update the instance's state.
|
* Update the instance's state.
|
||||||
*
|
*
|
||||||
* @param partial - A partial object to update the instance state with.
|
* @param partial - A partial object to update the instance state with.
|
||||||
* @param historyOptions - (optional) The history options for the change.
|
* @param historyOptions - The history options for the change.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -1341,7 +1341,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param partial - The partial of the page state object containing the changes.
|
* @param partial - The partial of the page state object containing the changes.
|
||||||
* @param historyOptions - (optional) The history options for the change.
|
* @param historyOptions - The history options for the change.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -2064,7 +2064,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param point - The new camera position.
|
* @param point - The new camera position.
|
||||||
* @param animation - (optional) Options for an animation.
|
* @param animation - Options for an animation.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -2101,7 +2101,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param point - The point in the current page space to center on.
|
* @param point - The point in the current page space to center on.
|
||||||
* @param animation - (optional) The options for an animation.
|
* @param animation - The options for an animation.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -2126,7 +2126,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* editor.zoomToContent({ duration: 200 })
|
* editor.zoomToContent({ duration: 200 })
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param opts - (optional) The options for an animation.
|
* @param opts - The options for an animation.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -2149,7 +2149,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* editor.zoomToFit({ duration: 200 })
|
* editor.zoomToFit({ duration: 200 })
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param animation - (optional) The options for an animation.
|
* @param animation - The options for an animation.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -2174,8 +2174,8 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* editor.resetZoom(editor.viewportScreenCenter, { duration: 200 })
|
* editor.resetZoom(editor.viewportScreenCenter, { duration: 200 })
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param point - (optional) The screen point to zoom out on. Defaults to the viewport screen center.
|
* @param point - The screen point to zoom out on. Defaults to the viewport screen center.
|
||||||
* @param animation - (optional) The options for an animation.
|
* @param animation - The options for an animation.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -2202,7 +2202,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* editor.zoomIn(editor.inputs.currentScreenPoint, { duration: 120 })
|
* editor.zoomIn(editor.inputs.currentScreenPoint, { duration: 120 })
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param animation - (optional) The options for an animation.
|
* @param animation - The options for an animation.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -2240,7 +2240,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* editor.zoomOut(editor.inputs.currentScreenPoint, { duration: 120 })
|
* editor.zoomOut(editor.inputs.currentScreenPoint, { duration: 120 })
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param animation - (optional) The options for an animation.
|
* @param animation - The options for an animation.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -2281,7 +2281,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* editor.zoomToSelection()
|
* editor.zoomToSelection()
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param animation - (optional) The options for an animation.
|
* @param animation - The options for an animation.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -2360,7 +2360,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
*
|
*
|
||||||
* @param bounds - The bounding box.
|
* @param bounds - The bounding box.
|
||||||
* @param targetZoom - The desired zoom level. Defaults to 0.1.
|
* @param targetZoom - The desired zoom level. Defaults to 0.1.
|
||||||
* @param animation - (optional) The options for an animation.
|
* @param animation - The options for an animation.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -2406,7 +2406,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param offset - The offset in the current page space.
|
* @param offset - The offset in the current page space.
|
||||||
* @param animation - (optional) The animation options.
|
* @param animation - The animation options.
|
||||||
*/
|
*/
|
||||||
pan(offset: VecLike, animation?: TLAnimationOptions): this {
|
pan(offset: VecLike, animation?: TLAnimationOptions): this {
|
||||||
if (!this.instanceState.canMoveCamera) return this
|
if (!this.instanceState.canMoveCamera) return this
|
||||||
|
@ -2659,7 +2659,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* editor.updateViewportScreenBounds(true)
|
* editor.updateViewportScreenBounds(true)
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param center - (optional) Whether to preserve the viewport page center as the viewport changes.
|
* @param center - Whether to preserve the viewport page center as the viewport changes.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -3269,7 +3269,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param page - The page (or page id) to set as the current page.
|
* @param page - The page (or page id) to set as the current page.
|
||||||
* @param historyOptions - (optional) The history options for the change.
|
* @param historyOptions - The history options for the change.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -3344,7 +3344,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param partial - The partial of the shape to update.
|
* @param partial - The partial of the shape to update.
|
||||||
* @param historyOptions - (optional) The history options for the change.
|
* @param historyOptions - The history options for the change.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -4732,7 +4732,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
*
|
*
|
||||||
* @param shapes - The shapes (or shape ids) of the shapes to reparent.
|
* @param shapes - The shapes (or shape ids) of the shapes to reparent.
|
||||||
* @param parentId - The id of the new parent shape.
|
* @param parentId - The id of the new parent shape.
|
||||||
* @param insertIndex - (optional) The index to insert the children.
|
* @param insertIndex - The index to insert the children.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -5046,7 +5046,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
*
|
*
|
||||||
* @param shapes - The shapes (or shape ids) to move.
|
* @param shapes - The shapes (or shape ids) to move.
|
||||||
* @param direction - The direction in which to move the shapes.
|
* @param direction - The direction in which to move the shapes.
|
||||||
* @param historyOptions - (optional) The history options for the change.
|
* @param historyOptions - The history options for the change.
|
||||||
*/
|
*/
|
||||||
nudgeShapes(
|
nudgeShapes(
|
||||||
shapes: TLShapeId[] | TLShape[],
|
shapes: TLShapeId[] | TLShape[],
|
||||||
|
@ -5108,7 +5108,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param shapes - The shapes (or shape ids) to duplicate.
|
* @param shapes - The shapes (or shape ids) to duplicate.
|
||||||
* @param offset - (optional) The offset (in pixels) to apply to the duplicated shapes.
|
* @param offset - The offset (in pixels) to apply to the duplicated shapes.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -6653,7 +6653,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param partial - The shape partial to update.
|
* @param partial - The shape partial to update.
|
||||||
* @param options - (optional) The animation's options.
|
* @param options - The animation's options.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -6674,7 +6674,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param partials - The shape partials to update.
|
* @param partials - The shape partials to update.
|
||||||
* @param options - (optional) The animation's options.
|
* @param options - The animation's options.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -6772,7 +6772,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* Create a group containing the provided shapes.
|
* Create a group containing the provided shapes.
|
||||||
*
|
*
|
||||||
* @param shapes - The shapes (or shape ids) to group. Defaults to the selected shapes.
|
* @param shapes - The shapes (or shape ids) to group. Defaults to the selected shapes.
|
||||||
* @param groupId - (optional) The id of the group to create.
|
* @param groupId - The id of the group to create.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -6905,7 +6905,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param partial - The shape partial to update.
|
* @param partial - The shape partial to update.
|
||||||
* @param historyOptions - (optional) The history options for the change.
|
* @param historyOptions - The history options for the change.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -6926,7 +6926,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param partials - The shape partials to update.
|
* @param partials - The shape partials to update.
|
||||||
* @param historyOptions - (optional) The history options for the change.
|
* @param historyOptions - The history options for the change.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -7369,7 +7369,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
*
|
*
|
||||||
* @param style - The style to set.
|
* @param style - The style to set.
|
||||||
* @param value - The value to set.
|
* @param value - The value to set.
|
||||||
* @param historyOptions - (optional) The history options for the change.
|
* @param historyOptions - The history options for the change.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -7401,7 +7401,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
*
|
*
|
||||||
* @param style - The style to set.
|
* @param style - The style to set.
|
||||||
* @param value - The value to set.
|
* @param value - The value to set.
|
||||||
* @param historyOptions - (optional) The history options for the change.
|
* @param historyOptions - The history options for the change.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { generateNKeysBetween } from './dgreensp'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a number of indices between two indices.
|
* Get a number of indices between two indices.
|
||||||
* @param below - (optional) The index below.
|
* @param below - The index below.
|
||||||
* @param above - (optional) The index above.
|
* @param above - The index above.
|
||||||
* @param n - The number of indices to get.
|
* @param n - The number of indices to get.
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -62,7 +62,7 @@ export function getIndexBelow(above: string) {
|
||||||
/**
|
/**
|
||||||
* Get n number of indices, starting at an index.
|
* Get n number of indices, starting at an index.
|
||||||
* @param n - The number of indices to get.
|
* @param n - The number of indices to get.
|
||||||
* @param start - (optional) The index to start at.
|
* @param start - The index to start at.
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export function getIndices(n: number, start = 'a1') {
|
export function getIndices(n: number, start = 'a1') {
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class HistoryBuffer<Diff> {
|
||||||
*
|
*
|
||||||
* @param lastComputedEpoch - The epoch when the diff was computed.
|
* @param lastComputedEpoch - The epoch when the diff was computed.
|
||||||
* @param currentEpoch - The current epoch.
|
* @param currentEpoch - The current epoch.
|
||||||
* @param diff - (optional) The diff to add, or else a reset value.
|
* @param diff - The diff to add, or else a reset value.
|
||||||
*/
|
*/
|
||||||
pushEntry(lastComputedEpoch: number, currentEpoch: number, diff: Diff | RESET_VALUE) {
|
pushEntry(lastComputedEpoch: number, currentEpoch: number, diff: Diff | RESET_VALUE) {
|
||||||
if (diff === undefined) {
|
if (diff === undefined) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import {
|
||||||
*
|
*
|
||||||
* @param editor - The editor instance.
|
* @param editor - The editor instance.
|
||||||
* @param clipboard - The clipboard model.
|
* @param clipboard - The clipboard model.
|
||||||
* @param point - (optional) The point at which to paste the text.
|
* @param point - The point at which to paste the text.
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export async function pasteExcalidrawContent(editor: Editor, clipboard: any, point?: VecLike) {
|
export async function pasteExcalidrawContent(editor: Editor, clipboard: any, point?: VecLike) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Editor, TLExternalContentSource, VecLike } from '@tldraw/editor'
|
||||||
*
|
*
|
||||||
* @param editor - The editor instance.
|
* @param editor - The editor instance.
|
||||||
* @param urls - The file urls.
|
* @param urls - The file urls.
|
||||||
* @param point - (optional) The point at which to paste the file.
|
* @param point - The point at which to paste the file.
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export async function pasteFiles(
|
export async function pasteFiles(
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Editor, TLContent, VecLike } from '@tldraw/editor'
|
||||||
*
|
*
|
||||||
* @param editor - The editor instance.
|
* @param editor - The editor instance.
|
||||||
* @param clipboard - The clipboard model.
|
* @param clipboard - The clipboard model.
|
||||||
* @param point - (optional) The point at which to paste the text.
|
* @param point - The point at which to paste the text.
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export function pasteTldrawContent(editor: Editor, clipboard: TLContent, point?: VecLike) {
|
export function pasteTldrawContent(editor: Editor, clipboard: TLContent, point?: VecLike) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { pasteFiles } from './pasteFiles'
|
||||||
*
|
*
|
||||||
* @param editor - The editor instance.
|
* @param editor - The editor instance.
|
||||||
* @param url - The URL to paste.
|
* @param url - The URL to paste.
|
||||||
* @param point - (optional) The point at which to paste the file.
|
* @param point - The point at which to paste the file.
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export async function pasteUrl(
|
export async function pasteUrl(
|
||||||
|
|
|
@ -114,7 +114,7 @@ const isFile = (item: ClipboardItem) => {
|
||||||
* Handle text pasted into the editor.
|
* Handle text pasted into the editor.
|
||||||
* @param editor - The editor instance.
|
* @param editor - The editor instance.
|
||||||
* @param data - The text to paste.
|
* @param data - The text to paste.
|
||||||
* @param point - (optional) The point at which to paste the text.
|
* @param point - The point at which to paste the text.
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
const handleText = (
|
const handleText = (
|
||||||
|
@ -186,7 +186,7 @@ type ClipboardThing =
|
||||||
*
|
*
|
||||||
* @param editor - The editor
|
* @param editor - The editor
|
||||||
* @param clipboardData - The clipboard data
|
* @param clipboardData - The clipboard data
|
||||||
* @param point - (optional) The point to paste at
|
* @param point - The point to paste at
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
const handlePasteFromEventClipboardData = async (
|
const handlePasteFromEventClipboardData = async (
|
||||||
|
@ -242,7 +242,7 @@ const handlePasteFromEventClipboardData = async (
|
||||||
*
|
*
|
||||||
* @param editor - The editor
|
* @param editor - The editor
|
||||||
* @param clipboardItems - The clipboard items to handle
|
* @param clipboardItems - The clipboard items to handle
|
||||||
* @param point - (optional) The point to paste at
|
* @param point - The point to paste at
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
const handlePasteFromClipboardApi = async (
|
const handlePasteFromClipboardApi = async (
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { TLUiTranslation, fetchTranslation } from './translations'
|
||||||
export interface TLUiTranslationProviderProps {
|
export interface TLUiTranslationProviderProps {
|
||||||
children: any
|
children: any
|
||||||
/**
|
/**
|
||||||
* (optional) A collection of overrides different locales.
|
* A collection of overrides different locales.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue