flinker-dom 1.0.6 → 1.0.8
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/core.js +2 -2
- package/dist/esm/processor.js +14 -38
- package/dist/types/core.d.ts +1 -1
- package/dist/types/processor.d.ts +1 -1
- package/package.json +1 -1
package/dist/esm/core.js
CHANGED
|
@@ -178,9 +178,9 @@ export const buildClassName = (props, pc, tag = '') => {
|
|
|
178
178
|
}
|
|
179
179
|
return 'className' in props && props.className ? props.className + ' ' + getClassName(tag) : getClassName(tag);
|
|
180
180
|
};
|
|
181
|
-
export const buildRule = (props, parentSelector, childSelector) => {
|
|
181
|
+
export const buildRule = (props, parentSelector, childSelector, pc = 'none') => {
|
|
182
182
|
const { reset, operator, addRule } = ruleBuilder;
|
|
183
|
-
reset(
|
|
183
|
+
reset(pc, 'low');
|
|
184
184
|
for (const k of [...Object.keys(props)].sort(sortKeys)) {
|
|
185
185
|
if (operator[k]) {
|
|
186
186
|
operator[k](props[k]);
|
package/dist/esm/processor.js
CHANGED
|
@@ -75,11 +75,16 @@ 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
|
+
['none', 'hover', 'focus', 'placeholder', 'active', 'visited', 'link'].forEach(t => {
|
|
79
|
+
switch (t) {
|
|
80
|
+
case ('hover'):
|
|
81
|
+
this.hash.set('hover', new HoverPseudoClass(styleSheet));
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
this.hash.set(t, new PseudoClass(t, styleSheet));
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
83
88
|
}
|
|
84
89
|
setValue(to, key, value, priority, appendToClassName = true) {
|
|
85
90
|
const pseudoClass = this.hash.get(to);
|
|
@@ -108,7 +113,10 @@ export class PseudoClass {
|
|
|
108
113
|
this.hashSum = '';
|
|
109
114
|
}
|
|
110
115
|
insertRule(className, tag) {
|
|
111
|
-
|
|
116
|
+
if (this.style) {
|
|
117
|
+
const rule = tag + '.' + className + (this.type === 'none' ? '' : ':' + this.type) + '{' + this.style + '}';
|
|
118
|
+
this.styleSheet.insertRule(rule);
|
|
119
|
+
}
|
|
112
120
|
}
|
|
113
121
|
setValue(key, value, priority, appendToClassName = true) {
|
|
114
122
|
if (value === undefined)
|
|
@@ -129,17 +137,6 @@ export class PseudoClass {
|
|
|
129
137
|
this.style = '';
|
|
130
138
|
}
|
|
131
139
|
}
|
|
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
140
|
class HoverPseudoClass extends PseudoClass {
|
|
144
141
|
constructor(styleSheet) {
|
|
145
142
|
super('hover', styleSheet);
|
|
@@ -152,24 +149,3 @@ class HoverPseudoClass extends PseudoClass {
|
|
|
152
149
|
}
|
|
153
150
|
}
|
|
154
151
|
}
|
|
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
|
-
}
|
package/dist/types/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PseudoClassType } from './processor';
|
|
2
2
|
export type RulePriority = 'high' | 'low';
|
|
3
3
|
export declare const buildClassName: (props: any, pc: PseudoClassType, tag?: string) => string;
|
|
4
|
-
export declare const buildRule: (props: any, parentSelector: string, childSelector: string) => void;
|
|
4
|
+
export declare const buildRule: (props: any, parentSelector: string, childSelector: string, pc?: PseudoClassType) => void;
|
|
5
5
|
export type BorderStyle = 'solid' | 'dotted' | 'dashed' | 'double' | 'none' | 'hidden';
|
|
6
6
|
export type PointerEventsStyle = 'auto' | 'none' | 'visiblePainted' | 'visibleFill' | 'visibleStroke' | 'visible' | 'painted' | 'fill' | 'stroke' | 'all' | 'inherit' | 'initial' | 'unset';
|
|
7
7
|
export type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | 'inherit';
|
|
@@ -8,7 +8,7 @@ export declare class StyleSheetProcessor {
|
|
|
8
8
|
insertRule(className: string, tag: string): void;
|
|
9
9
|
clearValues(): void;
|
|
10
10
|
}
|
|
11
|
-
export type PseudoClassType = 'none' | 'hover' | 'focus' | 'placeholder';
|
|
11
|
+
export type PseudoClassType = 'none' | 'hover' | 'focus' | 'placeholder' | 'active' | 'visited' | 'link';
|
|
12
12
|
export declare class PseudoClass {
|
|
13
13
|
readonly type: PseudoClassType;
|
|
14
14
|
readonly styleSheet: CSSStyleSheet;
|