1
Fork 0
mirror of https://github.com/Steffo99/bluelib.git synced 2024-12-22 19:44:21 +00:00
This commit is contained in:
Steffo 2020-06-24 23:14:58 +02:00
parent 24e1718611
commit e6ff4744cb
Signed by: steffo
GPG key ID: 896A80F55F7C97F0
30 changed files with 65 additions and 48 deletions

File diff suppressed because one or more lines are too long

3
docs/bundle.69585.js Normal file

File diff suppressed because one or more lines are too long

1
docs/bundle.69585.js.map Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
/*! For license information please see bundle.e576f.esm.js.LICENSE.txt */

3
docs/bundle.fe0c4.esm.js Normal file

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
/*! For license information please see bundle.fe0c4.esm.js.LICENSE.txt */

View file

@ -1 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"bundle.e576f.esm.js","sourceRoot":""} {"version":3,"sources":[],"names":[],"mappings":"","file":"bundle.fe0c4.esm.js","sourceRoot":""}

View file

@ -1 +1 @@
<!DOCTYPE html><html lang="it"><head><meta charset="utf-8"><title>bluelib</title><meta name="viewport" content="width=device-width,initial-scale=1"><style>body{background-color:#0d193b;color:#a0ccff}</style><link rel="manifest" href="/manifest.json"><link href="/bundle.3fcfd.css" rel="preload" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/bundle.3fcfd.css"></noscript></head><body><script type="__PREACT_CLI_DATA__">{"preRenderData":{"url":"/"}}</script><script nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" src="/bundle.e576f.esm.js" type="module"></script><script nomodule="" src="/polyfills.ac517.js"></script><script nomodule="" defer="defer" src="/bundle.b78fb.js"></script></body></html> <!DOCTYPE html><html lang="it"><head><meta charset="utf-8"><title>bluelib</title><meta name="viewport" content="width=device-width,initial-scale=1"><style>body{background-color:#0d193b;color:#a0ccff}</style><link rel="manifest" href="/manifest.json"><link href="/bundle.1f6e4.css" rel="preload" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/bundle.1f6e4.css"></noscript></head><body><script type="__PREACT_CLI_DATA__">{"preRenderData":{"url":"/"}}</script><script nomodule="">!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script crossorigin="anonymous" src="/bundle.fe0c4.esm.js" type="module"></script><script nomodule="" src="/polyfills.ac517.js"></script><script nomodule="" defer="defer" src="/bundle.69585.js"></script></body></html>

View file

@ -1 +1 @@
{"/":{"bundle.3fcfd.css":{"type":"style","weight":1},"bundle.e576f.esm.js":{"type":"script","weight":1}},"/Sample":{"bundle.3fcfd.css":{"type":"style","weight":1},"bundle.e576f.esm.js":{"type":"script","weight":1},"route-Sample.chunk.06577.esm.js":{"type":"script","weight":0.9},"route-Sample.chunk.6e286.css":{"type":"style","weight":0.9}}} {"/":{"bundle.1f6e4.css":{"type":"style","weight":1},"bundle.fe0c4.esm.js":{"type":"script","weight":1}},"/Sample":{"bundle.1f6e4.css":{"type":"style","weight":1},"bundle.fe0c4.esm.js":{"type":"script","weight":1},"route-Sample.chunk.f0674.esm.js":{"type":"script","weight":0.9},"route-Sample.chunk.6e286.css":{"type":"style","weight":0.9}}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"route-Sample.chunk.06577.esm.js","sourceRoot":""} {"version":3,"sources":[],"names":[],"mappings":"","file":"route-Sample.chunk.f0674.esm.js","sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
{ {
"private": false, "private": false,
"name": "bluelib", "name": "bluelib",
"version": "0.13.0", "version": "0.13.1",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"source": "src/index.js", "source": "src/index.js",
"main": "dist/index.js", "main": "dist/index.js",

View file

@ -1,15 +1,20 @@
import ValidityStatus from "../Enums/ValidityStatus"; import ValidityStatus from "../../enums/Validity";
import FormRow from "./FormRow"; import FormRow from "./FormRow";
import style from "./FormRow.less" import style from "./FormRow.less";
import concatClass from "../../utils/concatClass";
import theme from "../../styles/theme.less";
export default function (props) { export default function (props) {
return ( return (
<FormRow validity={props.validity} label={props.label} icon={props.icon}> <FormRow
disabled={props.disabled}
validity={props.validity}
label={props.label}
icon={props.icon}>
<button <button
class={style.contentschild} class={concatClass(style.contentschild, props.disabled ? theme.disabled : null)}
onClick={(props.disabled && props.validity.validity === ValidityStatus.DISABLED) ? null : props.onClick} onClick={(props.disabled && props.validity.validity === ValidityStatus.DISABLED) ? null : props.onClick}
disabled={props.validity ? props.validity.validity === ValidityStatus.DISABLED : false} disabled={props.validity ? props.validity.validity === ValidityStatus.DISABLED : false}>
>
{props.children} {props.children}
</button> </button>
</FormRow> </FormRow>

View file

@ -1,16 +1,19 @@
import FormRow from "./FormRow"; import FormRow from "./FormRow";
import ValidityStatus from "../Enums/ValidityStatus";
import style from "./FormRow.less" import style from "./FormRow.less"
export default function (props) { export default function (props) {
return ( return (
<FormRow validity={props.validity} label={props.label} icon={props.icon}> <FormRow
disabled={props.disabled}
validity={props.validity}
label={props.label}
icon={props.icon}>
<input <input
class={style.contentschild} class={style.contentschild}
type={props.type} type={props.type}
value={props.value} value={props.value}
onChange={props.onChange} onChange={props.onChange}
disabled={props.validity ? props.validity.validity === ValidityStatus.DISABLED : false} disabled={props.disabled}
name={props.name}/> name={props.name}/>
</FormRow> </FormRow>
); );

View file

@ -1,12 +1,20 @@
import concatClass from "../../utils/concatClass"; import concatClass from "../../utils/concatClass";
import style from "./FormRow.less"; import style from "./FormRow.less";
import theme from "../../styles/theme.less" import theme from "../../styles/theme.less"
import ValidityStatus from "../Enums/ValidityStatus"; import ValidityStatus from "../../enums/Validity";
export default function (props) { export default function (props) {
let color = null;
if(props.disabled) {
color = theme.disabled;
}
else if(props.validity) {
color = theme[props.validity.validity];
}
return ( return (
<label <label
className={concatClass(style.label, theme[props.validity ? props.validity.validity : ValidityStatus.NONE])}> className={concatClass(style.label, color)}>
<div className={style.text}>{props.label}</div> <div className={style.text}>{props.label}</div>
<div className={style.icon}>{props.icon}</div> <div className={style.icon}>{props.icon}</div>
<div className={style.contents}> <div className={style.contents}>

View file

@ -1,6 +1,5 @@
export default Object.freeze({ export default Object.freeze({
NONE: "none", NONE: "none",
CHECKING: "checking",
OK: "ok", OK: "ok",
WARNING: "warning", WARNING: "warning",
ERROR: "error", ERROR: "error",

View file

@ -1,5 +1,5 @@
import { useEffect, useState } from 'preact/hooks'; import { useEffect, useState } from 'preact/hooks';
import ValidityStatus from "../components/Enums/ValidityStatus"; import ValidityStatus from "../enums/Validity";
export default function(value, validator) { export default function(value, validator) {
const [status, setStatus] = useState({ const [status, setStatus] = useState({

View file

@ -2,7 +2,7 @@ import { useContext, useState } from 'preact/hooks';
import RoyalnetInstanceUrl from '../contexts/RoyalnetInstanceUrl'; import RoyalnetInstanceUrl from '../contexts/RoyalnetInstanceUrl';
import useFormValidator from "./useFormValidator"; import useFormValidator from "./useFormValidator";
import {royalnetApiRequest} from '../utils/royalnetApiRequest'; import {royalnetApiRequest} from '../utils/royalnetApiRequest';
import ValidityStatus from "../components/Enums/ValidityStatus"; import ValidityStatus from "../enums/Validity";
const instanceUrlRegex = /^https?:\/\/.*?[^/]$/; const instanceUrlRegex = /^https?:\/\/.*?[^/]$/;

View file

@ -26,6 +26,8 @@ import LatexRenderColor from "./contexts/LatexRenderColor";
import RoyalnetInstanceUrl from "./contexts/RoyalnetInstanceUrl"; import RoyalnetInstanceUrl from "./contexts/RoyalnetInstanceUrl";
import RoyalnetLoginStatus from "./contexts/RoyalnetLoginStatus"; import RoyalnetLoginStatus from "./contexts/RoyalnetLoginStatus";
import Validity from "./enums/Validity";
import useFormValidator from "./hooks/useFormValidator"; import useFormValidator from "./hooks/useFormValidator";
import useLoginDataStorage from "./hooks/useLoginDataStorage"; import useLoginDataStorage from "./hooks/useLoginDataStorage";
import useRoyalnetData from "./hooks/useRoyalnetData"; import useRoyalnetData from "./hooks/useRoyalnetData";
@ -74,6 +76,8 @@ export {
RoyalnetInstanceUrl, RoyalnetInstanceUrl,
RoyalnetLoginStatus, RoyalnetLoginStatus,
Validity,
useFormValidator, useFormValidator,
useLoginDataStorage, useLoginDataStorage,
useRoyalnetData, useRoyalnetData,

View file

@ -18,7 +18,7 @@ import {
faRadiation, faRadiation,
faSpinner faSpinner
} from "@fortawesome/free-solid-svg-icons"; } from "@fortawesome/free-solid-svg-icons";
import ValidityStatus from "../components/Enums/ValidityStatus"; import Validity from "../enums/Validity";
import style from "./Sample.less"; import style from "./Sample.less";
@ -95,42 +95,40 @@ export default function (props) {
<Panel title={"FormInputs"}> <Panel title={"FormInputs"}>
<FormInput type={"text"} name={"username"} label={"Username"}/> <FormInput type={"text"} name={"username"} label={"Username"}/>
<FormInput type={"password"} label={"Password"}/> <FormInput type={"password"} label={"Password"}/>
<FormInput type={"text"} label={"Caricamento"} icon={<FontAwesomeIcon icon={faSpinner} pulse={true}/>} validity={{ <FormInput type={"text"} label={"Caricamento"} icon={<FontAwesomeIcon icon={faSpinner} pulse={true}/>} disabled={true} validity={{
validity: ValidityStatus.DISABLED,
message: [<FontAwesomeIcon icon={faAddressCard} className={style.flipping}/>, " Take your time..."] message: [<FontAwesomeIcon icon={faAddressCard} className={style.flipping}/>, " Take your time..."]
}}/> }}/>
<FormInput type={"text"} label={"OK!"} icon={<FontAwesomeIcon icon={faCheck}/>} validity={{ <FormInput type={"text"} label={"OK!"} icon={<FontAwesomeIcon icon={faCheck}/>} validity={{
validity: ValidityStatus.OK, validity: Validity.OK,
message: "", message: "",
}}/> }}/>
<FormInput type={"text"} label={"È un angelo!"} icon={<FontAwesomeIcon icon={faExclamationTriangle}/>} validity={{ <FormInput type={"text"} label={"È un angelo!"} icon={<FontAwesomeIcon icon={faExclamationTriangle}/>} validity={{
validity: ValidityStatus.WARNING, validity: Validity.WARNING,
message: "", message: "",
}}/> }}/>
<FormInput type={"text"} label={"Spinning Jesus"} icon={<FontAwesomeIcon icon={faCross} spin={true}/>} validity={{ <FormInput type={"text"} label={"Spinning Jesus"} icon={<FontAwesomeIcon icon={faCross} spin={true}/>} validity={{
validity: ValidityStatus.ERROR, validity: Validity.ERROR,
message: "", message: "",
}}/> }}/>
<FormInput type={"text"} label={"Ur mom"} icon={<FontAwesomeIcon icon={faCircle}/>} validity={{ <FormInput type={"text"} label={"Ur mom"} icon={<FontAwesomeIcon icon={faCircle}/>} validity={{
validity: ValidityStatus.ERROR, validity: Validity.ERROR,
message: "ERROR: she is too fat for this input", message: "ERROR: she is too fat for this input",
}}/> }}/>
</Panel> </Panel>
<Panel title={"FormButtons"}> <Panel title={"FormButtons"}>
Ma quindi era tutto... Ma quindi era tutto...
<FormButton label={"...un bottone?"}>Lo è sempre stato.</FormButton> <FormButton label={"...un bottone?"}>Lo è sempre stato.</FormButton>
<FormButton label={"...disattivato?"} icon={<FontAwesomeIcon icon={faXbox}/>} validity={{ <FormButton label={"...disattivato?"} disabled={true} icon={<FontAwesomeIcon icon={faXbox}/>} validity={{
validity: ValidityStatus.DISABLED,
message: "pls w8 a sec" message: "pls w8 a sec"
}}>.</FormButton> }}>.</FormButton>
<FormButton label={"...una città?"} icon={<FontAwesomeIcon icon={faHouseUser}/>} validity={{ <FormButton label={"...una città?"} icon={<FontAwesomeIcon icon={faHouseUser}/>} validity={{
validity: ValidityStatus.OK, validity: Validity.OK,
}}>Lucianina?</FormButton> }}>Lucianina?</FormButton>
<FormButton label={"...miele?"} icon={<FontAwesomeIcon icon={faBug}/>} validity={{ <FormButton label={"...miele?"} icon={<FontAwesomeIcon icon={faBug}/>} validity={{
validity: ValidityStatus.WARNING, validity: Validity.WARNING,
}}>Not the bees!</FormButton> }}>Not the bees!</FormButton>
<FormButton label={"...un Helios?"} icon={<FontAwesomeIcon icon={faRadiation}/>} validity={{ <FormButton label={"...un Helios?"} icon={<FontAwesomeIcon icon={faRadiation}/>} validity={{
validity: ValidityStatus.ERROR, validity: Validity.ERROR,
message: "ERROR: è finito il metallo", message: "ERROR: è finito il metallo",
}}>[AVVIA ANNICHILIMENTO]</FormButton> }}>[AVVIA ANNICHILIMENTO]</FormButton>
</Panel> </Panel>

View file

@ -108,7 +108,7 @@
} }
} }
.disabled { .disabled, :disabled {
color: @disabledfg; color: @disabledfg;
cursor: not-allowed; cursor: not-allowed;