@zipify/wysiwyg 1.1.1-0 → 1.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 (164) hide show
  1. package/dist/cli.js +2 -2
  2. package/dist/wysiwyg.css +11 -11
  3. package/dist/wysiwyg.mjs +46 -53
  4. package/lib/components/toolbar/controls/link/LinkControl.vue +4 -5
  5. package/lib/components/toolbar/controls/link/LinkControlHeader.vue +2 -2
  6. package/lib/components/toolbar/controls/link/__tests__/LinkControl.test.js +1 -1
  7. package/lib/components/toolbar/controls/link/__tests__/LinkControlHeader.test.js +1 -1
  8. package/lib/components/toolbar/controls/link/composables/useLink.js +5 -7
  9. package/lib/enums/TextSettings.js +0 -2
  10. package/lib/extensions/Alignment.js +10 -8
  11. package/lib/extensions/FontSize.js +8 -3
  12. package/lib/extensions/FontStyle.js +2 -2
  13. package/lib/extensions/LineHeight.js +10 -4
  14. package/lib/extensions/Link.js +15 -13
  15. package/lib/extensions/TextDecoration.js +13 -12
  16. package/lib/extensions/__tests__/FontFamily.test.js +6 -7
  17. package/lib/extensions/__tests__/FontWeight.test.js +10 -11
  18. package/lib/extensions/__tests__/TextDecoration.test.js +42 -73
  19. package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +3 -3
  20. package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +0 -18
  21. package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +9 -9
  22. package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +0 -16
  23. package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +5 -5
  24. package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +43 -0
  25. package/lib/services/NodeFactory.js +4 -1
  26. package/node_modules_lambda/acorn-globals/node_modules/.bin/acorn +4 -0
  27. package/node_modules_lambda/acorn-globals/node_modules/acorn/CHANGELOG.md +620 -0
  28. package/node_modules_lambda/acorn-globals/node_modules/acorn/LICENSE +21 -0
  29. package/node_modules_lambda/acorn-globals/node_modules/acorn/README.md +269 -0
  30. package/node_modules_lambda/acorn-globals/node_modules/acorn/bin/acorn +4 -0
  31. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.d.ts +209 -0
  32. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js +5186 -0
  33. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js.map +1 -0
  34. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs +5155 -0
  35. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.d.ts +2 -0
  36. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.map +1 -0
  37. package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/bin.js +64 -0
  38. package/node_modules_lambda/acorn-globals/node_modules/acorn/package.json +35 -0
  39. package/node_modules_lambda/cssstyle/node_modules/cssom/LICENSE.txt +20 -0
  40. package/node_modules_lambda/cssstyle/node_modules/cssom/README.mdown +67 -0
  41. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSDocumentRule.js +39 -0
  42. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSFontFaceRule.js +36 -0
  43. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSHostRule.js +37 -0
  44. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSImportRule.js +132 -0
  45. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframeRule.js +37 -0
  46. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframesRule.js +39 -0
  47. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSMediaRule.js +41 -0
  48. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSOM.js +3 -0
  49. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSRule.js +43 -0
  50. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleDeclaration.js +148 -0
  51. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleRule.js +190 -0
  52. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleSheet.js +88 -0
  53. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSSupportsRule.js +36 -0
  54. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValue.js +43 -0
  55. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValueExpression.js +344 -0
  56. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MatcherList.js +62 -0
  57. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MediaList.js +61 -0
  58. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/StyleSheet.js +17 -0
  59. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/clone.js +82 -0
  60. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/index.js +21 -0
  61. package/node_modules_lambda/cssstyle/node_modules/cssom/lib/parse.js +464 -0
  62. package/node_modules_lambda/cssstyle/node_modules/cssom/package.json +18 -0
  63. package/node_modules_lambda/data-urls/node_modules/whatwg-url/LICENSE.txt +21 -0
  64. package/node_modules_lambda/data-urls/node_modules/whatwg-url/README.md +106 -0
  65. package/node_modules_lambda/data-urls/node_modules/whatwg-url/index.js +27 -0
  66. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/Function.js +42 -0
  67. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL-impl.js +209 -0
  68. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL.js +442 -0
  69. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams-impl.js +130 -0
  70. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams.js +472 -0
  71. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/VoidFunction.js +26 -0
  72. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/encoding.js +16 -0
  73. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/infra.js +26 -0
  74. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/percent-encoding.js +142 -0
  75. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/url-state-machine.js +1244 -0
  76. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/urlencoded.js +106 -0
  77. package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/utils.js +190 -0
  78. package/node_modules_lambda/data-urls/node_modules/whatwg-url/package.json +58 -0
  79. package/node_modules_lambda/data-urls/node_modules/whatwg-url/webidl2js-wrapper.js +7 -0
  80. package/node_modules_lambda/escodegen/node_modules/estraverse/.jshintrc +16 -0
  81. package/node_modules_lambda/escodegen/node_modules/estraverse/LICENSE.BSD +19 -0
  82. package/node_modules_lambda/escodegen/node_modules/estraverse/README.md +153 -0
  83. package/node_modules_lambda/escodegen/node_modules/estraverse/estraverse.js +805 -0
  84. package/node_modules_lambda/escodegen/node_modules/estraverse/gulpfile.js +70 -0
  85. package/node_modules_lambda/escodegen/node_modules/estraverse/package.json +40 -0
  86. package/node_modules_lambda/escodegen/node_modules/levn/LICENSE +22 -0
  87. package/node_modules_lambda/escodegen/node_modules/levn/README.md +196 -0
  88. package/node_modules_lambda/escodegen/node_modules/levn/lib/cast.js +298 -0
  89. package/node_modules_lambda/escodegen/node_modules/levn/lib/coerce.js +285 -0
  90. package/node_modules_lambda/escodegen/node_modules/levn/lib/index.js +22 -0
  91. package/node_modules_lambda/escodegen/node_modules/levn/lib/parse-string.js +113 -0
  92. package/node_modules_lambda/escodegen/node_modules/levn/lib/parse.js +102 -0
  93. package/node_modules_lambda/escodegen/node_modules/levn/package.json +47 -0
  94. package/node_modules_lambda/escodegen/node_modules/optionator/CHANGELOG.md +56 -0
  95. package/node_modules_lambda/escodegen/node_modules/optionator/LICENSE +22 -0
  96. package/node_modules_lambda/escodegen/node_modules/optionator/README.md +238 -0
  97. package/node_modules_lambda/escodegen/node_modules/optionator/lib/help.js +260 -0
  98. package/node_modules_lambda/escodegen/node_modules/optionator/lib/index.js +465 -0
  99. package/node_modules_lambda/escodegen/node_modules/optionator/lib/util.js +54 -0
  100. package/node_modules_lambda/escodegen/node_modules/optionator/package.json +44 -0
  101. package/node_modules_lambda/escodegen/node_modules/prelude-ls/CHANGELOG.md +99 -0
  102. package/node_modules_lambda/escodegen/node_modules/prelude-ls/LICENSE +22 -0
  103. package/node_modules_lambda/escodegen/node_modules/prelude-ls/README.md +15 -0
  104. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Func.js +65 -0
  105. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/List.js +686 -0
  106. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Num.js +130 -0
  107. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Obj.js +154 -0
  108. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Str.js +92 -0
  109. package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/index.js +178 -0
  110. package/node_modules_lambda/escodegen/node_modules/prelude-ls/package.json +52 -0
  111. package/node_modules_lambda/escodegen/node_modules/source-map/CHANGELOG.md +301 -0
  112. package/node_modules_lambda/escodegen/node_modules/source-map/LICENSE +28 -0
  113. package/node_modules_lambda/escodegen/node_modules/source-map/README.md +742 -0
  114. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.debug.js +3234 -0
  115. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.js +3233 -0
  116. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js +2 -0
  117. package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js.map +1 -0
  118. package/node_modules_lambda/escodegen/node_modules/source-map/lib/array-set.js +121 -0
  119. package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64-vlq.js +140 -0
  120. package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64.js +67 -0
  121. package/node_modules_lambda/escodegen/node_modules/source-map/lib/binary-search.js +111 -0
  122. package/node_modules_lambda/escodegen/node_modules/source-map/lib/mapping-list.js +79 -0
  123. package/node_modules_lambda/escodegen/node_modules/source-map/lib/quick-sort.js +114 -0
  124. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-consumer.js +1145 -0
  125. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-generator.js +425 -0
  126. package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-node.js +413 -0
  127. package/node_modules_lambda/escodegen/node_modules/source-map/lib/util.js +488 -0
  128. package/node_modules_lambda/escodegen/node_modules/source-map/package.json +73 -0
  129. package/node_modules_lambda/escodegen/node_modules/source-map/source-map.d.ts +98 -0
  130. package/node_modules_lambda/escodegen/node_modules/source-map/source-map.js +8 -0
  131. package/node_modules_lambda/escodegen/node_modules/type-check/LICENSE +22 -0
  132. package/node_modules_lambda/escodegen/node_modules/type-check/README.md +210 -0
  133. package/node_modules_lambda/escodegen/node_modules/type-check/lib/check.js +126 -0
  134. package/node_modules_lambda/escodegen/node_modules/type-check/lib/index.js +16 -0
  135. package/node_modules_lambda/escodegen/node_modules/type-check/lib/parse-type.js +196 -0
  136. package/node_modules_lambda/escodegen/node_modules/type-check/package.json +40 -0
  137. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/.github/dependabot.yml +11 -0
  138. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/Changelog.md +212 -0
  139. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/LICENSE +21 -0
  140. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/README.md +130 -0
  141. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-codec.js +597 -0
  142. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-data.js +188 -0
  143. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/index.js +23 -0
  144. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/internal.js +198 -0
  145. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
  146. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  147. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data.js +179 -0
  148. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  149. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  150. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  151. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  152. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  153. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  154. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  155. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  156. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf16.js +197 -0
  157. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf32.js +319 -0
  158. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf7.js +290 -0
  159. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/bom-handling.js +52 -0
  160. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.d.ts +41 -0
  161. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.js +180 -0
  162. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/streams.js +109 -0
  163. package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/package.json +44 -0
  164. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var fs = require('fs');
