flinker-dom 1.0.7 → 1.0.9
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/dist/esm/processor.js +15 -38
- package/package.json +1 -1
package/dist/esm/processor.js
CHANGED
|
@@ -75,11 +75,17 @@ export class StyleSheetProcessor {
|
|
|
75
75
|
constructor(styleSheet) {
|
|
76
76
|
this.hash = new Map();
|
|
77
77
|
this.list = Array.of();
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
const all = ['none', 'hover', 'focus', 'placeholder', 'active', 'visited', 'link'];
|
|
79
|
+
all.forEach(t => {
|
|
80
|
+
switch (t) {
|
|
81
|
+
case ('hover'):
|
|
82
|
+
this.hash.set('hover', new HoverPseudoClass(styleSheet));
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
this.hash.set(t, new PseudoClass(t, styleSheet));
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
83
89
|
}
|
|
84
90
|
setValue(to, key, value, priority, appendToClassName = true) {
|
|
85
91
|
const pseudoClass = this.hash.get(to);
|
|
@@ -108,7 +114,10 @@ export class PseudoClass {
|
|
|
108
114
|
this.hashSum = '';
|
|
109
115
|
}
|
|
110
116
|
insertRule(className, tag) {
|
|
111
|
-
|
|
117
|
+
if (this.style) {
|
|
118
|
+
const rule = tag + '.' + className + (this.type === 'none' ? '' : ':' + this.type) + '{' + this.style + '}';
|
|
119
|
+
this.styleSheet.insertRule(rule);
|
|
120
|
+
}
|
|
112
121
|
}
|
|
113
122
|
setValue(key, value, priority, appendToClassName = true) {
|
|
114
123
|
if (value === undefined)
|
|
@@ -129,17 +138,6 @@ export class PseudoClass {
|
|
|
129
138
|
this.style = '';
|
|
130
139
|
}
|
|
131
140
|
}
|
|
132
|
-
class NoPseudoClass extends PseudoClass {
|
|
133
|
-
constructor(styleSheet) {
|
|
134
|
-
super('none', styleSheet);
|
|
135
|
-
}
|
|
136
|
-
insertRule(className, tag) {
|
|
137
|
-
if (this.style) {
|
|
138
|
-
const rule = tag + '.' + className + '{' + this.style + '}';
|
|
139
|
-
this.styleSheet.insertRule(rule);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
141
|
class HoverPseudoClass extends PseudoClass {
|
|
144
142
|
constructor(styleSheet) {
|
|
145
143
|
super('hover', styleSheet);
|
|
@@ -152,24 +150,3 @@ class HoverPseudoClass extends PseudoClass {
|
|
|
152
150
|
}
|
|
153
151
|
}
|
|
154
152
|
}
|
|
155
|
-
class FocusPseudoClass extends PseudoClass {
|
|
156
|
-
constructor(styleSheet) {
|
|
157
|
-
super('focus', styleSheet);
|
|
158
|
-
}
|
|
159
|
-
insertRule(className, tag) {
|
|
160
|
-
if (this.style) {
|
|
161
|
-
const rule = tag + '.' + className + ':focus{' + this.style + '}';
|
|
162
|
-
this.styleSheet.insertRule(rule);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
class PlaceholderPseudoClass extends PseudoClass {
|
|
167
|
-
constructor(styleSheet) {
|
|
168
|
-
super('placeholder', styleSheet);
|
|
169
|
-
}
|
|
170
|
-
insertRule(className, tag) {
|
|
171
|
-
if (this.style) {
|
|
172
|
-
this.styleSheet.insertRule(tag + '.' + className + '::placeholder{' + this.style + '}');
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|