@zipify/wysiwyg 1.1.1 → 1.2.1-1

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.
Files changed (176) hide show
  1. package/.github/actions/lint-css/action.yaml +1 -3
  2. package/.release-it.json +2 -1
  3. package/dist/cli.js +3 -3
  4. package/dist/wysiwyg.css +24 -25
  5. package/dist/wysiwyg.mjs +641 -618
  6. package/jest.config.js +3 -0
  7. package/lib/components/base/Modal.vue +21 -2
  8. package/lib/components/base/__tests__/Modal.test.js +1 -0
  9. package/lib/components/toolbar/controls/link/LinkControl.vue +22 -10
  10. package/lib/components/toolbar/controls/link/LinkControlHeader.vue +3 -3
  11. package/lib/components/toolbar/controls/link/__tests__/LinkControl.test.js +8 -8
  12. package/lib/components/toolbar/controls/link/__tests__/LinkControlHeader.test.js +1 -1
  13. package/lib/components/toolbar/controls/link/composables/useLink.js +10 -6
  14. package/lib/composables/__tests__/__snapshots__/useEditor.test.js.snap +1 -1
  15. package/lib/composables/useEditor.js +4 -3
  16. package/lib/enums/TextSettings.js +2 -0
  17. package/lib/extensions/FontStyle.js +2 -2
  18. package/lib/extensions/FontWeight.js +2 -0
  19. package/lib/extensions/Link.js +13 -15
  20. package/lib/extensions/StylePreset.js +33 -3
  21. package/lib/extensions/TextDecoration.js +6 -12
  22. package/lib/extensions/__tests__/FontFamily.test.js +7 -6
  23. package/lib/extensions/__tests__/FontWeight.test.js +19 -10
  24. package/lib/extensions/__tests__/StylePreset.test.js +52 -2
  25. package/lib/extensions/__tests__/TextDecoration.test.js +11 -40
  26. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +2 -2
  27. package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +1 -1
  28. package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +1 -1
  29. package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +19 -1
  30. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +2 -2
  31. package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +17 -1
  32. package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +26 -1
  33. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +2 -2
  34. package/lib/extensions/__tests__/__snapshots__/Margin.test.js.snap +2 -2
  35. package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +22 -2
  36. package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +3 -46
  37. package/package.json +22 -22
  38. package/lib/components/toolbar/controls/link/LinkControlApply.vue +0 -35
  39. package/node_modules_lambda/acorn-globals/node_modules/.bin/acorn +0 -4
  40. package/node_modules_lambda/acorn-globals/node_modules/acorn/CHANGELOG.md +0 -620
  41. package/node_modules_lambda/acorn-globals/node_modules/acorn/LICENSE +0 -21
  42. package/node_modules_lambda/acorn-globals/node_modules/acorn/README.md +0 -269
  43. package/node_modules_lambda/acorn-globals/node_modules/acorn/bin/acorn +0 -4
  44. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.d.ts +0 -209
  45. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js +0 -5186
  46. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js.map +0 -1
  47. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs +0 -5155
  48. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.d.ts +0 -2
  49. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.map +0 -1
  50. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/bin.js +0 -64
  51. package/node_modules_lambda/acorn-globals/node_modules/acorn/package.json +0 -35
  52. package/node_modules_lambda/cssstyle/node_modules/cssom/LICENSE.txt +0 -20
  53. package/node_modules_lambda/cssstyle/node_modules/cssom/README.mdown +0 -67
  54. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSDocumentRule.js +0 -39
  55. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSFontFaceRule.js +0 -36
  56. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSHostRule.js +0 -37
  57. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSImportRule.js +0 -132
  58. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframeRule.js +0 -37
  59. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframesRule.js +0 -39
  60. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSMediaRule.js +0 -41
  61. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSOM.js +0 -3
  62. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSRule.js +0 -43
  63. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleDeclaration.js +0 -148
  64. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleRule.js +0 -190
  65. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleSheet.js +0 -88
  66. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSSupportsRule.js +0 -36
  67. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValue.js +0 -43
  68. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValueExpression.js +0 -344
  69. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MatcherList.js +0 -62
  70. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MediaList.js +0 -61
  71. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/StyleSheet.js +0 -17
  72. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/clone.js +0 -82
  73. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/index.js +0 -21
  74. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/parse.js +0 -464
  75. package/node_modules_lambda/cssstyle/node_modules/cssom/package.json +0 -18
  76. package/node_modules_lambda/data-urls/node_modules/whatwg-url/LICENSE.txt +0 -21
  77. package/node_modules_lambda/data-urls/node_modules/whatwg-url/README.md +0 -106
  78. package/node_modules_lambda/data-urls/node_modules/whatwg-url/index.js +0 -27
  79. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/Function.js +0 -42
  80. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL-impl.js +0 -209
  81. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL.js +0 -442
  82. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams-impl.js +0 -130
  83. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams.js +0 -472
  84. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/VoidFunction.js +0 -26
  85. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/encoding.js +0 -16
  86. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/infra.js +0 -26
  87. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/percent-encoding.js +0 -142
  88. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/url-state-machine.js +0 -1244
  89. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/urlencoded.js +0 -106
  90. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/utils.js +0 -190
  91. package/node_modules_lambda/data-urls/node_modules/whatwg-url/package.json +0 -58
  92. package/node_modules_lambda/data-urls/node_modules/whatwg-url/webidl2js-wrapper.js +0 -7
  93. package/node_modules_lambda/escodegen/node_modules/estraverse/.jshintrc +0 -16
  94. package/node_modules_lambda/escodegen/node_modules/estraverse/LICENSE.BSD +0 -19
  95. package/node_modules_lambda/escodegen/node_modules/estraverse/README.md +0 -153
  96. package/node_modules_lambda/escodegen/node_modules/estraverse/estraverse.js +0 -805
  97. package/node_modules_lambda/escodegen/node_modules/estraverse/gulpfile.js +0 -70
  98. package/node_modules_lambda/escodegen/node_modules/estraverse/package.json +0 -40
  99. package/node_modules_lambda/escodegen/node_modules/levn/LICENSE +0 -22
  100. package/node_modules_lambda/escodegen/node_modules/levn/README.md +0 -196
  101. package/node_modules_lambda/escodegen/node_modules/levn/lib/cast.js +0 -298
  102. package/node_modules_lambda/escodegen/node_modules/levn/lib/coerce.js +0 -285
  103. package/node_modules_lambda/escodegen/node_modules/levn/lib/index.js +0 -22
  104. package/node_modules_lambda/escodegen/node_modules/levn/lib/parse-string.js +0 -113
  105. package/node_modules_lambda/escodegen/node_modules/levn/lib/parse.js +0 -102
  106. package/node_modules_lambda/escodegen/node_modules/levn/package.json +0 -47
  107. package/node_modules_lambda/escodegen/node_modules/optionator/CHANGELOG.md +0 -56
  108. package/node_modules_lambda/escodegen/node_modules/optionator/LICENSE +0 -22
  109. package/node_modules_lambda/escodegen/node_modules/optionator/README.md +0 -238
  110. package/node_modules_lambda/escodegen/node_modules/optionator/lib/help.js +0 -260
  111. package/node_modules_lambda/escodegen/node_modules/optionator/lib/index.js +0 -465
  112. package/node_modules_lambda/escodegen/node_modules/optionator/lib/util.js +0 -54
  113. package/node_modules_lambda/escodegen/node_modules/optionator/package.json +0 -44
  114. package/node_modules_lambda/escodegen/node_modules/prelude-ls/CHANGELOG.md +0 -99
  115. package/node_modules_lambda/escodegen/node_modules/prelude-ls/LICENSE +0 -22
  116. package/node_modules_lambda/escodegen/node_modules/prelude-ls/README.md +0 -15
  117. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Func.js +0 -65
  118. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/List.js +0 -686
  119. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Num.js +0 -130
  120. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Obj.js +0 -154
  121. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Str.js +0 -92
  122. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/index.js +0 -178
  123. package/node_modules_lambda/escodegen/node_modules/prelude-ls/package.json +0 -52
  124. package/node_modules_lambda/escodegen/node_modules/source-map/CHANGELOG.md +0 -301
  125. package/node_modules_lambda/escodegen/node_modules/source-map/LICENSE +0 -28
  126. package/node_modules_lambda/escodegen/node_modules/source-map/README.md +0 -742
  127. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.debug.js +0 -3234
  128. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.js +0 -3233
  129. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js +0 -2
  130. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js.map +0 -1
  131. package/node_modules_lambda/escodegen/node_modules/source-map/lib/array-set.js +0 -121
  132. package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64-vlq.js +0 -140
  133. package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64.js +0 -67
  134. package/node_modules_lambda/escodegen/node_modules/source-map/lib/binary-search.js +0 -111
  135. package/node_modules_lambda/escodegen/node_modules/source-map/lib/mapping-list.js +0 -79
  136. package/node_modules_lambda/escodegen/node_modules/source-map/lib/quick-sort.js +0 -114
  137. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-consumer.js +0 -1145
  138. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-generator.js +0 -425
  139. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-node.js +0 -413
  140. package/node_modules_lambda/escodegen/node_modules/source-map/lib/util.js +0 -488
  141. package/node_modules_lambda/escodegen/node_modules/source-map/package.json +0 -73
  142. package/node_modules_lambda/escodegen/node_modules/source-map/source-map.d.ts +0 -98
  143. package/node_modules_lambda/escodegen/node_modules/source-map/source-map.js +0 -8
  144. package/node_modules_lambda/escodegen/node_modules/type-check/LICENSE +0 -22
  145. package/node_modules_lambda/escodegen/node_modules/type-check/README.md +0 -210
  146. package/node_modules_lambda/escodegen/node_modules/type-check/lib/check.js +0 -126
  147. package/node_modules_lambda/escodegen/node_modules/type-check/lib/index.js +0 -16
  148. package/node_modules_lambda/escodegen/node_modules/type-check/lib/parse-type.js +0 -196
  149. package/node_modules_lambda/escodegen/node_modules/type-check/package.json +0 -40
  150. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/.github/dependabot.yml +0 -11
  151. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/Changelog.md +0 -212
  152. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/LICENSE +0 -21
  153. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/README.md +0 -130
  154. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -597
  155. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-data.js +0 -188
  156. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/index.js +0 -23
  157. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/internal.js +0 -198
  158. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  159. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  160. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data.js +0 -179
  161. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  162. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  163. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  164. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  165. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  166. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  167. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
  168. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  169. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf16.js +0 -197
  170. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf32.js +0 -319
  171. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf7.js +0 -290
  172. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  173. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.d.ts +0 -41
  174. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.js +0 -180
  175. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/streams.js +0 -109
  176. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/package.json +0 -44
