@nice-digital/nds-core 3.0.2 → 4.0.0-alpha.0
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/es/breakpoints.d.ts +28 -0
- package/es/breakpoints.js +39 -40
- package/es/core.d.ts +2 -0
- package/es/core.js +18 -3
- package/es/utils.d.ts +78 -0
- package/es/utils.js +140 -161
- package/es/utils.test.d.ts +1 -0
- package/es/utils.test.js +64 -0
- package/package.json +13 -11
- package/scss/colours/tokens/_alias.scss +3 -0
- package/es/breakpoints.js.map +0 -1
- package/es/core.js.map +0 -1
- package/es/utils.js.map +0 -1
- package/lib/breakpoints.js +0 -49
- package/lib/breakpoints.js.map +0 -1
- package/lib/core.js +0 -20
- package/lib/core.js.map +0 -1
- package/lib/utils.js +0 -184
- package/lib/utils.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Breakpoints
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The breakpoints, in pixel values.
|
|
6
|
+
* These correspond with the breakpoints defined in SASS.
|
|
7
|
+
* Often not used directly, but via matchesFrom.
|
|
8
|
+
*/
|
|
9
|
+
export declare const breakpoints: {
|
|
10
|
+
xs: number;
|
|
11
|
+
sm: number;
|
|
12
|
+
md: number;
|
|
13
|
+
lg: number;
|
|
14
|
+
xl: number;
|
|
15
|
+
};
|
|
16
|
+
export declare type breakpointType = keyof typeof breakpoints;
|
|
17
|
+
/**
|
|
18
|
+
* Determines if the device's width matches a min-width query from the given breakpoint.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} breakpointName The breakpoint name
|
|
21
|
+
* @return {Boolean} True if it matches, false otherwise.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* import { matchesFrom } from "./breakpoints";
|
|
25
|
+
* // Checks if the media query (min-width: 25em) matches
|
|
26
|
+
* var matches = matchesFrom("xs");
|
|
27
|
+
*/
|
|
28
|
+
export declare const matchesFrom: (breakpointName: string) => boolean;
|
package/es/breakpoints.js
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
//# sourceMappingURL=breakpoints.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module Breakpoints
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.matchesFrom = exports.breakpoints = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* The breakpoints, in pixel values.
|
|
9
|
+
* These correspond with the breakpoints defined in SASS.
|
|
10
|
+
* Often not used directly, but via matchesFrom.
|
|
11
|
+
*/
|
|
12
|
+
exports.breakpoints = {
|
|
13
|
+
xs: 400,
|
|
14
|
+
sm: 600,
|
|
15
|
+
md: 900,
|
|
16
|
+
lg: 1200,
|
|
17
|
+
xl: 1600
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Determines if the device's width matches a min-width query from the given breakpoint.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} breakpointName The breakpoint name
|
|
23
|
+
* @return {Boolean} True if it matches, false otherwise.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* import { matchesFrom } from "./breakpoints";
|
|
27
|
+
* // Checks if the media query (min-width: 25em) matches
|
|
28
|
+
* var matches = matchesFrom("xs");
|
|
29
|
+
*/
|
|
30
|
+
const matchesFrom = (breakpointName) => {
|
|
31
|
+
let breakpointPx = exports.breakpoints[breakpointName];
|
|
32
|
+
if (!breakpointPx) {
|
|
33
|
+
throw new Error(`Breakpoint ${breakpointName} does not exist`);
|
|
34
|
+
}
|
|
35
|
+
// Assume matchMedia is polyfilled elsewhere
|
|
36
|
+
// Convert to ems to match the media query if the browser's root font-size isn't 16
|
|
37
|
+
return window.matchMedia(`(min-width: ${breakpointPx / 16}em)`).matches;
|
|
38
|
+
};
|
|
39
|
+
exports.matchesFrom = matchesFrom;
|
package/es/core.d.ts
ADDED
package/es/core.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./utils"), exports);
|
|
18
|
+
__exportStar(require("./breakpoints"), exports);
|
package/es/utils.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Utils
|
|
3
|
+
* Utility functions
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Trims whitespace characters from the start and end of a string.
|
|
7
|
+
* This utility method exists because String.prototype.trim is
|
|
8
|
+
* not supported in IE8.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} str The string to trim
|
|
11
|
+
*/
|
|
12
|
+
export declare const trim: (str: string) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Throttle events
|
|
15
|
+
* See https://remysharp.com/2010/07/21/throttling-function-calls
|
|
16
|
+
*
|
|
17
|
+
* @param {Function} func The function to throttle
|
|
18
|
+
* @param {Integer} threshold The threshold period, in milliseconds
|
|
19
|
+
* @param {Object} scope The context of the throttled function
|
|
20
|
+
* @return {Function} { The throttled function }
|
|
21
|
+
*/
|
|
22
|
+
export declare const throttle: (fn: Function, threshold?: number, scope?: Object | null) => () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Debounce
|
|
25
|
+
* See http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
|
|
26
|
+
*
|
|
27
|
+
* @param {Function} func The function to debounce
|
|
28
|
+
* @param {boolean} execAsap Whether to execute the function now
|
|
29
|
+
* @param {Integer} threshold The detection period, in milliseconds
|
|
30
|
+
* @param {Object} scope The context for the debounced function
|
|
31
|
+
* @return {Function} { The debounced function }
|
|
32
|
+
*/
|
|
33
|
+
export declare const debounce: (func: Function, execAsap?: boolean, threshold?: number, scope?: Object | null) => () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Turns a string into a slug.
|
|
36
|
+
* See {@link https://gist.github.com/mathewbyrne/1280286#gistcomment-1606270|this gist}.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} str { The string to slugify }
|
|
39
|
+
* @returns {string} { The slugified string }
|
|
40
|
+
*
|
|
41
|
+
* @example <caption>Example slugifying</caption>
|
|
42
|
+
* import { slugify } from "./utils";
|
|
43
|
+
* // returns "a-string-to-transform-and-slugify"
|
|
44
|
+
* slugify("A (string) to transform & slugify!");
|
|
45
|
+
*/
|
|
46
|
+
export declare const slugify: (str: string) => string;
|
|
47
|
+
/**
|
|
48
|
+
* Generates a unique id in the form prefix-n by incrementing a counter.
|
|
49
|
+
* The first time this is called it will return "uid-1" then "uid-2" and so on.
|
|
50
|
+
* See {@link http://stackoverflow.com/a/20302361|This StackOverflow answer}.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} prefix { The prefix for the id to return. Defaults to "uid" }
|
|
53
|
+
* @return {string} { The unique id }
|
|
54
|
+
*
|
|
55
|
+
* @example <caption>Simple example</caption>
|
|
56
|
+
* import { nextUniqueId } from "./utils";
|
|
57
|
+
* // returns "uid-1"
|
|
58
|
+
* nextUniqueId();
|
|
59
|
+
*
|
|
60
|
+
* @example <caption>Prefix example</caption>
|
|
61
|
+
* import utils from "./utils";
|
|
62
|
+
* // returns "prefix-1"
|
|
63
|
+
* utils.nextUniqueId("prefix");
|
|
64
|
+
*/
|
|
65
|
+
export declare const nextUniqueId: (prefix?: string) => string;
|
|
66
|
+
/**
|
|
67
|
+
* CamelCases a string
|
|
68
|
+
* @param {string} str The string to camel case
|
|
69
|
+
*/
|
|
70
|
+
export declare const camelCase: (str: string) => string;
|
|
71
|
+
declare const _default: {
|
|
72
|
+
throttle: (fn: Function, threshold?: number, scope?: Object | null) => () => void;
|
|
73
|
+
debounce: (func: Function, execAsap?: boolean, threshold?: number, scope?: Object | null) => () => void;
|
|
74
|
+
slugify: (str: string) => string;
|
|
75
|
+
nextUniqueId: (prefix?: string) => string;
|
|
76
|
+
camelCase: (str: string) => string;
|
|
77
|
+
};
|
|
78
|
+
export default _default;
|
package/es/utils.js
CHANGED
|
@@ -1,161 +1,140 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* CamelCases a string
|
|
143
|
-
* @param {string} str The string to camel case
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
|
-
export var camelCase = function camelCase(str) {
|
|
147
|
-
str = str.split("-").join(" "); // To support kebab-case
|
|
148
|
-
// See https://stackoverflow.com/a/2970667/486434
|
|
149
|
-
|
|
150
|
-
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (letter, index) {
|
|
151
|
-
return index === 0 ? letter.toLowerCase() : letter.toUpperCase();
|
|
152
|
-
}).replace(/\s+/g, "");
|
|
153
|
-
};
|
|
154
|
-
export default {
|
|
155
|
-
throttle: throttle,
|
|
156
|
-
debounce: debounce,
|
|
157
|
-
slugify: slugify,
|
|
158
|
-
nextUniqueId: nextUniqueId,
|
|
159
|
-
camelCase: camelCase
|
|
160
|
-
};
|
|
161
|
-
//# sourceMappingURL=utils.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module Utils
|
|
4
|
+
* Utility functions
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.camelCase = exports.nextUniqueId = exports.slugify = exports.debounce = exports.throttle = exports.trim = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Trims whitespace characters from the start and end of a string.
|
|
10
|
+
* This utility method exists because String.prototype.trim is
|
|
11
|
+
* not supported in IE8.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} str The string to trim
|
|
14
|
+
*/
|
|
15
|
+
const trim = function (str) {
|
|
16
|
+
return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
17
|
+
};
|
|
18
|
+
exports.trim = trim;
|
|
19
|
+
/**
|
|
20
|
+
* Throttle events
|
|
21
|
+
* See https://remysharp.com/2010/07/21/throttling-function-calls
|
|
22
|
+
*
|
|
23
|
+
* @param {Function} func The function to throttle
|
|
24
|
+
* @param {Integer} threshold The threshold period, in milliseconds
|
|
25
|
+
* @param {Object} scope The context of the throttled function
|
|
26
|
+
* @return {Function} { The throttled function }
|
|
27
|
+
*/
|
|
28
|
+
const throttle = function (fn, threshold = 100, scope = null) {
|
|
29
|
+
let last, deferTimer;
|
|
30
|
+
return function throttled() {
|
|
31
|
+
let context = scope || this, now = +new Date(), args = arguments;
|
|
32
|
+
if (last && now < last + threshold) {
|
|
33
|
+
// hold on to it
|
|
34
|
+
clearTimeout(deferTimer);
|
|
35
|
+
deferTimer = setTimeout(function () {
|
|
36
|
+
last = now;
|
|
37
|
+
fn.apply(context, args);
|
|
38
|
+
}, threshold);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
last = now;
|
|
42
|
+
fn.apply(context, args);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.throttle = throttle;
|
|
47
|
+
/**
|
|
48
|
+
* Debounce
|
|
49
|
+
* See http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
|
|
50
|
+
*
|
|
51
|
+
* @param {Function} func The function to debounce
|
|
52
|
+
* @param {boolean} execAsap Whether to execute the function now
|
|
53
|
+
* @param {Integer} threshold The detection period, in milliseconds
|
|
54
|
+
* @param {Object} scope The context for the debounced function
|
|
55
|
+
* @return {Function} { The debounced function }
|
|
56
|
+
*/
|
|
57
|
+
const debounce = function (func, execAsap = false, threshold = 100, scope = null) {
|
|
58
|
+
let timeout;
|
|
59
|
+
return function debounced() {
|
|
60
|
+
let context = scope || this, args = arguments;
|
|
61
|
+
function delayed() {
|
|
62
|
+
if (!execAsap)
|
|
63
|
+
func.apply(context, args);
|
|
64
|
+
timeout = null;
|
|
65
|
+
}
|
|
66
|
+
if (timeout)
|
|
67
|
+
clearTimeout(timeout);
|
|
68
|
+
else if (execAsap)
|
|
69
|
+
func.apply(context, args);
|
|
70
|
+
timeout = setTimeout(delayed, threshold);
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
exports.debounce = debounce;
|
|
74
|
+
/**
|
|
75
|
+
* Turns a string into a slug.
|
|
76
|
+
* See {@link https://gist.github.com/mathewbyrne/1280286#gistcomment-1606270|this gist}.
|
|
77
|
+
*
|
|
78
|
+
* @param {string} str { The string to slugify }
|
|
79
|
+
* @returns {string} { The slugified string }
|
|
80
|
+
*
|
|
81
|
+
* @example <caption>Example slugifying</caption>
|
|
82
|
+
* import { slugify } from "./utils";
|
|
83
|
+
* // returns "a-string-to-transform-and-slugify"
|
|
84
|
+
* slugify("A (string) to transform & slugify!");
|
|
85
|
+
*/
|
|
86
|
+
const slugify = (str) => {
|
|
87
|
+
return (0, exports.trim)(str)
|
|
88
|
+
.toLowerCase()
|
|
89
|
+
.replace(/\s+/g, "-") // Replace spaces with -
|
|
90
|
+
.replace(/&/g, "-and-") // Replace & with 'and'
|
|
91
|
+
.replace(/[^\w-]+/g, "") // Remove all non-word chars
|
|
92
|
+
.replace(/^-+/g, "") // Trim dashes from the start
|
|
93
|
+
.replace(/-+$/g, "") // Trim dashes from the end
|
|
94
|
+
.replace(/-{2,}/g, "-"); // Replace multiple - with single -
|
|
95
|
+
};
|
|
96
|
+
exports.slugify = slugify;
|
|
97
|
+
/**
|
|
98
|
+
* Generates a unique id in the form prefix-n by incrementing a counter.
|
|
99
|
+
* The first time this is called it will return "uid-1" then "uid-2" and so on.
|
|
100
|
+
* See {@link http://stackoverflow.com/a/20302361|This StackOverflow answer}.
|
|
101
|
+
*
|
|
102
|
+
* @param {string} prefix { The prefix for the id to return. Defaults to "uid" }
|
|
103
|
+
* @return {string} { The unique id }
|
|
104
|
+
*
|
|
105
|
+
* @example <caption>Simple example</caption>
|
|
106
|
+
* import { nextUniqueId } from "./utils";
|
|
107
|
+
* // returns "uid-1"
|
|
108
|
+
* nextUniqueId();
|
|
109
|
+
*
|
|
110
|
+
* @example <caption>Prefix example</caption>
|
|
111
|
+
* import utils from "./utils";
|
|
112
|
+
* // returns "prefix-1"
|
|
113
|
+
* utils.nextUniqueId("prefix");
|
|
114
|
+
*/
|
|
115
|
+
exports.nextUniqueId = (function (i) {
|
|
116
|
+
return function (prefix = "uid") {
|
|
117
|
+
return `${prefix}-${++i}`;
|
|
118
|
+
};
|
|
119
|
+
})(0);
|
|
120
|
+
/**
|
|
121
|
+
* CamelCases a string
|
|
122
|
+
* @param {string} str The string to camel case
|
|
123
|
+
*/
|
|
124
|
+
const camelCase = function (str) {
|
|
125
|
+
str = str.split("-").join(" "); // To support kebab-case
|
|
126
|
+
// See https://stackoverflow.com/a/2970667/486434
|
|
127
|
+
return str
|
|
128
|
+
.replace(/(?:^\w|[A-Z]|\b\w)/g, function (letter, index) {
|
|
129
|
+
return index === 0 ? letter.toLowerCase() : letter.toUpperCase();
|
|
130
|
+
})
|
|
131
|
+
.replace(/\s+/g, "");
|
|
132
|
+
};
|
|
133
|
+
exports.camelCase = camelCase;
|
|
134
|
+
exports.default = {
|
|
135
|
+
throttle: exports.throttle,
|
|
136
|
+
debounce: exports.debounce,
|
|
137
|
+
slugify: exports.slugify,
|
|
138
|
+
nextUniqueId: exports.nextUniqueId,
|
|
139
|
+
camelCase: exports.camelCase
|
|
140
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/utils.test.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-env node, mocha, jquery */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
describe("Utils", function () {
|
|
6
|
+
describe("slugify", function () {
|
|
7
|
+
it("lowercases the input", function () {
|
|
8
|
+
let s = (0, utils_1.slugify)("DOGBONE");
|
|
9
|
+
expect(s).toEqual("dogbone");
|
|
10
|
+
});
|
|
11
|
+
it("replaces space characters with dashes", function () {
|
|
12
|
+
let s = (0, utils_1.slugify)("dog bone");
|
|
13
|
+
expect(s).toEqual("dog-bone");
|
|
14
|
+
});
|
|
15
|
+
it("replaces multiple space characters with single dash", function () {
|
|
16
|
+
let s = (0, utils_1.slugify)("dog bone");
|
|
17
|
+
expect(s).toEqual("dog-bone");
|
|
18
|
+
});
|
|
19
|
+
it("replaces multiple dash characters with single dash", function () {
|
|
20
|
+
let s = (0, utils_1.slugify)("dog--bone");
|
|
21
|
+
expect(s).toEqual("dog-bone");
|
|
22
|
+
});
|
|
23
|
+
it("replaces ampersands with the word 'and'", function () {
|
|
24
|
+
let s = (0, utils_1.slugify)("dog & bone");
|
|
25
|
+
expect(s).toEqual("dog-and-bone");
|
|
26
|
+
});
|
|
27
|
+
it("replaces non word characters", function () {
|
|
28
|
+
let s = (0, utils_1.slugify)("dog () & * bone 2");
|
|
29
|
+
expect(s).toEqual("dog-and-bone-2");
|
|
30
|
+
});
|
|
31
|
+
it("removes dashes from the start", function () {
|
|
32
|
+
let s = (0, utils_1.slugify)("* dog");
|
|
33
|
+
expect(s).toEqual("dog");
|
|
34
|
+
});
|
|
35
|
+
it("removes dashes from the end", function () {
|
|
36
|
+
let s = (0, utils_1.slugify)("dog *");
|
|
37
|
+
expect(s).toEqual("dog");
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
describe("nextUniqueId", function () {
|
|
41
|
+
it("prefixes with 'uid' by default", function () {
|
|
42
|
+
expect((0, utils_1.nextUniqueId)().indexOf("uid-")).toEqual(0);
|
|
43
|
+
});
|
|
44
|
+
it("prefixes with the given prefix", function () {
|
|
45
|
+
expect((0, utils_1.nextUniqueId)("test").indexOf("test-")).toEqual(0);
|
|
46
|
+
});
|
|
47
|
+
it("increments counter on subsequent calls", function () {
|
|
48
|
+
const idA = (0, utils_1.nextUniqueId)().match(/\d+/), idB = (0, utils_1.nextUniqueId)().match(/\d+/);
|
|
49
|
+
let a = Number(idA ? idA[0] : null), b = Number(idB ? idB[0] : null);
|
|
50
|
+
expect(b).toEqual(a + 1);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
describe("camelCase", function () {
|
|
54
|
+
it("turns a Title Case string into a camelCase string", function () {
|
|
55
|
+
expect((0, utils_1.camelCase)("Title Case")).toEqual("titleCase");
|
|
56
|
+
});
|
|
57
|
+
it("turns a Sentence case string into a camelCase string", function () {
|
|
58
|
+
expect((0, utils_1.camelCase)("Sentence case")).toEqual("sentenceCase");
|
|
59
|
+
});
|
|
60
|
+
it("turns a kebab-case string into a camelCase string", function () {
|
|
61
|
+
expect((0, utils_1.camelCase)("this-is-kebab-case")).toEqual("thisIsKebabCase");
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-digital/nds-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.0",
|
|
4
4
|
"description": "Core code for the NICE Design System",
|
|
5
5
|
"author": "Ian Routledge <ian.routledge@nice.org.uk>",
|
|
6
6
|
"contributors": [
|
|
@@ -9,17 +9,15 @@
|
|
|
9
9
|
],
|
|
10
10
|
"homepage": "https://design-system.nice.org.uk/",
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"main": "
|
|
13
|
-
"module": "es/core.js",
|
|
12
|
+
"main": "es/core.js",
|
|
14
13
|
"style": "scss/core.scss",
|
|
15
14
|
"directories": {
|
|
16
|
-
"lib": "
|
|
17
|
-
"test": "__tests__"
|
|
15
|
+
"lib": "es"
|
|
18
16
|
},
|
|
19
17
|
"files": [
|
|
20
|
-
"lib",
|
|
21
18
|
"es",
|
|
22
|
-
"scss"
|
|
19
|
+
"scss",
|
|
20
|
+
"*.d.ts"
|
|
23
21
|
],
|
|
24
22
|
"publishConfig": {
|
|
25
23
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -33,8 +31,7 @@
|
|
|
33
31
|
"url": "https://github.com/nice-digital/nice-design-system/issues"
|
|
34
32
|
},
|
|
35
33
|
"dependencies": {
|
|
36
|
-
"@nice-digital/icons": "^
|
|
37
|
-
"prop-types": "^15.7.2",
|
|
34
|
+
"@nice-digital/icons": "^6.0.0-alpha.0",
|
|
38
35
|
"sass-mq": "^6.0.0"
|
|
39
36
|
},
|
|
40
37
|
"peerDependencies": {
|
|
@@ -42,7 +39,12 @@
|
|
|
42
39
|
"react-dom": "^16 || ^17 || ^18"
|
|
43
40
|
},
|
|
44
41
|
"devDependencies": {
|
|
45
|
-
"@
|
|
42
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
43
|
+
"@testing-library/react": "^13.4.0",
|
|
44
|
+
"@testing-library/user-event": "^14.4.3",
|
|
45
|
+
"@types/jest": "^29.2.2",
|
|
46
|
+
"@types/node": "^18.11.9",
|
|
47
|
+
"typescript": "^4.8.4"
|
|
46
48
|
},
|
|
47
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e225e0b15723013fb3df7309d197590a09cc2ea7"
|
|
48
50
|
}
|
|
@@ -50,6 +50,7 @@ $success-background: global.$custom-green-1-tint;
|
|
|
50
50
|
|
|
51
51
|
// Fills
|
|
52
52
|
$fill-page-background: global.$nice-cream-tint-1;
|
|
53
|
+
$fill-white-background: global.$white;
|
|
53
54
|
|
|
54
55
|
// Forms
|
|
55
56
|
$form-group-hint: global.$black-tint-1;
|
|
@@ -76,6 +77,8 @@ $alphabet-letter-span: global.$custom-grey-3;
|
|
|
76
77
|
// Card
|
|
77
78
|
$card-author: global.$black-tint-1;
|
|
78
79
|
$card-metadata: global.$black-tint-1;
|
|
80
|
+
$card-callout-background: global.$white;
|
|
81
|
+
$card-callout-border: global.$custom-grey-2;
|
|
79
82
|
|
|
80
83
|
// Callout
|
|
81
84
|
$callout-background: global.$white;
|
package/es/breakpoints.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.js","names":["breakpoints","xs","sm","md","lg","xl","matchesFrom","breakpointName","breakpointPx","Error","window","matchMedia","matches"],"sources":["../src/breakpoints.js"],"sourcesContent":["/**\n * @module Breakpoints\n */\n\n/**\n * The breakpoints, in pixel values.\n * These correspond with the breakpoints defined in SASS.\n * Often not used directly, but via matchesFrom.\n */\nexport const breakpoints = {\n\txs: 400,\n\tsm: 600,\n\tmd: 900,\n\tlg: 1200,\n\txl: 1600\n};\n\n/**\n * Determines if the device's width matches a min-width query from the given breakpoint.\n *\n * @param {string} breakpointName The breakpoint name\n * @return {Boolean} True if it matches, false otherwise.\n *\n * @example\n * \timport { matchesFrom } from \"./breakpoints\";\n * \t// Checks if the media query (min-width: 25em) matches\n * \tvar matches = matchesFrom(\"xs\");\n */\nexport const matchesFrom = (breakpointName) => {\n\tlet breakpointPx = breakpoints[breakpointName];\n\n\tif (!breakpointPx) {\n\t\tthrow new Error(`Breakpoint ${breakpointName} does not exist`);\n\t}\n\n\t// Assume matchMedia is polyfilled elsewhere\n\t// Convert to ems to match the media query if the browser's root font-size isn't 16\n\treturn window.matchMedia(`(min-width: ${breakpointPx / 16}em)`).matches;\n};\n"],"mappings":"AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMA,WAAW,GAAG;EAC1BC,EAAE,EAAE,GADsB;EAE1BC,EAAE,EAAE,GAFsB;EAG1BC,EAAE,EAAE,GAHsB;EAI1BC,EAAE,EAAE,IAJsB;EAK1BC,EAAE,EAAE;AALsB,CAApB;AAQP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACC,cAAD,EAAoB;EAC9C,IAAIC,YAAY,GAAGR,WAAW,CAACO,cAAD,CAA9B;;EAEA,IAAI,CAACC,YAAL,EAAmB;IAClB,MAAM,IAAIC,KAAJ,iBAAwBF,cAAxB,qBAAN;EACA,CAL6C,CAO9C;EACA;;;EACA,OAAOG,MAAM,CAACC,UAAP,kBAAiCH,YAAY,GAAG,EAAhD,UAAyDI,OAAhE;AACA,CAVM"}
|
package/es/core.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","names":[],"sources":["../src/core.js"],"sourcesContent":["export * from \"./utils\";\nexport * from \"./breakpoints\";\n"],"mappings":"AAAA,cAAc,SAAd;AACA,cAAc,eAAd"}
|
package/es/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["trim","str","replace","throttle","fn","threshhold","scope","last","deferTimer","throttled","context","now","Date","args","arguments","clearTimeout","setTimeout","apply","debounce","func","execAsap","threshold","timeout","debounced","delayed","slugify","toLowerCase","nextUniqueId","i","prefix","camelCase","split","join","letter","index","toUpperCase"],"sources":["../src/utils.js"],"sourcesContent":["/**\n * @module Utils\n * Utility functions\n */\n\n/**\n * Trims whitespace characters from the start and end of a string.\n * This utility method exists because String.prototype.trim is\n * not supported in IE8.\n *\n * @param {string} str The string to trim\n */\nexport const trim = function (str) {\n\treturn str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, \"\");\n};\n\n/**\n * Throttle events\n * See https://remysharp.com/2010/07/21/throttling-function-calls\n *\n * @param {Function} func The function to throttle\n * @param {Integer} threshold The threshhold period, in milliseconds\n * @param {Object} scope The context of the throttled function\n * @return {Function} { The throttled function }\n */\nexport const throttle = function (fn, threshhold = 100, scope = null) {\n\tlet last, deferTimer;\n\n\treturn function throttled() {\n\t\tlet context = scope || this,\n\t\t\tnow = +new Date(),\n\t\t\targs = arguments;\n\n\t\tif (last && now < last + threshhold) {\n\t\t\t// hold on to it\n\t\t\tclearTimeout(deferTimer);\n\t\t\tdeferTimer = setTimeout(function () {\n\t\t\t\tlast = now;\n\t\t\t\tfn.apply(context, args);\n\t\t\t}, threshhold);\n\t\t} else {\n\t\t\tlast = now;\n\t\t\tfn.apply(context, args);\n\t\t}\n\t};\n};\n\n/**\n * Debounce\n * See http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n *\n * @param {Function} func The function to debounce\n * @param {Integer} execAsap Whether to execute the function now\n * @param {Integer} threshold The detection period, in milliseconds\n * @param {Object} scope The context for the debounced function\n * @return {Function} { The debounced function }\n */\nexport const debounce = function (\n\tfunc,\n\texecAsap = false,\n\tthreshold = 100,\n\tscope = null\n) {\n\tlet timeout;\n\n\treturn function debounced() {\n\t\tlet context = scope || this,\n\t\t\targs = arguments;\n\n\t\tfunction delayed() {\n\t\t\tif (!execAsap) func.apply(context, args);\n\t\t\ttimeout = null;\n\t\t}\n\n\t\tif (timeout) clearTimeout(timeout);\n\t\telse if (execAsap) func.apply(context, args);\n\n\t\ttimeout = setTimeout(delayed, threshold);\n\t};\n};\n\n/**\n * Turns a string into a slug.\n * See {@link https://gist.github.com/mathewbyrne/1280286#gistcomment-1606270|this gist}.\n *\n * @param {string} str { The string to slugify }\n * @returns {string} { The slugified string }\n *\n * @example <caption>Example slugifying</caption>\n * import { slugify } from \"./utils\";\n * // returns \"a-string-to-transform-and-slugify\"\n * slugify(\"A (string) to transform & slugify!\");\n */\nexport const slugify = (str) => {\n\treturn trim(str)\n\t\t.toLowerCase()\n\t\t.replace(/\\s+/g, \"-\") // Replace spaces with -\n\t\t.replace(/&/g, \"-and-\") // Replace & with 'and'\n\t\t.replace(/[^\\w-]+/g, \"\") // Remove all non-word chars\n\t\t.replace(/^-+/g, \"\") // Trim dashes from the start\n\t\t.replace(/-+$/g, \"\") // Trim dashes from the end\n\t\t.replace(/-{2,}/g, \"-\"); // Replace multiple - with single -\n};\n\n/**\n * Generates a unique id in the form prefix-n by incrementing a counter.\n * The first time this is called it will return \"uid-1\" then \"uid-2\" and so on.\n * See {@link http://stackoverflow.com/a/20302361|This StackOverflow answer}.\n *\n * @param {string} prefix { The prefix for the id to return. Defaults to \"uid\" }\n * @return {string} { The unique id }\n *\n * @example <caption>Simple example</caption>\n * import { nextUniqueId } from \"./utils\";\n * // returns \"uid-1\"\n * nextUniqueId();\n *\n * @example <caption>Prefix example</caption>\n * import utils from \"./utils\";\n * // returns \"prefix-1\"\n * utils.nextUniqueId(\"prefix\");\n */\nexport const nextUniqueId = (function (i) {\n\treturn function (prefix = \"uid\") {\n\t\treturn `${prefix}-${++i}`;\n\t};\n})(0);\n\n/**\n * CamelCases a string\n * @param {string} str The string to camel case\n */\nexport const camelCase = function (str) {\n\tstr = str.split(\"-\").join(\" \"); // To support kebab-case\n\t// See https://stackoverflow.com/a/2970667/486434\n\treturn str\n\t\t.replace(/(?:^\\w|[A-Z]|\\b\\w)/g, function (letter, index) {\n\t\t\treturn index === 0 ? letter.toLowerCase() : letter.toUpperCase();\n\t\t})\n\t\t.replace(/\\s+/g, \"\");\n};\n\nexport default {\n\tthrottle: throttle,\n\tdebounce: debounce,\n\tslugify: slugify,\n\tnextUniqueId: nextUniqueId,\n\tcamelCase: camelCase\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMA,IAAI,GAAG,SAAPA,IAAO,CAAUC,GAAV,EAAe;EAClC,OAAOA,GAAG,CAACC,OAAJ,CAAY,oCAAZ,EAAkD,EAAlD,CAAP;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAAUC,EAAV,EAAcC,UAAd,EAAgCC,KAAhC,EAA8C;EAAA,IAAhCD,UAAgC;IAAhCA,UAAgC,GAAnB,GAAmB;EAAA;;EAAA,IAAdC,KAAc;IAAdA,KAAc,GAAN,IAAM;EAAA;;EACrE,IAAIC,IAAJ,EAAUC,UAAV;EAEA,OAAO,SAASC,SA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CAACE,WAAP,EAA5C;EACA,CAHK,EAILjC,OAJK,CAIG,MAJH,EAIW,EAJX,CAAP;AAKA,CARM;AAUP,eAAe;EACdC,QAAQ,EAAEA,QADI;EAEde,QAAQ,EAAEA,QAFI;EAGdO,OAAO,EAAEA,OAHK;EAIdE,YAAY,EAAEA,YAJA;EAKdG,SAAS,EAAEA;AALG,CAAf"}
|
package/lib/breakpoints.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.matchesFrom = exports.breakpoints = void 0;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @module Breakpoints
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The breakpoints, in pixel values.
|
|
12
|
-
* These correspond with the breakpoints defined in SASS.
|
|
13
|
-
* Often not used directly, but via matchesFrom.
|
|
14
|
-
*/
|
|
15
|
-
var breakpoints = {
|
|
16
|
-
xs: 400,
|
|
17
|
-
sm: 600,
|
|
18
|
-
md: 900,
|
|
19
|
-
lg: 1200,
|
|
20
|
-
xl: 1600
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Determines if the device's width matches a min-width query from the given breakpoint.
|
|
24
|
-
*
|
|
25
|
-
* @param {string} breakpointName The breakpoint name
|
|
26
|
-
* @return {Boolean} True if it matches, false otherwise.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* import { matchesFrom } from "./breakpoints";
|
|
30
|
-
* // Checks if the media query (min-width: 25em) matches
|
|
31
|
-
* var matches = matchesFrom("xs");
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
exports.breakpoints = breakpoints;
|
|
35
|
-
|
|
36
|
-
var matchesFrom = function matchesFrom(breakpointName) {
|
|
37
|
-
var breakpointPx = breakpoints[breakpointName];
|
|
38
|
-
|
|
39
|
-
if (!breakpointPx) {
|
|
40
|
-
throw new Error("Breakpoint " + breakpointName + " does not exist");
|
|
41
|
-
} // Assume matchMedia is polyfilled elsewhere
|
|
42
|
-
// Convert to ems to match the media query if the browser's root font-size isn't 16
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return window.matchMedia("(min-width: " + breakpointPx / 16 + "em)").matches;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
exports.matchesFrom = matchesFrom;
|
|
49
|
-
//# sourceMappingURL=breakpoints.js.map
|
package/lib/breakpoints.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.js","names":["breakpoints","xs","sm","md","lg","xl","matchesFrom","breakpointName","breakpointPx","Error","window","matchMedia","matches"],"sources":["../src/breakpoints.js"],"sourcesContent":["/**\n * @module Breakpoints\n */\n\n/**\n * The breakpoints, in pixel values.\n * These correspond with the breakpoints defined in SASS.\n * Often not used directly, but via matchesFrom.\n */\nexport const breakpoints = {\n\txs: 400,\n\tsm: 600,\n\tmd: 900,\n\tlg: 1200,\n\txl: 1600\n};\n\n/**\n * Determines if the device's width matches a min-width query from the given breakpoint.\n *\n * @param {string} breakpointName The breakpoint name\n * @return {Boolean} True if it matches, false otherwise.\n *\n * @example\n * \timport { matchesFrom } from \"./breakpoints\";\n * \t// Checks if the media query (min-width: 25em) matches\n * \tvar matches = matchesFrom(\"xs\");\n */\nexport const matchesFrom = (breakpointName) => {\n\tlet breakpointPx = breakpoints[breakpointName];\n\n\tif (!breakpointPx) {\n\t\tthrow new Error(`Breakpoint ${breakpointName} does not exist`);\n\t}\n\n\t// Assume matchMedia is polyfilled elsewhere\n\t// Convert to ems to match the media query if the browser's root font-size isn't 16\n\treturn window.matchMedia(`(min-width: ${breakpointPx / 16}em)`).matches;\n};\n"],"mappings":";;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,IAAMA,WAAW,GAAG;EAC1BC,EAAE,EAAE,GADsB;EAE1BC,EAAE,EAAE,GAFsB;EAG1BC,EAAE,EAAE,GAHsB;EAI1BC,EAAE,EAAE,IAJsB;EAK1BC,EAAE,EAAE;AALsB,CAApB;AAQP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACC,cAAD,EAAoB;EAC9C,IAAIC,YAAY,GAAGR,WAAW,CAACO,cAAD,CAA9B;;EAEA,IAAI,CAACC,YAAL,EAAmB;IAClB,MAAM,IAAIC,KAAJ,iBAAwBF,cAAxB,qBAAN;EACA,CAL6C,CAO9C;EACA;;;EACA,OAAOG,MAAM,CAACC,UAAP,kBAAiCH,YAAY,GAAG,EAAhD,UAAyDI,OAAhE;AACA,CAVM"}
|
package/lib/core.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
|
|
5
|
-
var _utils = require("./utils");
|
|
6
|
-
|
|
7
|
-
Object.keys(_utils).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _utils[key]) return;
|
|
10
|
-
exports[key] = _utils[key];
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
var _breakpoints = require("./breakpoints");
|
|
14
|
-
|
|
15
|
-
Object.keys(_breakpoints).forEach(function (key) {
|
|
16
|
-
if (key === "default" || key === "__esModule") return;
|
|
17
|
-
if (key in exports && exports[key] === _breakpoints[key]) return;
|
|
18
|
-
exports[key] = _breakpoints[key];
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=core.js.map
|
package/lib/core.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","names":[],"sources":["../src/core.js"],"sourcesContent":["export * from \"./utils\";\nexport * from \"./breakpoints\";\n"],"mappings":";;;;AAAA;;AAAA;EAAA;EAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;AAAA"}
|
package/lib/utils.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.trim = exports.throttle = exports.slugify = exports.nextUniqueId = exports["default"] = exports.debounce = exports.camelCase = void 0;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @module Utils
|
|
8
|
-
* Utility functions
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Trims whitespace characters from the start and end of a string.
|
|
13
|
-
* This utility method exists because String.prototype.trim is
|
|
14
|
-
* not supported in IE8.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} str The string to trim
|
|
17
|
-
*/
|
|
18
|
-
var trim = function trim(str) {
|
|
19
|
-
return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Throttle events
|
|
23
|
-
* See https://remysharp.com/2010/07/21/throttling-function-calls
|
|
24
|
-
*
|
|
25
|
-
* @param {Function} func The function to throttle
|
|
26
|
-
* @param {Integer} threshold The threshhold period, in milliseconds
|
|
27
|
-
* @param {Object} scope The context of the throttled function
|
|
28
|
-
* @return {Function} { The throttled function }
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
exports.trim = trim;
|
|
33
|
-
|
|
34
|
-
var throttle = function throttle(fn, threshhold, scope) {
|
|
35
|
-
if (threshhold === void 0) {
|
|
36
|
-
threshhold = 100;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (scope === void 0) {
|
|
40
|
-
scope = null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
var last, deferTimer;
|
|
44
|
-
return function throttled() {
|
|
45
|
-
var context = scope || this,
|
|
46
|
-
now = +new Date(),
|
|
47
|
-
args = arguments;
|
|
48
|
-
|
|
49
|
-
if (last && now < last + threshhold) {
|
|
50
|
-
// hold on to it
|
|
51
|
-
clearTimeout(deferTimer);
|
|
52
|
-
deferTimer = setTimeout(function () {
|
|
53
|
-
last = now;
|
|
54
|
-
fn.apply(context, args);
|
|
55
|
-
}, threshhold);
|
|
56
|
-
} else {
|
|
57
|
-
last = now;
|
|
58
|
-
fn.apply(context, args);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Debounce
|
|
64
|
-
* See http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
|
|
65
|
-
*
|
|
66
|
-
* @param {Function} func The function to debounce
|
|
67
|
-
* @param {Integer} execAsap Whether to execute the function now
|
|
68
|
-
* @param {Integer} threshold The detection period, in milliseconds
|
|
69
|
-
* @param {Object} scope The context for the debounced function
|
|
70
|
-
* @return {Function} { The debounced function }
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
exports.throttle = throttle;
|
|
75
|
-
|
|
76
|
-
var debounce = function debounce(func, execAsap, threshold, scope) {
|
|
77
|
-
if (execAsap === void 0) {
|
|
78
|
-
execAsap = false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (threshold === void 0) {
|
|
82
|
-
threshold = 100;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (scope === void 0) {
|
|
86
|
-
scope = null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
var timeout;
|
|
90
|
-
return function debounced() {
|
|
91
|
-
var context = scope || this,
|
|
92
|
-
args = arguments;
|
|
93
|
-
|
|
94
|
-
function delayed() {
|
|
95
|
-
if (!execAsap) func.apply(context, args);
|
|
96
|
-
timeout = null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (timeout) clearTimeout(timeout);else if (execAsap) func.apply(context, args);
|
|
100
|
-
timeout = setTimeout(delayed, threshold);
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
/**
|
|
104
|
-
* Turns a string into a slug.
|
|
105
|
-
* See {@link https://gist.github.com/mathewbyrne/1280286#gistcomment-1606270|this gist}.
|
|
106
|
-
*
|
|
107
|
-
* @param {string} str { The string to slugify }
|
|
108
|
-
* @returns {string} { The slugified string }
|
|
109
|
-
*
|
|
110
|
-
* @example <caption>Example slugifying</caption>
|
|
111
|
-
* import { slugify } from "./utils";
|
|
112
|
-
* // returns "a-string-to-transform-and-slugify"
|
|
113
|
-
* slugify("A (string) to transform & slugify!");
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
exports.debounce = debounce;
|
|
118
|
-
|
|
119
|
-
var slugify = function slugify(str) {
|
|
120
|
-
return trim(str).toLowerCase().replace(/\s+/g, "-") // Replace spaces with -
|
|
121
|
-
.replace(/&/g, "-and-") // Replace & with 'and'
|
|
122
|
-
.replace(/[^\w-]+/g, "") // Remove all non-word chars
|
|
123
|
-
.replace(/^-+/g, "") // Trim dashes from the start
|
|
124
|
-
.replace(/-+$/g, "") // Trim dashes from the end
|
|
125
|
-
.replace(/-{2,}/g, "-"); // Replace multiple - with single -
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Generates a unique id in the form prefix-n by incrementing a counter.
|
|
129
|
-
* The first time this is called it will return "uid-1" then "uid-2" and so on.
|
|
130
|
-
* See {@link http://stackoverflow.com/a/20302361|This StackOverflow answer}.
|
|
131
|
-
*
|
|
132
|
-
* @param {string} prefix { The prefix for the id to return. Defaults to "uid" }
|
|
133
|
-
* @return {string} { The unique id }
|
|
134
|
-
*
|
|
135
|
-
* @example <caption>Simple example</caption>
|
|
136
|
-
* import { nextUniqueId } from "./utils";
|
|
137
|
-
* // returns "uid-1"
|
|
138
|
-
* nextUniqueId();
|
|
139
|
-
*
|
|
140
|
-
* @example <caption>Prefix example</caption>
|
|
141
|
-
* import utils from "./utils";
|
|
142
|
-
* // returns "prefix-1"
|
|
143
|
-
* utils.nextUniqueId("prefix");
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
exports.slugify = slugify;
|
|
148
|
-
|
|
149
|
-
var nextUniqueId = function (i) {
|
|
150
|
-
return function (prefix) {
|
|
151
|
-
if (prefix === void 0) {
|
|
152
|
-
prefix = "uid";
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return prefix + "-" + ++i;
|
|
156
|
-
};
|
|
157
|
-
}(0);
|
|
158
|
-
/**
|
|
159
|
-
* CamelCases a string
|
|
160
|
-
* @param {string} str The string to camel case
|
|
161
|
-
*/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
exports.nextUniqueId = nextUniqueId;
|
|
165
|
-
|
|
166
|
-
var camelCase = function camelCase(str) {
|
|
167
|
-
str = str.split("-").join(" "); // To support kebab-case
|
|
168
|
-
// See https://stackoverflow.com/a/2970667/486434
|
|
169
|
-
|
|
170
|
-
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function (letter, index) {
|
|
171
|
-
return index === 0 ? letter.toLowerCase() : letter.toUpperCase();
|
|
172
|
-
}).replace(/\s+/g, "");
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
exports.camelCase = camelCase;
|
|
176
|
-
var _default = {
|
|
177
|
-
throttle: throttle,
|
|
178
|
-
debounce: debounce,
|
|
179
|
-
slugify: slugify,
|
|
180
|
-
nextUniqueId: nextUniqueId,
|
|
181
|
-
camelCase: camelCase
|
|
182
|
-
};
|
|
183
|
-
exports["default"] = _default;
|
|
184
|
-
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["trim","str","replace","throttle","fn","threshhold","scope","last","deferTimer","throttled","context","now","Date","args","arguments","clearTimeout","setTimeout","apply","debounce","func","execAsap","threshold","timeout","debounced","delayed","slugify","toLowerCase","nextUniqueId","i","prefix","camelCase","split","join","letter","index","toUpperCase"],"sources":["../src/utils.js"],"sourcesContent":["/**\n * @module Utils\n * Utility functions\n */\n\n/**\n * Trims whitespace characters from the start and end of a string.\n * This utility method exists because String.prototype.trim is\n * not supported in IE8.\n *\n * @param {string} str The string to trim\n */\nexport const trim = function (str) {\n\treturn str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, \"\");\n};\n\n/**\n * Throttle events\n * See https://remysharp.com/2010/07/21/throttling-function-calls\n *\n * @param {Function} func The function to throttle\n * @param {Integer} threshold The threshhold period, in milliseconds\n * @param {Object} scope The context of the throttled function\n * @return {Function} { The throttled function }\n */\nexport const throttle = function (fn, threshhold = 100, scope = null) {\n\tlet last, deferTimer;\n\n\treturn function throttled() {\n\t\tlet context = scope || this,\n\t\t\tnow = +new Date(),\n\t\t\targs = arguments;\n\n\t\tif (last && now < last + threshhold) {\n\t\t\t// hold on to it\n\t\t\tclearTimeout(deferTimer);\n\t\t\tdeferTimer = setTimeout(function () {\n\t\t\t\tlast = now;\n\t\t\t\tfn.apply(context, args);\n\t\t\t}, threshhold);\n\t\t} else {\n\t\t\tlast = now;\n\t\t\tfn.apply(context, args);\n\t\t}\n\t};\n};\n\n/**\n * Debounce\n * See http://unscriptable.com/2009/03/20/debouncing-javascript-methods/\n *\n * @param {Function} func The function to debounce\n * @param {Integer} execAsap Whether to execute the function now\n * @param {Integer} threshold The detection period, in milliseconds\n * @param {Object} scope The context for the debounced function\n * @return {Function} { The debounced function }\n */\nexport const debounce = function (\n\tfunc,\n\texecAsap = false,\n\tthreshold = 100,\n\tscope = null\n) {\n\tlet timeout;\n\n\treturn function debounced() {\n\t\tlet context = scope || this,\n\t\t\targs = arguments;\n\n\t\tfunction delayed() {\n\t\t\tif (!execAsap) func.apply(context, args);\n\t\t\ttimeout = null;\n\t\t}\n\n\t\tif (timeout) clearTimeout(timeout);\n\t\telse if (execAsap) func.apply(context, args);\n\n\t\ttimeout = setTimeout(delayed, threshold);\n\t};\n};\n\n/**\n * Turns a string into a slug.\n * See {@link https://gist.github.com/mathewbyrne/1280286#gistcomment-1606270|this gist}.\n *\n * @param {string} str { The string to slugify }\n * @returns {string} { The slugified string }\n *\n * @example <caption>Example slugifying</caption>\n * import { slugify } from \"./utils\";\n * // returns \"a-string-to-transform-and-slugify\"\n * slugify(\"A (string) to transform & slugify!\");\n */\nexport const slugify = (str) => {\n\treturn trim(str)\n\t\t.toLowerCase()\n\t\t.replace(/\\s+/g, \"-\") // Replace spaces with -\n\t\t.replace(/&/g, \"-and-\") // Replace & with 'and'\n\t\t.replace(/[^\\w-]+/g, \"\") // Remove all non-word chars\n\t\t.replace(/^-+/g, \"\") // Trim dashes from the start\n\t\t.replace(/-+$/g, \"\") // Trim dashes from the end\n\t\t.replace(/-{2,}/g, \"-\"); // Replace multiple - with single -\n};\n\n/**\n * Generates a unique id in the form prefix-n by incrementing a counter.\n * The first time this is called it will return \"uid-1\" then \"uid-2\" and so on.\n * See {@link http://stackoverflow.com/a/20302361|This StackOverflow answer}.\n *\n * @param {string} prefix { The prefix for the id to return. Defaults to \"uid\" }\n * @return {string} { The unique id }\n *\n * @example <caption>Simple example</caption>\n * import { nextUniqueId } from \"./utils\";\n * // returns \"uid-1\"\n * nextUniqueId();\n *\n * @example <caption>Prefix example</caption>\n * import utils from \"./utils\";\n * // returns \"prefix-1\"\n * utils.nextUniqueId(\"prefix\");\n */\nexport const nextUniqueId = (function (i) {\n\treturn function (prefix = \"uid\") {\n\t\treturn `${prefix}-${++i}`;\n\t};\n})(0);\n\n/**\n * CamelCases a string\n * @param {string} str The string to camel case\n */\nexport const camelCase = function (str) {\n\tstr = str.split(\"-\").join(\" \"); // To support kebab-case\n\t// See https://stackoverflow.com/a/2970667/486434\n\treturn str\n\t\t.replace(/(?:^\\w|[A-Z]|\\b\\w)/g, function (letter, index) {\n\t\t\treturn index === 0 ? letter.toLowerCase() : letter.toUpperCase();\n\t\t})\n\t\t.replace(/\\s+/g, \"\");\n};\n\nexport default {\n\tthrottle: throttle,\n\tdebounce: debounce,\n\tslugify: slugify,\n\tnextUniqueId: nextUniqueId,\n\tcamelCase: camelCase\n};\n"],"mappings":";;;;;AAAA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;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