<commit_before>import {layoutAlign} from './layout';

import {
  numberValue, stringValue, colorValue,
  alignValue, baselineValue, fontWeightValue,
  numberOrSignal, stringOrSignal, arrayOrSignal,
  anyOf, allOf, def, enums, object, pattern, required, ref, type,
  numberType, stringType
} from './util';

// types defined elsewhere
const encodeEntryRef = def('encodeEntry');
const styleRef = ref('style');
const labelOverlapRef = ref('labelOverlap');
const tickCountRef = ref('tickCount');

const guideEncodeRef = def('guideEncode');
const guideEncode = pattern(
  object({
    name: stringType,
    interactive: type('boolean', {default: false}),
    style: styleRef
  }), {
    '^(?!interactive|name|style).+$': encodeEntryRef
  }
);

const legendTypeEnum = ['gradient', 'symbol'];

const legendDirectionEnum = ['vertical', 'horizontal'];

const legendOrientEnum = [
  'none',
  'left',
  'right',
  'top',
  'bottom',
  'top-left',
  'top-right',
  'bottom-left',
  'bottom-right'
];

const legendProps = object({
  size:        stringType,
  shape:       stringType,
  fill:        stringType,
  stroke:      stringType,
  opacity:     stringType,
  strokeDash:  stringType,
  strokeWidth: stringType,
  type: enums(legendTypeEnum),
  direction: enums(legendDirectionEnum),
  orient: enums(legendOrientEnum, {default: 'right'}),

  format: stringOrSignal,
  title: stringOrSignal,
  tickCount: tickCountRef,
  tickMinStep: numberOrSignal,
  values: arrayOrSignal,
  zindex: numberType,

  // LEGEND GROUP CONFIG
  cornerRadius: numberValue,
  fillColor: colorValue,
  offset: numberValue,
  padding: numberValue,
  strokeColor: colorValue,

  // LEGEND TITLE CONFIG
  titleAlign: alignValue,
  titleBaseline: baselineValue,
  titleColor: colorValue,
  titleFont: stringValue,
  titleFontSize: numberValue,
  titleFontStyle: stringValue,
  titleFontWeight: fontWeightValue,
  titleLimit: numberValue,
  titleOpacity: numberValue,
  titlePadding: numberValue,

  // GRADIENT CONFIG
  gradientLength: numberOrSignal,
  gradientOpacity: numberValue,
  gradientStrokeColor: colorValue,
  gradientStrokeWidth: numberValue,
  gradientThickness: numberOrSignal,

  // SYMBOL LAYOUT CONFIG
  clipHeight: numberOrSignal,
  columns: numberOrSignal,
  columnPadding: numberOrSignal,
  rowPadding: numberOrSignal,
  gridAlign: layoutAlign,

  // SYMBOL CONFIG
  symbolFillColor: colorValue,
  symbolOffset: numberValue,
  symbolOpacity: numberValue,
  symbolSize: numberValue,
  symbolStrokeColor: colorValue,
  symbolStrokeWidth: numberValue,
  symbolType: stringValue,

  // LABEL CONFIG
  labelAlign: alignValue,
  labelBaseline: baselineValue,
  labelColor: colorValue,
  labelFont: stringValue,
  labelFontSize: numberValue,
  labelFontStyle: stringValue,
  labelFontWeight: fontWeightValue,
  labelLimit: numberValue,
  labelOffset: numberValue,
  labelOpacity: numberValue,
  labelOverlap: labelOverlapRef,
  labelSeparation: numberOrSignal,

  // CUSTOMIZED ENCODERS
  encode: object({
    title: guideEncodeRef,
    labels: guideEncodeRef,
    legend: guideEncodeRef,
    entries: guideEncodeRef,
    symbols: guideEncodeRef,
    gradient: guideEncodeRef
  })
});

const legend = allOf(
  legendProps,
  anyOf(
    required('size'),
    required('shape'),
    required('fill'),
    required('stroke'),
    required('opacity'),
    required('strokeDash')
  )
);

export default {
  defs: {
    guideEncode,
    legend
  }
};
<commit_msg>Fix missing strokeWidth option in legend schema.<commit_after>import {layoutAlign} from './layout';

