@gtkx/react 1.0.0-rc.1 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adw/config.d.ts +2 -0
- package/dist/adw/config.d.ts.map +1 -0
- package/dist/adw/config.js +2 -0
- package/dist/adw/config.js.map +1 -0
- package/dist/{libraries/adw → adw}/dialog.d.ts +2 -2
- package/dist/adw/dialog.d.ts.map +1 -0
- package/dist/adw/dialog.js +25 -0
- package/dist/adw/dialog.js.map +1 -0
- package/dist/adw/element-behaviors.d.ts +2 -0
- package/dist/adw/element-behaviors.d.ts.map +1 -0
- package/dist/adw/element-behaviors.js +299 -0
- package/dist/adw/element-behaviors.js.map +1 -0
- package/dist/adw/element-config.d.ts +9 -0
- package/dist/adw/element-config.d.ts.map +1 -0
- package/dist/adw/element-config.js +137 -0
- package/dist/adw/element-config.js.map +1 -0
- package/dist/adw/index.d.ts +4 -0
- package/dist/adw/index.d.ts.map +1 -0
- package/dist/adw/index.js +3 -0
- package/dist/adw/index.js.map +1 -0
- package/dist/adw/prop-types.d.ts +29 -0
- package/dist/adw/prop-types.d.ts.map +1 -0
- package/dist/adw/prop-types.js +2 -0
- package/dist/adw/prop-types.js.map +1 -0
- package/dist/bootstrap.d.ts +2 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +5 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/components/application.d.ts +2 -2
- package/dist/components/application.d.ts.map +1 -1
- package/dist/components/application.js +31 -18
- package/dist/components/application.js.map +1 -1
- package/dist/components/element.d.ts +6 -0
- package/dist/components/element.d.ts.map +1 -0
- package/dist/components/element.js +29 -0
- package/dist/components/element.js.map +1 -0
- package/dist/components/window.d.ts +2 -2
- package/dist/components/window.d.ts.map +1 -1
- package/dist/components/window.js +10 -11
- package/dist/components/window.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -0
- package/dist/element-behaviors.d.ts +2 -0
- package/dist/element-behaviors.d.ts.map +1 -0
- package/dist/element-behaviors.js +348 -0
- package/dist/element-behaviors.js.map +1 -0
- package/dist/element-config.d.ts +10 -0
- package/dist/element-config.d.ts.map +1 -0
- package/dist/element-config.js +146 -0
- package/dist/element-config.js.map +1 -0
- package/dist/hooks/use-application.d.ts +4 -3
- package/dist/hooks/use-application.d.ts.map +1 -1
- package/dist/hooks/use-application.js +5 -4
- package/dist/hooks/use-application.js.map +1 -1
- package/dist/hooks/use-bind-setting.d.ts +21 -4
- package/dist/hooks/use-bind-setting.d.ts.map +1 -1
- package/dist/hooks/use-bind-setting.js +27 -16
- package/dist/hooks/use-bind-setting.js.map +1 -1
- package/dist/hooks/use-merged-refs.d.ts +8 -0
- package/dist/hooks/use-merged-refs.d.ts.map +1 -0
- package/dist/hooks/use-merged-refs.js +48 -0
- package/dist/hooks/use-merged-refs.js.map +1 -0
- package/dist/hooks/use-object-value.d.ts +3 -2
- package/dist/hooks/use-object-value.d.ts.map +1 -1
- package/dist/hooks/use-object-value.js +18 -21
- package/dist/hooks/use-object-value.js.map +1 -1
- package/dist/hooks/use-parent-window.d.ts +3 -2
- package/dist/hooks/use-parent-window.d.ts.map +1 -1
- package/dist/hooks/use-parent-window.js +3 -2
- package/dist/hooks/use-parent-window.js.map +1 -1
- package/dist/hooks/use-property.d.ts +5 -5
- package/dist/hooks/use-property.d.ts.map +1 -1
- package/dist/hooks/use-property.js +4 -3
- package/dist/hooks/use-property.js.map +1 -1
- package/dist/hooks/use-setting.d.ts +5 -16
- package/dist/hooks/use-setting.d.ts.map +1 -1
- package/dist/hooks/use-setting.js +16 -11
- package/dist/hooks/use-setting.js.map +1 -1
- package/dist/hooks/use-signal.d.ts +10 -7
- package/dist/hooks/use-signal.d.ts.map +1 -1
- package/dist/hooks/use-signal.js +29 -18
- package/dist/hooks/use-signal.js.map +1 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +6 -7
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +5 -7
- package/dist/internal.js.map +1 -1
- package/dist/prop-types.d.ts +110 -0
- package/dist/prop-types.d.ts.map +1 -0
- package/dist/prop-types.js +2 -0
- package/dist/prop-types.js.map +1 -0
- package/dist/reconciler/apply-props.d.ts +10 -7
- package/dist/reconciler/apply-props.d.ts.map +1 -1
- package/dist/reconciler/apply-props.js +182 -84
- package/dist/reconciler/apply-props.js.map +1 -1
- package/dist/reconciler/behaviors.d.ts +59 -0
- package/dist/reconciler/behaviors.d.ts.map +1 -0
- package/dist/reconciler/behaviors.js +172 -0
- package/dist/reconciler/behaviors.js.map +1 -0
- package/dist/reconciler/child-routing.d.ts +5 -0
- package/dist/reconciler/child-routing.d.ts.map +1 -0
- package/dist/reconciler/child-routing.js +156 -0
- package/dist/reconciler/child-routing.js.map +1 -0
- package/dist/reconciler/host-config.d.ts +8 -12
- package/dist/reconciler/host-config.d.ts.map +1 -1
- package/dist/reconciler/host-config.js +175 -270
- package/dist/reconciler/host-config.js.map +1 -1
- package/dist/reconciler/instance.d.ts +4 -5
- package/dist/reconciler/instance.d.ts.map +1 -1
- package/dist/reconciler/instance.js +44 -22
- package/dist/reconciler/instance.js.map +1 -1
- package/dist/reconciler/metadata.d.ts +17 -0
- package/dist/reconciler/metadata.d.ts.map +1 -0
- package/dist/reconciler/metadata.js +82 -0
- package/dist/reconciler/metadata.js.map +1 -0
- package/dist/reconciler/node.d.ts +76 -0
- package/dist/reconciler/node.d.ts.map +1 -0
- package/dist/reconciler/node.js +53 -0
- package/dist/reconciler/node.js.map +1 -0
- package/dist/reconciler/placement.d.ts +5 -0
- package/dist/reconciler/placement.d.ts.map +1 -0
- package/dist/reconciler/placement.js +175 -0
- package/dist/reconciler/placement.js.map +1 -0
- package/dist/reconciler/registry.d.ts +92 -0
- package/dist/reconciler/registry.d.ts.map +1 -0
- package/dist/reconciler/registry.js +64 -0
- package/dist/reconciler/registry.js.map +1 -0
- package/dist/reconciler/root-element.d.ts +9 -12
- package/dist/reconciler/root-element.d.ts.map +1 -1
- package/dist/reconciler/root-element.js +6 -6
- package/dist/reconciler/root-element.js.map +1 -1
- package/dist/reconciler/root.d.ts +56 -0
- package/dist/reconciler/root.d.ts.map +1 -0
- package/dist/reconciler/root.js +109 -0
- package/dist/reconciler/root.js.map +1 -0
- package/dist/reconciler/signals.d.ts +10 -0
- package/dist/reconciler/signals.d.ts.map +1 -0
- package/dist/reconciler/signals.js +70 -0
- package/dist/reconciler/signals.js.map +1 -0
- package/dist/reconciler/text.d.ts +19 -0
- package/dist/reconciler/text.d.ts.map +1 -0
- package/dist/reconciler/text.js +276 -0
- package/dist/reconciler/text.js.map +1 -0
- package/dist/utils/accessible-metadata.d.ts +11 -4
- package/dist/utils/accessible-metadata.d.ts.map +1 -1
- package/dist/utils/accessible-metadata.js +20 -17
- package/dist/utils/accessible-metadata.js.map +1 -1
- package/dist/{reconciler/accessible.d.ts → utils/accessible-props.d.ts} +7 -6
- package/dist/utils/accessible-props.d.ts.map +1 -0
- package/dist/utils/accessible-props.js +181 -0
- package/dist/utils/accessible-props.js.map +1 -0
- package/dist/utils/ref-prop.d.ts +15 -0
- package/dist/utils/ref-prop.d.ts.map +1 -0
- package/dist/utils/ref-prop.js +18 -0
- package/dist/utils/ref-prop.js.map +1 -0
- package/dist/utils/settings.d.ts +17 -0
- package/dist/utils/settings.d.ts.map +1 -0
- package/dist/utils/settings.js +37 -0
- package/dist/utils/settings.js.map +1 -0
- package/dist/utils/variant.d.ts +57 -0
- package/dist/utils/variant.d.ts.map +1 -0
- package/dist/utils/variant.js +197 -0
- package/dist/utils/variant.js.map +1 -0
- package/env.d.ts +9 -0
- package/package.json +36 -11
- package/src/adw/config.ts +1 -0
- package/src/adw/dialog.tsx +35 -0
- package/src/adw/element-behaviors.ts +379 -0
- package/src/adw/element-config.ts +140 -0
- package/src/adw/index.ts +4 -0
- package/src/adw/prop-types.ts +42 -0
- package/src/bootstrap.ts +5 -0
- package/src/components/application.tsx +42 -23
- package/src/components/element.tsx +47 -0
- package/src/components/window.tsx +12 -13
- package/src/config.ts +3 -0
- package/src/element-behaviors.ts +424 -0
- package/src/element-config.ts +148 -0
- package/src/env.d.ts +1 -0
- package/src/hooks/use-application.ts +6 -4
- package/src/hooks/use-bind-setting.ts +47 -31
- package/src/hooks/use-merged-refs.ts +64 -0
- package/src/hooks/use-object-value.ts +27 -23
- package/src/hooks/use-parent-window.ts +4 -2
- package/src/hooks/use-property.ts +11 -10
- package/src/hooks/use-setting.ts +20 -33
- package/src/hooks/use-signal.ts +37 -48
- package/src/index.ts +7 -8
- package/src/internal.ts +7 -18
- package/src/prop-types.ts +142 -0
- package/src/reconciler/apply-props.ts +233 -85
- package/src/reconciler/behaviors.ts +324 -0
- package/src/reconciler/child-routing.ts +202 -0
- package/src/reconciler/host-config.ts +239 -366
- package/src/reconciler/instance.ts +76 -24
- package/src/reconciler/metadata.ts +119 -0
- package/src/reconciler/node.ts +161 -0
- package/src/reconciler/placement.ts +255 -0
- package/src/reconciler/registry.ts +161 -0
- package/src/reconciler/root-element.ts +9 -11
- package/src/reconciler/root.ts +175 -0
- package/src/reconciler/signals.ts +113 -0
- package/src/reconciler/text.ts +407 -0
- package/src/utils/accessible-metadata.ts +23 -18
- package/src/utils/accessible-props.ts +279 -0
- package/src/utils/ref-prop.ts +30 -0
- package/src/utils/settings.ts +69 -0
- package/src/utils/variant.ts +368 -0
- package/dist/hooks/use-merge-refs.d.ts +0 -3
- package/dist/hooks/use-merge-refs.d.ts.map +0 -1
- package/dist/hooks/use-merge-refs.js +0 -48
- package/dist/hooks/use-merge-refs.js.map +0 -1
- package/dist/hooks/use-object-attachment.d.ts +0 -10
- package/dist/hooks/use-object-attachment.d.ts.map +0 -1
- package/dist/hooks/use-object-attachment.js +0 -24
- package/dist/hooks/use-object-attachment.js.map +0 -1
- package/dist/libraries/adw/dialog.d.ts.map +0 -1
- package/dist/libraries/adw/dialog.js +0 -25
- package/dist/libraries/adw/dialog.js.map +0 -1
- package/dist/libraries/adw/index.d.ts +0 -2
- package/dist/libraries/adw/index.d.ts.map +0 -1
- package/dist/libraries/adw/index.js +0 -2
- package/dist/libraries/adw/index.js.map +0 -1
- package/dist/reconciler/accessible.d.ts.map +0 -1
- package/dist/reconciler/accessible.js +0 -143
- package/dist/reconciler/accessible.js.map +0 -1
- package/dist/reconciler/commit-flush.d.ts +0 -3
- package/dist/reconciler/commit-flush.d.ts.map +0 -1
- package/dist/reconciler/commit-flush.js +0 -13
- package/dist/reconciler/commit-flush.js.map +0 -1
- package/dist/reconciler/container-attach.d.ts +0 -10
- package/dist/reconciler/container-attach.d.ts.map +0 -1
- package/dist/reconciler/container-attach.js +0 -216
- package/dist/reconciler/container-attach.js.map +0 -1
- package/dist/reconciler/content-rebuild.d.ts +0 -3
- package/dist/reconciler/content-rebuild.d.ts.map +0 -1
- package/dist/reconciler/content-rebuild.js +0 -15
- package/dist/reconciler/content-rebuild.js.map +0 -1
- package/dist/reconciler/dispatch.d.ts +0 -6
- package/dist/reconciler/dispatch.d.ts.map +0 -1
- package/dist/reconciler/dispatch.js +0 -61
- package/dist/reconciler/dispatch.js.map +0 -1
- package/dist/reconciler/element-prop-appliers.d.ts +0 -5
- package/dist/reconciler/element-prop-appliers.d.ts.map +0 -1
- package/dist/reconciler/element-prop-appliers.js +0 -104
- package/dist/reconciler/element-prop-appliers.js.map +0 -1
- package/dist/reconciler/element-props.d.ts +0 -25
- package/dist/reconciler/element-props.d.ts.map +0 -1
- package/dist/reconciler/element-props.js +0 -157
- package/dist/reconciler/element-props.js.map +0 -1
- package/dist/reconciler/label-text-rebuild.d.ts +0 -3
- package/dist/reconciler/label-text-rebuild.d.ts.map +0 -1
- package/dist/reconciler/label-text-rebuild.js +0 -22
- package/dist/reconciler/label-text-rebuild.js.map +0 -1
- package/dist/reconciler/portal.d.ts +0 -11
- package/dist/reconciler/portal.d.ts.map +0 -1
- package/dist/reconciler/portal.js +0 -20
- package/dist/reconciler/portal.js.map +0 -1
- package/dist/reconciler/reconciler-error-handler.d.ts +0 -7
- package/dist/reconciler/reconciler-error-handler.d.ts.map +0 -1
- package/dist/reconciler/reconciler-error-handler.js +0 -24
- package/dist/reconciler/reconciler-error-handler.js.map +0 -1
- package/dist/reconciler/reconciler-root.d.ts +0 -19
- package/dist/reconciler/reconciler-root.d.ts.map +0 -1
- package/dist/reconciler/reconciler-root.js +0 -24
- package/dist/reconciler/reconciler-root.js.map +0 -1
- package/dist/reconciler/reconciler.d.ts +0 -3
- package/dist/reconciler/reconciler.d.ts.map +0 -1
- package/dist/reconciler/reconciler.js +0 -12
- package/dist/reconciler/reconciler.js.map +0 -1
- package/dist/reconciler/render.d.ts +0 -23
- package/dist/reconciler/render.d.ts.map +0 -1
- package/dist/reconciler/render.js +0 -46
- package/dist/reconciler/render.js.map +0 -1
- package/dist/reconciler/signal-store.d.ts +0 -22
- package/dist/reconciler/signal-store.d.ts.map +0 -1
- package/dist/reconciler/signal-store.js +0 -84
- package/dist/reconciler/signal-store.js.map +0 -1
- package/dist/reconciler/state.d.ts +0 -36
- package/dist/reconciler/state.d.ts.map +0 -1
- package/dist/reconciler/state.js +0 -38
- package/dist/reconciler/state.js.map +0 -1
- package/dist/reconciler/text-buffer-controller.d.ts +0 -17
- package/dist/reconciler/text-buffer-controller.d.ts.map +0 -1
- package/dist/reconciler/text-buffer-controller.js +0 -102
- package/dist/reconciler/text-buffer-controller.js.map +0 -1
- package/dist/reconciler/text-buffer-rebuild.d.ts +0 -3
- package/dist/reconciler/text-buffer-rebuild.d.ts.map +0 -1
- package/dist/reconciler/text-buffer-rebuild.js +0 -7
- package/dist/reconciler/text-buffer-rebuild.js.map +0 -1
- package/dist/reconciler/text-node.d.ts +0 -7
- package/dist/reconciler/text-node.d.ts.map +0 -1
- package/dist/reconciler/text-node.js +0 -8
- package/dist/reconciler/text-node.js.map +0 -1
- package/dist/reconciler/types.d.ts +0 -5
- package/dist/reconciler/types.d.ts.map +0 -1
- package/dist/reconciler/types.js +0 -2
- package/dist/reconciler/types.js.map +0 -1
- package/dist/reconciler/visibility.d.ts +0 -6
- package/dist/reconciler/visibility.d.ts.map +0 -1
- package/dist/reconciler/visibility.js +0 -57
- package/dist/reconciler/visibility.js.map +0 -1
- package/dist/reconciler/wrapper-apply.d.ts +0 -6
- package/dist/reconciler/wrapper-apply.d.ts.map +0 -1
- package/dist/reconciler/wrapper-apply.js +0 -287
- package/dist/reconciler/wrapper-apply.js.map +0 -1
- package/dist/reconciler/wrapper-content.d.ts +0 -8
- package/dist/reconciler/wrapper-content.d.ts.map +0 -1
- package/dist/reconciler/wrapper-content.js +0 -19
- package/dist/reconciler/wrapper-content.js.map +0 -1
- package/dist/reconciler/wrapper-node.d.ts +0 -8
- package/dist/reconciler/wrapper-node.d.ts.map +0 -1
- package/dist/reconciler/wrapper-node.js +0 -4
- package/dist/reconciler/wrapper-node.js.map +0 -1
- package/dist/reconciler/wrapper-protocol.d.ts +0 -13
- package/dist/reconciler/wrapper-protocol.d.ts.map +0 -1
- package/dist/reconciler/wrapper-protocol.js +0 -20
- package/dist/reconciler/wrapper-protocol.js.map +0 -1
- package/dist/utils/create-element-component.d.ts +0 -4
- package/dist/utils/create-element-component.d.ts.map +0 -1
- package/dist/utils/create-element-component.js +0 -54
- package/dist/utils/create-element-component.js.map +0 -1
- package/dist/utils/gtype.d.ts +0 -16
- package/dist/utils/gtype.d.ts.map +0 -1
- package/dist/utils/gtype.js +0 -127
- package/dist/utils/gtype.js.map +0 -1
- package/dist/utils/notify-name.d.ts +0 -5
- package/dist/utils/notify-name.d.ts.map +0 -1
- package/dist/utils/notify-name.js +0 -6
- package/dist/utils/notify-name.js.map +0 -1
- package/dist/utils/object-prop.d.ts +0 -8
- package/dist/utils/object-prop.d.ts.map +0 -1
- package/dist/utils/object-prop.js +0 -9
- package/dist/utils/object-prop.js.map +0 -1
- package/dist/utils/settings-accessor.d.ts +0 -8
- package/dist/utils/settings-accessor.d.ts.map +0 -1
- package/dist/utils/settings-accessor.js +0 -69
- package/dist/utils/settings-accessor.js.map +0 -1
- package/dist/utils/wrapper-node-jsx.d.ts +0 -32
- package/dist/utils/wrapper-node-jsx.d.ts.map +0 -1
- package/dist/utils/wrapper-node-jsx.js +0 -2
- package/dist/utils/wrapper-node-jsx.js.map +0 -1
- package/src/hooks/use-merge-refs.ts +0 -53
- package/src/hooks/use-object-attachment.ts +0 -35
- package/src/libraries/adw/dialog.tsx +0 -34
- package/src/libraries/adw/index.ts +0 -1
- package/src/reconciler/accessible.ts +0 -232
- package/src/reconciler/commit-flush.ts +0 -13
- package/src/reconciler/container-attach.ts +0 -219
- package/src/reconciler/content-rebuild.ts +0 -19
- package/src/reconciler/dispatch.ts +0 -58
- package/src/reconciler/element-prop-appliers.ts +0 -110
- package/src/reconciler/element-props.ts +0 -192
- package/src/reconciler/label-text-rebuild.ts +0 -26
- package/src/reconciler/portal.ts +0 -28
- package/src/reconciler/reconciler-error-handler.ts +0 -29
- package/src/reconciler/reconciler-root.ts +0 -57
- package/src/reconciler/reconciler.ts +0 -13
- package/src/reconciler/render.ts +0 -61
- package/src/reconciler/signal-store.ts +0 -103
- package/src/reconciler/state.ts +0 -72
- package/src/reconciler/text-buffer-controller.ts +0 -107
- package/src/reconciler/text-buffer-rebuild.ts +0 -12
- package/src/reconciler/text-node.ts +0 -13
- package/src/reconciler/types.ts +0 -6
- package/src/reconciler/visibility.ts +0 -52
- package/src/reconciler/wrapper-apply.ts +0 -308
- package/src/reconciler/wrapper-content.ts +0 -24
- package/src/reconciler/wrapper-node.ts +0 -8
- package/src/reconciler/wrapper-protocol.ts +0 -32
- package/src/utils/create-element-component.ts +0 -77
- package/src/utils/gtype.ts +0 -166
- package/src/utils/notify-name.ts +0 -10
- package/src/utils/object-prop.ts +0 -13
- package/src/utils/settings-accessor.ts +0 -89
- package/src/utils/wrapper-node-jsx.ts +0 -34
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { indexBeforeOrEnd, remove } from "@gtkx/utils";
|
|
2
|
+
import { DEFAULT_SLOT, ELEMENT_KIND, LAZY_KIND, nodeObject, PROP_KIND, TEXT_KIND } from "./node.js";
|
|
3
|
+
import { placeChild, unplaceChild } from "./placement.js";
|
|
4
|
+
import { addContent, canAcceptText, removeContent, textRestrictionError } from "./text.js";
|
|
5
|
+
const asPlaceable = (node) => node !== null && (node.kind === ELEMENT_KIND || node.kind === LAZY_KIND) ? node : null;
|
|
6
|
+
const attachPropToElement = (parent, node, before) => {
|
|
7
|
+
node.parent = parent;
|
|
8
|
+
for (const child of node.children) {
|
|
9
|
+
placeChild(parent, node.slot, child, asPlaceable(before));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const detachPropFromElement = (parent, node) => {
|
|
13
|
+
for (const child of node.children) {
|
|
14
|
+
unplaceChild(parent, node.slot, child);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const asContentChild = (node) => node !== null && (node.kind === TEXT_KIND || node.kind === ELEMENT_KIND) ? node : null;
|
|
18
|
+
const attachToContentHost = (parent, child, before) => {
|
|
19
|
+
if (child.kind === TEXT_KIND && !canAcceptText(parent)) {
|
|
20
|
+
throw textRestrictionError(child.text);
|
|
21
|
+
}
|
|
22
|
+
if (child.kind === TEXT_KIND || child.kind === ELEMENT_KIND) {
|
|
23
|
+
addContent(parent, child, asContentChild(before));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const attachToElement = (parent, child, before) => {
|
|
27
|
+
if (child.kind === PROP_KIND) {
|
|
28
|
+
attachPropToElement(parent, child, before);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (parent.contentKind !== null) {
|
|
32
|
+
attachToContentHost(parent, child, before);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (child.kind === TEXT_KIND) {
|
|
36
|
+
throw textRestrictionError(child.text);
|
|
37
|
+
}
|
|
38
|
+
if (child.kind === LAZY_KIND) {
|
|
39
|
+
child.parent = parent;
|
|
40
|
+
}
|
|
41
|
+
placeChild(parent, DEFAULT_SLOT, child, asPlaceable(before));
|
|
42
|
+
};
|
|
43
|
+
const insertPlaceable = (list, node, before) => {
|
|
44
|
+
const beforeNode = asPlaceable(before);
|
|
45
|
+
list.splice(indexBeforeOrEnd(list, beforeNode, (item, target) => item === target), 0, node);
|
|
46
|
+
};
|
|
47
|
+
const insertChild = (parent, child, before) => {
|
|
48
|
+
const placeable = asPlaceable(child);
|
|
49
|
+
if (placeable === null) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
insertPlaceable(parent.children, placeable, before);
|
|
53
|
+
return placeable;
|
|
54
|
+
};
|
|
55
|
+
const attachToProp = (parent, child, before) => {
|
|
56
|
+
const placeable = insertChild(parent, child, before);
|
|
57
|
+
if (placeable === null) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const owner = parent.parent;
|
|
61
|
+
if (owner === null) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
placeChild(owner, parent.slot, placeable, asPlaceable(before));
|
|
65
|
+
};
|
|
66
|
+
const placeLazy = (owner, node, hasObject) => {
|
|
67
|
+
if (hasObject) {
|
|
68
|
+
placeChild(owner, DEFAULT_SLOT, node, null);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const syncLazy = (node) => {
|
|
72
|
+
const owner = node.parent;
|
|
73
|
+
if (owner === null) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const entry = owner.placements.get(DEFAULT_SLOT)?.find((entry) => entry.node === node);
|
|
77
|
+
const object = nodeObject(node);
|
|
78
|
+
if (entry === undefined) {
|
|
79
|
+
placeLazy(owner, node, object !== null);
|
|
80
|
+
}
|
|
81
|
+
else if (entry.object !== object) {
|
|
82
|
+
unplaceChild(owner, DEFAULT_SLOT, node);
|
|
83
|
+
placeLazy(owner, node, object !== null);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const attachToLazy = (parent, child, before) => {
|
|
87
|
+
if (insertChild(parent, child, before) === null) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
syncLazy(parent);
|
|
91
|
+
};
|
|
92
|
+
const attachChild = (parent, child, before) => {
|
|
93
|
+
if (parent.kind === ELEMENT_KIND) {
|
|
94
|
+
attachToElement(parent, child, before);
|
|
95
|
+
}
|
|
96
|
+
else if (parent.kind === PROP_KIND) {
|
|
97
|
+
attachToProp(parent, child, before);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
attachToLazy(parent, child, before);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const removeContentChild = (parent, child) => {
|
|
104
|
+
if (child.kind === TEXT_KIND || child.kind === ELEMENT_KIND) {
|
|
105
|
+
removeContent(parent, child);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const unplaceChildNode = (parent, child) => {
|
|
109
|
+
const placeable = asPlaceable(child);
|
|
110
|
+
if (placeable !== null) {
|
|
111
|
+
unplaceChild(parent, DEFAULT_SLOT, placeable);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const detachFromElement = (parent, child) => {
|
|
115
|
+
if (child.kind === PROP_KIND) {
|
|
116
|
+
detachPropFromElement(parent, child);
|
|
117
|
+
}
|
|
118
|
+
else if (parent.contentKind === null) {
|
|
119
|
+
unplaceChildNode(parent, child);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
removeContentChild(parent, child);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const detachFromProp = (parent, child) => {
|
|
126
|
+
const placeable = asPlaceable(child);
|
|
127
|
+
if (placeable === null) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
remove(parent.children, placeable);
|
|
131
|
+
const owner = parent.parent;
|
|
132
|
+
if (owner === null) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
unplaceChild(owner, parent.slot, placeable);
|
|
136
|
+
};
|
|
137
|
+
const detachFromLazy = (parent, child) => {
|
|
138
|
+
const placeable = asPlaceable(child);
|
|
139
|
+
if (placeable !== null) {
|
|
140
|
+
remove(parent.children, placeable);
|
|
141
|
+
}
|
|
142
|
+
syncLazy(parent);
|
|
143
|
+
};
|
|
144
|
+
const detachChild = (parent, child) => {
|
|
145
|
+
if (parent.kind === ELEMENT_KIND) {
|
|
146
|
+
detachFromElement(parent, child);
|
|
147
|
+
}
|
|
148
|
+
else if (parent.kind === PROP_KIND) {
|
|
149
|
+
detachFromProp(parent, child);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
detachFromLazy(parent, child);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
export { attachChild, detachChild };
|
|
156
|
+
//# sourceMappingURL=child-routing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child-routing.js","sourceRoot":"","sources":["../../src/reconciler/child-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE3F,MAAM,WAAW,GAAG,CAAC,IAAoB,EAAwB,EAAE,CAC/D,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAE3F,MAAM,mBAAmB,GAAG,CAAC,MAAmB,EAAE,IAAc,EAAE,MAAsB,EAAQ,EAAE;I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AE,KAAc,EAAQ,EAAE;IAC7D,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAC/B,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;SAAM,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACnC,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;SAAM,CAAC;QACJ,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { indexBeforeOrEnd, remove } from \"@gtkx/utils\";\nimport type { AnyNode, ContentChild, ElementNode, LazyNode, ParentNode, PlaceableNode, PropNode } from \"./node.js\";\nimport { DEFAULT_SLOT, ELEMENT_KIND, LAZY_KIND, nodeObject, PROP_KIND, TEXT_KIND } from \"./node.js\";\nimport { placeChild, unplaceChild } from \"./placement.js\";\nimport { addContent, canAcceptText, removeContent, textRestrictionError } from \"./text.js\";\n\nconst asPlaceable = (node: AnyNode | null): PlaceableNode | null =>\n node !== null && (node.kind === ELEMENT_KIND || node.kind === LAZY_KIND) ? node : null;\n\nconst attachPropToElement = (parent: ElementNode, node: PropNode, before: AnyNode | null): void => {\n node.parent = parent;\n\n for (const child of node.children) {\n placeChild(parent, node.slot, child, asPlaceable(before));\n }\n};\n\nconst detachPropFromElement = (parent: ElementNode, node: PropNode): void => {\n for (const child of node.children) {\n unplaceChild(parent, node.slot, child);\n }\n};\n\nconst asContentChild = (node: AnyNode | null): ContentChild | null =>\n node !== null && (node.kind === TEXT_KIND || node.kind === ELEMENT_KIND) ? node : null;\n\nconst attachToContentHost = (parent: ElementNode, child: AnyNode, before: AnyNode | null): void => {\n if (child.kind === TEXT_KIND && !canAcceptText(parent)) {\n throw textRestrictionError(child.text);\n }\n\n if (child.kind === TEXT_KIND || child.kind === ELEMENT_KIND) {\n addContent(parent, child, asContentChild(before));\n }\n};\n\nconst attachToElement = (parent: ElementNode, child: AnyNode, before: AnyNode | null): void => {\n if (child.kind === PROP_KIND) {\n attachPropToElement(parent, child, before);\n\n return;\n }\n\n if (parent.contentKind !== null) {\n attachToContentHost(parent, child, before);\n\n return;\n }\n\n if (child.kind === TEXT_KIND) {\n throw textRestrictionError(child.text);\n }\n\n if (child.kind === LAZY_KIND) {\n child.parent = parent;\n }\n\n placeChild(parent, DEFAULT_SLOT, child, asPlaceable(before));\n};\n\nconst insertPlaceable = (list: PlaceableNode[], node: PlaceableNode, before: AnyNode | null): void => {\n const beforeNode = asPlaceable(before);\n\n list.splice(\n indexBeforeOrEnd(list, beforeNode, (item, target) => item === target),\n 0,\n node,\n );\n};\n\nconst insertChild = (parent: PropNode | LazyNode, child: AnyNode, before: AnyNode | null): PlaceableNode | null => {\n const placeable = asPlaceable(child);\n\n if (placeable === null) {\n return null;\n }\n\n insertPlaceable(parent.children, placeable, before);\n\n return placeable;\n};\n\nconst attachToProp = (parent: PropNode, child: AnyNode, before: AnyNode | null): void => {\n const placeable = insertChild(parent, child, before);\n\n if (placeable === null) {\n return;\n }\n\n const owner = parent.parent;\n\n if (owner === null) {\n return;\n }\n\n placeChild(owner, parent.slot, placeable, asPlaceable(before));\n};\n\nconst placeLazy = (owner: ElementNode, node: LazyNode, hasObject: boolean): void => {\n if (hasObject) {\n placeChild(owner, DEFAULT_SLOT, node, null);\n }\n};\n\nconst syncLazy = (node: LazyNode): void => {\n const owner = node.parent;\n\n if (owner === null) {\n return;\n }\n\n const entry = owner.placements.get(DEFAULT_SLOT)?.find((entry) => entry.node === node);\n const object = nodeObject(node);\n\n if (entry === undefined) {\n placeLazy(owner, node, object !== null);\n } else if (entry.object !== object) {\n unplaceChild(owner, DEFAULT_SLOT, node);\n placeLazy(owner, node, object !== null);\n }\n};\n\nconst attachToLazy = (parent: LazyNode, child: AnyNode, before: AnyNode | null): void => {\n if (insertChild(parent, child, before) === null) {\n return;\n }\n\n syncLazy(parent);\n};\n\nconst attachChild = (parent: ParentNode, child: AnyNode, before: AnyNode | null): void => {\n if (parent.kind === ELEMENT_KIND) {\n attachToElement(parent, child, before);\n } else if (parent.kind === PROP_KIND) {\n attachToProp(parent, child, before);\n } else {\n attachToLazy(parent, child, before);\n }\n};\n\nconst removeContentChild = (parent: ElementNode, child: AnyNode): void => {\n if (child.kind === TEXT_KIND || child.kind === ELEMENT_KIND) {\n removeContent(parent, child);\n }\n};\n\nconst unplaceChildNode = (parent: ElementNode, child: AnyNode): void => {\n const placeable = asPlaceable(child);\n\n if (placeable !== null) {\n unplaceChild(parent, DEFAULT_SLOT, placeable);\n }\n};\n\nconst detachFromElement = (parent: ElementNode, child: AnyNode): void => {\n if (child.kind === PROP_KIND) {\n detachPropFromElement(parent, child);\n } else if (parent.contentKind === null) {\n unplaceChildNode(parent, child);\n } else {\n removeContentChild(parent, child);\n }\n};\n\nconst detachFromProp = (parent: PropNode, child: AnyNode): void => {\n const placeable = asPlaceable(child);\n\n if (placeable === null) {\n return;\n }\n\n remove(parent.children, placeable);\n const owner = parent.parent;\n\n if (owner === null) {\n return;\n }\n\n unplaceChild(owner, parent.slot, placeable);\n};\n\nconst detachFromLazy = (parent: LazyNode, child: AnyNode): void => {\n const placeable = asPlaceable(child);\n\n if (placeable !== null) {\n remove(parent.children, placeable);\n }\n\n syncLazy(parent);\n};\n\nconst detachChild = (parent: ParentNode, child: AnyNode): void => {\n if (parent.kind === ELEMENT_KIND) {\n detachFromElement(parent, child);\n } else if (parent.kind === PROP_KIND) {\n detachFromProp(parent, child);\n } else {\n detachFromLazy(parent, child);\n }\n};\n\nexport { attachChild, detachChild };\n"]}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import * as GObject from "@gtkx/gi/gobject";
|
|
2
|
-
import
|
|
3
|
-
import { type
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
type HostConfig = ReactReconciler.HostConfig<string, Props, Container, Node, Node, never, never, never, PublicInstance, HostContext, never, number, -1, number>;
|
|
10
|
-
export type ReconcilerInstance = ReactReconciler.Reconciler<Container, Node, Node, never, never, PublicInstance>;
|
|
11
|
-
export declare function createHostConfig(): HostConfig;
|
|
12
|
-
export {};
|
|
1
|
+
import type * as GObject from "@gtkx/gi/gobject";
|
|
2
|
+
import ReactReconciler from "react-reconciler";
|
|
3
|
+
import { type Instance, type TextNode } from "./node.js";
|
|
4
|
+
import { type RootElement } from "./root-element.js";
|
|
5
|
+
/** A top-level container an element tree can be mounted into. */
|
|
6
|
+
type Container = RootElement | GObject.Object;
|
|
7
|
+
declare const reconciler: ReactReconciler.Reconciler<Container, Instance, TextNode, unknown, unknown, object>;
|
|
8
|
+
export { reconciler, type Container };
|
|
13
9
|
//# sourceMappingURL=host-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-config.d.ts","sourceRoot":"","sources":["../../src/reconciler/host-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"host-config.d.ts","sourceRoot":"","sources":["../../src/reconciler/host-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAKjD,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAe/C,OAAO,EAQH,KAAK,QAAQ,EAGb,KAAK,QAAQ,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUpE,iEAAiE;AACjE,KAAK,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;AAgI9C,QAAA,MAAM,UAAU,EAAE,eAAe,CAAC,UAAU,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CACrE,CAAC;AAwGhC,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,CAAC"}
|