flinker-dom 1.1.11 → 1.1.13

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.
@@ -117,7 +117,7 @@ export class UIComponent {
117
117
  res.pseudo = {};
118
118
  const state = {};
119
119
  this.whenHoveredFn(state);
120
- res.pseudo['hover'] = state;
120
+ res.pseudo[':hover'] = state;
121
121
  }
122
122
  if (this.mapStateFn)
123
123
  this.mapStateFn(res);
@@ -353,7 +353,7 @@ export class Button extends Text {
353
353
  res.pseudo = {};
354
354
  const state = {};
355
355
  this.whenHoveredFn(state);
356
- res.pseudo['hover'] = state;
356
+ res.pseudo[':hover'] = state;
357
357
  }
358
358
  if (!this.childrenColl)
359
359
  this.dom.textContent = this.props.text ?? null;
@@ -673,7 +673,7 @@ export class Input extends UIComponent {
673
673
  res.pseudo = {};
674
674
  const state = {};
675
675
  this.whenHoveredFn(state);
676
- res.pseudo['hover'] = state;
676
+ res.pseudo[':hover'] = state;
677
677
  }
678
678
  if (this.whenFocusedFn) {
679
679
  if (!res.pseudo)
@@ -687,7 +687,7 @@ export class Input extends UIComponent {
687
687
  res.pseudo = {};
688
688
  const state = {};
689
689
  this.whenPlaceholderShownFn(state);
690
- res.pseudo['placeholder'] = state;
690
+ res.pseudo['::placeholder'] = state;
691
691
  }
692
692
  if (this.mapStateFn)
693
693
  this.mapStateFn(res);
@@ -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.13",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/Dittner/FlinkerDOM.git"