@treenity/react 3.0.0 → 3.0.1
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 +91 -0
- package/dist/AclEditor.d.ts +1 -1
- package/dist/AclEditor.d.ts.map +1 -1
- package/dist/AclEditor.js +5 -5
- package/dist/AclEditor.js.map +1 -1
- package/dist/ActionCards.d.ts +9 -0
- package/dist/ActionCards.d.ts.map +1 -0
- package/dist/ActionCards.js +96 -0
- package/dist/ActionCards.js.map +1 -0
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +71 -185
- package/dist/App.js.map +1 -1
- package/dist/ComponentSection.d.ts +15 -0
- package/dist/ComponentSection.d.ts.map +1 -0
- package/dist/ComponentSection.js +25 -0
- package/dist/ComponentSection.js.map +1 -0
- package/dist/ErrorBoundary.d.ts +18 -0
- package/dist/ErrorBoundary.d.ts.map +1 -0
- package/dist/ErrorBoundary.js +17 -0
- package/dist/ErrorBoundary.js.map +1 -0
- package/dist/Inspector.d.ts +1 -0
- package/dist/Inspector.d.ts.map +1 -1
- package/dist/Inspector.js +22 -347
- package/dist/Inspector.js.map +1 -1
- package/dist/Login.d.ts +8 -0
- package/dist/Login.d.ts.map +1 -0
- package/dist/Login.js +45 -0
- package/dist/Login.js.map +1 -0
- package/dist/NodeEditor.d.ts +11 -0
- package/dist/NodeEditor.d.ts.map +1 -0
- package/dist/NodeEditor.js +157 -0
- package/dist/NodeEditor.js.map +1 -0
- package/dist/Tree.d.ts +1 -0
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Tree.js +8 -27
- package/dist/Tree.js.map +1 -1
- package/dist/bind/engine.js +1 -1
- package/dist/bind/engine.js.map +1 -1
- package/dist/bind/eval.d.ts +1 -1
- package/dist/bind/eval.d.ts.map +1 -1
- package/dist/bind/hook.d.ts +1 -1
- package/dist/bind/hook.d.ts.map +1 -1
- package/dist/bind/hook.js +1 -1
- package/dist/bind/hook.js.map +1 -1
- package/dist/cache.d.ts +1 -1
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +4 -0
- package/dist/cache.js.map +1 -1
- package/dist/client-tree.d.ts +1 -2
- package/dist/client-tree.d.ts.map +1 -1
- package/dist/client-tree.js +12 -5
- package/dist/client-tree.js.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -4
- package/dist/client.js.map +1 -1
- package/dist/components/ConfirmDialog.d.ts +9 -0
- package/dist/components/ConfirmDialog.d.ts.map +1 -0
- package/dist/components/ConfirmDialog.js +6 -0
- package/dist/components/ConfirmDialog.js.map +1 -0
- package/dist/components/ConfirmPopover.d.ts +8 -0
- package/dist/components/ConfirmPopover.d.ts.map +1 -0
- package/dist/components/ConfirmPopover.js +9 -0
- package/dist/components/ConfirmPopover.js.map +1 -0
- package/dist/components/PathBreadcrumb.d.ts +5 -0
- package/dist/components/PathBreadcrumb.d.ts.map +1 -0
- package/dist/components/PathBreadcrumb.js +16 -0
- package/dist/components/PathBreadcrumb.js.map +1 -0
- package/dist/components/lib/utils.d.ts +3 -0
- package/dist/components/lib/utils.d.ts.map +1 -0
- package/dist/components/lib/utils.js +6 -0
- package/dist/components/lib/utils.js.map +1 -0
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +19 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +42 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/badge.js +1 -1
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +12 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +28 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/button.d.ts +9 -8
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +26 -21
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +25 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +13 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/command.d.ts +19 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +35 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.js +1 -1
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +52 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/form-field.d.ts +7 -0
- package/dist/components/ui/form-field.d.ts.map +1 -0
- package/dist/components/ui/form-field.js +17 -0
- package/dist/components/ui/form-field.js.map +1 -0
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/pagination.d.ts +14 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +30 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/popover.js +2 -2
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.js +1 -1
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/resizable.d.ts +8 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +14 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +13 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +9 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +15 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +40 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +7 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/slider.js +1 -1
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.d.ts +11 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +29 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +12 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +29 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +10 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +23 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +10 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +27 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.js +1 -1
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/context/index.d.ts +27 -10
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +43 -36
- package/dist/context/index.js.map +1 -1
- package/dist/events.d.ts +10 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +78 -0
- package/dist/events.js.map +1 -0
- package/dist/fiber-tree.d.ts +3 -0
- package/dist/fiber-tree.d.ts.map +1 -0
- package/dist/fiber-tree.js +93 -0
- package/dist/fiber-tree.js.map +1 -0
- package/dist/hooks.d.ts +5 -2
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +66 -6
- package/dist/hooks.js.map +1 -1
- package/dist/idb.d.ts +1 -1
- package/dist/idb.d.ts.map +1 -1
- package/dist/lib/to-plain.d.ts +2 -0
- package/dist/lib/to-plain.d.ts.map +1 -0
- package/dist/lib/to-plain.js +21 -0
- package/dist/lib/to-plain.js.map +1 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -3
- package/dist/main.js.map +1 -1
- package/dist/mods/clients.d.ts +3 -0
- package/dist/mods/clients.d.ts.map +1 -0
- package/dist/mods/clients.js +4 -0
- package/dist/mods/clients.js.map +1 -0
- package/dist/mods/editor-ui/FieldLabel.d.ts +15 -0
- package/dist/mods/editor-ui/FieldLabel.d.ts.map +1 -0
- package/dist/mods/editor-ui/FieldLabel.js +55 -0
- package/dist/mods/editor-ui/FieldLabel.js.map +1 -0
- package/dist/mods/editor-ui/client.d.ts +1 -1
- package/dist/mods/editor-ui/client.d.ts.map +1 -1
- package/dist/mods/editor-ui/client.js +1 -1
- package/dist/mods/editor-ui/client.js.map +1 -1
- package/dist/mods/editor-ui/default-edit.d.ts +2 -0
- package/dist/mods/editor-ui/default-edit.d.ts.map +1 -0
- package/dist/mods/editor-ui/default-edit.js +54 -0
- package/dist/mods/editor-ui/default-edit.js.map +1 -0
- package/dist/mods/editor-ui/default-view.d.ts +8 -1
- package/dist/mods/editor-ui/default-view.d.ts.map +1 -1
- package/dist/mods/editor-ui/default-view.js +8 -5
- package/dist/mods/editor-ui/default-view.js.map +1 -1
- package/dist/mods/editor-ui/dir-view.js +0 -2
- package/dist/mods/editor-ui/dir-view.js.map +1 -1
- package/dist/mods/editor-ui/empty-placeholder.d.ts +5 -0
- package/dist/mods/editor-ui/empty-placeholder.d.ts.map +1 -0
- package/dist/mods/editor-ui/empty-placeholder.js +14 -0
- package/dist/mods/editor-ui/empty-placeholder.js.map +1 -0
- package/dist/mods/editor-ui/form-field.d.ts +17 -0
- package/dist/mods/editor-ui/form-field.d.ts.map +1 -0
- package/dist/mods/editor-ui/form-field.js +68 -0
- package/dist/mods/editor-ui/form-field.js.map +1 -0
- package/dist/mods/editor-ui/form-fields.d.ts +1 -2
- package/dist/mods/editor-ui/form-fields.d.ts.map +1 -1
- package/dist/mods/editor-ui/form-fields.js +56 -60
- package/dist/mods/editor-ui/form-fields.js.map +1 -1
- package/dist/mods/editor-ui/layout-view.js +3 -2
- package/dist/mods/editor-ui/layout-view.js.map +1 -1
- package/dist/mods/editor-ui/list-items.js +1 -1
- package/dist/mods/editor-ui/list-items.js.map +1 -1
- package/dist/mods/editor-ui/node-utils.d.ts +2 -2
- package/dist/mods/editor-ui/node-utils.d.ts.map +1 -1
- package/dist/mods/editor-ui/node-utils.js +4 -5
- package/dist/mods/editor-ui/node-utils.js.map +1 -1
- package/dist/mods/editor-ui/type-picker.d.ts +15 -0
- package/dist/mods/editor-ui/type-picker.d.ts.map +1 -0
- package/dist/mods/editor-ui/type-picker.js +69 -0
- package/dist/mods/editor-ui/type-picker.js.map +1 -0
- package/dist/mods/editor-ui/user-view.js +1 -1
- package/dist/mods/editor-ui/user-view.js.map +1 -1
- package/dist/mods/servers.d.ts +1 -0
- package/dist/mods/servers.d.ts.map +1 -0
- package/dist/mods/servers.js +4 -0
- package/dist/mods/servers.js.map +1 -0
- package/dist/mods/treenity/groups/index.js +1 -1
- package/dist/mods/treenity/groups/index.js.map +1 -1
- package/dist/mods/treenity/preview.js +1 -1
- package/dist/mods/treenity/preview.js.map +1 -1
- package/dist/mods/treenity/ref-view.js +1 -1
- package/dist/mods/treenity/ref-view.js.map +1 -1
- package/dist/mods/treenity/schema-form.js +1 -1
- package/dist/mods/treenity/schema-form.js.map +1 -1
- package/dist/mods/treenity/seed.js +1 -1
- package/dist/mods/treenity/seed.js.map +1 -1
- package/dist/mods/treenity/type-view.js +1 -1
- package/dist/mods/treenity/type-view.js.map +1 -1
- package/dist/schema-loader.d.ts +1 -1
- package/dist/schema-loader.d.ts.map +1 -1
- package/dist/schema-loader.js +1 -1
- package/dist/schema-loader.js.map +1 -1
- package/dist/symbols.d.ts +5 -0
- package/dist/symbols.d.ts.map +1 -0
- package/dist/symbols.js +16 -0
- package/dist/symbols.js.map +1 -0
- package/dist/trpc.d.ts +10 -3
- package/dist/trpc.d.ts.map +1 -1
- package/package.json +74 -8
- package/src/AclEditor.tsx +11 -18
- package/src/ActionCards.tsx +224 -0
- package/src/App.tsx +204 -385
- package/src/ComponentSection.tsx +113 -0
- package/src/ErrorBoundary.tsx +37 -0
- package/src/Inspector.css +54 -0
- package/src/Inspector.tsx +73 -793
- package/src/Login.tsx +97 -0
- package/src/NodeEditor.tsx +300 -0
- package/src/Tree.css +91 -0
- package/src/Tree.tsx +40 -43
- package/src/bind/bind.test.ts +1 -1
- package/src/bind/engine.ts +1 -1
- package/src/bind/eval.ts +1 -1
- package/src/bind/hook.ts +1 -1
- package/src/bind/pipes.ts +1 -1
- package/src/cache.ts +5 -1
- package/src/client-tree.test.ts +1 -1
- package/src/client-tree.ts +22 -16
- package/src/client.ts +2 -4
- package/src/components/ConfirmDialog.tsx +34 -0
- package/src/components/ConfirmPopover.tsx +41 -0
- package/src/components/PathBreadcrumb.tsx +36 -0
- package/src/components/lib/utils.ts +6 -0
- package/src/components/lib/utils.ts.bak +6 -0
- package/src/components/ui/accordion.tsx +1 -1
- package/src/components/ui/alert-dialog.tsx +189 -0
- package/src/components/ui/badge.tsx +1 -1
- package/src/components/ui/breadcrumb.tsx +108 -0
- package/src/components/ui/button.tsx +53 -31
- package/src/components/ui/card.tsx +91 -0
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/collapsible.tsx +31 -0
- package/src/components/ui/command.tsx +177 -0
- package/src/components/ui/dialog.tsx +1 -2
- package/src/components/ui/drawer.tsx +1 -1
- package/src/components/ui/dropdown-menu.tsx +256 -0
- package/src/components/ui/form-field.tsx +37 -0
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/pagination.tsx +127 -0
- package/src/components/ui/popover.tsx +2 -2
- package/src/components/ui/progress.tsx +1 -1
- package/src/components/ui/resizable.tsx +47 -0
- package/src/components/ui/scroll-area.tsx +55 -0
- package/src/components/ui/select.tsx +1 -1
- package/src/components/ui/separator.tsx +27 -0
- package/src/components/ui/sheet.tsx +140 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/slider.tsx +1 -1
- package/src/components/ui/switch.tsx +1 -1
- package/src/components/ui/table.tsx +115 -0
- package/src/components/ui/tabs.tsx +88 -0
- package/src/components/ui/textarea.tsx +1 -1
- package/src/components/ui/toggle-group.tsx +82 -0
- package/src/components/ui/toggle.tsx +46 -0
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/context/index.tsx +75 -42
- package/src/events.ts +81 -0
- package/src/fiber-tree.ts +112 -0
- package/src/hooks.ts +88 -9
- package/src/idb.ts +1 -1
- package/src/lib/to-plain.ts +21 -0
- package/src/main.tsx +3 -1
- package/src/mods/clients.ts +3 -0
- package/src/mods/editor-ui/FieldLabel.tsx +124 -0
- package/src/mods/editor-ui/client.ts +1 -1
- package/src/mods/editor-ui/default-edit.tsx +99 -0
- package/src/mods/editor-ui/default-view.tsx +13 -8
- package/src/mods/editor-ui/dir-view.tsx +2 -2
- package/src/mods/editor-ui/editor-ui.css +174 -0
- package/src/mods/editor-ui/empty-placeholder.tsx +39 -0
- package/src/mods/editor-ui/form-field.tsx +144 -0
- package/src/mods/editor-ui/form-fields.tsx +132 -113
- package/src/mods/editor-ui/layout-view.tsx +4 -2
- package/src/mods/editor-ui/list-items.tsx +2 -2
- package/src/mods/editor-ui/node-utils.ts +4 -5
- package/src/mods/editor-ui/type-picker.tsx +147 -0
- package/src/mods/editor-ui/user-view.tsx +1 -1
- package/src/mods/servers.ts +2 -0
- package/src/mods/treenity/groups/index.tsx +1 -1
- package/src/mods/treenity/preview.tsx +1 -1
- package/src/mods/treenity/ref-view.tsx +1 -1
- package/src/mods/treenity/schema-form.tsx +1 -1
- package/src/mods/treenity/seed.ts +1 -1
- package/src/mods/treenity/type-view.tsx +1 -1
- package/src/optimistic.test.ts +111 -0
- package/src/remote-tree.test.ts +1 -1
- package/src/remote-tree.ts +1 -1
- package/src/root.css +117 -0
- package/src/schema-loader.ts +1 -1
- package/src/symbols.ts +18 -0
- package/src/index.html +0 -14
- package/src/style.css +0 -1269
- package/src/vite-env.d.ts +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAGA,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE5D,eAAO,MAAM,IAAI,eAA8B,CAAC;AAChD,eAAO,MAAM,KAAK,eAA+B,CAAC;AAElD,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAS9C"}
|
package/dist/symbols.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Symbol-based component location metadata.
|
|
2
|
+
// Stamped on deserialization (cache.put). Survive spread, invisible to JSON/keys/entries.
|
|
3
|
+
import { isComponent } from '@treenity/core';
|
|
4
|
+
export const $key = Symbol.for('treenity.$key');
|
|
5
|
+
export const $node = Symbol.for('treenity.$node');
|
|
6
|
+
export function stampNode(node) {
|
|
7
|
+
node[$key] = '';
|
|
8
|
+
node[$node] = node;
|
|
9
|
+
for (const [k, v] of Object.entries(node)) {
|
|
10
|
+
if (k.startsWith('$') || !isComponent(v))
|
|
11
|
+
continue;
|
|
12
|
+
v[$key] = k;
|
|
13
|
+
v[$node] = node;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=symbols.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.js","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,0FAA0F;AAE1F,OAAO,EAAE,WAAW,EAAiB,MAAM,gBAAgB,CAAC;AAE5D,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAElD,MAAM,UAAU,SAAS,CAAC,IAAc;IACrC,IAAY,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IACxB,IAAY,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAE5B,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YAAE,SAAS;QAClD,CAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpB,CAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAC3B,CAAC;AACH,CAAC"}
|
package/dist/trpc.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const trpc: import("@trpc/client").TRPCClient<import("@trpc/serve
|
|
|
13
13
|
path: string;
|
|
14
14
|
watch?: boolean | undefined;
|
|
15
15
|
};
|
|
16
|
-
output: import("@treenity/core
|
|
16
|
+
output: import("@treenity/core").NodeData | undefined;
|
|
17
17
|
meta: object;
|
|
18
18
|
}>;
|
|
19
19
|
getChildren: import("@trpc/server").TRPCQueryProcedure<{
|
|
@@ -25,7 +25,7 @@ export declare const trpc: import("@trpc/client").TRPCClient<import("@trpc/serve
|
|
|
25
25
|
watch?: boolean | undefined;
|
|
26
26
|
watchNew?: boolean | undefined;
|
|
27
27
|
};
|
|
28
|
-
output: import("@treenity/core/tree").Page<import("@treenity/core
|
|
28
|
+
output: import("@treenity/core/tree").Page<import("@treenity/core").NodeData>;
|
|
29
29
|
meta: object;
|
|
30
30
|
}>;
|
|
31
31
|
set: import("@trpc/server").TRPCMutationProcedure<{
|
|
@@ -66,7 +66,7 @@ export declare const trpc: import("@trpc/client").TRPCClient<import("@trpc/serve
|
|
|
66
66
|
}>;
|
|
67
67
|
getTemplates: import("@trpc/server").TRPCQueryProcedure<{
|
|
68
68
|
input: void;
|
|
69
|
-
output: import("@treenity/core
|
|
69
|
+
output: import("@treenity/core").NodeData[];
|
|
70
70
|
meta: object;
|
|
71
71
|
}>;
|
|
72
72
|
applyTemplate: import("@trpc/server").TRPCMutationProcedure<{
|
|
@@ -122,6 +122,13 @@ export declare const trpc: import("@trpc/client").TRPCClient<import("@trpc/serve
|
|
|
122
122
|
} | null;
|
|
123
123
|
meta: object;
|
|
124
124
|
}>;
|
|
125
|
+
getPerm: import("@trpc/server").TRPCQueryProcedure<{
|
|
126
|
+
input: {
|
|
127
|
+
path: string;
|
|
128
|
+
};
|
|
129
|
+
output: number;
|
|
130
|
+
meta: object;
|
|
131
|
+
}>;
|
|
125
132
|
logout: import("@trpc/server").TRPCMutationProcedure<{
|
|
126
133
|
input: void;
|
|
127
134
|
output: {
|
package/dist/trpc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trpc.d.ts","sourceRoot":"","sources":["../src/trpc.ts"],"names":[],"mappings":"AAIA,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAExC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,QAErC;AAED,wBAAgB,UAAU,SAEzB;AAED,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAUtD,eAAO,MAAQ,IAAI
|
|
1
|
+
{"version":3,"file":"trpc.d.ts","sourceRoot":"","sources":["../src/trpc.ts"],"names":[],"mappings":"AAIA,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAExC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,QAErC;AAED,wBAAgB,UAAU,SAEzB;AAED,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAUtD,eAAO,MAAQ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAiE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treenity/react",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
|
+
"description": "React binding for Treenity — reactive hooks, admin UI, and context-based component rendering.",
|
|
4
5
|
"type": "module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"license": "AGPL-3.0",
|
|
10
|
+
"author": "Treenity <hello@treenity.ai> (https://treenity.ai)",
|
|
11
|
+
"homepage": "https://github.com/treenity-ai/treenity",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/treenity-ai/treenity.git",
|
|
15
|
+
"directory": "packages/react"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"treenity",
|
|
19
|
+
"react",
|
|
20
|
+
"hooks",
|
|
21
|
+
"reactive",
|
|
22
|
+
"tree",
|
|
23
|
+
"composable",
|
|
24
|
+
"admin",
|
|
25
|
+
"ui",
|
|
26
|
+
"mcp",
|
|
27
|
+
"ai-native"
|
|
28
|
+
],
|
|
5
29
|
"imports": {
|
|
6
|
-
"#*": {
|
|
30
|
+
"#*": {
|
|
31
|
+
"development": [
|
|
32
|
+
"./src/*.ts",
|
|
33
|
+
"./src/*.tsx"
|
|
34
|
+
],
|
|
35
|
+
"default": [
|
|
36
|
+
"./dist/*.js",
|
|
37
|
+
"./dist/*.jsx"
|
|
38
|
+
]
|
|
39
|
+
}
|
|
7
40
|
},
|
|
8
41
|
"exports": {
|
|
9
|
-
".":
|
|
10
|
-
|
|
11
|
-
|
|
42
|
+
".": {
|
|
43
|
+
"development": "./src/index.ts",
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"default": "./dist/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./ui/*": {
|
|
48
|
+
"development": [
|
|
49
|
+
"./src/components/ui/*.ts",
|
|
50
|
+
"./src/components/ui/*.tsx"
|
|
51
|
+
],
|
|
52
|
+
"types": "./dist/components/ui/*.d.ts",
|
|
53
|
+
"default": "./dist/components/ui/*.js"
|
|
54
|
+
},
|
|
55
|
+
"./*.css": "./src/*.css",
|
|
56
|
+
"./*": {
|
|
57
|
+
"development": [
|
|
58
|
+
"./src/*.ts",
|
|
59
|
+
"./src/*.tsx"
|
|
60
|
+
],
|
|
61
|
+
"types": [
|
|
62
|
+
"./dist/*.d.ts"
|
|
63
|
+
],
|
|
64
|
+
"default": [
|
|
65
|
+
"./dist/*.js"
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"treenity": {
|
|
70
|
+
"clients": "./src/mods/clients.ts",
|
|
71
|
+
"servers": "./src/mods/servers.ts"
|
|
12
72
|
},
|
|
13
|
-
"files": [
|
|
73
|
+
"files": [
|
|
74
|
+
"dist",
|
|
75
|
+
"src",
|
|
76
|
+
"LICENSE",
|
|
77
|
+
"README.md"
|
|
78
|
+
],
|
|
14
79
|
"scripts": {
|
|
15
80
|
"build": "tsc -p tsconfig.build.json",
|
|
16
81
|
"prepack": "npm run build",
|
|
@@ -42,6 +107,7 @@
|
|
|
42
107
|
"@trpc/client": "^11.9.0",
|
|
43
108
|
"class-variance-authority": "^0.7.1",
|
|
44
109
|
"clsx": "^2.1.1",
|
|
110
|
+
"cmdk": "^1.1.1",
|
|
45
111
|
"d3-hierarchy": "^3.1.2",
|
|
46
112
|
"d3-selection": "^3.0.0",
|
|
47
113
|
"d3-zoom": "^3.0.0",
|
|
@@ -59,6 +125,7 @@
|
|
|
59
125
|
"radix-ui": "^1.4.3",
|
|
60
126
|
"react-easy-crop": "^5.5.6",
|
|
61
127
|
"react-grid-layout": "^2.2.2",
|
|
128
|
+
"react-resizable-panels": "^4.7.2",
|
|
62
129
|
"sonner": "^2.0.7",
|
|
63
130
|
"swiper": "^12.1.2",
|
|
64
131
|
"tailwind-merge": "^3.4.0",
|
|
@@ -82,7 +149,6 @@
|
|
|
82
149
|
"three": "^0.183.2",
|
|
83
150
|
"tsx": "^4.21.0",
|
|
84
151
|
"typescript": "^5.9.3",
|
|
85
|
-
"vite": "^7.3.1"
|
|
86
|
-
"vite-tsconfig-paths": "^6.1.0"
|
|
152
|
+
"vite": "^7.3.1"
|
|
87
153
|
}
|
|
88
154
|
}
|
package/src/AclEditor.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Button } from '#components/ui/button';
|
|
2
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '#components/ui/collapsible';
|
|
2
3
|
import { Input } from '#components/ui/input';
|
|
3
|
-
import { A, type GroupPerm, R, S, W } from '@treenity/core
|
|
4
|
-
import {
|
|
4
|
+
import { A, type GroupPerm, R, S, W } from '@treenity/core';
|
|
5
|
+
import { ChevronRight, X } from 'lucide-react';
|
|
5
6
|
import { useMemo, useState } from 'react';
|
|
6
7
|
import * as cache from './cache';
|
|
7
8
|
|
|
@@ -136,7 +137,6 @@ function ancestorChain(path: string): { path: string; owner?: string; acl?: Grou
|
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
export function AclEditor({ path, owner, rules, currentUserId, onChange }: Props) {
|
|
139
|
-
const [open, setOpen] = useState(false);
|
|
140
140
|
const [newGroup, setNewGroup] = useState('');
|
|
141
141
|
const chain = useMemo(() => ancestorChain(path), [path]);
|
|
142
142
|
|
|
@@ -162,11 +162,8 @@ export function AclEditor({ path, owner, rules, currentUserId, onChange }: Props
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
return (
|
|
165
|
-
<
|
|
166
|
-
<
|
|
167
|
-
className="card-header cursor-pointer select-none"
|
|
168
|
-
onClick={() => setOpen((v) => !v)}
|
|
169
|
-
>
|
|
165
|
+
<Collapsible className="border-t border-border mt-2 pt-0.5 first:border-t-0 first:mt-0 first:pt-0">
|
|
166
|
+
<CollapsibleTrigger className="flex w-full items-center justify-between py-2 pb-1.5 text-[11px] font-semibold text-muted-foreground uppercase tracking-wider cursor-pointer select-none">
|
|
170
167
|
<span>Access Control</span>
|
|
171
168
|
<span className="flex items-center gap-2 normal-case tracking-normal font-normal">
|
|
172
169
|
{effective && (
|
|
@@ -192,15 +189,11 @@ export function AclEditor({ path, owner, rules, currentUserId, onChange }: Props
|
|
|
192
189
|
</span>
|
|
193
190
|
</span>
|
|
194
191
|
)}
|
|
195
|
-
|
|
196
|
-
<ChevronDown className="h-3 w-3" />
|
|
197
|
-
) : (
|
|
198
|
-
<ChevronRight className="h-3 w-3" />
|
|
199
|
-
)}
|
|
192
|
+
<ChevronRight className="h-3 w-3 transition-transform duration-200 group-data-[state=open]:rotate-90" />
|
|
200
193
|
</span>
|
|
201
|
-
</
|
|
202
|
-
|
|
203
|
-
<div className="
|
|
194
|
+
</CollapsibleTrigger>
|
|
195
|
+
<CollapsibleContent>
|
|
196
|
+
<div className="py-0.5 pb-2.5 space-y-3">
|
|
204
197
|
<div className="field">
|
|
205
198
|
<label className="text-xs text-muted-foreground">$owner</label>
|
|
206
199
|
<Input value={owner} onChange={(e) => onChange(e.target.value, rules)} />
|
|
@@ -258,8 +251,8 @@ export function AclEditor({ path, owner, rules, currentUserId, onChange }: Props
|
|
|
258
251
|
</div>
|
|
259
252
|
)}
|
|
260
253
|
</div>
|
|
261
|
-
|
|
262
|
-
</
|
|
254
|
+
</CollapsibleContent>
|
|
255
|
+
</Collapsible>
|
|
263
256
|
);
|
|
264
257
|
}
|
|
265
258
|
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
// ActionCards — action pill buttons with expandable params, run, and results
|
|
2
|
+
|
|
3
|
+
import { Button } from '#components/ui/button';
|
|
4
|
+
import { Checkbox } from '#components/ui/checkbox';
|
|
5
|
+
import { Input } from '#components/ui/input';
|
|
6
|
+
import { Render } from '#context';
|
|
7
|
+
import { getActions, getActionSchema } from '#mods/editor-ui/node-utils';
|
|
8
|
+
import type { ComponentData, NodeData } from '@treenity/core';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import * as cache from './cache';
|
|
11
|
+
import { useSchema } from './schema-loader';
|
|
12
|
+
import { trpc } from './trpc';
|
|
13
|
+
|
|
14
|
+
function ResultView({ value }: { value: unknown }) {
|
|
15
|
+
if (value === undefined || value === null) return null;
|
|
16
|
+
if (typeof value !== 'object')
|
|
17
|
+
return <span className="font-mono text-[11px]">{String(value)}</span>;
|
|
18
|
+
|
|
19
|
+
if ('$type' in (value as Record<string, unknown>)) {
|
|
20
|
+
return <Render value={value as ComponentData} />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const entries = Object.entries(value as Record<string, unknown>);
|
|
24
|
+
if (entries.length === 0) return <span className="text-muted-foreground text-[11px]">empty</span>;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className="flex flex-col gap-0.5">
|
|
28
|
+
{entries.map(([k, v]) => (
|
|
29
|
+
<div key={k} className="flex gap-2 text-[11px]">
|
|
30
|
+
<span className="text-muted-foreground shrink-0">{k}</span>
|
|
31
|
+
<span className="font-mono text-foreground/80 truncate">
|
|
32
|
+
{typeof v === 'object' && v !== null ? JSON.stringify(v) : String(v ?? '')}
|
|
33
|
+
</span>
|
|
34
|
+
</div>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function ActionCardList({
|
|
41
|
+
path,
|
|
42
|
+
componentName,
|
|
43
|
+
compType,
|
|
44
|
+
toast,
|
|
45
|
+
onActionComplete,
|
|
46
|
+
}: {
|
|
47
|
+
path: string;
|
|
48
|
+
componentName: string;
|
|
49
|
+
compType: string;
|
|
50
|
+
compData: Record<string, unknown>;
|
|
51
|
+
toast: (msg: string) => void;
|
|
52
|
+
onActionComplete?: () => void;
|
|
53
|
+
}) {
|
|
54
|
+
const schema = useSchema(compType);
|
|
55
|
+
const [expanded, setExpanded] = useState<string | null>(null);
|
|
56
|
+
const [paramsText, setParamsText] = useState<Record<string, string>>({});
|
|
57
|
+
const [schemaData, setSchemaData] = useState<Record<string, Record<string, unknown>>>({});
|
|
58
|
+
const [running, setRunning] = useState<string | null>(null);
|
|
59
|
+
const [results, setResults] = useState<Record<string, { ok: boolean; value: unknown }>>({});
|
|
60
|
+
const [resultMode, setResultMode] = useState<Record<string, 'pretty' | 'json'>>({});
|
|
61
|
+
|
|
62
|
+
if (schema === undefined) return null;
|
|
63
|
+
|
|
64
|
+
const actions = getActions(compType, schema);
|
|
65
|
+
if (actions.length === 0) return null;
|
|
66
|
+
|
|
67
|
+
async function run(a: string) {
|
|
68
|
+
setRunning(a);
|
|
69
|
+
try {
|
|
70
|
+
const actionSchema = getActionSchema(compType, a);
|
|
71
|
+
let data: unknown = {};
|
|
72
|
+
if (actionSchema) {
|
|
73
|
+
data = schemaData[a] ?? {};
|
|
74
|
+
} else {
|
|
75
|
+
const raw = (paramsText[a] ?? '').trim();
|
|
76
|
+
if (raw && raw !== '{}') {
|
|
77
|
+
try { data = JSON.parse(raw); }
|
|
78
|
+
catch { toast('Invalid JSON params'); setRunning(null); return; }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const result = await trpc.execute.mutate({ path, key: componentName, action: a, data });
|
|
82
|
+
const fresh = (await trpc.get.query({ path, watch: true })) as NodeData | undefined;
|
|
83
|
+
if (fresh) cache.put(fresh);
|
|
84
|
+
onActionComplete?.();
|
|
85
|
+
setResults((prev) => ({ ...prev, [a]: { ok: true, value: result } }));
|
|
86
|
+
setExpanded(a);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
setResults((prev) => ({
|
|
89
|
+
...prev,
|
|
90
|
+
[a]: { ok: false, value: e instanceof Error ? e.message : String(e) },
|
|
91
|
+
}));
|
|
92
|
+
setExpanded(a);
|
|
93
|
+
} finally {
|
|
94
|
+
setRunning(null);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<div className="mt-2.5 pt-2.5 border-t border-border">
|
|
100
|
+
<div className="flex flex-wrap gap-1.5">
|
|
101
|
+
{actions.map((a) => (
|
|
102
|
+
<Button
|
|
103
|
+
key={a}
|
|
104
|
+
variant="outline"
|
|
105
|
+
size="sm"
|
|
106
|
+
className={`h-6 rounded-full font-mono text-[11px] text-green-300 bg-green-400/10 border-green-400/40 hover:bg-green-400/20 hover:border-green-400/60 ${expanded === a ? 'bg-green-400/20 border-green-300' : ''} ${running === a ? 'opacity-60 pointer-events-none' : ''}`}
|
|
107
|
+
onClick={() => setExpanded(expanded === a ? null : a)}
|
|
108
|
+
>
|
|
109
|
+
{running === a ? '...' : a}
|
|
110
|
+
{results[a] && !results[a].ok && expanded !== a && (
|
|
111
|
+
<span className="ml-1 text-destructive">!</span>
|
|
112
|
+
)}
|
|
113
|
+
{results[a]?.ok && expanded !== a && (
|
|
114
|
+
<span className="ml-1 text-primary/60">✓</span>
|
|
115
|
+
)}
|
|
116
|
+
</Button>
|
|
117
|
+
))}
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
{expanded && (() => {
|
|
121
|
+
const a = expanded;
|
|
122
|
+
const actionSchema = getActionSchema(compType, a);
|
|
123
|
+
const hasParams = actionSchema !== null && Object.keys(actionSchema.properties).length > 0;
|
|
124
|
+
const noParams = actionSchema !== null && Object.keys(actionSchema.properties).length === 0;
|
|
125
|
+
const result = results[a];
|
|
126
|
+
const mode = resultMode[a] ?? 'pretty';
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<div className="mt-2 p-2 px-2.5 border border-border rounded-md bg-card">
|
|
130
|
+
{hasParams && (
|
|
131
|
+
<div className="flex flex-col gap-1.5 mb-2">
|
|
132
|
+
{Object.entries(actionSchema!.properties).map(([field, prop]) => {
|
|
133
|
+
const p = prop as { type: string; title?: string; format?: string };
|
|
134
|
+
const val = (schemaData[a] ?? {})[field];
|
|
135
|
+
const setField = (v: unknown) =>
|
|
136
|
+
setSchemaData((prev) => ({
|
|
137
|
+
...prev,
|
|
138
|
+
[a]: { ...(prev[a] ?? {}), [field]: v },
|
|
139
|
+
}));
|
|
140
|
+
return (
|
|
141
|
+
<div key={field} className="flex flex-col gap-0.5">
|
|
142
|
+
<label>{p.title ?? field}</label>
|
|
143
|
+
{p.type === 'number' || p.format === 'number' ? (
|
|
144
|
+
<Input type="number" className="h-7 text-xs" value={String(val ?? 0)}
|
|
145
|
+
onChange={(e) => setField(Number(e.target.value))} />
|
|
146
|
+
) : p.type === 'boolean' ? (
|
|
147
|
+
<label className="flex items-center gap-1.5 cursor-pointer">
|
|
148
|
+
<Checkbox checked={!!val}
|
|
149
|
+
onChange={(e) => setField((e.target as HTMLInputElement).checked)} />
|
|
150
|
+
<span className="text-[11px]">{val ? 'true' : 'false'}</span>
|
|
151
|
+
</label>
|
|
152
|
+
) : (
|
|
153
|
+
<Input className="h-7 text-xs" value={String(val ?? '')}
|
|
154
|
+
onChange={(e) => setField(e.target.value)} />
|
|
155
|
+
)}
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
})}
|
|
159
|
+
</div>
|
|
160
|
+
)}
|
|
161
|
+
|
|
162
|
+
{!hasParams && !noParams && (
|
|
163
|
+
<textarea
|
|
164
|
+
className="min-h-12 text-[11px] mb-2"
|
|
165
|
+
value={paramsText[a] ?? '{}'}
|
|
166
|
+
onChange={(e) => setParamsText((prev) => ({ ...prev, [a]: e.target.value }))}
|
|
167
|
+
spellCheck={false}
|
|
168
|
+
rows={2}
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
171
|
+
|
|
172
|
+
<Button
|
|
173
|
+
size="sm"
|
|
174
|
+
className="h-6 rounded-full text-[11px] font-medium"
|
|
175
|
+
disabled={running !== null}
|
|
176
|
+
onClick={() => run(a)}
|
|
177
|
+
>
|
|
178
|
+
{running === a ? '...' : '▶'} {a}
|
|
179
|
+
</Button>
|
|
180
|
+
|
|
181
|
+
{result && (
|
|
182
|
+
<div className={`mt-2 p-1.5 px-2 rounded-md bg-background border ${result.ok ? 'border-border' : 'border-destructive/40 bg-destructive/5'}`}>
|
|
183
|
+
{!result.ok ? (
|
|
184
|
+
<span className="text-destructive font-mono text-[11px]">{String(result.value)}</span>
|
|
185
|
+
) : result.value === undefined || result.value === null ? (
|
|
186
|
+
<span className="text-primary text-[11px]">✓ done</span>
|
|
187
|
+
) : (
|
|
188
|
+
<>
|
|
189
|
+
<div className="flex items-center justify-between mb-1">
|
|
190
|
+
<span className="text-[10px] text-muted-foreground uppercase tracking-wider">Result</span>
|
|
191
|
+
{typeof result.value === 'object' && (
|
|
192
|
+
<div className="flex gap-0.5">
|
|
193
|
+
<Button
|
|
194
|
+
variant={mode === 'pretty' ? 'secondary' : 'ghost'}
|
|
195
|
+
size="sm"
|
|
196
|
+
className="h-5 px-1.5 text-[10px] rounded-full"
|
|
197
|
+
onClick={() => setResultMode((p) => ({ ...p, [a]: 'pretty' }))}
|
|
198
|
+
>View</Button>
|
|
199
|
+
<Button
|
|
200
|
+
variant={mode === 'json' ? 'secondary' : 'ghost'}
|
|
201
|
+
size="sm"
|
|
202
|
+
className="h-5 px-1.5 text-[10px] rounded-full"
|
|
203
|
+
onClick={() => setResultMode((p) => ({ ...p, [a]: 'json' }))}
|
|
204
|
+
>JSON</Button>
|
|
205
|
+
</div>
|
|
206
|
+
)}
|
|
207
|
+
</div>
|
|
208
|
+
{mode === 'json' ? (
|
|
209
|
+
<pre className="text-[11px] font-mono text-foreground/60 whitespace-pre-wrap break-all leading-relaxed">
|
|
210
|
+
{JSON.stringify(result.value, null, 2)}
|
|
211
|
+
</pre>
|
|
212
|
+
) : (
|
|
213
|
+
<ResultView value={result.value} />
|
|
214
|
+
)}
|
|
215
|
+
</>
|
|
216
|
+
)}
|
|
217
|
+
</div>
|
|
218
|
+
)}
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
})()}
|
|
222
|
+
</div>
|
|
223
|
+
);
|
|
224
|
+
}
|