@chocbite/ts-lib-ui 1.0.6 → 1.1.0
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 +164 -3
- package/SOURCE.md +2000 -268
- package/base/index.d.mts +1 -1
- package/base/index.mjs +7 -7
- package/base/index.mjs.map +1 -1
- package/canvas/index.d.mts +1 -1
- package/canvas/index.mjs +8 -8
- package/canvas/index.mjs.map +1 -1
- package/context-menu/index.d.mts +2 -2
- package/context-menu/index.mjs +1 -1
- package/{context-menu-Bo8R6DmK.mjs → context-menu-DE3EUtY8.mjs} +149 -111
- package/context-menu-DE3EUtY8.mjs.map +1 -0
- package/document/index.mjs +1 -1
- package/document/index.mjs.map +1 -1
- package/dom/index.mjs +1 -1
- package/dom/index.mjs.map +1 -1
- package/form/index.d.mts +6 -5
- package/form/index.mjs +30 -29
- package/form/index.mjs.map +1 -1
- package/icons/index.d.mts +1 -1
- package/icons/index.mjs +1 -1
- package/{icons-e2J_Ojic.mjs → icons-B88i-7MC.mjs} +2 -2
- package/{index-ClIBfrHy.d.mts → index-BDWg5GX2.d.mts} +2 -2
- package/{index-ClfL2SQR.d.mts → index-CvzH3M_5.d.mts} +2 -2
- package/index-Cw4AcuUl.d.mts +371 -0
- package/{index-Pr2sLv9e.d.mts → index-YNZjMIO7.d.mts} +33 -17
- package/keyboard/index.d.mts +1 -1
- package/keyboard/index.mjs +12 -12
- package/keyboard/index.mjs.map +1 -1
- package/list/index.d.mts +2 -2
- package/list/index.mjs +1 -1
- package/list-D08epOjk.mjs +1566 -0
- package/list-D08epOjk.mjs.map +1 -0
- package/package.json +5 -80
- package/selection/index.mjs +1 -1
- package/selection/index.mjs.map +1 -1
- package/settings/index.mjs +1 -1
- package/settings/index.mjs.map +1 -1
- package/spinner/index.d.mts +1 -1
- package/spinner/index.mjs +3 -3
- package/spinner/index.mjs.map +1 -1
- package/state_ui/index.mjs +1 -1
- package/{state_ui-Bm3TeKNL.mjs → state_ui-Dtm2y5RU.mjs} +3 -3
- package/state_ui-Dtm2y5RU.mjs.map +1 -0
- package/style.css +307 -63
- package/svg/index.d.mts +1 -1
- package/svg/index.mjs +1 -1
- package/{svg-1bp-yIPC.mjs → svg-Yz7elqnU.mjs} +16 -16
- package/svg-Yz7elqnU.mjs.map +1 -0
- package/test/index.d.mts +1 -1
- package/test/index.mjs +1 -1
- package/test/index.mjs.map +1 -1
- package/theme/index.d.mts +1 -1
- package/theme/index.mjs +1 -1
- package/{theme-DgVtLDzP.mjs → theme-BJS5z1iW.mjs} +9 -9
- package/theme-BJS5z1iW.mjs.map +1 -0
- package/context-menu-Bo8R6DmK.mjs.map +0 -1
- package/index-BTUFkF9s.d.mts +0 -173
- package/list-DOXIQOEY.mjs +0 -715
- package/list-DOXIQOEY.mjs.map +0 -1
- package/state_ui-Bm3TeKNL.mjs.map +0 -1
- package/svg-1bp-yIPC.mjs.map +0 -1
- package/theme-DgVtLDzP.mjs.map +0 -1
package/index-BTUFkF9s.d.mts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import './style.css';
|
|
2
|
-
import { l as Base, u as BaseIntersectObserver } from "./index-ClfL2SQR.mjs";
|
|
3
|
-
import { t as SVGFunc } from "./index-ClIBfrHy.mjs";
|
|
4
|
-
import { n as ContextMenu } from "./index-Pr2sLv9e.mjs";
|
|
5
|
-
import { State } from "@chocbite/ts-lib/state";
|
|
6
|
-
import { Option, Result } from "@chocbite/ts-lib/result";
|
|
7
|
-
declare abstract class ListField extends Base {
|
|
8
|
-
static element_name(): string;
|
|
9
|
-
static element_name_space(): string;
|
|
10
|
-
constructor();
|
|
11
|
-
}
|
|
12
|
-
declare class ListTextField extends ListField {
|
|
13
|
-
static element_name(): string;
|
|
14
|
-
set text(value: string);
|
|
15
|
-
}
|
|
16
|
-
declare function text_field(): ListTextField;
|
|
17
|
-
declare class ListNumberField extends ListField {
|
|
18
|
-
static element_name(): string;
|
|
19
|
-
set number(value: number);
|
|
20
|
-
}
|
|
21
|
-
declare function number_field(): ListNumberField;
|
|
22
|
-
declare class ListNodeField<T extends Node> extends ListField {
|
|
23
|
-
static element_name(): string;
|
|
24
|
-
constructor(node: T);
|
|
25
|
-
set node(node: T);
|
|
26
|
-
get node(): T;
|
|
27
|
-
}
|
|
28
|
-
declare function node_field<T extends Node>(node: T): ListNodeField<T>;
|
|
29
|
-
interface ListKeyFieldOptions {
|
|
30
|
-
icon?: SVGFunc | State<SVGFunc>;
|
|
31
|
-
}
|
|
32
|
-
type ListSubRows<R> = () => R[] | State<R[]>;
|
|
33
|
-
interface ListRowOptions<R, T extends {}, S extends boolean> {
|
|
34
|
-
opened?: boolean;
|
|
35
|
-
openable?: boolean | State<boolean>;
|
|
36
|
-
key_field?: ListKeyFieldOptions;
|
|
37
|
-
sub_rows?: S extends true ? ListSubRows<R> : never;
|
|
38
|
-
add_row?: ListAddRowOptions;
|
|
39
|
-
context_menu?: ContextMenu | (() => Option<ContextMenu>);
|
|
40
|
-
values: T;
|
|
41
|
-
}
|
|
42
|
-
declare class ListRow<R, T extends {}, A extends ListType<R>, S extends boolean> extends Base implements ListRowParent<A> {
|
|
43
|
-
#private;
|
|
44
|
-
static element_name(): string;
|
|
45
|
-
static element_name_space(): string;
|
|
46
|
-
readonly depth: number;
|
|
47
|
-
state: ListParentRows<A>;
|
|
48
|
-
constructor(root: ListRoot<R, T, A, S>, parent: ListRowParent<A>, data: R);
|
|
49
|
-
/**Regenerates the fields of the row and its sub rows after the columns changed */
|
|
50
|
-
columns_changed(): void;
|
|
51
|
-
select_adjacent(direction: "next" | "previous" | "p_next" | "p_previous" | "last", field: Option<number>): void;
|
|
52
|
-
set data(data: R);
|
|
53
|
-
set add_row(options: ListAddRowOptions | undefined);
|
|
54
|
-
set openable(value: boolean);
|
|
55
|
-
get openable(): boolean;
|
|
56
|
-
set open(open: boolean);
|
|
57
|
-
get open(): boolean;
|
|
58
|
-
get index(): number;
|
|
59
|
-
amount_rows(rec?: boolean): number;
|
|
60
|
-
set rows(rows: R[] | State<R[]>);
|
|
61
|
-
}
|
|
62
|
-
type ListType<R> = R[] | State<R[]>;
|
|
63
|
-
type ListTypeExtract<A extends ListType<any>> = A extends (infer U)[] ? U : A extends State<(infer U)[]> ? U : never;
|
|
64
|
-
/**Rows of a row parent, the top level rows or sub rows, which can be an array or a state regardless of the top level rows */
|
|
65
|
-
type ListParentRows<A extends ListType<any>> = A | ListType<ListTypeExtract<A>>;
|
|
66
|
-
declare const ListDataType: {
|
|
67
|
-
readonly number: "number";
|
|
68
|
-
readonly string: "string";
|
|
69
|
-
readonly bool: "bool";
|
|
70
|
-
};
|
|
71
|
-
type ListDataType = (typeof ListDataType)[keyof typeof ListDataType];
|
|
72
|
-
type ListColumnAlign = "left" | "center" | "right";
|
|
73
|
-
interface ListColumnOptions<V, C extends ListField> {
|
|
74
|
-
/**Initial width of the column in rem, auto when undefined*/
|
|
75
|
-
init_width?: number;
|
|
76
|
-
/**If the column has a fixed width in rem, overrides init_width and disables resizing*/
|
|
77
|
-
fixed_width?: number | "min" | "max";
|
|
78
|
-
/**Initial order of the column, lower numbers appear first, will order by column object if undefined
|
|
79
|
-
* A column without order uses its position in the column object as order*/
|
|
80
|
-
order?: number;
|
|
81
|
-
/**Whether the column is reorderable by the user*/
|
|
82
|
-
reorderable?: boolean;
|
|
83
|
-
/**Data type of the column, used for sorting, will attempt auto detect if undefined*/
|
|
84
|
-
type?: ListDataType;
|
|
85
|
-
/**Horizontal alignment of the title and the fields, center when undefined
|
|
86
|
-
* Text, number and node fields follow it, more complex fields like form fields do not */
|
|
87
|
-
align?: ListColumnAlign;
|
|
88
|
-
/**Column title*/
|
|
89
|
-
title: string;
|
|
90
|
-
/**Generates the field element, only called during row or column creation */
|
|
91
|
-
field_gen(): C;
|
|
92
|
-
/**Applies the value to the field */
|
|
93
|
-
field_apply(field: C, value: V): void;
|
|
94
|
-
}
|
|
95
|
-
/**Helper to create a column object */
|
|
96
|
-
declare function column<V, C extends ListField>(options: ListColumnOptions<V, C>): ListColumnOptions<V, C>;
|
|
97
|
-
/**Special helper to create a string value column */
|
|
98
|
-
declare function column_string(
|
|
99
|
-
/**Column title*/
|
|
100
|
-
title: string, options?: {
|
|
101
|
-
align?: ListColumnAlign;
|
|
102
|
-
}): ListColumnOptions<string, ListTextField>;
|
|
103
|
-
/**Transforms the data of a row into row options
|
|
104
|
-
* Returning an error makes the row invalid, the error text then replaces the fields of the row
|
|
105
|
-
* An invalid row is for failures with no other options, so it has no sub rows, add row or context menu */
|
|
106
|
-
type ListRowTransformer<R, T extends {}, A extends ListType<any>, S extends boolean> = (
|
|
107
|
-
/**Data of the row */
|
|
108
|
-
data: R,
|
|
109
|
-
/**The row the options are for */
|
|
110
|
-
row: ListRow<R, T, A, S>,
|
|
111
|
-
/**Rows the data is from, sub rows can come from an array or a state regardless of the top level rows */
|
|
112
|
-
state: S extends true ? A | ListType<R> : A) => Result<ListRowOptions<R, T, S>, string>;
|
|
113
|
-
interface ListRoot<R, T extends {}, A extends ListType<any>, S extends boolean> {
|
|
114
|
-
/**Sub rows */
|
|
115
|
-
readonly sub_rows: S;
|
|
116
|
-
/**Columns options mapped by column key */
|
|
117
|
-
readonly columns: Map<keyof T, ListColumnOptions<T[keyof T], ListField>>;
|
|
118
|
-
/**Order of visible columns by column key */
|
|
119
|
-
columns_visible: (keyof T)[];
|
|
120
|
-
/**Function to transform a row data into row options */
|
|
121
|
-
transform: ListRowTransformer<R, T, A, S>;
|
|
122
|
-
/**Observer for the container if observer is active */
|
|
123
|
-
observer?: BaseIntersectObserver;
|
|
124
|
-
}
|
|
125
|
-
interface ListRowParent<A extends ListType<any>> {
|
|
126
|
-
/**Sub row depth */
|
|
127
|
-
readonly depth: number;
|
|
128
|
-
/**Whether the row is open to show sub rows */
|
|
129
|
-
open: boolean;
|
|
130
|
-
/**Selects the adjacent row in the given direction */
|
|
131
|
-
select_adjacent(direction: "next" | "previous" | "p_next" | "p_previous" | "last", field: Option<number>): void;
|
|
132
|
-
/**Rows of the parent, the rows of the container or the sub rows of a row */
|
|
133
|
-
state: ListParentRows<A>;
|
|
134
|
-
}
|
|
135
|
-
interface ListAddRowOptions {
|
|
136
|
-
text: string | State<string>;
|
|
137
|
-
disabled?: boolean | State<boolean>;
|
|
138
|
-
icon?: SVGFunc | State<SVGFunc>;
|
|
139
|
-
on_add: () => void;
|
|
140
|
-
}
|
|
141
|
-
interface ContainerOptions<S extends boolean = false> {
|
|
142
|
-
/**Should header row be omitted */
|
|
143
|
-
headless?: boolean;
|
|
144
|
-
/**Can rows have sub rows */
|
|
145
|
-
sub_rows?: S;
|
|
146
|
-
/**Options for an add row button */
|
|
147
|
-
add_row?: ListAddRowOptions;
|
|
148
|
-
/**If list should use a container to give fields the option of attach/detach to states when visible */
|
|
149
|
-
observer?: BaseIntersectObserver;
|
|
150
|
-
}
|
|
151
|
-
declare class Container<A extends ListType<any>, T extends {
|
|
152
|
-
[key: string]: ListColumnOptions<any, any>;
|
|
153
|
-
}, S extends boolean = false, R = ListTypeExtract<A>> extends Base {
|
|
154
|
-
#private;
|
|
155
|
-
static element_name(): string;
|
|
156
|
-
static element_name_space(): string;
|
|
157
|
-
constructor(columns: { [K in keyof T]: ListColumnOptions<T[K], any>; }, transform: ListRowTransformer<R, T, A, S>, rows: A, options?: ContainerOptions<S>);
|
|
158
|
-
set columns(columns: { [K in keyof T]: ListColumnOptions<T[K], any>; });
|
|
159
|
-
set add_row(options: ListAddRowOptions | undefined);
|
|
160
|
-
amount_rows(rec?: boolean): number;
|
|
161
|
-
set rows(rows: R[] | State<R[]>);
|
|
162
|
-
}
|
|
163
|
-
declare function container<A extends ListType<any>, T extends {}, S extends boolean = false, R = ListTypeExtract<A>>(columns: { [K in keyof T]: ListColumnOptions<T[K], any>; }, transform: ListRowTransformer<R, NoInfer<T>, A, S>, rows: A, options?: ContainerOptions<S>): Container<A, T, S, R>;
|
|
164
|
-
declare const list: {
|
|
165
|
-
column: typeof column;
|
|
166
|
-
column_string: typeof column_string;
|
|
167
|
-
container: typeof container;
|
|
168
|
-
text_field: typeof text_field;
|
|
169
|
-
number_field: typeof number_field;
|
|
170
|
-
node_field: typeof node_field;
|
|
171
|
-
};
|
|
172
|
-
export { ListField as n, list as t };
|
|
173
|
-
//# sourceMappingURL=index-BTUFkF9s.d.mts.map
|