@gtkx/react 1.0.0-rc.2 → 1.0.0-rc.4
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 +4 -5
- package/dist/adw/config.d.ts +1 -0
- package/dist/adw/config.d.ts.map +1 -1
- package/dist/adw/config.js +1 -0
- package/dist/adw/config.js.map +1 -1
- package/dist/adw/dialog.d.ts +1 -0
- package/dist/adw/dialog.d.ts.map +1 -1
- package/dist/adw/dialog.js +1 -0
- package/dist/adw/dialog.js.map +1 -1
- package/dist/adw/element-behaviors.js +8 -39
- package/dist/adw/element-behaviors.js.map +1 -1
- package/dist/adw/element-config.d.ts +7 -4
- package/dist/adw/element-config.d.ts.map +1 -1
- package/dist/adw/element-config.js +32 -41
- package/dist/adw/element-config.js.map +1 -1
- package/dist/adw/index.d.ts +1 -0
- package/dist/adw/index.d.ts.map +1 -1
- package/dist/adw/index.js +1 -0
- package/dist/adw/index.js.map +1 -1
- package/dist/adw/prop-types.d.ts +1 -1
- package/dist/adw/prop-types.d.ts.map +1 -1
- package/dist/adw/prop-types.js.map +1 -1
- package/dist/bootstrap.js +1 -1
- package/dist/bootstrap.js.map +1 -1
- package/dist/components/application.d.ts +1 -0
- package/dist/components/application.d.ts.map +1 -1
- package/dist/components/application.js +1 -0
- package/dist/components/application.js.map +1 -1
- package/dist/components/element.d.ts +0 -1
- package/dist/components/element.d.ts.map +1 -1
- package/dist/components/element.js +0 -1
- package/dist/components/element.js.map +1 -1
- package/dist/components/window.d.ts +1 -0
- package/dist/components/window.d.ts.map +1 -1
- package/dist/components/window.js +14 -2
- package/dist/components/window.js.map +1 -1
- package/dist/config.d.ts +5 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/element-behaviors.js +0 -1
- package/dist/element-behaviors.js.map +1 -1
- package/dist/element-config.d.ts +4 -3
- package/dist/element-config.d.ts.map +1 -1
- package/dist/element-config.js +12 -8
- package/dist/element-config.js.map +1 -1
- package/dist/hooks/use-bind-setting.d.ts +8 -7
- package/dist/hooks/use-bind-setting.d.ts.map +1 -1
- package/dist/hooks/use-bind-setting.js +2 -7
- package/dist/hooks/use-bind-setting.js.map +1 -1
- package/dist/hooks/use-parent-window.d.ts +3 -1
- package/dist/hooks/use-parent-window.d.ts.map +1 -1
- package/dist/hooks/use-parent-window.js +3 -1
- package/dist/hooks/use-parent-window.js.map +1 -1
- package/dist/hooks/use-property.d.ts +2 -2
- package/dist/hooks/use-property.d.ts.map +1 -1
- package/dist/hooks/use-property.js +1 -2
- package/dist/hooks/use-property.js.map +1 -1
- package/dist/hooks/use-setting.d.ts +2 -3
- package/dist/hooks/use-setting.d.ts.map +1 -1
- package/dist/hooks/use-setting.js +2 -3
- package/dist/hooks/use-setting.js.map +1 -1
- package/dist/hooks/use-signal.d.ts +17 -7
- package/dist/hooks/use-signal.d.ts.map +1 -1
- package/dist/hooks/use-signal.js +10 -8
- package/dist/hooks/use-signal.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +5 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +3 -3
- package/dist/internal.js.map +1 -1
- package/dist/prop-types.d.ts +60 -0
- package/dist/prop-types.d.ts.map +1 -1
- package/dist/prop-types.js.map +1 -1
- package/dist/reconciler/apply-props.d.ts.map +1 -1
- package/dist/reconciler/apply-props.js +12 -6
- package/dist/reconciler/apply-props.js.map +1 -1
- package/dist/reconciler/behaviors.d.ts +0 -15
- package/dist/reconciler/behaviors.d.ts.map +1 -1
- package/dist/reconciler/behaviors.js +12 -22
- package/dist/reconciler/behaviors.js.map +1 -1
- package/dist/reconciler/host-config.d.ts +1 -1
- package/dist/reconciler/host-config.d.ts.map +1 -1
- package/dist/reconciler/host-config.js +2 -6
- package/dist/reconciler/host-config.js.map +1 -1
- package/dist/reconciler/instance.js +1 -1
- 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 +7 -7
- package/dist/reconciler/metadata.js.map +1 -1
- package/dist/reconciler/node.d.ts +2 -2
- package/dist/reconciler/node.d.ts.map +1 -1
- package/dist/reconciler/node.js +1 -1
- package/dist/reconciler/node.js.map +1 -1
- package/dist/reconciler/placement.d.ts.map +1 -1
- package/dist/reconciler/placement.js +28 -12
- package/dist/reconciler/placement.js.map +1 -1
- package/dist/reconciler/registry.d.ts +56 -29
- package/dist/reconciler/registry.d.ts.map +1 -1
- package/dist/reconciler/registry.js +27 -26
- package/dist/reconciler/registry.js.map +1 -1
- package/dist/reconciler/root-element.d.ts +0 -1
- package/dist/reconciler/root-element.d.ts.map +1 -1
- package/dist/reconciler/root-element.js +0 -1
- package/dist/reconciler/root-element.js.map +1 -1
- package/dist/reconciler/root.d.ts +8 -22
- package/dist/reconciler/root.d.ts.map +1 -1
- package/dist/reconciler/root.js +5 -23
- package/dist/reconciler/root.js.map +1 -1
- package/dist/reconciler/signals.d.ts +3 -4
- package/dist/reconciler/signals.d.ts.map +1 -1
- package/dist/reconciler/signals.js +14 -26
- package/dist/reconciler/signals.js.map +1 -1
- package/dist/reconciler/text.d.ts.map +1 -1
- package/dist/reconciler/text.js +18 -13
- package/dist/reconciler/text.js.map +1 -1
- package/dist/utils/accessible-metadata.d.ts +0 -7
- package/dist/utils/accessible-metadata.d.ts.map +1 -1
- package/dist/utils/accessible-metadata.js +0 -7
- package/dist/utils/accessible-metadata.js.map +1 -1
- package/dist/utils/accessible-props.d.ts +49 -1
- package/dist/utils/accessible-props.d.ts.map +1 -1
- package/dist/utils/accessible-props.js.map +1 -1
- package/dist/utils/ref-prop.d.ts +0 -6
- package/dist/utils/ref-prop.d.ts.map +1 -1
- package/dist/utils/ref-prop.js +0 -6
- package/dist/utils/ref-prop.js.map +1 -1
- package/dist/utils/settings.d.ts +6 -0
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/settings.js.map +1 -1
- package/env.d.ts +11 -4
- package/package.json +5 -5
- package/src/adw/config.ts +1 -0
- package/src/adw/dialog.tsx +1 -0
- package/src/adw/element-behaviors.ts +8 -39
- package/src/adw/element-config.ts +33 -41
- package/src/adw/index.ts +1 -0
- package/src/adw/prop-types.ts +1 -1
- package/src/bootstrap.ts +1 -1
- package/src/components/application.tsx +1 -0
- package/src/components/element.tsx +0 -1
- package/src/components/window.tsx +16 -2
- package/src/config.ts +5 -2
- package/src/element-behaviors.ts +0 -1
- package/src/element-config.ts +12 -8
- package/src/hooks/use-bind-setting.ts +8 -7
- package/src/hooks/use-parent-window.ts +3 -1
- package/src/hooks/use-property.ts +2 -2
- package/src/hooks/use-setting.ts +2 -3
- package/src/hooks/use-signal.ts +20 -10
- package/src/index.ts +10 -2
- package/src/internal.ts +5 -3
- package/src/prop-types.ts +86 -5
- package/src/reconciler/apply-props.ts +12 -6
- package/src/reconciler/behaviors.ts +14 -23
- package/src/reconciler/host-config.ts +3 -8
- package/src/reconciler/instance.ts +1 -1
- package/src/reconciler/metadata.ts +8 -8
- package/src/reconciler/node.ts +3 -3
- package/src/reconciler/placement.ts +33 -13
- package/src/reconciler/registry.ts +70 -41
- package/src/reconciler/root-element.ts +0 -1
- package/src/reconciler/root.ts +9 -26
- package/src/reconciler/signals.ts +16 -37
- package/src/reconciler/text.ts +21 -14
- package/src/utils/accessible-metadata.ts +0 -7
- package/src/utils/accessible-props.ts +49 -1
- package/src/utils/ref-prop.ts +0 -6
- package/src/utils/settings.ts +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-signal.d.ts","sourceRoot":"","sources":["../../src/hooks/use-signal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAA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AAM,EAAE,CAAC;AAEzG;;;GAGG;AACH,KAAK,kBAAkB,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,OAAO,CAAC,CAAC,CAAC,GAC1F,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACb,CAAC,SAAS,GAAG,MAAM,KAAK,KAAK,MAAM,EAAE,GACjC,KAAK,SAAS,MAAM,OAAO,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GACjB,aAAa,GACjB,aAAa,CAAC;AAExB,qCAAqC;AACrC,KAAK,gBAAgB,GAAG;IACpB,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uFAAuF;IACvF,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,iBAAS,SAAS,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,EACzE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EACjC,EAAE,OAAe,EAAE,WAAmB,EAAE,GAAE,gBAAqB,GAChE,IAAI,CAoBN;AAED,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,kBAAkB,EAAE,CAAC"}
|
package/dist/hooks/use-signal.js
CHANGED
|
@@ -6,26 +6,28 @@ import { resolveRefProp } from "../utils/ref-prop.js";
|
|
|
6
6
|
* Each emission runs the handler from the latest render, so it does not have to be stable and a
|
|
7
7
|
* changing handler never reconnects the signal.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* On React 19.2 this does not hold inside a component wrapped in `memo` or `forwardRef`, where every emission
|
|
10
|
+
* runs the handler captured on the first render. Keep the calling component unwrapped, or read the values the
|
|
11
|
+
* handler needs off the GObject itself. React fixes this on the 19.3 line.
|
|
12
|
+
*
|
|
13
|
+
* @param signal The signal name, optionally with a `::detail` suffix.
|
|
14
|
+
* @param options `isAfter` runs the handler after the default handler; `isImmediate` also invokes it on connect.
|
|
13
15
|
*/
|
|
14
|
-
function useSignal(object, signal, handler, {
|
|
16
|
+
function useSignal(object, signal, handler, { isAfter = false, isImmediate = false } = {}) {
|
|
15
17
|
const emit = useEffectEvent(handler);
|
|
16
18
|
useLayoutEffect(() => {
|
|
17
19
|
const resolved = resolveRefProp(object);
|
|
18
20
|
if (!resolved) {
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
|
-
resolved.on(signal, emit,
|
|
22
|
-
if (
|
|
23
|
+
resolved.on(signal, emit, isAfter);
|
|
24
|
+
if (isImmediate) {
|
|
23
25
|
emit();
|
|
24
26
|
}
|
|
25
27
|
return () => {
|
|
26
28
|
resolved.off(signal, emit);
|
|
27
29
|
};
|
|
28
|
-
}, [object, signal,
|
|
30
|
+
}, [object, signal, isAfter, isImmediate]);
|
|
29
31
|
}
|
|
30
32
|
export { useSignal };
|
|
31
33
|
//# sourceMappingURL=use-signal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-signal.js","sourceRoot":"","sources":["../../src/hooks/use-signal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAgB,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-signal.js","sourceRoot":"","sources":["../../src/hooks/use-signal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAgB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AA0BpE;;;;;;;;;;;;GAYG;AACH,SAAS,SAAS,CACd,MAAkB,EAClB,MAAS,EACT,OAAiC,EACjC,EAAE,OAAO,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,KAAuB,EAAE;IAE/D,MAAM,IAAI,GAAG,cAAc,CAAC,OAAwB,CAAC,CAAC;IAEtD,eAAe,CAAC,GAAG,EAAE;QACjB,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO;QACX,CAAC;QAED,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEnC,IAAI,WAAW,EAAE,CAAC;YACd,IAAI,EAAE,CAAC;QACX,CAAC;QAED,OAAO,GAAG,EAAE;YACR,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,OAAO,EAAE,SAAS,EAA4C,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { SignalHandler } from \"@gtkx/runtime\";\nimport { useEffectEvent, useLayoutEffect } from \"react\";\nimport { type RefProp, resolveRefProp } from \"../utils/ref-prop.js\";\n\ntype Signals<T extends GObject.Object> = NonNullable<T[\"__signals__\"]>;\n/** Every signal name `T` declares, on its own or narrowed by a `::detail` suffix. */\ntype SignalName<T extends GObject.Object> = keyof Signals<T> | `${keyof Signals<T> & string}::${string}`;\n\n/**\n * The handler signature `T` declares for signal `S`, looked up through any `::detail` suffix and\n * falling back to an untyped `SignalHandler` when the object declares no such signal.\n */\ntype TypedSignalHandler<T extends GObject.Object, S extends string> = S extends keyof Signals<T>\n ? Signals<T>[S]\n : S extends `${infer TBase}::${string}`\n ? TBase extends keyof Signals<T>\n ? Signals<T>[TBase]\n : SignalHandler\n : SignalHandler;\n\n/** Options for {@link useSignal}. */\ntype UseSignalOptions = {\n /** Runs the handler after the object's own default handler rather than before it. */\n isAfter?: boolean;\n /** Invokes the handler once, with no arguments, as soon as the signal is connected. */\n isImmediate?: boolean;\n};\n\n/**\n * Connects a handler to a GObject signal for the lifetime of the component, reconnecting when the object changes.\n *\n * Each emission runs the handler from the latest render, so it does not have to be stable and a\n * changing handler never reconnects the signal.\n *\n * On React 19.2 this does not hold inside a component wrapped in `memo` or `forwardRef`, where every emission\n * runs the handler captured on the first render. Keep the calling component unwrapped, or read the values the\n * handler needs off the GObject itself. React fixes this on the 19.3 line.\n *\n * @param signal The signal name, optionally with a `::detail` suffix.\n * @param options `isAfter` runs the handler after the default handler; `isImmediate` also invokes it on connect.\n */\nfunction useSignal<T extends GObject.Object, S extends SignalName<T> & string>(\n object: RefProp<T>,\n signal: S,\n handler: TypedSignalHandler<T, S>,\n { isAfter = false, isImmediate = false }: UseSignalOptions = {},\n): void {\n const emit = useEffectEvent(handler as SignalHandler);\n\n useLayoutEffect(() => {\n const resolved = resolveRefProp(object);\n\n if (!resolved) {\n return;\n }\n\n resolved.on(signal, emit, isAfter);\n\n if (isImmediate) {\n emit();\n }\n\n return () => {\n resolved.off(signal, emit);\n };\n }, [object, signal, isAfter, isImmediate]);\n}\n\nexport { useSignal, type SignalName, type TypedSignalHandler };\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import "./bootstrap.js";
|
|
2
|
+
/** @public */
|
|
2
3
|
export { useApplication } from "./hooks/use-application.js";
|
|
4
|
+
/** @public */
|
|
3
5
|
export { useBindSetting } from "./hooks/use-bind-setting.js";
|
|
6
|
+
/** @public */
|
|
4
7
|
export { useParentWindow } from "./hooks/use-parent-window.js";
|
|
8
|
+
/** @public */
|
|
5
9
|
export { useProperty } from "./hooks/use-property.js";
|
|
10
|
+
/** @public */
|
|
6
11
|
export { useSetting } from "./hooks/use-setting.js";
|
|
12
|
+
/** @public */
|
|
7
13
|
export { useSignal } from "./hooks/use-signal.js";
|
|
8
|
-
|
|
14
|
+
/** @public */
|
|
9
15
|
export { type RootElement, rootElement } from "./reconciler/root-element.js";
|
|
16
|
+
/** @public */
|
|
10
17
|
export { createPortal, createRoot, quit, type Root } from "./reconciler/root.js";
|
|
18
|
+
/** @public */
|
|
11
19
|
export type { AccessibleProps } from "./utils/accessible-props.js";
|
|
20
|
+
/** @public */
|
|
12
21
|
export type { RefProp } from "./utils/ref-prop.js";
|
|
13
|
-
export type { SettingsSchema, SettingsSchemaKeys, SettingValue } from "./utils/settings.js";
|
|
14
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,cAAc;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,cAAc;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,cAAc;AACd,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,cAAc;AACd,OAAO,EAAE,KAAK,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC7E,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjF,cAAc;AACd,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,cAAc;AACd,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import "./bootstrap.js";
|
|
2
|
+
/** @public */
|
|
2
3
|
export { useApplication } from "./hooks/use-application.js";
|
|
4
|
+
/** @public */
|
|
3
5
|
export { useBindSetting } from "./hooks/use-bind-setting.js";
|
|
6
|
+
/** @public */
|
|
4
7
|
export { useParentWindow } from "./hooks/use-parent-window.js";
|
|
8
|
+
/** @public */
|
|
5
9
|
export { useProperty } from "./hooks/use-property.js";
|
|
10
|
+
/** @public */
|
|
6
11
|
export { useSetting } from "./hooks/use-setting.js";
|
|
12
|
+
/** @public */
|
|
7
13
|
export { useSignal } from "./hooks/use-signal.js";
|
|
14
|
+
/** @public */
|
|
8
15
|
export { rootElement } from "./reconciler/root-element.js";
|
|
16
|
+
/** @public */
|
|
9
17
|
export { createPortal, createRoot, quit } from "./reconciler/root.js";
|
|
10
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,cAAc;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,cAAc;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,cAAc;AACd,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,cAAc;AACd,OAAO,EAAoB,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC7E,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAa,MAAM,sBAAsB,CAAC","sourcesContent":["import \"./bootstrap.js\";\n\n/** @public */\nexport { useApplication } from \"./hooks/use-application.js\";\n/** @public */\nexport { useBindSetting } from \"./hooks/use-bind-setting.js\";\n/** @public */\nexport { useParentWindow } from \"./hooks/use-parent-window.js\";\n/** @public */\nexport { useProperty } from \"./hooks/use-property.js\";\n/** @public */\nexport { useSetting } from \"./hooks/use-setting.js\";\n/** @public */\nexport { useSignal } from \"./hooks/use-signal.js\";\n/** @public */\nexport { type RootElement, rootElement } from \"./reconciler/root-element.js\";\n/** @public */\nexport { createPortal, createRoot, quit, type Root } from \"./reconciler/root.js\";\n/** @public */\nexport type { AccessibleProps } from \"./utils/accessible-props.js\";\n/** @public */\nexport type { RefProp } from \"./utils/ref-prop.js\";\n"]}
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import "./bootstrap.js";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export { createApplicationComponent } from "./components/application.js";
|
|
3
4
|
export { createElementComponent } from "./components/element.js";
|
|
5
|
+
/** @internal */
|
|
4
6
|
export { createWindowComponent } from "./components/window.js";
|
|
5
|
-
export { ApplicationContext } from "./hooks/use-application.js";
|
|
6
7
|
export { useMergedRef } from "./hooks/use-merged-refs.js";
|
|
7
|
-
export { useObjectValue } from "./hooks/use-object-value.js";
|
|
8
8
|
export type * from "./prop-types.js";
|
|
9
|
+
export type { ModuleExport } from "./reconciler/registry.js";
|
|
9
10
|
export { isRootElement } from "./reconciler/root-element.js";
|
|
10
11
|
export { createReconcilerRoot, type ReconcilerRoot, setReconcilerErrorHandler } from "./reconciler/root.js";
|
|
12
|
+
export { applyWrite } from "./reconciler/signals.js";
|
|
11
13
|
export { getAccessibleMetadata } from "./utils/accessible-metadata.js";
|
|
12
|
-
export {
|
|
14
|
+
export type { SettingsSchema, SettingsSchemaKeys, SettingValue } from "./utils/settings.js";
|
|
13
15
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,mBAAmB,iBAAiB,CAAC;AACrC,YAAY,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC5G,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/internal.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./bootstrap.js";
|
|
2
|
+
/** @internal */
|
|
2
3
|
export { createApplicationComponent } from "./components/application.js";
|
|
3
4
|
export { createElementComponent } from "./components/element.js";
|
|
5
|
+
/** @internal */
|
|
4
6
|
export { createWindowComponent } from "./components/window.js";
|
|
5
|
-
export { ApplicationContext } from "./hooks/use-application.js";
|
|
6
7
|
export { useMergedRef } from "./hooks/use-merged-refs.js";
|
|
7
|
-
export { useObjectValue } from "./hooks/use-object-value.js";
|
|
8
8
|
export { isRootElement } from "./reconciler/root-element.js";
|
|
9
9
|
export { createReconcilerRoot, setReconcilerErrorHandler } from "./reconciler/root.js";
|
|
10
|
+
export { applyWrite } from "./reconciler/signals.js";
|
|
10
11
|
export { getAccessibleMetadata } from "./utils/accessible-metadata.js";
|
|
11
|
-
export { resolveRefProp } from "./utils/ref-prop.js";
|
|
12
12
|
//# sourceMappingURL=internal.js.map
|
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAuB,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC5G,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["import \"./bootstrap.js\";\n\n/** @internal */\nexport { createApplicationComponent } from \"./components/application.js\";\nexport { createElementComponent } from \"./components/element.js\";\n/** @internal */\nexport { createWindowComponent } from \"./components/window.js\";\nexport { useMergedRef } from \"./hooks/use-merged-refs.js\";\nexport type * from \"./prop-types.js\";\nexport type { ModuleExport } from \"./reconciler/registry.js\";\nexport { isRootElement } from \"./reconciler/root-element.js\";\nexport { createReconcilerRoot, type ReconcilerRoot, setReconcilerErrorHandler } from \"./reconciler/root.js\";\nexport { applyWrite } from \"./reconciler/signals.js\";\nexport { getAccessibleMetadata } from \"./utils/accessible-metadata.js\";\nexport type { SettingsSchema, SettingsSchemaKeys, SettingValue } from \"./utils/settings.js\";\n"]}
|
package/dist/prop-types.d.ts
CHANGED
|
@@ -4,106 +4,166 @@ import type * as Gtk from "@gtkx/gi/gtk";
|
|
|
4
4
|
import type { ReactNode } from "react";
|
|
5
5
|
/** One entry of a `GMenu`'s `items` prop; `submenu` and `section` nest further menus. */
|
|
6
6
|
type MenuItem = {
|
|
7
|
+
/** Text shown for the entry, or the heading of the submenu or section it introduces. */
|
|
7
8
|
label?: string | null;
|
|
9
|
+
/** Detailed action name the entry activates, ignored when `submenu` or `section` is given. */
|
|
8
10
|
action?: string | null;
|
|
11
|
+
/** Entries of a separate menu the labelled entry opens. */
|
|
9
12
|
submenu?: MenuItem[];
|
|
13
|
+
/** Entries appended below the label as an inline section, used only when `submenu` is absent. */
|
|
10
14
|
section?: MenuItem[];
|
|
11
15
|
};
|
|
12
16
|
/** One Visual Format Language block applied to a `Gtk.ConstraintLayout`. */
|
|
13
17
|
type VflConstraints = {
|
|
18
|
+
/** Format lines, each describing every constraint on one row or column. */
|
|
14
19
|
lines: string[];
|
|
20
|
+
/** Default horizontal spacing the `-` operator stands for; defaults to 0. */
|
|
15
21
|
hspacing?: number;
|
|
22
|
+
/** Default vertical spacing the `-` operator stands for; defaults to 0. */
|
|
16
23
|
vspacing?: number;
|
|
24
|
+
/** Targets the view names in `lines` refer to; defaults to none. */
|
|
17
25
|
views?: Map<string, Gtk.ConstraintTarget>;
|
|
18
26
|
};
|
|
19
27
|
/** One mark on a `Gtk.Scale`. */
|
|
20
28
|
type ScaleMark = {
|
|
29
|
+
/** Point on the scale the mark is drawn at; defaults to 0. */
|
|
21
30
|
value?: number;
|
|
31
|
+
/** Side of the scale the mark and its label sit on. */
|
|
22
32
|
position: Gtk.PositionType;
|
|
33
|
+
/** Pango markup drawn beside the mark, or `null` for an unlabelled one. */
|
|
23
34
|
markup?: string | null;
|
|
24
35
|
};
|
|
25
36
|
/** One labelled offset on a `Gtk.LevelBar`. */
|
|
26
37
|
type LevelBarOffset = {
|
|
38
|
+
/** Style class applied to the bar's blocks while the value falls in this offset's interval. */
|
|
27
39
|
name: string;
|
|
40
|
+
/** Upper bound of that interval; defaults to 0. */
|
|
28
41
|
value?: number;
|
|
29
42
|
};
|
|
30
43
|
/** One credit section on a `Gtk.AboutDialog`. */
|
|
31
44
|
type CreditSection = {
|
|
45
|
+
/** Heading the names are listed under. */
|
|
32
46
|
sectionName: string;
|
|
47
|
+
/** Names listed in the section. */
|
|
33
48
|
people: string[];
|
|
34
49
|
};
|
|
35
50
|
/** One accelerator binding on a `Gtk.Application`. */
|
|
36
51
|
type ActionAccel = {
|
|
52
|
+
/** Action the accelerators activate, such as `app.quit` or `win.open('file')`. */
|
|
37
53
|
detailedActionName: string;
|
|
54
|
+
/** Accelerators in `Gtk.acceleratorParse` syntax, cleared when the entry goes away. */
|
|
38
55
|
accels: string[];
|
|
39
56
|
};
|
|
40
57
|
/** The drag icon of a `Gtk.DragSource`, with its hotspot. */
|
|
41
58
|
type DragSourceIcon = {
|
|
59
|
+
/** Image shown under the pointer during the drag; defaults to none. */
|
|
42
60
|
paintable?: Gdk.Paintable | null;
|
|
61
|
+
/** Horizontal offset of the pointer within the image; defaults to 0. */
|
|
43
62
|
hotX?: number;
|
|
63
|
+
/** Vertical offset of the pointer within the image; defaults to 0. */
|
|
44
64
|
hotY?: number;
|
|
45
65
|
};
|
|
46
66
|
/** Props of an element that accepts children. */
|
|
47
67
|
type ChildrenProps = {
|
|
68
|
+
/** Elements attached to the element's default child slot, or its text for elements that hold text. */
|
|
48
69
|
children?: ReactNode;
|
|
49
70
|
};
|
|
71
|
+
/** Objects a widget takes through a method call rather than a property. */
|
|
50
72
|
type GtkWidgetProps = {
|
|
73
|
+
/** `Gtk.EventController` elements added to the widget. */
|
|
51
74
|
controllers?: ReactNode | null | undefined;
|
|
75
|
+
/** `Gio.ActionGroup` elements inserted into the widget, each under its own `prefix`. */
|
|
52
76
|
actionGroups?: ReactNode | null | undefined;
|
|
53
77
|
} & ChildrenProps;
|
|
78
|
+
/** Props of an action group placed in a widget's `actionGroups` slot. */
|
|
54
79
|
type GActionGroupProps = {
|
|
80
|
+
/** Prefix the group's actions are addressed by, such as `win`; defaults to the empty string. */
|
|
55
81
|
prefix?: string | null | undefined;
|
|
56
82
|
};
|
|
83
|
+
/** Props of an element implementing `Gio.ActionMap`. */
|
|
57
84
|
type GActionMapProps = {
|
|
85
|
+
/** `Gio.Action` elements added to the map, removed again by their `name`. */
|
|
58
86
|
actions?: ReactNode | null | undefined;
|
|
59
87
|
};
|
|
88
|
+
/** Props of a `Gio.Menu` element. */
|
|
60
89
|
type GMenuProps = {
|
|
90
|
+
/** Entries the menu is rebuilt from whenever they change. */
|
|
61
91
|
items?: MenuItem[] | null | undefined;
|
|
62
92
|
};
|
|
93
|
+
/** Props of a `Gtk.ShortcutController` element. */
|
|
63
94
|
type GtkShortcutControllerProps = {
|
|
95
|
+
/** `Gtk.Shortcut` elements the controller watches for. */
|
|
64
96
|
shortcuts?: ReactNode | null | undefined;
|
|
65
97
|
};
|
|
98
|
+
/** Props of a `Gtk.Overlay` element, whose `children` is the widget the overlays sit above. */
|
|
66
99
|
type GtkOverlayProps = {
|
|
100
|
+
/** Widgets stacked over the main child. */
|
|
67
101
|
overlays?: ReactNode | null | undefined;
|
|
68
102
|
} & ChildrenProps;
|
|
103
|
+
/** Props of a `Gtk.ConstraintLayout` element. */
|
|
69
104
|
type GtkConstraintLayoutProps = {
|
|
105
|
+
/** `Gtk.Constraint` elements added to the layout. */
|
|
70
106
|
constraints?: ReactNode | null | undefined;
|
|
107
|
+
/** `Gtk.ConstraintGuide` elements added to the layout as invisible spacers. */
|
|
71
108
|
guides?: ReactNode | null | undefined;
|
|
109
|
+
/** Visual Format Language blocks whose constraints are added alongside `constraints`. */
|
|
72
110
|
vfl?: VflConstraints[] | null | undefined;
|
|
73
111
|
};
|
|
74
112
|
/** Props of `GtkTextChildAnchor`, which embeds either a child widget or a paintable in a text buffer. */
|
|
75
113
|
type GtkTextChildAnchorProps = {
|
|
114
|
+
/** Image inserted into the buffer instead of an anchored widget; giving both is an error. */
|
|
76
115
|
paintable?: Gdk.Paintable | null | undefined;
|
|
77
116
|
} & ChildrenProps;
|
|
117
|
+
/** Props of a `Gtk.HeaderBar` or `Gtk.ActionBar` element. */
|
|
78
118
|
type GtkHeaderBarProps = {
|
|
119
|
+
/** Widgets packed at the start of the bar. */
|
|
79
120
|
start?: ReactNode | null | undefined;
|
|
121
|
+
/** Widgets packed at the end of the bar. */
|
|
80
122
|
end?: ReactNode | null | undefined;
|
|
81
123
|
};
|
|
124
|
+
/** Props of a `Gtk.Scale` element. */
|
|
82
125
|
type GtkScaleProps = {
|
|
126
|
+
/** Marks drawn along the scale, cleared and re-added whenever the list changes. */
|
|
83
127
|
marks?: ScaleMark[] | null | undefined;
|
|
84
128
|
};
|
|
129
|
+
/** Props of a `Gtk.Calendar` element. */
|
|
85
130
|
type GtkCalendarProps = {
|
|
131
|
+
/** Days of the shown month drawn as marked, cleared and re-marked whenever the list changes. */
|
|
86
132
|
markedDays?: number[] | null | undefined;
|
|
87
133
|
};
|
|
134
|
+
/** Props of a `Gtk.LevelBar` element. */
|
|
88
135
|
type GtkLevelBarProps = {
|
|
136
|
+
/** Offsets that split the bar's range into differently styled intervals. */
|
|
89
137
|
offsets?: LevelBarOffset[] | null | undefined;
|
|
90
138
|
};
|
|
139
|
+
/** Props of a `Gtk.SizeGroup` element. */
|
|
91
140
|
type GtkSizeGroupProps = {
|
|
141
|
+
/** Widgets the group keeps at a common size. */
|
|
92
142
|
widgets?: Gtk.Widget[] | null | undefined;
|
|
93
143
|
};
|
|
144
|
+
/** Props of a `Gtk.AboutDialog` element. */
|
|
94
145
|
type GtkAboutDialogProps = {
|
|
146
|
+
/** Extra sections appended to the dialog's credits, which GTK offers no way to remove. */
|
|
95
147
|
creditSections?: CreditSection[] | null | undefined;
|
|
96
148
|
};
|
|
149
|
+
/** Props of a `Gtk.Application` element, whose `children` are the windows it owns. */
|
|
97
150
|
type GtkApplicationProps = {
|
|
151
|
+
/** Accelerators bound to the application's actions. */
|
|
98
152
|
actionAccels?: ActionAccel[] | null | undefined;
|
|
99
153
|
} & ChildrenProps;
|
|
154
|
+
/** Props of a `Gtk.DropTarget` element. */
|
|
100
155
|
type GtkDropTargetProps = {
|
|
156
|
+
/** GTypes the target accepts a drop of. */
|
|
101
157
|
types?: GObject.Type[] | null | undefined;
|
|
102
158
|
};
|
|
159
|
+
/** Props of a `Gtk.DrawingArea` element. */
|
|
103
160
|
type GtkDrawingAreaProps = {
|
|
161
|
+
/** Callback that draws the area's contents; setting it queues a redraw. */
|
|
104
162
|
drawFunc?: Gtk.DrawingAreaDrawFunc | null | undefined;
|
|
105
163
|
};
|
|
164
|
+
/** Props of a `Gtk.DragSource` element. */
|
|
106
165
|
type GtkDragSourceProps = {
|
|
166
|
+
/** Icon shown under the pointer while a drag started from this source is in flight. */
|
|
107
167
|
icon?: DragSourceIcon | null | undefined;
|
|
108
168
|
};
|
|
109
169
|
export { type MenuItem, type VflConstraints, type ScaleMark, type LevelBarOffset, type CreditSection, type ActionAccel, type DragSourceIcon, type ChildrenProps, type GtkWidgetProps, type GActionGroupProps, type GActionMapProps, type GMenuProps, type GtkShortcutControllerProps, type GtkOverlayProps, type GtkTextChildAnchorProps, type GtkConstraintLayoutProps, type GtkHeaderBarProps, type GtkScaleProps, type GtkCalendarProps, type GtkLevelBarProps, type GtkSizeGroupProps, type GtkAboutDialogProps, type GtkApplicationProps, type GtkDropTargetProps, type GtkDrawingAreaProps, type GtkDragSourceProps, };
|
package/dist/prop-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,KAAK,OA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AA2C;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF,4CAA4C;AAC5C,KAAK,mBAAmB,GAAG;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,GAAG,CAAC,mBAAmB,GAAG,IAAI,GAAG,SAAS,CAAC;CACzD,CAAC;AAEF,2CAA2C;AAC3C,KAAK,kBAAkB,GAAG;IACtB,uFAAuF;IACvF,IAAI,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC;CAC5C,CAAC;AAEF,OAAO,EACH,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GAC1B,CAAC"}
|
package/dist/prop-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.js","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prop-types.js","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"AAmMA,OAAO,EA2BN,CAAC","sourcesContent":["import type * as Gdk from \"@gtkx/gi/gdk\";\nimport type * as GObject from \"@gtkx/gi/gobject\";\nimport type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { ReactNode } from \"react\";\n\n/** One entry of a `GMenu`'s `items` prop; `submenu` and `section` nest further menus. */\ntype MenuItem = {\n /** Text shown for the entry, or the heading of the submenu or section it introduces. */\n label?: string | null;\n /** Detailed action name the entry activates, ignored when `submenu` or `section` is given. */\n action?: string | null;\n /** Entries of a separate menu the labelled entry opens. */\n submenu?: MenuItem[];\n /** Entries appended below the label as an inline section, used only when `submenu` is absent. */\n section?: MenuItem[];\n};\n\n/** One Visual Format Language block applied to a `Gtk.ConstraintLayout`. */\ntype VflConstraints = {\n /** Format lines, each describing every constraint on one row or column. */\n lines: string[];\n /** Default horizontal spacing the `-` operator stands for; defaults to 0. */\n hspacing?: number;\n /** Default vertical spacing the `-` operator stands for; defaults to 0. */\n vspacing?: number;\n /** Targets the view names in `lines` refer to; defaults to none. */\n views?: Map<string, Gtk.ConstraintTarget>;\n};\n\n/** One mark on a `Gtk.Scale`. */\ntype ScaleMark = {\n /** Point on the scale the mark is drawn at; defaults to 0. */\n value?: number;\n /** Side of the scale the mark and its label sit on. */\n position: Gtk.PositionType;\n /** Pango markup drawn beside the mark, or `null` for an unlabelled one. */\n markup?: string | null;\n};\n\n/** One labelled offset on a `Gtk.LevelBar`. */\ntype LevelBarOffset = {\n /** Style class applied to the bar's blocks while the value falls in this offset's interval. */\n name: string;\n /** Upper bound of that interval; defaults to 0. */\n value?: number;\n};\n\n/** One credit section on a `Gtk.AboutDialog`. */\ntype CreditSection = {\n /** Heading the names are listed under. */\n sectionName: string;\n /** Names listed in the section. */\n people: string[];\n};\n\n/** One accelerator binding on a `Gtk.Application`. */\ntype ActionAccel = {\n /** Action the accelerators activate, such as `app.quit` or `win.open('file')`. */\n detailedActionName: string;\n /** Accelerators in `Gtk.acceleratorParse` syntax, cleared when the entry goes away. */\n accels: string[];\n};\n\n/** The drag icon of a `Gtk.DragSource`, with its hotspot. */\ntype DragSourceIcon = {\n /** Image shown under the pointer during the drag; defaults to none. */\n paintable?: Gdk.Paintable | null;\n /** Horizontal offset of the pointer within the image; defaults to 0. */\n hotX?: number;\n /** Vertical offset of the pointer within the image; defaults to 0. */\n hotY?: number;\n};\n\n/** Props of an element that accepts children. */\ntype ChildrenProps = {\n /** Elements attached to the element's default child slot, or its text for elements that hold text. */\n children?: ReactNode;\n};\n\n/** Objects a widget takes through a method call rather than a property. */\ntype GtkWidgetProps = {\n /** `Gtk.EventController` elements added to the widget. */\n controllers?: ReactNode | null | undefined;\n /** `Gio.ActionGroup` elements inserted into the widget, each under its own `prefix`. */\n actionGroups?: ReactNode | null | undefined;\n} & ChildrenProps;\n\n/** Props of an action group placed in a widget's `actionGroups` slot. */\ntype GActionGroupProps = {\n /** Prefix the group's actions are addressed by, such as `win`; defaults to the empty string. */\n prefix?: string | null | undefined;\n};\n\n/** Props of an element implementing `Gio.ActionMap`. */\ntype GActionMapProps = {\n /** `Gio.Action` elements added to the map, removed again by their `name`. */\n actions?: ReactNode | null | undefined;\n};\n\n/** Props of a `Gio.Menu` element. */\ntype GMenuProps = {\n /** Entries the menu is rebuilt from whenever they change. */\n items?: MenuItem[] | null | undefined;\n};\n\n/** Props of a `Gtk.ShortcutController` element. */\ntype GtkShortcutControllerProps = {\n /** `Gtk.Shortcut` elements the controller watches for. */\n shortcuts?: ReactNode | null | undefined;\n};\n\n/** Props of a `Gtk.Overlay` element, whose `children` is the widget the overlays sit above. */\ntype GtkOverlayProps = {\n /** Widgets stacked over the main child. */\n overlays?: ReactNode | null | undefined;\n} & ChildrenProps;\n\n/** Props of a `Gtk.ConstraintLayout` element. */\ntype GtkConstraintLayoutProps = {\n /** `Gtk.Constraint` elements added to the layout. */\n constraints?: ReactNode | null | undefined;\n /** `Gtk.ConstraintGuide` elements added to the layout as invisible spacers. */\n guides?: ReactNode | null | undefined;\n /** Visual Format Language blocks whose constraints are added alongside `constraints`. */\n vfl?: VflConstraints[] | null | undefined;\n};\n\n/** Props of `GtkTextChildAnchor`, which embeds either a child widget or a paintable in a text buffer. */\ntype GtkTextChildAnchorProps = {\n /** Image inserted into the buffer instead of an anchored widget; giving both is an error. */\n paintable?: Gdk.Paintable | null | undefined;\n} & ChildrenProps;\n\n/** Props of a `Gtk.HeaderBar` or `Gtk.ActionBar` element. */\ntype GtkHeaderBarProps = {\n /** Widgets packed at the start of the bar. */\n start?: ReactNode | null | undefined;\n /** Widgets packed at the end of the bar. */\n end?: ReactNode | null | undefined;\n};\n\n/** Props of a `Gtk.Scale` element. */\ntype GtkScaleProps = {\n /** Marks drawn along the scale, cleared and re-added whenever the list changes. */\n marks?: ScaleMark[] | null | undefined;\n};\n\n/** Props of a `Gtk.Calendar` element. */\ntype GtkCalendarProps = {\n /** Days of the shown month drawn as marked, cleared and re-marked whenever the list changes. */\n markedDays?: number[] | null | undefined;\n};\n\n/** Props of a `Gtk.LevelBar` element. */\ntype GtkLevelBarProps = {\n /** Offsets that split the bar's range into differently styled intervals. */\n offsets?: LevelBarOffset[] | null | undefined;\n};\n\n/** Props of a `Gtk.SizeGroup` element. */\ntype GtkSizeGroupProps = {\n /** Widgets the group keeps at a common size. */\n widgets?: Gtk.Widget[] | null | undefined;\n};\n\n/** Props of a `Gtk.AboutDialog` element. */\ntype GtkAboutDialogProps = {\n /** Extra sections appended to the dialog's credits, which GTK offers no way to remove. */\n creditSections?: CreditSection[] | null | undefined;\n};\n\n/** Props of a `Gtk.Application` element, whose `children` are the windows it owns. */\ntype GtkApplicationProps = {\n /** Accelerators bound to the application's actions. */\n actionAccels?: ActionAccel[] | null | undefined;\n} & ChildrenProps;\n\n/** Props of a `Gtk.DropTarget` element. */\ntype GtkDropTargetProps = {\n /** GTypes the target accepts a drop of. */\n types?: GObject.Type[] | null | undefined;\n};\n\n/** Props of a `Gtk.DrawingArea` element. */\ntype GtkDrawingAreaProps = {\n /** Callback that draws the area's contents; setting it queues a redraw. */\n drawFunc?: Gtk.DrawingAreaDrawFunc | null | undefined;\n};\n\n/** Props of a `Gtk.DragSource` element. */\ntype GtkDragSourceProps = {\n /** Icon shown under the pointer while a drag started from this source is in flight. */\n icon?: DragSourceIcon | null | undefined;\n};\n\nexport {\n type MenuItem,\n type VflConstraints,\n type ScaleMark,\n type LevelBarOffset,\n type CreditSection,\n type ActionAccel,\n type DragSourceIcon,\n type ChildrenProps,\n type GtkWidgetProps,\n type GActionGroupProps,\n type GActionMapProps,\n type GMenuProps,\n type GtkShortcutControllerProps,\n type GtkOverlayProps,\n type GtkTextChildAnchorProps,\n type GtkConstraintLayoutProps,\n type GtkHeaderBarProps,\n type GtkScaleProps,\n type GtkCalendarProps,\n type GtkLevelBarProps,\n type GtkSizeGroupProps,\n type GtkAboutDialogProps,\n type GtkApplicationProps,\n type GtkDropTargetProps,\n type GtkDrawingAreaProps,\n type GtkDragSourceProps,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-props.d.ts","sourceRoot":"","sources":["../../src/reconciler/apply-props.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,KAAK,EAAE,MAAM,eAAe,CAAC;AAG5D,OAAO,EAAE,KAAK,WAAW,EAAsB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"apply-props.d.ts","sourceRoot":"","sources":["../../src/reconciler/apply-props.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,KAAK,EAAE,MAAM,eAAe,CAAC;AAG5D,OAAO,EAAE,KAAK,WAAW,EAAsB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AA+GpF,QAAA,MAAM,4BAA4B,GAAI,UAAU,MAAM,EAAE,MAAM,KAAK,EAAE,MAAM,KAAK,KAAG,IAUlF,CAAC;AAqEF,QAAA,MAAM,SAAS,GAAI,MAAM,WAAW,KAAG,IAItC,CAAC;AAQF,QAAA,MAAM,cAAc,QAAO,IAI1B,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,MAAM,WAAW,KAAG,IAM3C,CAAC;AAEF,QAAA,MAAM,gBAAgB,GAAI,MAAM,WAAW,KAAG,IAE7C,CAAC;AAQF,QAAA,MAAM,iBAAiB,GAAI,MAAM,WAAW,EAAE,MAAM,KAAK,EAAE,MAAM,KAAK,KAAG,IASxE,CAAC;AAIF,QAAA,MAAM,iBAAiB,GAAI,QAAQ,YAAY,EAAE,MAAM,KAAK,EAAE,MAAM,KAAK,KAAG,IAc3E,CAAC;AAEF,OAAO,EACH,SAAS,EACT,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,4BAA4B,GAC/B,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { drain, kebabCase } from "@gtkx/utils";
|
|
|
3
3
|
import { applyAccessibleProps, isAccessibleProp } from "../utils/accessible-props.js";
|
|
4
4
|
import { typeInfoFor } from "./metadata.js";
|
|
5
5
|
import { getOrCreateContext } from "./node.js";
|
|
6
|
-
import { connectHandler, disconnectHandler } from "./signals.js";
|
|
6
|
+
import { applyWrite, connectHandler, disconnectHandler } from "./signals.js";
|
|
7
7
|
import { bufferText, hasSameText, isContentPaintableProp, markTextDirty, TEXT_PROP } from "./text.js";
|
|
8
8
|
const REACT_RESERVED_PROPS = new Set(["children", "ref", "key"]);
|
|
9
9
|
const NOTIFY_PREFIX = "onNotify";
|
|
@@ -25,7 +25,9 @@ const writeValue = (object, name, value) => {
|
|
|
25
25
|
if (hasSameText(object, name, value)) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
applyWrite(() => {
|
|
29
|
+
Reflect.set(object, name, value);
|
|
30
|
+
});
|
|
29
31
|
};
|
|
30
32
|
const resetPlain = (object, info, name) => {
|
|
31
33
|
if (Object.hasOwn(info.defaults, name)) {
|
|
@@ -44,9 +46,11 @@ const applyBufferText = (buffer, text) => {
|
|
|
44
46
|
if (bufferText(buffer) === text) {
|
|
45
47
|
return;
|
|
46
48
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
applyWrite(() => {
|
|
50
|
+
buffer.beginIrreversibleAction();
|
|
51
|
+
buffer.setText(text, -1);
|
|
52
|
+
buffer.endIrreversibleAction();
|
|
53
|
+
});
|
|
50
54
|
};
|
|
51
55
|
const isBufferText = (node, name) => name === TEXT_PROP && node.contentKind === "buffer" && node.object instanceof Gtk.TextBuffer;
|
|
52
56
|
const propText = (value) => (typeof value === "string" ? value : JSON.stringify(value));
|
|
@@ -117,7 +121,9 @@ const restoreActionableSensitivity = (node, info, prev, next) => {
|
|
|
117
121
|
}
|
|
118
122
|
const desired = "sensitive" in next ? next.sensitive : info.defaults.sensitive;
|
|
119
123
|
if (typeof desired === "boolean") {
|
|
120
|
-
|
|
124
|
+
applyWrite(() => {
|
|
125
|
+
Reflect.set(node.object, "sensitive", desired);
|
|
126
|
+
});
|
|
121
127
|
}
|
|
122
128
|
};
|
|
123
129
|
const applyHandlers = (target, info, prev, next) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-props.js","sourceRoot":"","sources":["../../src/reconciler/apply-props.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAiB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAoB,kBAAkB,EAAqB,MAAM,WAAW,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,sBAAsB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAMtG,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACjE,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,cAAc,GAAG,IA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C;AAC5C,CAAC,CAAC;AAEF,OAAO,EACH,SAAS,EACT,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,4BAA4B,GAC/B,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { SignalHandler } from \"@gtkx/runtime\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { drain, kebabCase } from \"@gtkx/utils\";\nimport type { ElementBehavior, Props } from \"./registry.js\";\nimport { applyAccessibleProps, isAccessibleProp } from \"../utils/accessible-props.js\";\nimport { type TypeInfo, typeInfoFor } from \"./metadata.js\";\nimport { type ElementNode, getOrCreateContext, type SignalTarget } from \"./node.js\";\nimport { connectHandler, disconnectHandler } from \"./signals.js\";\nimport { bufferText, hasSameText, isContentPaintableProp, markTextDirty, TEXT_PROP } from \"./text.js\";\n\ntype PropDelta = { name: string; value: unknown; prevValue: unknown };\ntype BehaviorUpdateContext = { node: ElementNode; prev: Props; next: Props; consumed: Set<string> };\ntype PropChange = { prev: Props; next: Props };\n\nconst REACT_RESERVED_PROPS = new Set([\"children\", \"ref\", \"key\"]);\nconst NOTIFY_PREFIX = \"onNotify\";\nconst HANDLER_PREFIX = \"on\";\nconst flushDirty: Set<ElementNode> = new Set();\n\nconst isHandlerName = (name: string): boolean => /^on[A-Z]/.test(name);\n\nconst signalForProp = (info: TypeInfo, name: string): string => {\n if (name === NOTIFY_PREFIX) {\n return \"notify\";\n }\n\n if (name.startsWith(NOTIFY_PREFIX) && name.length > NOTIFY_PREFIX.length) {\n return `notify::${kebabCase(name.slice(NOTIFY_PREFIX.length))}`;\n }\n\n return info.signals[name] ?? kebabCase(name.slice(HANDLER_PREFIX.length));\n};\n\nconst isReservedName = (name: string, info: TypeInfo): boolean =>\n REACT_RESERVED_PROPS.has(name) || isHandlerName(name) || isAccessibleProp(name) || info.constructOnly.has(name);\n\nconst isSkippedValueName = (name: string, info: TypeInfo, consumed: Set<string>): boolean =>\n isReservedName(name, info) || consumed.has(name);\n\nconst writeValue = (object: GObject.Object, name: string, value: unknown): void => {\n if (hasSameText(object, name, value)) {\n return;\n }\n\n Reflect.set(object, name, value);\n};\n\nconst resetPlain = (object: GObject.Object, info: TypeInfo, name: string): void => {\n if (Object.hasOwn(info.defaults, name)) {\n writeValue(object, name, info.defaults[name]);\n }\n};\n\nconst setOrReset = (object: GObject.Object, info: TypeInfo, name: string, value: unknown): void => {\n if (value === undefined) {\n resetPlain(object, info, name);\n } else {\n writeValue(object, name, value);\n }\n};\n\nconst applyBufferText = (buffer: Gtk.TextBuffer, text: string): void => {\n if (bufferText(buffer) === text) {\n return;\n }\n\n buffer.beginIrreversibleAction();\n buffer.setText(text, -1);\n buffer.endIrreversibleAction();\n};\n\nconst isBufferText = (node: ElementNode, name: string): node is ElementNode & { object: Gtk.TextBuffer } =>\n name === TEXT_PROP && node.contentKind === \"buffer\" && node.object instanceof Gtk.TextBuffer;\n\nconst propText = (value: unknown): string => (typeof value === \"string\" ? value : JSON.stringify(value));\n\nconst applyEntry = (node: ElementNode, info: TypeInfo, delta: PropDelta): void => {\n const { name, value, prevValue } = delta;\n\n if (value !== undefined && isBufferText(node, name)) {\n applyBufferText(node.object, propText(value));\n\n return;\n }\n\n if (isContentPaintableProp(node, name)) {\n markTextDirty(node);\n\n return;\n }\n\n const isInitialNull = value === null && prevValue === undefined;\n\n if (!isInitialNull) {\n setOrReset(node.object, info, name, value);\n }\n};\n\nconst eachChangedName = (prev: Props, next: Props, visit: (name: string) => void): void => {\n const names = new Set([...Object.keys(prev), ...Object.keys(next)]);\n\n for (const name of names) {\n visit(name);\n }\n};\n\nconst constructOnlyChangeError = (typeName: string, name: string): Error =>\n new Error(\n `Cannot change the construct-only prop '${name}' of <${typeName}> after it is created. ` +\n \"GTK accepts it only while the object is being built, so give the element a key that \" +\n `changes with '${name}' and React will build a new one.`,\n );\n\nconst assertConstructOnlyUnchanged = (typeName: string, prev: Props, next: Props): void => {\n const info = typeInfoFor(typeName);\n\n eachChangedName(prev, next, (name) => {\n if (!info.constructOnly.has(name) || Object.is(prev[name], next[name])) {\n return;\n }\n\n throw constructOnlyChangeError(typeName, name);\n });\n};\n\nconst collectConsumed = (ctx: BehaviorUpdateContext, behavior: ElementBehavior): void => {\n if (behavior.update === undefined) {\n return;\n }\n\n const result = behavior.update(ctx.node.object, ctx.prev, ctx.next, getOrCreateContext(ctx.node, behavior));\n\n if (result === undefined) {\n return;\n }\n\n for (const name of result) {\n ctx.consumed.add(name);\n }\n};\n\nconst runBehaviorUpdates = (node: ElementNode, info: TypeInfo, prev: Props, next: Props): Set<string> => {\n const consumed: Set<string> = new Set();\n const ctx: BehaviorUpdateContext = { node, prev, next, consumed };\n\n for (const behavior of info.behaviors) {\n collectConsumed(ctx, behavior);\n }\n\n return consumed;\n};\n\nconst applyValueEntries = (node: ElementNode, info: TypeInfo, change: PropChange, consumed: Set<string>): void => {\n eachChangedName(change.prev, change.next, (name) => {\n if (isSkippedValueName(name, info, consumed) || Object.is(change.prev[name], change.next[name])) {\n return;\n }\n\n applyEntry(node, info, { name, value: change.next[name], prevValue: change.prev[name] });\n });\n};\n\nconst restoreActionableSensitivity = (node: ElementNode, info: TypeInfo, prev: Props, next: Props): void => {\n if (prev.actionName === undefined || next.actionName !== undefined) {\n return;\n }\n\n const desired = \"sensitive\" in next ? next.sensitive : info.defaults.sensitive;\n\n if (typeof desired === \"boolean\") {\n Reflect.set(node.object, \"sensitive\", desired);\n }\n};\n\nconst applyHandlers = (target: SignalTarget, info: TypeInfo, prev: Props, next: Props): void => {\n eachChangedName(prev, next, (name) => {\n if (!isHandlerName(name)) {\n return;\n }\n\n const value = next[name];\n\n if (typeof value === \"function\") {\n connectHandler(target, name, signalForProp(info, name), value as SignalHandler);\n } else {\n disconnectHandler(target, name);\n }\n });\n};\n\nconst markFlush = (node: ElementNode): void => {\n if (typeInfoFor(node.typeName).hasFlush) {\n flushDirty.add(node);\n }\n};\n\nconst eachBehavior = (node: ElementNode, visit: (behavior: ElementBehavior, context: unknown) => void): void => {\n for (const behavior of typeInfoFor(node.typeName).behaviors) {\n visit(behavior, getOrCreateContext(node, behavior));\n }\n};\n\nconst flushBehaviors = (): void => {\n drain(flushDirty, (node) => {\n eachBehavior(node, (behavior, context) => behavior.flush?.(node.object, context));\n });\n};\n\nconst mountBehaviors = (node: ElementNode): void => {\n if (!typeInfoFor(node.typeName).hasMount) {\n return;\n }\n\n eachBehavior(node, (behavior, context) => behavior.mount?.(node.object, context));\n};\n\nconst unmountBehaviors = (node: ElementNode): void => {\n eachBehavior(node, (behavior, context) => behavior.unmount?.(node.object, context));\n};\n\nconst applyAccessible = (object: GObject.Object, prev: Props, next: Props): void => {\n if (object instanceof Gtk.Widget) {\n applyAccessibleProps(object, prev, next);\n }\n};\n\nconst applyElementProps = (node: ElementNode, prev: Props, next: Props): void => {\n const info = typeInfoFor(node.typeName);\n const consumed = runBehaviorUpdates(node, info, prev, next);\n applyValueEntries(node, info, { prev, next }, consumed);\n restoreActionableSensitivity(node, info, prev, next);\n applyAccessible(node.object, prev, next);\n applyHandlers(node, info, prev, next);\n markFlush(node);\n node.props = next;\n};\n\nconst isSkippedAdoptedName = (info: TypeInfo, name: string): boolean => isReservedName(name, info);\n\nconst applyAdoptedProps = (target: SignalTarget, prev: Props, next: Props): void => {\n const { object, typeName } = target;\n const info = typeInfoFor(typeName);\n\n eachChangedName(prev, next, (name) => {\n if (isSkippedAdoptedName(info, name) || Object.is(prev[name], next[name])) {\n return;\n }\n\n setOrReset(object, info, name, next[name]);\n });\n\n applyAccessible(object, prev, next);\n applyHandlers(target, info, prev, next);\n};\n\nexport {\n markFlush,\n flushBehaviors,\n mountBehaviors,\n unmountBehaviors,\n applyElementProps,\n applyAdoptedProps,\n assertConstructOnlyUnchanged,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"apply-props.js","sourceRoot":"","sources":["../../src/reconciler/apply-props.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAC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cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAEnG,MAAM,iBAAiB,GAAG,CAAC,MAAoB,EAAE,IAAW,EAAE,IAAW,EAAQ,EAAE;IAC/E,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IAEnC,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;QACjC,IAAI,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACxE,OAAO;QACX,CAAC;QAED,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,eAAe,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,OAAO,EACH,SAAS,EACT,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,4BAA4B,GAC/B,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport type { SignalHandler } from \"@gtkx/runtime\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { drain, kebabCase } from \"@gtkx/utils\";\nimport type { ElementBehavior, Props } from \"./registry.js\";\nimport { applyAccessibleProps, isAccessibleProp } from \"../utils/accessible-props.js\";\nimport { type TypeInfo, typeInfoFor } from \"./metadata.js\";\nimport { type ElementNode, getOrCreateContext, type SignalTarget } from \"./node.js\";\nimport { applyWrite, connectHandler, disconnectHandler } from \"./signals.js\";\nimport { bufferText, hasSameText, isContentPaintableProp, markTextDirty, TEXT_PROP } from \"./text.js\";\n\ntype PropDelta = { name: string; value: unknown; prevValue: unknown };\ntype BehaviorUpdateContext = { node: ElementNode; prev: Props; next: Props; consumed: Set<string> };\ntype PropChange = { prev: Props; next: Props };\n\nconst REACT_RESERVED_PROPS = new Set([\"children\", \"ref\", \"key\"]);\nconst NOTIFY_PREFIX = \"onNotify\";\nconst HANDLER_PREFIX = \"on\";\nconst flushDirty: Set<ElementNode> = new Set();\n\nconst isHandlerName = (name: string): boolean => /^on[A-Z]/.test(name);\n\nconst signalForProp = (info: TypeInfo, name: string): string => {\n if (name === NOTIFY_PREFIX) {\n return \"notify\";\n }\n\n if (name.startsWith(NOTIFY_PREFIX) && name.length > NOTIFY_PREFIX.length) {\n return `notify::${kebabCase(name.slice(NOTIFY_PREFIX.length))}`;\n }\n\n return info.signals[name] ?? kebabCase(name.slice(HANDLER_PREFIX.length));\n};\n\nconst isReservedName = (name: string, info: TypeInfo): boolean =>\n REACT_RESERVED_PROPS.has(name) || isHandlerName(name) || isAccessibleProp(name) || info.constructOnly.has(name);\n\nconst isSkippedValueName = (name: string, info: TypeInfo, consumed: Set<string>): boolean =>\n isReservedName(name, info) || consumed.has(name);\n\nconst writeValue = (object: GObject.Object, name: string, value: unknown): void => {\n if (hasSameText(object, name, value)) {\n return;\n }\n\n applyWrite(() => {\n Reflect.set(object, name, value);\n });\n};\n\nconst resetPlain = (object: GObject.Object, info: TypeInfo, name: string): void => {\n if (Object.hasOwn(info.defaults, name)) {\n writeValue(object, name, info.defaults[name]);\n }\n};\n\nconst setOrReset = (object: GObject.Object, info: TypeInfo, name: string, value: unknown): void => {\n if (value === undefined) {\n resetPlain(object, info, name);\n } else {\n writeValue(object, name, value);\n }\n};\n\nconst applyBufferText = (buffer: Gtk.TextBuffer, text: string): void => {\n if (bufferText(buffer) === text) {\n return;\n }\n\n applyWrite(() => {\n buffer.beginIrreversibleAction();\n buffer.setText(text, -1);\n buffer.endIrreversibleAction();\n });\n};\n\nconst isBufferText = (node: ElementNode, name: string): node is ElementNode & { object: Gtk.TextBuffer } =>\n name === TEXT_PROP && node.contentKind === \"buffer\" && node.object instanceof Gtk.TextBuffer;\n\nconst propText = (value: unknown): string => (typeof value === \"string\" ? value : JSON.stringify(value));\n\nconst applyEntry = (node: ElementNode, info: TypeInfo, delta: PropDelta): void => {\n const { name, value, prevValue } = delta;\n\n if (value !== undefined && isBufferText(node, name)) {\n applyBufferText(node.object, propText(value));\n\n return;\n }\n\n if (isContentPaintableProp(node, name)) {\n markTextDirty(node);\n\n return;\n }\n\n const isInitialNull = value === null && prevValue === undefined;\n\n if (!isInitialNull) {\n setOrReset(node.object, info, name, value);\n }\n};\n\nconst eachChangedName = (prev: Props, next: Props, visit: (name: string) => void): void => {\n const names = new Set([...Object.keys(prev), ...Object.keys(next)]);\n\n for (const name of names) {\n visit(name);\n }\n};\n\nconst constructOnlyChangeError = (typeName: string, name: string): Error =>\n new Error(\n `Cannot change the construct-only prop '${name}' of <${typeName}> after it is created. ` +\n \"GTK accepts it only while the object is being built, so give the element a key that \" +\n `changes with '${name}' and React will build a new one.`,\n );\n\nconst assertConstructOnlyUnchanged = (typeName: string, prev: Props, next: Props): void => {\n const info = typeInfoFor(typeName);\n\n eachChangedName(prev, next, (name) => {\n if (!info.constructOnly.has(name) || Object.is(prev[name], next[name])) {\n return;\n }\n\n throw constructOnlyChangeError(typeName, name);\n });\n};\n\nconst collectConsumed = (ctx: BehaviorUpdateContext, behavior: ElementBehavior): void => {\n if (behavior.update === undefined) {\n return;\n }\n\n const result = behavior.update(ctx.node.object, ctx.prev, ctx.next, getOrCreateContext(ctx.node, behavior));\n\n if (result === undefined) {\n return;\n }\n\n for (const name of result) {\n ctx.consumed.add(name);\n }\n};\n\nconst runBehaviorUpdates = (node: ElementNode, info: TypeInfo, prev: Props, next: Props): Set<string> => {\n const consumed: Set<string> = new Set();\n const ctx: BehaviorUpdateContext = { node, prev, next, consumed };\n\n for (const behavior of info.behaviors) {\n collectConsumed(ctx, behavior);\n }\n\n return consumed;\n};\n\nconst applyValueEntries = (node: ElementNode, info: TypeInfo, change: PropChange, consumed: Set<string>): void => {\n eachChangedName(change.prev, change.next, (name) => {\n if (isSkippedValueName(name, info, consumed) || Object.is(change.prev[name], change.next[name])) {\n return;\n }\n\n applyEntry(node, info, { name, value: change.next[name], prevValue: change.prev[name] });\n });\n};\n\nconst restoreActionableSensitivity = (node: ElementNode, info: TypeInfo, prev: Props, next: Props): void => {\n if (prev.actionName === undefined || next.actionName !== undefined) {\n return;\n }\n\n const desired = \"sensitive\" in next ? next.sensitive : info.defaults.sensitive;\n\n if (typeof desired === \"boolean\") {\n applyWrite(() => {\n Reflect.set(node.object, \"sensitive\", desired);\n });\n }\n};\n\nconst applyHandlers = (target: SignalTarget, info: TypeInfo, prev: Props, next: Props): void => {\n eachChangedName(prev, next, (name) => {\n if (!isHandlerName(name)) {\n return;\n }\n\n const value = next[name];\n\n if (typeof value === \"function\") {\n connectHandler(target, name, signalForProp(info, name), value as SignalHandler);\n } else {\n disconnectHandler(target, name);\n }\n });\n};\n\nconst markFlush = (node: ElementNode): void => {\n if (typeInfoFor(node.typeName).hasFlush) {\n flushDirty.add(node);\n }\n};\n\nconst eachBehavior = (node: ElementNode, visit: (behavior: ElementBehavior, context: unknown) => void): void => {\n for (const behavior of typeInfoFor(node.typeName).behaviors) {\n visit(behavior, getOrCreateContext(node, behavior));\n }\n};\n\nconst flushBehaviors = (): void => {\n drain(flushDirty, (node) => {\n eachBehavior(node, (behavior, context) => behavior.flush?.(node.object, context));\n });\n};\n\nconst mountBehaviors = (node: ElementNode): void => {\n if (!typeInfoFor(node.typeName).hasMount) {\n return;\n }\n\n eachBehavior(node, (behavior, context) => behavior.mount?.(node.object, context));\n};\n\nconst unmountBehaviors = (node: ElementNode): void => {\n eachBehavior(node, (behavior, context) => behavior.unmount?.(node.object, context));\n};\n\nconst applyAccessible = (object: GObject.Object, prev: Props, next: Props): void => {\n if (object instanceof Gtk.Widget) {\n applyAccessibleProps(object, prev, next);\n }\n};\n\nconst applyElementProps = (node: ElementNode, prev: Props, next: Props): void => {\n const info = typeInfoFor(node.typeName);\n const consumed = runBehaviorUpdates(node, info, prev, next);\n applyValueEntries(node, info, { prev, next }, consumed);\n restoreActionableSensitivity(node, info, prev, next);\n applyAccessible(node.object, prev, next);\n applyHandlers(node, info, prev, next);\n markFlush(node);\n node.props = next;\n};\n\nconst isSkippedAdoptedName = (info: TypeInfo, name: string): boolean => isReservedName(name, info);\n\nconst applyAdoptedProps = (target: SignalTarget, prev: Props, next: Props): void => {\n const { object, typeName } = target;\n const info = typeInfoFor(typeName);\n\n eachChangedName(prev, next, (name) => {\n if (isSkippedAdoptedName(info, name) || Object.is(prev[name], next[name])) {\n return;\n }\n\n setOrReset(object, info, name, next[name]);\n });\n\n applyAccessible(object, prev, next);\n applyHandlers(target, info, prev, next);\n};\n\nexport {\n markFlush,\n flushBehaviors,\n mountBehaviors,\n unmountBehaviors,\n applyElementProps,\n applyAdoptedProps,\n assertConstructOnlyUnchanged,\n};\n"]}
|
|
@@ -29,31 +29,16 @@ type IndexedInserter = GObject.Object & {
|
|
|
29
29
|
remove: (child: Gtk.Widget) => void;
|
|
30
30
|
insert: (child: Gtk.Widget, position: number) => unknown;
|
|
31
31
|
};
|
|
32
|
-
/** Builds a behavior for a named child slot holding children of `childType`, claiming matches only. */
|
|
33
32
|
declare const slot: <P extends GObject.Object, C extends GObject.Object>(slotName: string, childType: string, hooks: SlotHooks<P, C>) => ElementBehavior;
|
|
34
|
-
/** Builds a scalar-prop behavior that invokes `apply` whenever the value changes, and claims the prop. */
|
|
35
33
|
declare const value: <P extends GObject.Object, V>(prop: string, apply: ValueApply<P, V>) => ElementBehavior<P>;
|
|
36
|
-
/**
|
|
37
|
-
* Builds an array-prop behavior that adds, removes, and clears its items, reapplying on structural
|
|
38
|
-
* change. `add` may return a handle that the same item's later `remove` receives, for items whose
|
|
39
|
-
* teardown needs what `add` produced (as VFL constraints need the objects the layout created).
|
|
40
|
-
*/
|
|
41
34
|
declare const list: <P extends GObject.Object, I, H = void>(prop: string, hooks: ListHooks<P, I, H>) => ElementBehavior<P>;
|
|
42
|
-
/** Builds a behavior for a prop applied after the surrounding commit, deferred until `canApply` returns true. */
|
|
43
35
|
declare const deferred: <P extends GObject.Object, V>(prop: string, canApply?: CanApply<P, V>) => ElementBehavior<P>;
|
|
44
|
-
/** Builds a behavior for a text prop kept in controlled-input sync: set when provided, never reset. */
|
|
45
36
|
declare const controlledText: (prop: string) => ElementBehavior;
|
|
46
|
-
/** Behavior for a container that installs its single child with `setChild`. */
|
|
47
37
|
declare const childSetterSlot: <P extends ChildSetter>() => ElementBehavior<P>;
|
|
48
|
-
/** Behavior for a container that installs its single child with `setContent`. */
|
|
49
38
|
declare const contentSetterSlot: <P extends ContentSetter<C>, C extends Gtk.Widget = Gtk.Widget>(childType?: string) => ElementBehavior<P>;
|
|
50
|
-
/** Behavior for a `GtkBox`-style container that orders children by sibling. */
|
|
51
39
|
declare const boxSlot: <P extends BoxLike>() => ElementBehavior<P>;
|
|
52
|
-
/** Behavior for a container whose children are added and removed by a pair of methods. */
|
|
53
40
|
declare const addRemoveSlot: <C extends GObject.Object, P extends GObject.Object>(slotName: string, childType: string, add: (parent: P, child: C) => unknown, remove: (parent: P, child: C) => void) => ElementBehavior;
|
|
54
|
-
/** Behavior for a `children` slot whose attach call returns the page object the container adopts. */
|
|
55
41
|
declare const adoptedChildrenSlot: <P extends GObject.Object, C extends GObject.Object>(childType: string, add: (parent: P, item: C) => unknown, remove: (parent: P, item: C) => void) => ElementBehavior;
|
|
56
|
-
/** Behavior for an index-placed container that wraps each child in `Wrapper` before adding it. */
|
|
57
42
|
declare const wrappingIndexedSlot: <W extends Gtk.Widget, P extends IndexedInserter>(Wrapper: new (props: Props) => W, setChild: (wrapper: W, inner: Gtk.Widget) => void) => ElementBehavior<P>;
|
|
58
43
|
export { slot, value, list, deferred, controlledText, childSetterSlot, contentSetterSlot, boxSlot, addRemoveSlot, adoptedChildrenSlot, wrappingIndexedSlot, };
|
|
59
44
|
//# sourceMappingURL=behaviors.d.ts.map
|