@badcss/core
Advanced tools
Comparing version 0.1.9-1 to 0.1.9-2
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
import { generateUUID } from "../utils/generateUUID.js"; | ||
import { displayError } from "../utils/error.js"; | ||
@@ -15,2 +16,3 @@ export function AlertComponent(tag) { | ||
if (!alertType) { | ||
displayError("No variant found"); | ||
throw new Error("No variant found"); | ||
@@ -42,2 +44,3 @@ } | ||
if (!allowedVariants.includes(alertType)) { | ||
displayError(`Invalid variant ${alertType}`); | ||
throw new Error(`Invalid variant ${alertType}`); | ||
@@ -44,0 +47,0 @@ } |
import { generateUUID } from "../utils/generateUUID.js"; | ||
import { displayError } from "../utils/error.js"; | ||
@@ -27,2 +28,3 @@ export function ButtonComponent(tag) { | ||
if (!allowedVariants.includes(buttonType)) { | ||
displayError(`Invalid variant ${buttonType}`); | ||
throw new Error(`Invalid variant ${buttonType}`); | ||
@@ -29,0 +31,0 @@ } |
import { generateUUID } from "../utils/generateUUID.js"; | ||
import { displayError } from "../utils/error.js"; | ||
@@ -18,2 +19,3 @@ export function SpinnerComponent(tag) { | ||
if (!spinnerType) { | ||
displayError("No variant found"); | ||
throw new Error("No variant found"); | ||
@@ -35,2 +37,3 @@ } | ||
if (!allowedVariants.includes(spinnerType)) { | ||
displayError(`Invalid variant Spinner`); | ||
throw new Error(`Invalid variant Spinner`); | ||
@@ -37,0 +40,0 @@ } |
@@ -102,5 +102,7 @@ import { ButtonComponent } from "./components/Button.js"; | ||
// map for the findTags | ||
const findTag = document.getElementsByTagName("badcss"); | ||
for (let i = 0; i < findTag.length; i++) { | ||
const tag = findTag[i]; | ||
const findTags = document.querySelectorAll("badcss"); | ||
findTags.forEach(async (i) => { | ||
const tag = i; | ||
// get the component name | ||
@@ -137,88 +139,9 @@ const component = tag.getAttribute("component"); | ||
} | ||
} | ||
}); | ||
} catch (error) { | ||
// create new element | ||
const element = document.createElement("div"); | ||
// style | ||
element.setAttribute("badcss", "error"); | ||
element.setAttribute("component", "error"); | ||
element.style.backgroundColor = "#eee"; | ||
// make it to a modal | ||
element.style.position = "fixed"; | ||
element.style.top = "0"; | ||
element.style.left = "0"; | ||
element.style.width = "100vw"; | ||
element.style.height = "100vh"; | ||
// make it to a flexbox | ||
element.style.display = "flex"; | ||
element.style.flexDirection = "column"; | ||
element.style.justifyContent = "center"; | ||
element.style.alignItems = "center"; | ||
// z-index | ||
element.style.zIndex | ||
? (element.style.zIndex | ||
? parseInt(element.style.zIndex) + 1 | ||
: parseInt(element.style.zIndex)) + "" | ||
: "999999999"; | ||
// blur bg | ||
element.style.backdropFilter = "blur(5px)"; | ||
const helpDocumention = [ | ||
{ | ||
keyWords: ["component"], | ||
url: "https://badcss.dev/components", | ||
}, | ||
{ | ||
keyWords: ["config", "unspected token"], | ||
url: "https://badcss.dev/config", | ||
}, | ||
{ | ||
keyWords: ["Invalid variant", "Spinner"], | ||
url: "https://badcss.dev/docs", | ||
}, | ||
]; | ||
// add the error message | ||
element.innerHTML = ` | ||
<h1> | ||
Runtime Error <span style="color: var(--danger)">×</span> | ||
</h1> | ||
<p style="text-align: center"> | ||
Badcss encountered an error while loading the page.<br /> | ||
${ | ||
helpDocumention.find((doc) => | ||
doc.keyWords.some((keyWord) => error.message.includes(keyWord)) | ||
) | ||
? ` | ||
Read the documentation for help, this might help you to fix the error.<br /> | ||
<a href="${ | ||
helpDocumention.find((doc) => | ||
doc.keyWords.some((keyWord) => error.message.includes(keyWord)) | ||
).url | ||
}" target="_blank" style="color: var(--primary)">${ | ||
helpDocumention.find((doc) => | ||
doc.keyWords.some((keyWord) => error.message.includes(keyWord)) | ||
).url | ||
}</a>` | ||
: "" | ||
} | ||
</p> | ||
<p> | ||
<pre>${error.message}</pre> | ||
</p> | ||
`; | ||
document.body.appendChild(element); | ||
Log({ | ||
type: "error", | ||
message: error.message, | ||
message: error.message + "from element", | ||
}); | ||
} | ||
}); |
@@ -0,0 +0,0 @@ export function generateColor(color) { |
@@ -0,0 +0,0 @@ /* Helper function to generate a UUID (Universally Unique Identifier) */ |
@@ -0,0 +0,0 @@ export function Log(options) { |
{ | ||
"name": "@badcss/core", | ||
"version": "0.1.9-1", | ||
"version": "0.1.9-2", | ||
"description": "A lightweight and customizable framework designed to simplify web development and enhance the styling capabilities of your projects.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,19 +0,22 @@ | ||
# The Most Bad CSS Framework | ||
The Most Bad CSS Framework is a lightweight and customizable framework designed to simplify web development and enhance the styling capabilities of your projects. Built with simplicity and ease-of-use in mind. | ||
<h1 style="text-align: center !important;">Bad CSS</h1> | ||
## License | ||
A lightweight and customizable framework designed to simplify web development and enhance the styling capabilities of your projects. | ||
[MIT](https://choosealicense.com/licenses/mit/) | ||
The Most Bad CSS Framework is open-source and released under the MIT License, making it free to use, modify, and distribute. | ||
## About the Author | ||
The Most Bad CSS Framework is developed and maintained by Lasse Vestergaard, an enthusiastic web developer passionate about crafting elegant and efficient solutions for the web. | ||
Enjoy using The Most Bad CSS Framework to build remarkable web experiences! Happy coding! | ||
## Examples | ||
## Credits | ||
A basic example of how the framework works, with a custom html tag. | ||
Colors is from [Tailwind CSS](https://tailwindcss.com/). | ||
```html | ||
<badcss component="button" variant="primary" size="md"> | ||
This is a primary Button | ||
</badcss> | ||
``` | ||
## Documentation | ||
You can getting started by visit the website: https://badcss.dev | ||
@@ -0,0 +0,0 @@ const { |
@@ -0,0 +0,0 @@ const prompt = require("prompt-sync")(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
131316
47
2309
23
5