@gtkx/react 1.0.0-rc.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -9
- 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 +4 -4
- package/dist/adw/dialog.d.ts.map +1 -1
- package/dist/adw/dialog.js +16 -21
- package/dist/adw/dialog.js.map +1 -1
- package/dist/adw/element-behaviors.js +104 -57
- package/dist/adw/element-behaviors.js.map +1 -1
- package/dist/adw/element-config.d.ts +0 -5
- package/dist/adw/element-config.d.ts.map +1 -1
- package/dist/adw/element-config.js +25 -26
- 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 +35 -4
- 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-window.d.ts +5 -0
- package/dist/components/application-window.d.ts.map +1 -0
- package/dist/components/application-window.js +7 -0
- package/dist/components/application-window.js.map +1 -0
- package/dist/components/application.d.ts +3 -8
- package/dist/components/application.d.ts.map +1 -1
- package/dist/components/application.js +22 -6
- package/dist/components/application.js.map +1 -1
- package/dist/components/element.d.ts +13 -2
- package/dist/components/element.d.ts.map +1 -1
- package/dist/components/element.js +39 -15
- package/dist/components/element.js.map +1 -1
- package/dist/components/portaled.d.ts +5 -0
- package/dist/components/portaled.d.ts.map +1 -0
- package/dist/components/portaled.js +8 -0
- package/dist/components/portaled.js.map +1 -0
- package/dist/components/window.d.ts +6 -5
- package/dist/components/window.d.ts.map +1 -1
- package/dist/components/window.js +17 -16
- package/dist/components/window.js.map +1 -1
- package/dist/config.d.ts +7 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -1
- package/dist/config.js.map +1 -1
- package/dist/element-behaviors.js +11 -2
- 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 +19 -15
- 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-merged-refs.d.ts +1 -4
- package/dist/hooks/use-merged-refs.d.ts.map +1 -1
- package/dist/hooks/use-merged-refs.js +1 -1
- package/dist/hooks/use-merged-refs.js.map +1 -1
- package/dist/hooks/use-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-presented-instance.d.ts +12 -0
- package/dist/hooks/use-presented-instance.d.ts.map +1 -0
- package/dist/hooks/use-presented-instance.js +27 -0
- package/dist/hooks/use-presented-instance.js.map +1 -0
- package/dist/hooks/use-property.d.ts +4 -3
- 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 +15 -8
- package/dist/hooks/use-signal.d.ts.map +1 -1
- package/dist/hooks/use-signal.js +6 -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 +8 -5
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +7 -5
- package/dist/internal.js.map +1 -1
- package/dist/prop-types.d.ts +88 -4
- package/dist/prop-types.d.ts.map +1 -1
- package/dist/prop-types.js.map +1 -1
- package/dist/reconciler/apply-props.d.ts +4 -4
- package/dist/reconciler/apply-props.d.ts.map +1 -1
- package/dist/reconciler/apply-props.js +62 -20
- package/dist/reconciler/apply-props.js.map +1 -1
- package/dist/reconciler/behaviors.d.ts +9 -20
- package/dist/reconciler/behaviors.d.ts.map +1 -1
- package/dist/reconciler/behaviors.js +44 -41
- package/dist/reconciler/behaviors.js.map +1 -1
- package/dist/reconciler/devtools.d.ts +6 -0
- package/dist/reconciler/devtools.d.ts.map +1 -0
- package/dist/reconciler/devtools.js +11 -0
- package/dist/reconciler/devtools.js.map +1 -0
- package/dist/reconciler/host-config.d.ts +1 -1
- package/dist/reconciler/host-config.d.ts.map +1 -1
- package/dist/reconciler/host-config.js +17 -26
- package/dist/reconciler/host-config.js.map +1 -1
- package/dist/reconciler/instance.d.ts.map +1 -1
- package/dist/reconciler/instance.js +6 -4
- package/dist/reconciler/instance.js.map +1 -1
- package/dist/reconciler/metadata.d.ts +2 -2
- package/dist/reconciler/metadata.d.ts.map +1 -1
- package/dist/reconciler/metadata.js +9 -11
- package/dist/reconciler/metadata.js.map +1 -1
- package/dist/reconciler/node.d.ts +4 -3
- package/dist/reconciler/node.d.ts.map +1 -1
- package/dist/reconciler/node.js +8 -7
- package/dist/reconciler/node.js.map +1 -1
- package/dist/reconciler/placement.js +20 -20
- package/dist/reconciler/placement.js.map +1 -1
- package/dist/reconciler/registry.d.ts +46 -32
- package/dist/reconciler/registry.d.ts.map +1 -1
- package/dist/reconciler/registry.js +10 -19
- package/dist/reconciler/registry.js.map +1 -1
- package/dist/reconciler/root-element.d.ts +1 -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 +9 -20
- package/dist/reconciler/root.d.ts.map +1 -1
- package/dist/reconciler/root.js +6 -19
- package/dist/reconciler/root.js.map +1 -1
- package/dist/reconciler/signals.d.ts +1 -2
- package/dist/reconciler/signals.d.ts.map +1 -1
- package/dist/reconciler/signals.js +3 -3
- package/dist/reconciler/signals.js.map +1 -1
- package/dist/reconciler/text.js +5 -5
- package/dist/reconciler/text.js.map +1 -1
- package/dist/utils/accessible-props.d.ts +57 -9
- package/dist/utils/accessible-props.d.ts.map +1 -1
- package/dist/utils/accessible-props.js +11 -13
- package/dist/utils/accessible-props.js.map +1 -1
- package/dist/utils/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 +7 -0
- package/dist/utils/settings.d.ts.map +1 -1
- package/dist/utils/settings.js.map +1 -1
- package/dist/utils/variant.d.ts +33 -1
- package/dist/utils/variant.d.ts.map +1 -1
- package/dist/utils/variant.js.map +1 -1
- package/env.d.ts +11 -4
- package/package.json +5 -5
- package/src/adw/config.ts +1 -0
- package/src/adw/dialog.tsx +23 -25
- package/src/adw/element-behaviors.ts +131 -60
- package/src/adw/element-config.ts +25 -26
- package/src/adw/index.ts +1 -0
- package/src/adw/prop-types.ts +36 -3
- package/src/bootstrap.ts +1 -1
- package/src/components/application-window.tsx +10 -0
- package/src/components/application.tsx +32 -5
- package/src/components/element.tsx +52 -17
- package/src/components/portaled.tsx +14 -0
- package/src/components/window.tsx +25 -23
- package/src/config.ts +13 -8
- package/src/element-behaviors.ts +20 -1
- package/src/element-config.ts +19 -15
- package/src/hooks/use-bind-setting.ts +8 -7
- package/src/hooks/use-merged-refs.ts +1 -1
- package/src/hooks/use-parent-window.ts +3 -1
- package/src/hooks/use-presented-instance.tsx +50 -0
- package/src/hooks/use-property.ts +4 -3
- package/src/hooks/use-setting.ts +2 -3
- package/src/hooks/use-signal.ts +18 -11
- package/src/index.ts +10 -2
- package/src/internal.ts +8 -5
- package/src/prop-types.ts +119 -11
- package/src/reconciler/apply-props.ts +77 -24
- package/src/reconciler/behaviors.ts +77 -50
- package/src/reconciler/devtools.ts +18 -0
- package/src/reconciler/host-config.ts +20 -32
- package/src/reconciler/instance.ts +7 -4
- package/src/reconciler/metadata.ts +11 -14
- package/src/reconciler/node.ts +12 -9
- package/src/reconciler/placement.ts +25 -25
- package/src/reconciler/registry.ts +56 -39
- package/src/reconciler/root-element.ts +4 -2
- package/src/reconciler/root.ts +12 -20
- package/src/reconciler/signals.ts +2 -3
- package/src/reconciler/text.ts +6 -6
- package/src/utils/accessible-props.ts +70 -25
- package/src/utils/ref-prop.ts +0 -6
- package/src/utils/settings.ts +7 -0
- package/src/utils/variant.ts +33 -1
- package/dist/utils/accessible-metadata.d.ts +0 -12
- package/dist/utils/accessible-metadata.d.ts.map +0 -1
- package/dist/utils/accessible-metadata.js +0 -25
- package/dist/utils/accessible-metadata.js.map +0 -1
- package/src/utils/accessible-metadata.ts +0 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placement.js","sourceRoot":"","sources":["../../src/reconciler/placement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACH,YAAY,EACZ,YAAY,EAEZ,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,UAAU,GAGb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1C,MAAM,WAAW,GAAG,CAAC,I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AAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAEhE,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACf,OAAO;IACX,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAEzC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,SAAS,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { getOrInsert, indexBeforeOrEnd, remove } from \"@gtkx/utils\";\nimport type { DetachInfo, ElementBehavior, PlaceInfo } from \"./registry.js\";\nimport { applyAdoptedProps, markFlush } from \"./apply-props.js\";\nimport { typeInfoFor } from \"./metadata.js\";\nimport {\n DEFAULT_SLOT,\n ELEMENT_KIND,\n type ElementNode,\n getOrCreateContext,\n LAZY_KIND,\n lazyTarget,\n nodeObject,\n type PlaceableNode,\n type PlacedChild,\n} from \"./node.js\";\nimport { applyWrite } from \"./signals.js\";\nimport { markTextDirty } from \"./text.js\";\n\ntype AttachContext = { parent: ElementNode; entry: PlacedChild; index: number; sibling: GObject.Object | null };\n\nconst createEntry = (slot: string, node: PlaceableNode): PlacedChild | null => {\n const object = nodeObject(node);\n\n if (object === null) {\n return null;\n }\n\n return { node, object, adopted: null, slot, behavior: null, attached: false };\n};\n\nconst siblingAt = (entries: PlacedChild[], index: number): GObject.Object | null =>\n index > 0 ? (entries[index - 1]?.object ?? null) : null;\n\nconst placeInfo = (entry: PlacedChild, index: number, sibling: GObject.Object | null, context: unknown): PlaceInfo => ({\n slot: entry.slot,\n index,\n sibling,\n adopted: entry.adopted,\n props: entry.node.props,\n context,\n});\n\nconst adoptedFrom = (parent: ElementNode, entry: PlacedChild, behavior: ElementBehavior, claim: unknown): void => {\n if (behavior.resolve !== undefined) {\n entry.adopted = behavior.resolve(parent.object, entry.object);\n\n return;\n }\n\n entry.adopted = claim instanceof GObject.Object ? claim : null;\n};\n\nconst applyLazyProps = (entry: PlacedChild): void => {\n if (entry.node.kind !== LAZY_KIND || entry.adopted === null) {\n return;\n }\n\n applyAdoptedProps(lazyTarget(entry.node, entry.adopted), {}, entry.node.props);\n entry.node.adopted = entry.adopted;\n};\n\nconst wireBufferView = (node: PlaceableNode, parent: ElementNode): void => {\n if (!(node.kind === ELEMENT_KIND && node.contentKind === \"buffer\" && parent.object instanceof Gtk.TextView)) {\n return;\n }\n\n node.bufferView = parent.object;\n markTextDirty(node);\n};\n\nconst writeSlot = (parent: ElementNode, entry: PlacedChild, value: GObject.Object | null): void => {\n applyWrite(() => {\n Reflect.set(parent.object, entry.slot, value);\n });\n};\n\nconst setObjectSlot = (parent: ElementNode, entry: PlacedChild): void => {\n writeSlot(parent, entry, entry.object);\n wireBufferView(entry.node, parent);\n entry.behavior = null;\n entry.attached = true;\n};\n\nconst didAttach = (ctx: AttachContext, behavior: ElementBehavior): boolean => {\n const attach = behavior.attach;\n\n if (attach === undefined) {\n return false;\n }\n\n const context = getOrCreateContext(ctx.parent, behavior);\n const claim = attach(ctx.parent.object, ctx.entry.object, placeInfo(ctx.entry, ctx.index, ctx.sibling, context));\n\n if (claim === undefined) {\n return false;\n }\n\n ctx.entry.behavior = behavior;\n adoptedFrom(ctx.parent, ctx.entry, behavior, claim);\n ctx.entry.attached = true;\n applyLazyProps(ctx.entry);\n\n return true;\n};\n\nconst runAttach = (parent: ElementNode, entry: PlacedChild, index: number, sibling: GObject.Object | null): void => {\n const ctx: AttachContext = { parent, entry, index, sibling };\n\n for (const behavior of typeInfoFor(parent.typeName).behaviors) {\n if (didAttach(ctx, behavior)) {\n return;\n }\n }\n\n if (entry.slot !== DEFAULT_SLOT) {\n setObjectSlot(parent, entry);\n }\n};\n\nconst attachEntry = (parent: ElementNode, entry: PlacedChild, index: number, sibling: GObject.Object | null): void => {\n applyWrite(() => {\n runAttach(parent, entry, index, sibling);\n });\n};\n\nconst detachInfo = (entry: PlacedChild, context: unknown): DetachInfo => ({\n slot: entry.slot,\n adopted: entry.adopted,\n props: entry.node.props,\n context,\n});\n\nconst runDetach = (parent: ElementNode, entry: PlacedChild): void => {\n const behavior = entry.behavior;\n\n if (behavior === null) {\n if (entry.slot !== DEFAULT_SLOT) {\n writeSlot(parent, entry, null);\n }\n\n return;\n }\n\n behavior.detach?.(parent.object, entry.object, detachInfo(entry, getOrCreateContext(parent, behavior)));\n};\n\nconst detachEntry = (parent: ElementNode, entry: PlacedChild): void => {\n if (!entry.attached) {\n return;\n }\n\n entry.attached = false;\n\n applyWrite(() => {\n runDetach(parent, entry);\n });\n};\n\nconst rebuild = (parent: ElementNode, entries: PlacedChild[]): void => {\n for (const entry of entries) {\n detachEntry(parent, entry);\n }\n\n for (const [index, entry] of entries.entries()) {\n entry.behavior = null;\n attachEntry(parent, entry, index, siblingAt(entries, index));\n }\n};\n\nconst getPosition = (entries: PlacedChild[], before: PlaceableNode | null): number =>\n indexBeforeOrEnd(entries, before, (entry, target) => entry.node === target);\n\nconst placeNew = (parent: ElementNode, entry: PlacedChild, entries: PlacedChild[], index: number): void => {\n attachEntry(parent, entry, index, siblingAt(entries, index));\n\n if (!entry.attached) {\n remove(entries, entry);\n\n return;\n }\n\n const isInsertedBeforeEnd = index < entries.length - 1;\n const isCannotReorderInPlace = entry.behavior !== null && entry.behavior.reorder === undefined;\n\n if (isInsertedBeforeEnd && isCannotReorderInPlace) {\n rebuild(parent, entries);\n }\n};\n\nconst moveEntry = (parent: ElementNode, entry: PlacedChild, entries: PlacedChild[], index: number): void => {\n const behavior = entry.behavior;\n const reorder = behavior?.reorder;\n\n if (behavior === null || reorder === undefined) {\n rebuild(parent, entries);\n\n return;\n }\n\n const context = getOrCreateContext(parent, behavior);\n const claim = reorder(parent.object, entry.object, placeInfo(entry, index, siblingAt(entries, index), context));\n adoptedFrom(parent, entry, behavior, claim);\n applyLazyProps(entry);\n};\n\nconst resolveEntry = (\n entries: PlacedChild[],\n existing: number,\n slot: string,\n node: PlaceableNode,\n): PlacedChild | null => {\n if (existing >= 0) {\n return entries[existing] ?? null;\n }\n\n return createEntry(slot, node);\n};\n\nconst placeChild = (\n parent: ElementNode,\n slot: string,\n node: PlaceableNode,\n before: PlaceableNode | null,\n): void => {\n const entries = getOrInsert(parent.placements, slot, () => []);\n const existing = entries.findIndex((entry) => entry.node === node);\n const entry = resolveEntry(entries, existing, slot, node);\n\n if (entry === null) {\n return;\n }\n\n const isMove = existing !== -1;\n\n if (isMove) {\n entries.splice(existing, 1);\n }\n\n const index = getPosition(entries, before);\n entries.splice(index, 0, entry);\n\n if (isMove) {\n moveEntry(parent, entry, entries, index);\n } else {\n placeNew(parent, entry, entries, index);\n }\n\n markFlush(parent);\n};\n\nconst unplaceChild = (parent: ElementNode, slot: string, node: PlaceableNode): void => {\n const entries = parent.placements.get(slot);\n\n if (entries === undefined) {\n return;\n }\n\n const index = entries.findIndex((entry) => entry.node === node);\n\n if (index === -1) {\n return;\n }\n\n const [entry] = entries.splice(index, 1);\n\n if (entry !== undefined) {\n detachEntry(parent, entry);\n }\n\n markFlush(parent);\n};\n\nexport { placeChild, unplaceChild };\n"]}
|
|
1
|
+
{"version":3,"file":"placement.js","sourceRoot":"","sources":["../../src/reconciler/placement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE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C;AAEF,MAAM,YAAY,GAAG,CAAC,MAAmB,EAAE,IAAY,EAAE,IAAmB,EAAQ,EAAE;IAClF,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAE5C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO;IACX,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAEhE,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACf,OAAO;IACX,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAEzC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,SAAS,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import * as GObject from \"@gtkx/gi/gobject\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { getOrInsert, indexBeforeOrEnd } from \"@gtkx/utils\";\nimport type { DetachInfo, ElementBehavior, PlaceInfo } from \"./registry.js\";\nimport { applyAdoptedProps, markFlush } from \"./apply-props.js\";\nimport { typeInfoFor } from \"./metadata.js\";\nimport {\n DEFAULT_SLOT,\n ELEMENT_KIND,\n type ElementNode,\n getOrCreateContext,\n LAZY_KIND,\n lazyTarget,\n leafElement,\n type PlaceableNode,\n type PlacedChild,\n} from \"./node.js\";\nimport { applyWrite } from \"./signals.js\";\nimport { markTextDirty } from \"./text.js\";\n\ntype AttachContext = { parent: ElementNode; entry: PlacedChild; index: number; sibling: GObject.Object | null };\n\nconst createEntry = (slot: string, node: PlaceableNode): PlacedChild | null => {\n const leaf = leafElement(node);\n\n if (leaf === null) {\n return null;\n }\n\n return {\n node,\n object: leaf.object,\n typeName: leaf.typeName,\n adopted: null,\n slot,\n behavior: null,\n };\n};\n\nconst siblingAt = (entries: PlacedChild[], index: number): GObject.Object | null =>\n index > 0 ? (entries[index - 1]?.object ?? null) : null;\n\nconst placeInfo = (entry: PlacedChild, index: number, sibling: GObject.Object | null, context: unknown): PlaceInfo => ({\n slot: entry.slot,\n index,\n sibling,\n adopted: entry.adopted,\n props: entry.node.props,\n context,\n});\n\nconst adoptedFrom = (parent: ElementNode, entry: PlacedChild, behavior: ElementBehavior, claim: unknown): void => {\n if (behavior.resolve !== undefined) {\n entry.adopted = behavior.resolve(parent.object, entry.object);\n\n return;\n }\n\n entry.adopted = claim instanceof GObject.Object ? claim : null;\n};\n\nconst applyLazyProps = (entry: PlacedChild): void => {\n if (entry.node.kind !== LAZY_KIND || entry.adopted === null) {\n return;\n }\n\n applyAdoptedProps(lazyTarget(entry.node, entry.adopted), {}, entry.node.props);\n entry.node.adopted = entry.adopted;\n};\n\nconst wireBufferView = (node: PlaceableNode, parent: ElementNode): void => {\n if (!(node.kind === ELEMENT_KIND && node.contentKind === \"buffer\" && parent.object instanceof Gtk.TextView)) {\n return;\n }\n\n node.bufferView = parent.object;\n markTextDirty(node);\n};\n\nconst writeSlot = (parent: ElementNode, entry: PlacedChild, value: GObject.Object | null): void => {\n applyWrite(() => {\n Reflect.set(parent.object, entry.slot, value);\n });\n};\n\nconst setObjectSlot = (parent: ElementNode, entry: PlacedChild): void => {\n writeSlot(parent, entry, entry.object);\n wireBufferView(entry.node, parent);\n entry.behavior = null;\n};\n\nconst didAttach = (ctx: AttachContext, behavior: ElementBehavior): boolean => {\n const attach = behavior.attach;\n\n if (attach === undefined) {\n return false;\n }\n\n const context = getOrCreateContext(ctx.parent, behavior);\n const claim = attach(ctx.parent.object, ctx.entry.object, placeInfo(ctx.entry, ctx.index, ctx.sibling, context));\n\n if (claim === undefined) {\n return false;\n }\n\n ctx.entry.behavior = behavior;\n adoptedFrom(ctx.parent, ctx.entry, behavior, claim);\n applyLazyProps(ctx.entry);\n\n return true;\n};\n\nconst unclaimedChildError = (parentTypeName: string, childTypeName: string): Error =>\n new Error(\n `<${childTypeName}> cannot be a child of <${parentTypeName}>. Pass it to the ` +\n `<${parentTypeName}> prop that takes it, if there is one, portal it to rootElement with createPortal ` +\n `if it does not belong inside <${parentTypeName}>, or register an attach behavior for ` +\n `<${parentTypeName}> with defineElements from \"@gtkx/react/config\" if it belongs among its children.`,\n );\n\nconst runAttach = (parent: ElementNode, entry: PlacedChild, index: number, sibling: GObject.Object | null): void => {\n const ctx: AttachContext = { parent, entry, index, sibling };\n\n for (const behavior of typeInfoFor(parent.typeName).behaviors) {\n if (didAttach(ctx, behavior)) {\n return;\n }\n }\n\n if (entry.slot === DEFAULT_SLOT) {\n throw unclaimedChildError(parent.typeName, entry.typeName);\n }\n\n setObjectSlot(parent, entry);\n};\n\nconst attachEntry = (parent: ElementNode, entry: PlacedChild, index: number, sibling: GObject.Object | null): void => {\n applyWrite(() => {\n runAttach(parent, entry, index, sibling);\n });\n};\n\nconst detachInfo = (entry: PlacedChild, context: unknown): DetachInfo => ({\n slot: entry.slot,\n adopted: entry.adopted,\n props: entry.node.props,\n context,\n});\n\nconst runDetach = (parent: ElementNode, entry: PlacedChild): void => {\n const behavior = entry.behavior;\n\n if (behavior === null) {\n writeSlot(parent, entry, null);\n\n return;\n }\n\n behavior.detach?.(parent.object, entry.object, detachInfo(entry, getOrCreateContext(parent, behavior)));\n};\n\nconst detachEntry = (parent: ElementNode, entry: PlacedChild): void => {\n applyWrite(() => {\n runDetach(parent, entry);\n });\n};\n\nconst rebuild = (parent: ElementNode, entries: PlacedChild[]): void => {\n for (const entry of entries) {\n detachEntry(parent, entry);\n }\n\n for (const [index, entry] of entries.entries()) {\n entry.behavior = null;\n attachEntry(parent, entry, index, siblingAt(entries, index));\n }\n};\n\nconst getPosition = (entries: PlacedChild[], before: PlaceableNode | null): number =>\n indexBeforeOrEnd(entries, before, (entry, target) => entry.node === target);\n\nconst placeNew = (parent: ElementNode, entry: PlacedChild, entries: PlacedChild[], index: number): void => {\n attachEntry(parent, entry, index, siblingAt(entries, index));\n const isInsertedBeforeEnd = index < entries.length - 1;\n const isCannotReorderInPlace = entry.behavior !== null && entry.behavior.reorder === undefined;\n\n if (isInsertedBeforeEnd && isCannotReorderInPlace) {\n rebuild(parent, entries);\n }\n};\n\nconst moveEntry = (parent: ElementNode, entry: PlacedChild, entries: PlacedChild[], index: number): void => {\n const behavior = entry.behavior;\n const reorder = behavior?.reorder;\n\n if (behavior === null || reorder === undefined) {\n rebuild(parent, entries);\n\n return;\n }\n\n const context = getOrCreateContext(parent, behavior);\n const claim = reorder(parent.object, entry.object, placeInfo(entry, index, siblingAt(entries, index), context));\n adoptedFrom(parent, entry, behavior, claim);\n applyLazyProps(entry);\n};\n\nconst resolveEntry = (\n entries: PlacedChild[],\n existing: number,\n slot: string,\n node: PlaceableNode,\n): PlacedChild | null => {\n if (existing >= 0) {\n return entries[existing] ?? null;\n }\n\n return createEntry(slot, node);\n};\n\nconst placeChild = (\n parent: ElementNode,\n slot: string,\n node: PlaceableNode,\n before: PlaceableNode | null,\n): void => {\n const entries = getOrInsert(parent.placements, slot, () => []);\n const existing = entries.findIndex((entry) => entry.node === node);\n const entry = resolveEntry(entries, existing, slot, node);\n\n if (entry === null) {\n return;\n }\n\n const isMove = existing !== -1;\n\n if (isMove) {\n entries.splice(existing, 1);\n }\n\n const index = getPosition(entries, before);\n entries.splice(index, 0, entry);\n\n if (isMove) {\n moveEntry(parent, entry, entries, index);\n } else {\n placeNew(parent, entry, entries, index);\n }\n\n markFlush(parent);\n};\n\nconst unplaceChild = (parent: ElementNode, slot: string, node: PlaceableNode): void => {\n const entries = parent.placements.get(slot);\n\n if (entries === undefined) {\n return;\n }\n\n const index = entries.findIndex((entry) => entry.node === node);\n\n if (index === -1) {\n return;\n }\n\n const [entry] = entries.splice(index, 1);\n\n if (entry !== undefined) {\n detachEntry(parent, entry);\n }\n\n markFlush(parent);\n};\n\nexport { placeChild, unplaceChild };\n"]}
|
|
@@ -3,87 +3,103 @@ import type * as GObject from "@gtkx/gi/gobject";
|
|
|
3
3
|
type Props = Record<string, unknown>;
|
|
4
4
|
/** Per-child values a slot hook receives while placing or moving one child. */
|
|
5
5
|
type PlaceInfo = {
|
|
6
|
+
/** Name of the slot being filled: `children`, or the prop the child was nested under. */
|
|
6
7
|
slot: string;
|
|
8
|
+
/** Position of the child among the slot's children. */
|
|
7
9
|
index: number;
|
|
10
|
+
/** Object of the preceding child in the slot, or null when the child comes first. */
|
|
8
11
|
sibling: GObject.Object | null;
|
|
12
|
+
/** Object adopted for this child by an earlier attach, or null before it has one. */
|
|
9
13
|
adopted: GObject.Object | null;
|
|
14
|
+
/** Props of the child element. */
|
|
10
15
|
props: Props;
|
|
16
|
+
/** Value `initialize` returned for this behavior on the parent. */
|
|
11
17
|
context: unknown;
|
|
12
18
|
};
|
|
13
19
|
/** Per-child values a slot hook receives while removing one child. */
|
|
14
20
|
type DetachInfo = {
|
|
21
|
+
/** Name of the slot the child is leaving. */
|
|
15
22
|
slot: string;
|
|
23
|
+
/** Object the container adopted for this child, or null when it adopted none. */
|
|
16
24
|
adopted: GObject.Object | null;
|
|
25
|
+
/** Props of the child element. */
|
|
17
26
|
props: Props;
|
|
27
|
+
/** Value `initialize` returned for this behavior on the parent. */
|
|
18
28
|
context: unknown;
|
|
19
29
|
};
|
|
20
30
|
/**
|
|
21
|
-
* Customizes how one element type places children and applies props.
|
|
22
|
-
* GObject instance and
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* are not also set as plain GObject properties. `create` builds the GObject for types whose
|
|
26
|
-
* constructor does more than set properties, and is consulted for its own type only, never
|
|
27
|
-
* inherited by subtypes.
|
|
31
|
+
* Customizes how one element type places children and applies props. Hooks other than `create` receive the
|
|
32
|
+
* GObject instance; `update` and `flush` also take the private per-node context `initialize` built, and
|
|
33
|
+
* `attach`, `reorder` and `detach` read it off their info object. Subtypes inherit a type's behaviors,
|
|
34
|
+
* except for `create`, which is consulted only for the type it is registered on.
|
|
28
35
|
*/
|
|
29
36
|
type ElementBehavior<T extends GObject.Object = GObject.Object> = {
|
|
37
|
+
/** Builds the GObject from its construct props, for types whose constructor does more than set properties. */
|
|
30
38
|
create?: (props: Props) => GObject.Object;
|
|
31
|
-
|
|
39
|
+
/** Builds the private per-node context the other hooks receive, once per node. */
|
|
40
|
+
initialize?: (object: T) => unknown;
|
|
41
|
+
/** Places a child, claiming it by returning anything other than `undefined`. */
|
|
32
42
|
attach?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;
|
|
43
|
+
/** Moves an already-attached child; without it, the whole slot is detached and re-attached in order. */
|
|
33
44
|
reorder?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;
|
|
45
|
+
/** Removes a child this behavior attached. */
|
|
34
46
|
detach?: (object: T, child: GObject.Object, info: DetachInfo) => void;
|
|
47
|
+
/** Returns the object the container adopts for a child, overriding whatever `attach` returned. */
|
|
35
48
|
resolve?: (object: T, child: GObject.Object) => GObject.Object | null;
|
|
49
|
+
/** Applies changed props and returns the names it consumed, which are then not set as GObject properties. */
|
|
36
50
|
update?: (object: T, prev: Props, next: Props, context: unknown) => Iterable<string> | undefined;
|
|
51
|
+
/** Runs after the commit that touched the node, once every child has been placed. */
|
|
37
52
|
flush?: (object: T, context: unknown) => void;
|
|
38
|
-
|
|
39
|
-
unmount?: (object: T, context: unknown) => void;
|
|
53
|
+
/** Props to withhold from the constructor, leaving them for a later hook to apply. */
|
|
40
54
|
deferred?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Props the behavior can only apply while the element is being built, because the library exposes no
|
|
57
|
+
* counterpart to whatever applied them. Changing one after it has been applied throws instead of
|
|
58
|
+
* silently applying the new value on top of the old.
|
|
59
|
+
*/
|
|
60
|
+
constructOnly?: string[];
|
|
41
61
|
};
|
|
42
62
|
/** A named export in a module, referenced as plain data (the module is never imported at runtime). */
|
|
43
63
|
type ModuleExport = {
|
|
64
|
+
/** Specifier the export is imported from. */
|
|
44
65
|
module: string;
|
|
66
|
+
/** Identifier the module exports it under. */
|
|
45
67
|
export: string;
|
|
46
68
|
};
|
|
47
69
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* its type, an optional component that wraps the generated element, the base props interface its
|
|
51
|
-
* generated props extend, and the GObject properties to leave out of the generated props (those a
|
|
52
|
-
* behavior already writes from children, such as the `child` and `content` properties). `component`,
|
|
53
|
-
* `props` and `omitProps` are inert at runtime; they are read only by codegen.
|
|
70
|
+
* How one GLib type is rendered. `component`, `props` and `omittedProps` are inert at runtime; they are
|
|
71
|
+
* read only by codegen.
|
|
54
72
|
*/
|
|
55
73
|
type ElementConfig<T extends GObject.Object = GObject.Object> = {
|
|
56
|
-
|
|
74
|
+
/** The element has no GObject of its own; its parent container creates one, as it does for pages. */
|
|
75
|
+
isLazy?: boolean;
|
|
76
|
+
/** Behaviors bound to the type, consulted in registration order and inherited by its subtypes. */
|
|
57
77
|
behaviors?: ElementBehavior<T>[];
|
|
78
|
+
/** Component that wraps the generated element. */
|
|
58
79
|
component?: ModuleExport;
|
|
80
|
+
/** Base props interface the generated props extend. */
|
|
59
81
|
props?: ModuleExport;
|
|
60
|
-
|
|
82
|
+
/** GObject properties to leave out of the generated props, such as those a behavior writes from children. */
|
|
83
|
+
omittedProps?: string[];
|
|
61
84
|
};
|
|
62
85
|
/**
|
|
63
86
|
* Every registered element config, keyed by GLib type name. Adwaita entries appear once `@gtkx/react/adw`
|
|
64
87
|
* is loaded.
|
|
65
88
|
*/
|
|
66
89
|
declare const ELEMENTS: Record<string, ElementConfig>;
|
|
67
|
-
/** Props a behavior applies after construction; the constructor is never given them. */
|
|
68
90
|
declare const deferredProps: (behavior: ElementBehavior) => string[];
|
|
69
91
|
/**
|
|
70
92
|
* Merges maps of {@link ElementConfig} keyed by GLib type name into one, concatenating each type's
|
|
71
|
-
* behaviors and omitted props in the order the maps are given (an earlier map's behaviors come first)
|
|
72
|
-
*
|
|
73
|
-
* with its behaviors.
|
|
93
|
+
* behaviors and omitted props in the order the maps are given (an earlier map's behaviors come first),
|
|
94
|
+
* taking the last component and props seen, and marking a type lazy if any map does. Use it to combine
|
|
95
|
+
* an app's element config with its behaviors.
|
|
74
96
|
*/
|
|
75
97
|
declare const mergeElementConfigs: (...maps: Record<string, ElementConfig<never>>[]) => Record<string, ElementConfig>;
|
|
76
|
-
/**
|
|
77
|
-
* Registers a map of {@link ElementConfig} keyed by GLib type name, merging each entry into the
|
|
78
|
-
* registry. Behaviors are appended by default (the framework's built-ins register this way); pass
|
|
79
|
-
* `{ prepend: true }` for an app's own configuration so its behaviors are consulted before the
|
|
80
|
-
* built-ins for the same slot, letting it override them regardless of registration order.
|
|
81
|
-
*/
|
|
82
98
|
declare const registerElements: (map: Record<string, ElementConfig<never>>, options?: {
|
|
83
|
-
|
|
99
|
+
isPrepended?: boolean;
|
|
84
100
|
}) => void;
|
|
85
101
|
/**
|
|
86
|
-
* Identity helper that types the module named by
|
|
102
|
+
* Identity helper that types the module named by `elements.behaviors` in `gtkx.config.ts`, enabling
|
|
87
103
|
* editor autocompletion and type checking. Key each entry by GLib type name and write each behavior
|
|
88
104
|
* with {@link defineBehavior} so its hooks receive the concrete GObject class.
|
|
89
105
|
*/
|
|
@@ -99,9 +115,7 @@ declare const defineElements: (elements: Record<string, ElementConfig<never>>) =
|
|
|
99
115
|
* ```
|
|
100
116
|
*/
|
|
101
117
|
declare const defineBehavior: <T extends GObject.Object>(hooks: ElementBehavior<T>) => ElementBehavior<never>;
|
|
102
|
-
/** Spreads one config across many GLib type names. */
|
|
103
118
|
declare const forTypes: (types: string[], config: ElementConfig<never>) => Record<string, ElementConfig<never>>;
|
|
104
|
-
/** References a base props interface exported from `@gtkx/react/internal`. */
|
|
105
119
|
declare const internal: (name: string) => ModuleExport;
|
|
106
120
|
export { ELEMENTS, deferredProps, mergeElementConfigs, registerElements, defineElements, defineBehavior, forTypes, internal, type Props, type PlaceInfo, type DetachInfo, type ElementBehavior, type ModuleExport, type ElementConfig, };
|
|
107
121
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/reconciler/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAEjD,wFAAwF;AACxF,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErC,+EAA+E;AAC/E,KAAK,SAAS,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,sEAAsE;AACtE,KAAK,UAAU,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/reconciler/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAEjD,wFAAwF;AACxF,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErC,+EAA+E;AAC/E,KAAK,SAAS,GAAG;IACb,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,qFAAqF;IACrF,OAAO,EAAE,OAAO,CAAC,MAAM,GAAG,IA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EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,KAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAU1G,CAAC;AAEF,QAAA,MAAM,gBAAgB,GAClB,KAAK,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,EACzC,UAAS;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,KACxC,IAIF,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,cAAc,GAAI,UAAU,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAChG,CAAC;AAEb;;;;;;;;;GASG;AACH,QAAA,MAAM,cAAc,GAAI,CAAC,SAAS,OAAO,CAAC,MAAM,EAAE,OAAO,eAAe,CAAC,CAAC,CAAC,KAAG,eAAe,CAAC,KAAK,CAAU,CAAC;AAE9G,QAAA,MAAM,QAAQ,GAAI,OAAO,MAAM,EAAE,EAAE,QAAQ,aAAa,CAAC,KAAK,CAAC,KAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAC1C,CAAC;AAE5D,QAAA,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,YAAkE,CAAC;AAEpG,OAAO,EACH,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,aAAa,GACrB,CAAC"}
|
|
@@ -3,31 +3,30 @@
|
|
|
3
3
|
* is loaded.
|
|
4
4
|
*/
|
|
5
5
|
const ELEMENTS = {};
|
|
6
|
-
/** Props a behavior applies after construction; the constructor is never given them. */
|
|
7
6
|
const deferredProps = (behavior) => behavior.deferred ?? [];
|
|
8
7
|
const mergeBehaviors = (base, added, isPrepended) => {
|
|
9
8
|
const baseBehaviors = base.behaviors ?? [];
|
|
10
9
|
return isPrepended ? [...added, ...baseBehaviors] : [...baseBehaviors, ...added];
|
|
11
10
|
};
|
|
12
11
|
const mergeConfigEntry = (base, added, isPrepended = false) => {
|
|
13
|
-
const { behaviors,
|
|
12
|
+
const { behaviors, isLazy, omittedProps, ...rest } = added;
|
|
14
13
|
const entry = { ...base, ...rest };
|
|
15
14
|
if (behaviors !== undefined) {
|
|
16
15
|
entry.behaviors = mergeBehaviors(base, behaviors, isPrepended);
|
|
17
16
|
}
|
|
18
|
-
if (
|
|
19
|
-
entry.
|
|
17
|
+
if (omittedProps !== undefined) {
|
|
18
|
+
entry.omittedProps = [...(base.omittedProps ?? []), ...omittedProps];
|
|
20
19
|
}
|
|
21
|
-
if (
|
|
22
|
-
entry.
|
|
20
|
+
if (isLazy === true) {
|
|
21
|
+
entry.isLazy = true;
|
|
23
22
|
}
|
|
24
23
|
return entry;
|
|
25
24
|
};
|
|
26
25
|
/**
|
|
27
26
|
* Merges maps of {@link ElementConfig} keyed by GLib type name into one, concatenating each type's
|
|
28
|
-
* behaviors and omitted props in the order the maps are given (an earlier map's behaviors come first)
|
|
29
|
-
*
|
|
30
|
-
* with its behaviors.
|
|
27
|
+
* behaviors and omitted props in the order the maps are given (an earlier map's behaviors come first),
|
|
28
|
+
* taking the last component and props seen, and marking a type lazy if any map does. Use it to combine
|
|
29
|
+
* an app's element config with its behaviors.
|
|
31
30
|
*/
|
|
32
31
|
const mergeElementConfigs = (...maps) => {
|
|
33
32
|
const merged = {};
|
|
@@ -38,19 +37,13 @@ const mergeElementConfigs = (...maps) => {
|
|
|
38
37
|
}
|
|
39
38
|
return merged;
|
|
40
39
|
};
|
|
41
|
-
/**
|
|
42
|
-
* Registers a map of {@link ElementConfig} keyed by GLib type name, merging each entry into the
|
|
43
|
-
* registry. Behaviors are appended by default (the framework's built-ins register this way); pass
|
|
44
|
-
* `{ prepend: true }` for an app's own configuration so its behaviors are consulted before the
|
|
45
|
-
* built-ins for the same slot, letting it override them regardless of registration order.
|
|
46
|
-
*/
|
|
47
40
|
const registerElements = (map, options = {}) => {
|
|
48
41
|
for (const [type, config] of Object.entries(map)) {
|
|
49
|
-
ELEMENTS[type] = mergeConfigEntry(ELEMENTS[type] ?? {}, config, options.
|
|
42
|
+
ELEMENTS[type] = mergeConfigEntry(ELEMENTS[type] ?? {}, config, options.isPrepended === true);
|
|
50
43
|
}
|
|
51
44
|
};
|
|
52
45
|
/**
|
|
53
|
-
* Identity helper that types the module named by
|
|
46
|
+
* Identity helper that types the module named by `elements.behaviors` in `gtkx.config.ts`, enabling
|
|
54
47
|
* editor autocompletion and type checking. Key each entry by GLib type name and write each behavior
|
|
55
48
|
* with {@link defineBehavior} so its hooks receive the concrete GObject class.
|
|
56
49
|
*/
|
|
@@ -66,9 +59,7 @@ const defineElements = (elements) => elements;
|
|
|
66
59
|
* ```
|
|
67
60
|
*/
|
|
68
61
|
const defineBehavior = (hooks) => hooks;
|
|
69
|
-
/** Spreads one config across many GLib type names. */
|
|
70
62
|
const forTypes = (types, config) => Object.fromEntries(types.map((type) => [type, config]));
|
|
71
|
-
/** References a base props interface exported from `@gtkx/react/internal`. */
|
|
72
63
|
const internal = (name) => ({ module: "@gtkx/react/internal", export: name });
|
|
73
64
|
export { ELEMENTS, deferredProps, mergeElementConfigs, registerElements, defineElements, defineBehavior, forTypes, internal, };
|
|
74
65
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/reconciler/registry.ts"],"names":[],"mappings":"AAiEA;;;GAGG;AACH,MAAM,QAAQ,GAAkC,EAAE,CAAC;AAEnD,wFAAwF;AACxF,MAAM,aAAa,GAAG,CAAC,QAAyB,EAAY,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC;AAEvF,MAAM,cAAc,GAAG,CAAC,IAAmB,EAAE,KAAwB,EAAE,WA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node, as React passes them through the reconciler. */\ntype Props = Record<string, unknown>;\n\n/** Per-child values a slot hook receives while placing or moving one child. */\ntype PlaceInfo = {\n slot: string;\n index: number;\n sibling: GObject.Object | null;\n adopted: GObject.Object | null;\n props: Props;\n context: unknown;\n};\n\n/** Per-child values a slot hook receives while removing one child. */\ntype DetachInfo = {\n slot: string;\n adopted: GObject.Object | null;\n props: Props;\n context: unknown;\n};\n\n/**\n * Customizes how one element type places children and applies props. Every hook receives the\n * GObject instance and a private per-node `context` built once by `createContext`. A slot hook\n * claims a child by returning a non-`undefined` value; that value, or `resolve`, is the object\n * the container adopts for the child. `update` returns the prop names it consumed so those props\n * are not also set as plain GObject properties. `create` builds the GObject for types whose\n * constructor does more than set properties, and is consulted for its own type only, never\n * inherited by subtypes.\n */\ntype ElementBehavior<T extends GObject.Object = GObject.Object> = {\n create?: (props: Props) => GObject.Object;\n createContext?: (object: T) => unknown;\n attach?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;\n reorder?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;\n detach?: (object: T, child: GObject.Object, info: DetachInfo) => void;\n resolve?: (object: T, child: GObject.Object) => GObject.Object | null;\n update?: (object: T, prev: Props, next: Props, context: unknown) => Iterable<string> | undefined;\n flush?: (object: T, context: unknown) => void;\n mount?: (object: T, context: unknown) => void;\n unmount?: (object: T, context: unknown) => void;\n deferred?: string[];\n};\n\n/** A named export in a module, referenced as plain data (the module is never imported at runtime). */\ntype ModuleExport = { module: string; export: string };\n\n/**\n * Per-element configuration keyed by GLib type name: whether the element is lazy (its GObject is\n * created by its parent container, as pages and layout children are), the custom behaviors bound to\n * its type, an optional component that wraps the generated element, the base props interface its\n * generated props extend, and the GObject properties to leave out of the generated props (those a\n * behavior already writes from children, such as the `child` and `content` properties). `component`,\n * `props` and `omitProps` are inert at runtime; they are read only by codegen.\n */\ntype ElementConfig<T extends GObject.Object = GObject.Object> = {\n lazy?: boolean;\n behaviors?: ElementBehavior<T>[];\n component?: ModuleExport;\n props?: ModuleExport;\n omitProps?: string[];\n};\n\n/**\n * Every registered element config, keyed by GLib type name. Adwaita entries appear once `@gtkx/react/adw`\n * is loaded.\n */\nconst ELEMENTS: Record<string, ElementConfig> = {};\n\n/** Props a behavior applies after construction; the constructor is never given them. */\nconst deferredProps = (behavior: ElementBehavior): string[] => behavior.deferred ?? [];\n\nconst mergeBehaviors = (base: ElementConfig, added: ElementBehavior[], isPrepended: boolean): ElementBehavior[] => {\n const baseBehaviors = base.behaviors ?? [];\n\n return isPrepended ? [...added, ...baseBehaviors] : [...baseBehaviors, ...added];\n};\n\nconst mergeConfigEntry = (base: ElementConfig, added: ElementConfig<never>, isPrepended = false): ElementConfig => {\n const { behaviors, lazy, omitProps, ...rest } = added;\n const entry: ElementConfig = { ...base, ...rest };\n\n if (behaviors !== undefined) {\n entry.behaviors = mergeBehaviors(base, behaviors as ElementBehavior[], isPrepended);\n }\n\n if (omitProps !== undefined) {\n entry.omitProps = [...(base.omitProps ?? []), ...omitProps];\n }\n\n if (lazy === true) {\n entry.lazy = true;\n }\n\n return entry;\n};\n\n/**\n * Merges maps of {@link ElementConfig} keyed by GLib type name into one, concatenating each type's\n * behaviors and omitted props in the order the maps are given (an earlier map's behaviors come first)\n * and taking the last lazy flag, component, and props seen. Use it to combine an app's element config\n * with its behaviors.\n */\nconst mergeElementConfigs = (...maps: Record<string, ElementConfig<never>>[]): Record<string, ElementConfig> => {\n const merged: Record<string, ElementConfig> = {};\n\n for (const map of maps) {\n for (const [type, config] of Object.entries(map)) {\n merged[type] = mergeConfigEntry(merged[type] ?? {}, config);\n }\n }\n\n return merged;\n};\n\n/**\n * Registers a map of {@link ElementConfig} keyed by GLib type name, merging each entry into the\n * registry. Behaviors are appended by default (the framework's built-ins register this way); pass\n * `{ prepend: true }` for an app's own configuration so its behaviors are consulted before the\n * built-ins for the same slot, letting it override them regardless of registration order.\n */\nconst registerElements = (\n map: Record<string, ElementConfig<never>>,\n options: { prepend?: boolean } = {},\n): void => {\n for (const [type, config] of Object.entries(map)) {\n ELEMENTS[type] = mergeConfigEntry(ELEMENTS[type] ?? {}, config, options.prepend === true);\n }\n};\n\n/**\n * Identity helper that types the module named by the `elements` entry of `gtkx.config.ts`, enabling\n * editor autocompletion and type checking. Key each entry by GLib type name and write each behavior\n * with {@link defineBehavior} so its hooks receive the concrete GObject class.\n */\nconst defineElements = (elements: Record<string, ElementConfig<never>>): Record<string, ElementConfig<never>> =>\n elements;\n\n/**\n * Types one behavior against the GObject class it applies to, so every hook's object parameter is\n * inferred rather than annotated by hand. Pass the class as the type argument.\n *\n * ```ts\n * defineElements({\n * GtkFrame: { behaviors: [defineBehavior<Gtk.Frame>({ attach: (frame, child) => frame.setChild(child) })] },\n * });\n * ```\n */\nconst defineBehavior = <T extends GObject.Object>(hooks: ElementBehavior<T>): ElementBehavior<never> => hooks;\n\n/** Spreads one config across many GLib type names. */\nconst forTypes = (types: string[], config: ElementConfig<never>): Record<string, ElementConfig<never>> =>\n Object.fromEntries(types.map((type) => [type, config]));\n\n/** References a base props interface exported from `@gtkx/react/internal`. */\nconst internal = (name: string): ModuleExport => ({ module: \"@gtkx/react/internal\", export: name });\n\nexport {\n ELEMENTS,\n deferredProps,\n mergeElementConfigs,\n registerElements,\n defineElements,\n defineBehavior,\n forTypes,\n internal,\n type Props,\n type PlaceInfo,\n type DetachInfo,\n type ElementBehavior,\n type ModuleExport,\n type ElementConfig,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/reconciler/registry.ts"],"names":[],"mappings":"AA2FA;;;GAGG;AACH,MAAM,QAAQ,GAAkC,EAAE,CAAC;AAEnD,MAAM,aAAa,GAAG,CAAC,QAAyB,EAAY,EAAE,CAAC,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC;AAEvF,MAAM,cAAc,GAAG,CAAC,IAAmB,EAAE,KAAwB,EAAE,WAAoB,EAAqB,EAAE;IAC9G,MAAM,aAAa,GAAG,IAAI,CAAC,SAA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EAAE,EAAE,MAAM,CAAC,CAAC;QAChE,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CACrB,GAAyC,EACzC,UAAqC,EAAE,EACnC,EAAE;IACN,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,QAAQ,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC;IAClG,CAAC;AACL,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,cAAc,GAAG,CAAC,QAA8C,EAAwC,EAAE,CAC5G,QAAQ,CAAC;AAEb;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAG,CAA2B,KAAyB,EAA0B,EAAE,CAAC,KAAK,CAAC;AAE9G,MAAM,QAAQ,GAAG,CAAC,KAAe,EAAE,MAA4B,EAAwC,EAAE,CACrG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAE5D,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAgB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAEpG,OAAO,EACH,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,QAAQ,GAOX,CAAC","sourcesContent":["import type * as GObject from \"@gtkx/gi/gobject\";\n\n/** The props of a host element or node, as React passes them through the reconciler. */\ntype Props = Record<string, unknown>;\n\n/** Per-child values a slot hook receives while placing or moving one child. */\ntype PlaceInfo = {\n /** Name of the slot being filled: `children`, or the prop the child was nested under. */\n slot: string;\n /** Position of the child among the slot's children. */\n index: number;\n /** Object of the preceding child in the slot, or null when the child comes first. */\n sibling: GObject.Object | null;\n /** Object adopted for this child by an earlier attach, or null before it has one. */\n adopted: GObject.Object | null;\n /** Props of the child element. */\n props: Props;\n /** Value `initialize` returned for this behavior on the parent. */\n context: unknown;\n};\n\n/** Per-child values a slot hook receives while removing one child. */\ntype DetachInfo = {\n /** Name of the slot the child is leaving. */\n slot: string;\n /** Object the container adopted for this child, or null when it adopted none. */\n adopted: GObject.Object | null;\n /** Props of the child element. */\n props: Props;\n /** Value `initialize` returned for this behavior on the parent. */\n context: unknown;\n};\n\n/**\n * Customizes how one element type places children and applies props. Hooks other than `create` receive the\n * GObject instance; `update` and `flush` also take the private per-node context `initialize` built, and\n * `attach`, `reorder` and `detach` read it off their info object. Subtypes inherit a type's behaviors,\n * except for `create`, which is consulted only for the type it is registered on.\n */\ntype ElementBehavior<T extends GObject.Object = GObject.Object> = {\n /** Builds the GObject from its construct props, for types whose constructor does more than set properties. */\n create?: (props: Props) => GObject.Object;\n /** Builds the private per-node context the other hooks receive, once per node. */\n initialize?: (object: T) => unknown;\n /** Places a child, claiming it by returning anything other than `undefined`. */\n attach?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;\n /** Moves an already-attached child; without it, the whole slot is detached and re-attached in order. */\n reorder?: (object: T, child: GObject.Object, info: PlaceInfo) => unknown;\n /** Removes a child this behavior attached. */\n detach?: (object: T, child: GObject.Object, info: DetachInfo) => void;\n /** Returns the object the container adopts for a child, overriding whatever `attach` returned. */\n resolve?: (object: T, child: GObject.Object) => GObject.Object | null;\n /** Applies changed props and returns the names it consumed, which are then not set as GObject properties. */\n update?: (object: T, prev: Props, next: Props, context: unknown) => Iterable<string> | undefined;\n /** Runs after the commit that touched the node, once every child has been placed. */\n flush?: (object: T, context: unknown) => void;\n /** Props to withhold from the constructor, leaving them for a later hook to apply. */\n deferred?: string[];\n /**\n * Props the behavior can only apply while the element is being built, because the library exposes no\n * counterpart to whatever applied them. Changing one after it has been applied throws instead of\n * silently applying the new value on top of the old.\n */\n constructOnly?: string[];\n};\n\n/** A named export in a module, referenced as plain data (the module is never imported at runtime). */\ntype ModuleExport = {\n /** Specifier the export is imported from. */\n module: string;\n /** Identifier the module exports it under. */\n export: string;\n};\n\n/**\n * How one GLib type is rendered. `component`, `props` and `omittedProps` are inert at runtime; they are\n * read only by codegen.\n */\ntype ElementConfig<T extends GObject.Object = GObject.Object> = {\n /** The element has no GObject of its own; its parent container creates one, as it does for pages. */\n isLazy?: boolean;\n /** Behaviors bound to the type, consulted in registration order and inherited by its subtypes. */\n behaviors?: ElementBehavior<T>[];\n /** Component that wraps the generated element. */\n component?: ModuleExport;\n /** Base props interface the generated props extend. */\n props?: ModuleExport;\n /** GObject properties to leave out of the generated props, such as those a behavior writes from children. */\n omittedProps?: string[];\n};\n\n/**\n * Every registered element config, keyed by GLib type name. Adwaita entries appear once `@gtkx/react/adw`\n * is loaded.\n */\nconst ELEMENTS: Record<string, ElementConfig> = {};\n\nconst deferredProps = (behavior: ElementBehavior): string[] => behavior.deferred ?? [];\n\nconst mergeBehaviors = (base: ElementConfig, added: ElementBehavior[], isPrepended: boolean): ElementBehavior[] => {\n const baseBehaviors = base.behaviors ?? [];\n\n return isPrepended ? [...added, ...baseBehaviors] : [...baseBehaviors, ...added];\n};\n\nconst mergeConfigEntry = (base: ElementConfig, added: ElementConfig<never>, isPrepended = false): ElementConfig => {\n const { behaviors, isLazy, omittedProps, ...rest } = added;\n const entry: ElementConfig = { ...base, ...rest };\n\n if (behaviors !== undefined) {\n entry.behaviors = mergeBehaviors(base, behaviors as ElementBehavior[], isPrepended);\n }\n\n if (omittedProps !== undefined) {\n entry.omittedProps = [...(base.omittedProps ?? []), ...omittedProps];\n }\n\n if (isLazy === true) {\n entry.isLazy = true;\n }\n\n return entry;\n};\n\n/**\n * Merges maps of {@link ElementConfig} keyed by GLib type name into one, concatenating each type's\n * behaviors and omitted props in the order the maps are given (an earlier map's behaviors come first),\n * taking the last component and props seen, and marking a type lazy if any map does. Use it to combine\n * an app's element config with its behaviors.\n */\nconst mergeElementConfigs = (...maps: Record<string, ElementConfig<never>>[]): Record<string, ElementConfig> => {\n const merged: Record<string, ElementConfig> = {};\n\n for (const map of maps) {\n for (const [type, config] of Object.entries(map)) {\n merged[type] = mergeConfigEntry(merged[type] ?? {}, config);\n }\n }\n\n return merged;\n};\n\nconst registerElements = (\n map: Record<string, ElementConfig<never>>,\n options: { isPrepended?: boolean } = {},\n): void => {\n for (const [type, config] of Object.entries(map)) {\n ELEMENTS[type] = mergeConfigEntry(ELEMENTS[type] ?? {}, config, options.isPrepended === true);\n }\n};\n\n/**\n * Identity helper that types the module named by `elements.behaviors` in `gtkx.config.ts`, enabling\n * editor autocompletion and type checking. Key each entry by GLib type name and write each behavior\n * with {@link defineBehavior} so its hooks receive the concrete GObject class.\n */\nconst defineElements = (elements: Record<string, ElementConfig<never>>): Record<string, ElementConfig<never>> =>\n elements;\n\n/**\n * Types one behavior against the GObject class it applies to, so every hook's object parameter is\n * inferred rather than annotated by hand. Pass the class as the type argument.\n *\n * ```ts\n * defineElements({\n * GtkFrame: { behaviors: [defineBehavior<Gtk.Frame>({ attach: (frame, child) => frame.setChild(child) })] },\n * });\n * ```\n */\nconst defineBehavior = <T extends GObject.Object>(hooks: ElementBehavior<T>): ElementBehavior<never> => hooks;\n\nconst forTypes = (types: string[], config: ElementConfig<never>): Record<string, ElementConfig<never>> =>\n Object.fromEntries(types.map((type) => [type, config]));\n\nconst internal = (name: string): ModuleExport => ({ module: \"@gtkx/react/internal\", export: name });\n\nexport {\n ELEMENTS,\n deferredProps,\n mergeElementConfigs,\n registerElements,\n defineElements,\n defineBehavior,\n forTypes,\n internal,\n type Props,\n type PlaceInfo,\n type DetachInfo,\n type ElementBehavior,\n type ModuleExport,\n type ElementConfig,\n};\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** The type of the shared {@link rootElement} marker used as a default top-level container. */
|
|
2
2
|
type RootElement = {
|
|
3
|
+
/** Marks a container as the top level rather than a GObject; `isRootElement` tests for it. */
|
|
3
4
|
[ROOT_ELEMENT_BRAND]: true;
|
|
4
5
|
};
|
|
5
6
|
declare const ROOT_ELEMENT_BRAND: unique symbol;
|
|
6
7
|
/** A shared marker value used as the default top-level container for rendering and portals. */
|
|
7
8
|
declare const rootElement: RootElement;
|
|
8
|
-
/** Reports whether an arbitrary value is a {@link rootElement} marker. */
|
|
9
9
|
declare const isRootElement: (value: unknown) => value is RootElement;
|
|
10
10
|
export { rootElement, isRootElement, type RootElement };
|
|
11
11
|
//# sourceMappingURL=root-element.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-element.d.ts","sourceRoot":"","sources":["../../src/reconciler/root-element.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,KAAK,WAAW,GAAG;
|
|
1
|
+
{"version":3,"file":"root-element.d.ts","sourceRoot":"","sources":["../../src/reconciler/root-element.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,KAAK,WAAW,GAAG;IACf,8FAA8F;IAC9F,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC;CAC9B,CAAC;AAEF,QAAA,MAAM,kBAAkB,EAAE,OAAO,MAAwC,CAAC;AAC1E,+FAA+F;AAC/F,QAAA,MAAM,WAAW,EAAE,WAA4C,CAAC;AAEhE,QAAA,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAC0C,CAAC;AAE5F,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,WAAW,EAAE,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const ROOT_ELEMENT_BRAND = Symbol.for("gtkx:root-element");
|
|
2
2
|
/** A shared marker value used as the default top-level container for rendering and portals. */
|
|
3
3
|
const rootElement = { [ROOT_ELEMENT_BRAND]: true };
|
|
4
|
-
/** Reports whether an arbitrary value is a {@link rootElement} marker. */
|
|
5
4
|
const isRootElement = (value) => typeof value === "object" && value !== null && Object.hasOwn(value, ROOT_ELEMENT_BRAND);
|
|
6
5
|
export { rootElement, isRootElement };
|
|
7
6
|
//# sourceMappingURL=root-element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-element.js","sourceRoot":"","sources":["../../src/reconciler/root-element.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"root-element.js","sourceRoot":"","sources":["../../src/reconciler/root-element.ts"],"names":[],"mappings":"AAMA,MAAM,kBAAkB,GAAkB,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAC1E,+FAA+F;AAC/F,MAAM,WAAW,GAAgB,EAAE,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC;AAEhE,MAAM,aAAa,GAAG,CAAC,KAAc,EAAwB,EAAE,CAC3D,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;AAE5F,OAAO,EAAE,WAAW,EAAE,aAAa,EAAoB,CAAC","sourcesContent":["/** The type of the shared {@link rootElement} marker used as a default top-level container. */\ntype RootElement = {\n /** Marks a container as the top level rather than a GObject; `isRootElement` tests for it. */\n [ROOT_ELEMENT_BRAND]: true;\n};\n\nconst ROOT_ELEMENT_BRAND: unique symbol = Symbol.for(\"gtkx:root-element\");\n/** A shared marker value used as the default top-level container for rendering and portals. */\nconst rootElement: RootElement = { [ROOT_ELEMENT_BRAND]: true };\n\nconst isRootElement = (value: unknown): value is RootElement =>\n typeof value === \"object\" && value !== null && Object.hasOwn(value, ROOT_ELEMENT_BRAND);\n\nexport { rootElement, isRootElement, type RootElement };\n"]}
|
|
@@ -9,36 +9,28 @@ type RootErrorCallbacks = {
|
|
|
9
9
|
type ReconcilerRootOptions = RootErrorCallbacks & {
|
|
10
10
|
containerInfo: Container;
|
|
11
11
|
};
|
|
12
|
-
/** A root
|
|
12
|
+
/** A render root whose updates and teardown the caller drives, with error handling left to it. */
|
|
13
13
|
type ReconcilerRoot = {
|
|
14
|
+
/** Mounts an element tree into the container, or updates the tree already mounted there. */
|
|
14
15
|
update: (element: ReactNode) => void;
|
|
16
|
+
/** Hands the root to `teardown`, then stops {@link quit} from unmounting the container. */
|
|
15
17
|
unmount: (teardown: (root: ReconcilerRoot) => Promise<void>) => Promise<void>;
|
|
16
18
|
};
|
|
17
19
|
/** The object {@link createRoot} returns: it renders an element tree into a container and can tear it down. */
|
|
18
20
|
type Root = {
|
|
21
|
+
/** Mounts an element tree into the container, or updates the tree already mounted there. */
|
|
19
22
|
render: (element: ReactNode) => void;
|
|
23
|
+
/** Unmounts the rendered tree and runs its effect cleanups. */
|
|
20
24
|
unmount: () => void;
|
|
21
25
|
};
|
|
22
26
|
type ErrorHandler = (error: unknown) => void;
|
|
23
|
-
/**
|
|
24
|
-
* Installs a process-wide handler for errors thrown while rendering or applying an update.
|
|
25
|
-
*
|
|
26
|
-
* @param handler The handler to install.
|
|
27
|
-
* @returns The previously installed handler, or null.
|
|
28
|
-
*/
|
|
29
27
|
declare const setReconcilerErrorHandler: (handler: ErrorHandler) => ErrorHandler | null;
|
|
30
|
-
/**
|
|
31
|
-
* Creates a root that mounts an element tree into a container, routing render errors to the supplied callbacks.
|
|
32
|
-
*
|
|
33
|
-
* @param options The container to render into and the error callbacks to route failures to.
|
|
34
|
-
* @returns A {@link ReconcilerRoot}.
|
|
35
|
-
*/
|
|
36
28
|
declare const createReconcilerRoot: (options: ReconcilerRootOptions) => ReconcilerRoot;
|
|
37
29
|
/**
|
|
38
|
-
* Creates a render root for a GTKX application.
|
|
30
|
+
* Creates a render root for a GTKX application. Uncaught render errors are rethrown and errors caught by an
|
|
31
|
+
* error boundary are logged.
|
|
39
32
|
*
|
|
40
|
-
* @param container The
|
|
41
|
-
* @returns A {@link Root} exposing render and unmount.
|
|
33
|
+
* @param container The GObject to render into; defaults to the shared {@link rootElement}, which holds no object.
|
|
42
34
|
*/
|
|
43
35
|
declare const createRoot: (container?: Container) => Root;
|
|
44
36
|
/** Unmounts every active render root and stops the originating signal from propagating further. */
|
|
@@ -46,10 +38,7 @@ declare const quit: () => typeof Gdk.EVENT_STOP;
|
|
|
46
38
|
/**
|
|
47
39
|
* Renders children into a container other than the surrounding tree.
|
|
48
40
|
*
|
|
49
|
-
* @param
|
|
50
|
-
* @param container The GObject, application, or {@link rootElement} to render into.
|
|
51
|
-
* @param key An optional stable key.
|
|
52
|
-
* @returns A React portal.
|
|
41
|
+
* @param container The GObject to render into, or {@link rootElement} to render at the top level.
|
|
53
42
|
*/
|
|
54
43
|
declare const createPortal: (children: ReactNode, container: Container, key?: string) => ReactPortal;
|
|
55
44
|
export { setReconcilerErrorHandler, createReconcilerRoot, createRoot, quit, createPortal, type ReconcilerRoot, type Root, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/reconciler/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/reconciler/root.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAIpC,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,kBAAkB,CAAC;AAK9D,KAAK,kBAAkB,GAAG;IACtB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IAC5D,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CA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Z,CAAC"}
|
package/dist/reconciler/root.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Gdk from "@gtkx/gi/gdk";
|
|
2
2
|
import { createLogger } from "@gtkx/utils";
|
|
3
3
|
import { ConcurrentRoot } from "react-reconciler/constants.js";
|
|
4
|
+
import { injectIntoDevTools } from "./devtools.js";
|
|
4
5
|
import { reconciler } from "./host-config.js";
|
|
5
6
|
import { rootElement } from "./root-element.js";
|
|
6
7
|
const log = createLogger("react");
|
|
@@ -17,12 +18,6 @@ function createErrorHandlerSlot() {
|
|
|
17
18
|
},
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Installs a process-wide handler for errors thrown while rendering or applying an update.
|
|
22
|
-
*
|
|
23
|
-
* @param handler The handler to install.
|
|
24
|
-
* @returns The previously installed handler, or null.
|
|
25
|
-
*/
|
|
26
21
|
const setReconcilerErrorHandler = (handler) => errorHandlerSlot.set(handler);
|
|
27
22
|
const rethrowUncaughtRenderError = (error) => {
|
|
28
23
|
throw error;
|
|
@@ -31,6 +26,7 @@ const logCaughtRenderError = (error) => {
|
|
|
31
26
|
log.error("caught render error", error);
|
|
32
27
|
};
|
|
33
28
|
const openContainer = (containerInfo, callbacks) => {
|
|
29
|
+
injectIntoDevTools(reconciler);
|
|
34
30
|
const container = reconciler.createContainer(containerInfo, ConcurrentRoot, null, false, null, "", (error, info) => {
|
|
35
31
|
errorHandlerSlot.get()?.(error);
|
|
36
32
|
callbacks.onUncaughtError?.(error, info);
|
|
@@ -47,12 +43,6 @@ const unmountContainer = (container) => {
|
|
|
47
43
|
reconciler.updateContainer(null, container, null, null);
|
|
48
44
|
activeRoots.delete(container);
|
|
49
45
|
};
|
|
50
|
-
/**
|
|
51
|
-
* Creates a root that mounts an element tree into a container, routing render errors to the supplied callbacks.
|
|
52
|
-
*
|
|
53
|
-
* @param options The container to render into and the error callbacks to route failures to.
|
|
54
|
-
* @returns A {@link ReconcilerRoot}.
|
|
55
|
-
*/
|
|
56
46
|
const createReconcilerRoot = (options) => {
|
|
57
47
|
const container = openContainer(options.containerInfo, options);
|
|
58
48
|
const root = {
|
|
@@ -67,10 +57,10 @@ const createReconcilerRoot = (options) => {
|
|
|
67
57
|
return root;
|
|
68
58
|
};
|
|
69
59
|
/**
|
|
70
|
-
* Creates a render root for a GTKX application.
|
|
60
|
+
* Creates a render root for a GTKX application. Uncaught render errors are rethrown and errors caught by an
|
|
61
|
+
* error boundary are logged.
|
|
71
62
|
*
|
|
72
|
-
* @param container The
|
|
73
|
-
* @returns A {@link Root} exposing render and unmount.
|
|
63
|
+
* @param container The GObject to render into; defaults to the shared {@link rootElement}, which holds no object.
|
|
74
64
|
*/
|
|
75
65
|
const createRoot = (container = rootElement) => {
|
|
76
66
|
const opaque = openContainer(container, {
|
|
@@ -96,10 +86,7 @@ const quit = () => {
|
|
|
96
86
|
/**
|
|
97
87
|
* Renders children into a container other than the surrounding tree.
|
|
98
88
|
*
|
|
99
|
-
* @param
|
|
100
|
-
* @param container The GObject, application, or {@link rootElement} to render into.
|
|
101
|
-
* @param key An optional stable key.
|
|
102
|
-
* @returns A React portal.
|
|
89
|
+
* @param container The GObject to render into, or {@link rootElement} to render at the top level.
|
|
103
90
|
*/
|
|
104
91
|
const createPortal = (children, container, key) => reconciler.createPortal(children, container, null, key ?? null);
|
|
105
92
|
export { setReconcilerErrorHandler, createReconcilerRoot, createRoot, quit, createPortal, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/reconciler/root.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,YAAY,EAAe,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAkB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CA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port { createLogger, type Logger } from \"@gtkx/utils\";\nimport { ConcurrentRoot } from \"react-reconciler/constants.js\";\nimport { injectIntoDevTools } from \"./devtools.js\";\nimport { type Container, reconciler } from \"./host-config.js\";\nimport { rootElement } from \"./root-element.js\";\n\ntype OpaqueRoot = { [opaqueRoot]: true };\n\ntype RootErrorCallbacks = {\n onUncaughtError?: (error: unknown, info: ErrorInfo) => void;\n onCaughtError?: (error: unknown, info: ErrorInfo) => void;\n onRecoverableError?: (error: unknown, info: ErrorInfo) => void;\n};\n\ntype ReconcilerRootOptions = RootErrorCallbacks & { containerInfo: Container };\n\n/** A render root whose updates and teardown the caller drives, with error handling left to it. */\ntype ReconcilerRoot = {\n /** Mounts an element tree into the container, or updates the tree already mounted there. */\n update: (element: ReactNode) => void;\n /** Hands the root to `teardown`, then stops {@link quit} from unmounting the container. */\n unmount: (teardown: (root: ReconcilerRoot) => Promise<void>) => Promise<void>;\n};\n\n/** The object {@link createRoot} returns: it renders an element tree into a container and can tear it down. */\ntype Root = {\n /** Mounts an element tree into the container, or updates the tree already mounted there. */\n render: (element: ReactNode) => void;\n /** Unmounts the rendered tree and runs its effect cleanups. */\n unmount: () => void;\n};\n\ntype ErrorHandler = (error: unknown) => void;\ntype ErrorHandlerSlot = { get: () => ErrorHandler | null; set: (handler: ErrorHandler) => ErrorHandler | null };\n\ndeclare const opaqueRoot: unique symbol;\nconst log: Logger = createLogger(\"react\");\nconst activeRoots: Set<OpaqueRoot> = new Set();\nconst errorHandlerSlot = createErrorHandlerSlot();\n\nfunction createErrorHandlerSlot(): ErrorHandlerSlot {\n let current: ErrorHandler | null = null;\n\n return {\n get: () => current,\n set: (handler) => {\n const previous = current;\n current = handler;\n\n return previous;\n },\n };\n}\n\nconst setReconcilerErrorHandler = (handler: ErrorHandler): ErrorHandler | null => errorHandlerSlot.set(handler);\n\nconst rethrowUncaughtRenderError = (error: unknown): never => {\n throw error;\n};\n\nconst logCaughtRenderError = (error: unknown): void => {\n log.error(\"caught render error\", error);\n};\n\nconst openContainer = (containerInfo: Container, callbacks: RootErrorCallbacks): OpaqueRoot => {\n injectIntoDevTools(reconciler);\n\n const container = reconciler.createContainer(\n containerInfo,\n ConcurrentRoot,\n null,\n false,\n null,\n \"\",\n (error, info) => {\n errorHandlerSlot.get()?.(error);\n callbacks.onUncaughtError?.(error, info);\n },\n (error, info) => {\n errorHandlerSlot.get()?.(error);\n callbacks.onCaughtError?.(error, info);\n },\n (error, info) => {\n callbacks.onRecoverableError?.(error, info);\n },\n (): void => undefined,\n ) as OpaqueRoot;\n\n activeRoots.add(container);\n\n return container;\n};\n\nconst unmountContainer = (container: OpaqueRoot): void => {\n reconciler.updateContainer(null, container, null, null);\n activeRoots.delete(container);\n};\n\nconst createReconcilerRoot = (options: ReconcilerRootOptions): ReconcilerRoot => {\n const container = openContainer(options.containerInfo, options);\n\n const root: ReconcilerRoot = {\n update: (element) => {\n reconciler.updateContainer(element, container, null, null);\n },\n unmount: async (teardown) => {\n await teardown(root);\n activeRoots.delete(container);\n },\n };\n\n return root;\n};\n\n/**\n * Creates a render root for a GTKX application. Uncaught render errors are rethrown and errors caught by an\n * error boundary are logged.\n *\n * @param container The GObject to render into; defaults to the shared {@link rootElement}, which holds no object.\n */\nconst createRoot = (container: Container = rootElement): Root => {\n const opaque = openContainer(container, {\n onUncaughtError: rethrowUncaughtRenderError,\n onCaughtError: logCaughtRenderError,\n });\n\n return {\n render: (element) => {\n reconciler.updateContainer(element, opaque, null, null);\n },\n unmount: () => {\n unmountContainer(opaque);\n },\n };\n};\n\n/** Unmounts every active render root and stops the originating signal from propagating further. */\nconst quit = (): typeof Gdk.EVENT_STOP => {\n for (const container of activeRoots) {\n unmountContainer(container);\n }\n\n return Gdk.EVENT_STOP;\n};\n\n/**\n * Renders children into a container other than the surrounding tree.\n *\n * @param container The GObject to render into, or {@link rootElement} to render at the top level.\n */\nconst createPortal = (children: ReactNode, container: Container, key?: string): ReactPortal =>\n reconciler.createPortal(children, container, null, key ?? null) as unknown as ReactPortal;\n\nexport {\n setReconcilerErrorHandler,\n createReconcilerRoot,\n createRoot,\n quit,\n createPortal,\n type ReconcilerRoot,\n type Root,\n};\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type SignalHandler } from "@gtkx/runtime";
|
|
2
2
|
import type { SignalTarget } from "./node.js";
|
|
3
|
-
declare const isApplyingWrite: () => boolean;
|
|
4
3
|
declare const applyWrite: <T>(write: () => T) => T;
|
|
5
4
|
declare const connectHandler: (target: SignalTarget, prop: string, signal: string, handler: SignalHandler) => void;
|
|
6
5
|
declare const disconnectHandler: (target: SignalTarget, prop: string) => void;
|
|
7
6
|
declare const disconnectAllHandlers: (target: SignalTarget) => void;
|
|
8
|
-
export { applyWrite,
|
|
7
|
+
export { applyWrite, connectHandler, disconnectHandler, disconnectAllHandlers, };
|
|
9
8
|
//# sourceMappingURL=signals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/reconciler/signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/reconciler/signals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,WAAW,CAAC;AAQ7D,QAAA,MAAM,UAAU,GAAI,CAAC,EAAE,OAAO,MAAM,CAAC,KAAG,CAQvC,CAAC;AA2BF,QAAA,MAAM,cAAc,GAAI,QAAQ,YAAY,EAAE,MAAM,MAAM,EAAE,QAAQ,MAAM,EAAE,SAAS,aAAa,KAAG,IAmBpG,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,QAAQ,YAAY,EAAE,MAAM,MAAM,KAAG,IAS/D,CAAC;AAEF,QAAA,MAAM,qBAAqB,GAAI,QAAQ,YAAY,KAAG,IAMrD,CAAC;AAEF,OAAO,EACH,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,qBAAqB,GACxB,CAAC"}
|