@chocbite/ts-lib-ui 1.1.5 → 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 +547 -9
- package/README.md +3 -0
- package/SOURCE.md +10313 -7355
- package/base/index.d.mts +2 -2
- package/base/index.mjs +68 -5
- package/base/index.mjs.map +1 -1
- package/canvas/index.d.mts +1 -1
- package/canvas/index.mjs +1 -1
- package/composition/index.d.mts +283 -0
- package/composition/index.mjs +2 -0
- package/composition-7xlf0UjB.mjs +869 -0
- package/composition-7xlf0UjB.mjs.map +1 -0
- package/context-menu/index.d.mts +1 -1
- package/context-menu/index.mjs +1 -1
- package/{context-menu-CZxEGjBi.mjs → context-menu-DSVerkvr.mjs} +2 -2
- package/{context-menu-CZxEGjBi.mjs.map → context-menu-DSVerkvr.mjs.map} +1 -1
- package/depot_ui/index.d.mts +60 -0
- package/depot_ui/index.mjs +280 -0
- package/depot_ui/index.mjs.map +1 -0
- package/form/index.d.mts +2 -758
- package/form/index.mjs +1 -2953
- package/form-CnIHz2Bp.mjs +2961 -0
- package/form-CnIHz2Bp.mjs.map +1 -0
- package/icons/index.d.mts +1 -1
- package/{index-YNZjMIO7.d.mts → index-CApVOEcI.d.mts} +2 -2
- package/{index-BDWg5GX2.d.mts → index-Czy8O3me.d.mts} +6 -2
- package/index-DD09-bGe.d.mts +761 -0
- package/{index-DlBJdGaQ.d.mts → index-U3pqQjLg.d.mts} +4 -4
- package/{index-CvzH3M_5.d.mts → index-_y7vmunA.d.mts} +72 -8
- package/keyboard/index.d.mts +1 -1
- package/keyboard/index.mjs +1 -1
- package/list/index.d.mts +1 -1
- package/list/index.mjs +1 -1
- package/{list-C52-ExFw.mjs → list-ByNP3ZG2.mjs} +3 -3
- package/{list-C52-ExFw.mjs.map → list-ByNP3ZG2.mjs.map} +1 -1
- package/package.json +2 -2
- package/prompts/index.d.mts +48 -0
- package/prompts/index.mjs +107 -0
- package/prompts/index.mjs.map +1 -0
- package/spinner/index.d.mts +1 -1
- package/spinner/index.mjs +1 -1
- package/style.css +2049 -1640
- package/svg/index.d.mts +1 -1
- package/svg-Yz7elqnU.mjs.map +1 -1
- package/theme/index.d.mts +1 -1
- package/theme/index.mjs +1 -1
- package/{theme-D3YluyYr.mjs → theme-ycsugrdT.mjs} +2 -2
- package/{theme-D3YluyYr.mjs.map → theme-ycsugrdT.mjs.map} +1 -1
- package/form/index.mjs.map +0 -1
- package/test/index.d.mts +0 -98
- package/test/index.mjs +0 -193
- package/test/index.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './style.css';
|
|
2
|
-
import { l as Base, u as BaseIntersectObserver } from "./index-
|
|
3
|
-
import { t as SVGFunc } from "./index-
|
|
4
|
-
import { r as ContextMenu } from "./index-
|
|
2
|
+
import { l as Base, u as BaseIntersectObserver } from "./index-_y7vmunA.mjs";
|
|
3
|
+
import { t as SVGFunc } from "./index-Czy8O3me.mjs";
|
|
4
|
+
import { r as ContextMenu } from "./index-CApVOEcI.mjs";
|
|
5
5
|
import { State, StateREAW } from "@chocbite/ts-lib/state";
|
|
6
6
|
import { Option, Result } from "@chocbite/ts-lib/result";
|
|
7
7
|
declare abstract class ListField extends Base {
|
|
@@ -382,4 +382,4 @@ declare const list: {
|
|
|
382
382
|
drag_group<R>(): ListDragGroup<R>;
|
|
383
383
|
};
|
|
384
384
|
export { ListField as a, ListReorderOptions as i, ListDragGroup as n, ListDropTarget as r, list as t };
|
|
385
|
-
//# sourceMappingURL=index-
|
|
385
|
+
//# sourceMappingURL=index-U3pqQjLg.d.mts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './style.css';
|
|
2
|
-
import { t as SVGFunc } from "./index-
|
|
3
|
-
import { State, StateInferSub, StateREA, StateROA, StateSub } from "@chocbite/ts-lib/state";
|
|
4
|
-
import { Option } from "@chocbite/ts-lib/result";
|
|
2
|
+
import { t as SVGFunc } from "./index-Czy8O3me.mjs";
|
|
3
|
+
import { State, StateInferSub, StateREA, StateROA, StateResult, StateSub } from "@chocbite/ts-lib/state";
|
|
4
|
+
import { Option, ResultOk } from "@chocbite/ts-lib/result";
|
|
5
5
|
/**Enum of possible access types for base element*/
|
|
6
6
|
declare const AccessTypes: {
|
|
7
7
|
readonly Write: "w";
|
|
@@ -27,6 +27,35 @@ declare const ACCESSTYPESINFO: {
|
|
|
27
27
|
icon?: SVGFunc;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
+
declare const INPUT_TYPE: unique symbol;
|
|
31
|
+
/**Key of the method applying the creation inputs of an element, see Base.create
|
|
32
|
+
* Elements with inputs given at creation override [CREATE] like set, and call super[CREATE] with the options*/
|
|
33
|
+
declare const CREATE: unique symbol;
|
|
34
|
+
/**Key identifying an input of an element, carrying the type of the input, a StateOrVal variant or a plain value type
|
|
35
|
+
* Made with input_key, the type property only exists for the types, so a plain symbol is not a key*/
|
|
36
|
+
type InputKey<S> = symbol & {
|
|
37
|
+
readonly [INPUT_TYPE]: S;
|
|
38
|
+
};
|
|
39
|
+
/**Makes a key for an input, one per input, as a property of a module constant object of the keys of an element
|
|
40
|
+
* @example
|
|
41
|
+
* const SLIDER = {
|
|
42
|
+
* value: input_key<StateOrValROSW<number>>(),
|
|
43
|
+
* step: input_key<number>(),
|
|
44
|
+
* };
|
|
45
|
+
* export type SliderOptions = InputOptions<typeof SLIDER>;*/
|
|
46
|
+
declare function input_key<S>(): InputKey<S>;
|
|
47
|
+
/**Input type of a key, the StateOrVal variant or plain value type it was made with
|
|
48
|
+
* For building an options interface by hand, like options passed on to a child: scale?: InputOf<typeof VIEW.scale>*/
|
|
49
|
+
type InputOf<K> = K extends InputKey<infer S> ? S : never;
|
|
50
|
+
/**Options of an element from an object of its keys, every option is optional, see Base.set
|
|
51
|
+
* The doc comments of the keys show on the options*/
|
|
52
|
+
type InputOptions<K extends Record<string, InputKey<any>>> = { [P in keyof K]?: InputOf<K[P]>; };
|
|
53
|
+
/**State part of an input type, never for plain values*/
|
|
54
|
+
type InputState<S> = Extract<S, State<any, any, any>>;
|
|
55
|
+
/**Value part of an input type*/
|
|
56
|
+
type InputValue<S> = Exclude<S, State<any, any, any>>;
|
|
57
|
+
/**Result an input gives, ok results when the input can not be an error*/
|
|
58
|
+
type InputResult<S> = [InputState<S>] extends [never] ? ResultOk<InputValue<S>> : [InputState<S>] extends [StateROA<any, any, any>] ? ResultOk<InputValue<S>> : StateResult<InputValue<S>>;
|
|
30
59
|
type BaseIntersectObserverOptions = {
|
|
31
60
|
/**Deffers updating visible state for so many milliseconds, defaults to 250
|
|
32
61
|
* this will also batch updates if they are constantly coming*/
|
|
@@ -49,6 +78,15 @@ type WithStateROA<T> = { [K in keyof T]?: T[K] | StateROA<T[K]>; };
|
|
|
49
78
|
* Elements are only created in code, with new or a factory function, HTML is not supported,
|
|
50
79
|
* constructors add children and attributes, which document.createElement and the HTML parser do not allow
|
|
51
80
|
*
|
|
81
|
+
* New elements, and elements being reworked, follow the element pattern in package-ui/PATTERN.md:
|
|
82
|
+
* The class is only exported as a type, a factory function taking optional options creates it with create
|
|
83
|
+
* The constructor takes no arguments, it builds the children and sets the defaults
|
|
84
|
+
* The inputs are an object of keys made with input_key, the options type is InputOptions of it
|
|
85
|
+
* set takes the options, each a fixed value or a state (StateOrVal), and applies them with set_input
|
|
86
|
+
* Inputs handed out to other elements are given once, at creation, and applied by overriding [CREATE]
|
|
87
|
+
* so element_factory({ width: 100, label: label_state }).set({ width: 120 })
|
|
88
|
+
* A fixed value never changes, anything that changes must be a state
|
|
89
|
+
*
|
|
52
90
|
* All none abstracts classes must override the static method element_name to return the name of the element
|
|
53
91
|
* Abstract classes should return @abstract@
|
|
54
92
|
*
|
|
@@ -75,10 +113,36 @@ declare abstract class Base extends HTMLElement {
|
|
|
75
113
|
protected connectedCallback(): void;
|
|
76
114
|
/**Runs when element is dettached from document*/
|
|
77
115
|
protected disconnectedCallback(): void;
|
|
78
|
-
/**Sets any attribute on the base element, to either a fixed value or a state value
|
|
116
|
+
/**Sets any attribute on the base element, to either a fixed value or a state value
|
|
117
|
+
* Older style, new elements take their inputs with set and set_input, see package-ui/PATTERN.md*/
|
|
79
118
|
opts(opts: WithStateROA<DataProps<this>>): this;
|
|
80
|
-
/**
|
|
81
|
-
|
|
119
|
+
/**Applies the given options, options that are not given are left unchanged
|
|
120
|
+
* Can be called any number of times, like when a list reuses an element for other data
|
|
121
|
+
* Elements override it with their own options type and call super.set with the options,
|
|
122
|
+
* each option is applied with set_input, so setting an option again replaces the state set before
|
|
123
|
+
* It runs after every constructor has finished, so overrides called from it can use all fields of the subclass*/
|
|
124
|
+
set(_options: object): this;
|
|
125
|
+
/**Creates the element, applies the creation inputs with [CREATE] and then the rest with set
|
|
126
|
+
* Factories call it, and called on a subclass it creates the subclass, so a user subclass is made with MyElement.create(options)
|
|
127
|
+
* The options are those of [CREATE] and set together, both run after every constructor has finished
|
|
128
|
+
* The constructor must take no arguments, abstract classes can not be created*/
|
|
129
|
+
static create<T extends Base>(this: new () => T, options?: Parameters<T[typeof CREATE]>[0] & Parameters<T["set"]>[0]): T;
|
|
130
|
+
/**Applies the inputs given at creation, called once by create before set
|
|
131
|
+
* Inputs other elements follow are given here, and left out of the options of set, so they can never be replaced
|
|
132
|
+
* Elements override it with their own options type and call super[CREATE] with the options, like set*/
|
|
133
|
+
[CREATE](_options: object): void;
|
|
134
|
+
/**Sets an input that is either a fixed value or a state, see set
|
|
135
|
+
* undefined leaves the input unchanged
|
|
136
|
+
* A fixed value is applied right away as an ok result, and detaches any state the key had
|
|
137
|
+
* A state replaces any state the key had, and is applied while the element is connected
|
|
138
|
+
* The key decides the type of the input, and the result apply gets:
|
|
139
|
+
* inputs that can not be errors give ok results, others results the element must handle
|
|
140
|
+
* @param key the key of the input, made with input_key*/
|
|
141
|
+
protected set_input<S>(key: InputKey<S>, input: NoInfer<S> | undefined, apply: (value: InputResult<S>) => void): void;
|
|
142
|
+
/**The state an input has now, undefined when it has a fixed value or was never set
|
|
143
|
+
* Typed by the key, so a writable input gives a writable state to write to,
|
|
144
|
+
* the element keeps no reference of its own to the state*/
|
|
145
|
+
protected input_state<S>(key: InputKey<S>): InputState<S> | undefined;
|
|
82
146
|
/**Executes a function with the element as an argument and returns the element
|
|
83
147
|
* Useful when declaring multiple elements in a single statement, without easy access to a scope to execute code in*/
|
|
84
148
|
scope(fn: (elem: this) => void): this;
|
|
@@ -215,5 +279,5 @@ declare const base_element_name: (element: ElementConstructor) => string;
|
|
|
215
279
|
declare const ELEMENT_LIST: Set<string>;
|
|
216
280
|
/**Defines elements inheriting from the base*/
|
|
217
281
|
declare const define_element: (element: ElementConstructor) => void;
|
|
218
|
-
export { validate_element_name as a, base_loop as c, BaseIntersectObserverOptions as d,
|
|
219
|
-
//# sourceMappingURL=index-
|
|
282
|
+
export { InputState as _, validate_element_name as a, ACCESSTYPESINFO as b, base_loop as c, BaseIntersectObserverOptions as d, CREATE as f, InputResult as g, InputOptions as h, set_base_element_global_namespace as i, Base as l, InputOf as m, base_element_name as n, BaseSVG as o, InputKey as p, define_element as r, Loop as s, ELEMENT_LIST as t, BaseIntersectObserver as u, InputValue as v, AccessTypes as x, input_key as y };
|
|
283
|
+
//# sourceMappingURL=index-_y7vmunA.d.mts.map
|
package/keyboard/index.d.mts
CHANGED
package/keyboard/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import "../style.css";
|
|
|
2
2
|
import { DOCUMENT_HANDLER } from "../document/index.mjs";
|
|
3
3
|
import { Base, define_element } from "../base/index.mjs";
|
|
4
4
|
import { get_cursor_position, set_cursor_position } from "../selection/index.mjs";
|
|
5
|
-
import { _ as version, i as theme_init_variable_root } from "../theme-
|
|
5
|
+
import { _ as version, i as theme_init_variable_root } from "../theme-ycsugrdT.mjs";
|
|
6
6
|
import { settings_init } from "../settings/index.mjs";
|
|
7
7
|
import state, { state as state$1 } from "@chocbite/ts-lib/state";
|
|
8
8
|
import { some } from "@chocbite/ts-lib/result";
|
package/list/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import '../style.css';
|
|
2
|
-
import { a as ListField, i as ListReorderOptions, n as ListDragGroup, r as ListDropTarget, t as list } from "../index-
|
|
2
|
+
import { a as ListField, i as ListReorderOptions, n as ListDragGroup, r as ListDropTarget, t as list } from "../index-U3pqQjLg.mjs";
|
|
3
3
|
export { type ListDragGroup, type ListDropTarget, ListField, type ListReorderOptions, list as default, list };
|
package/list/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "../style.css";
|
|
2
|
-
export { n as ListField, t as default, t as list } from "../list-
|
|
2
|
+
export { n as ListField, t as default, t as list } from "../list-ByNP3ZG2.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
2
|
import { Base, define_element } from "./base/index.mjs";
|
|
3
|
-
import { t as ctm } from "./context-menu-
|
|
4
|
-
import { a as px_to_rem, i as theme_init_variable_root } from "./theme-
|
|
3
|
+
import { t as ctm } from "./context-menu-DSVerkvr.mjs";
|
|
4
|
+
import { a as px_to_rem, i as theme_init_variable_root } from "./theme-ycsugrdT.mjs";
|
|
5
5
|
import { t as state_ui } from "./state_ui-Dtm2y5RU.mjs";
|
|
6
6
|
import { state as state$1 } from "@chocbite/ts-lib/state";
|
|
7
7
|
import { none, some } from "@chocbite/ts-lib/result";
|
|
@@ -1637,4 +1637,4 @@ const list = {
|
|
|
1637
1637
|
};
|
|
1638
1638
|
export { ListField as n, list as t };
|
|
1639
1639
|
|
|
1640
|
-
//# sourceMappingURL=list-
|
|
1640
|
+
//# sourceMappingURL=list-ByNP3ZG2.mjs.map
|