0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-27 22:33:07 +00:00

update widgets - add hints component and adjust autocomplete logic

This commit is contained in:
Charlie Humphreys
2023-06-30 00:18:23 -05:00
parent b6d37dd825
commit 47c84d9f01
10 changed files with 327 additions and 149 deletions

View File

@@ -1,5 +1,10 @@
export const UNITS = ['cm', 'mm', 'in', 'px', 'pt', 'pc', 'em', 'ex', 'ch', 'rem', 'vw', 'vh', 'vmin', 'vmax', '%'];
export const HINT_TYPE = {
VALUE : 0,
NUMBER_SUFFIX : 1
};
export const WIDGET_TYPE = {
SNIPPET : 0,
INLINE_SNIPPET : 1,
@@ -17,7 +22,9 @@ export const PATTERNS = {
[WIDGET_TYPE.IMAGE] : ()=>new RegExp(`^\\!\\[(?:[a-zA-Z -]+)?\\]\\(.*\\).*{[a-zA-Z0-9:, "'-]+}$`),
},
field : {
[FIELD_TYPE.STYLE] : (name)=>new RegExp(`[{,;](${name}):((?:"[^},;"]*")|(?:[^},;]*))`),
[FIELD_TYPE.STYLE] : (name)=>new RegExp(`[{,;](${name}):("[^},;"]*"|[^},;]*)`),
},
collectStyles : new RegExp(`(?:[{,;]([a-zA-Z-]+):)+`, 'g'),
};
collectStyles : new RegExp(`(?:([a-zA-Z-]+):)+`, 'g'),
};
export const NUMBER_PATTERN = new RegExp(`([^-\\d]*)([-\\d]+)(${UNITS.join('|')})?(.*)`);