@chocbite/ts-lib-ui 1.1.4 → 1.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chocbite/ts-lib-ui",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Browser UI TypeScript libraries, builds on @chocbite/ts-lib",
5
5
  "author": "chocolateandmilkwin",
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  "./theme/mixins": "./theme/mixins.scss"
20
20
  },
21
21
  "dependencies": {
22
- "@chocbite/ts-lib": "^1.1.4"
22
+ "@chocbite/ts-lib": "^1.1.5"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"
@@ -1,5 +1,5 @@
1
1
  import '../style.css';
2
- import { l as Base } from "../index-ClfL2SQR.mjs";
2
+ import { l as Base } from "../index-CvzH3M_5.mjs";
3
3
  export declare class Spinner extends Base {
4
4
  /**Returns the name used to define the element */
5
5
  static element_name(): string;
package/spinner/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import "../style.css";
2
2
  import { Base, define_element } from "../base/index.mjs";
3
3
  import { t as svg } from "../svg-Yz7elqnU.mjs";
4
- import { i as theme_init_variable_root } from "../theme-CpaCSGOf.mjs";
4
+ import { i as theme_init_variable_root } from "../theme-D3YluyYr.mjs";
5
5
  import { GREY } from "@chocbite/ts-lib/colors";
6
6
  // spinner/index.ts
7
7
  theme_init_variable_root("spinners", "Spinner", "Spinner used as a placeholder for data with and unknown arrival time").make_variable("color", "Dot color", "Color of dots in spinner", GREY["700"], GREY["300"], "Color", void 0);
package/svg/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  import '../style.css';
2
- import { n as svg, r as SVGAnchorPoint, t as SVGFunc } from "../index-ClIBfrHy.mjs";
2
+ import { n as svg, r as SVGAnchorPoint, t as SVGFunc } from "../index-BDWg5GX2.mjs";
3
3
  export { SVGAnchorPoint, SVGFunc, svg };
package/test/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '../style.css';
2
- import { l as Base } from "../index-ClfL2SQR.mjs";
2
+ import { l as Base } from "../index-CvzH3M_5.mjs";
3
3
  import { State, StateROSW } from "@chocbite/ts-lib/state";
4
4
  /**A fixed value or a state giving the value*/
5
5
  export type Input<T> = T | State<T>;
package/theme/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '../style.css';
2
- import { t as SVGFunc } from "../index-ClIBfrHy.mjs";
2
+ import { t as SVGFunc } from "../index-BDWg5GX2.mjs";
3
3
  export declare const BUILT_IN = 0;
4
4
  export declare const Themes: {
5
5
  readonly Light: "light";
package/theme/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  import "../style.css";
2
- export { s as ANIMATION_LEVEL, c as ANIMATION_SPEED, l as AnimationLevels, n as BUILT_IN, u as INPUT_MODE, d as InputModes, f as SCALE, p as SCROLLBAR_MODE, m as ScrollbarModes, h as THEME, r as ThemeVariableGroup, g as Themes, a as px_to_rem, o as rem_to_px, t as theme_init, i as theme_init_variable_root } from "../theme-CpaCSGOf.mjs";
2
+ export { s as ANIMATION_LEVEL, c as ANIMATION_SPEED, l as AnimationLevels, n as BUILT_IN, u as INPUT_MODE, d as InputModes, f as SCALE, p as SCROLLBAR_MODE, m as ScrollbarModes, h as THEME, r as ThemeVariableGroup, g as Themes, a as px_to_rem, o as rem_to_px, t as theme_init, i as theme_init_variable_root } from "../theme-D3YluyYr.mjs";
@@ -6,7 +6,7 @@ import { state as state$1 } from "@chocbite/ts-lib/state";
6
6
  import { none, ok, some } from "@chocbite/ts-lib/result";
7
7
  import { GREY } from "@chocbite/ts-lib/colors";
8
8
  // ../package.json
9
- var version = "1.1.4";
9
+ var version = "1.1.5";
10
10
  // theme/settings.ts
11
11
  const SETTINGS = settings_init("@chocbite/ts-lib-theme", version, "Theme/UI", "Settings for UI elements and color themes");
12
12
  /**Accepts a stored setting only when it is one of the given values, otherwise the default is used*/
@@ -416,4 +416,4 @@ function theme_init(options = {}) {
416
416
  }
417
417
  export { version as _, px_to_rem as a, ANIMATION_SPEED as c, InputModes as d, SCALE as f, Themes as g, THEME as h, theme_init_variable_root as i, AnimationLevels as l, ScrollbarModes as m, BUILT_IN as n, rem_to_px as o, SCROLLBAR_MODE as p, ThemeVariableGroup as r, ANIMATION_LEVEL as s, theme_init as t, INPUT_MODE as u };
418
418
 
419
- //# sourceMappingURL=theme-CpaCSGOf.mjs.map
419
+ //# sourceMappingURL=theme-D3YluyYr.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"theme-CpaCSGOf.mjs","names":["st"],"sources":["../../package.json","../../package-ui/theme/settings.ts","../../package-ui/theme/shared.ts","../../package-ui/theme/engine.ts","../../package-ui/theme/variables.ts","../../package-ui/theme/builtIn.ts","../../package-ui/theme/init.ts"],"sourcesContent":["","import {\n material_dark_mode_rounded,\n material_edit_rounded,\n material_light_mode_rounded,\n material_mouse_rounded,\n material_touch_app_rounded,\n} from \"#icons\";\nimport { settings_init } from \"#settings\";\nimport { none, ok, some, type Option } from \"@chocbite/ts-lib/result\";\nimport { state as st } from \"@chocbite/ts-lib/state\";\nimport { version } from \"../../package.json\";\n\nconst SETTINGS = settings_init(\n \"@chocbite/ts-lib-theme\",\n version,\n \"Theme/UI\",\n \"Settings for UI elements and color themes\",\n);\n\n/**Accepts a stored setting only when it is one of the given values, otherwise the default is used*/\nconst one_of =\n <T>(values: { [key: string]: T }) =>\n (stored: unknown): Option<T> =>\n Object.values(values).includes(stored as T) ? some(stored as T) : none();\n\n/**Accepts a stored setting only when it is a number within the range, otherwise the default is used*/\nconst in_range =\n (min: number, max: number) =>\n (stored: unknown): Option<number> =>\n typeof stored === \"number\" && stored >= min && stored <= max\n ? some(stored)\n : none();\n\n// _______ _ _ ______ __ __ ______\n// |__ __| | | | ____| \\/ | ____|\n// | | | |__| | |__ | \\ / | |__\n// | | | __ | __| | |\\/| | __|\n// | | | | | | |____| | | | |____\n// |_| |_| |_|______|_| |_|______|\nexport const Themes = {\n Light: \"light\",\n Dark: \"dark\",\n /**Follows the light or dark mode of the operating system, only offered when theme_init enables system*/\n System: \"system\",\n} as const;\nexport type Themes = (typeof Themes)[keyof typeof Themes];\n/**Themes that can be applied to the page, System is resolved to one of these*/\nexport type AppliedThemes = typeof Themes.Light | typeof Themes.Dark;\n\ntype ThemeList = Parameters<typeof st.e.list<Themes>>[0];\nconst LIGHT = {\n name: \"Light\",\n description: \"Theme optimized for daylight\",\n icon: material_light_mode_rounded,\n};\nconst DARK = {\n name: \"Dark\",\n description: \"Theme optimized for night time\",\n icon: material_dark_mode_rounded,\n};\n/**Theme choices, the System choice shows the theme the operating system currently uses\n * @param system theme of the operating system, undefined when the System choice is not offered*/\nconst theme_list = (system?: AppliedThemes): ThemeList => {\n const list: Partial<ThemeList> = {\n [Themes.Light]: LIGHT,\n [Themes.Dark]: DARK,\n };\n if (system) {\n const active = system === Themes.Dark ? DARK : LIGHT;\n list[Themes.System] = {\n name: \"System (\" + active.name + \")\",\n description: \"Follows the light or dark mode of the operating system\",\n icon: active.icon,\n };\n }\n return list as ThemeList;\n};\nconst THEMES = st.ok_w(theme_list());\n\nconst THEME_ID = \"theme\";\n/**Theme the user chose, undefined when nothing has been chosen yet*/\nconst STORED_THEME = SETTINGS.get<Themes | undefined>(\n THEME_ID,\n undefined,\n one_of(Themes),\n).value;\nconst PRIVATE_THEME = st.rosw(\n st.e.help(ok(STORED_THEME ?? (Themes.Light as Themes)), { list: THEMES }),\n true,\n);\n\nexport const THEME = PRIVATE_THEME.read_write;\n\n/**Sets up the theme setting, called once by theme_init\n * @param system theme of the operating system, undefined when the System choice is not offered\n * @param default_theme theme used when the user has not chosen one*/\nexport function theme_setting_init(\n system: AppliedThemes | undefined,\n default_theme: Themes,\n) {\n if (system) THEMES.set_ok(theme_list(system));\n //Set before registering, so the default is not stored as if the user chose it\n if (STORED_THEME === undefined || (STORED_THEME === Themes.System && !system))\n PRIVATE_THEME.set_ok(default_theme);\n SETTINGS.register(\n THEME_ID,\n \"Theme\",\n \"Theme to use for the UI\",\n PRIVATE_THEME,\n );\n}\n\n/**Updates the System choice to show the theme the operating system uses*/\nexport function theme_setting_system(system: AppliedThemes) {\n THEMES.set_ok(theme_list(system));\n}\n\n// _____ _____ _ ______\n// / ____|/ ____| /\\ | | | ____|\n// | (___ | | / \\ | | | |__\n// \\___ \\| | / /\\ \\ | | | __|\n// ____) | |____ / ____ \\| |____| |____\n// |_____/ \\_____/_/ \\_\\______|______|\nconst SCALE_ID = \"scale\";\nconst PRIVATE_SCALE = st.rosw(\n st.n.help(SETTINGS.get(SCALE_ID, 100, in_range(50, 400)), {\n min: st.ok(50),\n max: st.ok(400),\n unit: st.ok(\"%\"),\n start: st.ok(0),\n step: st.ok(1),\n }),\n true,\n);\nSETTINGS.register(SCALE_ID, \"Scale\", \"UI scale\", PRIVATE_SCALE);\nexport const SCALE = PRIVATE_SCALE.read_write;\n\n// _____ _____ _____ ____ _ _ ____ _____\n// / ____|/ ____| __ \\ / __ \\| | | | | _ \\ /\\ | __ \\\n// | (___ | | | |__) | | | | | | | | |_) | / \\ | |__) |\n// \\___ \\| | | _ /| | | | | | | | _ < / /\\ \\ | _ /\n// ____) | |____| | \\ \\| |__| | |____| |____| |_) / ____ \\| | \\ \\\n// |_____/ \\_____|_| \\_\\\\____/|______|______|____/_/ \\_\\_| \\_\\\nexport const ScrollbarModes = {\n Thin: \"thin\",\n Medium: \"medium\",\n Wide: \"wide\",\n} as const;\nexport type ScrollbarModes =\n (typeof ScrollbarModes)[keyof typeof ScrollbarModes];\n\nconst SCROLLBAR_MODES = st.ok(\n st.e.list<ScrollbarModes>({\n [ScrollbarModes.Thin]: {\n name: \"Thin\",\n description: \"Thin modern scrollbar\",\n },\n [ScrollbarModes.Medium]: {\n name: \"Medium\",\n description: \"Normal scrollbar\",\n },\n [ScrollbarModes.Wide]: {\n name: \"Wide\",\n description: \"Large touch friendly scrollbar\",\n },\n }),\n);\n\nconst SCROLLBAR_ID = \"scrollbar\";\nconst PRIVATE_SCROLLBAR_MODE = st.rosw(\n st.e.help(\n SETTINGS.get(\n SCROLLBAR_ID,\n ScrollbarModes.Thin as ScrollbarModes,\n one_of(ScrollbarModes),\n ),\n { list: SCROLLBAR_MODES },\n ),\n true,\n);\nSETTINGS.register(\n \"scrollbar\",\n \"Scrollbar Mode\",\n \"Size of the scrollbar to use\",\n PRIVATE_SCROLLBAR_MODE,\n);\n\nexport const SCROLLBAR_MODE = PRIVATE_SCROLLBAR_MODE.read_write;\n\n// _____ _ _ _____ _ _ _______ __ __ ____ _____ ______\n// |_ _| \\ | | __ \\| | | |__ __| | \\/ |/ __ \\| __ \\| ____|\n// | | | \\| | |__) | | | | | | | \\ / | | | | | | | |__\n// | | | . ` | ___/| | | | | | | |\\/| | | | | | | | __|\n// _| |_| |\\ | | | |__| | | | | | | | |__| | |__| | |____\n// |_____|_| \\_|_| \\____/ |_| |_| |_|\\____/|_____/|______|\nexport const InputModes = {\n Mouse: \"mouse\",\n Pen: \"pen\",\n Touch: \"touch\",\n} as const;\nexport type InputModes = (typeof InputModes)[keyof typeof InputModes];\n\nconst INPUT_MODES = st.ok(\n st.e.list<InputModes>({\n [InputModes.Mouse]: {\n name: \"Mouse\",\n description: \"Mouse input\",\n icon: material_mouse_rounded,\n },\n [InputModes.Pen]: {\n name: \"Pen\",\n description: \"Pen input\",\n icon: material_edit_rounded,\n },\n [InputModes.Touch]: {\n name: \"Touch\",\n description: \"Touch input\",\n icon: material_touch_app_rounded,\n },\n }),\n);\n\nconst INPUT_MODE_ID = \"input_mode\";\nconst PRIVATE_INPUT_MODE = st.rosw(\n st.e.help(\n SETTINGS.get(\n INPUT_MODE_ID,\n matchMedia(\"(pointer: coarse)\").matches\n ? InputModes.Touch\n : (InputModes.Mouse as InputModes),\n one_of(InputModes),\n ),\n { list: INPUT_MODES },\n ),\n true,\n);\nSETTINGS.register(\n INPUT_MODE_ID,\n \"Input Mode\",\n \"Setting for preffered input mode, changes UI elements to be more optimized for the selected input mode\",\n PRIVATE_INPUT_MODE,\n);\n\nexport const INPUT_MODE = PRIVATE_INPUT_MODE.read_write;\n\n// _ _ _____ __ __ _______ _____ ____ _ _ _ ________ ________ _\n// /\\ | \\ | |_ _| \\/ | /\\|__ __|_ _/ __ \\| \\ | | | | | ____\\ \\ / / ____| |\n// / \\ | \\| | | | | \\ / | / \\ | | | || | | | \\| | | | | |__ \\ \\ / /| |__ | |\n// / /\\ \\ | . ` | | | | |\\/| | / /\\ \\ | | | || | | | . ` | | | | __| \\ \\/ / | __| | |\n// / ____ \\| |\\ |_| |_| | | |/ ____ \\| | _| || |__| | |\\ | | |____| |____ \\ / | |____| |____\n// /_/ \\_\\_| \\_|_____|_| |_/_/ \\_\\_| |_____\\____/|_| \\_| |______|______| \\/ |______|______|\nexport const AnimationLevels = {\n All: \"all\",\n Some: \"some\",\n None: \"none\",\n} as const;\nexport type AnimationLevels =\n (typeof AnimationLevels)[keyof typeof AnimationLevels];\n\nconst ANIMATION_LEVELS = st.ok(\n st.e.list<AnimationLevels>({\n [AnimationLevels.All]: { name: \"All\", description: \"All animations\" },\n [AnimationLevels.Some]: {\n name: \"Functional\",\n description: \"Only functional animations that improve usability\",\n },\n [AnimationLevels.None]: { name: \"None\", description: \"No animations\" },\n }),\n);\n\nconst ANIMATION_LEVEL_ID = \"animation_level\";\nconst PRIVATE_ANIMATION_LEVEL = st.rosw(\n st.e.help(\n SETTINGS.get(\n ANIMATION_LEVEL_ID,\n AnimationLevels.None as AnimationLevels,\n one_of(AnimationLevels),\n ),\n { list: ANIMATION_LEVELS },\n ),\n true,\n);\nSETTINGS.register(\n ANIMATION_LEVEL_ID,\n \"Animation Level\",\n \"Setting for animation level, changes the amount of animations used in the UI\",\n PRIVATE_ANIMATION_LEVEL,\n);\n\nexport const ANIMATION_LEVEL = PRIVATE_ANIMATION_LEVEL.read_write;\n\n// _ _ _____ __ __ _______ _____ ____ _ _ _____ _____ ______ ______ _____\n// /\\ | \\ | |_ _| \\/ | /\\|__ __|_ _/ __ \\| \\ | | / ____| __ \\| ____| ____| __ \\\n// / \\ | \\| | | | | \\ / | / \\ | | | || | | | \\| | | (___ | |__) | |__ | |__ | | | |\n// / /\\ \\ | . ` | | | | |\\/| | / /\\ \\ | | | || | | | . ` | \\___ \\| ___/| __| | __| | | | |\n// / ____ \\| |\\ |_| |_| | | |/ ____ \\| | _| || |__| | |\\ | ____) | | | |____| |____| |__| |\n// /_/ \\_\\_| \\_|_____|_| |_/_/ \\_\\_| |_____\\____/|_| \\_| |_____/|_| |______|______|_____/\nconst ANIMATION_SPEED_ID = \"animation_speed\";\nconst PRIVATE_ANIMATION_SPEED = st.rosw(\n st.n.help(SETTINGS.get(ANIMATION_SPEED_ID, 200, in_range(50, 1000)), {\n min: st.ok(50),\n max: st.ok(1000),\n unit: st.ok(\"ms\"),\n start: st.ok(0),\n step: st.ok(50),\n }),\n true,\n);\nSETTINGS.register(\n ANIMATION_SPEED_ID,\n \"Animation Speed\",\n \"Setting for animation speed, changes the speed of animations in the UI\",\n PRIVATE_ANIMATION_SPEED,\n);\n\nexport const ANIMATION_SPEED = PRIVATE_ANIMATION_SPEED.read_write;\n","import type { ThemeVariableGroup } from \"./variables\";\n\nexport const BOTTOM_GROUPS: { [key: string]: ThemeVariableGroup } = {};\n","import { DOCUMENT_HANDLER } from \"#document\";\nimport {\n ANIMATION_LEVEL,\n ANIMATION_SPEED,\n AnimationLevels,\n INPUT_MODE,\n InputModes,\n SCALE,\n SCROLLBAR_MODE,\n ScrollbarModes,\n THEME,\n Themes,\n type AppliedThemes,\n} from \"./settings\";\nimport { BOTTOM_GROUPS } from \"./shared\";\n\nclass ThemeEngine {\n #started = false;\n /**Theme of the operating system, used for the System theme*/\n #os_theme: AppliedThemes = Themes.Light;\n\n /**Starts applying the theme to all documents, called once by theme_init*/\n start() {\n this.#started = true;\n DOCUMENT_HANDLER.events.on(\"added\", (e) => {\n this.#apply_all_to_doc(e.data);\n });\n this.#for_documents((doc) => {\n this.#apply_all_to_doc(doc);\n });\n }\n\n /**Runs for every document, nothing is applied before the engine is started*/\n #for_documents(func: (doc: Document) => void) {\n if (this.#started) DOCUMENT_HANDLER.for_documents(func);\n }\n\n /**Sets the theme of the operating system, reapplying the theme when System is used*/\n set_os_theme(theme: AppliedThemes) {\n this.#os_theme = theme;\n if (THEME.ok() === Themes.System) this.apply_theme(Themes.System);\n }\n\n /**Resolves the System theme to the theme of the operating system*/\n #applied(theme: Themes): AppliedThemes {\n return theme === Themes.System ? this.#os_theme : theme;\n }\n\n /**This applies the current theme to a document*/\n #apply_all_to_doc(doc: Document) {\n this.#apply_scrollbar_to_doc(doc, SCROLLBAR_MODE.ok());\n this.#apply_theme_to_doc(doc, THEME.ok());\n this.#apply_input_to_doc(doc, INPUT_MODE.ok());\n this.#apply_scale_to_doc(doc, SCALE.ok() / 100);\n this.#apply_animation_level_to_doc(doc, ANIMATION_LEVEL.ok());\n this.#apply_animation_speed_to_doc(doc, ANIMATION_SPEED.ok());\n }\n\n /**This applies the current theme to a document*/\n apply_scrollbar(scroll: ScrollbarModes) {\n this.#for_documents((doc) => {\n this.#apply_scrollbar_to_doc(doc, scroll);\n });\n }\n #apply_scrollbar_to_doc(doc: Document, scroll: ScrollbarModes) {\n doc.documentElement.style.setProperty(\n \"--scrollbar\",\n {\n [ScrollbarModes.Thin]: \"0.6rem\",\n [ScrollbarModes.Medium]: \"1rem\",\n [ScrollbarModes.Wide]: \"2.6rem\",\n }[scroll],\n );\n }\n\n /**This applies the current theme to a document*/\n apply_animation_level(anim: AnimationLevels) {\n this.#for_documents((doc) => {\n this.#apply_animation_level_to_doc(doc, anim);\n });\n }\n #apply_animation_level_to_doc(doc: Document, anim: AnimationLevels) {\n doc.documentElement.classList.remove(\"anim-all\", \"anim-some\");\n switch (anim) {\n case AnimationLevels.All:\n doc.documentElement.classList.add(\"anim-all\");\n doc.documentElement.classList.add(\"anim-some\");\n break;\n case AnimationLevels.Some:\n doc.documentElement.classList.add(\"anim-some\");\n break;\n }\n }\n\n /**This applies the current theme to a document*/\n apply_animation_speed(speed: number) {\n this.#for_documents((doc) => {\n this.#apply_animation_speed_to_doc(doc, speed);\n });\n }\n #apply_animation_speed_to_doc(doc: Document, speed: number) {\n const style = doc.documentElement.style;\n style.setProperty(\"--animation-speed\", speed.toString() + \"ms\");\n }\n\n /**This applies the current theme to a document*/\n apply_theme(theme: Themes) {\n this.#for_documents((doc) => {\n this.#apply_theme_to_doc(doc, theme);\n });\n }\n #apply_theme_to_doc(doc: Document, theme: Themes) {\n const applied = this.#applied(theme);\n for (const key in BOTTOM_GROUPS)\n BOTTOM_GROUPS[key].apply_themes(doc.documentElement.style, applied);\n }\n\n /**This applies the current scale to a document*/\n apply_scale(scale: number) {\n this.#for_documents((doc) => {\n this.#apply_scale_to_doc(doc, scale);\n });\n }\n #apply_scale_to_doc(doc: Document, scale: number) {\n doc.documentElement.style.fontSize = scale * 16 + \"px\";\n }\n\n /**Auto Input Mode */\n apply_input(mode: InputModes) {\n this.#for_documents((doc) => {\n this.#apply_input_to_doc(doc, mode);\n });\n }\n #apply_input_to_doc(doc: Document, mode: InputModes) {\n const style = doc.documentElement.style;\n style.setProperty(\"--mouse\", \"0\");\n style.setProperty(\"--pen\", \"0\");\n style.setProperty(\"--touch\", \"0\");\n doc.documentElement.classList.remove(\"mouse\", \"pen\", \"touch\");\n switch (mode) {\n case InputModes.Mouse:\n style.setProperty(\"--mouse\", \"1\");\n doc.documentElement.classList.add(\"mouse\");\n break;\n case InputModes.Pen:\n style.setProperty(\"--pen\", \"1\");\n doc.documentElement.classList.add(\"pen\");\n break;\n case InputModes.Touch:\n style.setProperty(\"--touch\", \"1\");\n doc.documentElement.classList.add(\"touch\");\n break;\n }\n }\n\n apply_single_property(key: string, variable: { [s: string]: string }) {\n const theme_buff = this.#applied(THEME.ok());\n this.#for_documents((doc) => {\n doc.documentElement.style.setProperty(key, variable[theme_buff]);\n });\n }\n}\n\nexport const theme_engine = new ThemeEngine();\n\nTHEME.sub((val) => {\n theme_engine.apply_theme(val.value);\n});\n/**Size of a rem in pixels at the current scale, set right away from the stored scale*/\nlet scale_rem = 16;\nSCALE.sub((val) => {\n const scale_value = val.value / 100;\n scale_rem = scale_value * 16;\n theme_engine.apply_scale(scale_value);\n}, true);\n/**Converts the given rems to pixels */\nexport function rem_to_px(rem: number) {\n return rem * scale_rem;\n}\n/**Converts the given pixels to rems */\nexport function px_to_rem(px: number) {\n return px / scale_rem;\n}\nSCROLLBAR_MODE.sub((val) => {\n theme_engine.apply_scrollbar(val.value);\n});\nINPUT_MODE.sub((val) => {\n theme_engine.apply_input(val.value);\n});\nANIMATION_LEVEL.sub((val) => {\n theme_engine.apply_animation_level(val.value);\n});\nANIMATION_SPEED.sub((val) => {\n theme_engine.apply_animation_speed(val.value);\n});\n","import { theme_engine } from \"./engine\";\nimport { Themes } from \"./settings\";\nimport { BOTTOM_GROUPS } from \"./shared\";\n\n/**Initialises the settings for the package\n * @param package_name use import {name} from \"../package.json\"\n * @param name name of group formatted for user reading\n * @param description a description of what the setting group is about*/\nexport const theme_init_variable_root = (\n package_name: string,\n name: string,\n description: string\n) => {\n if (package_name.includes(\"-\"))\n throw new Error(\"Dash not permitted in package name \" + package_name);\n if (package_name in BOTTOM_GROUPS)\n throw new Error(\n \"Theme variable group already registered \" +\n package_name +\n \", by another package or by this library being loaded twice\",\n );\n BOTTOM_GROUPS[package_name] = new ThemeVariableGroup(\n package_name,\n name,\n description\n );\n return BOTTOM_GROUPS[package_name];\n};\n\n/**Group of settings should never be instantiated manually use initSettings*/\nexport class ThemeVariableGroup {\n private path_id: string;\n private variables: {\n [key: string]: {\n name: string;\n desc: string;\n vars: { [key: string]: string };\n type: keyof VariableType;\n typeParams: VariableType[keyof VariableType];\n example?: () => Element;\n };\n } = {};\n private sub_groups: { [key: string]: ThemeVariableGroup } = {};\n readonly name: string;\n readonly description: string;\n\n constructor(path: string, name: string, description: string) {\n this.path_id = path;\n this.name = name;\n this.description = description;\n }\n\n /**Makes a variable subgroup for this group\n * @param id unique identifier for this subgroup in the parent group\n * @param name name of group formatted for user reading\n * @param description a description of what the setting group is about formatted for user reading*/\n make_sub_group(id: string, name: string, description: string) {\n if (id.includes(\"-\"))\n throw new Error(\"Dash not permitted in variable id \" + id);\n if (id in this.sub_groups)\n throw new Error(\"Sub group already registered \" + id);\n return (this.sub_groups[id] = new ThemeVariableGroup(\n this.path_id + \"-\" + id,\n name,\n description\n ));\n }\n\n /**Makes a variable\n * @param id unique identifier for this variable in the group\n * @param name name of variable formatted for user reading\n * @param description a description of what the variable is about formatted for user reading\n * @param light value for light mode\n * @param dark value for dark mode\n * @param type type of variable for editing\n * @param type_params */\n make_variable<K extends keyof VariableType>(\n id: string,\n name: string,\n description: string,\n light: string,\n dark: string,\n type: K,\n type_params: VariableType[K],\n example?: () => Element\n ): string {\n if (id.includes(\"-\"))\n throw new Error(\"Dash not permitted in variable id \" + id);\n const key = \"--\" + this.path_id + \"-\" + id;\n if (key in this.variables)\n throw new Error(\"Settings already registered \" + id);\n const variable = (this.variables[key] = {\n name,\n desc: description,\n vars: { [Themes.Light]: light, [Themes.Dark]: dark },\n type,\n typeParams: type_params,\n example,\n });\n theme_engine.apply_single_property(key, variable.vars);\n return key;\n }\n\n /**Applies the groups\n * @param style unique identifier for this variable in the group\n * @param theme name of variable formatted for user reading*/\n apply_themes(style: CSSStyleDeclaration, theme: string) {\n for (const key in this.variables)\n style.setProperty(key, this.variables[key].vars[theme]);\n for (const key in this.sub_groups)\n this.sub_groups[key].apply_themes(style, theme);\n }\n}\n\n/**Defines the parameters for a variable type */\ninterface VariableType {\n /**Font variable, */\n Font: undefined;\n /**Text variable, */\n String: undefined;\n /**Color variable */\n Color: undefined;\n /**Transition type */\n TransitionType: undefined;\n /**Percent type */\n Percent: undefined;\n /**Filter type */\n Filter: undefined;\n /**Radius type */\n Radius: undefined;\n /**Time variable */\n Time: {\n /**Minimum time in milliseconds */\n min: number;\n /**Maximum time in milliseconds */\n max: number;\n };\n /**Angle variable */\n Angle: { min: number; max: number };\n /**Length variable*/\n Length: { min: number; max: number };\n /**Number variable*/\n Number: { min: number; max: number };\n /**Ratio*/\n Ratio:\n | {\n width: { min: number; max: number };\n height: { min: number; max: number };\n }\n | number;\n}\n","import { GREY } from \"@chocbite/ts-lib/colors\";\nimport { theme_init_variable_root } from \"./variables\";\n\nexport const BUILT_IN = 0;\n\nconst root = theme_init_variable_root(\n \"common\",\n \"Shared Variables\",\n \"Shared variables across features\",\n);\n\nconst scroll_bar = root.make_sub_group(\n \"scrollbar\",\n \"Scrollbar\",\n \"Scrollbar variables\",\n);\nconst scroll_bar_thumb = scroll_bar.make_sub_group(\n \"thumb\",\n \"Thumb\",\n \"Scrollbar Thumb variables\",\n);\nscroll_bar_thumb.make_variable(\n \"color\",\n \"Thumb Color\",\n \"Color of the scrollbar thumb in normal state\",\n GREY[\"400\"],\n GREY[\"800\"],\n \"Color\",\n undefined,\n);\nscroll_bar_thumb.make_variable(\n \"hoverColor\",\n \"Thumb Hover Color\",\n \"Color of the scrollbar thumb when hovered\",\n GREY[\"600\"],\n GREY[\"600\"],\n \"Color\",\n undefined,\n);\nscroll_bar_thumb.make_variable(\n \"activeColor\",\n \"Thumb Active Color\",\n \"Color of the scrollbar thumb when pressed\",\n GREY[\"500\"],\n GREY[\"700\"],\n \"Color\",\n undefined,\n);\n\nconst fonts = root.make_sub_group(\"fonts\", \"Fonts\", \"Font variables\");\nfonts.make_variable(\n \"base\",\n \"UI Base Font\",\n \"The base font for the UI\",\n '\"Roboto\", Arial, Helvetica, sans-serif',\n '\"Roboto\", Arial, Helvetica, sans-serif',\n \"Font\",\n undefined,\n);\n\n// _____ ____ _ ____ _____ _____\n// / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | | | | | | | | | | | |__) | (___\n// | | | | | | | | | | | _ / \\___ \\\n// | |___| |__| | |___| |__| | | \\ \\ ____) |\n// \\_____\\____/|______\\____/|_| \\_\\_____/\n\nconst colors = root.make_sub_group(\"colors\", \"Colors\", \"Color variables\");\ncolors.make_variable(\n \"layer1\",\n \"UI Layer 1\",\n \"Color of the first layer of the UI\",\n GREY[50],\n \"#111111\",\n \"Color\",\n undefined,\n);\n","import { theme_engine } from \"./engine\";\nimport {\n theme_setting_init,\n theme_setting_system,\n Themes,\n type AppliedThemes,\n} from \"./settings\";\n\nexport interface ThemeInitOptions {\n /**Offers a System theme that follows the light or dark mode of the operating system,\n * leave it off on devices without that feature*/\n system?: boolean;\n /**Theme used until the user chooses one, defaults to System when system is on, otherwise Light*/\n default?: Themes;\n}\n\nlet initialized = false;\n\n/**Starts the theme, the app must call it once, nothing of the theme is applied to the page before.\n * This is the only place the operating system dark mode is read, and only when system is on*/\nexport function theme_init(options: ThemeInitOptions = {}) {\n const default_theme =\n options.default ?? (options.system ? Themes.System : Themes.Light);\n if (default_theme === Themes.System && !options.system)\n throw new Error(\"The System theme can only be the default with system on\");\n if (initialized) throw new Error(\"theme_init has already been called\");\n initialized = true;\n let os_theme: AppliedThemes | undefined;\n if (options.system) {\n const query = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const theme_of = (dark: boolean) => (dark ? Themes.Dark : Themes.Light);\n os_theme = theme_of(query.matches);\n theme_engine.set_os_theme(os_theme);\n query.addEventListener(\"change\", (e) => {\n const changed = theme_of(e.matches);\n theme_setting_system(changed);\n theme_engine.set_os_theme(changed);\n });\n }\n theme_setting_init(os_theme, default_theme);\n theme_engine.start();\n}\n"],"mappings":";;;;;;;;;;ACYA,MAAM,WAAW,cACf,0BACA,SACA,YACA,2CACF;;AAGA,MAAM,UACA,YACH,WACC,OAAO,OAAO,MAAM,CAAC,CAAC,SAAS,MAAW,IAAI,KAAK,MAAW,IAAI,KAAK;;AAG3E,MAAM,YACH,KAAa,SACb,WACC,OAAO,WAAW,YAAY,UAAU,OAAO,UAAU,MACrD,KAAK,MAAM,IACX,KAAK;AAQb,MAAa,SAAS;CACpB,OAAO;CACP,MAAM;;CAEN,QAAQ;A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;CACzD,MAAM,gBACJ,QAAQ,YAAY,QAAQ,SAAS,OAAO,SAAS,OAAO;CAC9D,IAAI,kBAAkB,OAAO,UAAU,CAAC,QAAQ,QAC9C,MAAM,IAAI,MAAM,yDAAyD;CAC3E,IAAI,aAAa,MAAM,IAAI,MAAM,oCAAoC;CACrE,cAAc;CACd,IAAI;CACJ,IAAI,QAAQ,QAAQ;EAClB,MAAM,QAAQ,OAAO,WAAW,8BAA8B;EAC9D,MAAM,YAAY,SAAmB,OAAO,OAAO,OAAO,OAAO;EACjE,WAAW,SAAS,MAAM,OAAO;EACjC,aAAa,aAAa,QAAQ;EAClC,MAAM,iBAAiB,WAAW,MAAM;GACtC,MAAM,UAAU,SAAS,EAAE,OAAO;GAClC,qBAAqB,OAAO;GAC5B,aAAa,aAAa,OAAO;EACnC,CAAC;CACH;CACA,mBAAmB,UAAU,aAAa;CAC1C,aAAa,MAAM;AACrB"}
1
+ {"version":3,"file":"theme-D3YluyYr.mjs","names":["st"],"sources":["../../package.json","../../package-ui/theme/settings.ts","../../package-ui/theme/shared.ts","../../package-ui/theme/engine.ts","../../package-ui/theme/variables.ts","../../package-ui/theme/builtIn.ts","../../package-ui/theme/init.ts"],"sourcesContent":["","import {\n material_dark_mode_rounded,\n material_edit_rounded,\n material_light_mode_rounded,\n material_mouse_rounded,\n material_touch_app_rounded,\n} from \"#icons\";\nimport { settings_init } from \"#settings\";\nimport { none, ok, some, type Option } from \"@chocbite/ts-lib/result\";\nimport { state as st } from \"@chocbite/ts-lib/state\";\nimport { version } from \"../../package.json\";\n\nconst SETTINGS = settings_init(\n \"@chocbite/ts-lib-theme\",\n version,\n \"Theme/UI\",\n \"Settings for UI elements and color themes\",\n);\n\n/**Accepts a stored setting only when it is one of the given values, otherwise the default is used*/\nconst one_of =\n <T>(values: { [key: string]: T }) =>\n (stored: unknown): Option<T> =>\n Object.values(values).includes(stored as T) ? some(stored as T) : none();\n\n/**Accepts a stored setting only when it is a number within the range, otherwise the default is used*/\nconst in_range =\n (min: number, max: number) =>\n (stored: unknown): Option<number> =>\n typeof stored === \"number\" && stored >= min && stored <= max\n ? some(stored)\n : none();\n\n// _______ _ _ ______ __ __ ______\n// |__ __| | | | ____| \\/ | ____|\n// | | | |__| | |__ | \\ / | |__\n// | | | __ | __| | |\\/| | __|\n// | | | | | | |____| | | | |____\n// |_| |_| |_|______|_| |_|______|\nexport const Themes = {\n Light: \"light\",\n Dark: \"dark\",\n /**Follows the light or dark mode of the operating system, only offered when theme_init enables system*/\n System: \"system\",\n} as const;\nexport type Themes = (typeof Themes)[keyof typeof Themes];\n/**Themes that can be applied to the page, System is resolved to one of these*/\nexport type AppliedThemes = typeof Themes.Light | typeof Themes.Dark;\n\ntype ThemeList = Parameters<typeof st.e.list<Themes>>[0];\nconst LIGHT = {\n name: \"Light\",\n description: \"Theme optimized for daylight\",\n icon: material_light_mode_rounded,\n};\nconst DARK = {\n name: \"Dark\",\n description: \"Theme optimized for night time\",\n icon: material_dark_mode_rounded,\n};\n/**Theme choices, the System choice shows the theme the operating system currently uses\n * @param system theme of the operating system, undefined when the System choice is not offered*/\nconst theme_list = (system?: AppliedThemes): ThemeList => {\n const list: Partial<ThemeList> = {\n [Themes.Light]: LIGHT,\n [Themes.Dark]: DARK,\n };\n if (system) {\n const active = system === Themes.Dark ? DARK : LIGHT;\n list[Themes.System] = {\n name: \"System (\" + active.name + \")\",\n description: \"Follows the light or dark mode of the operating system\",\n icon: active.icon,\n };\n }\n return list as ThemeList;\n};\nconst THEMES = st.ok_w(theme_list());\n\nconst THEME_ID = \"theme\";\n/**Theme the user chose, undefined when nothing has been chosen yet*/\nconst STORED_THEME = SETTINGS.get<Themes | undefined>(\n THEME_ID,\n undefined,\n one_of(Themes),\n).value;\nconst PRIVATE_THEME = st.rosw(\n st.e.help(ok(STORED_THEME ?? (Themes.Light as Themes)), { list: THEMES }),\n true,\n);\n\nexport const THEME = PRIVATE_THEME.read_write;\n\n/**Sets up the theme setting, called once by theme_init\n * @param system theme of the operating system, undefined when the System choice is not offered\n * @param default_theme theme used when the user has not chosen one*/\nexport function theme_setting_init(\n system: AppliedThemes | undefined,\n default_theme: Themes,\n) {\n if (system) THEMES.set_ok(theme_list(system));\n //Set before registering, so the default is not stored as if the user chose it\n if (STORED_THEME === undefined || (STORED_THEME === Themes.System && !system))\n PRIVATE_THEME.set_ok(default_theme);\n SETTINGS.register(\n THEME_ID,\n \"Theme\",\n \"Theme to use for the UI\",\n PRIVATE_THEME,\n );\n}\n\n/**Updates the System choice to show the theme the operating system uses*/\nexport function theme_setting_system(system: AppliedThemes) {\n THEMES.set_ok(theme_list(system));\n}\n\n// _____ _____ _ ______\n// / ____|/ ____| /\\ | | | ____|\n// | (___ | | / \\ | | | |__\n// \\___ \\| | / /\\ \\ | | | __|\n// ____) | |____ / ____ \\| |____| |____\n// |_____/ \\_____/_/ \\_\\______|______|\nconst SCALE_ID = \"scale\";\nconst PRIVATE_SCALE = st.rosw(\n st.n.help(SETTINGS.get(SCALE_ID, 100, in_range(50, 400)), {\n min: st.ok(50),\n max: st.ok(400),\n unit: st.ok(\"%\"),\n start: st.ok(0),\n step: st.ok(1),\n }),\n true,\n);\nSETTINGS.register(SCALE_ID, \"Scale\", \"UI scale\", PRIVATE_SCALE);\nexport const SCALE = PRIVATE_SCALE.read_write;\n\n// _____ _____ _____ ____ _ _ ____ _____\n// / ____|/ ____| __ \\ / __ \\| | | | | _ \\ /\\ | __ \\\n// | (___ | | | |__) | | | | | | | | |_) | / \\ | |__) |\n// \\___ \\| | | _ /| | | | | | | | _ < / /\\ \\ | _ /\n// ____) | |____| | \\ \\| |__| | |____| |____| |_) / ____ \\| | \\ \\\n// |_____/ \\_____|_| \\_\\\\____/|______|______|____/_/ \\_\\_| \\_\\\nexport const ScrollbarModes = {\n Thin: \"thin\",\n Medium: \"medium\",\n Wide: \"wide\",\n} as const;\nexport type ScrollbarModes =\n (typeof ScrollbarModes)[keyof typeof ScrollbarModes];\n\nconst SCROLLBAR_MODES = st.ok(\n st.e.list<ScrollbarModes>({\n [ScrollbarModes.Thin]: {\n name: \"Thin\",\n description: \"Thin modern scrollbar\",\n },\n [ScrollbarModes.Medium]: {\n name: \"Medium\",\n description: \"Normal scrollbar\",\n },\n [ScrollbarModes.Wide]: {\n name: \"Wide\",\n description: \"Large touch friendly scrollbar\",\n },\n }),\n);\n\nconst SCROLLBAR_ID = \"scrollbar\";\nconst PRIVATE_SCROLLBAR_MODE = st.rosw(\n st.e.help(\n SETTINGS.get(\n SCROLLBAR_ID,\n ScrollbarModes.Thin as ScrollbarModes,\n one_of(ScrollbarModes),\n ),\n { list: SCROLLBAR_MODES },\n ),\n true,\n);\nSETTINGS.register(\n \"scrollbar\",\n \"Scrollbar Mode\",\n \"Size of the scrollbar to use\",\n PRIVATE_SCROLLBAR_MODE,\n);\n\nexport const SCROLLBAR_MODE = PRIVATE_SCROLLBAR_MODE.read_write;\n\n// _____ _ _ _____ _ _ _______ __ __ ____ _____ ______\n// |_ _| \\ | | __ \\| | | |__ __| | \\/ |/ __ \\| __ \\| ____|\n// | | | \\| | |__) | | | | | | | \\ / | | | | | | | |__\n// | | | . ` | ___/| | | | | | | |\\/| | | | | | | | __|\n// _| |_| |\\ | | | |__| | | | | | | | |__| | |__| | |____\n// |_____|_| \\_|_| \\____/ |_| |_| |_|\\____/|_____/|______|\nexport const InputModes = {\n Mouse: \"mouse\",\n Pen: \"pen\",\n Touch: \"touch\",\n} as const;\nexport type InputModes = (typeof InputModes)[keyof typeof InputModes];\n\nconst INPUT_MODES = st.ok(\n st.e.list<InputModes>({\n [InputModes.Mouse]: {\n name: \"Mouse\",\n description: \"Mouse input\",\n icon: material_mouse_rounded,\n },\n [InputModes.Pen]: {\n name: \"Pen\",\n description: \"Pen input\",\n icon: material_edit_rounded,\n },\n [InputModes.Touch]: {\n name: \"Touch\",\n description: \"Touch input\",\n icon: material_touch_app_rounded,\n },\n }),\n);\n\nconst INPUT_MODE_ID = \"input_mode\";\nconst PRIVATE_INPUT_MODE = st.rosw(\n st.e.help(\n SETTINGS.get(\n INPUT_MODE_ID,\n matchMedia(\"(pointer: coarse)\").matches\n ? InputModes.Touch\n : (InputModes.Mouse as InputModes),\n one_of(InputModes),\n ),\n { list: INPUT_MODES },\n ),\n true,\n);\nSETTINGS.register(\n INPUT_MODE_ID,\n \"Input Mode\",\n \"Setting for preffered input mode, changes UI elements to be more optimized for the selected input mode\",\n PRIVATE_INPUT_MODE,\n);\n\nexport const INPUT_MODE = PRIVATE_INPUT_MODE.read_write;\n\n// _ _ _____ __ __ _______ _____ ____ _ _ _ ________ ________ _\n// /\\ | \\ | |_ _| \\/ | /\\|__ __|_ _/ __ \\| \\ | | | | | ____\\ \\ / / ____| |\n// / \\ | \\| | | | | \\ / | / \\ | | | || | | | \\| | | | | |__ \\ \\ / /| |__ | |\n// / /\\ \\ | . ` | | | | |\\/| | / /\\ \\ | | | || | | | . ` | | | | __| \\ \\/ / | __| | |\n// / ____ \\| |\\ |_| |_| | | |/ ____ \\| | _| || |__| | |\\ | | |____| |____ \\ / | |____| |____\n// /_/ \\_\\_| \\_|_____|_| |_/_/ \\_\\_| |_____\\____/|_| \\_| |______|______| \\/ |______|______|\nexport const AnimationLevels = {\n All: \"all\",\n Some: \"some\",\n None: \"none\",\n} as const;\nexport type AnimationLevels =\n (typeof AnimationLevels)[keyof typeof AnimationLevels];\n\nconst ANIMATION_LEVELS = st.ok(\n st.e.list<AnimationLevels>({\n [AnimationLevels.All]: { name: \"All\", description: \"All animations\" },\n [AnimationLevels.Some]: {\n name: \"Functional\",\n description: \"Only functional animations that improve usability\",\n },\n [AnimationLevels.None]: { name: \"None\", description: \"No animations\" },\n }),\n);\n\nconst ANIMATION_LEVEL_ID = \"animation_level\";\nconst PRIVATE_ANIMATION_LEVEL = st.rosw(\n st.e.help(\n SETTINGS.get(\n ANIMATION_LEVEL_ID,\n AnimationLevels.None as AnimationLevels,\n one_of(AnimationLevels),\n ),\n { list: ANIMATION_LEVELS },\n ),\n true,\n);\nSETTINGS.register(\n ANIMATION_LEVEL_ID,\n \"Animation Level\",\n \"Setting for animation level, changes the amount of animations used in the UI\",\n PRIVATE_ANIMATION_LEVEL,\n);\n\nexport const ANIMATION_LEVEL = PRIVATE_ANIMATION_LEVEL.read_write;\n\n// _ _ _____ __ __ _______ _____ ____ _ _ _____ _____ ______ ______ _____\n// /\\ | \\ | |_ _| \\/ | /\\|__ __|_ _/ __ \\| \\ | | / ____| __ \\| ____| ____| __ \\\n// / \\ | \\| | | | | \\ / | / \\ | | | || | | | \\| | | (___ | |__) | |__ | |__ | | | |\n// / /\\ \\ | . ` | | | | |\\/| | / /\\ \\ | | | || | | | . ` | \\___ \\| ___/| __| | __| | | | |\n// / ____ \\| |\\ |_| |_| | | |/ ____ \\| | _| || |__| | |\\ | ____) | | | |____| |____| |__| |\n// /_/ \\_\\_| \\_|_____|_| |_/_/ \\_\\_| |_____\\____/|_| \\_| |_____/|_| |______|______|_____/\nconst ANIMATION_SPEED_ID = \"animation_speed\";\nconst PRIVATE_ANIMATION_SPEED = st.rosw(\n st.n.help(SETTINGS.get(ANIMATION_SPEED_ID, 200, in_range(50, 1000)), {\n min: st.ok(50),\n max: st.ok(1000),\n unit: st.ok(\"ms\"),\n start: st.ok(0),\n step: st.ok(50),\n }),\n true,\n);\nSETTINGS.register(\n ANIMATION_SPEED_ID,\n \"Animation Speed\",\n \"Setting for animation speed, changes the speed of animations in the UI\",\n PRIVATE_ANIMATION_SPEED,\n);\n\nexport const ANIMATION_SPEED = PRIVATE_ANIMATION_SPEED.read_write;\n","import type { ThemeVariableGroup } from \"./variables\";\n\nexport const BOTTOM_GROUPS: { [key: string]: ThemeVariableGroup } = {};\n","import { DOCUMENT_HANDLER } from \"#document\";\nimport {\n ANIMATION_LEVEL,\n ANIMATION_SPEED,\n AnimationLevels,\n INPUT_MODE,\n InputModes,\n SCALE,\n SCROLLBAR_MODE,\n ScrollbarModes,\n THEME,\n Themes,\n type AppliedThemes,\n} from \"./settings\";\nimport { BOTTOM_GROUPS } from \"./shared\";\n\nclass ThemeEngine {\n #started = false;\n /**Theme of the operating system, used for the System theme*/\n #os_theme: AppliedThemes = Themes.Light;\n\n /**Starts applying the theme to all documents, called once by theme_init*/\n start() {\n this.#started = true;\n DOCUMENT_HANDLER.events.on(\"added\", (e) => {\n this.#apply_all_to_doc(e.data);\n });\n this.#for_documents((doc) => {\n this.#apply_all_to_doc(doc);\n });\n }\n\n /**Runs for every document, nothing is applied before the engine is started*/\n #for_documents(func: (doc: Document) => void) {\n if (this.#started) DOCUMENT_HANDLER.for_documents(func);\n }\n\n /**Sets the theme of the operating system, reapplying the theme when System is used*/\n set_os_theme(theme: AppliedThemes) {\n this.#os_theme = theme;\n if (THEME.ok() === Themes.System) this.apply_theme(Themes.System);\n }\n\n /**Resolves the System theme to the theme of the operating system*/\n #applied(theme: Themes): AppliedThemes {\n return theme === Themes.System ? this.#os_theme : theme;\n }\n\n /**This applies the current theme to a document*/\n #apply_all_to_doc(doc: Document) {\n this.#apply_scrollbar_to_doc(doc, SCROLLBAR_MODE.ok());\n this.#apply_theme_to_doc(doc, THEME.ok());\n this.#apply_input_to_doc(doc, INPUT_MODE.ok());\n this.#apply_scale_to_doc(doc, SCALE.ok() / 100);\n this.#apply_animation_level_to_doc(doc, ANIMATION_LEVEL.ok());\n this.#apply_animation_speed_to_doc(doc, ANIMATION_SPEED.ok());\n }\n\n /**This applies the current theme to a document*/\n apply_scrollbar(scroll: ScrollbarModes) {\n this.#for_documents((doc) => {\n this.#apply_scrollbar_to_doc(doc, scroll);\n });\n }\n #apply_scrollbar_to_doc(doc: Document, scroll: ScrollbarModes) {\n doc.documentElement.style.setProperty(\n \"--scrollbar\",\n {\n [ScrollbarModes.Thin]: \"0.6rem\",\n [ScrollbarModes.Medium]: \"1rem\",\n [ScrollbarModes.Wide]: \"2.6rem\",\n }[scroll],\n );\n }\n\n /**This applies the current theme to a document*/\n apply_animation_level(anim: AnimationLevels) {\n this.#for_documents((doc) => {\n this.#apply_animation_level_to_doc(doc, anim);\n });\n }\n #apply_animation_level_to_doc(doc: Document, anim: AnimationLevels) {\n doc.documentElement.classList.remove(\"anim-all\", \"anim-some\");\n switch (anim) {\n case AnimationLevels.All:\n doc.documentElement.classList.add(\"anim-all\");\n doc.documentElement.classList.add(\"anim-some\");\n break;\n case AnimationLevels.Some:\n doc.documentElement.classList.add(\"anim-some\");\n break;\n }\n }\n\n /**This applies the current theme to a document*/\n apply_animation_speed(speed: number) {\n this.#for_documents((doc) => {\n this.#apply_animation_speed_to_doc(doc, speed);\n });\n }\n #apply_animation_speed_to_doc(doc: Document, speed: number) {\n const style = doc.documentElement.style;\n style.setProperty(\"--animation-speed\", speed.toString() + \"ms\");\n }\n\n /**This applies the current theme to a document*/\n apply_theme(theme: Themes) {\n this.#for_documents((doc) => {\n this.#apply_theme_to_doc(doc, theme);\n });\n }\n #apply_theme_to_doc(doc: Document, theme: Themes) {\n const applied = this.#applied(theme);\n for (const key in BOTTOM_GROUPS)\n BOTTOM_GROUPS[key].apply_themes(doc.documentElement.style, applied);\n }\n\n /**This applies the current scale to a document*/\n apply_scale(scale: number) {\n this.#for_documents((doc) => {\n this.#apply_scale_to_doc(doc, scale);\n });\n }\n #apply_scale_to_doc(doc: Document, scale: number) {\n doc.documentElement.style.fontSize = scale * 16 + \"px\";\n }\n\n /**Auto Input Mode */\n apply_input(mode: InputModes) {\n this.#for_documents((doc) => {\n this.#apply_input_to_doc(doc, mode);\n });\n }\n #apply_input_to_doc(doc: Document, mode: InputModes) {\n const style = doc.documentElement.style;\n style.setProperty(\"--mouse\", \"0\");\n style.setProperty(\"--pen\", \"0\");\n style.setProperty(\"--touch\", \"0\");\n doc.documentElement.classList.remove(\"mouse\", \"pen\", \"touch\");\n switch (mode) {\n case InputModes.Mouse:\n style.setProperty(\"--mouse\", \"1\");\n doc.documentElement.classList.add(\"mouse\");\n break;\n case InputModes.Pen:\n style.setProperty(\"--pen\", \"1\");\n doc.documentElement.classList.add(\"pen\");\n break;\n case InputModes.Touch:\n style.setProperty(\"--touch\", \"1\");\n doc.documentElement.classList.add(\"touch\");\n break;\n }\n }\n\n apply_single_property(key: string, variable: { [s: string]: string }) {\n const theme_buff = this.#applied(THEME.ok());\n this.#for_documents((doc) => {\n doc.documentElement.style.setProperty(key, variable[theme_buff]);\n });\n }\n}\n\nexport const theme_engine = new ThemeEngine();\n\nTHEME.sub((val) => {\n theme_engine.apply_theme(val.value);\n});\n/**Size of a rem in pixels at the current scale, set right away from the stored scale*/\nlet scale_rem = 16;\nSCALE.sub((val) => {\n const scale_value = val.value / 100;\n scale_rem = scale_value * 16;\n theme_engine.apply_scale(scale_value);\n}, true);\n/**Converts the given rems to pixels */\nexport function rem_to_px(rem: number) {\n return rem * scale_rem;\n}\n/**Converts the given pixels to rems */\nexport function px_to_rem(px: number) {\n return px / scale_rem;\n}\nSCROLLBAR_MODE.sub((val) => {\n theme_engine.apply_scrollbar(val.value);\n});\nINPUT_MODE.sub((val) => {\n theme_engine.apply_input(val.value);\n});\nANIMATION_LEVEL.sub((val) => {\n theme_engine.apply_animation_level(val.value);\n});\nANIMATION_SPEED.sub((val) => {\n theme_engine.apply_animation_speed(val.value);\n});\n","import { theme_engine } from \"./engine\";\nimport { Themes } from \"./settings\";\nimport { BOTTOM_GROUPS } from \"./shared\";\n\n/**Initialises the settings for the package\n * @param package_name use import {name} from \"../package.json\"\n * @param name name of group formatted for user reading\n * @param description a description of what the setting group is about*/\nexport const theme_init_variable_root = (\n package_name: string,\n name: string,\n description: string\n) => {\n if (package_name.includes(\"-\"))\n throw new Error(\"Dash not permitted in package name \" + package_name);\n if (package_name in BOTTOM_GROUPS)\n throw new Error(\n \"Theme variable group already registered \" +\n package_name +\n \", by another package or by this library being loaded twice\",\n );\n BOTTOM_GROUPS[package_name] = new ThemeVariableGroup(\n package_name,\n name,\n description\n );\n return BOTTOM_GROUPS[package_name];\n};\n\n/**Group of settings should never be instantiated manually use initSettings*/\nexport class ThemeVariableGroup {\n private path_id: string;\n private variables: {\n [key: string]: {\n name: string;\n desc: string;\n vars: { [key: string]: string };\n type: keyof VariableType;\n typeParams: VariableType[keyof VariableType];\n example?: () => Element;\n };\n } = {};\n private sub_groups: { [key: string]: ThemeVariableGroup } = {};\n readonly name: string;\n readonly description: string;\n\n constructor(path: string, name: string, description: string) {\n this.path_id = path;\n this.name = name;\n this.description = description;\n }\n\n /**Makes a variable subgroup for this group\n * @param id unique identifier for this subgroup in the parent group\n * @param name name of group formatted for user reading\n * @param description a description of what the setting group is about formatted for user reading*/\n make_sub_group(id: string, name: string, description: string) {\n if (id.includes(\"-\"))\n throw new Error(\"Dash not permitted in variable id \" + id);\n if (id in this.sub_groups)\n throw new Error(\"Sub group already registered \" + id);\n return (this.sub_groups[id] = new ThemeVariableGroup(\n this.path_id + \"-\" + id,\n name,\n description\n ));\n }\n\n /**Makes a variable\n * @param id unique identifier for this variable in the group\n * @param name name of variable formatted for user reading\n * @param description a description of what the variable is about formatted for user reading\n * @param light value for light mode\n * @param dark value for dark mode\n * @param type type of variable for editing\n * @param type_params */\n make_variable<K extends keyof VariableType>(\n id: string,\n name: string,\n description: string,\n light: string,\n dark: string,\n type: K,\n type_params: VariableType[K],\n example?: () => Element\n ): string {\n if (id.includes(\"-\"))\n throw new Error(\"Dash not permitted in variable id \" + id);\n const key = \"--\" + this.path_id + \"-\" + id;\n if (key in this.variables)\n throw new Error(\"Settings already registered \" + id);\n const variable = (this.variables[key] = {\n name,\n desc: description,\n vars: { [Themes.Light]: light, [Themes.Dark]: dark },\n type,\n typeParams: type_params,\n example,\n });\n theme_engine.apply_single_property(key, variable.vars);\n return key;\n }\n\n /**Applies the groups\n * @param style unique identifier for this variable in the group\n * @param theme name of variable formatted for user reading*/\n apply_themes(style: CSSStyleDeclaration, theme: string) {\n for (const key in this.variables)\n style.setProperty(key, this.variables[key].vars[theme]);\n for (const key in this.sub_groups)\n this.sub_groups[key].apply_themes(style, theme);\n }\n}\n\n/**Defines the parameters for a variable type */\ninterface VariableType {\n /**Font variable, */\n Font: undefined;\n /**Text variable, */\n String: undefined;\n /**Color variable */\n Color: undefined;\n /**Transition type */\n TransitionType: undefined;\n /**Percent type */\n Percent: undefined;\n /**Filter type */\n Filter: undefined;\n /**Radius type */\n Radius: undefined;\n /**Time variable */\n Time: {\n /**Minimum time in milliseconds */\n min: number;\n /**Maximum time in milliseconds */\n max: number;\n };\n /**Angle variable */\n Angle: { min: number; max: number };\n /**Length variable*/\n Length: { min: number; max: number };\n /**Number variable*/\n Number: { min: number; max: number };\n /**Ratio*/\n Ratio:\n | {\n width: { min: number; max: number };\n height: { min: number; max: number };\n }\n | number;\n}\n","import { GREY } from \"@chocbite/ts-lib/colors\";\nimport { theme_init_variable_root } from \"./variables\";\n\nexport const BUILT_IN = 0;\n\nconst root = theme_init_variable_root(\n \"common\",\n \"Shared Variables\",\n \"Shared variables across features\",\n);\n\nconst scroll_bar = root.make_sub_group(\n \"scrollbar\",\n \"Scrollbar\",\n \"Scrollbar variables\",\n);\nconst scroll_bar_thumb = scroll_bar.make_sub_group(\n \"thumb\",\n \"Thumb\",\n \"Scrollbar Thumb variables\",\n);\nscroll_bar_thumb.make_variable(\n \"color\",\n \"Thumb Color\",\n \"Color of the scrollbar thumb in normal state\",\n GREY[\"400\"],\n GREY[\"800\"],\n \"Color\",\n undefined,\n);\nscroll_bar_thumb.make_variable(\n \"hoverColor\",\n \"Thumb Hover Color\",\n \"Color of the scrollbar thumb when hovered\",\n GREY[\"600\"],\n GREY[\"600\"],\n \"Color\",\n undefined,\n);\nscroll_bar_thumb.make_variable(\n \"activeColor\",\n \"Thumb Active Color\",\n \"Color of the scrollbar thumb when pressed\",\n GREY[\"500\"],\n GREY[\"700\"],\n \"Color\",\n undefined,\n);\n\nconst fonts = root.make_sub_group(\"fonts\", \"Fonts\", \"Font variables\");\nfonts.make_variable(\n \"base\",\n \"UI Base Font\",\n \"The base font for the UI\",\n '\"Roboto\", Arial, Helvetica, sans-serif',\n '\"Roboto\", Arial, Helvetica, sans-serif',\n \"Font\",\n undefined,\n);\n\n// _____ ____ _ ____ _____ _____\n// / ____/ __ \\| | / __ \\| __ \\ / ____|\n// | | | | | | | | | | | |__) | (___\n// | | | | | | | | | | | _ / \\___ \\\n// | |___| |__| | |___| |__| | | \\ \\ ____) |\n// \\_____\\____/|______\\____/|_| \\_\\_____/\n\nconst colors = root.make_sub_group(\"colors\", \"Colors\", \"Color variables\");\ncolors.make_variable(\n \"layer1\",\n \"UI Layer 1\",\n \"Color of the first layer of the UI\",\n GREY[50],\n \"#111111\",\n \"Color\",\n undefined,\n);\n","import { theme_engine } from \"./engine\";\nimport {\n theme_setting_init,\n theme_setting_system,\n Themes,\n type AppliedThemes,\n} from \"./settings\";\n\nexport interface ThemeInitOptions {\n /**Offers a System theme that follows the light or dark mode of the operating system,\n * leave it off on devices without that feature*/\n system?: boolean;\n /**Theme used until the user chooses one, defaults to System when system is on, otherwise Light*/\n default?: Themes;\n}\n\nlet initialized = false;\n\n/**Starts the theme, the app must call it once, nothing of the theme is applied to the page before.\n * This is the only place the operating system dark mode is read, and only when system is on*/\nexport function theme_init(options: ThemeInitOptions = {}) {\n const default_theme =\n options.default ?? (options.system ? Themes.System : Themes.Light);\n if (default_theme === Themes.System && !options.system)\n throw new Error(\"The System theme can only be the default with system on\");\n if (initialized) throw new Error(\"theme_init has already been called\");\n initialized = true;\n let os_theme: AppliedThemes | undefined;\n if (options.system) {\n const query = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const theme_of = (dark: boolean) => (dark ? Themes.Dark : Themes.Light);\n os_theme = theme_of(query.matches);\n theme_engine.set_os_theme(os_theme);\n query.addEventListener(\"change\", (e) => {\n const changed = theme_of(e.matches);\n theme_setting_system(changed);\n theme_engine.set_os_theme(changed);\n });\n }\n theme_setting_init(os_theme, default_theme);\n theme_engine.start();\n}\n"],"mappings":";;;;;;;;;;ACYA,MAAM,WAAW,cACf,0BACA,SACA,YACA,2CACF;;AAGA,MAAM,UACA,YACH,WACC,OAAO,OAAO,MAAM,CAA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