@chocbite/ts-lib-ui 1.2.0 → 1.2.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.
package/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @chocbite/ts-lib-ui, notes for agents
2
2
 
3
- @chocbite/ts-lib-ui 1.2.0, built from ssh://git@forgejo.nsns.dk:2222/chocbite/ts-lib.git at commit e86d86d, with uncommitted changes.
3
+ @chocbite/ts-lib-ui 1.2.1, built from ssh://git@forgejo.nsns.dk:2222/chocbite/ts-lib.git at commit 607aff8.
4
4
 
5
5
  Read the sections for the modules you use before using them. The full source of this version is in `SOURCE.md` next to this file, every file under a `## <repo path>` heading, e.g. search it for `## package-ui/<module>/` to find a module.
6
6
 
package/SOURCE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @chocbite/ts-lib-ui source
2
2
 
3
- @chocbite/ts-lib-ui 1.2.0, built from ssh://git@forgejo.nsns.dk:2222/chocbite/ts-lib.git at commit e86d86d, with uncommitted changes.
3
+ @chocbite/ts-lib-ui 1.2.1, built from ssh://git@forgejo.nsns.dk:2222/chocbite/ts-lib.git at commit 607aff8.
4
4
 
5
5
  Every source file of the package, tests excluded, under a heading with its path in the repo. Usage notes are in `AGENTS.md` next to this file.
6
6
 
package/canvas/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import "../style.css";
2
2
  import { Base, define_element } from "../base/index.mjs";
3
- import { i as theme_init_variable_root } from "../theme-D0pRMLyT.mjs";
3
+ import { i as theme_init_variable_root } from "../theme-ycsugrdT.mjs";
4
4
  import { $q as material_open_with_rounded, ha as material_arrow_range_rounded, r2 as material_rotate_right_rounded } from "../icons-B88i-7MC.mjs";
5
5
  import { BLUE, GREY } from "@chocbite/ts-lib/colors";
6
6
  // canvas/shared.ts
@@ -1,2 +1,2 @@
1
1
  import "../style.css";
2
- export { r as CompAnchor, n as ContentBase, t as comp } from "../composition-BlntkKR0.mjs";
2
+ export { r as CompAnchor, n as ContentBase, t as comp } from "../composition-7xlf0UjB.mjs";
@@ -1,10 +1,10 @@
1
1
  import "./style.css";
2
- import { a as px_to_rem, c as ANIMATION_SPEED, f as SCALE, h as THEME, i as theme_init_variable_root, s as ANIMATION_LEVEL, u as INPUT_MODE } from "./theme-D0pRMLyT.mjs";
2
+ import { a as px_to_rem, c as ANIMATION_SPEED, f as SCALE, h as THEME, i as theme_init_variable_root, s as ANIMATION_LEVEL, u as INPUT_MODE } from "./theme-ycsugrdT.mjs";
3
3
  import { Base, CREATE, define_element, input_key } from "./base/index.mjs";
4
4
  import { DOCUMENT_HANDLER } from "./document/index.mjs";
5
- import { t as form } from "./form-CJA3s46n.mjs";
5
+ import { t as form } from "./form-CnIHz2Bp.mjs";
6
6
  import { hd as material_brightness_medium_rounded } from "./icons-B88i-7MC.mjs";
7
- import { t as ctm } from "./context-menu-C0KTV5zC.mjs";
7
+ import { t as ctm } from "./context-menu-DSVerkvr.mjs";
8
8
  import state from "@chocbite/ts-lib/state";
9
9
  import { GREY, ORANGE, RED } from "@chocbite/ts-lib/colors";
10
10
  // composition/shared.ts
@@ -866,4 +866,4 @@ const comp = {
866
866
  };
867
867
  export { ContentBase as n, CompAnchor as r, comp as t };
868
868
 
