@kubuno/views
v0.1.4
Published
Kubuno .kbview views runtime (@kubuno/views) — the code-behind model (View, @bind, element handles, event args), the renderer of compiled views and the runtime elements (Repeater, Timer, Query, Mutation, MessageBox, Dialog). Provided by the host at runtim
Readme
@kubuno/views
The runtime of .kbview views in the Kubuno web UI.
.kbview views are compiled by @kubuno/views-compiler into a render plan; this
runtime renders that plan with React, binds it to the view's code-behind and raises its events. The real
implementation is provided by the Kubuno host at runtime through its import map (one instance for the
host and every module: one binding engine, one live-view registry). This package ships the type
surface so a module can build and type-check on its own; its JS entry is a stub that throws if it is
ever bundled.
What it provides
- The code-behind model —
View(base of every generatedViewBase), the@bindaccessor decorator,use()for React hooks,t()for resources,invalidate(),X.component()to get a React component. - Element handles — one typed handle per
x:Name(this.save.text = 'Saved',this.save.enabled,focus(),element), with an interface per element (Button,TextField,CheckBox…). - Event args —
EventArgs,MouseEventArgs,KeyEventArgs,CancelEventArgs,ValueChangedEventArgs,ItemEventArgs… (e.handledstops propagation,e.cancelprevents the default). - Bindings — one-way, two-way, one-time and one-way-to-source;
UpdateSourceTrigger=LostFocus; converters (Not,IsEmpty,ToUpper,Equals,BoolToText,Count… andregisterConverter); .NET-styleStringFormat(N2,C,dd/MM/yyyy,'{0} items');FallbackValueandTargetNullValue. - Runtime elements —
Repeater(an item template per row),Timer,Query/Mutation(React Query, withQueryHandle/MutationHandle),ReactHost,defineControlfor custom controls,KbView. - Dialogs —
MessageBox.show(…)andDialog.show(…), on the host'sConfirmDialogandFloatingWindow(never browser dialogs). - Compatibility —
VIEWS_ABI: a module exportsviewsAbinext tosdkVersion; the host refuses a module whose views were compiled for another plan ABI.
Install
npm install -D @kubuno/views @kubuno/views-compilerMark @kubuno/views as external in your module build, like @ui and @kubuno/sdk.
| @kubuno/views | Kubuno core | VIEWS_ABI | React |
| --- | --- | --- | --- |
| 0.1.x | 0.1.x | 1 | 19 |
License
AGPL-3.0-or-later © Kubuno contributors.
