@yuntijs/ui
Version:
☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps
28 lines (24 loc) • 978 B
JavaScript
export var DEFAULT_PUNCTUATION = '\\.,\\*\\?\\$\\|#{}\\(\\)\\^\\[\\]\\\\/!%\'"~=<>_:;';
// Makes it possible to use brackets before the trigger: (@mention)
export var PRE_TRIGGER_CHARS = '\\(';
// Strings that can trigger the mention menu.
export var TRIGGERS = function TRIGGERS(triggers) {
return '(?:' + triggers.join('|') + ')';
};
// Chars we expect to see in a mention (non-space, non-punctuation).
export var VALID_CHARS = function VALID_CHARS(triggers, punctuation) {
var lookahead = triggers.length === 0 ? '' : '(?!' + triggers.join('|') + ')';
return lookahead + '[^\\s' + punctuation + ']';
};
// Non-standard series of chars. Each series must be preceded and followed by
// a valid char.
export var VALID_JOINS = function VALID_JOINS(punctuation) {
return '(?:' + '\\.[ |$]|' +
// E.g. "r. " in "Mr. Smith"
'\\s|' +
// E.g. " " in "Josh Duck"
'[' + punctuation + ']|' +
// E.g. "-' in "Salier-Hellendag"
')';
};
export var LENGTH_LIMIT = 75;