@difizen/libro-common 0.0.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +0 -0
- package/es/array.d.ts +368 -0
- package/es/array.d.ts.map +1 -0
- package/es/array.js +577 -0
- package/es/display-wrapper.d.ts +6 -0
- package/es/display-wrapper.d.ts.map +1 -0
- package/es/display-wrapper.js +12 -0
- package/es/index.d.ts +11 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +10 -0
- package/es/iter.d.ts +147 -0
- package/es/iter.d.ts.map +1 -0
- package/es/iter.js +162 -0
- package/es/json.d.ts +126 -0
- package/es/json.d.ts.map +1 -0
- package/es/json.js +274 -0
- package/es/path.d.ts +97 -0
- package/es/path.d.ts.map +1 -0
- package/es/path.js +60 -0
- package/es/polling/index.d.ts +3 -0
- package/es/polling/index.d.ts.map +1 -0
- package/es/polling/index.js +2 -0
- package/es/polling/poll.d.ts +193 -0
- package/es/polling/poll.d.ts.map +1 -0
- package/es/polling/poll.js +501 -0
- package/es/polling/protocol.d.ts +120 -0
- package/es/polling/protocol.d.ts.map +1 -0
- package/es/polling/protocol.js +13 -0
- package/es/posix.d.ts +2 -0
- package/es/posix.d.ts.map +1 -0
- package/es/posix.js +71 -0
- package/es/protocol/cell-protocol.d.ts +181 -0
- package/es/protocol/cell-protocol.d.ts.map +1 -0
- package/es/protocol/cell-protocol.js +1 -0
- package/es/protocol/index.d.ts +4 -0
- package/es/protocol/index.d.ts.map +1 -0
- package/es/protocol/index.js +3 -0
- package/es/protocol/notebook-protocol.d.ts +63 -0
- package/es/protocol/notebook-protocol.d.ts.map +1 -0
- package/es/protocol/notebook-protocol.js +41 -0
- package/es/protocol/output-protocol.d.ts +125 -0
- package/es/protocol/output-protocol.d.ts.map +1 -0
- package/es/protocol/output-protocol.js +1 -0
- package/es/sanitizer.d.ts +44 -0
- package/es/sanitizer.d.ts.map +1 -0
- package/es/sanitizer.js +659 -0
- package/es/url.d.ts +98 -0
- package/es/url.d.ts.map +1 -0
- package/es/url.js +134 -0
- package/es/utils.d.ts +57 -0
- package/es/utils.d.ts.map +1 -0
- package/es/utils.js +124 -0
- package/package.json +62 -0
- package/src/array.ts +608 -0
- package/src/display-wrapper.tsx +11 -0
- package/src/index.ts +10 -0
- package/src/iter.ts +199 -0
- package/src/json.ts +321 -0
- package/src/path.ts +138 -0
- package/src/polling/index.ts +2 -0
- package/src/polling/poll.ts +508 -0
- package/src/polling/protocol.ts +145 -0
- package/src/posix.ts +75 -0
- package/src/protocol/cell-protocol.ts +215 -0
- package/src/protocol/index.ts +3 -0
- package/src/protocol/notebook-protocol.ts +73 -0
- package/src/protocol/output-protocol.ts +162 -0
- package/src/sanitizer.ts +944 -0
- package/src/url.ts +157 -0
- package/src/utils.ts +145 -0
package/es/sanitizer.js
ADDED
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _class, _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
|
+
import _sanitize from 'sanitize-html';
|
|
13
|
+
var CssProp = /*#__PURE__*/function () {
|
|
14
|
+
function CssProp() {
|
|
15
|
+
_classCallCheck(this, CssProp);
|
|
16
|
+
}
|
|
17
|
+
_createClass(CssProp, null, [{
|
|
18
|
+
key: "reg",
|
|
19
|
+
value: function reg(r) {
|
|
20
|
+
return new RegExp('^' + r + '$', 'i');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Numeric base expressions used to help build more complex regular expressions
|
|
25
|
+
*/
|
|
26
|
+
}]);
|
|
27
|
+
return CssProp;
|
|
28
|
+
}();
|
|
29
|
+
_class = CssProp;
|
|
30
|
+
CssProp.N = {
|
|
31
|
+
integer: "[+-]?[0-9]+",
|
|
32
|
+
integer_pos: "[+]?[0-9]+",
|
|
33
|
+
integer_zero_ff: "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",
|
|
34
|
+
number: "[+-]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?",
|
|
35
|
+
number_pos: "[+]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?",
|
|
36
|
+
number_zero_hundred: "[+]?(([0-9]|[1-9][0-9])([.][0-9]+)?|100)",
|
|
37
|
+
number_zero_one: "[+]?(1([.][0]+)?|0?([.][0-9]+)?)"
|
|
38
|
+
};
|
|
39
|
+
/*
|
|
40
|
+
* Base expressions of common CSS syntax elements
|
|
41
|
+
*/
|
|
42
|
+
CssProp.B = {
|
|
43
|
+
angle: "(".concat(_class.N.number, "(deg|rad|grad|turn)|0)"),
|
|
44
|
+
frequency: "".concat(_class.N.number, "(Hz|kHz)"),
|
|
45
|
+
ident: String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["-?([_a-z]|[\xA0-\xFF]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\xA0-\xFF]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*"], ["-?([_a-z]|[\\xA0-\\xFF]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])([_a-z0-9-]|[\\xA0-\\xFF]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*"]))),
|
|
46
|
+
len_or_perc: "(0|".concat(_class.N.number, "(px|em|rem|ex|in|cm|mm|pt|pc|%))"),
|
|
47
|
+
length: "(".concat(_class.N.number, "(px|em|rem|ex|in|cm|mm|pt|pc)|0)"),
|
|
48
|
+
length_pos: "(".concat(_class.N.number_pos, "(px|em|rem|ex|in|cm|mm|pt|pc)|0)"),
|
|
49
|
+
percentage: "".concat(_class.N.number, "%"),
|
|
50
|
+
percentage_pos: "".concat(_class.N.number_pos, "%"),
|
|
51
|
+
percentage_zero_hundred: "".concat(_class.N.number_zero_hundred, "%"),
|
|
52
|
+
string: String.raw(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["(\"([^\n\r\f\\\"]|\\\n|\r\n|\r|\f|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*\")|('([^\n\r\f\\']|\\\n|\r\n|\r|\f|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*')"], ["(\\\"([^\\n\\r\\f\\\\\"]|\\\\\\n|\\r\\n|\\r|\\f|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*\\\")|(\\'([^\\n\\r\\f\\\\']|\\\\\\n|\\r\\n|\\r|\\f|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*\\')"]))),
|
|
53
|
+
time: "".concat(_class.N.number, "(s|ms)"),
|
|
54
|
+
url: "url\\(.*?\\)",
|
|
55
|
+
z_index: "[+-]?[0-9]{1,7}"
|
|
56
|
+
};
|
|
57
|
+
/*
|
|
58
|
+
* Atomic (i.e. not dependant on other regular expressions) sub RegEx segments
|
|
59
|
+
*/
|
|
60
|
+
CssProp.A = {
|
|
61
|
+
absolute_size: "xx-small|x-small|small|medium|large|x-large|xx-large",
|
|
62
|
+
attachment: "scroll|fixed|local",
|
|
63
|
+
bg_origin: "border-box|padding-box|content-box",
|
|
64
|
+
border_style: "none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset",
|
|
65
|
+
box: "border-box|padding-box|content-box",
|
|
66
|
+
display_inside: "auto|block|table|flex|grid",
|
|
67
|
+
display_outside: "block-level|inline-level|none|table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption",
|
|
68
|
+
ending_shape: "circle|ellipse",
|
|
69
|
+
generic_family: "serif|sans-serif|cursive|fantasy|monospace",
|
|
70
|
+
generic_voice: "male|female|child",
|
|
71
|
+
relative_size: "smaller|larger",
|
|
72
|
+
repeat_style: "repeat-x|repeat-y|((?:repeat|space|round|no-repeat)(?:\\s*(?:repeat|space|round|no-repeat))?)",
|
|
73
|
+
side_or_corner: "(left|right)?\\s*(top|bottom)?",
|
|
74
|
+
single_animation_direction: "normal|reverse|alternate|alternate-reverse",
|
|
75
|
+
single_animation_fill_mode: "none|forwards|backwards|both",
|
|
76
|
+
single_animation_play_state: "running|paused"
|
|
77
|
+
};
|
|
78
|
+
/*
|
|
79
|
+
* Color definition sub expressions
|
|
80
|
+
*/
|
|
81
|
+
CssProp._COLOR = {
|
|
82
|
+
hex: "\\#(0x)?[0-9a-f]+",
|
|
83
|
+
name: "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|transparent|violet|wheat|white|whitesmoke|yellow|yellowgreen",
|
|
84
|
+
rgb: String.raw(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["rgb(s*(d{1,3})s*,s*(d{1,3})s*,s*(d{1,3})s*)"], ["rgb\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*\\)"]))),
|
|
85
|
+
rgba: String.raw(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["rgba(s*(d{1,3})s*,s*(d{1,3})s*,s*(d{1,3})s*,s*(", "|", "|", ")s*)"], ["rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(", "|", "|", ")\\s*\\)"])), _class.N.integer_zero_ff, _class.N.number_zero_one, _class.B.percentage_zero_hundred)
|
|
86
|
+
};
|
|
87
|
+
/*
|
|
88
|
+
* Compound (i.e. dependant on other (sub) regular expressions) sub RegEx segments
|
|
89
|
+
*/
|
|
90
|
+
CssProp._C = {
|
|
91
|
+
alpha: "".concat(_class.N.integer_zero_ff, "|").concat(_class.N.number_zero_one, "|").concat(_class.B.percentage_zero_hundred),
|
|
92
|
+
alphavalue: _class.N.number_zero_one,
|
|
93
|
+
bg_position: "((".concat(_class.B.len_or_perc, "|left|center|right|top|bottom)\\s*){1,4}"),
|
|
94
|
+
bg_size: "(".concat(_class.B.length_pos, "|").concat(_class.B.percentage, "|auto){1,2}|cover|contain"),
|
|
95
|
+
border_width: "thin|medium|thick|".concat(_class.B.length),
|
|
96
|
+
bottom: "".concat(_class.B.length, "|auto"),
|
|
97
|
+
color: "".concat(_class._COLOR.hex, "|").concat(_class._COLOR.rgb, "|").concat(_class._COLOR.rgba, "|").concat(_class._COLOR.name),
|
|
98
|
+
color_stop_length: "(".concat(_class.B.len_or_perc, "\\s*){1,2}"),
|
|
99
|
+
linear_color_hint: "".concat(_class.B.len_or_perc),
|
|
100
|
+
family_name: "".concat(_class.B.string, "|(").concat(_class.B.ident, "\\s*)+"),
|
|
101
|
+
image_decl: _class.B.url,
|
|
102
|
+
left: "".concat(_class.B.length, "|auto"),
|
|
103
|
+
loose_quotable_words: "(".concat(_class.B.ident, ")+"),
|
|
104
|
+
margin_width: "".concat(_class.B.len_or_perc, "|auto"),
|
|
105
|
+
padding_width: "".concat(_class.B.length_pos, "|").concat(_class.B.percentage_pos),
|
|
106
|
+
page_url: _class.B.url,
|
|
107
|
+
position: "((".concat(_class.B.len_or_perc, "|left|center|right|top|bottom)\\s*){1,4}"),
|
|
108
|
+
right: "".concat(_class.B.length, "|auto"),
|
|
109
|
+
shadow: '',
|
|
110
|
+
size: "closest-side|farthest-side|closest-corner|farthest-corner|".concat(_class.B.length, "|(").concat(_class.B.len_or_perc, ")\\s+(").concat(_class.B.len_or_perc, ")"),
|
|
111
|
+
top: "".concat(_class.B.length, "|auto")
|
|
112
|
+
};
|
|
113
|
+
CssProp._C1 = {
|
|
114
|
+
image_list: "image\\(\\s*(".concat(_class.B.url, ")*\\s*(").concat(_class.B.url, "|").concat(_class._C.color, ")\\s*\\)"),
|
|
115
|
+
linear_color_stop: "(".concat(_class._C.color, ")(\\s*").concat(_class._C.color_stop_length, ")?"),
|
|
116
|
+
// eslint-disable-next-line no-useless-escape
|
|
117
|
+
shadow: "((".concat(_class._C.color, ")\\s+((").concat(_class.B.length, ")\\s*){2,4}(s+inset)?)|((inset\\s+)?((").concat(_class.B.length, ")\\s*){2,4}\\s*(").concat(_class._C.color, ")?)")
|
|
118
|
+
};
|
|
119
|
+
CssProp._C2 = {
|
|
120
|
+
color_stop_list: "((".concat(_class._C1.linear_color_stop, ")(\\s*(").concat(_class._C.linear_color_hint, "))?\\s*,\\s*)+(").concat(_class._C1.linear_color_stop, ")"),
|
|
121
|
+
shape: "rect\\(\\s*(".concat(_class._C.top, ")\\s*,\\s*(").concat(_class._C.right, ")\\s*,\\s*(").concat(_class._C.bottom, ")\\s*,\\s*(").concat(_class._C.left, ")\\s*\\)")
|
|
122
|
+
};
|
|
123
|
+
CssProp._C3 = {
|
|
124
|
+
linear_gradient: "linear-gradient\\((((".concat(_class.B.angle, ")|to\\s+(").concat(_class.A.side_or_corner, "))\\s*,\\s*)?\\s*(").concat(_class._C2.color_stop_list, ")\\s*\\)"),
|
|
125
|
+
radial_gradient: "radial-gradient\\(((((".concat(_class.A.ending_shape, ")|(").concat(_class._C.size, "))\\s*)*\\s*(at\\s+").concat(_class._C.position, ")?\\s*,\\s*)?\\s*(").concat(_class._C2.color_stop_list, ")\\s*\\)")
|
|
126
|
+
};
|
|
127
|
+
CssProp._C4 = {
|
|
128
|
+
image: "".concat(_class.B.url, "|").concat(_class._C3.linear_gradient, "|").concat(_class._C3.radial_gradient, "|").concat(_class._C1.image_list),
|
|
129
|
+
bg_image: "(".concat(_class.B.url, "|").concat(_class._C3.linear_gradient, "|").concat(_class._C3.radial_gradient, "|").concat(_class._C1.image_list, ")|none")
|
|
130
|
+
};
|
|
131
|
+
CssProp.C = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _class._C), _class._C1), _class._C2), _class._C3), _class._C4);
|
|
132
|
+
/*
|
|
133
|
+
* Property value regular expressions not dependant on other sub expressions
|
|
134
|
+
*/
|
|
135
|
+
CssProp.AP = {
|
|
136
|
+
border_collapse: "collapse|separate",
|
|
137
|
+
box: "normal|none|contents",
|
|
138
|
+
box_sizing: "content-box|padding-box|border-box",
|
|
139
|
+
caption_side: "top|bottom",
|
|
140
|
+
clear: "none|left|right|both",
|
|
141
|
+
direction: "ltr|rtl",
|
|
142
|
+
empty_cells: "show|hide",
|
|
143
|
+
float: "left|right|none",
|
|
144
|
+
font_stretch: "normal|wider|narrower|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded",
|
|
145
|
+
font_style: "normal|italic|oblique",
|
|
146
|
+
font_variant: "normal|small-caps",
|
|
147
|
+
font_weight: "normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900",
|
|
148
|
+
list_style_position: "inside|outside",
|
|
149
|
+
list_style_type: "disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-latin|upper-latin|armenian|georgian|lower-alpha|upper-alpha|none",
|
|
150
|
+
overflow: "visible|hidden|scroll|auto",
|
|
151
|
+
overflow_wrap: "normal|break-word",
|
|
152
|
+
overflow_x: "visible|hidden|scroll|auto|no-display|no-content",
|
|
153
|
+
page_break_after: "auto|always|avoid|left|right",
|
|
154
|
+
page_break_before: "auto|always|avoid|left|right",
|
|
155
|
+
page_break_inside: "avoid|auto",
|
|
156
|
+
position: "static|relative|absolute",
|
|
157
|
+
resize: "none|both|horizontal|vertical",
|
|
158
|
+
speak: "normal|none|spell-out",
|
|
159
|
+
speak_header: "once|always",
|
|
160
|
+
speak_numeral: "digits|continuous",
|
|
161
|
+
speak_punctuation: "code|none",
|
|
162
|
+
table_layout: "auto|fixed",
|
|
163
|
+
text_align: "left|right|center|justify",
|
|
164
|
+
text_decoration: "none|((underline|overline|line-through|blink)\\s*)+",
|
|
165
|
+
text_transform: "capitalize|uppercase|lowercase|none",
|
|
166
|
+
text_wrap: "normal|unrestricted|none|suppress",
|
|
167
|
+
unicode_bidi: "normal|embed|bidi-override",
|
|
168
|
+
visibility: "visible|hidden|collapse",
|
|
169
|
+
white_space: "normal|pre|nowrap|pre-wrap|pre-line",
|
|
170
|
+
word_break: "normal|keep-all|break-all"
|
|
171
|
+
};
|
|
172
|
+
/*
|
|
173
|
+
* Compound propertiy value regular expressions (i.e. dependant on other sub expressions)
|
|
174
|
+
*/
|
|
175
|
+
CssProp._CP = {
|
|
176
|
+
background_attachment: "".concat(_class.A.attachment, "(,\\s*").concat(_class.A.attachment, ")*"),
|
|
177
|
+
background_color: _class.C.color,
|
|
178
|
+
background_origin: "".concat(_class.A.box, "(,\\s*").concat(_class.A.box, ")*"),
|
|
179
|
+
background_repeat: "".concat(_class.A.repeat_style, "(,\\s*").concat(_class.A.repeat_style, ")*"),
|
|
180
|
+
border: "((".concat(_class.C.border_width, "|").concat(_class.A.border_style, "|").concat(_class.C.color, ")\\s*){1,3}"),
|
|
181
|
+
border_radius: "((".concat(_class.B.len_or_perc, ")\\s*){1,4}(\\/\\s*((").concat(_class.B.len_or_perc, ")\\s*){1,4})?"),
|
|
182
|
+
border_spacing: "".concat(_class.B.length, "\\s*(").concat(_class.B.length, ")?"),
|
|
183
|
+
border_top_color: _class.C.color,
|
|
184
|
+
border_top_style: _class.A.border_style,
|
|
185
|
+
border_width: "((".concat(_class.C.border_width, ")\\s*){1,4}"),
|
|
186
|
+
color: _class.C.color,
|
|
187
|
+
cursor: "(".concat(_class.B.url, "(\\s*,\\s*)?)*(auto|crosshair|default|pointer|move|e-resize|ne-resize|nw-resize|n-resize|se-resize|sw-resize|s-resize|w-resize|text|wait|help|progress|all-scroll|col-resize|hand|no-drop|not-allowed|row-resize|vertical-text)"),
|
|
188
|
+
display: "inline|block|list-item|run-in|inline-list-item|inline-block|table|inline-table|table-cell|table-caption|flex|inline-flex|grid|inline-grid|".concat(_class.A.display_inside, "|").concat(_class.A.display_outside, "|inherit|inline-box|inline-stack"),
|
|
189
|
+
display_outside: _class.A.display_outside,
|
|
190
|
+
elevation: "".concat(_class.B.angle, "|below|level|above|higher|lower"),
|
|
191
|
+
font_family: "(".concat(_class.C.family_name, "|").concat(_class.A.generic_family, ")(,\\s*(").concat(_class.C.family_name, "|").concat(_class.A.generic_family, "))*"),
|
|
192
|
+
height: "".concat(_class.B.length, "|").concat(_class.B.percentage, "|auto"),
|
|
193
|
+
letter_spacing: "normal|".concat(_class.B.length),
|
|
194
|
+
list_style_image: "".concat(_class.C.image, "|none"),
|
|
195
|
+
margin_right: _class.C.margin_width,
|
|
196
|
+
max_height: "".concat(_class.B.length_pos, "|").concat(_class.B.percentage_pos, "|none|auto"),
|
|
197
|
+
min_height: "".concat(_class.B.length_pos, "|").concat(_class.B.percentage_pos, "|auto"),
|
|
198
|
+
opacity: _class.C.alphavalue,
|
|
199
|
+
outline_color: "".concat(_class.C.color, "|invert"),
|
|
200
|
+
outline_width: _class.C.border_width,
|
|
201
|
+
padding: "((".concat(_class.C.padding_width, ")\\s*){1,4}"),
|
|
202
|
+
padding_top: _class.C.padding_width,
|
|
203
|
+
pitch_range: _class.N.number,
|
|
204
|
+
right: "".concat(_class.B.length, "|").concat(_class.B.percentage, "|auto"),
|
|
205
|
+
stress: _class.N.number,
|
|
206
|
+
text_indent: "".concat(_class.B.length, "|").concat(_class.B.percentage),
|
|
207
|
+
text_shadow: "none|".concat(_class.C.shadow, "(,\\s*(").concat(_class.C.shadow, "))*"),
|
|
208
|
+
volume: "".concat(_class.N.number_pos, "|").concat(_class.B.percentage_pos, "|silent|x-soft|soft|medium|loud|x-loud"),
|
|
209
|
+
word_wrap: _class.AP.overflow_wrap,
|
|
210
|
+
zoom: "normal|".concat(_class.N.number_pos, "|").concat(_class.B.percentage_pos),
|
|
211
|
+
backface_visibility: _class.AP.visibility,
|
|
212
|
+
background_clip: "".concat(_class.A.box, "(,\\s*(").concat(_class.A.box, "))*"),
|
|
213
|
+
background_position: "".concat(_class.C.bg_position, "(,\\s*(").concat(_class.C.bg_position, "))*"),
|
|
214
|
+
border_bottom_color: _class.C.color,
|
|
215
|
+
border_bottom_style: _class.A.border_style,
|
|
216
|
+
border_color: "((".concat(_class.C.color, ")\\s*){1,4}"),
|
|
217
|
+
border_left_color: _class.C.color,
|
|
218
|
+
border_right_color: _class.C.color,
|
|
219
|
+
border_style: "((".concat(_class.A.border_style, ")\\s*){1,4}"),
|
|
220
|
+
border_top_left_radius: "(".concat(_class.B.length, "|").concat(_class.B.percentage, ")(\\s*(").concat(_class.B.length, "|").concat(_class.B.percentage, "))?"),
|
|
221
|
+
border_top_width: _class.C.border_width,
|
|
222
|
+
box_shadow: "none|".concat(_class.C.shadow, "(,\\s*(").concat(_class.C.shadow, "))*"),
|
|
223
|
+
clip: "".concat(_class.C.shape, "|auto"),
|
|
224
|
+
display_inside: _class.A.display_inside,
|
|
225
|
+
font_size: "".concat(_class.A.absolute_size, "|").concat(_class.A.relative_size, "|").concat(_class.B.length_pos, "|").concat(_class.B.percentage_pos),
|
|
226
|
+
line_height: "normal|".concat(_class.N.number_pos, "|").concat(_class.B.length_pos, "|").concat(_class.B.percentage_pos),
|
|
227
|
+
margin_left: _class.C.margin_width,
|
|
228
|
+
max_width: "".concat(_class.B.length_pos, "|").concat(_class.B.percentage_pos, "|none|auto"),
|
|
229
|
+
outline_style: _class.A.border_style,
|
|
230
|
+
padding_bottom: _class.C.padding_width,
|
|
231
|
+
padding_right: _class.C.padding_width,
|
|
232
|
+
perspective: "none|".concat(_class.B.length),
|
|
233
|
+
richness: _class.N.number,
|
|
234
|
+
text_overflow: "((clip|ellipsis|".concat(_class.B.string, ")\\s*){1,2}"),
|
|
235
|
+
top: "".concat(_class.B.length, "|").concat(_class.B.percentage, "|auto"),
|
|
236
|
+
width: "".concat(_class.B.length_pos, "|").concat(_class.B.percentage_pos, "|auto"),
|
|
237
|
+
z_index: "auto|".concat(_class.B.z_index),
|
|
238
|
+
// Simplified background
|
|
239
|
+
background: "(((".concat(_class.C.bg_position, "\\s*(\\/\\s*").concat(_class.C.bg_size, ")?)|(").concat(_class.A.repeat_style, ")|(").concat(_class.A.attachment, ")|(").concat(_class.A.bg_origin, ")|(").concat(_class.C.bg_image, ")|(").concat(_class.C.color, "))\\s*)+"),
|
|
240
|
+
background_size: "".concat(_class.C.bg_size, "(,\\s*").concat(_class.C.bg_size, ")*"),
|
|
241
|
+
border_bottom_left_radius: "(".concat(_class.B.length, "|").concat(_class.B.percentage, ")(\\s*(").concat(_class.B.length, "|").concat(_class.B.percentage, "))?"),
|
|
242
|
+
border_bottom_width: _class.C.border_width,
|
|
243
|
+
border_left_style: _class.A.border_style,
|
|
244
|
+
border_right_style: _class.A.border_style,
|
|
245
|
+
border_top: "((".concat(_class.C.border_width, "|").concat(_class.A.border_style, "|").concat(_class.C.color, ")\\s*){1,3}"),
|
|
246
|
+
bottom: "".concat(_class.B.len_or_perc, "|auto"),
|
|
247
|
+
list_style: "((".concat(_class.AP.list_style_type, "|").concat(_class.AP.list_style_position, "|").concat(_class.C.image, "|none})\\s*){1,3}"),
|
|
248
|
+
margin_top: _class.C.margin_width,
|
|
249
|
+
outline: "((".concat(_class.C.color, "|invert|").concat(_class.A.border_style, "|").concat(_class.C.border_width, ")\\s*){1,3}"),
|
|
250
|
+
overflow_y: _class.AP.overflow_x,
|
|
251
|
+
pitch: "".concat(_class.B.frequency, "|x-low|low|medium|high|x-high"),
|
|
252
|
+
vertical_align: "baseline|sub|super|top|text-top|middle|bottom|text-bottom|".concat(_class.B.len_or_perc),
|
|
253
|
+
word_spacing: "normal|".concat(_class.B.length),
|
|
254
|
+
background_image: "".concat(_class.C.bg_image, "(,\\s*").concat(_class.C.bg_image, ")*"),
|
|
255
|
+
border_bottom_right_radius: "(".concat(_class.B.length, "|").concat(_class.B.percentage, ")(\\s*(").concat(_class.B.length, "|").concat(_class.B.percentage, "))?"),
|
|
256
|
+
border_left_width: _class.C.border_width,
|
|
257
|
+
border_right_width: _class.C.border_width,
|
|
258
|
+
left: "".concat(_class.B.len_or_perc, "|auto"),
|
|
259
|
+
margin_bottom: _class.C.margin_width,
|
|
260
|
+
pause_after: "".concat(_class.B.time, "|").concat(_class.B.percentage),
|
|
261
|
+
speech_rate: "".concat(_class.N.number, "|x-slow|slow|medium|fast|x-fast|faster|slower"),
|
|
262
|
+
transition_duration: "".concat(_class.B.time, "(,\\s*").concat(_class.B.time, ")*"),
|
|
263
|
+
border_bottom: "((".concat(_class.C.border_width, "|").concat(_class.A.border_style, "|").concat(_class.C.color, ")\\s*){1,3}"),
|
|
264
|
+
border_right: "((".concat(_class.C.border_width, "|").concat(_class.A.border_style, "|").concat(_class.C.color, ")\\s*){1,3}"),
|
|
265
|
+
margin: "((".concat(_class.C.margin_width, ")\\s*){1,4}"),
|
|
266
|
+
padding_left: _class.C.padding_width,
|
|
267
|
+
border_left: "((".concat(_class.C.border_width, "|").concat(_class.A.border_style, "|").concat(_class.C.color, ")\\s*){1,3}"),
|
|
268
|
+
quotes: "(".concat(_class.B.string, "\\s*").concat(_class.B.string, ")+|none"),
|
|
269
|
+
border_top_right_radius: "(".concat(_class.B.length, "|").concat(_class.B.percentage, ")(\\s*(").concat(_class.B.length, "|").concat(_class.B.percentage, "))?"),
|
|
270
|
+
min_width: "".concat(_class.B.length_pos, "|").concat(_class.B.percentage_pos, "|auto")
|
|
271
|
+
};
|
|
272
|
+
CssProp._CP1 = {
|
|
273
|
+
font: "(((((".concat(_class.AP.font_style, "|").concat(_class.AP.font_variant, "|").concat(_class.AP.font_weight, ")\\s*){1,3})?\\s*(").concat(_class._CP.font_size, ")\\s*(\\/\\s*(").concat(_class._CP.line_height, "))?\\s+(").concat(_class._CP.font_family, "))|caption|icon|menu|message-box|small-caption|status-bar)")
|
|
274
|
+
};
|
|
275
|
+
CssProp.CP = _objectSpread(_objectSpread({}, _class._CP), _class._CP1);
|
|
276
|
+
// CSS Property value validation regular expressions for use with sanitize-html
|
|
277
|
+
CssProp.BORDER_COLLAPSE = _class.reg(_class.AP.border_collapse);
|
|
278
|
+
CssProp.BOX = _class.reg(_class.AP.box);
|
|
279
|
+
CssProp.BOX_SIZING = _class.reg(_class.AP.box_sizing);
|
|
280
|
+
CssProp.CAPTION_SIDE = _class.reg(_class.AP.caption_side);
|
|
281
|
+
CssProp.CLEAR = _class.reg(_class.AP.clear);
|
|
282
|
+
CssProp.DIRECTION = _class.reg(_class.AP.direction);
|
|
283
|
+
CssProp.EMPTY_CELLS = _class.reg(_class.AP.empty_cells);
|
|
284
|
+
CssProp.FLOAT = _class.reg(_class.AP.float);
|
|
285
|
+
CssProp.FONT_STRETCH = _class.reg(_class.AP.font_stretch);
|
|
286
|
+
CssProp.FONT_STYLE = _class.reg(_class.AP.font_style);
|
|
287
|
+
CssProp.FONT_VARIANT = _class.reg(_class.AP.font_variant);
|
|
288
|
+
CssProp.FONT_WEIGHT = _class.reg(_class.AP.font_weight);
|
|
289
|
+
CssProp.LIST_STYLE_POSITION = _class.reg(_class.AP.list_style_position);
|
|
290
|
+
CssProp.LIST_STYLE_TYPE = _class.reg(_class.AP.list_style_type);
|
|
291
|
+
CssProp.OVERFLOW = _class.reg(_class.AP.overflow);
|
|
292
|
+
CssProp.OVERFLOW_WRAP = _class.reg(_class.AP.overflow_wrap);
|
|
293
|
+
CssProp.OVERFLOW_X = _class.reg(_class.AP.overflow_x);
|
|
294
|
+
CssProp.PAGE_BREAK_AFTER = _class.reg(_class.AP.page_break_after);
|
|
295
|
+
CssProp.PAGE_BREAK_BEFORE = _class.reg(_class.AP.page_break_before);
|
|
296
|
+
CssProp.PAGE_BREAK_INSIDE = _class.reg(_class.AP.page_break_inside);
|
|
297
|
+
CssProp.POSITION = _class.reg(_class.AP.position);
|
|
298
|
+
CssProp.RESIZE = _class.reg(_class.AP.resize);
|
|
299
|
+
CssProp.SPEAK = _class.reg(_class.AP.speak);
|
|
300
|
+
CssProp.SPEAK_HEADER = _class.reg(_class.AP.speak_header);
|
|
301
|
+
CssProp.SPEAK_NUMERAL = _class.reg(_class.AP.speak_numeral);
|
|
302
|
+
CssProp.SPEAK_PUNCTUATION = _class.reg(_class.AP.speak_punctuation);
|
|
303
|
+
CssProp.TABLE_LAYOUT = _class.reg(_class.AP.table_layout);
|
|
304
|
+
CssProp.TEXT_ALIGN = _class.reg(_class.AP.text_align);
|
|
305
|
+
CssProp.TEXT_DECORATION = _class.reg(_class.AP.text_decoration);
|
|
306
|
+
CssProp.TEXT_TRANSFORM = _class.reg(_class.AP.text_transform);
|
|
307
|
+
CssProp.TEXT_WRAP = _class.reg(_class.AP.text_wrap);
|
|
308
|
+
CssProp.UNICODE_BIDI = _class.reg(_class.AP.unicode_bidi);
|
|
309
|
+
CssProp.VISIBILITY = _class.reg(_class.AP.visibility);
|
|
310
|
+
CssProp.WHITE_SPACE = _class.reg(_class.AP.white_space);
|
|
311
|
+
CssProp.WORD_BREAK = _class.reg(_class.AP.word_break);
|
|
312
|
+
CssProp.BACKGROUND_ATTACHMENT = _class.reg(_class.CP.background_attachment);
|
|
313
|
+
CssProp.BACKGROUND_COLOR = _class.reg(_class.CP.background_color);
|
|
314
|
+
CssProp.BACKGROUND_ORIGIN = _class.reg(_class.CP.background_origin);
|
|
315
|
+
CssProp.BACKGROUND_REPEAT = _class.reg(_class.CP.background_repeat);
|
|
316
|
+
CssProp.BORDER = _class.reg(_class.CP.border);
|
|
317
|
+
CssProp.BORDER_RADIUS = _class.reg(_class.CP.border_radius);
|
|
318
|
+
CssProp.BORDER_SPACING = _class.reg(_class.CP.border_spacing);
|
|
319
|
+
CssProp.BORDER_TOP_COLOR = _class.reg(_class.CP.border_top_color);
|
|
320
|
+
CssProp.BORDER_TOP_STYLE = _class.reg(_class.CP.border_top_style);
|
|
321
|
+
CssProp.BORDER_WIDTH = _class.reg(_class.CP.border_width);
|
|
322
|
+
CssProp.COLOR = _class.reg(_class.CP.color);
|
|
323
|
+
CssProp.CURSOR = _class.reg(_class.CP.cursor);
|
|
324
|
+
CssProp.DISPLAY = _class.reg(_class.CP.display);
|
|
325
|
+
CssProp.DISPLAY_OUTSIDE = _class.reg(_class.CP.display_outside);
|
|
326
|
+
CssProp.ELEVATION = _class.reg(_class.CP.elevation);
|
|
327
|
+
CssProp.FONT_FAMILY = _class.reg(_class.CP.font_family);
|
|
328
|
+
CssProp.HEIGHT = _class.reg(_class.CP.height);
|
|
329
|
+
CssProp.LETTER_SPACING = _class.reg(_class.CP.letter_spacing);
|
|
330
|
+
CssProp.LIST_STYLE_IMAGE = _class.reg(_class.CP.list_style_image);
|
|
331
|
+
CssProp.MARGIN_RIGHT = _class.reg(_class.CP.margin_right);
|
|
332
|
+
CssProp.MAX_HEIGHT = _class.reg(_class.CP.max_height);
|
|
333
|
+
CssProp.MIN_HEIGHT = _class.reg(_class.CP.min_height);
|
|
334
|
+
CssProp.OPACITY = _class.reg(_class.CP.opacity);
|
|
335
|
+
CssProp.OUTLINE_COLOR = _class.reg(_class.CP.outline_color);
|
|
336
|
+
CssProp.OUTLINE_WIDTH = _class.reg(_class.CP.outline_width);
|
|
337
|
+
CssProp.PADDING = _class.reg(_class.CP.padding);
|
|
338
|
+
CssProp.PADDING_TOP = _class.reg(_class.CP.padding_top);
|
|
339
|
+
CssProp.PITCH_RANGE = _class.reg(_class.CP.pitch_range);
|
|
340
|
+
CssProp.RIGHT = _class.reg(_class.CP.right);
|
|
341
|
+
CssProp.STRESS = _class.reg(_class.CP.stress);
|
|
342
|
+
CssProp.TEXT_INDENT = _class.reg(_class.CP.text_indent);
|
|
343
|
+
CssProp.TEXT_SHADOW = _class.reg(_class.CP.text_shadow);
|
|
344
|
+
CssProp.VOLUME = _class.reg(_class.CP.volume);
|
|
345
|
+
CssProp.WORD_WRAP = _class.reg(_class.CP.word_wrap);
|
|
346
|
+
CssProp.ZOOM = _class.reg(_class.CP.zoom);
|
|
347
|
+
CssProp.BACKFACE_VISIBILITY = _class.reg(_class.CP.backface_visibility);
|
|
348
|
+
CssProp.BACKGROUND_CLIP = _class.reg(_class.CP.background_clip);
|
|
349
|
+
CssProp.BACKGROUND_POSITION = _class.reg(_class.CP.background_position);
|
|
350
|
+
CssProp.BORDER_BOTTOM_COLOR = _class.reg(_class.CP.border_bottom_color);
|
|
351
|
+
CssProp.BORDER_BOTTOM_STYLE = _class.reg(_class.CP.border_bottom_style);
|
|
352
|
+
CssProp.BORDER_COLOR = _class.reg(_class.CP.border_color);
|
|
353
|
+
CssProp.BORDER_LEFT_COLOR = _class.reg(_class.CP.border_left_color);
|
|
354
|
+
CssProp.BORDER_RIGHT_COLOR = _class.reg(_class.CP.border_right_color);
|
|
355
|
+
CssProp.BORDER_STYLE = _class.reg(_class.CP.border_style);
|
|
356
|
+
CssProp.BORDER_TOP_LEFT_RADIUS = _class.reg(_class.CP.border_top_left_radius);
|
|
357
|
+
CssProp.BORDER_TOP_WIDTH = _class.reg(_class.CP.border_top_width);
|
|
358
|
+
CssProp.BOX_SHADOW = _class.reg(_class.CP.box_shadow);
|
|
359
|
+
CssProp.CLIP = _class.reg(_class.CP.clip);
|
|
360
|
+
CssProp.DISPLAY_INSIDE = _class.reg(_class.CP.display_inside);
|
|
361
|
+
CssProp.FONT_SIZE = _class.reg(_class.CP.font_size);
|
|
362
|
+
CssProp.LINE_HEIGHT = _class.reg(_class.CP.line_height);
|
|
363
|
+
CssProp.MARGIN_LEFT = _class.reg(_class.CP.margin_left);
|
|
364
|
+
CssProp.MAX_WIDTH = _class.reg(_class.CP.max_width);
|
|
365
|
+
CssProp.OUTLINE_STYLE = _class.reg(_class.CP.outline_style);
|
|
366
|
+
CssProp.PADDING_BOTTOM = _class.reg(_class.CP.padding_bottom);
|
|
367
|
+
CssProp.PADDING_RIGHT = _class.reg(_class.CP.padding_right);
|
|
368
|
+
CssProp.PERSPECTIVE = _class.reg(_class.CP.perspective);
|
|
369
|
+
CssProp.RICHNESS = _class.reg(_class.CP.richness);
|
|
370
|
+
CssProp.TEXT_OVERFLOW = _class.reg(_class.CP.text_overflow);
|
|
371
|
+
CssProp.TOP = _class.reg(_class.CP.top);
|
|
372
|
+
CssProp.WIDTH = _class.reg(_class.CP.width);
|
|
373
|
+
CssProp.Z_INDEX = _class.reg(_class.CP.z_index);
|
|
374
|
+
CssProp.BACKGROUND = _class.reg(_class.CP.background);
|
|
375
|
+
CssProp.BACKGROUND_SIZE = _class.reg(_class.CP.background_size);
|
|
376
|
+
CssProp.BORDER_BOTTOM_LEFT_RADIUS = _class.reg(_class.CP.border_bottom_left_radius);
|
|
377
|
+
CssProp.BORDER_BOTTOM_WIDTH = _class.reg(_class.CP.border_bottom_width);
|
|
378
|
+
CssProp.BORDER_LEFT_STYLE = _class.reg(_class.CP.border_left_style);
|
|
379
|
+
CssProp.BORDER_RIGHT_STYLE = _class.reg(_class.CP.border_right_style);
|
|
380
|
+
CssProp.BORDER_TOP = _class.reg(_class.CP.border_top);
|
|
381
|
+
CssProp.BOTTOM = _class.reg(_class.CP.bottom);
|
|
382
|
+
CssProp.LIST_STYLE = _class.reg(_class.CP.list_style);
|
|
383
|
+
CssProp.MARGIN_TOP = _class.reg(_class.CP.margin_top);
|
|
384
|
+
CssProp.OUTLINE = _class.reg(_class.CP.outline);
|
|
385
|
+
CssProp.OVERFLOW_Y = _class.reg(_class.CP.overflow_y);
|
|
386
|
+
CssProp.PITCH = _class.reg(_class.CP.pitch);
|
|
387
|
+
CssProp.VERTICAL_ALIGN = _class.reg(_class.CP.vertical_align);
|
|
388
|
+
CssProp.WORD_SPACING = _class.reg(_class.CP.word_spacing);
|
|
389
|
+
CssProp.BACKGROUND_IMAGE = _class.reg(_class.CP.background_image);
|
|
390
|
+
CssProp.BORDER_BOTTOM_RIGHT_RADIUS = _class.reg(_class.CP.border_bottom_right_radius);
|
|
391
|
+
CssProp.BORDER_LEFT_WIDTH = _class.reg(_class.CP.border_left_width);
|
|
392
|
+
CssProp.BORDER_RIGHT_WIDTH = _class.reg(_class.CP.border_right_width);
|
|
393
|
+
CssProp.LEFT = _class.reg(_class.CP.left);
|
|
394
|
+
CssProp.MARGIN_BOTTOM = _class.reg(_class.CP.margin_bottom);
|
|
395
|
+
CssProp.PAUSE_AFTER = _class.reg(_class.CP.pause_after);
|
|
396
|
+
CssProp.SPEECH_RATE = _class.reg(_class.CP.speech_rate);
|
|
397
|
+
CssProp.TRANSITION_DURATION = _class.reg(_class.CP.transition_duration);
|
|
398
|
+
CssProp.BORDER_BOTTOM = _class.reg(_class.CP.border_bottom);
|
|
399
|
+
CssProp.BORDER_RIGHT = _class.reg(_class.CP.border_right);
|
|
400
|
+
CssProp.MARGIN = _class.reg(_class.CP.margin);
|
|
401
|
+
CssProp.PADDING_LEFT = _class.reg(_class.CP.padding_left);
|
|
402
|
+
CssProp.BORDER_LEFT = _class.reg(_class.CP.border_left);
|
|
403
|
+
CssProp.FONT = _class.reg(_class.CP.font);
|
|
404
|
+
CssProp.QUOTES = _class.reg(_class.CP.quotes);
|
|
405
|
+
CssProp.BORDER_TOP_RIGHT_RADIUS = _class.reg(_class.CP.border_top_right_radius);
|
|
406
|
+
CssProp.MIN_WIDTH = _class.reg(_class.CP.min_width);
|
|
407
|
+
/**
|
|
408
|
+
* A class to sanitize HTML strings.
|
|
409
|
+
*/
|
|
410
|
+
export var Sanitizer = /*#__PURE__*/function () {
|
|
411
|
+
function Sanitizer() {
|
|
412
|
+
_classCallCheck(this, Sanitizer);
|
|
413
|
+
this._options = {
|
|
414
|
+
// HTML tags that are allowed to be used. Tags were extracted from Google Caja
|
|
415
|
+
allowedTags: ['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blockquote', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'colspan', 'command', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'i',
|
|
416
|
+
// 'iframe' is allowed by Google Caja, but disallowed by default by sanitize-html
|
|
417
|
+
// , 'iframe'
|
|
418
|
+
'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'map', 'mark', 'menu', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'pre', 'progress', 'q', 'rowspan', 's', 'samp', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'],
|
|
419
|
+
// Attributes that HTML tags are allowed to have, extracted from Google Caja.
|
|
420
|
+
// See https://github.com/jupyterlab/jupyterlab/issues/1812#issuecomment-285848435
|
|
421
|
+
allowedAttributes: {
|
|
422
|
+
'*': ['class', 'dir', 'draggable', 'hidden', 'id', 'inert', 'itemprop', 'itemref', 'itemscope', 'lang', 'spellcheck', 'style', 'title', 'translate'],
|
|
423
|
+
// 'rel' and 'target' were *not* allowed by Google Caja
|
|
424
|
+
a: ['accesskey', 'coords', 'href', 'hreflang', 'name', 'rel', 'shape', 'tabindex', 'target', 'type'],
|
|
425
|
+
area: ['accesskey', 'alt', 'coords', 'href', 'nohref', 'shape', 'tabindex'],
|
|
426
|
+
// 'autoplay' was *not* allowed by Google Caja
|
|
427
|
+
audio: ['autoplay', 'controls', 'loop', 'mediagroup', 'muted', 'preload', 'src'],
|
|
428
|
+
bdo: ['dir'],
|
|
429
|
+
blockquote: ['cite'],
|
|
430
|
+
br: ['clear'],
|
|
431
|
+
button: ['accesskey', 'data-commandlinker-args', 'data-commandlinker-command', 'disabled', 'name', 'tabindex', 'type', 'value'],
|
|
432
|
+
canvas: ['height', 'width'],
|
|
433
|
+
caption: ['align'],
|
|
434
|
+
col: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
|
|
435
|
+
colgroup: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
|
|
436
|
+
command: ['checked', 'command', 'disabled', 'icon', 'label', 'radiogroup', 'type'],
|
|
437
|
+
data: ['value'],
|
|
438
|
+
del: ['cite', 'datetime'],
|
|
439
|
+
details: ['open'],
|
|
440
|
+
dir: ['compact'],
|
|
441
|
+
div: ['align'],
|
|
442
|
+
dl: ['compact'],
|
|
443
|
+
fieldset: ['disabled'],
|
|
444
|
+
font: ['color', 'face', 'size'],
|
|
445
|
+
form: ['accept', 'autocomplete', 'enctype', 'method', 'name', 'novalidate'],
|
|
446
|
+
h1: ['align'],
|
|
447
|
+
h2: ['align'],
|
|
448
|
+
h3: ['align'],
|
|
449
|
+
h4: ['align'],
|
|
450
|
+
h5: ['align'],
|
|
451
|
+
h6: ['align'],
|
|
452
|
+
hr: ['align', 'noshade', 'size', 'width'],
|
|
453
|
+
iframe: ['align', 'frameborder', 'height', 'marginheight', 'marginwidth', 'width'],
|
|
454
|
+
img: ['align', 'alt', 'border', 'height', 'hspace', 'ismap', 'name', 'src', 'usemap', 'vspace', 'width'],
|
|
455
|
+
input: ['accept', 'accesskey', 'align', 'alt', 'autocomplete', 'checked', 'disabled', 'inputmode', 'ismap', 'list', 'max', 'maxlength', 'min', 'multiple', 'name', 'placeholder', 'readonly', 'required', 'size', 'src', 'step', 'tabindex', 'type', 'usemap', 'value'],
|
|
456
|
+
ins: ['cite', 'datetime'],
|
|
457
|
+
label: ['accesskey', 'for'],
|
|
458
|
+
legend: ['accesskey', 'align'],
|
|
459
|
+
li: ['type', 'value'],
|
|
460
|
+
map: ['name'],
|
|
461
|
+
menu: ['compact', 'label', 'type'],
|
|
462
|
+
meter: ['high', 'low', 'max', 'min', 'value'],
|
|
463
|
+
ol: ['compact', 'reversed', 'start', 'type'],
|
|
464
|
+
optgroup: ['disabled', 'label'],
|
|
465
|
+
option: ['disabled', 'label', 'selected', 'value'],
|
|
466
|
+
output: ['for', 'name'],
|
|
467
|
+
p: ['align'],
|
|
468
|
+
pre: ['width'],
|
|
469
|
+
progress: ['max', 'min', 'value'],
|
|
470
|
+
q: ['cite'],
|
|
471
|
+
select: ['autocomplete', 'disabled', 'multiple', 'name', 'required', 'size', 'tabindex'],
|
|
472
|
+
source: ['type'],
|
|
473
|
+
table: ['align', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'frame', 'rules', 'summary', 'width'],
|
|
474
|
+
tbody: ['align', 'char', 'charoff', 'valign'],
|
|
475
|
+
td: ['abbr', 'align', 'axis', 'bgcolor', 'char', 'charoff', 'colspan', 'headers', 'height', 'nowrap', 'rowspan', 'scope', 'valign', 'width'],
|
|
476
|
+
textarea: ['accesskey', 'autocomplete', 'cols', 'disabled', 'inputmode', 'name', 'placeholder', 'readonly', 'required', 'rows', 'tabindex', 'wrap'],
|
|
477
|
+
tfoot: ['align', 'char', 'charoff', 'valign'],
|
|
478
|
+
th: ['abbr', 'align', 'axis', 'bgcolor', 'char', 'charoff', 'colspan', 'headers', 'height', 'nowrap', 'rowspan', 'scope', 'valign', 'width'],
|
|
479
|
+
thead: ['align', 'char', 'charoff', 'valign'],
|
|
480
|
+
tr: ['align', 'bgcolor', 'char', 'charoff', 'valign'],
|
|
481
|
+
track: ['default', 'kind', 'label', 'srclang'],
|
|
482
|
+
ul: ['compact', 'type'],
|
|
483
|
+
video: ['autoplay', 'controls', 'height', 'loop', 'mediagroup', 'muted', 'poster', 'preload', 'src', 'width']
|
|
484
|
+
},
|
|
485
|
+
// Inline CSS styles that HTML tags may have (and their allowed values)
|
|
486
|
+
allowedStyles: {
|
|
487
|
+
// To simplify the data, all styles are allowed on all tags that allow the style attribute
|
|
488
|
+
'*': {
|
|
489
|
+
'backface-visibility': [CssProp.BACKFACE_VISIBILITY],
|
|
490
|
+
background: [CssProp.BACKGROUND],
|
|
491
|
+
'background-attachment': [CssProp.BACKGROUND_ATTACHMENT],
|
|
492
|
+
'background-clip': [CssProp.BACKGROUND_CLIP],
|
|
493
|
+
'background-color': [CssProp.BACKGROUND_COLOR],
|
|
494
|
+
'background-image': [CssProp.BACKGROUND_IMAGE],
|
|
495
|
+
'background-origin': [CssProp.BACKGROUND_ORIGIN],
|
|
496
|
+
'background-position': [CssProp.BACKGROUND_POSITION],
|
|
497
|
+
'background-repeat': [CssProp.BACKGROUND_REPEAT],
|
|
498
|
+
'background-size': [CssProp.BACKGROUND_SIZE],
|
|
499
|
+
border: [CssProp.BORDER],
|
|
500
|
+
'border-bottom': [CssProp.BORDER_BOTTOM],
|
|
501
|
+
'border-bottom-color': [CssProp.BORDER_BOTTOM_COLOR],
|
|
502
|
+
'border-bottom-left-radius': [CssProp.BORDER_BOTTOM_LEFT_RADIUS],
|
|
503
|
+
'border-bottom-right-radius': [CssProp.BORDER_BOTTOM_RIGHT_RADIUS],
|
|
504
|
+
'border-bottom-style': [CssProp.BORDER_BOTTOM_STYLE],
|
|
505
|
+
'border-bottom-width': [CssProp.BORDER_BOTTOM_WIDTH],
|
|
506
|
+
'border-collapse': [CssProp.BORDER_COLLAPSE],
|
|
507
|
+
'border-color': [CssProp.BORDER_COLOR],
|
|
508
|
+
'border-left': [CssProp.BORDER_LEFT],
|
|
509
|
+
'border-left-color': [CssProp.BORDER_LEFT_COLOR],
|
|
510
|
+
'border-left-style': [CssProp.BORDER_LEFT_STYLE],
|
|
511
|
+
'border-left-width': [CssProp.BORDER_LEFT_WIDTH],
|
|
512
|
+
'border-radius': [CssProp.BORDER_RADIUS],
|
|
513
|
+
'border-right': [CssProp.BORDER_RIGHT],
|
|
514
|
+
'border-right-color': [CssProp.BORDER_RIGHT_COLOR],
|
|
515
|
+
'border-right-style': [CssProp.BORDER_RIGHT_STYLE],
|
|
516
|
+
'border-right-width': [CssProp.BORDER_RIGHT_WIDTH],
|
|
517
|
+
'border-spacing': [CssProp.BORDER_SPACING],
|
|
518
|
+
'border-style': [CssProp.BORDER_STYLE],
|
|
519
|
+
'border-top': [CssProp.BORDER_TOP],
|
|
520
|
+
'border-top-color': [CssProp.BORDER_TOP_COLOR],
|
|
521
|
+
'border-top-left-radius': [CssProp.BORDER_TOP_LEFT_RADIUS],
|
|
522
|
+
'border-top-right-radius': [CssProp.BORDER_TOP_RIGHT_RADIUS],
|
|
523
|
+
'border-top-style': [CssProp.BORDER_TOP_STYLE],
|
|
524
|
+
'border-top-width': [CssProp.BORDER_TOP_WIDTH],
|
|
525
|
+
'border-width': [CssProp.BORDER_WIDTH],
|
|
526
|
+
bottom: [CssProp.BOTTOM],
|
|
527
|
+
box: [CssProp.BOX],
|
|
528
|
+
'box-shadow': [CssProp.BOX_SHADOW],
|
|
529
|
+
'box-sizing': [CssProp.BOX_SIZING],
|
|
530
|
+
'caption-side': [CssProp.CAPTION_SIDE],
|
|
531
|
+
clear: [CssProp.CLEAR],
|
|
532
|
+
clip: [CssProp.CLIP],
|
|
533
|
+
color: [CssProp.COLOR],
|
|
534
|
+
cursor: [CssProp.CURSOR],
|
|
535
|
+
direction: [CssProp.DIRECTION],
|
|
536
|
+
display: [CssProp.DISPLAY],
|
|
537
|
+
'display-inside': [CssProp.DISPLAY_INSIDE],
|
|
538
|
+
'display-outside': [CssProp.DISPLAY_OUTSIDE],
|
|
539
|
+
elevation: [CssProp.ELEVATION],
|
|
540
|
+
'empty-cells': [CssProp.EMPTY_CELLS],
|
|
541
|
+
float: [CssProp.FLOAT],
|
|
542
|
+
font: [CssProp.FONT],
|
|
543
|
+
'font-family': [CssProp.FONT_FAMILY],
|
|
544
|
+
'font-size': [CssProp.FONT_SIZE],
|
|
545
|
+
'font-stretch': [CssProp.FONT_STRETCH],
|
|
546
|
+
'font-style': [CssProp.FONT_STYLE],
|
|
547
|
+
'font-variant': [CssProp.FONT_VARIANT],
|
|
548
|
+
'font-weight': [CssProp.FONT_WEIGHT],
|
|
549
|
+
height: [CssProp.HEIGHT],
|
|
550
|
+
left: [CssProp.LEFT],
|
|
551
|
+
'letter-spacing': [CssProp.LETTER_SPACING],
|
|
552
|
+
'line-height': [CssProp.LINE_HEIGHT],
|
|
553
|
+
'list-style': [CssProp.LIST_STYLE],
|
|
554
|
+
'list-style-image': [CssProp.LIST_STYLE_IMAGE],
|
|
555
|
+
'list-style-position': [CssProp.LIST_STYLE_POSITION],
|
|
556
|
+
'list-style-type': [CssProp.LIST_STYLE_TYPE],
|
|
557
|
+
margin: [CssProp.MARGIN],
|
|
558
|
+
'margin-bottom': [CssProp.MARGIN_BOTTOM],
|
|
559
|
+
'margin-left': [CssProp.MARGIN_LEFT],
|
|
560
|
+
'margin-right': [CssProp.MARGIN_RIGHT],
|
|
561
|
+
'margin-top': [CssProp.MARGIN_TOP],
|
|
562
|
+
'max-height': [CssProp.MAX_HEIGHT],
|
|
563
|
+
'max-width': [CssProp.MAX_WIDTH],
|
|
564
|
+
'min-height': [CssProp.MIN_HEIGHT],
|
|
565
|
+
'min-width': [CssProp.MIN_WIDTH],
|
|
566
|
+
opacity: [CssProp.OPACITY],
|
|
567
|
+
outline: [CssProp.OUTLINE],
|
|
568
|
+
'outline-color': [CssProp.OUTLINE_COLOR],
|
|
569
|
+
'outline-style': [CssProp.OUTLINE_STYLE],
|
|
570
|
+
'outline-width': [CssProp.OUTLINE_WIDTH],
|
|
571
|
+
overflow: [CssProp.OVERFLOW],
|
|
572
|
+
'overflow-wrap': [CssProp.OVERFLOW_WRAP],
|
|
573
|
+
'overflow-x': [CssProp.OVERFLOW_X],
|
|
574
|
+
'overflow-y': [CssProp.OVERFLOW_Y],
|
|
575
|
+
padding: [CssProp.PADDING],
|
|
576
|
+
'padding-bottom': [CssProp.PADDING_BOTTOM],
|
|
577
|
+
'padding-left': [CssProp.PADDING_LEFT],
|
|
578
|
+
'padding-right': [CssProp.PADDING_RIGHT],
|
|
579
|
+
'padding-top': [CssProp.PADDING_TOP],
|
|
580
|
+
'page-break-after': [CssProp.PAGE_BREAK_AFTER],
|
|
581
|
+
'page-break-before': [CssProp.PAGE_BREAK_BEFORE],
|
|
582
|
+
'page-break-inside': [CssProp.PAGE_BREAK_INSIDE],
|
|
583
|
+
'pause-after': [CssProp.PAUSE_AFTER],
|
|
584
|
+
perspective: [CssProp.PERSPECTIVE],
|
|
585
|
+
pitch: [CssProp.PITCH],
|
|
586
|
+
'pitch-range': [CssProp.PITCH_RANGE],
|
|
587
|
+
position: [CssProp.POSITION],
|
|
588
|
+
quotes: [CssProp.QUOTES],
|
|
589
|
+
resize: [CssProp.RESIZE],
|
|
590
|
+
richness: [CssProp.RICHNESS],
|
|
591
|
+
right: [CssProp.RIGHT],
|
|
592
|
+
speak: [CssProp.SPEAK],
|
|
593
|
+
'speak-header': [CssProp.SPEAK_HEADER],
|
|
594
|
+
'speak-numeral': [CssProp.SPEAK_NUMERAL],
|
|
595
|
+
'speak-punctuation': [CssProp.SPEAK_PUNCTUATION],
|
|
596
|
+
'speech-rate': [CssProp.SPEECH_RATE],
|
|
597
|
+
stress: [CssProp.STRESS],
|
|
598
|
+
'table-layout': [CssProp.TABLE_LAYOUT],
|
|
599
|
+
'text-align': [CssProp.TEXT_ALIGN],
|
|
600
|
+
'text-decoration': [CssProp.TEXT_DECORATION],
|
|
601
|
+
'text-indent': [CssProp.TEXT_INDENT],
|
|
602
|
+
'text-overflow': [CssProp.TEXT_OVERFLOW],
|
|
603
|
+
'text-shadow': [CssProp.TEXT_SHADOW],
|
|
604
|
+
'text-transform': [CssProp.TEXT_TRANSFORM],
|
|
605
|
+
'text-wrap': [CssProp.TEXT_WRAP],
|
|
606
|
+
top: [CssProp.TOP],
|
|
607
|
+
'unicode-bidi': [CssProp.UNICODE_BIDI],
|
|
608
|
+
'vertical-align': [CssProp.VERTICAL_ALIGN],
|
|
609
|
+
visibility: [CssProp.VISIBILITY],
|
|
610
|
+
volume: [CssProp.VOLUME],
|
|
611
|
+
'white-space': [CssProp.WHITE_SPACE],
|
|
612
|
+
width: [CssProp.WIDTH],
|
|
613
|
+
'word-break': [CssProp.WORD_BREAK],
|
|
614
|
+
'word-spacing': [CssProp.WORD_SPACING],
|
|
615
|
+
'word-wrap': [CssProp.WORD_WRAP],
|
|
616
|
+
'z-index': [CssProp.Z_INDEX],
|
|
617
|
+
zoom: [CssProp.ZOOM]
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
transformTags: {
|
|
621
|
+
// Set the "rel" attribute for <a> tags to "nofollow".
|
|
622
|
+
a: _sanitize.simpleTransform('a', {
|
|
623
|
+
rel: 'nofollow'
|
|
624
|
+
}),
|
|
625
|
+
// Set the "disabled" attribute for <input> tags.
|
|
626
|
+
input: _sanitize.simpleTransform('input', {
|
|
627
|
+
disabled: 'disabled'
|
|
628
|
+
})
|
|
629
|
+
},
|
|
630
|
+
allowedSchemesByTag: {
|
|
631
|
+
// Allow 'attachment:' img src (used for markdown cell attachments).
|
|
632
|
+
img: _sanitize.defaults.allowedSchemes.concat(['attachment'])
|
|
633
|
+
},
|
|
634
|
+
// Override of the default option, so we can skip 'src' attribute validation.
|
|
635
|
+
// 'src' Attributes are validated to be URIs, which does not allow for embedded (image) data.
|
|
636
|
+
// Since embedded data is no longer deemed to be a threat, validation can be skipped.
|
|
637
|
+
// See https://github.com/jupyterlab/jupyterlab/issues/5183
|
|
638
|
+
allowedSchemesAppliedToAttributes: ['href', 'cite']
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
_createClass(Sanitizer, [{
|
|
642
|
+
key: "sanitize",
|
|
643
|
+
value:
|
|
644
|
+
/**
|
|
645
|
+
* Sanitize an HTML string.
|
|
646
|
+
*
|
|
647
|
+
* @param dirty - The dirty text.
|
|
648
|
+
*
|
|
649
|
+
* @param options - The optional sanitization options.
|
|
650
|
+
*
|
|
651
|
+
* @returns The sanitized string.
|
|
652
|
+
*/
|
|
653
|
+
function sanitize(dirty, options) {
|
|
654
|
+
return _sanitize(dirty, _objectSpread(_objectSpread({}, this._options), options || {}));
|
|
655
|
+
}
|
|
656
|
+
}]);
|
|
657
|
+
return Sanitizer;
|
|
658
|
+
}();
|
|
659
|
+
export var defaultSanitizer = new Sanitizer();
|