@ulu/frontend 0.0.15 → 0.0.17
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
|
@@ -44,11 +44,28 @@ export class CssBreakpoints {
|
|
|
44
44
|
this.resizeDirection = null;
|
|
45
45
|
this.previousIndex = null;
|
|
46
46
|
this.breakpoints = {};
|
|
47
|
+
this.onChangeCallbacks = [];
|
|
47
48
|
this.order.forEach(n => this.breakpoints[n] = new Breakpoint(n, this));
|
|
48
49
|
log(this, this);
|
|
49
50
|
this.update(); // Run for the first time, then whenever browser resizes
|
|
50
51
|
CssBreakpoints.instances.push(this);
|
|
51
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Add a callback for everytime a breakpoint changes
|
|
55
|
+
* - Not recommended, possibly use to watch for changes, etc
|
|
56
|
+
* - For more control use intance.at(name) with breakpoint methods
|
|
57
|
+
* @param {Function} callback Function to call, passed one argument current instance which can be used to get information about breakpoints
|
|
58
|
+
*/
|
|
59
|
+
onChange(callback) {
|
|
60
|
+
this.onChangeCallbacks.push(callback);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Remove change callback
|
|
64
|
+
* @param {Function} callback Function to remove
|
|
65
|
+
*/
|
|
66
|
+
removeOnChange(callback) {
|
|
67
|
+
removeArrayElement(this.onChangeCallbacks, callback);
|
|
68
|
+
}
|
|
52
69
|
/**
|
|
53
70
|
* Get breakpoint from a psuedo element
|
|
54
71
|
*/
|
|
@@ -117,6 +134,8 @@ export class CssBreakpoints {
|
|
|
117
134
|
if (this.previousIndex !== null) {
|
|
118
135
|
this.resizeDirection = this.previousIndex < index ? "up" : "down";
|
|
119
136
|
}
|
|
137
|
+
|
|
138
|
+
this.onChangeCallbacks.forEach(cb => cb(this));
|
|
120
139
|
}
|
|
121
140
|
/**
|
|
122
141
|
* Get a breakpoint by key
|
package/package.json
CHANGED
|
@@ -54,19 +54,19 @@
|
|
|
54
54
|
}
|
|
55
55
|
.hidden,
|
|
56
56
|
.display-none {
|
|
57
|
-
display: none;
|
|
57
|
+
display: none !important;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// Display none per breakpoint
|
|
61
61
|
@each $name in map.keys(breakpoint.$sizes) {
|
|
62
62
|
@include breakpoint.min($name) {
|
|
63
63
|
.hidden-min-#{ $name } {
|
|
64
|
-
display: none;
|
|
64
|
+
display: none !important;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
@include breakpoint.max($name) {
|
|
68
68
|
.hidden-max-#{ $name } {
|
|
69
|
-
display: none;
|
|
69
|
+
display: none !important;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -34,6 +34,19 @@ export class CssBreakpoints {
|
|
|
34
34
|
resizeDirection: string;
|
|
35
35
|
previousIndex: any;
|
|
36
36
|
breakpoints: {};
|
|
37
|
+
onChangeCallbacks: any[];
|
|
38
|
+
/**
|
|
39
|
+
* Add a callback for everytime a breakpoint changes
|
|
40
|
+
* - Not recommended, possibly use to watch for changes, etc
|
|
41
|
+
* - For more control use intance.at(name) with breakpoint methods
|
|
42
|
+
* @param {Function} callback Function to call, passed one argument current instance which can be used to get information about breakpoints
|
|
43
|
+
*/
|
|
44
|
+
onChange(callback: Function): void;
|
|
45
|
+
/**
|
|
46
|
+
* Remove change callback
|
|
47
|
+
* @param {Function} callback Function to remove
|
|
48
|
+
*/
|
|
49
|
+
removeOnChange(callback: Function): void;
|
|
37
50
|
/**
|
|
38
51
|
* Get breakpoint from a psuedo element
|
|
39
52
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-breakpoint.d.ts","sourceRoot":"","sources":["../../js/helpers/css-breakpoint.js"],"names":[],"mappings":"AAeA;;;;GAIG;AACH;IACE,wBAAsB;IACtB;;;;;;;MAOC;IACD;;;;;;;OAOG;IACH;QANyB,KAAK;QACL,cAAc;QACd,eAAe;QAChB,OAAO,EAApB,IAAI;QACW,cAAc;
|
|
1
|
+
{"version":3,"file":"css-breakpoint.d.ts","sourceRoot":"","sources":["../../js/helpers/css-breakpoint.js"],"names":[],"mappings":"AAeA;;;;GAIG;AACH;IACE,wBAAsB;IACtB;;;;;;;MAOC;IACD;;;;;;;OAOG;IACH;QANyB,KAAK;QACL,cAAc;QACd,eAAe;QAChB,OAAO,EAApB,IAAI;QACW,cAAc;OAevC;IAXC,YAAkB;IAClB,cAAoB;IACpB,iBAAuB;IACvB,wBAA2B;IAC3B,mBAAyB;IACzB,gBAAqB;IACrB,yBAA2B;IAM7B;;;;;OAKG;IACH,mCAEC;IACD;;;OAGG;IACH,yCAEC;IACD;;OAEG;IACH,gCAEC;IACD;;OAEG;IACH,kCAEC;IACD;;OAEG;IACH,wBAMC;IACD;;OAEG;IACH,eA6CC;IACD;;;;OAIG;IACH,kBAFY,UAAU,CAQrB;CACF;;AAsED;;;GAGG;AACH;IACE,qCAQC;IAPC;;;;MAIC;IACD,cAAuB;IACvB,UAAgB;IAElB;;;;;OAKG;IACH,wDAEC;IACD;;;;;OAKG;IACH,6BAEC;IACD;;;;;OAKG;IACH,6BAEC;IACD;;;OAGG;IACH,8BAEC;IACD;;;;OAIG;IACH,mDAGC;IAED,yBAGC;CACF;AAnID;;;GAGG;AACH;IACE,6CAMC;IALC,eAA0B;IAC1B,gBAAmB;IACnB,UAAY;IACZ,WAAa;IACb,gBAA4B;IAE9B;;OAEG;IACH,sBAMC;IACD;;OAEG;IACH,4BAIC;IACD;;OAEG;IACH,+BAEC;IACD;;;;;OAKG;IACH,aAJW,cAAe,QAiBzB;IACD;;OAEG;IACH,2BAQC;CACF"}
|