UNPKG

adwaveui

Version:

Interactive Web Components inspired by the Gtk Adwaita theme.

1,639 lines (1,628 loc) 132 kB
var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); // src/base-elements.ts import { sig, VSignal } from "@ncpa0cpl/vanilla-jsx/signals"; // ../wc_toolkit/dist/esm/utils.mjs var mirroredNode = /* @__PURE__ */ __name((node) => { let clone = node.cloneNode(true); const observer = new MutationObserver((mutations) => { const newClone = node.cloneNode(true); clone.parentNode?.replaceChild(newClone, clone); clone = newClone; }); observer.observe(node, { attributes: true, characterData: true, childList: true, subtree: true }); return { current: /* @__PURE__ */ __name(() => clone, "current"), remove: /* @__PURE__ */ __name(() => observer.disconnect(), "remove") }; }, "mirroredNode"); function toAttributeName(str) { return str.replace(/([a-z][A-Z])/g, (_, g) => `${g[0]}${g[1].toLowerCase()}`).toLowerCase(); } __name(toAttributeName, "toAttributeName"); function nodeHasClassName(node, className) { return node.nodeType === Node.ELEMENT_NODE && node.classList.contains(className); } __name(nodeHasClassName, "nodeHasClassName"); var ListSerializer = class { static { __name(this, "ListSerializer"); } static intoString(list) { return list.map((elem) => { return String(elem).replaceAll(",", "\\,"); }).join(","); } static fromString(value) { const result = []; let escaped = false; let current = ""; for (let i = 0; i < value.length; i++) { const char = value[i]; switch (char) { case "\\": { escaped = !escaped; continue; } case ",": { if (!escaped) { result.push(current); current = ""; continue; } } } current += char; escaped = false; } if (current.length > 0) { result.push(current); } return result; } }; var ListenerController = class { static { __name(this, "ListenerController"); } constructor(element, eventNames, callback, options) { this.element = element; this.eventNames = eventNames; this.callback = callback; this.options = options; this.active = false; this.destroyed = false; this.enable = this.enable.bind(this); this.disable = this.disable.bind(this); this.destroy = this.destroy.bind(this); } enable() { if (!this.active && !this.destroyed) { this.element.addEventListener(this.eventNames, this.callback, this.options); this.active = true; } return this; } disable() { if (this.active) { this.element.removeEventListener(this.eventNames, this.callback, this.options); this.active = false; } return this; } destroy() { this.disable(); this.destroyed = true; return this; } }; var ALL_BROWSER_EVENTS = [ "abort", "afterprint", "animationend", "animationiteration", "animationstart", "beforeprint", "beforeunload", "blur", "canplay", "canplaythrough", "change", "click", "contextmenu", "copy", "cut", "dblclick", "drag", "dragend", "dragenter", "dragleave", "dragover", "dragstart", "drop", "durationchange", "ended", "error", "focus", "focusin", "focusout", "fullscreenchange", "fullscreenerror", "hashchange", "input", "invalid", "keydown", "keypress", "keyup", "load", "loadeddata", "loadedmetadata", "loadstart", "message", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseover", "mouseout", "mouseup", "mousewheel", "offline", "online", "open", "pagehide", "pageshow", "paste", "pause", "play", "playing", "popstate", "progress", "ratechange", "resize", "reset", "scroll", "search", "seeked", "seeking", "select", "show", "stalled", "storage", "submit", "suspend", "timeupdate", "toggle", "touchcancel", "touchend", "touchmove", "touchstart", "transitionend", "unload", "volumechange", "waiting", "wheel" ]; function nofail(fn) { try { fn(); } catch (err) { console.error(err); } } __name(nofail, "nofail"); // ../wc_toolkit/dist/esm/attribute.mjs var NEVER_CALLED = Symbol("CALLBACK_NEVER_CALLED"); var Attribute = class _Attribute { static { __name(this, "_Attribute"); } constructor(controller, attrType, propName, options) { this.controller = controller; this.attrType = attrType; this.propName = propName; this.options = options; this.valueMemo = null; this.attrKey = options?.htmlName ?? toAttributeName(this.propName); this.onCreatedCallback(); this.controller.registerProxy(this); } static { this.new = (controller, attrType, key, options) => { return new _Attribute(controller, attrType, key, options); }; } static extend(getExtended) { const NewConstructor = getExtended(_Attribute); _Attribute.new = (controller, attrType, key, options) => { return new NewConstructor(controller, attrType, key, options); }; } clearMemo() { this.valueMemo = null; } stringToAttrType(value) { let result; if (value == null) { if (this.attrType === "boolean") { return false; } if (typeof this.attrType === "object") { return this.attrType.fromString(value); } return null; } switch (this.attrType) { case "string": result = value; break; case "boolean": result = true; break; case "number": result = Number(value); break; case "string[]": result = ListSerializer.fromString(value); break; case "number[]": result = ListSerializer.fromString(value).map(Number).filter((v) => !Number.isNaN(v)); break; default: result = this.attrType.fromString(value); break; } return result; } attrTypeToString(value) { let result = null; switch (this.attrType) { case "string": result = value; break; case "boolean": result = value ? this.attrKey : null; break; case "number": if (value != null) { result = String(value); } break; case "string[]": if (value != null) { result = ListSerializer.intoString(value); } break; case "number[]": if (value != null) { result = ListSerializer.intoString(value); } break; default: result = this.attrType.intoString(value); break; } return result; } get() { if (this.valueMemo) { return this.valueMemo; } const result = this.stringToAttrType(this.controller.get(this.attrKey)); this.valueMemo = result; return result; } set(value) { const stringified = this.attrTypeToString(value); this.valueMemo = value; if (stringified != null) { this.controller.set(this.attrKey, stringified); } else { this.unset(); } } unset() { this.valueMemo = null; this.controller.unset(this.attrKey); } onChange(cb) { let lastValue = NEVER_CALLED; const listenerHandler = /* @__PURE__ */ __name((_) => { const value = this.get(); if (value === lastValue) return; lastValue = value; cb(value); }, "listenerHandler"); this.controller.addEventListener(this.attrKey, listenerHandler); return () => { this.controller.removeEventListener(this.attrKey, listenerHandler); }; } onCreatedCallback() { } }; var AttributeController = class { static { __name(this, "AttributeController"); } constructor(element) { this.element = element; this.emitter = new EventTarget(); this.attrProxies = /* @__PURE__ */ new Map(); } getAttributesApi(attributes, attributeOptions) { const api = Object.fromEntries( Object.entries(attributes).map(([k, def]) => { return [k, this.getOrCreateProxy(k, def, attributeOptions)]; }) ); return api; } registerProxy(attrProxy) { this.attrProxies.set(attrProxy.propName, attrProxy); this.attrProxies.set(attrProxy.attrKey, attrProxy); } getOrCreateProxy(attrName, attrType, attributeOptions) { let p = this.attrProxies.get(attrName); if (!p) { p = Attribute.new(this, attrType, attrName, attributeOptions?.[attrName]); } return p; } getProxy(attrName) { return this.attrProxies.get(attrName); } attributeChangedCallback(name, oldValue, newValue) { if (oldValue === newValue) return; this.getProxy(name)?.["clearMemo"](); this.emitter.dispatchEvent( new CustomEvent(name, { detail: { attributeName: name, previousValue: oldValue, newValue } }) ); } get(attributeName) { return this.element.getAttribute(attributeName); } set(attributeName, value) { this.getProxy(attributeName)?.["clearMemo"](); this.element.setAttribute(attributeName, value); } unset(attributeName) { this.getProxy(attributeName)?.["clearMemo"](); this.element.removeAttribute(attributeName); } addEventListener(attributeName, listener, options) { this.emitter.addEventListener(attributeName, listener, options); } removeEventListener(attributeName, listener) { this.emitter.removeEventListener(attributeName, listener); } }; // ../wc_toolkit/dist/esm/cleanup_controller.mjs var CleanupController = class { static { __name(this, "CleanupController"); } constructor() { this._cleanupFns = []; } /** Adds a cleanup that will run only once, on the next disconnect. */ once(cleanup) { this._cleanupFns.push({ fn: cleanup, once: true }); } /** Adds a cleanup that will run on every disconnect. */ add(cleanup) { this._cleanupFns.push({ fn: cleanup, once: false }); } runCleanups() { for (const cleanup of this._cleanupFns) { nofail(cleanup.fn); } for (let i = this._cleanupFns.length - 1; i >= 0; i--) { const cleanup = this._cleanupFns[i]; if (cleanup.once) { this._cleanupFns.splice(i, 1); } } } }; // ../wc_toolkit/dist/esm/function-parser.mjs var FunctionAttributeParser = { fromString(value) { return Function("event", value); }, intoString(value) { return `(${value.toString()})(event)`; } }; // ../wc_toolkit/dist/esm/methods_api.mjs var CONFITMED_EMIT = class { static { __name(this, "CONFITMED_EMIT"); } static onCommit(cb) { cb(); return CONFITMED_EMIT; } static onCancel(_) { return CONFITMED_EMIT; } }; var CANCELLED_EMIT = class { static { __name(this, "CANCELLED_EMIT"); } static onCommit(_) { return CANCELLED_EMIT; } static onCancel(cb) { cb(); return CANCELLED_EMIT; } }; var MethodsApi = class { static { __name(this, "MethodsApi"); } constructor(_thisElement, cleanups, context, attributeController, root, eventsRecord, attributes) { this._thisElement = _thisElement; this.cleanups = cleanups; this.context = context; this.attributeController = attributeController; this.root = root; this.eventsRecord = eventsRecord; this.attribute = attributeController.getAttributesApi(attributes); } get thisElement() { return this._thisElement; } get isMounted() { return this._thisElement.isMounted; } /** * Appends the given content to the element as a child. */ attach(newContent) { if (typeof newContent === "string") { const textNode = document.createTextNode(newContent); this.root.append(textNode); } else { this.root.append(newContent); } } /** * Replaces the content of the element with the given element. */ replace(newContent) { this.root.innerHTML = ""; if (typeof newContent === "string") { const textNode = document.createTextNode(newContent); this.root.append(textNode); } else { this.root.append(newContent); } } getChildren() { return Array.from(this._thisElement.childNodes).filter((elem) => { if ("classList" in elem && elem.classList.contains("_wc_toolkit_content_container")) { return false; } return true; }); } /** * Adds a listener to this element. This listener will be automatically * removed when the element is disconnected. */ listen(eventName, listener, options) { const controller = new ListenerController(this._thisElement, eventName, listener, options); if (options?.initEnabled !== false) { controller.enable(); } this.cleanups.once(() => { controller.destroy(); }); return controller; } /** * Adds a listener to the document. This listener will be automatically * removed when the element is disconnected. */ listenDocument(eventName, listener, options) { const controller = new ListenerController(document, eventName, listener, options); if (options?.initEnabled !== false) { controller.enable(); } this.cleanups.once(() => { controller.destroy(); }); return controller; } /** * Adds a listener to the window. This listener will be automatically * removed when the element is disconnected. */ listenWindow(eventName, listener, options) { const controller = new ListenerController(window, eventName, listener, options); if (options?.initEnabled !== false) { controller.enable(); } this.cleanups.once(() => { controller.destroy(); }); return controller; } emitEvent(arg0, ...rest) { let event; if (typeof arg0 === "string") { const Constructor = this.eventsRecord[arg0]; if (!Constructor) { throw new Error(`invalid error type: '${arg0}'`); } event = new Constructor(arg0, ...rest); } else { event = arg0; } const shouldCommit = this._thisElement.dispatchEvent(event); if (shouldCommit) { return CONFITMED_EMIT; } return CANCELLED_EMIT; } }; // ../wc_toolkit/dist/esm/main_fn_api.mjs var ATTR_DEP_HANDLER = class { static { __name(this, "ATTR_DEP_HANDLER"); } static detect(v) { return v instanceof Attribute; } static onChange(attr, cb) { return attr.onChange(cb); } }; var ConnectedCallbackApi = class _ConnectedCallbackApi extends MethodsApi { static { __name(this, "_ConnectedCallbackApi"); } constructor(thisElement, cleanups, attributeController, context, method, root, childrenPortal, eventsRecord, attributes) { super(thisElement, cleanups, context, attributeController, root, eventsRecord, attributes); this.context = context; this.method = method; this.childrenPortal = childrenPortal; this.eventsRecord = eventsRecord; this.childrenChangeCallbacks = []; this.readyCallbacks = []; this.isMutCbQueued = false; cleanups.add(() => { this.childrenChangeCallbacks.splice(0, this.childrenChangeCallbacks.length); this.readyCallbacks.splice(0, this.readyCallbacks.length); }); } static { this.dependencyHandlers = [ATTR_DEP_HANDLER]; } static addDependencyHandler(handler) { this.dependencyHandlers.push(handler); } getHandler(v) { for (const handler of _ConnectedCallbackApi.dependencyHandlers) { if (handler.detect(v)) { return handler; } } throw new Error( "Invalid dependency, make sure the dependency is of supported type or add a new dependency handler" ); } mutationObservedCallback(mutationRecords) { if (this.isMutCbQueued) { return; } if (mutationRecords.every( (mut) => mut.type !== "characterData" && Array.from(mut.addedNodes).every((n) => nodeHasClassName(n, "_wc_toolkit_content_container")) && Array.from(mut.removedNodes).every((n) => nodeHasClassName(n, "_wc_toolkit_content_container")) )) { return; } this.isMutCbQueued = true; setTimeout(() => { this.isMutCbQueued = false; this.triggerChildrenChange(); }); } triggerReadyCallbacks() { for (let cb = this.readyCallbacks.shift(); cb != null; cb = this.readyCallbacks.shift()) { nofail(cb); } } triggerChildrenChange(skipIfZero = false) { const children = this.getChildren(); if (skipIfZero && children.length === 0) { return; } for (const cb of this.childrenChangeCallbacks) { nofail(() => cb(children)); } } /** * Registers a callback that will be invoked whenever a direct children of * this Web Component is changed, added or removed. This only includes childrens * passed to it from outside, and doesn't include children added by this web component. * * These callbacks are only guaranteed to run while the component is mounted in the page. */ onChildrenChange(cb) { this.childrenChangeCallbacks.push(cb); } /** * Registers a callback that will be invoked once the Web Component is initialized and * all it's initial children are accounted for. * * These callbacks are only guaranteed to run while the component is mounted in the page. */ onReady(cb) { this.readyCallbacks.push(cb); } /** * Registers a callback that will be invoked every time any of it's dependencies changes. * Only the attributes can be dependencies by default, but through the `registerDependencyHandler()` * other dependencies can be added. * * These callbacks are only guaranteed to run while the component is mounted in the page. */ onChange(deps, cb) { let willRunOnNextMicroevent = false; for (const dep of deps) { const depHandler = this.getHandler(dep); const unbind = depHandler.onChange(dep, () => { if (willRunOnNextMicroevent) { return; } willRunOnNextMicroevent = true; queueMicrotask(() => { willRunOnNextMicroevent = false; cb(); }); }); this.cleanups.once(unbind); } } /** * Adds a cleanup function that will be called when the element is * disconnected from the document. */ cleanup(cb, opts) { if (opts?.keep) { this.cleanups.add(cb); return; } this.cleanups.once(cb); } }; function registerDependencyHandler(handler) { ConnectedCallbackApi.addDependencyHandler(handler); } __name(registerDependencyHandler, "registerDependencyHandler"); // ../wc_toolkit/dist/esm/custom_element.mjs function customElement(tagName, options) { const { childrenPortal = false, noContent = false, observeSubtree = false, shadowRoot = false, shadowRootInit } = options ?? {}; return { /** * Define the attributes of the custom element and the type of their values. */ attributes(attributes = {}, attributeOptions) { return { /** * Define what events can be emitted by the custom element. For every event, an attribute is * added to the custom element that can be set in html. `on${eventType}` properties are also added * to element instances that can be manipulated in JavaScript. */ events(eventRecords = {}) { const events = Object.entries(eventRecords).map(([e, constructor]) => e); return { /** * Context can be used to store the internal state of the custom element. `getContext` param should * return the initial context value, it will be called once for every instance of the custom element. */ context(getContext = () => ({})) { return { /** * Define the methods of the custom element. These methods can be later called via the api * object given to the main function or on the instance of the custom element. * * `getMethods` argument will be called in the constructor of the custom element. */ methods(getMethods = () => ({})) { return { /** * The main function of the custom element. * * `onConnectedCallback` argument will be called every time the custom element is * mounted in the document, (same as `connectedCallback` in standard web components). */ connected(onConnectedCallback) { const observedAttributes = Object.keys(attributes).flatMap((attr) => { const options2 = attributeOptions?.[attr]; if (options2?.observe === false) return []; return options2?.htmlName ?? toAttributeName(attr); }); for (let eventType of events) { eventType = eventType.toLowerCase(); if (!ALL_BROWSER_EVENTS.includes(eventType)) { observedAttributes.push(`on${eventType}`); } } Object.freeze(observedAttributes); const getRoot = /* @__PURE__ */ __name((elem) => { let root; if (shadowRoot) { const sroot = elem.attachShadow(shadowRootInit ?? { mode: "open" }); root = sroot; } else { root = document.createElement("div"); root.className = "_wc_toolkit_content_container"; root.style.display = "contents"; } return root; }, "getRoot"); const initiateMethods = /* @__PURE__ */ __name((methodsApi) => { const methods = getMethods(methodsApi); for (const key in methods) { const method = methods[key]; methods[key] = method.bind(methods); } return methods; }, "initiateMethods"); const elementConstructor = class WcToolkitCustomElement extends HTMLElement { static { __name(this, "WcToolkitCustomElement"); } constructor() { super(); this.attributeNames = observedAttributes; this.childrenContainer = document.createElement("div"); this.root = getRoot(this); this.attributeController = new AttributeController(this); this.cleanups = new CleanupController(); this._context = getContext( this.attributeController.getAttributesApi(attributes, attributeOptions) ); this._methodsApi = new MethodsApi( this, this.cleanups, this._context, this.attributeController, this.root, eventRecords, attributes ); this._methods = initiateMethods(this._methodsApi); this._mainFuncApi = new ConnectedCallbackApi( this, this.cleanups, this.attributeController, this._context, this._methods, this.root, this.childrenContainer, eventRecords, attributes ); this.isMounted = false; this._portalCleanups = []; this.childrenContainer.className = "_wc_toolkit_children_container"; for (const key in this._methods) { Object.defineProperty(this, key, { enumerable: false, configurable: false, writable: false, value: this._methods[key] }); } for (const [key, value] of Object.entries(attributes)) { if (key in this) { console.warn( `Property '${key}' already exists on the HTMLElement, cannot assign attribute accessor. [${tagName}]` ); continue; } const attrProxy = this.attributeController.getOrCreateProxy(key, value, attributeOptions); Object.defineProperty(this, key, { enumerable: false, configurable: false, get: /* @__PURE__ */ __name(() => { return attrProxy.get(); }, "get"), set: /* @__PURE__ */ __name((value2) => { attrProxy.set(value2); }, "set") }); } for (const eventType of events) { const lowercaseType = eventType.toLowerCase(); const accessorKey = `on${lowercaseType}`; if (ALL_BROWSER_EVENTS.includes(lowercaseType)) { continue; } const attrProxy = this.attributeController.getOrCreateProxy( accessorKey, FunctionAttributeParser, attributeOptions ); let attributeHandlerOverride = null; let attributeHandler = null; this.addEventListener(eventType, (event) => { if (attributeHandlerOverride) { return attributeHandlerOverride(event); } if (attributeHandler) { return attributeHandler(event); } }); attrProxy.onChange(() => { attributeHandler = attrProxy.get(); }); if (accessorKey in this) { console.warn( `Property '${accessorKey}' already exists on the HTMLElement, cannot assign event callback accessor. [${tagName}]` ); continue; } Object.defineProperty(this, accessorKey, { enumerable: false, configurable: false, get: /* @__PURE__ */ __name(() => { return attributeHandlerOverride ?? attrProxy.get(); }, "get"), set: /* @__PURE__ */ __name((value) => { if (value == null) { attributeHandlerOverride = null; return; } if (typeof value !== "function") { throw new TypeError(`'on${lowercaseType}' must be a Function`); } attributeHandlerOverride = value; }, "set") }); } } static { this.NAME = tagName; } static { this.observedAttributes = observedAttributes; } _cloneChildrenIntoPortal() { this._portalCleanups.splice(0, this._portalCleanups.length).forEach((cleanup) => cleanup()); if (childrenPortal) { this.childrenContainer.innerHTML = ""; for (const child of this.childNodes) { if ("classList" in child && child.classList.contains("_wc_toolkit_content_container")) { continue; } const mirrored = mirroredNode(child); this.childrenContainer.appendChild(mirrored.current()); this._portalCleanups.push(mirrored.remove); } } } connectedCallback() { this.classList.add("_wc_toolkit_custom_element"); this.isMounted = true; if (!noContent) { if (!(this.root instanceof ShadowRoot)) { this.append(this.root); } this._cloneChildrenIntoPortal(); } const cleanup = onConnectedCallback(this._mainFuncApi); if (cleanup) { this.cleanups.once(cleanup); } this.mutationObserver = new MutationObserver((mutationRecords) => { if (!noContent) { const childLenghtCahnged = mutationRecords.some( (r) => r.addedNodes.length > 0 || r.removedNodes.length > 0 ); if (childLenghtCahnged) { this._cloneChildrenIntoPortal(); } } this._mainFuncApi["mutationObservedCallback"](mutationRecords); }); this.mutationObserver.observe(this, { childList: true, characterData: true, subtree: observeSubtree }); this.cleanups.once(() => { this.mutationObserver.disconnect(); this.mutationObserver = void 0; }); setTimeout(() => { this._mainFuncApi["triggerChildrenChange"](true); this._mainFuncApi["triggerReadyCallbacks"](); }); } disconnectedCallback() { this.isMounted = false; if (!noContent) { if (!(this.root instanceof ShadowRoot)) { this.root.remove(); } } this.cleanups.runCleanups(); } attributeChangedCallback(name, oldValue, newValue) { this.attributeController.attributeChangedCallback(name, oldValue, newValue); } }; return { CustomElement: elementConstructor, /** * Register the custom element in the current window's CustomElementRegistry. */ register() { customElements.define(elementConstructor.NAME, elementConstructor); return this; } }; } }; } }; } }; } }; } }; } __name(customElement, "customElement"); // src/base-elements.ts registerDependencyHandler({ detect(v) { return v instanceof VSignal; }, onChange(sig6, cb) { const cbRef = { current: /* @__PURE__ */ __name(() => { cbRef.current = cb; }, "current") }; return sig6.add(() => cbRef.current()).detach; } }); Attribute.extend((Attr) => { return class AttributeWithSignal extends Attr { constructor() { super(...arguments); this.signal = sig(); } static { __name(this, "AttributeWithSignal"); } onCreatedCallback() { this.onChange((value) => { if (typeof value === "function") { this.signal.dispatch(() => value); return; } this.signal.dispatch(value ?? void 0); }); } }; }); // src/components/calendar/calendar.tsx import { sig as sig2 } from "@ncpa0cpl/vanilla-jsx/signals"; // node_modules/adwavecss/dist/index.js var Theme = class _Theme { static { __name(this, "Theme"); } static dark = "dark-theme"; static light = "light-theme"; static className(params) { switch (params.type) { case "light": return _Theme.light; } return _Theme.dark; } static toString() { return _Theme.dark; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Box = class _Box { static { __name(this, "Box"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/box.md#ClassNames */ static box = "box"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/box.md#ClassNames */ static rounded = "rounded"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/box.md#ClassNames */ static bg1 = "bg-1"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/box.md#ClassNames */ static bg2 = "bg-2"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/box.md#ClassNames */ static bg3 = "bg-3"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/box.md#ClassNames */ static bg4 = "bg-4"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/box.md#ClassNames */ static bg5 = "bg-5"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/box.md#ClassNames */ static bg6 = "bg-6"; static className(params) { let className = _Box.box; if (params.rounded) { className += ` ${_Box.rounded}`; } if (params.bg) { switch (params.bg) { case 1: className += ` ${_Box.bg1}`; break; case 2: className += ` ${_Box.bg2}`; break; case 3: className += ` ${_Box.bg3}`; break; case 4: className += ` ${_Box.bg4}`; break; case 5: className += ` ${_Box.bg5}`; break; case 6: className += ` ${_Box.bg6}`; break; } } return className; } static toString() { return _Box.box; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Button = class _Button { static { __name(this, "Button"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static button = "btn"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static disabled = "disabled"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static primary = "primary"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static danger = "danger"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static flat = "flat"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static pill = "pill"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static circular = "circular"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static square = "square"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static toggled = "toggled"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static wrapper = "btn-wrapper"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/button.md#ClassNames */ static adaptive = "adaptive"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/linked.md */ static linked = "linked"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/linked.md */ static linkedVertical = "vertical"; static className(params) { let className = _Button.button; if (params.disabled) { className += ` ${_Button.disabled}`; } if (params.color) { switch (params.color) { case "primary": className += ` ${_Button.primary}`; break; case "danger": className += ` ${_Button.danger}`; break; } } if (params.shape) { switch (params.shape) { case "circular": className += ` ${_Button.circular}`; break; case "square": className += ` ${_Button.square}`; break; } } if (params.flat) { className += ` ${_Button.flat}`; } if (params.pill) { className += ` ${_Button.pill}`; } if (params.toggled) { className += ` ${_Button.toggled}`; } if (params.adaptive) { className += ` ${_Button.adaptive}`; } if (params.linked) { className += ` ${_Button.linked}`; } if (params.linkedVertical) { className += ` ${_Button.linkedVertical}`; } return className; } static toString() { return _Button.button; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Card = class _Card { static { __name(this, "Card"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/card.md#ClassNames */ static card = "card"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/card.md#ClassNames */ static activable = "activable"; static className(params) { let className = _Card.card; if (params.activable) { className += ` ${_Card.activable}`; } return className; } static toString() { return _Card.card; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Checkbox = class _Checkbox { static { __name(this, "Checkbox"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/checkbox.md#ClassNames */ static checkbox = "checkbox"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/checkbox.md#ClassNames */ static disabled = "disabled"; static className(params) { let className = _Checkbox.checkbox; if (params.disabled) { className += ` ${_Checkbox.disabled}`; } return className; } static toString() { return _Checkbox.checkbox; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Dialog = class _Dialog { static { __name(this, "Dialog"); } static dialog = "dialog"; static header = "dialog-header"; static title = "dailog-title"; static body = "dialog-body"; static className() { return _Dialog.dialog; } static toString() { return _Dialog.dialog; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Frame = class _Frame { static { __name(this, "Frame"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/frame.md#ClassNames */ static frame = "frame"; static className() { return _Frame.frame; } static toString() { return _Frame.frame; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Input = class _Input { static { __name(this, "Input"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/input.md#ClassNames */ static input = "input"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/input.md#ClassNames */ static disabled = "disabled"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/linked.md */ static linked = "linked"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/linked.md */ static linkedVertical = "vertical"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/input.md#ClassNames */ static wrapper = "input-wrapper"; static className(params) { let className = _Input.input; if (params.disabled) { className += ` ${_Input.disabled}`; } if (params.linked) { className += ` ${_Input.linked}`; } if (params.linkedVertical) { className += ` ${_Input.linkedVertical}`; } return className; } static wrapperClassName() { return _Input.wrapper; } static toString() { return _Input.input; } static [Symbol.toPrimitive]() { return this.toString(); } }; var List = class _List { static { __name(this, "List"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/list.md#ClassNames */ static list = "list"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/list.md#ClassNames */ static element = "list-element"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/list.md#ClassNames */ static activableElement = "activable"; static className() { let className = _List.list; return className; } static elementClassName(params) { let className = _List.element; if (params.activable) { className += ` ${_List.activableElement}`; } return className; } static toString() { return _List.list; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Message = class _Message { static { __name(this, "Message"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/message.md#ClassNames */ static message = "message"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/message.md#ClassNames */ static info = "info"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/message.md#ClassNames */ static success = "success"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/message.md#ClassNames */ static warning = "warning"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/message.md#ClassNames */ static error = "error"; static className(params) { let className = _Message.message; if (params.type) { switch (params.type) { case "info": className += ` ${_Message.info}`; break; case "success": className += ` ${_Message.success}`; break; case "warning": className += ` ${_Message.warning}`; break; case "error": className += ` ${_Message.error}`; break; } } return className; } static toString() { return _Message.message; } static [Symbol.toPrimitive]() { return this.toString(); } }; var NavSidebar = class _NavSidebar { static { __name(this, "NavSidebar"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/nav-sidebar.md#ClassNames */ static navSidebar = "nav-sidebar"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/nav-sidebar.md#ClassNames */ static button = "nav-sidebar-btn"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/nav-sidebar.md#ClassNames */ static separator = "separator"; static active = "active"; static className() { return _NavSidebar.navSidebar; } static btnClassName(params) { let className = _NavSidebar.button; if (params.active) { className += ` ${_NavSidebar.active}`; } return className; } static separatorClassName() { return _NavSidebar.separator; } static toString() { return _NavSidebar.navSidebar; } static [Symbol.toPrimitive]() { return this.toString(); } }; var ScrollView = class _ScrollView { static { __name(this, "ScrollView"); } static scrollView = "scrollview"; static className() { return _ScrollView.scrollView; } static toString() { return _ScrollView.scrollView; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Selector = class _Selector { static { __name(this, "Selector"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/selector.md#ClassNames */ static selector = "selector"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/selector.md#ClassNames */ static disabled = "disabled"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/selector.md#ClassNames */ static selectedOption = "selected-option"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/selector.md#ClassNames */ static downButton = "down-button"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/selector.md#ClassNames */ static opened = "opened"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/selector.md#ClassNames */ static optionsList = "options-list"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/selector.md#ClassNames */ static option = "option"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/selector.md#ClassNames */ static top = "top"; /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/selector.md#ClassNames */ static noPosition = "no-position"; static className(params) { let className = _Selector.selector; if (params.disabled) { className += ` ${_Selector.disabled}`; } if (params.opened) { className += ` ${_Selector.opened}`; } if (params.noPosition) { className += ` ${_Selector.noPosition}`; } if (params.position === "top") { className += ` ${_Selector.top}`; } return className; } static optionClassName() { let className = _Selector.option; return className; } static selectedOptionClassName() { let className = _Selector.selectedOption; return className; } static listClassName() { let className = _Selector.optionsList; return className; } static downButtonClassName() { let className = _Selector.downButton; return className; } static toString() { return _Selector.selector; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Separator = class _Separator { static { __name(this, "Separator"); } static separator = "separator"; static vertical = "vertical"; static className(params) { let className = _Separator.separator; if (params.vertical) { className += ` ${_Separator.vertical}`; } return className; } static toString() { return _Separator.separator; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Skeleton = class _Skeleton { static { __name(this, "Skeleton"); } static skeleton = "skeleton"; static className() { return _Skeleton.skeleton; } static toString() { return _Skeleton.skeleton; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Spinner = class _Spinner { static { __name(this, "Spinner"); } static spinner = "spinner"; static innerCircle = "inner-circle"; static toString() { return _Spinner.spinner; } static [Symbol.toPrimitive]() { return this.toString(); } }; var Slider = class _Slider { static { __name(this, "Slider"); } /** * Read more at @link https://github.com/ncpa0/ADWaveCSS/blob/master/docs/components/slider.md#ClassNames */ static slider = "slider"; /** * Read more at @link https://github.com/ncpa0/ADWave