| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import { dom_manager, type_manager } from "./functions.js";
- class applet_builder {
- #target;
- #show;
- #hide;
- #change;
- #init;
- #animation;
-
- constructor() {
- this.#target = undefined;
- this.#show = undefined;
- this.#hide = undefined;
- this.#change = undefined;
- this.#init = undefined;
- this.#animation = undefined;
- }
- set_target(target) {
- if (!dom_manager.is_element(target)) {
- throw "Target is not HTML element.";
- }
- this.#target = target;
- }
- #is_dualbutton() {
- return this.#show !== undefined || this.#hide !== undefined;
- }
- #is_singlebutton() {
- return this.#change !== undefined;
- }
- set_show(target) {
- if (!dom_manager.is_element(target)) {
- throw "Show button must be HTML element.";
- }
- if (this.#is_singlebutton()) {
- throw "This is single button applet.";
- }
- this.#show = target;
- }
- set_hide(target) {
- if (!dom_manager.is_element(target)) {
- throw "Hide button must be HTML element.";
- }
- if (this.#is_singlebutton()) {
- throw "This is single button applet.";
- }
- this.#hide = hide;
- }
- set_change(target) {
- if (!dom_manager.is_element(target)) {
- throw "Change button must be HTML element.";
- }
- if (this.#is_dualbutton()) {
- throw "This is dual button applet.";
- }
- this.#change = target;
- }
- default_visible() {
- this.#init = true;
- }
- default_hidden() {
- this.#init = false;
- }
- set_animation(target) {
- if (!type_manager.is_function(target)) {
- throw "Animation must be an function.";
- }
- }
- }
- class applet {
- }
- export { applet };
|