- added NcModal.vue, NcActions.vue, NcButton.vue, FirstrunWizard.vue, Card.vue, Page0.vue, Page1.vue, Page2.vue, Page3.vue and some icons
Some checks failed
CI Pipeline / japa-tests (push) Failing after 51s

- added lime color inside tailwind.config.js
- added some utilities scripts needed for components
- npm updates
- changed postcss.config.js for nesting css styles
- added about function to NavBar.vue
This commit is contained in:
Kaimbacher 2023-12-21 09:30:21 +01:00
parent cefd9081ae
commit 87e9314b00
25 changed files with 3475 additions and 401 deletions

View file

@ -0,0 +1,8 @@
const GenRandomId = (length) => {
return Math.random()
.toString(36)
.replace(/[^a-z]+/g, '')
.slice(0, length || 5)
}
export default GenRandomId

View file

@ -0,0 +1,43 @@
/**
* @param {Function} callback The function to call
* @param {number} delay The time to wait
*/
export default function timer(callback, delay) {
let id;
let started;
let remaining = delay;
let running;
this.start = function () {
running = true;
started = new Date();
id = setTimeout(callback, remaining);
};
this.pause = function () {
running = false;
clearTimeout(id);
remaining -= new Date() - started;
};
this.clear = function () {
running = false;
clearTimeout(id);
remaining = 0;
};
this.getTimeLeft = function () {
if (running) {
this.pause();
this.start();
}
return remaining;
};
this.getStateRunning = function () {
return running;
};
this.start();
}

View file

@ -0,0 +1,11 @@
/**
* Return the default global focus trap stack
*
* @return {import('focus-trap').FocusTrap[]}
*/
export const getTrapStack = function() {
// Create global stack if undefined
Object.assign(window, { _nc_focus_trap: window._nc_focus_trap || [] })
return window._nc_focus_trap
}

View file

@ -0,0 +1,16 @@
export function loadState<T>(app: string, key: string, fallback?: T): T {
const elem = <HTMLInputElement>document.querySelector(`#initial-state-${app}-${key}`);
if (elem === null) {
if (fallback !== undefined) {
return fallback;
}
throw new Error(`Could not find initial state ${key} of ${app}`);
}
try {
const value = atob(elem.value);
return JSON.parse(value);
} catch (e) {
throw new Error(`Could not parse initial state ${key} of ${app}`);
}
}