@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
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import '../style.css';
|
|
2
|
+
import { f as CREATE, h as InputOptions, l as Base, m as InputOf, p as InputKey } from "../index-_y7vmunA.mjs";
|
|
3
|
+
import { n as ContextMenuGroup } from "../index-CApVOEcI.mjs";
|
|
4
|
+
import { t as SVGFunc } from "../index-Czy8O3me.mjs";
|
|
5
|
+
import { W as FormElement } from "../index-DD09-bGe.mjs";
|
|
6
|
+
import { StateOrVal, StateOrValROSW, StateROSW } from "@chocbite/ts-lib/state";
|
|
7
|
+
/** Type to store a position related to composition
|
|
8
|
+
* position is always in rem*/
|
|
9
|
+
interface CompPosition {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}
|
|
13
|
+
/**A point of a box, like the corner of a panel that its position places*/
|
|
14
|
+
export declare const CompAnchor: {
|
|
15
|
+
readonly TOP_RIGHT: "top_right";
|
|
16
|
+
readonly TOP_LEFT: "top_left";
|
|
17
|
+
readonly BOT_RIGHT: "bot_right";
|
|
18
|
+
readonly BOT_LEFT: "bot_left";
|
|
19
|
+
readonly CENTER: "center";
|
|
20
|
+
};
|
|
21
|
+
export type CompAnchor = (typeof CompAnchor)[keyof typeof CompAnchor];
|
|
22
|
+
/**Position in rem of the anchor point of the element, from the top left of the page*/
|
|
23
|
+
declare function get_element_anchor_position(element: Element, anchor: CompAnchor): CompPosition;
|
|
24
|
+
/**Inputs of content that can be set again*/
|
|
25
|
+
declare const CONTENT: {
|
|
26
|
+
/**Context menu of the content, also shown by its container, like on the title bar of a panel
|
|
27
|
+
* Lines, a menu, or a function giving them, which is called every time the menu opens*/
|
|
28
|
+
context_menu: InputKey<ContextMenuGroup>;
|
|
29
|
+
};
|
|
30
|
+
type ContentOptions = InputOptions<typeof CONTENT>;
|
|
31
|
+
/**Inputs of content given at creation, the container showing the content follows them
|
|
32
|
+
* Exported for the containers of this module, not from the module*/
|
|
33
|
+
declare const CONTENT_CREATE: {
|
|
34
|
+
/**Title the container shows, like on the title bar of a panel*/
|
|
35
|
+
title: InputKey<StateOrVal<string>>;
|
|
36
|
+
/**Icon the container shows in front of the title*/
|
|
37
|
+
icon: InputKey<StateOrVal<SVGFunc | undefined>>;
|
|
38
|
+
/**Whether the container lets the user close the content*/
|
|
39
|
+
closable: InputKey<StateOrVal<boolean>>;
|
|
40
|
+
/**Smallest width in rem the container gives the content*/
|
|
41
|
+
min_width: InputKey<StateOrVal<number>>;
|
|
42
|
+
/**Smallest height in rem the container gives the content*/
|
|
43
|
+
min_height: InputKey<StateOrVal<number>>;
|
|
44
|
+
};
|
|
45
|
+
type ContentCreateOptions = ContentOptions & InputOptions<typeof CONTENT_CREATE>;
|
|
46
|
+
/**Called by the container when it closes the content, internal to this module*/
|
|
47
|
+
declare const CONTENT_CLOSED: unique symbol;
|
|
48
|
+
/**Base for anything shown in a container of this module, like a panel
|
|
49
|
+
*
|
|
50
|
+
* Library users extend it for their own content, and create it with MyContent.create(options),
|
|
51
|
+
* the title, icon, closable and minimum size are given at creation, as the container follows them
|
|
52
|
+
* To follow its own size, content attaches to the resize observer of Base and overrides on_resize*/
|
|
53
|
+
export declare abstract class ContentBase extends Base {
|
|
54
|
+
#private;
|
|
55
|
+
static element_name(): string;
|
|
56
|
+
static element_name_space(): string;
|
|
57
|
+
constructor();
|
|
58
|
+
/**Title the container shows, given at creation and never replaced*/
|
|
59
|
+
get content_title(): InputOf<typeof CONTENT_CREATE.title>;
|
|
60
|
+
/**Icon the container shows, given at creation and never replaced*/
|
|
61
|
+
get content_icon(): InputOf<typeof CONTENT_CREATE.icon>;
|
|
62
|
+
/**Whether the container lets the user close the content, given at creation and never replaced*/
|
|
63
|
+
get content_closable(): InputOf<typeof CONTENT_CREATE.closable>;
|
|
64
|
+
/**Smallest width in rem, given at creation and never replaced*/
|
|
65
|
+
get content_min_width(): InputOf<typeof CONTENT_CREATE.min_width>;
|
|
66
|
+
/**Smallest height in rem, given at creation and never replaced*/
|
|
67
|
+
get content_min_height(): InputOf<typeof CONTENT_CREATE.min_height>;
|
|
68
|
+
/**Context menu of the content, read by the container every time its menu opens*/
|
|
69
|
+
get content_context_menu(): ContextMenuGroup;
|
|
70
|
+
[CREATE](options: ContentCreateOptions): void;
|
|
71
|
+
set(options: ContentOptions): this;
|
|
72
|
+
/**Resolves when the content is closed, by itself or by its container*/
|
|
73
|
+
content_on_close(): Promise<void>;
|
|
74
|
+
/**Closes the content, its container closes with it*/
|
|
75
|
+
content_close(): void;
|
|
76
|
+
/**Resolves the waiting content_on_close promises, called by the container that closes the content*/
|
|
77
|
+
[CONTENT_CLOSED](): void;
|
|
78
|
+
}
|
|
79
|
+
/**Content without behavior of its own, filled with children by the user*/
|
|
80
|
+
declare class Content extends ContentBase {
|
|
81
|
+
static element_name(): string;
|
|
82
|
+
static element_name_space(): string;
|
|
83
|
+
}
|
|
84
|
+
/**Content to fill with children, the title, icon, closable and minimum size are given here, the container follows them*/
|
|
85
|
+
declare function content(options?: ContentCreateOptions): Content;
|
|
86
|
+
/**Inputs of the panel*/
|
|
87
|
+
declare const PANEL: {
|
|
88
|
+
/**Layer of the panel, panels in a higher layer are always above panels in a lower one*/
|
|
89
|
+
layer: InputKey<StateOrVal<number>>;
|
|
90
|
+
/**Horizontal position in rem from the left of the page, of the anchor point of the panel
|
|
91
|
+
* 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*/
|
|
92
|
+
x: InputKey<StateOrValROSW<number>>;
|
|
93
|
+
/**Vertical position in rem from the top of the page, of the anchor point of the panel, works like x*/
|
|
94
|
+
y: InputKey<StateOrValROSW<number>>;
|
|
95
|
+
/**Point of the panel that x and y place, top_left by default*/
|
|
96
|
+
anchor: InputKey<StateOrVal<CompAnchor>>;
|
|
97
|
+
/**Width in rem, not given the panel fits its content
|
|
98
|
+
* A fixed value can not be sized by the user, a writable state is written when the user sizes the panel*/
|
|
99
|
+
width: InputKey<StateOrValROSW<number>>;
|
|
100
|
+
/**Height in rem, works like width*/
|
|
101
|
+
height: InputKey<StateOrValROSW<number>>;
|
|
102
|
+
/**Whether the user can size the panel, at the sides where width and height can be written, true by default*/
|
|
103
|
+
sizeable: InputKey<StateOrVal<boolean>>;
|
|
104
|
+
/**Whether the panel is hidden, auto_hide writes it, so give a writable state to show the panel again*/
|
|
105
|
+
hidden: InputKey<StateOrValROSW<boolean>>;
|
|
106
|
+
/**Hides the panel when the user presses outside it*/
|
|
107
|
+
auto_hide: InputKey<StateOrVal<boolean>>;
|
|
108
|
+
/**Closes the panel when the user presses outside it*/
|
|
109
|
+
auto_close: InputKey<StateOrVal<boolean>>;
|
|
110
|
+
/**Darkens the page behind the panel and keeps the focus in it*/
|
|
111
|
+
modal: InputKey<StateOrVal<boolean>>;
|
|
112
|
+
/**Whether the title bar is shown, true by default*/
|
|
113
|
+
titlebar: InputKey<StateOrVal<boolean>>;
|
|
114
|
+
};
|
|
115
|
+
type PanelOptions = InputOptions<typeof PANEL>;
|
|
116
|
+
declare const PANEL_ADDED: unique symbol;
|
|
117
|
+
declare const PANEL_LAYOUT: unique symbol;
|
|
118
|
+
declare const HOST_LAYER: unique symbol;
|
|
119
|
+
declare const HOST_RAISE: unique symbol;
|
|
120
|
+
declare const HOST_REMOVE: unique symbol;
|
|
121
|
+
/**The container of a panel, as the panel sees it*/
|
|
122
|
+
interface PanelHost {
|
|
123
|
+
/**Width in rem*/
|
|
124
|
+
readonly width: number;
|
|
125
|
+
/**Height in rem*/
|
|
126
|
+
readonly height: number;
|
|
127
|
+
/**Moves the panel into the given layer*/
|
|
128
|
+
[HOST_LAYER](panel: Panel, layer: number): void;
|
|
129
|
+
/**Puts the panel above the others in its layer*/
|
|
130
|
+
[HOST_RAISE](panel: Panel): void;
|
|
131
|
+
/**Forgets the panel, it is closed*/
|
|
132
|
+
[HOST_REMOVE](panel: Panel): void;
|
|
133
|
+
}
|
|
134
|
+
declare class Panel extends Base {
|
|
135
|
+
#private;
|
|
136
|
+
static element_name(): string;
|
|
137
|
+
static element_name_space(): string;
|
|
138
|
+
constructor();
|
|
139
|
+
[CREATE](options: {
|
|
140
|
+
content: ContentBase;
|
|
141
|
+
}): void;
|
|
142
|
+
set(options: PanelOptions): this;
|
|
143
|
+
/**Content the panel shows, given when the panel is created*/
|
|
144
|
+
get content(): ContentBase;
|
|
145
|
+
/**Resolves when the panel is closed*/
|
|
146
|
+
on_close(): Promise<void>;
|
|
147
|
+
/**Closes the panel and its content*/
|
|
148
|
+
close(): void;
|
|
149
|
+
/**Called by the container that shows the panel, once, after creating it*/
|
|
150
|
+
[PANEL_ADDED](host: PanelHost): void;
|
|
151
|
+
/**Called by the container when its size changes*/
|
|
152
|
+
[PANEL_LAYOUT](): void;
|
|
153
|
+
protected on_resize(): void;
|
|
154
|
+
}
|
|
155
|
+
/**Layer over the whole page that panels float in, one per document*/
|
|
156
|
+
declare class PanelContainer extends Base implements PanelHost {
|
|
157
|
+
#private;
|
|
158
|
+
static element_name(): string;
|
|
159
|
+
static element_name_space(): string;
|
|
160
|
+
constructor();
|
|
161
|
+
/**Width in rem*/
|
|
162
|
+
get width(): number;
|
|
163
|
+
/**Height in rem*/
|
|
164
|
+
get height(): number;
|
|
165
|
+
/**Panel the user worked in last*/
|
|
166
|
+
get active_panel(): Panel | undefined;
|
|
167
|
+
/**Creates a panel showing the content in this container
|
|
168
|
+
* The title, icon, close button and minimum size come from the content, see content*/
|
|
169
|
+
panel(content: ContentBase, options?: PanelOptions): Panel;
|
|
170
|
+
protected on_resize(): void;
|
|
171
|
+
[HOST_LAYER](panel: Panel, layer: number): void;
|
|
172
|
+
[HOST_RAISE](panel: Panel): void;
|
|
173
|
+
[HOST_REMOVE](panel: Panel): void;
|
|
174
|
+
}
|
|
175
|
+
/**The panel container of the document the given node is in, the main document by default
|
|
176
|
+
* The container is made the first time it is asked for*/
|
|
177
|
+
declare function panel_container(owner?: Node): PanelContainer;
|
|
178
|
+
/**Creates a panel showing the content, in the main document
|
|
179
|
+
* Use panel_container(element).panel for another document*/
|
|
180
|
+
declare function panel(content: ContentBase, options?: PanelOptions): Panel;
|
|
181
|
+
/**Inputs of the customization*/
|
|
182
|
+
declare const CUSTOMIZATION: {
|
|
183
|
+
/**Settings of the app, shown under the theme*/
|
|
184
|
+
main: InputKey<StateOrVal<readonly FormElement[]>>;
|
|
185
|
+
/**Advanced settings of the app, shown last in the advanced section*/
|
|
186
|
+
advanced: InputKey<StateOrVal<readonly FormElement[]>>;
|
|
187
|
+
};
|
|
188
|
+
type CustomizationOptions = ContentOptions & InputOptions<typeof CUSTOMIZATION>;
|
|
189
|
+
type CustomizationCreateOptions = ContentCreateOptions & CustomizationOptions;
|
|
190
|
+
/**Content with the settings of the library, theme, scale, input mode and animations, and settings of the app*/
|
|
191
|
+
declare class Customization extends ContentBase {
|
|
192
|
+
#private;
|
|
193
|
+
static element_name(): string;
|
|
194
|
+
static element_name_space(): string;
|
|
195
|
+
constructor();
|
|
196
|
+
set(options: CustomizationOptions): this;
|
|
197
|
+
}
|
|
198
|
+
/**Content with the settings of the library, and of the app given as main and advanced
|
|
199
|
+
* The title, icon and minimum size have defaults, give them to change them*/
|
|
200
|
+
declare function customization(options?: CustomizationCreateOptions): Customization;
|
|
201
|
+
/**The customization in a hidden modal panel*/
|
|
202
|
+
interface CustomizationPanel {
|
|
203
|
+
readonly panel: Panel;
|
|
204
|
+
readonly content: Customization;
|
|
205
|
+
/**Whether the panel is hidden, write false to show it, the panel writes true when the user presses outside it*/
|
|
206
|
+
readonly hidden: StateROSW<boolean>;
|
|
207
|
+
}
|
|
208
|
+
/**Creates the customization in a modal panel, hidden, it hides again when the user presses outside it
|
|
209
|
+
* Change the panel with panel.set, like its position
|
|
210
|
+
* @param owner the panel is made in the document of the owner, the main document by default*/
|
|
211
|
+
declare function customization_panel(options?: CustomizationCreateOptions, owner?: Node): CustomizationPanel;
|
|
212
|
+
/**Shows the customization panel when the element is clicked, with the anchor of the panel at the anchor of the element
|
|
213
|
+
* @param c_panel the panel to show, a new one in the document of the element by default*/
|
|
214
|
+
declare function attach_customization_panel_to_element(element: Element, element_anchor: CompAnchor, panel_anchor: CompAnchor, c_panel?: CustomizationPanel): CustomizationPanel;
|
|
215
|
+
/**Shared base of the top bar elements, only sets the namespace*/
|
|
216
|
+
declare abstract class TopbarBase extends Base {
|
|
217
|
+
static element_name(): string;
|
|
218
|
+
static element_name_space(): string;
|
|
219
|
+
}
|
|
220
|
+
/**Inputs of the top bar*/
|
|
221
|
+
declare const TOPBAR: {
|
|
222
|
+
/**Items at the left side, the side is empty on errors*/
|
|
223
|
+
left: InputKey<StateOrVal<readonly Element[]>>;
|
|
224
|
+
/**Items in the middle, the middle is empty on errors*/
|
|
225
|
+
mid: InputKey<StateOrVal<readonly Element[]>>;
|
|
226
|
+
/**Items at the right side, the side is empty on errors*/
|
|
227
|
+
right: InputKey<StateOrVal<readonly Element[]>>;
|
|
228
|
+
};
|
|
229
|
+
type TopbarOptions = InputOptions<typeof TOPBAR>;
|
|
230
|
+
/**Bar along the top of a page, with items at the left, in the middle and at the right*/
|
|
231
|
+
declare class Topbar extends TopbarBase {
|
|
232
|
+
#private;
|
|
233
|
+
static element_name(): string;
|
|
234
|
+
set(options: TopbarOptions): this;
|
|
235
|
+
}
|
|
236
|
+
/**Inputs of a top bar button*/
|
|
237
|
+
declare const BUTTON: {
|
|
238
|
+
/**Text of the button, shows the error on errors*/
|
|
239
|
+
text: InputKey<StateOrVal<string>>;
|
|
240
|
+
/**Icon in front of the text, no icon on errors*/
|
|
241
|
+
icon: InputKey<StateOrVal<SVGFunc | undefined>>;
|
|
242
|
+
/**Called when the button is clicked, a plain value as it is not shown*/
|
|
243
|
+
on_click: InputKey<() => void>;
|
|
244
|
+
};
|
|
245
|
+
type TopbarButtonOptions = InputOptions<typeof BUTTON>;
|
|
246
|
+
/**Button for the top bar, with an icon, a text or both*/
|
|
247
|
+
declare class TopbarButton extends TopbarBase {
|
|
248
|
+
#private;
|
|
249
|
+
static element_name(): string;
|
|
250
|
+
constructor();
|
|
251
|
+
set(options: TopbarButtonOptions): this;
|
|
252
|
+
}
|
|
253
|
+
/**Inputs of a top bar label*/
|
|
254
|
+
declare const LABEL: {
|
|
255
|
+
/**Text of the label, shows the error on errors*/
|
|
256
|
+
text: InputKey<StateOrVal<string>>;
|
|
257
|
+
};
|
|
258
|
+
type TopbarLabelOptions = InputOptions<typeof LABEL>;
|
|
259
|
+
/**Text for the top bar*/
|
|
260
|
+
declare class TopbarLabel extends TopbarBase {
|
|
261
|
+
static element_name(): string;
|
|
262
|
+
set(options: TopbarLabelOptions): this;
|
|
263
|
+
}
|
|
264
|
+
/**Bar along the top of a page, items are given as arrays for the left, middle and right*/
|
|
265
|
+
declare function topbar(options?: TopbarOptions): Topbar;
|
|
266
|
+
/**Button for the top bar, with an icon, a text or both*/
|
|
267
|
+
declare function topbar_button(options?: TopbarButtonOptions): TopbarButton;
|
|
268
|
+
/**Text for the top bar*/
|
|
269
|
+
declare function topbar_label(options?: TopbarLabelOptions): TopbarLabel;
|
|
270
|
+
export declare const comp: {
|
|
271
|
+
content: typeof content;
|
|
272
|
+
panel: typeof panel;
|
|
273
|
+
panel_container: typeof panel_container;
|
|
274
|
+
topbar: typeof topbar;
|
|
275
|
+
topbar_button: typeof topbar_button;
|
|
276
|
+
topbar_label: typeof topbar_label;
|
|
277
|
+
customization: typeof customization;
|
|
278
|
+
customization_panel: typeof customization_panel;
|
|
279
|
+
attach_customization_panel_to_element: typeof attach_customization_panel_to_element;
|
|
280
|
+
get_element_anchor_position: typeof get_element_anchor_position;
|
|
281
|
+
};
|
|
282
|
+
export type { CompPosition, Content, ContentCreateOptions, ContentOptions, Customization, CustomizationCreateOptions, CustomizationOptions, CustomizationPanel, Panel, PanelContainer, PanelOptions, Topbar, TopbarButton, TopbarButtonOptions, TopbarLabel, TopbarLabelOptions, TopbarOptions };
|
|
283
|
+
//# sourceMappingURL=index.d.mts.map
|