Thank you for the clarification. 

On Fri, Mar 10, 2023, 08:13 Bart Schaefer <schaefer@brasslantern.com> wrote:
On Thu, Mar 9, 2023 at 8:48 PM Nikita Romanyuk <ufh8945@gmail.com> wrote:
>
> If I understood correctly, we shouldn't use setopt for changing keyboard
> layouts because it's not expandable. Better, there should be a separate
> builtin function. How should it be called? "setlayout"? "setkblayout"?

No, you have misunderstood.  We're suggesting something like

.zle.layout=$'\n\n\n\n\n\n\n\n\n\n\n\n\n\n etc etc'

and then the spdist function would read the value of that variable.
No new options, no new builtins.

A shell function file similar to (for an example)
Functions/Misc/colors would provide a set of layouts that could be
assigned to the variable.