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

chore: commit save point

parent ccb2cba1
Branches
Tags
No related merge requests found
Showing
with 84 additions and 390 deletions
...@@ -17,20 +17,11 @@ import {Script} from "./resource/script.js"; ...@@ -17,20 +17,11 @@ import {Script} from "./resource/script.js";
/** /**
* You can call the method via the monster namespace `new Monster.DOM.ResourceManager()`. * The ResourceManager is a singleton that manages all resources.
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {Resource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/resourcemanager.js';
* new Monster.DOM.ResourceManager()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Resource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/resourcemanager.js';
* new ResourceManager() * new ResourceManager()
* </script> * </script>
* ``` * ```
...@@ -40,7 +31,7 @@ import {Script} from "./resource/script.js"; ...@@ -40,7 +31,7 @@ import {Script} from "./resource/script.js";
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @summary A Resource class * @summary A Resource class
*/ */
class ResourceManager extends BaseWithOptions { export class ResourceManager extends BaseWithOptions {
/** /**
* *
...@@ -208,7 +199,3 @@ function addResource(type, url, options) { ...@@ -208,7 +199,3 @@ function addResource(type, url, options) {
(self.getOption('resources')?.[type]).push(resource); (self.getOption('resources')?.[type]).push(resource);
return self; return self;
} }
assignToNamespace('Monster.DOM', ResourceManager);
export {Monster, ResourceManager}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js'; import {Base} from '../types/base.js';
import {getGlobalFunction, getGlobalObject} from '../types/global.js'; import {getGlobalFunction, getGlobalObject} from '../types/global.js';
import {validateInstance, validateString} from "../types/validate.js"; import {validateInstance, validateString} from "../types/validate.js";
...@@ -11,20 +11,11 @@ import {ATTRIBUTE_TEMPLATE_PREFIX} from "./constants.js"; ...@@ -11,20 +11,11 @@ import {ATTRIBUTE_TEMPLATE_PREFIX} from "./constants.js";
import {getDocumentTheme} from "./theme.js"; import {getDocumentTheme} from "./theme.js";
/** /**
* you can call the method via the monster namespace `new Monster.DOM.Template()`. * The template class provides methods for creating templates.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.DOM.Template()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/template.js'; * import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/template.js';
* new Template() * new Template()
* </script> * </script>
* ``` * ```
...@@ -34,7 +25,7 @@ import {getDocumentTheme} from "./theme.js"; ...@@ -34,7 +25,7 @@ import {getDocumentTheme} from "./theme.js";
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @summary A template class * @summary A template class
*/ */
class Template extends Base { export class Template extends Base {
/** /**
* *
* @param {HTMLTemplateElement} template * @param {HTMLTemplateElement} template
...@@ -86,23 +77,14 @@ class Template extends Base { ...@@ -86,23 +77,14 @@ class Template extends Base {
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/template.js';
* Monster.DOM.findDocumentTemplate()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/template.js';
* findDocumentTemplate() * findDocumentTemplate()
* </script> * </script>
* ``` * ```
* *
* @example * @example
* *
* import { findDocumentTemplate } from "https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/template.js"; * import { findDocumentTemplate } from "https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/template.js";
* *
* const template = document.createElement("template"); * const template = document.createElement("template");
* template.id = "myTemplate"; * template.id = "myTemplate";
...@@ -139,7 +121,7 @@ class Template extends Base { ...@@ -139,7 +121,7 @@ class Template extends Base {
* @throws {Error} template id not found. * @throws {Error} template id not found.
* @throws {TypeError} value is not a string * @throws {TypeError} value is not a string
*/ */
function findDocumentTemplate(id, currentNode) { export function findDocumentTemplate(id, currentNode) {
validateString(id); validateString(id);
const document = getGlobalObject('document'); const document = getGlobalObject('document');
...@@ -219,8 +201,3 @@ function findDocumentTemplate(id, currentNode) { ...@@ -219,8 +201,3 @@ function findDocumentTemplate(id, currentNode) {
throw new Error("template " + id + " not found.") throw new Error("template " + id + " not found.")
} }
assignToNamespace('Monster.DOM', Template, findDocumentTemplate);
export {Monster, Template, findDocumentTemplate}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js'; import {Base} from '../types/base.js';
import {getGlobalObject} from '../types/global.js'; import {getGlobalObject} from '../types/global.js';
import {validateString} from "../types/validate.js"; import {validateString} from "../types/validate.js";
...@@ -11,27 +11,18 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js"; ...@@ -11,27 +11,18 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js";
/** /**
* You can call the method via the monster namespace `new Monster.DOM.Theme()`. * The Theme class provides the functionality for the theme.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* console.log(new Monster.DOM.Theme())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/theme.js'; * import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/theme.js';
* console.log(new Theme()) * console.log(new Theme())
* </script> * </script>
* ``` * ```
* *
* @example * @example
* *
* import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/theme.js'; * import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/theme.js';
* *
* const theme = getDocumentTheme(); * const theme = getDocumentTheme();
* console.log(theme.getName()); * console.log(theme.getName());
...@@ -42,7 +33,7 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js"; ...@@ -42,7 +33,7 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js";
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @summary A theme class * @summary A theme class
*/ */
class Theme extends Base { export class Theme extends Base {
/** /**
* *
...@@ -81,7 +72,7 @@ class Theme extends Base { ...@@ -81,7 +72,7 @@ class Theme extends Base {
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @since 1.7.0 * @since 1.7.0
*/ */
function getDocumentTheme() { export function getDocumentTheme() {
let document = getGlobalObject('document'); let document = getGlobalObject('document');
let name = DEFAULT_THEME; let name = DEFAULT_THEME;
...@@ -96,6 +87,3 @@ function getDocumentTheme() { ...@@ -96,6 +87,3 @@ function getDocumentTheme() {
return new Theme(name); return new Theme(name);
} }
assignToNamespace('Monster.DOM', Theme, getDocumentTheme);
export {Monster, Theme, getDocumentTheme}
...@@ -18,7 +18,7 @@ import { ...@@ -18,7 +18,7 @@ import {
ATTRIBUTE_UPDATER_REPLACE, ATTRIBUTE_UPDATER_REPLACE,
ATTRIBUTE_UPDATER_SELECT_THIS ATTRIBUTE_UPDATER_SELECT_THIS
} from "../dom/constants.js"; } from "../dom/constants.js";
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from "../types/base.js"; import {Base} from "../types/base.js";
import {isArray, isInstance, isIterable} from "../types/is.js"; import {isArray, isInstance, isIterable} from "../types/is.js";
import {Observer} from "../types/observer.js"; import {Observer} from "../types/observer.js";
...@@ -40,27 +40,16 @@ import {getDocument} from "./util.js"; ...@@ -40,27 +40,16 @@ import {getDocument} from "./util.js";
* Changes to attributes are made only when the direct values are changed. If you want to assign changes to other values * Changes to attributes are made only when the direct values are changed. If you want to assign changes to other values
* as well, you have to insert the attribute `data-monster-select-this`. This should be done with care, as it can reduce performance. * as well, you have to insert the attribute `data-monster-select-this`. This should be done with care, as it can reduce performance.
* *
* You can create an object of this class using the monster namespace `new Monster.DOM.Updater()`.
*
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/updater.js';
* new Monster.DOM.Updater()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/updater.js';
* new Updater() * new Updater()
* </script> * </script>
* ``` * ```
* *
* @example * @example
* *
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/updater.js'; * import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/updater.js';
* *
* // First we prepare the html document. * // First we prepare the html document.
* // This is done here via script, but can also be inserted into the document as pure html. * // This is done here via script, but can also be inserted into the document as pure html.
...@@ -95,7 +84,7 @@ import {getDocument} from "./util.js"; ...@@ -95,7 +84,7 @@ import {getDocument} from "./util.js";
* @throws {TypeError} value is not an instance of HTMLElement * @throws {TypeError} value is not an instance of HTMLElement
* @summary The updater class connects an object with the dom * @summary The updater class connects an object with the dom
*/ */
class Updater extends Base { export class Updater extends Base {
/** /**
* @since 1.8.0 * @since 1.8.0
...@@ -900,6 +889,3 @@ function handleInputControlAttributeUpdate(element, name, value) { ...@@ -900,6 +889,3 @@ function handleInputControlAttributeUpdate(element, name, value) {
} }
} }
assignToNamespace('Monster.DOM', Updater);
export {Monster, Updater}
...@@ -3,26 +3,16 @@ ...@@ -3,26 +3,16 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {getGlobal} from "../types/global.js"; import {getGlobal} from "../types/global.js";
import {validateString} from "../types/validate.js"; import {validateString} from "../types/validate.js";
/** /**
* this method fetches the document object * this method fetches the document object
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/util.js';
* console.log(Monster.DOM.getDocument())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/util.js';
* console.log(getDocument()) * console.log(getDocument())
* </script> * </script>
* ``` * ```
...@@ -60,7 +50,7 @@ import {validateString} from "../types/validate.js"; ...@@ -60,7 +50,7 @@ import {validateString} from "../types/validate.js";
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @throws {Error} not supported environment * @throws {Error} not supported environment
*/ */
function getDocument() { export function getDocument() {
let document = getGlobal()?.['document']; let document = getGlobal()?.['document'];
if (typeof document !== 'object') { if (typeof document !== 'object') {
throw new Error("not supported environment") throw new Error("not supported environment")
...@@ -74,16 +64,7 @@ function getDocument() { ...@@ -74,16 +64,7 @@ function getDocument() {
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/util.js';
* console.log(Monster.DOM.getWindow())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/util.js';
* console.log(getWindow(null)) * console.log(getWindow(null))
* </script> * </script>
* ``` * ```
...@@ -123,7 +104,7 @@ function getDocument() { ...@@ -123,7 +104,7 @@ function getDocument() {
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @throws {Error} not supported environment * @throws {Error} not supported environment
*/ */
function getWindow() { export function getWindow() {
let window = getGlobal()?.['window']; let window = getGlobal()?.['window'];
if (typeof window !== 'object') { if (typeof window !== 'object') {
throw new Error("not supported environment") throw new Error("not supported environment")
...@@ -134,22 +115,11 @@ function getWindow() { ...@@ -134,22 +115,11 @@ function getWindow() {
/** /**
*
*
* this method fetches the document object * this method fetches the document object
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/util.js';
* console.log(Monster.DOM.getDocumentFragmentFromString())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/util.js';
* console.log(getDocumentFragmentFromString('<div></div>')) * console.log(getDocumentFragmentFromString('<div></div>'))
* </script> * </script>
* ``` * ```
...@@ -188,7 +158,7 @@ function getWindow() { ...@@ -188,7 +158,7 @@ function getWindow() {
* @throws {Error} not supported environment * @throws {Error} not supported environment
* @throws {TypeError} value is not a string * @throws {TypeError} value is not a string
*/ */
function getDocumentFragmentFromString(html) { export function getDocumentFragmentFromString(html) {
validateString(html); validateString(html);
const document = getDocument(); const document = getDocument();
...@@ -197,7 +167,3 @@ function getDocumentFragmentFromString(html) { ...@@ -197,7 +167,3 @@ function getDocumentFragmentFromString(html) {
return template.content; return template.content;
} }
assignToNamespace('Monster.DOM', getWindow, getDocument, getDocumentFragmentFromString);
export {Monster, getWindow, getDocument, getDocumentFragmentFromString}
...@@ -13,23 +13,12 @@ import {getGlobal, getGlobalFunction} from "../../types/global.js"; ...@@ -13,23 +13,12 @@ import {getGlobal, getGlobalFunction} from "../../types/global.js";
import {isFunction} from "../../types/is.js"; import {isFunction} from "../../types/is.js";
import {validateInstance, validateString} from "../../types/validate.js"; import {validateInstance, validateString} from "../../types/validate.js";
/** /**
* You can call the function via the monster namespace `new Monster.DOM.Worker.getLocaleOfDocument()`. * A factory for creating worker instances.
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {Factory} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/worker/factory.js';
* console.log(new Monster.DOM.Worker.Factory())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Factory} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/worker/factory.js';
* console.log(new Factory()) * console.log(new Factory())
* </script> * </script>
* ``` * ```
...@@ -39,7 +28,7 @@ import {validateInstance, validateString} from "../../types/validate.js"; ...@@ -39,7 +28,7 @@ import {validateInstance, validateString} from "../../types/validate.js";
* @memberOf Monster.DOM.Worker * @memberOf Monster.DOM.Worker
* @summary A small factory to create worker * @summary A small factory to create worker
*/ */
class Factory extends Base { export class Factory extends Base {
/** /**
...@@ -129,6 +118,3 @@ class Factory extends Base { ...@@ -129,6 +118,3 @@ class Factory extends Base {
} }
assignToNamespace('Monster.DOM.Worker', Factory);
export {Monster, Factory}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import {internalSymbol} from "../constants.js"; import {internalSymbol} from "../constants.js";
import {extend} from "../data/extend.js"; import {extend} from "../data/extend.js";
import {assignToNamespace, Monster} from '../namespace.js';
import {Formatter as TextFormatter} from "../text/formatter.js"; import {Formatter as TextFormatter} from "../text/formatter.js";
import {validateInstance, validateString} from "../types/validate.js"; import {validateInstance, validateString} from "../types/validate.js";
import {Translations} from "./translations.js"; import {Translations} from "./translations.js";
...@@ -21,28 +21,17 @@ const internalTranslationSymbol = Symbol('internalTranslation') ...@@ -21,28 +21,17 @@ const internalTranslationSymbol = Symbol('internalTranslation')
/** /**
* The Formatter extends the Text.Formatter with the possibility to replace the key by a translation. * The Formatter extends the Text.Formatter with the possibility to replace the key by a translation.
* *
* You can create an instance via the monster namespace `new Monster.I18n.Formatter()`.
*
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/formatter.js';
* new Monster.I18n.Formatter()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/formatter.js';
* new Formatter() * new Formatter()
* </script> * </script>
* ``` * ```
* *
* @example * @example
* *
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/formatter.js'; * import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/formatter.js';
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/translations.js'; * import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/translations.js';
* *
* const translations = new Translations('en') * const translations = new Translations('en')
* .assignTranslations({ * .assignTranslations({
...@@ -56,7 +45,7 @@ const internalTranslationSymbol = Symbol('internalTranslation') ...@@ -56,7 +45,7 @@ const internalTranslationSymbol = Symbol('internalTranslation')
* @copyright schukai GmbH * @copyright schukai GmbH
* @memberOf Monster.I18n * @memberOf Monster.I18n
*/ */
class Formatter extends TextFormatter { export class Formatter extends TextFormatter {
/** /**
* Default values for the markers are `${` and `}` * Default values for the markers are `${` and `}`
...@@ -135,6 +124,3 @@ class Formatter extends TextFormatter { ...@@ -135,6 +124,3 @@ class Formatter extends TextFormatter {
} }
assignToNamespace('Monster.I18n', Formatter);
export {Monster, Formatter}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from "../types/base.js"; import {Base} from "../types/base.js";
import {validateString} from "../types/validate.js"; import {validateString} from "../types/validate.js";
import {clone} from "../util/clone.js"; import {clone} from "../util/clone.js";
...@@ -21,20 +21,11 @@ const propertiesSymbol = Symbol('properties'); ...@@ -21,20 +21,11 @@ const propertiesSymbol = Symbol('properties');
const localeStringSymbol = Symbol('localeString'); const localeStringSymbol = Symbol('localeString');
/** /**
* You can create an instance via the monster namespace `new Monster.I18n.Locale()`. * The Locale class is a base class for the language classes.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.I18n.Locale()
* </script>
* ```
*
* Alternatively, you can also integrate this class individually.
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/locale.js'; * import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/locale.js';
* new Locale() * new Locale()
* </script> * </script>
* ``` * ```
...@@ -75,7 +66,7 @@ const localeStringSymbol = Symbol('localeString'); ...@@ -75,7 +66,7 @@ const localeStringSymbol = Symbol('localeString');
* @memberOf Monster.I18n * @memberOf Monster.I18n
* @see https://datatracker.ietf.org/doc/html/rfc3066 * @see https://datatracker.ietf.org/doc/html/rfc3066
*/ */
class Locale extends Base { export class Locale extends Base {
/** /**
* @param {string} language * @param {string} language
...@@ -212,7 +203,7 @@ class Locale extends Base { ...@@ -212,7 +203,7 @@ class Locale extends Base {
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {createLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/locale.js'; * import {createLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/locale.js';
* createLocale() * createLocale()
* </script> * </script>
* ``` * ```
...@@ -273,7 +264,7 @@ class Locale extends Base { ...@@ -273,7 +264,7 @@ class Locale extends Base {
* @throws {TypeError} value is not a string * @throws {TypeError} value is not a string
* @throws {Error} unsupported locale * @throws {Error} unsupported locale
*/ */
function parseLocale(locale) { export function parseLocale(locale) {
locale = validateString(locale).replace(/_/g, "-"); locale = validateString(locale).replace(/_/g, "-");
...@@ -330,7 +321,3 @@ function parseLocale(locale) { ...@@ -330,7 +321,3 @@ function parseLocale(locale) {
return new Locale(language, region, script, variants, extlang); return new Locale(language, region, script, variants, extlang);
} }
assignToNamespace('Monster.I18n', Locale, parseLocale);
export {Monster, Locale, parseLocale}
'use strict';
/**
* In this namespace you will find classes and methods for handling locale and localized texts.
*
* @namespace Monster.I18n
* @memberOf Monster
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.I18n";
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {BaseWithOptions} from "../types/basewithoptions.js"; import {BaseWithOptions} from "../types/basewithoptions.js";
import {Locale} from "./locale.js" import {Locale} from "./locale.js"
import {Translations} from "./translations.js" import {Translations} from "./translations.js"
...@@ -11,20 +11,9 @@ import {Translations} from "./translations.js" ...@@ -11,20 +11,9 @@ import {Translations} from "./translations.js"
/** /**
* A provider makes a translation object available. * A provider makes a translation object available.
* *
* You can call the method via the monster namespace `new Monster.I18n.Provider()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.I18n.Provider()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ``` * ```
* <script type="module"> * <script type="module">
* import {Provider} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/provider.js'; * import {Provider} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/provider.js';
* new Provider() * new Provider()
* </script> * </script>
* ``` * ```
...@@ -34,7 +23,7 @@ import {Translations} from "./translations.js" ...@@ -34,7 +23,7 @@ import {Translations} from "./translations.js"
* @memberOf Monster.I18n * @memberOf Monster.I18n
* @see {@link https://datatracker.ietf.org/doc/html/rfc3066} * @see {@link https://datatracker.ietf.org/doc/html/rfc3066}
*/ */
class Provider extends BaseWithOptions { export class Provider extends BaseWithOptions {
/** /**
* @param {Locale|string} locale * @param {Locale|string} locale
...@@ -52,7 +41,3 @@ class Provider extends BaseWithOptions { ...@@ -52,7 +41,3 @@ class Provider extends BaseWithOptions {
} }
} }
assignToNamespace('Monster.I18n', Provider);
export {Monster, Provider}
...@@ -18,27 +18,16 @@ import {Translations} from "../translations.js"; ...@@ -18,27 +18,16 @@ import {Translations} from "../translations.js";
/** /**
* The fetch provider retrieves a JSON file from the given URL and returns a translation object. * The fetch provider retrieves a JSON file from the given URL and returns a translation object.
* *
* You can create the object via the monster namespace `new Monster.I18n.Provider.Fetch()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.I18n.Providers.Fetch()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ``` * ```
* <script type="module"> * <script type="module">
* import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/providers/fetch.js'; * import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/providers/fetch.js';
* new Fetch() * new Fetch()
* </script> * </script>
* ``` * ```
* *
* @example <caption>das ist ein test</caption> * @example <caption>das ist ein test</caption>
* *
* import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/providers/fetch.js'; * import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/providers/fetch.js';
* *
* // fetch from API * // fetch from API
* const translation = new Fetch('https://example.com/${language}.json').getTranslation('en-GB'); * const translation = new Fetch('https://example.com/${language}.json').getTranslation('en-GB');
...@@ -50,7 +39,7 @@ import {Translations} from "../translations.js"; ...@@ -50,7 +39,7 @@ import {Translations} from "../translations.js";
* @see {@link https://datatracker.ietf.org/doc/html/rfc3066} * @see {@link https://datatracker.ietf.org/doc/html/rfc3066}
* @tutorial i18n-locale-and-formatter * @tutorial i18n-locale-and-formatter
*/ */
class Fetch extends Provider { export class Fetch extends Provider {
/** /**
* As options the key `fetch` can be passed. This config object is passed to the fetch method as init. * As options the key `fetch` can be passed. This config object is passed to the fetch method as init.
...@@ -142,6 +131,3 @@ class Fetch extends Provider { ...@@ -142,6 +131,3 @@ class Fetch extends Provider {
} }
assignToNamespace('Monster.I18n.Providers', Fetch);
export {Monster, Fetch}
'use strict';
/**
* Namespace for different translation providers.
*
* @namespace Monster.I18n.Providers
* @memberOf Monster.I18n
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.I18n.Providers";
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from "../types/base.js"; import {Base} from "../types/base.js";
import {isObject, isString} from "../types/is.js"; import {isObject, isString} from "../types/is.js";
import {validateInstance, validateInteger, validateObject, validateString} from "../types/validate.js"; import {validateInstance, validateInteger, validateObject, validateString} from "../types/validate.js";
...@@ -13,28 +13,17 @@ import {Locale, parseLocale} from "./locale.js"; ...@@ -13,28 +13,17 @@ import {Locale, parseLocale} from "./locale.js";
/** /**
* With this class you can manage translations and access the keys. * With this class you can manage translations and access the keys.
* *
* You can call the method via the monster namespace `new Monster.I18n.Translations()`.
*
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/translations.js';
* new Monster.I18n.Translations()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/translations.js';
* new Translations() * new Translations()
* </script> * </script>
* ``` * ```
* *
* @example * @example
* *
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/translations.js'; * import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/translations.js';
* import {parseLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/locale.js'; * import {parseLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/locale.js';
* *
* const translation = new Translations(parseLocale('en-GB')); * const translation = new Translations(parseLocale('en-GB'));
* *
...@@ -59,7 +48,7 @@ import {Locale, parseLocale} from "./locale.js"; ...@@ -59,7 +48,7 @@ import {Locale, parseLocale} from "./locale.js";
* @memberOf Monster.I18n * @memberOf Monster.I18n
* @see https://datatracker.ietf.org/doc/html/rfc3066 * @see https://datatracker.ietf.org/doc/html/rfc3066
*/ */
class Translations extends Base { export class Translations extends Base {
/** /**
* *
...@@ -214,6 +203,3 @@ class Translations extends Base { ...@@ -214,6 +203,3 @@ class Translations extends Base {
} }
} }
assignToNamespace('Monster.I18n', Translations);
export {Monster, Translations}
...@@ -4,27 +4,18 @@ ...@@ -4,27 +4,18 @@
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js'; import {Base} from '../types/base.js';
import {validateInstance, validateInteger} from "../types/validate.js"; import {validateInstance, validateInteger} from "../types/validate.js";
import {LogEntry} from "./logentry.js"; import {LogEntry} from "./logentry.js";
import {ALL, DEBUG, ERROR, FATAL, INFO, OFF, TRACE, WARN} from "./logger.js"; import {ALL, DEBUG, ERROR, FATAL, INFO, OFF, TRACE, WARN} from "./logger.js";
/** /**
* you can call the method via the monster namespace `new Monster.Logging.Handler()`. * The log handler is the interface between the log entries and the log listeners.
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/logging/handler.js';
* console.log(new Monster.Logging.Handler())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/logging/handler.js';
* console.log(new Handler()) * console.log(new Handler())
* </script> * </script>
* ``` * ```
...@@ -33,7 +24,7 @@ import {ALL, DEBUG, ERROR, FATAL, INFO, OFF, TRACE, WARN} from "./logger.js"; ...@@ -33,7 +24,7 @@ import {ALL, DEBUG, ERROR, FATAL, INFO, OFF, TRACE, WARN} from "./logger.js";
* @copyright schukai GmbH * @copyright schukai GmbH
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
class Handler extends Base { export class Handler extends Base {
constructor() { constructor() {
super(); super();
...@@ -178,7 +169,3 @@ class Handler extends Base { ...@@ -178,7 +169,3 @@ class Handler extends Base {
} }
assignToNamespace('Monster.Logging', Handler);
export {Monster, Handler};
...@@ -15,16 +15,7 @@ import {LogEntry} from "../logentry.js"; ...@@ -15,16 +15,7 @@ import {LogEntry} from "../logentry.js";
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {ConsoleHandler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/logging/handler/console.js';
* console.log(new Monster.Logging.Handler.ConsoleHandler())
* </script>
* ```
*
* Alternatively, you can also integrate this class individually.
*
* ```
* <script type="module">
* import {ConsoleHandler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/logging/handler/console.js';
* console.log(new ConsoleHandler()) * console.log(new ConsoleHandler())
* </script> * </script>
* ``` * ```
...@@ -33,7 +24,7 @@ import {LogEntry} from "../logentry.js"; ...@@ -33,7 +24,7 @@ import {LogEntry} from "../logentry.js";
* @copyright schukai GmbH * @copyright schukai GmbH
* @memberOf Monster.Logging.Handler * @memberOf Monster.Logging.Handler
*/ */
class ConsoleHandler extends Handler { export class ConsoleHandler extends Handler {
constructor() { constructor() {
super(); super();
} }
...@@ -62,5 +53,3 @@ class ConsoleHandler extends Handler { ...@@ -62,5 +53,3 @@ class ConsoleHandler extends Handler {
} }
assignToNamespace('Monster.Logging.Handler', ConsoleHandler);
export {Monster, ConsoleHandler};
'use strict';
/**
* @namespace Monster.Logging.Handler
* @memberOf Monster.Logging
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.Logging.Handler";
\ No newline at end of file
...@@ -4,26 +4,17 @@ ...@@ -4,26 +4,17 @@
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js'; import {Base} from '../types/base.js';
import {validateInteger} from '../types/validate.js'; import {validateInteger} from '../types/validate.js';
/** /**
* you can call the method via the monster namespace `new Monster.Logging.LogEntry()`. * A log entry for the logger
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* console.log(new Monster.Logging.LogEntry())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/logging/logentry.js'; * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/logging/logentry.js';
* console.log(new LogEntry()) * console.log(new LogEntry())
* </script> * </script>
* ``` * ```
...@@ -32,7 +23,7 @@ import {validateInteger} from '../types/validate.js'; ...@@ -32,7 +23,7 @@ import {validateInteger} from '../types/validate.js';
* @copyright schukai GmbH * @copyright schukai GmbH
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
class LogEntry extends Base { export class LogEntry extends Base {
/** /**
* *
* @param {Integer} loglevel * @param {Integer} loglevel
...@@ -63,6 +54,3 @@ class LogEntry extends Base { ...@@ -63,6 +54,3 @@ class LogEntry extends Base {
} }
} }
assignToNamespace('Monster.Logging', LogEntry);
export {Monster, LogEntry}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import {Handler} from '../logging/handler.js'; import {Handler} from '../logging/handler.js';
import {LogEntry} from '../logging/logentry.js'; import {LogEntry} from '../logging/logentry.js';
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js'; import {Base} from '../types/base.js';
import {validateInteger, validateObject, validateString} from '../types/validate.js'; import {validateInteger, validateObject, validateString} from '../types/validate.js';
...@@ -16,65 +16,56 @@ import {validateInteger, validateObject, validateString} from '../types/validate ...@@ -16,65 +16,56 @@ import {validateInteger, validateObject, validateString} from '../types/validate
* @type {number} * @type {number}
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
const ALL = 255; export const ALL = 255;
/** /**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number} * @type {number}
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
const TRACE = 64; export const TRACE = 64;
/** /**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number} * @type {number}
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
const DEBUG = 32; export const DEBUG = 32;
/** /**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number} * @type {number}
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
const INFO = 16; export const INFO = 16;
/** /**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number} * @type {number}
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
const WARN = 8; export const WARN = 8;
/** /**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number} * @type {number}
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
const ERROR = 4; export const ERROR = 4;
/** /**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number} * @type {number}
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
const FATAL = 2; export const FATAL = 2;
/** /**
* ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF
* @type {number} * @type {number}
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
const OFF = 0; export const OFF = 0;
/** /**
* You can create an object of the class simply by using the namespace `new Monster.Logging.Logger()`. * The logger is a class that takes care of logging.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js';
* new Monster.Logging.Logger()
* </script>
* ```
*
* Alternatively, you can also integrate this class individually.
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/logging/logger.js'; * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/logging/logger.js';
* new Logger() * new Logger()
* </script> * </script>
* ``` * ```
...@@ -83,7 +74,7 @@ const OFF = 0; ...@@ -83,7 +74,7 @@ const OFF = 0;
* @copyright schukai GmbH * @copyright schukai GmbH
* @memberOf Monster.Logging * @memberOf Monster.Logging
*/ */
class Logger extends Base { export class Logger extends Base {
/** /**
* *
...@@ -256,9 +247,6 @@ class Logger extends Base { ...@@ -256,9 +247,6 @@ class Logger extends Base {
} }
assignToNamespace('Monster.Logging', Logger);
export {Monster, Logger, ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF};
/** /**
* Log triggern * Log triggern
......
'use strict';
/**
* Namespace for logging.
*
* @namespace Monster.Logging
* @memberOf Monster
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.Logging";
\ No newline at end of file
'use strict';
/**
* Namespace for math.
*
* @namespace Monster.Math
* @memberOf Monster
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.Math";
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment