@stanko/ctrls 0.1.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/README.md +359 -0
- package/dist/ctrls/ctrl-boolean.d.ts +22 -0
- package/dist/ctrls/ctrl-boolean.js +67 -0
- package/dist/ctrls/ctrl-dual-range.d.ts +47 -0
- package/dist/ctrls/ctrl-dual-range.js +113 -0
- package/dist/ctrls/ctrl-easing.d.ts +37 -0
- package/dist/ctrls/ctrl-easing.js +288 -0
- package/dist/ctrls/ctrl-radio.d.ts +28 -0
- package/dist/ctrls/ctrl-radio.js +83 -0
- package/dist/ctrls/ctrl-range.d.ts +25 -0
- package/dist/ctrls/ctrl-range.js +83 -0
- package/dist/ctrls/ctrl-seed.d.ts +22 -0
- package/dist/ctrls/ctrl-seed.js +79 -0
- package/dist/ctrls/index.d.ts +114 -0
- package/dist/ctrls/index.js +158 -0
- package/dist/ctrls.css +716 -0
- package/dist/ctrls.css.map +1 -0
- package/dist/utils/alea.d.ts +2 -0
- package/dist/utils/alea.js +41 -0
- package/dist/utils/generate-seed.d.ts +1 -0
- package/dist/utils/generate-seed.js +10 -0
- package/dist/utils/icons.d.ts +3 -0
- package/dist/utils/icons.js +4 -0
- package/dist/utils/random.d.ts +2 -0
- package/dist/utils/random.js +7 -0
- package/dist/utils/round-to-step.d.ts +1 -0
- package/dist/utils/round-to-step.js +5 -0
- package/dist/utils/string-utils.d.ts +3 -0
- package/dist/utils/string-utils.js +9 -0
- package/dist/utils/words.d.ts +1 -0
- package/dist/utils/words.js +1954 -0
- package/package.json +47 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../node_modules/@stanko/dual-range-input/dist/index.css","../src/scss/_ctrls.scss"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;;;;AC3IF;EACE;AAAA;AAAA;EAGA;EACA;EACA;EACA;EAGA;EACA;EAEA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EAGA;EAGA;EACA;EACA;EAGA;EACA;EAGA;EAGA;EAEA;EACA;EAEA;EACA;EAGA;EAGA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EAGA;EACA;EAEA;EAEA;EACA;EAEA;EAGA;EAEA;EACA;;;AA0CF;EACE;IAtCA;IAEA;IACA;IAGA;IACA;IACA;IACA;IACA;IACA;IAGA;IAGA;IACA;IACA;IAGA;IACA;IAGA;IAGA;IAEA;IAGA;;;AASF;EA3CE;EAEA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EAGA;EAGA;EACA;EACA;EAGA;EACA;EAGA;EAGA;EAEA;EAGA;;;AAeF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;EAGE;EACA;EACA;;AAGF;AAAA;EAEE;EACA;EACA;;AAGF;EACE;EACA;;;AAIJ;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;;AAGF;EAEE;;AAGF;EACE;EACA,YACE;;AAIJ;EACE;;;AAKJ;EACE;EACA;EACA;EACA;EACA;;AAEA;EAEE;EACA;;;AAOA;EACE;;AAGF;AAAA;AAAA;EAEE;;;AAKN;AAEA;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAKA;AAAA;EACE;EACA;EACA;;;AAIJ;AAEA;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAKJ;EACE;EACA;EACA;;;AAIF;EACE;;;AAIF;EACE;;;AAIF;EACE;EACA;;;AAGF;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAmCJ;EA5BE;EACA;EACA;EACA;EACA;EAEA;;;AA0BF;EAhCE;EACA;EACA;EACA;EACA;EAEA;;;AA8BF;EAtBE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAkBA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAKF;EAvDE;EACA;EACA;EACA;EACA;EAEA;;;AAqDF;EA7CE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAwCA;EACA;;;AAGF;EACE;EACA;;;AAGF;AAEA;EAGE;;AAEA;EACE;;AANJ;EASE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;;;AAIJ;AAEA;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;EAEF;EACA;EACA;;AAEA;EAEE;EACA;;;AAIJ;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;AAEA;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;;AAIE;EACE;;;AAKN;AAEA;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAEA;AAAA;EAEE;EACA;EACA;;;AAIJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,YACE;;AAGF;EAEE;EACA;;;AAIJ;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EAEE;;AAEA;EACE;EACA","file":"ctrls.css"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Algorithm by Johannes Baagøe
|
|
2
|
+
// Slim TypeScript version of this implementation:
|
|
3
|
+
// https://github.com/coverslide/node-alea
|
|
4
|
+
const getMash = () => {
|
|
5
|
+
let n = 0xefc8249d;
|
|
6
|
+
const mash = (seed) => {
|
|
7
|
+
for (let i = 0; i < seed.length; i++) {
|
|
8
|
+
n += seed.charCodeAt(i);
|
|
9
|
+
let h = 0.02519603282416938 * n;
|
|
10
|
+
n = h >>> 0;
|
|
11
|
+
h -= n;
|
|
12
|
+
h *= n;
|
|
13
|
+
n = h >>> 0;
|
|
14
|
+
h -= n;
|
|
15
|
+
n += h * 0x100000000; // 2^32
|
|
16
|
+
}
|
|
17
|
+
return (n >>> 0) * 2.3283064365386963e-10; // 2^-32
|
|
18
|
+
};
|
|
19
|
+
return mash;
|
|
20
|
+
};
|
|
21
|
+
const Alea = (seed = Date.now().toString()) => {
|
|
22
|
+
let s = [0, 0, 0];
|
|
23
|
+
let c = 1;
|
|
24
|
+
let mash = getMash();
|
|
25
|
+
s.forEach((_, i) => {
|
|
26
|
+
s[i] = mash(" ") - mash(seed);
|
|
27
|
+
if (s[i] < 0) {
|
|
28
|
+
s[i] += 1;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const random = () => {
|
|
32
|
+
const t = 2091639 * s[0] + c * 2.3283064365386963e-10; // 2^-32
|
|
33
|
+
c = t | 0;
|
|
34
|
+
s[0] = s[1];
|
|
35
|
+
s[1] = s[2];
|
|
36
|
+
s[2] = t - c;
|
|
37
|
+
return s[2];
|
|
38
|
+
};
|
|
39
|
+
return random;
|
|
40
|
+
};
|
|
41
|
+
export default Alea;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function generateSeed(): string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const checkIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6 9 17l-5-5\"/></svg>";
|
|
2
|
+
export declare const refreshIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\"/><path d=\"M21 3v5h-5\"/><path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\"/><path d=\"M8 16H3v5\"/></svg>";
|
|
3
|
+
export declare const diceIcon = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" ry=\"2\" stroke-width=\"2\"/><path d=\"M16 8h.01\"/><path d=\"M8 8h.01\"/><path d=\"M8 16h.01\"/><path d=\"M16 16h.01\"/><path d=\"M12 12h.01\"/></svg>";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Icons from https://lucide.dev/
|
|
2
|
+
export const checkIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>`;
|
|
3
|
+
export const refreshIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/></svg>`;
|
|
4
|
+
export const diceIcon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" ry="2" stroke-width="2"/><path d="M16 8h.01"/><path d="M8 8h.01"/><path d="M8 16h.01"/><path d="M16 16h.01"/><path d="M12 12h.01"/></svg>`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const roundToStep: (value: number, step: number) => number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const toKebabCase = (str) => {
|
|
2
|
+
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
3
|
+
};
|
|
4
|
+
export const toCamelCase = (str) => {
|
|
5
|
+
return str.replace(/([-_ ][a-z])/g, (group) => group.toUpperCase().replace(/[-_ ]/, ''));
|
|
6
|
+
};
|
|
7
|
+
export const toSpaceCase = (str) => {
|
|
8
|
+
return str.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase();
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const words: string[];
|