@@ -1,464 +0,0 @@
1
- //.CommonJS
2
- var CSSOM = {};
3
- ///CommonJS
4
-
5
-
6
- /**
7
- * @param {string} token
8
- */
9
- CSSOM.parse = function parse(token) {
10
-
11
- var i = 0;
12
-
13
- /**
14
- "before-selector" or
15
- "selector" or
16
- "atRule" or
17
- "atBlock" or
18
- "conditionBlock" or
19
- "before-name" or
20
- "name" or
21
- "before-value" or
22
- "value"
23
- */
24
- var state = "before-selector";
25
-
26
- var index;
27
- var buffer = "";
28
- var valueParenthesisDepth = 0;
29
-
30
- var SIGNIFICANT_WHITESPACE = {
31
- "selector": true,
32
- "value": true,
33
- "value-parenthesis": true,
34
- "atRule": true,
35
- "importRule-begin": true,
36
- "importRule": true,
37
- "atBlock": true,
38
- "conditionBlock": true,
39
- 'documentRule-begin': true
40
- };
41
-
42
- var styleSheet = new CSSOM.CSSStyleSheet();
43
-
44
- // @type CSSStyleSheet|CSSMediaRule|CSSSupportsRule|CSSFontFaceRule|CSSKeyframesRule|CSSDocumentRule
45
- var currentScope = styleSheet;
46
-
47
- // @type CSSMediaRule|CSSSupportsRule|CSSKeyframesRule|CSSDocumentRule
48
- var parentRule;
49
-
50
- var ancestorRules = [];
51
- var hasAncestors = false;
52
- var prevScope;
53
-
54
- var name, priority="", styleRule, mediaRule, supportsRule, importRule, fontFaceRule, keyframesRule, documentRule, hostRule;
55
-
56
- var atKeyframesRegExp = /@(-(?:\w+-)+)?keyframes/g;
57
-
58
- var parseError = function(message) {
59
- var lines = token.substring(0, i).split('\n');
60
- var lineCount = lines.length;
61
- var charCount = lines.pop().length + 1;
62
- var error = new Error(message + ' (line ' + lineCount + ', char ' + charCount + ')');
63
- error.line = lineCount;
64
- /* jshint sub : true */
65
- error['char'] = charCount;
66
- error.styleSheet = styleSheet;
67
- throw error;
68
- };
69
-
70
- for (var character; (character = token.charAt(i)); i++) {
71
-
72
- switch (character) {
73
-
74
- case " ":
75
- case "\t":
76
- case "\r":
77
- case "\n":
78
- case "\f":
79
- if (SIGNIFICANT_WHITESPACE[state]) {
80
- buffer += character;
81
- }
82
- break;
83
-
84
- // String
85
- case '"':
86
- index = i + 1;
87
- do {
88
- index = token.indexOf('"', index) + 1;
89
- if (!index) {
90
- parseError('Unmatched "');
91
- }
92
- } while (token[index - 2] === '\\');
93
- buffer += token.slice(i, index);
94
- i = index - 1;
95
- switch (state) {
96
- case 'before-value':
97
- state = 'value';
98
- break;
99
- case 'importRule-begin':
100
- state = 'importRule';
101
- break;
102
- }
103
- break;
104
-
105
- case "'":
106
- index = i + 1;
107
- do {
108
- index = token.indexOf("'", index) + 1;
109
- if (!index) {
110
- parseError("Unmatched '");
111
- }
112
- } while (token[index - 2] === '\\');
113
- buffer += token.slice(i, index);
114
- i = index - 1;
115
- switch (state) {
116
- case 'before-value':
117
- state = 'value';
118
- break;
119
- case 'importRule-begin':
120
- state = 'importRule';
121
- break;
122
- }
123
- break;
124
-
125
- // Comment
126
- case "/":
127
- if (token.charAt(i + 1) === "*") {
128
- i += 2;
129
- index = token.indexOf("*/", i);
130
- if (index === -1) {
131
- parseError("Missing */");
132
- } else {
133
- i = index + 1;
134
- }
135
- } else {
136
- buffer += character;
137
- }
138
- if (state === "importRule-begin") {
139
- buffer += " ";
140
- state = "importRule";
141
- }
142
- break;
143
-
144
- // At-rule
145
- case "@":
146
- if (token.indexOf("@-moz-document", i) === i) {
147
- state = "documentRule-begin";
148
- documentRule = new CSSOM.CSSDocumentRule();
149
- documentRule.__starts = i;
150
- i += "-moz-document".length;
151
- buffer = "";
152
- break;
153
- } else if (token.indexOf("@media", i) === i) {
154
- state = "atBlock";
155
- mediaRule = new CSSOM.CSSMediaRule();
156
- mediaRule.__starts = i;
157
- i += "media".length;
158
- buffer = "";
159
- break;
160
- } else if (token.indexOf("@supports", i) === i) {
161
- state = "conditionBlock";
162
- supportsRule = new CSSOM.CSSSupportsRule();
163
- supportsRule.__starts = i;
164
- i += "supports".length;
165
- buffer = "";
166
- break;
167
- } else if (token.indexOf("@host", i) === i) {
168
- state = "hostRule-begin";
169
- i += "host".length;
170
- hostRule = new CSSOM.CSSHostRule();
171
- hostRule.__starts = i;
172
- buffer = "";
173
- break;
174
- } else if (token.indexOf("@import", i) === i) {
175
- state = "importRule-begin";
176
- i += "import".length;
177
- buffer += "@import";
178
- break;
179
- } else if (token.indexOf("@font-face", i) === i) {
180
- state = "fontFaceRule-begin";
181
- i += "font-face".length;
182
- fontFaceRule = new CSSOM.CSSFontFaceRule();
183
- fontFaceRule.__starts = i;
184
- buffer = "";
185
- break;
186
- } else {
187
- atKeyframesRegExp.lastIndex = i;
188
- var matchKeyframes = atKeyframesRegExp.exec(token);
189
- if (matchKeyframes && matchKeyframes.index === i) {
190
- state = "keyframesRule-begin";
191
- keyframesRule = new CSSOM.CSSKeyframesRule();
192
- keyframesRule.__starts = i;
193
- keyframesRule._vendorPrefix = matchKeyframes[1]; // Will come out as undefined if no prefix was found
194
- i += matchKeyframes[0].length - 1;
195
- buffer = "";
196
- break;
197
- } else if (state === "selector") {
198
- state = "atRule";
199
- }
200
- }
201
- buffer += character;
202
- break;
203
-
204
- case "{":
205
- if (state === "selector" || state === "atRule") {
206
- styleRule.selectorText = buffer.trim();
207
- styleRule.style.__starts = i;
208
- buffer = "";
209
- state = "before-name";
210
- } else if (state === "atBlock") {
211
- mediaRule.media.mediaText = buffer.trim();
212
-
213
- if (parentRule) {
214
- ancestorRules.push(parentRule);
215
- }
216
-
217
- currentScope = parentRule = mediaRule;
218
- mediaRule.parentStyleSheet = styleSheet;
219
- buffer = "";
220
- state = "before-selector";
221
- } else if (state === "conditionBlock") {
222
- supportsRule.conditionText = buffer.trim();
223
-
224
- if (parentRule) {
225
- ancestorRules.push(parentRule);
226
- }
227
-
228
- currentScope = parentRule = supportsRule;
229
- supportsRule.parentStyleSheet = styleSheet;
230
- buffer = "";
231
- state = "before-selector";
232
- } else if (state === "hostRule-begin") {
233
- if (parentRule) {
234
- ancestorRules.push(parentRule);
235
- }
236
-
237
- currentScope = parentRule = hostRule;
238
- hostRule.parentStyleSheet = styleSheet;
239
- buffer = "";
240
- state = "before-selector";
241
- } else if (state === "fontFaceRule-begin") {
242
- if (parentRule) {
243
- ancestorRules.push(parentRule);
244
- fontFaceRule.parentRule = parentRule;
245
- }
246
- fontFaceRule.parentStyleSheet = styleSheet;
247
- styleRule = fontFaceRule;
248
- buffer = "";
249
- state = "before-name";
250
- } else if (state === "keyframesRule-begin") {
251
- keyframesRule.name = buffer.trim();
252
- if (parentRule) {
253
- ancestorRules.push(parentRule);
254
- keyframesRule.parentRule = parentRule;
255
- }
256
- keyframesRule.parentStyleSheet = styleSheet;
257
- currentScope = parentRule = keyframesRule;
258
- buffer = "";
259
- state = "keyframeRule-begin";
260
- } else if (state === "keyframeRule-begin") {
261
- styleRule = new CSSOM.CSSKeyframeRule();
262
- styleRule.keyText = buffer.trim();
263
- styleRule.__starts = i;
264
- buffer = "";
265
- state = "before-name";
266
- } else if (state === "documentRule-begin") {
267
- // FIXME: what if this '{' is in the url text of the match function?
268
- documentRule.matcher.matcherText = buffer.trim();
269
- if (parentRule) {
270
- ancestorRules.push(parentRule);
271
- documentRule.parentRule = parentRule;
272
- }
273
- currentScope = parentRule = documentRule;
274
- documentRule.parentStyleSheet = styleSheet;
275
- buffer = "";
276
- state = "before-selector";
277
- }
278
- break;
279
-
280
- case ":":
281
- if (state === "name") {
282
- name = buffer.trim();
283
- buffer = "";
284
- state = "before-value";
285
- } else {
286
- buffer += character;
287
- }
288
- break;
289
-
290
- case "(":
291
- if (state === 'value') {
292
- // ie css expression mode
293
- if (buffer.trim() === 'expression') {
294
- var info = (new CSSOM.CSSValueExpression(token, i)).parse();
295
-
296
- if (info.error) {
297
- parseError(info.error);
298
- } else {
299
- buffer += info.expression;
300
- i = info.idx;
301
- }
302
- } else {
303
- state = 'value-parenthesis';
304
- //always ensure this is reset to 1 on transition
305
- //from value to value-parenthesis
306
- valueParenthesisDepth = 1;
307
- buffer += character;
308
- }
309
- } else if (state === 'value-parenthesis') {
310
- valueParenthesisDepth++;
311
- buffer += character;
312
- } else {
313
- buffer += character;
314
- }
315
- break;
316
-
317
- case ")":
318
- if (state === 'value-parenthesis') {
319
- valueParenthesisDepth--;
320
- if (valueParenthesisDepth === 0) state = 'value';
321
- }
322
- buffer += character;
323
- break;
324
-
325
- case "!":
326
- if (state === "value" && token.indexOf("!important", i) === i) {
327
- priority = "important";
328
- i += "important".length;
329
- } else {
330
- buffer += character;
331
- }
332
- break;
333
-
334
- case ";":
335
- switch (state) {
336
- case "value":
337
- styleRule.style.setProperty(name, buffer.trim(), priority);
338
- priority = "";
339
- buffer = "";
340
- state = "before-name";
341
- break;
342
- case "atRule":
343
- buffer = "";
344
- state = "before-selector";
345
- break;
346
- case "importRule":
347
- importRule = new CSSOM.CSSImportRule();
348
- importRule.parentStyleSheet = importRule.styleSheet.parentStyleSheet = styleSheet;
349
- importRule.cssText = buffer + character;
350
- styleSheet.cssRules.push(importRule);
351
- buffer = "";
352
- state = "before-selector";
353
- break;
354
- default:
355
- buffer += character;
356
- break;
357
- }
358
- break;
359
-
360
- case "}":
361
- switch (state) {
362
- case "value":
363
- styleRule.style.setProperty(name, buffer.trim(), priority);
364
- priority = "";
365
- /* falls through */
366
- case "before-name":
367
- case "name":
368
- styleRule.__ends = i + 1;
369
- if (parentRule) {
370
- styleRule.parentRule = parentRule;
371
- }
372
- styleRule.parentStyleSheet = styleSheet;
373
- currentScope.cssRules.push(styleRule);
374
- buffer = "";
375
- if (currentScope.constructor === CSSOM.CSSKeyframesRule) {
376
- state = "keyframeRule-begin";
377
- } else {
378
- state = "before-selector";
379
- }
380
- break;
381
- case "keyframeRule-begin":
382
- case "before-selector":
383
- case "selector":
384
- // End of media/supports/document rule.
385
- if (!parentRule) {
386
- parseError("Unexpected }");
387
- }
388
-
389
- // Handle rules nested in @media or @supports
390
- hasAncestors = ancestorRules.length > 0;
391
-
392
- while (ancestorRules.length > 0) {
393
- parentRule = ancestorRules.pop();
394
-
395
- if (
396
- parentRule.constructor.name === "CSSMediaRule"
397
- || parentRule.constructor.name === "CSSSupportsRule"
398
- ) {
399
- prevScope = currentScope;
400
- currentScope = parentRule;
401
- currentScope.cssRules.push(prevScope);
402
- break;
403
- }
404
-
405
- if (ancestorRules.length === 0) {
406
- hasAncestors = false;
407
- }
408
- }
409
-
410
- if (!hasAncestors) {
411
- currentScope.__ends = i + 1;
412
- styleSheet.cssRules.push(currentScope);
413
- currentScope = styleSheet;
414
- parentRule = null;
415
- }
416
-
417
- buffer = "";
418
- state = "before-selector";
419
- break;
420
- }
421
- break;
422
-
423
- default:
424
- switch (state) {
425
- case "before-selector":
426
- state = "selector";
427
- styleRule = new CSSOM.CSSStyleRule();
428
- styleRule.__starts = i;
429
- break;
430
- case "before-name":
431
- state = "name";
432
- break;
433
- case "before-value":
434
- state = "value";
435
- break;
436
- case "importRule-begin":
437
- state = "importRule";
438
- break;
439
- }
440
- buffer += character;
441
- break;
442
- }
443
- }
444
-
445
- return styleSheet;
446
- };
447
-
448
-
449
- //.CommonJS
450
- exports.parse = CSSOM.parse;
451
- // The following modules cannot be included sooner due to the mutual dependency with parse.js
452
- CSSOM.CSSStyleSheet = require("./CSSStyleSheet").CSSStyleSheet;
453
- CSSOM.CSSStyleRule = require("./CSSStyleRule").CSSStyleRule;
454
- CSSOM.CSSImportRule = require("./CSSImportRule").CSSImportRule;
455
- CSSOM.CSSMediaRule = require("./CSSMediaRule").CSSMediaRule;
456
- CSSOM.CSSSupportsRule = require("./CSSSupportsRule").CSSSupportsRule;
457
- CSSOM.CSSFontFaceRule = require("./CSSFontFaceRule").CSSFontFaceRule;
458
- CSSOM.CSSHostRule = require("./CSSHostRule").CSSHostRule;
459
- CSSOM.CSSStyleDeclaration = require('./CSSStyleDeclaration').CSSStyleDeclaration;
460
- CSSOM.CSSKeyframeRule = require('./CSSKeyframeRule').CSSKeyframeRule;
461
- CSSOM.CSSKeyframesRule = require('./CSSKeyframesRule').CSSKeyframesRule;
462
- CSSOM.CSSValueExpression = require('./CSSValueExpression').CSSValueExpression;
463
- CSSOM.CSSDocumentRule = require('./CSSDocumentRule').CSSDocumentRule;
464
- ///CommonJS
@@ -1,18 +0,0 @@
1
- {
2
- "name": "cssom",
3
- "description": "CSS Object Model implementation and CSS parser",
4
- "keywords": [
5
- "CSS",
6
- "CSSOM",
7
- "parser",
8
- "styleSheet"
9
- ],
10
- "version": "0.3.8",
11
- "author": "Nikita Vasilyev <me@elv1s.ru>",
12
- "repository": "NV/CSSOM",
13
- "files": [
14
- "lib/"
15
- ],
16
- "main": "./lib/index.js",
17
- "license": "MIT"
18
- }
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) Sebastian Mayr
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,106 +0,0 @@
1
- # whatwg-url
2
-
3
- whatwg-url is a full implementation of the WHATWG [URL Standard](https://url.spec.whatwg.org/). It can be used standalone, but it also exposes a lot of the internal algorithms that are useful for integrating a URL parser into a project like [jsdom](https://github.com/jsdom/jsdom).
4
-
5
- ## Specification conformance
6
-
7
- whatwg-url is currently up to date with the URL spec up to commit [43c2713](https://github.com/whatwg/url/commit/43c27137a0bc82c4b800fe74be893255fbeb35f4).
8
-
9
- For `file:` URLs, whose [origin is left unspecified](https://url.spec.whatwg.org/#concept-url-origin), whatwg-url chooses to use a new opaque origin (which serializes to `"null"`).
10
-
11
- whatwg-url does not yet implement any encoding handling beyond UTF-8. That is, the _encoding override_ parameter does not exist in our API.
12
-
13
- ## API
14
-
15
- ### The `URL` and `URLSearchParams` classes
16
-
17
- The main API is provided by the [`URL`](https://url.spec.whatwg.org/#url-class) and [`URLSearchParams`](https://url.spec.whatwg.org/#interface-urlsearchparams) exports, which follows the spec's behavior in all ways (including e.g. `USVString` conversion). Most consumers of this library will want to use these.
18
-
19
- ### Low-level URL Standard API
20
-
21
- The following methods are exported for use by places like jsdom that need to implement things like [`HTMLHyperlinkElementUtils`](https://html.spec.whatwg.org/#htmlhyperlinkelementutils). They mostly operate on or return an "internal URL" or ["URL record"](https://url.spec.whatwg.org/#concept-url) type.
22
-
23
- - [URL parser](https://url.spec.whatwg.org/#concept-url-parser): `parseURL(input, { baseURL })`
24
- - [Basic URL parser](https://url.spec.whatwg.org/#concept-basic-url-parser): `basicURLParse(input, { baseURL, url, stateOverride })`
25
- - [URL serializer](https://url.spec.whatwg.org/#concept-url-serializer): `serializeURL(urlRecord, excludeFragment)`
26
- - [Host serializer](https://url.spec.whatwg.org/#concept-host-serializer): `serializeHost(hostFromURLRecord)`
27
- - [URL path serializer](https://url.spec.whatwg.org/#url-path-serializer): `serializePath(urlRecord)`
28
- - [Serialize an integer](https://url.spec.whatwg.org/#serialize-an-integer): `serializeInteger(number)`
29
- - [Origin](https://url.spec.whatwg.org/#concept-url-origin) [serializer](https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin): `serializeURLOrigin(urlRecord)`
30
- - [Set the username](https://url.spec.whatwg.org/#set-the-username): `setTheUsername(urlRecord, usernameString)`
31
- - [Set the password](https://url.spec.whatwg.org/#set-the-password): `setThePassword(urlRecord, passwordString)`
32
- - [Has an opaque path](https://url.spec.whatwg.org/#url-opaque-path): `hasAnOpaquePath(urlRecord)`
33
- - [Cannot have a username/password/port](https://url.spec.whatwg.org/#cannot-have-a-username-password-port): `cannotHaveAUsernamePasswordPort(urlRecord)`
34
- - [Percent decode bytes](https://url.spec.whatwg.org/#percent-decode): `percentDecodeBytes(uint8Array)`
35
- - [Percent decode a string](https://url.spec.whatwg.org/#percent-decode-string): `percentDecodeString(string)`
36
-
37
- The `stateOverride` parameter is one of the following strings:
38
-
39
- - [`"scheme start"`](https://url.spec.whatwg.org/#scheme-start-state)
40
- - [`"scheme"`](https://url.spec.whatwg.org/#scheme-state)
41
- - [`"no scheme"`](https://url.spec.whatwg.org/#no-scheme-state)
42
- - [`"special relative or authority"`](https://url.spec.whatwg.org/#special-relative-or-authority-state)
43
- - [`"path or authority"`](https://url.spec.whatwg.org/#path-or-authority-state)
44
- - [`"relative"`](https://url.spec.whatwg.org/#relative-state)
45
- - [`"relative slash"`](https://url.spec.whatwg.org/#relative-slash-state)
46
- - [`"special authority slashes"`](https://url.spec.whatwg.org/#special-authority-slashes-state)
47
- - [`"special authority ignore slashes"`](https://url.spec.whatwg.org/#special-authority-ignore-slashes-state)
48
- - [`"authority"`](https://url.spec.whatwg.org/#authority-state)
49
- - [`"host"`](https://url.spec.whatwg.org/#host-state)
50
- - [`"hostname"`](https://url.spec.whatwg.org/#hostname-state)
51
- - [`"port"`](https://url.spec.whatwg.org/#port-state)
52
- - [`"file"`](https://url.spec.whatwg.org/#file-state)
53
- - [`"file slash"`](https://url.spec.whatwg.org/#file-slash-state)
54
- - [`"file host"`](https://url.spec.whatwg.org/#file-host-state)
55
- - [`"path start"`](https://url.spec.whatwg.org/#path-start-state)
56
- - [`"path"`](https://url.spec.whatwg.org/#path-state)
57
- - [`"opaque path"`](https://url.spec.whatwg.org/#cannot-be-a-base-url-path-state)
58
- - [`"query"`](https://url.spec.whatwg.org/#query-state)
59
- - [`"fragment"`](https://url.spec.whatwg.org/#fragment-state)
60
-
61
- The URL record type has the following API:
62
-
63
- - [`scheme`](https://url.spec.whatwg.org/#concept-url-scheme)
64
- - [`username`](https://url.spec.whatwg.org/#concept-url-username)
65
- - [`password`](https://url.spec.whatwg.org/#concept-url-password)
66
- - [`host`](https://url.spec.whatwg.org/#concept-url-host)
67
- - [`port`](https://url.spec.whatwg.org/#concept-url-port)
68
- - [`path`](https://url.spec.whatwg.org/#concept-url-path) (as an array of strings, or a string)
69
- - [`query`](https://url.spec.whatwg.org/#concept-url-query)
70
- - [`fragment`](https://url.spec.whatwg.org/#concept-url-fragment)
71
-
72
- These properties should be treated with care, as in general changing them will cause the URL record to be in an inconsistent state until the appropriate invocation of `basicURLParse` is used to fix it up. You can see examples of this in the URL Standard, where there are many step sequences like "4. Set context object’s url’s fragment to the empty string. 5. Basic URL parse _input_ with context object’s url as _url_ and fragment state as _state override_." In between those two steps, a URL record is in an unusable state.
73
-
74
- The return value of "failure" in the spec is represented by `null`. That is, functions like `parseURL` and `basicURLParse` can return _either_ a URL record _or_ `null`.
75
-
76
- ### `whatwg-url/webidl2js-wrapper` module
77
-
78
- This module exports the `URL` and `URLSearchParams` [interface wrappers API](https://github.com/jsdom/webidl2js#for-interfaces) generated by [webidl2js](https://github.com/jsdom/webidl2js).
79
-
80
- ## Development instructions
81
-
82
- First, install [Node.js](https://nodejs.org/). Then, fetch the dependencies of whatwg-url, by running from this directory:
83
-
84
- npm install
85
-
86
- To run tests:
87
-
88
- npm test
89
-
90
- To generate a coverage report:
91
-
92
- npm run coverage
93
-
94
- To build and run the live viewer:
95
-
96
- npm run prepare
97
- npm run build-live-viewer
98
-
99
- Serve the contents of the `live-viewer` directory using any web server.
100
-
101
- ## Supporting whatwg-url
102
-
103
- The jsdom project (including whatwg-url) is a community-driven project maintained by a team of [volunteers](https://github.com/orgs/jsdom/people). You could support us by:
104
-
105
- - [Getting professional support for whatwg-url](https://tidelift.com/subscription/pkg/npm-whatwg-url?utm_source=npm-whatwg-url&utm_medium=referral&utm_campaign=readme) as part of a Tidelift subscription. Tidelift helps making open source sustainable for us while giving teams assurances for maintenance, licensing, and security.
106
- - Contributing directly to the project.
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- const { URL, URLSearchParams } = require("./webidl2js-wrapper");
4
- const urlStateMachine = require("./lib/url-state-machine");
5
- const percentEncoding = require("./lib/percent-encoding");
6
-
7
- const sharedGlobalObject = { Array, Object, Promise, String, TypeError };
8
- URL.install(sharedGlobalObject, ["Window"]);
9
- URLSearchParams.install(sharedGlobalObject, ["Window"]);
10
-
11
- exports.URL = sharedGlobalObject.URL;
12
- exports.URLSearchParams = sharedGlobalObject.URLSearchParams;
13
-
14
- exports.parseURL = urlStateMachine.parseURL;
15
- exports.basicURLParse = urlStateMachine.basicURLParse;
16
- exports.serializeURL = urlStateMachine.serializeURL;
17
- exports.serializePath = urlStateMachine.serializePath;
18
- exports.serializeHost = urlStateMachine.serializeHost;
19
- exports.serializeInteger = urlStateMachine.serializeInteger;
20
- exports.serializeURLOrigin = urlStateMachine.serializeURLOrigin;
21
- exports.setTheUsername = urlStateMachine.setTheUsername;
22
- exports.setThePassword = urlStateMachine.setThePassword;
23
- exports.cannotHaveAUsernamePasswordPort = urlStateMachine.cannotHaveAUsernamePasswordPort;
24
- exports.hasAnOpaquePath = urlStateMachine.hasAnOpaquePath;
25
-
26
- exports.percentDecodeString = percentEncoding.percentDecodeString;
27
- exports.percentDecodeBytes = percentEncoding.percentDecodeBytes;
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- const conversions = require("webidl-conversions");
4
- const utils = require("./utils.js");
5
-
6
- exports.convert = (globalObject, value, { context = "The provided value" } = {}) => {
7
- if (typeof value !== "function") {
8
- throw new globalObject.TypeError(context + " is not a function");
9
- }
10
-
11
- function invokeTheCallbackFunction(...args) {
12
- const thisArg = utils.tryWrapperForImpl(this);
13
- let callResult;
14
-
15
- for (let i = 0; i < args.length; i++) {
16
- args[i] = utils.tryWrapperForImpl(args[i]);
17
- }
18
-
19
- callResult = Reflect.apply(value, thisArg, args);
20
-
21
- callResult = conversions["any"](callResult, { context: context, globals: globalObject });
22
-
23
- return callResult;
24
- }
25
-
26
- invokeTheCallbackFunction.construct = (...args) => {
27
- for (let i = 0; i < args.length; i++) {
28
- args[i] = utils.tryWrapperForImpl(args[i]);
29
- }
30
-
31
- let callResult = Reflect.construct(value, args);
32
-
33
- callResult = conversions["any"](callResult, { context: context, globals: globalObject });
34
-
35
- return callResult;
36
- };
37
-
38
- invokeTheCallbackFunction[utils.wrapperSymbol] = value;
39
- invokeTheCallbackFunction.objectReference = value;
40
-
41
- return invokeTheCallbackFunction;
42
- };