flinker-dom 1.1.11 → 1.1.12

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.
@@ -71,19 +71,19 @@ const abbreviations = {
71
71
  'user-select': 'U',
72
72
  'z-index': 'Z'
73
73
  };
74
+ const pseudoClasses = ['none', ':hover', ':focus', ':link', ':visited', ':active', '::placeholder', '::before'];
74
75
  export class StyleSheetProcessor {
75
76
  constructor(styleSheet) {
76
77
  this.hash = new Map();
77
78
  this.list = Array.of();
78
- const all = ['none', 'hover', 'focus', 'placeholder'];
79
- all.forEach(t => {
80
- if (t === 'hover') {
79
+ pseudoClasses.forEach(t => {
80
+ if (t === ':hover') {
81
81
  const pc = new HoverPseudoClass(styleSheet);
82
- this.hash.set('hover', pc);
82
+ this.hash.set(':hover', pc);
83
83
  this.list.push(pc);
84
84
  }
85
85
  else {
86
- const pc = new PseudoClass(t, styleSheet, t === 'placeholder' ? '::' : ':');
86
+ const pc = new PseudoClass(t, styleSheet);
87
87
  this.hash.set(t, pc);
88
88
  this.list.push(pc);
89
89
  }
@@ -109,16 +109,15 @@ export class StyleSheetProcessor {
109
109
  }
110
110
  }
111
111
  export class PseudoClass {
112
- constructor(type, styleSheet, divider = ':') {
112
+ constructor(type, styleSheet) {
113
113
  this.type = type;
114
114
  this.styleSheet = styleSheet;
115
115
  this.style = '';
116
116
  this.hashSum = '';
117
- this.divider = divider;
118
117
  }
119
118
  insertRule(className, tag) {
120
119
  if (this.style) {
121
- const rule = tag + '.' + className + (this.type === 'none' ? '' : this.divider + this.type) + '{' + this.style + '}';
120
+ const rule = tag + '.' + className + (this.type === 'none' ? '' : this.type) + '{' + this.style + '}';
122
121
  this.styleSheet.insertRule(rule);
123
122
  }
124
123
  }
@@ -143,7 +142,7 @@ export class PseudoClass {
143
142
  }
144
143
  class HoverPseudoClass extends PseudoClass {
145
144
  constructor(styleSheet) {
146
- super('hover', styleSheet);
145
+ super(':hover', styleSheet);
147
146
  this.isMobileDevice = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0);
148
147
  }
149
148
  insertRule(className, tag) {
@@ -1,4 +1,6 @@
1
1
  import { type RulePriority } from './core';
2
+ declare const pseudoClasses: readonly ["none", ":hover", ":focus", ":link", ":visited", ":active", "::placeholder", "::before"];
3
+ export type PseudoClassType = typeof pseudoClasses[number];
2
4
  export declare class StyleSheetProcessor {
3
5
  private readonly hash;
4
6
  private readonly list;
@@ -8,16 +10,15 @@ export declare class StyleSheetProcessor {
8
10
  insertRule(className: string, tag: string): void;
9
11
  clearValues(): void;
10
12
  }
11
- export type PseudoClassType = 'none' | 'hover' | 'focus' | 'placeholder';
12
13
  export declare class PseudoClass {
13
14
  readonly type: PseudoClassType;
14
15
  readonly styleSheet: CSSStyleSheet;
15
16
  style: string;
16
17
  hashSum: string;
17
- readonly divider: string;
18
- constructor(type: PseudoClassType, styleSheet: CSSStyleSheet, divider?: string);
18
+ constructor(type: PseudoClassType, styleSheet: CSSStyleSheet);
19
19
  insertRule(className: string, tag: string): void;
20
20
  setValue(key: string, value: string, priority: RulePriority, appendToClassName?: boolean): void;
21
21
  isEmpty(): boolean;
22
22
  clear(): void;
23
23
  }
24
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "flinker-dom",
3
3
  "description": "Free TypeScript library for writing frontend apps",
4
- "version": "1.1.11",
4
+ "version": "1.1.12",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/Dittner/FlinkerDOM.git"