@kizmann/pico-js 0.4.5 → 0.4.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizmann/pico-js",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
package/src/index.js CHANGED
@@ -85,4 +85,14 @@ if ( typeof global.pi === 'undefined' && global.navigator ) {
85
85
  global.pi = Pico;
86
86
  }
87
87
 
88
+ global.pi.Dom.ready(function () {
89
+
90
+ // Apply dom scroll event
91
+ document.addEventListener("scroll",
92
+ global.pi.Element.scroll);
93
+
94
+ // Apply initial scroll event
95
+ global.pi.Element.scroll();
96
+ });
97
+
88
98
  export default Pico;
@@ -1,15 +1,5 @@
1
1
  import { Str, Obj, Dom, Any, Arr } from "../index.js";
2
2
 
3
-
4
- Dom.ready(() => {
5
-
6
- document.addEventListener("scroll",
7
- Element.scroll);
8
-
9
- Element.scroll();
10
- });
11
-
12
-
13
3
  export class Element
14
4
  {
15
5
  /**
@@ -27,7 +27,7 @@ export default class Map
27
27
  constructor(el, options = {})
28
28
  {
29
29
  if ( ! global.google ) {
30
- return console.error('Google Maps is not loaded.');
30
+ throw new Error('Google Maps is required for pi.Map');
31
31
  }
32
32
 
33
33
  let center = Obj.only(options, ['lat', 'lng']);
@@ -52,7 +52,7 @@ export default class Map
52
52
  static setMarkerStyle(key, style = {}, extra = {})
53
53
  {
54
54
  if ( ! global.google ) {
55
- return console.error('Google Maps is not loaded.');
55
+ throw new Error('Google Maps is required for pi.Map');
56
56
  }
57
57
 
58
58
  if ( ! Obj.has(style, 'default') ) {
@@ -1,5 +1,4 @@
1
1
  import { Num, Arr, Any } from "../index.js";
2
- import moment from "moment";
3
2
 
4
3
  export class Now
5
4
  {
@@ -8,6 +7,10 @@ export class Now
8
7
 
9
8
  constructor(date = null, format = 'YYYY-MM-DD hh:mm:ss')
10
9
  {
10
+ if ( ! global.moment ) {
11
+ throw new Error('Moment.js is required for pi.Now');
12
+ }
13
+
11
14
  if ( date instanceof Now ) {
12
15
  date = date.get().toDate();
13
16
  }
@@ -15,14 +18,14 @@ export class Now
15
18
  this.initialDate = date;
16
19
 
17
20
  if ( ! Any.isString(date) ) {
18
- this.moment = moment(date || new Date, format);
21
+ this.moment = global.moment(date || new Date, format);
19
22
  }
20
23
 
21
24
  if ( this.moment !== null ) {
22
25
  return this;
23
26
  }
24
27
 
25
- this.moment = moment(date.match(/^now/) ?
28
+ this.moment = global.moment(date.match(/^now/) ?
26
29
  new Date : date, format);
27
30
 
28
31
  let second = this.initialDate.match(/(\+|-)([0-9]+)seconds?/);
@@ -89,7 +92,7 @@ export class Now
89
92
  valid()
90
93
  {
91
94
  return ! Any.isEmpty(this.initialDate) &&
92
- moment(this.initialDate).isValid();
95
+ global.moment(this.initialDate).isValid();
93
96
  }
94
97
 
95
98
  clone()
@@ -18,11 +18,11 @@ let config = {
18
18
  }
19
19
  ]
20
20
  },
21
- externals: {
22
- 'moment': {
23
- root: 'moment', commonjs2: 'moment', commonjs: 'moment', amd: 'moment'
24
- },
25
- },
21
+ // externals: {
22
+ // 'moment': {
23
+ // root: 'moment', commonjs2: 'moment', commonjs: 'moment', amd: 'moment'
24
+ // },
25
+ // },
26
26
  plugins: []
27
27
  };
28
28