import sublime, sublime_plugin import re # Prepare some common property values for when there is more than one way to # specify a certain value type. The color value for example can be specified # by `rgb()` or `hsl()` and so on. Example where `|` denotes the caret: # # color: rg| --> color: rgb(|); # # This is also helpful when multiple properties share the same value types. COMMON_VALUES = { 'animation_direction': [ 'alternate', 'alternate-reverse', 'normal', 'reverse' ], 'absolute_size': [ 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' ], 'absolute_weight': [ '100', '200', '300', '400', '500', '600', '700', '800', '900' ], 'basic_shape': ['inset($1)', 'circle($1)', 'ellipse($1)', 'polygon($1)'], 'blend_mode': [ 'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity' ], 'border_style': [ 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset' ], 'border_width': ['thin', 'medium', 'thick'], 'break_before_after': [ 'always', 'left', 'right', 'recto', 'verso', 'page', 'column', 'region' ], 'break_inside': [ 'auto', 'avoid', 'avoid-page', 'avoid-column', 'avoid-region' ], 'color': [ 'currentColor', ['rgb()', 'rgb(${1:0}, ${2:0}, ${3:0})'], ['rgba()', 'rgba(${1:0}, ${2:0}, ${3:0}, ${4:1.0})'], ['hsl()', 'hsl(${1:0}, ${2:100%}, ${3:50%})'], ['hsla()', 'hsla(${1:0}, ${2:100%}, ${3:50%}, ${4:1.0})'], 'transparent' ], 'font_variant_alternates': [ 'normal', 'historical-forms', 'stylistic($1)', 'styleset($1)', 'character-variant($1)', 'swash($1)', 'ornaments($1)', 'annotation($1)' ], 'generic_name': [ 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace' ], 'grid': [ ['repeat()', 'repeat(${1:2}, ${2:1fr})'], ['minmax()', 'minmax(${1:100px}, ${2:1fr})'], ], 'list_style_type': [ 'none', 'inline', 'disc', 'circle', 'square', 'decimal', 'decimal-leading-zero', 'arabic-indic', 'binary', 'bengali', 'cambodian', 'khmer', 'devanagari', 'gujarati', 'gurmukhi', 'kannada', 'lower-hexadecimal', 'lao', 'malayalam', 'mongolian', 'myanmar', 'octal', 'oriya', 'persian', 'urdu', 'telugu', 'tibetan', 'thai', 'upper-hexadecimal', 'lower-roman', 'upper-roman', 'lower-greek', 'lower-alpha', 'lower-latin', 'upper-alpha', 'upper-latin', 'afar', 'ethiopic-halehame-aa-et', 'ethiopic-halehame-aa-er', 'amharic', 'ethiopic-halehame-am-et', 'amharic-abegede', 'ethiopic-abegede-am-et', 'cjk-earthly-branch', 'cjk-heavenly-stem', 'ethiopic', 'ethiopic-halehame-gez', 'ethiopic-abegede', 'ethiopic-abegede-gez', 'hangul-consonant', 'hangul', 'lower-norwegian', 'oromo', 'ethiopic-halehame-om-et', 'sidama', 'ethiopic-halehame-sid-et', 'somali', 'ethiopic-halehame-so-et', 'tigre', 'ethiopic-halehame-tig', 'tigrinya-er', 'ethiopic-halehame-ti-er', 'tigrinya-er-abegede', 'ethiopic-abegede-ti-er', 'tigrinya-et', 'ethiopic-halehame-ti-et', 'tigrinya-et-abegede', 'ethiopic-abegede-ti-et', 'upper-greek', 'upper-norwegian', 'asterisks', 'footnotes', 'hebrew', 'armenian', 'lower-armenian', 'upper-armenian', 'georgian', 'cjk-ideographic', 'hiragana', 'katakana', 'hiragana-iroha', 'katakana-iroha' ], 'position': ['top', 'right', 'bottom', 'left', 'center'], 'relative_size': ['larger', 'smaller'], 'relative_weight': ['bolder', 'lighter'], 'repeat_style': [ 'repeat', 'repeat-x', 'repeat-y', 'space', 'round', 'no-repeat' ], 'string': ['\"$1\"'], 'timing_function': [ 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear', ['cubic-bezier()', 'cubic-bezier(${1:0.0}, ${2:0.0}, ${3:1.0}, ${4:1.0})'], 'step-start', 'step-end', ['steps()', 'steps(${1:2}, ${2:start})'], ], 'uri': ['url($1)'], } PROPERTY_DICT = { 'align-content': [ 'center', 'flex-end', 'flex-start', 'space-around', 'space-between', 'stretch' ], 'align-items': ['baseline', 'center', 'flex-end', 'flex-start', 'stretch'], 'align-self': ['auto', 'baseline', 'center', 'flex-end', 'flex-start', 'stretch'], 'alignment-baseline': [ 'baseline', 'middle', 'auto', 'before-edge', 'after-edge', 'central', 'text-before-edge', 'text-after-edge', 'ideographic', 'alphabetic', 'hanging', 'mathematical' ], 'animation': [ 'none', '', 'infinite', '', 'forwards', 'backwards', 'both', 'running', 'paused' ], 'animation-name': ['none', ''], 'animation-duration': ['