@chocbite/ts-lib-ui 1.0.6 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/AGENTS.md +172 -3
  2. package/SOURCE.md +2161 -273
  3. package/base/index.mjs +7 -7
  4. package/base/index.mjs.map +1 -1
  5. package/canvas/index.mjs +8 -8
  6. package/canvas/index.mjs.map +1 -1
  7. package/context-menu/index.d.mts +2 -2
  8. package/context-menu/index.mjs +1 -1
  9. package/{context-menu-Bo8R6DmK.mjs → context-menu-hHRJ33Lu.mjs} +149 -111
  10. package/context-menu-hHRJ33Lu.mjs.map +1 -0
  11. package/document/index.mjs +1 -1
  12. package/document/index.mjs.map +1 -1
  13. package/dom/index.mjs +1 -1
  14. package/dom/index.mjs.map +1 -1
  15. package/form/index.d.mts +4 -3
  16. package/form/index.mjs +30 -29
  17. package/form/index.mjs.map +1 -1
  18. package/icons/index.mjs +1 -1
  19. package/{icons-e2J_Ojic.mjs → icons-B88i-7MC.mjs} +2 -2
  20. package/{index-Pr2sLv9e.d.mts → index-76zZKjTH.d.mts} +32 -16
  21. package/index-D6L_jK1x.d.mts +385 -0
  22. package/keyboard/index.mjs +12 -12
  23. package/keyboard/index.mjs.map +1 -1
  24. package/list/index.d.mts +2 -2
  25. package/list/index.mjs +1 -1
  26. package/list-Bic1UzeC.mjs +1640 -0
  27. package/list-Bic1UzeC.mjs.map +1 -0
  28. package/package.json +5 -80
  29. package/selection/index.mjs +1 -1
  30. package/selection/index.mjs.map +1 -1
  31. package/settings/index.mjs +1 -1
  32. package/settings/index.mjs.map +1 -1
  33. package/spinner/index.mjs +3 -3
  34. package/spinner/index.mjs.map +1 -1
  35. package/state_ui/index.mjs +1 -1
  36. package/{state_ui-Bm3TeKNL.mjs → state_ui-Dtm2y5RU.mjs} +3 -3
  37. package/state_ui-Dtm2y5RU.mjs.map +1 -0
  38. package/style.css +349 -63
  39. package/svg/index.mjs +1 -1
  40. package/{svg-1bp-yIPC.mjs → svg-Yz7elqnU.mjs} +16 -16
  41. package/svg-Yz7elqnU.mjs.map +1 -0
  42. package/test/index.mjs +1 -1
  43. package/test/index.mjs.map +1 -1
  44. package/theme/index.mjs +1 -1
  45. package/{theme-DgVtLDzP.mjs → theme-DilOXXDu.mjs} +9 -9
  46. package/theme-DilOXXDu.mjs.map +1 -0
  47. package/context-menu-Bo8R6DmK.mjs.map +0 -1
  48. package/index-BTUFkF9s.d.mts +0 -173
  49. package/list-DOXIQOEY.mjs +0 -715
  50. package/list-DOXIQOEY.mjs.map +0 -1
  51. package/state_ui-Bm3TeKNL.mjs.map +0 -1
  52. package/svg-1bp-yIPC.mjs.map +0 -1
  53. package/theme-DgVtLDzP.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/form/shared.ts","../../src/form/base.ts","../../src/form/boolean/button/button.ts","../../src/form/boolean/lamp/lamp.ts","../../src/form/boolean/switch/switch.ts","../../src/form/group/group_base.ts","../../src/form/group/group.ts","../../src/form/group/group_collapser.ts","../../src/form/list/list_field.ts","../../src/form/number/number_base.ts","../../src/form/number/number_input/number_input.ts","../../src/form/number/progress/progress.ts","../../src/form/number/slider/slider.ts","../../src/form/number/stepper/stepper.ts","../../src/form/selectors/selector_base.ts","../../src/form/selectors/drop_down/drop_down.ts","../../src/form/selectors/toggle_button/toggle_button.ts","../../src/form/spacing/spacer.ts","../../src/form/special/color/color_input.ts","../../src/form/special/date_time/date_time_input.ts","../../src/form/special/ip/ip_input.ts","../../src/form/special/password/password_input.ts","../../src/form/text/input/text_input.ts","../../src/form/text/multi_line/text_multi_line.ts","../../src/form/text/text/text.ts","../../src/form/index.ts"],"sourcesContent":["import {\n BLUE,\n GREEN,\n GREY,\n ORANGE,\n RED,\n YELLOW,\n} from \"@chocbite/ts-lib/colors\";\nimport { theme_init_variable_root } from \"#theme\";\n\nconst theme_root = theme_init_variable_root(\n \"form\",\n \"UI Form Elements\",\n \"Theme variables for UI form Elements\",\n);\n\n// _____ ______ _____ ____ _ _ _ __ __\n// | __ \\| ____| /\\ | __ \\ / __ \\| \\ | | | \\ \\ / /\n// | |__) | |__ / \\ | | | | | | | | \\| | | \\ \\_/ /\n// | _ /| __| / /\\ \\ | | | | | | | | . ` | | \\ /\n// | | \\ \\| |____ / ____ \\| |__| | | |__| | |\\ | |____| |\n// |_| \\_\\______/_/ \\_\\_____/ \\____/|_| \\_|______|_|\nconst read_only = theme_root.make_sub_group(\n \"read\",\n \"Read Only\",\n \"Settings for form elements in read only mode\",\n);\nread_only.make_variable(\n \"filter\",\n \"Read Only Filter\",\n \"Filter applied to form elements in read only mode\",\n \"opacity(0.6)\",\n \"opacity(0.6)\",\n \"Filter\",\n undefined,\n);\n\n//#################################################################################3\n//#################################################################################3\n// _____ ____ _ ____ _____ _____\n// / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | | | | | | | | | | | |__) | (___\n// | | | | | | | | | | | _ / \\___ \\\n// | |___| |__| | |___| |__| | | \\ \\ ____) |\n// \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors = theme_root.make_sub_group(\n \"colors\",\n \"Colors\",\n \"Colors used in all form elements\",\n);\n\n// _______ ________ _________ _____ ____ _ ____ _____ _____\n// |__ __| ____\\ \\ / /__ __| / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | | | |__ \\ V / | | | | | | | | | | | | | |__) | (___\n// | | | __| > < | | | | | | | | | | | | | _ / \\___ \\\n// | | | |____ / . \\ | | | |___| |__| | |___| |__| | | \\ \\ ____) |\n// |_| |______/_/ \\_\\ |_| \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors_text = colors.make_sub_group(\n \"text\",\n \"Text Colors\",\n \"Text colors used in all form elements\",\n);\ncolors_text.make_variable(\n \"label\",\n \"Label Color\",\n \"Color of form elements labels\",\n GREY[\"700\"],\n GREY[\"300\"],\n \"Color\",\n undefined,\n);\ncolors_text.make_variable(\n \"normal\",\n \"Normal Text Color\",\n \"Normal text color in form elements\",\n GREY[\"800\"],\n GREY[\"200\"],\n \"Color\",\n undefined,\n);\ncolors_text.make_variable(\n \"selected\",\n \"Selected Text Color\",\n \"Selected text color in form elements\",\n GREY[\"900\"],\n GREY[\"50\"],\n \"Color\",\n undefined,\n);\ncolors_text.make_variable(\n \"unselected\",\n \"Unselected Text Color\",\n \"Unselected text color in form elements\",\n GREY[\"600\"],\n GREY[\"400\"],\n \"Color\",\n undefined,\n);\n\n// _______ ________ _________ ____ _ _____ _ __\n// |__ __| ____\\ \\ / /__ __| | _ \\| | /\\ / ____| |/ /\n// | | | |__ \\ V / | | | |_) | | / \\ | | | ' /\n// | | | __| > < | | | _ <| | / /\\ \\| | | <\n// | | | |____ / . \\ | | | |_) | |____ / ____ \\ |____| . \\\n// |_| |______/_/ \\_\\ |_| |____/|______/_/ \\_\\_____|_|\\_\\\n//\n//\nconst colors_text_black = colors.make_sub_group(\n \"textBlack\",\n \"Text Colors Black Background\",\n \"Text colors used for black background in all form elements\",\n);\ncolors_text_black.make_variable(\n \"normal\",\n \"Normal Text Color\",\n \"Normal text color in form elements\",\n GREY[\"200\"],\n GREY[\"200\"],\n \"Color\",\n undefined,\n);\ncolors_text_black.make_variable(\n \"selected\",\n \"Selected Text Color\",\n \"Selected text color in form elements\",\n GREY[\"50\"],\n GREY[\"50\"],\n \"Color\",\n undefined,\n);\ncolors_text_black.make_variable(\n \"unselected\",\n \"Unselected Text Color\",\n \"Unselected text color in form elements\",\n GREY[\"600\"],\n GREY[\"400\"],\n \"Color\",\n undefined,\n);\n\n// _____ _____ ____ _ _ _____ ____ _ ____ _____ _____\n// |_ _/ ____/ __ \\| \\ | | / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | || | | | | | \\| | | | | | | | | | | | | |__) | (___\n// | || | | | | | . ` | | | | | | | | | | | | _ / \\___ \\\n// _| || |___| |__| | |\\ | | |___| |__| | |___| |__| | | \\ \\ ____) |\n// |_____\\_____\\____/|_| \\_| \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors_icon = colors.make_sub_group(\n \"icon\",\n \"Icon Colors\",\n \"Icon colors used in all form elements\",\n);\ncolors_icon.make_variable(\n \"normal\",\n \"Normal Icon Color\",\n \"Color of icons in form elements\",\n GREY[\"800\"],\n GREY[\"200\"],\n \"Color\",\n undefined,\n);\ncolors_icon.make_variable(\n \"selected\",\n \"Selected Icon Color\",\n \"Color of selected icons in form elements\",\n GREY[\"900\"],\n GREY[\"50\"],\n \"Color\",\n undefined,\n);\ncolors_icon.make_variable(\n \"unselected\",\n \"Unselected Icon Color\",\n \"Color of unselected icons in form elements\",\n GREY[\"600\"],\n GREY[\"400\"],\n \"Color\",\n undefined,\n);\n\n// ____ _____ _ _______ _____ ____ _ _ _ _ _____ _____ ____ _ ____ _____ _____\n// | _ \\ /\\ / ____| |/ / ____| __ \\ / __ \\| | | | \\ | | __ \\ / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | |_) | / \\ | | | ' / | __| |__) | | | | | | | \\| | | | | | | | | | | | | | | | |__) | (___\n// | _ < / /\\ \\| | | <| | |_ | _ /| | | | | | | . ` | | | | | | | | | | | | | | | _ / \\___ \\\n// | |_) / ____ \\ |____| . \\ |__| | | \\ \\| |__| | |__| | |\\ | |__| | | |___| |__| | |___| |__| | | \\ \\ ____) |\n// |____/_/ \\_\\_____|_|\\_\\_____|_| \\_\\\\____/ \\____/|_| \\_|_____/ \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors_background = colors.make_sub_group(\n \"background\",\n \"Background Colors\",\n \"Background colors used in all form elements\",\n);\ncolors_background.make_variable(\n \"normal\",\n \"Normal Background Color\",\n \"Color of normal form element backgrounds\",\n GREY[\"50\"],\n GREY[\"900\"],\n \"Color\",\n undefined,\n);\ncolors_background.make_variable(\n \"hover\",\n \"Hover Background Color\",\n \"Color of form element backgrounds when hovering\",\n GREY[\"400\"],\n GREY[\"700\"],\n \"Color\",\n undefined,\n);\ncolors_background.make_variable(\n \"unselected\",\n \"Unselected Background Color\",\n \"Color of unselected form element backgrounds\",\n GREY[\"300\"],\n GREY[\"800\"],\n \"Color\",\n undefined,\n);\n\n// ____ ____ _____ _____ ______ _____ _____ ____ _ ____ _____ _____\n// | _ \\ / __ \\| __ \\| __ \\| ____| __ \\ / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | |_) | | | | |__) | | | | |__ | |__) | | | | | | | | | | | | |__) | (___\n// | _ <| | | | _ /| | | | __| | _ / | | | | | | | | | | | _ / \\___ \\\n// | |_) | |__| | | \\ \\| |__| | |____| | \\ \\ | |___| |__| | |___| |__| | | \\ \\ ____) |\n// |____/ \\____/|_| \\_\\_____/|______|_| \\_\\ \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors_border = colors.make_sub_group(\n \"border\",\n \"Border Colors\",\n \"Border colors used in all form elements\",\n);\ncolors_border.make_variable(\n \"normal\",\n \"Normal Border Color\",\n \"Color of normal form element borders\",\n GREY[\"700\"],\n GREY[\"300\"],\n \"Color\",\n undefined,\n);\ncolors_border.make_variable(\n \"unselected\",\n \"Unselected Border Color\",\n \"Color of unselected form element borders\",\n GREY[\"700\"],\n GREY[\"300\"],\n \"Color\",\n undefined,\n);\n\n// ______ ____ _____ _ _ _____\n// | ____/ __ \\ / ____| | | |/ ____|\n// | |__ | | | | | | | | | (___\n// | __|| | | | | | | | |\\___ \\\n// | | | |__| | |____| |__| |____) |\n// |_| \\____/ \\_____|\\____/|_____/\nconst colors_focus = colors.make_sub_group(\n \"focus\",\n \"Focus Colors\",\n \"Focus colors used in all form elements\",\n);\ncolors_focus.make_variable(\n \"normal\",\n \"Focus Color\",\n \"Color of focussed form element\",\n ORANGE[\"600\"],\n ORANGE[\"300\"],\n \"Color\",\n undefined,\n);\n\n// ____ _____ _____ _____ _____ ____ _ ____ _____ _____\n// | _ \\ /\\ / ____|_ _/ ____| / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | |_) | / \\ | (___ | || | | | | | | | | | | | | |__) | (___\n// | _ < / /\\ \\ \\___ \\ | || | | | | | | | | | | | | _ / \\___ \\\n// | |_) / ____ \\ ____) |_| || |____ | |___| |__| | |___| |__| | | \\ \\ ____) |\n// |____/_/ \\_\\_____/|_____\\_____| \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors_basic = colors.make_sub_group(\n \"basic\",\n \"Basic Colors\",\n \"Basic colors used in all form elements\",\n);\ncolors_basic.make_variable(\n \"black\",\n \"Basic Black Color\",\n \"Commonly used black color in form elements\",\n GREY[\"900\"],\n GREY[\"900\"],\n \"Color\",\n undefined,\n);\ncolors_basic.make_variable(\n \"white\",\n \"Basic White Color\",\n \"Commonly used white color in form elements\",\n GREY[\"100\"],\n GREY[\"100\"],\n \"Color\",\n undefined,\n);\ncolors_basic.make_variable(\n \"green\",\n \"Basic Green Color\",\n \"Commonly used green color in form elements\",\n GREEN[\"300\"],\n GREEN[\"900\"],\n \"Color\",\n undefined,\n);\ncolors_basic.make_variable(\n \"red\",\n \"Basic Red Color\",\n \"Commonly used red color in form elements\",\n RED[\"300\"],\n RED[\"900\"],\n \"Color\",\n undefined,\n);\ncolors_basic.make_variable(\n \"blue\",\n \"Basic Blue Color\",\n \"Commonly used blue color in form elements\",\n BLUE[\"300\"],\n BLUE[\"900\"],\n \"Color\",\n undefined,\n);\ncolors_basic.make_variable(\n \"yellow\",\n \"Basic Yellow Color\",\n \"Commonly used yellow color in form elements\",\n YELLOW[\"300\"],\n ORANGE[\"900\"],\n \"Color\",\n undefined,\n);\n\n//#################################################################################3\n//#################################################################################3\n// _____ _____ ____________ _____\n// / ____|_ _|___ / ____|/ ____|\n// | (___ | | / /| |__ | (___\n// \\___ \\ | | / / | __| \\___ \\\n// ____) |_| |_ / /__| |____ ____) |\n// |_____/|_____/_____|______|_____/\nconst sizes = theme_root.make_sub_group(\n \"size\",\n \"Size\",\n \"Sizes used in all form elements\",\n);\n\nsizes.make_variable(\n \"height\",\n \"Height\",\n \"Default height used in all form elements\",\n \"1.3rem\",\n \"1.3rem\",\n \"Length\",\n { min: 0.1, max: 10 },\n);\n\nsizes.make_variable(\n \"touchHeight\",\n \"Touch Height\",\n \"Minimum height for touch devices used in all form elements\",\n \"2.0rem\",\n \"2.0rem\",\n \"Length\",\n { min: 0.1, max: 10 },\n);\n\n//#################################################################################3\n//#################################################################################3\n// ______ ____ _ _ _______\n// | ____/ __ \\| \\ | |__ __|\n// | |__ | | | | \\| | | |\n// | __|| | | | . ` | | |\n// | | | |__| | |\\ | | |\n// |_| \\____/|_| \\_| |_|\nconst font = theme_root.make_sub_group(\n \"font\",\n \"Font\",\n \"Font settings used in all form elements\",\n);\n\nfont.make_variable(\n \"size\",\n \"Font Size\",\n \"Default font size used in all form elements\",\n \"0.9rem\",\n \"0.9rem\",\n \"Length\",\n { min: 0.1, max: 10 },\n);\n\nfont.make_variable(\n \"touch_size\",\n \"Touch Font Size\",\n \"Font size used in all form elements for touch devices\",\n \"1.1rem\",\n \"1.1rem\",\n \"Length\",\n { min: 0.1, max: 10 },\n);\n","import { Base } from \"#base\";\nimport { sync_resolve } from \"@chocbite/ts-lib/common\";\nimport { err, ok, type Option, type Result } from \"@chocbite/ts-lib/result\";\nimport type { State, StateREAW, StateSub } from \"@chocbite/ts-lib/state\";\nimport \"./shared\";\n\nexport interface FormOptions {}\n\n/**Colors for form elements that have selectable colors*/\nexport const FormColors = {\n None: \"none\",\n Black: \"black\",\n Green: \"green\",\n Red: \"red\",\n Blue: \"blue\",\n Yellow: \"yellow\",\n} as const;\nexport type FormColors = (typeof FormColors)[keyof typeof FormColors];\n\n/**Shared component class for other components to inherit from*/\nexport abstract class FormElement extends Base {\n static element_name() {\n return \"@abstract@\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n static apply_options(_element: FormElement, _options: FormOptions) {}\n}\n\n//##################################################################################################\n// __ __ _ _ _ ______ _____ ______ _____\n// \\ \\ / /\\ | | | | | | ____| | __ \\| ____| /\\ | __ \\\n// \\ \\ / / \\ | | | | | | |__ | |__) | |__ / \\ | | | |\n// \\ \\/ / /\\ \\ | | | | | | __| | _ /| __| / /\\ \\ | | | |\n// \\ / ____ \\| |___| |__| | |____ | | \\ \\| |____ / ____ \\| |__| |\n// \\/_/ \\_\\______\\____/|______| |_| \\_\\______/_/ \\_\\_____/\n\nexport interface FormValueOptions<\n RT,\n ID extends string | undefined,\n> extends FormOptions {\n /**ID form form element */\n id?: ID;\n /**Value for form element */\n value?: RT;\n /**Longer description what form element does */\n description?: string;\n}\n\n/**Shared class for all components with values*/\nexport abstract class FormValue<\n RT,\n ID extends string | undefined,\n> extends FormElement {\n static element_name() {\n return \"@abstract@\";\n }\n\n static apply_options<RT, ID extends string | undefined>(\n element: FormValue<RT, ID>,\n options: FormValueOptions<RT, ID>,\n ) {\n if (options.description) element.description = options.description;\n if (options.value !== undefined) element.value = options.value;\n super.apply_options(element, options);\n }\n\n readonly form_id: ID;\n\n constructor(id?: ID) {\n super();\n this.form_id = id as ID;\n }\n\n protected _description?: string;\n /**Sets the description of the element, shown as a tooltip*/\n set description(text: string) {\n this._description = text;\n if (text) this.title = text;\n else this.removeAttribute(\"title\");\n }\n get description(): string {\n return this._description || \"\";\n }\n\n protected _buffer?: RT;\n get buffer(): RT | undefined {\n return this._buffer;\n }\n\n protected _state?: State<RT, Option<{}>, RT>;\n #func?: StateSub<Result<RT, string>>;\n\n bind(opts: { value: StateREAW<RT, Option<{}>, RT> }): this {\n if (this.#func) {\n this.detach_state(this.#func);\n this.#func = undefined;\n }\n if (opts.value) {\n //Related first, so the first value is shown with them, like decimals\n const related = opts.value.related();\n this.state_related(related.some ? related.value : {});\n this.#func = this.attach_state(opts.value, (val) => {\n if (val.ok) {\n this.value = val.value;\n if (this.#error) this.error = undefined;\n } else this.error = val.error;\n });\n } else this.state_related({});\n this._state = opts.value;\n\n return this;\n }\n\n /**This sets the value of the component*/\n set value(val: RT) {\n if (typeof this._buffer !== \"undefined\" && this._buffer === val) return;\n this._buffer = val;\n this.new_value(val);\n }\n\n /**Returns value of the component*/\n get get_value(): Result<RT, string> {\n return this._state\n ? err(\"State based component\")\n : typeof this._buffer === \"undefined\"\n ? err(\"No value yet\")\n : ok(this._buffer);\n }\n\n #error = false;\n set error(err: string | undefined) {\n if (err) {\n this.new_error(err);\n this.#error = true;\n } else if (this.#error) {\n this.clear_error();\n this.#error = false;\n }\n }\n\n /**Clears the value and error of the component if not state based*/\n clear(): void {\n if (this._state) return;\n this._buffer = undefined;\n this.clear_value();\n this.clear_error();\n this.#error = false;\n }\n\n /**Called when value is set by value setter or state*/\n protected abstract new_value(val: RT): void;\n\n /**Clears form element graphically*/\n protected abstract clear_value(): void;\n\n /**Called when error is set by error or state*/\n protected abstract new_error(val: string): void;\n\n /**Called when error is cleared by error or state*/\n protected abstract clear_error(): void;\n\n /**Called when state has related information */\n protected abstract state_related(related: {}): void;\n}\n\n//##################################################################################################\n// __ __ _ _ _ ______ __ _______ _____ _______ ______\n// \\ \\ / /\\ | | | | | | ____| \\ \\ / / __ \\|_ _|__ __| ____|\n// \\ \\ / / \\ | | | | | | |__ \\ \\ /\\ / /| |__) | | | | | | |__\n// \\ \\/ / /\\ \\ | | | | | | __| \\ \\/ \\/ / | _ / | | | | | __|\n// \\ / ____ \\| |___| |__| | |____ \\ /\\ / | | \\ \\ _| |_ | | | |____\n// \\/_/ \\_\\______\\____/|______| \\/ \\/ |_| \\_\\_____| |_| |______|\n\nexport interface FormValueWriteOptions<\n RT,\n ID extends string | undefined,\n> extends FormValueOptions<RT, ID> {\n /**Change listener function*/\n change?: (val: RT) => void;\n}\n\n/**Shared class for all components with values*/\nexport abstract class FormValueWrite<\n RT,\n ID extends string | undefined,\n> extends FormValue<RT, ID> {\n static element_name() {\n return \"@abstract@\";\n }\n\n protected selected: boolean = false;\n protected warn_input: HTMLInputElement = document.createElement(\"input\");\n #warn_timeout?: number;\n #changed: boolean = false;\n #change?: (val: RT) => void;\n\n static apply_options<RT, ID extends string | undefined>(\n element: FormValueWrite<RT, ID>,\n options: FormValueWriteOptions<RT, ID>,\n ) {\n if (options.change) element.change = options.change;\n super.apply_options(element, options);\n }\n\n constructor(id?: ID) {\n super(id);\n this.warn_input.name = \"val\";\n }\n\n focus(options?: FocusOptions): void {\n this.warn_input.focus(options);\n }\n\n set change(func: (val: RT) => void) {\n this.#change = func;\n }\n get change(): ((val: RT) => void) | undefined {\n return this.#change;\n }\n\n /**Returns true if the value of the component has changed*/\n get changed(): boolean {\n return this.#changed;\n }\n\n set value(val: RT) {\n if (!this.selected) super.value = val;\n else this._buffer = val;\n }\n\n warn(message: string): void {\n this.warn_input.setCustomValidity(message);\n this.warn_input.reportValidity();\n if (this.#warn_timeout) clearTimeout(this.#warn_timeout);\n this.#warn_timeout = setTimeout(() => {\n this.warn_input.setCustomValidity(\"\");\n this.warn_input.reportValidity();\n }, 5000);\n }\n\n /**Function to limit value entered */\n protected limit_value(val: RT): PromiseLike<Result<RT, string>> {\n if (this._state) {\n if (this._state.writable) return this._state.limit(val);\n else return sync_resolve(err(\"Not writable\"));\n } else return sync_resolve(ok(val));\n }\n\n /**Function to check value, a state checks the value itself when it is written, so it is not checked here*/\n protected check_value(val: RT): PromiseLike<Result<RT, string>> {\n if (this._state && !this._state.writable)\n return sync_resolve(err(\"Not writable\"));\n return sync_resolve(ok(val));\n }\n\n /**Function to update value*/\n protected async set_value_limit(val: RT): Promise<Result<RT, string>> {\n const limited = await this.limit_value(val);\n if (limited.err) {\n this.warn(limited.error);\n return limited;\n }\n return this.#set_value(limited.value);\n }\n\n /**Function to update value*/\n protected async set_value_check(val: RT): Promise<Result<RT, string>> {\n const checked = await this.check_value(val);\n if (checked.err) {\n this.warn(checked.error);\n return checked;\n }\n return this.#set_value(checked.value);\n }\n\n /**Shows the value and writes it to the state, a value the state rejects is reverted and warned about.\n * The change listener is only called with accepted values*/\n async #set_value(val: RT): Promise<Result<RT, string>> {\n //Shown even when unchanged, the shown text can differ, like a typed value rounding to the current value\n this.new_value(val);\n if (this._buffer === val) return ok(val);\n if (this._state) {\n const buff = this._buffer;\n const written = await this._state.write!(val);\n if (written.err) {\n if (buff !== undefined) this.new_value(buff);\n this.warn(written.error);\n return err(written.error);\n }\n } else {\n this._buffer = val;\n this.#changed = true;\n }\n this.call_change(val);\n return ok(val);\n }\n\n /**Calls the change listener with a value the user changed, and lets a parent group know*/\n protected call_change(val: RT): void {\n if (this.#change)\n try {\n this.#change(val);\n } catch (e) {\n console.error(\"Failed while updating change listener\", e);\n }\n const parent = this.parentElement;\n if (this.form_id !== undefined && parent instanceof FormValueWrite)\n parent.child_changed(this);\n }\n\n /**Called when a child value element with a form id was changed by the user*/\n protected child_changed(_child: FormValueWrite<any, any>): void {}\n}\n","import { define_element } from \"#base\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport type { SVGFunc } from \"#svg\";\nimport { FormColors, FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"../../shared\";\nimport \"./button.scss\";\n\nexport interface FormButtonOptions<\n ID extends string | undefined,\n> extends FormValueWriteOptions<boolean, ID> {\n /**Buttons text */\n text?: string;\n /**Icon for button */\n icon?: SVGFunc;\n /**Function to call on button click */\n on_click?: () => void;\n /**Set true to make button toggle on click instead of normal */\n toggle?: boolean;\n /**Changes the buttons color */\n color?: FormColors;\n /**Centers text and icon */\n center?: boolean;\n}\n\nexport class FormButton<ID extends string | undefined> extends FormValueWrite<\n boolean,\n ID\n> {\n static element_name() {\n return \"button\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #text: HTMLSpanElement = this.appendChild(document.createElement(\"span\"));\n #on_click?: () => void;\n #toggle?: boolean;\n #icon?: SVGSVGElement;\n\n constructor(id?: ID) {\n super(id);\n\n this.appendChild(this.warn_input);\n this.setAttribute(\"tabindex\", \"0\");\n this.onclick = () => {\n if (this.#on_click) this.#on_click();\n };\n this.onpointerdown = (e) => {\n if (e.pointerType !== \"touch\" && e.button === 0) {\n e.stopPropagation();\n this.setPointerCapture(e.pointerId);\n if (!this.#toggle) this.set_value_check(true);\n this.onpointerup = (ev) => {\n ev.stopPropagation();\n this.releasePointerCapture(ev.pointerId);\n if (this.#toggle) this.set_value_check(!this.buffer);\n else this.set_value_check(false);\n this.onpointerup = null;\n this.onpointercancel = null;\n };\n //A cancelled press releases a momentary button and does not toggle a toggle button\n this.onpointercancel = (ev) => {\n this.releasePointerCapture(ev.pointerId);\n if (!this.#toggle) this.set_value_check(false);\n this.onpointerup = null;\n this.onpointercancel = null;\n };\n }\n };\n this.ontouchstart = (e) => {\n e.stopPropagation();\n if (!this.#toggle) this.set_value_check(true);\n this.ontouchend = (ev) => {\n ev.stopPropagation();\n if (ev.targetTouches.length === 0) {\n if (this.#toggle) this.set_value_check(!this.buffer);\n else this.set_value_check(false);\n this.ontouchend = null;\n this.ontouchcancel = null;\n }\n };\n this.ontouchcancel = () => {\n if (!this.#toggle) this.set_value_check(false);\n this.ontouchend = null;\n this.ontouchcancel = null;\n };\n };\n this.onkeydown = (e) => {\n switch (e.key) {\n case \" \":\n case \"Enter\": {\n e.stopPropagation();\n e.preventDefault();\n if (!this.#toggle) this.set_value_check(true);\n this.onkeyup = (e) => {\n switch (e.key) {\n case \"Enter\":\n case \" \": {\n e.stopPropagation();\n e.preventDefault();\n this.onkeyup = null;\n if (this.#toggle) this.set_value_check(!this.buffer);\n else this.set_value_check(false);\n if (this.#on_click) this.#on_click();\n break;\n }\n }\n };\n break;\n }\n }\n };\n }\n\n focus(options?: FocusOptions): void {\n HTMLElement.prototype.focus.call(this, options);\n }\n\n /**Sets the current text of the button*/\n set text(label: string) {\n this.#text.textContent = label;\n }\n get text() {\n return this.#text.textContent;\n }\n\n /**Changes the icon of the button*/\n set icon(icon: SVGFunc | undefined) {\n if (this.#icon) this.removeChild(this.#icon);\n this.#icon = icon ? this.insertBefore(icon(), this.#text) : undefined;\n }\n\n /**Function to call on button click*/\n set on_click(func: (() => void) | undefined) {\n this.#on_click = func;\n }\n get on_click() {\n return this.#on_click;\n }\n\n /**Changes the color of the button*/\n set color(color: FormColors) {\n if (color === FormColors.None) this.removeAttribute(\"color\");\n else this.setAttribute(\"color\", color);\n }\n\n /**Centers text and icon */\n set center(center: boolean) {\n if (center) this.classList.add(\"center\");\n else this.classList.remove(\"center\");\n }\n\n get center() {\n return this.classList.contains(\"center\");\n }\n\n /**Called when value is changed */\n protected new_value(value: boolean) {\n if (value) this.classList.add(\"active\");\n else this.classList.remove(\"active\");\n }\n\n protected clear_value(): void {\n this.new_value(false);\n }\n\n protected new_error(err: string): void {\n console.error(\"TODO\", err);\n }\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n\n /**Changes whether the button is maintained or momentary*/\n set toggle(toggle: boolean | undefined) {\n this.#toggle = Boolean(toggle);\n }\n get toggle() {\n return this.#toggle;\n }\n}\ndefine_element(FormButton);\n\n/**Creates a button form element */\nexport function form_button<ID extends string | undefined>(\n options?: FormButtonOptions<ID>,\n): FormButton<ID> {\n const butt = new FormButton<ID>(options?.id);\n if (options) {\n if (options.text) butt.text = options.text;\n if (options.icon) butt.icon = options.icon;\n if (options.on_click) butt.on_click = options.on_click;\n if (options.toggle) butt.toggle = options.toggle;\n if (options.color) butt.color = options.color;\n if (options.center) butt.center = options.center;\n FormValueWrite.apply_options(butt, options);\n }\n return butt;\n}\n","import { define_element } from \"#base\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport type { SVGFunc } from \"#svg\";\nimport { FormValue, type FormColors, type FormValueOptions } from \"../../base\";\nimport \"./lamp.scss\";\n\nexport interface FormLampOptions<\n T extends boolean | number,\n C extends FormColors[],\n ID extends string | undefined,\n> extends FormValueOptions<T, ID> {\n /**Sets the lamp colors */\n colors: C;\n /**Lamp text */\n text?: string;\n /**Icon for lamp */\n icon?: SVGFunc;\n /**Centers text and icon */\n center?: boolean;\n}\n\nexport class FormLamp<\n T extends boolean | number,\n C extends FormColors[],\n ID extends string | undefined,\n> extends FormValue<T, ID> {\n static element_name() {\n return \"lamp\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #text: HTMLSpanElement = this.appendChild(document.createElement(\"span\"));\n #icon: SVGSVGElement | undefined;\n #colors: FormColors[] = [];\n\n /**Sets the current text of the lamp*/\n set text(label: string) {\n this.#text.textContent = label;\n }\n get text() {\n return this.#text.textContent;\n }\n\n /**Changes the icon of the lamp*/\n set icon(icon: SVGFunc | undefined) {\n if (this.#icon) this.removeChild(this.#icon);\n this.#icon = icon ? this.insertBefore(icon(), this.#text) : undefined;\n }\n\n /** Sets the background color of the lamp*/\n set colors(colors: C) {\n this.#colors = colors;\n this.new_value(this.buffer!);\n }\n\n /**Centers text and icon */\n set center(center: boolean) {\n if (center) this.classList.add(\"center\");\n else this.classList.remove(\"center\");\n }\n\n get center() {\n return this.classList.contains(\"center\");\n }\n\n /**Called when value is changed */\n protected new_value(value: number | boolean) {\n const color = this.#colors[Number(value)];\n if (color) this.setAttribute(\"color\", color);\n else this.removeAttribute(\"color\");\n }\n\n protected clear_value(): void {\n this.removeAttribute(\"color\");\n }\n\n protected new_error(err: string): void {\n console.error(err);\n }\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormLamp);\n\n/**Creates a button form element */\nfunction from<ID extends string | undefined>(\n options?: FormLampOptions<\n number,\n [FormColors, FormColors, FormColors, ...FormColors[]],\n ID\n >,\n): FormLamp<number, [FormColors, FormColors, FormColors, ...FormColors[]], ID>;\nfunction from<ID extends string | undefined>(\n options?: FormLampOptions<boolean, [FormColors, FormColors], ID>,\n): FormLamp<boolean, [FormColors, FormColors], ID>;\nfunction from<\n T extends boolean | number,\n C extends FormColors[],\n ID extends string | undefined,\n>(options?: FormLampOptions<T, C, ID>): FormLamp<T, C, ID> {\n const lamp = new FormLamp<T, C, ID>(options?.id);\n if (options) {\n lamp.colors = options.colors;\n if (options.text) lamp.text = options.text;\n if (options.icon) lamp.icon = options.icon;\n if (options.center) lamp.center = options.center;\n FormValue.apply_options(lamp, options);\n }\n return lamp;\n}\n\n/**Creates a button form element */\nexport const form_lamp = from;\n","import { define_element } from \"#base\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport type { SVGFunc } from \"#svg\";\nimport { FormColors, FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./switch.scss\";\n\nexport interface FormSwitchOptions<\n ID extends string | undefined,\n> extends FormValueWriteOptions<boolean, ID> {\n /**Icon to use for left side*/\n icon?: SVGFunc;\n /**Color when switch is on */\n on_color?: FormColors;\n /**Color when switch is off */\n off_color?: FormColors;\n}\n\nexport class FormSwitch<ID extends string | undefined> extends FormValueWrite<\n boolean,\n ID\n> {\n static element_name() {\n return \"switch\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #switch: HTMLDivElement = this.appendChild(document.createElement(\"div\"));\n #icon: SVGSVGElement | undefined;\n #prevent_click: boolean = false;\n\n constructor(id?: ID) {\n super(id);\n\n this.appendChild(this.warn_input);\n this.#switch.setAttribute(\"tabindex\", \"0\");\n this.#switch.onkeydown = (e) => {\n switch (e.key) {\n case \"Enter\":\n case \" \": {\n e.stopPropagation();\n e.preventDefault();\n this.onkeyup = (e) => {\n switch (e.key) {\n case \"Enter\":\n case \" \": {\n e.stopPropagation();\n e.preventDefault();\n this.onkeyup = null;\n this.set_value_check(!this.buffer);\n break;\n }\n }\n };\n break;\n }\n }\n };\n\n this.#switch.onpointerdown = (e) => {\n if (e.button === 0) {\n e.stopPropagation();\n this.#switch.classList.add(\"active\");\n this.#switch.setPointerCapture(e.pointerId);\n let has_moved = false;\n this.#switch.onpointermove = (ev) => {\n ev.stopPropagation();\n if (has_moved) {\n const box = this.#switch.getBoundingClientRect();\n const mid_cord = box.x + box.width / 2;\n if (ev.clientX > mid_cord) {\n if (!this.buffer) this.set_value_check(true);\n } else {\n if (this.buffer) this.set_value_check(false);\n }\n } else if (\n Math.abs(e.clientX - ev.clientX) > 10 ||\n Math.abs(e.clientY - ev.clientY) > 10\n ) {\n has_moved = true;\n }\n };\n const release = () => {\n this.#switch.classList.remove(\"active\");\n this.#switch.releasePointerCapture(e.pointerId);\n this.#switch.onpointerup = null;\n this.#switch.onpointermove = null;\n this.#switch.onpointercancel = null;\n };\n this.#switch.onpointerup = (ev) => {\n ev.stopPropagation();\n release();\n if (!has_moved) this.set_value_check(!this.buffer);\n };\n //A cancelled press does not toggle, values set by moving are kept\n this.#switch.onpointercancel = release;\n }\n };\n\n this.#switch.onclick = (e) => e.stopPropagation();\n\n this.onclick = (e) => {\n e.stopPropagation();\n if (this.#prevent_click) return (this.#prevent_click = false);\n this.set_value_check(!this.buffer);\n return;\n };\n }\n\n /**Changes the icon of the switch*/\n set icon(icon: SVGFunc | undefined) {\n if (this.#icon) this.removeChild(this.#icon);\n this.#icon = icon ? this.insertBefore(icon(), this.#switch) : undefined;\n }\n\n set on_color(color: FormColors) {\n if (color === FormColors.None) this.#switch.removeAttribute(\"on-color\");\n else this.#switch.setAttribute(\"on-color\", color);\n }\n set off_color(color: FormColors) {\n if (color === FormColors.None) this.#switch.removeAttribute(\"off-color\");\n else this.#switch.setAttribute(\"off-color\", color);\n }\n set error_color(color: FormColors) {\n if (color === FormColors.None) this.#switch.removeAttribute(\"error-color\");\n else this.#switch.setAttribute(\"error-color\", color);\n }\n\n /**Called when value is changed */\n protected new_value(value: boolean) {\n if (value) this.#switch.classList.add(\"on\");\n else this.#switch.classList.remove(\"on\");\n }\n\n protected clear_value(): void {\n this.new_value(false);\n }\n\n protected new_error(_err: string): void {\n this.#switch.classList.add(\"error\");\n }\n\n protected clear_error(): void {\n this.#switch.classList.remove(\"error\");\n }\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormSwitch);\n\n/**Creates a switch form element */\nexport function form_switch<ID extends string | undefined>(\n options?: FormSwitchOptions<ID>,\n): FormSwitch<ID> {\n const swit = new FormSwitch<ID>(options?.id);\n if (options) {\n if (options.icon) swit.icon = options.icon;\n if (options.on_color) swit.on_color = options.on_color;\n if (options.off_color) swit.off_color = options.off_color;\n FormValueWrite.apply_options(swit, options);\n }\n return swit;\n}\n","import { AccessTypes } from \"#base\";\nimport { err, ok, Option, Result } from \"@chocbite/ts-lib/result\";\nimport { FormElement, FormValue, FormValueWrite } from \"../base\";\nimport \"./group_base.scss\";\n\n/**Different border styles for the component group*/\nexport const FormGroupBorderStyle = {\n None: \"none\",\n Inset: \"inset\",\n Outset: \"outset\",\n Line: \"line\",\n} as const;\nexport type FormGroupBorderStyle =\n (typeof FormGroupBorderStyle)[keyof typeof FormGroupBorderStyle];\n\nexport type GroupExtractVals<Arr extends any[]> = Arr extends [\n infer Head,\n ...infer Tail,\n]\n ? Head extends FormValue<infer T, infer ID>\n ? [FormValue<T, ID>, ...GroupExtractVals<Tail>]\n : [...GroupExtractVals<Tail>]\n : [];\n\nexport type GroupToKeyVal<Arr extends FormValue<any, any>[]> = {\n [K in Arr[number] as K extends FormValue<any, infer ID>\n ? [ID] extends [string]\n ? ID\n : never\n : never]: K extends FormValue<infer T, any> ? T : never;\n};\n\nexport type GroupValueElements<Elements extends FormElement[]> = {\n [Element in Elements[number] as Element extends FormValueWrite<any, infer ID>\n ? [ID] extends [string]\n ? ID\n : never\n : never]: Element;\n};\n\nexport abstract class FormGroupBase<\n RT extends object,\n ID extends string | undefined,\n Elements extends FormElement[] = FormElement[],\n> extends FormValueWrite<Partial<RT>, ID> {\n static element_name() {\n return \"@abstract@\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n protected _value_elements: Map<string, FormValueWrite<any, any>> = new Map();\n\n /**Returns form elements indexed by their form IDs*/\n get value_elements(): GroupValueElements<Elements> {\n return Object.fromEntries(\n this._value_elements,\n ) as unknown as GroupValueElements<Elements>;\n }\n\n /**This places the group at an absolute position in one of the corners of the container*/\n set border(border: FormGroupBorderStyle | undefined) {\n this.classList.remove(\n FormGroupBorderStyle.Inset,\n FormGroupBorderStyle.Outset,\n FormGroupBorderStyle.Line,\n );\n if (border && border !== FormGroupBorderStyle.None)\n this.classList.add(border);\n }\n\n set max_height(height: number | undefined) {\n this.style.setProperty(\"--max_height\", height ? height + \"rem\" : \"none\");\n if (height) this.classList.add(\"max_height\");\n else this.classList.remove(\"max_height\");\n }\n\n set embed(embed: boolean) {\n if (embed) this.classList.add(\"embed\");\n else this.classList.remove(\"embed\");\n }\n\n set value(val: Partial<RT>) {\n super.value = val;\n }\n\n /**Returns value of the group, returning err if any component has no value*/\n get get_value(): Result<RT, string> {\n if (this._state) return err(\"State based component\");\n const result: RT = {} as RT;\n for (const [key, comp] of this._value_elements) {\n const val = comp.get_value;\n if (val.err) return err(\"Component with id \" + key + \" has no value\");\n result[key as keyof RT] = val.value as RT[keyof RT];\n }\n return ok(result);\n }\n\n /**Returns partial value of the group, containing all values of components that have values*/\n get value_partial(): Result<Partial<RT>, string> {\n if (this._state) return err(\"State based component\");\n return ok(this.#partial());\n }\n\n #partial(): Partial<RT> {\n const result: Partial<RT> = {};\n for (const [key, comp] of this._value_elements) {\n const val = comp.get_value;\n if (val.err) continue;\n result[key as keyof RT] = val.value as RT[keyof RT];\n }\n return result;\n }\n\n /**The change listener of the group gets the values of all components that have values*/\n protected child_changed(child: FormValueWrite<any, any>): void {\n if (this._value_elements.get(child.form_id as string) === child)\n this.call_change(this.#partial());\n }\n\n /**Returns partial value of the group, only containing values of components where value has changed*/\n get value_changed(): Result<Partial<RT>, string> {\n if (this._state) return err(\"State based component\");\n const result: Partial<RT> = {};\n for (const [key, comp] of this._value_elements) {\n const val = comp.get_value;\n if (val.err) continue;\n if (comp.changed) result[key as keyof RT] = val.value as RT[keyof RT];\n }\n return ok(result);\n }\n\n protected new_value(val: RT): void {\n for (const key in val)\n if (this._value_elements.has(key))\n this._value_elements.get(key)!.value = val[key as keyof RT];\n }\n\n protected clear_value(): void {\n for (const comp of this._value_elements.values()) comp.clear();\n }\n\n protected new_error(err: string): void {\n console.error(err);\n }\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n\n protected on_access(access: AccessTypes): void {\n switch (access) {\n case AccessTypes.Read: {\n this.tabIndex = 0;\n this.onfocus = () => document.body.focus();\n break;\n }\n case AccessTypes.Write: {\n this.removeAttribute(\"tabIndex\");\n this.onfocus = null;\n break;\n }\n }\n }\n}\n","import { define_element } from \"#base\";\nimport { type Prettify } from \"@chocbite/ts-lib/common\";\nimport { FormElement, FormValueWrite, FormValueWriteOptions } from \"../base\";\nimport \"./group.scss\";\nimport {\n FormGroupBase,\n FormGroupBorderStyle,\n GroupExtractVals,\n GroupToKeyVal,\n} from \"./group_base\";\n\nexport interface FormGroupOptions<\n L extends FormElement[],\n ID extends string | undefined,\n T,\n> extends FormValueWriteOptions<Partial<T>, ID> {\n /**Elements to add to the group*/\n elements?: [...L];\n /**Border style for group*/\n border?: FormGroupBorderStyle;\n /**Removes padding when true allows for putting groups in groups without padding building up */\n embed?: boolean;\n /**Group max height in rem, undefined means no limit*/\n max_height?: number;\n /**Columns, true is everything in one columns, just a number will make repeating columns of minimum that rem width, an array will make exactly that many colums with specified rem widths */\n column?: true | string | string[];\n /**Rows, true is everything in one row, just a number will make repeating rows of minimum that rem height, an array will make exactly that many rows with specified rem heights */\n row?: true | string | string[];\n}\n\n/**Component group class which allows to add elements and controls the flow of the elements*/\nexport class FormGroup<\n RT extends object,\n ID extends string | undefined,\n Elements extends FormElement[] = FormValueWrite<any, string>[],\n> extends FormGroupBase<RT, ID, Elements> {\n static element_name() {\n return \"group\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n constructor(id?: ID) {\n super(id);\n this.classList.add(\"flex-col\");\n }\n\n set column(column: true | string | string[]) {\n this.classList.remove(\"grid-row\", \"grid-col\", \"flex-row\", \"flex-col\");\n if (column === true) {\n this.classList.add(\"flex-col\");\n } else {\n this.classList.add(\"grid-col\");\n\n if (typeof column === \"string\") {\n this.style.gridTemplateColumns =\n \"repeat(auto-fit, minmax(\" + column + \", 1fr))\";\n } else {\n this.style.gridTemplateColumns = column\n .map((col) => \"minmax(\" + col + \", 1fr)\")\n .join(\" \");\n }\n }\n }\n\n set row(row: true | string | string[]) {\n this.classList.remove(\"grid-row\", \"grid-col\", \"flex-row\", \"flex-col\");\n if (row === true) {\n this.classList.add(\"flex-row\");\n } else {\n this.classList.add(\"grid-row\");\n if (typeof row === \"string\") {\n this.style.gridTemplateRows =\n \"repeat(auto-fit, minmax(\" + row + \", 1fr))\";\n } else {\n this.style.gridTemplateRows = row\n .map((col) => \"minmax(\" + col + \", 1fr)\")\n .join(\" \");\n }\n }\n }\n\n #elements: FormElement[] = [];\n\n set elements(elements: FormElement[]) {\n for (let i = 0, n = elements.length; i < n; i++) {\n const comp = elements[i];\n if (comp instanceof FormValueWrite && comp.form_id) {\n if (this._value_elements.has(comp.form_id as string)) {\n console.error(\n \"Form element with form id \" +\n comp.form_id +\n \" already exists in group\",\n );\n continue;\n }\n this._value_elements.set(comp.form_id as string, comp);\n }\n this.#elements.push(this.appendChild(comp));\n }\n }\n\n /**All elements added to the group, also those without a form id*/\n get elements(): FormElement[] {\n return [...this.#elements];\n }\n}\ndefine_element(FormGroup);\n\n/**Creates a form group with elements */\nexport function form_group<\n L extends FormElement[],\n ID extends string | undefined,\n T extends object = Prettify<GroupToKeyVal<GroupExtractVals<L>>>,\n>(options?: FormGroupOptions<L, ID, T>): FormGroup<T, ID, L> {\n const group = new FormGroup<T, ID, L>(options?.id);\n if (options) {\n if (options.border) group.border = options.border;\n if (options.elements) group.elements = options.elements;\n if (options.max_height) group.max_height = options.max_height;\n if (options.embed) group.embed = options.embed;\n if (options.column) group.column = options.column;\n else if (options.row) group.row = options.row;\n FormValueWrite.apply_options(group, options);\n }\n return group;\n}\n","import { define_element } from \"#base\";\nimport { node_clone } from \"#dom\";\nimport {\n material_unfold_less_rounded,\n material_unfold_more_rounded,\n} from \"#icons\";\nimport {\n ANIMATION_LEVEL,\n ANIMATION_SPEED,\n AnimationLevels,\n} from \"#theme\";\nimport { FormElement, FormOptions } from \"../base\";\nimport { FormGroupBase } from \"./group_base\";\nimport \"./group_collapser.scss\";\n\nexport interface FormGroupCollapserOptions extends FormOptions {\n /**Wether the group is collapsed initially*/\n collapsed?: boolean;\n /**Text to show on the collapser when open*/\n opened_text?: string;\n /**Text to show on the collapser when closed*/\n closed_text?: string;\n}\n\nconst opened_text = document.createElement(\"span\");\nopened_text.textContent = \"Collapse\";\nconst closed_text = document.createElement(\"span\");\nclosed_text.textContent = \"Expand\";\n\n/**Component group class which allows to add elements and controls the flow of the elements*/\nexport class FormGroupCollapser extends FormElement {\n static element_name() {\n return \"group-collapser\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #group;\n #collapse_button;\n #collapsed: boolean = false;\n /**Running collapse or open animation, cancelled when the other one starts*/\n #animation?: Animation;\n #open_text = node_clone(opened_text);\n #close_text = node_clone(closed_text);\n\n constructor(group: FormGroupBase<any, any>, collapsed?: boolean) {\n super();\n this.#group = this.appendChild(group);\n if (collapsed) {\n this.classList.add(\"collapsed\");\n this.#collapsed = true;\n }\n this.#collapse_button = this.appendChild(document.createElement(\"span\"));\n this.#collapse_button.tabIndex = 0;\n this.#collapse_button.appendChild(\n collapsed ? this.#close_text : this.#open_text,\n );\n this.#collapse_button.appendChild(\n collapsed\n ? material_unfold_more_rounded()\n : material_unfold_less_rounded(),\n );\n this.#collapse_button.onclick = () => (this.collapsed = !this.collapsed);\n this.#collapse_button.onkeydown = (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n this.collapsed = !this.collapsed;\n }\n };\n }\n\n set group(group: FormGroupBase<any, any>) {\n this.replaceChild(group, this.#group);\n this.#group = group;\n }\n\n get group(): FormGroupBase<any, any> {\n return this.#group;\n }\n\n set collapsed(collapsed: boolean) {\n if (collapsed && !this.#collapsed) {\n this.#animation?.cancel();\n //# Animation\n this.#collapse_button.replaceChildren(\n this.#close_text,\n material_unfold_more_rounded(),\n );\n if (ANIMATION_LEVEL.get().value === AnimationLevels.All) {\n this.#group.style.overflowY = \"auto\";\n const full_height = this.#group.getBoundingClientRect().height + \"px\";\n this.#animation = this.#group.animate(\n [\n { maxHeight: full_height },\n { maxHeight: \"0px\", paddingBlock: \"0px\" },\n ],\n {\n duration: ANIMATION_SPEED.get().value,\n easing: \"ease-in-out\",\n },\n );\n this.#animation.onfinish = () => {\n this.classList.add(\"collapsed\");\n this.#group.style.overflowY = \"\";\n };\n } else {\n this.classList.add(\"collapsed\");\n }\n } else if (!collapsed && this.#collapsed) {\n this.#animation?.cancel();\n this.classList.remove(\"collapsed\");\n this.#collapse_button.replaceChildren(\n this.#open_text,\n material_unfold_less_rounded(),\n );\n //# Animation\n if (ANIMATION_LEVEL.get().value === AnimationLevels.All) {\n this.#group.style.overflowY = \"auto\";\n const full_height = this.#group.getBoundingClientRect().height + \"px\";\n this.#animation = this.#group.animate(\n [\n { maxHeight: \"0px\", paddingBlock: \"0px\" },\n { maxHeight: full_height },\n ],\n {\n duration: ANIMATION_SPEED.get().value,\n easing: \"ease-in-out\",\n },\n );\n this.#animation.onfinish = () => (this.#group.style.overflowY = \"\");\n }\n }\n this.#collapsed = collapsed;\n }\n get collapsed(): boolean {\n return this.#collapsed;\n }\n\n set opened_text(text: string) {\n this.#open_text.textContent = text;\n }\n\n set closed_text(text: string) {\n this.#close_text.textContent = text;\n }\n}\ndefine_element(FormGroupCollapser);\n\n/**Creates a dropdown form element */\nexport function form_group_collapser(\n group: FormGroupBase<any, any>,\n options?: FormGroupCollapserOptions,\n): FormGroupCollapser {\n const slide = new FormGroupCollapser(group, options?.collapsed);\n if (options) {\n if (options.opened_text) slide.opened_text = options.opened_text;\n if (options.closed_text) slide.closed_text = options.closed_text;\n FormElement.apply_options(slide, options);\n }\n return slide;\n}\n","import { define_element } from \"#base\";\nimport { ListField } from \"#list\";\nimport { FormElement } from \"../base\";\nimport \"./list_field.scss\";\n\nexport class ListFormField<T extends FormElement> extends ListField {\n static element_name() {\n return \"listfield\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n set element(component: T) {\n this.replaceChildren(component);\n }\n\n get element(): T {\n return this.firstElementChild as T;\n }\n}\ndefine_element(ListFormField);\n\nexport function form_list_field<T extends FormElement>(element: T) {\n const field = new ListFormField<T>();\n field.element = element;\n return field;\n}\n","import { none } from \"@chocbite/ts-lib/result\";\nimport type { StateNumberRelated } from \"@chocbite/ts-lib/state\";\nimport type { SVGFunc } from \"#svg\";\nimport {\n FormValueWrite,\n FormValueWriteOptions,\n type FormValueOptions,\n} from \"../base\";\nimport \"./number_base.scss\";\n\nexport interface FormNumberOptions<\n ID extends string | undefined,\n RT = number,\n> extends FormValueOptions<RT, ID> {\n /**Lower limit for slider value*/\n min?: number;\n /**Upper limit for slider value*/\n max?: number;\n /**Amount of decimals to show*/\n decimals?: number;\n /**Unit to use for slider*/\n unit?: string;\n}\n\nexport interface FormNumberWriteOptions<\n ID extends string | undefined,\n RT = number,\n>\n extends FormNumberOptions<ID, RT>, FormValueWriteOptions<RT, ID> {\n /**Step size, use 0 for automatic step size*/\n step?: number;\n /**Start for step, use 0 for automatic */\n start?: number;\n}\n\nexport interface FormStepperBaseOptions<\n ID extends string | undefined,\n RT = number,\n> extends FormNumberWriteOptions<ID, RT> {\n /**wether the events are live as the slider is moved or only when moving stops */\n live?: boolean;\n /**Icon to use for decreasing value*/\n icon_decrease?: SVGFunc;\n /**Icon to use for increasing value*/\n icon_increase?: SVGFunc;\n}\n\nexport abstract class FormNumberWrite<\n ID extends string | undefined,\n RT = number,\n> extends FormValueWrite<RT, ID> {\n static apply_options<RT, ID extends string | undefined>(\n element: FormNumberWrite<ID, RT>,\n options: FormNumberWriteOptions<ID, RT>,\n ) {\n if (options.unit) element.unit = options.unit;\n if (options.decimals) element.decimals = options.decimals;\n if (options.min !== undefined) element.min = options.min;\n if (options.max !== undefined) element.max = options.max;\n if (options.step) element.step = options.step;\n if (options.start) element.start = options.start;\n super.apply_options(element, options);\n }\n\n /**Set the minimum value*/\n abstract set min(min: number | undefined);\n\n /**Set the minimum value*/\n abstract set max(max: number | undefined);\n\n /**Sets the size of number change steps*/\n abstract set step(step: number | undefined);\n\n /**Sets the start offset for number steps*/\n abstract set start(step: number | undefined);\n\n /**Sets the amount of decimals the element can have*/\n abstract set decimals(dec: number | undefined);\n\n /**Sets the unit of the element*/\n abstract set unit(unit: string | undefined);\n\n /**Related states of the last bound state, a prop is only reset when it followed one of them*/\n #related: Partial<StateNumberRelated> = {};\n\n protected state_related(related: Partial<StateNumberRelated>): void {\n const old = this.#related;\n this.#related = related;\n if (related.min)\n this.attach_state_to_prop(\"min\", related.min, () => none());\n else if (old.min) this.detach_state_from_prop(\"min\").min = undefined;\n if (related.max)\n this.attach_state_to_prop(\"max\", related.max, () => none());\n else if (old.max) this.detach_state_from_prop(\"max\").max = undefined;\n if (related.step)\n this.attach_state_to_prop(\"step\", related.step, () => none());\n else if (old.step) this.detach_state_from_prop(\"step\").step = undefined;\n if (related.start)\n this.attach_state_to_prop(\"start\", related.start, () => none());\n else if (old.start) this.detach_state_from_prop(\"start\").start = undefined;\n if (related.decimals)\n this.attach_state_to_prop(\"decimals\", related.decimals, () => none());\n else if (old.decimals)\n this.detach_state_from_prop(\"decimals\").decimals = undefined;\n if (related.unit)\n this.attach_state_to_prop(\"unit\", related.unit, () => none());\n else if (old.unit) this.detach_state_from_prop(\"unit\").unit = undefined;\n }\n}\n\n/**Decimals to show and round to, the given decimals, or without them enough for the step and start*/\nexport function number_decimals(\n decimals: number | undefined,\n step: number,\n start: number,\n): number {\n return decimals ?? Math.max(fraction_digits(step), fraction_digits(start));\n}\n\n/**Amount of decimals needed to show a number, at most 10*/\nfunction fraction_digits(val: number): number {\n let dec = 0;\n for (let scaled = val; dec < 10; dec++, scaled = val * 10 ** dec)\n if (Math.abs(scaled - Math.round(scaled)) < 1e-9) break;\n return dec;\n}\n","import { define_element } from \"#base\";\nimport { sync_resolve } from \"@chocbite/ts-lib/common\";\nimport { get_cursor_position, set_cursor_end, set_cursor_position, set_selection_all } from \"#selection\";\nimport { number_step_start_decimal } from \"@chocbite/ts-lib/math\";\nimport { err, type Result } from \"@chocbite/ts-lib/result\";\nimport {\n FormNumberWrite,\n number_decimals,\n type FormNumberWriteOptions,\n} from \"../number_base\";\nimport \"./number_input.scss\";\n\nexport class FormNumberInput<\n ID extends string | undefined,\n> extends FormNumberWrite<ID> {\n static element_name() {\n return \"numberinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #unit: string = \"\";\n #min: number = -Infinity;\n #max: number = Infinity;\n #step: number = 0;\n #start: number = 0;\n #decimals_set?: number;\n #decimals: number = 0;\n /**Text last drawn from a value, and whether the user typed since*/\n #shown: string = \"\";\n #edited: boolean = false;\n\n #value_box = this.appendChild(document.createElement(\"span\"));\n #unit_box = this.appendChild(document.createElement(\"span\"));\n #legend = this.appendChild(document.createElement(\"div\"));\n #max_legend = this.#legend.appendChild(document.createElement(\"span\"));\n #min_legend = this.#legend.appendChild(document.createElement(\"span\"));\n\n constructor(id?: ID) {\n super(id);\n this.appendChild(this.warn_input);\n this.#value_box.contentEditable = \"true\";\n this.onpointerdown = (e) => {\n this.selected = true;\n if (e.target !== this.#value_box) {\n e.preventDefault();\n set_cursor_end(this.#value_box);\n } else this.#value_box.focus();\n };\n this.#value_box.addEventListener(\"focusin\", (e) => {\n e.preventDefault();\n if (this.selected) return;\n set_selection_all(this.#value_box);\n this.selected = true;\n });\n this.#value_box.onblur = () => {\n this.selected = false;\n setTimeout(() => {\n this.#set(false);\n }, 0);\n };\n this.#value_box.oninput = () => (this.#edited = true);\n this.onkeydown = (e) => {\n if (e.key === \"Enter\") this.#set(true);\n else if (e.key === \"Escape\") {\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n } else if (e.key === \"ArrowUp\") this.#step_value(true);\n else if (e.key === \"ArrowDown\") this.#step_value(false);\n else return;\n e.preventDefault();\n e.stopPropagation();\n };\n this.onbeforeinput = (e) => {\n if (e.inputType === \"insertParagraph\") e.preventDefault();\n else if (e.data) {\n if (!/[\\d,.-]/g.test(e.data)) e.preventDefault();\n else if (/[,.]/g.test(e.data) && this.#decimals === 0)\n e.preventDefault();\n else if (this.#min >= 0 && /-/g.test(e.data)) e.preventDefault();\n }\n };\n }\n\n async #set(cur: boolean) {\n const text = this.#value_box.textContent || \"\";\n //Not edited, a value that arrived while focused is shown instead of writing the old text back\n if (!this.#edited && text === this.#shown) {\n const shown = this.buffer?.toFixed(this.#decimals);\n if (shown !== undefined && shown !== text) this.new_value(this.buffer!);\n return;\n }\n const sel = get_cursor_position(this.#value_box);\n const buff = this.buffer;\n (await this.set_value_check(parseFloat(text.replace(\",\", \".\")) || 0))\n .map_err(() => {\n this.new_value(buff || Math.max(Math.min(0, this.#max), this.#min));\n set_cursor_end(this.#value_box);\n })\n .map(() => {\n if (!cur) return;\n set_cursor_position(this.#value_box, sel);\n });\n }\n\n focus(options?: FocusOptions): void {\n this.#value_box.focus(options);\n }\n\n set unit(unit: string | undefined) {\n this.#unit = unit || \"\";\n this.#unit_box.textContent = this.#unit;\n }\n\n set decimals(dec: number | undefined) {\n this.#decimals_set = dec;\n this.#update_decimals();\n }\n\n /**Updates the decimals from the set decimals, step and start, and redraws with them*/\n #update_decimals() {\n const dec = number_decimals(this.#decimals_set, this.#step, this.#start);\n if (dec === this.#decimals) return;\n this.#decimals = dec;\n this.#update_min_legend();\n this.#update_max_lengend();\n if (this.buffer !== undefined && !this.selected)\n this.new_value(this.buffer);\n }\n\n set min(min: number | undefined) {\n this.#min = min ?? -Infinity;\n this.#update_min_legend();\n }\n #update_min_legend() {\n this.#min_legend.textContent =\n this.#min === -Infinity ? \"\" : \"Min:\" + this.#min.toFixed(this.#decimals);\n }\n\n set max(max: number | undefined) {\n this.#max = max ?? Infinity;\n this.#update_max_lengend();\n }\n #update_max_lengend() {\n this.#max_legend.textContent =\n this.#max === Infinity ? \"\" : \"Max:\" + this.#max.toFixed(this.#decimals);\n }\n\n set step(step: number | undefined) {\n this.#step = step || 0;\n this.#update_decimals();\n }\n\n set start(step: number | undefined) {\n this.#start = step || 0;\n this.#update_decimals();\n }\n\n protected new_value(val: number): void {\n this.#value_box.textContent = this.#shown = val.toFixed(this.#decimals);\n this.#edited = false;\n }\n\n protected clear_value(): void {\n this.#value_box.textContent = this.#shown = \"\";\n this.#edited = false;\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected limit_value(val: number): PromiseLike<Result<number, string>> {\n let lim = number_step_start_decimal(\n Math.min(Math.max(val, this.#min), this.#max),\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.limit_value(lim);\n }\n\n protected check_value(val: number): PromiseLike<Result<number, string>> {\n if (val < this.#min)\n return sync_resolve(\n err(\"Minimum value \" + this.#min.toFixed(this.#decimals) + this.#unit),\n );\n if (val > this.#max)\n return sync_resolve(\n err(\"Maximum value \" + this.#max.toFixed(this.#decimals) + this.#unit),\n );\n let lim = number_step_start_decimal(\n val,\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.check_value(lim);\n }\n\n #step_value(dir: boolean) {\n const step =\n this.#step ||\n Math.max(\n this.#decimals ? 10 ** -this.#decimals : 1,\n Math.floor(Math.abs(this.buffer || 0) / 150),\n );\n return this.set_value_check((this.buffer || 0) + (dir ? step : -step));\n }\n}\ndefine_element(FormNumberInput);\n\n/**Creates a number input form element */\nexport function form_number_input<ID extends string | undefined>(\n options?: FormNumberWriteOptions<ID>,\n): FormNumberInput<ID> {\n const input = new FormNumberInput<ID>(options?.id);\n if (options) {\n FormNumberWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport { none } from \"@chocbite/ts-lib/result\";\nimport type { StateNumberRelated } from \"@chocbite/ts-lib/state\";\nimport { FormValue } from \"../../base\";\nimport { type FormNumberOptions } from \"../number_base\";\nimport \"./progress.scss\";\n\nexport class FormProgress<ID extends string | undefined> extends FormValue<\n number,\n ID\n> {\n static element_name() {\n return \"progress\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #min: number = 0;\n #max: number = 100;\n #span: number = 100;\n #decimals: number = 0;\n #bar: HTMLDivElement = this.appendChild(document.createElement(\"div\"));\n #val: HTMLSpanElement = this.appendChild(document.createElement(\"span\"));\n #unit: HTMLSpanElement = this.appendChild(document.createElement(\"span\"));\n\n /**Set the minimum value*/\n set min(min: number) {\n this.#min = min;\n this.#span = this.#max - this.#min;\n this.#redraw();\n }\n\n /**Set the minimum value*/\n set max(max: number) {\n this.#max = max;\n this.#span = this.#max - this.#min;\n this.#redraw();\n }\n\n /**Sets the amount of decimals the element can have*/\n set decimals(dec: number | undefined) {\n this.#decimals = Math.max(dec ?? 0, 0);\n this.#redraw();\n }\n\n /**Sets the unit of the element*/\n set unit(unit: string | undefined) {\n this.#unit.textContent = unit ?? \"\";\n }\n\n /**Shows the value again, after a change to how it is shown*/\n #redraw(): void {\n if (this._buffer !== undefined) this.new_value(this._buffer);\n }\n\n protected new_value(value: number): void {\n this.#bar.style.width =\n Math.min(Math.max(((value - this.#min) / this.#span) * 100, 0), 100) +\n \"%\";\n this.#val.textContent = value.toFixed(this.#decimals);\n }\n\n protected clear_value(): void {\n this.#bar.style.width = \"0%\";\n this.#val.textContent = \"\";\n }\n\n protected new_error(err: string): void {\n console.error(err);\n }\n\n protected clear_error(): void {}\n\n /**Related states of the last bound state, a prop is only reset when it followed one of them*/\n #related: Partial<StateNumberRelated> = {};\n\n protected state_related(related: Partial<StateNumberRelated>): void {\n const old = this.#related;\n this.#related = related;\n if (related.min)\n this.attach_state_to_prop(\"min\", related.min, () => none());\n else if (old.min) this.detach_state_from_prop(\"min\").min = 0;\n if (related.max)\n this.attach_state_to_prop(\"max\", related.max, () => none());\n else if (old.max) this.detach_state_from_prop(\"max\").max = 100;\n if (related.decimals)\n this.attach_state_to_prop(\"decimals\", related.decimals, () => none());\n else if (old.decimals)\n this.detach_state_from_prop(\"decimals\").decimals = undefined;\n if (related.unit)\n this.attach_state_to_prop(\"unit\", related.unit, () => none());\n else if (old.unit) this.detach_state_from_prop(\"unit\").unit = undefined;\n }\n}\ndefine_element(FormProgress);\n\n/**Creates a progress form element */\nexport function form_progress<ID extends string | undefined>(\n options?: FormNumberOptions<ID>,\n): FormProgress<ID> {\n const prog = new FormProgress<ID>(options?.id);\n if (options) {\n if (typeof options.min !== \"undefined\") prog.min = options.min;\n if (typeof options.max !== \"undefined\") prog.max = options.max;\n prog.decimals = options.decimals;\n prog.unit = options.unit;\n FormValue.apply_options(prog, options);\n }\n return prog;\n}\n","import { define_element } from \"#base\";\nimport { sync_resolve } from \"@chocbite/ts-lib/common\";\nimport {\n material_add_rounded,\n material_remove_rounded,\n} from \"#icons\";\nimport { number_step_start_decimal } from \"@chocbite/ts-lib/math\";\nimport { err, type Result } from \"@chocbite/ts-lib/result\";\nimport type { SVGFunc } from \"#svg\";\nimport {\n FormNumberWrite,\n number_decimals,\n type FormStepperBaseOptions,\n} from \"../number_base\";\nimport \"./slider.scss\";\n\n/**Slide Selector, displays all options in a slider*/\nexport class FormSlider<ID extends string | undefined> extends FormNumberWrite<\n ID,\n number\n> {\n static element_name() {\n return \"slider\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #unit: string = \"\";\n #decimals_set?: number;\n #decimals: number = 0;\n #min: number = -Infinity;\n #max: number = Infinity;\n #span: number = Infinity;\n #step: number = 0;\n #start: number = 0;\n #live: boolean = false;\n #icon_dec = this.#stepper_func(\n this.appendChild(material_remove_rounded()),\n false,\n );\n #slide = this.appendChild(document.createElement(\"div\"));\n #legend = this.appendChild(document.createElement(\"span\"));\n #left_legend = this.#legend.appendChild(document.createElement(\"span\"));\n #right_legend = this.#legend.appendChild(document.createElement(\"span\"));\n #icon_inc = this.#stepper_func(\n this.appendChild(material_add_rounded()),\n true,\n );\n #slider = this.#slide.appendChild(document.createElement(\"div\"));\n #value_box = this.#slider.appendChild(document.createElement(\"span\"));\n #unit_box = this.#slider.appendChild(document.createElement(\"span\"));\n\n constructor(id?: ID) {\n super(id);\n this.#slider.setAttribute(\"tabindex\", \"0\");\n this.appendChild(this.warn_input);\n\n this.onpointerdown = (e) => {\n if (e.button !== 0) return;\n if (e.pointerType !== \"mouse\" && !this.#slider.contains(e.target as Node))\n return;\n e.stopPropagation();\n this.#slider.classList.add(\"active\");\n this.selected = true;\n const box = this.#slider.getBoundingClientRect();\n const offset = this.#slider.contains(e.target as Node)\n ? e.clientX >= box.x\n ? e.clientX <= box.x + box.width\n ? box.x - e.clientX\n : -box.width\n : 0\n : -box.width / 2;\n if (this.#min === -Infinity || this.#max === Infinity) {\n let value = this.buffer || 0;\n const interval = setInterval(async () => {\n const val = (value += diff / 50);\n if (this.#live)\n (await this.set_value_limit(val)).map((v) => (value = v));\n else {\n (await this.limit_value(val)).map((v) => {\n this.#move_value(v);\n value = v;\n });\n }\n }, 100);\n let diff = this.#x_to_perc(e.clientX + offset) - 50;\n this.#move_slide(this.#x_to_perc(e.clientX + offset));\n this.#slider.setPointerCapture(e.pointerId);\n this.#slider.onpointermove = (ev) => {\n ev.stopPropagation();\n const perc = this.#x_to_perc(ev.clientX + offset);\n diff = (this.#step || 1) * ((perc - 50) * 2);\n this.#move_slide(perc);\n };\n const reset = () => {\n this.#slider.classList.remove(\"active\");\n this.selected = false;\n this.#slider.releasePointerCapture(e.pointerId);\n this.#slider.onpointermove = null;\n this.#slider.onpointerup = null;\n this.#slider.onpointercancel = null;\n this.#slider.onkeydown = null;\n this.#move_slide(50);\n clearInterval(interval);\n };\n this.#slider.onpointerup = (ev) => {\n ev.stopPropagation();\n reset();\n if (!this.#live) this.set_value_limit(value);\n };\n //A cancelled drag, like a touch turning into a scroll, is undone like Escape\n this.#slider.onpointercancel = () => {\n reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n };\n this.#slider.onkeydown = (e) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n }\n };\n } else {\n const value = this.buffer || 0;\n this.#move_absolute(e.clientX + offset);\n this.#slider.setPointerCapture(e.pointerId);\n this.#slider.onpointermove = (ev) => {\n ev.stopPropagation();\n this.#move_absolute(ev.clientX + offset);\n };\n const reset = () => {\n this.#slider.classList.remove(\"active\");\n this.selected = false;\n this.#slider.releasePointerCapture(e.pointerId);\n this.#slider.onpointermove = null;\n this.#slider.onpointerup = null;\n this.#slider.onpointercancel = null;\n this.#slider.onkeydown = null;\n };\n this.#slider.onpointerup = (ev) => {\n ev.stopPropagation();\n reset();\n this.#move_absolute(ev.clientX + offset, value);\n };\n //A cancelled drag, like a touch turning into a scroll, is undone like Escape\n this.#slider.onpointercancel = () => {\n reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n };\n this.#slider.onkeydown = (e) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n }\n };\n }\n };\n this.#slide.onkeydown = (e) => {\n if (e.key === \"ArrowRight\") this.#step_value(true);\n else if (e.key === \"ArrowLeft\") this.#step_value(false);\n else return;\n e.preventDefault();\n e.stopPropagation();\n };\n }\n\n focus(options?: FocusOptions): void {\n this.#slider.focus(options);\n }\n\n set unit(unit: string | undefined) {\n this.#unit = unit || \"\";\n this.#unit_box.textContent = this.#unit;\n }\n\n set min(min: number | undefined) {\n this.#min = min ?? -Infinity;\n this.#update_min_max();\n this.#update_min_legend();\n }\n #update_min_legend() {\n this.#left_legend.textContent =\n this.#min === -Infinity ? \"\" : \"Min:\" + this.#min.toFixed(this.#decimals);\n }\n\n set max(max: number | undefined) {\n this.#max = max ?? Infinity;\n this.#update_min_max();\n this.#update_max_legend();\n }\n\n #update_max_legend() {\n this.#right_legend.textContent =\n this.#max === Infinity ? \"\" : this.#max.toFixed(this.#decimals) + \":Max\";\n }\n\n #update_min_max() {\n this.#span = this.#max - this.#min;\n if (this.#span === Infinity) this.#move_slide(50);\n else if (this.buffer !== undefined) this.new_value(this.buffer);\n }\n\n set decimals(dec: number | undefined) {\n this.#decimals_set = dec;\n this.#update_decimals();\n }\n\n set step(step: number | undefined) {\n this.#step = step || 0;\n this.#update_decimals();\n }\n\n set start(step: number | undefined) {\n this.#start = step || 0;\n this.#update_decimals();\n }\n\n /**Updates the decimals from the set decimals, step and start, and redraws with them*/\n #update_decimals() {\n const dec = number_decimals(this.#decimals_set, this.#step, this.#start);\n if (dec === this.#decimals) return;\n this.#decimals = dec;\n this.#update_min_legend();\n this.#update_max_legend();\n if (this.buffer !== undefined && !this.selected)\n this.new_value(this.buffer);\n }\n\n /**Set wether the slider is in live mode*/\n set live(live: boolean | undefined) {\n this.#live = live || false;\n }\n\n set icon_decrease(icon: SVGFunc | undefined) {\n const old = this.#icon_dec;\n this.#icon_dec = this.#stepper_func(\n icon ? icon() : material_remove_rounded(),\n false,\n );\n this.replaceChild(this.#icon_dec, old);\n }\n\n set icon_increase(icon: SVGFunc | undefined) {\n const old = this.#icon_inc;\n this.#icon_inc = this.#stepper_func(\n icon ? icon() : material_add_rounded(),\n true,\n );\n this.replaceChild(this.#icon_inc, old);\n }\n\n protected new_value(value: number): void {\n this.#move_value(value);\n //Without both limits the handle stays centered\n this.#move_slide(\n this.#span === Infinity\n ? 50\n : Math.min(Math.max(((-this.#min + value) / this.#span) * 100, 0), 100),\n );\n }\n\n protected clear_value(): void {\n this.#value_box.textContent = \"\";\n this.#move_slide(50);\n }\n\n protected new_error(err: string): void {\n console.error(err);\n }\n\n protected clear_error(): void {}\n\n protected limit_value(val: number): PromiseLike<Result<number, string>> {\n let lim = number_step_start_decimal(\n Math.min(Math.max(val, this.#min), this.#max),\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.limit_value(lim);\n }\n\n protected check_value(val: number): PromiseLike<Result<number, string>> {\n if (val < this.#min)\n return sync_resolve(\n err(\"Minimum value \" + this.#min.toFixed(this.#decimals) + this.#unit),\n );\n if (val > this.#max)\n return sync_resolve(\n err(\"Maximum value \" + this.#max.toFixed(this.#decimals) + this.#unit),\n );\n let lim = number_step_start_decimal(\n val,\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.check_value(lim);\n }\n\n async #move_absolute(x: number, last?: number) {\n const perc = this.#x_to_perc(x);\n if (this.#live) this.set_value_limit(this.#perc_to_value(perc));\n else {\n if (last === undefined) {\n const value = await this.limit_value(this.#perc_to_value(perc));\n if (value.ok) {\n this.#move_slide(((-this.#min + value.value) / this.#span) * 100);\n this.#move_value(value.value);\n }\n } else {\n this.set_value_limit(this.#perc_to_value(perc));\n }\n }\n }\n\n #x_to_perc(x: number) {\n const box = this.#slide.getBoundingClientRect();\n return Math.min(100, Math.max(0, ((x - box.x) / box.width) * 100));\n }\n\n #perc_to_value(perc: number) {\n return (perc / 100) * this.#span + this.#min;\n }\n\n /**Attaches click action to over time increase speed of stepping when holding step buttons */\n #stepper_func(icon: SVGSVGElement, dir: boolean) {\n icon.onpointerdown = (e) => {\n if (e.button === 0) {\n e.stopPropagation();\n let interval = 0;\n let scaler_interval = 0;\n let scaler = 250;\n const release = () => {\n clearInterval(interval);\n clearInterval(scaler_interval);\n clearTimeout(timeout);\n icon.onpointerup = null;\n icon.onpointercancel = null;\n icon.releasePointerCapture(e.pointerId);\n icon.classList.remove(\"active\");\n };\n icon.setPointerCapture(e.pointerId);\n icon.classList.add(\"active\");\n const timeout = setTimeout(() => {\n this.#step_value(dir);\n interval = setInterval(() => this.#step_value(dir), scaler);\n scaler_interval = setInterval(() => {\n if (scaler > 20) scaler /= 1.1;\n clearInterval(interval);\n interval = setInterval(() => this.#step_value(dir), scaler);\n }, 1000);\n }, 500);\n icon.onpointerup = () => {\n if (interval === 0) this.#step_value(dir);\n release();\n };\n icon.onpointercancel = release;\n }\n };\n return icon;\n }\n\n #step_value(dir: boolean) {\n const step =\n this.#step ||\n Math.max(\n this.#decimals ? 10 ** -this.#decimals : 1,\n Math.floor(Math.abs(this.buffer || 0) / 150),\n );\n return this.set_value_check((this.buffer || 0) + (dir ? step : -step));\n }\n\n #move_slide(perc: number) {\n this.#slider.style.left = perc + \"%\";\n }\n #move_value(value: number) {\n this.#value_box.textContent = value.toFixed(this.#decimals);\n }\n}\ndefine_element(FormSlider);\n\n/**Creates a dropdown form element */\nexport function form_slider<ID extends string | undefined>(\n options?: FormStepperBaseOptions<ID>,\n): FormSlider<ID> {\n const slide = new FormSlider<ID>(options?.id);\n if (options) {\n if (options.live) slide.live = options.live;\n if (options.icon_decrease) slide.icon_decrease = options.icon_decrease;\n if (options.icon_increase) slide.icon_increase = options.icon_increase;\n FormNumberWrite.apply_options(slide, options);\n }\n return slide;\n}\n","import { define_element } from \"#base\";\nimport { sleep, sync_resolve } from \"@chocbite/ts-lib/common\";\nimport {\n material_add_rounded,\n material_remove_rounded,\n} from \"#icons\";\nimport { number_step_start_decimal } from \"@chocbite/ts-lib/math\";\nimport { err, type Result } from \"@chocbite/ts-lib/result\";\nimport { set_cursor_end } from \"#selection\";\nimport type { SVGFunc } from \"#svg\";\nimport {\n FormNumberWrite,\n number_decimals,\n type FormStepperBaseOptions,\n} from \"../number_base\";\nimport \"./stepper.scss\";\n\n/**Slide Selector, displays all options in a slider*/\nexport class FormStepper<ID extends string | undefined> extends FormNumberWrite<\n ID,\n number\n> {\n static element_name() {\n return \"stepper\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #unit: string = \"\";\n #decimals_set?: number;\n #decimals: number = 0;\n /**Text last drawn from a value, and whether the user typed since*/\n #shown: string = \"\";\n #edited: boolean = false;\n #min: number = -Infinity;\n #max: number = Infinity;\n #step: number = 0;\n #start: number = 0;\n #live: boolean = false;\n #icon_dec = this.#stepper_func(\n this.appendChild(material_remove_rounded()),\n false,\n );\n #text = this.appendChild(document.createElement(\"span\"));\n #icon_inc = this.#stepper_func(\n this.appendChild(material_add_rounded()),\n true,\n );\n #value_box = this.#text.appendChild(document.createElement(\"span\"));\n #unit_box = this.#text.appendChild(document.createElement(\"span\"));\n #legend = this.#text.appendChild(document.createElement(\"span\"));\n #max_legend = this.#legend.appendChild(document.createElement(\"span\"));\n #min_legend = this.#legend.appendChild(document.createElement(\"span\"));\n\n constructor(id?: ID) {\n super(id);\n this.setAttribute(\"tabindex\", \"0\");\n this.appendChild(this.warn_input);\n\n this.#value_box.setAttribute(\"tabindex\", \"-1\");\n this.#value_box.contentEditable = \"true\";\n this.#value_box.onfocus = async () => {\n this.selected = true;\n };\n this.#value_box.onblur = async () => {\n this.selected = false;\n await sleep(0);\n const text = this.#value_box.textContent || \"\";\n //Not edited, a value that arrived while focused is shown instead of writing the old text back\n if (!this.#edited && text === this.#shown) {\n if (this.buffer !== undefined) this.new_value(this.buffer);\n } else this.set_value_check(parseFloat(text.replace(\",\", \".\")) || 0);\n };\n this.#value_box.oninput = () => (this.#edited = true);\n this.#value_box.onpointerdown = () => {\n this.selected = true;\n };\n let pointer_id: number | undefined;\n const reset = () => {\n this.selected = false;\n this.#value_box.contentEditable = \"true\";\n if (pointer_id !== undefined) {\n this.#text.releasePointerCapture(pointer_id);\n pointer_id = undefined;\n }\n this.#text.onpointermove = null;\n this.#text.onpointerup = null;\n this.#text.onpointercancel = null;\n };\n this.#text.onpointerdown = (e) => {\n if (e.button === 0 && !this.selected) {\n e.stopPropagation();\n this.selected = true;\n const initial_val = this.buffer || 0;\n let moving = false;\n this.#text.setPointerCapture(e.pointerId);\n pointer_id = e.pointerId;\n this.#text.onpointermove = (ev) => {\n ev.stopPropagation();\n if (moving) {\n this.#move_diff(\n initial_val + ((ev.clientX - e.clientX) / 10) * (this.#step || 1),\n );\n } else if (Math.abs(e.clientX - ev.clientX) > 5) {\n this.#value_box.contentEditable = \"false\";\n moving = true;\n }\n };\n this.#text.onpointerup = (ev) => {\n ev.stopPropagation();\n reset();\n if (!moving && e.target !== this.#value_box) {\n set_cursor_end(this.#value_box);\n } else if (moving) {\n this.#move_diff(\n initial_val + ((ev.clientX - e.clientX) / 10) * (this.#step || 1),\n true,\n );\n moving = false;\n }\n };\n //A cancelled drag, like a touch turning into a scroll, is undone like Escape\n this.#text.onpointercancel = () => {\n reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n };\n }\n };\n\n this.onkeydown = (e) => {\n if (e.key === \"ArrowRight\" || e.key === \"ArrowLeft\") {\n e.preventDefault();\n e.stopPropagation();\n this.#step_value(e.key === \"ArrowRight\");\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n if (reset) reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n } else {\n if (\n this.ownerDocument.activeElement !== this.#value_box &&\n /[\\d,.-]/g.test(e.key)\n ) {\n this.#value_box.textContent = \"\";\n this.#value_box.focus();\n }\n }\n };\n this.#value_box.onkeydown = (e) => {\n if (e.key === \"Enter\") {\n HTMLElement.prototype.focus.call(this);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n } else if (e.key === \"ArrowRight\" || e.key === \"ArrowLeft\")\n e.stopPropagation();\n };\n this.#value_box.onbeforeinput = (e) => {\n if (e.inputType === \"insertParagraph\") e.preventDefault();\n if (e.data) {\n if (!/[\\d,.-]/g.test(e.data)) e.preventDefault();\n else if (/[,.]/g.test(e.data) && this.#decimals === 0)\n e.preventDefault();\n else if (\n /-/g.test(e.data) &&\n (this.#min >= 0 || this.#value_box.textContent?.includes(\"-\"))\n )\n e.preventDefault();\n }\n };\n }\n\n focus(options?: FocusOptions): void {\n this.#value_box.focus(options);\n }\n\n set unit(unit: string | undefined) {\n this.#unit = unit || \"\";\n this.#unit_box.textContent = this.#unit;\n }\n\n set decimals(dec: number | undefined) {\n this.#decimals_set = dec;\n this.#update_decimals();\n }\n\n /**Updates the decimals from the set decimals, step and start, and redraws with them*/\n #update_decimals() {\n const dec = number_decimals(this.#decimals_set, this.#step, this.#start);\n if (dec === this.#decimals) return;\n this.#decimals = dec;\n this.#update_min_legend();\n this.#update_max_lengend();\n if (this.buffer !== undefined && !this.selected)\n this.new_value(this.buffer);\n }\n\n set min(min: number | undefined) {\n this.#min = min ?? -Infinity;\n this.#update_min_legend();\n }\n #update_min_legend() {\n this.#min_legend.textContent =\n this.#min === -Infinity ? \"\" : \"Min:\" + this.#min.toFixed(this.#decimals);\n }\n\n set max(max: number | undefined) {\n this.#max = max ?? Infinity;\n this.#update_max_lengend();\n }\n #update_max_lengend() {\n this.#max_legend.textContent =\n this.#max === Infinity ? \"\" : \"Max:\" + this.#max.toFixed(this.#decimals);\n }\n\n set step(step: number | undefined) {\n this.#step = step || 0;\n this.#update_decimals();\n }\n\n set start(step: number | undefined) {\n this.#start = step || 0;\n this.#update_decimals();\n }\n\n /**Set wether the slider is in live mode*/\n set live(live: boolean | undefined) {\n this.#live = live || false;\n }\n\n set icon_decrease(icon: SVGFunc | undefined) {\n const old = this.#icon_dec;\n this.#icon_dec = this.#stepper_func(\n icon ? icon() : material_remove_rounded(),\n false,\n );\n this.replaceChild(this.#icon_dec, old);\n }\n\n set icon_increase(icon: SVGFunc | undefined) {\n const old = this.#icon_inc;\n this.#icon_inc = this.#stepper_func(\n icon ? icon() : material_add_rounded(),\n true,\n );\n this.replaceChild(this.#icon_inc, old);\n }\n\n protected new_value(value: number) {\n this.#value_box.textContent = this.#shown = value.toFixed(this.#decimals);\n this.#edited = false;\n }\n\n protected clear_value(): void {\n this.#value_box.textContent = this.#shown = \"\";\n this.#edited = false;\n }\n\n protected new_error(err: string): void {\n console.error(err);\n }\n\n protected clear_error(): void {}\n\n protected limit_value(val: number): PromiseLike<Result<number, string>> {\n let lim = number_step_start_decimal(\n Math.min(Math.max(val, this.#min), this.#max),\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.limit_value(lim);\n }\n\n protected check_value(val: number): PromiseLike<Result<number, string>> {\n if (val < this.#min)\n return sync_resolve(\n err(\"Minimum value \" + this.#min.toFixed(this.#decimals) + this.#unit),\n );\n if (val > this.#max)\n return sync_resolve(\n err(\"Maximum value \" + this.#max.toFixed(this.#decimals) + this.#unit),\n );\n let lim = number_step_start_decimal(\n val,\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.check_value(lim);\n }\n\n /**Moves the value to a position by the mouse x coordinates*/\n async #move_diff(value: number, last: boolean = false) {\n if (this.#live) this.set_value_limit(value);\n else {\n if (last) this.set_value_limit(value);\n else {\n const lim = await this.limit_value(value);\n if (lim.ok) this.#move_value(lim.value);\n }\n }\n }\n\n /**Moves the slider to the given percent position*/\n #move_value(value: number) {\n this.#value_box.textContent = value.toFixed(this.#decimals);\n }\n\n /**Attaches click action to over time increase speed of stepping when holding step buttons */\n #stepper_func(icon: SVGSVGElement, dir: boolean) {\n icon.onpointerdown = (e) => {\n if (e.button === 0) {\n e.stopPropagation();\n let interval = 0;\n let scaler_interval = 0;\n let scaler = 250;\n const release = () => {\n clearInterval(interval);\n clearInterval(scaler_interval);\n clearTimeout(timeout);\n icon.onpointerup = null;\n icon.onpointercancel = null;\n icon.releasePointerCapture(e.pointerId);\n icon.classList.remove(\"active\");\n };\n icon.setPointerCapture(e.pointerId);\n icon.classList.add(\"active\");\n const timeout = setTimeout(() => {\n this.#step_value(dir);\n interval = setInterval(() => this.#step_value(dir), scaler);\n scaler_interval = setInterval(() => {\n if (scaler > 20) scaler /= 1.1;\n clearInterval(interval);\n interval = setInterval(() => this.#step_value(dir), scaler);\n }, 1000);\n }, 500);\n icon.onpointerup = () => {\n if (interval === 0) this.#step_value(dir);\n release();\n };\n icon.onpointercancel = release;\n }\n };\n return icon;\n }\n\n #step_value(dir: boolean) {\n const step =\n this.#step ||\n Math.max(\n this.#decimals ? 10 ** -this.#decimals : 1,\n Math.floor(Math.abs(this.buffer || 0) / 150),\n );\n return this.set_value_check((this.buffer || 0) + (dir ? step : -step));\n }\n}\ndefine_element(FormStepper);\n\n/**Creates a dropdown form element */\nexport function form_stepper<ID extends string | undefined>(\n options?: FormStepperBaseOptions<ID>,\n): FormStepper<ID> {\n const slide = new FormStepper<ID>(options?.id);\n if (options) {\n if (options.live) slide.live = options.live;\n if (options.icon_decrease) slide.icon_decrease = options.icon_decrease;\n if (options.icon_increase) slide.icon_increase = options.icon_increase;\n FormNumberWrite.apply_options(slide, options);\n }\n return slide;\n}\n","import { some } from \"@chocbite/ts-lib/result\";\nimport state, { type StateEnumRelated } from \"@chocbite/ts-lib/state\";\nimport type { SVGFunc } from \"#svg\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../base\";\n\nexport interface FormSelectorOption<RT> {\n /**Value to set when option is selected */\n value: RT;\n /**Text for selection */\n text: string;\n /**Icon to display for option*/\n icon?: SVGFunc;\n}\n\n/**Selection options for a form selector */\nexport type FormSelections<T> = FormSelectorOption<T>[];\n\nexport interface FormSelectorBaseOptions<\n T,\n ID extends string | undefined,\n> extends FormValueWriteOptions<T, ID> {\n /**Options for selector*/\n selections?: FormSelections<T>;\n}\n\n/**Base for number elements elements*/\nexport abstract class FormSelectorBase<\n RT,\n ID extends string | undefined,\n> extends FormValueWrite<RT, ID> {\n /**Sets the selection options for the selector */\n abstract set selections(selections: FormSelections<RT> | undefined);\n\n static apply_options<RT, ID extends string | undefined>(\n element: FormSelectorBase<RT, ID>,\n options: FormSelectorBaseOptions<RT, ID>,\n ) {\n if (options.selections) element.selections = options.selections;\n super.apply_options(element, options);\n }\n\n //True while the selections come from the list of the bound state\n #related_list = false;\n\n protected state_related(related: Partial<StateEnumRelated>): void {\n if (related.list) {\n this.attach_state_to_prop_map(\n \"selections\",\n related.list,\n () => some([]),\n (val) => {\n return some(\n state.e.map(val, (key, val) => {\n return {\n text: val.name,\n value: key as RT,\n icon: val.icon,\n };\n }),\n );\n },\n );\n } else if (this.#related_list)\n this.detach_state_from_prop(\"selections\").selections = undefined;\n this.#related_list = !!related.list;\n }\n}\n","import { Base, define_element } from \"#base\";\nimport { DOCUMENT_HANDLER } from \"#document\";\nimport {\n material_close_rounded,\n material_keyboard_arrow_down_rounded,\n material_unfold_less_rounded,\n} from \"#icons\";\nimport type { SVGFunc } from \"#svg\";\nimport {\n FormSelectorBase,\n type FormSelectorBaseOptions,\n type FormSelectorOption,\n} from \"../selector_base\";\nimport \"./drop_down.scss\";\n\nexport interface FormDropDownSelection {\n text: string;\n icon?: SVGFunc;\n}\n\nexport interface FormDropDownOptions<\n RT,\n ID extends string | undefined,\n> extends FormSelectorBaseOptions<RT, ID> {\n /**Default text displayed*/\n default?: string;\n /**Default icon displayed*/\n default_icon?: SVGFunc;\n}\n\n/**Dropdown box for selecting between multiple choices in a small space*/\nexport class FormDropdown<\n RT,\n ID extends string | undefined,\n> extends FormSelectorBase<RT, ID> {\n static element_name() {\n return \"dropdown\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #map: Map<RT, FormDropDownSelection> = new Map();\n #values: RT[] = [];\n #selected: number = -1;\n\n #icon?: SVGSVGElement;\n #text: HTMLDivElement = this.appendChild(document.createElement(\"div\"));\n #open: SVGSVGElement = this.appendChild(\n material_keyboard_arrow_down_rounded(),\n );\n #default: Text = document.createTextNode(\"Select something\");\n #default_icon?: SVGFunc;\n /**Popup of the document the dropdown was opened in*/\n #box?: DropDownBox;\n private is_open: boolean = false;\n\n constructor(id?: ID) {\n super(id);\n this.#text.append(this.#default);\n this.appendChild(this.warn_input);\n this.tabIndex = 0;\n this.onclick = () => (this.open = true);\n this.onpointerdown = (e) => {\n if (e.pointerType === \"mouse\") {\n this.open = true;\n e.preventDefault();\n }\n };\n this.onkeydown = (e) => {\n switch (e.key) {\n case \" \":\n case \"Enter\":\n e.preventDefault();\n this.open = true;\n break;\n case \"ArrowDown\":\n case \"ArrowUp\":\n e.preventDefault();\n e.stopPropagation();\n this.#select_adjacent(e.key === \"ArrowDown\");\n break;\n }\n };\n }\n\n focus(options?: FocusOptions): void {\n HTMLElement.prototype.focus.call(this, options);\n }\n\n /**Gets the default text displayed when nothing has been selected yet */\n get default() {\n return this.#default.nodeValue || \"\";\n }\n\n /**Sets the default text displayed when nothing has been selected yet */\n set default(def: string) {\n this.#default.nodeValue = def;\n }\n\n /**Sets the default text displayed when nothing has been selected yet */\n set default_icon(def: SVGFunc | undefined) {\n this.#default_icon = def;\n if (def && this.#selected === -1) this.#set_icon = def;\n }\n\n set selections(selections: FormSelectorOption<RT>[] | undefined) {\n this.open = false;\n if (this.#map.size > 0) {\n this.#map.clear();\n this.#values = [];\n this.#selected = -1;\n }\n for (let i = 0; selections && i < selections.length; i++) {\n const { value, text, icon } = selections[i];\n this.#map.set(value, { text, icon });\n this.#values.push(value);\n }\n if (this.buffer !== undefined) this.new_value(this.buffer);\n }\n\n set open(open: boolean) {\n if (open && !this.is_open) {\n const old = this.#open;\n this.#open = material_unfold_less_rounded();\n old.replaceWith(this.#open);\n this.#box = boxes.get(this.ownerDocument) ?? main_box;\n this.#box.open_menu(this.#map, this, this.buffer);\n } else if (!open && this.is_open) {\n const old = this.#open;\n this.#open = material_keyboard_arrow_down_rounded();\n old.replaceWith(this.#open);\n this.#box?.close_menu();\n }\n this.is_open = open;\n }\n\n /**Changes the icon of the button*/\n set #set_icon(icon: SVGFunc | undefined) {\n if (icon) {\n const i = icon();\n if (this.#icon) this.replaceChild(i, this.#icon);\n else this.insertBefore(i, this.#text);\n this.#icon = i;\n } else if (this.#icon) {\n this.removeChild(this.#icon);\n this.#icon = undefined;\n }\n }\n\n /**Selects the previous or next selection in the element\n * @param dir false is next true is previous*/\n #select_adjacent(dir: boolean) {\n const y = Math.min(\n this.#values.length - 1,\n Math.max(0, dir ? this.#selected + 1 : this.#selected - 1),\n );\n if (y !== this.#selected) this.set_value_check(this.#values[y]);\n }\n\n #clear() {\n this.default_icon = this.#default_icon\n ? (this.#set_icon = this.#default_icon)\n : (this.#set_icon = undefined);\n this.#text.replaceChildren(this.#default);\n }\n\n /**Called when Value is changed */\n protected new_value(value: RT) {\n if (!this.#map.has(value)) {\n this.#clear();\n this.#selected = -1;\n return;\n }\n const opt = this.#map.get(value)!;\n this.#text.innerText = opt.text;\n this.#selected = this.#values.indexOf(value);\n if (opt.icon) this.#set_icon = opt.icon;\n else this.#set_icon = undefined;\n }\n\n protected clear_value(): void {\n this.#clear();\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n warn(message: string): void {\n setTimeout(() => {\n super.warn(message);\n }, 0);\n }\n}\ndefine_element(FormDropdown);\n\n/**Creates a dropdown form element */\nexport function form_dropdown<RT, ID extends string | undefined>(\n options?: FormDropDownOptions<RT, ID>,\n): FormDropdown<RT, ID> {\n const drop = new FormDropdown<RT, ID>(options?.id);\n if (options) {\n if (options.default) drop.default = options.default;\n if (options.default_icon) drop.default_icon = options.default_icon;\n FormSelectorBase.apply_options(drop, options);\n }\n return drop;\n}\n\n///##################################################################################################\nclass DropDownBox extends Base {\n static element_name() {\n return \"dropdownbox\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #closer: HTMLDivElement = document.createElement(\"div\");\n #container: HTMLDivElement = this.appendChild(document.createElement(\"div\"));\n #scroll: HTMLDivElement = this.#container.appendChild(\n document.createElement(\"div\"),\n );\n #table: HTMLDivElement = this.#scroll.appendChild(\n document.createElement(\"div\"),\n );\n #dropdown: FormDropdown<any, any> | undefined;\n #focus_out_handler = (e: FocusEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (!e.relatedTarget || !this.contains(e.relatedTarget as Node))\n this.close_menu();\n };\n #window_resize_handler = () => this.close_menu();\n #is_open: boolean = false;\n\n constructor() {\n super();\n this.#container.tabIndex = 0;\n this.#container.onkeydown = (e) => {\n if (e.key === \"Escape\") this.close_menu();\n else if (e.key === \"ArrowUp\" || (e.shiftKey && e.key === \"Tab\")) {\n const elem =\n e.target === this.#container\n ? this.#table.lastElementChild\n : (e.target as HTMLElement).previousElementSibling;\n if (elem) (elem as HTMLElement).focus();\n } else if (e.key === \"ArrowDown\" || e.key === \"Tab\") {\n const elem =\n e.target === this.#container\n ? this.#table.firstElementChild\n : (e.target as HTMLElement).nextElementSibling;\n if (elem) (elem as HTMLElement).focus();\n } else {\n return;\n }\n e.stopPropagation();\n e.preventDefault();\n };\n\n this.#closer\n .appendChild(document.createElement(\"div\"))\n .appendChild(material_close_rounded());\n this.#closer.appendChild(document.createElement(\"div\")).textContent =\n \"Close\";\n this.#closer.tabIndex = 0;\n this.#closer.onclick = (e) => {\n e.stopPropagation();\n e.preventDefault();\n this.close_menu();\n };\n this.#closer.onkeydown = (e) => {\n if (e.key === \" \" || e.key === \"Enter\") {\n e.stopPropagation();\n e.preventDefault();\n this.close_menu();\n }\n };\n\n this.addEventListener(\"focusout\", this.#focus_out_handler, {\n capture: true,\n });\n }\n\n #set_value(value: unknown) {\n //@ts-expect-error Call private method from sister class\n if (this.#dropdown) this.#dropdown.set_value_check(value);\n this.close_menu();\n }\n\n open_menu(\n map: Map<any, FormDropDownSelection>,\n parent: FormDropdown<any, any>,\n value: any,\n ) {\n //Another dropdown opening closes the open one, without focusing it\n if (this.#is_open) this.close_menu(false);\n const inner_height = this.ownerDocument.defaultView?.innerHeight || 0;\n this.classList.add(\"open\");\n const bounds = parent.getBoundingClientRect();\n if (bounds.y + bounds.height / 2 < inner_height / 2) {\n const top = bounds.y + bounds.height;\n this.#container.style.top = top + \"px\";\n this.#container.style.bottom = \"\";\n this.#container.style.maxHeight = inner_height - top - 10 + \"px\";\n this.#container.style.flexDirection = \"column\";\n } else {\n const bottom = inner_height - bounds.y;\n this.#container.style.top = \"\";\n this.#container.style.bottom = bottom + \"px\";\n this.#container.style.maxHeight = inner_height - bottom - 10 + \"px\";\n this.#container.style.flexDirection = \"column-reverse\";\n }\n this.#container.style.left = bounds.x + \"px\";\n this.#container.style.width = bounds.width + \"px\";\n this.#dropdown = parent;\n\n let focus: HTMLElement | undefined = undefined as HTMLElement | undefined;\n this.#table.replaceChildren(\n ...Array.from(map).map(([val, opt]) => {\n const line = document.createElement(\"div\");\n const icon = line.appendChild(document.createElement(\"div\"));\n if (opt.icon) icon.appendChild(opt.icon());\n const text = line.appendChild(document.createElement(\"div\"));\n text.textContent = opt.text;\n line.onpointerup = (e) => {\n if (e.pointerType !== \"touch\") this.#set_value(val);\n };\n line.onclick = () => this.#set_value(val);\n line.tabIndex = 0;\n line.onkeydown = (e) => {\n if (e.key === \" \" || e.key === \"Enter\") {\n e.preventDefault();\n this.#set_value(val);\n }\n };\n if (val === value) focus = line;\n return line;\n }),\n );\n\n //Show closer or not\n const box = this.#scroll.getBoundingClientRect();\n const box_area = box.width * box.height;\n const html = this.ownerDocument.documentElement;\n const html_area = html.clientWidth * html.clientHeight;\n if (box_area > html_area * 0.5) {\n this.#table.prepend(this.#closer);\n }\n\n //Checked after the options are added, so their size is known\n if (this.#scroll.scrollHeight > this.#scroll.clientHeight)\n this.#scroll.classList.add(\"scroll\");\n else this.#scroll.classList.remove(\"scroll\");\n\n if (focus) {\n focus.focus();\n focus.classList.add(\"selected\");\n } else this.#container.focus();\n\n this.ownerDocument.defaultView?.addEventListener(\n \"resize\",\n this.#window_resize_handler,\n { passive: true },\n );\n this.#is_open = true;\n }\n\n close_menu(focus: boolean = true) {\n if (!this.#is_open) return;\n this.#is_open = false;\n if (this.#dropdown) this.#dropdown.open = false;\n this.classList.remove(\"open\");\n this.#table.replaceChildren();\n if (this.#dropdown) {\n if (focus) this.#dropdown.focus();\n //@ts-expect-error Overwrite private property from sister class\n this.#dropdown.is_open = false;\n }\n this.ownerDocument.defaultView?.removeEventListener(\n \"resize\",\n this.#window_resize_handler,\n );\n }\n}\ndefine_element(DropDownBox);\n\n/**One popup per document, so dropdowns in popout windows open in their own window*/\nconst boxes = new Map<Document, DropDownBox>();\nconst add_box = (doc: Document): DropDownBox => {\n const box = doc.documentElement.appendChild(new DropDownBox());\n boxes.set(doc, box);\n return box;\n};\n/**Used for dropdowns in documents not registered with the document handler*/\nconst main_box = add_box(DOCUMENT_HANDLER.main);\nDOCUMENT_HANDLER.for_documents((doc) => {\n if (doc !== DOCUMENT_HANDLER.main) add_box(doc);\n});\nDOCUMENT_HANDLER.events.on(\"added\", (e) => add_box(e.data));\nDOCUMENT_HANDLER.events.on(\"removed\", (e) => boxes.delete(e.data));\n","import { define_element } from \"#base\";\nimport {\n FormSelectorBase,\n type FormSelectorBaseOptions,\n type FormSelectorOption,\n} from \"../selector_base\";\nimport \"./toggle_button.scss\";\n\nexport interface FormToggleButtonSelection {\n top: HTMLDivElement;\n bot: HTMLDivElement;\n}\n\n/**Toggle buttons, displays all options in a multi toggler*/\nexport class FormToggleButton<\n RT,\n ID extends string | undefined,\n> extends FormSelectorBase<RT, ID> {\n /**Returns the name used to define the element*/\n static element_name() {\n return \"togglebutton\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #map: Map<RT, FormToggleButtonSelection> = new Map();\n #values: RT[] = [];\n #selected: number = -1;\n\n focus(options?: FocusOptions): void {\n (this.firstElementChild as HTMLElement | null)?.focus(options);\n }\n\n set selections(selections: FormSelectorOption<RT>[] | undefined) {\n if (this.#map.size > 0) {\n this.#map.clear();\n this.#values = [];\n this.#selected = -1;\n this.replaceChildren();\n }\n for (let i = 0; selections && i < selections.length; i++) {\n const { value } = selections[i];\n this.#map.set(value, this.#add_selection(selections[i]));\n this.#values.push(selections[i].value);\n }\n if (this.buffer !== undefined) this.new_value(this.buffer);\n }\n\n #add_selection(selection: FormSelectorOption<RT>) {\n const top = this.appendChild(document.createElement(\"div\"));\n top.tabIndex = 0;\n const bot = this.appendChild(document.createElement(\"div\"));\n if (selection.icon) {\n top.appendChild(selection.icon());\n bot.textContent = selection.text;\n } else top.textContent = selection.text;\n const click = () => {\n top.appendChild(this.warn_input);\n this.set_value_check(selection.value);\n };\n top.onclick = click;\n bot.onclick = click;\n top.onkeydown = (e) => {\n if (e.key === \" \" || e.key === \"Enter\") click();\n else if (e.key === \"ArrowRight\") this.#select_adjacent(true);\n else if (e.key === \"ArrowLeft\") this.#select_adjacent(false);\n else return;\n e.preventDefault();\n e.stopPropagation();\n };\n return { top, bot };\n }\n\n /**Selects the previous or next selection in the element\n * @param dir false is next true is previous*/\n #select_adjacent(dir: boolean) {\n const sel = this.#map.get(this.#values[this.#selected]);\n if (sel) sel.top.appendChild(this.warn_input);\n const y = Math.min(\n this.#values.length - 1,\n Math.max(0, dir ? this.#selected + 1 : this.#selected - 1),\n );\n if (y !== this.#selected) this.set_value_check(this.#values[y]);\n }\n\n protected new_value(value: RT): void {\n const prev = this.#map.get(this.#values[this.#selected]);\n if (prev) {\n prev.top.classList.remove(\"selected\");\n prev.bot.classList.remove(\"selected\");\n }\n const opt = this.#map.get(value);\n if (opt) {\n opt.top.classList.add(\"selected\");\n opt.bot.classList.add(\"selected\");\n this.#selected = this.#values.indexOf(value);\n if (this.contains(document.activeElement)) {\n opt.top.focus();\n }\n } else this.#selected = -1;\n }\n\n protected clear_value(): void {\n const prev = this.#map.get(this.#values[this.#selected]);\n if (prev) {\n prev.top.classList.remove(\"selected\");\n prev.bot.classList.remove(\"selected\");\n }\n this.#selected = -1;\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n}\ndefine_element(FormToggleButton);\n\n/**Creates a toggle button form element */\nexport function form_toggle_button<RT, ID extends string | undefined>(\n options?: FormSelectorBaseOptions<RT, ID>,\n): FormToggleButton<RT, ID> {\n const togg = new FormToggleButton<RT, ID>(options?.id);\n if (options) FormSelectorBase.apply_options(togg, options);\n return togg;\n}\n","import { define_element } from \"#base\";\nimport { FormElement } from \"../base\";\nimport \"../shared\";\nimport \"./spacer.scss\";\n\nexport interface FormSpacerOptions {\n /**Spacing amount */\n space?: number;\n}\n\nexport class FormSpacer extends FormElement {\n static element_name() {\n return \"spacer\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n constructor() {\n super();\n }\n\n /**Sets the amount of space, in rem */\n set space(space: number) {\n this.style.height = `${space}rem`;\n }\n get space() {\n return parseFloat(this.style.height);\n }\n}\ndefine_element(FormSpacer);\n\n/**Creates a spacer form element */\nexport function form_spacer(options?: FormSpacerOptions): FormSpacer {\n const spacer = new FormSpacer();\n if (options) {\n if (options.space) spacer.space = options.space;\n }\n return spacer;\n}\n","import { define_element } from \"#base\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./color_input.scss\";\n\nexport interface FormColorOptions<\n ID extends string | undefined,\n RT = string,\n> extends FormValueWriteOptions<RT, ID> {\n /**Whether the color input should update live*/\n live?: boolean;\n}\n\nexport class FormColor<ID extends string | undefined> extends FormValueWrite<\n string,\n ID\n> {\n static element_name() {\n return \"colorinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #live: boolean = false;\n\n constructor(id?: ID) {\n super(id);\n this.appendChild(this.warn_input);\n this.warn_input.type = \"color\";\n this.warn_input.oninput = () => {\n if (this.#live) this.set_value_check(this.warn_input.value);\n };\n this.warn_input.onchange = () => {\n if (!this.#live) this.set_value_check(this.warn_input.value);\n };\n }\n\n set live(val: boolean) {\n this.#live = val;\n }\n get live(): boolean {\n return this.#live;\n }\n\n protected new_value(val: string): void {\n this.warn_input.value = val;\n }\n\n protected clear_value(): void {\n this.warn_input.value = \"#000000\";\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormColor);\n\n/**Creates a color input form element */\nexport function form_color<ID extends string | undefined>(\n options?: FormColorOptions<ID, string>,\n): FormColor<ID> {\n const input = new FormColor<ID>(options?.id);\n if (options) {\n if (options.live) input.live = options.live;\n FormValueWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport {\n material_calendar_month_rounded,\n material_schedule_rounded,\n} from \"#icons\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./date_time_input.scss\";\n\nexport interface FormDateTimeOptions<\n MODE extends FormDateTimeMode,\n ID extends string | undefined,\n> extends FormValueWriteOptions<FormDateTimeResult<MODE>, ID> {\n /**Type of date time*/\n type?: FormDateTimeType;\n /**Value representation used by the input*/\n mode: MODE;\n /**Force show milliseconds even when value is not precise to milliseconds */\n milliseconds?: boolean;\n}\n\nexport const FormDateTimeType = {\n DATE: \"date\",\n TIME: \"time\",\n DATETIME: \"datetime\",\n} as const;\nexport type FormDateTimeType =\n (typeof FormDateTimeType)[keyof typeof FormDateTimeType];\n\nexport const FormDateTimeMode = {\n DATE: \"date\",\n STRING: \"string\",\n NUMBER: \"number\",\n} as const;\nexport type FormDateTimeMode =\n (typeof FormDateTimeMode)[keyof typeof FormDateTimeMode];\n\nconst TIME_ONLY = /^\\d{2}:\\d{2}/;\nconst DATE_ONLY = /^\\d{4}-\\d{2}-\\d{2}$/;\n//Strings the input of each type shows as they are, without milliseconds\nconst INPUT_FORMAT: { [K in FormDateTimeType]: RegExp } = {\n date: DATE_ONLY,\n time: /^\\d{2}:\\d{2}(:\\d{2})?$/,\n datetime: /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2})?$/,\n};\n\n/**Returns the wall clock time of a string as UTC milliseconds, like the input uses\n * Time only strings give the time since midnight, strings without time zone are local*/\nconst string_wall_time = (value: string): number => {\n if (TIME_ONLY.test(value)) return Date.parse(\"1970-01-01T\" + value + \"Z\");\n //Date only strings are parsed as UTC midnight, which is the wall clock\n if (DATE_ONLY.test(value)) return Date.parse(value);\n const date = new Date(value);\n return date.getTime() - date.getTimezoneOffset() * 60000;\n};\n\ntype FormDateTimeResult<MODE extends FormDateTimeMode> =\n MODE extends typeof FormDateTimeMode.DATE\n ? Date\n : MODE extends typeof FormDateTimeMode.STRING\n ? string\n : number;\n\nexport class FormDateTime<\n MODE extends FormDateTimeMode,\n ID extends string | undefined,\n> extends FormValueWrite<FormDateTimeResult<MODE>, ID> {\n static element_name() {\n return \"datetimeinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #type: FormDateTimeType = FormDateTimeType.DATETIME;\n #mode: MODE;\n #milliseconds: boolean = false;\n\n constructor(mode: MODE, id?: ID) {\n super(id);\n this.#mode = mode;\n this.warn_input.onfocus = () => {\n this.selected = true;\n };\n this.warn_input.onblur = () => {\n this.selected = false;\n //Shows a state change that arrived while focused\n if (this._buffer !== undefined) this.new_value(this._buffer);\n };\n\n this.warn_input.type = \"datetime-local\";\n this.warn_input.lang = \"da-DK\";\n this.warn_input.step = \"1\";\n this.appendChild(this.warn_input);\n this.appendChild(material_calendar_month_rounded()).onclick = () =>\n this.warn_input.showPicker();\n this.appendChild(material_schedule_rounded()).onclick = () =>\n this.warn_input.showPicker();\n this.warn_input.onchange = () => {\n if (this.warn_input.value) {\n if (this.#mode === FormDateTimeMode.DATE) {\n //The input gives the local wall clock as UTC, the offset of the entered date is used\n const wall = new Date(this.warn_input.valueAsNumber);\n const date = new Date(0);\n date.setFullYear(\n wall.getUTCFullYear(),\n wall.getUTCMonth(),\n wall.getUTCDate(),\n );\n date.setHours(\n wall.getUTCHours(),\n wall.getUTCMinutes(),\n wall.getUTCSeconds(),\n wall.getUTCMilliseconds(),\n );\n this.set_value_check(date as FormDateTimeResult<MODE>);\n } else if (this.#mode === FormDateTimeMode.STRING)\n this.set_value_check(\n this.warn_input.value as FormDateTimeResult<MODE>,\n );\n else\n this.set_value_check(\n this.warn_input.valueAsNumber as FormDateTimeResult<MODE>,\n );\n }\n };\n }\n\n /**Returns the date time type*/\n get type() {\n return this.#type;\n }\n\n /**Sets the date time type*/\n set type(type: FormDateTimeType) {\n if (type === FormDateTimeType.DATE) this.warn_input.type = \"date\";\n if (type === FormDateTimeType.TIME) this.warn_input.type = \"time\";\n if (type === FormDateTimeType.DATETIME)\n this.warn_input.type = \"datetime-local\";\n this.#type = type;\n }\n\n /**Returns true if the input is set to show milliseconds*/\n get milliseconds() {\n return this.#milliseconds;\n }\n\n /**Sets the input to show milliseconds*/\n set milliseconds(value: boolean) {\n this.#milliseconds = value;\n if (value) this.warn_input.step = \"0.001\";\n else this.warn_input.step = \"1\";\n }\n\n /**Returns the date time type*/\n get step() {\n return Number(this.warn_input.step);\n }\n /**Sets the date time type*/\n set step(step: number) {\n this.warn_input.step = String(step);\n }\n\n protected new_value(value: FormDateTimeResult<MODE>): void {\n let time: number;\n if (typeof value === \"number\") time = value;\n else if (typeof value === \"string\") {\n if (INPUT_FORMAT[this.#type].test(value)) {\n this.warn_input.value = value;\n return;\n }\n time = string_wall_time(value);\n } else time = value.getTime() - value.getTimezoneOffset() * 60000;\n this.warn_input.valueAsNumber = this.#milliseconds\n ? time\n : time - (time % 1000);\n }\n protected clear_value(): void {\n this.warn_input.value = \"\";\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormDateTime);\n\n/**Creates a date time input form element\n * Number type is always UTC, Date and String is always local*/\nexport function form_date_time<\n MODE extends FormDateTimeMode,\n ID extends string | undefined,\n>(options: FormDateTimeOptions<MODE, ID>): FormDateTime<MODE, ID> {\n const input = new FormDateTime<MODE, ID>(options.mode, options.id);\n if (options.type) input.type = options.type;\n if (options.milliseconds !== undefined)\n input.milliseconds = options.milliseconds;\n FormValueWrite.apply_options(input, options);\n return input;\n}\n","import { define_element } from \"#base\";\nimport { IPAddress, IPVersion, sleep } from \"@chocbite/ts-lib/common\";\nimport { get_cursor_position, set_cursor_end, set_selection_all } from \"#selection\";\nimport { err, ok, type Option, type Result } from \"@chocbite/ts-lib/result\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./ip_input.scss\";\n\nexport interface FormIpOptions<\n ID extends string | undefined,\n> extends FormValueWriteOptions<IPAddress, ID> {\n /**Ip address type, this is overwritten if supplied with an ipaddress with a different type*/\n type: IPVersion;\n}\n\nexport class FormIp<ID extends string | undefined> extends FormValueWrite<\n IPAddress,\n ID\n> {\n static element_name() {\n return \"ipinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #type: IPVersion;\n /**Amount of parts of the current type*/\n get #count() {\n return this.#type === IPVersion.V4 ? 4 : 8;\n }\n #parts: HTMLDivElement[] = Array.from({ length: 8 }, (_, i) => {\n const inp = this.appendChild(document.createElement(\"div\"));\n if (i < 7) this.appendChild(document.createElement(\"span\"));\n inp.contentEditable = \"true\";\n inp.onbeforeinput = async (ev) => {\n if (ev.inputType === \"insertParagraph\") ev.preventDefault();\n //Backspace\n else if (ev.inputType === \"deleteContentBackward\") {\n if (inp.textContent.length === 0 && i > 0) {\n set_cursor_end(this.#parts[i - 1]);\n }\n // Delete\n } else if (ev.inputType === \"deleteContentForward\") {\n if (inp.textContent.length === 0 && i < this.#count - 1) {\n await sleep(0);\n this.#parts[i + 1].focus();\n }\n } else if (ev.data) {\n //Check for . or :\n if (\n (ev.data === \".\" || ev.data === \":\" || ev.data === \",\") &&\n i < this.#count - 1\n ) {\n set_selection_all(this.#parts[i + 1]);\n ev.preventDefault();\n }\n //Check for valid characters\n else if (\n !ev.data.match(\n this.#type === IPVersion.V4 ? /^[\\d]*$/ : /^[\\dA-Fa-f]*$/,\n )\n )\n ev.preventDefault();\n else {\n //The text the part would have, typed text replaces the selection\n const [start, end] = this.#selection_in(inp);\n const potential =\n inp.textContent.slice(0, start) +\n ev.data +\n inp.textContent.slice(end);\n //Prevent too long values\n if (potential.length > (this.#type === IPVersion.V4 ? 3 : 4)) {\n ev.preventDefault();\n return;\n }\n //Prevent too big values\n const num =\n this.#type === IPVersion.V4\n ? parseInt(potential, 10)\n : parseInt(potential, 16);\n if (\n (this.#type === IPVersion.V4 && num > 255) ||\n (this.#type === IPVersion.V6 && num > 65535)\n ) {\n if (i < this.#count - 1) set_selection_all(this.#parts[i + 1]);\n else ev.preventDefault();\n }\n }\n }\n };\n inp.oninput = () => {\n if (\n inp.textContent.length === (this.#type === IPVersion.V4 ? 3 : 4) &&\n get_cursor_position(inp) === inp.textContent.length &&\n i < this.#count - 1\n ) {\n set_selection_all(this.#parts[i + 1]);\n }\n };\n inp.onkeydown = async (e) => {\n if (e.key === \"ArrowUp\") {\n } else if (e.key === \"ArrowDown\") {\n } else if (e.key === \"ArrowLeft\" && i > 0) {\n if (get_cursor_position(inp) === 0 || inp.textContent.length === 0)\n set_cursor_end(this.#parts[i - 1]);\n else return;\n } else if (e.key === \"ArrowRight\" && i < this.#count - 1) {\n if (\n get_cursor_position(inp) === inp.textContent.length ||\n inp.textContent.length === 0\n )\n this.#parts[i + 1].focus();\n else return;\n } else return;\n e.preventDefault();\n e.stopPropagation();\n };\n return inp;\n });\n\n constructor(type: IPVersion, id?: ID) {\n super(id);\n this.type = type;\n this.#type = type;\n this.appendChild(this.warn_input);\n this.addEventListener(\"focusin\", () => {\n this.selected = true;\n });\n this.addEventListener(\"focusout\", () => {\n this.selected = false;\n });\n\n this.onpointerdown = (e) => {\n if (!this.#parts.includes(e.target as HTMLDivElement)) {\n e.preventDefault();\n set_cursor_end(this.#parts[this.#type === IPVersion.V4 ? 3 : 7]);\n }\n };\n this.ondblclick = (e) => {\n if (e.target !== this) return;\n e.preventDefault();\n set_selection_all(this.#parts[0]);\n };\n this.addEventListener(\"focusin\", (e) => {\n e.preventDefault();\n });\n this.addEventListener(\"focusout\", (e) => {\n if (e.relatedTarget && this.contains(e.relatedTarget as Node)) return;\n this.#commit_typed();\n });\n this.onkeydown = (e) => {\n if (e.key === \"Enter\") this.#commit_typed();\n else if (e.key === \"Escape\") {\n if (this.buffer) this.new_value(this.buffer);\n else this.clear_value();\n }\n };\n this.oncopy = (e) => {\n e.preventDefault();\n const typed = this.#typed();\n if (typed.ok)\n e.clipboardData?.setData(\"text/plain\", typed.value.to_string());\n };\n this.onpaste = (e) => {\n e.preventDefault();\n const paste = e.clipboardData?.getData(\"text/plain\") || \"\";\n let new_ip: IPAddress;\n try {\n new_ip = new IPAddress(paste);\n } catch (error) {\n return this.warn(error instanceof Error ? error.message : String(error));\n }\n if (new_ip.version !== this.#type) return;\n this.#commit(new_ip);\n };\n }\n\n /**Start and end of the selection in a part, both the cursor position when nothing is selected*/\n #selection_in(part: HTMLElement): [number, number] {\n const selection = part.ownerDocument.getSelection();\n if (selection?.rangeCount && part.contains(selection.anchorNode)) {\n const range = selection.getRangeAt(0);\n const before = range.cloneRange();\n before.selectNodeContents(part);\n before.setEnd(range.startContainer, range.startOffset);\n const start = before.toString().length;\n return [start, start + range.toString().length];\n }\n const position = get_cursor_position(part);\n return [position, position];\n }\n\n /**The typed address, or why the typed parts are not an address*/\n #typed(): Result<IPAddress, string> {\n if (this.#parts.slice(0, this.#count).some((part) => !part.textContent))\n return err(\"All parts of the address must be filled in\");\n try {\n return ok(this.value_as_ip);\n } catch (error) {\n return err(error instanceof Error ? error.message : String(error));\n }\n }\n\n /**Commits the typed address, or warns why it is not an address*/\n #commit_typed() {\n const typed = this.#typed();\n if (typed.ok) this.#commit(typed.value);\n else this.warn(typed.error);\n }\n\n /**Commits an address, unless it is the current address, a new IPAddress object is never the same object as the current one*/\n #commit(ip: IPAddress) {\n if (this.buffer?.equals(ip)) return;\n this.set_value_check(ip);\n }\n\n focus(options?: FocusOptions): void {\n this.#parts[0].focus(options);\n }\n\n get value_as_ip(): IPAddress {\n return new IPAddress(\n this.#parts\n .slice(0, this.#type === IPVersion.V4 ? 4 : 8)\n .reduce((acc, part, i) => {\n acc += part.innerText;\n if (i < (this.#type === IPVersion.V4 ? 4 : 8) - 1)\n acc += this.#type === IPVersion.V4 ? \".\" : \":\";\n return acc;\n }, \"\"),\n );\n }\n\n set type(val: IPVersion) {\n if (this.#type === val) return;\n this.#type = val;\n this.classList.toggle(\"ipv4\", val === IPVersion.V4);\n this.classList.toggle(\"ipv6\", val === IPVersion.V6);\n this.replaceChildren(\n ...this.#parts\n .slice(0, this.#count)\n .flatMap((v, i) =>\n i < this.#count - 1\n ? [v, document.createTextNode(val === IPVersion.V4 ? \".\" : \":\")]\n : [v],\n ),\n //Kept, warnings are shown through it\n this.warn_input,\n );\n }\n\n protected new_value(val: IPAddress): void {\n this.type = val.version;\n val.as_array.forEach((part, i) => {\n this.#parts[i].textContent =\n val.version === IPVersion.V4 ? part.toString() : part.toString(16);\n });\n }\n\n protected clear_value(): void {\n this.#parts.forEach((part) => {\n part.textContent = \"\";\n });\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormIp);\n\n/**Creates an IP input form element */\nexport function form_ip<ID extends string | undefined>(\n options: FormIpOptions<ID>,\n): FormIp<ID> {\n const input = new FormIp<ID>(options.type, options?.id);\n if (options) {\n FormValueWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./password_input.scss\";\n\nexport interface FormPasswordOptions<\n ID extends string | undefined,\n> extends FormValueWriteOptions<string, ID> {\n /**Allowed characters for the password input */\n filter?: RegExp;\n}\n\nexport class FormPassword<ID extends string | undefined> extends FormValueWrite<\n string,\n ID\n> {\n static element_name() {\n return \"passwordinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #filter?: RegExp;\n\n constructor(id?: ID) {\n super(id);\n this.appendChild(this.warn_input);\n this.warn_input.type = \"password\";\n this.warn_input.onfocus = () => {\n this.warn_input.value = \"\";\n this.selected = true;\n };\n this.warn_input.onblur = () => {\n this.selected = false;\n //Restores the password when nothing new was entered, or shows a state change made while focused\n if (this._buffer !== undefined && this.warn_input.value !== this._buffer)\n this.new_value(this._buffer);\n };\n this.warn_input.onchange = () => {\n this.set_value_check(this.warn_input.value);\n };\n this.warn_input.onbeforeinput = (ev) => {\n if (ev.data && this.#filter) {\n this.#filter.lastIndex = 0;\n if (!this.#filter.test(ev.data)) {\n ev.preventDefault();\n this.warn(\"Invalid character entered\");\n }\n }\n };\n }\n\n set filter(val: RegExp | undefined) {\n this.#filter = val;\n }\n\n protected new_value(val: string): void {\n this.warn_input.value = val;\n }\n\n protected clear_value(): void {\n this.warn_input.value = \"\";\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormPassword);\n\n/**Creates a password input form element */\nexport function form_password<ID extends string | undefined>(\n options?: FormPasswordOptions<ID>,\n): FormPassword<ID> {\n const input = new FormPassword<ID>(options?.id);\n if (options) {\n if (options.filter) input.filter = options.filter;\n FormValueWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport { sync_resolve } from \"@chocbite/ts-lib/common\";\nimport { set_cursor_end } from \"#selection\";\nimport { err, none, type Result } from \"@chocbite/ts-lib/result\";\nimport type { StateStringRelated } from \"@chocbite/ts-lib/state\";\nimport { string_byte_length, string_byte_limit } from \"@chocbite/ts-lib/string\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./text_input.scss\";\n\nexport interface FormTextInputOptions<\n ID extends string | undefined,\n RT = string,\n> extends FormValueWriteOptions<RT, ID> {\n /**Placeholder text when input is empty */\n placeholder?: string;\n /**Maximum length of the input */\n max_length?: number;\n /**Maximum bytes of the input */\n max_bytes?: number;\n /**Allowed characters for the text input */\n filter?: RegExp;\n}\n\nexport class FormTextInput<\n ID extends string | undefined,\n> extends FormValueWrite<string, ID> {\n static element_name() {\n return \"textinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #filter?: RegExp;\n #max_length?: number;\n #max_bytes?: number;\n //True while the limit comes from the bound state\n #related_length = false;\n #related_bytes = false;\n\n constructor(id?: ID) {\n super(id);\n this.warn_input.onfocus = () => {\n this.selected = true;\n };\n this.warn_input.onblur = () => {\n this.selected = false;\n //Shows a state change that arrived while focused\n if (this._buffer !== undefined && this.warn_input.value !== this._buffer)\n this.new_value(this._buffer);\n };\n this.warn_input.type = \"text\";\n this.appendChild(this.warn_input);\n this.warn_input.onchange = () => this.#set();\n this.onbeforeinput = (e) => {\n this.warn(\"\");\n const data = e.data || e.dataTransfer?.getData(\"text/plain\");\n if (data) {\n if (this.#filter) this.#filter.lastIndex = 0;\n if (this.#filter && !this.#filter.test(data)) {\n e.preventDefault();\n this.warn(\"Invalid character entered\");\n } else if (this.#max_length || this.#max_bytes) {\n //The selected text is replaced by the typed text\n const input = this.warn_input;\n const value = input.value;\n const start = input.selectionStart ?? value.length;\n const end = input.selectionEnd ?? start;\n if (\n this.#max_length &&\n value.length - (end - start) + data.length > this.#max_length\n ) {\n e.preventDefault();\n this.warn(`A maximum of ${this.#max_length} characters is allowed`);\n }\n if (\n this.#max_bytes &&\n string_byte_length(value) -\n string_byte_length(value.slice(start, end)) +\n string_byte_length(data) >\n this.#max_bytes\n ) {\n e.preventDefault();\n this.warn(`A maximum of ${this.#max_bytes} bytes is allowed`);\n }\n }\n }\n };\n this.onkeydown = (e) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n if (this.buffer) this.new_value(this.buffer);\n else this.clear_value();\n }\n };\n }\n\n async #set() {\n const buff = this.buffer;\n (await this.set_value_check(this.warn_input.value || \"\")).map_err(() => {\n this.new_value(buff || \"\");\n set_cursor_end(this.warn_input);\n });\n }\n\n set filter(val: RegExp | undefined) {\n this.#filter = val;\n }\n get filter(): RegExp | undefined {\n return this.#filter;\n }\n\n set placeholder(val: string) {\n this.warn_input.placeholder = val;\n }\n get placeholder(): string {\n return this.warn_input.placeholder;\n }\n\n set max_length(val: number | undefined) {\n this.#max_length = val;\n if (val === undefined) this.warn_input.removeAttribute(\"maxlength\");\n else this.warn_input.maxLength = val;\n }\n get max_length(): number | undefined {\n return this.#max_length;\n }\n\n set max_bytes(val: number | undefined) {\n this.#max_bytes = val;\n }\n get max_bytes(): number | undefined {\n return this.#max_bytes;\n }\n\n protected new_value(val: string): void {\n this.warn_input.value = val;\n }\n\n protected clear_value(): void {\n this.warn_input.value = \"\";\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected limit_value(val: string): PromiseLike<Result<string, string>> {\n if (this.#max_length && val.length > this.#max_length)\n val = val.slice(0, this.#max_length);\n if (this.#max_bytes) val = string_byte_limit(val, this.#max_bytes);\n return super.limit_value(val);\n }\n\n protected check_value(val: string): PromiseLike<Result<string, string>> {\n if (this.#max_length && val.length > this.#max_length)\n return sync_resolve(\n err(`A maximum of ${this.#max_length} characters is allowed`),\n );\n if (this.#max_bytes && string_byte_length(val) > this.#max_bytes)\n return sync_resolve(\n err(`A maximum of ${this.#max_bytes} bytes is allowed`),\n );\n return super.check_value(val);\n }\n\n protected state_related(related: Partial<StateStringRelated>): void {\n if (related.max_length)\n this.attach_state_to_prop(\"max_length\", related.max_length, () => none());\n else if (this.#related_length)\n this.detach_state_from_prop(\"max_length\").max_length = undefined;\n this.#related_length = !!related.max_length;\n if (related.max_length_bytes)\n this.attach_state_to_prop(\"max_bytes\", related.max_length_bytes, () =>\n none(),\n );\n else if (this.#related_bytes)\n this.detach_state_from_prop(\"max_bytes\").max_bytes = undefined;\n this.#related_bytes = !!related.max_length_bytes;\n }\n}\ndefine_element(FormTextInput);\n\n/**Creates a single line text input form element */\nexport function form_text_input<ID extends string | undefined>(\n options?: FormTextInputOptions<ID>,\n): FormTextInput<ID> {\n const input = new FormTextInput<ID>(options?.id);\n if (options) {\n if (options.filter) input.filter = options.filter;\n if (options.placeholder) input.placeholder = options.placeholder;\n if (options.max_length) input.max_length = options.max_length;\n if (options.max_bytes) input.max_bytes = options.max_bytes;\n FormValueWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport { sync_resolve } from \"@chocbite/ts-lib/common\";\nimport { set_cursor_end } from \"#selection\";\nimport { material_drag_handle_rounded } from \"#icons\";\nimport { err, none, type Result } from \"@chocbite/ts-lib/result\";\nimport type { StateStringRelated } from \"@chocbite/ts-lib/state\";\nimport { string_byte_length, string_byte_limit } from \"@chocbite/ts-lib/string\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./text_multi_line.scss\";\n\nexport interface FormTextMultilineOptions<\n ID extends string | undefined,\n RT = string,\n> extends FormValueWriteOptions<RT, ID> {\n /**Placeholder text when input is empty */\n placeholder?: string;\n /**Maximum length of the input */\n max_length?: number;\n /**Maximum bytes of the input */\n max_bytes?: number;\n /**Allowed characters for the text input */\n filter?: RegExp;\n}\n\nexport class FormTextMultiline<\n ID extends string | undefined,\n> extends FormValueWrite<string, ID> {\n static element_name() {\n return \"textmultiline\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #filter?: RegExp;\n #max_length?: number;\n #max_bytes?: number;\n //True while the limit comes from the bound state\n #related_length = false;\n #related_bytes = false;\n #value_box: HTMLTextAreaElement = this.appendChild(\n document.createElement(\"textarea\"),\n );\n #resizer: HTMLDivElement = this.appendChild(document.createElement(\"div\"));\n\n constructor(id?: ID) {\n super(id);\n this.#value_box.onfocus = () => {\n this.selected = true;\n };\n this.#value_box.onblur = () => {\n this.selected = false;\n //Shows a state change that arrived while focused\n if (this._buffer !== undefined && this.#value_box.value !== this._buffer)\n this.new_value(this._buffer);\n };\n this.appendChild(this.warn_input);\n this.#resizer.appendChild(material_drag_handle_rounded());\n this.#resizer.onpointerdown = (e) => {\n e.preventDefault();\n const height = this.#value_box.getBoundingClientRect().height;\n const start_y = e.clientY;\n this.#resizer.setPointerCapture(e.pointerId);\n this.#resizer.onpointermove = (ev) => {\n const dy = ev.clientY - start_y;\n this.#value_box.style.height = `${height + dy}px`;\n };\n this.#resizer.onpointerup = (_ev) => {\n this.#resizer.releasePointerCapture(e.pointerId);\n this.#resizer.onpointermove = null;\n this.#resizer.onpointerup = null;\n };\n };\n this.#value_box.onchange = () => this.#set();\n this.#value_box.onbeforeinput = (e) => {\n this.warn(\"\");\n const data = e.data || e.dataTransfer?.getData(\"text/plain\");\n if (data) {\n if (this.#filter) this.#filter.lastIndex = 0;\n if (this.#filter && !this.#filter.test(data)) {\n e.preventDefault();\n this.warn(\"Invalid character entered\");\n } else if (this.#max_length || this.#max_bytes) {\n //The selected text is replaced by the typed text\n const box = this.#value_box;\n const value = box.value;\n const start = box.selectionStart;\n const end = box.selectionEnd;\n if (\n this.#max_length &&\n value.length - (end - start) + data.length > this.#max_length\n ) {\n e.preventDefault();\n this.warn(`A maximum of ${this.#max_length} characters is allowed`);\n }\n if (\n this.#max_bytes &&\n string_byte_length(value) -\n string_byte_length(value.slice(start, end)) +\n string_byte_length(data) >\n this.#max_bytes\n ) {\n e.preventDefault();\n this.warn(`A maximum of ${this.#max_bytes} bytes is allowed`);\n }\n }\n }\n };\n this.#value_box.onkeydown = (e) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n if (this.buffer) this.new_value(this.buffer);\n else this.clear_value();\n } else if (e.key === \"Enter\") {\n //Enter is a new line, it must not reach parent elements\n if (!e.shiftKey) e.stopPropagation();\n if (e.ctrlKey) {\n e.preventDefault();\n this.#set();\n }\n }\n };\n }\n\n focus(options?: FocusOptions): void {\n this.#value_box.focus(options);\n }\n\n async #set() {\n const buff = this.buffer;\n (await this.set_value_check(this.#value_box.value || \"\")).map_err(() => {\n this.new_value(buff || \"\");\n set_cursor_end(this.#value_box);\n });\n }\n\n set filter(val: RegExp | undefined) {\n this.#filter = val;\n }\n get filter(): RegExp | undefined {\n return this.#filter;\n }\n\n set placeholder(val: string) {\n this.#value_box.placeholder = val;\n }\n get placeholder(): string {\n return this.#value_box.placeholder;\n }\n\n set max_length(val: number | undefined) {\n this.#max_length = val;\n if (val === undefined) this.#value_box.removeAttribute(\"maxlength\");\n else this.#value_box.maxLength = val;\n }\n get max_length(): number | undefined {\n return this.#max_length;\n }\n\n set max_bytes(val: number | undefined) {\n this.#max_bytes = val;\n }\n get max_bytes(): number | undefined {\n return this.#max_bytes;\n }\n\n protected new_value(val: string): void {\n this.#value_box.value = val;\n }\n\n protected clear_value(): void {\n this.#value_box.value = \"\";\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected limit_value(val: string): PromiseLike<Result<string, string>> {\n if (this.#max_length && val.length > this.#max_length)\n val = val.slice(0, this.#max_length);\n if (this.#max_bytes) val = string_byte_limit(val, this.#max_bytes);\n return super.limit_value(val);\n }\n\n protected check_value(val: string): PromiseLike<Result<string, string>> {\n if (this.#max_length && val.length > this.#max_length)\n return sync_resolve(\n err(`A maximum of ${this.#max_length} characters is allowed`),\n );\n if (this.#max_bytes && string_byte_length(val) > this.#max_bytes)\n return sync_resolve(\n err(`A maximum of ${this.#max_bytes} bytes is allowed`),\n );\n return super.check_value(val);\n }\n\n protected state_related(related: Partial<StateStringRelated>): void {\n if (related.max_length)\n this.attach_state_to_prop(\"max_length\", related.max_length, () => none());\n else if (this.#related_length)\n this.detach_state_from_prop(\"max_length\").max_length = undefined;\n this.#related_length = !!related.max_length;\n if (related.max_length_bytes)\n this.attach_state_to_prop(\"max_bytes\", related.max_length_bytes, () =>\n none(),\n );\n else if (this.#related_bytes)\n this.detach_state_from_prop(\"max_bytes\").max_bytes = undefined;\n this.#related_bytes = !!related.max_length_bytes;\n }\n}\ndefine_element(FormTextMultiline);\n\n/**Creates a multi line text input form element */\nexport function form_text_multiline<ID extends string | undefined>(\n options?: FormTextMultilineOptions<ID>,\n): FormTextMultiline<ID> {\n const input = new FormTextMultiline<ID>(options?.id);\n if (options) {\n if (options.filter) input.filter = options.filter;\n if (options.placeholder) input.placeholder = options.placeholder;\n if (options.max_length) input.max_length = options.max_length;\n if (options.max_bytes) input.max_bytes = options.max_bytes;\n FormValueWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport { FormElement } from \"../../base\";\nimport \"./text.scss\";\n\nexport interface FormTextOptions {\n /**Buttons text */\n text?: string;\n /**Text size */\n size?: number;\n}\n\n/**Component for simple text */\nexport class FormText extends FormElement {\n static element_name() {\n return \"text\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n constructor(options: FormTextOptions) {\n super();\n if (options.text) this.text = options.text;\n if (options.size) this.size = options.size;\n }\n\n /**Sets the current text of the element*/\n set text(text: string) {\n this.textContent = text;\n }\n get text() {\n return this.textContent;\n }\n\n /**Sets the current text of the element*/\n set size(size: number) {\n this.style.fontSize = size + \"rem\";\n this.style.lineHeight = size + \"rem\";\n }\n}\ndefine_element(FormText);\n\n/**Creates a button form element */\nexport function form_text(options: FormTextOptions): FormText {\n return new FormText(options);\n}\n","import {\n FormColors,\n FormOptions,\n FormValueOptions,\n FormValueWriteOptions,\n} from \"./base\";\nimport {\n form_button,\n FormButton,\n type FormButtonOptions,\n} from \"./boolean/button/button\";\nimport { form_lamp, FormLamp, type FormLampOptions } from \"./boolean/lamp/lamp\";\nimport {\n form_switch,\n FormSwitch,\n type FormSwitchOptions,\n} from \"./boolean/switch/switch\";\nimport { form_group, FormGroup, type FormGroupOptions } from \"./group/group\";\nimport {\n form_group_collapser,\n FormGroupCollapser,\n type FormGroupCollapserOptions,\n} from \"./group/group_collapser\";\nimport { form_list_field, ListFormField } from \"./list/list_field\";\nimport {\n type FormNumberOptions,\n type FormNumberWriteOptions,\n} from \"./number/number_base\";\nimport {\n form_number_input,\n FormNumberInput,\n} from \"./number/number_input/number_input\";\nimport { form_progress, FormProgress } from \"./number/progress/progress\";\nimport { form_slider, FormSlider } from \"./number/slider/slider\";\nimport { form_stepper, FormStepper } from \"./number/stepper/stepper\";\nimport {\n form_dropdown,\n FormDropdown,\n type FormDropDownOptions,\n type FormDropDownSelection,\n} from \"./selectors/drop_down/drop_down\";\nimport { type FormSelections } from \"./selectors/selector_base\";\nimport {\n form_toggle_button,\n FormToggleButton,\n type FormToggleButtonSelection,\n} from \"./selectors/toggle_button/toggle_button\";\nimport {\n form_spacer,\n FormSpacer,\n type FormSpacerOptions,\n} from \"./spacing/spacer\";\nimport {\n form_color,\n FormColor,\n type FormColorOptions,\n} from \"./special/color/color_input\";\nimport {\n form_date_time,\n FormDateTime,\n FormDateTimeMode,\n FormDateTimeType,\n type FormDateTimeOptions,\n} from \"./special/date_time/date_time_input\";\nimport { form_ip, FormIp, type FormIpOptions } from \"./special/ip/ip_input\";\nimport {\n form_password,\n FormPassword,\n type FormPasswordOptions,\n} from \"./special/password/password_input\";\nimport {\n form_text_input,\n FormTextInput,\n type FormTextInputOptions,\n} from \"./text/input/text_input\";\nimport {\n form_text_multiline,\n FormTextMultiline,\n type FormTextMultilineOptions,\n} from \"./text/multi_line/text_multi_line\";\nimport { form_text, FormText, type FormTextOptions } from \"./text/text/text\";\n\n/**Form elements with label */\nexport const form = {\n FormColors,\n\n //Boolean\n button: form_button,\n switch: form_switch,\n lamp: form_lamp,\n\n //Group\n group: form_group,\n group_collapser: form_group_collapser,\n\n //Special\n color: form_color,\n date_time: form_date_time,\n FormDateTimeMode,\n FormDateTimeType,\n ip: form_ip,\n password: form_password,\n\n //Number\n progress: form_progress,\n number_input: form_number_input,\n slider: form_slider,\n stepper: form_stepper,\n\n //Selectors\n dropdown: form_dropdown,\n toggle_button: form_toggle_button,\n\n //Spacing\n spacer: form_spacer,\n\n //Text\n text: form_text,\n text_input: form_text_input,\n text_multiline: form_text_multiline,\n\n //List\n list_field: form_list_field,\n};\nexport default form;\n\nexport type {\n FormButton,\n FormButtonOptions,\n FormColor,\n FormColorOptions,\n FormDateTime,\n FormDateTimeOptions,\n FormDropdown,\n FormDropDownOptions,\n FormDropDownSelection,\n FormGroup,\n FormGroupCollapser,\n FormGroupCollapserOptions,\n FormGroupOptions,\n FormIp,\n FormIpOptions,\n FormLamp,\n FormLampOptions,\n FormNumberInput,\n FormNumberOptions,\n FormNumberWriteOptions,\n FormOptions,\n FormPassword,\n FormPasswordOptions,\n FormProgress,\n FormSelections,\n FormSlider,\n FormSpacer,\n FormSpacerOptions,\n FormStepper,\n FormSwitch,\n FormSwitchOptions,\n FormText,\n FormTextInput,\n FormTextInputOptions,\n FormTextMultiline,\n FormTextMultilineOptions,\n FormTextOptions,\n FormToggleButton,\n FormToggleButtonSelection,\n FormValueOptions,\n FormValueWriteOptions,\n ListFormField,\n};\n\nexport { FormColors, FormElement, FormValue, FormValueWrite } from \"./base\";\nexport {\n FormDateTimeMode,\n FormDateTimeType,\n} from \"./special/date_time/date_time_input\";\n"],"mappings":";;;;;;;;;;;;;;;AAUA,MAAM,aAAa,yBACjB,QACA,oBACA,sCACF;AAQkB,WAAW,eAC3B,QACA,aACA,8CAEM,CAAC,CAAC,cACR,UACA,oBACA,qDACA,gBACA,gBACA,UACA,KAAA,CACF;AAUA,MAAM,SAAS,WAAW,eACxB,UACA,UACA,kCACF;AAQA,MAAM,cAAc,OAAO,eACzB,QACA,eACA,uCACF;AACA,YAAY,cACV,SACA,eACA,iCACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,YAAY,cACV,UACA,qBACA,sCACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,YAAY,cACV,YACA,uBACA,wCACA,KAAK,QACL,KAAK,OACL,SACA,KAAA,CACF;AACA,YAAY,cACV,cACA,yBACA,0CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AAUA,MAAM,oBAAoB,OAAO,eAC/B,aACA,gCACA,4DACF;AACA,kBAAkB,cAChB,UACA,qBACA,sCACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,kBAAkB,cAChB,YACA,uBACA,wCACA,KAAK,OACL,KAAK,OACL,SACA,KAAA,CACF;AACA,kBAAkB,cAChB,cACA,yBACA,0CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AAQA,MAAM,cAAc,OAAO,eACzB,QACA,eACA,uCACF;AACA,YAAY,cACV,UACA,qBACA,mCACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,YAAY,cACV,YACA,uBACA,4CACA,KAAK,QACL,KAAK,OACL,SACA,KAAA,CACF;AACA,YAAY,cACV,cACA,yBACA,8CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AAQA,MAAM,oBAAoB,OAAO,eAC/B,cACA,qBACA,6CACF;AACA,kBAAkB,cAChB,UACA,2BACA,4CACA,KAAK,OACL,KAAK,QACL,SACA,KAAA,CACF;AACA,kBAAkB,cAChB,SACA,0BACA,mDACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,kBAAkB,cAChB,cACA,+BACA,gDACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AAQA,MAAM,gBAAgB,OAAO,eAC3B,UACA,iBACA,yCACF;AACA,cAAc,cACZ,UACA,uBACA,wCACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,cAAc,cACZ,cACA,2BACA,4CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AAQqB,OAAO,eAC1B,SACA,gBACA,wCAES,CAAC,CAAC,cACX,UACA,eACA,kCACA,OAAO,QACP,OAAO,QACP,SACA,KAAA,CACF;AAQA,MAAM,eAAe,OAAO,eAC1B,SACA,gBACA,wCACF;AACA,aAAa,cACX,SACA,qBACA,8CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,aAAa,cACX,SACA,qBACA,8CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,aAAa,cACX,SACA,qBACA,8CACA,MAAM,QACN,MAAM,QACN,SACA,KAAA,CACF;AACA,aAAa,cACX,OACA,mBACA,4CACA,IAAI,QACJ,IAAI,QACJ,SACA,KAAA,CACF;AACA,aAAa,cACX,QACA,oBACA,6CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,aAAa,cACX,UACA,sBACA,+CACA,OAAO,QACP,OAAO,QACP,SACA,KAAA,CACF;AAUA,MAAM,QAAQ,WAAW,eACvB,QACA,QACA,iCACF;AAEA,MAAM,cACJ,UACA,UACA,4CACA,UACA,UACA,UACA;CAAE,KAAK;CAAK,KAAK;AAAG,CACtB;AAEA,MAAM,cACJ,eACA,gBACA,8DACA,UACA,UACA,UACA;CAAE,KAAK;CAAK,KAAK;AAAG,CACtB;AAUA,MAAM,OAAO,WAAW,eACtB,QACA,QACA,yCACF;AAEA,KAAK,cACH,QACA,aACA,+CACA,UACA,UACA,UACA;CAAE,KAAK;CAAK,KAAK;AAAG,CACtB;AAEA,KAAK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EACrD,IAAI,QAAQ,YAAY,MAAM,aAAa,QAAQ;EACnD,IAAI,QAAQ,WAAW,MAAM,YAAY,QAAQ;EACjD,eAAe,cAAc,OAAO,OAAO;CAC7C;CACA,OAAO;AACT;;;ACxNA,IAAa,WAAb,cAA8B,YAAY;CACxC,OAAO,eAAe;EACpB,OAAO;CACT;CACA,OAAO,qBAA6B;EAClC,OAAO;CACT;CAEA,YAAY,SAA0B;EACpC,MAAM;EACN,IAAI,QAAQ,MAAM,KAAK,OAAO,QAAQ;EACtC,IAAI,QAAQ,MAAM,KAAK,OAAO,QAAQ;CACxC;;CAGA,IAAI,KAAK,MAAc;EACrB,KAAK,cAAc;CACrB;CACA,IAAI,OAAO;EACT,OAAO,KAAK;CACd;;CAGA,IAAI,KAAK,MAAc;EACrB,KAAK,MAAM,WAAW,OAAO;EAC7B,KAAK,MAAM,aAAa,OAAO;CACjC;AACF;AACA,eAAe,QAAQ;;AAGvB,SAAgB,UAAU,SAAoC;CAC5D,OAAO,IAAI,SAAS,OAAO;AAC7B;;;ACsCA,MAAa,OAAO;CAClB;CAGA,QAAQ;CACR,QAAQ;CACR,MAAM;CAGN,OAAO;CACP,iBAAiB;CAGjB,OAAO;CACP,WAAW;CACX;CACA;CACA,IAAI;CACJ,UAAU;CAGV,UAAU;CACV,cAAc;CACd,QAAQ;CACR,SAAS;CAGT,UAAU;CACV,eAAe;CAGf,QAAQ;CAGR,MAAM;CACN,YAAY;CACZ,gBAAgB;CAGhB,YAAY;AACd"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../package-ui/form/shared.ts","../../../package-ui/form/base.ts","../../../package-ui/form/boolean/button/button.ts","../../../package-ui/form/boolean/lamp/lamp.ts","../../../package-ui/form/boolean/switch/switch.ts","../../../package-ui/form/group/group_base.ts","../../../package-ui/form/group/group.ts","../../../package-ui/form/group/group_collapser.ts","../../../package-ui/form/list/list_field.ts","../../../package-ui/form/number/number_base.ts","../../../package-ui/form/number/number_input/number_input.ts","../../../package-ui/form/number/progress/progress.ts","../../../package-ui/form/number/slider/slider.ts","../../../package-ui/form/number/stepper/stepper.ts","../../../package-ui/form/selectors/selector_base.ts","../../../package-ui/form/selectors/drop_down/drop_down.ts","../../../package-ui/form/selectors/toggle_button/toggle_button.ts","../../../package-ui/form/spacing/spacer.ts","../../../package-ui/form/special/color/color_input.ts","../../../package-ui/form/special/date_time/date_time_input.ts","../../../package-ui/form/special/ip/ip_input.ts","../../../package-ui/form/special/password/password_input.ts","../../../package-ui/form/text/input/text_input.ts","../../../package-ui/form/text/multi_line/text_multi_line.ts","../../../package-ui/form/text/text/text.ts","../../../package-ui/form/index.ts"],"sourcesContent":["import {\n BLUE,\n GREEN,\n GREY,\n ORANGE,\n RED,\n YELLOW,\n} from \"@chocbite/ts-lib/colors\";\nimport { theme_init_variable_root } from \"#theme\";\n\nconst theme_root = theme_init_variable_root(\n \"form\",\n \"UI Form Elements\",\n \"Theme variables for UI form Elements\",\n);\n\n// _____ ______ _____ ____ _ _ _ __ __\n// | __ \\| ____| /\\ | __ \\ / __ \\| \\ | | | \\ \\ / /\n// | |__) | |__ / \\ | | | | | | | | \\| | | \\ \\_/ /\n// | _ /| __| / /\\ \\ | | | | | | | | . ` | | \\ /\n// | | \\ \\| |____ / ____ \\| |__| | | |__| | |\\ | |____| |\n// |_| \\_\\______/_/ \\_\\_____/ \\____/|_| \\_|______|_|\nconst read_only = theme_root.make_sub_group(\n \"read\",\n \"Read Only\",\n \"Settings for form elements in read only mode\",\n);\nread_only.make_variable(\n \"filter\",\n \"Read Only Filter\",\n \"Filter applied to form elements in read only mode\",\n \"opacity(0.6)\",\n \"opacity(0.6)\",\n \"Filter\",\n undefined,\n);\n\n//#################################################################################3\n//#################################################################################3\n// _____ ____ _ ____ _____ _____\n// / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | | | | | | | | | | | |__) | (___\n// | | | | | | | | | | | _ / \\___ \\\n// | |___| |__| | |___| |__| | | \\ \\ ____) |\n// \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors = theme_root.make_sub_group(\n \"colors\",\n \"Colors\",\n \"Colors used in all form elements\",\n);\n\n// _______ ________ _________ _____ ____ _ ____ _____ _____\n// |__ __| ____\\ \\ / /__ __| / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | | | |__ \\ V / | | | | | | | | | | | | | |__) | (___\n// | | | __| > < | | | | | | | | | | | | | _ / \\___ \\\n// | | | |____ / . \\ | | | |___| |__| | |___| |__| | | \\ \\ ____) |\n// |_| |______/_/ \\_\\ |_| \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors_text = colors.make_sub_group(\n \"text\",\n \"Text Colors\",\n \"Text colors used in all form elements\",\n);\ncolors_text.make_variable(\n \"label\",\n \"Label Color\",\n \"Color of form elements labels\",\n GREY[\"700\"],\n GREY[\"300\"],\n \"Color\",\n undefined,\n);\ncolors_text.make_variable(\n \"normal\",\n \"Normal Text Color\",\n \"Normal text color in form elements\",\n GREY[\"800\"],\n GREY[\"200\"],\n \"Color\",\n undefined,\n);\ncolors_text.make_variable(\n \"selected\",\n \"Selected Text Color\",\n \"Selected text color in form elements\",\n GREY[\"900\"],\n GREY[\"50\"],\n \"Color\",\n undefined,\n);\ncolors_text.make_variable(\n \"unselected\",\n \"Unselected Text Color\",\n \"Unselected text color in form elements\",\n GREY[\"600\"],\n GREY[\"400\"],\n \"Color\",\n undefined,\n);\n\n// _______ ________ _________ ____ _ _____ _ __\n// |__ __| ____\\ \\ / /__ __| | _ \\| | /\\ / ____| |/ /\n// | | | |__ \\ V / | | | |_) | | / \\ | | | ' /\n// | | | __| > < | | | _ <| | / /\\ \\| | | <\n// | | | |____ / . \\ | | | |_) | |____ / ____ \\ |____| . \\\n// |_| |______/_/ \\_\\ |_| |____/|______/_/ \\_\\_____|_|\\_\\\n//\n//\nconst colors_text_black = colors.make_sub_group(\n \"textBlack\",\n \"Text Colors Black Background\",\n \"Text colors used for black background in all form elements\",\n);\ncolors_text_black.make_variable(\n \"normal\",\n \"Normal Text Color\",\n \"Normal text color in form elements\",\n GREY[\"200\"],\n GREY[\"200\"],\n \"Color\",\n undefined,\n);\ncolors_text_black.make_variable(\n \"selected\",\n \"Selected Text Color\",\n \"Selected text color in form elements\",\n GREY[\"50\"],\n GREY[\"50\"],\n \"Color\",\n undefined,\n);\ncolors_text_black.make_variable(\n \"unselected\",\n \"Unselected Text Color\",\n \"Unselected text color in form elements\",\n GREY[\"600\"],\n GREY[\"400\"],\n \"Color\",\n undefined,\n);\n\n// _____ _____ ____ _ _ _____ ____ _ ____ _____ _____\n// |_ _/ ____/ __ \\| \\ | | / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | || | | | | | \\| | | | | | | | | | | | | |__) | (___\n// | || | | | | | . ` | | | | | | | | | | | | _ / \\___ \\\n// _| || |___| |__| | |\\ | | |___| |__| | |___| |__| | | \\ \\ ____) |\n// |_____\\_____\\____/|_| \\_| \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors_icon = colors.make_sub_group(\n \"icon\",\n \"Icon Colors\",\n \"Icon colors used in all form elements\",\n);\ncolors_icon.make_variable(\n \"normal\",\n \"Normal Icon Color\",\n \"Color of icons in form elements\",\n GREY[\"800\"],\n GREY[\"200\"],\n \"Color\",\n undefined,\n);\ncolors_icon.make_variable(\n \"selected\",\n \"Selected Icon Color\",\n \"Color of selected icons in form elements\",\n GREY[\"900\"],\n GREY[\"50\"],\n \"Color\",\n undefined,\n);\ncolors_icon.make_variable(\n \"unselected\",\n \"Unselected Icon Color\",\n \"Color of unselected icons in form elements\",\n GREY[\"600\"],\n GREY[\"400\"],\n \"Color\",\n undefined,\n);\n\n// ____ _____ _ _______ _____ ____ _ _ _ _ _____ _____ ____ _ ____ _____ _____\n// | _ \\ /\\ / ____| |/ / ____| __ \\ / __ \\| | | | \\ | | __ \\ / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | |_) | / \\ | | | ' / | __| |__) | | | | | | | \\| | | | | | | | | | | | | | | | |__) | (___\n// | _ < / /\\ \\| | | <| | |_ | _ /| | | | | | | . ` | | | | | | | | | | | | | | | _ / \\___ \\\n// | |_) / ____ \\ |____| . \\ |__| | | \\ \\| |__| | |__| | |\\ | |__| | | |___| |__| | |___| |__| | | \\ \\ ____) |\n// |____/_/ \\_\\_____|_|\\_\\_____|_| \\_\\\\____/ \\____/|_| \\_|_____/ \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors_background = colors.make_sub_group(\n \"background\",\n \"Background Colors\",\n \"Background colors used in all form elements\",\n);\ncolors_background.make_variable(\n \"normal\",\n \"Normal Background Color\",\n \"Color of normal form element backgrounds\",\n GREY[\"50\"],\n GREY[\"900\"],\n \"Color\",\n undefined,\n);\ncolors_background.make_variable(\n \"hover\",\n \"Hover Background Color\",\n \"Color of form element backgrounds when hovering\",\n GREY[\"400\"],\n GREY[\"700\"],\n \"Color\",\n undefined,\n);\ncolors_background.make_variable(\n \"unselected\",\n \"Unselected Background Color\",\n \"Color of unselected form element backgrounds\",\n GREY[\"300\"],\n GREY[\"800\"],\n \"Color\",\n undefined,\n);\n\n// ____ ____ _____ _____ ______ _____ _____ ____ _ ____ _____ _____\n// | _ \\ / __ \\| __ \\| __ \\| ____| __ \\ / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | |_) | | | | |__) | | | | |__ | |__) | | | | | | | | | | | | |__) | (___\n// | _ <| | | | _ /| | | | __| | _ / | | | | | | | | | | | _ / \\___ \\\n// | |_) | |__| | | \\ \\| |__| | |____| | \\ \\ | |___| |__| | |___| |__| | | \\ \\ ____) |\n// |____/ \\____/|_| \\_\\_____/|______|_| \\_\\ \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors_border = colors.make_sub_group(\n \"border\",\n \"Border Colors\",\n \"Border colors used in all form elements\",\n);\ncolors_border.make_variable(\n \"normal\",\n \"Normal Border Color\",\n \"Color of normal form element borders\",\n GREY[\"700\"],\n GREY[\"300\"],\n \"Color\",\n undefined,\n);\ncolors_border.make_variable(\n \"unselected\",\n \"Unselected Border Color\",\n \"Color of unselected form element borders\",\n GREY[\"700\"],\n GREY[\"300\"],\n \"Color\",\n undefined,\n);\n\n// ______ ____ _____ _ _ _____\n// | ____/ __ \\ / ____| | | |/ ____|\n// | |__ | | | | | | | | | (___\n// | __|| | | | | | | | |\\___ \\\n// | | | |__| | |____| |__| |____) |\n// |_| \\____/ \\_____|\\____/|_____/\nconst colors_focus = colors.make_sub_group(\n \"focus\",\n \"Focus Colors\",\n \"Focus colors used in all form elements\",\n);\ncolors_focus.make_variable(\n \"normal\",\n \"Focus Color\",\n \"Color of focussed form element\",\n ORANGE[\"600\"],\n ORANGE[\"300\"],\n \"Color\",\n undefined,\n);\n\n// ____ _____ _____ _____ _____ ____ _ ____ _____ _____\n// | _ \\ /\\ / ____|_ _/ ____| / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | |_) | / \\ | (___ | || | | | | | | | | | | | | |__) | (___\n// | _ < / /\\ \\ \\___ \\ | || | | | | | | | | | | | | _ / \\___ \\\n// | |_) / ____ \\ ____) |_| || |____ | |___| |__| | |___| |__| | | \\ \\ ____) |\n// |____/_/ \\_\\_____/|_____\\_____| \\_____\\____/|______\\____/|_| \\_\\_____/\nconst colors_basic = colors.make_sub_group(\n \"basic\",\n \"Basic Colors\",\n \"Basic colors used in all form elements\",\n);\ncolors_basic.make_variable(\n \"black\",\n \"Basic Black Color\",\n \"Commonly used black color in form elements\",\n GREY[\"900\"],\n GREY[\"900\"],\n \"Color\",\n undefined,\n);\ncolors_basic.make_variable(\n \"white\",\n \"Basic White Color\",\n \"Commonly used white color in form elements\",\n GREY[\"100\"],\n GREY[\"100\"],\n \"Color\",\n undefined,\n);\ncolors_basic.make_variable(\n \"green\",\n \"Basic Green Color\",\n \"Commonly used green color in form elements\",\n GREEN[\"300\"],\n GREEN[\"900\"],\n \"Color\",\n undefined,\n);\ncolors_basic.make_variable(\n \"red\",\n \"Basic Red Color\",\n \"Commonly used red color in form elements\",\n RED[\"300\"],\n RED[\"900\"],\n \"Color\",\n undefined,\n);\ncolors_basic.make_variable(\n \"blue\",\n \"Basic Blue Color\",\n \"Commonly used blue color in form elements\",\n BLUE[\"300\"],\n BLUE[\"900\"],\n \"Color\",\n undefined,\n);\ncolors_basic.make_variable(\n \"yellow\",\n \"Basic Yellow Color\",\n \"Commonly used yellow color in form elements\",\n YELLOW[\"300\"],\n ORANGE[\"900\"],\n \"Color\",\n undefined,\n);\n\n//#################################################################################3\n//#################################################################################3\n// _____ _____ ____________ _____\n// / ____|_ _|___ / ____|/ ____|\n// | (___ | | / /| |__ | (___\n// \\___ \\ | | / / | __| \\___ \\\n// ____) |_| |_ / /__| |____ ____) |\n// |_____/|_____/_____|______|_____/\nconst sizes = theme_root.make_sub_group(\n \"size\",\n \"Size\",\n \"Sizes used in all form elements\",\n);\n\nsizes.make_variable(\n \"height\",\n \"Height\",\n \"Default height used in all form elements\",\n \"1.3rem\",\n \"1.3rem\",\n \"Length\",\n { min: 0.1, max: 10 },\n);\n\nsizes.make_variable(\n \"touchHeight\",\n \"Touch Height\",\n \"Minimum height for touch devices used in all form elements\",\n \"2.0rem\",\n \"2.0rem\",\n \"Length\",\n { min: 0.1, max: 10 },\n);\n\n//#################################################################################3\n//#################################################################################3\n// ______ ____ _ _ _______\n// | ____/ __ \\| \\ | |__ __|\n// | |__ | | | | \\| | | |\n// | __|| | | | . ` | | |\n// | | | |__| | |\\ | | |\n// |_| \\____/|_| \\_| |_|\nconst font = theme_root.make_sub_group(\n \"font\",\n \"Font\",\n \"Font settings used in all form elements\",\n);\n\nfont.make_variable(\n \"size\",\n \"Font Size\",\n \"Default font size used in all form elements\",\n \"0.9rem\",\n \"0.9rem\",\n \"Length\",\n { min: 0.1, max: 10 },\n);\n\nfont.make_variable(\n \"touch_size\",\n \"Touch Font Size\",\n \"Font size used in all form elements for touch devices\",\n \"1.1rem\",\n \"1.1rem\",\n \"Length\",\n { min: 0.1, max: 10 },\n);\n","import { Base } from \"#base\";\nimport { sync_resolve } from \"@chocbite/ts-lib/common\";\nimport { err, ok, type Option, type Result } from \"@chocbite/ts-lib/result\";\nimport type { State, StateREA, StateSub } from \"@chocbite/ts-lib/state\";\nimport \"./shared\";\n\nexport interface FormOptions {}\n\n/**Colors for form elements that have selectable colors*/\nexport const FormColors = {\n None: \"none\",\n Black: \"black\",\n Green: \"green\",\n Red: \"red\",\n Blue: \"blue\",\n Yellow: \"yellow\",\n} as const;\nexport type FormColors = (typeof FormColors)[keyof typeof FormColors];\n\n/**Shared component class for other components to inherit from*/\nexport abstract class FormElement extends Base {\n static element_name() {\n return \"@abstract@\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n static apply_options(_element: FormElement, _options: FormOptions) {}\n}\n\n//##################################################################################################\n// __ __ _ _ _ ______ _____ ______ _____\n// \\ \\ / /\\ | | | | | | ____| | __ \\| ____| /\\ | __ \\\n// \\ \\ / / \\ | | | | | | |__ | |__) | |__ / \\ | | | |\n// \\ \\/ / /\\ \\ | | | | | | __| | _ /| __| / /\\ \\ | | | |\n// \\ / ____ \\| |___| |__| | |____ | | \\ \\| |____ / ____ \\| |__| |\n// \\/_/ \\_\\______\\____/|______| |_| \\_\\______/_/ \\_\\_____/\n\nexport interface FormValueOptions<\n RT,\n ID extends string | undefined,\n> extends FormOptions {\n /**ID form form element */\n id?: ID;\n /**Value for form element */\n value?: RT;\n /**Longer description what form element does */\n description?: string;\n}\n\n/**Shared class for all components with values*/\nexport abstract class FormValue<\n RT,\n ID extends string | undefined,\n> extends FormElement {\n static element_name() {\n return \"@abstract@\";\n }\n\n static apply_options<RT, ID extends string | undefined>(\n element: FormValue<RT, ID>,\n options: FormValueOptions<RT, ID>,\n ) {\n if (options.description) element.description = options.description;\n if (options.value !== undefined) element.value = options.value;\n super.apply_options(element, options);\n }\n\n readonly form_id: ID;\n\n constructor(id?: ID) {\n super();\n this.form_id = id as ID;\n }\n\n protected _description?: string;\n /**Sets the description of the element, shown as a tooltip*/\n set description(text: string) {\n this._description = text;\n if (text) this.title = text;\n else this.removeAttribute(\"title\");\n }\n get description(): string {\n return this._description || \"\";\n }\n\n protected _buffer?: RT;\n get buffer(): RT | undefined {\n return this._buffer;\n }\n\n protected _state?: State<RT, Option<{}>, RT>;\n #func?: StateSub<Result<RT, string>>;\n\n /**Binds the element to a state, a read only state is shown and changes to the element are refused with a warning*/\n bind(opts: { value: StateREA<RT, Option<{}>, RT> }): this {\n if (this.#func) {\n this.detach_state(this.#func);\n this.#func = undefined;\n }\n if (opts.value) {\n //Related first, so the first value is shown with them, like decimals\n const related = opts.value.related();\n this.state_related(related.some ? related.value : {});\n this.#func = this.attach_state(opts.value, (val) => {\n if (val.ok) {\n this.value = val.value;\n if (this.#error) this.error = undefined;\n } else this.error = val.error;\n });\n } else this.state_related({});\n this._state = opts.value;\n\n return this;\n }\n\n /**This sets the value of the component*/\n set value(val: RT) {\n if (typeof this._buffer !== \"undefined\" && this._buffer === val) return;\n this._buffer = val;\n this.new_value(val);\n }\n\n /**Returns value of the component*/\n get get_value(): Result<RT, string> {\n return this._state\n ? err(\"State based component\")\n : typeof this._buffer === \"undefined\"\n ? err(\"No value yet\")\n : ok(this._buffer);\n }\n\n #error = false;\n set error(err: string | undefined) {\n if (err) {\n this.new_error(err);\n this.#error = true;\n } else if (this.#error) {\n this.clear_error();\n this.#error = false;\n }\n }\n\n /**Clears the value and error of the component if not state based*/\n clear(): void {\n if (this._state) return;\n this._buffer = undefined;\n this.clear_value();\n this.clear_error();\n this.#error = false;\n }\n\n /**Called when value is set by value setter or state*/\n protected abstract new_value(val: RT): void;\n\n /**Clears form element graphically*/\n protected abstract clear_value(): void;\n\n /**Called when error is set by error or state*/\n protected abstract new_error(val: string): void;\n\n /**Called when error is cleared by error or state*/\n protected abstract clear_error(): void;\n\n /**Called when state has related information */\n protected abstract state_related(related: {}): void;\n}\n\n//##################################################################################################\n// __ __ _ _ _ ______ __ _______ _____ _______ ______\n// \\ \\ / /\\ | | | | | | ____| \\ \\ / / __ \\|_ _|__ __| ____|\n// \\ \\ / / \\ | | | | | | |__ \\ \\ /\\ / /| |__) | | | | | | |__\n// \\ \\/ / /\\ \\ | | | | | | __| \\ \\/ \\/ / | _ / | | | | | __|\n// \\ / ____ \\| |___| |__| | |____ \\ /\\ / | | \\ \\ _| |_ | | | |____\n// \\/_/ \\_\\______\\____/|______| \\/ \\/ |_| \\_\\_____| |_| |______|\n\nexport interface FormValueWriteOptions<\n RT,\n ID extends string | undefined,\n> extends FormValueOptions<RT, ID> {\n /**Change listener function*/\n change?: (val: RT) => void;\n}\n\n/**Shared class for all components with values*/\nexport abstract class FormValueWrite<\n RT,\n ID extends string | undefined,\n> extends FormValue<RT, ID> {\n static element_name() {\n return \"@abstract@\";\n }\n\n protected selected: boolean = false;\n protected warn_input: HTMLInputElement = document.createElement(\"input\");\n #warn_timeout?: number;\n #changed: boolean = false;\n #change?: (val: RT) => void;\n\n static apply_options<RT, ID extends string | undefined>(\n element: FormValueWrite<RT, ID>,\n options: FormValueWriteOptions<RT, ID>,\n ) {\n if (options.change) element.change = options.change;\n super.apply_options(element, options);\n }\n\n constructor(id?: ID) {\n super(id);\n this.warn_input.name = \"val\";\n }\n\n focus(options?: FocusOptions): void {\n this.warn_input.focus(options);\n }\n\n set change(func: (val: RT) => void) {\n this.#change = func;\n }\n get change(): ((val: RT) => void) | undefined {\n return this.#change;\n }\n\n /**Returns true if the value of the component has changed*/\n get changed(): boolean {\n return this.#changed;\n }\n\n set value(val: RT) {\n if (!this.selected) super.value = val;\n else this._buffer = val;\n }\n\n warn(message: string): void {\n this.warn_input.setCustomValidity(message);\n this.warn_input.reportValidity();\n if (this.#warn_timeout) clearTimeout(this.#warn_timeout);\n this.#warn_timeout = setTimeout(() => {\n this.warn_input.setCustomValidity(\"\");\n this.warn_input.reportValidity();\n }, 5000);\n }\n\n /**Function to limit value entered */\n protected limit_value(val: RT): PromiseLike<Result<RT, string>> {\n if (this._state) {\n if (this._state.writable) return this._state.limit(val);\n else return sync_resolve(err(\"Not writable\"));\n } else return sync_resolve(ok(val));\n }\n\n /**Function to check value, a state checks the value itself when it is written, so it is not checked here*/\n protected check_value(val: RT): PromiseLike<Result<RT, string>> {\n if (this._state && !this._state.writable)\n return sync_resolve(err(\"Not writable\"));\n return sync_resolve(ok(val));\n }\n\n /**Function to update value*/\n protected async set_value_limit(val: RT): Promise<Result<RT, string>> {\n const limited = await this.limit_value(val);\n if (limited.err) {\n this.warn(limited.error);\n return limited;\n }\n return this.#set_value(limited.value);\n }\n\n /**Function to update value*/\n protected async set_value_check(val: RT): Promise<Result<RT, string>> {\n const checked = await this.check_value(val);\n if (checked.err) {\n this.warn(checked.error);\n return checked;\n }\n return this.#set_value(checked.value);\n }\n\n /**Shows the value and writes it to the state, a value the state rejects is reverted and warned about.\n * The change listener is only called with accepted values*/\n async #set_value(val: RT): Promise<Result<RT, string>> {\n //Shown even when unchanged, the shown text can differ, like a typed value rounding to the current value\n this.new_value(val);\n if (this._buffer === val) return ok(val);\n if (this._state) {\n const buff = this._buffer;\n const written = await this._state.write!(val);\n if (written.err) {\n if (buff !== undefined) this.new_value(buff);\n this.warn(written.error);\n return err(written.error);\n }\n } else {\n this._buffer = val;\n this.#changed = true;\n }\n this.call_change(val);\n return ok(val);\n }\n\n /**Calls the change listener with a value the user changed, and lets a parent group know*/\n protected call_change(val: RT): void {\n if (this.#change)\n try {\n this.#change(val);\n } catch (e) {\n console.error(\"Failed while updating change listener\", e);\n }\n const parent = this.parentElement;\n if (this.form_id !== undefined && parent instanceof FormValueWrite)\n parent.child_changed(this);\n }\n\n /**Called when a child value element with a form id was changed by the user*/\n protected child_changed(_child: FormValueWrite<any, any>): void {}\n}\n","import { define_element } from \"#base\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport type { SVGFunc } from \"#svg\";\nimport { FormColors, FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"../../shared\";\nimport \"./button.scss\";\n\nexport interface FormButtonOptions<\n ID extends string | undefined,\n> extends FormValueWriteOptions<boolean, ID> {\n /**Buttons text */\n text?: string;\n /**Icon for button */\n icon?: SVGFunc;\n /**Function to call on button click */\n on_click?: () => void;\n /**Set true to make button toggle on click instead of normal */\n toggle?: boolean;\n /**Changes the buttons color */\n color?: FormColors;\n /**Centers text and icon */\n center?: boolean;\n}\n\nexport class FormButton<ID extends string | undefined> extends FormValueWrite<\n boolean,\n ID\n> {\n static element_name() {\n return \"button\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #text: HTMLSpanElement = this.appendChild(document.createElement(\"span\"));\n #on_click?: () => void;\n #toggle?: boolean;\n #icon?: SVGSVGElement;\n\n constructor(id?: ID) {\n super(id);\n\n this.appendChild(this.warn_input);\n this.setAttribute(\"tabindex\", \"0\");\n this.onclick = () => {\n if (this.#on_click) this.#on_click();\n };\n this.onpointerdown = (e) => {\n if (e.pointerType !== \"touch\" && e.button === 0) {\n e.stopPropagation();\n this.setPointerCapture(e.pointerId);\n if (!this.#toggle) this.set_value_check(true);\n this.onpointerup = (ev) => {\n ev.stopPropagation();\n this.releasePointerCapture(ev.pointerId);\n if (this.#toggle) this.set_value_check(!this.buffer);\n else this.set_value_check(false);\n this.onpointerup = null;\n this.onpointercancel = null;\n };\n //A cancelled press releases a momentary button and does not toggle a toggle button\n this.onpointercancel = (ev) => {\n this.releasePointerCapture(ev.pointerId);\n if (!this.#toggle) this.set_value_check(false);\n this.onpointerup = null;\n this.onpointercancel = null;\n };\n }\n };\n this.ontouchstart = (e) => {\n e.stopPropagation();\n if (!this.#toggle) this.set_value_check(true);\n this.ontouchend = (ev) => {\n ev.stopPropagation();\n if (ev.targetTouches.length === 0) {\n if (this.#toggle) this.set_value_check(!this.buffer);\n else this.set_value_check(false);\n this.ontouchend = null;\n this.ontouchcancel = null;\n }\n };\n this.ontouchcancel = () => {\n if (!this.#toggle) this.set_value_check(false);\n this.ontouchend = null;\n this.ontouchcancel = null;\n };\n };\n this.onkeydown = (e) => {\n switch (e.key) {\n case \" \":\n case \"Enter\": {\n e.stopPropagation();\n e.preventDefault();\n if (!this.#toggle) this.set_value_check(true);\n this.onkeyup = (e) => {\n switch (e.key) {\n case \"Enter\":\n case \" \": {\n e.stopPropagation();\n e.preventDefault();\n this.onkeyup = null;\n if (this.#toggle) this.set_value_check(!this.buffer);\n else this.set_value_check(false);\n if (this.#on_click) this.#on_click();\n break;\n }\n }\n };\n break;\n }\n }\n };\n }\n\n focus(options?: FocusOptions): void {\n HTMLElement.prototype.focus.call(this, options);\n }\n\n /**Sets the current text of the button*/\n set text(label: string) {\n this.#text.textContent = label;\n }\n get text() {\n return this.#text.textContent;\n }\n\n /**Changes the icon of the button*/\n set icon(icon: SVGFunc | undefined) {\n if (this.#icon) this.removeChild(this.#icon);\n this.#icon = icon ? this.insertBefore(icon(), this.#text) : undefined;\n }\n\n /**Function to call on button click*/\n set on_click(func: (() => void) | undefined) {\n this.#on_click = func;\n }\n get on_click() {\n return this.#on_click;\n }\n\n /**Changes the color of the button*/\n set color(color: FormColors) {\n if (color === FormColors.None) this.removeAttribute(\"color\");\n else this.setAttribute(\"color\", color);\n }\n\n /**Centers text and icon */\n set center(center: boolean) {\n if (center) this.classList.add(\"center\");\n else this.classList.remove(\"center\");\n }\n\n get center() {\n return this.classList.contains(\"center\");\n }\n\n /**Called when value is changed */\n protected new_value(value: boolean) {\n if (value) this.classList.add(\"active\");\n else this.classList.remove(\"active\");\n }\n\n protected clear_value(): void {\n this.new_value(false);\n }\n\n protected new_error(err: string): void {\n console.error(\"TODO\", err);\n }\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n\n /**Changes whether the button is maintained or momentary*/\n set toggle(toggle: boolean | undefined) {\n this.#toggle = Boolean(toggle);\n }\n get toggle() {\n return this.#toggle;\n }\n}\ndefine_element(FormButton);\n\n/**Creates a button form element */\nexport function form_button<ID extends string | undefined>(\n options?: FormButtonOptions<ID>,\n): FormButton<ID> {\n const butt = new FormButton<ID>(options?.id);\n if (options) {\n if (options.text) butt.text = options.text;\n if (options.icon) butt.icon = options.icon;\n if (options.on_click) butt.on_click = options.on_click;\n if (options.toggle) butt.toggle = options.toggle;\n if (options.color) butt.color = options.color;\n if (options.center) butt.center = options.center;\n FormValueWrite.apply_options(butt, options);\n }\n return butt;\n}\n","import { define_element } from \"#base\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport type { SVGFunc } from \"#svg\";\nimport { FormValue, type FormColors, type FormValueOptions } from \"../../base\";\nimport \"./lamp.scss\";\n\nexport interface FormLampOptions<\n T extends boolean | number,\n C extends FormColors[],\n ID extends string | undefined,\n> extends FormValueOptions<T, ID> {\n /**Sets the lamp colors */\n colors: C;\n /**Lamp text */\n text?: string;\n /**Icon for lamp */\n icon?: SVGFunc;\n /**Centers text and icon */\n center?: boolean;\n}\n\nexport class FormLamp<\n T extends boolean | number,\n C extends FormColors[],\n ID extends string | undefined,\n> extends FormValue<T, ID> {\n static element_name() {\n return \"lamp\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #text: HTMLSpanElement = this.appendChild(document.createElement(\"span\"));\n #icon: SVGSVGElement | undefined;\n #colors: FormColors[] = [];\n\n /**Sets the current text of the lamp*/\n set text(label: string) {\n this.#text.textContent = label;\n }\n get text() {\n return this.#text.textContent;\n }\n\n /**Changes the icon of the lamp*/\n set icon(icon: SVGFunc | undefined) {\n if (this.#icon) this.removeChild(this.#icon);\n this.#icon = icon ? this.insertBefore(icon(), this.#text) : undefined;\n }\n\n /** Sets the background color of the lamp*/\n set colors(colors: C) {\n this.#colors = colors;\n this.new_value(this.buffer!);\n }\n\n /**Centers text and icon */\n set center(center: boolean) {\n if (center) this.classList.add(\"center\");\n else this.classList.remove(\"center\");\n }\n\n get center() {\n return this.classList.contains(\"center\");\n }\n\n /**Called when value is changed */\n protected new_value(value: number | boolean) {\n const color = this.#colors[Number(value)];\n if (color) this.setAttribute(\"color\", color);\n else this.removeAttribute(\"color\");\n }\n\n protected clear_value(): void {\n this.removeAttribute(\"color\");\n }\n\n protected new_error(err: string): void {\n console.error(err);\n }\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormLamp);\n\n/**Creates a button form element */\nfunction from<ID extends string | undefined>(\n options?: FormLampOptions<\n number,\n [FormColors, FormColors, FormColors, ...FormColors[]],\n ID\n >,\n): FormLamp<number, [FormColors, FormColors, FormColors, ...FormColors[]], ID>;\nfunction from<ID extends string | undefined>(\n options?: FormLampOptions<boolean, [FormColors, FormColors], ID>,\n): FormLamp<boolean, [FormColors, FormColors], ID>;\nfunction from<\n T extends boolean | number,\n C extends FormColors[],\n ID extends string | undefined,\n>(options?: FormLampOptions<T, C, ID>): FormLamp<T, C, ID> {\n const lamp = new FormLamp<T, C, ID>(options?.id);\n if (options) {\n lamp.colors = options.colors;\n if (options.text) lamp.text = options.text;\n if (options.icon) lamp.icon = options.icon;\n if (options.center) lamp.center = options.center;\n FormValue.apply_options(lamp, options);\n }\n return lamp;\n}\n\n/**Creates a button form element */\nexport const form_lamp = from;\n","import { define_element } from \"#base\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport type { SVGFunc } from \"#svg\";\nimport { FormColors, FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./switch.scss\";\n\nexport interface FormSwitchOptions<\n ID extends string | undefined,\n> extends FormValueWriteOptions<boolean, ID> {\n /**Icon to use for left side*/\n icon?: SVGFunc;\n /**Color when switch is on */\n on_color?: FormColors;\n /**Color when switch is off */\n off_color?: FormColors;\n}\n\nexport class FormSwitch<ID extends string | undefined> extends FormValueWrite<\n boolean,\n ID\n> {\n static element_name() {\n return \"switch\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #switch: HTMLDivElement = this.appendChild(document.createElement(\"div\"));\n #icon: SVGSVGElement | undefined;\n #prevent_click: boolean = false;\n\n constructor(id?: ID) {\n super(id);\n\n this.appendChild(this.warn_input);\n this.#switch.setAttribute(\"tabindex\", \"0\");\n this.#switch.onkeydown = (e) => {\n switch (e.key) {\n case \"Enter\":\n case \" \": {\n e.stopPropagation();\n e.preventDefault();\n this.onkeyup = (e) => {\n switch (e.key) {\n case \"Enter\":\n case \" \": {\n e.stopPropagation();\n e.preventDefault();\n this.onkeyup = null;\n this.set_value_check(!this.buffer);\n break;\n }\n }\n };\n break;\n }\n }\n };\n\n this.#switch.onpointerdown = (e) => {\n if (e.button === 0) {\n e.stopPropagation();\n this.#switch.classList.add(\"active\");\n this.#switch.setPointerCapture(e.pointerId);\n let has_moved = false;\n this.#switch.onpointermove = (ev) => {\n ev.stopPropagation();\n if (has_moved) {\n const box = this.#switch.getBoundingClientRect();\n const mid_cord = box.x + box.width / 2;\n if (ev.clientX > mid_cord) {\n if (!this.buffer) this.set_value_check(true);\n } else {\n if (this.buffer) this.set_value_check(false);\n }\n } else if (\n Math.abs(e.clientX - ev.clientX) > 10 ||\n Math.abs(e.clientY - ev.clientY) > 10\n ) {\n has_moved = true;\n }\n };\n const release = () => {\n this.#switch.classList.remove(\"active\");\n this.#switch.releasePointerCapture(e.pointerId);\n this.#switch.onpointerup = null;\n this.#switch.onpointermove = null;\n this.#switch.onpointercancel = null;\n };\n this.#switch.onpointerup = (ev) => {\n ev.stopPropagation();\n release();\n if (!has_moved) this.set_value_check(!this.buffer);\n };\n //A cancelled press does not toggle, values set by moving are kept\n this.#switch.onpointercancel = release;\n }\n };\n\n this.#switch.onclick = (e) => e.stopPropagation();\n\n this.onclick = (e) => {\n e.stopPropagation();\n if (this.#prevent_click) return (this.#prevent_click = false);\n this.set_value_check(!this.buffer);\n return;\n };\n }\n\n /**Changes the icon of the switch*/\n set icon(icon: SVGFunc | undefined) {\n if (this.#icon) this.removeChild(this.#icon);\n this.#icon = icon ? this.insertBefore(icon(), this.#switch) : undefined;\n }\n\n set on_color(color: FormColors) {\n if (color === FormColors.None) this.#switch.removeAttribute(\"on-color\");\n else this.#switch.setAttribute(\"on-color\", color);\n }\n set off_color(color: FormColors) {\n if (color === FormColors.None) this.#switch.removeAttribute(\"off-color\");\n else this.#switch.setAttribute(\"off-color\", color);\n }\n set error_color(color: FormColors) {\n if (color === FormColors.None) this.#switch.removeAttribute(\"error-color\");\n else this.#switch.setAttribute(\"error-color\", color);\n }\n\n /**Called when value is changed */\n protected new_value(value: boolean) {\n if (value) this.#switch.classList.add(\"on\");\n else this.#switch.classList.remove(\"on\");\n }\n\n protected clear_value(): void {\n this.new_value(false);\n }\n\n protected new_error(_err: string): void {\n this.#switch.classList.add(\"error\");\n }\n\n protected clear_error(): void {\n this.#switch.classList.remove(\"error\");\n }\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormSwitch);\n\n/**Creates a switch form element */\nexport function form_switch<ID extends string | undefined>(\n options?: FormSwitchOptions<ID>,\n): FormSwitch<ID> {\n const swit = new FormSwitch<ID>(options?.id);\n if (options) {\n if (options.icon) swit.icon = options.icon;\n if (options.on_color) swit.on_color = options.on_color;\n if (options.off_color) swit.off_color = options.off_color;\n FormValueWrite.apply_options(swit, options);\n }\n return swit;\n}\n","import { AccessTypes } from \"#base\";\nimport { err, ok, Option, Result } from \"@chocbite/ts-lib/result\";\nimport { FormElement, FormValue, FormValueWrite } from \"../base\";\nimport \"./group_base.scss\";\n\n/**Different border styles for the component group*/\nexport const FormGroupBorderStyle = {\n None: \"none\",\n Inset: \"inset\",\n Outset: \"outset\",\n Line: \"line\",\n} as const;\nexport type FormGroupBorderStyle =\n (typeof FormGroupBorderStyle)[keyof typeof FormGroupBorderStyle];\n\nexport type GroupExtractVals<Arr extends any[]> = Arr extends [\n infer Head,\n ...infer Tail,\n]\n ? Head extends FormValue<infer T, infer ID>\n ? [FormValue<T, ID>, ...GroupExtractVals<Tail>]\n : [...GroupExtractVals<Tail>]\n : [];\n\nexport type GroupToKeyVal<Arr extends FormValue<any, any>[]> = {\n [K in Arr[number] as K extends FormValue<any, infer ID>\n ? [ID] extends [string]\n ? ID\n : never\n : never]: K extends FormValue<infer T, any> ? T : never;\n};\n\nexport type GroupValueElements<Elements extends FormElement[]> = {\n [Element in Elements[number] as Element extends FormValueWrite<any, infer ID>\n ? [ID] extends [string]\n ? ID\n : never\n : never]: Element;\n};\n\nexport abstract class FormGroupBase<\n RT extends object,\n ID extends string | undefined,\n Elements extends FormElement[] = FormElement[],\n> extends FormValueWrite<Partial<RT>, ID> {\n static element_name() {\n return \"@abstract@\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n protected _value_elements: Map<string, FormValueWrite<any, any>> = new Map();\n\n /**Returns form elements indexed by their form IDs*/\n get value_elements(): GroupValueElements<Elements> {\n return Object.fromEntries(\n this._value_elements,\n ) as unknown as GroupValueElements<Elements>;\n }\n\n /**This places the group at an absolute position in one of the corners of the container*/\n set border(border: FormGroupBorderStyle | undefined) {\n this.classList.remove(\n FormGroupBorderStyle.Inset,\n FormGroupBorderStyle.Outset,\n FormGroupBorderStyle.Line,\n );\n if (border && border !== FormGroupBorderStyle.None)\n this.classList.add(border);\n }\n\n set max_height(height: number | undefined) {\n this.style.setProperty(\"--max_height\", height ? height + \"rem\" : \"none\");\n if (height) this.classList.add(\"max_height\");\n else this.classList.remove(\"max_height\");\n }\n\n set embed(embed: boolean) {\n if (embed) this.classList.add(\"embed\");\n else this.classList.remove(\"embed\");\n }\n\n set value(val: Partial<RT>) {\n super.value = val;\n }\n\n /**Returns value of the group, returning err if any component has no value*/\n get get_value(): Result<RT, string> {\n if (this._state) return err(\"State based component\");\n const result: RT = {} as RT;\n for (const [key, comp] of this._value_elements) {\n const val = comp.get_value;\n if (val.err) return err(\"Component with id \" + key + \" has no value\");\n result[key as keyof RT] = val.value as RT[keyof RT];\n }\n return ok(result);\n }\n\n /**Returns partial value of the group, containing all values of components that have values*/\n get value_partial(): Result<Partial<RT>, string> {\n if (this._state) return err(\"State based component\");\n return ok(this.#partial());\n }\n\n #partial(): Partial<RT> {\n const result: Partial<RT> = {};\n for (const [key, comp] of this._value_elements) {\n const val = comp.get_value;\n if (val.err) continue;\n result[key as keyof RT] = val.value as RT[keyof RT];\n }\n return result;\n }\n\n /**The change listener of the group gets the values of all components that have values*/\n protected child_changed(child: FormValueWrite<any, any>): void {\n if (this._value_elements.get(child.form_id as string) === child)\n this.call_change(this.#partial());\n }\n\n /**Returns partial value of the group, only containing values of components where value has changed*/\n get value_changed(): Result<Partial<RT>, string> {\n if (this._state) return err(\"State based component\");\n const result: Partial<RT> = {};\n for (const [key, comp] of this._value_elements) {\n const val = comp.get_value;\n if (val.err) continue;\n if (comp.changed) result[key as keyof RT] = val.value as RT[keyof RT];\n }\n return ok(result);\n }\n\n protected new_value(val: RT): void {\n for (const key in val)\n if (this._value_elements.has(key))\n this._value_elements.get(key)!.value = val[key as keyof RT];\n }\n\n protected clear_value(): void {\n for (const comp of this._value_elements.values()) comp.clear();\n }\n\n protected new_error(err: string): void {\n console.error(err);\n }\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n\n protected on_access(access: AccessTypes): void {\n switch (access) {\n case AccessTypes.Read: {\n this.tabIndex = 0;\n this.onfocus = () => document.body.focus();\n break;\n }\n case AccessTypes.Write: {\n this.removeAttribute(\"tabIndex\");\n this.onfocus = null;\n break;\n }\n }\n }\n}\n","import { define_element } from \"#base\";\nimport { type Prettify } from \"@chocbite/ts-lib/common\";\nimport { FormElement, FormValueWrite, FormValueWriteOptions } from \"../base\";\nimport \"./group.scss\";\nimport {\n FormGroupBase,\n FormGroupBorderStyle,\n GroupExtractVals,\n GroupToKeyVal,\n} from \"./group_base\";\n\nexport interface FormGroupOptions<\n L extends FormElement[],\n ID extends string | undefined,\n T,\n> extends FormValueWriteOptions<Partial<T>, ID> {\n /**Elements to add to the group*/\n elements?: [...L];\n /**Border style for group*/\n border?: FormGroupBorderStyle;\n /**Removes padding when true allows for putting groups in groups without padding building up */\n embed?: boolean;\n /**Group max height in rem, undefined means no limit*/\n max_height?: number;\n /**Columns, true is everything in one columns, just a number will make repeating columns of minimum that rem width, an array will make exactly that many colums with specified rem widths */\n column?: true | string | string[];\n /**Rows, true is everything in one row, just a number will make repeating rows of minimum that rem height, an array will make exactly that many rows with specified rem heights */\n row?: true | string | string[];\n}\n\n/**Component group class which allows to add elements and controls the flow of the elements*/\nexport class FormGroup<\n RT extends object,\n ID extends string | undefined,\n Elements extends FormElement[] = FormValueWrite<any, string>[],\n> extends FormGroupBase<RT, ID, Elements> {\n static element_name() {\n return \"group\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n constructor(id?: ID) {\n super(id);\n this.classList.add(\"flex-col\");\n }\n\n set column(column: true | string | string[]) {\n this.classList.remove(\"grid-row\", \"grid-col\", \"flex-row\", \"flex-col\");\n if (column === true) {\n this.classList.add(\"flex-col\");\n } else {\n this.classList.add(\"grid-col\");\n\n if (typeof column === \"string\") {\n this.style.gridTemplateColumns =\n \"repeat(auto-fit, minmax(\" + column + \", 1fr))\";\n } else {\n this.style.gridTemplateColumns = column\n .map((col) => \"minmax(\" + col + \", 1fr)\")\n .join(\" \");\n }\n }\n }\n\n set row(row: true | string | string[]) {\n this.classList.remove(\"grid-row\", \"grid-col\", \"flex-row\", \"flex-col\");\n if (row === true) {\n this.classList.add(\"flex-row\");\n } else {\n this.classList.add(\"grid-row\");\n if (typeof row === \"string\") {\n this.style.gridTemplateRows =\n \"repeat(auto-fit, minmax(\" + row + \", 1fr))\";\n } else {\n this.style.gridTemplateRows = row\n .map((col) => \"minmax(\" + col + \", 1fr)\")\n .join(\" \");\n }\n }\n }\n\n #elements: FormElement[] = [];\n\n set elements(elements: FormElement[]) {\n for (let i = 0, n = elements.length; i < n; i++) {\n const comp = elements[i];\n if (comp instanceof FormValueWrite && comp.form_id) {\n if (this._value_elements.has(comp.form_id as string)) {\n console.error(\n \"Form element with form id \" +\n comp.form_id +\n \" already exists in group\",\n );\n continue;\n }\n this._value_elements.set(comp.form_id as string, comp);\n }\n this.#elements.push(this.appendChild(comp));\n }\n }\n\n /**All elements added to the group, also those without a form id*/\n get elements(): FormElement[] {\n return [...this.#elements];\n }\n}\ndefine_element(FormGroup);\n\n/**Creates a form group with elements */\nexport function form_group<\n L extends FormElement[],\n ID extends string | undefined,\n T extends object = Prettify<GroupToKeyVal<GroupExtractVals<L>>>,\n>(options?: FormGroupOptions<L, ID, T>): FormGroup<T, ID, L> {\n const group = new FormGroup<T, ID, L>(options?.id);\n if (options) {\n if (options.border) group.border = options.border;\n if (options.elements) group.elements = options.elements;\n if (options.max_height) group.max_height = options.max_height;\n if (options.embed) group.embed = options.embed;\n if (options.column) group.column = options.column;\n else if (options.row) group.row = options.row;\n FormValueWrite.apply_options(group, options);\n }\n return group;\n}\n","import { define_element } from \"#base\";\nimport { node_clone } from \"#dom\";\nimport {\n material_unfold_less_rounded,\n material_unfold_more_rounded,\n} from \"#icons\";\nimport {\n ANIMATION_LEVEL,\n ANIMATION_SPEED,\n AnimationLevels,\n} from \"#theme\";\nimport { FormElement, FormOptions } from \"../base\";\nimport { FormGroupBase } from \"./group_base\";\nimport \"./group_collapser.scss\";\n\nexport interface FormGroupCollapserOptions extends FormOptions {\n /**Wether the group is collapsed initially*/\n collapsed?: boolean;\n /**Text to show on the collapser when open*/\n opened_text?: string;\n /**Text to show on the collapser when closed*/\n closed_text?: string;\n}\n\nconst opened_text = document.createElement(\"span\");\nopened_text.textContent = \"Collapse\";\nconst closed_text = document.createElement(\"span\");\nclosed_text.textContent = \"Expand\";\n\n/**Component group class which allows to add elements and controls the flow of the elements*/\nexport class FormGroupCollapser extends FormElement {\n static element_name() {\n return \"group-collapser\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #group;\n #collapse_button;\n #collapsed: boolean = false;\n /**Running collapse or open animation, cancelled when the other one starts*/\n #animation?: Animation;\n #open_text = node_clone(opened_text);\n #close_text = node_clone(closed_text);\n\n constructor(group: FormGroupBase<any, any>, collapsed?: boolean) {\n super();\n this.#group = this.appendChild(group);\n if (collapsed) {\n this.classList.add(\"collapsed\");\n this.#collapsed = true;\n }\n this.#collapse_button = this.appendChild(document.createElement(\"span\"));\n this.#collapse_button.tabIndex = 0;\n this.#collapse_button.appendChild(\n collapsed ? this.#close_text : this.#open_text,\n );\n this.#collapse_button.appendChild(\n collapsed\n ? material_unfold_more_rounded()\n : material_unfold_less_rounded(),\n );\n this.#collapse_button.onclick = () => (this.collapsed = !this.collapsed);\n this.#collapse_button.onkeydown = (e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n this.collapsed = !this.collapsed;\n }\n };\n }\n\n set group(group: FormGroupBase<any, any>) {\n this.replaceChild(group, this.#group);\n this.#group = group;\n }\n\n get group(): FormGroupBase<any, any> {\n return this.#group;\n }\n\n set collapsed(collapsed: boolean) {\n if (collapsed && !this.#collapsed) {\n this.#animation?.cancel();\n //# Animation\n this.#collapse_button.replaceChildren(\n this.#close_text,\n material_unfold_more_rounded(),\n );\n if (ANIMATION_LEVEL.get().value === AnimationLevels.All) {\n this.#group.style.overflowY = \"auto\";\n const full_height = this.#group.getBoundingClientRect().height + \"px\";\n this.#animation = this.#group.animate(\n [\n { maxHeight: full_height },\n { maxHeight: \"0px\", paddingBlock: \"0px\" },\n ],\n {\n duration: ANIMATION_SPEED.get().value,\n easing: \"ease-in-out\",\n },\n );\n this.#animation.onfinish = () => {\n this.classList.add(\"collapsed\");\n this.#group.style.overflowY = \"\";\n };\n } else {\n this.classList.add(\"collapsed\");\n }\n } else if (!collapsed && this.#collapsed) {\n this.#animation?.cancel();\n this.classList.remove(\"collapsed\");\n this.#collapse_button.replaceChildren(\n this.#open_text,\n material_unfold_less_rounded(),\n );\n //# Animation\n if (ANIMATION_LEVEL.get().value === AnimationLevels.All) {\n this.#group.style.overflowY = \"auto\";\n const full_height = this.#group.getBoundingClientRect().height + \"px\";\n this.#animation = this.#group.animate(\n [\n { maxHeight: \"0px\", paddingBlock: \"0px\" },\n { maxHeight: full_height },\n ],\n {\n duration: ANIMATION_SPEED.get().value,\n easing: \"ease-in-out\",\n },\n );\n this.#animation.onfinish = () => (this.#group.style.overflowY = \"\");\n }\n }\n this.#collapsed = collapsed;\n }\n get collapsed(): boolean {\n return this.#collapsed;\n }\n\n set opened_text(text: string) {\n this.#open_text.textContent = text;\n }\n\n set closed_text(text: string) {\n this.#close_text.textContent = text;\n }\n}\ndefine_element(FormGroupCollapser);\n\n/**Creates a dropdown form element */\nexport function form_group_collapser(\n group: FormGroupBase<any, any>,\n options?: FormGroupCollapserOptions,\n): FormGroupCollapser {\n const slide = new FormGroupCollapser(group, options?.collapsed);\n if (options) {\n if (options.opened_text) slide.opened_text = options.opened_text;\n if (options.closed_text) slide.closed_text = options.closed_text;\n FormElement.apply_options(slide, options);\n }\n return slide;\n}\n","import { define_element } from \"#base\";\nimport { ListField } from \"#list\";\nimport { FormElement } from \"../base\";\nimport \"./list_field.scss\";\n\nexport class ListFormField<T extends FormElement> extends ListField {\n static element_name() {\n return \"listfield\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n set element(component: T) {\n this.replaceChildren(component);\n }\n\n get element(): T {\n return this.firstElementChild as T;\n }\n}\ndefine_element(ListFormField);\n\nexport function form_list_field<T extends FormElement>(element: T) {\n const field = new ListFormField<T>();\n field.element = element;\n return field;\n}\n","import { none } from \"@chocbite/ts-lib/result\";\nimport type { StateNumberRelated } from \"@chocbite/ts-lib/state\";\nimport type { SVGFunc } from \"#svg\";\nimport {\n FormValueWrite,\n FormValueWriteOptions,\n type FormValueOptions,\n} from \"../base\";\nimport \"./number_base.scss\";\n\nexport interface FormNumberOptions<\n ID extends string | undefined,\n RT = number,\n> extends FormValueOptions<RT, ID> {\n /**Lower limit for slider value*/\n min?: number;\n /**Upper limit for slider value*/\n max?: number;\n /**Amount of decimals to show*/\n decimals?: number;\n /**Unit to use for slider*/\n unit?: string;\n}\n\nexport interface FormNumberWriteOptions<\n ID extends string | undefined,\n RT = number,\n>\n extends FormNumberOptions<ID, RT>, FormValueWriteOptions<RT, ID> {\n /**Step size, use 0 for automatic step size*/\n step?: number;\n /**Start for step, use 0 for automatic */\n start?: number;\n}\n\nexport interface FormStepperBaseOptions<\n ID extends string | undefined,\n RT = number,\n> extends FormNumberWriteOptions<ID, RT> {\n /**wether the events are live as the slider is moved or only when moving stops */\n live?: boolean;\n /**Icon to use for decreasing value*/\n icon_decrease?: SVGFunc;\n /**Icon to use for increasing value*/\n icon_increase?: SVGFunc;\n}\n\nexport abstract class FormNumberWrite<\n ID extends string | undefined,\n RT = number,\n> extends FormValueWrite<RT, ID> {\n static apply_options<RT, ID extends string | undefined>(\n element: FormNumberWrite<ID, RT>,\n options: FormNumberWriteOptions<ID, RT>,\n ) {\n if (options.unit) element.unit = options.unit;\n if (options.decimals) element.decimals = options.decimals;\n if (options.min !== undefined) element.min = options.min;\n if (options.max !== undefined) element.max = options.max;\n if (options.step) element.step = options.step;\n if (options.start) element.start = options.start;\n super.apply_options(element, options);\n }\n\n /**Set the minimum value*/\n abstract set min(min: number | undefined);\n\n /**Set the minimum value*/\n abstract set max(max: number | undefined);\n\n /**Sets the size of number change steps*/\n abstract set step(step: number | undefined);\n\n /**Sets the start offset for number steps*/\n abstract set start(step: number | undefined);\n\n /**Sets the amount of decimals the element can have*/\n abstract set decimals(dec: number | undefined);\n\n /**Sets the unit of the element*/\n abstract set unit(unit: string | undefined);\n\n /**Related states of the last bound state, a prop is only reset when it followed one of them*/\n #related: Partial<StateNumberRelated> = {};\n\n protected state_related(related: Partial<StateNumberRelated>): void {\n const old = this.#related;\n this.#related = related;\n if (related.min)\n this.attach_state_to_prop(\"min\", related.min, () => none());\n else if (old.min) this.detach_state_from_prop(\"min\").min = undefined;\n if (related.max)\n this.attach_state_to_prop(\"max\", related.max, () => none());\n else if (old.max) this.detach_state_from_prop(\"max\").max = undefined;\n if (related.step)\n this.attach_state_to_prop(\"step\", related.step, () => none());\n else if (old.step) this.detach_state_from_prop(\"step\").step = undefined;\n if (related.start)\n this.attach_state_to_prop(\"start\", related.start, () => none());\n else if (old.start) this.detach_state_from_prop(\"start\").start = undefined;\n if (related.decimals)\n this.attach_state_to_prop(\"decimals\", related.decimals, () => none());\n else if (old.decimals)\n this.detach_state_from_prop(\"decimals\").decimals = undefined;\n if (related.unit)\n this.attach_state_to_prop(\"unit\", related.unit, () => none());\n else if (old.unit) this.detach_state_from_prop(\"unit\").unit = undefined;\n }\n}\n\n/**Decimals to show and round to, the given decimals, or without them enough for the step and start*/\nexport function number_decimals(\n decimals: number | undefined,\n step: number,\n start: number,\n): number {\n return decimals ?? Math.max(fraction_digits(step), fraction_digits(start));\n}\n\n/**Amount of decimals needed to show a number, at most 10*/\nfunction fraction_digits(val: number): number {\n let dec = 0;\n for (let scaled = val; dec < 10; dec++, scaled = val * 10 ** dec)\n if (Math.abs(scaled - Math.round(scaled)) < 1e-9) break;\n return dec;\n}\n","import { define_element } from \"#base\";\nimport { sync_resolve } from \"@chocbite/ts-lib/common\";\nimport { get_cursor_position, set_cursor_end, set_cursor_position, set_selection_all } from \"#selection\";\nimport { number_step_start_decimal } from \"@chocbite/ts-lib/math\";\nimport { err, type Result } from \"@chocbite/ts-lib/result\";\nimport {\n FormNumberWrite,\n number_decimals,\n type FormNumberWriteOptions,\n} from \"../number_base\";\nimport \"./number_input.scss\";\n\nexport class FormNumberInput<\n ID extends string | undefined,\n> extends FormNumberWrite<ID> {\n static element_name() {\n return \"numberinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #unit: string = \"\";\n #min: number = -Infinity;\n #max: number = Infinity;\n #step: number = 0;\n #start: number = 0;\n #decimals_set?: number;\n #decimals: number = 0;\n /**Text last drawn from a value, and whether the user typed since*/\n #shown: string = \"\";\n #edited: boolean = false;\n\n #value_box = this.appendChild(document.createElement(\"span\"));\n #unit_box = this.appendChild(document.createElement(\"span\"));\n #legend = this.appendChild(document.createElement(\"div\"));\n #max_legend = this.#legend.appendChild(document.createElement(\"span\"));\n #min_legend = this.#legend.appendChild(document.createElement(\"span\"));\n\n constructor(id?: ID) {\n super(id);\n this.appendChild(this.warn_input);\n this.#value_box.contentEditable = \"true\";\n this.onpointerdown = (e) => {\n this.selected = true;\n if (e.target !== this.#value_box) {\n e.preventDefault();\n set_cursor_end(this.#value_box);\n } else this.#value_box.focus();\n };\n this.#value_box.addEventListener(\"focusin\", (e) => {\n e.preventDefault();\n if (this.selected) return;\n set_selection_all(this.#value_box);\n this.selected = true;\n });\n this.#value_box.onblur = () => {\n this.selected = false;\n setTimeout(() => {\n this.#set(false);\n }, 0);\n };\n this.#value_box.oninput = () => (this.#edited = true);\n this.onkeydown = (e) => {\n if (e.key === \"Enter\") this.#set(true);\n else if (e.key === \"Escape\") {\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n } else if (e.key === \"ArrowUp\") this.#step_value(true);\n else if (e.key === \"ArrowDown\") this.#step_value(false);\n else return;\n e.preventDefault();\n e.stopPropagation();\n };\n this.onbeforeinput = (e) => {\n if (e.inputType === \"insertParagraph\") e.preventDefault();\n else if (e.data) {\n if (!/[\\d,.-]/g.test(e.data)) e.preventDefault();\n else if (/[,.]/g.test(e.data) && this.#decimals === 0)\n e.preventDefault();\n else if (this.#min >= 0 && /-/g.test(e.data)) e.preventDefault();\n }\n };\n }\n\n async #set(cur: boolean) {\n const text = this.#value_box.textContent || \"\";\n //Not edited, a value that arrived while focused is shown instead of writing the old text back\n if (!this.#edited && text === this.#shown) {\n const shown = this.buffer?.toFixed(this.#decimals);\n if (shown !== undefined && shown !== text) this.new_value(this.buffer!);\n return;\n }\n const sel = get_cursor_position(this.#value_box);\n const buff = this.buffer;\n (await this.set_value_check(parseFloat(text.replace(\",\", \".\")) || 0))\n .map_err(() => {\n this.new_value(buff || Math.max(Math.min(0, this.#max), this.#min));\n set_cursor_end(this.#value_box);\n })\n .map(() => {\n if (!cur) return;\n set_cursor_position(this.#value_box, sel);\n });\n }\n\n focus(options?: FocusOptions): void {\n this.#value_box.focus(options);\n }\n\n set unit(unit: string | undefined) {\n this.#unit = unit || \"\";\n this.#unit_box.textContent = this.#unit;\n }\n\n set decimals(dec: number | undefined) {\n this.#decimals_set = dec;\n this.#update_decimals();\n }\n\n /**Updates the decimals from the set decimals, step and start, and redraws with them*/\n #update_decimals() {\n const dec = number_decimals(this.#decimals_set, this.#step, this.#start);\n if (dec === this.#decimals) return;\n this.#decimals = dec;\n this.#update_min_legend();\n this.#update_max_lengend();\n if (this.buffer !== undefined && !this.selected)\n this.new_value(this.buffer);\n }\n\n set min(min: number | undefined) {\n this.#min = min ?? -Infinity;\n this.#update_min_legend();\n }\n #update_min_legend() {\n this.#min_legend.textContent =\n this.#min === -Infinity ? \"\" : \"Min:\" + this.#min.toFixed(this.#decimals);\n }\n\n set max(max: number | undefined) {\n this.#max = max ?? Infinity;\n this.#update_max_lengend();\n }\n #update_max_lengend() {\n this.#max_legend.textContent =\n this.#max === Infinity ? \"\" : \"Max:\" + this.#max.toFixed(this.#decimals);\n }\n\n set step(step: number | undefined) {\n this.#step = step || 0;\n this.#update_decimals();\n }\n\n set start(step: number | undefined) {\n this.#start = step || 0;\n this.#update_decimals();\n }\n\n protected new_value(val: number): void {\n this.#value_box.textContent = this.#shown = val.toFixed(this.#decimals);\n this.#edited = false;\n }\n\n protected clear_value(): void {\n this.#value_box.textContent = this.#shown = \"\";\n this.#edited = false;\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected limit_value(val: number): PromiseLike<Result<number, string>> {\n let lim = number_step_start_decimal(\n Math.min(Math.max(val, this.#min), this.#max),\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.limit_value(lim);\n }\n\n protected check_value(val: number): PromiseLike<Result<number, string>> {\n if (val < this.#min)\n return sync_resolve(\n err(\"Minimum value \" + this.#min.toFixed(this.#decimals) + this.#unit),\n );\n if (val > this.#max)\n return sync_resolve(\n err(\"Maximum value \" + this.#max.toFixed(this.#decimals) + this.#unit),\n );\n let lim = number_step_start_decimal(\n val,\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.check_value(lim);\n }\n\n #step_value(dir: boolean) {\n const step =\n this.#step ||\n Math.max(\n this.#decimals ? 10 ** -this.#decimals : 1,\n Math.floor(Math.abs(this.buffer || 0) / 150),\n );\n return this.set_value_check((this.buffer || 0) + (dir ? step : -step));\n }\n}\ndefine_element(FormNumberInput);\n\n/**Creates a number input form element */\nexport function form_number_input<ID extends string | undefined>(\n options?: FormNumberWriteOptions<ID>,\n): FormNumberInput<ID> {\n const input = new FormNumberInput<ID>(options?.id);\n if (options) {\n FormNumberWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport { none } from \"@chocbite/ts-lib/result\";\nimport type { StateNumberRelated } from \"@chocbite/ts-lib/state\";\nimport { FormValue } from \"../../base\";\nimport { type FormNumberOptions } from \"../number_base\";\nimport \"./progress.scss\";\n\nexport class FormProgress<ID extends string | undefined> extends FormValue<\n number,\n ID\n> {\n static element_name() {\n return \"progress\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #min: number = 0;\n #max: number = 100;\n #span: number = 100;\n #decimals: number = 0;\n #bar: HTMLDivElement = this.appendChild(document.createElement(\"div\"));\n #val: HTMLSpanElement = this.appendChild(document.createElement(\"span\"));\n #unit: HTMLSpanElement = this.appendChild(document.createElement(\"span\"));\n\n /**Set the minimum value*/\n set min(min: number) {\n this.#min = min;\n this.#span = this.#max - this.#min;\n this.#redraw();\n }\n\n /**Set the minimum value*/\n set max(max: number) {\n this.#max = max;\n this.#span = this.#max - this.#min;\n this.#redraw();\n }\n\n /**Sets the amount of decimals the element can have*/\n set decimals(dec: number | undefined) {\n this.#decimals = Math.max(dec ?? 0, 0);\n this.#redraw();\n }\n\n /**Sets the unit of the element*/\n set unit(unit: string | undefined) {\n this.#unit.textContent = unit ?? \"\";\n }\n\n /**Shows the value again, after a change to how it is shown*/\n #redraw(): void {\n if (this._buffer !== undefined) this.new_value(this._buffer);\n }\n\n protected new_value(value: number): void {\n this.#bar.style.width =\n Math.min(Math.max(((value - this.#min) / this.#span) * 100, 0), 100) +\n \"%\";\n this.#val.textContent = value.toFixed(this.#decimals);\n }\n\n protected clear_value(): void {\n this.#bar.style.width = \"0%\";\n this.#val.textContent = \"\";\n }\n\n protected new_error(err: string): void {\n console.error(err);\n }\n\n protected clear_error(): void {}\n\n /**Related states of the last bound state, a prop is only reset when it followed one of them*/\n #related: Partial<StateNumberRelated> = {};\n\n protected state_related(related: Partial<StateNumberRelated>): void {\n const old = this.#related;\n this.#related = related;\n if (related.min)\n this.attach_state_to_prop(\"min\", related.min, () => none());\n else if (old.min) this.detach_state_from_prop(\"min\").min = 0;\n if (related.max)\n this.attach_state_to_prop(\"max\", related.max, () => none());\n else if (old.max) this.detach_state_from_prop(\"max\").max = 100;\n if (related.decimals)\n this.attach_state_to_prop(\"decimals\", related.decimals, () => none());\n else if (old.decimals)\n this.detach_state_from_prop(\"decimals\").decimals = undefined;\n if (related.unit)\n this.attach_state_to_prop(\"unit\", related.unit, () => none());\n else if (old.unit) this.detach_state_from_prop(\"unit\").unit = undefined;\n }\n}\ndefine_element(FormProgress);\n\n/**Creates a progress form element */\nexport function form_progress<ID extends string | undefined>(\n options?: FormNumberOptions<ID>,\n): FormProgress<ID> {\n const prog = new FormProgress<ID>(options?.id);\n if (options) {\n if (typeof options.min !== \"undefined\") prog.min = options.min;\n if (typeof options.max !== \"undefined\") prog.max = options.max;\n prog.decimals = options.decimals;\n prog.unit = options.unit;\n FormValue.apply_options(prog, options);\n }\n return prog;\n}\n","import { define_element } from \"#base\";\nimport { sync_resolve } from \"@chocbite/ts-lib/common\";\nimport {\n material_add_rounded,\n material_remove_rounded,\n} from \"#icons\";\nimport { number_step_start_decimal } from \"@chocbite/ts-lib/math\";\nimport { err, type Result } from \"@chocbite/ts-lib/result\";\nimport type { SVGFunc } from \"#svg\";\nimport {\n FormNumberWrite,\n number_decimals,\n type FormStepperBaseOptions,\n} from \"../number_base\";\nimport \"./slider.scss\";\n\n/**Slide Selector, displays all options in a slider*/\nexport class FormSlider<ID extends string | undefined> extends FormNumberWrite<\n ID,\n number\n> {\n static element_name() {\n return \"slider\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #unit: string = \"\";\n #decimals_set?: number;\n #decimals: number = 0;\n #min: number = -Infinity;\n #max: number = Infinity;\n #span: number = Infinity;\n #step: number = 0;\n #start: number = 0;\n #live: boolean = false;\n #icon_dec = this.#stepper_func(\n this.appendChild(material_remove_rounded()),\n false,\n );\n #slide = this.appendChild(document.createElement(\"div\"));\n #legend = this.appendChild(document.createElement(\"span\"));\n #left_legend = this.#legend.appendChild(document.createElement(\"span\"));\n #right_legend = this.#legend.appendChild(document.createElement(\"span\"));\n #icon_inc = this.#stepper_func(\n this.appendChild(material_add_rounded()),\n true,\n );\n #slider = this.#slide.appendChild(document.createElement(\"div\"));\n #value_box = this.#slider.appendChild(document.createElement(\"span\"));\n #unit_box = this.#slider.appendChild(document.createElement(\"span\"));\n\n constructor(id?: ID) {\n super(id);\n this.#slider.setAttribute(\"tabindex\", \"0\");\n this.appendChild(this.warn_input);\n\n this.onpointerdown = (e) => {\n if (e.button !== 0) return;\n if (e.pointerType !== \"mouse\" && !this.#slider.contains(e.target as Node))\n return;\n e.stopPropagation();\n this.#slider.classList.add(\"active\");\n this.selected = true;\n const box = this.#slider.getBoundingClientRect();\n const offset = this.#slider.contains(e.target as Node)\n ? e.clientX >= box.x\n ? e.clientX <= box.x + box.width\n ? box.x - e.clientX\n : -box.width\n : 0\n : -box.width / 2;\n if (this.#min === -Infinity || this.#max === Infinity) {\n let value = this.buffer || 0;\n const interval = setInterval(async () => {\n const val = (value += diff / 50);\n if (this.#live)\n (await this.set_value_limit(val)).map((v) => (value = v));\n else {\n (await this.limit_value(val)).map((v) => {\n this.#move_value(v);\n value = v;\n });\n }\n }, 100);\n let diff = this.#x_to_perc(e.clientX + offset) - 50;\n this.#move_slide(this.#x_to_perc(e.clientX + offset));\n this.#slider.setPointerCapture(e.pointerId);\n this.#slider.onpointermove = (ev) => {\n ev.stopPropagation();\n const perc = this.#x_to_perc(ev.clientX + offset);\n diff = (this.#step || 1) * ((perc - 50) * 2);\n this.#move_slide(perc);\n };\n const reset = () => {\n this.#slider.classList.remove(\"active\");\n this.selected = false;\n this.#slider.releasePointerCapture(e.pointerId);\n this.#slider.onpointermove = null;\n this.#slider.onpointerup = null;\n this.#slider.onpointercancel = null;\n this.#slider.onkeydown = null;\n this.#move_slide(50);\n clearInterval(interval);\n };\n this.#slider.onpointerup = (ev) => {\n ev.stopPropagation();\n reset();\n if (!this.#live) this.set_value_limit(value);\n };\n //A cancelled drag, like a touch turning into a scroll, is undone like Escape\n this.#slider.onpointercancel = () => {\n reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n };\n this.#slider.onkeydown = (e) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n }\n };\n } else {\n const value = this.buffer || 0;\n this.#move_absolute(e.clientX + offset);\n this.#slider.setPointerCapture(e.pointerId);\n this.#slider.onpointermove = (ev) => {\n ev.stopPropagation();\n this.#move_absolute(ev.clientX + offset);\n };\n const reset = () => {\n this.#slider.classList.remove(\"active\");\n this.selected = false;\n this.#slider.releasePointerCapture(e.pointerId);\n this.#slider.onpointermove = null;\n this.#slider.onpointerup = null;\n this.#slider.onpointercancel = null;\n this.#slider.onkeydown = null;\n };\n this.#slider.onpointerup = (ev) => {\n ev.stopPropagation();\n reset();\n this.#move_absolute(ev.clientX + offset, value);\n };\n //A cancelled drag, like a touch turning into a scroll, is undone like Escape\n this.#slider.onpointercancel = () => {\n reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n };\n this.#slider.onkeydown = (e) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n }\n };\n }\n };\n this.#slide.onkeydown = (e) => {\n if (e.key === \"ArrowRight\") this.#step_value(true);\n else if (e.key === \"ArrowLeft\") this.#step_value(false);\n else return;\n e.preventDefault();\n e.stopPropagation();\n };\n }\n\n focus(options?: FocusOptions): void {\n this.#slider.focus(options);\n }\n\n set unit(unit: string | undefined) {\n this.#unit = unit || \"\";\n this.#unit_box.textContent = this.#unit;\n }\n\n set min(min: number | undefined) {\n this.#min = min ?? -Infinity;\n this.#update_min_max();\n this.#update_min_legend();\n }\n #update_min_legend() {\n this.#left_legend.textContent =\n this.#min === -Infinity ? \"\" : \"Min:\" + this.#min.toFixed(this.#decimals);\n }\n\n set max(max: number | undefined) {\n this.#max = max ?? Infinity;\n this.#update_min_max();\n this.#update_max_legend();\n }\n\n #update_max_legend() {\n this.#right_legend.textContent =\n this.#max === Infinity ? \"\" : this.#max.toFixed(this.#decimals) + \":Max\";\n }\n\n #update_min_max() {\n this.#span = this.#max - this.#min;\n if (this.#span === Infinity) this.#move_slide(50);\n else if (this.buffer !== undefined) this.new_value(this.buffer);\n }\n\n set decimals(dec: number | undefined) {\n this.#decimals_set = dec;\n this.#update_decimals();\n }\n\n set step(step: number | undefined) {\n this.#step = step || 0;\n this.#update_decimals();\n }\n\n set start(step: number | undefined) {\n this.#start = step || 0;\n this.#update_decimals();\n }\n\n /**Updates the decimals from the set decimals, step and start, and redraws with them*/\n #update_decimals() {\n const dec = number_decimals(this.#decimals_set, this.#step, this.#start);\n if (dec === this.#decimals) return;\n this.#decimals = dec;\n this.#update_min_legend();\n this.#update_max_legend();\n if (this.buffer !== undefined && !this.selected)\n this.new_value(this.buffer);\n }\n\n /**Set wether the slider is in live mode*/\n set live(live: boolean | undefined) {\n this.#live = live || false;\n }\n\n set icon_decrease(icon: SVGFunc | undefined) {\n const old = this.#icon_dec;\n this.#icon_dec = this.#stepper_func(\n icon ? icon() : material_remove_rounded(),\n false,\n );\n this.replaceChild(this.#icon_dec, old);\n }\n\n set icon_increase(icon: SVGFunc | undefined) {\n const old = this.#icon_inc;\n this.#icon_inc = this.#stepper_func(\n icon ? icon() : material_add_rounded(),\n true,\n );\n this.replaceChild(this.#icon_inc, old);\n }\n\n protected new_value(value: number): void {\n this.#move_value(value);\n //Without both limits the handle stays centered\n this.#move_slide(\n this.#span === Infinity\n ? 50\n : Math.min(Math.max(((-this.#min + value) / this.#span) * 100, 0), 100),\n );\n }\n\n protected clear_value(): void {\n this.#value_box.textContent = \"\";\n this.#move_slide(50);\n }\n\n protected new_error(err: string): void {\n console.error(err);\n }\n\n protected clear_error(): void {}\n\n protected limit_value(val: number): PromiseLike<Result<number, string>> {\n let lim = number_step_start_decimal(\n Math.min(Math.max(val, this.#min), this.#max),\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.limit_value(lim);\n }\n\n protected check_value(val: number): PromiseLike<Result<number, string>> {\n if (val < this.#min)\n return sync_resolve(\n err(\"Minimum value \" + this.#min.toFixed(this.#decimals) + this.#unit),\n );\n if (val > this.#max)\n return sync_resolve(\n err(\"Maximum value \" + this.#max.toFixed(this.#decimals) + this.#unit),\n );\n let lim = number_step_start_decimal(\n val,\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.check_value(lim);\n }\n\n async #move_absolute(x: number, last?: number) {\n const perc = this.#x_to_perc(x);\n if (this.#live) this.set_value_limit(this.#perc_to_value(perc));\n else {\n if (last === undefined) {\n const value = await this.limit_value(this.#perc_to_value(perc));\n if (value.ok) {\n this.#move_slide(((-this.#min + value.value) / this.#span) * 100);\n this.#move_value(value.value);\n }\n } else {\n this.set_value_limit(this.#perc_to_value(perc));\n }\n }\n }\n\n #x_to_perc(x: number) {\n const box = this.#slide.getBoundingClientRect();\n return Math.min(100, Math.max(0, ((x - box.x) / box.width) * 100));\n }\n\n #perc_to_value(perc: number) {\n return (perc / 100) * this.#span + this.#min;\n }\n\n /**Attaches click action to over time increase speed of stepping when holding step buttons */\n #stepper_func(icon: SVGSVGElement, dir: boolean) {\n icon.onpointerdown = (e) => {\n if (e.button === 0) {\n e.stopPropagation();\n let interval = 0;\n let scaler_interval = 0;\n let scaler = 250;\n const release = () => {\n clearInterval(interval);\n clearInterval(scaler_interval);\n clearTimeout(timeout);\n icon.onpointerup = null;\n icon.onpointercancel = null;\n icon.releasePointerCapture(e.pointerId);\n icon.classList.remove(\"active\");\n };\n icon.setPointerCapture(e.pointerId);\n icon.classList.add(\"active\");\n const timeout = setTimeout(() => {\n this.#step_value(dir);\n interval = setInterval(() => this.#step_value(dir), scaler);\n scaler_interval = setInterval(() => {\n if (scaler > 20) scaler /= 1.1;\n clearInterval(interval);\n interval = setInterval(() => this.#step_value(dir), scaler);\n }, 1000);\n }, 500);\n icon.onpointerup = () => {\n if (interval === 0) this.#step_value(dir);\n release();\n };\n icon.onpointercancel = release;\n }\n };\n return icon;\n }\n\n #step_value(dir: boolean) {\n const step =\n this.#step ||\n Math.max(\n this.#decimals ? 10 ** -this.#decimals : 1,\n Math.floor(Math.abs(this.buffer || 0) / 150),\n );\n return this.set_value_check((this.buffer || 0) + (dir ? step : -step));\n }\n\n #move_slide(perc: number) {\n this.#slider.style.left = perc + \"%\";\n }\n #move_value(value: number) {\n this.#value_box.textContent = value.toFixed(this.#decimals);\n }\n}\ndefine_element(FormSlider);\n\n/**Creates a dropdown form element */\nexport function form_slider<ID extends string | undefined>(\n options?: FormStepperBaseOptions<ID>,\n): FormSlider<ID> {\n const slide = new FormSlider<ID>(options?.id);\n if (options) {\n if (options.live) slide.live = options.live;\n if (options.icon_decrease) slide.icon_decrease = options.icon_decrease;\n if (options.icon_increase) slide.icon_increase = options.icon_increase;\n FormNumberWrite.apply_options(slide, options);\n }\n return slide;\n}\n","import { define_element } from \"#base\";\nimport { sleep, sync_resolve } from \"@chocbite/ts-lib/common\";\nimport {\n material_add_rounded,\n material_remove_rounded,\n} from \"#icons\";\nimport { number_step_start_decimal } from \"@chocbite/ts-lib/math\";\nimport { err, type Result } from \"@chocbite/ts-lib/result\";\nimport { set_cursor_end } from \"#selection\";\nimport type { SVGFunc } from \"#svg\";\nimport {\n FormNumberWrite,\n number_decimals,\n type FormStepperBaseOptions,\n} from \"../number_base\";\nimport \"./stepper.scss\";\n\n/**Slide Selector, displays all options in a slider*/\nexport class FormStepper<ID extends string | undefined> extends FormNumberWrite<\n ID,\n number\n> {\n static element_name() {\n return \"stepper\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #unit: string = \"\";\n #decimals_set?: number;\n #decimals: number = 0;\n /**Text last drawn from a value, and whether the user typed since*/\n #shown: string = \"\";\n #edited: boolean = false;\n #min: number = -Infinity;\n #max: number = Infinity;\n #step: number = 0;\n #start: number = 0;\n #live: boolean = false;\n #icon_dec = this.#stepper_func(\n this.appendChild(material_remove_rounded()),\n false,\n );\n #text = this.appendChild(document.createElement(\"span\"));\n #icon_inc = this.#stepper_func(\n this.appendChild(material_add_rounded()),\n true,\n );\n #value_box = this.#text.appendChild(document.createElement(\"span\"));\n #unit_box = this.#text.appendChild(document.createElement(\"span\"));\n #legend = this.#text.appendChild(document.createElement(\"span\"));\n #max_legend = this.#legend.appendChild(document.createElement(\"span\"));\n #min_legend = this.#legend.appendChild(document.createElement(\"span\"));\n\n constructor(id?: ID) {\n super(id);\n this.setAttribute(\"tabindex\", \"0\");\n this.appendChild(this.warn_input);\n\n this.#value_box.setAttribute(\"tabindex\", \"-1\");\n this.#value_box.contentEditable = \"true\";\n this.#value_box.onfocus = async () => {\n this.selected = true;\n };\n this.#value_box.onblur = async () => {\n this.selected = false;\n await sleep(0);\n const text = this.#value_box.textContent || \"\";\n //Not edited, a value that arrived while focused is shown instead of writing the old text back\n if (!this.#edited && text === this.#shown) {\n if (this.buffer !== undefined) this.new_value(this.buffer);\n } else this.set_value_check(parseFloat(text.replace(\",\", \".\")) || 0);\n };\n this.#value_box.oninput = () => (this.#edited = true);\n this.#value_box.onpointerdown = () => {\n this.selected = true;\n };\n let pointer_id: number | undefined;\n const reset = () => {\n this.selected = false;\n this.#value_box.contentEditable = \"true\";\n if (pointer_id !== undefined) {\n this.#text.releasePointerCapture(pointer_id);\n pointer_id = undefined;\n }\n this.#text.onpointermove = null;\n this.#text.onpointerup = null;\n this.#text.onpointercancel = null;\n };\n this.#text.onpointerdown = (e) => {\n if (e.button === 0 && !this.selected) {\n e.stopPropagation();\n this.selected = true;\n const initial_val = this.buffer || 0;\n let moving = false;\n this.#text.setPointerCapture(e.pointerId);\n pointer_id = e.pointerId;\n this.#text.onpointermove = (ev) => {\n ev.stopPropagation();\n if (moving) {\n this.#move_diff(\n initial_val + ((ev.clientX - e.clientX) / 10) * (this.#step || 1),\n );\n } else if (Math.abs(e.clientX - ev.clientX) > 5) {\n this.#value_box.contentEditable = \"false\";\n moving = true;\n }\n };\n this.#text.onpointerup = (ev) => {\n ev.stopPropagation();\n reset();\n if (!moving && e.target !== this.#value_box) {\n set_cursor_end(this.#value_box);\n } else if (moving) {\n this.#move_diff(\n initial_val + ((ev.clientX - e.clientX) / 10) * (this.#step || 1),\n true,\n );\n moving = false;\n }\n };\n //A cancelled drag, like a touch turning into a scroll, is undone like Escape\n this.#text.onpointercancel = () => {\n reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n };\n }\n };\n\n this.onkeydown = (e) => {\n if (e.key === \"ArrowRight\" || e.key === \"ArrowLeft\") {\n e.preventDefault();\n e.stopPropagation();\n this.#step_value(e.key === \"ArrowRight\");\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n if (reset) reset();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n } else {\n if (\n this.ownerDocument.activeElement !== this.#value_box &&\n /[\\d,.-]/g.test(e.key)\n ) {\n this.#value_box.textContent = \"\";\n this.#value_box.focus();\n }\n }\n };\n this.#value_box.onkeydown = (e) => {\n if (e.key === \"Enter\") {\n HTMLElement.prototype.focus.call(this);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n if (this.buffer !== undefined) this.new_value(this.buffer);\n else this.clear_value();\n } else if (e.key === \"ArrowRight\" || e.key === \"ArrowLeft\")\n e.stopPropagation();\n };\n this.#value_box.onbeforeinput = (e) => {\n if (e.inputType === \"insertParagraph\") e.preventDefault();\n if (e.data) {\n if (!/[\\d,.-]/g.test(e.data)) e.preventDefault();\n else if (/[,.]/g.test(e.data) && this.#decimals === 0)\n e.preventDefault();\n else if (\n /-/g.test(e.data) &&\n (this.#min >= 0 || this.#value_box.textContent?.includes(\"-\"))\n )\n e.preventDefault();\n }\n };\n }\n\n focus(options?: FocusOptions): void {\n this.#value_box.focus(options);\n }\n\n set unit(unit: string | undefined) {\n this.#unit = unit || \"\";\n this.#unit_box.textContent = this.#unit;\n }\n\n set decimals(dec: number | undefined) {\n this.#decimals_set = dec;\n this.#update_decimals();\n }\n\n /**Updates the decimals from the set decimals, step and start, and redraws with them*/\n #update_decimals() {\n const dec = number_decimals(this.#decimals_set, this.#step, this.#start);\n if (dec === this.#decimals) return;\n this.#decimals = dec;\n this.#update_min_legend();\n this.#update_max_lengend();\n if (this.buffer !== undefined && !this.selected)\n this.new_value(this.buffer);\n }\n\n set min(min: number | undefined) {\n this.#min = min ?? -Infinity;\n this.#update_min_legend();\n }\n #update_min_legend() {\n this.#min_legend.textContent =\n this.#min === -Infinity ? \"\" : \"Min:\" + this.#min.toFixed(this.#decimals);\n }\n\n set max(max: number | undefined) {\n this.#max = max ?? Infinity;\n this.#update_max_lengend();\n }\n #update_max_lengend() {\n this.#max_legend.textContent =\n this.#max === Infinity ? \"\" : \"Max:\" + this.#max.toFixed(this.#decimals);\n }\n\n set step(step: number | undefined) {\n this.#step = step || 0;\n this.#update_decimals();\n }\n\n set start(step: number | undefined) {\n this.#start = step || 0;\n this.#update_decimals();\n }\n\n /**Set wether the slider is in live mode*/\n set live(live: boolean | undefined) {\n this.#live = live || false;\n }\n\n set icon_decrease(icon: SVGFunc | undefined) {\n const old = this.#icon_dec;\n this.#icon_dec = this.#stepper_func(\n icon ? icon() : material_remove_rounded(),\n false,\n );\n this.replaceChild(this.#icon_dec, old);\n }\n\n set icon_increase(icon: SVGFunc | undefined) {\n const old = this.#icon_inc;\n this.#icon_inc = this.#stepper_func(\n icon ? icon() : material_add_rounded(),\n true,\n );\n this.replaceChild(this.#icon_inc, old);\n }\n\n protected new_value(value: number) {\n this.#value_box.textContent = this.#shown = value.toFixed(this.#decimals);\n this.#edited = false;\n }\n\n protected clear_value(): void {\n this.#value_box.textContent = this.#shown = \"\";\n this.#edited = false;\n }\n\n protected new_error(err: string): void {\n console.error(err);\n }\n\n protected clear_error(): void {}\n\n protected limit_value(val: number): PromiseLike<Result<number, string>> {\n let lim = number_step_start_decimal(\n Math.min(Math.max(val, this.#min), this.#max),\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.limit_value(lim);\n }\n\n protected check_value(val: number): PromiseLike<Result<number, string>> {\n if (val < this.#min)\n return sync_resolve(\n err(\"Minimum value \" + this.#min.toFixed(this.#decimals) + this.#unit),\n );\n if (val > this.#max)\n return sync_resolve(\n err(\"Maximum value \" + this.#max.toFixed(this.#decimals) + this.#unit),\n );\n let lim = number_step_start_decimal(\n val,\n this.#step,\n this.#start,\n this.#decimals,\n );\n if (lim < this.#min) lim += this.#step;\n if (lim > this.#max) lim -= this.#step;\n return super.check_value(lim);\n }\n\n /**Moves the value to a position by the mouse x coordinates*/\n async #move_diff(value: number, last: boolean = false) {\n if (this.#live) this.set_value_limit(value);\n else {\n if (last) this.set_value_limit(value);\n else {\n const lim = await this.limit_value(value);\n if (lim.ok) this.#move_value(lim.value);\n }\n }\n }\n\n /**Moves the slider to the given percent position*/\n #move_value(value: number) {\n this.#value_box.textContent = value.toFixed(this.#decimals);\n }\n\n /**Attaches click action to over time increase speed of stepping when holding step buttons */\n #stepper_func(icon: SVGSVGElement, dir: boolean) {\n icon.onpointerdown = (e) => {\n if (e.button === 0) {\n e.stopPropagation();\n let interval = 0;\n let scaler_interval = 0;\n let scaler = 250;\n const release = () => {\n clearInterval(interval);\n clearInterval(scaler_interval);\n clearTimeout(timeout);\n icon.onpointerup = null;\n icon.onpointercancel = null;\n icon.releasePointerCapture(e.pointerId);\n icon.classList.remove(\"active\");\n };\n icon.setPointerCapture(e.pointerId);\n icon.classList.add(\"active\");\n const timeout = setTimeout(() => {\n this.#step_value(dir);\n interval = setInterval(() => this.#step_value(dir), scaler);\n scaler_interval = setInterval(() => {\n if (scaler > 20) scaler /= 1.1;\n clearInterval(interval);\n interval = setInterval(() => this.#step_value(dir), scaler);\n }, 1000);\n }, 500);\n icon.onpointerup = () => {\n if (interval === 0) this.#step_value(dir);\n release();\n };\n icon.onpointercancel = release;\n }\n };\n return icon;\n }\n\n #step_value(dir: boolean) {\n const step =\n this.#step ||\n Math.max(\n this.#decimals ? 10 ** -this.#decimals : 1,\n Math.floor(Math.abs(this.buffer || 0) / 150),\n );\n return this.set_value_check((this.buffer || 0) + (dir ? step : -step));\n }\n}\ndefine_element(FormStepper);\n\n/**Creates a dropdown form element */\nexport function form_stepper<ID extends string | undefined>(\n options?: FormStepperBaseOptions<ID>,\n): FormStepper<ID> {\n const slide = new FormStepper<ID>(options?.id);\n if (options) {\n if (options.live) slide.live = options.live;\n if (options.icon_decrease) slide.icon_decrease = options.icon_decrease;\n if (options.icon_increase) slide.icon_increase = options.icon_increase;\n FormNumberWrite.apply_options(slide, options);\n }\n return slide;\n}\n","import { some } from \"@chocbite/ts-lib/result\";\nimport state, { type StateEnumRelated } from \"@chocbite/ts-lib/state\";\nimport type { SVGFunc } from \"#svg\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../base\";\n\nexport interface FormSelectorOption<RT> {\n /**Value to set when option is selected */\n value: RT;\n /**Text for selection */\n text: string;\n /**Icon to display for option*/\n icon?: SVGFunc;\n}\n\n/**Selection options for a form selector */\nexport type FormSelections<T> = FormSelectorOption<T>[];\n\nexport interface FormSelectorBaseOptions<\n T,\n ID extends string | undefined,\n> extends FormValueWriteOptions<T, ID> {\n /**Options for selector*/\n selections?: FormSelections<T>;\n}\n\n/**Base for number elements elements*/\nexport abstract class FormSelectorBase<\n RT,\n ID extends string | undefined,\n> extends FormValueWrite<RT, ID> {\n /**Sets the selection options for the selector */\n abstract set selections(selections: FormSelections<RT> | undefined);\n\n static apply_options<RT, ID extends string | undefined>(\n element: FormSelectorBase<RT, ID>,\n options: FormSelectorBaseOptions<RT, ID>,\n ) {\n if (options.selections) element.selections = options.selections;\n super.apply_options(element, options);\n }\n\n //True while the selections come from the list of the bound state\n #related_list = false;\n\n protected state_related(related: Partial<StateEnumRelated>): void {\n if (related.list) {\n this.attach_state_to_prop_map(\n \"selections\",\n related.list,\n () => some([]),\n (val) => {\n return some(\n state.e.map(val, (key, val) => {\n return {\n text: val.name,\n value: key as RT,\n icon: val.icon,\n };\n }),\n );\n },\n );\n } else if (this.#related_list)\n this.detach_state_from_prop(\"selections\").selections = undefined;\n this.#related_list = !!related.list;\n }\n}\n","import { Base, define_element } from \"#base\";\nimport { DOCUMENT_HANDLER } from \"#document\";\nimport {\n material_close_rounded,\n material_keyboard_arrow_down_rounded,\n material_unfold_less_rounded,\n} from \"#icons\";\nimport type { SVGFunc } from \"#svg\";\nimport {\n FormSelectorBase,\n type FormSelectorBaseOptions,\n type FormSelectorOption,\n} from \"../selector_base\";\nimport \"./drop_down.scss\";\n\nexport interface FormDropDownSelection {\n text: string;\n icon?: SVGFunc;\n}\n\nexport interface FormDropDownOptions<\n RT,\n ID extends string | undefined,\n> extends FormSelectorBaseOptions<RT, ID> {\n /**Default text displayed*/\n default?: string;\n /**Default icon displayed*/\n default_icon?: SVGFunc;\n}\n\n/**Dropdown box for selecting between multiple choices in a small space*/\nexport class FormDropdown<\n RT,\n ID extends string | undefined,\n> extends FormSelectorBase<RT, ID> {\n static element_name() {\n return \"dropdown\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #map: Map<RT, FormDropDownSelection> = new Map();\n #values: RT[] = [];\n #selected: number = -1;\n\n #icon?: SVGSVGElement;\n #text: HTMLDivElement = this.appendChild(document.createElement(\"div\"));\n #open: SVGSVGElement = this.appendChild(\n material_keyboard_arrow_down_rounded(),\n );\n #default: Text = document.createTextNode(\"Select something\");\n #default_icon?: SVGFunc;\n /**Popup of the document the dropdown was opened in*/\n #box?: DropDownBox;\n private is_open: boolean = false;\n\n constructor(id?: ID) {\n super(id);\n this.#text.append(this.#default);\n this.appendChild(this.warn_input);\n this.tabIndex = 0;\n this.onclick = () => (this.open = true);\n this.onpointerdown = (e) => {\n if (e.pointerType === \"mouse\") {\n this.open = true;\n e.preventDefault();\n }\n };\n this.onkeydown = (e) => {\n switch (e.key) {\n case \" \":\n case \"Enter\":\n e.preventDefault();\n this.open = true;\n break;\n case \"ArrowDown\":\n case \"ArrowUp\":\n e.preventDefault();\n e.stopPropagation();\n this.#select_adjacent(e.key === \"ArrowDown\");\n break;\n }\n };\n }\n\n focus(options?: FocusOptions): void {\n HTMLElement.prototype.focus.call(this, options);\n }\n\n /**Gets the default text displayed when nothing has been selected yet */\n get default() {\n return this.#default.nodeValue || \"\";\n }\n\n /**Sets the default text displayed when nothing has been selected yet */\n set default(def: string) {\n this.#default.nodeValue = def;\n }\n\n /**Sets the default text displayed when nothing has been selected yet */\n set default_icon(def: SVGFunc | undefined) {\n this.#default_icon = def;\n if (def && this.#selected === -1) this.#set_icon = def;\n }\n\n set selections(selections: FormSelectorOption<RT>[] | undefined) {\n this.open = false;\n if (this.#map.size > 0) {\n this.#map.clear();\n this.#values = [];\n this.#selected = -1;\n }\n for (let i = 0; selections && i < selections.length; i++) {\n const { value, text, icon } = selections[i];\n this.#map.set(value, { text, icon });\n this.#values.push(value);\n }\n if (this.buffer !== undefined) this.new_value(this.buffer);\n }\n\n set open(open: boolean) {\n if (open && !this.is_open) {\n const old = this.#open;\n this.#open = material_unfold_less_rounded();\n old.replaceWith(this.#open);\n this.#box = boxes.get(this.ownerDocument) ?? main_box;\n this.#box.open_menu(this.#map, this, this.buffer);\n } else if (!open && this.is_open) {\n const old = this.#open;\n this.#open = material_keyboard_arrow_down_rounded();\n old.replaceWith(this.#open);\n this.#box?.close_menu();\n }\n this.is_open = open;\n }\n\n /**Changes the icon of the button*/\n set #set_icon(icon: SVGFunc | undefined) {\n if (icon) {\n const i = icon();\n if (this.#icon) this.replaceChild(i, this.#icon);\n else this.insertBefore(i, this.#text);\n this.#icon = i;\n } else if (this.#icon) {\n this.removeChild(this.#icon);\n this.#icon = undefined;\n }\n }\n\n /**Selects the previous or next selection in the element\n * @param dir false is next true is previous*/\n #select_adjacent(dir: boolean) {\n const y = Math.min(\n this.#values.length - 1,\n Math.max(0, dir ? this.#selected + 1 : this.#selected - 1),\n );\n if (y !== this.#selected) this.set_value_check(this.#values[y]);\n }\n\n #clear() {\n this.default_icon = this.#default_icon\n ? (this.#set_icon = this.#default_icon)\n : (this.#set_icon = undefined);\n this.#text.replaceChildren(this.#default);\n }\n\n /**Called when Value is changed */\n protected new_value(value: RT) {\n if (!this.#map.has(value)) {\n this.#clear();\n this.#selected = -1;\n return;\n }\n const opt = this.#map.get(value)!;\n this.#text.innerText = opt.text;\n this.#selected = this.#values.indexOf(value);\n if (opt.icon) this.#set_icon = opt.icon;\n else this.#set_icon = undefined;\n }\n\n protected clear_value(): void {\n this.#clear();\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n warn(message: string): void {\n setTimeout(() => {\n super.warn(message);\n }, 0);\n }\n}\ndefine_element(FormDropdown);\n\n/**Creates a dropdown form element */\nexport function form_dropdown<RT, ID extends string | undefined>(\n options?: FormDropDownOptions<RT, ID>,\n): FormDropdown<RT, ID> {\n const drop = new FormDropdown<RT, ID>(options?.id);\n if (options) {\n if (options.default) drop.default = options.default;\n if (options.default_icon) drop.default_icon = options.default_icon;\n FormSelectorBase.apply_options(drop, options);\n }\n return drop;\n}\n\n///##################################################################################################\nclass DropDownBox extends Base {\n static element_name() {\n return \"dropdownbox\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #closer: HTMLDivElement = document.createElement(\"div\");\n #container: HTMLDivElement = this.appendChild(document.createElement(\"div\"));\n #scroll: HTMLDivElement = this.#container.appendChild(\n document.createElement(\"div\"),\n );\n #table: HTMLDivElement = this.#scroll.appendChild(\n document.createElement(\"div\"),\n );\n #dropdown: FormDropdown<any, any> | undefined;\n #focus_out_handler = (e: FocusEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (!e.relatedTarget || !this.contains(e.relatedTarget as Node))\n this.close_menu();\n };\n #window_resize_handler = () => this.close_menu();\n #is_open: boolean = false;\n\n constructor() {\n super();\n this.#container.tabIndex = 0;\n this.#container.onkeydown = (e) => {\n if (e.key === \"Escape\") this.close_menu();\n else if (e.key === \"ArrowUp\" || (e.shiftKey && e.key === \"Tab\")) {\n const elem =\n e.target === this.#container\n ? this.#table.lastElementChild\n : (e.target as HTMLElement).previousElementSibling;\n if (elem) (elem as HTMLElement).focus();\n } else if (e.key === \"ArrowDown\" || e.key === \"Tab\") {\n const elem =\n e.target === this.#container\n ? this.#table.firstElementChild\n : (e.target as HTMLElement).nextElementSibling;\n if (elem) (elem as HTMLElement).focus();\n } else {\n return;\n }\n e.stopPropagation();\n e.preventDefault();\n };\n\n this.#closer\n .appendChild(document.createElement(\"div\"))\n .appendChild(material_close_rounded());\n this.#closer.appendChild(document.createElement(\"div\")).textContent =\n \"Close\";\n this.#closer.tabIndex = 0;\n this.#closer.onclick = (e) => {\n e.stopPropagation();\n e.preventDefault();\n this.close_menu();\n };\n this.#closer.onkeydown = (e) => {\n if (e.key === \" \" || e.key === \"Enter\") {\n e.stopPropagation();\n e.preventDefault();\n this.close_menu();\n }\n };\n\n this.addEventListener(\"focusout\", this.#focus_out_handler, {\n capture: true,\n });\n }\n\n #set_value(value: unknown) {\n //@ts-expect-error Call private method from sister class\n if (this.#dropdown) this.#dropdown.set_value_check(value);\n this.close_menu();\n }\n\n open_menu(\n map: Map<any, FormDropDownSelection>,\n parent: FormDropdown<any, any>,\n value: any,\n ) {\n //Another dropdown opening closes the open one, without focusing it\n if (this.#is_open) this.close_menu(false);\n const inner_height = this.ownerDocument.defaultView?.innerHeight || 0;\n this.classList.add(\"open\");\n const bounds = parent.getBoundingClientRect();\n if (bounds.y + bounds.height / 2 < inner_height / 2) {\n const top = bounds.y + bounds.height;\n this.#container.style.top = top + \"px\";\n this.#container.style.bottom = \"\";\n this.#container.style.maxHeight = inner_height - top - 10 + \"px\";\n this.#container.style.flexDirection = \"column\";\n } else {\n const bottom = inner_height - bounds.y;\n this.#container.style.top = \"\";\n this.#container.style.bottom = bottom + \"px\";\n this.#container.style.maxHeight = inner_height - bottom - 10 + \"px\";\n this.#container.style.flexDirection = \"column-reverse\";\n }\n this.#container.style.left = bounds.x + \"px\";\n this.#container.style.width = bounds.width + \"px\";\n this.#dropdown = parent;\n\n let focus: HTMLElement | undefined = undefined as HTMLElement | undefined;\n this.#table.replaceChildren(\n ...Array.from(map).map(([val, opt]) => {\n const line = document.createElement(\"div\");\n const icon = line.appendChild(document.createElement(\"div\"));\n if (opt.icon) icon.appendChild(opt.icon());\n const text = line.appendChild(document.createElement(\"div\"));\n text.textContent = opt.text;\n line.onpointerup = (e) => {\n if (e.pointerType !== \"touch\") this.#set_value(val);\n };\n line.onclick = () => this.#set_value(val);\n line.tabIndex = 0;\n line.onkeydown = (e) => {\n if (e.key === \" \" || e.key === \"Enter\") {\n e.preventDefault();\n this.#set_value(val);\n }\n };\n if (val === value) focus = line;\n return line;\n }),\n );\n\n //Show closer or not\n const box = this.#scroll.getBoundingClientRect();\n const box_area = box.width * box.height;\n const html = this.ownerDocument.documentElement;\n const html_area = html.clientWidth * html.clientHeight;\n if (box_area > html_area * 0.5) {\n this.#table.prepend(this.#closer);\n }\n\n //Checked after the options are added, so their size is known\n if (this.#scroll.scrollHeight > this.#scroll.clientHeight)\n this.#scroll.classList.add(\"scroll\");\n else this.#scroll.classList.remove(\"scroll\");\n\n if (focus) {\n focus.focus();\n focus.classList.add(\"selected\");\n } else this.#container.focus();\n\n this.ownerDocument.defaultView?.addEventListener(\n \"resize\",\n this.#window_resize_handler,\n { passive: true },\n );\n this.#is_open = true;\n }\n\n close_menu(focus: boolean = true) {\n if (!this.#is_open) return;\n this.#is_open = false;\n if (this.#dropdown) this.#dropdown.open = false;\n this.classList.remove(\"open\");\n this.#table.replaceChildren();\n if (this.#dropdown) {\n if (focus) this.#dropdown.focus();\n //@ts-expect-error Overwrite private property from sister class\n this.#dropdown.is_open = false;\n }\n this.ownerDocument.defaultView?.removeEventListener(\n \"resize\",\n this.#window_resize_handler,\n );\n }\n}\ndefine_element(DropDownBox);\n\n/**One popup per document, so dropdowns in popout windows open in their own window*/\nconst boxes = new Map<Document, DropDownBox>();\nconst add_box = (doc: Document): DropDownBox => {\n const box = doc.documentElement.appendChild(new DropDownBox());\n boxes.set(doc, box);\n return box;\n};\n/**Used for dropdowns in documents not registered with the document handler*/\nconst main_box = add_box(DOCUMENT_HANDLER.main);\nDOCUMENT_HANDLER.for_documents((doc) => {\n if (doc !== DOCUMENT_HANDLER.main) add_box(doc);\n});\nDOCUMENT_HANDLER.events.on(\"added\", (e) => add_box(e.data));\nDOCUMENT_HANDLER.events.on(\"removed\", (e) => boxes.delete(e.data));\n","import { define_element } from \"#base\";\nimport {\n FormSelectorBase,\n type FormSelectorBaseOptions,\n type FormSelectorOption,\n} from \"../selector_base\";\nimport \"./toggle_button.scss\";\n\nexport interface FormToggleButtonSelection {\n top: HTMLDivElement;\n bot: HTMLDivElement;\n}\n\n/**Toggle buttons, displays all options in a multi toggler*/\nexport class FormToggleButton<\n RT,\n ID extends string | undefined,\n> extends FormSelectorBase<RT, ID> {\n /**Returns the name used to define the element*/\n static element_name() {\n return \"togglebutton\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #map: Map<RT, FormToggleButtonSelection> = new Map();\n #values: RT[] = [];\n #selected: number = -1;\n\n focus(options?: FocusOptions): void {\n (this.firstElementChild as HTMLElement | null)?.focus(options);\n }\n\n set selections(selections: FormSelectorOption<RT>[] | undefined) {\n if (this.#map.size > 0) {\n this.#map.clear();\n this.#values = [];\n this.#selected = -1;\n this.replaceChildren();\n }\n for (let i = 0; selections && i < selections.length; i++) {\n const { value } = selections[i];\n this.#map.set(value, this.#add_selection(selections[i]));\n this.#values.push(selections[i].value);\n }\n if (this.buffer !== undefined) this.new_value(this.buffer);\n }\n\n #add_selection(selection: FormSelectorOption<RT>) {\n const top = this.appendChild(document.createElement(\"div\"));\n top.tabIndex = 0;\n const bot = this.appendChild(document.createElement(\"div\"));\n if (selection.icon) {\n top.appendChild(selection.icon());\n bot.textContent = selection.text;\n } else top.textContent = selection.text;\n const click = () => {\n top.appendChild(this.warn_input);\n this.set_value_check(selection.value);\n };\n top.onclick = click;\n bot.onclick = click;\n top.onkeydown = (e) => {\n if (e.key === \" \" || e.key === \"Enter\") click();\n else if (e.key === \"ArrowRight\") this.#select_adjacent(true);\n else if (e.key === \"ArrowLeft\") this.#select_adjacent(false);\n else return;\n e.preventDefault();\n e.stopPropagation();\n };\n return { top, bot };\n }\n\n /**Selects the previous or next selection in the element\n * @param dir false is next true is previous*/\n #select_adjacent(dir: boolean) {\n const sel = this.#map.get(this.#values[this.#selected]);\n if (sel) sel.top.appendChild(this.warn_input);\n const y = Math.min(\n this.#values.length - 1,\n Math.max(0, dir ? this.#selected + 1 : this.#selected - 1),\n );\n if (y !== this.#selected) this.set_value_check(this.#values[y]);\n }\n\n protected new_value(value: RT): void {\n const prev = this.#map.get(this.#values[this.#selected]);\n if (prev) {\n prev.top.classList.remove(\"selected\");\n prev.bot.classList.remove(\"selected\");\n }\n const opt = this.#map.get(value);\n if (opt) {\n opt.top.classList.add(\"selected\");\n opt.bot.classList.add(\"selected\");\n this.#selected = this.#values.indexOf(value);\n if (this.contains(document.activeElement)) {\n opt.top.focus();\n }\n } else this.#selected = -1;\n }\n\n protected clear_value(): void {\n const prev = this.#map.get(this.#values[this.#selected]);\n if (prev) {\n prev.top.classList.remove(\"selected\");\n prev.bot.classList.remove(\"selected\");\n }\n this.#selected = -1;\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n}\ndefine_element(FormToggleButton);\n\n/**Creates a toggle button form element */\nexport function form_toggle_button<RT, ID extends string | undefined>(\n options?: FormSelectorBaseOptions<RT, ID>,\n): FormToggleButton<RT, ID> {\n const togg = new FormToggleButton<RT, ID>(options?.id);\n if (options) FormSelectorBase.apply_options(togg, options);\n return togg;\n}\n","import { define_element } from \"#base\";\nimport { FormElement } from \"../base\";\nimport \"../shared\";\nimport \"./spacer.scss\";\n\nexport interface FormSpacerOptions {\n /**Spacing amount */\n space?: number;\n}\n\nexport class FormSpacer extends FormElement {\n static element_name() {\n return \"spacer\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n constructor() {\n super();\n }\n\n /**Sets the amount of space, in rem */\n set space(space: number) {\n this.style.height = `${space}rem`;\n }\n get space() {\n return parseFloat(this.style.height);\n }\n}\ndefine_element(FormSpacer);\n\n/**Creates a spacer form element */\nexport function form_spacer(options?: FormSpacerOptions): FormSpacer {\n const spacer = new FormSpacer();\n if (options) {\n if (options.space) spacer.space = options.space;\n }\n return spacer;\n}\n","import { define_element } from \"#base\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./color_input.scss\";\n\nexport interface FormColorOptions<\n ID extends string | undefined,\n RT = string,\n> extends FormValueWriteOptions<RT, ID> {\n /**Whether the color input should update live*/\n live?: boolean;\n}\n\nexport class FormColor<ID extends string | undefined> extends FormValueWrite<\n string,\n ID\n> {\n static element_name() {\n return \"colorinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #live: boolean = false;\n\n constructor(id?: ID) {\n super(id);\n this.appendChild(this.warn_input);\n this.warn_input.type = \"color\";\n this.warn_input.oninput = () => {\n if (this.#live) this.set_value_check(this.warn_input.value);\n };\n this.warn_input.onchange = () => {\n if (!this.#live) this.set_value_check(this.warn_input.value);\n };\n }\n\n set live(val: boolean) {\n this.#live = val;\n }\n get live(): boolean {\n return this.#live;\n }\n\n protected new_value(val: string): void {\n this.warn_input.value = val;\n }\n\n protected clear_value(): void {\n this.warn_input.value = \"#000000\";\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormColor);\n\n/**Creates a color input form element */\nexport function form_color<ID extends string | undefined>(\n options?: FormColorOptions<ID, string>,\n): FormColor<ID> {\n const input = new FormColor<ID>(options?.id);\n if (options) {\n if (options.live) input.live = options.live;\n FormValueWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport {\n material_calendar_month_rounded,\n material_schedule_rounded,\n} from \"#icons\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./date_time_input.scss\";\n\nexport interface FormDateTimeOptions<\n MODE extends FormDateTimeMode,\n ID extends string | undefined,\n> extends FormValueWriteOptions<FormDateTimeResult<MODE>, ID> {\n /**Type of date time*/\n type?: FormDateTimeType;\n /**Value representation used by the input*/\n mode: MODE;\n /**Force show milliseconds even when value is not precise to milliseconds */\n milliseconds?: boolean;\n}\n\nexport const FormDateTimeType = {\n DATE: \"date\",\n TIME: \"time\",\n DATETIME: \"datetime\",\n} as const;\nexport type FormDateTimeType =\n (typeof FormDateTimeType)[keyof typeof FormDateTimeType];\n\nexport const FormDateTimeMode = {\n DATE: \"date\",\n STRING: \"string\",\n NUMBER: \"number\",\n} as const;\nexport type FormDateTimeMode =\n (typeof FormDateTimeMode)[keyof typeof FormDateTimeMode];\n\nconst TIME_ONLY = /^\\d{2}:\\d{2}/;\nconst DATE_ONLY = /^\\d{4}-\\d{2}-\\d{2}$/;\n//Strings the input of each type shows as they are, without milliseconds\nconst INPUT_FORMAT: { [K in FormDateTimeType]: RegExp } = {\n date: DATE_ONLY,\n time: /^\\d{2}:\\d{2}(:\\d{2})?$/,\n datetime: /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2})?$/,\n};\n\n/**Returns the wall clock time of a string as UTC milliseconds, like the input uses\n * Time only strings give the time since midnight, strings without time zone are local*/\nconst string_wall_time = (value: string): number => {\n if (TIME_ONLY.test(value)) return Date.parse(\"1970-01-01T\" + value + \"Z\");\n //Date only strings are parsed as UTC midnight, which is the wall clock\n if (DATE_ONLY.test(value)) return Date.parse(value);\n const date = new Date(value);\n return date.getTime() - date.getTimezoneOffset() * 60000;\n};\n\ntype FormDateTimeResult<MODE extends FormDateTimeMode> =\n MODE extends typeof FormDateTimeMode.DATE\n ? Date\n : MODE extends typeof FormDateTimeMode.STRING\n ? string\n : number;\n\nexport class FormDateTime<\n MODE extends FormDateTimeMode,\n ID extends string | undefined,\n> extends FormValueWrite<FormDateTimeResult<MODE>, ID> {\n static element_name() {\n return \"datetimeinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #type: FormDateTimeType = FormDateTimeType.DATETIME;\n #mode: MODE;\n #milliseconds: boolean = false;\n\n constructor(mode: MODE, id?: ID) {\n super(id);\n this.#mode = mode;\n this.warn_input.onfocus = () => {\n this.selected = true;\n };\n this.warn_input.onblur = () => {\n this.selected = false;\n //Shows a state change that arrived while focused\n if (this._buffer !== undefined) this.new_value(this._buffer);\n };\n\n this.warn_input.type = \"datetime-local\";\n this.warn_input.lang = \"da-DK\";\n this.warn_input.step = \"1\";\n this.appendChild(this.warn_input);\n this.appendChild(material_calendar_month_rounded()).onclick = () =>\n this.warn_input.showPicker();\n this.appendChild(material_schedule_rounded()).onclick = () =>\n this.warn_input.showPicker();\n this.warn_input.onchange = () => {\n if (this.warn_input.value) {\n if (this.#mode === FormDateTimeMode.DATE) {\n //The input gives the local wall clock as UTC, the offset of the entered date is used\n const wall = new Date(this.warn_input.valueAsNumber);\n const date = new Date(0);\n date.setFullYear(\n wall.getUTCFullYear(),\n wall.getUTCMonth(),\n wall.getUTCDate(),\n );\n date.setHours(\n wall.getUTCHours(),\n wall.getUTCMinutes(),\n wall.getUTCSeconds(),\n wall.getUTCMilliseconds(),\n );\n this.set_value_check(date as FormDateTimeResult<MODE>);\n } else if (this.#mode === FormDateTimeMode.STRING)\n this.set_value_check(\n this.warn_input.value as FormDateTimeResult<MODE>,\n );\n else\n this.set_value_check(\n this.warn_input.valueAsNumber as FormDateTimeResult<MODE>,\n );\n }\n };\n }\n\n /**Returns the date time type*/\n get type() {\n return this.#type;\n }\n\n /**Sets the date time type*/\n set type(type: FormDateTimeType) {\n if (type === FormDateTimeType.DATE) this.warn_input.type = \"date\";\n if (type === FormDateTimeType.TIME) this.warn_input.type = \"time\";\n if (type === FormDateTimeType.DATETIME)\n this.warn_input.type = \"datetime-local\";\n this.#type = type;\n }\n\n /**Returns true if the input is set to show milliseconds*/\n get milliseconds() {\n return this.#milliseconds;\n }\n\n /**Sets the input to show milliseconds*/\n set milliseconds(value: boolean) {\n this.#milliseconds = value;\n if (value) this.warn_input.step = \"0.001\";\n else this.warn_input.step = \"1\";\n }\n\n /**Returns the date time type*/\n get step() {\n return Number(this.warn_input.step);\n }\n /**Sets the date time type*/\n set step(step: number) {\n this.warn_input.step = String(step);\n }\n\n protected new_value(value: FormDateTimeResult<MODE>): void {\n let time: number;\n if (typeof value === \"number\") time = value;\n else if (typeof value === \"string\") {\n if (INPUT_FORMAT[this.#type].test(value)) {\n this.warn_input.value = value;\n return;\n }\n time = string_wall_time(value);\n } else time = value.getTime() - value.getTimezoneOffset() * 60000;\n this.warn_input.valueAsNumber = this.#milliseconds\n ? time\n : time - (time % 1000);\n }\n protected clear_value(): void {\n this.warn_input.value = \"\";\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormDateTime);\n\n/**Creates a date time input form element\n * Number type is always UTC, Date and String is always local*/\nexport function form_date_time<\n MODE extends FormDateTimeMode,\n ID extends string | undefined,\n>(options: FormDateTimeOptions<MODE, ID>): FormDateTime<MODE, ID> {\n const input = new FormDateTime<MODE, ID>(options.mode, options.id);\n if (options.type) input.type = options.type;\n if (options.milliseconds !== undefined)\n input.milliseconds = options.milliseconds;\n FormValueWrite.apply_options(input, options);\n return input;\n}\n","import { define_element } from \"#base\";\nimport { IPAddress, IPVersion, sleep } from \"@chocbite/ts-lib/common\";\nimport { get_cursor_position, set_cursor_end, set_selection_all } from \"#selection\";\nimport { err, ok, type Option, type Result } from \"@chocbite/ts-lib/result\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./ip_input.scss\";\n\nexport interface FormIpOptions<\n ID extends string | undefined,\n> extends FormValueWriteOptions<IPAddress, ID> {\n /**Ip address type, this is overwritten if supplied with an ipaddress with a different type*/\n type: IPVersion;\n}\n\nexport class FormIp<ID extends string | undefined> extends FormValueWrite<\n IPAddress,\n ID\n> {\n static element_name() {\n return \"ipinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #type: IPVersion;\n /**Amount of parts of the current type*/\n get #count() {\n return this.#type === IPVersion.V4 ? 4 : 8;\n }\n #parts: HTMLDivElement[] = Array.from({ length: 8 }, (_, i) => {\n const inp = this.appendChild(document.createElement(\"div\"));\n if (i < 7) this.appendChild(document.createElement(\"span\"));\n inp.contentEditable = \"true\";\n inp.onbeforeinput = async (ev) => {\n if (ev.inputType === \"insertParagraph\") ev.preventDefault();\n //Backspace\n else if (ev.inputType === \"deleteContentBackward\") {\n if (inp.textContent.length === 0 && i > 0) {\n set_cursor_end(this.#parts[i - 1]);\n }\n // Delete\n } else if (ev.inputType === \"deleteContentForward\") {\n if (inp.textContent.length === 0 && i < this.#count - 1) {\n await sleep(0);\n this.#parts[i + 1].focus();\n }\n } else if (ev.data) {\n //Check for . or :\n if (\n (ev.data === \".\" || ev.data === \":\" || ev.data === \",\") &&\n i < this.#count - 1\n ) {\n set_selection_all(this.#parts[i + 1]);\n ev.preventDefault();\n }\n //Check for valid characters\n else if (\n !ev.data.match(\n this.#type === IPVersion.V4 ? /^[\\d]*$/ : /^[\\dA-Fa-f]*$/,\n )\n )\n ev.preventDefault();\n else {\n //The text the part would have, typed text replaces the selection\n const [start, end] = this.#selection_in(inp);\n const potential =\n inp.textContent.slice(0, start) +\n ev.data +\n inp.textContent.slice(end);\n //Prevent too long values\n if (potential.length > (this.#type === IPVersion.V4 ? 3 : 4)) {\n ev.preventDefault();\n return;\n }\n //Prevent too big values\n const num =\n this.#type === IPVersion.V4\n ? parseInt(potential, 10)\n : parseInt(potential, 16);\n if (\n (this.#type === IPVersion.V4 && num > 255) ||\n (this.#type === IPVersion.V6 && num > 65535)\n ) {\n if (i < this.#count - 1) set_selection_all(this.#parts[i + 1]);\n else ev.preventDefault();\n }\n }\n }\n };\n inp.oninput = () => {\n if (\n inp.textContent.length === (this.#type === IPVersion.V4 ? 3 : 4) &&\n get_cursor_position(inp) === inp.textContent.length &&\n i < this.#count - 1\n ) {\n set_selection_all(this.#parts[i + 1]);\n }\n };\n inp.onkeydown = async (e) => {\n if (e.key === \"ArrowUp\") {\n } else if (e.key === \"ArrowDown\") {\n } else if (e.key === \"ArrowLeft\" && i > 0) {\n if (get_cursor_position(inp) === 0 || inp.textContent.length === 0)\n set_cursor_end(this.#parts[i - 1]);\n else return;\n } else if (e.key === \"ArrowRight\" && i < this.#count - 1) {\n if (\n get_cursor_position(inp) === inp.textContent.length ||\n inp.textContent.length === 0\n )\n this.#parts[i + 1].focus();\n else return;\n } else return;\n e.preventDefault();\n e.stopPropagation();\n };\n return inp;\n });\n\n constructor(type: IPVersion, id?: ID) {\n super(id);\n this.type = type;\n this.#type = type;\n this.appendChild(this.warn_input);\n this.addEventListener(\"focusin\", () => {\n this.selected = true;\n });\n this.addEventListener(\"focusout\", () => {\n this.selected = false;\n });\n\n this.onpointerdown = (e) => {\n if (!this.#parts.includes(e.target as HTMLDivElement)) {\n e.preventDefault();\n set_cursor_end(this.#parts[this.#type === IPVersion.V4 ? 3 : 7]);\n }\n };\n this.ondblclick = (e) => {\n if (e.target !== this) return;\n e.preventDefault();\n set_selection_all(this.#parts[0]);\n };\n this.addEventListener(\"focusin\", (e) => {\n e.preventDefault();\n });\n this.addEventListener(\"focusout\", (e) => {\n if (e.relatedTarget && this.contains(e.relatedTarget as Node)) return;\n this.#commit_typed();\n });\n this.onkeydown = (e) => {\n if (e.key === \"Enter\") this.#commit_typed();\n else if (e.key === \"Escape\") {\n if (this.buffer) this.new_value(this.buffer);\n else this.clear_value();\n }\n };\n this.oncopy = (e) => {\n e.preventDefault();\n const typed = this.#typed();\n if (typed.ok)\n e.clipboardData?.setData(\"text/plain\", typed.value.to_string());\n };\n this.onpaste = (e) => {\n e.preventDefault();\n const paste = e.clipboardData?.getData(\"text/plain\") || \"\";\n let new_ip: IPAddress;\n try {\n new_ip = new IPAddress(paste);\n } catch (error) {\n return this.warn(error instanceof Error ? error.message : String(error));\n }\n if (new_ip.version !== this.#type) return;\n this.#commit(new_ip);\n };\n }\n\n /**Start and end of the selection in a part, both the cursor position when nothing is selected*/\n #selection_in(part: HTMLElement): [number, number] {\n const selection = part.ownerDocument.getSelection();\n if (selection?.rangeCount && part.contains(selection.anchorNode)) {\n const range = selection.getRangeAt(0);\n const before = range.cloneRange();\n before.selectNodeContents(part);\n before.setEnd(range.startContainer, range.startOffset);\n const start = before.toString().length;\n return [start, start + range.toString().length];\n }\n const position = get_cursor_position(part);\n return [position, position];\n }\n\n /**The typed address, or why the typed parts are not an address*/\n #typed(): Result<IPAddress, string> {\n if (this.#parts.slice(0, this.#count).some((part) => !part.textContent))\n return err(\"All parts of the address must be filled in\");\n try {\n return ok(this.value_as_ip);\n } catch (error) {\n return err(error instanceof Error ? error.message : String(error));\n }\n }\n\n /**Commits the typed address, or warns why it is not an address*/\n #commit_typed() {\n const typed = this.#typed();\n if (typed.ok) this.#commit(typed.value);\n else this.warn(typed.error);\n }\n\n /**Commits an address, unless it is the current address, a new IPAddress object is never the same object as the current one*/\n #commit(ip: IPAddress) {\n if (this.buffer?.equals(ip)) return;\n this.set_value_check(ip);\n }\n\n focus(options?: FocusOptions): void {\n this.#parts[0].focus(options);\n }\n\n get value_as_ip(): IPAddress {\n return new IPAddress(\n this.#parts\n .slice(0, this.#type === IPVersion.V4 ? 4 : 8)\n .reduce((acc, part, i) => {\n acc += part.innerText;\n if (i < (this.#type === IPVersion.V4 ? 4 : 8) - 1)\n acc += this.#type === IPVersion.V4 ? \".\" : \":\";\n return acc;\n }, \"\"),\n );\n }\n\n set type(val: IPVersion) {\n if (this.#type === val) return;\n this.#type = val;\n this.classList.toggle(\"ipv4\", val === IPVersion.V4);\n this.classList.toggle(\"ipv6\", val === IPVersion.V6);\n this.replaceChildren(\n ...this.#parts\n .slice(0, this.#count)\n .flatMap((v, i) =>\n i < this.#count - 1\n ? [v, document.createTextNode(val === IPVersion.V4 ? \".\" : \":\")]\n : [v],\n ),\n //Kept, warnings are shown through it\n this.warn_input,\n );\n }\n\n protected new_value(val: IPAddress): void {\n this.type = val.version;\n val.as_array.forEach((part, i) => {\n this.#parts[i].textContent =\n val.version === IPVersion.V4 ? part.toString() : part.toString(16);\n });\n }\n\n protected clear_value(): void {\n this.#parts.forEach((part) => {\n part.textContent = \"\";\n });\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormIp);\n\n/**Creates an IP input form element */\nexport function form_ip<ID extends string | undefined>(\n options: FormIpOptions<ID>,\n): FormIp<ID> {\n const input = new FormIp<ID>(options.type, options?.id);\n if (options) {\n FormValueWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport type { Option } from \"@chocbite/ts-lib/result\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./password_input.scss\";\n\nexport interface FormPasswordOptions<\n ID extends string | undefined,\n> extends FormValueWriteOptions<string, ID> {\n /**Allowed characters for the password input */\n filter?: RegExp;\n}\n\nexport class FormPassword<ID extends string | undefined> extends FormValueWrite<\n string,\n ID\n> {\n static element_name() {\n return \"passwordinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #filter?: RegExp;\n\n constructor(id?: ID) {\n super(id);\n this.appendChild(this.warn_input);\n this.warn_input.type = \"password\";\n this.warn_input.onfocus = () => {\n this.warn_input.value = \"\";\n this.selected = true;\n };\n this.warn_input.onblur = () => {\n this.selected = false;\n //Restores the password when nothing new was entered, or shows a state change made while focused\n if (this._buffer !== undefined && this.warn_input.value !== this._buffer)\n this.new_value(this._buffer);\n };\n this.warn_input.onchange = () => {\n this.set_value_check(this.warn_input.value);\n };\n this.warn_input.onbeforeinput = (ev) => {\n if (ev.data && this.#filter) {\n this.#filter.lastIndex = 0;\n if (!this.#filter.test(ev.data)) {\n ev.preventDefault();\n this.warn(\"Invalid character entered\");\n }\n }\n };\n }\n\n set filter(val: RegExp | undefined) {\n this.#filter = val;\n }\n\n protected new_value(val: string): void {\n this.warn_input.value = val;\n }\n\n protected clear_value(): void {\n this.warn_input.value = \"\";\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected state_related(_related: Option<{}>): void {}\n}\ndefine_element(FormPassword);\n\n/**Creates a password input form element */\nexport function form_password<ID extends string | undefined>(\n options?: FormPasswordOptions<ID>,\n): FormPassword<ID> {\n const input = new FormPassword<ID>(options?.id);\n if (options) {\n if (options.filter) input.filter = options.filter;\n FormValueWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport { sync_resolve } from \"@chocbite/ts-lib/common\";\nimport { set_cursor_end } from \"#selection\";\nimport { err, none, type Result } from \"@chocbite/ts-lib/result\";\nimport type { StateStringRelated } from \"@chocbite/ts-lib/state\";\nimport { string_byte_length, string_byte_limit } from \"@chocbite/ts-lib/string\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./text_input.scss\";\n\nexport interface FormTextInputOptions<\n ID extends string | undefined,\n RT = string,\n> extends FormValueWriteOptions<RT, ID> {\n /**Placeholder text when input is empty */\n placeholder?: string;\n /**Maximum length of the input */\n max_length?: number;\n /**Maximum bytes of the input */\n max_bytes?: number;\n /**Allowed characters for the text input */\n filter?: RegExp;\n}\n\nexport class FormTextInput<\n ID extends string | undefined,\n> extends FormValueWrite<string, ID> {\n static element_name() {\n return \"textinput\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #filter?: RegExp;\n #max_length?: number;\n #max_bytes?: number;\n //True while the limit comes from the bound state\n #related_length = false;\n #related_bytes = false;\n\n constructor(id?: ID) {\n super(id);\n this.warn_input.onfocus = () => {\n this.selected = true;\n };\n this.warn_input.onblur = () => {\n this.selected = false;\n //Shows a state change that arrived while focused\n if (this._buffer !== undefined && this.warn_input.value !== this._buffer)\n this.new_value(this._buffer);\n };\n this.warn_input.type = \"text\";\n this.appendChild(this.warn_input);\n this.warn_input.onchange = () => this.#set();\n this.onbeforeinput = (e) => {\n this.warn(\"\");\n const data = e.data || e.dataTransfer?.getData(\"text/plain\");\n if (data) {\n if (this.#filter) this.#filter.lastIndex = 0;\n if (this.#filter && !this.#filter.test(data)) {\n e.preventDefault();\n this.warn(\"Invalid character entered\");\n } else if (this.#max_length || this.#max_bytes) {\n //The selected text is replaced by the typed text\n const input = this.warn_input;\n const value = input.value;\n const start = input.selectionStart ?? value.length;\n const end = input.selectionEnd ?? start;\n if (\n this.#max_length &&\n value.length - (end - start) + data.length > this.#max_length\n ) {\n e.preventDefault();\n this.warn(`A maximum of ${this.#max_length} characters is allowed`);\n }\n if (\n this.#max_bytes &&\n string_byte_length(value) -\n string_byte_length(value.slice(start, end)) +\n string_byte_length(data) >\n this.#max_bytes\n ) {\n e.preventDefault();\n this.warn(`A maximum of ${this.#max_bytes} bytes is allowed`);\n }\n }\n }\n };\n this.onkeydown = (e) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n if (this.buffer) this.new_value(this.buffer);\n else this.clear_value();\n }\n };\n }\n\n async #set() {\n const buff = this.buffer;\n (await this.set_value_check(this.warn_input.value || \"\")).map_err(() => {\n this.new_value(buff || \"\");\n set_cursor_end(this.warn_input);\n });\n }\n\n set filter(val: RegExp | undefined) {\n this.#filter = val;\n }\n get filter(): RegExp | undefined {\n return this.#filter;\n }\n\n set placeholder(val: string) {\n this.warn_input.placeholder = val;\n }\n get placeholder(): string {\n return this.warn_input.placeholder;\n }\n\n set max_length(val: number | undefined) {\n this.#max_length = val;\n if (val === undefined) this.warn_input.removeAttribute(\"maxlength\");\n else this.warn_input.maxLength = val;\n }\n get max_length(): number | undefined {\n return this.#max_length;\n }\n\n set max_bytes(val: number | undefined) {\n this.#max_bytes = val;\n }\n get max_bytes(): number | undefined {\n return this.#max_bytes;\n }\n\n protected new_value(val: string): void {\n this.warn_input.value = val;\n }\n\n protected clear_value(): void {\n this.warn_input.value = \"\";\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected limit_value(val: string): PromiseLike<Result<string, string>> {\n if (this.#max_length && val.length > this.#max_length)\n val = val.slice(0, this.#max_length);\n if (this.#max_bytes) val = string_byte_limit(val, this.#max_bytes);\n return super.limit_value(val);\n }\n\n protected check_value(val: string): PromiseLike<Result<string, string>> {\n if (this.#max_length && val.length > this.#max_length)\n return sync_resolve(\n err(`A maximum of ${this.#max_length} characters is allowed`),\n );\n if (this.#max_bytes && string_byte_length(val) > this.#max_bytes)\n return sync_resolve(\n err(`A maximum of ${this.#max_bytes} bytes is allowed`),\n );\n return super.check_value(val);\n }\n\n protected state_related(related: Partial<StateStringRelated>): void {\n if (related.max_length)\n this.attach_state_to_prop(\"max_length\", related.max_length, () => none());\n else if (this.#related_length)\n this.detach_state_from_prop(\"max_length\").max_length = undefined;\n this.#related_length = !!related.max_length;\n if (related.max_length_bytes)\n this.attach_state_to_prop(\"max_bytes\", related.max_length_bytes, () =>\n none(),\n );\n else if (this.#related_bytes)\n this.detach_state_from_prop(\"max_bytes\").max_bytes = undefined;\n this.#related_bytes = !!related.max_length_bytes;\n }\n}\ndefine_element(FormTextInput);\n\n/**Creates a single line text input form element */\nexport function form_text_input<ID extends string | undefined>(\n options?: FormTextInputOptions<ID>,\n): FormTextInput<ID> {\n const input = new FormTextInput<ID>(options?.id);\n if (options) {\n if (options.filter) input.filter = options.filter;\n if (options.placeholder) input.placeholder = options.placeholder;\n if (options.max_length) input.max_length = options.max_length;\n if (options.max_bytes) input.max_bytes = options.max_bytes;\n FormValueWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport { sync_resolve } from \"@chocbite/ts-lib/common\";\nimport { set_cursor_end } from \"#selection\";\nimport { material_drag_handle_rounded } from \"#icons\";\nimport { err, none, type Result } from \"@chocbite/ts-lib/result\";\nimport type { StateStringRelated } from \"@chocbite/ts-lib/state\";\nimport { string_byte_length, string_byte_limit } from \"@chocbite/ts-lib/string\";\nimport { FormValueWrite, FormValueWriteOptions } from \"../../base\";\nimport \"./text_multi_line.scss\";\n\nexport interface FormTextMultilineOptions<\n ID extends string | undefined,\n RT = string,\n> extends FormValueWriteOptions<RT, ID> {\n /**Placeholder text when input is empty */\n placeholder?: string;\n /**Maximum length of the input */\n max_length?: number;\n /**Maximum bytes of the input */\n max_bytes?: number;\n /**Allowed characters for the text input */\n filter?: RegExp;\n}\n\nexport class FormTextMultiline<\n ID extends string | undefined,\n> extends FormValueWrite<string, ID> {\n static element_name() {\n return \"textmultiline\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n #filter?: RegExp;\n #max_length?: number;\n #max_bytes?: number;\n //True while the limit comes from the bound state\n #related_length = false;\n #related_bytes = false;\n #value_box: HTMLTextAreaElement = this.appendChild(\n document.createElement(\"textarea\"),\n );\n #resizer: HTMLDivElement = this.appendChild(document.createElement(\"div\"));\n\n constructor(id?: ID) {\n super(id);\n this.#value_box.onfocus = () => {\n this.selected = true;\n };\n this.#value_box.onblur = () => {\n this.selected = false;\n //Shows a state change that arrived while focused\n if (this._buffer !== undefined && this.#value_box.value !== this._buffer)\n this.new_value(this._buffer);\n };\n this.appendChild(this.warn_input);\n this.#resizer.appendChild(material_drag_handle_rounded());\n this.#resizer.onpointerdown = (e) => {\n e.preventDefault();\n const height = this.#value_box.getBoundingClientRect().height;\n const start_y = e.clientY;\n this.#resizer.setPointerCapture(e.pointerId);\n this.#resizer.onpointermove = (ev) => {\n const dy = ev.clientY - start_y;\n this.#value_box.style.height = `${height + dy}px`;\n };\n this.#resizer.onpointerup = (_ev) => {\n this.#resizer.releasePointerCapture(e.pointerId);\n this.#resizer.onpointermove = null;\n this.#resizer.onpointerup = null;\n };\n };\n this.#value_box.onchange = () => this.#set();\n this.#value_box.onbeforeinput = (e) => {\n this.warn(\"\");\n const data = e.data || e.dataTransfer?.getData(\"text/plain\");\n if (data) {\n if (this.#filter) this.#filter.lastIndex = 0;\n if (this.#filter && !this.#filter.test(data)) {\n e.preventDefault();\n this.warn(\"Invalid character entered\");\n } else if (this.#max_length || this.#max_bytes) {\n //The selected text is replaced by the typed text\n const box = this.#value_box;\n const value = box.value;\n const start = box.selectionStart;\n const end = box.selectionEnd;\n if (\n this.#max_length &&\n value.length - (end - start) + data.length > this.#max_length\n ) {\n e.preventDefault();\n this.warn(`A maximum of ${this.#max_length} characters is allowed`);\n }\n if (\n this.#max_bytes &&\n string_byte_length(value) -\n string_byte_length(value.slice(start, end)) +\n string_byte_length(data) >\n this.#max_bytes\n ) {\n e.preventDefault();\n this.warn(`A maximum of ${this.#max_bytes} bytes is allowed`);\n }\n }\n }\n };\n this.#value_box.onkeydown = (e) => {\n if (e.key === \"Escape\") {\n e.preventDefault();\n e.stopPropagation();\n if (this.buffer) this.new_value(this.buffer);\n else this.clear_value();\n } else if (e.key === \"Enter\") {\n //Enter is a new line, it must not reach parent elements\n if (!e.shiftKey) e.stopPropagation();\n if (e.ctrlKey) {\n e.preventDefault();\n this.#set();\n }\n }\n };\n }\n\n focus(options?: FocusOptions): void {\n this.#value_box.focus(options);\n }\n\n async #set() {\n const buff = this.buffer;\n (await this.set_value_check(this.#value_box.value || \"\")).map_err(() => {\n this.new_value(buff || \"\");\n set_cursor_end(this.#value_box);\n });\n }\n\n set filter(val: RegExp | undefined) {\n this.#filter = val;\n }\n get filter(): RegExp | undefined {\n return this.#filter;\n }\n\n set placeholder(val: string) {\n this.#value_box.placeholder = val;\n }\n get placeholder(): string {\n return this.#value_box.placeholder;\n }\n\n set max_length(val: number | undefined) {\n this.#max_length = val;\n if (val === undefined) this.#value_box.removeAttribute(\"maxlength\");\n else this.#value_box.maxLength = val;\n }\n get max_length(): number | undefined {\n return this.#max_length;\n }\n\n set max_bytes(val: number | undefined) {\n this.#max_bytes = val;\n }\n get max_bytes(): number | undefined {\n return this.#max_bytes;\n }\n\n protected new_value(val: string): void {\n this.#value_box.value = val;\n }\n\n protected clear_value(): void {\n this.#value_box.value = \"\";\n }\n\n protected new_error(_val: string): void {}\n\n protected clear_error(): void {}\n\n protected limit_value(val: string): PromiseLike<Result<string, string>> {\n if (this.#max_length && val.length > this.#max_length)\n val = val.slice(0, this.#max_length);\n if (this.#max_bytes) val = string_byte_limit(val, this.#max_bytes);\n return super.limit_value(val);\n }\n\n protected check_value(val: string): PromiseLike<Result<string, string>> {\n if (this.#max_length && val.length > this.#max_length)\n return sync_resolve(\n err(`A maximum of ${this.#max_length} characters is allowed`),\n );\n if (this.#max_bytes && string_byte_length(val) > this.#max_bytes)\n return sync_resolve(\n err(`A maximum of ${this.#max_bytes} bytes is allowed`),\n );\n return super.check_value(val);\n }\n\n protected state_related(related: Partial<StateStringRelated>): void {\n if (related.max_length)\n this.attach_state_to_prop(\"max_length\", related.max_length, () => none());\n else if (this.#related_length)\n this.detach_state_from_prop(\"max_length\").max_length = undefined;\n this.#related_length = !!related.max_length;\n if (related.max_length_bytes)\n this.attach_state_to_prop(\"max_bytes\", related.max_length_bytes, () =>\n none(),\n );\n else if (this.#related_bytes)\n this.detach_state_from_prop(\"max_bytes\").max_bytes = undefined;\n this.#related_bytes = !!related.max_length_bytes;\n }\n}\ndefine_element(FormTextMultiline);\n\n/**Creates a multi line text input form element */\nexport function form_text_multiline<ID extends string | undefined>(\n options?: FormTextMultilineOptions<ID>,\n): FormTextMultiline<ID> {\n const input = new FormTextMultiline<ID>(options?.id);\n if (options) {\n if (options.filter) input.filter = options.filter;\n if (options.placeholder) input.placeholder = options.placeholder;\n if (options.max_length) input.max_length = options.max_length;\n if (options.max_bytes) input.max_bytes = options.max_bytes;\n FormValueWrite.apply_options(input, options);\n }\n return input;\n}\n","import { define_element } from \"#base\";\nimport { FormElement } from \"../../base\";\nimport \"./text.scss\";\n\nexport interface FormTextOptions {\n /**Buttons text */\n text?: string;\n /**Text size */\n size?: number;\n}\n\n/**Component for simple text */\nexport class FormText extends FormElement {\n static element_name() {\n return \"text\";\n }\n static element_name_space(): string {\n return \"form\";\n }\n\n constructor(options: FormTextOptions) {\n super();\n if (options.text) this.text = options.text;\n if (options.size) this.size = options.size;\n }\n\n /**Sets the current text of the element*/\n set text(text: string) {\n this.textContent = text;\n }\n get text() {\n return this.textContent;\n }\n\n /**Sets the current text of the element*/\n set size(size: number) {\n this.style.fontSize = size + \"rem\";\n this.style.lineHeight = size + \"rem\";\n }\n}\ndefine_element(FormText);\n\n/**Creates a button form element */\nexport function form_text(options: FormTextOptions): FormText {\n return new FormText(options);\n}\n","import {\n FormColors,\n FormOptions,\n FormValueOptions,\n FormValueWriteOptions,\n} from \"./base\";\nimport {\n form_button,\n FormButton,\n type FormButtonOptions,\n} from \"./boolean/button/button\";\nimport { form_lamp, FormLamp, type FormLampOptions } from \"./boolean/lamp/lamp\";\nimport {\n form_switch,\n FormSwitch,\n type FormSwitchOptions,\n} from \"./boolean/switch/switch\";\nimport { form_group, FormGroup, type FormGroupOptions } from \"./group/group\";\nimport {\n form_group_collapser,\n FormGroupCollapser,\n type FormGroupCollapserOptions,\n} from \"./group/group_collapser\";\nimport { form_list_field, ListFormField } from \"./list/list_field\";\nimport {\n type FormNumberOptions,\n type FormNumberWriteOptions,\n} from \"./number/number_base\";\nimport {\n form_number_input,\n FormNumberInput,\n} from \"./number/number_input/number_input\";\nimport { form_progress, FormProgress } from \"./number/progress/progress\";\nimport { form_slider, FormSlider } from \"./number/slider/slider\";\nimport { form_stepper, FormStepper } from \"./number/stepper/stepper\";\nimport {\n form_dropdown,\n FormDropdown,\n type FormDropDownOptions,\n type FormDropDownSelection,\n} from \"./selectors/drop_down/drop_down\";\nimport { type FormSelections } from \"./selectors/selector_base\";\nimport {\n form_toggle_button,\n FormToggleButton,\n type FormToggleButtonSelection,\n} from \"./selectors/toggle_button/toggle_button\";\nimport {\n form_spacer,\n FormSpacer,\n type FormSpacerOptions,\n} from \"./spacing/spacer\";\nimport {\n form_color,\n FormColor,\n type FormColorOptions,\n} from \"./special/color/color_input\";\nimport {\n form_date_time,\n FormDateTime,\n FormDateTimeMode,\n FormDateTimeType,\n type FormDateTimeOptions,\n} from \"./special/date_time/date_time_input\";\nimport { form_ip, FormIp, type FormIpOptions } from \"./special/ip/ip_input\";\nimport {\n form_password,\n FormPassword,\n type FormPasswordOptions,\n} from \"./special/password/password_input\";\nimport {\n form_text_input,\n FormTextInput,\n type FormTextInputOptions,\n} from \"./text/input/text_input\";\nimport {\n form_text_multiline,\n FormTextMultiline,\n type FormTextMultilineOptions,\n} from \"./text/multi_line/text_multi_line\";\nimport { form_text, FormText, type FormTextOptions } from \"./text/text/text\";\n\n/**Form elements with label */\nexport const form = {\n FormColors,\n\n //Boolean\n button: form_button,\n switch: form_switch,\n lamp: form_lamp,\n\n //Group\n group: form_group,\n group_collapser: form_group_collapser,\n\n //Special\n color: form_color,\n date_time: form_date_time,\n FormDateTimeMode,\n FormDateTimeType,\n ip: form_ip,\n password: form_password,\n\n //Number\n progress: form_progress,\n number_input: form_number_input,\n slider: form_slider,\n stepper: form_stepper,\n\n //Selectors\n dropdown: form_dropdown,\n toggle_button: form_toggle_button,\n\n //Spacing\n spacer: form_spacer,\n\n //Text\n text: form_text,\n text_input: form_text_input,\n text_multiline: form_text_multiline,\n\n //List\n list_field: form_list_field,\n};\nexport default form;\n\nexport type {\n FormButton,\n FormButtonOptions,\n FormColor,\n FormColorOptions,\n FormDateTime,\n FormDateTimeOptions,\n FormDropdown,\n FormDropDownOptions,\n FormDropDownSelection,\n FormGroup,\n FormGroupCollapser,\n FormGroupCollapserOptions,\n FormGroupOptions,\n FormIp,\n FormIpOptions,\n FormLamp,\n FormLampOptions,\n FormNumberInput,\n FormNumberOptions,\n FormNumberWriteOptions,\n FormOptions,\n FormPassword,\n FormPasswordOptions,\n FormProgress,\n FormSelections,\n FormSlider,\n FormSpacer,\n FormSpacerOptions,\n FormStepper,\n FormSwitch,\n FormSwitchOptions,\n FormText,\n FormTextInput,\n FormTextInputOptions,\n FormTextMultiline,\n FormTextMultilineOptions,\n FormTextOptions,\n FormToggleButton,\n FormToggleButtonSelection,\n FormValueOptions,\n FormValueWriteOptions,\n ListFormField,\n};\n\nexport { FormColors, FormElement, FormValue, FormValueWrite } from \"./base\";\nexport {\n FormDateTimeMode,\n FormDateTimeType,\n} from \"./special/date_time/date_time_input\";\n"],"mappings":";;;;;;;;;;;;;;;AAUA,MAAM,aAAa,yBACjB,QACA,oBACA,sCACF;AAQkB,WAAW,eAC3B,QACA,aACA,8CAEM,CAAC,CAAC,cACR,UACA,oBACA,qDACA,gBACA,gBACA,UACA,KAAA,CACF;AAUA,MAAM,SAAS,WAAW,eACxB,UACA,UACA,kCACF;AAQA,MAAM,cAAc,OAAO,eACzB,QACA,eACA,uCACF;AACA,YAAY,cACV,SACA,eACA,iCACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,YAAY,cACV,UACA,qBACA,sCACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,YAAY,cACV,YACA,uBACA,wCACA,KAAK,QACL,KAAK,OACL,SACA,KAAA,CACF;AACA,YAAY,cACV,cACA,yBACA,0CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AAUA,MAAM,oBAAoB,OAAO,eAC/B,aACA,gCACA,4DACF;AACA,kBAAkB,cAChB,UACA,qBACA,sCACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,kBAAkB,cAChB,YACA,uBACA,wCACA,KAAK,OACL,KAAK,OACL,SACA,KAAA,CACF;AACA,kBAAkB,cAChB,cACA,yBACA,0CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AAQA,MAAM,cAAc,OAAO,eACzB,QACA,eACA,uCACF;AACA,YAAY,cACV,UACA,qBACA,mCACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,YAAY,cACV,YACA,uBACA,4CACA,KAAK,QACL,KAAK,OACL,SACA,KAAA,CACF;AACA,YAAY,cACV,cACA,yBACA,8CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AAQA,MAAM,oBAAoB,OAAO,eAC/B,cACA,qBACA,6CACF;AACA,kBAAkB,cAChB,UACA,2BACA,4CACA,KAAK,OACL,KAAK,QACL,SACA,KAAA,CACF;AACA,kBAAkB,cAChB,SACA,0BACA,mDACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,kBAAkB,cAChB,cACA,+BACA,gDACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AAQA,MAAM,gBAAgB,OAAO,eAC3B,UACA,iBACA,yCACF;AACA,cAAc,cACZ,UACA,uBACA,wCACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,cAAc,cACZ,cACA,2BACA,4CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AAQqB,OAAO,eAC1B,SACA,gBACA,wCAES,CAAC,CAAC,cACX,UACA,eACA,kCACA,OAAO,QACP,OAAO,QACP,SACA,KAAA,CACF;AAQA,MAAM,eAAe,OAAO,eAC1B,SACA,gBACA,wCACF;AACA,aAAa,cACX,SACA,qBACA,8CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,aAAa,cACX,SACA,qBACA,8CACA,KAAK,QACL,KAAK,QACL,SACA,KAAA,CACF;AACA,aAAa,cACX,SACA,qBACA,8CAC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