{
  "version": 3,
  "sources": ["../../src/styles/StyleProp.ts"],
  "sourcesContent": ["import { T } from '@bigbluebutton/validate'\n\n/**\n * A `StyleProp` is a property of a shape that follows some special rules.\n *\n * 1. The same value can be set on lots of shapes at the same time.\n *\n * 2. The last used value is automatically saved and applied to new shapes.\n *\n * For example, {@link DefaultColorStyle} is a style prop used by tldraw's default shapes to set\n * their color. If you try selecting several shapes on tldraw.com and changing their color, you'll\n * see that the color is applied to all of them. Then, if you draw a new shape, it'll have the same\n * color as the one you just set.\n *\n * You can use styles in your own shapes by either defining your own (see {@link StyleProp.define}\n * and {@link StyleProp.defineEnum}) or using tldraw's default ones, like {@link DefaultColorStyle}.\n * When you define a shape, pass a `props` object describing all of your shape's properties, using\n * `StyleProp`s for the ones you want to be styles. See the\n * {@link https://github.com/bigbluebutton/tldraw/tree/main/apps/examples | custom styles example}\n * for more.\n *\n * @public\n */\nexport class StyleProp<Type> implements T.Validatable<Type> {\n\t/**\n\t * Define a new {@link StyleProp}.\n\t *\n\t * @param uniqueId - Each StyleProp must have a unique ID. We recommend you prefix this with\n\t * your app/library name.\n\t * @param options -\n\t * - `defaultValue`: The default value for this style prop.\n\t *\n\t * - `type`: Optionally, describe what type of data you expect for this style prop.\n\t *\n\t * @example\n\t * ```ts\n\t * import {T} from '@bigbluebutton/validate'\n\t * import {StyleProp} from '@bigbluebutton/tlschema'\n\t *\n\t * const MyLineWidthProp = StyleProp.define('myApp:lineWidth', {\n\t *   defaultValue: 1,\n\t *   type: T.number,\n\t * })\n\t * ```\n\t * @public\n\t */\n\tstatic define<Type>(\n\t\tuniqueId: string,\n\t\toptions: { defaultValue: Type; type?: T.Validatable<Type> }\n\t) {\n\t\tconst { defaultValue, type = T.any } = options\n\t\treturn new StyleProp<Type>(uniqueId, defaultValue, type)\n\t}\n\n\t/**\n\t * Define a new {@link StyleProp} as a list of possible values.\n\t *\n\t * @param uniqueId - Each StyleProp must have a unique ID. We recommend you prefix this with\n\t * your app/library name.\n\t * @param options -\n\t * - `defaultValue`: The default value for this style prop.\n\t *\n\t * - `values`: An array of possible values of this style prop.\n\t *\n\t * @example\n\t * ```ts\n\t * import {StyleProp} from '@bigbluebutton/tlschema'\n\t *\n\t * const MySizeProp = StyleProp.defineEnum('myApp:size', {\n\t *   defaultValue: 'medium',\n\t *   values: ['small', 'medium', 'large'],\n\t * })\n\t * ```\n\t */\n\tstatic defineEnum<const Values extends readonly unknown[]>(\n\t\tuniqueId: string,\n\t\toptions: { defaultValue: Values[number]; values: Values }\n\t) {\n\t\tconst { defaultValue, values } = options\n\t\treturn new EnumStyleProp<Values[number]>(uniqueId, defaultValue, values)\n\t}\n\n\t/** @internal */\n\tprotected constructor(\n\t\treadonly id: string,\n\t\treadonly defaultValue: Type,\n\t\treadonly type: T.Validatable<Type>\n\t) {}\n\n\tvalidate(value: unknown) {\n\t\treturn this.type.validate(value)\n\t}\n}\n\n/**\n * See {@link StyleProp} & {@link StyleProp.defineEnum}\n *\n * @public\n */\nexport class EnumStyleProp<T> extends StyleProp<T> {\n\t/** @internal */\n\tconstructor(id: string, defaultValue: T, readonly values: readonly T[]) {\n\t\tsuper(id, defaultValue, T.literalEnum(...values))\n\t}\n}\n"],
  "mappings": "AAAA,SAAS,SAAS;AAuBX,MAAM,UAA+C;AAAA;AAAA,EA4DjD,YACA,IACA,cACA,MACR;AAHQ;AACA;AACA;AAAA,EACP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAzCH,OAAO,OACN,UACA,SACC;AACD,UAAM,EAAE,cAAc,OAAO,EAAE,IAAI,IAAI;AACvC,WAAO,IAAI,UAAgB,UAAU,cAAc,IAAI;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsBA,OAAO,WACN,UACA,SACC;AACD,UAAM,EAAE,cAAc,OAAO,IAAI;AACjC,WAAO,IAAI,cAA8B,UAAU,cAAc,MAAM;AAAA,EACxE;AAAA,EASA,SAAS,OAAgB;AACxB,WAAO,KAAK,KAAK,SAAS,KAAK;AAAA,EAChC;AACD;AAOO,MAAM,sBAAyB,UAAa;AAAA;AAAA,EAElD,YAAY,IAAY,cAA0B,QAAsB;AACvE,UAAM,IAAI,cAAc,EAAE,YAAY,GAAG,MAAM,CAAC;AADC;AAAA,EAElD;AACD;",
  "names": []
}
