@awesomeness-js/server 1.0.2 → 1.1.1
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 +61 -0
- package/build/build.js +7 -0
- package/build/postBuild.js +7 -0
- package/example-.awesomeness/componentLocations.js +15 -0
- package/example-.awesomeness/config.js +5 -21
- package/example-site/example.awesomenessjs.com/api/readme.md +1 -0
- package/example-site/example.awesomenessjs.com/components/example/index.js +3 -0
- package/example-site/example.awesomenessjs.com/components/notCommonExample/_.css +1 -0
- package/example-site/example.awesomenessjs.com/components/notCommonExample/index.js +3 -0
- package/example-site/example.awesomenessjs.com/pages/_md/_info.js +15 -0
- package/example-site/example.awesomenessjs.com/pages/_md/css/example.css +4 -0
- package/example-site/example.awesomenessjs.com/pages/_md/drafts/example.md +32 -0
- package/example-site/example.awesomenessjs.com/pages/_md/getBlogData.js +117 -0
- package/example-site/example.awesomenessjs.com/pages/_md/getData.js +36 -0
- package/example-site/example.awesomenessjs.com/pages/_md/js/callToAction.js +43 -0
- package/example-site/example.awesomenessjs.com/pages/_md/js/init.js +88 -0
- package/example-site/example.awesomenessjs.com/pages/_md/meta.template.md +33 -0
- package/example-site/example.awesomenessjs.com/pages/_md/pages/mission.md +345 -0
- package/example-site/example.awesomenessjs.com/pages/_template/_info.js +9 -0
- package/example-site/example.awesomenessjs.com/pages/_template/css/_.css +4 -0
- package/example-site/example.awesomenessjs.com/pages/_template/getData.js +6 -0
- package/example-site/example.awesomenessjs.com/pages/_template/js/init.js +3 -0
- package/example-site/example.awesomenessjs.com/pages/blog/_info.js +14 -0
- package/example-site/example.awesomenessjs.com/pages/blog/css/topics.css +17 -0
- package/example-site/example.awesomenessjs.com/pages/blog/getData.js +22 -0
- package/example-site/example.awesomenessjs.com/pages/blog/js/colors.js +159 -0
- package/example-site/example.awesomenessjs.com/pages/blog/js/init.js +242 -0
- package/example-site/example.awesomenessjs.com/pages/blog/js/tag.js +111 -0
- package/example-site/example.awesomenessjs.com/pages/examples/_info.js +9 -0
- package/example-site/example.awesomenessjs.com/pages/examples/css/footer.css +6 -0
- package/example-site/example.awesomenessjs.com/pages/examples/css/intro.css +67 -0
- package/example-site/example.awesomenessjs.com/pages/examples/css/nav.css +221 -0
- package/example-site/example.awesomenessjs.com/pages/examples/getData.js +8 -0
- package/example-site/example.awesomenessjs.com/pages/examples/js/init.js +15 -0
- package/example-site/example.awesomenessjs.com/pages/examples/js/updateState.js +14 -0
- package/example-site/example.awesomenessjs.com/pages/start/_info.js +11 -0
- package/example-site/example.awesomenessjs.com/pages/start/css/footer.css +6 -0
- package/example-site/example.awesomenessjs.com/pages/start/css/intro.css +67 -0
- package/example-site/example.awesomenessjs.com/pages/start/css/nav.css +221 -0
- package/example-site/example.awesomenessjs.com/pages/start/getData.js +8 -0
- package/example-site/example.awesomenessjs.com/pages/start/js/init.js +30 -0
- package/example-site/example.awesomenessjs.com/pages/start/js/updateState.js +14 -0
- package/example-site/example.awesomenessjs.com/public/images/awesomeness.webp +0 -0
- package/example-site/example.awesomenessjs.com/public/manifest.webmanifest.json +8 -0
- package/example-site/example.awesomenessjs.com/specialRoutes.js +14 -0
- package/index.js +105 -25
- package/package.json +5 -2
- package/{server → src}/applicationMap.js +1 -1
- package/{server → src}/awesomenessNormalizeRequest.js +24 -3
- package/{server → src}/componentDependencies.js +11 -5
- package/{config.js → src/config.js} +6 -1
- package/{server → src}/fetchPage.js +6 -6
- package/src/getConfig.js +3 -0
- package/src/init.js +3 -0
- package/{server → src}/koa/attachAwesomenessRequest.js +5 -6
- package/{server → src}/koa/cors.js +2 -4
- package/{server → src}/koa/errorHandler.js +3 -3
- package/{server → src}/koa/finalFormat.js +2 -5
- package/{server → src}/koa/jsonBodyParser.js +3 -3
- package/src/koa/routeRequest.js +334 -0
- package/{server → src}/koa/serverUp.js +2 -4
- package/{server → src}/koa/staticFiles.js +10 -11
- package/{server → src}/koa/timeout.js +3 -3
- package/{server → src}/pageInfo.js +6 -6
- package/{server → src}/reRoute.js +3 -2
- package/{server → src}/resolveRealCasePath.js +1 -1
- package/{start.js → src/start.js} +14 -13
- package/{server → src}/validateRequest.js +1 -1
- package/{server → src}/ws/handlers.js +4 -2
- package/{server → src}/ws/index.js +2 -2
- package/ui/README.md +438 -0
- package/ui/awesomeness-ui.instructions.md +156 -0
- package/ui/build.js +119 -0
- package/ui/commonComponent.test.js +27 -0
- package/ui/components/blogPost/all.css +371 -0
- package/ui/components/blogPost/headerImage.js +153 -0
- package/ui/components/blogPost/index.js +45 -0
- package/ui/components/blogPost/marked.js +74 -0
- package/ui/components/blogPost/md.js +73 -0
- package/ui/components/blogPost/parseAwesomeness.jQuery.js +47 -0
- package/ui/components/blogPost/readme.md +8 -0
- package/ui/components/colors/README.md +65 -0
- package/ui/components/colors/dynamic.css +1884 -0
- package/ui/components/colors/dynamic.css.js +135 -0
- package/ui/components/colors/dynamic.css.php +79 -0
- package/ui/components/colors/example.js +133 -0
- package/ui/components/colors/index.js +65 -0
- package/ui/components/colors/map.js +13 -0
- package/ui/components/colors/random.js +17 -0
- package/ui/components/colors/tailwind-colors.css +247 -0
- package/ui/components/insertIntoList/insertIntoList.jquery.js +150 -0
- package/ui/components/statusPage/index.css +120 -0
- package/ui/components/statusPage/index.js +39 -0
- package/ui/components/tag/category.js +8 -0
- package/ui/components/tag/index.js +33 -0
- package/ui/components/tag/list.js +42 -0
- package/ui/components/tag/map.js +64 -0
- package/ui/components/tag/tagMap.css +60 -0
- package/ui/components/tag/tags.css +20 -0
- package/ui/core/css/_normalize.css +57 -0
- package/ui/core/css/dynamic/flex.js +36 -0
- package/ui/core/css/dynamic/grid.js +185 -0
- package/ui/core/css/dynamic/shortcuts.js +48 -0
- package/ui/core/css/dynamic/spacing.js +61 -0
- package/ui/core/css/dynamic/text.js +80 -0
- package/ui/core/css/dynamic/width.js +75 -0
- package/ui/core/css/dynamic.js +40 -0
- package/ui/core/js/app/api.js +143 -0
- package/ui/core/js/app/init.js +88 -0
- package/ui/core/js/app/initDarkMode.js +26 -0
- package/ui/core/js/app/initialScroll.js +28 -0
- package/ui/core/js/app/meta/update/components.js +65 -0
- package/ui/core/js/app/meta/update/pages.js +86 -0
- package/ui/core/js/app/metaUpdates.js +10 -0
- package/ui/core/js/app/page.js +319 -0
- package/ui/core/js/app/resize.js +52 -0
- package/ui/core/js/app/state/back.js +16 -0
- package/ui/core/js/app/state/create.js +50 -0
- package/ui/core/js/app/state/get.js +5 -0
- package/ui/core/js/app/state/init.js +25 -0
- package/ui/core/js/app.js +41 -0
- package/ui/core/js/jquery-3.7.1.min.js +2 -0
- package/ui/core/public/app.css +1 -0
- package/ui/core/public/app.js +975 -0
- package/ui/core/public/favicon.ico +0 -0
- package/ui/core/public/index.html +40 -0
- package/server/koa/routeRequest.js +0 -286
- /package/{server/errors.js → errors.js} +0 -0
- /package/{server → src}/brotliJsonResponse.js +0 -0
- /package/{server → src}/checkAccess.js +0 -0
- /package/{server → src}/getMD.js +0 -0
- /package/{server → src}/specialPaths.js +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import {
|
|
3
|
+
dirname, join
|
|
4
|
+
} from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
|
|
7
|
+
// Get the current directory of this script file
|
|
8
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
|
|
10
|
+
const dynamicColors = ()=>{
|
|
11
|
+
|
|
12
|
+
const colorNames = [
|
|
13
|
+
"red",
|
|
14
|
+
"orange",
|
|
15
|
+
"amber",
|
|
16
|
+
"yellow",
|
|
17
|
+
"lime",
|
|
18
|
+
"green",
|
|
19
|
+
"emerald",
|
|
20
|
+
"teal",
|
|
21
|
+
"cyan",
|
|
22
|
+
"sky",
|
|
23
|
+
"blue",
|
|
24
|
+
"indigo",
|
|
25
|
+
"violet",
|
|
26
|
+
"purple",
|
|
27
|
+
"fuchsia",
|
|
28
|
+
"pink",
|
|
29
|
+
"rose",
|
|
30
|
+
"slate",
|
|
31
|
+
"gray",
|
|
32
|
+
"zinc",
|
|
33
|
+
"neutral",
|
|
34
|
+
"stone"
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const preFixes = {
|
|
38
|
+
'bg': 'background-color',
|
|
39
|
+
'border': 'border-color',
|
|
40
|
+
'text': 'color'
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const shades = [
|
|
44
|
+
50,
|
|
45
|
+
100,
|
|
46
|
+
200,
|
|
47
|
+
300,
|
|
48
|
+
400,
|
|
49
|
+
500,
|
|
50
|
+
600,
|
|
51
|
+
700,
|
|
52
|
+
800,
|
|
53
|
+
900,
|
|
54
|
+
950
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
let css = "";
|
|
58
|
+
|
|
59
|
+
Object.keys(preFixes).forEach((preFix)=>{
|
|
60
|
+
|
|
61
|
+
// black and white
|
|
62
|
+
css += `.${preFix}-black{${preFixes[preFix]}:var(--black)}\n`;
|
|
63
|
+
css += `.${preFix}-white{${preFixes[preFix]}:var(--white)}\n`;
|
|
64
|
+
|
|
65
|
+
css += `.${preFix}-black--hover:hover{${preFixes[preFix]}:var(--black)}\n`;
|
|
66
|
+
css += `.${preFix}-white--hover:hover{${preFixes[preFix]}:var(--white)}\n`;
|
|
67
|
+
|
|
68
|
+
// border
|
|
69
|
+
const borderThicknesses = [ 1, 2, 3, 4, 5, 6, 7, 8 ];
|
|
70
|
+
|
|
71
|
+
borderThicknesses.forEach((width) => {
|
|
72
|
+
|
|
73
|
+
css += `.border-${width}{border-style:solid; border-width: ${width}px;}\n`;
|
|
74
|
+
|
|
75
|
+
// top left, bottom, right
|
|
76
|
+
css += `.border-top-${width}{border-top-width:${width}px}\n`;
|
|
77
|
+
css += `.border-bottom-${width}{border-bottom-width:${width}px}\n`;
|
|
78
|
+
css += `.border-left-${width}{border-left-width:${width}px}\n`;
|
|
79
|
+
css += `.border-right-${width}{border-right-width:${width}px}\n`;
|
|
80
|
+
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// 1 - 100
|
|
84
|
+
const borderRadiusThicknesses = [];
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
for (let i = 1; i <= 100; i++) {
|
|
88
|
+
|
|
89
|
+
borderRadiusThicknesses.push(i);
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
borderRadiusThicknesses.forEach((width) => {
|
|
94
|
+
|
|
95
|
+
css += `.border-radius-${width}{border-radius:${width}px}\n`;
|
|
96
|
+
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
colorNames.forEach((colorName)=>{
|
|
101
|
+
|
|
102
|
+
shades.forEach((shade)=>{
|
|
103
|
+
|
|
104
|
+
css += `.${preFix}-${colorName}-${shade}{${preFixes[preFix]}:var(--${colorName}-${shade})}\n`;
|
|
105
|
+
css += `.${preFix}-${colorName}-${shade}--hover:hover{${preFixes[preFix]}:var(--${colorName}-${shade})}\n`;
|
|
106
|
+
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
css,
|
|
116
|
+
shades,
|
|
117
|
+
colorNames,
|
|
118
|
+
preFixes
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
async function cssBuild(){
|
|
124
|
+
|
|
125
|
+
const { css } = dynamicColors();
|
|
126
|
+
const filePath = join(__dirname, 'dynamic.css'); // Ensures it's written to the current working directory
|
|
127
|
+
|
|
128
|
+
await fs.writeFile(filePath, css, 'utf8');
|
|
129
|
+
|
|
130
|
+
return true;
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
export { cssBuild };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
function dynamicColors() {
|
|
4
|
+
$colorNames = [
|
|
5
|
+
"amber",
|
|
6
|
+
"blue",
|
|
7
|
+
"cyan",
|
|
8
|
+
"emerald",
|
|
9
|
+
"fuchsia",
|
|
10
|
+
"gray",
|
|
11
|
+
"green",
|
|
12
|
+
"indigo",
|
|
13
|
+
"lime",
|
|
14
|
+
"neutral",
|
|
15
|
+
"orange",
|
|
16
|
+
"pink",
|
|
17
|
+
"purple",
|
|
18
|
+
"red",
|
|
19
|
+
"rose",
|
|
20
|
+
"sky",
|
|
21
|
+
"slate",
|
|
22
|
+
"stone",
|
|
23
|
+
"teal",
|
|
24
|
+
"violet",
|
|
25
|
+
"yellow",
|
|
26
|
+
"zinc",
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
$preFixes = [
|
|
30
|
+
'bg' => 'background-color',
|
|
31
|
+
'border' => 'border-color',
|
|
32
|
+
'text' => 'color'
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
$shades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
36
|
+
|
|
37
|
+
$css = "";
|
|
38
|
+
|
|
39
|
+
foreach ($preFixes as $preFix => $cssProp) {
|
|
40
|
+
// black and white
|
|
41
|
+
$css .= ".$preFix-black{{$cssProp}:var(--black)}\n";
|
|
42
|
+
$css .= ".$preFix-white{{$cssProp}:var(--white)}\n";
|
|
43
|
+
|
|
44
|
+
// border widths
|
|
45
|
+
$borderThicknesses = range(1, 8);
|
|
46
|
+
foreach ($borderThicknesses as $width) {
|
|
47
|
+
$css .= ".border-$width{border-width:{$width}px}\n";
|
|
48
|
+
$css .= ".border-top-$width{border-top-width:{$width}px}\n";
|
|
49
|
+
$css .= ".border-bottom-$width{border-bottom-width:{$width}px}\n";
|
|
50
|
+
$css .= ".border-left-$width{border-left-width:{$width}px}\n";
|
|
51
|
+
$css .= ".border-right-$width{border-right-width:{$width}px}\n";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// border radius 1-100
|
|
55
|
+
foreach (range(1, 100) as $radius) {
|
|
56
|
+
$css .= ".border-radius-$radius{border-radius:{$radius}px}\n";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// color + shade combos
|
|
60
|
+
foreach ($colorNames as $colorName) {
|
|
61
|
+
foreach ($shades as $shade) {
|
|
62
|
+
$css .= ".{$preFix}-{$colorName}-{$shade}{{$cssProp}:var(--{$colorName}-{$shade})}\n";
|
|
63
|
+
$css .= ".{$preFix}-{$colorName}-{$shade}--hover:hover{{$cssProp}:var(--{$colorName}-{$shade})}\n";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return $css;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function cssBuild() {
|
|
72
|
+
$css = dynamicColors();
|
|
73
|
+
$filePath = __DIR__ . '/dynamic.css';
|
|
74
|
+
file_put_contents($filePath, $css);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Run the build when the script executes
|
|
79
|
+
cssBuild();
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export default ({
|
|
2
|
+
exampleParam = 'test'
|
|
3
|
+
} = {}) => {
|
|
4
|
+
|
|
5
|
+
let $container = $(`<div class="grid-1 gap-40 plr40"></div>`);
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
preFixes,
|
|
9
|
+
colors,
|
|
10
|
+
colorGroups,
|
|
11
|
+
shades
|
|
12
|
+
} = ui.colors();
|
|
13
|
+
|
|
14
|
+
const $shadePicker = $(`<div></div>`).appendTo($container);
|
|
15
|
+
|
|
16
|
+
$shadePicker.append('<h3 class="mb10"></h3>');
|
|
17
|
+
|
|
18
|
+
const $shadeSelected = $(`<h3>Pick a Shade</h3>`).appendTo($shadePicker);
|
|
19
|
+
|
|
20
|
+
const $shadeList = $(`<div class="grid-11 gap-10"></div>`).appendTo($shadePicker);
|
|
21
|
+
|
|
22
|
+
shades.forEach((shade) => {
|
|
23
|
+
|
|
24
|
+
const textShade = shade >= 400 ? 50 : 700;
|
|
25
|
+
|
|
26
|
+
const $shadeBox = $(`<div class="bg-gray-${shade} text-center p20 cursor-pointer text-gray-${textShade}">${shade}</div>`)
|
|
27
|
+
.appendTo($shadeList)
|
|
28
|
+
.click(() => {
|
|
29
|
+
|
|
30
|
+
chooseShade(shade);
|
|
31
|
+
|
|
32
|
+
$shadeSelected.html(`Pick a Shade - <strong>${shade}</strong>`);
|
|
33
|
+
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const $colors = $(`<div class="grid-1 gap-10"></div>`).appendTo($container);
|
|
40
|
+
const $colorDetails = $(`<div class=""></div>`).appendTo($container);
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function chooseShade(shade) {
|
|
44
|
+
|
|
45
|
+
$colors.empty();
|
|
46
|
+
$colorDetails.empty();
|
|
47
|
+
|
|
48
|
+
$.each(colorGroups, (groupName, groupColors) => {
|
|
49
|
+
|
|
50
|
+
let hoverShade = shade + 200;
|
|
51
|
+
|
|
52
|
+
if(hoverShade > 700){
|
|
53
|
+
|
|
54
|
+
hoverShade = 500;
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if(hoverShade < 300){
|
|
59
|
+
|
|
60
|
+
hoverShade = 400;
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
const $colorGroup = $(`<div class="grid-${groupColors.length} gap-10"></div>`).appendTo($colors);
|
|
66
|
+
|
|
67
|
+
groupColors.forEach((colorName)=>{
|
|
68
|
+
|
|
69
|
+
const $bgBox = $(`<div class="bg-${colorName}-${shade} bg-${colorName}-${hoverShade}--hover text-white ptb40 text-center cursor-pointer">${colorName}</div>`)
|
|
70
|
+
.appendTo($colorGroup)
|
|
71
|
+
.click(()=>{
|
|
72
|
+
|
|
73
|
+
$colorDetails.empty();
|
|
74
|
+
|
|
75
|
+
const $name = $(`<h3 class="mb10">${colorName}</h3>`).appendTo($colorDetails);
|
|
76
|
+
|
|
77
|
+
const $backgrounds = $(`<div class="grid-11-xl grid-6-d grid-2-p grid-4-t gap-10 mb10"></div>`).appendTo($colorDetails);
|
|
78
|
+
const $borders = $(`<div class="grid-11-xl grid-6-d grid-2-p grid-4-t gap-10 mb10"></div>`).appendTo($colorDetails);
|
|
79
|
+
const $texts = $(`<div class="grid-11-xl grid-6-d grid-2-p grid-4-t gap-10"></div>`).appendTo($colorDetails);
|
|
80
|
+
|
|
81
|
+
shades.forEach((shade) => {
|
|
82
|
+
|
|
83
|
+
const bgClass = `bg-${colorName}-${shade}`;
|
|
84
|
+
const borderClass = `border-${colorName}-${shade}`;
|
|
85
|
+
const textClass = `text-${colorName}-${shade}`;
|
|
86
|
+
|
|
87
|
+
const textColorForBg = shade >= 300 ? 'text-white' : `text-${colorName}-700`;
|
|
88
|
+
|
|
89
|
+
const $bgBox = $(`<div class="${bgClass} ${textColorForBg} p20 text-center">${bgClass}</div>`).appendTo($backgrounds);
|
|
90
|
+
const $borderBox = $(`<div class="${borderClass} border-4 p20 text-center">${borderClass}</div>`).appendTo($borders);
|
|
91
|
+
const $textBox = $(`<div class="${textClass} p20 text-center">${textClass}</div>`).appendTo($texts);
|
|
92
|
+
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const $name = $(`<h3 class="mb10">${colorName}</h3>`).appendTo($colorDetails);
|
|
100
|
+
|
|
101
|
+
const $backgrounds = $(`<div class="grid-11-xl grid-6-d grid-2-p grid-4-t gap-10 mb10"></div>`).appendTo($colorDetails);
|
|
102
|
+
const $borders = $(`<div class="grid-11-xl grid-6-d grid-2-p grid-4-t gap-10 mb10"></div>`).appendTo($colorDetails);
|
|
103
|
+
const $texts = $(`<div class="grid-11-xl grid-6-d grid-2-p grid-4-t gap-10"></div>`).appendTo($colorDetails);
|
|
104
|
+
|
|
105
|
+
shades.forEach((shade) => {
|
|
106
|
+
|
|
107
|
+
const bgClass = `bg-${colorName}-${shade}`;
|
|
108
|
+
const borderClass = `border-${colorName}-${shade}`;
|
|
109
|
+
const textClass = `text-${colorName}-${shade}`;
|
|
110
|
+
|
|
111
|
+
const textColorForBg = shade >= 300 ? 'text-white' : `text-${colorName}-700`;
|
|
112
|
+
|
|
113
|
+
const $bgBox = $(`<div class="${bgClass} ${textColorForBg} p20 text-center">${bgClass}</div>`).appendTo($backgrounds);
|
|
114
|
+
const $borderBox = $(`<div class="${borderClass} border-4 p20 text-center">${borderClass}</div>`).appendTo($borders);
|
|
115
|
+
const $textBox = $(`<div class="${textClass} p20 text-center">${textClass}</div>`).appendTo($texts);
|
|
116
|
+
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
chooseShade(500);
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
return $container;
|
|
132
|
+
|
|
133
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export default () => {
|
|
2
|
+
|
|
3
|
+
const colors = [
|
|
4
|
+
"red",
|
|
5
|
+
"orange",
|
|
6
|
+
"amber",
|
|
7
|
+
"yellow",
|
|
8
|
+
"lime",
|
|
9
|
+
"green",
|
|
10
|
+
"emerald",
|
|
11
|
+
"teal",
|
|
12
|
+
"cyan",
|
|
13
|
+
"sky",
|
|
14
|
+
"blue",
|
|
15
|
+
"indigo",
|
|
16
|
+
"violet",
|
|
17
|
+
"purple",
|
|
18
|
+
"fuchsia",
|
|
19
|
+
"pink",
|
|
20
|
+
"rose",
|
|
21
|
+
"slate",
|
|
22
|
+
"gray",
|
|
23
|
+
"zinc",
|
|
24
|
+
"neutral",
|
|
25
|
+
"stone"
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const colorGroups = {
|
|
29
|
+
'reds': [ 'red', 'rose', 'pink' ],
|
|
30
|
+
'oranges': [ 'orange', 'amber', 'yellow' ],
|
|
31
|
+
'greens': [ 'lime', 'green', 'emerald', 'teal' ],
|
|
32
|
+
'blues': [ 'cyan', 'sky', 'blue' ],
|
|
33
|
+
'purples': [ 'indigo', 'violet', 'purple', 'fuchsia' ],
|
|
34
|
+
'grays': [ 'slate', 'gray', 'zinc', 'neutral', 'stone' ]
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const preFixes = [
|
|
38
|
+
'bg',
|
|
39
|
+
'border',
|
|
40
|
+
'text'
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const shades = [
|
|
45
|
+
50,
|
|
46
|
+
100,
|
|
47
|
+
200,
|
|
48
|
+
300,
|
|
49
|
+
400,
|
|
50
|
+
500,
|
|
51
|
+
600,
|
|
52
|
+
700,
|
|
53
|
+
800,
|
|
54
|
+
900,
|
|
55
|
+
950
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
colorGroups,
|
|
60
|
+
preFixes,
|
|
61
|
+
colors,
|
|
62
|
+
shades
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default ({
|
|
2
|
+
shadeMin = 400,
|
|
3
|
+
shadeMax = 700
|
|
4
|
+
} = {}) => {
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
colors,
|
|
8
|
+
shades
|
|
9
|
+
} = ui.colors();
|
|
10
|
+
|
|
11
|
+
const randomColor = colors[Math.floor(Math.random() * colors.length)];
|
|
12
|
+
const shadeRange = shades.filter((shade) => shade >= shadeMin && shade <= shadeMax);
|
|
13
|
+
const randomShade = shadeRange[Math.floor(Math.random() * shadeRange.length)];
|
|
14
|
+
|
|
15
|
+
return `${randomColor}-${randomShade}`;
|
|
16
|
+
|
|
17
|
+
};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--red-50: oklch(0.971 0.013 17.38);
|
|
3
|
+
--red-100: oklch(0.936 0.032 17.717);
|
|
4
|
+
--red-200: oklch(0.885 0.062 18.334);
|
|
5
|
+
--red-300: oklch(0.808 0.114 19.571);
|
|
6
|
+
--red-400: oklch(0.704 0.191 22.216);
|
|
7
|
+
--red-500: oklch(0.637 0.237 25.331);
|
|
8
|
+
--red-600: oklch(0.577 0.245 27.325);
|
|
9
|
+
--red-700: oklch(0.505 0.213 27.518);
|
|
10
|
+
--red-800: oklch(0.444 0.177 26.899);
|
|
11
|
+
--red-900: oklch(0.396 0.141 25.723);
|
|
12
|
+
--red-950: oklch(0.258 0.092 26.042);
|
|
13
|
+
--orange-50: oklch(0.98 0.016 73.684);
|
|
14
|
+
--orange-100: oklch(0.954 0.038 75.164);
|
|
15
|
+
--orange-200: oklch(0.901 0.076 70.697);
|
|
16
|
+
--orange-300: oklch(0.837 0.128 66.29);
|
|
17
|
+
--orange-400: oklch(0.75 0.183 55.934);
|
|
18
|
+
--orange-500: oklch(0.705 0.213 47.604);
|
|
19
|
+
--orange-600: oklch(0.646 0.222 41.116);
|
|
20
|
+
--orange-700: oklch(0.553 0.195 38.402);
|
|
21
|
+
--orange-800: oklch(0.47 0.157 37.304);
|
|
22
|
+
--orange-900: oklch(0.408 0.123 38.172);
|
|
23
|
+
--orange-950: oklch(0.266 0.079 36.259);
|
|
24
|
+
--amber-50: oklch(0.987 0.022 95.277);
|
|
25
|
+
--amber-100: oklch(0.962 0.059 95.617);
|
|
26
|
+
--amber-200: oklch(0.924 0.12 95.746);
|
|
27
|
+
--amber-300: oklch(0.879 0.169 91.605);
|
|
28
|
+
--amber-400: oklch(0.828 0.189 84.429);
|
|
29
|
+
--amber-500: oklch(0.769 0.188 70.08);
|
|
30
|
+
--amber-600: oklch(0.666 0.179 58.318);
|
|
31
|
+
--amber-700: oklch(0.555 0.163 48.998);
|
|
32
|
+
--amber-800: oklch(0.473 0.137 46.201);
|
|
33
|
+
--amber-900: oklch(0.414 0.112 45.904);
|
|
34
|
+
--amber-950: oklch(0.279 0.077 45.635);
|
|
35
|
+
--yellow-50: oklch(0.987 0.026 102.212);
|
|
36
|
+
--yellow-100: oklch(0.973 0.071 103.193);
|
|
37
|
+
--yellow-200: oklch(0.945 0.129 101.54);
|
|
38
|
+
--yellow-300: oklch(0.905 0.182 98.111);
|
|
39
|
+
--yellow-400: oklch(0.852 0.199 91.936);
|
|
40
|
+
--yellow-500: oklch(0.795 0.184 86.047);
|
|
41
|
+
--yellow-600: oklch(0.681 0.162 75.834);
|
|
42
|
+
--yellow-700: oklch(0.554 0.135 66.442);
|
|
43
|
+
--yellow-800: oklch(0.476 0.114 61.907);
|
|
44
|
+
--yellow-900: oklch(0.421 0.095 57.708);
|
|
45
|
+
--yellow-950: oklch(0.286 0.066 53.813);
|
|
46
|
+
--lime-50: oklch(0.986 0.031 120.757);
|
|
47
|
+
--lime-100: oklch(0.967 0.067 122.328);
|
|
48
|
+
--lime-200: oklch(0.938 0.127 124.321);
|
|
49
|
+
--lime-300: oklch(0.897 0.196 126.665);
|
|
50
|
+
--lime-400: oklch(0.841 0.238 128.85);
|
|
51
|
+
--lime-500: oklch(0.768 0.233 130.85);
|
|
52
|
+
--lime-600: oklch(0.648 0.2 131.684);
|
|
53
|
+
--lime-700: oklch(0.532 0.157 131.589);
|
|
54
|
+
--lime-800: oklch(0.453 0.124 130.933);
|
|
55
|
+
--lime-900: oklch(0.405 0.101 131.063);
|
|
56
|
+
--lime-950: oklch(0.274 0.072 132.109);
|
|
57
|
+
--green-50: oklch(0.982 0.018 155.826);
|
|
58
|
+
--green-100: oklch(0.962 0.044 156.743);
|
|
59
|
+
--green-200: oklch(0.925 0.084 155.995);
|
|
60
|
+
--green-300: oklch(0.871 0.15 154.449);
|
|
61
|
+
--green-400: oklch(0.792 0.209 151.711);
|
|
62
|
+
--green-500: oklch(0.723 0.219 149.579);
|
|
63
|
+
--green-600: oklch(0.627 0.194 149.214);
|
|
64
|
+
--green-700: oklch(0.527 0.154 150.069);
|
|
65
|
+
--green-800: oklch(0.448 0.119 151.328);
|
|
66
|
+
--green-900: oklch(0.393 0.095 152.535);
|
|
67
|
+
--green-950: oklch(0.266 0.065 152.934);
|
|
68
|
+
--emerald-50: oklch(0.979 0.021 166.113);
|
|
69
|
+
--emerald-100: oklch(0.95 0.052 163.051);
|
|
70
|
+
--emerald-200: oklch(0.905 0.093 164.15);
|
|
71
|
+
--emerald-300: oklch(0.845 0.143 164.978);
|
|
72
|
+
--emerald-400: oklch(0.765 0.177 163.223);
|
|
73
|
+
--emerald-500: oklch(0.696 0.17 162.48);
|
|
74
|
+
--emerald-600: oklch(0.596 0.145 163.225);
|
|
75
|
+
--emerald-700: oklch(0.508 0.118 165.612);
|
|
76
|
+
--emerald-800: oklch(0.432 0.095 166.913);
|
|
77
|
+
--emerald-900: oklch(0.378 0.077 168.94);
|
|
78
|
+
--emerald-950: oklch(0.262 0.051 172.552);
|
|
79
|
+
--teal-50: oklch(0.984 0.014 180.72);
|
|
80
|
+
--teal-100: oklch(0.953 0.051 180.801);
|
|
81
|
+
--teal-200: oklch(0.91 0.096 180.426);
|
|
82
|
+
--teal-300: oklch(0.855 0.138 181.071);
|
|
83
|
+
--teal-400: oklch(0.777 0.152 181.912);
|
|
84
|
+
--teal-500: oklch(0.704 0.14 182.503);
|
|
85
|
+
--teal-600: oklch(0.6 0.118 184.704);
|
|
86
|
+
--teal-700: oklch(0.511 0.096 186.391);
|
|
87
|
+
--teal-800: oklch(0.437 0.078 188.216);
|
|
88
|
+
--teal-900: oklch(0.386 0.063 188.416);
|
|
89
|
+
--teal-950: oklch(0.277 0.046 192.524);
|
|
90
|
+
--cyan-50: oklch(0.984 0.019 200.873);
|
|
91
|
+
--cyan-100: oklch(0.956 0.045 203.388);
|
|
92
|
+
--cyan-200: oklch(0.917 0.08 205.041);
|
|
93
|
+
--cyan-300: oklch(0.865 0.127 207.078);
|
|
94
|
+
--cyan-400: oklch(0.789 0.154 211.53);
|
|
95
|
+
--cyan-500: oklch(0.715 0.143 215.221);
|
|
96
|
+
--cyan-600: oklch(0.609 0.126 221.723);
|
|
97
|
+
--cyan-700: oklch(0.52 0.105 223.128);
|
|
98
|
+
--cyan-800: oklch(0.45 0.085 224.283);
|
|
99
|
+
--cyan-900: oklch(0.398 0.07 227.392);
|
|
100
|
+
--cyan-950: oklch(0.302 0.056 229.695);
|
|
101
|
+
--sky-50: oklch(0.977 0.013 236.62);
|
|
102
|
+
--sky-100: oklch(0.951 0.026 236.824);
|
|
103
|
+
--sky-200: oklch(0.901 0.058 230.902);
|
|
104
|
+
--sky-300: oklch(0.828 0.111 230.318);
|
|
105
|
+
--sky-400: oklch(0.746 0.16 232.661);
|
|
106
|
+
--sky-500: oklch(0.685 0.169 237.323);
|
|
107
|
+
--sky-600: oklch(0.588 0.158 241.966);
|
|
108
|
+
--sky-700: oklch(0.5 0.134 242.749);
|
|
109
|
+
--sky-800: oklch(0.443 0.11 240.79);
|
|
110
|
+
--sky-900: oklch(0.391 0.09 240.876);
|
|
111
|
+
--sky-950: oklch(0.293 0.066 243.157);
|
|
112
|
+
--blue-50: oklch(0.97 0.014 254.604);
|
|
113
|
+
--blue-100: oklch(0.932 0.032 255.585);
|
|
114
|
+
--blue-200: oklch(0.882 0.059 254.128);
|
|
115
|
+
--blue-300: oklch(0.809 0.105 251.813);
|
|
116
|
+
--blue-400: oklch(0.707 0.165 254.624);
|
|
117
|
+
--blue-500: oklch(0.623 0.214 259.815);
|
|
118
|
+
--blue-600: oklch(0.546 0.245 262.881);
|
|
119
|
+
--blue-700: oklch(0.488 0.243 264.376);
|
|
120
|
+
--blue-800: oklch(0.424 0.199 265.638);
|
|
121
|
+
--blue-900: oklch(0.379 0.146 265.522);
|
|
122
|
+
--blue-950: oklch(0.282 0.091 267.935);
|
|
123
|
+
--indigo-50: oklch(0.962 0.018 272.314);
|
|
124
|
+
--indigo-100: oklch(0.93 0.034 272.788);
|
|
125
|
+
--indigo-200: oklch(0.87 0.065 274.039);
|
|
126
|
+
--indigo-300: oklch(0.785 0.115 274.713);
|
|
127
|
+
--indigo-400: oklch(0.673 0.182 276.935);
|
|
128
|
+
--indigo-500: oklch(0.585 0.233 277.117);
|
|
129
|
+
--indigo-600: oklch(0.511 0.262 276.966);
|
|
130
|
+
--indigo-700: oklch(0.457 0.24 277.023);
|
|
131
|
+
--indigo-800: oklch(0.398 0.195 277.366);
|
|
132
|
+
--indigo-900: oklch(0.359 0.144 278.697);
|
|
133
|
+
--indigo-950: oklch(0.257 0.09 281.288);
|
|
134
|
+
--violet-50: oklch(0.969 0.016 293.756);
|
|
135
|
+
--violet-100: oklch(0.943 0.029 294.588);
|
|
136
|
+
--violet-200: oklch(0.894 0.057 293.283);
|
|
137
|
+
--violet-300: oklch(0.811 0.111 293.571);
|
|
138
|
+
--violet-400: oklch(0.702 0.183 293.541);
|
|
139
|
+
--violet-500: oklch(0.606 0.25 292.717);
|
|
140
|
+
--violet-600: oklch(0.541 0.281 293.009);
|
|
141
|
+
--violet-700: oklch(0.491 0.27 292.581);
|
|
142
|
+
--violet-800: oklch(0.432 0.232 292.759);
|
|
143
|
+
--violet-900: oklch(0.38 0.189 293.745);
|
|
144
|
+
--violet-950: oklch(0.283 0.141 291.089);
|
|
145
|
+
--purple-50: oklch(0.977 0.014 308.299);
|
|
146
|
+
--purple-100: oklch(0.946 0.033 307.174);
|
|
147
|
+
--purple-200: oklch(0.902 0.063 306.703);
|
|
148
|
+
--purple-300: oklch(0.827 0.119 306.383);
|
|
149
|
+
--purple-400: oklch(0.714 0.203 305.504);
|
|
150
|
+
--purple-500: oklch(0.627 0.265 303.9);
|
|
151
|
+
--purple-600: oklch(0.558 0.288 302.321);
|
|
152
|
+
--purple-700: oklch(0.496 0.265 301.924);
|
|
153
|
+
--purple-800: oklch(0.438 0.218 303.724);
|
|
154
|
+
--purple-900: oklch(0.381 0.176 304.987);
|
|
155
|
+
--purple-950: oklch(0.291 0.149 302.717);
|
|
156
|
+
--fuchsia-50: oklch(0.977 0.017 320.058);
|
|
157
|
+
--fuchsia-100: oklch(0.952 0.037 318.852);
|
|
158
|
+
--fuchsia-200: oklch(0.903 0.076 319.62);
|
|
159
|
+
--fuchsia-300: oklch(0.833 0.145 321.434);
|
|
160
|
+
--fuchsia-400: oklch(0.74 0.238 322.16);
|
|
161
|
+
--fuchsia-500: oklch(0.667 0.295 322.15);
|
|
162
|
+
--fuchsia-600: oklch(0.591 0.293 322.896);
|
|
163
|
+
--fuchsia-700: oklch(0.518 0.253 323.949);
|
|
164
|
+
--fuchsia-800: oklch(0.452 0.211 324.591);
|
|
165
|
+
--fuchsia-900: oklch(0.401 0.17 325.612);
|
|
166
|
+
--fuchsia-950: oklch(0.293 0.136 325.661);
|
|
167
|
+
--pink-50: oklch(0.971 0.014 343.198);
|
|
168
|
+
--pink-100: oklch(0.948 0.028 342.258);
|
|
169
|
+
--pink-200: oklch(0.899 0.061 343.231);
|
|
170
|
+
--pink-300: oklch(0.823 0.12 346.018);
|
|
171
|
+
--pink-400: oklch(0.718 0.202 349.761);
|
|
172
|
+
--pink-500: oklch(0.656 0.241 354.308);
|
|
173
|
+
--pink-600: oklch(0.592 0.249 0.584);
|
|
174
|
+
--pink-700: oklch(0.525 0.223 3.958);
|
|
175
|
+
--pink-800: oklch(0.459 0.187 3.815);
|
|
176
|
+
--pink-900: oklch(0.408 0.153 2.432);
|
|
177
|
+
--pink-950: oklch(0.284 0.109 3.907);
|
|
178
|
+
--rose-50: oklch(0.969 0.015 12.422);
|
|
179
|
+
--rose-100: oklch(0.941 0.03 12.58);
|
|
180
|
+
--rose-200: oklch(0.892 0.058 10.001);
|
|
181
|
+
--rose-300: oklch(0.81 0.117 11.638);
|
|
182
|
+
--rose-400: oklch(0.712 0.194 13.428);
|
|
183
|
+
--rose-500: oklch(0.645 0.246 16.439);
|
|
184
|
+
--rose-600: oklch(0.586 0.253 17.585);
|
|
185
|
+
--rose-700: oklch(0.514 0.222 16.935);
|
|
186
|
+
--rose-800: oklch(0.455 0.188 13.697);
|
|
187
|
+
--rose-900: oklch(0.41 0.159 10.272);
|
|
188
|
+
--rose-950: oklch(0.271 0.105 12.094);
|
|
189
|
+
--slate-50: oklch(0.984 0.003 247.858);
|
|
190
|
+
--slate-100: oklch(0.968 0.007 247.896);
|
|
191
|
+
--slate-200: oklch(0.929 0.013 255.508);
|
|
192
|
+
--slate-300: oklch(0.869 0.022 252.894);
|
|
193
|
+
--slate-400: oklch(0.704 0.04 256.788);
|
|
194
|
+
--slate-500: oklch(0.554 0.046 257.417);
|
|
195
|
+
--slate-600: oklch(0.446 0.043 257.281);
|
|
196
|
+
--slate-700: oklch(0.372 0.044 257.287);
|
|
197
|
+
--slate-800: oklch(0.279 0.041 260.031);
|
|
198
|
+
--slate-900: oklch(0.208 0.042 265.755);
|
|
199
|
+
--slate-950: oklch(0.129 0.042 264.695);
|
|
200
|
+
--gray-50: oklch(0.985 0.002 247.839);
|
|
201
|
+
--gray-100: oklch(0.967 0.003 264.542);
|
|
202
|
+
--gray-200: oklch(0.928 0.006 264.531);
|
|
203
|
+
--gray-300: oklch(0.872 0.01 258.338);
|
|
204
|
+
--gray-400: oklch(0.707 0.022 261.325);
|
|
205
|
+
--gray-500: oklch(0.551 0.027 264.364);
|
|
206
|
+
--gray-600: oklch(0.446 0.03 256.802);
|
|
207
|
+
--gray-700: oklch(0.373 0.034 259.733);
|
|
208
|
+
--gray-800: oklch(0.278 0.033 256.848);
|
|
209
|
+
--gray-900: oklch(0.21 0.034 264.665);
|
|
210
|
+
--gray-950: oklch(0.13 0.028 261.692);
|
|
211
|
+
--zinc-50: oklch(0.985 0 0);
|
|
212
|
+
--zinc-100: oklch(0.967 0.001 286.375);
|
|
213
|
+
--zinc-200: oklch(0.92 0.004 286.32);
|
|
214
|
+
--zinc-300: oklch(0.871 0.006 286.286);
|
|
215
|
+
--zinc-400: oklch(0.705 0.015 286.067);
|
|
216
|
+
--zinc-500: oklch(0.552 0.016 285.938);
|
|
217
|
+
--zinc-600: oklch(0.442 0.017 285.786);
|
|
218
|
+
--zinc-700: oklch(0.37 0.013 285.805);
|
|
219
|
+
--zinc-800: oklch(0.274 0.006 286.033);
|
|
220
|
+
--zinc-900: oklch(0.21 0.006 285.885);
|
|
221
|
+
--zinc-950: oklch(0.141 0.005 285.823);
|
|
222
|
+
--neutral-50: oklch(0.985 0 0);
|
|
223
|
+
--neutral-100: oklch(0.97 0 0);
|
|
224
|
+
--neutral-200: oklch(0.922 0 0);
|
|
225
|
+
--neutral-300: oklch(0.87 0 0);
|
|
226
|
+
--neutral-350: oklch(0.8 0 0);
|
|
227
|
+
--neutral-400: oklch(0.708 0 0);
|
|
228
|
+
--neutral-500: oklch(0.556 0 0);
|
|
229
|
+
--neutral-600: oklch(0.439 0 0);
|
|
230
|
+
--neutral-700: oklch(0.371 0 0);
|
|
231
|
+
--neutral-800: oklch(0.269 0 0);
|
|
232
|
+
--neutral-900: oklch(0.205 0 0);
|
|
233
|
+
--neutral-950: oklch(0.145 0 0);
|
|
234
|
+
--stone-50: oklch(0.985 0.001 106.423);
|
|
235
|
+
--stone-100: oklch(0.97 0.001 106.424);
|
|
236
|
+
--stone-200: oklch(0.923 0.003 48.717);
|
|
237
|
+
--stone-300: oklch(0.869 0.005 56.366);
|
|
238
|
+
--stone-400: oklch(0.709 0.01 56.259);
|
|
239
|
+
--stone-500: oklch(0.553 0.013 58.071);
|
|
240
|
+
--stone-600: oklch(0.444 0.011 73.639);
|
|
241
|
+
--stone-700: oklch(0.374 0.01 67.558);
|
|
242
|
+
--stone-800: oklch(0.268 0.007 34.298);
|
|
243
|
+
--stone-900: oklch(0.216 0.006 56.043);
|
|
244
|
+
--stone-950: oklch(0.147 0.004 49.25);
|
|
245
|
+
--black: #000;
|
|
246
|
+
--white: #fff;
|
|
247
|
+
}
|