869
- //# sourceMappingURL=composition-BlntkKR0.mjs.map
869
+ //# sourceMappingURL=composition-7xlf0UjB.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"composition-BlntkKR0.mjs","names":[],"sources":["../../package-ui/composition/shared.ts","../../package-ui/composition/content.ts","../../package-ui/composition/panel.ts","../../package-ui/composition/container.ts","../../package-ui/composition/customization.ts","../../package-ui/composition/topbar.ts","../../package-ui/composition/index.ts"],"sourcesContent":["import { GREY, ORANGE, RED } from \"@chocbite/ts-lib/colors\";\nimport { px_to_rem, theme_init_variable_root } from \"#theme\";\n\n/** Type to store a position related to composition\n * position is always in rem*/\nexport interface CompPosition {\n x: number;\n y: number;\n}\n\n/**A point of a box, like the corner of a panel that its position places*/\nexport const CompAnchor = {\n TOP_RIGHT: \"top_right\",\n TOP_LEFT: \"top_left\",\n BOT_RIGHT: \"bot_right\",\n BOT_LEFT: \"bot_left\",\n CENTER: \"center\",\n} as const;\nexport type CompAnchor = (typeof CompAnchor)[keyof typeof CompAnchor];\n\n/**Where the anchor is in a box, as parts of its width and height from the top left*/\nexport function anchor_fraction(anchor: CompAnchor): [number, number] {\n if (anchor === CompAnchor.CENTER) return [0.5, 0.5];\n const [f, l] = anchor.split(\"_\");\n return [l === \"left\" ? 0 : 1, f === \"top\" ? 0 : 1];\n}\n\n/**Position in rem of the anchor point of the element, from the top left of the page*/\nexport function get_element_anchor_position(\n element: Element,\n anchor: CompAnchor,\n): CompPosition {\n const rect = element.getBoundingClientRect();\n const [ax, ay] = anchor_fraction(anchor);\n return {\n x: px_to_rem(rect.left + rect.width * ax),\n y: px_to_rem(rect.top + rect.height * ay),\n };\n}\n\nconst theme_root = theme_init_variable_root(\n \"composition\",\n \"Composition\",\n \"Theme variables for page composition, panels and top bar\",\n);\n\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\ncolors.make_variable(\n \"titlebar\",\n \"Title Bar Background\",\n \"Background color for the title bar of UI panels\",\n GREY[500],\n GREY[800],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"titlebarHover\",\n \"Title Bar Hover Background\",\n \"Background color for the title bar of UI panels when hovered\",\n GREY[400],\n GREY[700],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"titlebarCloseHover\",\n \"Title Bar Close Hover Background\",\n \"Background color for the title bar close button of UI panels when hovered\",\n RED[400],\n RED[700],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"titlebarText\",\n \"Title Bar Text\",\n \"Text color for the title bar of UI panels\",\n GREY[900],\n GREY[50],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"background\",\n \"Content Background\",\n \"Default background color for content areas\",\n GREY[100],\n \"#000000\",\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"icons\",\n \"Icons Color\",\n \"Default color for icons\",\n GREY[900],\n GREY[100],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"sizers\",\n \"Sizers\",\n \"Background color of the sizers of panels, shown in touch mode\",\n GREY[300],\n GREY[900],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"shadow\",\n \"Border Shadow\",\n \"Shadow color for borders and outlines\",\n \"#000000\",\n GREY[50],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"shadowFocus\",\n \"Border Shadow In Focus\",\n \"Shadow color for borders and outlines when in focus\",\n ORANGE[500],\n ORANGE[500],\n \"Color\",\n undefined,\n);\n","import {\n Base,\n CREATE,\n define_element,\n input_key,\n type InputOf,\n type InputOptions,\n} from \"#base\";\nimport ctm, { type ContextMenuGroup } from \"#context-menu\";\nimport type { SVGFunc } from \"#svg\";\nimport type { StateOrVal } from \"@chocbite/ts-lib/state\";\nimport \"./content.scss\";\nimport \"./shared\";\n\n/**Inputs of content that can be set again*/\nconst CONTENT = {\n /**Context menu of the content, also shown by its container, like on the title bar of a panel\n * Lines, a menu, or a function giving them, which is called every time the menu opens*/\n context_menu: input_key<ContextMenuGroup>(),\n};\nexport type ContentOptions = InputOptions<typeof CONTENT>;\n\n/**Inputs of content given at creation, the container showing the content follows them\n * Exported for the containers of this module, not from the module*/\nexport const CONTENT_CREATE = {\n /**Title the container shows, like on the title bar of a panel*/\n title: input_key<StateOrVal<string>>(),\n /**Icon the container shows in front of the title*/\n icon: input_key<StateOrVal<SVGFunc | undefined>>(),\n /**Whether the container lets the user close the content*/\n closable: input_key<StateOrVal<boolean>>(),\n /**Smallest width in rem the container gives the content*/\n min_width: input_key<StateOrVal<number>>(),\n /**Smallest height in rem the container gives the content*/\n min_height: input_key<StateOrVal<number>>(),\n};\nexport type ContentCreateOptions = ContentOptions &\n InputOptions<typeof CONTENT_CREATE>;\n\n/**Called by the container when it closes the content, internal to this module*/\nexport const CONTENT_CLOSED = Symbol(\"content_closed\");\n\n/**The context menu of content as it is right now, for ctm.combine, internal to this module*/\nexport function content_context_lines(content: ContentBase) {\n const group = content.content_context_menu;\n return typeof group === \"function\" ? group() : (group ?? []);\n}\n\n/**Base for anything shown in a container of this module, like a panel\n *\n * Library users extend it for their own content, and create it with MyContent.create(options),\n * the title, icon, closable and minimum size are given at creation, as the container follows them\n * To follow its own size, content attaches to the resize observer of Base and overrides on_resize*/\nexport abstract class ContentBase extends Base {\n static element_name() {\n return \"@abstract@\";\n }\n static element_name_space() {\n return \"@abstract@\";\n }\n\n #title: InputOf<typeof CONTENT_CREATE.title> = \"\";\n #icon: InputOf<typeof CONTENT_CREATE.icon> = undefined;\n #closable: InputOf<typeof CONTENT_CREATE.closable> = false;\n #min_width: InputOf<typeof CONTENT_CREATE.min_width> = 0;\n #min_height: InputOf<typeof CONTENT_CREATE.min_height> = 0;\n #context_menu: ContextMenuGroup = undefined;\n #on_close: (() => void)[] = [];\n\n constructor() {\n super();\n this.tabIndex = -1;\n this.classList.add(\"content\");\n ctm.attach(\n this,\n ctm.combine(() => content_context_lines(this)),\n );\n }\n\n /**Title the container shows, given at creation and never replaced*/\n get content_title(): InputOf<typeof CONTENT_CREATE.title> {\n return this.#title;\n }\n /**Icon the container shows, given at creation and never replaced*/\n get content_icon(): InputOf<typeof CONTENT_CREATE.icon> {\n return this.#icon;\n }\n /**Whether the container lets the user close the content, given at creation and never replaced*/\n get content_closable(): InputOf<typeof CONTENT_CREATE.closable> {\n return this.#closable;\n }\n /**Smallest width in rem, given at creation and never replaced*/\n get content_min_width(): InputOf<typeof CONTENT_CREATE.min_width> {\n return this.#min_width;\n }\n /**Smallest height in rem, given at creation and never replaced*/\n get content_min_height(): InputOf<typeof CONTENT_CREATE.min_height> {\n return this.#min_height;\n }\n /**Context menu of the content, read by the container every time its menu opens*/\n get content_context_menu(): ContextMenuGroup {\n return this.#context_menu;\n }\n\n [CREATE](options: ContentCreateOptions): void {\n super[CREATE](options);\n if (options.title !== undefined) this.#title = options.title;\n if (options.icon !== undefined) this.#icon = options.icon;\n if (options.closable !== undefined) this.#closable = options.closable;\n if (options.min_width !== undefined) this.#min_width = options.min_width;\n if (options.min_height !== undefined) this.#min_height = options.min_height;\n }\n\n set(options: ContentOptions): this {\n this.set_input(CONTENT.context_menu, options.context_menu, (menu) => {\n this.#context_menu = menu.value;\n });\n return this;\n }\n\n /**Resolves when the content is closed, by itself or by its container*/\n content_on_close(): Promise<void> {\n return new Promise<void>((resolve) => this.#on_close.push(resolve));\n }\n\n /**Closes the content, its container closes with it*/\n content_close(): void {\n this[CONTENT_CLOSED]();\n this.dispatchEvent(new CustomEvent(\"content_closed\", { bubbles: true }));\n }\n\n /**Resolves the waiting content_on_close promises, called by the container that closes the content*/\n [CONTENT_CLOSED](): void {\n for (const resolve of this.#on_close.splice(0)) resolve();\n }\n}\n\n/**Content without behavior of its own, filled with children by the user*/\nclass Content extends ContentBase {\n static element_name() {\n return \"content\";\n }\n static element_name_space() {\n return \"composition\";\n }\n}\ndefine_element(Content);\n\nexport type { Content };\n\n/**Content to fill with children, the title, icon, closable and minimum size are given here, the container follows them*/\nexport function content(options: ContentCreateOptions = {}): Content {\n return Content.create(options);\n}\n","import {\n Base,\n CREATE,\n define_element,\n input_key,\n type InputOf,\n type InputOptions,\n} from \"#base\";\nimport ctm from \"#context-menu\";\nimport type { SVGFunc } from \"#svg\";\nimport { px_to_rem } from \"#theme\";\nimport type { StateOrVal, StateOrValROSW } from \"@chocbite/ts-lib/state\";\nimport {\n CONTENT_CLOSED,\n CONTENT_CREATE,\n content_context_lines,\n type ContentBase,\n} from \"./content\";\nimport \"./panel.scss\";\nimport { anchor_fraction, CompAnchor } from \"./shared\";\n\n/**Inputs of the panel*/\nconst PANEL = {\n /**Layer of the panel, panels in a higher layer are always above panels in a lower one*/\n layer: input_key<StateOrVal<number>>(),\n /**Horizontal position in rem from the left of the page, of the anchor point of the panel\n * Not given the panel starts centered, a fixed value can not be moved by the user, a writable state is written when the user moves the panel*/\n x: input_key<StateOrValROSW<number>>(),\n /**Vertical position in rem from the top of the page, of the anchor point of the panel, works like x*/\n y: input_key<StateOrValROSW<number>>(),\n /**Point of the panel that x and y place, top_left by default*/\n anchor: input_key<StateOrVal<CompAnchor>>(),\n /**Width in rem, not given the panel fits its content\n * A fixed value can not be sized by the user, a writable state is written when the user sizes the panel*/\n width: input_key<StateOrValROSW<number>>(),\n /**Height in rem, works like width*/\n height: input_key<StateOrValROSW<number>>(),\n /**Whether the user can size the panel, at the sides where width and height can be written, true by default*/\n sizeable: input_key<StateOrVal<boolean>>(),\n /**Whether the panel is hidden, auto_hide writes it, so give a writable state to show the panel again*/\n hidden: input_key<StateOrValROSW<boolean>>(),\n /**Hides the panel when the user presses outside it*/\n auto_hide: input_key<StateOrVal<boolean>>(),\n /**Closes the panel when the user presses outside it*/\n auto_close: input_key<StateOrVal<boolean>>(),\n /**Darkens the page behind the panel and keeps the focus in it*/\n modal: input_key<StateOrVal<boolean>>(),\n /**Whether the title bar is shown, true by default*/\n titlebar: input_key<StateOrVal<boolean>>(),\n};\nexport type PanelOptions = InputOptions<typeof PANEL>;\n\n/**Inputs of the content the panel follows, inner inputs that are not options*/\nconst PANEL_CONTENT = {\n title: input_key<InputOf<typeof CONTENT_CREATE.title>>(),\n icon: input_key<InputOf<typeof CONTENT_CREATE.icon>>(),\n closable: input_key<InputOf<typeof CONTENT_CREATE.closable>>(),\n min_width: input_key<InputOf<typeof CONTENT_CREATE.min_width>>(),\n min_height: input_key<InputOf<typeof CONTENT_CREATE.min_height>>(),\n};\n\n/**Smallest size of a panel in rem*/\nconst MIN_SIZE = 4;\n/**How much of the panel is kept inside the container, at the top in rem, at the sides as part of its width*/\nconst KEEP_TOP = 2;\nconst KEEP_SIDE = 0.5;\n\n//Internal to this module, between the panel and its container\nexport const PANEL_ADDED = Symbol(\"panel_added\");\nexport const PANEL_LAYOUT = Symbol(\"panel_layout\");\nexport const HOST_LAYER = Symbol(\"host_layer\");\nexport const HOST_RAISE = Symbol(\"host_raise\");\nexport const HOST_REMOVE = Symbol(\"host_remove\");\n\n/**The container of a panel, as the panel sees it*/\nexport interface PanelHost {\n /**Width in rem*/\n readonly width: number;\n /**Height in rem*/\n readonly height: number;\n /**Moves the panel into the given layer*/\n [HOST_LAYER](panel: Panel, layer: number): void;\n /**Puts the panel above the others in its layer*/\n [HOST_RAISE](panel: Panel): void;\n /**Forgets the panel, it is closed*/\n [HOST_REMOVE](panel: Panel): void;\n}\n\n/**Values of the inputs the user can change by moving, sizing or hiding the panel*/\ninterface ChangeableValues {\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n hidden: boolean;\n}\ntype Changeable = keyof ChangeableValues;\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.max(min, Math.min(value, max));\n\nclass Panel extends Base {\n static element_name() {\n return \"panel\";\n }\n static element_name_space() {\n return \"composition\";\n }\n\n #host?: PanelHost;\n #content!: ContentBase;\n\n #sizer = this.appendChild(document.createElement(\"div\"));\n #titlebar = this.appendChild(document.createElement(\"div\"));\n #icon?: HTMLDivElement;\n #title = this.#titlebar.appendChild(document.createElement(\"div\"));\n #close_button?: HTMLSpanElement;\n #content_box = this.appendChild(document.createElement(\"div\"));\n #focus_catcher?: HTMLDivElement;\n\n #layer = 0;\n #anchor: CompAnchor = CompAnchor.TOP_LEFT;\n #sizeable = true;\n #auto_hide = false;\n #auto_close = false;\n #min_width = 0;\n #min_height = 0;\n /**Values of the changeable inputs, the panel owns them until they are given*/\n #values: ChangeableValues = { hidden: false };\n #given = new Set<Changeable>();\n /**Position shown last, in rem, the start of moving and sizing*/\n #left = 0;\n #top = 0;\n #moving = false;\n #on_close: (() => void)[] = [];\n\n constructor() {\n super();\n this.tabIndex = 0;\n this.attach_to_resize_observer();\n this.addEventListener(\"focus\", () => this.#content.focus());\n this.addEventListener(\"focusin\", () => this.#host?.[HOST_RAISE](this));\n this.addEventListener(\"content_closed\", (e) => {\n e.stopPropagation();\n this.close();\n });\n\n this.#titlebar.tabIndex = 0;\n this.#title.classList.add(\"title\");\n ctm.attach(\n this.#titlebar,\n ctm.combine(() => content_context_lines(this.#content)),\n () => this.#moving,\n );\n this.#titlebar.onpointerdown = (e) => this.#move_start(e);\n this.#titlebar.onkeydown = (e) => this.#move_key(e);\n\n for (const side of [\"n\", \"s\", \"e\", \"w\", \"ne\", \"nw\", \"se\", \"sw\"]) {\n const handle = this.#sizer.appendChild(document.createElement(\"div\"));\n handle.classList.add(side);\n if (side.length === 1)\n handle.appendChild(document.createElement(\"div\")).textContent =\n \"\\ue25d\";\n handle.onpointerdown = (e) => this.#size_start(e, handle, side);\n }\n }\n\n [CREATE](options: { content: ContentBase }): void {\n super[CREATE](options);\n const content = (this.#content = options.content);\n this.#content_box.appendChild(content);\n this.set_input(PANEL_CONTENT.icon, content.content_icon, (icon) =>\n this.#set_icon(icon.ok ? icon.value : undefined),\n );\n this.set_input(PANEL_CONTENT.title, content.content_title, (title) => {\n this.#title.textContent = title.ok ? title.value : \"⚠ \" + title.error;\n });\n this.set_input(PANEL_CONTENT.closable, content.content_closable, (c) =>\n this.#set_closable(c.ok && c.value),\n );\n this.set_input(PANEL_CONTENT.min_width, content.content_min_width, (w) => {\n this.#min_width = w.ok ? w.value : 0;\n this.#layout();\n });\n this.set_input(\n PANEL_CONTENT.min_height,\n content.content_min_height,\n (h) => {\n this.#min_height = h.ok ? h.value : 0;\n this.#layout();\n },\n );\n }\n\n set(options: PanelOptions): this {\n this.set_input(PANEL.layer, options.layer, (layer) => {\n this.#layer = layer.ok ? layer.value : 0;\n this.#host?.[HOST_LAYER](this, this.#layer);\n });\n this.set_input(PANEL.anchor, options.anchor, (anchor) => {\n this.#anchor = anchor.ok ? anchor.value : CompAnchor.TOP_LEFT;\n this.#layout();\n });\n for (const name of [\"x\", \"y\", \"width\", \"height\"] as const) {\n if (options[name] !== undefined) this.#given.add(name);\n this.set_input(PANEL[name], options[name], (value) => {\n this.#values[name] = value.value;\n this.#layout();\n });\n }\n if (options.hidden !== undefined) this.#given.add(\"hidden\");\n this.set_input(PANEL.hidden, options.hidden, (hidden) => {\n this.#values.hidden = hidden.value;\n this.classList.toggle(\"hidden\", hidden.value);\n this.#layout();\n });\n this.set_input(PANEL.sizeable, options.sizeable, (sizeable) => {\n this.#sizeable = sizeable.ok && sizeable.value;\n this.#layout();\n });\n this.set_input(PANEL.auto_hide, options.auto_hide, (auto_hide) => {\n this.#auto_hide = auto_hide.ok && auto_hide.value;\n });\n this.set_input(PANEL.auto_close, options.auto_close, (auto_close) => {\n this.#auto_close = auto_close.ok && auto_close.value;\n });\n this.set_input(PANEL.modal, options.modal, (modal) =>\n this.#set_modal(modal.ok && modal.value),\n );\n this.set_input(PANEL.titlebar, options.titlebar, (titlebar) => {\n this.classList.toggle(\"no-titlebar\", !(titlebar.ok && titlebar.value));\n this.#layout();\n });\n return this;\n }\n\n /**Content the panel shows, given when the panel is created*/\n get content(): ContentBase {\n return this.#content;\n }\n\n /**Resolves when the panel is closed*/\n on_close(): Promise<void> {\n return new Promise<void>((resolve) => this.#on_close.push(resolve));\n }\n\n /**Closes the panel and its content*/\n close(): void {\n this.ownerDocument.removeEventListener(\"pointerdown\", this.#outside, {\n capture: true,\n });\n this.#host?.[HOST_REMOVE](this);\n this.#host = undefined;\n this.remove();\n this.#content[CONTENT_CLOSED]();\n for (const resolve of this.#on_close.splice(0)) resolve();\n }\n\n /**Called by the container that shows the panel, once, after creating it*/\n [PANEL_ADDED](host: PanelHost): void {\n this.#host = host;\n host[HOST_LAYER](this, this.#layer);\n host[HOST_RAISE](this);\n this.ownerDocument.addEventListener(\"pointerdown\", this.#outside, {\n capture: true,\n passive: true,\n });\n this.#layout();\n }\n\n /**Called by the container when its size changes*/\n [PANEL_LAYOUT](): void {\n this.#layout();\n }\n\n protected on_resize(): void {\n this.#layout();\n }\n\n // _____ _ _ _ _ _____ ______\n // / ____| | | | /\\ | \\ | |/ ____| ____|\n // | | | |__| | / \\ | \\| | | __| |__\n // | | | __ | / /\\ \\ | . ` | | |_ | __|\n // | |____| | | |/ ____ \\| |\\ | |__| | |____\n // \\_____|_| |_/_/ \\_\\_| \\_|\\_____|______|\n /**Whether the user can change the input, when the panel owns it or it is a writable state*/\n #can_change(name: Changeable): boolean {\n return !this.#given.has(name) || this.#state_of(name) !== undefined;\n }\n\n /**The writable state the input has, undefined for a fixed value or one never given*/\n #state_of(name: Changeable) {\n return this.input_state<StateOrValROSW<number | boolean>>(PANEL[name]);\n }\n\n /**Writes a change by the user, to the state of the input, or to the panel when it owns the input*/\n #change<N extends Changeable>(\n name: N,\n value: NonNullable<ChangeableValues[N]>,\n ): void {\n const state = this.#state_of(name);\n if (state) void state.write(value);\n else if (!this.#given.has(name)) {\n this.#values[name] = value;\n if (name === \"hidden\") this.classList.toggle(\"hidden\", value === true);\n this.#layout();\n }\n }\n\n #outside = (e: Event) => {\n if (this.#values.hidden) return;\n if (this.contains(e.target as Node) && e.target !== this) return;\n if (this.#auto_close) this.close();\n else if (this.#auto_hide) this.#change(\"hidden\", true);\n };\n\n // _ __ ______ _ _ _______\n // | | /\\\\ \\ / / __ \\| | | |__ __|\n // | | / \\\\ \\_/ / | | | | | | | |\n // | | / /\\ \\\\ /| | | | | | | | |\n // | |____ / ____ \\| | | |__| | |__| | | |\n // |______/_/ \\_\\_| \\____/ \\____/ |_|\n /**Left edge shown for the given one, keeping part of the panel inside the container*/\n #clamp_left(left: number, width: number): number {\n const keep = width * KEEP_SIDE;\n return clamp(left, -keep, this.#host!.width - keep);\n }\n /**Top edge shown for the given one, keeping the title bar inside the container*/\n #clamp_top(top: number): number {\n return clamp(top, 0, Math.max(0, this.#host!.height - KEEP_TOP));\n }\n\n /**Applies size and position, the position is only clamped for showing, the inputs keep their values*/\n #layout(): void {\n if (!this.#host || !this.isConnected) return;\n const { width, height } = this.#values;\n this.style.width = width === undefined ? \"\" : width + \"rem\";\n this.style.height = height === undefined ? \"\" : height + \"rem\";\n this.style.minWidth = Math.max(MIN_SIZE, this.#min_width) + \"rem\";\n this.style.minHeight = `calc(${Math.max(MIN_SIZE, this.#min_height)}rem + var(--titlebar-height))`;\n this.#sizer.classList.toggle(\n \"x\",\n this.#sizeable && this.#can_change(\"width\"),\n );\n this.#sizer.classList.toggle(\n \"y\",\n this.#sizeable && this.#can_change(\"height\"),\n );\n this.classList.toggle(\"size-x\", this.#sizer.classList.contains(\"x\"));\n this.classList.toggle(\"size-y\", this.#sizer.classList.contains(\"y\"));\n if (this.#values.hidden) return;\n\n const rect = this.getBoundingClientRect();\n const w = px_to_rem(rect.width);\n const h = px_to_rem(rect.height);\n const [ax, ay] = anchor_fraction(this.#anchor);\n const { x, y } = this.#values;\n this.#left = this.#clamp_left(\n x === undefined ? (this.#host.width - w) / 2 : x - w * ax,\n w,\n );\n this.#top = this.#clamp_top(\n y === undefined ? (this.#host.height - h) / 2 : y - h * ay,\n );\n this.style.left = this.#left + \"rem\";\n this.style.top = this.#top + \"rem\";\n }\n\n // __ __ ______ _______ _ _ _____\n // | \\/ |/ __ \\ \\ / /_ _| \\ | |/ ____|\n // | \\ / | | | \\ \\ / / | | | \\| | | __\n // | |\\/| | | | |\\ \\/ / | | | . ` | | |_ |\n // | | | | |__| | \\ / _| |_| |\\ | |__| |\n // |_| |_|\\____/ \\/ |_____|_| \\_|\\_____|\n /**Moves the panel so its top left corner is at the given position, clamped, on the axes the user can change*/\n #move_to(left: number, top: number): void {\n const rect = this.getBoundingClientRect();\n const w = px_to_rem(rect.width);\n const h = px_to_rem(rect.height);\n const [ax, ay] = anchor_fraction(this.#anchor);\n if (this.#can_change(\"x\"))\n this.#change(\"x\", this.#clamp_left(left, w) + w * ax);\n if (this.#can_change(\"y\")) this.#change(\"y\", this.#clamp_top(top) + h * ay);\n }\n\n #move_start(e: PointerEvent): void {\n if (e.button !== 0) return;\n if (!this.#can_change(\"x\") && !this.#can_change(\"y\")) return;\n const titlebar = this.#titlebar;\n titlebar.setPointerCapture(e.pointerId);\n titlebar.classList.add(\"moving\");\n this.#moving = true;\n const left = this.#left;\n const top = this.#top;\n titlebar.onpointermove = (ev) =>\n this.#move_to(\n left + px_to_rem(ev.clientX - e.clientX),\n top + px_to_rem(ev.clientY - e.clientY),\n );\n titlebar.onpointerup = (ev) => {\n titlebar.releasePointerCapture(ev.pointerId);\n titlebar.classList.remove(\"moving\");\n this.#moving = false;\n titlebar.onpointermove = null;\n titlebar.onpointerup = null;\n };\n }\n\n #move_key(e: KeyboardEvent): void {\n const step = e.shiftKey ? 5 : e.ctrlKey ? 0.1 : 1;\n const [dx, dy] =\n {\n ArrowLeft: [-step, 0],\n ArrowRight: [step, 0],\n ArrowUp: [0, -step],\n ArrowDown: [0, step],\n }[e.key] ?? [];\n if (dx === undefined || dy === undefined) return;\n e.preventDefault();\n e.stopPropagation();\n this.#move_to(this.#left + dx, this.#top + dy);\n }\n\n // _____ _____ ___________ _ _ _____\n // / ____|_ _|___ /_ _| \\ | |/ ____|\n // | (___ | | / / | | | \\| | | __\n // \\___ \\ | | / / | | | . ` | | |_ |\n // ____) |_| |_ / /__ _| |_| |\\ | |__| |\n // |_____/|_____/_____|_____|_| \\_|\\_____|\n /**Sizes the panel from one side or corner, the opposite side stays where it is when x and y can be written*/\n #size_start(e: PointerEvent, handle: HTMLDivElement, side: string): void {\n if (e.button !== 0) return;\n e.stopPropagation();\n const host = this.#host;\n if (!host) return;\n handle.setPointerCapture(e.pointerId);\n const rect = this.getBoundingClientRect();\n const w0 = px_to_rem(rect.width);\n const h0 = px_to_rem(rect.height);\n const left0 = this.#left;\n const top0 = this.#top;\n const [ax, ay] = anchor_fraction(this.#anchor);\n const min_w = Math.max(MIN_SIZE, this.#min_width);\n const min_h =\n Math.max(MIN_SIZE, this.#min_height) +\n px_to_rem(this.#titlebar.getBoundingClientRect().height);\n const horizontal = this.#sizer.classList.contains(\"x\");\n const vertical = this.#sizer.classList.contains(\"y\");\n handle.onpointermove = (ev) => {\n const dx = px_to_rem(ev.clientX - e.clientX);\n const dy = px_to_rem(ev.clientY - e.clientY);\n if (horizontal && (side.includes(\"e\") || side.includes(\"w\"))) {\n const east = side.includes(\"e\");\n const w = clamp(east ? w0 + dx : w0 - dx, min_w, host.width);\n this.#change(\"width\", w);\n if (this.#can_change(\"x\"))\n this.#change(\"x\", (east ? left0 : left0 + w0 - w) + w * ax);\n }\n if (vertical && (side.includes(\"n\") || side.includes(\"s\"))) {\n const south = side.includes(\"s\");\n const h = clamp(south ? h0 + dy : h0 - dy, min_h, host.height);\n this.#change(\"height\", h);\n if (this.#can_change(\"y\"))\n this.#change(\"y\", (south ? top0 : top0 + h0 - h) + h * ay);\n }\n };\n handle.onpointerup = (ev) => {\n handle.releasePointerCapture(ev.pointerId);\n handle.onpointermove = null;\n handle.onpointerup = null;\n this.#titlebar.focus();\n };\n }\n\n // _____ _____ ______ _____ _____ ____ _____ _____ ______ _____\n // /\\ / ____/ ____| ____|/ ____/ ____|/ __ \\| __ \\|_ _| ____|/ ____|\n // / \\ | | | | | |__ | (___| (___ | | | | |__) | | | | |__ | (___\n // / /\\ \\| | | | | __| \\___ \\\\___ \\| | | | _ / | | | __| \\___ \\\n // / ____ \\ |___| |____| |____ ____) |___) | |__| | | \\ \\ _| |_| |____ ____) |\n // /_/ \\_\\_____\\_____|______|_____/_____/ \\____/|_| \\_\\_____|______|_____/\n #set_icon(icon?: SVGFunc): void {\n if (icon) {\n this.#icon ??= this.#titlebar.insertBefore(\n document.createElement(\"div\"),\n this.#title,\n );\n this.#icon.classList.add(\"icon\");\n this.#icon.replaceChildren(icon());\n } else {\n this.#icon?.remove();\n this.#icon = undefined;\n }\n }\n\n #set_closable(closable: boolean): void {\n if (closable && !this.#close_button) {\n const button = (this.#close_button = this.#titlebar.appendChild(\n document.createElement(\"span\"),\n ));\n button.classList.add(\"close-button\");\n button.textContent = \"×\";\n button.onpointerdown = (e) => {\n e.preventDefault();\n e.stopPropagation();\n button.setPointerCapture(e.pointerId);\n button.onpointerup = (e) => {\n button.releasePointerCapture(e.pointerId);\n button.onpointerup = null;\n const rect = button.getBoundingClientRect();\n if (\n e.clientX >= rect.left &&\n e.clientX <= rect.right &&\n e.clientY >= rect.top &&\n e.clientY <= rect.bottom\n )\n this.close();\n };\n };\n button.oncontextmenu = (e) => {\n e.preventDefault();\n e.stopPropagation();\n };\n button.ontouchend = (e) => {\n if (e.cancelable) e.preventDefault();\n e.stopPropagation();\n };\n } else if (!closable && this.#close_button) {\n this.#close_button.remove();\n this.#close_button = undefined;\n }\n }\n\n #set_modal(modal: boolean): void {\n this.classList.toggle(\"modal\", modal);\n if (modal && !this.#focus_catcher) {\n //Tabbing past the end of the panel comes back to its content\n this.#focus_catcher = this.appendChild(document.createElement(\"div\"));\n this.#focus_catcher.tabIndex = 0;\n this.#focus_catcher.onfocus = () => this.#content.focus();\n } else if (!modal && this.#focus_catcher) {\n this.#focus_catcher.remove();\n this.#focus_catcher = undefined;\n }\n }\n}\ndefine_element(Panel);\n\nexport { Panel };\n","import { Base, define_element, input_key } from \"#base\";\nimport { DOCUMENT_HANDLER } from \"#document\";\nimport { px_to_rem, SCALE } from \"#theme\";\nimport type { StateOrValROS } from \"@chocbite/ts-lib/state\";\nimport type { ContentBase } from \"./content\";\nimport \"./container.scss\";\nimport {\n HOST_LAYER,\n HOST_RAISE,\n HOST_REMOVE,\n Panel,\n PANEL_ADDED,\n PANEL_LAYOUT,\n type PanelHost,\n type PanelOptions,\n} from \"./panel\";\n\n/**Internal input, the scale changes the size of the container in rem*/\nconst SCALE_KEY = input_key<StateOrValROS<number>>();\n\n/**Layer over the whole page that panels float in, one per document*/\nclass PanelContainer extends Base implements PanelHost {\n static element_name() {\n return \"panelcontainer\";\n }\n static element_name_space() {\n return \"composition\";\n }\n\n #layers = new Map<number, HTMLDivElement>();\n #panels = new Set<Panel>();\n #raised = 0;\n #active?: Panel;\n\n constructor() {\n super();\n this.attach_to_resize_observer();\n this.set_input(SCALE_KEY, SCALE, () => this.#layout());\n }\n\n /**Width in rem*/\n get width(): number {\n return px_to_rem(this.actual_size.width);\n }\n /**Height in rem*/\n get height(): number {\n return px_to_rem(this.actual_size.height);\n }\n /**Panel the user worked in last*/\n get active_panel(): Panel | undefined {\n return this.#active;\n }\n\n /**Creates a panel showing the content in this container\n * The title, icon, close button and minimum size come from the content, see content*/\n panel(content: ContentBase, options: PanelOptions = {}): Panel {\n const panel = Panel.create({ ...options, content });\n this.#panels.add(panel);\n panel[PANEL_ADDED](this);\n return panel;\n }\n\n protected on_resize(): void {\n this.#layout();\n }\n\n #layout(): void {\n for (const panel of this.#panels) panel[PANEL_LAYOUT]();\n }\n\n [HOST_LAYER](panel: Panel, layer: number): void {\n let box = this.#layers.get(layer);\n if (!box) {\n box = document.createElement(\"div\");\n box.style.zIndex = String(layer);\n this.#layers.set(layer, box);\n //Layers in order, so the DOM order matches what is shown\n const above = [...this.#layers].filter(([l]) => l > layer);\n const next = above.sort(([a], [b]) => a - b)[0]?.[1];\n this.insertBefore(box, next ?? null);\n }\n //Moving an element reconnects it, which applies its states again\n if (panel.parentElement !== box) box.appendChild(panel);\n }\n\n [HOST_RAISE](panel: Panel): void {\n this.#active = panel;\n panel.style.zIndex = String(++this.#raised);\n }\n\n [HOST_REMOVE](panel: Panel): void {\n this.#panels.delete(panel);\n if (this.#active === panel) this.#active = undefined;\n }\n}\ndefine_element(PanelContainer);\n\nexport type { PanelContainer };\n\nconst CONTAINERS = new WeakMap<Document, PanelContainer>();\nDOCUMENT_HANDLER.events.on(\"removed\", (e) => {\n CONTAINERS.get(e.data)?.remove();\n CONTAINERS.delete(e.data);\n});\n\n/**The panel container of the document the given node is in, the main document by default\n * The container is made the first time it is asked for*/\nexport function panel_container(\n owner: Node = DOCUMENT_HANDLER.main,\n): PanelContainer {\n const doc = owner.ownerDocument ?? (owner as Document);\n let container = CONTAINERS.get(doc);\n if (!container) {\n container = PanelContainer.create();\n doc.documentElement.appendChild(container);\n CONTAINERS.set(doc, container);\n }\n return container;\n}\n\n/**Creates a panel showing the content, in the main document\n * Use panel_container(element).panel for another document*/\nexport function panel(content: ContentBase, options: PanelOptions = {}): Panel {\n return panel_container().panel(content, options);\n}\n","import { define_element, input_key, type InputOptions } from \"#base\";\nimport { DOCUMENT_HANDLER } from \"#document\";\nimport form, { type FormElement } from \"#form\";\nimport { material_brightness_medium_rounded } from \"#icons\";\nimport {\n ANIMATION_LEVEL,\n ANIMATION_SPEED,\n INPUT_MODE,\n SCALE,\n THEME,\n} from \"#theme\";\nimport state, { type StateOrVal, type StateROSW } from \"@chocbite/ts-lib/state\";\nimport { panel_container } from \"./container\";\nimport {\n ContentBase,\n type ContentCreateOptions,\n type ContentOptions,\n} from \"./content\";\nimport type { Panel } from \"./panel\";\nimport { get_element_anchor_position, type CompAnchor } from \"./shared\";\n\n/**Inputs of the customization*/\nconst CUSTOMIZATION = {\n /**Settings of the app, shown under the theme*/\n main: input_key<StateOrVal<readonly FormElement[]>>(),\n /**Advanced settings of the app, shown last in the advanced section*/\n advanced: input_key<StateOrVal<readonly FormElement[]>>(),\n};\nexport type CustomizationOptions = ContentOptions &\n InputOptions<typeof CUSTOMIZATION>;\nexport type CustomizationCreateOptions = ContentCreateOptions &\n CustomizationOptions;\n\n/**Content with the settings of the library, theme, scale, input mode and animations, and settings of the app*/\nclass Customization extends ContentBase {\n static element_name() {\n return \"customization\";\n }\n static element_name_space() {\n return \"composition\";\n }\n\n #main = form.group({ embed: true });\n #advanced = form.group({ embed: true });\n\n constructor() {\n super();\n this.appendChild(\n form.group({\n elements: [\n form.toggle_button().bind({ value: THEME }),\n this.#main,\n form.group_collapser(\n form.group({\n embed: true,\n elements: [\n form.text({ text: \"UI Scale\" }),\n form.stepper().bind({ value: SCALE }),\n form.text({ text: \"Input Mode\" }),\n form.toggle_button().bind({ value: INPUT_MODE }),\n form.text({ text: \"Animation Level\" }),\n form.toggle_button().bind({ value: ANIMATION_LEVEL }),\n form.text({ text: \"Animation Speed\" }),\n form.slider({ live: true }).bind({ value: ANIMATION_SPEED }),\n this.#advanced,\n ],\n }),\n { closed_text: \"Advanced\", collapsed: true },\n ),\n ],\n }),\n );\n }\n\n set(options: CustomizationOptions): this {\n super.set(options);\n this.set_input(CUSTOMIZATION.main, options.main, (elements) => {\n this.#main = replace_group(this.#main, elements.ok ? elements.value : []);\n });\n this.set_input(CUSTOMIZATION.advanced, options.advanced, (elements) => {\n this.#advanced = replace_group(\n this.#advanced,\n elements.ok ? elements.value : [],\n );\n });\n return this;\n }\n}\ndefine_element(Customization);\n\n/**A form group only takes elements once, so a new list gets a new group*/\nconst replace_group = (old: HTMLElement, elements: readonly FormElement[]) => {\n const group = form.group({ embed: true, elements: [...elements] });\n old.replaceWith(group);\n return group;\n};\n\nexport type { Customization };\n\n/**Content with the settings of the library, and of the app given as main and advanced\n * The title, icon and minimum size have defaults, give them to change them*/\nexport function customization(\n options: CustomizationCreateOptions = {},\n): Customization {\n return Customization.create({\n title: \"Customization\",\n icon: material_brightness_medium_rounded,\n closable: true,\n min_width: 10,\n min_height: 6,\n ...options,\n });\n}\n\n/**The customization in a hidden modal panel*/\nexport interface CustomizationPanel {\n readonly panel: Panel;\n readonly content: Customization;\n /**Whether the panel is hidden, write false to show it, the panel writes true when the user presses outside it*/\n readonly hidden: StateROSW<boolean>;\n}\n\n/**Creates the customization in a modal panel, hidden, it hides again when the user presses outside it\n * Change the panel with panel.set, like its position\n * @param owner the panel is made in the document of the owner, the main document by default*/\nexport function customization_panel(\n options: CustomizationCreateOptions = {},\n owner: Node = DOCUMENT_HANDLER.main,\n): CustomizationPanel {\n const content = customization(options);\n const hidden = state.ok_w(true);\n const panel = panel_container(owner).panel(content, {\n sizeable: false,\n titlebar: false,\n width: 20,\n hidden,\n auto_hide: true,\n modal: true,\n layer: 9999,\n });\n return { panel, content, hidden };\n}\n\n/**Shows the customization panel when the element is clicked, with the anchor of the panel at the anchor of the element\n * @param c_panel the panel to show, a new one in the document of the element by default*/\nexport function attach_customization_panel_to_element(\n element: Element,\n element_anchor: CompAnchor,\n panel_anchor: CompAnchor,\n c_panel: CustomizationPanel = customization_panel({}, element),\n): CustomizationPanel {\n element.addEventListener(\"click\", () => {\n const { x, y } = get_element_anchor_position(element, element_anchor);\n c_panel.panel.set({ x, y, anchor: panel_anchor });\n void c_panel.hidden.write(false);\n c_panel.panel.focus();\n });\n return c_panel;\n}\n","import { Base, define_element, input_key, type InputOptions } from \"#base\";\nimport type { SVGFunc } from \"#svg\";\nimport type { StateOrVal } from \"@chocbite/ts-lib/state\";\nimport \"./shared\";\nimport \"./topbar.scss\";\n\n/**Shared base of the top bar elements, only sets the namespace*/\nabstract class TopbarBase extends Base {\n static element_name() {\n return \"@abstract@\";\n }\n static element_name_space() {\n return \"composition\";\n }\n}\n\n// _______ ____ _____ ____ _____\n// |__ __/ __ \\| __ \\| _ \\ /\\ | __ \\\n// | | | | | | |__) | |_) | / \\ | |__) |\n// | | | | | | ___/| _ < / /\\ \\ | _ /\n// | | | |__| | | | |_) / ____ \\| | \\ \\\n// |_| \\____/|_| |____/_/ \\_\\_| \\_\\\n/**Inputs of the top bar*/\nconst TOPBAR = {\n /**Items at the left side, the side is empty on errors*/\n left: input_key<StateOrVal<readonly Element[]>>(),\n /**Items in the middle, the middle is empty on errors*/\n mid: input_key<StateOrVal<readonly Element[]>>(),\n /**Items at the right side, the side is empty on errors*/\n right: input_key<StateOrVal<readonly Element[]>>(),\n};\nexport type TopbarOptions = InputOptions<typeof TOPBAR>;\n\n/**Bar along the top of a page, with items at the left, in the middle and at the right*/\nclass Topbar extends TopbarBase {\n static element_name() {\n return \"topbar\";\n }\n\n #left = this.appendChild(document.createElement(\"div\"));\n #mid = this.appendChild(document.createElement(\"div\"));\n #right = this.appendChild(document.createElement(\"div\"));\n\n set(options: TopbarOptions): this {\n this.set_input(TOPBAR.left, options.left, (items) => {\n this.#left.replaceChildren(...(items.ok ? items.value : []));\n });\n this.set_input(TOPBAR.mid, options.mid, (items) => {\n this.#mid.replaceChildren(...(items.ok ? items.value : []));\n });\n this.set_input(TOPBAR.right, options.right, (items) => {\n this.#right.replaceChildren(...(items.ok ? items.value : []));\n });\n return this;\n }\n}\ndefine_element(Topbar);\n\n// ____ _ _ _______ _______ ____ _ _\n// | _ \\| | | |__ __|__ __/ __ \\| \\ | |\n// | |_) | | | | | | | | | | | | \\| |\n// | _ <| | | | | | | | | | | | . ` |\n// | |_) | |__| | | | | | | |__| | |\\ |\n// |____/ \\____/ |_| |_| \\____/|_| \\_|\n/**Inputs of a top bar button*/\nconst BUTTON = {\n /**Text of the button, shows the error on errors*/\n text: input_key<StateOrVal<string>>(),\n /**Icon in front of the text, no icon on errors*/\n icon: input_key<StateOrVal<SVGFunc | undefined>>(),\n /**Called when the button is clicked, a plain value as it is not shown*/\n on_click: input_key<() => void>(),\n};\nexport type TopbarButtonOptions = InputOptions<typeof BUTTON>;\n\n/**Button for the top bar, with an icon, a text or both*/\nclass TopbarButton extends TopbarBase {\n static element_name() {\n return \"topbar-button\";\n }\n\n #icon?: SVGSVGElement;\n #text = this.appendChild(document.createElement(\"span\"));\n #on_click?: () => void;\n\n constructor() {\n super();\n this.onclick = () => this.#on_click?.();\n }\n\n set(options: TopbarButtonOptions): this {\n this.set_input(BUTTON.on_click, options.on_click, (on_click) => {\n this.#on_click = on_click.value;\n });\n this.set_input(BUTTON.text, options.text, (text) => {\n this.#text.textContent = text.ok ? text.value : \"⚠ \" + text.error;\n });\n this.set_input(BUTTON.icon, options.icon, (icon) => {\n this.#icon?.remove();\n this.#icon = icon.ok && icon.value ? icon.value() : undefined;\n if (this.#icon) this.prepend(this.#icon);\n });\n return this;\n }\n}\ndefine_element(TopbarButton);\n\n// _ ____ ______ _\n// | | /\\ | _ \\| ____| |\n// | | / \\ | |_) | |__ | |\n// | | / /\\ \\ | _ <| __| | |\n// | |____ / ____ \\| |_) | |____| |____\n// |______/_/ \\_\\____/|______|______|\n/**Inputs of a top bar label*/\nconst LABEL = {\n /**Text of the label, shows the error on errors*/\n text: input_key<StateOrVal<string>>(),\n};\nexport type TopbarLabelOptions = InputOptions<typeof LABEL>;\n\n/**Text for the top bar*/\nclass TopbarLabel extends TopbarBase {\n static element_name() {\n return \"topbar-label\";\n }\n\n set(options: TopbarLabelOptions): this {\n this.set_input(LABEL.text, options.text, (text) => {\n this.textContent = text.ok ? text.value : \"⚠ \" + text.error;\n });\n return this;\n }\n}\ndefine_element(TopbarLabel);\n\n// ______ _____ _______ ____ _____ _____ ______ _____\n// | ____/\\ / ____|__ __/ __ \\| __ \\|_ _| ____|/ ____|\n// | |__ / \\ | | | | | | | | |__) | | | | |__ | (___\n// | __/ /\\ \\| | | | | | | | _ / | | | __| \\___ \\\n// | | / ____ \\ |____ | | | |__| | | \\ \\ _| |_| |____ ____) |\n// |_|/_/ \\_\\_____| |_| \\____/|_| \\_\\_____|______|_____/\nexport type { Topbar, TopbarButton, TopbarLabel };\n\n/**Bar along the top of a page, items are given as arrays for the left, middle and right*/\nexport function topbar(options: TopbarOptions = {}): Topbar {\n return Topbar.create(options);\n}\n\n/**Button for the top bar, with an icon, a text or both*/\nexport function topbar_button(options: TopbarButtonOptions = {}): TopbarButton {\n return TopbarButton.create(options);\n}\n\n/**Text for the top bar*/\nexport function topbar_label(options: TopbarLabelOptions = {}): TopbarLabel {\n return TopbarLabel.create(options);\n}\n","export type { PanelContainer } from \"./container\";\nexport type { Panel, PanelOptions } from \"./panel\";\nexport { CompAnchor, type CompPosition } from \"./shared\";\nimport {\n attach_customization_panel_to_element,\n customization,\n customization_panel,\n} from \"./customization\";\nimport { panel, panel_container } from \"./container\";\nimport { content } from \"./content\";\nimport { get_element_anchor_position } from \"./shared\";\nimport { topbar, topbar_button, topbar_label } from \"./topbar\";\n\nexport const comp = {\n content,\n panel,\n panel_container,\n topbar,\n topbar_button,\n topbar_label,\n customization,\n customization_panel,\n attach_customization_panel_to_element,\n get_element_anchor_position,\n};\n\nexport {\n ContentBase,\n type Content,\n type ContentCreateOptions,\n type ContentOptions,\n} from \"./content\";\nexport type {\n Customization,\n CustomizationCreateOptions,\n CustomizationOptions,\n CustomizationPanel,\n} from \"./customization\";\nexport type {\n Topbar,\n TopbarButton,\n TopbarButtonOptions,\n TopbarLabel,\n TopbarLabelOptions,\n TopbarOptions,\n} from \"./topbar\";\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,aAAa;CACxB,WAAW;CACX,UAAU;CACV,WAAW;CACX,UAAU;CACV,QAAQ;AACV;;AAIA,SAAgB,gBAAgB,QAAsC;CACpE,IAAI,WAAW,WAAW,QAAQ,OAAO,CAAC,IAAK,EAAG;CAClD,MAAM,CAAC,GAAG,KAAK,OAAO,MAAM,GAAG;CAC/B,OAAO,CAAC,MAAM,SAAS,IAAI,GAAG,MAAM,QAAQ,IAAI,CAAC;AACnD;;AAGA,SAAgB,4BACd,SACA,QACc;CACd,MAAM,OAAO,QAAQ,sBAAsB;CAC3C,MAAM,CAAC,IAAI,MAAM,gBAAgB,MAAM;CACvC,OAAO;EACL,GAAG,UAAU,KAAK,OAAO,KAAK,QAAQ,EAAE;EACxC,GAAG,UAAU,KAAK,MAAM,KAAK,SAAS,EAAE;CAC1C;AACF;AAcA,MAAM,SAZa,yBACjB,eACA,eACA,0DASsB,CAAC,CAAC,eACxB,UACA,UACA,kCACF;AAEA,OAAO,cACL,YACA,wBACA,mDACA,KAAK,MACL,KAAK,MACL,SACA,KAAA,CACF;AAEA,OAAO,cACL,iBACA,8BACA,gEACA,KAAK,MACL,KAAK,MACL,SACA,KAAA,CACF;AAEA,OAAO,cACL,sBACA,oCACA,6EACA,IAAI,MACJ,IAAI,MACJ,SACA,KAAA,CACF;AAEA,OAAO,cACL,gBACA,kBACA,6CACA,KAAK,MACL,KAAK,KACL,SACA,KAAA,CACF;AAEA,OAAO,cACL,cACA,sBACA,8CACA,KAAK,MAC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["../../package-ui/composition/shared.ts","../../package-ui/composition/content.ts","../../package-ui/composition/panel.ts","../../package-ui/composition/container.ts","../../package-ui/composition/customization.ts","../../package-ui/composition/topbar.ts","../../package-ui/composition/index.ts"],"sourcesContent":["import { GREY, ORANGE, RED } from \"@chocbite/ts-lib/colors\";\nimport { px_to_rem, theme_init_variable_root } from \"#theme\";\n\n/** Type to store a position related to composition\n * position is always in rem*/\nexport interface CompPosition {\n x: number;\n y: number;\n}\n\n/**A point of a box, like the corner of a panel that its position places*/\nexport const CompAnchor = {\n TOP_RIGHT: \"top_right\",\n TOP_LEFT: \"top_left\",\n BOT_RIGHT: \"bot_right\",\n BOT_LEFT: \"bot_left\",\n CENTER: \"center\",\n} as const;\nexport type CompAnchor = (typeof CompAnchor)[keyof typeof CompAnchor];\n\n/**Where the anchor is in a box, as parts of its width and height from the top left*/\nexport function anchor_fraction(anchor: CompAnchor): [number, number] {\n if (anchor === CompAnchor.CENTER) return [0.5, 0.5];\n const [f, l] = anchor.split(\"_\");\n return [l === \"left\" ? 0 : 1, f === \"top\" ? 0 : 1];\n}\n\n/**Position in rem of the anchor point of the element, from the top left of the page*/\nexport function get_element_anchor_position(\n element: Element,\n anchor: CompAnchor,\n): CompPosition {\n const rect = element.getBoundingClientRect();\n const [ax, ay] = anchor_fraction(anchor);\n return {\n x: px_to_rem(rect.left + rect.width * ax),\n y: px_to_rem(rect.top + rect.height * ay),\n };\n}\n\nconst theme_root = theme_init_variable_root(\n \"composition\",\n \"Composition\",\n \"Theme variables for page composition, panels and top bar\",\n);\n\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\ncolors.make_variable(\n \"titlebar\",\n \"Title Bar Background\",\n \"Background color for the title bar of UI panels\",\n GREY[500],\n GREY[800],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"titlebarHover\",\n \"Title Bar Hover Background\",\n \"Background color for the title bar of UI panels when hovered\",\n GREY[400],\n GREY[700],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"titlebarCloseHover\",\n \"Title Bar Close Hover Background\",\n \"Background color for the title bar close button of UI panels when hovered\",\n RED[400],\n RED[700],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"titlebarText\",\n \"Title Bar Text\",\n \"Text color for the title bar of UI panels\",\n GREY[900],\n GREY[50],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"background\",\n \"Content Background\",\n \"Default background color for content areas\",\n GREY[100],\n \"#000000\",\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"icons\",\n \"Icons Color\",\n \"Default color for icons\",\n GREY[900],\n GREY[100],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"sizers\",\n \"Sizers\",\n \"Background color of the sizers of panels, shown in touch mode\",\n GREY[300],\n GREY[900],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"shadow\",\n \"Border Shadow\",\n \"Shadow color for borders and outlines\",\n \"#000000\",\n GREY[50],\n \"Color\",\n undefined,\n);\n\ncolors.make_variable(\n \"shadowFocus\",\n \"Border Shadow In Focus\",\n \"Shadow color for borders and outlines when in focus\",\n ORANGE[500],\n ORANGE[500],\n \"Color\",\n undefined,\n);\n","import {\n Base,\n CREATE,\n define_element,\n input_key,\n type InputOf,\n type InputOptions,\n} from \"#base\";\nimport ctm, { type ContextMenuGroup } from \"#context-menu\";\nimport type { SVGFunc } from \"#svg\";\nimport type { StateOrVal } from \"@chocbite/ts-lib/state\";\nimport \"./content.scss\";\nimport \"./shared\";\n\n/**Inputs of content that can be set again*/\nconst CONTENT = {\n /**Context menu of the content, also shown by its container, like on the title bar of a panel\n * Lines, a menu, or a function giving them, which is called every time the menu opens*/\n context_menu: input_key<ContextMenuGroup>(),\n};\nexport type ContentOptions = InputOptions<typeof CONTENT>;\n\n/**Inputs of content given at creation, the container showing the content follows them\n * Exported for the containers of this module, not from the module*/\nexport const CONTENT_CREATE = {\n /**Title the container shows, like on the title bar of a panel*/\n title: input_key<StateOrVal<string>>(),\n /**Icon the container shows in front of the title*/\n icon: input_key<StateOrVal<SVGFunc | undefined>>(),\n /**Whether the container lets the user close the content*/\n closable: input_key<StateOrVal<boolean>>(),\n /**Smallest width in rem the container gives the content*/\n min_width: input_key<StateOrVal<number>>(),\n /**Smallest height in rem the container gives the content*/\n min_height: input_key<StateOrVal<number>>(),\n};\nexport type ContentCreateOptions = ContentOptions &\n InputOptions<typeof CONTENT_CREATE>;\n\n/**Called by the container when it closes the content, internal to this module*/\nexport const CONTENT_CLOSED = Symbol(\"content_closed\");\n\n/**The context menu of content as it is right now, for ctm.combine, internal to this module*/\nexport function content_context_lines(content: ContentBase) {\n const group = content.content_context_menu;\n return typeof group === \"function\" ? group() : (group ?? []);\n}\n\n/**Base for anything shown in a container of this module, like a panel\n *\n * Library users extend it for their own content, and create it with MyContent.create(options),\n * the title, icon, closable and minimum size are given at creation, as the container follows them\n * To follow its own size, content attaches to the resize observer of Base and overrides on_resize*/\nexport abstract class ContentBase extends Base {\n static element_name() {\n return \"@abstract@\";\n }\n static element_name_space() {\n return \"@abstract@\";\n }\n\n #title: InputOf<typeof CONTENT_CREATE.title> = \"\";\n #icon: InputOf<typeof CONTENT_CREATE.icon> = undefined;\n #closable: InputOf<typeof CONTENT_CREATE.closable> = false;\n #min_width: InputOf<typeof CONTENT_CREATE.min_width> = 0;\n #min_height: InputOf<typeof CONTENT_CREATE.min_height> = 0;\n #context_menu: ContextMenuGroup = undefined;\n #on_close: (() => void)[] = [];\n\n constructor() {\n super();\n this.tabIndex = -1;\n this.classList.add(\"content\");\n ctm.attach(\n this,\n ctm.combine(() => content_context_lines(this)),\n );\n }\n\n /**Title the container shows, given at creation and never replaced*/\n get content_title(): InputOf<typeof CONTENT_CREATE.title> {\n return this.#title;\n }\n /**Icon the container shows, given at creation and never replaced*/\n get content_icon(): InputOf<typeof CONTENT_CREATE.icon> {\n return this.#icon;\n }\n /**Whether the container lets the user close the content, given at creation and never replaced*/\n get content_closable(): InputOf<typeof CONTENT_CREATE.closable> {\n return this.#closable;\n }\n /**Smallest width in rem, given at creation and never replaced*/\n get content_min_width(): InputOf<typeof CONTENT_CREATE.min_width> {\n return this.#min_width;\n }\n /**Smallest height in rem, given at creation and never replaced*/\n get content_min_height(): InputOf<typeof CONTENT_CREATE.min_height> {\n return this.#min_height;\n }\n /**Context menu of the content, read by the container every time its menu opens*/\n get content_context_menu(): ContextMenuGroup {\n return this.#context_menu;\n }\n\n [CREATE](options: ContentCreateOptions): void {\n super[CREATE](options);\n if (options.title !== undefined) this.#title = options.title;\n if (options.icon !== undefined) this.#icon = options.icon;\n if (options.closable !== undefined) this.#closable = options.closable;\n if (options.min_width !== undefined) this.#min_width = options.min_width;\n if (options.min_height !== undefined) this.#min_height = options.min_height;\n }\n\n set(options: ContentOptions): this {\n this.set_input(CONTENT.context_menu, options.context_menu, (menu) => {\n this.#context_menu = menu.value;\n });\n return this;\n }\n\n /**Resolves when the content is closed, by itself or by its container*/\n content_on_close(): Promise<void> {\n return new Promise<void>((resolve) => this.#on_close.push(resolve));\n }\n\n /**Closes the content, its container closes with it*/\n content_close(): void {\n this[CONTENT_CLOSED]();\n this.dispatchEvent(new CustomEvent(\"content_closed\", { bubbles: true }));\n }\n\n /**Resolves the waiting content_on_close promises, called by the container that closes the content*/\n [CONTENT_CLOSED](): void {\n for (const resolve of this.#on_close.splice(0)) resolve();\n }\n}\n\n/**Content without behavior of its own, filled with children by the user*/\nclass Content extends ContentBase {\n static element_name() {\n return \"content\";\n }\n static element_name_space() {\n return \"composition\";\n }\n}\ndefine_element(Content);\n\nexport type { Content };\n\n/**Content to fill with children, the title, icon, closable and minimum size are given here, the container follows them*/\nexport function content(options: ContentCreateOptions = {}): Content {\n return Content.create(options);\n}\n","import {\n Base,\n CREATE,\n define_element,\n input_key,\n type InputOf,\n type InputOptions,\n} from \"#base\";\nimport ctm from \"#context-menu\";\nimport type { SVGFunc } from \"#svg\";\nimport { px_to_rem } from \"#theme\";\nimport type { StateOrVal, StateOrValROSW } from \"@chocbite/ts-lib/state\";\nimport {\n CONTENT_CLOSED,\n CONTENT_CREATE,\n content_context_lines,\n type ContentBase,\n} from \"./content\";\nimport \"./panel.scss\";\nimport { anchor_fraction, CompAnchor } from \"./shared\";\n\n/**Inputs of the panel*/\nconst PANEL = {\n /**Layer of the panel, panels in a higher layer are always above panels in a lower one*/\n layer: input_key<StateOrVal<number>>(),\n /**Horizontal position in rem from the left of the page, of the anchor point of the panel\n * Not given the panel starts centered, a fixed value can not be moved by the user, a writable state is written when the user moves the panel*/\n x: input_key<StateOrValROSW<number>>(),\n /**Vertical position in rem from the top of the page, of the anchor point of the panel, works like x*/\n y: input_key<StateOrValROSW<number>>(),\n /**Point of the panel that x and y place, top_left by default*/\n anchor: input_key<StateOrVal<CompAnchor>>(),\n /**Width in rem, not given the panel fits its content\n * A fixed value can not be sized by the user, a writable state is written when the user sizes the panel*/\n width: input_key<StateOrValROSW<number>>(),\n /**Height in rem, works like width*/\n height: input_key<StateOrValROSW<number>>(),\n /**Whether the user can size the panel, at the sides where width and height can be written, true by default*/\n sizeable: input_key<StateOrVal<boolean>>(),\n /**Whether the panel is hidden, auto_hide writes it, so give a writable state to show the panel again*/\n hidden: input_key<StateOrValROSW<boolean>>(),\n /**Hides the panel when the user presses outside it*/\n auto_hide: input_key<StateOrVal<boolean>>(),\n /**Closes the panel when the user presses outside it*/\n auto_close: input_key<StateOrVal<boolean>>(),\n /**Darkens the page behind the panel and keeps the focus in it*/\n modal: input_key<StateOrVal<boolean>>(),\n /**Whether the title bar is shown, true by default*/\n titlebar: input_key<StateOrVal<boolean>>(),\n};\nexport type PanelOptions = InputOptions<typeof PANEL>;\n\n/**Inputs of the content the panel follows, inner inputs that are not options*/\nconst PANEL_CONTENT = {\n title: input_key<InputOf<typeof CONTENT_CREATE.title>>(),\n icon: input_key<InputOf<typeof CONTENT_CREATE.icon>>(),\n closable: input_key<InputOf<typeof CONTENT_CREATE.closable>>(),\n min_width: input_key<InputOf<typeof CONTENT_CREATE.min_width>>(),\n min_height: input_key<InputOf<typeof CONTENT_CREATE.min_height>>(),\n};\n\n/**Smallest size of a panel in rem*/\nconst MIN_SIZE = 4;\n/**How much of the panel is kept inside the container, at the top in rem, at the sides as part of its width*/\nconst KEEP_TOP = 2;\nconst KEEP_SIDE = 0.5;\n\n//Internal to this module, between the panel and its container\nexport const PANEL_ADDED = Symbol(\"panel_added\");\nexport const PANEL_LAYOUT = Symbol(\"panel_layout\");\nexport const HOST_LAYER = Symbol(\"host_layer\");\nexport const HOST_RAISE = Symbol(\"host_raise\");\nexport const HOST_REMOVE = Symbol(\"host_remove\");\n\n/**The container of a panel, as the panel sees it*/\nexport interface PanelHost {\n /**Width in rem*/\n readonly width: number;\n /**Height in rem*/\n readonly height: number;\n /**Moves the panel into the given layer*/\n [HOST_LAYER](panel: Panel, layer: number): void;\n /**Puts the panel above the others in its layer*/\n [HOST_RAISE](panel: Panel): void;\n /**Forgets the panel, it is closed*/\n [HOST_REMOVE](panel: Panel): void;\n}\n\n/**Values of the inputs the user can change by moving, sizing or hiding the panel*/\ninterface ChangeableValues {\n x?: number;\n y?: number;\n width?: number;\n height?: number;\n hidden: boolean;\n}\ntype Changeable = keyof ChangeableValues;\n\nconst clamp = (value: number, min: number, max: number) =>\n Math.max(min, Math.min(value, max));\n\nclass Panel extends Base {\n static element_name() {\n return \"panel\";\n }\n static element_name_space() {\n return \"composition\";\n }\n\n #host?: PanelHost;\n #content!: ContentBase;\n\n #sizer = this.appendChild(document.createElement(\"div\"));\n #titlebar = this.appendChild(document.createElement(\"div\"));\n #icon?: HTMLDivElement;\n #title = this.#titlebar.appendChild(document.createElement(\"div\"));\n #close_button?: HTMLSpanElement;\n #content_box = this.appendChild(document.createElement(\"div\"));\n #focus_catcher?: HTMLDivElement;\n\n #layer = 0;\n #anchor: CompAnchor = CompAnchor.TOP_LEFT;\n #sizeable = true;\n #auto_hide = false;\n #auto_close = false;\n #min_width = 0;\n #min_height = 0;\n /**Values of the changeable inputs, the panel owns them until they are given*/\n #values: ChangeableValues = { hidden: false };\n #given = new Set<Changeable>();\n /**Position shown last, in rem, the start of moving and sizing*/\n #left = 0;\n #top = 0;\n #moving = false;\n #on_close: (() => void)[] = [];\n\n constructor() {\n super();\n this.tabIndex = 0;\n this.attach_to_resize_observer();\n this.addEventListener(\"focus\", () => this.#content.focus());\n this.addEventListener(\"focusin\", () => this.#host?.[HOST_RAISE](this));\n this.addEventListener(\"content_closed\", (e) => {\n e.stopPropagation();\n this.close();\n });\n\n this.#titlebar.tabIndex = 0;\n this.#title.classList.add(\"title\");\n ctm.attach(\n this.#titlebar,\n ctm.combine(() => content_context_lines(this.#content)),\n () => this.#moving,\n );\n this.#titlebar.onpointerdown = (e) => this.#move_start(e);\n this.#titlebar.onkeydown = (e) => this.#move_key(e);\n\n for (const side of [\"n\", \"s\", \"e\", \"w\", \"ne\", \"nw\", \"se\", \"sw\"]) {\n const handle = this.#sizer.appendChild(document.createElement(\"div\"));\n handle.classList.add(side);\n if (side.length === 1)\n handle.appendChild(document.createElement(\"div\")).textContent =\n \"\\ue25d\";\n handle.onpointerdown = (e) => this.#size_start(e, handle, side);\n }\n }\n\n [CREATE](options: { content: ContentBase }): void {\n super[CREATE](options);\n const content = (this.#content = options.content);\n this.#content_box.appendChild(content);\n this.set_input(PANEL_CONTENT.icon, content.content_icon, (icon) =>\n this.#set_icon(icon.ok ? icon.value : undefined),\n );\n this.set_input(PANEL_CONTENT.title, content.content_title, (title) => {\n this.#title.textContent = title.ok ? title.value : \"⚠ \" + title.error;\n });\n this.set_input(PANEL_CONTENT.closable, content.content_closable, (c) =>\n this.#set_closable(c.ok && c.value),\n );\n this.set_input(PANEL_CONTENT.min_width, content.content_min_width, (w) => {\n this.#min_width = w.ok ? w.value : 0;\n this.#layout();\n });\n this.set_input(\n PANEL_CONTENT.min_height,\n content.content_min_height,\n (h) => {\n this.#min_height = h.ok ? h.value : 0;\n this.#layout();\n },\n );\n }\n\n set(options: PanelOptions): this {\n this.set_input(PANEL.layer, options.layer, (layer) => {\n this.#layer = layer.ok ? layer.value : 0;\n this.#host?.[HOST_LAYER](this, this.#layer);\n });\n this.set_input(PANEL.anchor, options.anchor, (anchor) => {\n this.#anchor = anchor.ok ? anchor.value : CompAnchor.TOP_LEFT;\n this.#layout();\n });\n for (const name of [\"x\", \"y\", \"width\", \"height\"] as const) {\n if (options[name] !== undefined) this.#given.add(name);\n this.set_input(PANEL[name], options[name], (value) => {\n this.#values[name] = value.value;\n this.#layout();\n });\n }\n if (options.hidden !== undefined) this.#given.add(\"hidden\");\n this.set_input(PANEL.hidden, options.hidden, (hidden) => {\n this.#values.hidden = hidden.value;\n this.classList.toggle(\"hidden\", hidden.value);\n this.#layout();\n });\n this.set_input(PANEL.sizeable, options.sizeable, (sizeable) => {\n this.#sizeable = sizeable.ok && sizeable.value;\n this.#layout();\n });\n this.set_input(PANEL.auto_hide, options.auto_hide, (auto_hide) => {\n this.#auto_hide = auto_hide.ok && auto_hide.value;\n });\n this.set_input(PANEL.auto_close, options.auto_close, (auto_close) => {\n this.#auto_close = auto_close.ok && auto_close.value;\n });\n this.set_input(PANEL.modal, options.modal, (modal) =>\n this.#set_modal(modal.ok && modal.value),\n );\n this.set_input(PANEL.titlebar, options.titlebar, (titlebar) => {\n this.classList.toggle(\"no-titlebar\", !(titlebar.ok && titlebar.value));\n this.#layout();\n });\n return this;\n }\n\n /**Content the panel shows, given when the panel is created*/\n get content(): ContentBase {\n return this.#content;\n }\n\n /**Resolves when the panel is closed*/\n on_close(): Promise<void> {\n return new Promise<void>((resolve) => this.#on_close.push(resolve));\n }\n\n /**Closes the panel and its content*/\n close(): void {\n this.ownerDocument.removeEventListener(\"pointerdown\", this.#outside, {\n capture: true,\n });\n this.#host?.[HOST_REMOVE](this);\n this.#host = undefined;\n this.remove();\n this.#content[CONTENT_CLOSED]();\n for (const resolve of this.#on_close.splice(0)) resolve();\n }\n\n /**Called by the container that shows the panel, once, after creating it*/\n [PANEL_ADDED](host: PanelHost): void {\n this.#host = host;\n host[HOST_LAYER](this, this.#layer);\n host[HOST_RAISE](this);\n this.ownerDocument.addEventListener(\"pointerdown\", this.#outside, {\n capture: true,\n passive: true,\n });\n this.#layout();\n }\n\n /**Called by the container when its size changes*/\n [PANEL_LAYOUT](): void {\n this.#layout();\n }\n\n protected on_resize(): void {\n this.#layout();\n }\n\n // _____ _ _ _ _ _____ ______\n // / ____| | | | /\\ | \\ | |/ ____| ____|\n // | | | |__| | / \\ | \\| | | __| |__\n // | | | __ | / /\\ \\ | . ` | | |_ | __|\n // | |____| | | |/ ____ \\| |\\ | |__| | |____\n // \\_____|_| |_/_/ \\_\\_| \\_|\\_____|______|\n /**Whether the user can change the input, when the panel owns it or it is a writable state*/\n #can_change(name: Changeable): boolean {\n return !this.#given.has(name) || this.#state_of(name) !== undefined;\n }\n\n /**The writable state the input has, undefined for a fixed value or one never given*/\n #state_of(name: Changeable) {\n return this.input_state<StateOrValROSW<number | boolean>>(PANEL[name]);\n }\n\n /**Writes a change by the user, to the state of the input, or to the panel when it owns the input*/\n #change<N extends Changeable>(\n name: N,\n value: NonNullable<ChangeableValues[N]>,\n ): void {\n const state = this.#state_of(name);\n if (state) void state.write(value);\n else if (!this.#given.has(name)) {\n this.#values[name] = value;\n if (name === \"hidden\") this.classList.toggle(\"hidden\", value === true);\n this.#layout();\n }\n }\n\n #outside = (e: Event) => {\n if (this.#values.hidden) return;\n if (this.contains(e.target as Node) && e.target !== this) return;\n if (this.#auto_close) this.close();\n else if (this.#auto_hide) this.#change(\"hidden\", true);\n };\n\n // _ __ ______ _ _ _______\n // | | /\\\\ \\ / / __ \\| | | |__ __|\n // | | / \\\\ \\_/ / | | | | | | | |\n // | | / /\\ \\\\ /| | | | | | | | |\n // | |____ / ____ \\| | | |__| | |__| | | |\n // |______/_/ \\_\\_| \\____/ \\____/ |_|\n /**Left edge shown for the given one, keeping part of the panel inside the container*/\n #clamp_left(left: number, width: number): number {\n const keep = width * KEEP_SIDE;\n return clamp(left, -keep, this.#host!.width - keep);\n }\n /**Top edge shown for the given one, keeping the title bar inside the container*/\n #clamp_top(top: number): number {\n return clamp(top, 0, Math.max(0, this.#host!.height - KEEP_TOP));\n }\n\n /**Applies size and position, the position is only clamped for showing, the inputs keep their values*/\n #layout(): void {\n if (!this.#host || !this.isConnected) return;\n const { width, height } = this.#values;\n this.style.width = width === undefined ? \"\" : width + \"rem\";\n this.style.height = height === undefined ? \"\" : height + \"rem\";\n this.style.minWidth = Math.max(MIN_SIZE, this.#min_width) + \"rem\";\n this.style.minHeight = `calc(${Math.max(MIN_SIZE, this.#min_height)}rem + var(--titlebar-height))`;\n this.#sizer.classList.toggle(\n \"x\",\n this.#sizeable && this.#can_change(\"width\"),\n );\n this.#sizer.classList.toggle(\n \"y\",\n this.#sizeable && this.#can_change(\"height\"),\n );\n this.classList.toggle(\"size-x\", this.#sizer.classList.contains(\"x\"));\n this.classList.toggle(\"size-y\", this.#sizer.classList.contains(\"y\"));\n if (this.#values.hidden) return;\n\n const rect = this.getBoundingClientRect();\n const w = px_to_rem(rect.width);\n const h = px_to_rem(rect.height);\n const [ax, ay] = anchor_fraction(this.#anchor);\n const { x, y } = this.#values;\n this.#left = this.#clamp_left(\n x === undefined ? (this.#host.width - w) / 2 : x - w * ax,\n w,\n );\n this.#top = this.#clamp_top(\n y === undefined ? (this.#host.height - h) / 2 : y - h * ay,\n );\n this.style.left = this.#left + \"rem\";\n this.style.top = this.#top + \"rem\";\n }\n\n // __ __ ______ _______ _ _ _____\n // | \\/ |/ __ \\ \\ / /_ _| \\ | |/ ____|\n // | \\ / | | | \\ \\ / / | | | \\| | | __\n // | |\\/| | | | |\\ \\/ / | | | . ` | | |_ |\n // | | | | |__| | \\ / _| |_| |\\ | |__| |\n // |_| |_|\\____/ \\/ |_____|_| \\_|\\_____|\n /**Moves the panel so its top left corner is at the given position, clamped, on the axes the user can change*/\n #move_to(left: number, top: number): void {\n const rect = this.getBoundingClientRect();\n const w = px_to_rem(rect.width);\n const h = px_to_rem(rect.height);\n const [ax, ay] = anchor_fraction(this.#anchor);\n if (this.#can_change(\"x\"))\n this.#change(\"x\", this.#clamp_left(left, w) + w * ax);\n if (this.#can_change(\"y\")) this.#change(\"y\", this.#clamp_top(top) + h * ay);\n }\n\n #move_start(e: PointerEvent): void {\n if (e.button !== 0) return;\n if (!this.#can_change(\"x\") && !this.#can_change(\"y\")) return;\n const titlebar = this.#titlebar;\n titlebar.setPointerCapture(e.pointerId);\n titlebar.classList.add(\"moving\");\n this.#moving = true;\n const left = this.#left;\n const top = this.#top;\n titlebar.onpointermove = (ev) =>\n this.#move_to(\n left + px_to_rem(ev.clientX - e.clientX),\n top + px_to_rem(ev.clientY - e.clientY),\n );\n titlebar.onpointerup = (ev) => {\n titlebar.releasePointerCapture(ev.pointerId);\n titlebar.classList.remove(\"moving\");\n this.#moving = false;\n titlebar.onpointermove = null;\n titlebar.onpointerup = null;\n };\n }\n\n #move_key(e: KeyboardEvent): void {\n const step = e.shiftKey ? 5 : e.ctrlKey ? 0.1 : 1;\n const [dx, dy] =\n {\n ArrowLeft: [-step, 0],\n ArrowRight: [step, 0],\n ArrowUp: [0, -step],\n ArrowDown: [0, step],\n }[e.key] ?? [];\n if (dx === undefined || dy === undefined) return;\n e.preventDefault();\n e.stopPropagation();\n this.#move_to(this.#left + dx, this.#top + dy);\n }\n\n // _____ _____ ___________ _ _ _____\n // / ____|_ _|___ /_ _| \\ | |/ ____|\n // | (___ | | / / | | | \\| | | __\n // \\___ \\ | | / / | | | . ` | | |_ |\n // ____) |_| |_ / /__ _| |_| |\\ | |__| |\n // |_____/|_____/_____|_____|_| \\_|\\_____|\n /**Sizes the panel from one side or corner, the opposite side stays where it is when x and y can be written*/\n #size_start(e: PointerEvent, handle: HTMLDivElement, side: string): void {\n if (e.button !== 0) return;\n e.stopPropagation();\n const host = this.#host;\n if (!host) return;\n handle.setPointerCapture(e.pointerId);\n const rect = this.getBoundingClientRect();\n const w0 = px_to_rem(rect.width);\n const h0 = px_to_rem(rect.height);\n const left0 = this.#left;\n const top0 = this.#top;\n const [ax, ay] = anchor_fraction(this.#anchor);\n const min_w = Math.max(MIN_SIZE, this.#min_width);\n const min_h =\n Math.max(MIN_SIZE, this.#min_height) +\n px_to_rem(this.#titlebar.getBoundingClientRect().height);\n const horizontal = this.#sizer.classList.contains(\"x\");\n const vertical = this.#sizer.classList.contains(\"y\");\n handle.onpointermove = (ev) => {\n const dx = px_to_rem(ev.clientX - e.clientX);\n const dy = px_to_rem(ev.clientY - e.clientY);\n if (horizontal && (side.includes(\"e\") || side.includes(\"w\"))) {\n const east = side.includes(\"e\");\n const w = clamp(east ? w0 + dx : w0 - dx, min_w, host.width);\n this.#change(\"width\", w);\n if (this.#can_change(\"x\"))\n this.#change(\"x\", (east ? left0 : left0 + w0 - w) + w * ax);\n }\n if (vertical && (side.includes(\"n\") || side.includes(\"s\"))) {\n const south = side.includes(\"s\");\n const h = clamp(south ? h0 + dy : h0 - dy, min_h, host.height);\n this.#change(\"height\", h);\n if (this.#can_change(\"y\"))\n this.#change(\"y\", (south ? top0 : top0 + h0 - h) + h * ay);\n }\n };\n handle.onpointerup = (ev) => {\n handle.releasePointerCapture(ev.pointerId);\n handle.onpointermove = null;\n handle.onpointerup = null;\n this.#titlebar.focus();\n };\n }\n\n // _____ _____ ______ _____ _____ ____ _____ _____ ______ _____\n // /\\ / ____/ ____| ____|/ ____/ ____|/ __ \\| __ \\|_ _| ____|/ ____|\n // / \\ | | | | | |__ | (___| (___ | | | | |__) | | | | |__ | (___\n // / /\\ \\| | | | | __| \\___ \\\\___ \\| | | | _ / | | | __| \\___ \\\n // / ____ \\ |___| |____| |____ ____) |___) | |__| | | \\ \\ _| |_| |____ ____) |\n // /_/ \\_\\_____\\_____|______|_____/_____/ \\____/|_| \\_\\_____|______|_____/\n #set_icon(icon?: SVGFunc): void {\n if (icon) {\n this.#icon ??= this.#titlebar.insertBefore(\n document.createElement(\"div\"),\n this.#title,\n );\n this.#icon.classList.add(\"icon\");\n this.#icon.replaceChildren(icon());\n } else {\n this.#icon?.remove();\n this.#icon = undefined;\n }\n }\n\n #set_closable(closable: boolean): void {\n if (closable && !this.#close_button) {\n const button = (this.#close_button = this.#titlebar.appendChild(\n document.createElement(\"span\"),\n ));\n button.classList.add(\"close-button\");\n button.textContent = \"×\";\n button.onpointerdown = (e) => {\n e.preventDefault();\n e.stopPropagation();\n button.setPointerCapture(e.pointerId);\n button.onpointerup = (e) => {\n button.releasePointerCapture(e.pointerId);\n button.onpointerup = null;\n const rect = button.getBoundingClientRect();\n if (\n e.clientX >= rect.left &&\n e.clientX <= rect.right &&\n e.clientY >= rect.top &&\n e.clientY <= rect.bottom\n )\n this.close();\n };\n };\n button.oncontextmenu = (e) => {\n e.preventDefault();\n e.stopPropagation();\n };\n button.ontouchend = (e) => {\n if (e.cancelable) e.preventDefault();\n e.stopPropagation();\n };\n } else if (!closable && this.#close_button) {\n this.#close_button.remove();\n this.#close_button = undefined;\n }\n }\n\n #set_modal(modal: boolean): void {\n this.classList.toggle(\"modal\", modal);\n if (modal && !this.#focus_catcher) {\n //Tabbing past the end of the panel comes back to its content\n this.#focus_catcher = this.appendChild(document.createElement(\"div\"));\n this.#focus_catcher.tabIndex = 0;\n this.#focus_catcher.onfocus = () => this.#content.focus();\n } else if (!modal && this.#focus_catcher) {\n this.#focus_catcher.remove();\n this.#focus_catcher = undefined;\n }\n }\n}\ndefine_element(Panel);\n\nexport { Panel };\n","import { Base, define_element, input_key } from \"#base\";\nimport { DOCUMENT_HANDLER } from \"#document\";\nimport { px_to_rem, SCALE } from \"#theme\";\nimport type { StateOrValROS } from \"@chocbite/ts-lib/state\";\nimport type { ContentBase } from \"./content\";\nimport \"./container.scss\";\nimport {\n HOST_LAYER,\n HOST_RAISE,\n HOST_REMOVE,\n Panel,\n PANEL_ADDED,\n PANEL_LAYOUT,\n type PanelHost,\n type PanelOptions,\n} from \"./panel\";\n\n/**Internal input, the scale changes the size of the container in rem*/\nconst SCALE_KEY = input_key<StateOrValROS<number>>();\n\n/**Layer over the whole page that panels float in, one per document*/\nclass PanelContainer extends Base implements PanelHost {\n static element_name() {\n return \"panelcontainer\";\n }\n static element_name_space() {\n return \"composition\";\n }\n\n #layers = new Map<number, HTMLDivElement>();\n #panels = new Set<Panel>();\n #raised = 0;\n #active?: Panel;\n\n constructor() {\n super();\n this.attach_to_resize_observer();\n this.set_input(SCALE_KEY, SCALE, () => this.#layout());\n }\n\n /**Width in rem*/\n get width(): number {\n return px_to_rem(this.actual_size.width);\n }\n /**Height in rem*/\n get height(): number {\n return px_to_rem(this.actual_size.height);\n }\n /**Panel the user worked in last*/\n get active_panel(): Panel | undefined {\n return this.#active;\n }\n\n /**Creates a panel showing the content in this container\n * The title, icon, close button and minimum size come from the content, see content*/\n panel(content: ContentBase, options: PanelOptions = {}): Panel {\n const panel = Panel.create({ ...options, content });\n this.#panels.add(panel);\n panel[PANEL_ADDED](this);\n return panel;\n }\n\n protected on_resize(): void {\n this.#layout();\n }\n\n #layout(): void {\n for (const panel of this.#panels) panel[PANEL_LAYOUT]();\n }\n\n [HOST_LAYER](panel: Panel, layer: number): void {\n let box = this.#layers.get(layer);\n if (!box) {\n box = document.createElement(\"div\");\n box.style.zIndex = String(layer);\n this.#layers.set(layer, box);\n //Layers in order, so the DOM order matches what is shown\n const above = [...this.#layers].filter(([l]) => l > layer);\n const next = above.sort(([a], [b]) => a - b)[0]?.[1];\n this.insertBefore(box, next ?? null);\n }\n //Moving an element reconnects it, which applies its states again\n if (panel.parentElement !== box) box.appendChild(panel);\n }\n\n [HOST_RAISE](panel: Panel): void {\n this.#active = panel;\n panel.style.zIndex = String(++this.#raised);\n }\n\n [HOST_REMOVE](panel: Panel): void {\n this.#panels.delete(panel);\n if (this.#active === panel) this.#active = undefined;\n }\n}\ndefine_element(PanelContainer);\n\nexport type { PanelContainer };\n\nconst CONTAINERS = new WeakMap<Document, PanelContainer>();\nDOCUMENT_HANDLER.events.on(\"removed\", (e) => {\n CONTAINERS.get(e.data)?.remove();\n CONTAINERS.delete(e.data);\n});\n\n/**The panel container of the document the given node is in, the main document by default\n * The container is made the first time it is asked for*/\nexport function panel_container(\n owner: Node = DOCUMENT_HANDLER.main,\n): PanelContainer {\n const doc = owner.ownerDocument ?? (owner as Document);\n let container = CONTAINERS.get(doc);\n if (!container) {\n container = PanelContainer.create();\n doc.documentElement.appendChild(container);\n CONTAINERS.set(doc, container);\n }\n return container;\n}\n\n/**Creates a panel showing the content, in the main document\n * Use panel_container(element).panel for another document*/\nexport function panel(content: ContentBase, options: PanelOptions = {}): Panel {\n return panel_container().panel(content, options);\n}\n","import { define_element, input_key, type InputOptions } from \"#base\";\nimport { DOCUMENT_HANDLER } from \"#document\";\nimport form, { type FormElement } from \"#form\";\nimport { material_brightness_medium_rounded } from \"#icons\";\nimport {\n ANIMATION_LEVEL,\n ANIMATION_SPEED,\n INPUT_MODE,\n SCALE,\n THEME,\n} from \"#theme\";\nimport state, { type StateOrVal, type StateROSW } from \"@chocbite/ts-lib/state\";\nimport { panel_container } from \"./container\";\nimport {\n ContentBase,\n type ContentCreateOptions,\n type ContentOptions,\n} from \"./content\";\nimport type { Panel } from \"./panel\";\nimport { get_element_anchor_position, type CompAnchor } from \"./shared\";\n\n/**Inputs of the customization*/\nconst CUSTOMIZATION = {\n /**Settings of the app, shown under the theme*/\n main: input_key<StateOrVal<readonly FormElement[]>>(),\n /**Advanced settings of the app, shown last in the advanced section*/\n advanced: input_key<StateOrVal<readonly FormElement[]>>(),\n};\nexport type CustomizationOptions = ContentOptions &\n InputOptions<typeof CUSTOMIZATION>;\nexport type CustomizationCreateOptions = ContentCreateOptions &\n CustomizationOptions;\n\n/**Content with the settings of the library, theme, scale, input mode and animations, and settings of the app*/\nclass Customization extends ContentBase {\n static element_name() {\n return \"customization\";\n }\n static element_name_space() {\n return \"composition\";\n }\n\n #main = form.group({ embed: true });\n #advanced = form.group({ embed: true });\n\n constructor() {\n super();\n this.appendChild(\n form.group({\n elements: [\n form.toggle_button().bind({ value: THEME }),\n this.#main,\n form.group_collapser(\n form.group({\n embed: true,\n elements: [\n form.text({ text: \"UI Scale\" }),\n form.stepper().bind({ value: SCALE }),\n form.text({ text: \"Input Mode\" }),\n form.toggle_button().bind({ value: INPUT_MODE }),\n form.text({ text: \"Animation Level\" }),\n form.toggle_button().bind({ value: ANIMATION_LEVEL }),\n form.text({ text: \"Animation Speed\" }),\n form.slider({ live: true }).bind({ value: ANIMATION_SPEED }),\n this.#advanced,\n ],\n }),\n { closed_text: \"Advanced\", collapsed: true },\n ),\n ],\n }),\n );\n }\n\n set(options: CustomizationOptions): this {\n super.set(options);\n this.set_input(CUSTOMIZATION.main, options.main, (elements) => {\n this.#main = replace_group(this.#main, elements.ok ? elements.value : []);\n });\n this.set_input(CUSTOMIZATION.advanced, options.advanced, (elements) => {\n this.#advanced = replace_group(\n this.#advanced,\n elements.ok ? elements.value : [],\n );\n });\n return this;\n }\n}\ndefine_element(Customization);\n\n/**A form group only takes elements once, so a new list gets a new group*/\nconst replace_group = (old: HTMLElement, elements: readonly FormElement[]) => {\n const group = form.group({ embed: true, elements: [...elements] });\n old.replaceWith(group);\n return group;\n};\n\nexport type { Customization };\n\n/**Content with the settings of the library, and of the app given as main and advanced\n * The title, icon and minimum size have defaults, give them to change them*/\nexport function customization(\n options: CustomizationCreateOptions = {},\n): Customization {\n return Customization.create({\n title: \"Customization\",\n icon: material_brightness_medium_rounded,\n closable: true,\n min_width: 10,\n min_height: 6,\n ...options,\n });\n}\n\n/**The customization in a hidden modal panel*/\nexport interface CustomizationPanel {\n readonly panel: Panel;\n readonly content: Customization;\n /**Whether the panel is hidden, write false to show it, the panel writes true when the user presses outside it*/\n readonly hidden: StateROSW<boolean>;\n}\n\n/**Creates the customization in a modal panel, hidden, it hides again when the user presses outside it\n * Change the panel with panel.set, like its position\n * @param owner the panel is made in the document of the owner, the main document by default*/\nexport function customization_panel(\n options: CustomizationCreateOptions = {},\n owner: Node = DOCUMENT_HANDLER.main,\n): CustomizationPanel {\n const content = customization(options);\n const hidden = state.ok_w(true);\n const panel = panel_container(owner).panel(content, {\n sizeable: false,\n titlebar: false,\n width: 20,\n hidden,\n auto_hide: true,\n modal: true,\n layer: 9999,\n });\n return { panel, content, hidden };\n}\n\n/**Shows the customization panel when the element is clicked, with the anchor of the panel at the anchor of the element\n * @param c_panel the panel to show, a new one in the document of the element by default*/\nexport function attach_customization_panel_to_element(\n element: Element,\n element_anchor: CompAnchor,\n panel_anchor: CompAnchor,\n c_panel: CustomizationPanel = customization_panel({}, element),\n): CustomizationPanel {\n element.addEventListener(\"click\", () => {\n const { x, y } = get_element_anchor_position(element, element_anchor);\n c_panel.panel.set({ x, y, anchor: panel_anchor });\n void c_panel.hidden.write(false);\n c_panel.panel.focus();\n });\n return c_panel;\n}\n","import { Base, define_element, input_key, type InputOptions } from \"#base\";\nimport type { SVGFunc } from \"#svg\";\nimport type { StateOrVal } from \"@chocbite/ts-lib/state\";\nimport \"./shared\";\nimport \"./topbar.scss\";\n\n/**Shared base of the top bar elements, only sets the namespace*/\nabstract class TopbarBase extends Base {\n static element_name() {\n return \"@abstract@\";\n }\n static element_name_space() {\n return \"composition\";\n }\n}\n\n// _______ ____ _____ ____ _____\n// |__ __/ __ \\| __ \\| _ \\ /\\ | __ \\\n// | | | | | | |__) | |_) | / \\ | |__) |\n// | | | | | | ___/| _ < / /\\ \\ | _ /\n// | | | |__| | | | |_) / ____ \\| | \\ \\\n// |_| \\____/|_| |____/_/ \\_\\_| \\_\\\n/**Inputs of the top bar*/\nconst TOPBAR = {\n /**Items at the left side, the side is empty on errors*/\n left: input_key<StateOrVal<readonly Element[]>>(),\n /**Items in the middle, the middle is empty on errors*/\n mid: input_key<StateOrVal<readonly Element[]>>(),\n /**Items at the right side, the side is empty on errors*/\n right: input_key<StateOrVal<readonly Element[]>>(),\n};\nexport type TopbarOptions = InputOptions<typeof TOPBAR>;\n\n/**Bar along the top of a page, with items at the left, in the middle and at the right*/\nclass Topbar extends TopbarBase {\n static element_name() {\n return \"topbar\";\n }\n\n #left = this.appendChild(document.createElement(\"div\"));\n #mid = this.appendChild(document.createElement(\"div\"));\n #right = this.appendChild(document.createElement(\"div\"));\n\n set(options: TopbarOptions): this {\n this.set_input(TOPBAR.left, options.left, (items) => {\n this.#left.replaceChildren(...(items.ok ? items.value : []));\n });\n this.set_input(TOPBAR.mid, options.mid, (items) => {\n this.#mid.replaceChildren(...(items.ok ? items.value : []));\n });\n this.set_input(TOPBAR.right, options.right, (items) => {\n this.#right.replaceChildren(...(items.ok ? items.value : []));\n });\n return this;\n }\n}\ndefine_element(Topbar);\n\n// ____ _ _ _______ _______ ____ _ _\n// | _ \\| | | |__ __|__ __/ __ \\| \\ | |\n// | |_) | | | | | | | | | | | | \\| |\n// | _ <| | | | | | | | | | | | . ` |\n// | |_) | |__| | | | | | | |__| | |\\ |\n// |____/ \\____/ |_| |_| \\____/|_| \\_|\n/**Inputs of a top bar button*/\nconst BUTTON = {\n /**Text of the button, shows the error on errors*/\n text: input_key<StateOrVal<string>>(),\n /**Icon in front of the text, no icon on errors*/\n icon: input_key<StateOrVal<SVGFunc | undefined>>(),\n /**Called when the button is clicked, a plain value as it is not shown*/\n on_click: input_key<() => void>(),\n};\nexport type TopbarButtonOptions = InputOptions<typeof BUTTON>;\n\n/**Button for the top bar, with an icon, a text or both*/\nclass TopbarButton extends TopbarBase {\n static element_name() {\n return \"topbar-button\";\n }\n\n #icon?: SVGSVGElement;\n #text = this.appendChild(document.createElement(\"span\"));\n #on_click?: () => void;\n\n constructor() {\n super();\n this.onclick = () => this.#on_click?.();\n }\n\n set(options: TopbarButtonOptions): this {\n this.set_input(BUTTON.on_click, options.on_click, (on_click) => {\n this.#on_click = on_click.value;\n });\n this.set_input(BUTTON.text, options.text, (text) => {\n this.#text.textContent = text.ok ? text.value : \"⚠ \" + text.error;\n });\n this.set_input(BUTTON.icon, options.icon, (icon) => {\n this.#icon?.remove();\n this.#icon = icon.ok && icon.value ? icon.value() : undefined;\n if (this.#icon) this.prepend(this.#icon);\n });\n return this;\n }\n}\ndefine_element(TopbarButton);\n\n// _ ____ ______ _\n// | | /\\ | _ \\| ____| |\n// | | / \\ | |_) | |__ | |\n// | | / /\\ \\ | _ <| __| | |\n// | |____ / ____ \\| |_) | |____| |____\n// |______/_/ \\_\\____/|______|______|\n/**Inputs of a top bar label*/\nconst LABEL = {\n /**Text of the label, shows the error on errors*/\n text: input_key<StateOrVal<string>>(),\n};\nexport type TopbarLabelOptions = InputOptions<typeof LABEL>;\n\n/**Text for the top bar*/\nclass TopbarLabel extends TopbarBase {\n static element_name() {\n return \"topbar-label\";\n }\n\n set(options: TopbarLabelOptions): this {\n this.set_input(LABEL.text, options.text, (text) => {\n this.textContent = text.ok ? text.value : \"⚠ \" + text.error;\n });\n return this;\n }\n}\ndefine_element(TopbarLabel);\n\n// ______ _____ _______ ____ _____ _____ ______ _____\n// | ____/\\ / ____|__ __/ __ \\| __ \\|_ _| ____|/ ____|\n// | |__ / \\ | | | | | | | | |__) | | | | |__ | (___\n// | __/ /\\ \\| | | | | | | | _ / | | | __| \\___ \\\n// | | / ____ \\ |____ | | | |__| | | \\ \\ _| |_| |____ ____) |\n// |_|/_/ \\_\\_____| |_| \\____/|_| \\_\\_____|______|_____/\nexport type { Topbar, TopbarButton, TopbarLabel };\n\n/**Bar along the top of a page, items are given as arrays for the left, middle and right*/\nexport function topbar(options: TopbarOptions = {}): Topbar {\n return Topbar.create(options);\n}\n\n/**Button for the top bar, with an icon, a text or both*/\nexport function topbar_button(options: TopbarButtonOptions = {}): TopbarButton {\n return TopbarButton.create(options);\n}\n\n/**Text for the top bar*/\nexport function topbar_label(options: TopbarLabelOptions = {}): TopbarLabel {\n return TopbarLabel.create(options);\n}\n","export type { PanelContainer } from \"./container\";\nexport type { Panel, PanelOptions } from \"./panel\";\nexport { CompAnchor, type CompPosition } from \"./shared\";\nimport {\n attach_customization_panel_to_element,\n customization,\n customization_panel,\n} from \"./customization\";\nimport { panel, panel_container } from \"./container\";\nimport { content } from \"./content\";\nimport { get_element_anchor_position } from \"./shared\";\nimport { topbar, topbar_button, topbar_label } from \"./topbar\";\n\nexport const comp = {\n content,\n panel,\n panel_container,\n topbar,\n topbar_button,\n topbar_label,\n customization,\n customization_panel,\n attach_customization_panel_to_element,\n get_element_anchor_position,\n};\n\nexport {\n ContentBase,\n type Content,\n type ContentCreateOptions,\n type ContentOptions,\n} from \"./content\";\nexport type {\n Customization,\n CustomizationCreateOptions,\n CustomizationOptions,\n CustomizationPanel,\n} from \"./customization\";\nexport type {\n Topbar,\n TopbarButton,\n TopbarButtonOptions,\n TopbarLabel,\n TopbarLabelOptions,\n TopbarOptions,\n} from \"./topbar\";\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,aAAa;CACxB,WAAW;CACX,UAAU;CACV,WAAW;CACX,UAAU;CACV,QAAQ;AACV;;AAIA,SAAgB,gBAAgB,QAAsC;CACpE,IAAI,WAAW,WAAW,QAAQ,OAAO,CAAC,IAAK,EAAG;CAClD,MAAM,CAAC,GAAG,KAAK,OAAO,MAAM,GAAG;CAC/B,OAAO,CAAC,MAAM,SAAS,IAAI,GAAG,MAAM,QAAQ,IAAI,CAAC;AACnD;;AAGA,SAAgB,4BACd,SACA,QACc;CACd,MAAM,OAAO,QAAQ,sBAAsB;CAC3C,MAAM,CAAC,IAAI,MAAM,gBAAgB,MAAM;CACvC,OAAO;EACL,GAAG,UAAU,KAAK,OAAO,KAAK,QAAQ,EAAE;EACxC,GAAG,UAAU,KAAK,MAAM,KAAK,SAAS,EAAE;CAC1C;AACF;AAcA,MAAM,SAZa,yBACjB,eACA,eACA,0DASsB,CAAC,CAAC,eACxB,UACA,UACA,kCACF;AAEA,OA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GAAW;CAC1D,OAAO,OAAO,OAAO,OAAO;AAC9B;;AAGA,SAAgB,cAAc,UAA+B,CAAC,GAAiB;CAC7E,OAAO,aAAa,OAAO,OAAO;AACpC;;AAGA,SAAgB,aAAa,UAA8B,CAAC,GAAgB;CAC1E,OAAO,YAAY,OAAO,OAAO;AACnC;;AC/IA,MAAa,OAAO;CAClB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -1,2 +1,2 @@
1
1
  import "../style.css";
2
- export { t as ctm, t as default } from "../context-menu-C0KTV5zC.mjs";
2
+ export { t as ctm, t as default } from "../context-menu-DSVerkvr.mjs";
@@ -1,6 +1,6 @@
1
1
  import "./style.css";
2
2
  import { Base, define_element } from "./base/index.mjs";
3
- import { i as theme_init_variable_root } from "./theme-D0pRMLyT.mjs";
3
+ import { i as theme_init_variable_root } from "./theme-ycsugrdT.mjs";
4
4
  import { Fm as material_chevron_right_rounded, xh as material_close_rounded } from "./icons-B88i-7MC.mjs";
5
5
  import { Spinner } from "./spinner/index.mjs";
6
6
  import { DOCUMENT_HANDLER } from "./document/index.mjs";
@@ -596,4 +596,4 @@ const ctm = {
596
596
  };
597
597
  export { ctm as t };
598
598
 
599
- //# sourceMappingURL=context-menu-C0KTV5zC.mjs.map
599
+ //# sourceMappingURL=context-menu-DSVerkvr.mjs.map