I’m trying execute a portal ui command from a code window.
(ns gbo.portal
(:require
[portal.api :as p]
[portal.ui.commands :as pui]))
returns
> Execution error (FileNotFoundException) at gbo.portal/eval11569$loading (REPL:1).
> Could not locate portal/ui/commands__init.class, portal/ui/commands.clj or portal/ui/commands.cljc on classpath
The normal portal.api works fine.
Im attempting to execute (pui/toggle-shell state) from code. (so I dont have to focus portal window and go through ui.
If i can load dependency fn… what would state be in this case? Does the portal instance need to be defined as a def ? Would I need surface the session id? What is the idiomatic way to reference a portal window.Looks a bit over my head atm. I am familiar w Calva repl snippets and will try some cut&paste to try out. Thanks for the pointers!
I think the main thing you probably care about in the above snippets is:
(p/eval-str portal "(portal.ui.commands/toggle-shell portal.ui.state/state)")So to execute ui commands, you need to send code to the client. https://github.com/seancorfield/vscode-calva-setup/blob/develop/calva/config.edn#L141-L153 is an example of how to do it. I have been thinking about making this easier from the user's runtime, but haven't gotten around to it yet.
https://github.com/djblue/portal/blob/presentation/examples/portal-internals/src/portal/internals/viewer.clj#L110-L121 is an example of how to automatically toggle the shell on page load.