<commit_before>import Backbone from 'backbone';
import { isUndefined, isString } from 'underscore';
import { capitalize } from 'utils/mixins';

const Property = Backbone.Model.extend(
  {
    defaults: {
      name: '',
      property: '',
      type: '',
      defaults: '',
      info: '',
      value: '',
      icon: '',
      functionName: '',
      status: '',
      visible: true,
      fixedValues: ['initial', 'inherit'],

      // If true, the property will be forced to be full width
      full: 0,

      // If true to the value will be added '!important'
      important: 0,

      // If true, will be hidden by default and will show up only for targets
      // which require this property (via `stylable-require`)
      // Use case:
      // you can add all SVG CSS properties with toRequire as true
      // and then require them on SVG Components
      toRequire: 0,

      // Specifies dependency on other properties of the selected object.
      // Property is shown only when all conditions are matched.
      //
      // example: { display: ['flex', 'block'], position: ['absolute'] };
      //          in this case the property is only shown when display is
      //          of value 'flex' or 'block' AND position is 'absolute'
      requires: null,

      // Specifies dependency on properties of the parent of the selected object.
      // Property is shown only when all conditions are matched.
      requiresParent: null
    },

    initialize(props = {}, opts = {}) {
      const id = this.get('id') || '';
      const name = this.get('name') || '';
      !this.get('property') &&
        this.set('property', (name || id).replace(/ /g, '-'));
      const prop = this.get('property');
      !this.get('id') && this.set('id', prop);
      !name && this.set('name', capitalize(prop).replace(/-/g, ' '));
      Property.callInit(this, props, opts);
    },

    init() {},

    /**
     * Clear the value
     * @return {this}
     */
    clearValue(opts = {}) {
      this.set({ value: undefined, status: '' }, opts);
      return this;
    },

    /**
     * Update value
     * @param {any} value
     * @param {Boolen} [complete=true] Indicates if it's a final state
     * @param {Object} [opts={}] Options
     */
    setValue(value, complete = 1, opts = {}) {
      const parsed = this.parseValue(value);
      const avoidStore = !complete;
      !avoidStore && this.set({ value: '' }, { avoidStore, silent: true });
      this.set(parsed, { avoidStore, ...opts });
    },

    /**<commit_msg>Trigger change on values with empty value. Closes #2835<commit_after>import Backbone from 'backbone';
import { isUndefined, isString } from 'underscore';
import { capitalize } from 'utils/mixins';

const Property = Backbone.Model.extend(
  {
    defaults: {
      name: '',
      property: '',
      type: '',
      defaults: '',
      info: '',
      value: '',
      icon: '',
      functionName: '',
      status: '',
      visible: true,
      fixedValues: ['initial', 'inherit'],

      // If true, the property will be forced to be full width
      full: 0,

      // If true to the value will be added '!important'
      important: 0,

      // If true, will be hidden by default and will show up only for targets
      // which require this property (via `stylable-require`)
      // Use case:
      // you can add all SVG CSS properties with toRequire as true
      // and then require them on SVG Components
      toRequire: 0,

      // Specifies dependency on other properties of the selected object.
      // Property is shown only when all conditions are matched.
      //
      // example: { display: ['flex', 'block'], position: ['absolute'] };
      //          in this case the property is only shown when display is
      //          of value 'flex' or 'block' AND position is 'absolute'
      requires: null,

      // Specifies dependency on properties of the parent of the selected object.
      // Property is shown only when all conditions are matched.
      requiresParent: null
    },

    initialize(props = {}, opts = {}) {
      const id = this.get('id') || '';
      const name = this.get('name') || '';
      !this.get('property') &&
        this.set('property', (name || id).replace(/ /g, '-'));
      const prop = this.get('property');
      !this.get('id') && this.set('id', prop);
      !name && this.set('name', capitalize(prop).replace(/-/g, ' '));
      Property.callInit(this, props, opts);
    },

    init() {},

    /**
     * Clear the value
     * @return {this}
     */
    clearValue(opts = {}) {
      this.set({ value: undefined, status: '' }, opts);
      return this;
    },

    /**
     * Update value
     * @param {any} value
     * @param {Boolen} [complete=true] Indicates if it's a final state
     * @param {Object} [opts={}] Options
     */
    setValue(value, complete = 1, opts = {}) {
      const parsed = this.parseValue(value);
      const avoidStore = !complete;
      !avoidStore &&
        this.set({ value: undefined }, { avoidStore, silent: true });
      this.set(parsed, { avoidStore, ...opts });
    },

    /**
{'fraction_non_alphanumeric': 0.14719123116069682, 'fraction_numerical': 0.002348796241926013, 'mean_word_length': 2.2219419924337958, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7231136', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1422, 'n_words': 491}