dom-render 1.0.97 → 1.0.99
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/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/dom-render.iml +9 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/jpa-buddy.xml +6 -0
- package/.idea/misc.xml +8 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/README.MD +6 -793
- package/package.json +1 -1
- package/DomRender.d.ts +0 -13
- package/DomRender.js +0 -72
- package/DomRenderProxy.d.ts +0 -30
- package/DomRenderProxy.js +0 -510
- package/components/ComponentSet.d.ts +0 -10
- package/components/ComponentSet.js +0 -13
- package/configs/Config.d.ts +0 -34
- package/configs/Config.js +0 -2
- package/configs/TargetAttr.d.ts +0 -6
- package/configs/TargetAttr.js +0 -2
- package/configs/TargetElement.d.ts +0 -14
- package/configs/TargetElement.js +0 -2
- package/css/parse/index.d.ts +0 -1
- package/css/parse/index.js +0 -512
- package/css/stringify/compiler.d.ts +0 -32
- package/css/stringify/compiler.js +0 -40
- package/css/stringify/compress.d.ts +0 -75
- package/css/stringify/compress.js +0 -156
- package/css/stringify/identity.d.ts +0 -85
- package/css/stringify/identity.js +0 -194
- package/css/stringify/index.d.ts +0 -14
- package/css/stringify/index.js +0 -44
- package/dist/bundle.js +0 -5493
- package/events/EventManager.d.ts +0 -49
- package/events/EventManager.js +0 -529
- package/iterators/Range.d.ts +0 -23
- package/iterators/Range.js +0 -80
- package/lifecycle/OnBeforeReturnGet.d.ts +0 -3
- package/lifecycle/OnBeforeReturnGet.js +0 -2
- package/lifecycle/OnBeforeReturnSet.d.ts +0 -3
- package/lifecycle/OnBeforeReturnSet.js +0 -2
- package/lifecycle/OnChangeAttrRender.d.ts +0 -3
- package/lifecycle/OnChangeAttrRender.js +0 -2
- package/lifecycle/OnCreateRender.d.ts +0 -3
- package/lifecycle/OnCreateRender.js +0 -2
- package/lifecycle/OnDestroyRender.d.ts +0 -4
- package/lifecycle/OnDestroyRender.js +0 -2
- package/lifecycle/OnInitRender.d.ts +0 -3
- package/lifecycle/OnInitRender.js +0 -2
- package/lifecycle/OnProxyDomRender.d.ts +0 -4
- package/lifecycle/OnProxyDomRender.js +0 -2
- package/managers/RenderManager.d.ts +0 -3
- package/managers/RenderManager.js +0 -18
- package/messenger/DefaultMessenger.d.ts +0 -3
- package/messenger/DefaultMessenger.js +0 -27
- package/messenger/Messenger.d.ts +0 -78
- package/messenger/Messenger.js +0 -201
- package/operators/Appender.d.ts +0 -10
- package/operators/Appender.js +0 -64
- package/operators/AttrExpresion.d.ts +0 -0
- package/operators/AttrExpresion.js +0 -44
- package/operators/Dr.d.ts +0 -8
- package/operators/Dr.js +0 -101
- package/operators/DrAppender.d.ts +0 -8
- package/operators/DrAppender.js +0 -107
- package/operators/DrFor.d.ts +0 -8
- package/operators/DrFor.js +0 -104
- package/operators/DrForOf.d.ts +0 -8
- package/operators/DrForOf.js +0 -107
- package/operators/DrForm.d.ts +0 -8
- package/operators/DrForm.js +0 -138
- package/operators/DrIf.d.ts +0 -8
- package/operators/DrIf.js +0 -108
- package/operators/DrInnerHTML.d.ts +0 -8
- package/operators/DrInnerHTML.js +0 -99
- package/operators/DrInnerText.d.ts +0 -8
- package/operators/DrInnerText.js +0 -97
- package/operators/DrPre.d.ts +0 -7
- package/operators/DrPre.js +0 -73
- package/operators/DrRepeat.d.ts +0 -8
- package/operators/DrRepeat.js +0 -105
- package/operators/DrTargetAttr.d.ts +0 -7
- package/operators/DrTargetAttr.js +0 -98
- package/operators/DrTargetElement.d.ts +0 -7
- package/operators/DrTargetElement.js +0 -114
- package/operators/DrThis.d.ts +0 -5
- package/operators/DrThis.js +0 -108
- package/operators/DrThisProperty.d.ts +0 -10
- package/operators/DrThisProperty.js +0 -143
- package/operators/OperatorExecuter.d.ts +0 -49
- package/operators/OperatorExecuter.js +0 -89
- package/operators/OperatorExecuterAttrRequire.d.ts +0 -8
- package/operators/OperatorExecuterAttrRequire.js +0 -79
- package/rawsets/AttrInitCallBack.d.ts +0 -5
- package/rawsets/AttrInitCallBack.js +0 -2
- package/rawsets/Attrs.d.ts +0 -24
- package/rawsets/Attrs.js +0 -2
- package/rawsets/CreatorMetaData.d.ts +0 -18
- package/rawsets/CreatorMetaData.js +0 -2
- package/rawsets/DestroyOptionType.d.ts +0 -4
- package/rawsets/DestroyOptionType.js +0 -8
- package/rawsets/ElementInitCallBack.d.ts +0 -8
- package/rawsets/ElementInitCallBack.js +0 -2
- package/rawsets/RawSet.d.ts +0 -118
- package/rawsets/RawSet.js +0 -1141
- package/rawsets/RawSetOperatorType.d.ts +0 -3
- package/rawsets/RawSetOperatorType.js +0 -7
- package/rawsets/RawSetType.d.ts +0 -7
- package/rawsets/RawSetType.js +0 -11
- package/rawsets/Render.d.ts +0 -17
- package/rawsets/Render.js +0 -2
- package/routers/HashRouter.d.ts +0 -9
- package/routers/HashRouter.js +0 -53
- package/routers/PathRouter.d.ts +0 -9
- package/routers/PathRouter.js +0 -52
- package/routers/Router.d.ts +0 -28
- package/routers/Router.js +0 -126
- package/types/Types.d.ts +0 -14
- package/types/Types.js +0 -36
- package/utils/clipboard/ClipBoardUtils.d.ts +0 -6
- package/utils/clipboard/ClipBoardUtils.js +0 -25
- package/utils/dom/DomUtils.d.ts +0 -13
- package/utils/dom/DomUtils.js +0 -47
- package/utils/location/LocationUtils.d.ts +0 -16
- package/utils/location/LocationUtils.js +0 -63
- package/utils/node/NodeUtils.d.ts +0 -10
- package/utils/node/NodeUtils.js +0 -27
- package/utils/random/RandomUtils.d.ts +0 -7
- package/utils/random/RandomUtils.js +0 -47
- package/utils/script/ScriptUtils.d.ts +0 -14
- package/utils/script/ScriptUtils.js +0 -89
- package/utils/storage/StorageUtils.d.ts +0 -16
- package/utils/storage/StorageUtils.js +0 -87
- package/utils/string/StringUtils.d.ts +0 -6
- package/utils/string/StringUtils.js +0 -58
- package/utils/valid/ValidUtils.d.ts +0 -10
- package/utils/valid/ValidUtils.js +0 -78
- package/validators/AllCheckedValidatorArray.d.ts +0 -6
- package/validators/AllCheckedValidatorArray.js +0 -32
- package/validators/AllUnCheckedValidatorArray.d.ts +0 -6
- package/validators/AllUnCheckedValidatorArray.js +0 -32
- package/validators/CheckedValidator.d.ts +0 -5
- package/validators/CheckedValidator.js +0 -32
- package/validators/CountEqualsCheckedValidatorArray.d.ts +0 -7
- package/validators/CountEqualsCheckedValidatorArray.js +0 -34
- package/validators/CountEqualsUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountEqualsUnCheckedValidatorArray.js +0 -34
- package/validators/CountGreaterThanCheckedValidatorArray.d.ts +0 -7
- package/validators/CountGreaterThanCheckedValidatorArray.js +0 -34
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.d.ts +0 -7
- package/validators/CountGreaterThanEqualsCheckedValidatorArray.js +0 -34
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountGreaterThanEqualsUnCheckedValidatorArray.js +0 -34
- package/validators/CountGreaterThanUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountGreaterThanUnCheckedValidatorArray.js +0 -34
- package/validators/CountLessThanCheckedValidatorArray.d.ts +0 -7
- package/validators/CountLessThanCheckedValidatorArray.js +0 -34
- package/validators/CountLessThanEqualsCheckedValidatorArray.d.ts +0 -7
- package/validators/CountLessThanEqualsCheckedValidatorArray.js +0 -34
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountLessThanEqualsUnCheckedValidatorArray.js +0 -34
- package/validators/CountLessThanUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountLessThanUnCheckedValidatorArray.js +0 -34
- package/validators/CountUnCheckedValidatorArray.d.ts +0 -7
- package/validators/CountUnCheckedValidatorArray.js +0 -34
- package/validators/EmptyValidator.d.ts +0 -5
- package/validators/EmptyValidator.js +0 -33
- package/validators/ExcludeCheckedValidatorArray.d.ts +0 -8
- package/validators/ExcludeCheckedValidatorArray.js +0 -41
- package/validators/FormValidator.d.ts +0 -7
- package/validators/FormValidator.js +0 -37
- package/validators/IncludeCheckedValidatorArray.d.ts +0 -8
- package/validators/IncludeCheckedValidatorArray.js +0 -41
- package/validators/MultipleValidator.d.ts +0 -8
- package/validators/MultipleValidator.js +0 -48
- package/validators/NonPassValidator.d.ts +0 -5
- package/validators/NonPassValidator.js +0 -31
- package/validators/NotEmptyValidator.d.ts +0 -5
- package/validators/NotEmptyValidator.js +0 -34
- package/validators/NotRegExpTestValidator.d.ts +0 -6
- package/validators/NotRegExpTestValidator.js +0 -42
- package/validators/PassValidator.d.ts +0 -5
- package/validators/PassValidator.js +0 -31
- package/validators/RegExpTestValidator.d.ts +0 -6
- package/validators/RegExpTestValidator.js +0 -43
- package/validators/RequiredValidator.d.ts +0 -5
- package/validators/RequiredValidator.js +0 -33
- package/validators/UnCheckedValidator.d.ts +0 -5
- package/validators/UnCheckedValidator.js +0 -32
- package/validators/ValidMultipleValidator.d.ts +0 -9
- package/validators/ValidMultipleValidator.js +0 -34
- package/validators/ValidValidator.d.ts +0 -6
- package/validators/ValidValidator.js +0 -33
- package/validators/ValidValidatorArray.d.ts +0 -7
- package/validators/ValidValidatorArray.js +0 -33
- package/validators/Validator.d.ts +0 -57
- package/validators/Validator.js +0 -242
- package/validators/ValidatorArray.d.ts +0 -17
- package/validators/ValidatorArray.js +0 -99
- package/validators/ValueEqualsValidator.d.ts +0 -6
- package/validators/ValueEqualsValidator.js +0 -33
- package/validators/ValueNotEqualsValidator.d.ts +0 -6
- package/validators/ValueNotEqualsValidator.js +0 -33
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export = Compiler;
|
|
2
|
-
/**
|
|
3
|
-
* Initialize a new `Compiler`.
|
|
4
|
-
*/
|
|
5
|
-
declare function Compiler(options: any): void;
|
|
6
|
-
declare class Compiler {
|
|
7
|
-
/**
|
|
8
|
-
* Initialize a new `Compiler`.
|
|
9
|
-
*/
|
|
10
|
-
constructor(options: any);
|
|
11
|
-
/**
|
|
12
|
-
* Compile `node`.
|
|
13
|
-
*/
|
|
14
|
-
compile(node: any): any;
|
|
15
|
-
/**
|
|
16
|
-
* Visit comment node.
|
|
17
|
-
*/
|
|
18
|
-
comment(node: any): any;
|
|
19
|
-
/**
|
|
20
|
-
* Visit import node.
|
|
21
|
-
*/
|
|
22
|
-
import(node: any): any;
|
|
23
|
-
/**
|
|
24
|
-
* Visit media node.
|
|
25
|
-
*/
|
|
26
|
-
media(node: any): any;
|
|
27
|
-
/**
|
|
28
|
-
* Visit document node.
|
|
29
|
-
*/
|
|
30
|
-
document(node: any): any;
|
|
31
|
-
/**
|
|
32
|
-
* Visit charset node.
|
|
33
|
-
*/
|
|
34
|
-
charset(node: any): any;
|
|
35
|
-
/**
|
|
36
|
-
* Visit namespace node.
|
|
37
|
-
*/
|
|
38
|
-
namespace(node: any): any;
|
|
39
|
-
/**
|
|
40
|
-
* Visit supports node.
|
|
41
|
-
*/
|
|
42
|
-
supports(node: any): any;
|
|
43
|
-
/**
|
|
44
|
-
* Visit keyframes node.
|
|
45
|
-
*/
|
|
46
|
-
keyframes(node: any): any;
|
|
47
|
-
/**
|
|
48
|
-
* Visit keyframe node.
|
|
49
|
-
*/
|
|
50
|
-
keyframe(node: any): any;
|
|
51
|
-
/**
|
|
52
|
-
* Visit page node.
|
|
53
|
-
*/
|
|
54
|
-
page(node: any): any;
|
|
55
|
-
/**
|
|
56
|
-
* Visit font-face node.
|
|
57
|
-
*/
|
|
58
|
-
'font-face'(node: any): any;
|
|
59
|
-
/**
|
|
60
|
-
* Visit host node.
|
|
61
|
-
*/
|
|
62
|
-
host(node: any): any;
|
|
63
|
-
/**
|
|
64
|
-
* Visit custom-media node.
|
|
65
|
-
*/
|
|
66
|
-
'custom-media'(node: any): any;
|
|
67
|
-
/**
|
|
68
|
-
* Visit rule node.
|
|
69
|
-
*/
|
|
70
|
-
rule(node: any): any;
|
|
71
|
-
/**
|
|
72
|
-
* Visit declaration node.
|
|
73
|
-
*/
|
|
74
|
-
declaration(node: any): any;
|
|
75
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Module dependencies.
|
|
4
|
-
*/
|
|
5
|
-
var Base = require('./compiler');
|
|
6
|
-
var inherits = require('inherits');
|
|
7
|
-
/**
|
|
8
|
-
* Expose compiler.
|
|
9
|
-
*/
|
|
10
|
-
module.exports = Compiler;
|
|
11
|
-
/**
|
|
12
|
-
* Initialize a new `Compiler`.
|
|
13
|
-
*/
|
|
14
|
-
function Compiler(options) {
|
|
15
|
-
Base.call(this, options);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Inherit from `Base.prototype`.
|
|
19
|
-
*/
|
|
20
|
-
inherits(Compiler, Base);
|
|
21
|
-
/**
|
|
22
|
-
* Compile `node`.
|
|
23
|
-
*/
|
|
24
|
-
Compiler.prototype.compile = function (node) {
|
|
25
|
-
return node.stylesheet
|
|
26
|
-
.rules.map(this.visit, this)
|
|
27
|
-
.join('');
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Visit comment node.
|
|
31
|
-
*/
|
|
32
|
-
Compiler.prototype.comment = function (node) {
|
|
33
|
-
return this.emit('', node.position);
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Visit import node.
|
|
37
|
-
*/
|
|
38
|
-
Compiler.prototype.import = function (node) {
|
|
39
|
-
return this.emit('@import ' + node.import + ';', node.position);
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Visit media node.
|
|
43
|
-
*/
|
|
44
|
-
Compiler.prototype.media = function (node) {
|
|
45
|
-
return this.emit('@media ' + node.media, node.position)
|
|
46
|
-
+ this.emit('{')
|
|
47
|
-
+ this.mapVisit(node.rules)
|
|
48
|
-
+ this.emit('}');
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Visit document node.
|
|
52
|
-
*/
|
|
53
|
-
Compiler.prototype.document = function (node) {
|
|
54
|
-
var doc = '@' + (node.vendor || '') + 'document ' + node.document;
|
|
55
|
-
return this.emit(doc, node.position)
|
|
56
|
-
+ this.emit('{')
|
|
57
|
-
+ this.mapVisit(node.rules)
|
|
58
|
-
+ this.emit('}');
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Visit charset node.
|
|
62
|
-
*/
|
|
63
|
-
Compiler.prototype.charset = function (node) {
|
|
64
|
-
return this.emit('@charset ' + node.charset + ';', node.position);
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Visit namespace node.
|
|
68
|
-
*/
|
|
69
|
-
Compiler.prototype.namespace = function (node) {
|
|
70
|
-
return this.emit('@namespace ' + node.namespace + ';', node.position);
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Visit supports node.
|
|
74
|
-
*/
|
|
75
|
-
Compiler.prototype.supports = function (node) {
|
|
76
|
-
return this.emit('@supports ' + node.supports, node.position)
|
|
77
|
-
+ this.emit('{')
|
|
78
|
-
+ this.mapVisit(node.rules)
|
|
79
|
-
+ this.emit('}');
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Visit keyframes node.
|
|
83
|
-
*/
|
|
84
|
-
Compiler.prototype.keyframes = function (node) {
|
|
85
|
-
return this.emit('@'
|
|
86
|
-
+ (node.vendor || '')
|
|
87
|
-
+ 'keyframes '
|
|
88
|
-
+ node.name, node.position)
|
|
89
|
-
+ this.emit('{')
|
|
90
|
-
+ this.mapVisit(node.keyframes)
|
|
91
|
-
+ this.emit('}');
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Visit keyframe node.
|
|
95
|
-
*/
|
|
96
|
-
Compiler.prototype.keyframe = function (node) {
|
|
97
|
-
var decls = node.declarations;
|
|
98
|
-
return this.emit(node.values.join(','), node.position)
|
|
99
|
-
+ this.emit('{')
|
|
100
|
-
+ this.mapVisit(decls)
|
|
101
|
-
+ this.emit('}');
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* Visit page node.
|
|
105
|
-
*/
|
|
106
|
-
Compiler.prototype.page = function (node) {
|
|
107
|
-
var sel = node.selectors.length
|
|
108
|
-
? node.selectors.join(', ')
|
|
109
|
-
: '';
|
|
110
|
-
return this.emit('@page ' + sel, node.position)
|
|
111
|
-
+ this.emit('{')
|
|
112
|
-
+ this.mapVisit(node.declarations)
|
|
113
|
-
+ this.emit('}');
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Visit font-face node.
|
|
117
|
-
*/
|
|
118
|
-
Compiler.prototype['font-face'] = function (node) {
|
|
119
|
-
return this.emit('@font-face', node.position)
|
|
120
|
-
+ this.emit('{')
|
|
121
|
-
+ this.mapVisit(node.declarations)
|
|
122
|
-
+ this.emit('}');
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* Visit host node.
|
|
126
|
-
*/
|
|
127
|
-
Compiler.prototype.host = function (node) {
|
|
128
|
-
return this.emit('@host', node.position)
|
|
129
|
-
+ this.emit('{')
|
|
130
|
-
+ this.mapVisit(node.rules)
|
|
131
|
-
+ this.emit('}');
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Visit custom-media node.
|
|
135
|
-
*/
|
|
136
|
-
Compiler.prototype['custom-media'] = function (node) {
|
|
137
|
-
return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position);
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* Visit rule node.
|
|
141
|
-
*/
|
|
142
|
-
Compiler.prototype.rule = function (node) {
|
|
143
|
-
var decls = node.declarations;
|
|
144
|
-
if (!decls.length)
|
|
145
|
-
return '';
|
|
146
|
-
return this.emit(node.selectors.join(','), node.position)
|
|
147
|
-
+ this.emit('{')
|
|
148
|
-
+ this.mapVisit(decls)
|
|
149
|
-
+ this.emit('}');
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Visit declaration node.
|
|
153
|
-
*/
|
|
154
|
-
Compiler.prototype.declaration = function (node) {
|
|
155
|
-
return this.emit(node.property + ':' + node.value, node.position) + this.emit(';');
|
|
156
|
-
};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
export = Compiler;
|
|
2
|
-
/**
|
|
3
|
-
* Initialize a new `Compiler`.
|
|
4
|
-
*/
|
|
5
|
-
declare function Compiler(options: any): void;
|
|
6
|
-
declare class Compiler {
|
|
7
|
-
/**
|
|
8
|
-
* Initialize a new `Compiler`.
|
|
9
|
-
*/
|
|
10
|
-
constructor(options: any);
|
|
11
|
-
indentation: any;
|
|
12
|
-
/**
|
|
13
|
-
* Compile `node`.
|
|
14
|
-
*/
|
|
15
|
-
compile(node: any): any;
|
|
16
|
-
/**
|
|
17
|
-
* Visit stylesheet node.
|
|
18
|
-
*/
|
|
19
|
-
stylesheet(node: any): any;
|
|
20
|
-
/**
|
|
21
|
-
* Visit comment node.
|
|
22
|
-
*/
|
|
23
|
-
comment(node: any): any;
|
|
24
|
-
/**
|
|
25
|
-
* Visit import node.
|
|
26
|
-
*/
|
|
27
|
-
import(node: any): any;
|
|
28
|
-
/**
|
|
29
|
-
* Visit media node.
|
|
30
|
-
*/
|
|
31
|
-
media(node: any): any;
|
|
32
|
-
/**
|
|
33
|
-
* Visit document node.
|
|
34
|
-
*/
|
|
35
|
-
document(node: any): any;
|
|
36
|
-
/**
|
|
37
|
-
* Visit charset node.
|
|
38
|
-
*/
|
|
39
|
-
charset(node: any): any;
|
|
40
|
-
/**
|
|
41
|
-
* Visit namespace node.
|
|
42
|
-
*/
|
|
43
|
-
namespace(node: any): any;
|
|
44
|
-
/**
|
|
45
|
-
* Visit supports node.
|
|
46
|
-
*/
|
|
47
|
-
supports(node: any): any;
|
|
48
|
-
/**
|
|
49
|
-
* Visit keyframes node.
|
|
50
|
-
*/
|
|
51
|
-
keyframes(node: any): any;
|
|
52
|
-
/**
|
|
53
|
-
* Visit keyframe node.
|
|
54
|
-
*/
|
|
55
|
-
keyframe(node: any): any;
|
|
56
|
-
/**
|
|
57
|
-
* Visit page node.
|
|
58
|
-
*/
|
|
59
|
-
page(node: any): any;
|
|
60
|
-
/**
|
|
61
|
-
* Visit font-face node.
|
|
62
|
-
*/
|
|
63
|
-
'font-face'(node: any): any;
|
|
64
|
-
/**
|
|
65
|
-
* Visit host node.
|
|
66
|
-
*/
|
|
67
|
-
host(node: any): any;
|
|
68
|
-
/**
|
|
69
|
-
* Visit custom-media node.
|
|
70
|
-
*/
|
|
71
|
-
'custom-media'(node: any): any;
|
|
72
|
-
/**
|
|
73
|
-
* Visit rule node.
|
|
74
|
-
*/
|
|
75
|
-
rule(node: any): any;
|
|
76
|
-
/**
|
|
77
|
-
* Visit declaration node.
|
|
78
|
-
*/
|
|
79
|
-
declaration(node: any): any;
|
|
80
|
-
/**
|
|
81
|
-
* Increase, decrease or return current indentation.
|
|
82
|
-
*/
|
|
83
|
-
indent(level: any): string;
|
|
84
|
-
level: any;
|
|
85
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Module dependencies.
|
|
4
|
-
*/
|
|
5
|
-
var Base = require('./compiler');
|
|
6
|
-
var inherits = require('inherits');
|
|
7
|
-
/**
|
|
8
|
-
* Expose compiler.
|
|
9
|
-
*/
|
|
10
|
-
module.exports = Compiler;
|
|
11
|
-
/**
|
|
12
|
-
* Initialize a new `Compiler`.
|
|
13
|
-
*/
|
|
14
|
-
function Compiler(options) {
|
|
15
|
-
options = options || {};
|
|
16
|
-
Base.call(this, options);
|
|
17
|
-
this.indentation = typeof options.indent === 'string' ? options.indent : ' ';
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Inherit from `Base.prototype`.
|
|
21
|
-
*/
|
|
22
|
-
inherits(Compiler, Base);
|
|
23
|
-
/**
|
|
24
|
-
* Compile `node`.
|
|
25
|
-
*/
|
|
26
|
-
Compiler.prototype.compile = function (node) {
|
|
27
|
-
return this.stylesheet(node);
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Visit stylesheet node.
|
|
31
|
-
*/
|
|
32
|
-
Compiler.prototype.stylesheet = function (node) {
|
|
33
|
-
return this.mapVisit(node.stylesheet.rules, '\n\n');
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Visit comment node.
|
|
37
|
-
*/
|
|
38
|
-
Compiler.prototype.comment = function (node) {
|
|
39
|
-
return this.emit(this.indent() + '/*' + node.comment + '*/', node.position);
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Visit import node.
|
|
43
|
-
*/
|
|
44
|
-
Compiler.prototype.import = function (node) {
|
|
45
|
-
return this.emit('@import ' + node.import + ';', node.position);
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Visit media node.
|
|
49
|
-
*/
|
|
50
|
-
Compiler.prototype.media = function (node) {
|
|
51
|
-
return this.emit('@media ' + node.media, node.position)
|
|
52
|
-
+ this.emit(' {\n'
|
|
53
|
-
+ this.indent(1))
|
|
54
|
-
+ this.mapVisit(node.rules, '\n\n')
|
|
55
|
-
+ this.emit(this.indent(-1)
|
|
56
|
-
+ '\n}');
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Visit document node.
|
|
60
|
-
*/
|
|
61
|
-
Compiler.prototype.document = function (node) {
|
|
62
|
-
var doc = '@' + (node.vendor || '') + 'document ' + node.document;
|
|
63
|
-
return this.emit(doc, node.position)
|
|
64
|
-
+ this.emit(' '
|
|
65
|
-
+ ' {\n'
|
|
66
|
-
+ this.indent(1))
|
|
67
|
-
+ this.mapVisit(node.rules, '\n\n')
|
|
68
|
-
+ this.emit(this.indent(-1)
|
|
69
|
-
+ '\n}');
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Visit charset node.
|
|
73
|
-
*/
|
|
74
|
-
Compiler.prototype.charset = function (node) {
|
|
75
|
-
return this.emit('@charset ' + node.charset + ';', node.position);
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Visit namespace node.
|
|
79
|
-
*/
|
|
80
|
-
Compiler.prototype.namespace = function (node) {
|
|
81
|
-
return this.emit('@namespace ' + node.namespace + ';', node.position);
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Visit supports node.
|
|
85
|
-
*/
|
|
86
|
-
Compiler.prototype.supports = function (node) {
|
|
87
|
-
return this.emit('@supports ' + node.supports, node.position)
|
|
88
|
-
+ this.emit(' {\n'
|
|
89
|
-
+ this.indent(1))
|
|
90
|
-
+ this.mapVisit(node.rules, '\n\n')
|
|
91
|
-
+ this.emit(this.indent(-1)
|
|
92
|
-
+ '\n}');
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Visit keyframes node.
|
|
96
|
-
*/
|
|
97
|
-
Compiler.prototype.keyframes = function (node) {
|
|
98
|
-
return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position)
|
|
99
|
-
+ this.emit(' {\n'
|
|
100
|
-
+ this.indent(1))
|
|
101
|
-
+ this.mapVisit(node.keyframes, '\n')
|
|
102
|
-
+ this.emit(this.indent(-1)
|
|
103
|
-
+ '}');
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Visit keyframe node.
|
|
107
|
-
*/
|
|
108
|
-
Compiler.prototype.keyframe = function (node) {
|
|
109
|
-
var decls = node.declarations;
|
|
110
|
-
return this.emit(this.indent())
|
|
111
|
-
+ this.emit(node.values.join(', '), node.position)
|
|
112
|
-
+ this.emit(' {\n'
|
|
113
|
-
+ this.indent(1))
|
|
114
|
-
+ this.mapVisit(decls, '\n')
|
|
115
|
-
+ this.emit(this.indent(-1)
|
|
116
|
-
+ '\n'
|
|
117
|
-
+ this.indent() + '}\n');
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Visit page node.
|
|
121
|
-
*/
|
|
122
|
-
Compiler.prototype.page = function (node) {
|
|
123
|
-
var sel = node.selectors.length
|
|
124
|
-
? node.selectors.join(', ') + ' '
|
|
125
|
-
: '';
|
|
126
|
-
return this.emit('@page ' + sel, node.position)
|
|
127
|
-
+ this.emit('{\n')
|
|
128
|
-
+ this.emit(this.indent(1))
|
|
129
|
-
+ this.mapVisit(node.declarations, '\n')
|
|
130
|
-
+ this.emit(this.indent(-1))
|
|
131
|
-
+ this.emit('\n}');
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Visit font-face node.
|
|
135
|
-
*/
|
|
136
|
-
Compiler.prototype['font-face'] = function (node) {
|
|
137
|
-
return this.emit('@font-face ', node.position)
|
|
138
|
-
+ this.emit('{\n')
|
|
139
|
-
+ this.emit(this.indent(1))
|
|
140
|
-
+ this.mapVisit(node.declarations, '\n')
|
|
141
|
-
+ this.emit(this.indent(-1))
|
|
142
|
-
+ this.emit('\n}');
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* Visit host node.
|
|
146
|
-
*/
|
|
147
|
-
Compiler.prototype.host = function (node) {
|
|
148
|
-
return this.emit('@host', node.position)
|
|
149
|
-
+ this.emit(' {\n'
|
|
150
|
-
+ this.indent(1))
|
|
151
|
-
+ this.mapVisit(node.rules, '\n\n')
|
|
152
|
-
+ this.emit(this.indent(-1)
|
|
153
|
-
+ '\n}');
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* Visit custom-media node.
|
|
157
|
-
*/
|
|
158
|
-
Compiler.prototype['custom-media'] = function (node) {
|
|
159
|
-
return this.emit('@custom-media ' + node.name + ' ' + node.media + ';', node.position);
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* Visit rule node.
|
|
163
|
-
*/
|
|
164
|
-
Compiler.prototype.rule = function (node) {
|
|
165
|
-
var indent = this.indent();
|
|
166
|
-
var decls = node.declarations;
|
|
167
|
-
if (!decls.length)
|
|
168
|
-
return '';
|
|
169
|
-
return this.emit(node.selectors.map(function (s) { return indent + s; }).join(',\n'), node.position)
|
|
170
|
-
+ this.emit(' {\n')
|
|
171
|
-
+ this.emit(this.indent(1))
|
|
172
|
-
+ this.mapVisit(decls, '\n')
|
|
173
|
-
+ this.emit(this.indent(-1))
|
|
174
|
-
+ this.emit('\n' + this.indent() + '}');
|
|
175
|
-
};
|
|
176
|
-
/**
|
|
177
|
-
* Visit declaration node.
|
|
178
|
-
*/
|
|
179
|
-
Compiler.prototype.declaration = function (node) {
|
|
180
|
-
return this.emit(this.indent())
|
|
181
|
-
+ this.emit(node.property + ': ' + node.value, node.position)
|
|
182
|
-
+ this.emit(';');
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* Increase, decrease or return current indentation.
|
|
186
|
-
*/
|
|
187
|
-
Compiler.prototype.indent = function (level) {
|
|
188
|
-
this.level = this.level || 1;
|
|
189
|
-
if (null != level) {
|
|
190
|
-
this.level += level;
|
|
191
|
-
return '';
|
|
192
|
-
}
|
|
193
|
-
return Array(this.level).join(this.indentation);
|
|
194
|
-
};
|
package/css/stringify/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stringfy the given AST `node`.
|
|
3
|
-
*
|
|
4
|
-
* Options:
|
|
5
|
-
*
|
|
6
|
-
* - `compress` space-optimized output
|
|
7
|
-
* - `sourcemap` return an object with `.code` and `.map`
|
|
8
|
-
*
|
|
9
|
-
* @param {Object} node
|
|
10
|
-
* @param {Object} [options]
|
|
11
|
-
* @return {String}
|
|
12
|
-
* @api public
|
|
13
|
-
*/
|
|
14
|
-
export default function _default(node: Object, options?: Object | undefined): string;
|
package/css/stringify/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Module dependencies.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var Compressed = require('./compress');
|
|
7
|
-
var Identity = require('./identity');
|
|
8
|
-
/**
|
|
9
|
-
* Stringfy the given AST `node`.
|
|
10
|
-
*
|
|
11
|
-
* Options:
|
|
12
|
-
*
|
|
13
|
-
* - `compress` space-optimized output
|
|
14
|
-
* - `sourcemap` return an object with `.code` and `.map`
|
|
15
|
-
*
|
|
16
|
-
* @param {Object} node
|
|
17
|
-
* @param {Object} [options]
|
|
18
|
-
* @return {String}
|
|
19
|
-
* @api public
|
|
20
|
-
*/
|
|
21
|
-
function default_1(node, options) {
|
|
22
|
-
options = options || {};
|
|
23
|
-
var compiler = options.compress
|
|
24
|
-
? new Compressed(options)
|
|
25
|
-
: new Identity(options);
|
|
26
|
-
// source maps
|
|
27
|
-
// if (options.sourcemap) {
|
|
28
|
-
// var sourcemaps = require('./source-map-support');
|
|
29
|
-
// sourcemaps(compiler);
|
|
30
|
-
//
|
|
31
|
-
// var code = compiler.compile(node);
|
|
32
|
-
// compiler.applySourceMaps();
|
|
33
|
-
//
|
|
34
|
-
// var map = options.sourcemap === 'generator'
|
|
35
|
-
// ? compiler.map
|
|
36
|
-
// : compiler.map.toJSON();
|
|
37
|
-
//
|
|
38
|
-
// return { code: code, map: map };
|
|
39
|
-
// }
|
|
40
|
-
var code = compiler.compile(node);
|
|
41
|
-
return code;
|
|
42
|
-
}
|
|
43
|
-
exports.default = default_1;
|
|
44
|
-
;
|