@tldraw/tlschema
Version:
tldraw infinite canvas SDK (schema).
8 lines (7 loc) • 2.01 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../src/styles/TLTextAlignStyle.ts"],
"sourcesContent": ["import { T } from '@tldraw/validate'\nimport { StyleProp } from './StyleProp'\n\n/**\n * Default text alignment style property used by tldraw text shapes.\n * Controls how text content is aligned within text-based shapes like text boxes and notes.\n *\n * Available values:\n * - `start` - Align text to the start (left in LTR, right in RTL)\n * - `middle` - Center text horizontally\n * - `end` - Align text to the end (right in LTR, left in RTL)\n *\n * @example\n * ```ts\n * import { DefaultTextAlignStyle } from '@tldraw/tlschema'\n *\n * // Use in text shape props definition\n * interface MyTextShapeProps {\n * textAlign: typeof DefaultTextAlignStyle\n * // other props...\n * }\n *\n * // Create a text shape with center alignment\n * const textShape = {\n * // ... other properties\n * props: {\n * textAlign: 'middle' as const,\n * // ... other props\n * }\n * }\n * ```\n *\n * @public\n */\nexport const DefaultTextAlignStyle = StyleProp.defineEnum('tldraw:textAlign', {\n\tdefaultValue: 'start',\n\tvalues: ['start', 'middle', 'end'],\n})\n\n/**\n * Type representing a default text alignment style value.\n * This is a union type of all available text alignment options.\n *\n * @example\n * ```ts\n * import { TLDefaultTextAlignStyle } from '@tldraw/tlschema'\n *\n * // Valid text alignment values\n * const leftAlign: TLDefaultTextAlignStyle = 'start'\n * const centerAlign: TLDefaultTextAlignStyle = 'middle'\n * const rightAlign: TLDefaultTextAlignStyle = 'end'\n *\n * // Use in a function parameter\n * function setTextAlignment(align: TLDefaultTextAlignStyle) {\n * // Apply text alignment to text shape\n * }\n * ```\n *\n * @public\n */\nexport type TLDefaultTextAlignStyle = T.TypeOf<typeof DefaultTextAlignStyle>\n"],
"mappings": "AACA,SAAS,iBAAiB;AAiCnB,MAAM,wBAAwB,UAAU,WAAW,oBAAoB;AAAA,EAC7E,cAAc;AAAA,EACd,QAAQ,CAAC,SAAS,UAAU,KAAK;AAClC,CAAC;",
"names": []
}