Skip to content
Snippets Groups Projects
Verified Commit 5811bce5 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: some minor fixes

parent 2cea82d4
No related branches found
No related tags found
No related merge requests found
Showing
with 9 additions and 195 deletions
import {Notify} from '@schukai/component-notify/source/message.js';
const notify = document.createElement('monster-notify');
document.body.appendChild(notify);
import {Notify} from '@schukai/component-notify/source/notify.mjs';
const notify = document.createElement('monster-notify');
document.body.appendChild(notify);
\ No newline at end of file
import {Valid} from '@schukai/monster/source/constraints/valid.mjs';
import {Invalid} from '@schukai/monster/source/constraints/invalid.mjs';
import {AndOperator} from '@schukai/monster/source/constraints/andoperator.mjs';
new AndOperator(
new Valid(), new Valid()).isValid()
.then(() => console.log(true))
.catch(() => console.log(false));
// ↦ true
new AndOperator(
new Invalid(), new Valid()).isValid()
.then(() => console.log(true))
.catch(() => console.log(false));
// ↦ false
import {Invalid} from '@schukai/monster/source/constraints/invalid.mjs';
new Invalid().isValid()
.then(() => console.log(true))
.catch(() => console.log(false));
// ↦ false
\ No newline at end of file
import {IsArray} from '@schukai/monster/source/constraints/isarray.mjs';
new IsArray()
.isValid([])
.then(() => console.log(true));
// ↦ true
new IsArray()
.isValid(99)
.catch(e => console.log(e));
// ↦ 99
\ No newline at end of file
import {IsObject} from '@schukai/monster/source/constraints/isobject.mjs';
new IsObject()
.isValid({})
.then(() => console.log(true));
// ↦ true
new IsObject()
.isValid(99)
.catch(e => console.log(e));
// ↦ 99
\ No newline at end of file
import {Valid} from '@schukai/monster/source/constraints/valid.mjs';
import {Invalid} from '@schukai/monster/source/constraints/invalid.mjs';
import {OrOperator} from '@schukai/monster/source/constraints/oroperator.mjs';
new OrOperator(
new Valid(), new Invalid()).isValid()
.then(() => console.log(true))
.catch(() => console.log(false));
// ↦ true
new OrOperator(
new Invalid(), new Invalid()).isValid()
.then(() => console.log(true))
.catch(() => console.log(false));
// ↦ false
\ No newline at end of file
import {Valid} from '@schukai/monster/source/constraints/valid.mjs';
new Valid().isValid()
.then(() => console.log(true))
.catch(() => console.log(false));
// ↦ true
import {CustomElement} from '@schukai/monster/source/dom/CustomElement';
// In the example the user can use his own template by creating a template in the DOM with the ID `my-custom-element`.
// You can also specify a theme (for example `mytheme`), then it will search for the ID `my-custom-element-mytheme` and
// if not available for the ID `my-custom-element`.
class MyCustomElement extends CustomElement {
static getTag() {
return "my-custom-element"
}
}
// ↦ <my-custom-element></my-custom-element>
\ No newline at end of file
import {getDocumentTheme} from '@schukai/monster/source/dom/theme.mjs';
const theme = getDocumentTheme();
console.log(theme.getName());
// ↦ monster
\ No newline at end of file
import {Updater} from '@schukai/monster/source/dom/updater.mjs';
// First we prepare the html document.
// This is done here via script, but can also be inserted into the document as pure html.
// To do this, simply insert the tag <h1 data-monster-replace="path:headline"></h1>.
const body = document.querySelector('body');
const headline = document.createElement('h1');
headline.setAttribute('data-monster-replace', 'path:headline')
body.appendChild(headline);
// the data structure
let obj = {
headline: "Hello World",
};
// Now comes the real magic. we pass the updater the parent HTMLElement
// and the desired data structure.
const updater = new Updater(body, obj);
updater.run();
// Now you can change the data structure and the HTML will follow these changes.
const subject = updater.getSubject();
subject['headline'] = "Hello World!"
\ No newline at end of file
import {Comparator} from '@schukai/monster/source/util/comparator.mjs';
console.log(new Comparator().lessThanOrEqual(2, 5))
// ↦ true
console.log(new Comparator().greaterThan(4, 2))
// ↦ true
console.log(new Comparator().equal(4, 4))
// ↦ true
console.log(new Comparator().equal(4, 5))
// ↦ false
import {DeadMansSwitch} from '@schukai/monster/source/util/deadmansswitch.mjs';
const deadmansswitch = new DeadMansSwitch(100, () => {
console.log('yeah!')
// ↦ "yeah!"
})
deadmansswitch.touch(); // from here wait again 100 ms
deadmansswitch.touch(200); // from here wait 200 ms
import {Processing} from '@schukai/monster/source/util/processing.mjs';
let startTime = +new Date();
new Processing((url) => {
return fetch(url)
}, (response) => {
// do something with the response
console.log(response.status, +new Date() - startTime)
}, 200, () => {
// this function is called 200 seconds after fetch is received.
console.log('finished', +new Date() - startTime)
return 'done'
}).run('https://monsterjs.org/assets/world.json').then(r => {
console.log(r)
// ↦ "done"
})
......@@ -94,6 +94,9 @@ class Copy extends CustomElement {
/**
*
* @return {Components.Content.Copy
* @fires monster-copy-clicked This event is fired when the copy button is clicked.
* @fires monster-copy-success This event is fired when the copy action is successful.
* @fires monster-copy-error This event is fired when the copy action fails.
*/
[assembleMethodSymbol]() {
super[assembleMethodSymbol]();
......@@ -244,6 +247,9 @@ function attachResizeObserver() {
this[resizeObserverSymbol].observe(this.parentElement);
}
/**
* @private
*/
function disconnectResizeObserver() {
if (this[resizeObserverSymbol] instanceof ResizeObserver) {
this[resizeObserverSymbol].disconnect();
......@@ -324,9 +330,6 @@ function updatePopper() {
/**
* @private
* @return {initEventHandler}
* @fires monster-copy-clicked
* @fires monster-copy-success
* @fires monster-copy-error
*/
function initEventHandler() {
const self = this;
......
......@@ -38,47 +38,11 @@ const logElementSymbol = Symbol("logElement");
*/
const emptyStateElementSymbol = Symbol("emptyStateElement");
/**
* Log is a control to show a log message.
*
* <img src="./images/log.png">
*
* Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
*
* You can create this control either by specifying the HTML tag <monster-state />` directly in the HTML or using
* Javascript via the `document.createElement('monster-state');` method.
*
* ```html
* <monster-log></monster-log>
* ```
*
* Or you can create this CustomControl directly in Javascript:
*
* ```js
* import {Log} from '@schukai/component-state/source/log.js';
* document.createElement('monster-log');
* ```
*
* @externalExample ../../../example/components/state/log.mjs
* @startuml log.png
* skinparam monochrome true
* skinparam shadowing false
* HTMLElement <|-- CustomElement
* CustomElement <|-- Log
* @enduml
*
* @copyright schukai GmbH
* @memberOf Monster.Components.State
* @summary Log is a control to show a log message.
*/
/**
* A Log component
*
* @fragments /fragments/components/layout/collapse/
*
* @example /examples/components/layout/collapse-simple
*
* @since 3.74.0
* @copyright schukai GmbH
* @summary A Log component to show a log message.
......
......@@ -23,16 +23,16 @@ export { AndOperator };
*
* The AndOperator is used to link several constraints. The constraint is fulfilled if all constraints of the operators are fulfilled.
*
* @externalExample ../../example/constraints/andoperator.mjs
* @example /examples/libraries/constraints/andoperator/ A simple example
*
* @license AGPLv3
* @since 1.3.0
* @copyright schukai GmbH
* @memberOf Monster.Constraints
* @summary A and operator constraint
*/
class AndOperator extends AbstractOperator {
/**
* this method return a promise containing the result of the check.
* This method returns a promise containing the result of the check.
*
* @param {*} value
* @return {Promise}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment