{"version":3,"file":"constants.min.mjs","sources":["../../../../src/shapes/Text/constants.ts"],"sourcesContent":["import { FILL, LEFT, STROKE, reNewline } from '../../constants';\nimport type { TClassProperties } from '../../typedefs';\nimport type { FabricText } from './Text';\n\nconst fontProperties = [\n  'fontSize',\n  'fontWeight',\n  'fontFamily',\n  'fontStyle',\n] as const;\n\nexport const textDecorationProperties = [\n  'underline',\n  'overline',\n  'linethrough',\n] as const;\n\nexport const textLayoutProperties: string[] = [\n  ...fontProperties,\n  'lineHeight',\n  'text',\n  'charSpacing',\n  'textAlign',\n  'styles',\n  'path',\n  'pathStartOffset',\n  'pathSide',\n  'pathAlign',\n];\n\nexport const additionalProps = [\n  ...textLayoutProperties,\n  ...textDecorationProperties,\n  'textBackgroundColor',\n  'direction',\n] as const;\n\nexport type StylePropertiesType =\n  | 'fill'\n  | 'stroke'\n  | 'strokeWidth'\n  | 'fontSize'\n  | 'fontFamily'\n  | 'fontWeight'\n  | 'fontStyle'\n  | 'textBackgroundColor'\n  | 'deltaY'\n  | 'overline'\n  | 'underline'\n  | 'linethrough';\n\nexport const styleProperties: Readonly<StylePropertiesType[]> = [\n  ...fontProperties,\n  ...textDecorationProperties,\n  STROKE,\n  'strokeWidth',\n  FILL,\n  'deltaY',\n  'textBackgroundColor',\n] as const;\n\n// @TODO: Many things here are configuration related and shouldn't be on the class nor prototype\n// regexes, list of properties that are not suppose to change by instances, magic consts.\n// this will be a separated effort\nexport const textDefaultValues: Partial<TClassProperties<FabricText>> = {\n  _reNewline: reNewline,\n  _reSpacesAndTabs: /[ \\t\\r]/g,\n  _reSpaceAndTab: /[ \\t\\r]/,\n  _reWords: /\\S+/g,\n  fontSize: 40,\n  fontWeight: 'normal',\n  fontFamily: 'Times New Roman',\n  underline: false,\n  overline: false,\n  linethrough: false,\n  textAlign: LEFT,\n  fontStyle: 'normal',\n  lineHeight: 1.16,\n  superscript: {\n    size: 0.6, // fontSize factor\n    baseline: -0.35, // baseline-shift factor (upwards)\n  },\n  subscript: {\n    size: 0.6, // fontSize factor\n    baseline: 0.11, // baseline-shift factor (downwards)\n  },\n  textBackgroundColor: '',\n  stroke: null,\n  shadow: null,\n  path: undefined,\n  pathStartOffset: 0,\n  pathSide: LEFT,\n  pathAlign: 'baseline',\n  _fontSizeFraction: 0.222,\n  offsets: {\n    underline: 0.1,\n    linethrough: -0.315,\n    overline: -0.88,\n  },\n  _fontSizeMult: 1.13,\n  charSpacing: 0,\n  deltaY: 0,\n  direction: 'ltr',\n  CACHE_FONT_SIZE: 400,\n  MIN_TEXT_WIDTH: 2,\n};\n\nexport const JUSTIFY = 'justify';\nexport const JUSTIFY_LEFT = 'justify-left';\nexport const JUSTIFY_RIGHT = 'justify-right';\nexport const JUSTIFY_CENTER = 'justify-center';\n"],"names":["fontProperties","textDecorationProperties","textLayoutProperties","additionalProps","styleProperties","STROKE","FILL","textDefaultValues","_reNewline","reNewline","_reSpacesAndTabs","_reSpaceAndTab","_reWords","fontSize","fontWeight","fontFamily","underline","overline","linethrough","textAlign","LEFT","fontStyle","lineHeight","superscript","size","baseline","subscript","textBackgroundColor","stroke","shadow","path","undefined","pathStartOffset","pathSide","pathAlign","_fontSizeFraction","offsets","_fontSizeMult","charSpacing","deltaY","direction","CACHE_FONT_SIZE","MIN_TEXT_WIDTH","JUSTIFY","JUSTIFY_LEFT","JUSTIFY_RIGHT","JUSTIFY_CENTER"],"mappings":"oFAIA,MAAMA,EAAiB,CACrB,WACA,aACA,aACA,aAGWC,EAA2B,CACtC,YACA,WACA,eAGWC,EAAiC,IACzCF,EACH,aACA,OACA,cACA,YACA,SACA,OACA,kBACA,WACA,aAGWG,EAAkB,IAC1BD,KACAD,EACH,sBACA,aAiBWG,EAAmD,IAC3DJ,KACAC,EACHI,EACA,cACAC,EACA,SACA,uBAMWC,EAA2D,CACtEC,WAAYC,EACZC,iBAAkB,WAClBC,eAAgB,UAChBC,SAAU,OACVC,SAAU,GACVC,WAAY,SACZC,WAAY,kBACZC,WAAW,EACXC,UAAU,EACVC,aAAa,EACbC,UAAWC,EACXC,UAAW,SACXC,WAAY,KACZC,YAAa,CACXC,KAAM,GACNC,UAAW,KAEbC,UAAW,CACTF,KAAM,GACNC,SAAU,KAEZE,oBAAqB,GACrBC,OAAQ,KACRC,OAAQ,KACRC,UAAMC,EACNC,gBAAiB,EACjBC,SAAUb,EACVc,UAAW,WACXC,kBAAmB,KACnBC,QAAS,CACPpB,UAAW,GACXE,aAAc,KACdD,UAAW,KAEboB,cAAe,KACfC,YAAa,EACbC,OAAQ,EACRC,UAAW,MACXC,gBAAiB,IACjBC,eAAgB,GAGLC,EAAU,UACVC,EAAe,eACfC,EAAgB,gBAChBC,EAAiB"}