@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/dist/pico-js.js +1 -1
- package/dist/pico-js.js.map +1 -1
- package/package.json +1 -1
- package/src/index.js +10 -0
- package/src/library/element.js +0 -10
- package/src/library/map.js +2 -2
- package/src/utility/now.js +7 -4
- package/webpack.config.cjs +5 -5
package/package.json
CHANGED
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;
|
package/src/library/element.js
CHANGED
package/src/library/map.js
CHANGED
@@ -27,7 +27,7 @@ export default class Map
|
|
27
27
|
constructor(el, options = {})
|
28
28
|
{
|
29
29
|
if ( ! global.google ) {
|
30
|
-
|
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
|
-
|
55
|
+
throw new Error('Google Maps is required for pi.Map');
|
56
56
|
}
|
57
57
|
|
58
58
|
if ( ! Obj.has(style, 'default') ) {
|
package/src/utility/now.js
CHANGED
@@ -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()
|
package/webpack.config.cjs
CHANGED
@@ -18,11 +18,11 @@ let config = {
|
|
18
18
|
}
|
19
19
|
]
|
20
20
|
},
|
21
|
-
externals: {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
},
|
21
|
+
// externals: {
|
22
|
+
// 'moment': {
|
23
|
+
// root: 'moment', commonjs2: 'moment', commonjs: 'moment', amd: 'moment'
|
24
|
+
// },
|
25
|
+
// },
|
26
26
|
plugins: []
|
27
27
|
};
|
28
28
|
|