@gtkx/react 1.0.0-rc.2 → 1.0.0-rc.3
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/dist/adw/element-behaviors.js +6 -36
- package/dist/adw/element-behaviors.js.map +1 -1
- package/dist/adw/element-config.d.ts +3 -1
- package/dist/adw/element-config.d.ts.map +1 -1
- package/dist/adw/element-config.js +26 -36
- package/dist/adw/element-config.js.map +1 -1
- package/dist/components/window.d.ts.map +1 -1
- package/dist/components/window.js +13 -2
- package/dist/components/window.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/element-config.d.ts.map +1 -1
- package/dist/element-config.js +3 -0
- package/dist/element-config.js.map +1 -1
- package/dist/hooks/use-signal.d.ts +4 -0
- package/dist/hooks/use-signal.d.ts.map +1 -1
- package/dist/hooks/use-signal.js +4 -0
- package/dist/hooks/use-signal.js.map +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -0
- package/dist/internal.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.map +1 -1
- package/dist/reconciler/behaviors.js +7 -2
- package/dist/reconciler/behaviors.js.map +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/placement.d.ts.map +1 -1
- package/dist/reconciler/placement.js +24 -8
- package/dist/reconciler/placement.js.map +1 -1
- package/dist/reconciler/registry.d.ts +22 -7
- package/dist/reconciler/registry.d.ts.map +1 -1
- package/dist/reconciler/registry.js +25 -15
- package/dist/reconciler/registry.js.map +1 -1
- package/dist/reconciler/root.d.ts +2 -2
- package/dist/reconciler/root.d.ts.map +1 -1
- package/dist/reconciler/root.js +1 -4
- 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 +13 -25
- package/dist/reconciler/signals.js.map +1 -1
- package/dist/reconciler/text.d.ts.map +1 -1
- package/dist/reconciler/text.js +13 -8
- package/dist/reconciler/text.js.map +1 -1
- package/package.json +4 -4
- package/src/adw/element-behaviors.ts +6 -36
- package/src/adw/element-config.ts +27 -36
- package/src/components/window.tsx +15 -2
- package/src/config.ts +8 -1
- package/src/element-config.ts +3 -0
- package/src/hooks/use-signal.ts +4 -0
- package/src/internal.ts +1 -0
- package/src/reconciler/apply-props.ts +12 -6
- package/src/reconciler/behaviors.ts +8 -2
- package/src/reconciler/host-config.ts +2 -7
- package/src/reconciler/placement.ts +29 -9
- package/src/reconciler/registry.ts +31 -17
- package/src/reconciler/root.ts +3 -6
- package/src/reconciler/signals.ts +15 -36
- package/src/reconciler/text.ts +15 -8
|
@@ -10,25 +10,24 @@ const mergeBehaviors = (base, added, isPrepended) => {
|
|
|
10
10
|
return isPrepended ? [...added, ...baseBehaviors] : [...baseBehaviors, ...added];
|
|
11
11
|
};
|
|
12
12
|
const mergeConfigEntry = (base, added, isPrepended = false) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const { behaviors, lazy, omitProps, ...rest } = added;
|
|
14
|
+
const entry = { ...base, ...rest };
|
|
15
|
+
if (behaviors !== undefined) {
|
|
16
|
+
entry.behaviors = mergeBehaviors(base, behaviors, isPrepended);
|
|
16
17
|
}
|
|
17
|
-
if (
|
|
18
|
-
entry.
|
|
19
|
-
}
|
|
20
|
-
if (added.component !== undefined) {
|
|
21
|
-
entry.component = added.component;
|
|
18
|
+
if (omitProps !== undefined) {
|
|
19
|
+
entry.omitProps = [...(base.omitProps ?? []), ...omitProps];
|
|
22
20
|
}
|
|
23
|
-
if (
|
|
24
|
-
entry.
|
|
21
|
+
if (lazy === true) {
|
|
22
|
+
entry.lazy = true;
|
|
25
23
|
}
|
|
26
24
|
return entry;
|
|
27
25
|
};
|
|
28
26
|
/**
|
|
29
27
|
* Merges maps of {@link ElementConfig} keyed by GLib type name into one, concatenating each type's
|
|
30
|
-
* behaviors in the order the maps are given (an earlier map's behaviors come first)
|
|
31
|
-
* lazy flag, component, and props seen. Use it to combine an app's element config
|
|
28
|
+
* behaviors and omitted props in the order the maps are given (an earlier map's behaviors come first)
|
|
29
|
+
* and taking the last lazy flag, component, and props seen. Use it to combine an app's element config
|
|
30
|
+
* with its behaviors.
|
|
32
31
|
*/
|
|
33
32
|
const mergeElementConfigs = (...maps) => {
|
|
34
33
|
const merged = {};
|
|
@@ -52,13 +51,24 @@ const registerElements = (map, options = {}) => {
|
|
|
52
51
|
};
|
|
53
52
|
/**
|
|
54
53
|
* Identity helper that types the module named by the `elements` entry of `gtkx.config.ts`, enabling
|
|
55
|
-
* editor autocompletion and type checking. Key each entry by GLib type name and
|
|
56
|
-
*
|
|
54
|
+
* editor autocompletion and type checking. Key each entry by GLib type name and write each behavior
|
|
55
|
+
* with {@link defineBehavior} so its hooks receive the concrete GObject class.
|
|
57
56
|
*/
|
|
58
57
|
const defineElements = (elements) => elements;
|
|
58
|
+
/**
|
|
59
|
+
* Types one behavior against the GObject class it applies to, so every hook's object parameter is
|
|
60
|
+
* inferred rather than annotated by hand. Pass the class as the type argument.
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* defineElements({
|
|
64
|
+
* GtkFrame: { behaviors: [defineBehavior<Gtk.Frame>({ attach: (frame, child) => frame.setChild(child) })] },
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
const defineBehavior = (hooks) => hooks;
|
|
59
69
|
/** Spreads one config across many GLib type names. */
|
|
60
70
|
const forTypes = (types, config) => Object.fromEntries(types.map((type) => [type, config]));
|
|
61
71
|
/** References a base props interface exported from `@gtkx/react/internal`. */
|
|
62
72
|
const internal = (name) => ({ module: "@gtkx/react/internal", export: name });
|
|
63
|
-
export { ELEMENTS, deferredProps, mergeElementConfigs, registerElements, defineElements, forTypes, internal, };
|
|
73
|
+
export { ELEMENTS, deferredProps, mergeElementConfigs, registerElements, defineElements, defineBehavior, forTypes, internal, };
|
|
64
74
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/reconciler/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/reconciler/registry.ts"],"names":[],"mappings":"AAiEA;;;GAGG;AACH,MAAM,QAAQ,GAAkC,EAAE,CAAC;AAEnD,wFAAwF;AACxF,MAAM,aAAa,GAAG,CAAC,QAAyB,EAAY,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC;AAEvF,MAAM,cAAc,GAAG,CAAC,IAAmB,EAAE,KAAwB,EAAE,WAAoB,EAAqB,EAAE;IAC9G,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IAE3C,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa,EAAE,GAAG,KAAK,CAAC,CAAC;AACrF,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAmB,EAAE,KAA2B,EAAE,WAAW,GAAG,KAAK,EAAiB,EAAE;IAC9G,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,KAAK,GAAkB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;IAElD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,KAAK,CAAC,SAAS,GAAG,cAAc,CAAC,IAAI,EAAE,SAA8B,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AC;AAEb;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAG,CAA2B,KAAyB,EAA0B,EAAE,CAAC,KAAK,CAAC;AAE9G,sDAAsD;AACtD,MAAM,QAAQ,GAAG,CAAC,KAAe,EAAE,MAA4B,EAAwC,EAAE,CACrG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAE5D,8EAA8E;AAC9E,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAgB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAEpG,OAAO,EACH,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,QAAQ,GAOX,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\n\n/** The props of a host element or node, as React passes them through the reconciler. */\ntype Props = Record<string, unknown>;\n\n/** Per-child values a slot hook receives while placing or moving one child. */\ntype PlaceInfo = {\n slot: string;\n index: number;\n sibling: GObject.Object | null;\n adopted: GObject.Object | null;\n props: Props;\n context: unknown;\n};\n\n/** Per-child values a slot hook receives while removing one child. */\ntype DetachInfo = {\n slot: string;\n adopted: GObject.Object | null;\n props: Props;\n context: unknown;\n};\n\n/**\n * Customizes how one element type places children and applies props. Every hook receives the\n * GObject instance and a private per-node `context` built once by `createContext`. A slot hook\n * claims a child by returning a non-`undefined` value; that value, or `resolve`, is the object\n * the container adopts for the child. `update` returns the prop names it consumed so those props\n * are not also set as plain GObject properties. `create` builds the GObject for types whose\n * constructor does more than set properties, and is consulted for its own type only, never\n * inherited by subtypes.\n */\ntype ElementBehavior<T extends GObject.Object = GObject.Object> = {\n create?: (props: Props) => GObject.Object;\n createContext?: (object: T) => unknown;\n attach?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;\n reorder?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;\n detach?: (object: T, child: GObject.Object, info: DetachInfo) => void;\n resolve?: (object: T, child: GObject.Object) => GObject.Object | null;\n update?: (object: T, prev: Props, next: Props, context: unknown) => Iterable<string> | undefined;\n flush?: (object: T, context: unknown) => void;\n mount?: (object: T, context: unknown) => void;\n unmount?: (object: T, context: unknown) => void;\n deferred?: string[];\n};\n\n/** A named export in a module, referenced as plain data (the module is never imported at runtime). */\ntype ModuleExport = { module: string; export: string };\n\n/**\n * Per-element configuration keyed by GLib type name: whether the element is lazy (its GObject is\n * created by its parent container, as pages and layout children are), the custom behaviors bound to\n * its type, an optional component that wraps the generated element, the base props interface its\n * generated props extend, and the GObject properties to leave out of the generated props (those a\n * behavior already writes from children, such as the `child` and `content` properties). `component`,\n * `props` and `omitProps` are inert at runtime; they are read only by codegen.\n */\ntype ElementConfig<T extends GObject.Object = GObject.Object> = {\n lazy?: boolean;\n behaviors?: ElementBehavior<T>[];\n component?: ModuleExport;\n props?: ModuleExport;\n omitProps?: string[];\n};\n\n/**\n * Every registered element config, keyed by GLib type name. Adwaita entries appear once `@gtkx/react/adw`\n * is loaded.\n */\nconst ELEMENTS: Record<string, ElementConfig> = {};\n\n/** Props a behavior applies after construction; the constructor is never given them. */\nconst deferredProps = (behavior: ElementBehavior): string[] => behavior.deferred ?? [];\n\nconst mergeBehaviors = (base: ElementConfig, added: ElementBehavior[], isPrepended: boolean): ElementBehavior[] => {\n const baseBehaviors = base.behaviors ?? [];\n\n return isPrepended ? [...added, ...baseBehaviors] : [...baseBehaviors, ...added];\n};\n\nconst mergeConfigEntry = (base: ElementConfig, added: ElementConfig<never>, isPrepended = false): ElementConfig => {\n const { behaviors, lazy, omitProps, ...rest } = added;\n const entry: ElementConfig = { ...base, ...rest };\n\n if (behaviors !== undefined) {\n entry.behaviors = mergeBehaviors(base, behaviors as ElementBehavior[], isPrepended);\n }\n\n if (omitProps !== undefined) {\n entry.omitProps = [...(base.omitProps ?? []), ...omitProps];\n }\n\n if (lazy === true) {\n entry.lazy = true;\n }\n\n return entry;\n};\n\n/**\n * Merges maps of {@link ElementConfig} keyed by GLib type name into one, concatenating each type's\n * behaviors and omitted props in the order the maps are given (an earlier map's behaviors come first)\n * and taking the last lazy flag, component, and props seen. Use it to combine an app's element config\n * with its behaviors.\n */\nconst mergeElementConfigs = (...maps: Record<string, ElementConfig<never>>[]): Record<string, ElementConfig> => {\n const merged: Record<string, ElementConfig> = {};\n\n for (const map of maps) {\n for (const [type, config] of Object.entries(map)) {\n merged[type] = mergeConfigEntry(merged[type] ?? {}, config);\n }\n }\n\n return merged;\n};\n\n/**\n * Registers a map of {@link ElementConfig} keyed by GLib type name, merging each entry into the\n * registry. Behaviors are appended by default (the framework's built-ins register this way); pass\n * `{ prepend: true }` for an app's own configuration so its behaviors are consulted before the\n * built-ins for the same slot, letting it override them regardless of registration order.\n */\nconst registerElements = (\n map: Record<string, ElementConfig<never>>,\n options: { prepend?: boolean } = {},\n): void => {\n for (const [type, config] of Object.entries(map)) {\n ELEMENTS[type] = mergeConfigEntry(ELEMENTS[type] ?? {}, config, options.prepend === true);\n }\n};\n\n/**\n * Identity helper that types the module named by the `elements` entry of `gtkx.config.ts`, enabling\n * editor autocompletion and type checking. Key each entry by GLib type name and write each behavior\n * with {@link defineBehavior} so its hooks receive the concrete GObject class.\n */\nconst defineElements = (elements: Record<string, ElementConfig<never>>): Record<string, ElementConfig<never>> =>\n elements;\n\n/**\n * Types one behavior against the GObject class it applies to, so every hook's object parameter is\n * inferred rather than annotated by hand. Pass the class as the type argument.\n *\n * ```ts\n * defineElements({\n * GtkFrame: { behaviors: [defineBehavior<Gtk.Frame>({ attach: (frame, child) => frame.setChild(child) })] },\n * });\n * ```\n */\nconst defineBehavior = <T extends GObject.Object>(hooks: ElementBehavior<T>): ElementBehavior<never> => hooks;\n\n/** Spreads one config across many GLib type names. */\nconst forTypes = (types: string[], config: ElementConfig<never>): Record<string, ElementConfig<never>> =>\n Object.fromEntries(types.map((type) => [type, config]));\n\n/** References a base props interface exported from `@gtkx/react/internal`. */\nconst internal = (name: string): ModuleExport => ({ module: \"@gtkx/react/internal\", export: name });\n\nexport {\n ELEMENTS,\n deferredProps,\n mergeElementConfigs,\n registerElements,\n defineElements,\n defineBehavior,\n forTypes,\n internal,\n type Props,\n type PlaceInfo,\n type DetachInfo,\n type ElementBehavior,\n type ModuleExport,\n type ElementConfig,\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ErrorInfo, ReactNode } from "react";
|
|
1
|
+
import type { ErrorInfo, ReactNode, ReactPortal } from "react";
|
|
2
2
|
import * as Gdk from "@gtkx/gi/gdk";
|
|
3
3
|
import { type Container } from "./host-config.js";
|
|
4
4
|
type RootErrorCallbacks = {
|
|
@@ -51,6 +51,6 @@ declare const quit: () => typeof Gdk.EVENT_STOP;
|
|
|
51
51
|
* @param key An optional stable key.
|
|
52
52
|
* @returns A React portal.
|
|
53
53
|
*/
|
|
54
|
-
declare const createPortal: (children: ReactNode, container: Container, key?: string) =>
|
|
54
|
+
declare const createPortal: (children: ReactNode, container: Container, key?: string) => ReactPortal;
|
|
55
55
|
export { setReconcilerErrorHandler, createReconcilerRoot, createRoot, quit, createPortal, type ReconcilerRoot, type Root, };
|
|
56
56
|
//# sourceMappingURL=root.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/reconciler/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/reconciler/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAGpC,OAAO,EAAE,KAAK,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OG;AACH,QAAA,MAAM,YAAY,GAAI,UAAU,SAAS,EAAE,WAAW,SAAS,EAAE,MAAM,MAAM,KAAG,WACa,CAAC;AAE9F,OAAO,EACH,yBAAyB,EACzB,oBAAoB,EACpB,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,KAAK,cAAc,EACnB,KAAK,IAAI,GACZ,CAAC"}
|
package/dist/reconciler/root.js
CHANGED
|
@@ -3,7 +3,6 @@ import { createLogger } from "@gtkx/utils";
|
|
|
3
3
|
import { ConcurrentRoot } from "react-reconciler/constants.js";
|
|
4
4
|
import { reconciler } from "./host-config.js";
|
|
5
5
|
import { rootElement } from "./root-element.js";
|
|
6
|
-
import { endSuppressionNow } from "./signals.js";
|
|
7
6
|
const log = createLogger("react");
|
|
8
7
|
const activeRoots = new Set();
|
|
9
8
|
const errorHandlerSlot = createErrorHandlerSlot();
|
|
@@ -26,11 +25,9 @@ function createErrorHandlerSlot() {
|
|
|
26
25
|
*/
|
|
27
26
|
const setReconcilerErrorHandler = (handler) => errorHandlerSlot.set(handler);
|
|
28
27
|
const rethrowUncaughtRenderError = (error) => {
|
|
29
|
-
endSuppressionNow();
|
|
30
28
|
throw error;
|
|
31
29
|
};
|
|
32
30
|
const logCaughtRenderError = (error) => {
|
|
33
|
-
endSuppressionNow();
|
|
34
31
|
log.error("caught render error", error);
|
|
35
32
|
};
|
|
36
33
|
const openContainer = (containerInfo, callbacks) => {
|
|
@@ -104,6 +101,6 @@ const quit = () => {
|
|
|
104
101
|
* @param key An optional stable key.
|
|
105
102
|
* @returns A React portal.
|
|
106
103
|
*/
|
|
107
|
-
const createPortal = (children, container, key) =>
|
|
104
|
+
const createPortal = (children, container, key) => reconciler.createPortal(children, container, null, key ?? null);
|
|
108
105
|
export { setReconcilerErrorHandler, createReconcilerRoot, createRoot, quit, createPortal, };
|
|
109
106
|
//# sourceMappingURL=root.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/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IAAI,EAAE,GAAG,IAAI,IAAI,CAA2B,CAAC;AAE9F,OAAO,EACH,yBAAyB,EACzB,oBAAoB,EACpB,UAAU,EACV,IAAI,EACJ,YAAY,GAGf,CAAC","sourcesContent":["import type { ErrorInfo, ReactNode, ReactPortal } from \"react\";\nimport * as Gdk from \"@gtkx/gi/gdk\";\nimport { createLogger, type Logger } from \"@gtkx/utils\";\nimport { ConcurrentRoot } from \"react-reconciler/constants.js\";\nimport { type Container, reconciler } from \"./host-config.js\";\nimport { rootElement } from \"./root-element.js\";\n\ntype OpaqueRoot = { [opaqueRoot]: true };\n\ntype RootErrorCallbacks = {\n onUncaughtError?: (error: unknown, info: ErrorInfo) => void;\n onCaughtError?: (error: unknown, info: ErrorInfo) => void;\n onRecoverableError?: (error: unknown, info: ErrorInfo) => void;\n};\n\ntype ReconcilerRootOptions = RootErrorCallbacks & { containerInfo: Container };\n\n/** A root that mounts an element tree into an explicit container and reports render errors. */\ntype ReconcilerRoot = {\n update: (element: ReactNode) => void;\n unmount: (teardown: (root: ReconcilerRoot) => Promise<void>) => Promise<void>;\n};\n\n/** The object {@link createRoot} returns: it renders an element tree into a container and can tear it down. */\ntype Root = {\n render: (element: ReactNode) => void;\n unmount: () => void;\n};\n\ntype ErrorHandler = (error: unknown) => void;\ntype ErrorHandlerSlot = { get: () => ErrorHandler | null; set: (handler: ErrorHandler) => ErrorHandler | null };\n\ndeclare const opaqueRoot: unique symbol;\nconst log: Logger = createLogger(\"react\");\nconst activeRoots: Set<OpaqueRoot> = new Set();\nconst errorHandlerSlot = createErrorHandlerSlot();\n\nfunction createErrorHandlerSlot(): ErrorHandlerSlot {\n let current: ErrorHandler | null = null;\n\n return {\n get: () => current,\n set: (handler) => {\n const previous = current;\n current = handler;\n\n return previous;\n },\n };\n}\n\n/**\n * Installs a process-wide handler for errors thrown while rendering or applying an update.\n *\n * @param handler The handler to install.\n * @returns The previously installed handler, or null.\n */\nconst setReconcilerErrorHandler = (handler: ErrorHandler): ErrorHandler | null => errorHandlerSlot.set(handler);\n\nconst rethrowUncaughtRenderError = (error: unknown): never => {\n throw error;\n};\n\nconst logCaughtRenderError = (error: unknown): void => {\n log.error(\"caught render error\", error);\n};\n\nconst openContainer = (containerInfo: Container, callbacks: RootErrorCallbacks): OpaqueRoot => {\n const container = reconciler.createContainer(\n containerInfo,\n ConcurrentRoot,\n null,\n false,\n null,\n \"\",\n (error, info) => {\n errorHandlerSlot.get()?.(error);\n callbacks.onUncaughtError?.(error, info);\n },\n (error, info) => {\n errorHandlerSlot.get()?.(error);\n callbacks.onCaughtError?.(error, info);\n },\n (error, info) => {\n callbacks.onRecoverableError?.(error, info);\n },\n (): void => undefined,\n ) as OpaqueRoot;\n\n activeRoots.add(container);\n\n return container;\n};\n\nconst unmountContainer = (container: OpaqueRoot): void => {\n reconciler.updateContainer(null, container, null, null);\n activeRoots.delete(container);\n};\n\n/**\n * Creates a root that mounts an element tree into a container, routing render errors to the supplied callbacks.\n *\n * @param options The container to render into and the error callbacks to route failures to.\n * @returns A {@link ReconcilerRoot}.\n */\nconst createReconcilerRoot = (options: ReconcilerRootOptions): ReconcilerRoot => {\n const container = openContainer(options.containerInfo, options);\n\n const root: ReconcilerRoot = {\n update: (element) => {\n reconciler.updateContainer(element, container, null, null);\n },\n unmount: async (teardown) => {\n await teardown(root);\n activeRoots.delete(container);\n },\n };\n\n return root;\n};\n\n/**\n * Creates a render root for a GTKX application.\n *\n * @param container The top-level container to render into; defaults to the shared {@link rootElement}.\n * @returns A {@link Root} exposing render and unmount.\n */\nconst createRoot = (container: Container = rootElement): Root => {\n const opaque = openContainer(container, {\n onUncaughtError: rethrowUncaughtRenderError,\n onCaughtError: logCaughtRenderError,\n });\n\n return {\n render: (element) => {\n reconciler.updateContainer(element, opaque, null, null);\n },\n unmount: () => {\n unmountContainer(opaque);\n },\n };\n};\n\n/** Unmounts every active render root and stops the originating signal from propagating further. */\nconst quit = (): typeof Gdk.EVENT_STOP => {\n for (const container of activeRoots) {\n unmountContainer(container);\n }\n\n return Gdk.EVENT_STOP;\n};\n\n/**\n * Renders children into a container other than the surrounding tree.\n *\n * @param children The element tree to render.\n * @param container The GObject, application, or {@link rootElement} to render into.\n * @param key An optional stable key.\n * @returns A React portal.\n */\nconst createPortal = (children: ReactNode, container: Container, key?: string): ReactPortal =>\n reconciler.createPortal(children, container, null, key ?? null) as unknown as ReactPortal;\n\nexport {\n setReconcilerErrorHandler,\n createReconcilerRoot,\n createRoot,\n quit,\n createPortal,\n type ReconcilerRoot,\n type Root,\n};\n"]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type SignalHandler } from "@gtkx/runtime";
|
|
2
2
|
import type { SignalTarget } from "./node.js";
|
|
3
|
-
declare const
|
|
4
|
-
declare const
|
|
5
|
-
declare const endSuppressionNow: () => void;
|
|
3
|
+
declare const isApplyingWrite: () => boolean;
|
|
4
|
+
declare const applyWrite: <T>(write: () => T) => T;
|
|
6
5
|
declare const connectHandler: (target: SignalTarget, prop: string, signal: string, handler: SignalHandler) => void;
|
|
7
6
|
declare const disconnectHandler: (target: SignalTarget, prop: string) => void;
|
|
8
7
|
declare const disconnectAllHandlers: (target: SignalTarget) => void;
|
|
9
|
-
export {
|
|
8
|
+
export { applyWrite, isApplyingWrite, connectHandler, disconnectHandler, disconnectAllHandlers, };
|
|
10
9
|
//# sourceMappingURL=signals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/reconciler/signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/reconciler/signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,WAAW,CAAC;AAM7D,QAAA,MAAM,eAAe,QAAO,OAA+B,CAAC;AAE5D,QAAA,MAAM,UAAU,GAAI,CAAC,EAAE,OAAO,MAAM,CAAC,KAAG,CAQvC,CAAC;AA2BF,QAAA,MAAM,cAAc,GAAI,QAAQ,YAAY,EAAE,MAAM,MAAM,EAAE,QAAQ,MAAM,EAAE,SAAS,aAAa,KAAG,IAmBpG,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,QAAQ,YAAY,EAAE,MAAM,MAAM,KAAG,IAS/D,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAI,QAAQ,YAAY,KAAG,IAMrD,CAAC;AAEF,OAAO,EACH,UAAU,EACV,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,qBAAqB,GACxB,CAAC"}
|
|
@@ -2,36 +2,24 @@ import { getSignalBaseName } from "@gtkx/runtime";
|
|
|
2
2
|
import { camelCase } from "@gtkx/utils";
|
|
3
3
|
import { typeInfoFor } from "./metadata.js";
|
|
4
4
|
const NOTIFY_DETAIL_PREFIX = "notify::";
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
return {
|
|
18
|
-
beginSuppression: () => {
|
|
19
|
-
depth += 1;
|
|
20
|
-
},
|
|
21
|
-
endSuppression: () => {
|
|
22
|
-
queueMicrotask(release);
|
|
23
|
-
},
|
|
24
|
-
endSuppressionNow: release,
|
|
25
|
-
isSuppressed: () => depth > 0,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
5
|
+
const writeState = { depth: 0 };
|
|
6
|
+
const isApplyingWrite = () => writeState.depth > 0;
|
|
7
|
+
const applyWrite = (write) => {
|
|
8
|
+
writeState.depth += 1;
|
|
9
|
+
try {
|
|
10
|
+
return write();
|
|
11
|
+
}
|
|
12
|
+
finally {
|
|
13
|
+
writeState.depth = Math.max(0, writeState.depth - 1);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
28
16
|
const getNotifyProperty = (signal) => signal.startsWith(NOTIFY_DETAIL_PREFIX) ? camelCase(signal.slice(NOTIFY_DETAIL_PREFIX.length)) : null;
|
|
29
17
|
const isBlockableSignal = (info, signal) => info.userEventSignals.has(getSignalBaseName(signal));
|
|
30
18
|
const invokeHandler = (target, record, notifyProperty, args) => notifyProperty === null
|
|
31
19
|
? record.handler(...args, target.object)
|
|
32
20
|
: record.handler(Reflect.get(target.object, notifyProperty), target.object);
|
|
33
21
|
const wrapHandler = (target, record, notifyProperty) => (...args) => {
|
|
34
|
-
if (record.blockable &&
|
|
22
|
+
if (record.blockable && isApplyingWrite()) {
|
|
35
23
|
return undefined;
|
|
36
24
|
}
|
|
37
25
|
return target.dispatch(() => invokeHandler(target, record, notifyProperty, args));
|
|
@@ -66,5 +54,5 @@ const disconnectAllHandlers = (target) => {
|
|
|
66
54
|
}
|
|
67
55
|
target.handlers.clear();
|
|
68
56
|
};
|
|
69
|
-
export {
|
|
57
|
+
export { applyWrite, isApplyingWrite, connectHandler, disconnectHandler, disconnectAllHandlers, };
|
|
70
58
|
//# sourceMappingURL=signals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../src/reconciler/signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAiB,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../src/reconciler/signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAiB,W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zC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,MAAoB,EAAE,IAAY,EAAQ,EAAE;IACnE,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEzC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO;IACX,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,MAAoB,EAAQ,EAAE;IACzD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QAC5C,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC5B,CAAC,CAAC;AAEF,OAAO,EACH,UAAU,EACV,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,qBAAqB,GACxB,CAAC","sourcesContent":["import { getSignalBaseName, type SignalHandler } from \"@gtkx/runtime\";\nimport { camelCase } from \"@gtkx/utils\";\nimport type { HandlerRecord, SignalTarget } from \"./node.js\";\nimport { type TypeInfo, typeInfoFor } from \"./metadata.js\";\n\nconst NOTIFY_DETAIL_PREFIX = \"notify::\";\nconst writeState: { depth: number } = { depth: 0 };\n\nconst isApplyingWrite = (): boolean => writeState.depth > 0;\n\nconst applyWrite = <T>(write: () => T): T => {\n writeState.depth += 1;\n\n try {\n return write();\n } finally {\n writeState.depth = Math.max(0, writeState.depth - 1);\n }\n};\n\nconst getNotifyProperty = (signal: string): string | null =>\n signal.startsWith(NOTIFY_DETAIL_PREFIX) ? camelCase(signal.slice(NOTIFY_DETAIL_PREFIX.length)) : null;\n\nconst isBlockableSignal = (info: TypeInfo, signal: string): boolean =>\n info.userEventSignals.has(getSignalBaseName(signal));\n\nconst invokeHandler = (\n target: SignalTarget,\n record: HandlerRecord,\n notifyProperty: string | null,\n args: unknown[],\n): unknown =>\n notifyProperty === null\n ? record.handler(...args, target.object)\n : record.handler(Reflect.get(target.object, notifyProperty), target.object);\n\nconst wrapHandler = (target: SignalTarget, record: HandlerRecord, notifyProperty: string | null): SignalHandler =>\n (...args: unknown[]): unknown => {\n if (record.blockable && isApplyingWrite()) {\n return undefined;\n }\n\n return target.dispatch(() => invokeHandler(target, record, notifyProperty, args));\n };\n\nconst connectHandler = (target: SignalTarget, prop: string, signal: string, handler: SignalHandler): void => {\n const existing = target.handlers.get(prop);\n\n if (existing?.signal === signal) {\n existing.handler = handler;\n\n return;\n }\n\n if (existing !== undefined) {\n target.object.off(existing.signal, existing.wrapped);\n }\n\n const isBlockable = isBlockableSignal(typeInfoFor(target.typeName), signal);\n const notifyProperty = getNotifyProperty(signal);\n const record: HandlerRecord = { signal, handler, wrapped: (): undefined => undefined, blockable: isBlockable };\n record.wrapped = wrapHandler(target, record, notifyProperty);\n target.object.on(signal, record.wrapped);\n target.handlers.set(prop, record);\n};\n\nconst disconnectHandler = (target: SignalTarget, prop: string): void => {\n const record = target.handlers.get(prop);\n\n if (record === undefined) {\n return;\n }\n\n target.object.off(record.signal, record.wrapped);\n target.handlers.delete(prop);\n};\n\nconst disconnectAllHandlers = (target: SignalTarget): void => {\n for (const record of target.handlers.values()) {\n target.object.off(record.signal, record.wrapped);\n }\n\n target.handlers.clear();\n};\n\nexport {\n applyWrite,\n isApplyingWrite,\n connectHandler,\n disconnectHandler,\n disconnectAllHandlers,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot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AO,YAAY,KAAG,IAQ/D,CAAC;AAEF,QAAA,MAAM,kBAAkB,GAAI,MAAM,WAAW,EAAE,OAAO,KAAK,KAAG,IAY7D,CAAC;AAsDF,QAAA,MAAM,sBAAsB,GAAI,MAAM,WAAW,EAAE,MAAM,MAAM,KAAG,OACN,CAAC;AA6F7D,QAAA,MAAM,cAAc,QAAO,IAQ1B,CAAC;AAiBF,QAAA,MAAM,uBAAuB,GAAI,MAAM,WAAW,EAAE,MAAM,QAAQ,EAAE,SAAS,MAAM,EAAE,SAAS,MAAM,KAAG,OAyBtG,CAAC;AAEF,OAAO,EACH,SAAS,EACT,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,uBAAuB,GAC1B,CAAC"}
|
package/dist/reconciler/text.js
CHANGED
|
@@ -2,6 +2,7 @@ import * as Gdk from "@gtkx/gi/gdk";
|
|
|
2
2
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
3
|
import { drain, indexBeforeOrEnd } from "@gtkx/utils";
|
|
4
4
|
import { ELEMENT_KIND, TEXT_KIND } from "./node.js";
|
|
5
|
+
import { applyWrite } from "./signals.js";
|
|
5
6
|
const dirtyHosts = new Set();
|
|
6
7
|
const tagTables = new WeakMap();
|
|
7
8
|
const TEXT_CONTENT_KINDS = new Set(["label", "buffer", "tag"]);
|
|
@@ -220,12 +221,14 @@ const rebuildBuffer = (node) => {
|
|
|
220
221
|
if (node.props.text !== undefined || !(buffer instanceof Gtk.TextBuffer)) {
|
|
221
222
|
return;
|
|
222
223
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
224
|
+
applyWrite(() => {
|
|
225
|
+
buffer.setText("", -1);
|
|
226
|
+
const build = { buffer, view: node.bufferView, marks: [] };
|
|
227
|
+
insertContent(build, node.content);
|
|
228
|
+
for (const mark of build.marks) {
|
|
229
|
+
placeMark(buffer, mark.node, mark.offset);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
229
232
|
};
|
|
230
233
|
const rebuildLabel = (node) => {
|
|
231
234
|
if (node.props.label !== undefined) {
|
|
@@ -265,8 +268,10 @@ const didUpdateTextSurgically = (host, node, oldText, newText) => {
|
|
|
265
268
|
return false;
|
|
266
269
|
}
|
|
267
270
|
const start = located.offset;
|
|
268
|
-
|
|
269
|
-
|
|
271
|
+
applyWrite(() => {
|
|
272
|
+
buffer.delete(buffer.getIterAtOffset(start), buffer.getIterAtOffset(start + charLength(oldText)));
|
|
273
|
+
buffer.insert(buffer.getIterAtOffset(start), newText, -1);
|
|
274
|
+
});
|
|
270
275
|
const startIter = buffer.getIterAtOffset(start);
|
|
271
276
|
const endIter = buffer.getIterAtOffset(start + charLength(newText));
|
|
272
277
|
applyEnclosingTags(buffer, node, startIter, endIter);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/reconciler/text.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAUpD,MAAM,UAAU,GAAqB,IAAI,GAAG,EAAE,CAAC;AAC/C,MAAM,SAAS,GAAsC,IAAI,OAAO,EAAE,CAAC;AACnE,MAAM,kBAAkB,GAAgB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5E,MAAM,cAAc,GAAG,WAAW,CAAC;AACnC,MAAM,SAAS,GAAG,MAAM,CAAC;AAEzB,MAAM,iBAAiB,GAA2D;IAC9E;QACI,IAAI,EAAE,OAAO;QACb,IAAI,EAAE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k\";\nimport { drain, indexBeforeOrEnd } from \"@gtkx/utils\";\nimport type { ContentChild, ContentKind, ElementNode, ParentNode, TextNode } from \"./node.js\";\nimport type { Props } from \"./registry.js\";\nimport { ELEMENT_KIND, TEXT_KIND } from \"./node.js\";\n\ntype OffsetResult = { found: boolean; offset: number };\n\ntype BufferBuild = {\n buffer: Gtk.TextBuffer;\n view: Gtk.TextView | null;\n marks: { node: ElementNode; offset: number }[];\n};\n\nconst dirtyHosts: Set<ElementNode> = new Set();\nconst tagTables: WeakMap<object, Gtk.TextTagTable> = new WeakMap();\nconst TEXT_CONTENT_KINDS: Set<string> = new Set([\"label\", \"buffer\", \"tag\"]);\nconst PAINTABLE_PROP = \"paintable\";\nconst TEXT_PROP = \"text\";\n\nconst CONTENT_MIX_RULES: { kind: ContentKind; prop: string; message: string }[] = [\n {\n kind: \"label\",\n prop: \"label\",\n message: \"<GtkLabel> cannot mix a `label` prop with text children; use one or the other\",\n },\n {\n kind: \"buffer\",\n prop: \"text\",\n message: \"<GtkTextBuffer> cannot mix a `text` prop with content children; use one or the other\",\n },\n {\n kind: \"anchor\",\n prop: PAINTABLE_PROP,\n message: \"<GtkTextChildAnchor> cannot mix a `paintable` prop with a child widget; use one or the other\",\n },\n];\n\nconst charLength = (text: string): number => text[Symbol.iterator]().toArray().length;\n\nconst bufferText = (buffer: Gtk.TextBuffer): string =>\n buffer.getText(buffer.getStartIter(), buffer.getEndIter(), false);\n\nconst currentText = (object: GObject.Object): string | null => {\n if (object instanceof Gtk.TextBuffer) {\n return bufferText(object);\n }\n\n if (object instanceof Gtk.Editable || object instanceof Gtk.EntryBuffer) {\n return object.getText();\n }\n\n return null;\n};\n\nconst hasSameText = (object: GObject.Object, prop: string, value: unknown): boolean =>\n prop === TEXT_PROP && typeof value === \"string\" && currentText(object) === value;\n\nconst contentTextLength = (node: ContentChild): number => {\n if (node.kind === TEXT_KIND) {\n return charLength(node.text);\n }\n\n if (node.contentKind === \"tag\") {\n return node.content.reduce((sum, child) => sum + contentTextLength(child), 0);\n }\n\n return node.contentKind === \"anchor\" ? 1 : 0;\n};\n\nconst isTagElement = (node: ContentChild): node is ElementNode =>\n node.kind === ELEMENT_KIND && node.contentKind === \"tag\";\n\nconst stepOffset = (node: ContentChild, target: TextNode, offset: number): OffsetResult => {\n if (node === target) {\n return { found: true, offset };\n }\n\n if (isTagElement(node)) {\n return getOffset(node.content, target, offset);\n }\n\n return { found: false, offset: offset + contentTextLength(node) };\n};\n\nconst getOffset = (nodes: ContentChild[], target: TextNode, start: number): OffsetResult => {\n let offset = start;\n\n for (const node of nodes) {\n const step = stepOffset(node, target, offset);\n\n if (step.found) {\n return step;\n }\n\n offset = step.offset;\n }\n\n return { found: false, offset };\n};\n\nconst enclosingTagNodes = (node: TextNode): ElementNode[] => {\n const nodes: ElementNode[] = [];\n let current: ParentNode | null = node.parent;\n\n while (current !== null && current.kind === ELEMENT_KIND) {\n if (current.contentKind === \"tag\") {\n nodes.push(current);\n }\n\n current = current.parent;\n }\n\n return nodes;\n};\n\nconst textRestrictionError = (text: string): Error =>\n new Error(\n \"Text strings must be rendered within a <GtkLabel> or <GtkTextBuffer> element; \" +\n `received ${JSON.stringify(text)}`,\n );\n\nconst canAcceptText = (host: ElementNode): boolean =>\n host.contentKind !== null && TEXT_CONTENT_KINDS.has(host.contentKind);\n\nconst isRootHost = (node: ElementNode): boolean => node.contentKind === \"label\" || node.contentKind === \"buffer\";\n\nconst mapElementParent = <T>(parent: ParentNode | null, map: (element: ElementNode) => T): T | null =>\n parent !== null && parent.kind === ELEMENT_KIND ? map(parent) : null;\n\nconst parentElement = (node: ElementNode): ElementNode | null => mapElementParent(node.parent, (parent) => parent);\n\nconst getRootHost = (node: ElementNode): ElementNode | null => {\n let current: ElementNode | null = node;\n\n while (current !== null) {\n if (isRootHost(current)) {\n return current;\n }\n\n current = parentElement(current);\n }\n\n return null;\n};\n\nconst markTextDirty = (host: ElementNode): void => {\n const root = getRootHost(host);\n\n if (root !== null) {\n dirtyHosts.add(root);\n }\n};\n\nconst enclosingHost = (node: TextNode): ElementNode | null => mapElementParent(node.parent, getRootHost);\n\nconst addContent = (host: ElementNode, child: ContentChild, before: ContentChild | null): void => {\n const content = host.content;\n const existing = content.indexOf(child);\n\n if (existing !== -1) {\n content.splice(existing, 1);\n }\n\n content.splice(\n indexBeforeOrEnd(content, before, (item, target) => item === target),\n 0,\n child,\n );\n\n child.parent = host;\n markTextDirty(host);\n};\n\nconst removeContent = (host: ElementNode, child: ContentChild): void => {\n const index = host.content.indexOf(child);\n\n if (index !== -1) {\n host.content.splice(index, 1);\n }\n\n markTextDirty(host);\n};\n\nconst validateContentMix = (node: ElementNode, props: Props): void => {\n if (node.content.length === 0) {\n return;\n }\n\n const violated = CONTENT_MIX_RULES.find(\n (rule) => rule.kind === node.contentKind && props[rule.prop] !== undefined,\n );\n\n if (violated !== undefined) {\n throw new Error(violated.message);\n }\n};\n\nconst detachTag = (tag: Gtk.TextTag, table: Gtk.TextTagTable, name: string | null): void => {\n const previous = tagTables.get(tag);\n\n if (previous !== undefined && previous !== table) {\n previous.remove(tag);\n }\n\n if (name === null) {\n return;\n }\n\n const existing = table.lookup(name);\n\n if (existing !== null && existing !== tag) {\n table.remove(existing);\n }\n};\n\nconst ensureTag = (table: Gtk.TextTagTable, node: ElementNode): void => {\n const tag = node.object;\n\n if (!(tag instanceof Gtk.TextTag) || tagTables.get(tag) === table) {\n return;\n }\n\n const name = typeof node.props.name === \"string\" ? node.props.name : null;\n detachTag(tag, table, name);\n\n if (name === null || table.lookup(name) !== tag) {\n table.add(tag);\n }\n\n tagTables.set(tag, table);\n};\n\nconst insertTag = (build: BufferBuild, node: ElementNode): void => {\n const start = build.buffer.getCharCount();\n insertContent(build, node.content);\n const tag = node.object;\n\n if (tag instanceof Gtk.TextTag) {\n ensureTag(build.buffer.getTagTable(), node);\n build.buffer.applyTag(tag, build.buffer.getIterAtOffset(start), build.buffer.getEndIter());\n }\n};\n\nconst contentPaintable = (node: ElementNode): Gdk.Paintable | null => {\n const value = node.props[PAINTABLE_PROP];\n\n return value instanceof Gdk.Paintable ? value : null;\n};\n\nconst isContentPaintableProp = (node: ElementNode, name: string): boolean =>\n name === PAINTABLE_PROP && node.contentKind === \"anchor\";\n\nconst insertAnchor = (build: BufferBuild, node: ElementNode): void => {\n const paintable = contentPaintable(node);\n\n if (paintable !== null) {\n build.buffer.insertPaintable(build.buffer.getEndIter(), paintable);\n\n return;\n }\n\n const anchor = node.object;\n\n if (!(anchor instanceof Gtk.TextChildAnchor)) {\n return;\n }\n\n build.buffer.insertChildAnchor(build.buffer.getEndIter(), anchor);\n const child = node.content[0];\n\n if (build.view !== null && child?.kind === ELEMENT_KIND && child.object instanceof Gtk.Widget) {\n build.view.addChildAtAnchor(child.object, anchor);\n }\n};\n\nconst insertElement = (build: BufferBuild, node: ElementNode): void => {\n if (node.contentKind === \"tag\") {\n insertTag(build, node);\n } else if (node.contentKind === \"anchor\") {\n insertAnchor(build, node);\n } else {\n build.marks.push({ node, offset: build.buffer.getCharCount() });\n }\n};\n\nconst insertContent = (build: BufferBuild, nodes: ContentChild[]): void => {\n for (const child of nodes) {\n if (child.kind === TEXT_KIND) {\n build.buffer.insert(build.buffer.getEndIter(), child.text, -1);\n } else {\n insertElement(build, child);\n }\n }\n};\n\nconst placeMark = (buffer: Gtk.TextBuffer, node: ElementNode, offset: number): void => {\n const mark = node.object;\n\n if (!(mark instanceof Gtk.TextMark)) {\n return;\n }\n\n const iter = buffer.getIterAtOffset(offset);\n\n if (mark.getBuffer() === null) {\n buffer.addMark(mark, iter);\n } else {\n buffer.moveMark(mark, iter);\n }\n};\n\nconst rebuildBuffer = (node: ElementNode): void => {\n const buffer = node.object;\n\n if (node.props.text !== undefined || !(buffer instanceof Gtk.TextBuffer)) {\n return;\n }\n\n buffer.setText(\"\", -1);\n const build: BufferBuild = { buffer, view: node.bufferView, marks: [] };\n insertContent(build, node.content);\n\n for (const mark of build.marks) {\n placeMark(buffer, mark.node, mark.offset);\n }\n};\n\nconst rebuildLabel = (node: ElementNode): void => {\n if (node.props.label !== undefined) {\n return;\n }\n\n const label = node.object;\n\n if (!(label instanceof Gtk.Label)) {\n return;\n }\n\n label.setLabel(node.content.map((child) => (child.kind === TEXT_KIND ? child.text : \"\")).join(\"\"));\n};\n\nconst flushTextHosts = (): void => {\n drain(dirtyHosts, (host) => {\n if (host.contentKind === \"label\") {\n rebuildLabel(host);\n } else if (host.contentKind === \"buffer\") {\n rebuildBuffer(host);\n }\n });\n};\n\nconst applyEnclosingTags = (\n buffer: Gtk.TextBuffer,\n node: TextNode,\n startIter: Gtk.TextIter,\n endIter: Gtk.TextIter,\n): void => {\n for (const tagNode of enclosingTagNodes(node)) {\n ensureTag(buffer.getTagTable(), tagNode);\n\n if (tagNode.object instanceof Gtk.TextTag) {\n buffer.applyTag(tagNode.object, startIter, endIter);\n }\n }\n};\n\nconst didUpdateTextSurgically = (host: ElementNode, node: TextNode, oldText: string, newText: string): boolean => {\n const buffer = host.object;\n\n if (host.contentKind !== \"buffer\" || !(buffer instanceof Gtk.TextBuffer)) {\n return false;\n }\n\n const located = getOffset(host.content, node, 0);\n\n if (!located.found) {\n return false;\n }\n\n const start = located.offset;\n buffer.delete(buffer.getIterAtOffset(start), buffer.getIterAtOffset(start + charLength(oldText)));\n buffer.insert(buffer.getIterAtOffset(start), newText, -1);\n const startIter = buffer.getIterAtOffset(start);\n const endIter = buffer.getIterAtOffset(start + charLength(newText));\n applyEnclosingTags(buffer, node, startIter, endIter);\n\n return true;\n};\n\nexport {\n TEXT_PROP,\n textRestrictionError,\n bufferText,\n hasSameText,\n canAcceptText,\n isContentPaintableProp,\n markTextDirty,\n enclosingHost,\n addContent,\n removeContent,\n validateContentMix,\n flushTextHosts,\n didUpdateTextSurgically,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/reconciler/text.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,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AM,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,kBAAkB,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAErD,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,OAAO,EACH,SAAS,EACT,oBAAoB,EACpB,UAAU,EACV,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,uBAAuB,GAC1B,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gdk from \"@gtkx/gi/gdk\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { drain, indexBeforeOrEnd } from \"@gtkx/utils\";\nimport type { ContentChild, ContentKind, ElementNode, ParentNode, TextNode } from \"./node.js\";\nimport type { Props } from \"./registry.js\";\nimport { ELEMENT_KIND, TEXT_KIND } from \"./node.js\";\nimport { applyWrite } from \"./signals.js\";\n\ntype OffsetResult = { found: boolean; offset: number };\n\ntype BufferBuild = {\n buffer: Gtk.TextBuffer;\n view: Gtk.TextView | null;\n marks: { node: ElementNode; offset: number }[];\n};\n\nconst dirtyHosts: Set<ElementNode> = new Set();\nconst tagTables: WeakMap<object, Gtk.TextTagTable> = new WeakMap();\nconst TEXT_CONTENT_KINDS: Set<string> = new Set([\"label\", \"buffer\", \"tag\"]);\nconst PAINTABLE_PROP = \"paintable\";\nconst TEXT_PROP = \"text\";\n\nconst CONTENT_MIX_RULES: { kind: ContentKind; prop: string; message: string }[] = [\n {\n kind: \"label\",\n prop: \"label\",\n message: \"<GtkLabel> cannot mix a `label` prop with text children; use one or the other\",\n },\n {\n kind: \"buffer\",\n prop: \"text\",\n message: \"<GtkTextBuffer> cannot mix a `text` prop with content children; use one or the other\",\n },\n {\n kind: \"anchor\",\n prop: PAINTABLE_PROP,\n message: \"<GtkTextChildAnchor> cannot mix a `paintable` prop with a child widget; use one or the other\",\n },\n];\n\nconst charLength = (text: string): number => text[Symbol.iterator]().toArray().length;\n\nconst bufferText = (buffer: Gtk.TextBuffer): string =>\n buffer.getText(buffer.getStartIter(), buffer.getEndIter(), false);\n\nconst currentText = (object: GObject.Object): string | null => {\n if (object instanceof Gtk.TextBuffer) {\n return bufferText(object);\n }\n\n if (object instanceof Gtk.Editable || object instanceof Gtk.EntryBuffer) {\n return object.getText();\n }\n\n return null;\n};\n\nconst hasSameText = (object: GObject.Object, prop: string, value: unknown): boolean =>\n prop === TEXT_PROP && typeof value === \"string\" && currentText(object) === value;\n\nconst contentTextLength = (node: ContentChild): number => {\n if (node.kind === TEXT_KIND) {\n return charLength(node.text);\n }\n\n if (node.contentKind === \"tag\") {\n return node.content.reduce((sum, child) => sum + contentTextLength(child), 0);\n }\n\n return node.contentKind === \"anchor\" ? 1 : 0;\n};\n\nconst isTagElement = (node: ContentChild): node is ElementNode =>\n node.kind === ELEMENT_KIND && node.contentKind === \"tag\";\n\nconst stepOffset = (node: ContentChild, target: TextNode, offset: number): OffsetResult => {\n if (node === target) {\n return { found: true, offset };\n }\n\n if (isTagElement(node)) {\n return getOffset(node.content, target, offset);\n }\n\n return { found: false, offset: offset + contentTextLength(node) };\n};\n\nconst getOffset = (nodes: ContentChild[], target: TextNode, start: number): OffsetResult => {\n let offset = start;\n\n for (const node of nodes) {\n const step = stepOffset(node, target, offset);\n\n if (step.found) {\n return step;\n }\n\n offset = step.offset;\n }\n\n return { found: false, offset };\n};\n\nconst enclosingTagNodes = (node: TextNode): ElementNode[] => {\n const nodes: ElementNode[] = [];\n let current: ParentNode | null = node.parent;\n\n while (current !== null && current.kind === ELEMENT_KIND) {\n if (current.contentKind === \"tag\") {\n nodes.push(current);\n }\n\n current = current.parent;\n }\n\n return nodes;\n};\n\nconst textRestrictionError = (text: string): Error =>\n new Error(\n \"Text strings must be rendered within a <GtkLabel> or <GtkTextBuffer> element; \" +\n `received ${JSON.stringify(text)}`,\n );\n\nconst canAcceptText = (host: ElementNode): boolean =>\n host.contentKind !== null && TEXT_CONTENT_KINDS.has(host.contentKind);\n\nconst isRootHost = (node: ElementNode): boolean => node.contentKind === \"label\" || node.contentKind === \"buffer\";\n\nconst mapElementParent = <T>(parent: ParentNode | null, map: (element: ElementNode) => T): T | null =>\n parent !== null && parent.kind === ELEMENT_KIND ? map(parent) : null;\n\nconst parentElement = (node: ElementNode): ElementNode | null => mapElementParent(node.parent, (parent) => parent);\n\nconst getRootHost = (node: ElementNode): ElementNode | null => {\n let current: ElementNode | null = node;\n\n while (current !== null) {\n if (isRootHost(current)) {\n return current;\n }\n\n current = parentElement(current);\n }\n\n return null;\n};\n\nconst markTextDirty = (host: ElementNode): void => {\n const root = getRootHost(host);\n\n if (root !== null) {\n dirtyHosts.add(root);\n }\n};\n\nconst enclosingHost = (node: TextNode): ElementNode | null => mapElementParent(node.parent, getRootHost);\n\nconst addContent = (host: ElementNode, child: ContentChild, before: ContentChild | null): void => {\n const content = host.content;\n const existing = content.indexOf(child);\n\n if (existing !== -1) {\n content.splice(existing, 1);\n }\n\n content.splice(\n indexBeforeOrEnd(content, before, (item, target) => item === target),\n 0,\n child,\n );\n\n child.parent = host;\n markTextDirty(host);\n};\n\nconst removeContent = (host: ElementNode, child: ContentChild): void => {\n const index = host.content.indexOf(child);\n\n if (index !== -1) {\n host.content.splice(index, 1);\n }\n\n markTextDirty(host);\n};\n\nconst validateContentMix = (node: ElementNode, props: Props): void => {\n if (node.content.length === 0) {\n return;\n }\n\n const violated = CONTENT_MIX_RULES.find(\n (rule) => rule.kind === node.contentKind && props[rule.prop] !== undefined,\n );\n\n if (violated !== undefined) {\n throw new Error(violated.message);\n }\n};\n\nconst detachTag = (tag: Gtk.TextTag, table: Gtk.TextTagTable, name: string | null): void => {\n const previous = tagTables.get(tag);\n\n if (previous !== undefined && previous !== table) {\n previous.remove(tag);\n }\n\n if (name === null) {\n return;\n }\n\n const existing = table.lookup(name);\n\n if (existing !== null && existing !== tag) {\n table.remove(existing);\n }\n};\n\nconst ensureTag = (table: Gtk.TextTagTable, node: ElementNode): void => {\n const tag = node.object;\n\n if (!(tag instanceof Gtk.TextTag) || tagTables.get(tag) === table) {\n return;\n }\n\n const name = typeof node.props.name === \"string\" ? node.props.name : null;\n detachTag(tag, table, name);\n\n if (name === null || table.lookup(name) !== tag) {\n table.add(tag);\n }\n\n tagTables.set(tag, table);\n};\n\nconst insertTag = (build: BufferBuild, node: ElementNode): void => {\n const start = build.buffer.getCharCount();\n insertContent(build, node.content);\n const tag = node.object;\n\n if (tag instanceof Gtk.TextTag) {\n ensureTag(build.buffer.getTagTable(), node);\n build.buffer.applyTag(tag, build.buffer.getIterAtOffset(start), build.buffer.getEndIter());\n }\n};\n\nconst contentPaintable = (node: ElementNode): Gdk.Paintable | null => {\n const value = node.props[PAINTABLE_PROP];\n\n return value instanceof Gdk.Paintable ? value : null;\n};\n\nconst isContentPaintableProp = (node: ElementNode, name: string): boolean =>\n name === PAINTABLE_PROP && node.contentKind === \"anchor\";\n\nconst insertAnchor = (build: BufferBuild, node: ElementNode): void => {\n const paintable = contentPaintable(node);\n\n if (paintable !== null) {\n build.buffer.insertPaintable(build.buffer.getEndIter(), paintable);\n\n return;\n }\n\n const anchor = node.object;\n\n if (!(anchor instanceof Gtk.TextChildAnchor)) {\n return;\n }\n\n build.buffer.insertChildAnchor(build.buffer.getEndIter(), anchor);\n const child = node.content[0];\n\n if (build.view !== null && child?.kind === ELEMENT_KIND && child.object instanceof Gtk.Widget) {\n build.view.addChildAtAnchor(child.object, anchor);\n }\n};\n\nconst insertElement = (build: BufferBuild, node: ElementNode): void => {\n if (node.contentKind === \"tag\") {\n insertTag(build, node);\n } else if (node.contentKind === \"anchor\") {\n insertAnchor(build, node);\n } else {\n build.marks.push({ node, offset: build.buffer.getCharCount() });\n }\n};\n\nconst insertContent = (build: BufferBuild, nodes: ContentChild[]): void => {\n for (const child of nodes) {\n if (child.kind === TEXT_KIND) {\n build.buffer.insert(build.buffer.getEndIter(), child.text, -1);\n } else {\n insertElement(build, child);\n }\n }\n};\n\nconst placeMark = (buffer: Gtk.TextBuffer, node: ElementNode, offset: number): void => {\n const mark = node.object;\n\n if (!(mark instanceof Gtk.TextMark)) {\n return;\n }\n\n const iter = buffer.getIterAtOffset(offset);\n\n if (mark.getBuffer() === null) {\n buffer.addMark(mark, iter);\n } else {\n buffer.moveMark(mark, iter);\n }\n};\n\nconst rebuildBuffer = (node: ElementNode): void => {\n const buffer = node.object;\n\n if (node.props.text !== undefined || !(buffer instanceof Gtk.TextBuffer)) {\n return;\n }\n\n applyWrite(() => {\n buffer.setText(\"\", -1);\n const build: BufferBuild = { buffer, view: node.bufferView, marks: [] };\n insertContent(build, node.content);\n\n for (const mark of build.marks) {\n placeMark(buffer, mark.node, mark.offset);\n }\n });\n};\n\nconst rebuildLabel = (node: ElementNode): void => {\n if (node.props.label !== undefined) {\n return;\n }\n\n const label = node.object;\n\n if (!(label instanceof Gtk.Label)) {\n return;\n }\n\n label.setLabel(node.content.map((child) => (child.kind === TEXT_KIND ? child.text : \"\")).join(\"\"));\n};\n\nconst flushTextHosts = (): void => {\n drain(dirtyHosts, (host) => {\n if (host.contentKind === \"label\") {\n rebuildLabel(host);\n } else if (host.contentKind === \"buffer\") {\n rebuildBuffer(host);\n }\n });\n};\n\nconst applyEnclosingTags = (\n buffer: Gtk.TextBuffer,\n node: TextNode,\n startIter: Gtk.TextIter,\n endIter: Gtk.TextIter,\n): void => {\n for (const tagNode of enclosingTagNodes(node)) {\n ensureTag(buffer.getTagTable(), tagNode);\n\n if (tagNode.object instanceof Gtk.TextTag) {\n buffer.applyTag(tagNode.object, startIter, endIter);\n }\n }\n};\n\nconst didUpdateTextSurgically = (host: ElementNode, node: TextNode, oldText: string, newText: string): boolean => {\n const buffer = host.object;\n\n if (host.contentKind !== \"buffer\" || !(buffer instanceof Gtk.TextBuffer)) {\n return false;\n }\n\n const located = getOffset(host.content, node, 0);\n\n if (!located.found) {\n return false;\n }\n\n const start = located.offset;\n\n applyWrite(() => {\n buffer.delete(buffer.getIterAtOffset(start), buffer.getIterAtOffset(start + charLength(oldText)));\n buffer.insert(buffer.getIterAtOffset(start), newText, -1);\n });\n\n const startIter = buffer.getIterAtOffset(start);\n const endIter = buffer.getIterAtOffset(start + charLength(newText));\n applyEnclosingTags(buffer, node, startIter, endIter);\n\n return true;\n};\n\nexport {\n TEXT_PROP,\n textRestrictionError,\n bufferText,\n hasSameText,\n canAcceptText,\n isContentPaintableProp,\n markTextDirty,\n enclosingHost,\n addContent,\n removeContent,\n validateContentMix,\n flushTextHosts,\n didUpdateTextSurgically,\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/react",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.3",
|
|
4
4
|
"description": "React reconciler that renders GTK4 object trees, with the portals, signal handling, and hooks GTKX apps use",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"react-reconciler": "^0.33.0",
|
|
79
|
-
"@gtkx/config": "1.0.0-rc.
|
|
80
|
-
"@gtkx/runtime": "1.0.0-rc.
|
|
81
|
-
"@gtkx/utils": "1.0.0-rc.
|
|
79
|
+
"@gtkx/config": "1.0.0-rc.3",
|
|
80
|
+
"@gtkx/runtime": "1.0.0-rc.3",
|
|
81
|
+
"@gtkx/utils": "1.0.0-rc.3"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@types/react": "^19.2.17",
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
list,
|
|
12
12
|
slot,
|
|
13
13
|
} from "../reconciler/behaviors.js";
|
|
14
|
-
import { type ElementConfig, registerElements } from "../reconciler/registry.js";
|
|
15
|
-
import { BUILTIN_ELEMENTS } from "./element-config.js";
|
|
14
|
+
import { type ElementConfig, forTypes, registerElements } from "../reconciler/registry.js";
|
|
15
|
+
import { BUILTIN_ELEMENTS, CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES } from "./element-config.js";
|
|
16
16
|
|
|
17
17
|
type AdwChildSetter =
|
|
18
18
|
| Adw.Bin |
|
|
@@ -73,42 +73,12 @@ const pageHostChildren = addRemoveSlot<Adw.PreferencesPage, PageHost>(
|
|
|
73
73
|
|
|
74
74
|
/** The runtime half of the built-in element configuration: the behaviors bound to each GObject type. */
|
|
75
75
|
const BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {
|
|
76
|
-
|
|
76
|
+
...forTypes(CHILD_SETTER_TYPES, {
|
|
77
77
|
behaviors: [childSetter],
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
behaviors: [childSetter],
|
|
81
|
-
},
|
|
82
|
-
AdwClampScrollable: {
|
|
83
|
-
behaviors: [childSetter],
|
|
84
|
-
},
|
|
85
|
-
AdwNavigationPage: {
|
|
86
|
-
behaviors: [childSetter],
|
|
87
|
-
},
|
|
88
|
-
AdwSplitButton: {
|
|
89
|
-
behaviors: [childSetter],
|
|
90
|
-
},
|
|
91
|
-
AdwStatusPage: {
|
|
92
|
-
behaviors: [childSetter],
|
|
93
|
-
},
|
|
94
|
-
AdwTabOverview: {
|
|
95
|
-
behaviors: [childSetter],
|
|
96
|
-
},
|
|
97
|
-
AdwToastOverlay: {
|
|
98
|
-
behaviors: [childSetter],
|
|
99
|
-
},
|
|
100
|
-
AdwToggle: {
|
|
101
|
-
behaviors: [childSetter],
|
|
102
|
-
},
|
|
103
|
-
AdwBottomSheet: {
|
|
104
|
-
behaviors: [contentSetter],
|
|
105
|
-
},
|
|
106
|
-
AdwFlap: {
|
|
107
|
-
behaviors: [contentSetter],
|
|
108
|
-
},
|
|
109
|
-
AdwOverlaySplitView: {
|
|
78
|
+
}),
|
|
79
|
+
...forTypes(CONTENT_SETTER_TYPES, {
|
|
110
80
|
behaviors: [contentSetter],
|
|
111
|
-
},
|
|
81
|
+
}),
|
|
112
82
|
AdwDialog: {
|
|
113
83
|
behaviors: [childSetter, breakpoints],
|
|
114
84
|
},
|