@creative-web-solution/front-library 7.1.4 → 7.1.5

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/CHANGELOG.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## 7.1.5
5
+
6
+ * Typescript: Fix some type
7
+
8
+
4
9
  ## 7.1.4
5
10
 
6
11
  * Typescript: Fix tsify and browserify compatibility
7
- * HistoryController: Remove UrlParser for window.URL
8
12
 
9
13
 
10
14
  ## 7.1.3
@@ -1,4 +1,5 @@
1
1
  import { on } from './EventsManager';
2
+ import { UrlParser } from '../Helpers/UrlParser';
2
3
  import { slice } from '../Helpers/Slice';
3
4
 
4
5
 
@@ -32,7 +33,7 @@ export default class HistoryController {
32
33
  #hasPushstate: boolean;
33
34
  #hasPopStateEvent: boolean;
34
35
  #currentState: FLib.Events.History.StateObject;
35
- #registeredFunctionList: (( url: URL, state: any ) => void)[];
36
+ #registeredFunctionList: (( url: FLib.Helpers.UrlParser, state: any ) => void)[];
36
37
 
37
38
 
38
39
  get state(): FLib.Events.History.StateObject {
@@ -52,7 +53,7 @@ export default class HistoryController {
52
53
  this.#defaultTitle = encodeURIComponent( defaultTitle );
53
54
 
54
55
  this.#currentState = {
55
- "url": new window.URL( window.location.href ),
56
+ "url": new UrlParser( window.location.href ),
56
57
  "state": {},
57
58
  "title": this.#defaultTitle
58
59
  };
@@ -68,7 +69,7 @@ export default class HistoryController {
68
69
 
69
70
 
70
71
  // Call each registered function for popstate event
71
- #callRegisteredFunction = ( url: URL, state: any ): void => {
72
+ #callRegisteredFunction = ( url: FLib.Helpers.UrlParser, state: any ): void => {
72
73
  if ( !this.#registeredFunctionList.length ) {
73
74
  return;
74
75
  }
@@ -86,7 +87,7 @@ export default class HistoryController {
86
87
  }
87
88
 
88
89
  this.#currentState = {
89
- "url": new URL( document.location.href ),
90
+ "url": new UrlParser( document.location.href ),
90
91
  state,
91
92
  "title": ""
92
93
  };
@@ -100,15 +101,15 @@ export default class HistoryController {
100
101
  *
101
102
  * @param state - Native browser state object
102
103
  */
103
- pushState( state: any, title: string, url: string | URL ): this {
104
+ pushState( state: any, title: string, url: string | UrlParser ): this {
104
105
  if ( !this.#hasPushstate ) {
105
106
  return this;
106
107
  }
107
108
 
108
- url = url instanceof URL ? url : new URL( url as string );
109
+ url = url instanceof UrlParser ? url : new UrlParser( url as string );
109
110
 
110
111
  this.#currentState = {
111
- "url": url as URL,
112
+ "url": url as UrlParser,
112
113
  state,
113
114
  "title": title ? encodeURIComponent( title ) : this.#defaultTitle
114
115
  };
@@ -117,7 +118,7 @@ export default class HistoryController {
117
118
  window.history.pushState(
118
119
  state,
119
120
  this.#currentState.title,
120
- this.#currentState.url.href
121
+ this.#currentState.url.absolute2
121
122
  );
122
123
  }
123
124
  catch ( e ) {
@@ -136,14 +137,14 @@ export default class HistoryController {
136
137
  return this;
137
138
  }
138
139
 
139
- anchor = anchor.indexOf( '#' ) === -1 ? `#${ anchor }` : anchor;
140
+ anchor = anchor.indexOf( '#' ) === -1 ? anchor : anchor.slice( 1 );
140
141
 
141
142
  try {
142
- this.#currentState.url.hash = anchor.indexOf( '#' ) === -1 ? `#${ anchor }` : anchor;
143
+ this.#currentState.url.setAnchor( anchor );
143
144
  window.history.pushState(
144
145
  this.#currentState.state,
145
146
  this.#currentState.title,
146
- this.#currentState.url.href
147
+ this.#currentState.url.absolute2
147
148
  );
148
149
  }
149
150
  catch ( e ) {
@@ -53,7 +53,7 @@ export default class Popin {
53
53
 
54
54
  if ( _controllerOptions ) {
55
55
  this.#options = userOptions as FLib.Popin.Options;
56
- this.#backgroundLayer = _controllerOptions.background;
56
+ this.#backgroundLayer = _controllerOptions.background as PopinBackground;
57
57
  }
58
58
  else {
59
59
  this.#options = extend( defaultOptions, userOptions );
@@ -427,7 +427,8 @@ export default class Popin {
427
427
  e.preventDefault();
428
428
 
429
429
  if ( this.#controllerOptions ) {
430
- return this.#controllerOptions.controller.close();
430
+ this.#controllerOptions.controller.close();
431
+ return;
431
432
  }
432
433
 
433
434
  this.#closePopin();
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Front Library
2
2
 
3
- @version: 7.1.4
3
+ @version: 7.1.5
4
4
 
5
5
 
6
6
  ## Use
@@ -179,12 +179,12 @@ declare namespace FLib {
179
179
  */
180
180
  namespace History {
181
181
  type StateObject = {
182
- url: URL;
182
+ url: FLib.Helpers.UrlParser;
183
183
  state: any;
184
184
  title: string;
185
185
  }
186
186
 
187
- type Callback = ( url: URL, state: any ) => void;
187
+ type Callback = ( url: FLib.Helpers.UrlParser, state: any ) => void;
188
188
  }
189
189
 
190
190
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@creative-web-solution/front-library",
3
3
  "title": "Frontend library",
4
4
  "description": "Frontend functions and modules",
5
- "version": "7.1.4",
5
+ "version": "7.1.5",
6
6
  "homepage": "https://github.com/creative-web-solution/front-library",
7
7
  "author": "Creative Web Solution <contact@cws-studio.com> (https://www.cws-studio.com)",
8
8
  "keywords": [],