@gtkx/react 1.2.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/adw/dialog.js +2 -2
- package/dist/adw/dialog.js.map +1 -1
- package/dist/components/application.d.ts.map +1 -1
- package/dist/components/application.js +3 -3
- package/dist/components/application.js.map +1 -1
- package/dist/components/window.js +3 -3
- package/dist/components/window.js.map +1 -1
- package/dist/element-behaviors.js +130 -1
- package/dist/element-behaviors.js.map +1 -1
- package/dist/element-config.js +1 -1
- package/dist/element-config.js.map +1 -1
- package/dist/hooks/use-bind-setting.d.ts.map +1 -1
- package/dist/hooks/use-bind-setting.js +3 -2
- package/dist/hooks/use-bind-setting.js.map +1 -1
- package/dist/hooks/use-property.d.ts +1 -1
- package/dist/hooks/use-property.d.ts.map +1 -1
- package/dist/hooks/use-property.js +5 -1
- package/dist/hooks/use-property.js.map +1 -1
- package/dist/internal.d.ts +2 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +2 -0
- package/dist/internal.js.map +1 -1
- package/dist/prop-types.d.ts +20 -2
- package/dist/prop-types.d.ts.map +1 -1
- package/dist/prop-types.js.map +1 -1
- package/dist/reconciler/apply-props.d.ts +2 -1
- package/dist/reconciler/apply-props.d.ts.map +1 -1
- package/dist/reconciler/apply-props.js +60 -24
- package/dist/reconciler/apply-props.js.map +1 -1
- package/dist/reconciler/behaviors.d.ts.map +1 -1
- package/dist/reconciler/behaviors.js +40 -9
- package/dist/reconciler/behaviors.js.map +1 -1
- package/dist/reconciler/host-config.d.ts.map +1 -1
- package/dist/reconciler/host-config.js +10 -2
- package/dist/reconciler/host-config.js.map +1 -1
- package/dist/reconciler/metadata.d.ts +6 -1
- package/dist/reconciler/metadata.d.ts.map +1 -1
- package/dist/reconciler/metadata.js +39 -6
- package/dist/reconciler/metadata.js.map +1 -1
- package/dist/reconciler/placement.js +4 -4
- package/dist/reconciler/placement.js.map +1 -1
- package/dist/reconciler/registry.d.ts +2 -0
- package/dist/reconciler/registry.d.ts.map +1 -1
- package/dist/reconciler/registry.js.map +1 -1
- package/dist/reconciler/root.d.ts.map +1 -1
- package/dist/reconciler/root.js.map +1 -1
- package/dist/reconciler/signals.d.ts +3 -2
- package/dist/reconciler/signals.d.ts.map +1 -1
- package/dist/reconciler/signals.js +49 -16
- package/dist/reconciler/signals.js.map +1 -1
- package/dist/reconciler/style.d.ts +7 -0
- package/dist/reconciler/style.d.ts.map +1 -0
- package/dist/reconciler/style.js +61 -0
- package/dist/reconciler/style.js.map +1 -0
- package/dist/reconciler/text.js +3 -3
- package/dist/reconciler/text.js.map +1 -1
- package/dist/utils/accessible-props.d.ts.map +1 -1
- package/dist/utils/accessible-props.js +13 -7
- package/dist/utils/accessible-props.js.map +1 -1
- package/env.d.ts +10 -7
- package/package.json +6 -5
- package/src/adw/dialog.tsx +2 -2
- package/src/components/application.tsx +18 -3
- package/src/components/window.tsx +3 -3
- package/src/element-behaviors.ts +180 -1
- package/src/element-config.ts +1 -1
- package/src/hooks/use-bind-setting.ts +3 -2
- package/src/hooks/use-property.ts +6 -2
- package/src/internal.ts +2 -0
- package/src/prop-types.ts +96 -1
- package/src/reconciler/apply-props.ts +74 -26
- package/src/reconciler/behaviors.ts +60 -12
- package/src/reconciler/host-config.ts +13 -2
- package/src/reconciler/metadata.ts +62 -6
- package/src/reconciler/placement.ts +4 -4
- package/src/reconciler/registry.ts +2 -0
- package/src/reconciler/root.ts +1 -1
- package/src/reconciler/signals.ts +62 -17
- package/src/reconciler/style.ts +84 -0
- package/src/reconciler/text.ts +3 -3
- package/src/utils/accessible-props.ts +15 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-property.js","sourceRoot":"","sources":["../../src/hooks/use-property.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"use-property.js","sourceRoot":"","sources":["../../src/hooks/use-property.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAgB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAOvD;;;;;GAKG;AACH,SAAS,WAAW,CAChB,MAAkB,EAClB,YAAwB;IAExB,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,IAAI,SAAS,CAAC,YAAY,CAAC,CAAC;IAElH,OAAO,cAAc,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\nimport { kebabCase } from \"@gtkx/utils\";\nimport { getPropertyName } from \"../reconciler/metadata.js\";\nimport { type RefProp, resolveRefProp } from \"../utils/ref-prop.js\";\nimport { useObjectValue } from \"./use-object-value.js\";\n\n/** The property map `T` declares, from camelCase property name to value type. */\ntype Properties<T extends GObject.Object> = NonNullable<T[\"__properties__\"]>;\n/** Every property `T` declares that is also readable off the instance, in camelCase. */\ntype PropertyName<T extends GObject.Object> = keyof Properties<T> & keyof T;\n\n/**\n * Subscribes to a GObject property and returns its current value, re-rendering when the property changes.\n *\n * @param propertyName The camelCase name of a readable property on the object.\n * @returns The current value, or `undefined` while the object is null or an unresolved ref.\n */\nfunction useProperty<T extends GObject.Object, P extends PropertyName<T>>(\n object: RefProp<T>,\n propertyName: P & string,\n): T[P] | undefined {\n const resolved = resolveRefProp(object);\n const name = (resolved === null ? undefined : getPropertyName(resolved, propertyName)) ?? kebabCase(propertyName);\n\n return useObjectValue(object, `notify::${name}`, (obj) => obj?.[propertyName]);\n}\n\nexport { useProperty };\n"]}
|
package/dist/internal.d.ts
CHANGED
|
@@ -14,5 +14,7 @@ export type * from "./prop-types.js";
|
|
|
14
14
|
export { settleAccessible } from "./reconciler/apply-props.js";
|
|
15
15
|
export { isRootElement } from "./reconciler/root-element.js";
|
|
16
16
|
export { createReconcilerRoot, type ReconcilerRoot, setReconcilerErrorHandler } from "./reconciler/root.js";
|
|
17
|
+
export { applyWrite } from "./reconciler/signals.js";
|
|
18
|
+
export { applyStyle } from "./reconciler/style.js";
|
|
17
19
|
export type { SettingsSchema, SettingsSchemaKeys, SettingValue } from "./utils/settings.js";
|
|
18
20
|
//# 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,gBAAgB;AAChB,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,gBAAgB;AAChB,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,mBAAmB,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAC5G,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,gBAAgB;AAChB,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,gBAAgB;AAChB,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,mBAAmB,iBAAiB,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,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,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/internal.js
CHANGED
|
@@ -13,4 +13,6 @@ export { useMergedRef } from "./hooks/use-merged-refs.js";
|
|
|
13
13
|
export { settleAccessible } from "./reconciler/apply-props.js";
|
|
14
14
|
export { isRootElement } from "./reconciler/root-element.js";
|
|
15
15
|
export { createReconcilerRoot, setReconcilerErrorHandler } from "./reconciler/root.js";
|
|
16
|
+
export { applyWrite } from "./reconciler/signals.js";
|
|
17
|
+
export { applyStyle } from "./reconciler/style.js";
|
|
16
18
|
//# 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,gBAAgB;AAChB,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,gBAAgB;AAChB,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAuB,yBAAyB,EAAE,MAAM,sBAAsB,CAAC","sourcesContent":["import \"./bootstrap.js\";\n\n/** @internal */\nexport { createApplicationWindowComponent } from \"./components/application-window.js\";\n/** @internal */\nexport { createApplicationComponent } from \"./components/application.js\";\nexport { createElementComponent } from \"./components/element.js\";\n/** @internal */\nexport { createPortaledComponent } from \"./components/portaled.js\";\n/** @internal */\nexport { createWindowComponent } from \"./components/window.js\";\nexport { useLatestRef } from \"./hooks/use-latest-ref.js\";\nexport { useMergedRef } from \"./hooks/use-merged-refs.js\";\nexport type * from \"./prop-types.js\";\nexport { settleAccessible } from \"./reconciler/apply-props.js\";\nexport { isRootElement } from \"./reconciler/root-element.js\";\nexport { createReconcilerRoot, type ReconcilerRoot, setReconcilerErrorHandler } from \"./reconciler/root.js\";\nexport type { SettingsSchema, SettingsSchemaKeys, SettingValue } from \"./utils/settings.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;AAExB,gBAAgB;AAChB,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,gBAAgB;AAChB,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,gBAAgB;AAChB,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,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,UAAU,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["import \"./bootstrap.js\";\n\n/** @internal */\nexport { createApplicationWindowComponent } from \"./components/application-window.js\";\n/** @internal */\nexport { createApplicationComponent } from \"./components/application.js\";\nexport { createElementComponent } from \"./components/element.js\";\n/** @internal */\nexport { createPortaledComponent } from \"./components/portaled.js\";\n/** @internal */\nexport { createWindowComponent } from \"./components/window.js\";\nexport { useLatestRef } from \"./hooks/use-latest-ref.js\";\nexport { useMergedRef } from \"./hooks/use-merged-refs.js\";\nexport type * from \"./prop-types.js\";\nexport { settleAccessible } from \"./reconciler/apply-props.js\";\nexport { isRootElement } from \"./reconciler/root-element.js\";\nexport { createReconcilerRoot, type ReconcilerRoot, setReconcilerErrorHandler } from \"./reconciler/root.js\";\nexport { applyWrite } from \"./reconciler/signals.js\";\nexport { applyStyle } from \"./reconciler/style.js\";\nexport type { SettingsSchema, SettingsSchemaKeys, SettingValue } from \"./utils/settings.js\";\n"]}
|
package/dist/prop-types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type * as Gdk from "@gtkx/gi/gdk";
|
|
|
2
2
|
import type * as GLib from "@gtkx/gi/glib";
|
|
3
3
|
import type * as GObject from "@gtkx/gi/gobject";
|
|
4
4
|
import type * as Gtk from "@gtkx/gi/gtk";
|
|
5
|
-
import type { ReactNode } from "react";
|
|
5
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
6
6
|
/** One entry of a `GMenu`'s `items` prop; `submenu` and `section` nest further menus. */
|
|
7
7
|
type MenuItem = {
|
|
8
8
|
/** Text shown for the entry, or the heading of the submenu or section it introduces. */
|
|
@@ -84,12 +84,22 @@ type ChildrenProps = {
|
|
|
84
84
|
/** Elements attached to the element's default child slot, or its text for elements that hold text. */
|
|
85
85
|
children?: ReactNode;
|
|
86
86
|
};
|
|
87
|
+
/** Paint and typography declarations GTK4 CSS accepts, spelled the way React DOM spells them. */
|
|
88
|
+
type StyleProperties = Pick<CSSProperties, "animation" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimingFunction" | "background" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundRepeat" | "backgroundSize" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderStyle" | "borderTop" | "borderWidth" | "boxShadow" | "caretColor" | "color" | "filter" | "font" | "fontFamily" | "fontSize" | "fontStyle" | "fontVariant" | "fontWeight" | "letterSpacing" | "lineHeight" | "margin" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "minHeight" | "minWidth" | "opacity" | "outline" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "padding" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "textDecoration" | "textDecorationColor" | "textDecorationLine" | "textDecorationStyle" | "textShadow" | "textTransform" | "transform" | "transformOrigin" | "transition" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction">;
|
|
89
|
+
/**
|
|
90
|
+
* Style declarations for one widget. A key starting with `&` nests a block under a selector derived from
|
|
91
|
+
* it, such as `"&:hover"` or `"& label"`. GTK4 CSS covers paint and typography only, so layout properties
|
|
92
|
+
* such as `display`, `width` and `gap` are deliberately absent; use the widget's own layout props instead.
|
|
93
|
+
*/
|
|
94
|
+
type Style = StyleProperties & Partial<Record<`&${string}`, StyleProperties>>;
|
|
87
95
|
/** Objects a widget takes through a method call rather than a property. */
|
|
88
96
|
type GtkWidgetProps = {
|
|
89
97
|
/** `Gtk.EventController` elements added to the widget. */
|
|
90
98
|
controllers?: ReactNode | null | undefined;
|
|
91
99
|
/** `Gio.ActionGroup` elements inserted into the widget, each under its own `prefix`. */
|
|
92
100
|
actionGroups?: ReactNode | null | undefined;
|
|
101
|
+
/** Style declarations applied to this widget alone, outranking any class in `cssClasses`. */
|
|
102
|
+
style?: Style | null | undefined;
|
|
93
103
|
} & ChildrenProps;
|
|
94
104
|
/** Props of an action group placed in a widget's `actionGroups` slot. */
|
|
95
105
|
type ActionGroupProps = {
|
|
@@ -142,6 +152,14 @@ type GtkScaleProps = {
|
|
|
142
152
|
/** Marks drawn along the scale, cleared and re-added whenever the list changes. */
|
|
143
153
|
marks?: ScaleMark[] | null | undefined;
|
|
144
154
|
};
|
|
155
|
+
/** Props of a `Gtk.ListBox` element. */
|
|
156
|
+
type GtkListBoxProps = {
|
|
157
|
+
/**
|
|
158
|
+
* Index of the row to select; `-1` or `null` selects none. Applied once the row exists, and
|
|
159
|
+
* re-applied whenever the box's own selection drifts from it. Left alone while the prop is absent.
|
|
160
|
+
*/
|
|
161
|
+
selectedIndex?: number | null | undefined;
|
|
162
|
+
} & ChildrenProps;
|
|
145
163
|
/** Props of a `Gtk.Calendar` element. */
|
|
146
164
|
type GtkCalendarProps = {
|
|
147
165
|
/** Days of the shown month drawn as marked, cleared and re-marked whenever the list changes. */
|
|
@@ -190,5 +208,5 @@ type GtkDragSourceProps = {
|
|
|
190
208
|
/** Icon shown under the pointer while a drag started from this source is in flight. */
|
|
191
209
|
icon?: DragSourceIcon | null | undefined;
|
|
192
210
|
};
|
|
193
|
-
export { type MenuItem, type VflConstraints, type ScaleMark, type LevelBarOffset, type CreditSection, type MainOption, type ActionAccel, type DragSourceIcon, type ChildrenProps, type GtkWidgetProps, type ActionGroupProps, type ActionMapProps, type MenuProps, 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, };
|
|
211
|
+
export { type MenuItem, type VflConstraints, type ScaleMark, type LevelBarOffset, type CreditSection, type MainOption, type ActionAccel, type DragSourceIcon, type ChildrenProps, type GtkWidgetProps, type Style, type StyleProperties, type ActionGroupProps, type ActionMapProps, type MenuProps, type GtkShortcutControllerProps, type GtkOverlayProps, type GtkTextChildAnchorProps, type GtkConstraintLayoutProps, type GtkHeaderBarProps, type GtkScaleProps, type GtkListBoxProps, type GtkCalendarProps, type GtkLevelBarProps, type GtkSizeGroupProps, type GtkAboutDialogProps, type GtkApplicationProps, type GtkDropTargetProps, type GtkDrawingAreaProps, type GtkDragSourceProps, };
|
|
194
212
|
//# sourceMappingURL=prop-types.d.ts.map
|
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":"AACA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,KAAK,IAAI,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,KAAK,IAAI,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,yFAAyF;AACzF,KAAK,QAAQ,GAAG;IACZ,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB,iGAAiG;IACjG,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB,CAAC;AAEF,4EAA4E;AAC5E,KAAK,cAAc,GAAG;IAClB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,C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AAK,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":"AA6NA,OAAO,EA4BN,CAAC","sourcesContent":["/* eslint-disable gtkx/no-library-prefix */\nimport type * as Gdk from \"@gtkx/gi/gdk\";\nimport type * as GLib from \"@gtkx/gi/glib\";\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 command-line option a `Gtk.Application` accepts. */\ntype MainOption = {\n /** Name the option is spelled with after two dashes, such as `verbose` for `--verbose`. */\n longName: string;\n /** Single character the option is spelled with after one dash, such as `v` for `-v`; defaults to none. */\n shortName?: string | null;\n /** How the option itself is parsed and listed; defaults to `GLib.OptionFlags.NONE`. */\n flags?: GLib.OptionFlags;\n /** Type of argument the option takes; defaults to `GLib.OptionArg.NONE`, meaning it takes none. */\n arg?: GLib.OptionArg;\n /** Text describing the option in `--help`. */\n description: string;\n /** Placeholder standing for the option's argument in `--help`; defaults to none. */\n argDescription?: string | null;\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 ActionGroupProps = {\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 ActionMapProps = {\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 MenuProps = {\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 /**\n * Extra sections appended to the dialog's credits. GTK offers no way to remove one, so the list\n * cannot change once it has been applied.\n */\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 /**\n * Command-line options the application parses, registered before it starts. GLib offers no way to\n * unregister one, so the list cannot change once it has been applied.\n */\n mainOptions?: MainOption[] | 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 MainOption,\n type ActionAccel,\n type DragSourceIcon,\n type ChildrenProps,\n type GtkWidgetProps,\n type ActionGroupProps,\n type ActionMapProps,\n type MenuProps,\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
|
+
{"version":3,"file":"prop-types.js","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"AAyTA,OAAO,EA+BN,CAAC","sourcesContent":["/* eslint-disable gtkx/no-library-prefix */\nimport type * as Gdk from \"@gtkx/gi/gdk\";\nimport type * as GLib from \"@gtkx/gi/glib\";\nimport type * as GObject from \"@gtkx/gi/gobject\";\nimport type * as Gtk from \"@gtkx/gi/gtk\";\nimport type { CSSProperties, 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 command-line option a `Gtk.Application` accepts. */\ntype MainOption = {\n /** Name the option is spelled with after two dashes, such as `verbose` for `--verbose`. */\n longName: string;\n /** Single character the option is spelled with after one dash, such as `v` for `-v`; defaults to none. */\n shortName?: string | null;\n /** How the option itself is parsed and listed; defaults to `GLib.OptionFlags.NONE`. */\n flags?: GLib.OptionFlags;\n /** Type of argument the option takes; defaults to `GLib.OptionArg.NONE`, meaning it takes none. */\n arg?: GLib.OptionArg;\n /** Text describing the option in `--help`. */\n description: string;\n /** Placeholder standing for the option's argument in `--help`; defaults to none. */\n argDescription?: string | null;\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/** Paint and typography declarations GTK4 CSS accepts, spelled the way React DOM spells them. */\ntype StyleProperties = Pick<\n CSSProperties,\n | \"animation\" |\n \"animationDelay\" |\n \"animationDirection\" |\n \"animationDuration\" |\n \"animationFillMode\" |\n \"animationIterationCount\" |\n \"animationName\" |\n \"animationPlayState\" |\n \"animationTimingFunction\" |\n \"background\" |\n \"backgroundClip\" |\n \"backgroundColor\" |\n \"backgroundImage\" |\n \"backgroundOrigin\" |\n \"backgroundPosition\" |\n \"backgroundRepeat\" |\n \"backgroundSize\" |\n \"border\" |\n \"borderBottom\" |\n \"borderColor\" |\n \"borderLeft\" |\n \"borderRadius\" |\n \"borderRight\" |\n \"borderStyle\" |\n \"borderTop\" |\n \"borderWidth\" |\n \"boxShadow\" |\n \"caretColor\" |\n \"color\" |\n \"filter\" |\n \"font\" |\n \"fontFamily\" |\n \"fontSize\" |\n \"fontStyle\" |\n \"fontVariant\" |\n \"fontWeight\" |\n \"letterSpacing\" |\n \"lineHeight\" |\n \"margin\" |\n \"marginBottom\" |\n \"marginLeft\" |\n \"marginRight\" |\n \"marginTop\" |\n \"minHeight\" |\n \"minWidth\" |\n \"opacity\" |\n \"outline\" |\n \"outlineColor\" |\n \"outlineOffset\" |\n \"outlineStyle\" |\n \"outlineWidth\" |\n \"padding\" |\n \"paddingBottom\" |\n \"paddingLeft\" |\n \"paddingRight\" |\n \"paddingTop\" |\n \"textDecoration\" |\n \"textDecorationColor\" |\n \"textDecorationLine\" |\n \"textDecorationStyle\" |\n \"textShadow\" |\n \"textTransform\" |\n \"transform\" |\n \"transformOrigin\" |\n \"transition\" |\n \"transitionDelay\" |\n \"transitionDuration\" |\n \"transitionProperty\" |\n \"transitionTimingFunction\"\n>;\n\n/**\n * Style declarations for one widget. A key starting with `&` nests a block under a selector derived from\n * it, such as `\"&:hover\"` or `\"& label\"`. GTK4 CSS covers paint and typography only, so layout properties\n * such as `display`, `width` and `gap` are deliberately absent; use the widget's own layout props instead.\n */\ntype Style = StyleProperties & Partial<Record<`&${string}`, StyleProperties>>;\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 /** Style declarations applied to this widget alone, outranking any class in `cssClasses`. */\n style?: Style | null | undefined;\n} & ChildrenProps;\n\n/** Props of an action group placed in a widget's `actionGroups` slot. */\ntype ActionGroupProps = {\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 ActionMapProps = {\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 MenuProps = {\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.ListBox` element. */\ntype GtkListBoxProps = {\n /**\n * Index of the row to select; `-1` or `null` selects none. Applied once the row exists, and\n * re-applied whenever the box's own selection drifts from it. Left alone while the prop is absent.\n */\n selectedIndex?: number | null | undefined;\n} & ChildrenProps;\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 /**\n * Extra sections appended to the dialog's credits. GTK offers no way to remove one, so the list\n * cannot change once it has been applied.\n */\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 /**\n * Command-line options the application parses, registered before it starts. GLib offers no way to\n * unregister one, so the list cannot change once it has been applied.\n */\n mainOptions?: MainOption[] | 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 MainOption,\n type ActionAccel,\n type DragSourceIcon,\n type ChildrenProps,\n type GtkWidgetProps,\n type Style,\n type StyleProperties,\n type ActionGroupProps,\n type ActionMapProps,\n type MenuProps,\n type GtkShortcutControllerProps,\n type GtkOverlayProps,\n type GtkTextChildAnchorProps,\n type GtkConstraintLayoutProps,\n type GtkHeaderBarProps,\n type GtkScaleProps,\n type GtkListBoxProps,\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"]}
|
|
@@ -3,9 +3,10 @@ import { type ElementNode, type SignalTarget } from "./node.js";
|
|
|
3
3
|
declare const assertPropsCanChange: (typeName: string, prev: Props, next: Props) => void;
|
|
4
4
|
declare const markFlush: (node: ElementNode) => void;
|
|
5
5
|
declare const flushBehaviors: () => void;
|
|
6
|
+
declare const teardownBehaviors: (node: ElementNode) => void;
|
|
6
7
|
declare const settleAccessible: () => void;
|
|
7
8
|
declare const flushAccessible: () => void;
|
|
8
9
|
declare const applyElementProps: (node: ElementNode, prev: Props, next: Props) => void;
|
|
9
10
|
declare const applyAdoptedProps: (target: SignalTarget, prev: Props, next: Props) => void;
|
|
10
|
-
export { markFlush, flushAccessible, settleAccessible, flushBehaviors, applyElementProps, applyAdoptedProps, assertPropsCanChange, };
|
|
11
|
+
export { markFlush, flushAccessible, settleAccessible, flushBehaviors, teardownBehaviors, applyElementProps, applyAdoptedProps, assertPropsCanChange, };
|
|
11
12
|
//# sourceMappingURL=apply-props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-props.d.ts","sourceRoot":"","sources":["../../src/reconciler/apply-props.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply-props.d.ts","sourceRoot":"","sources":["../../src/reconciler/apply-props.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAmB,KAAK,EAAE,MAAM,eAAe,CAAC;AAG5D,OAAO,EAAE,KAAK,WAAW,EAAsB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAyJpF,QAAA,MAAM,oBAAoB,GAAI,UAAU,MAAM,EAAE,MAAM,KAAK,EAAE,MAAM,KAAK,KAAG,IAS1E,CAAC;AAuEF,QAAA,MAAM,SAAS,GAAI,MAAM,WAAW,KAAG,IAItC,CAAC;AAQF,QAAA,MAAM,cAAc,QAAO,IAI1B,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,MAAM,WAAW,KAAG,IAO9C,CAAC;AAkDF,QAAA,MAAM,gBAAgB,QAAO,IAM5B,CAAC;AAEF,QAAA,MAAM,eAAe,QAAO,IAO3B,CAAC;AAEF,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,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACvB,CAAC"}
|
|
@@ -1,36 +1,54 @@
|
|
|
1
|
+
import * as GObject from "@gtkx/gi/gobject";
|
|
1
2
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
2
|
-
import {
|
|
3
|
+
import { coerceObjectProperty, getInstanceType, signalForHandlerName, TYPE_INVALID } from "@gtkx/runtime";
|
|
4
|
+
import { drain, isDeepEqual, kebabCase, lowerFirst, unsanitizeIdentifier } from "@gtkx/utils";
|
|
3
5
|
import { applyAccessibleProps, isAccessibleProp } from "../utils/accessible-props.js";
|
|
4
|
-
import { typeInfoFor } from "./metadata.js";
|
|
6
|
+
import { getPropertyName, hasProperty, typeInfoFor } from "./metadata.js";
|
|
5
7
|
import { getOrCreateContext } from "./node.js";
|
|
6
8
|
import { applyWrite, connectHandler, disconnectHandler } from "./signals.js";
|
|
7
9
|
import { bufferText, hasSameText, isContentPaintableProp, markTextDirty, TEXT_PROP } from "./text.js";
|
|
8
10
|
const REACT_RESERVED_PROPS = new Set(["children", "ref", "key"]);
|
|
9
11
|
const NOTIFY_PREFIX = "onNotify";
|
|
10
|
-
const HANDLER_PREFIX = "on";
|
|
11
12
|
const HANDLER_NAME = /^on[A-Z]/;
|
|
12
13
|
const flushDirty = new Set();
|
|
13
14
|
const accessibleDirty = new Map();
|
|
14
|
-
const mapWatched = new
|
|
15
|
+
const mapWatched = new WeakMap();
|
|
15
16
|
const pendingMap = new Set();
|
|
16
17
|
const isHandlerName = (name) => HANDLER_NAME.test(name);
|
|
17
|
-
const
|
|
18
|
+
const notifiedAccessor = (name) => lowerFirst(name.slice(NOTIFY_PREFIX.length));
|
|
19
|
+
const unknownSignalError = (typeName, name) => new Error(`The handler prop '${name}' of <${typeName}> names no signal ${typeName} carries. Name a ` +
|
|
20
|
+
`signal the element carries, or declare the one '${name}' stands for on ${typeName} when ` +
|
|
21
|
+
"its class is registered.");
|
|
22
|
+
const lookedUpSignal = (target, name) => {
|
|
23
|
+
const type = getInstanceType(target.object);
|
|
24
|
+
const signal = type === TYPE_INVALID ? undefined : signalForHandlerName(type, name);
|
|
25
|
+
if (signal === undefined) {
|
|
26
|
+
throw unknownSignalError(target.typeName, name);
|
|
27
|
+
}
|
|
28
|
+
return signal;
|
|
29
|
+
};
|
|
30
|
+
const signalForProp = (target, info, name) => {
|
|
18
31
|
if (name === NOTIFY_PREFIX) {
|
|
19
32
|
return "notify";
|
|
20
33
|
}
|
|
21
34
|
if (name.startsWith(NOTIFY_PREFIX) && name.length > NOTIFY_PREFIX.length) {
|
|
22
|
-
|
|
35
|
+
const accessor = notifiedAccessor(name);
|
|
36
|
+
const property = getPropertyName(target.object, accessor) ?? unsanitizeIdentifier(kebabCase(accessor));
|
|
37
|
+
return `notify::${property}`;
|
|
23
38
|
}
|
|
24
|
-
return info.signals[name] ??
|
|
39
|
+
return info.signals[name] ?? lookedUpSignal(target, name);
|
|
25
40
|
};
|
|
26
|
-
const isReservedName = (name, info) => REACT_RESERVED_PROPS.has(name) ||
|
|
41
|
+
const isReservedName = (name, info) => REACT_RESERVED_PROPS.has(name) ||
|
|
42
|
+
(isHandlerName(name) && !hasProperty(info, name)) ||
|
|
43
|
+
(isAccessibleProp(name) && !hasProperty(info, name)) ||
|
|
44
|
+
info.constructOnly.has(name);
|
|
27
45
|
const isSkippedValueName = (name, info, consumed) => isReservedName(name, info) || consumed.has(name);
|
|
28
46
|
const writeValue = (object, name, value) => {
|
|
29
47
|
if (hasSameText(object, name, value)) {
|
|
30
48
|
return;
|
|
31
49
|
}
|
|
32
|
-
applyWrite(() => {
|
|
33
|
-
Reflect.set(object, name, value);
|
|
50
|
+
applyWrite(name, () => {
|
|
51
|
+
Reflect.set(object, name, coerceObjectProperty(object, name, value));
|
|
34
52
|
});
|
|
35
53
|
};
|
|
36
54
|
const resetPlain = (object, info, name) => {
|
|
@@ -50,7 +68,7 @@ const applyBufferText = (buffer, text) => {
|
|
|
50
68
|
if (bufferText(buffer) === text) {
|
|
51
69
|
return;
|
|
52
70
|
}
|
|
53
|
-
applyWrite(() => {
|
|
71
|
+
applyWrite(TEXT_PROP, () => {
|
|
54
72
|
buffer.beginIrreversibleAction();
|
|
55
73
|
buffer.setText(text, -1);
|
|
56
74
|
buffer.endIrreversibleAction();
|
|
@@ -134,22 +152,24 @@ const restoreActionableSensitivity = (node, info, prev, next) => {
|
|
|
134
152
|
}
|
|
135
153
|
const desired = "sensitive" in next ? next.sensitive : info.defaults.sensitive;
|
|
136
154
|
if (typeof desired === "boolean") {
|
|
137
|
-
applyWrite(() => {
|
|
155
|
+
applyWrite("sensitive", () => {
|
|
138
156
|
Reflect.set(node.object, "sensitive", desired);
|
|
139
157
|
});
|
|
140
158
|
}
|
|
141
159
|
};
|
|
160
|
+
const applyHandler = (target, info, name, next) => {
|
|
161
|
+
const value = next[name];
|
|
162
|
+
if (typeof value === "function") {
|
|
163
|
+
connectHandler(target, name, signalForProp(target, info, name), value);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
disconnectHandler(target, name);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
142
169
|
const applyHandlers = (target, info, prev, next) => {
|
|
143
170
|
eachChangedName(prev, next, (name) => {
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
const value = next[name];
|
|
148
|
-
if (typeof value === "function") {
|
|
149
|
-
connectHandler(target, name, signalForProp(info, name), value);
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
disconnectHandler(target, name);
|
|
171
|
+
if (isHandlerName(name) && !hasProperty(info, name)) {
|
|
172
|
+
applyHandler(target, info, name, next);
|
|
153
173
|
}
|
|
154
174
|
});
|
|
155
175
|
};
|
|
@@ -168,6 +188,13 @@ const flushBehaviors = () => {
|
|
|
168
188
|
eachBehavior(node, (behavior, context) => behavior.flush?.(node.object, context));
|
|
169
189
|
});
|
|
170
190
|
};
|
|
191
|
+
const teardownBehaviors = (node) => {
|
|
192
|
+
flushDirty.delete(node);
|
|
193
|
+
unwatchMap(node);
|
|
194
|
+
for (const [behavior, context] of node.contexts) {
|
|
195
|
+
behavior.teardown?.(node.object, context);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
171
198
|
const applyAccessible = (object, prev, next) => {
|
|
172
199
|
if (object instanceof Gtk.Accessible) {
|
|
173
200
|
applyAccessibleProps(object, prev, next);
|
|
@@ -191,12 +218,21 @@ const watchMap = (node) => {
|
|
|
191
218
|
if (mapWatched.has(node) || !(object instanceof Gtk.Widget) || !hasAccessibleProp(node.props)) {
|
|
192
219
|
return;
|
|
193
220
|
}
|
|
194
|
-
|
|
195
|
-
object.connect("map", () => {
|
|
221
|
+
const onMapped = () => {
|
|
196
222
|
pendingMap.add(node);
|
|
197
223
|
setTimeout(settleAccessible, 0);
|
|
224
|
+
};
|
|
225
|
+
object.on("map", onMapped);
|
|
226
|
+
mapWatched.set(node, () => {
|
|
227
|
+
object.off("map", onMapped);
|
|
198
228
|
});
|
|
199
229
|
};
|
|
230
|
+
const unwatchMap = (node) => {
|
|
231
|
+
mapWatched.get(node)?.();
|
|
232
|
+
mapWatched.delete(node);
|
|
233
|
+
pendingMap.delete(node);
|
|
234
|
+
accessibleDirty.delete(node);
|
|
235
|
+
};
|
|
200
236
|
const settleAccessible = () => {
|
|
201
237
|
drain(pendingMap, (node) => {
|
|
202
238
|
if (node.object instanceof Gtk.Widget && node.object.getMapped()) {
|
|
@@ -234,5 +270,5 @@ const applyAdoptedProps = (target, prev, next) => {
|
|
|
234
270
|
applyAccessible(object, prev, next);
|
|
235
271
|
applyHandlers(target, info, prev, next);
|
|
236
272
|
};
|
|
237
|
-
export { markFlush, flushAccessible, settleAccessible, flushBehaviors, applyElementProps, applyAdoptedProps, assertPropsCanChange, };
|
|
273
|
+
export { markFlush, flushAccessible, settleAccessible, flushBehaviors, teardownBehaviors, applyElementProps, applyAdoptedProps, assertPropsCanChange, };
|
|
238
274
|
//# sourceMappingURL=apply-props.js.map
|
|
@@ -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,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE5D,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,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,sBAAsB,EAAE,aAAa,EAAE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,EACd,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACvB,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, isDeepEqual, 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 HANDLER_NAME = /^on[A-Z]/;\nconst flushDirty: Set<ElementNode> = new Set();\nconst accessibleDirty: Map<ElementNode, Props> = new Map();\nconst mapWatched: WeakSet<ElementNode> = new WeakSet();\nconst pendingMap: Set<ElementNode> = new Set();\n\nconst isHandlerName = (name: string): boolean => HANDLER_NAME.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 for (const name in prev) {\n visit(name);\n }\n\n for (const name in next) {\n if (!Object.hasOwn(prev, name)) {\n visit(name);\n }\n }\n};\n\nconst propChangeError = (typeName: string, name: string): Error =>\n new Error(\n `Cannot change the construct-only prop '${name}' of <${typeName}> after it is created. ` +\n \"It is only accepted while the element is being built, so give the element a key that \" +\n `changes with '${name}' and React will build a new one.`,\n );\n\nconst hasAppliedValue = (value: unknown): boolean => (Array.isArray(value) ? value.length > 0 : value !== undefined);\n\nconst isConstructOnlyChange = (info: TypeInfo, name: string, change: PropChange): boolean =>\n info.constructOnly.has(name) && !Object.is(change.prev[name], change.next[name]);\n\nconst isDeclaredConstructOnlyChange = (info: TypeInfo, name: string, change: PropChange): boolean =>\n info.declaredConstructOnly.has(name) &&\n hasAppliedValue(change.prev[name]) &&\n !isDeepEqual(change.prev[name], change.next[name]);\n\nconst assertPropsCanChange = (typeName: string, prev: Props, next: Props): void => {\n const info = typeInfoFor(typeName);\n const change: PropChange = { prev, next };\n\n eachChangedName(prev, next, (name) => {\n if (isConstructOnlyChange(info, name, change) || isDeclaredConstructOnlyChange(info, name, change)) {\n throw propChangeError(typeName, name);\n }\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 applyAccessible = (object: GObject.Object, prev: Props | null, next: Props): void => {\n if (object instanceof Gtk.Accessible) {\n applyAccessibleProps(object, prev, next);\n }\n};\n\nconst markAccessible = (node: ElementNode, prev: Props): void => {\n if (!accessibleDirty.has(node)) {\n accessibleDirty.set(node, prev);\n }\n};\n\nconst hasAccessibleProp = (props: Props): boolean => {\n for (const name in props) {\n if (isAccessibleProp(name)) {\n return true;\n }\n }\n\n return false;\n};\n\nconst watchMap = (node: ElementNode): void => {\n const { object } = node;\n\n if (mapWatched.has(node) || !(object instanceof Gtk.Widget) || !hasAccessibleProp(node.props)) {\n return;\n }\n\n mapWatched.add(node);\n\n object.connect(\"map\", () => {\n pendingMap.add(node);\n setTimeout(settleAccessible, 0);\n });\n};\n\nconst settleAccessible = (): void => {\n drain(pendingMap, (node) => {\n if (node.object instanceof Gtk.Widget && node.object.getMapped()) {\n applyAccessible(node.object, null, node.props);\n }\n });\n};\n\nconst flushAccessible = (): void => {\n for (const [node, prev] of accessibleDirty) {\n applyAccessible(node.object, prev, node.props);\n watchMap(node);\n }\n\n accessibleDirty.clear();\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 applyHandlers(node, info, prev, next);\n markAccessible(node, prev);\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 flushAccessible,\n settleAccessible,\n flushBehaviors,\n applyElementProps,\n applyAdoptedProps,\n assertPropsCanChange,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"apply-props.js","sourceRoot":"","sources":["../../src/reconciler/apply-props.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1G,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE9F,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,WAAW,EAAiB,WAAW,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAoB,kBAAkB,EAAqB,MAAM,WAAW,C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AAI,CAAC,KAAK,GAAG,IAAI,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,IAAc,EAAE,IAAY,EAAW,EAAE,CAAC,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,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACvB,CAAC","sourcesContent":["import type { SignalHandler } from \"@gtkx/runtime\";\nimport * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { coerceObjectProperty, getInstanceType, signalForHandlerName, TYPE_INVALID } from \"@gtkx/runtime\";\nimport { drain, isDeepEqual, kebabCase, lowerFirst, unsanitizeIdentifier } from \"@gtkx/utils\";\nimport type { ElementBehavior, Props } from \"./registry.js\";\nimport { applyAccessibleProps, isAccessibleProp } from \"../utils/accessible-props.js\";\nimport { getPropertyName, hasProperty, 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_NAME = /^on[A-Z]/;\nconst flushDirty: Set<ElementNode> = new Set();\nconst accessibleDirty: Map<ElementNode, Props> = new Map();\nconst mapWatched: WeakMap<ElementNode, () => void> = new WeakMap();\nconst pendingMap: Set<ElementNode> = new Set();\n\nconst isHandlerName = (name: string): boolean => HANDLER_NAME.test(name);\nconst notifiedAccessor = (name: string): string => lowerFirst(name.slice(NOTIFY_PREFIX.length));\n\nconst unknownSignalError = (typeName: string, name: string): Error =>\n new Error(\n `The handler prop '${name}' of <${typeName}> names no signal ${typeName} carries. Name a ` +\n `signal the element carries, or declare the one '${name}' stands for on ${typeName} when ` +\n \"its class is registered.\",\n );\n\nconst lookedUpSignal = (target: SignalTarget, name: string): string => {\n const type = getInstanceType(target.object);\n const signal = type === TYPE_INVALID ? undefined : signalForHandlerName(type, name);\n\n if (signal === undefined) {\n throw unknownSignalError(target.typeName, name);\n }\n\n return signal;\n};\n\nconst signalForProp = (target: SignalTarget, 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 const accessor = notifiedAccessor(name);\n const property = getPropertyName(target.object, accessor) ?? unsanitizeIdentifier(kebabCase(accessor));\n\n return `notify::${property}`;\n }\n\n return info.signals[name] ?? lookedUpSignal(target, name);\n};\n\nconst isReservedName = (name: string, info: TypeInfo): boolean =>\n REACT_RESERVED_PROPS.has(name) ||\n (isHandlerName(name) && !hasProperty(info, name)) ||\n (isAccessibleProp(name) && !hasProperty(info, name)) ||\n 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(name, () => {\n Reflect.set(object, name, coerceObjectProperty(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(TEXT_PROP, () => {\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 for (const name in prev) {\n visit(name);\n }\n\n for (const name in next) {\n if (!Object.hasOwn(prev, name)) {\n visit(name);\n }\n }\n};\n\nconst propChangeError = (typeName: string, name: string): Error =>\n new Error(\n `Cannot change the construct-only prop '${name}' of <${typeName}> after it is created. ` +\n \"It is only accepted while the element is being built, so give the element a key that \" +\n `changes with '${name}' and React will build a new one.`,\n );\n\nconst hasAppliedValue = (value: unknown): boolean => (Array.isArray(value) ? value.length > 0 : value !== undefined);\n\nconst isConstructOnlyChange = (info: TypeInfo, name: string, change: PropChange): boolean =>\n info.constructOnly.has(name) && !Object.is(change.prev[name], change.next[name]);\n\nconst isDeclaredConstructOnlyChange = (info: TypeInfo, name: string, change: PropChange): boolean =>\n info.declaredConstructOnly.has(name) &&\n hasAppliedValue(change.prev[name]) &&\n !isDeepEqual(change.prev[name], change.next[name]);\n\nconst assertPropsCanChange = (typeName: string, prev: Props, next: Props): void => {\n const info = typeInfoFor(typeName);\n const change: PropChange = { prev, next };\n\n eachChangedName(prev, next, (name) => {\n if (isConstructOnlyChange(info, name, change) || isDeclaredConstructOnlyChange(info, name, change)) {\n throw propChangeError(typeName, name);\n }\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(\"sensitive\", () => {\n Reflect.set(node.object, \"sensitive\", desired);\n });\n }\n};\n\nconst applyHandler = (target: SignalTarget, info: TypeInfo, name: string, next: Props): void => {\n const value = next[name];\n\n if (typeof value === \"function\") {\n connectHandler(target, name, signalForProp(target, info, name), value as SignalHandler);\n } else {\n disconnectHandler(target, name);\n }\n};\n\nconst applyHandlers = (target: SignalTarget, info: TypeInfo, prev: Props, next: Props): void => {\n eachChangedName(prev, next, (name) => {\n if (isHandlerName(name) && !hasProperty(info, name)) {\n applyHandler(target, info, name, next);\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 teardownBehaviors = (node: ElementNode): void => {\n flushDirty.delete(node);\n unwatchMap(node);\n\n for (const [behavior, context] of node.contexts) {\n behavior.teardown?.(node.object, context);\n }\n};\n\nconst applyAccessible = (object: GObject.Object, prev: Props | null, next: Props): void => {\n if (object instanceof Gtk.Accessible) {\n applyAccessibleProps(object, prev, next);\n }\n};\n\nconst markAccessible = (node: ElementNode, prev: Props): void => {\n if (!accessibleDirty.has(node)) {\n accessibleDirty.set(node, prev);\n }\n};\n\nconst hasAccessibleProp = (props: Props): boolean => {\n for (const name in props) {\n if (isAccessibleProp(name)) {\n return true;\n }\n }\n\n return false;\n};\n\nconst watchMap = (node: ElementNode): void => {\n const { object } = node;\n\n if (mapWatched.has(node) || !(object instanceof Gtk.Widget) || !hasAccessibleProp(node.props)) {\n return;\n }\n\n const onMapped = (): undefined => {\n pendingMap.add(node);\n setTimeout(settleAccessible, 0);\n };\n\n object.on(\"map\", onMapped);\n\n mapWatched.set(node, () => {\n object.off(\"map\", onMapped);\n });\n};\n\nconst unwatchMap = (node: ElementNode): void => {\n mapWatched.get(node)?.();\n mapWatched.delete(node);\n pendingMap.delete(node);\n accessibleDirty.delete(node);\n};\n\nconst settleAccessible = (): void => {\n drain(pendingMap, (node) => {\n if (node.object instanceof Gtk.Widget && node.object.getMapped()) {\n applyAccessible(node.object, null, node.props);\n }\n });\n};\n\nconst flushAccessible = (): void => {\n for (const [node, prev] of accessibleDirty) {\n applyAccessible(node.object, prev, node.props);\n watchMap(node);\n }\n\n accessibleDirty.clear();\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 applyHandlers(node, info, prev, next);\n markAccessible(node, prev);\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 flushAccessible,\n settleAccessible,\n flushBehaviors,\n teardownBehaviors,\n applyElementProps,\n applyAdoptedProps,\n assertPropsCanChange,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"behaviors.d.ts","sourceRoot":"","sources":["../../src/reconciler/behaviors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAEH,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAM9B,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"behaviors.d.ts","sourceRoot":"","sources":["../../src/reconciler/behaviors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAEH,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAM9B,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAKnF,KAAK,SAAS,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,CAAC,SAAS,OAAO,CAAC,MAAM,IAAI;IACjE,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC;IAC1D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACzD,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,I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,EAAE,CAAC,KAAK,OAAO,EACpC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,KACrC,eAA0E,CAAC;AAsC9E,QAAA,MAAM,mBAAmB,GAAI,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,CAAC,SAAS,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,EACrF,SAAS,KAAK,KAAK,EAAE,KAAK,KAAK,CAAC,EAChC,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,KAAK,IAAI,KAClD,eAAe,CAAC,CAAC,CASlB,CAAC;AAEH,QAAA,MAAM,kBAAkB,GAAI,CAAC,SAAS,OAAO,CAAC,MAAM,GAAG,sBAAsB,EAAE,CAAC,SAAS,KAAK,EAC1F,MAAM,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,KAC7B,eAAe,CAAC,CAAC,CAElB,CAAC;AAEH,OAAO,EACH,kBAAkB,EAClB,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,mBAAmB,GACtB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createApplication, getClassType, TYPE_INVALID, typeFromName, typeIsA, } from "@gtkx/runtime";
|
|
2
|
-
import { getOrInsert, isDeepEqual, structuredClone } from "@gtkx/utils";
|
|
2
|
+
import { getOrInsert, isDeepEqual, kebabCase, structuredClone, unsanitizeIdentifier } from "@gtkx/utils";
|
|
3
|
+
import { getPropertyName } from "./metadata.js";
|
|
3
4
|
import { applyWrite } from "./signals.js";
|
|
4
5
|
import { hasSameText } from "./text.js";
|
|
5
6
|
const childTypeCache = new Map();
|
|
@@ -73,22 +74,45 @@ const list = (prop, hooks) => {
|
|
|
73
74
|
}
|
|
74
75
|
return behavior;
|
|
75
76
|
};
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
if (!state.isPresent || Object.is(state.applied, state.desired)) {
|
|
77
|
+
const settleDeferred = (object, state, prop, canApply) => {
|
|
78
|
+
if (!state.isPresent || Object.is(Reflect.get(object, prop), state.desired)) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
if (canApply !== undefined && !canApply(object, state.desired)) {
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
applyWrite(() => {
|
|
84
|
+
applyWrite(prop, () => {
|
|
85
85
|
Reflect.set(object, prop, state.desired);
|
|
86
86
|
});
|
|
87
|
-
|
|
87
|
+
};
|
|
88
|
+
const scheduleSettle = (object, state, prop, canApply) => {
|
|
89
|
+
if (state.isScheduled) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
state.isScheduled = true;
|
|
93
|
+
queueMicrotask(() => {
|
|
94
|
+
state.isScheduled = false;
|
|
95
|
+
if (state.disconnect !== null) {
|
|
96
|
+
settleDeferred(object, state, prop, canApply);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const watchDrift = (object, state, prop, canApply) => {
|
|
101
|
+
if (state.disconnect !== null) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const signal = `notify::${getPropertyName(object, prop) ?? unsanitizeIdentifier(kebabCase(prop))}`;
|
|
105
|
+
const handler = () => {
|
|
106
|
+
scheduleSettle(object, state, prop, canApply);
|
|
107
|
+
};
|
|
108
|
+
object.on(signal, handler);
|
|
109
|
+
state.disconnect = () => {
|
|
110
|
+
object.off(signal, handler);
|
|
111
|
+
};
|
|
88
112
|
};
|
|
89
113
|
const deferred = (prop, canApply) => ({
|
|
90
114
|
deferred: [prop],
|
|
91
|
-
initialize: () => ({ desired: undefined, isPresent: false,
|
|
115
|
+
initialize: () => ({ desired: undefined, isPresent: false, isScheduled: false, disconnect: null }),
|
|
92
116
|
update: (_object, _prev, next, context) => {
|
|
93
117
|
const state = context;
|
|
94
118
|
state.desired = next[prop];
|
|
@@ -96,12 +120,19 @@ const deferred = (prop, canApply) => ({
|
|
|
96
120
|
return [prop];
|
|
97
121
|
},
|
|
98
122
|
flush: (object, context) => {
|
|
99
|
-
|
|
123
|
+
const state = context;
|
|
124
|
+
settleDeferred(object, state, prop, canApply);
|
|
125
|
+
watchDrift(object, state, prop, canApply);
|
|
126
|
+
},
|
|
127
|
+
teardown: (_object, context) => {
|
|
128
|
+
const state = context;
|
|
129
|
+
state.disconnect?.();
|
|
130
|
+
state.disconnect = null;
|
|
100
131
|
},
|
|
101
132
|
});
|
|
102
133
|
const controlledText = (prop) => value(prop, (object, next) => {
|
|
103
134
|
if (!hasSameText(object, prop, next)) {
|
|
104
|
-
applyWrite(() => {
|
|
135
|
+
applyWrite(prop, () => {
|
|
105
136
|
Reflect.set(object, prop, next);
|
|
106
137
|
});
|
|
107
138
|
}
|