@gtkx/react 1.0.0-rc.2 → 1.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/dist/adw/config.d.ts +1 -0
- package/dist/adw/config.d.ts.map +1 -1
- package/dist/adw/config.js +1 -0
- package/dist/adw/config.js.map +1 -1
- package/dist/adw/dialog.d.ts +1 -0
- package/dist/adw/dialog.d.ts.map +1 -1
- package/dist/adw/dialog.js +1 -0
- package/dist/adw/dialog.js.map +1 -1
- package/dist/adw/element-behaviors.js +8 -39
- package/dist/adw/element-behaviors.js.map +1 -1
- package/dist/adw/element-config.d.ts +7 -4
- package/dist/adw/element-config.d.ts.map +1 -1
- package/dist/adw/element-config.js +32 -41
- package/dist/adw/element-config.js.map +1 -1
- package/dist/adw/index.d.ts +1 -0
- package/dist/adw/index.d.ts.map +1 -1
- package/dist/adw/index.js +1 -0
- package/dist/adw/index.js.map +1 -1
- package/dist/adw/prop-types.d.ts +1 -1
- package/dist/adw/prop-types.d.ts.map +1 -1
- package/dist/adw/prop-types.js.map +1 -1
- package/dist/bootstrap.js +1 -1
- package/dist/bootstrap.js.map +1 -1
- package/dist/components/application.d.ts +1 -0
- package/dist/components/application.d.ts.map +1 -1
- package/dist/components/application.js +1 -0
- package/dist/components/application.js.map +1 -1
- package/dist/components/element.d.ts +0 -1
- package/dist/components/element.d.ts.map +1 -1
- package/dist/components/element.js +0 -1
- package/dist/components/element.js.map +1 -1
- package/dist/components/window.d.ts +1 -0
- package/dist/components/window.d.ts.map +1 -1
- package/dist/components/window.js +14 -2
- package/dist/components/window.js.map +1 -1
- package/dist/config.d.ts +5 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/element-behaviors.js +0 -1
- package/dist/element-behaviors.js.map +1 -1
- package/dist/element-config.d.ts +4 -3
- package/dist/element-config.d.ts.map +1 -1
- package/dist/element-config.js +12 -8
- package/dist/element-config.js.map +1 -1
- package/dist/hooks/use-bind-setting.d.ts +8 -7
- package/dist/hooks/use-bind-setting.d.ts.map +1 -1
- package/dist/hooks/use-bind-setting.js +2 -7
- package/dist/hooks/use-bind-setting.js.map +1 -1
- package/dist/hooks/use-parent-window.d.ts +3 -1
- package/dist/hooks/use-parent-window.d.ts.map +1 -1
- package/dist/hooks/use-parent-window.js +3 -1
- package/dist/hooks/use-parent-window.js.map +1 -1
- package/dist/hooks/use-property.d.ts +2 -2
- package/dist/hooks/use-property.d.ts.map +1 -1
- package/dist/hooks/use-property.js +1 -2
- package/dist/hooks/use-property.js.map +1 -1
- package/dist/hooks/use-setting.d.ts +2 -3
- package/dist/hooks/use-setting.d.ts.map +1 -1
- package/dist/hooks/use-setting.js +2 -3
- package/dist/hooks/use-setting.js.map +1 -1
- package/dist/hooks/use-signal.d.ts +17 -7
- package/dist/hooks/use-signal.d.ts.map +1 -1
- package/dist/hooks/use-signal.js +10 -8
- package/dist/hooks/use-signal.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +5 -3
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +3 -3
- package/dist/internal.js.map +1 -1
- package/dist/prop-types.d.ts +60 -0
- package/dist/prop-types.d.ts.map +1 -1
- package/dist/prop-types.js.map +1 -1
- package/dist/reconciler/apply-props.d.ts.map +1 -1
- package/dist/reconciler/apply-props.js +12 -6
- package/dist/reconciler/apply-props.js.map +1 -1
- package/dist/reconciler/behaviors.d.ts +0 -15
- package/dist/reconciler/behaviors.d.ts.map +1 -1
- package/dist/reconciler/behaviors.js +12 -22
- package/dist/reconciler/behaviors.js.map +1 -1
- package/dist/reconciler/host-config.d.ts +1 -1
- package/dist/reconciler/host-config.d.ts.map +1 -1
- package/dist/reconciler/host-config.js +2 -6
- package/dist/reconciler/host-config.js.map +1 -1
- package/dist/reconciler/instance.js +1 -1
- package/dist/reconciler/instance.js.map +1 -1
- package/dist/reconciler/metadata.d.ts +1 -1
- package/dist/reconciler/metadata.d.ts.map +1 -1
- package/dist/reconciler/metadata.js +7 -7
- package/dist/reconciler/metadata.js.map +1 -1
- package/dist/reconciler/node.d.ts +2 -2
- package/dist/reconciler/node.d.ts.map +1 -1
- package/dist/reconciler/node.js +1 -1
- package/dist/reconciler/node.js.map +1 -1
- package/dist/reconciler/placement.d.ts.map +1 -1
- package/dist/reconciler/placement.js +28 -12
- package/dist/reconciler/placement.js.map +1 -1
- package/dist/reconciler/registry.d.ts +56 -29
- package/dist/reconciler/registry.d.ts.map +1 -1
- package/dist/reconciler/registry.js +27 -26
- package/dist/reconciler/registry.js.map +1 -1
- package/dist/reconciler/root-element.d.ts +0 -1
- package/dist/reconciler/root-element.d.ts.map +1 -1
- package/dist/reconciler/root-element.js +0 -1
- package/dist/reconciler/root-element.js.map +1 -1
- package/dist/reconciler/root.d.ts +8 -22
- package/dist/reconciler/root.d.ts.map +1 -1
- package/dist/reconciler/root.js +5 -23
- package/dist/reconciler/root.js.map +1 -1
- package/dist/reconciler/signals.d.ts +3 -4
- package/dist/reconciler/signals.d.ts.map +1 -1
- package/dist/reconciler/signals.js +14 -26
- package/dist/reconciler/signals.js.map +1 -1
- package/dist/reconciler/text.d.ts.map +1 -1
- package/dist/reconciler/text.js +18 -13
- package/dist/reconciler/text.js.map +1 -1
- package/dist/utils/accessible-metadata.d.ts +0 -7
- package/dist/utils/accessible-metadata.d.ts.map +1 -1
- package/dist/utils/accessible-metadata.js +0 -7
- package/dist/utils/accessible-metadata.js.map +1 -1
- package/dist/utils/accessible-props.d.ts +49 -1
- package/dist/utils/accessible-props.d.ts.map +1 -1
- package/dist/utils/accessible-props.js.map +1 -1
- package/dist/utils/ref-prop.d.ts +0 -6
- package/dist/utils/ref-prop.d.ts.map +1 -1
- package/dist/utils/ref-prop.js +0 -6
- package/dist/utils/ref-prop.js.map +1 -1
- package/dist/utils/settings.d.ts +6 -0
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/settings.js.map +1 -1
- package/env.d.ts +11 -4
- package/package.json +5 -5
- package/src/adw/config.ts +1 -0
- package/src/adw/dialog.tsx +1 -0
- package/src/adw/element-behaviors.ts +8 -39
- package/src/adw/element-config.ts +33 -41
- package/src/adw/index.ts +1 -0
- package/src/adw/prop-types.ts +1 -1
- package/src/bootstrap.ts +1 -1
- package/src/components/application.tsx +1 -0
- package/src/components/element.tsx +0 -1
- package/src/components/window.tsx +16 -2
- package/src/config.ts +5 -2
- package/src/element-behaviors.ts +0 -1
- package/src/element-config.ts +12 -8
- package/src/hooks/use-bind-setting.ts +8 -7
- package/src/hooks/use-parent-window.ts +3 -1
- package/src/hooks/use-property.ts +2 -2
- package/src/hooks/use-setting.ts +2 -3
- package/src/hooks/use-signal.ts +20 -10
- package/src/index.ts +10 -2
- package/src/internal.ts +5 -3
- package/src/prop-types.ts +86 -5
- package/src/reconciler/apply-props.ts +12 -6
- package/src/reconciler/behaviors.ts +14 -23
- package/src/reconciler/host-config.ts +3 -8
- package/src/reconciler/instance.ts +1 -1
- package/src/reconciler/metadata.ts +8 -8
- package/src/reconciler/node.ts +3 -3
- package/src/reconciler/placement.ts +33 -13
- package/src/reconciler/registry.ts +70 -41
- package/src/reconciler/root-element.ts +0 -1
- package/src/reconciler/root.ts +9 -26
- package/src/reconciler/signals.ts +16 -37
- package/src/reconciler/text.ts +21 -14
- package/src/utils/accessible-metadata.ts +0 -7
- package/src/utils/accessible-props.ts +49 -1
- package/src/utils/ref-prop.ts +0 -6
- package/src/utils/settings.ts +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessible-props.js","sourceRoot":"","sources":["../../src/utils/accessible-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,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,EAAE;IACnG,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAE9C,IAAI,QAAQ,EAAE,CAAC;QACX,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAwB,CAAC","sourcesContent":["import * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport type { Props } from \"../reconciler/registry.js\";\nimport { deleteAccessibleMetadata, setAccessibleMetadata } from \"./accessible-metadata.js\";\n\n/**\n * Accessibility props available on every widget. Each member maps to a GTK4 accessible attribute\n * (a `Gtk.AccessibleProperty`, `Gtk.AccessibleState`, or `Gtk.AccessibleRelation`) and is applied\n * to the widget's accessible interface; setting a member to `undefined` resets that attribute to its default.\n */\ntype AccessibleProps = {\n accessibleAutocomplete?: Gtk.AccessibleAutocomplete | null | undefined;\n accessibleDescription?: string | null | undefined;\n accessibleHasPopup?: boolean | null | undefined;\n accessibleKeyShortcuts?: string | null | undefined;\n accessibleLabel?: string | null | undefined;\n accessibleLevel?: number | null | undefined;\n accessibleModal?: boolean | null | undefined;\n accessibleMultiLine?: boolean | null | undefined;\n accessibleMultiSelectable?: boolean | null | undefined;\n accessibleOrientation?: Gtk.Orientation | null | undefined;\n accessiblePlaceholder?: string | null | undefined;\n accessibleReadOnly?: boolean | null | undefined;\n accessibleRequired?: boolean | null | undefined;\n accessibleRoleDescription?: string | null | undefined;\n accessibleSort?: Gtk.AccessibleSort | null | undefined;\n accessibleValueMax?: number | null | undefined;\n accessibleValueMin?: number | null | undefined;\n accessibleValueNow?: number | null | undefined;\n accessibleValueText?: string | null | undefined;\n accessibleHelpText?: string | null | undefined;\n accessibleBusy?: boolean | null | undefined;\n accessibleChecked?: Gtk.AccessibleTristate | null | undefined;\n accessibleDisabled?: boolean | null | undefined;\n accessibleExpanded?: boolean | null | undefined;\n accessibleHidden?: boolean | null | undefined;\n accessibleInvalid?: Gtk.AccessibleInvalidState | null | undefined;\n accessiblePressed?: Gtk.AccessibleTristate | null | undefined;\n accessibleSelected?: boolean | null | undefined;\n accessibleVisited?: boolean | null | undefined;\n accessibleActiveDescendant?: Gtk.Widget | null | undefined;\n accessibleColCount?: number | null | undefined;\n accessibleColIndex?: number | null | undefined;\n accessibleColIndexText?: string | null | undefined;\n accessibleColSpan?: number | null | undefined;\n accessibleControls?: Gtk.Widget[] | null | undefined;\n accessibleDescribedBy?: Gtk.Widget[] | null | undefined;\n accessibleDetails?: Gtk.Widget[] | null | undefined;\n accessibleErrorMessage?: Gtk.Widget[] | null | undefined;\n accessibleFlowTo?: Gtk.Widget[] | null | undefined;\n accessibleLabelledBy?: Gtk.Widget[] | null | undefined;\n accessibleOwns?: Gtk.Widget[] | null | undefined;\n accessiblePosInSet?: number | null | undefined;\n accessibleRowCount?: number | null | undefined;\n accessibleRowIndex?: number | null | undefined;\n accessibleRowIndexText?: string | null | undefined;\n accessibleRowSpan?: number | null | undefined;\n accessibleSetSize?: number | null | undefined;\n};\n\ntype AccessibleValueType = \"string\" | \"boolean\" | \"int\" | \"double\" | \"object\" | \"list\";\n\ntype AccessiblePropertyDescriptor = {\n kind: \"property\";\n property: Gtk.AccessibleProperty;\n type: AccessibleValueType;\n};\n\ntype AccessibleStateDescriptor = {\n kind: \"state\";\n state: Gtk.AccessibleState;\n type: AccessibleValueType;\n};\n\ntype AccessibleRelationDescriptor = {\n kind: \"relation\";\n relation: Gtk.AccessibleRelation;\n type: AccessibleValueType;\n};\n\ntype AccessibleDescriptor = AccessiblePropertyDescriptor | AccessibleStateDescriptor | AccessibleRelationDescriptor;\n\nconst ACCESSIBLE_PROP_MAP: Record<keyof AccessibleProps, AccessibleDescriptor> = {\n accessibleAutocomplete: buildProperty(Gtk.AccessibleProperty.AUTOCOMPLETE, \"int\"),\n accessibleDescription: buildProperty(Gtk.AccessibleProperty.DESCRIPTION, \"string\"),\n accessibleHasPopup: buildProperty(Gtk.AccessibleProperty.HAS_POPUP, \"boolean\"),\n accessibleKeyShortcuts: buildProperty(Gtk.AccessibleProperty.KEY_SHORTCUTS, \"string\"),\n accessibleLabel: buildProperty(Gtk.AccessibleProperty.LABEL, \"string\"),\n accessibleLevel: buildProperty(Gtk.AccessibleProperty.LEVEL, \"int\"),\n accessibleModal: buildProperty(Gtk.AccessibleProperty.MODAL, \"boolean\"),\n accessibleMultiLine: buildProperty(Gtk.AccessibleProperty.MULTI_LINE, \"boolean\"),\n accessibleMultiSelectable: buildProperty(Gtk.AccessibleProperty.MULTI_SELECTABLE, \"boolean\"),\n accessibleOrientation: buildProperty(Gtk.AccessibleProperty.ORIENTATION, \"int\"),\n accessiblePlaceholder: buildProperty(Gtk.AccessibleProperty.PLACEHOLDER, \"string\"),\n accessibleReadOnly: buildProperty(Gtk.AccessibleProperty.READ_ONLY, \"boolean\"),\n accessibleRequired: buildProperty(Gtk.AccessibleProperty.REQUIRED, \"boolean\"),\n accessibleRoleDescription: buildProperty(Gtk.AccessibleProperty.ROLE_DESCRIPTION, \"string\"),\n accessibleSort: buildProperty(Gtk.AccessibleProperty.SORT, \"int\"),\n accessibleValueMax: buildProperty(Gtk.AccessibleProperty.VALUE_MAX, \"double\"),\n accessibleValueMin: buildProperty(Gtk.AccessibleProperty.VALUE_MIN, \"double\"),\n accessibleValueNow: buildProperty(Gtk.AccessibleProperty.VALUE_NOW, \"double\"),\n accessibleValueText: buildProperty(Gtk.AccessibleProperty.VALUE_TEXT, \"string\"),\n accessibleHelpText: buildProperty(Gtk.AccessibleProperty.HELP_TEXT, \"string\"),\n accessibleBusy: buildState(Gtk.AccessibleState.BUSY, \"boolean\"),\n accessibleChecked: buildState(Gtk.AccessibleState.CHECKED, \"int\"),\n accessibleDisabled: buildState(Gtk.AccessibleState.DISABLED, \"boolean\"),\n accessibleExpanded: buildState(Gtk.AccessibleState.EXPANDED, \"int\"),\n accessibleHidden: buildState(Gtk.AccessibleState.HIDDEN, \"boolean\"),\n accessibleInvalid: buildState(Gtk.AccessibleState.INVALID, \"int\"),\n accessiblePressed: buildState(Gtk.AccessibleState.PRESSED, \"int\"),\n accessibleSelected: buildState(Gtk.AccessibleState.SELECTED, \"int\"),\n accessibleVisited: buildState(Gtk.AccessibleState.VISITED, \"int\"),\n accessibleActiveDescendant: buildRelation(Gtk.AccessibleRelation.ACTIVE_DESCENDANT, \"object\"),\n accessibleColCount: buildRelation(Gtk.AccessibleRelation.COL_COUNT, \"int\"),\n accessibleColIndex: buildRelation(Gtk.AccessibleRelation.COL_INDEX, \"int\"),\n accessibleColIndexText: buildRelation(Gtk.AccessibleRelation.COL_INDEX_TEXT, \"string\"),\n accessibleColSpan: buildRelation(Gtk.AccessibleRelation.COL_SPAN, \"int\"),\n accessibleControls: buildRelation(Gtk.AccessibleRelation.CONTROLS, \"list\"),\n accessibleDescribedBy: buildRelation(Gtk.AccessibleRelation.DESCRIBED_BY, \"list\"),\n accessibleDetails: buildRelation(Gtk.AccessibleRelation.DETAILS, \"list\"),\n accessibleErrorMessage: buildRelation(Gtk.AccessibleRelation.ERROR_MESSAGE, \"list\"),\n accessibleFlowTo: buildRelation(Gtk.AccessibleRelation.FLOW_TO, \"list\"),\n accessibleLabelledBy: buildRelation(Gtk.AccessibleRelation.LABELLED_BY, \"list\"),\n accessibleOwns: buildRelation(Gtk.AccessibleRelation.OWNS, \"list\"),\n accessiblePosInSet: buildRelation(Gtk.AccessibleRelation.POS_IN_SET, \"int\"),\n accessibleRowCount: buildRelation(Gtk.AccessibleRelation.ROW_COUNT, \"int\"),\n accessibleRowIndex: buildRelation(Gtk.AccessibleRelation.ROW_INDEX, \"int\"),\n accessibleRowIndexText: buildRelation(Gtk.AccessibleRelation.ROW_INDEX_TEXT, \"string\"),\n accessibleRowSpan: buildRelation(Gtk.AccessibleRelation.ROW_SPAN, \"int\"),\n accessibleSetSize: buildRelation(Gtk.AccessibleRelation.SET_SIZE, \"int\"),\n};\n\nfunction buildProperty(property: Gtk.AccessibleProperty, type: AccessibleValueType): AccessiblePropertyDescriptor {\n return {\n kind: \"property\",\n property,\n type,\n };\n}\n\nfunction buildState(state: Gtk.AccessibleState, type: AccessibleValueType): AccessibleStateDescriptor {\n return {\n kind: \"state\",\n state,\n type,\n };\n}\n\nfunction buildRelation(relation: Gtk.AccessibleRelation, type: AccessibleValueType): AccessibleRelationDescriptor {\n return {\n kind: \"relation\",\n relation,\n type,\n };\n}\n\nconst buildValue = (descriptor: AccessibleDescriptor, jsValue: unknown): GObject.Value => {\n switch (descriptor.type) {\n case \"string\": {\n return GObject.buildValue(GObject.TYPE_STRING, (v) => {\n v.setString(jsValue as string);\n });\n }\n case \"boolean\": {\n return GObject.buildValue(GObject.TYPE_BOOLEAN, (v) => {\n v.setBoolean(jsValue as boolean);\n });\n }\n case \"int\": {\n return GObject.buildValue(GObject.TYPE_INT, (v) => {\n v.setInt(jsValue as number);\n });\n }\n case \"double\": {\n return GObject.buildValue(GObject.TYPE_DOUBLE, (v) => {\n v.setDouble(jsValue as number);\n });\n }\n case \"object\": {\n return GObject.buildValue(GObject.TYPE_OBJECT, (v) => {\n v.setObject(jsValue as GObject.Object | null);\n });\n }\n case \"list\": {\n const list = Gtk.AccessibleList.newFromList(jsValue as Gtk.Widget[]);\n\n return GObject.buildValue(Gtk.AccessibleList.prototype.__type__, (v) => {\n v.setBoxed(list);\n });\n }\n }\n};\n\nconst isAccessibleProp = (name: string): name is keyof AccessibleProps =>\n Object.hasOwn(ACCESSIBLE_PROP_MAP, name);\n\nfunction applyDescriptor(widget: Gtk.Accessible, descriptor: AccessibleDescriptor, newValue: unknown): void {\n const value = buildValue(descriptor, newValue);\n\n switch (descriptor.kind) {\n case \"property\": {\n widget.updateProperty([descriptor.property], [value]);\n break;\n }\n case \"state\": {\n widget.updateState([descriptor.state], [value]);\n break;\n }\n case \"relation\": {\n widget.updateRelation([descriptor.relation], [value]);\n break;\n }\n }\n}\n\nfunction resetDescriptor(widget: Gtk.Accessible, descriptor: AccessibleDescriptor): void {\n switch (descriptor.kind) {\n case \"property\": {\n widget.resetProperty(descriptor.property);\n break;\n }\n case \"state\": {\n widget.resetState(descriptor.state);\n break;\n }\n case \"relation\": {\n widget.resetRelation(descriptor.relation);\n break;\n }\n }\n}\n\nconst applyChangedProp = (widget: Gtk.Accessible, name: keyof AccessibleProps, newValue: unknown): void => {\n if (newValue == null) {\n resetDescriptor(widget, ACCESSIBLE_PROP_MAP[name]);\n deleteAccessibleMetadata(widget, name);\n } else {\n applyDescriptor(widget, ACCESSIBLE_PROP_MAP[name], newValue);\n setAccessibleMetadata(widget, name, newValue);\n }\n};\n\nconst applyChangedProps = (widget: Gtk.Accessible, oldProps: Props | null, newProps: Props): void => {\n for (const name in newProps) {\n if (!isAccessibleProp(name)) {\n continue;\n }\n\n const newValue = newProps[name];\n\n if (oldProps?.[name] !== newValue) {\n applyChangedProp(widget, name, newValue);\n }\n }\n};\n\nconst isRemovedAccessibleProp = (name: string, oldProps: Props, newProps: Props): name is keyof AccessibleProps =>\n !Object.hasOwn(newProps, name) && isAccessibleProp(name) && oldProps[name] !== undefined;\n\nconst resetRemovedProps = (widget: Gtk.Accessible, oldProps: Props, newProps: Props): void => {\n for (const name in oldProps) {\n if (!isRemovedAccessibleProp(name, oldProps, newProps)) {\n continue;\n }\n\n resetDescriptor(widget, ACCESSIBLE_PROP_MAP[name]);\n deleteAccessibleMetadata(widget, name);\n }\n};\n\nconst applyAccessibleProps = (widget: Gtk.Accessible, oldProps: Props | null, newProps: Props): void => {\n applyChangedProps(widget, oldProps, newProps);\n\n if (oldProps) {\n resetRemovedProps(widget, oldProps, newProps);\n }\n};\n\nexport { isAccessibleProp, applyAccessibleProps, type AccessibleProps };\n"]}
|
|
1
|
+
{"version":3,"file":"accessible-props.js","sourceRoot":"","sources":["../../src/utils/accessible-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAA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AM,oBAAoB,GAAG,CAAC,MAAsB,EAAE,QAAsB,EAAE,QAAe,EAAQ,EAAE;IACnG,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAE9C,IAAI,QAAQ,EAAE,CAAC;QACX,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAwB,CAAC","sourcesContent":["import * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport type { Props } from \"../reconciler/registry.js\";\nimport { deleteAccessibleMetadata, setAccessibleMetadata } from \"./accessible-metadata.js\";\n\n/**\n * Accessibility props available on every widget. Each member maps to a GTK4 accessible attribute\n * (a `Gtk.AccessibleProperty`, `Gtk.AccessibleState`, or `Gtk.AccessibleRelation`) and is applied\n * to the widget's accessible interface. Setting a member to `null` or `undefined`, or dropping it from the\n * props, resets that attribute to its default.\n */\ntype AccessibleProps = {\n /** How the widget completes the text being typed into it. */\n accessibleAutocomplete?: Gtk.AccessibleAutocomplete | null | undefined;\n /** Longer description announced after the label. */\n accessibleDescription?: string | null | undefined;\n /** Whether activating the widget opens a popup. */\n accessibleHasPopup?: boolean | null | undefined;\n /** Keyboard shortcuts that activate the widget. */\n accessibleKeyShortcuts?: string | null | undefined;\n /** Short name announced for the widget. */\n accessibleLabel?: string | null | undefined;\n /** Depth of the widget within a hierarchy of headings, list items, or tree rows. */\n accessibleLevel?: number | null | undefined;\n /** Whether the widget blocks interaction with everything behind it. */\n accessibleModal?: boolean | null | undefined;\n /** Whether the text input accepts more than one line. */\n accessibleMultiLine?: boolean | null | undefined;\n /** Whether more than one of the widget's items can be selected at a time. */\n accessibleMultiSelectable?: boolean | null | undefined;\n /** Whether the widget arranges its items horizontally or vertically. */\n accessibleOrientation?: Gtk.Orientation | null | undefined;\n /** Hint announced while the input is empty. */\n accessiblePlaceholder?: string | null | undefined;\n /** Whether the value can be read but not changed. */\n accessibleReadOnly?: boolean | null | undefined;\n /** Whether a value has to be supplied before the form can be submitted. */\n accessibleRequired?: boolean | null | undefined;\n /** Wording that replaces the default announcement of the widget's role. */\n accessibleRoleDescription?: string | null | undefined;\n /** Direction the widget's items are sorted in. */\n accessibleSort?: Gtk.AccessibleSort | null | undefined;\n /** Upper bound of the widget's value range. */\n accessibleValueMax?: number | null | undefined;\n /** Lower bound of the widget's value range. */\n accessibleValueMin?: number | null | undefined;\n /** Current value within the widget's range. */\n accessibleValueNow?: number | null | undefined;\n /** Wording announced in place of the numeric value. */\n accessibleValueText?: string | null | undefined;\n /** Help text describing how to use the widget. */\n accessibleHelpText?: string | null | undefined;\n /** Whether the widget is still loading and its content may yet change. */\n accessibleBusy?: boolean | null | undefined;\n /** Checked state of a check button or menu item, which may be mixed. */\n accessibleChecked?: Gtk.AccessibleTristate | null | undefined;\n /** Whether the widget is visible but cannot be edited or operated. */\n accessibleDisabled?: boolean | null | undefined;\n /** Whether the content the widget discloses is showing. */\n accessibleExpanded?: boolean | null | undefined;\n /** Whether the widget is kept out of the accessibility tree. */\n accessibleHidden?: boolean | null | undefined;\n /** Whether the entered value fails validation, and in what way. */\n accessibleInvalid?: Gtk.AccessibleInvalidState | null | undefined;\n /** Pressed state of a toggle button, which may be mixed. */\n accessiblePressed?: Gtk.AccessibleTristate | null | undefined;\n /** Whether the widget is selected within its container. */\n accessibleSelected?: boolean | null | undefined;\n /** Whether the link has already been followed. */\n accessibleVisited?: boolean | null | undefined;\n /** Descendant that holds the focus while the widget itself keeps it. */\n accessibleActiveDescendant?: Gtk.Widget | null | undefined;\n /** Total number of columns in the table, including any that are not rendered. */\n accessibleColCount?: number | null | undefined;\n /** One-based column position of the cell within its table. */\n accessibleColIndex?: number | null | undefined;\n /** Wording announced in place of the numeric column position. */\n accessibleColIndexText?: string | null | undefined;\n /** Number of columns the cell spans. */\n accessibleColSpan?: number | null | undefined;\n /** Widgets whose content or presence this widget controls. */\n accessibleControls?: Gtk.Widget[] | null | undefined;\n /** Widgets that describe this one. */\n accessibleDescribedBy?: Gtk.Widget[] | null | undefined;\n /** Widgets holding extended detail about this one. */\n accessibleDetails?: Gtk.Widget[] | null | undefined;\n /** Widgets holding the message that explains why the value is invalid. */\n accessibleErrorMessage?: Gtk.Widget[] | null | undefined;\n /** Widgets to read next, overriding the default reading order. */\n accessibleFlowTo?: Gtk.Widget[] | null | undefined;\n /** Widgets that label this one. */\n accessibleLabelledBy?: Gtk.Widget[] | null | undefined;\n /** Widgets this one owns that the widget hierarchy does not already imply. */\n accessibleOwns?: Gtk.Widget[] | null | undefined;\n /** One-based position of the widget within its set. */\n accessiblePosInSet?: number | null | undefined;\n /** Total number of rows in the table, including any that are not rendered. */\n accessibleRowCount?: number | null | undefined;\n /** One-based row position of the cell within its table. */\n accessibleRowIndex?: number | null | undefined;\n /** Wording announced in place of the numeric row position. */\n accessibleRowIndexText?: string | null | undefined;\n /** Number of rows the cell spans. */\n accessibleRowSpan?: number | null | undefined;\n /** Total number of items in the set the widget belongs to. */\n accessibleSetSize?: number | null | undefined;\n};\n\ntype AccessibleValueType = \"string\" | \"boolean\" | \"int\" | \"double\" | \"object\" | \"list\";\n\ntype AccessiblePropertyDescriptor = {\n kind: \"property\";\n property: Gtk.AccessibleProperty;\n type: AccessibleValueType;\n};\n\ntype AccessibleStateDescriptor = {\n kind: \"state\";\n state: Gtk.AccessibleState;\n type: AccessibleValueType;\n};\n\ntype AccessibleRelationDescriptor = {\n kind: \"relation\";\n relation: Gtk.AccessibleRelation;\n type: AccessibleValueType;\n};\n\ntype AccessibleDescriptor = AccessiblePropertyDescriptor | AccessibleStateDescriptor | AccessibleRelationDescriptor;\n\nconst ACCESSIBLE_PROP_MAP: Record<keyof AccessibleProps, AccessibleDescriptor> = {\n accessibleAutocomplete: buildProperty(Gtk.AccessibleProperty.AUTOCOMPLETE, \"int\"),\n accessibleDescription: buildProperty(Gtk.AccessibleProperty.DESCRIPTION, \"string\"),\n accessibleHasPopup: buildProperty(Gtk.AccessibleProperty.HAS_POPUP, \"boolean\"),\n accessibleKeyShortcuts: buildProperty(Gtk.AccessibleProperty.KEY_SHORTCUTS, \"string\"),\n accessibleLabel: buildProperty(Gtk.AccessibleProperty.LABEL, \"string\"),\n accessibleLevel: buildProperty(Gtk.AccessibleProperty.LEVEL, \"int\"),\n accessibleModal: buildProperty(Gtk.AccessibleProperty.MODAL, \"boolean\"),\n accessibleMultiLine: buildProperty(Gtk.AccessibleProperty.MULTI_LINE, \"boolean\"),\n accessibleMultiSelectable: buildProperty(Gtk.AccessibleProperty.MULTI_SELECTABLE, \"boolean\"),\n accessibleOrientation: buildProperty(Gtk.AccessibleProperty.ORIENTATION, \"int\"),\n accessiblePlaceholder: buildProperty(Gtk.AccessibleProperty.PLACEHOLDER, \"string\"),\n accessibleReadOnly: buildProperty(Gtk.AccessibleProperty.READ_ONLY, \"boolean\"),\n accessibleRequired: buildProperty(Gtk.AccessibleProperty.REQUIRED, \"boolean\"),\n accessibleRoleDescription: buildProperty(Gtk.AccessibleProperty.ROLE_DESCRIPTION, \"string\"),\n accessibleSort: buildProperty(Gtk.AccessibleProperty.SORT, \"int\"),\n accessibleValueMax: buildProperty(Gtk.AccessibleProperty.VALUE_MAX, \"double\"),\n accessibleValueMin: buildProperty(Gtk.AccessibleProperty.VALUE_MIN, \"double\"),\n accessibleValueNow: buildProperty(Gtk.AccessibleProperty.VALUE_NOW, \"double\"),\n accessibleValueText: buildProperty(Gtk.AccessibleProperty.VALUE_TEXT, \"string\"),\n accessibleHelpText: buildProperty(Gtk.AccessibleProperty.HELP_TEXT, \"string\"),\n accessibleBusy: buildState(Gtk.AccessibleState.BUSY, \"boolean\"),\n accessibleChecked: buildState(Gtk.AccessibleState.CHECKED, \"int\"),\n accessibleDisabled: buildState(Gtk.AccessibleState.DISABLED, \"boolean\"),\n accessibleExpanded: buildState(Gtk.AccessibleState.EXPANDED, \"int\"),\n accessibleHidden: buildState(Gtk.AccessibleState.HIDDEN, \"boolean\"),\n accessibleInvalid: buildState(Gtk.AccessibleState.INVALID, \"int\"),\n accessiblePressed: buildState(Gtk.AccessibleState.PRESSED, \"int\"),\n accessibleSelected: buildState(Gtk.AccessibleState.SELECTED, \"int\"),\n accessibleVisited: buildState(Gtk.AccessibleState.VISITED, \"int\"),\n accessibleActiveDescendant: buildRelation(Gtk.AccessibleRelation.ACTIVE_DESCENDANT, \"object\"),\n accessibleColCount: buildRelation(Gtk.AccessibleRelation.COL_COUNT, \"int\"),\n accessibleColIndex: buildRelation(Gtk.AccessibleRelation.COL_INDEX, \"int\"),\n accessibleColIndexText: buildRelation(Gtk.AccessibleRelation.COL_INDEX_TEXT, \"string\"),\n accessibleColSpan: buildRelation(Gtk.AccessibleRelation.COL_SPAN, \"int\"),\n accessibleControls: buildRelation(Gtk.AccessibleRelation.CONTROLS, \"list\"),\n accessibleDescribedBy: buildRelation(Gtk.AccessibleRelation.DESCRIBED_BY, \"list\"),\n accessibleDetails: buildRelation(Gtk.AccessibleRelation.DETAILS, \"list\"),\n accessibleErrorMessage: buildRelation(Gtk.AccessibleRelation.ERROR_MESSAGE, \"list\"),\n accessibleFlowTo: buildRelation(Gtk.AccessibleRelation.FLOW_TO, \"list\"),\n accessibleLabelledBy: buildRelation(Gtk.AccessibleRelation.LABELLED_BY, \"list\"),\n accessibleOwns: buildRelation(Gtk.AccessibleRelation.OWNS, \"list\"),\n accessiblePosInSet: buildRelation(Gtk.AccessibleRelation.POS_IN_SET, \"int\"),\n accessibleRowCount: buildRelation(Gtk.AccessibleRelation.ROW_COUNT, \"int\"),\n accessibleRowIndex: buildRelation(Gtk.AccessibleRelation.ROW_INDEX, \"int\"),\n accessibleRowIndexText: buildRelation(Gtk.AccessibleRelation.ROW_INDEX_TEXT, \"string\"),\n accessibleRowSpan: buildRelation(Gtk.AccessibleRelation.ROW_SPAN, \"int\"),\n accessibleSetSize: buildRelation(Gtk.AccessibleRelation.SET_SIZE, \"int\"),\n};\n\nfunction buildProperty(property: Gtk.AccessibleProperty, type: AccessibleValueType): AccessiblePropertyDescriptor {\n return {\n kind: \"property\",\n property,\n type,\n };\n}\n\nfunction buildState(state: Gtk.AccessibleState, type: AccessibleValueType): AccessibleStateDescriptor {\n return {\n kind: \"state\",\n state,\n type,\n };\n}\n\nfunction buildRelation(relation: Gtk.AccessibleRelation, type: AccessibleValueType): AccessibleRelationDescriptor {\n return {\n kind: \"relation\",\n relation,\n type,\n };\n}\n\nconst buildValue = (descriptor: AccessibleDescriptor, jsValue: unknown): GObject.Value => {\n switch (descriptor.type) {\n case \"string\": {\n return GObject.buildValue(GObject.TYPE_STRING, (v) => {\n v.setString(jsValue as string);\n });\n }\n case \"boolean\": {\n return GObject.buildValue(GObject.TYPE_BOOLEAN, (v) => {\n v.setBoolean(jsValue as boolean);\n });\n }\n case \"int\": {\n return GObject.buildValue(GObject.TYPE_INT, (v) => {\n v.setInt(jsValue as number);\n });\n }\n case \"double\": {\n return GObject.buildValue(GObject.TYPE_DOUBLE, (v) => {\n v.setDouble(jsValue as number);\n });\n }\n case \"object\": {\n return GObject.buildValue(GObject.TYPE_OBJECT, (v) => {\n v.setObject(jsValue as GObject.Object | null);\n });\n }\n case \"list\": {\n const list = Gtk.AccessibleList.newFromList(jsValue as Gtk.Widget[]);\n\n return GObject.buildValue(Gtk.AccessibleList.prototype.__type__, (v) => {\n v.setBoxed(list);\n });\n }\n }\n};\n\nconst isAccessibleProp = (name: string): name is keyof AccessibleProps =>\n Object.hasOwn(ACCESSIBLE_PROP_MAP, name);\n\nfunction applyDescriptor(widget: Gtk.Accessible, descriptor: AccessibleDescriptor, newValue: unknown): void {\n const value = buildValue(descriptor, newValue);\n\n switch (descriptor.kind) {\n case \"property\": {\n widget.updateProperty([descriptor.property], [value]);\n break;\n }\n case \"state\": {\n widget.updateState([descriptor.state], [value]);\n break;\n }\n case \"relation\": {\n widget.updateRelation([descriptor.relation], [value]);\n break;\n }\n }\n}\n\nfunction resetDescriptor(widget: Gtk.Accessible, descriptor: AccessibleDescriptor): void {\n switch (descriptor.kind) {\n case \"property\": {\n widget.resetProperty(descriptor.property);\n break;\n }\n case \"state\": {\n widget.resetState(descriptor.state);\n break;\n }\n case \"relation\": {\n widget.resetRelation(descriptor.relation);\n break;\n }\n }\n}\n\nconst applyChangedProp = (widget: Gtk.Accessible, name: keyof AccessibleProps, newValue: unknown): void => {\n if (newValue == null) {\n resetDescriptor(widget, ACCESSIBLE_PROP_MAP[name]);\n deleteAccessibleMetadata(widget, name);\n } else {\n applyDescriptor(widget, ACCESSIBLE_PROP_MAP[name], newValue);\n setAccessibleMetadata(widget, name, newValue);\n }\n};\n\nconst applyChangedProps = (widget: Gtk.Accessible, oldProps: Props | null, newProps: Props): void => {\n for (const name in newProps) {\n if (!isAccessibleProp(name)) {\n continue;\n }\n\n const newValue = newProps[name];\n\n if (oldProps?.[name] !== newValue) {\n applyChangedProp(widget, name, newValue);\n }\n }\n};\n\nconst isRemovedAccessibleProp = (name: string, oldProps: Props, newProps: Props): name is keyof AccessibleProps =>\n !Object.hasOwn(newProps, name) && isAccessibleProp(name) && oldProps[name] !== undefined;\n\nconst resetRemovedProps = (widget: Gtk.Accessible, oldProps: Props, newProps: Props): void => {\n for (const name in oldProps) {\n if (!isRemovedAccessibleProp(name, oldProps, newProps)) {\n continue;\n }\n\n resetDescriptor(widget, ACCESSIBLE_PROP_MAP[name]);\n deleteAccessibleMetadata(widget, name);\n }\n};\n\nconst applyAccessibleProps = (widget: Gtk.Accessible, oldProps: Props | null, newProps: Props): void => {\n applyChangedProps(widget, oldProps, newProps);\n\n if (oldProps) {\n resetRemovedProps(widget, oldProps, newProps);\n }\n};\n\nexport { isAccessibleProp, applyAccessibleProps, type AccessibleProps };\n"]}
|
package/dist/utils/ref-prop.d.ts
CHANGED
|
@@ -4,12 +4,6 @@ import type { RefObject } from "react";
|
|
|
4
4
|
* or null or undefined when the target is absent.
|
|
5
5
|
*/
|
|
6
6
|
type RefProp<T extends object> = T | RefObject<T | null> | null | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Resolves a {@link RefProp} to the concrete object it points at, or null when it is absent or unresolved.
|
|
9
|
-
*
|
|
10
|
-
* @param prop The target object, a ref to one, or null/undefined.
|
|
11
|
-
* @returns The resolved object, or null.
|
|
12
|
-
*/
|
|
13
7
|
declare const resolveRefProp: <T extends object>(prop: RefProp<T>) => T | null;
|
|
14
8
|
export { resolveRefProp, type RefProp };
|
|
15
9
|
//# sourceMappingURL=ref-prop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref-prop.d.ts","sourceRoot":"","sources":["../../src/utils/ref-prop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAK5E
|
|
1
|
+
{"version":3,"file":"ref-prop.d.ts","sourceRoot":"","sources":["../../src/utils/ref-prop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;GAGG;AACH,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAK5E,QAAA,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,CAAC,GAAG,IAUhE,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,KAAK,OAAO,EAAE,CAAC"}
|
package/dist/utils/ref-prop.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
const isRefObject = (value) => typeof value === "object" && "current" in value;
|
|
2
|
-
/**
|
|
3
|
-
* Resolves a {@link RefProp} to the concrete object it points at, or null when it is absent or unresolved.
|
|
4
|
-
*
|
|
5
|
-
* @param prop The target object, a ref to one, or null/undefined.
|
|
6
|
-
* @returns The resolved object, or null.
|
|
7
|
-
*/
|
|
8
2
|
const resolveRefProp = (prop) => {
|
|
9
3
|
if (prop === null || prop === undefined) {
|
|
10
4
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref-prop.js","sourceRoot":"","sources":["../../src/utils/ref-prop.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,GAAG,CAAmB,KAA8B,EAAgC,EAAE,CACnG,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"ref-prop.js","sourceRoot":"","sources":["../../src/utils/ref-prop.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,GAAG,CAAmB,KAA8B,EAAgC,EAAE,CACnG,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,CAAC;AAEpD,MAAM,cAAc,GAAG,CAAmB,IAAgB,EAAY,EAAE;IACpE,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAgB,CAAC","sourcesContent":["import type { RefObject } from \"react\";\n\n/**\n * A way to reach a GObject: the object itself, a ref object whose `current` is the object or null,\n * or null or undefined when the target is absent.\n */\ntype RefProp<T extends object> = T | RefObject<T | null> | null | undefined;\n\nconst isRefObject = <T extends object>(value: T | RefObject<T | null>): value is RefObject<T | null> =>\n typeof value === \"object\" && \"current\" in value;\n\nconst resolveRefProp = <T extends object>(prop: RefProp<T>): T | null => {\n if (prop === null || prop === undefined) {\n return null;\n }\n\n if (isRefObject(prop)) {\n return prop.current;\n }\n\n return prop;\n};\n\nexport { resolveRefProp, type RefProp };\n"]}
|
package/dist/utils/settings.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type * as Gio from "@gtkx/gi/gio";
|
|
2
2
|
import { type VariantValue } from "./variant.js";
|
|
3
|
+
/** Maps each key of a GSettings schema to its kind: a GVariant type string, or `enum` or `flags`. */
|
|
3
4
|
type SettingsSchemaKeys = Record<string, string>;
|
|
4
5
|
type SettingKindValue<S extends string> = S extends "enum" | "flags" ? number : VariantValue<S>;
|
|
6
|
+
/** The JavaScript type key `P` holds: `number` for `enum` and `flags`, otherwise the unpacked GVariant. */
|
|
5
7
|
type SettingValue<K extends SettingsSchemaKeys, P extends keyof K> = SettingKindValue<K[P] & string>;
|
|
8
|
+
/** A GSettings schema, as described by the modules GTKX generates from a project's `.gschema.xml` files. */
|
|
6
9
|
type SettingsSchema<K extends SettingsSchemaKeys = SettingsSchemaKeys> = {
|
|
10
|
+
/** Schema id it is looked up by, such as `org.gtkx.Example`. */
|
|
7
11
|
id: string;
|
|
12
|
+
/** Path a relocatable schema is instantiated at, or `null` to use the schema's own path. */
|
|
8
13
|
path: string | null;
|
|
14
|
+
/** Kind of every key the schema declares, which types reads and writes of that key. */
|
|
9
15
|
keys: K;
|
|
10
16
|
};
|
|
11
17
|
type ResolvedSettingAccessor<K extends SettingsSchemaKeys, P extends keyof K> = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/utils/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,cAAc,CAAC;AACzC,OAAO,EAAgD,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/F,KAAK,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACjD,KAAK,gBAAgB,CAAC,CAAC,SAAS,MAA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AACN,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAC3B,QAAsB,EACtB,MAAyB,EACzB,GAAe,EACc,EAAE;IAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE9B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,QAAQ,GAAG,+BAA+B,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,CAAwC,CAAC;IAEnG,OAAO;QACH,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC;QAC3C,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC;KAC9C,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAmE,CAAC","sourcesContent":["import type * as Gio from \"@gtkx/gi/gio\";\nimport { packVariant, parseVariantType, unpackVariant, type VariantValue } from \"./variant.js\";\n\n/** Maps each key of a GSettings schema to its kind: a GVariant type string, or `enum` or `flags`. */\ntype SettingsSchemaKeys = Record<string, string>;\ntype SettingKindValue<S extends string> = S extends \"enum\" | \"flags\" ? number : VariantValue<S>;\n/** The JavaScript type key `P` holds: `number` for `enum` and `flags`, otherwise the unpacked GVariant. */\ntype SettingValue<K extends SettingsSchemaKeys, P extends keyof K> = SettingKindValue<K[P] & string>;\n\n/** A GSettings schema, as described by the modules GTKX generates from a project's `.gschema.xml` files. */\ntype SettingsSchema<K extends SettingsSchemaKeys = SettingsSchemaKeys> = {\n /** Schema id it is looked up by, such as `org.gtkx.Example`. */\n id: string;\n /** Path a relocatable schema is instantiated at, or `null` to use the schema's own path. */\n path: string | null;\n /** Kind of every key the schema declares, which types reads and writes of that key. */\n keys: K;\n};\n\ntype SettingAccessor<T = unknown> = {\n get: (settings: Gio.Settings, key: string) => T;\n set: (settings: Gio.Settings, key: string, value: T) => void;\n};\n\ntype ResolvedSettingAccessor<K extends SettingsSchemaKeys, P extends keyof K> = {\n get: () => SettingValue<K, P>;\n set: (value: SettingValue<K, P>) => void;\n};\n\nconst ACCESSORS: Record<string, SettingAccessor<number> | undefined> = {\n enum: {\n get: (settings: Gio.Settings, key: string) => settings.getEnum(key),\n set: (settings: Gio.Settings, key: string, value: number) => {\n settings.setEnum(key, value);\n },\n },\n flags: {\n get: (settings: Gio.Settings, key: string) => settings.getFlags(key),\n set: (settings: Gio.Settings, key: string, value: number) => {\n settings.setFlags(key, value);\n },\n },\n};\n\nconst defaultAccessor = (kind: string): SettingAccessor => {\n const node = parseVariantType(kind);\n\n return {\n get: (settings: Gio.Settings, key: string) => unpackVariant(node, settings.getValue(key)),\n set: (settings: Gio.Settings, key: string, value: unknown) => {\n settings.setValue(key, packVariant(node, value));\n },\n };\n};\n\nconst resolveSettingAccessor = <K extends SettingsSchemaKeys, P extends keyof K>(\n settings: Gio.Settings,\n schema: SettingsSchema<K>,\n key: P & string,\n): ResolvedSettingAccessor<K, P> => {\n const kind = schema.keys[key];\n\n if (kind === undefined) {\n throw new Error(`Key \"${key}\" is not defined in schema \"${schema.id}\"`);\n }\n\n const accessor = (ACCESSORS[kind] ?? defaultAccessor(kind)) as SettingAccessor<SettingValue<K, P>>;\n\n return {\n get: accessor.get.bind(null, settings, key),\n set: accessor.set.bind(null, settings, key),\n };\n};\n\nexport { resolveSettingAccessor, type SettingsSchemaKeys, type SettingValue, type SettingsSchema };\n"]}
|
package/env.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
declare module "virtual:gtkx-config" {
|
|
2
|
-
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
export const
|
|
2
|
+
/** The GObject signal each `on…` handler prop connects to, keyed by GLib type name. */
|
|
3
|
+
export const signals: Record<string, Record<string, string>>;
|
|
4
|
+
/** Props GTK accepts only while an object is being built, keyed by GLib type name. */
|
|
5
|
+
export const constructOnlyProps: Record<string, Set<string>>;
|
|
6
|
+
/** Props that can be passed to the constructor, keyed by GLib type name. */
|
|
7
|
+
export const constructProps: Record<string, Set<string>>;
|
|
8
|
+
/** The value each property is reset to when its prop is removed, keyed by GLib type name. */
|
|
9
|
+
export const defaultProps: Record<string, Record<string, unknown>>;
|
|
10
|
+
/** The application id from `gtkx.config.ts`, used as the default for `<GtkApplication>`. */
|
|
6
11
|
export const applicationId: import("@gtkx/config").ResolvedConfig["applicationId"];
|
|
12
|
+
/** Signals a user can trigger, which stay blocked while props are written, keyed by GLib type name. */
|
|
7
13
|
export const userEventSignals: import("@gtkx/config").ResolvedConfig["userEventSignals"];
|
|
14
|
+
/** The element configuration the project's `gtkx.config.ts` contributes, keyed by GLib type name. */
|
|
8
15
|
export const elements: Record<string, import("@gtkx/react/config").ElementConfig>;
|
|
9
16
|
}
|
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.4",
|
|
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,12 +76,12 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"react-reconciler": "^0.33.0",
|
|
79
|
-
"@gtkx/
|
|
80
|
-
"@gtkx/
|
|
81
|
-
"@gtkx/utils": "1.0.0-rc.
|
|
79
|
+
"@gtkx/runtime": "1.0.0-rc.4",
|
|
80
|
+
"@gtkx/config": "1.0.0-rc.4",
|
|
81
|
+
"@gtkx/utils": "1.0.0-rc.4"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@types/react": "^19.2.
|
|
84
|
+
"@types/react": "^19.2.18",
|
|
85
85
|
"@types/react-reconciler": "^0.33.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
package/src/adw/config.ts
CHANGED
package/src/adw/dialog.tsx
CHANGED
|
@@ -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 |
|
|
@@ -71,44 +71,13 @@ const pageHostChildren = addRemoveSlot<Adw.PreferencesPage, PageHost>(
|
|
|
71
71
|
},
|
|
72
72
|
);
|
|
73
73
|
|
|
74
|
-
/** The runtime half of the built-in element configuration: the behaviors bound to each GObject type. */
|
|
75
74
|
const BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {
|
|
76
|
-
|
|
75
|
+
...forTypes(CHILD_SETTER_TYPES, {
|
|
77
76
|
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: {
|
|
77
|
+
}),
|
|
78
|
+
...forTypes(CONTENT_SETTER_TYPES, {
|
|
110
79
|
behaviors: [contentSetter],
|
|
111
|
-
},
|
|
80
|
+
}),
|
|
112
81
|
AdwDialog: {
|
|
113
82
|
behaviors: [childSetter, breakpoints],
|
|
114
83
|
},
|
|
@@ -363,8 +332,8 @@ const BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {
|
|
|
363
332
|
dialog.setResponseAppearance(response.id, response.appearance);
|
|
364
333
|
}
|
|
365
334
|
|
|
366
|
-
if (response.
|
|
367
|
-
dialog.setResponseEnabled(response.id, response.
|
|
335
|
+
if (response.isEnabled !== undefined) {
|
|
336
|
+
dialog.setResponseEnabled(response.id, response.isEnabled);
|
|
368
337
|
}
|
|
369
338
|
},
|
|
370
339
|
remove: (dialog, response) => {
|
|
@@ -1,56 +1,42 @@
|
|
|
1
|
-
import { type ElementConfig, internal, type ModuleExport } from "../reconciler/registry.js";
|
|
1
|
+
import { type ElementConfig, forTypes, internal, type ModuleExport } from "../reconciler/registry.js";
|
|
2
2
|
|
|
3
|
+
const CHILD_SETTER_TYPES: string[] = [
|
|
4
|
+
"AdwBin",
|
|
5
|
+
"AdwClamp",
|
|
6
|
+
"AdwClampScrollable",
|
|
7
|
+
"AdwNavigationPage",
|
|
8
|
+
"AdwSplitButton",
|
|
9
|
+
"AdwStatusPage",
|
|
10
|
+
"AdwTabOverview",
|
|
11
|
+
"AdwToastOverlay",
|
|
12
|
+
"AdwToggle",
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const CONTENT_SETTER_TYPES: string[] = ["AdwBottomSheet", "AdwFlap", "AdwOverlaySplitView"];
|
|
3
16
|
const childrenProps = internal("ChildrenProps");
|
|
4
17
|
const breakpointsProps = adw("AdwBreakpointsProps");
|
|
5
18
|
const preferencesRowProps = adw("AdwPreferencesRowProps");
|
|
6
19
|
|
|
7
20
|
/**
|
|
8
|
-
* The
|
|
9
|
-
* generated element extends,
|
|
10
|
-
* parent.
|
|
21
|
+
* The framework's own element configuration for the Adwaita types it customizes: the base props interface each
|
|
22
|
+
* generated element extends, the component that wraps it, the GObject properties left out of its generated
|
|
23
|
+
* props, and whether its GObject is created by its parent. Carries no behaviors, so importing it never
|
|
24
|
+
* reaches the GObject bindings.
|
|
11
25
|
*/
|
|
12
26
|
const BUILTIN_ELEMENTS: Record<string, ElementConfig> = {
|
|
13
|
-
|
|
14
|
-
props: childrenProps,
|
|
15
|
-
},
|
|
16
|
-
AdwClamp: {
|
|
17
|
-
props: childrenProps,
|
|
18
|
-
},
|
|
19
|
-
AdwClampScrollable: {
|
|
20
|
-
props: childrenProps,
|
|
21
|
-
},
|
|
22
|
-
AdwNavigationPage: {
|
|
23
|
-
props: childrenProps,
|
|
24
|
-
},
|
|
25
|
-
AdwSplitButton: {
|
|
27
|
+
...forTypes(CHILD_SETTER_TYPES, {
|
|
26
28
|
props: childrenProps,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
AdwTabOverview: {
|
|
29
|
+
omittedProps: ["child"],
|
|
30
|
+
}),
|
|
31
|
+
...forTypes(CONTENT_SETTER_TYPES, {
|
|
32
32
|
props: childrenProps,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
props: childrenProps,
|
|
36
|
-
},
|
|
37
|
-
AdwToggle: {
|
|
38
|
-
props: childrenProps,
|
|
39
|
-
},
|
|
40
|
-
AdwBottomSheet: {
|
|
41
|
-
props: childrenProps,
|
|
42
|
-
},
|
|
43
|
-
AdwFlap: {
|
|
44
|
-
props: childrenProps,
|
|
45
|
-
},
|
|
46
|
-
AdwOverlaySplitView: {
|
|
47
|
-
props: childrenProps,
|
|
48
|
-
},
|
|
33
|
+
omittedProps: ["content"],
|
|
34
|
+
}),
|
|
49
35
|
AdwViewStackPage: {
|
|
50
|
-
|
|
36
|
+
isLazy: true,
|
|
51
37
|
},
|
|
52
38
|
AdwTabPage: {
|
|
53
|
-
|
|
39
|
+
isLazy: true,
|
|
54
40
|
},
|
|
55
41
|
AdwPreferencesRow: {
|
|
56
42
|
props: preferencesRowProps,
|
|
@@ -58,15 +44,19 @@ const BUILTIN_ELEMENTS: Record<string, ElementConfig> = {
|
|
|
58
44
|
AdwDialog: {
|
|
59
45
|
props: breakpointsProps,
|
|
60
46
|
component: adw("createDialogComponent"),
|
|
47
|
+
omittedProps: ["child"],
|
|
61
48
|
},
|
|
62
49
|
AdwApplicationWindow: {
|
|
63
50
|
props: breakpointsProps,
|
|
51
|
+
omittedProps: ["content"],
|
|
64
52
|
},
|
|
65
53
|
AdwWindow: {
|
|
66
54
|
props: breakpointsProps,
|
|
55
|
+
omittedProps: ["content"],
|
|
67
56
|
},
|
|
68
57
|
AdwBreakpointBin: {
|
|
69
58
|
props: breakpointsProps,
|
|
59
|
+
omittedProps: ["child"],
|
|
70
60
|
},
|
|
71
61
|
AdwActionRow: {
|
|
72
62
|
props: preferencesRowProps,
|
|
@@ -79,6 +69,7 @@ const BUILTIN_ELEMENTS: Record<string, ElementConfig> = {
|
|
|
79
69
|
},
|
|
80
70
|
AdwNavigationSplitView: {
|
|
81
71
|
props: childrenProps,
|
|
72
|
+
omittedProps: ["content"],
|
|
82
73
|
},
|
|
83
74
|
AdwLeaflet: {
|
|
84
75
|
props: childrenProps,
|
|
@@ -115,6 +106,7 @@ const BUILTIN_ELEMENTS: Record<string, ElementConfig> = {
|
|
|
115
106
|
},
|
|
116
107
|
AdwToolbarView: {
|
|
117
108
|
props: adw("AdwToolbarViewProps"),
|
|
109
|
+
omittedProps: ["content"],
|
|
118
110
|
},
|
|
119
111
|
AdwHeaderBar: {
|
|
120
112
|
props: internal("GtkHeaderBarProps"),
|
|
@@ -137,4 +129,4 @@ function adw(name: string): ModuleExport {
|
|
|
137
129
|
return { module: "@gtkx/react/adw", export: name };
|
|
138
130
|
}
|
|
139
131
|
|
|
140
|
-
export { BUILTIN_ELEMENTS };
|
|
132
|
+
export { CHILD_SETTER_TYPES, CONTENT_SETTER_TYPES, BUILTIN_ELEMENTS };
|
package/src/adw/index.ts
CHANGED
package/src/adw/prop-types.ts
CHANGED
package/src/bootstrap.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { isRecord } from "@gtkx/utils";
|
|
|
2
2
|
import { createElement, type ElementType, isValidElement, type ReactElement, type ReactNode } from "react";
|
|
3
3
|
import type { Props } from "../reconciler/registry.js";
|
|
4
4
|
|
|
5
|
-
/** The intrinsic element that carries an object-valued prop's element into its parent's named property. */
|
|
6
5
|
const Prop = "gtkx:prop";
|
|
7
6
|
|
|
8
7
|
const hasElement = (value: unknown): boolean =>
|
|
@@ -2,11 +2,24 @@ import type * as Gtk from "@gtkx/gi/gtk";
|
|
|
2
2
|
import { type ElementType, type ReactNode, type Ref, useLayoutEffect, useState } from "react";
|
|
3
3
|
import { useMergedRef } from "../hooks/use-merged-refs.js";
|
|
4
4
|
import { ParentWindowContext } from "../hooks/use-parent-window.js";
|
|
5
|
+
import { applyWrite } from "../reconciler/signals.js";
|
|
5
6
|
|
|
6
7
|
type WindowComponentProps = {
|
|
7
8
|
ref?: Ref<Gtk.Window | null> | undefined;
|
|
8
9
|
};
|
|
9
10
|
|
|
11
|
+
const presentWindow = (window: Gtk.Window): void => {
|
|
12
|
+
applyWrite(() => {
|
|
13
|
+
window.present();
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const destroyWindow = (window: Gtk.Window): void => {
|
|
18
|
+
applyWrite(() => {
|
|
19
|
+
window.destroy();
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
10
23
|
const createWindowComponent = (Component: ElementType): ((props: WindowComponentProps) => ReactNode) => {
|
|
11
24
|
return ({ ref, ...rest }: WindowComponentProps): ReactNode => {
|
|
12
25
|
const [window, setWindow] = useState<Gtk.Window | null>(null);
|
|
@@ -17,10 +30,10 @@ const createWindowComponent = (Component: ElementType): ((props: WindowComponent
|
|
|
17
30
|
return;
|
|
18
31
|
}
|
|
19
32
|
|
|
20
|
-
window
|
|
33
|
+
presentWindow(window);
|
|
21
34
|
|
|
22
35
|
return () => {
|
|
23
|
-
window
|
|
36
|
+
destroyWindow(window);
|
|
24
37
|
};
|
|
25
38
|
}, [window]);
|
|
26
39
|
|
|
@@ -32,4 +45,5 @@ const createWindowComponent = (Component: ElementType): ((props: WindowComponent
|
|
|
32
45
|
};
|
|
33
46
|
};
|
|
34
47
|
|
|
48
|
+
/** @internal */
|
|
35
49
|
export { createWindowComponent };
|
package/src/config.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/** @public */
|
|
1
2
|
export { BUILTIN_ELEMENTS } from "./element-config.js";
|
|
2
|
-
|
|
3
|
-
export {
|
|
3
|
+
/** @public */
|
|
4
|
+
export type { DetachInfo, ElementBehavior, ElementConfig, PlaceInfo, Props } from "./reconciler/registry.js";
|
|
5
|
+
/** @public */
|
|
6
|
+
export { defineBehavior, defineElements, ELEMENTS, mergeElementConfigs } from "./reconciler/registry.js";
|
package/src/element-behaviors.ts
CHANGED
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
} from "./reconciler/behaviors.js";
|
|
26
26
|
import { type ElementConfig, forTypes, registerElements } from "./reconciler/registry.js";
|
|
27
27
|
|
|
28
|
-
/** The runtime half of the built-in element configuration: the behaviors bound to each GObject type. */
|
|
29
28
|
const BUILTIN_BEHAVIORS: Record<string, ElementConfig<never>> = {
|
|
30
29
|
...forTypes(SINGLE_CHILD_TYPES, {
|
|
31
30
|
behaviors: [childSetterSlot()],
|
package/src/element-config.ts
CHANGED
|
@@ -25,13 +25,15 @@ const SINGLE_CHILD_TYPES: string[] = [
|
|
|
25
25
|
];
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* The
|
|
29
|
-
* generated element extends,
|
|
30
|
-
* parent.
|
|
28
|
+
* The framework's own element configuration for the GTK types it customizes: the base props interface each
|
|
29
|
+
* generated element extends, the component that wraps it, the GObject properties left out of its generated
|
|
30
|
+
* props, and whether its GObject is created by its parent. Carries no behaviors, so importing it never
|
|
31
|
+
* reaches the GObject bindings.
|
|
31
32
|
*/
|
|
32
33
|
const BUILTIN_ELEMENTS: Record<string, ElementConfig> = {
|
|
33
34
|
...forTypes(SINGLE_CHILD_TYPES, {
|
|
34
35
|
props: internal("ChildrenProps"),
|
|
36
|
+
omittedProps: ["child"],
|
|
35
37
|
}),
|
|
36
38
|
...forTypes(["GtkHeaderBar", "GtkActionBar"], {
|
|
37
39
|
props: internal("GtkHeaderBarProps"),
|
|
@@ -39,6 +41,7 @@ const BUILTIN_ELEMENTS: Record<string, ElementConfig> = {
|
|
|
39
41
|
GtkWindow: {
|
|
40
42
|
props: internal("ChildrenProps"),
|
|
41
43
|
component: internal("createWindowComponent"),
|
|
44
|
+
omittedProps: ["child"],
|
|
42
45
|
},
|
|
43
46
|
GtkLabel: {
|
|
44
47
|
props: internal("ChildrenProps"),
|
|
@@ -53,19 +56,19 @@ const BUILTIN_ELEMENTS: Record<string, ElementConfig> = {
|
|
|
53
56
|
props: internal("GtkTextChildAnchorProps"),
|
|
54
57
|
},
|
|
55
58
|
GtkGridLayoutChild: {
|
|
56
|
-
|
|
59
|
+
isLazy: true,
|
|
57
60
|
},
|
|
58
61
|
GtkFixedLayoutChild: {
|
|
59
|
-
|
|
62
|
+
isLazy: true,
|
|
60
63
|
},
|
|
61
64
|
GtkOverlayLayoutChild: {
|
|
62
|
-
|
|
65
|
+
isLazy: true,
|
|
63
66
|
},
|
|
64
67
|
GtkStackPage: {
|
|
65
|
-
|
|
68
|
+
isLazy: true,
|
|
66
69
|
},
|
|
67
70
|
GtkNotebookPage: {
|
|
68
|
-
|
|
71
|
+
isLazy: true,
|
|
69
72
|
},
|
|
70
73
|
GActionGroup: {
|
|
71
74
|
props: internal("GActionGroupProps"),
|
|
@@ -84,6 +87,7 @@ const BUILTIN_ELEMENTS: Record<string, ElementConfig> = {
|
|
|
84
87
|
},
|
|
85
88
|
GtkOverlay: {
|
|
86
89
|
props: internal("GtkOverlayProps"),
|
|
90
|
+
omittedProps: ["child"],
|
|
87
91
|
},
|
|
88
92
|
GtkShortcutController: {
|
|
89
93
|
props: internal("GtkShortcutControllerProps"),
|