@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.
- package/.github/actions/lint-css/action.yaml +1 -3
- package/.release-it.json +2 -1
- package/dist/cli.js +3 -3
- package/dist/wysiwyg.css +24 -25
- package/dist/wysiwyg.mjs +641 -618
- package/jest.config.js +3 -0
- package/lib/components/base/Modal.vue +21 -2
- package/lib/components/base/__tests__/Modal.test.js +1 -0
- package/lib/components/toolbar/controls/link/LinkControl.vue +22 -10
- package/lib/components/toolbar/controls/link/LinkControlHeader.vue +3 -3
- package/lib/components/toolbar/controls/link/__tests__/LinkControl.test.js +8 -8
- package/lib/components/toolbar/controls/link/__tests__/LinkControlHeader.test.js +1 -1
- package/lib/components/toolbar/controls/link/composables/useLink.js +10 -6
- package/lib/composables/__tests__/__snapshots__/useEditor.test.js.snap +1 -1
- package/lib/composables/useEditor.js +4 -3
- package/lib/enums/TextSettings.js +2 -0
- package/lib/extensions/FontStyle.js +2 -2
- package/lib/extensions/FontWeight.js +2 -0
- package/lib/extensions/Link.js +13 -15
- package/lib/extensions/StylePreset.js +33 -3
- package/lib/extensions/TextDecoration.js +6 -12
- package/lib/extensions/__tests__/FontFamily.test.js +7 -6
- package/lib/extensions/__tests__/FontWeight.test.js +19 -10
- package/lib/extensions/__tests__/StylePreset.test.js +52 -2
- package/lib/extensions/__tests__/TextDecoration.test.js +11 -40
- package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +2 -2
- package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +1 -1
- package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +1 -1
- package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +19 -1
- package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +2 -2
- package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +17 -1
- package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +26 -1
- package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +2 -2
- package/lib/extensions/__tests__/__snapshots__/Margin.test.js.snap +2 -2
- package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +22 -2
- package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +3 -46
- package/package.json +22 -22
- package/lib/components/toolbar/controls/link/LinkControlApply.vue +0 -35
- package/node_modules_lambda/acorn-globals/node_modules/.bin/acorn +0 -4
- package/node_modules_lambda/acorn-globals/node_modules/acorn/CHANGELOG.md +0 -620
- package/node_modules_lambda/acorn-globals/node_modules/acorn/LICENSE +0 -21
- package/node_modules_lambda/acorn-globals/node_modules/acorn/README.md +0 -269
- package/node_modules_lambda/acorn-globals/node_modules/acorn/bin/acorn +0 -4
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.d.ts +0 -209
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js +0 -5186
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.js.map +0 -1
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs +0 -5155
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.d.ts +0 -2
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/acorn.mjs.map +0 -1
- package/node_modules_lambda/acorn-globals/node_modules/acorn/dist/bin.js +0 -64
- package/node_modules_lambda/acorn-globals/node_modules/acorn/package.json +0 -35
- package/node_modules_lambda/cssstyle/node_modules/cssom/LICENSE.txt +0 -20
- package/node_modules_lambda/cssstyle/node_modules/cssom/README.mdown +0 -67
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSDocumentRule.js +0 -39
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSFontFaceRule.js +0 -36
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSHostRule.js +0 -37
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSImportRule.js +0 -132
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframeRule.js +0 -37
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSKeyframesRule.js +0 -39
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSMediaRule.js +0 -41
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSOM.js +0 -3
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSRule.js +0 -43
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleDeclaration.js +0 -148
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleRule.js +0 -190
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSStyleSheet.js +0 -88
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSSupportsRule.js +0 -36
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValue.js +0 -43
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/CSSValueExpression.js +0 -344
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MatcherList.js +0 -62
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/MediaList.js +0 -61
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/StyleSheet.js +0 -17
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/clone.js +0 -82
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/index.js +0 -21
- package/node_modules_lambda/cssstyle/node_modules/cssom/lib/parse.js +0 -464
- package/node_modules_lambda/cssstyle/node_modules/cssom/package.json +0 -18
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/LICENSE.txt +0 -21
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/README.md +0 -106
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/index.js +0 -27
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/Function.js +0 -42
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL-impl.js +0 -209
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URL.js +0 -442
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams-impl.js +0 -130
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/URLSearchParams.js +0 -472
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/VoidFunction.js +0 -26
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/encoding.js +0 -16
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/infra.js +0 -26
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/percent-encoding.js +0 -142
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/url-state-machine.js +0 -1244
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/urlencoded.js +0 -106
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/lib/utils.js +0 -190
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/package.json +0 -58
- package/node_modules_lambda/data-urls/node_modules/whatwg-url/webidl2js-wrapper.js +0 -7
- package/node_modules_lambda/escodegen/node_modules/estraverse/.jshintrc +0 -16
- package/node_modules_lambda/escodegen/node_modules/estraverse/LICENSE.BSD +0 -19
- package/node_modules_lambda/escodegen/node_modules/estraverse/README.md +0 -153
- package/node_modules_lambda/escodegen/node_modules/estraverse/estraverse.js +0 -805
- package/node_modules_lambda/escodegen/node_modules/estraverse/gulpfile.js +0 -70
- package/node_modules_lambda/escodegen/node_modules/estraverse/package.json +0 -40
- package/node_modules_lambda/escodegen/node_modules/levn/LICENSE +0 -22
- package/node_modules_lambda/escodegen/node_modules/levn/README.md +0 -196
- package/node_modules_lambda/escodegen/node_modules/levn/lib/cast.js +0 -298
- package/node_modules_lambda/escodegen/node_modules/levn/lib/coerce.js +0 -285
- package/node_modules_lambda/escodegen/node_modules/levn/lib/index.js +0 -22
- package/node_modules_lambda/escodegen/node_modules/levn/lib/parse-string.js +0 -113
- package/node_modules_lambda/escodegen/node_modules/levn/lib/parse.js +0 -102
- package/node_modules_lambda/escodegen/node_modules/levn/package.json +0 -47
- package/node_modules_lambda/escodegen/node_modules/optionator/CHANGELOG.md +0 -56
- package/node_modules_lambda/escodegen/node_modules/optionator/LICENSE +0 -22
- package/node_modules_lambda/escodegen/node_modules/optionator/README.md +0 -238
- package/node_modules_lambda/escodegen/node_modules/optionator/lib/help.js +0 -260
- package/node_modules_lambda/escodegen/node_modules/optionator/lib/index.js +0 -465
- package/node_modules_lambda/escodegen/node_modules/optionator/lib/util.js +0 -54
- package/node_modules_lambda/escodegen/node_modules/optionator/package.json +0 -44
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/CHANGELOG.md +0 -99
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/LICENSE +0 -22
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/README.md +0 -15
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Func.js +0 -65
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/List.js +0 -686
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Num.js +0 -130
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Obj.js +0 -154
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/Str.js +0 -92
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/lib/index.js +0 -178
- package/node_modules_lambda/escodegen/node_modules/prelude-ls/package.json +0 -52
- package/node_modules_lambda/escodegen/node_modules/source-map/CHANGELOG.md +0 -301
- package/node_modules_lambda/escodegen/node_modules/source-map/LICENSE +0 -28
- package/node_modules_lambda/escodegen/node_modules/source-map/README.md +0 -742
- package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.debug.js +0 -3234
- package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.js +0 -3233
- package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js +0 -2
- package/node_modules_lambda/escodegen/node_modules/source-map/dist/source-map.min.js.map +0 -1
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/array-set.js +0 -121
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64-vlq.js +0 -140
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/base64.js +0 -67
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/binary-search.js +0 -111
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/mapping-list.js +0 -79
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/quick-sort.js +0 -114
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-consumer.js +0 -1145
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-map-generator.js +0 -425
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/source-node.js +0 -413
- package/node_modules_lambda/escodegen/node_modules/source-map/lib/util.js +0 -488
- package/node_modules_lambda/escodegen/node_modules/source-map/package.json +0 -73
- package/node_modules_lambda/escodegen/node_modules/source-map/source-map.d.ts +0 -98
- package/node_modules_lambda/escodegen/node_modules/source-map/source-map.js +0 -8
- package/node_modules_lambda/escodegen/node_modules/type-check/LICENSE +0 -22
- package/node_modules_lambda/escodegen/node_modules/type-check/README.md +0 -210
- package/node_modules_lambda/escodegen/node_modules/type-check/lib/check.js +0 -126
- package/node_modules_lambda/escodegen/node_modules/type-check/lib/index.js +0 -16
- package/node_modules_lambda/escodegen/node_modules/type-check/lib/parse-type.js +0 -196
- package/node_modules_lambda/escodegen/node_modules/type-check/package.json +0 -40
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/.github/dependabot.yml +0 -11
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/Changelog.md +0 -212
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/LICENSE +0 -21
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/README.md +0 -130
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -597
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/dbcs-data.js +0 -188
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/index.js +0 -23
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/internal.js +0 -198
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/sbcs-data.js +0 -179
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf16.js +0 -197
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf32.js +0 -319
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/encodings/utf7.js +0 -290
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/bom-handling.js +0 -52
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.d.ts +0 -41
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/index.js +0 -180
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/lib/streams.js +0 -109
- package/node_modules_lambda/whatwg-encoding/node_modules/iconv-lite/package.json +0 -44
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
//.CommonJS
|
|
2
|
-
var CSSOM = {};
|
|
3
|
-
///CommonJS
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @constructor
|
|
8
|
-
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration
|
|
9
|
-
*/
|
|
10
|
-
CSSOM.CSSStyleDeclaration = function CSSStyleDeclaration(){
|
|
11
|
-
this.length = 0;
|
|
12
|
-
this.parentRule = null;
|
|
13
|
-
|
|
14
|
-
// NON-STANDARD
|
|
15
|
-
this._importants = {};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
CSSOM.CSSStyleDeclaration.prototype = {
|
|
20
|
-
|
|
21
|
-
constructor: CSSOM.CSSStyleDeclaration,
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @param {string} name
|
|
26
|
-
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-getPropertyValue
|
|
27
|
-
* @return {string} the value of the property if it has been explicitly set for this declaration block.
|
|
28
|
-
* Returns the empty string if the property has not been set.
|
|
29
|
-
*/
|
|
30
|
-
getPropertyValue: function(name) {
|
|
31
|
-
return this[name] || "";
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
* @param {string} name
|
|
37
|
-
* @param {string} value
|
|
38
|
-
* @param {string} [priority=null] "important" or null
|
|
39
|
-
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-setProperty
|
|
40
|
-
*/
|
|
41
|
-
setProperty: function(name, value, priority) {
|
|
42
|
-
if (this[name]) {
|
|
43
|
-
// Property already exist. Overwrite it.
|
|
44
|
-
var index = Array.prototype.indexOf.call(this, name);
|
|
45
|
-
if (index < 0) {
|
|
46
|
-
this[this.length] = name;
|
|
47
|
-
this.length++;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
// New property.
|
|
51
|
-
this[this.length] = name;
|
|
52
|
-
this.length++;
|
|
53
|
-
}
|
|
54
|
-
this[name] = value + "";
|
|
55
|
-
this._importants[name] = priority;
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
* @param {string} name
|
|
61
|
-
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration-removeProperty
|
|
62
|
-
* @return {string} the value of the property if it has been explicitly set for this declaration block.
|
|
63
|
-
* Returns the empty string if the property has not been set or the property name does not correspond to a known CSS property.
|
|
64
|
-
*/
|
|
65
|
-
removeProperty: function(name) {
|
|
66
|
-
if (!(name in this)) {
|
|
67
|
-
return "";
|
|
68
|
-
}
|
|
69
|
-
var index = Array.prototype.indexOf.call(this, name);
|
|
70
|
-
if (index < 0) {
|
|
71
|
-
return "";
|
|
72
|
-
}
|
|
73
|
-
var prevValue = this[name];
|
|
74
|
-
this[name] = "";
|
|
75
|
-
|
|
76
|
-
// That's what WebKit and Opera do
|
|
77
|
-
Array.prototype.splice.call(this, index, 1);
|
|
78
|
-
|
|
79
|
-
// That's what Firefox does
|
|
80
|
-
//this[index] = ""
|
|
81
|
-
|
|
82
|
-
return prevValue;
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
getPropertyCSSValue: function() {
|
|
86
|
-
//FIXME
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
*
|
|
91
|
-
* @param {String} name
|
|
92
|
-
*/
|
|
93
|
-
getPropertyPriority: function(name) {
|
|
94
|
-
return this._importants[name] || "";
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* element.style.overflow = "auto"
|
|
100
|
-
* element.style.getPropertyShorthand("overflow-x")
|
|
101
|
-
* -> "overflow"
|
|
102
|
-
*/
|
|
103
|
-
getPropertyShorthand: function() {
|
|
104
|
-
//FIXME
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
isPropertyImplicit: function() {
|
|
108
|
-
//FIXME
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
// Doesn't work in IE < 9
|
|
112
|
-
get cssText(){
|
|
113
|
-
var properties = [];
|
|
114
|
-
for (var i=0, length=this.length; i < length; ++i) {
|
|
115
|
-
var name = this[i];
|
|
116
|
-
var value = this.getPropertyValue(name);
|
|
117
|
-
var priority = this.getPropertyPriority(name);
|
|
118
|
-
if (priority) {
|
|
119
|
-
priority = " !" + priority;
|
|
120
|
-
}
|
|
121
|
-
properties[i] = name + ": " + value + priority + ";";
|
|
122
|
-
}
|
|
123
|
-
return properties.join(" ");
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
set cssText(text){
|
|
127
|
-
var i, name;
|
|
128
|
-
for (i = this.length; i--;) {
|
|
129
|
-
name = this[i];
|
|
130
|
-
this[name] = "";
|
|
131
|
-
}
|
|
132
|
-
Array.prototype.splice.call(this, 0, this.length);
|
|
133
|
-
this._importants = {};
|
|
134
|
-
|
|
135
|
-
var dummyRule = CSSOM.parse('#bogus{' + text + '}').cssRules[0].style;
|
|
136
|
-
var length = dummyRule.length;
|
|
137
|
-
for (i = 0; i < length; ++i) {
|
|
138
|
-
name = dummyRule[i];
|
|
139
|
-
this.setProperty(dummyRule[i], dummyRule.getPropertyValue(name), dummyRule.getPropertyPriority(name));
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
//.CommonJS
|
|
146
|
-
exports.CSSStyleDeclaration = CSSOM.CSSStyleDeclaration;
|
|
147
|
-
CSSOM.parse = require('./parse').parse; // Cannot be included sooner due to the mutual dependency between parse.js and CSSStyleDeclaration.js
|
|
148
|
-
///CommonJS
|
|
@@ -1,190 +0,0 @@
|
|
|
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/#cssstylerule
|
|
12
|
-
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleRule
|
|
13
|
-
*/
|
|
14
|
-
CSSOM.CSSStyleRule = function CSSStyleRule() {
|
|
15
|
-
CSSOM.CSSRule.call(this);
|
|
16
|
-
this.selectorText = "";
|
|
17
|
-
this.style = new CSSOM.CSSStyleDeclaration();
|
|
18
|
-
this.style.parentRule = this;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
CSSOM.CSSStyleRule.prototype = new CSSOM.CSSRule();
|
|
22
|
-
CSSOM.CSSStyleRule.prototype.constructor = CSSOM.CSSStyleRule;
|
|
23
|
-
CSSOM.CSSStyleRule.prototype.type = 1;
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(CSSOM.CSSStyleRule.prototype, "cssText", {
|
|
26
|
-
get: function() {
|
|
27
|
-
var text;
|
|
28
|
-
if (this.selectorText) {
|
|
29
|
-
text = this.selectorText + " {" + this.style.cssText + "}";
|
|
30
|
-
} else {
|
|
31
|
-
text = "";
|
|
32
|
-
}
|
|
33
|
-
return text;
|
|
34
|
-
},
|
|
35
|
-
set: function(cssText) {
|
|
36
|
-
var rule = CSSOM.CSSStyleRule.parse(cssText);
|
|
37
|
-
this.style = rule.style;
|
|
38
|
-
this.selectorText = rule.selectorText;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* NON-STANDARD
|
|
45
|
-
* lightweight version of parse.js.
|
|
46
|
-
* @param {string} ruleText
|
|
47
|
-
* @return CSSStyleRule
|
|
48
|
-
*/
|
|
49
|
-
CSSOM.CSSStyleRule.parse = function(ruleText) {
|
|
50
|
-
var i = 0;
|
|
51
|
-
var state = "selector";
|
|
52
|
-
var index;
|
|
53
|
-
var j = i;
|
|
54
|
-
var buffer = "";
|
|
55
|
-
|
|
56
|
-
var SIGNIFICANT_WHITESPACE = {
|
|
57
|
-
"selector": true,
|
|
58
|
-
"value": true
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
var styleRule = new CSSOM.CSSStyleRule();
|
|
62
|
-
var name, priority="";
|
|
63
|
-
|
|
64
|
-
for (var character; (character = ruleText.charAt(i)); i++) {
|
|
65
|
-
|
|
66
|
-
switch (character) {
|
|
67
|
-
|
|
68
|
-
case " ":
|
|
69
|
-
case "\t":
|
|
70
|
-
case "\r":
|
|
71
|
-
case "\n":
|
|
72
|
-
case "\f":
|
|
73
|
-
if (SIGNIFICANT_WHITESPACE[state]) {
|
|
74
|
-
// Squash 2 or more white-spaces in the row into 1
|
|
75
|
-
switch (ruleText.charAt(i - 1)) {
|
|
76
|
-
case " ":
|
|
77
|
-
case "\t":
|
|
78
|
-
case "\r":
|
|
79
|
-
case "\n":
|
|
80
|
-
case "\f":
|
|
81
|
-
break;
|
|
82
|
-
default:
|
|
83
|
-
buffer += " ";
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
break;
|
|
88
|
-
|
|
89
|
-
// String
|
|
90
|
-
case '"':
|
|
91
|
-
j = i + 1;
|
|
92
|
-
index = ruleText.indexOf('"', j) + 1;
|
|
93
|
-
if (!index) {
|
|
94
|
-
throw '" is missing';
|
|
95
|
-
}
|
|
96
|
-
buffer += ruleText.slice(i, index);
|
|
97
|
-
i = index - 1;
|
|
98
|
-
break;
|
|
99
|
-
|
|
100
|
-
case "'":
|
|
101
|
-
j = i + 1;
|
|
102
|
-
index = ruleText.indexOf("'", j) + 1;
|
|
103
|
-
if (!index) {
|
|
104
|
-
throw "' is missing";
|
|
105
|
-
}
|
|
106
|
-
buffer += ruleText.slice(i, index);
|
|
107
|
-
i = index - 1;
|
|
108
|
-
break;
|
|
109
|
-
|
|
110
|
-
// Comment
|
|
111
|
-
case "/":
|
|
112
|
-
if (ruleText.charAt(i + 1) === "*") {
|
|
113
|
-
i += 2;
|
|
114
|
-
index = ruleText.indexOf("*/", i);
|
|
115
|
-
if (index === -1) {
|
|
116
|
-
throw new SyntaxError("Missing */");
|
|
117
|
-
} else {
|
|
118
|
-
i = index + 1;
|
|
119
|
-
}
|
|
120
|
-
} else {
|
|
121
|
-
buffer += character;
|
|
122
|
-
}
|
|
123
|
-
break;
|
|
124
|
-
|
|
125
|
-
case "{":
|
|
126
|
-
if (state === "selector") {
|
|
127
|
-
styleRule.selectorText = buffer.trim();
|
|
128
|
-
buffer = "";
|
|
129
|
-
state = "name";
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
|
|
133
|
-
case ":":
|
|
134
|
-
if (state === "name") {
|
|
135
|
-
name = buffer.trim();
|
|
136
|
-
buffer = "";
|
|
137
|
-
state = "value";
|
|
138
|
-
} else {
|
|
139
|
-
buffer += character;
|
|
140
|
-
}
|
|
141
|
-
break;
|
|
142
|
-
|
|
143
|
-
case "!":
|
|
144
|
-
if (state === "value" && ruleText.indexOf("!important", i) === i) {
|
|
145
|
-
priority = "important";
|
|
146
|
-
i += "important".length;
|
|
147
|
-
} else {
|
|
148
|
-
buffer += character;
|
|
149
|
-
}
|
|
150
|
-
break;
|
|
151
|
-
|
|
152
|
-
case ";":
|
|
153
|
-
if (state === "value") {
|
|
154
|
-
styleRule.style.setProperty(name, buffer.trim(), priority);
|
|
155
|
-
priority = "";
|
|
156
|
-
buffer = "";
|
|
157
|
-
state = "name";
|
|
158
|
-
} else {
|
|
159
|
-
buffer += character;
|
|
160
|
-
}
|
|
161
|
-
break;
|
|
162
|
-
|
|
163
|
-
case "}":
|
|
164
|
-
if (state === "value") {
|
|
165
|
-
styleRule.style.setProperty(name, buffer.trim(), priority);
|
|
166
|
-
priority = "";
|
|
167
|
-
buffer = "";
|
|
168
|
-
} else if (state === "name") {
|
|
169
|
-
break;
|
|
170
|
-
} else {
|
|
171
|
-
buffer += character;
|
|
172
|
-
}
|
|
173
|
-
state = "selector";
|
|
174
|
-
break;
|
|
175
|
-
|
|
176
|
-
default:
|
|
177
|
-
buffer += character;
|
|
178
|
-
break;
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return styleRule;
|
|
184
|
-
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
//.CommonJS
|
|
189
|
-
exports.CSSStyleRule = CSSOM.CSSStyleRule;
|
|
190
|
-
///CommonJS
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
//.CommonJS
|
|
2
|
-
var CSSOM = {
|
|
3
|
-
StyleSheet: require("./StyleSheet").StyleSheet,
|
|
4
|
-
CSSStyleRule: require("./CSSStyleRule").CSSStyleRule
|
|
5
|
-
};
|
|
6
|
-
///CommonJS
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @constructor
|
|
11
|
-
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet
|
|
12
|
-
*/
|
|
13
|
-
CSSOM.CSSStyleSheet = function CSSStyleSheet() {
|
|
14
|
-
CSSOM.StyleSheet.call(this);
|
|
15
|
-
this.cssRules = [];
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
CSSOM.CSSStyleSheet.prototype = new CSSOM.StyleSheet();
|
|
20
|
-
CSSOM.CSSStyleSheet.prototype.constructor = CSSOM.CSSStyleSheet;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Used to insert a new rule into the style sheet. The new rule now becomes part of the cascade.
|
|
25
|
-
*
|
|
26
|
-
* sheet = new Sheet("body {margin: 0}")
|
|
27
|
-
* sheet.toString()
|
|
28
|
-
* -> "body{margin:0;}"
|
|
29
|
-
* sheet.insertRule("img {border: none}", 0)
|
|
30
|
-
* -> 0
|
|
31
|
-
* sheet.toString()
|
|
32
|
-
* -> "img{border:none;}body{margin:0;}"
|
|
33
|
-
*
|
|
34
|
-
* @param {string} rule
|
|
35
|
-
* @param {number} index
|
|
36
|
-
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet-insertRule
|
|
37
|
-
* @return {number} The index within the style sheet's rule collection of the newly inserted rule.
|
|
38
|
-
*/
|
|
39
|
-
CSSOM.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
40
|
-
if (index < 0 || index > this.cssRules.length) {
|
|
41
|
-
throw new RangeError("INDEX_SIZE_ERR");
|
|
42
|
-
}
|
|
43
|
-
var cssRule = CSSOM.parse(rule).cssRules[0];
|
|
44
|
-
cssRule.parentStyleSheet = this;
|
|
45
|
-
this.cssRules.splice(index, 0, cssRule);
|
|
46
|
-
return index;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Used to delete a rule from the style sheet.
|
|
52
|
-
*
|
|
53
|
-
* sheet = new Sheet("img{border:none} body{margin:0}")
|
|
54
|
-
* sheet.toString()
|
|
55
|
-
* -> "img{border:none;}body{margin:0;}"
|
|
56
|
-
* sheet.deleteRule(0)
|
|
57
|
-
* sheet.toString()
|
|
58
|
-
* -> "body{margin:0;}"
|
|
59
|
-
*
|
|
60
|
-
* @param {number} index within the style sheet's rule list of the rule to remove.
|
|
61
|
-
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleSheet-deleteRule
|
|
62
|
-
*/
|
|
63
|
-
CSSOM.CSSStyleSheet.prototype.deleteRule = function(index) {
|
|
64
|
-
if (index < 0 || index >= this.cssRules.length) {
|
|
65
|
-
throw new RangeError("INDEX_SIZE_ERR");
|
|
66
|
-
}
|
|
67
|
-
this.cssRules.splice(index, 1);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* NON-STANDARD
|
|
73
|
-
* @return {string} serialize stylesheet
|
|
74
|
-
*/
|
|
75
|
-
CSSOM.CSSStyleSheet.prototype.toString = function() {
|
|
76
|
-
var result = "";
|
|
77
|
-
var rules = this.cssRules;
|
|
78
|
-
for (var i=0; i<rules.length; i++) {
|
|
79
|
-
result += rules[i].cssText + "\n";
|
|
80
|
-
}
|
|
81
|
-
return result;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
//.CommonJS
|
|
86
|
-
exports.CSSStyleSheet = CSSOM.CSSStyleSheet;
|
|
87
|
-
CSSOM.parse = require('./parse').parse; // Cannot be included sooner due to the mutual dependency between parse.js and CSSStyleSheet.js
|
|
88
|
-
///CommonJS
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//.CommonJS
|
|
2
|
-
var CSSOM = {
|
|
3
|
-
CSSRule: require("./CSSRule").CSSRule,
|
|
4
|
-
};
|
|
5
|
-
///CommonJS
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @constructor
|
|
10
|
-
* @see https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface
|
|
11
|
-
*/
|
|
12
|
-
CSSOM.CSSSupportsRule = function CSSSupportsRule() {
|
|
13
|
-
CSSOM.CSSRule.call(this);
|
|
14
|
-
this.conditionText = '';
|
|
15
|
-
this.cssRules = [];
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
CSSOM.CSSSupportsRule.prototype = new CSSOM.CSSRule();
|
|
19
|
-
CSSOM.CSSSupportsRule.prototype.constructor = CSSOM.CSSSupportsRule;
|
|
20
|
-
CSSOM.CSSSupportsRule.prototype.type = 12;
|
|
21
|
-
|
|
22
|
-
Object.defineProperty(CSSOM.CSSSupportsRule.prototype, "cssText", {
|
|
23
|
-
get: function() {
|
|
24
|
-
var cssTexts = [];
|
|
25
|
-
|
|
26
|
-
for (var i = 0, length = this.cssRules.length; i < length; i++) {
|
|
27
|
-
cssTexts.push(this.cssRules[i].cssText);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return "@supports " + this.conditionText + " {" + cssTexts.join("") + "}";
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
//.CommonJS
|
|
35
|
-
exports.CSSSupportsRule = CSSOM.CSSSupportsRule;
|
|
36
|
-
///CommonJS
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
//.CommonJS
|
|
2
|
-
var CSSOM = {};
|
|
3
|
-
///CommonJS
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @constructor
|
|
8
|
-
* @see http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue
|
|
9
|
-
*
|
|
10
|
-
* TODO: add if needed
|
|
11
|
-
*/
|
|
12
|
-
CSSOM.CSSValue = function CSSValue() {
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
CSSOM.CSSValue.prototype = {
|
|
16
|
-
constructor: CSSOM.CSSValue,
|
|
17
|
-
|
|
18
|
-
// @see: http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSValue
|
|
19
|
-
set cssText(text) {
|
|
20
|
-
var name = this._getConstructorName();
|
|
21
|
-
|
|
22
|
-
throw new Error('DOMException: property "cssText" of "' + name + '" is readonly and can not be replaced with "' + text + '"!');
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
get cssText() {
|
|
26
|
-
var name = this._getConstructorName();
|
|
27
|
-
|
|
28
|
-
throw new Error('getter "cssText" of "' + name + '" is not implemented!');
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
_getConstructorName: function() {
|
|
32
|
-
var s = this.constructor.toString(),
|
|
33
|
-
c = s.match(/function\s([^\(]+)/),
|
|
34
|
-
name = c[1];
|
|
35
|
-
|
|
36
|
-
return name;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
//.CommonJS
|
|
42
|
-
exports.CSSValue = CSSOM.CSSValue;
|
|
43
|
-
///CommonJS
|