@gtkx/react 1.0.0-rc.4 → 1.0.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/README.md +5 -5
- package/dist/adw/dialog.d.ts +3 -4
- package/dist/adw/dialog.d.ts.map +1 -1
- package/dist/adw/dialog.js +15 -21
- package/dist/adw/dialog.js.map +1 -1
- package/dist/adw/element-behaviors.js +102 -54
- package/dist/adw/element-behaviors.js.map +1 -1
- package/dist/adw/element-config.d.ts +0 -6
- package/dist/adw/element-config.d.ts.map +1 -1
- package/dist/adw/element-config.js +15 -17
- package/dist/adw/element-config.js.map +1 -1
- package/dist/adw/prop-types.d.ts +34 -3
- package/dist/adw/prop-types.d.ts.map +1 -1
- package/dist/adw/prop-types.js.map +1 -1
- package/dist/components/application-window.d.ts +5 -0
- package/dist/components/application-window.d.ts.map +1 -0
- package/dist/components/application-window.js +7 -0
- package/dist/components/application-window.js.map +1 -0
- package/dist/components/application.d.ts +2 -8
- package/dist/components/application.d.ts.map +1 -1
- package/dist/components/application.js +21 -6
- package/dist/components/application.js.map +1 -1
- package/dist/components/element.d.ts +13 -1
- package/dist/components/element.d.ts.map +1 -1
- package/dist/components/element.js +39 -14
- package/dist/components/element.js.map +1 -1
- package/dist/components/portaled.d.ts +5 -0
- package/dist/components/portaled.d.ts.map +1 -0
- package/dist/components/portaled.js +8 -0
- package/dist/components/portaled.js.map +1 -0
- package/dist/components/window.d.ts +5 -5
- package/dist/components/window.d.ts.map +1 -1
- package/dist/components/window.js +16 -16
- package/dist/components/window.js.map +1 -1
- package/dist/config.d.ts +3 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/element-behaviors.js +11 -1
- package/dist/element-behaviors.js.map +1 -1
- package/dist/element-config.d.ts.map +1 -1
- package/dist/element-config.js +7 -4
- package/dist/element-config.js.map +1 -1
- package/dist/hooks/use-merged-refs.d.ts +1 -4
- package/dist/hooks/use-merged-refs.d.ts.map +1 -1
- package/dist/hooks/use-merged-refs.js +1 -1
- package/dist/hooks/use-merged-refs.js.map +1 -1
- package/dist/hooks/use-presented-instance.d.ts +12 -0
- package/dist/hooks/use-presented-instance.d.ts.map +1 -0
- package/dist/hooks/use-presented-instance.js +27 -0
- package/dist/hooks/use-presented-instance.js.map +1 -0
- package/dist/hooks/use-property.d.ts +2 -1
- package/dist/hooks/use-property.d.ts.map +1 -1
- package/dist/hooks/use-property.js.map +1 -1
- package/dist/hooks/use-signal.d.ts +2 -1
- package/dist/hooks/use-signal.d.ts.map +1 -1
- package/dist/hooks/use-signal.js.map +1 -1
- package/dist/internal.d.ts +5 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +5 -2
- package/dist/internal.js.map +1 -1
- package/dist/prop-types.d.ts +29 -5
- package/dist/prop-types.d.ts.map +1 -1
- package/dist/prop-types.js.map +1 -1
- package/dist/reconciler/apply-props.d.ts +4 -4
- package/dist/reconciler/apply-props.d.ts.map +1 -1
- package/dist/reconciler/apply-props.js +62 -20
- package/dist/reconciler/apply-props.js.map +1 -1
- package/dist/reconciler/behaviors.d.ts +9 -5
- package/dist/reconciler/behaviors.d.ts.map +1 -1
- package/dist/reconciler/behaviors.js +40 -22
- package/dist/reconciler/behaviors.js.map +1 -1
- package/dist/reconciler/devtools.d.ts +6 -0
- package/dist/reconciler/devtools.d.ts.map +1 -0
- package/dist/reconciler/devtools.js +11 -0
- package/dist/reconciler/devtools.js.map +1 -0
- package/dist/reconciler/host-config.d.ts.map +1 -1
- package/dist/reconciler/host-config.js +17 -26
- package/dist/reconciler/host-config.js.map +1 -1
- package/dist/reconciler/instance.d.ts.map +1 -1
- package/dist/reconciler/instance.js +5 -3
- package/dist/reconciler/instance.js.map +1 -1
- package/dist/reconciler/metadata.d.ts +1 -1
- package/dist/reconciler/metadata.d.ts.map +1 -1
- package/dist/reconciler/metadata.js +2 -4
- package/dist/reconciler/metadata.js.map +1 -1
- package/dist/reconciler/node.d.ts +3 -2
- package/dist/reconciler/node.d.ts.map +1 -1
- package/dist/reconciler/node.js +7 -6
- package/dist/reconciler/node.js.map +1 -1
- package/dist/reconciler/placement.js +20 -20
- package/dist/reconciler/placement.js.map +1 -1
- package/dist/reconciler/registry.d.ts +9 -7
- package/dist/reconciler/registry.d.ts.map +1 -1
- package/dist/reconciler/registry.js.map +1 -1
- package/dist/reconciler/root-element.d.ts +1 -0
- package/dist/reconciler/root-element.d.ts.map +1 -1
- package/dist/reconciler/root-element.js.map +1 -1
- package/dist/reconciler/root.d.ts +3 -0
- package/dist/reconciler/root.d.ts.map +1 -1
- package/dist/reconciler/root.js +2 -0
- package/dist/reconciler/root.js.map +1 -1
- package/dist/reconciler/signals.d.ts +1 -2
- package/dist/reconciler/signals.d.ts.map +1 -1
- package/dist/reconciler/signals.js +1 -1
- package/dist/reconciler/signals.js.map +1 -1
- package/dist/utils/accessible-props.d.ts +8 -8
- package/dist/utils/accessible-props.d.ts.map +1 -1
- package/dist/utils/accessible-props.js +11 -13
- package/dist/utils/accessible-props.js.map +1 -1
- package/dist/utils/settings.d.ts +2 -1
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/settings.js.map +1 -1
- package/dist/utils/variant.d.ts +33 -1
- package/dist/utils/variant.d.ts.map +1 -1
- package/dist/utils/variant.js.map +1 -1
- package/package.json +4 -4
- package/src/adw/dialog.tsx +22 -25
- package/src/adw/element-behaviors.ts +129 -57
- package/src/adw/element-config.ts +15 -17
- package/src/adw/prop-types.ts +35 -2
- package/src/components/application-window.tsx +10 -0
- package/src/components/application.tsx +31 -5
- package/src/components/element.tsx +52 -16
- package/src/components/portaled.tsx +14 -0
- package/src/components/window.tsx +24 -23
- package/src/config.ts +10 -1
- package/src/element-behaviors.ts +20 -0
- package/src/element-config.ts +7 -4
- package/src/hooks/use-merged-refs.ts +1 -1
- package/src/hooks/use-presented-instance.tsx +50 -0
- package/src/hooks/use-property.ts +2 -1
- package/src/hooks/use-signal.ts +2 -1
- package/src/internal.ts +5 -3
- package/src/prop-types.ts +34 -7
- package/src/reconciler/apply-props.ts +77 -24
- package/src/reconciler/behaviors.ts +72 -30
- package/src/reconciler/devtools.ts +18 -0
- package/src/reconciler/host-config.ts +19 -31
- package/src/reconciler/instance.ts +6 -3
- package/src/reconciler/metadata.ts +3 -6
- package/src/reconciler/node.ts +10 -7
- package/src/reconciler/placement.ts +25 -25
- package/src/reconciler/registry.ts +9 -7
- package/src/reconciler/root-element.ts +4 -1
- package/src/reconciler/root.ts +6 -0
- package/src/reconciler/signals.ts +0 -1
- package/src/utils/accessible-props.ts +21 -24
- package/src/utils/settings.ts +2 -1
- package/src/utils/variant.ts +33 -1
- package/dist/utils/accessible-metadata.d.ts +0 -5
- package/dist/utils/accessible-metadata.d.ts.map +0 -1
- package/dist/utils/accessible-metadata.js +0 -18
- package/dist/utils/accessible-metadata.js.map +0 -1
- package/src/utils/accessible-metadata.ts +0 -24
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as GObject from "@gtkx/gi/gobject";
|
|
2
2
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
3
|
import type { Props } from "../reconciler/registry.js";
|
|
4
|
-
import { deleteAccessibleMetadata, setAccessibleMetadata } from "./accessible-metadata.js";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Accessibility props available on every widget. Each member maps to a GTK4 accessible attribute
|
|
@@ -69,7 +68,7 @@ type AccessibleProps = {
|
|
|
69
68
|
/** Whether the link has already been followed. */
|
|
70
69
|
accessibleVisited?: boolean | null | undefined;
|
|
71
70
|
/** Descendant that holds the focus while the widget itself keeps it. */
|
|
72
|
-
accessibleActiveDescendant?: Gtk.
|
|
71
|
+
accessibleActiveDescendant?: Gtk.Accessible | null | undefined;
|
|
73
72
|
/** Total number of columns in the table, including any that are not rendered. */
|
|
74
73
|
accessibleColCount?: number | null | undefined;
|
|
75
74
|
/** One-based column position of the cell within its table. */
|
|
@@ -79,19 +78,19 @@ type AccessibleProps = {
|
|
|
79
78
|
/** Number of columns the cell spans. */
|
|
80
79
|
accessibleColSpan?: number | null | undefined;
|
|
81
80
|
/** Widgets whose content or presence this widget controls. */
|
|
82
|
-
accessibleControls?: Gtk.
|
|
81
|
+
accessibleControls?: Gtk.Accessible[] | null | undefined;
|
|
83
82
|
/** Widgets that describe this one. */
|
|
84
|
-
accessibleDescribedBy?: Gtk.
|
|
83
|
+
accessibleDescribedBy?: Gtk.Accessible[] | null | undefined;
|
|
85
84
|
/** Widgets holding extended detail about this one. */
|
|
86
|
-
accessibleDetails?: Gtk.
|
|
85
|
+
accessibleDetails?: Gtk.Accessible[] | null | undefined;
|
|
87
86
|
/** Widgets holding the message that explains why the value is invalid. */
|
|
88
|
-
accessibleErrorMessage?: Gtk.
|
|
87
|
+
accessibleErrorMessage?: Gtk.Accessible[] | null | undefined;
|
|
89
88
|
/** Widgets to read next, overriding the default reading order. */
|
|
90
|
-
accessibleFlowTo?: Gtk.
|
|
89
|
+
accessibleFlowTo?: Gtk.Accessible[] | null | undefined;
|
|
91
90
|
/** Widgets that label this one. */
|
|
92
|
-
accessibleLabelledBy?: Gtk.
|
|
91
|
+
accessibleLabelledBy?: Gtk.Accessible[] | null | undefined;
|
|
93
92
|
/** Widgets this one owns that the widget hierarchy does not already imply. */
|
|
94
|
-
accessibleOwns?: Gtk.
|
|
93
|
+
accessibleOwns?: Gtk.Accessible[] | null | undefined;
|
|
95
94
|
/** One-based position of the widget within its set. */
|
|
96
95
|
accessiblePosInSet?: number | null | undefined;
|
|
97
96
|
/** Total number of rows in the table, including any that are not rendered. */
|
|
@@ -106,7 +105,7 @@ type AccessibleProps = {
|
|
|
106
105
|
accessibleSetSize?: number | null | undefined;
|
|
107
106
|
};
|
|
108
107
|
|
|
109
|
-
type AccessibleValueType = "string" | "boolean" | "int" | "double" | "object" | "list";
|
|
108
|
+
type AccessibleValueType = "string" | "boolean" | "optionalBoolean" | "int" | "double" | "object" | "list";
|
|
110
109
|
|
|
111
110
|
type AccessiblePropertyDescriptor = {
|
|
112
111
|
kind: "property";
|
|
@@ -152,12 +151,12 @@ const ACCESSIBLE_PROP_MAP: Record<keyof AccessibleProps, AccessibleDescriptor> =
|
|
|
152
151
|
accessibleBusy: buildState(Gtk.AccessibleState.BUSY, "boolean"),
|
|
153
152
|
accessibleChecked: buildState(Gtk.AccessibleState.CHECKED, "int"),
|
|
154
153
|
accessibleDisabled: buildState(Gtk.AccessibleState.DISABLED, "boolean"),
|
|
155
|
-
accessibleExpanded: buildState(Gtk.AccessibleState.EXPANDED, "
|
|
154
|
+
accessibleExpanded: buildState(Gtk.AccessibleState.EXPANDED, "optionalBoolean"),
|
|
156
155
|
accessibleHidden: buildState(Gtk.AccessibleState.HIDDEN, "boolean"),
|
|
157
156
|
accessibleInvalid: buildState(Gtk.AccessibleState.INVALID, "int"),
|
|
158
157
|
accessiblePressed: buildState(Gtk.AccessibleState.PRESSED, "int"),
|
|
159
|
-
accessibleSelected: buildState(Gtk.AccessibleState.SELECTED, "
|
|
160
|
-
accessibleVisited: buildState(Gtk.AccessibleState.VISITED, "
|
|
158
|
+
accessibleSelected: buildState(Gtk.AccessibleState.SELECTED, "optionalBoolean"),
|
|
159
|
+
accessibleVisited: buildState(Gtk.AccessibleState.VISITED, "optionalBoolean"),
|
|
161
160
|
accessibleActiveDescendant: buildRelation(Gtk.AccessibleRelation.ACTIVE_DESCENDANT, "object"),
|
|
162
161
|
accessibleColCount: buildRelation(Gtk.AccessibleRelation.COL_COUNT, "int"),
|
|
163
162
|
accessibleColIndex: buildRelation(Gtk.AccessibleRelation.COL_INDEX, "int"),
|
|
@@ -214,6 +213,11 @@ const buildValue = (descriptor: AccessibleDescriptor, jsValue: unknown): GObject
|
|
|
214
213
|
v.setBoolean(jsValue as boolean);
|
|
215
214
|
});
|
|
216
215
|
}
|
|
216
|
+
case "optionalBoolean": {
|
|
217
|
+
return GObject.buildValue(GObject.TYPE_INT, (v) => {
|
|
218
|
+
v.setInt(jsValue === true ? 1 : 0);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
217
221
|
case "int": {
|
|
218
222
|
return GObject.buildValue(GObject.TYPE_INT, (v) => {
|
|
219
223
|
v.setInt(jsValue as number);
|
|
@@ -230,7 +234,7 @@ const buildValue = (descriptor: AccessibleDescriptor, jsValue: unknown): GObject
|
|
|
230
234
|
});
|
|
231
235
|
}
|
|
232
236
|
case "list": {
|
|
233
|
-
const list = Gtk.AccessibleList.newFromList(jsValue as Gtk.
|
|
237
|
+
const list = Gtk.AccessibleList.newFromList(jsValue as Gtk.Accessible[]);
|
|
234
238
|
|
|
235
239
|
return GObject.buildValue(Gtk.AccessibleList.prototype.__type__, (v) => {
|
|
236
240
|
v.setBoxed(list);
|
|
@@ -281,24 +285,18 @@ function resetDescriptor(widget: Gtk.Accessible, descriptor: AccessibleDescripto
|
|
|
281
285
|
const applyChangedProp = (widget: Gtk.Accessible, name: keyof AccessibleProps, newValue: unknown): void => {
|
|
282
286
|
if (newValue == null) {
|
|
283
287
|
resetDescriptor(widget, ACCESSIBLE_PROP_MAP[name]);
|
|
284
|
-
deleteAccessibleMetadata(widget, name);
|
|
285
288
|
} else {
|
|
286
289
|
applyDescriptor(widget, ACCESSIBLE_PROP_MAP[name], newValue);
|
|
287
|
-
setAccessibleMetadata(widget, name, newValue);
|
|
288
290
|
}
|
|
289
291
|
};
|
|
290
292
|
|
|
291
|
-
const applyChangedProps = (widget: Gtk.Accessible,
|
|
293
|
+
const applyChangedProps = (widget: Gtk.Accessible, newProps: Props): void => {
|
|
292
294
|
for (const name in newProps) {
|
|
293
295
|
if (!isAccessibleProp(name)) {
|
|
294
296
|
continue;
|
|
295
297
|
}
|
|
296
298
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (oldProps?.[name] !== newValue) {
|
|
300
|
-
applyChangedProp(widget, name, newValue);
|
|
301
|
-
}
|
|
299
|
+
applyChangedProp(widget, name, newProps[name]);
|
|
302
300
|
}
|
|
303
301
|
};
|
|
304
302
|
|
|
@@ -312,12 +310,11 @@ const resetRemovedProps = (widget: Gtk.Accessible, oldProps: Props, newProps: Pr
|
|
|
312
310
|
}
|
|
313
311
|
|
|
314
312
|
resetDescriptor(widget, ACCESSIBLE_PROP_MAP[name]);
|
|
315
|
-
deleteAccessibleMetadata(widget, name);
|
|
316
313
|
}
|
|
317
314
|
};
|
|
318
315
|
|
|
319
316
|
const applyAccessibleProps = (widget: Gtk.Accessible, oldProps: Props | null, newProps: Props): void => {
|
|
320
|
-
applyChangedProps(widget,
|
|
317
|
+
applyChangedProps(widget, newProps);
|
|
321
318
|
|
|
322
319
|
if (oldProps) {
|
|
323
320
|
resetRemovedProps(widget, oldProps, newProps);
|
package/src/utils/settings.ts
CHANGED
|
@@ -3,8 +3,9 @@ import { packVariant, parseVariantType, unpackVariant, type VariantValue } from
|
|
|
3
3
|
|
|
4
4
|
/** Maps each key of a GSettings schema to its kind: a GVariant type string, or `enum` or `flags`. */
|
|
5
5
|
type SettingsSchemaKeys = Record<string, string>;
|
|
6
|
+
/** Value type a key kind stands for: `number` for `enum` and `flags`, otherwise the unpacked GVariant. */
|
|
6
7
|
type SettingKindValue<S extends string> = S extends "enum" | "flags" ? number : VariantValue<S>;
|
|
7
|
-
/**
|
|
8
|
+
/** Value type of key `P`, looked up by its kind in schema `K`, that reads and writes of that key take. */
|
|
8
9
|
type SettingValue<K extends SettingsSchemaKeys, P extends keyof K> = SettingKindValue<K[P] & string>;
|
|
9
10
|
|
|
10
11
|
/** A GSettings schema, as described by the modules GTKX generates from a project's `.gschema.xml` files. */
|
package/src/utils/variant.ts
CHANGED
|
@@ -1,26 +1,45 @@
|
|
|
1
1
|
import * as GLib from "@gtkx/gi/glib";
|
|
2
2
|
|
|
3
|
+
/** JavaScript type every GVariant basic type code unpacks to. */
|
|
3
4
|
type BasicValueMap = {
|
|
5
|
+
/** Boolean, held as a single byte reading 0 or 1. */
|
|
4
6
|
b: boolean;
|
|
7
|
+
/** Unsigned byte. */
|
|
5
8
|
y: number;
|
|
9
|
+
/** Signed 16-bit integer. */
|
|
6
10
|
n: number;
|
|
11
|
+
/** Unsigned 16-bit integer. */
|
|
7
12
|
q: number;
|
|
13
|
+
/** Signed 32-bit integer. */
|
|
8
14
|
i: number;
|
|
15
|
+
/** Unsigned 32-bit integer. */
|
|
9
16
|
u: number;
|
|
17
|
+
/** Index into the file descriptor list a message carries. */
|
|
10
18
|
h: number;
|
|
19
|
+
/** Double precision floating point number. */
|
|
11
20
|
d: number;
|
|
21
|
+
/** Signed 64-bit integer. */
|
|
12
22
|
x: bigint;
|
|
23
|
+
/** Unsigned 64-bit integer. */
|
|
13
24
|
t: bigint;
|
|
25
|
+
/** UTF-8 string, under no further constraint on what it holds. */
|
|
14
26
|
s: string;
|
|
27
|
+
/** D-Bus object path. */
|
|
15
28
|
o: string;
|
|
29
|
+
/** GVariant type signature. */
|
|
16
30
|
g: string;
|
|
31
|
+
/** Boxed variant holding a value of any type. */
|
|
17
32
|
v: GLib.Variant;
|
|
18
33
|
};
|
|
19
34
|
|
|
35
|
+
/** Single-character code of one of the GVariant basic types in {@link BasicValueMap}. */
|
|
20
36
|
type BasicCode = keyof BasicValueMap;
|
|
37
|
+
/** Parses the element type of an array, yielding the array type it produces and the rest of the string. */
|
|
21
38
|
type ParseArray<S extends string> = Parse<S> extends [infer V, infer R extends string] ? [V[], R] : never;
|
|
39
|
+
/** Parses the element type of a maybe, yielding the nullable type it produces and the rest of the string. */
|
|
22
40
|
type ParseMaybe<S extends string> = Parse<S> extends [infer V, infer R extends string] ? [V | null, R] : never;
|
|
23
41
|
|
|
42
|
+
/** Collects tuple member types into `Acc` up to the closing parenthesis, yielding them and the rest of the string. */
|
|
24
43
|
type ParseTuple<S extends string, Acc extends unknown[]> = S extends `)${infer Rest}`
|
|
25
44
|
? [Acc, Rest]
|
|
26
45
|
: [Parse<S>] extends [never]
|
|
@@ -29,8 +48,10 @@ type ParseTuple<S extends string, Acc extends unknown[]> = S extends `)${infer R
|
|
|
29
48
|
? ParseTuple<R, [...Acc, V]>
|
|
30
49
|
: never;
|
|
31
50
|
|
|
51
|
+
/** Types a dictionary entry key can hold. */
|
|
32
52
|
type DictKey = string | number | bigint | boolean;
|
|
33
53
|
|
|
54
|
+
/** Parses the key and value types of a dictionary entry, yielding them and the rest of the string after its brace. */
|
|
34
55
|
type ParsePair<S extends string> =
|
|
35
56
|
Parse<S> extends [infer K, infer R1 extends string]
|
|
36
57
|
? Parse<R1> extends [infer V, infer R2 extends string]
|
|
@@ -42,16 +63,26 @@ type ParsePair<S extends string> =
|
|
|
42
63
|
: never
|
|
43
64
|
: never;
|
|
44
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Parses a dictionary entry into the collection an array of those entries unpacks to, a record for string keys and a
|
|
68
|
+
* `Map` otherwise, plus the rest of the string.
|
|
69
|
+
*/
|
|
45
70
|
type ParseDict<S extends string> =
|
|
46
71
|
ParsePair<S> extends [infer K, infer V, infer R extends string]
|
|
47
72
|
? [[K] extends [string] ? Record<string, V> : Map<K, V>, R]
|
|
48
73
|
: never;
|
|
49
74
|
|
|
75
|
+
/** Parses a standalone dictionary entry into a key and value pair, yielding it and the rest of the string. */
|
|
50
76
|
type ParseEntry<S extends string> =
|
|
51
77
|
ParsePair<S> extends [infer K, infer V, infer R extends string] ? [[K, V], R] : never;
|
|
52
78
|
|
|
79
|
+
/** Parses what follows an `a` as a dictionary when it opens an entry, and as a plain array otherwise. */
|
|
53
80
|
type ParseArrayOrDict<S extends string> = S extends `{${infer Rest}` ? ParseDict<Rest> : ParseArray<S>;
|
|
54
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Parses the type at the head of `S`, yielding the JavaScript type it unpacks to and the rest of the string, or
|
|
84
|
+
* `never` when the string is malformed.
|
|
85
|
+
*/
|
|
55
86
|
type Parse<S extends string> = S extends `a${infer Rest}`
|
|
56
87
|
? ParseArrayOrDict<Rest>
|
|
57
88
|
: S extends `m${infer Rest}`
|
|
@@ -66,6 +97,7 @@ type Parse<S extends string> = S extends `a${infer Rest}`
|
|
|
66
97
|
: never
|
|
67
98
|
: never;
|
|
68
99
|
|
|
100
|
+
/** JavaScript type a variant of type string `S` unpacks to, or `unknown` when `S` is not one complete type. */
|
|
69
101
|
type VariantValue<S extends string> = [Parse<S>] extends [never]
|
|
70
102
|
? unknown
|
|
71
103
|
: Parse<S> extends [infer V, ""]
|
|
@@ -365,4 +397,4 @@ const packVariant = (node: VariantTypeNode, value: unknown): GLib.Variant => {
|
|
|
365
397
|
}
|
|
366
398
|
};
|
|
367
399
|
|
|
368
|
-
export { parseVariantType, unpackVariant, packVariant, type VariantValue
|
|
400
|
+
export { parseVariantType, unpackVariant, packVariant, type VariantValue };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare const setAccessibleMetadata: (widget: object, name: string, value: unknown) => void;
|
|
2
|
-
declare const deleteAccessibleMetadata: (widget: object, name: string) => void;
|
|
3
|
-
declare const getAccessibleMetadata: (widget: object, name: string) => unknown;
|
|
4
|
-
export { setAccessibleMetadata, deleteAccessibleMetadata, getAccessibleMetadata };
|
|
5
|
-
//# sourceMappingURL=accessible-metadata.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accessible-metadata.d.ts","sourceRoot":"","sources":["../../src/utils/accessible-metadata.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,qBAAqB,GAAI,QAAQ,MAAM,EAAE,MAAM,MAAM,EAAE,OAAO,OAAO,KAAG,IAS7E,CAAC;AAEF,QAAA,MAAM,wBAAwB,GAAI,QAAQ,MAAM,EAAE,MAAM,MAAM,KAAG,IAEhE,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAI,QAAQ,MAAM,EAAE,MAAM,MAAM,KAAG,OAI7D,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const metadataStore = new WeakMap();
|
|
2
|
-
const setAccessibleMetadata = (widget, name, value) => {
|
|
3
|
-
let entries = metadataStore.get(widget);
|
|
4
|
-
if (entries === undefined) {
|
|
5
|
-
entries = new Map();
|
|
6
|
-
metadataStore.set(widget, entries);
|
|
7
|
-
}
|
|
8
|
-
entries.set(name, value);
|
|
9
|
-
};
|
|
10
|
-
const deleteAccessibleMetadata = (widget, name) => {
|
|
11
|
-
metadataStore.get(widget)?.delete(name);
|
|
12
|
-
};
|
|
13
|
-
const getAccessibleMetadata = (widget, name) => {
|
|
14
|
-
const value = metadataStore.get(widget)?.get(name);
|
|
15
|
-
return value === undefined ? null : value;
|
|
16
|
-
};
|
|
17
|
-
export { setAccessibleMetadata, deleteAccessibleMetadata, getAccessibleMetadata };
|
|
18
|
-
//# sourceMappingURL=accessible-metadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accessible-metadata.js","sourceRoot":"","sources":["../../src/utils/accessible-metadata.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAA0C,IAAI,OAAO,EAAE,CAAC;AAE3E,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAAE,IAAY,EAAE,KAAc,EAAQ,EAAE;IACjF,IAAI,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAExC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QACpB,aAAa,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,MAAc,EAAE,IAAY,EAAQ,EAAE;IACpE,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAAE,IAAY,EAAW,EAAE;IACpE,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAEnD,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9C,CAAC,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["const metadataStore: WeakMap<object, Map<string, unknown>> = new WeakMap();\n\nconst setAccessibleMetadata = (widget: object, name: string, value: unknown): void => {\n let entries = metadataStore.get(widget);\n\n if (entries === undefined) {\n entries = new Map();\n metadataStore.set(widget, entries);\n }\n\n entries.set(name, value);\n};\n\nconst deleteAccessibleMetadata = (widget: object, name: string): void => {\n metadataStore.get(widget)?.delete(name);\n};\n\nconst getAccessibleMetadata = (widget: object, name: string): unknown => {\n const value = metadataStore.get(widget)?.get(name);\n\n return value === undefined ? null : value;\n};\n\nexport { setAccessibleMetadata, deleteAccessibleMetadata, getAccessibleMetadata };\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const metadataStore: WeakMap<object, Map<string, unknown>> = new WeakMap();
|
|
2
|
-
|
|
3
|
-
const setAccessibleMetadata = (widget: object, name: string, value: unknown): void => {
|
|
4
|
-
let entries = metadataStore.get(widget);
|
|
5
|
-
|
|
6
|
-
if (entries === undefined) {
|
|
7
|
-
entries = new Map();
|
|
8
|
-
metadataStore.set(widget, entries);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
entries.set(name, value);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const deleteAccessibleMetadata = (widget: object, name: string): void => {
|
|
15
|
-
metadataStore.get(widget)?.delete(name);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const getAccessibleMetadata = (widget: object, name: string): unknown => {
|
|
19
|
-
const value = metadataStore.get(widget)?.get(name);
|
|
20
|
-
|
|
21
|
-
return value === undefined ? null : value;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { setAccessibleMetadata, deleteAccessibleMetadata, getAccessibleMetadata };
|