{"version":3,"file":"constants.min.mjs","sources":["../../../../src/shapes/Text/constants.ts"],"sourcesContent":["import { FILL, LEFT, LTR, NORMAL, STROKE, reNewline } from '../../constants';\nimport type { TClassProperties } from '../../typedefs';\nimport type { FabricText } from './Text';\n\nexport const TEXT_DECORATION_THICKNESS = 'textDecorationThickness';\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  TEXT_DECORATION_THICKNESS,\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  | typeof TEXT_DECORATION_THICKNESS;\n\nexport const styleProperties: Readonly<StylePropertiesType[]> = [\n  ...fontProperties,\n  ...textDecorationProperties,\n  STROKE,\n  'strokeWidth',\n  FILL,\n  'deltaY',\n  'textBackgroundColor',\n  TEXT_DECORATION_THICKNESS,\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  textBackgroundColor: '',\n  stroke: null,\n  shadow: null,\n  path: undefined,\n  pathStartOffset: 0,\n  pathSide: LEFT,\n  pathAlign: 'baseline',\n  charSpacing: 0,\n  deltaY: 0,\n  direction: LTR,\n  CACHE_FONT_SIZE: 400,\n  MIN_TEXT_WIDTH: 2,\n  // Text magic numbers\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  _fontSizeFraction: 0.222,\n  offsets: {\n    underline: 0.1,\n    linethrough: -0.28167, // added 1/30 to original number\n    overline: -0.81333, // added 1/15 to original number\n  },\n  _fontSizeMult: 1.13,\n  [TEXT_DECORATION_THICKNESS]: 66.667, // before implementation was 1/15\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":["TEXT_DECORATION_THICKNESS","fontProperties","textDecorationProperties","textLayoutProperties","additionalProps","styleProperties","STROKE","FILL","textDefaultValues","_reNewline","reNewline","_reSpacesAndTabs","_reSpaceAndTab","_reWords","fontSize","fontWeight","NORMAL","fontFamily","underline","overline","linethrough","textAlign","LEFT","fontStyle","lineHeight","textBackgroundColor","stroke","shadow","path","undefined","pathStartOffset","pathSide","pathAlign","charSpacing","deltaY","direction","LTR","CACHE_FONT_SIZE","MIN_TEXT_WIDTH","superscript","size","baseline","subscript","_fontSizeFraction","offsets","_fontSizeMult","JUSTIFY","JUSTIFY_LEFT","JUSTIFY_RIGHT","JUSTIFY_CENTER"],"mappings":"yGAIO,MAAMA,EAA4B,0BAEnCC,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,YACAF,GAkBWK,EAAmD,IAC3DJ,KACAC,EACHI,EACA,cACAC,EACA,SACA,sBACAP,GAMWQ,EAA2D,CACtEC,WAAYC,EACZC,iBAAkB,WAClBC,eAAgB,UAChBC,SAAU,OACVC,SAAU,GACVC,WAAYC,EACZC,WAAY,kBACZC,WAAW,EACXC,UAAU,EACVC,aAAa,EACbC,UAAWC,EACXC,UAAWP,EACXQ,WAAY,KACZC,oBAAqB,GACrBC,OAAQ,KACRC,OAAQ,KACRC,UAAMC,EACNC,gBAAiB,EACjBC,SAAUT,EACVU,UAAW,WACXC,YAAa,EACbC,OAAQ,EACRC,UAAWC,EACXC,gBAAiB,IACjBC,eAAgB,EAEhBC,YAAa,CACXC,KAAM,GACNC,UAAU,KAEZC,UAAW,CACTF,KAAM,GACNC,SAAU,KAEZE,kBAAmB,KACnBC,QAAS,CACP1B,UAAW,GACXE,aAAa,OACbD,UAAU,QAEZ0B,cAAe,KACf7C,CAACA,GAA4B,QAGlB8C,EAAU,UACVC,EAAe,eACfC,EAAgB,gBAChBC,EAAiB"}