5
+ var acorn = require('./acorn.js');
6
+
7
+ var infile, forceFile, silent = false, compact = false, tokenize = false;
8
+ var options = {};
9
+
10
+ function help(status) {
11
+ var print = (status === 0) ? console.log : console.error;
12
+ print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
13
+ print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
14
+ process.exit(status);
15
+ }
16
+
17
+ for (var i = 2; i < process.argv.length; ++i) {
18
+ var arg = process.argv[i];
19
+ if ((arg === "-" || arg[0] !== "-") && !infile) { infile = arg; }
20
+ else if (arg === "--" && !infile && i + 2 === process.argv.length) { forceFile = infile = process.argv[++i]; }
21
+ else if (arg === "--locations") { options.locations = true; }
22
+ else if (arg === "--allow-hash-bang") { options.allowHashBang = true; }
23
+ else if (arg === "--silent") { silent = true; }
24
+ else if (arg === "--compact") { compact = true; }
25
+ else if (arg === "--help") { help(0); }
26
+ else if (arg === "--tokenize") { tokenize = true; }
27
+ else if (arg === "--module") { options.sourceType = "module"; }
28
+ else {
29
+ var match = arg.match(/^--ecma(\d+)$/);
30
+ if (match)
31
+ { options.ecmaVersion = +match[1]; }
32
+ else
33
+ { help(1); }
34
+ }
35
+ }
36
+
37
+ function run(code) {
38
+ var result;
39
+ try {
40
+ if (!tokenize) {
41
+ result = acorn.parse(code, options);
42
+ } else {
43
+ result = [];
44
+ var tokenizer = acorn.tokenizer(code, options), token;
45
+ do {
46
+ token = tokenizer.getToken();
47
+ result.push(token);
48
+ } while (token.type !== acorn.tokTypes.eof)
49
+ }
50
+ } catch (e) {
51
+ console.error(infile && infile !== "-" ? e.message.replace(/\(\d+:\d+\)$/, function (m) { return m.slice(0, 1) + infile + " " + m.slice(1); }) : e.message);
52
+ process.exit(1);
53
+ }
54
+ if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
55
+ }
56
+
57
+ if (forceFile || infile && infile !== "-") {
58
+ run(fs.readFileSync(infile, "utf8"));
59
+ } else {
60
+ var code = "";
61
+ process.stdin.resume();
62
+ process.stdin.on("data", function (chunk) { return code += chunk; });
63
+ process.stdin.on("end", function () { return run(code); });
64
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "acorn",
3
+ "description": "ECMAScript parser",
4
+ "homepage": "https://github.com/acornjs/acorn",
5
+ "main": "dist/acorn.js",
6
+ "types": "dist/acorn.d.ts",
7
+ "module": "dist/acorn.mjs",
8
+ "version": "7.4.1",
9
+ "engines": {"node": ">=0.4.0"},
10
+ "maintainers": [
11
+ {
12
+ "name": "Marijn Haverbeke",
13
+ "email": "marijnh@gmail.com",
14
+ "web": "https://marijnhaverbeke.nl"
15
+ },
16
+ {
17
+ "name": "Ingvar Stepanyan",
18
+ "email": "me@rreverser.com",
19
+ "web": "https://rreverser.com/"
20
+ },
21
+ {
22
+ "name": "Adrian Heine",
23
+ "web": "http://adrianheine.de"
24
+ }
25
+ ],
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/acornjs/acorn.git"
29
+ },
30
+ "license": "MIT",
31
+ "scripts": {
32
+ "prepare": "cd ..; npm run build:main && npm run build:bin"
33
+ },
34
+ "bin": {"acorn": "./bin/acorn"}
35
+ }
@@ -0,0 +1,20 @@
1
+ Copyright (c) Nikita Vasilyev
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,67 @@
1
+ # CSSOM
2
+
3
+ CSSOM.js is a CSS parser written in pure JavaScript. It is also a partial implementation of [CSS Object Model](http://dev.w3.org/csswg/cssom/).
4
+
5
+ CSSOM.parse("body {color: black}")
6
+ -> {
7
+ cssRules: [
8
+ {
9
+ selectorText: "body",
10
+ style: {
11
+ 0: "color",
12
+ color: "black",
13
+ length: 1
14
+ }
15
+ }
16
+ ]
17
+ }
18
+
19
+
20
+ ## [Parser demo](http://nv.github.com/CSSOM/docs/parse.html)
21
+
22
+ Works well in Google Chrome 6+, Safari 5+, Firefox 3.6+, Opera 10.63+.
23
+ Doesn't work in IE < 9 because of unsupported getters/setters.
24
+
25
+ To use CSSOM.js in the browser you might want to build a one-file version that exposes a single `CSSOM` global variable:
26
+
27
+ ➤ git clone https://github.com/NV/CSSOM.git
28
+ ➤ cd CSSOM
29
+ ➤ node build.js
30
+ build/CSSOM.js is done
31
+
32
+ To use it with Node.js or any other CommonJS loader:
33
+
34
+ ➤ npm install cssom
35
+
36
+ ## Don’t use it if...
37
+
38
+ You parse CSS to mungle, minify or reformat code like this:
39
+
40
+ ```css
41
+ div {
42
+ background: gray;
43
+ background: linear-gradient(to bottom, white 0%, black 100%);
44
+ }
45
+ ```
46
+
47
+ This pattern is often used to give browsers that don’t understand linear gradients a fallback solution (e.g. gray color in the example).
48
+ In CSSOM, `background: gray` [gets overwritten](http://nv.github.io/CSSOM/docs/parse.html#css=div%20%7B%0A%20%20%20%20%20%20background%3A%20gray%3B%0A%20%20%20%20background%3A%20linear-gradient(to%20bottom%2C%20white%200%25%2C%20black%20100%25)%3B%0A%7D).
49
+ It doesn't get preserved.
50
+
51
+ If you do CSS mungling, minification, image inlining, and such, CSSOM.js is no good for you, considere using one of the following:
52
+
53
+ * [postcss](https://github.com/postcss/postcss)
54
+ * [reworkcss/css](https://github.com/reworkcss/css)
55
+ * [csso](https://github.com/css/csso)
56
+ * [mensch](https://github.com/brettstimmerman/mensch)
57
+
58
+
59
+ ## [Tests](http://nv.github.com/CSSOM/spec/)
60
+
61
+ To run tests locally:
62
+
63
+ ➤ git submodule init
64
+ ➤ git submodule update
65
+
66
+
67
+ ## [Who uses CSSOM.js](https://github.com/NV/CSSOM/wiki/Who-uses-CSSOM.js)
@@ -0,0 +1,39 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ MatcherList: require("./MatcherList").MatcherList
5
+ };
6
+ ///CommonJS
7
+
8
+
9
+ /**
10
+ * @constructor
11
+ * @see https://developer.mozilla.org/en/CSS/@-moz-document
12
+ */
13
+ CSSOM.CSSDocumentRule = function CSSDocumentRule() {
14
+ CSSOM.CSSRule.call(this);
15
+ this.matcher = new CSSOM.MatcherList();
16
+ this.cssRules = [];
17
+ };
18
+
19
+ CSSOM.CSSDocumentRule.prototype = new CSSOM.CSSRule();
20
+ CSSOM.CSSDocumentRule.prototype.constructor = CSSOM.CSSDocumentRule;
21
+ CSSOM.CSSDocumentRule.prototype.type = 10;
22
+ //FIXME
23
+ //CSSOM.CSSDocumentRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
24
+ //CSSOM.CSSDocumentRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
25
+
26
+ Object.defineProperty(CSSOM.CSSDocumentRule.prototype, "cssText", {
27
+ get: function() {
28
+ var cssTexts = [];
29
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
30
+ cssTexts.push(this.cssRules[i].cssText);
31
+ }
32
+ return "@-moz-document " + this.matcher.matcherText + " {" + cssTexts.join("") + "}";
33
+ }
34
+ });
35
+
36
+
37
+ //.CommonJS
38
+ exports.CSSDocumentRule = CSSOM.CSSDocumentRule;
39
+ ///CommonJS
@@ -0,0 +1,36 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSStyleDeclaration: require("./CSSStyleDeclaration").CSSStyleDeclaration,
4
+ CSSRule: require("./CSSRule").CSSRule
5
+ };
6
+ ///CommonJS
7
+
8
+
9
+ /**
10
+ * @constructor
11
+ * @see http://dev.w3.org/csswg/cssom/#css-font-face-rule
12
+ */
13
+ CSSOM.CSSFontFaceRule = function CSSFontFaceRule() {
14
+ CSSOM.CSSRule.call(this);
15
+ this.style = new CSSOM.CSSStyleDeclaration();
16
+ this.style.parentRule = this;
17
+ };
18
+
19
+ CSSOM.CSSFontFaceRule.prototype = new CSSOM.CSSRule();
20
+ CSSOM.CSSFontFaceRule.prototype.constructor = CSSOM.CSSFontFaceRule;
21
+ CSSOM.CSSFontFaceRule.prototype.type = 5;
22
+ //FIXME
23
+ //CSSOM.CSSFontFaceRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
24
+ //CSSOM.CSSFontFaceRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
25
+
26
+ // http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSFontFaceRule.cpp
27
+ Object.defineProperty(CSSOM.CSSFontFaceRule.prototype, "cssText", {
28
+ get: function() {
29
+ return "@font-face {" + this.style.cssText + "}";
30
+ }
31
+ });
32
+
33
+
34
+ //.CommonJS
35
+ exports.CSSFontFaceRule = CSSOM.CSSFontFaceRule;
36
+ ///CommonJS
@@ -0,0 +1,37 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule
4
+ };
5
+ ///CommonJS
6
+
7
+
8
+ /**
9
+ * @constructor
10
+ * @see http://www.w3.org/TR/shadow-dom/#host-at-rule
11
+ */
12
+ CSSOM.CSSHostRule = function CSSHostRule() {
13
+ CSSOM.CSSRule.call(this);
14
+ this.cssRules = [];
15
+ };
16
+
17
+ CSSOM.CSSHostRule.prototype = new CSSOM.CSSRule();
18
+ CSSOM.CSSHostRule.prototype.constructor = CSSOM.CSSHostRule;
19
+ CSSOM.CSSHostRule.prototype.type = 1001;
20
+ //FIXME
21
+ //CSSOM.CSSHostRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
22
+ //CSSOM.CSSHostRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
23
+
24
+ Object.defineProperty(CSSOM.CSSHostRule.prototype, "cssText", {
25
+ get: function() {
26
+ var cssTexts = [];
27
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
28
+ cssTexts.push(this.cssRules[i].cssText);
29
+ }
30
+ return "@host {" + cssTexts.join("") + "}";
31
+ }
32
+ });
33
+
34
+
35
+ //.CommonJS
36
+ exports.CSSHostRule = CSSOM.CSSHostRule;
37
+ ///CommonJS
@@ -0,0 +1,132 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ CSSStyleSheet: require("./CSSStyleSheet").CSSStyleSheet,
5
+ MediaList: require("./MediaList").MediaList
6
+ };
7
+ ///CommonJS
8
+
9
+
10
+ /**
11
+ * @constructor
12
+ * @see http://dev.w3.org/csswg/cssom/#cssimportrule
13
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSImportRule
14
+ */
15
+ CSSOM.CSSImportRule = function CSSImportRule() {
16
+ CSSOM.CSSRule.call(this);
17
+ this.href = "";
18
+ this.media = new CSSOM.MediaList();
19
+ this.styleSheet = new CSSOM.CSSStyleSheet();
20
+ };
21
+
22
+ CSSOM.CSSImportRule.prototype = new CSSOM.CSSRule();
23
+ CSSOM.CSSImportRule.prototype.constructor = CSSOM.CSSImportRule;
24
+ CSSOM.CSSImportRule.prototype.type = 3;
25
+
26
+ Object.defineProperty(CSSOM.CSSImportRule.prototype, "cssText", {
27
+ get: function() {
28
+ var mediaText = this.media.mediaText;
29
+ return "@import url(" + this.href + ")" + (mediaText ? " " + mediaText : "") + ";";
30
+ },
31
+ set: function(cssText) {
32
+ var i = 0;
33
+
34
+ /**
35
+ * @import url(partial.css) screen, handheld;
36
+ * || |
37
+ * after-import media
38
+ * |
39
+ * url
40
+ */
41
+ var state = '';
42
+
43
+ var buffer = '';
44
+ var index;
45
+ for (var character; (character = cssText.charAt(i)); i++) {
46
+
47
+ switch (character) {
48
+ case ' ':
49
+ case '\t':
50
+ case '\r':
51
+ case '\n':
52
+ case '\f':
53
+ if (state === 'after-import') {
54
+ state = 'url';
55
+ } else {
56
+ buffer += character;
57
+ }
58
+ break;
59
+
60
+ case '@':
61
+ if (!state && cssText.indexOf('@import', i) === i) {
62
+ state = 'after-import';
63
+ i += 'import'.length;
64
+ buffer = '';
65
+ }
66
+ break;
67
+
68
+ case 'u':
69
+ if (state === 'url' && cssText.indexOf('url(', i) === i) {
70
+ index = cssText.indexOf(')', i + 1);
71
+ if (index === -1) {
72
+ throw i + ': ")" not found';
73
+ }
74
+ i += 'url('.length;
75
+ var url = cssText.slice(i, index);
76
+ if (url[0] === url[url.length - 1]) {
77
+ if (url[0] === '"' || url[0] === "'") {
78
+ url = url.slice(1, -1);
79
+ }
80
+ }
81
+ this.href = url;
82
+ i = index;
83
+ state = 'media';
84
+ }
85
+ break;
86
+
87
+ case '"':
88
+ if (state === 'url') {
89
+ index = cssText.indexOf('"', i + 1);
90
+ if (!index) {
91
+ throw i + ": '\"' not found";
92
+ }
93
+ this.href = cssText.slice(i + 1, index);
94
+ i = index;
95
+ state = 'media';
96
+ }
97
+ break;
98
+
99
+ case "'":
100
+ if (state === 'url') {
101
+ index = cssText.indexOf("'", i + 1);
102
+ if (!index) {
103
+ throw i + ': "\'" not found';
104
+ }
105
+ this.href = cssText.slice(i + 1, index);
106
+ i = index;
107
+ state = 'media';
108
+ }
109
+ break;
110
+
111
+ case ';':
112
+ if (state === 'media') {
113
+ if (buffer) {
114
+ this.media.mediaText = buffer.trim();
115
+ }
116
+ }
117
+ break;
118
+
119
+ default:
120
+ if (state === 'media') {
121
+ buffer += character;
122
+ }
123
+ break;
124
+ }
125
+ }
126
+ }
127
+ });
128
+
129
+
130
+ //.CommonJS
131
+ exports.CSSImportRule = CSSOM.CSSImportRule;
132
+ ///CommonJS
@@ -0,0 +1,37 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ CSSStyleDeclaration: require('./CSSStyleDeclaration').CSSStyleDeclaration
5
+ };
6
+ ///CommonJS
7
+
8
+
9
+ /**
10
+ * @constructor
11
+ * @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframeRule
12
+ */
13
+ CSSOM.CSSKeyframeRule = function CSSKeyframeRule() {
14
+ CSSOM.CSSRule.call(this);
15
+ this.keyText = '';
16
+ this.style = new CSSOM.CSSStyleDeclaration();
17
+ this.style.parentRule = this;
18
+ };
19
+
20
+ CSSOM.CSSKeyframeRule.prototype = new CSSOM.CSSRule();
21
+ CSSOM.CSSKeyframeRule.prototype.constructor = CSSOM.CSSKeyframeRule;
22
+ CSSOM.CSSKeyframeRule.prototype.type = 9;
23
+ //FIXME
24
+ //CSSOM.CSSKeyframeRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
25
+ //CSSOM.CSSKeyframeRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
26
+
27
+ // http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframeRule.cpp
28
+ Object.defineProperty(CSSOM.CSSKeyframeRule.prototype, "cssText", {
29
+ get: function() {
30
+ return this.keyText + " {" + this.style.cssText + "} ";
31
+ }
32
+ });
33
+
34
+
35
+ //.CommonJS
36
+ exports.CSSKeyframeRule = CSSOM.CSSKeyframeRule;
37
+ ///CommonJS
@@ -0,0 +1,39 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule
4
+ };
5
+ ///CommonJS
6
+
7
+
8
+ /**
9
+ * @constructor
10
+ * @see http://www.w3.org/TR/css3-animations/#DOM-CSSKeyframesRule
11
+ */
12
+ CSSOM.CSSKeyframesRule = function CSSKeyframesRule() {
13
+ CSSOM.CSSRule.call(this);
14
+ this.name = '';
15
+ this.cssRules = [];
16
+ };
17
+
18
+ CSSOM.CSSKeyframesRule.prototype = new CSSOM.CSSRule();
19
+ CSSOM.CSSKeyframesRule.prototype.constructor = CSSOM.CSSKeyframesRule;
20
+ CSSOM.CSSKeyframesRule.prototype.type = 8;
21
+ //FIXME
22
+ //CSSOM.CSSKeyframesRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
23
+ //CSSOM.CSSKeyframesRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
24
+
25
+ // http://www.opensource.apple.com/source/WebCore/WebCore-955.66.1/css/WebKitCSSKeyframesRule.cpp
26
+ Object.defineProperty(CSSOM.CSSKeyframesRule.prototype, "cssText", {
27
+ get: function() {
28
+ var cssTexts = [];
29
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
30
+ cssTexts.push(" " + this.cssRules[i].cssText);
31
+ }
32
+ return "@" + (this._vendorPrefix || '') + "keyframes " + this.name + " { \n" + cssTexts.join("\n") + "\n}";
33
+ }
34
+ });
35
+
36
+
37
+ //.CommonJS
38
+ exports.CSSKeyframesRule = CSSOM.CSSKeyframesRule;
39
+ ///CommonJS
@@ -0,0 +1,41 @@
1
+ //.CommonJS
2
+ var CSSOM = {
3
+ CSSRule: require("./CSSRule").CSSRule,
4
+ MediaList: require("./MediaList").MediaList
5
+ };
6
+ ///CommonJS
7
+
8
+
9
+ /**
10
+ * @constructor
11
+ * @see http://dev.w3.org/csswg/cssom/#cssmediarule
12
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSMediaRule
13
+ */
14
+ CSSOM.CSSMediaRule = function CSSMediaRule() {
15
+ CSSOM.CSSRule.call(this);
16
+ this.media = new CSSOM.MediaList();
17
+ this.cssRules = [];
18
+ };
19
+
20
+ CSSOM.CSSMediaRule.prototype = new CSSOM.CSSRule();
21
+ CSSOM.CSSMediaRule.prototype.constructor = CSSOM.CSSMediaRule;
22
+ CSSOM.CSSMediaRule.prototype.type = 4;
23
+ //FIXME
24
+ //CSSOM.CSSMediaRule.prototype.insertRule = CSSStyleSheet.prototype.insertRule;
25
+ //CSSOM.CSSMediaRule.prototype.deleteRule = CSSStyleSheet.prototype.deleteRule;
26
+
27
+ // http://opensource.apple.com/source/WebCore/WebCore-658.28/css/CSSMediaRule.cpp
28
+ Object.defineProperty(CSSOM.CSSMediaRule.prototype, "cssText", {
29
+ get: function() {
30
+ var cssTexts = [];
31
+ for (var i=0, length=this.cssRules.length; i < length; i++) {
32
+ cssTexts.push(this.cssRules[i].cssText);
33
+ }
34
+ return "@media " + this.media.mediaText + " {" + cssTexts.join("") + "}";
35
+ }
36
+ });
37
+
38
+
39
+ //.CommonJS
40
+ exports.CSSMediaRule = CSSOM.CSSMediaRule;
41
+ ///CommonJS
@@ -0,0 +1,43 @@
1
+ //.CommonJS
2
+ var CSSOM = {};
3
+ ///CommonJS
4
+
5
+
6
+ /**
7
+ * @constructor
8
+ * @see http://dev.w3.org/csswg/cssom/#the-cssrule-interface
9
+ * @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSRule
10
+ */
11
+ CSSOM.CSSRule = function CSSRule() {
12
+ this.parentRule = null;
13
+ this.parentStyleSheet = null;
14
+ };
15
+
16
+ CSSOM.CSSRule.UNKNOWN_RULE = 0; // obsolete
17
+ CSSOM.CSSRule.STYLE_RULE = 1;
18
+ CSSOM.CSSRule.CHARSET_RULE = 2; // obsolete
19
+ CSSOM.CSSRule.IMPORT_RULE = 3;
20
+ CSSOM.CSSRule.MEDIA_RULE = 4;
21
+ CSSOM.CSSRule.FONT_FACE_RULE = 5;
22
+ CSSOM.CSSRule.PAGE_RULE = 6;
23
+ CSSOM.CSSRule.KEYFRAMES_RULE = 7;
24
+ CSSOM.CSSRule.KEYFRAME_RULE = 8;
25
+ CSSOM.CSSRule.MARGIN_RULE = 9;
26
+ CSSOM.CSSRule.NAMESPACE_RULE = 10;
27
+ CSSOM.CSSRule.COUNTER_STYLE_RULE = 11;
28
+ CSSOM.CSSRule.SUPPORTS_RULE = 12;
29
+ CSSOM.CSSRule.DOCUMENT_RULE = 13;
30
+ CSSOM.CSSRule.FONT_FEATURE_VALUES_RULE = 14;
31
+ CSSOM.CSSRule.VIEWPORT_RULE = 15;
32
+ CSSOM.CSSRule.REGION_STYLE_RULE = 16;
33
+
34
+
35
+ CSSOM.CSSRule.prototype = {
36
+ constructor: CSSOM.CSSRule
37
+ //FIXME
38
+ };
39
+
40
+
41
+ //.CommonJS
42
+ exports.CSSRule = CSSOM.CSSRule;
43
+ ///CommonJS