UNPKG

@tldraw/tlschema

Version:

tldraw infinite canvas SDK (schema).

8 lines (7 loc) 1.87 kB
{ "version": 3, "sources": ["../../src/styles/TLSizeStyle.ts"], "sourcesContent": ["import { T } from '@tldraw/validate'\nimport { StyleProp } from './StyleProp'\n\n/**\n * Default size style property used by tldraw shapes for scaling visual elements.\n * Controls the relative size of shape elements like stroke width, text size, and other proportional features.\n *\n * Available values:\n * - `s` - Small size\n * - `m` - Medium size (default)\n * - `l` - Large size\n * - `xl` - Extra large size\n *\n * @example\n * ```ts\n * import { DefaultSizeStyle } from '@tldraw/tlschema'\n *\n * // Use in shape props definition\n * interface MyShapeProps {\n * size: typeof DefaultSizeStyle\n * // other props...\n * }\n *\n * // Create a shape with large size\n * const shape = {\n * // ... other properties\n * props: {\n * size: 'l' as const,\n * // ... other props\n * }\n * }\n * ```\n *\n * @public\n */\nexport const DefaultSizeStyle = StyleProp.defineEnum('tldraw:size', {\n\tdefaultValue: 'm',\n\tvalues: ['s', 'm', 'l', 'xl'],\n})\n\n/**\n * Type representing a default size style value.\n * This is a union type of all available size options.\n *\n * @example\n * ```ts\n * import { TLDefaultSizeStyle } from '@tldraw/tlschema'\n *\n * // Valid size values\n * const smallSize: TLDefaultSizeStyle = 's'\n * const mediumSize: TLDefaultSizeStyle = 'm'\n * const largeSize: TLDefaultSizeStyle = 'l'\n * const extraLargeSize: TLDefaultSizeStyle = 'xl'\n *\n * // Use in a function parameter\n * function setShapeSize(size: TLDefaultSizeStyle) {\n * // Apply size style to shape\n * }\n * ```\n *\n * @public\n */\nexport type TLDefaultSizeStyle = T.TypeOf<typeof DefaultSizeStyle>\n"], "mappings": "AACA,SAAS,iBAAiB;AAkCnB,MAAM,mBAAmB,UAAU,WAAW,eAAe;AAAA,EACnE,cAAc;AAAA,EACd,QAAQ,CAAC,KAAK,KAAK,KAAK,IAAI;AAC7B,CAAC;", "names": [] }