@serendie/ui
Version:
Adaptive UI component library as part of Serendie Design System by Mitsubishi Electric
21 lines (20 loc) • 1.75 kB
JavaScript
import { withoutSpace as a } from "../helpers.js";
const s = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_ariaExpanded,expanded,expandedOnly,expandedDown,_themeAsagi,_themeKonjo-dark,_themeKurikawa,_themeSumire,_themeTsutsuji,base", n = new Set(s.split(",")), d = /^@|&|&$/;
function o(_) {
return n.has(_) || d.test(_);
}
const l = /^_/, c = /&|@/;
function p(_) {
return _.map((e) => n.has(e) ? e.replace(l, "") : c.test(e) ? `[${a(e.trim())}]` : e);
}
function g(_) {
return _.sort((e, i) => {
const r = o(e), t = o(i);
return r && !t ? 1 : !r && t ? -1 : 0;
});
}
export {
p as finalizeConditions,
o as isCondition,
g as sortConditions
};