import {
  numberValue, stringValue, colorValue,
  alignValue, baselineValue, fontWeightValue,
  numberOrSignal, stringOrSignal, arrayOrSignal,
  anyOf, allOf, def, enums, object, pattern, required, ref, type,
  numberType, stringType
} from './util';

// types defined elsewhere
const encodeEntryRef = def('encodeEntry');
const styleRef = ref('style');
const labelOverlapRef = ref('labelOverlap');
const tickCountRef = ref('tickCount');

const guideEncodeRef = def('guideEncode');
const guideEncode = pattern(
  object({
    name: stringType,
    interactive: type('boolean', {default: false}),
    style: styleRef
  }), {
    '^(?!interactive|name|style).+$': encodeEntryRef
  }
);

const legendTypeEnum = ['gradient', 'symbol'];

const legendDirectionEnum = ['vertical', 'horizontal'];

const legendOrientEnum = [
  'none',
  'left',
  'right',
  'top',
  'bottom',
  'top-left',
  'top-right',
  'bottom-left',
  'bottom-right'
];

const legendProps = object({
  size:        stringType,
  shape:       stringType,
  fill:        stringType,
  stroke:      stringType,
  opacity:     stringType,
  strokeDash:  stringType,
  strokeWidth: stringType,
  type: enums(legendTypeEnum),
  direction: enums(legendDirectionEnum),
  orient: enums(legendOrientEnum, {default: 'right'}),

  format: stringOrSignal,
  title: stringOrSignal,
  tickCount: tickCountRef,
  tickMinStep: numberOrSignal,
  values: arrayOrSignal,
  zindex: numberType,

  // LEGEND GROUP CONFIG
  cornerRadius: numberValue,
  fillColor: colorValue,
  offset: numberValue,
  padding: numberValue,
  strokeColor: colorValue,

  // LEGEND TITLE CONFIG
  titleAlign: alignValue,
  titleBaseline: baselineValue,
  titleColor: colorValue,
  titleFont: stringValue,
  titleFontSize: numberValue,
  titleFontStyle: stringValue,
  titleFontWeight: fontWeightValue,
  titleLimit: numberValue,
  titleOpacity: numberValue,
  titlePadding: numberValue,

  // GRADIENT CONFIG
  gradientLength: numberOrSignal,
  gradientOpacity: numberValue,
  gradientStrokeColor: colorValue,
  gradientStrokeWidth: numberValue,
  gradientThickness: numberOrSignal,

  // SYMBOL LAYOUT CONFIG
  clipHeight: numberOrSignal,
  columns: numberOrSignal,
  columnPadding: numberOrSignal,
  rowPadding: numberOrSignal,
  gridAlign: layoutAlign,

  // SYMBOL CONFIG
  symbolFillColor: colorValue,
  symbolOffset: numberValue,
  symbolOpacity: numberValue,
  symbolSize: numberValue,
  symbolStrokeColor: colorValue,
  symbolStrokeWidth: numberValue,
  symbolType: stringValue,

  // LABEL CONFIG
  labelAlign: alignValue,
  labelBaseline: baselineValue,
  labelColor: colorValue,
  labelFont: stringValue,
  labelFontSize: numberValue,
  labelFontStyle: stringValue,
  labelFontWeight: fontWeightValue,
  labelLimit: numberValue,
  labelOffset: numberValue,
  labelOpacity: numberValue,
  labelOverlap: labelOverlapRef,
  labelSeparation: numberOrSignal,

  // CUSTOMIZED ENCODERS
  encode: object({
    title: guideEncodeRef,
    labels: guideEncodeRef,
    legend: guideEncodeRef,
    entries: guideEncodeRef,
    symbols: guideEncodeRef,
    gradient: guideEncodeRef
  })
});

const legend = allOf(
  legendProps,
  anyOf(
    required('size'),
    required('shape'),
    required('fill'),
    required('stroke'),
    required('opacity'),
    required('strokeDash'),
    required('strokeWidth')
  )
);

export default {
  defs: {
    guideEncode,
    legend
  }
};

{'fraction_non_alphanumeric': 0.1069164265129683, 'fraction_numerical': 0.0, 'mean_word_length': 4.620242914979757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3499144', 'n_tokens_mistral': 2155, 'n_tokens_neox': 2118, 'n_words': 507}