open_intelligent_ui 3.1.0
open_intelligent_ui: ^3.1.0 copied to clipboard
Flutter renderer for Open Intelligent UI answers written in OpenUI Lang 1.0, a port of thesysdev/open-intelligent-ui.
3.1.0 #
- Markdown code fences can draw host widgets through
OpenUiServices.markdownFences, in answers and in the chat's prose fallback, which now renders as Markdown. See the core package's changelog. OpenUiViewpassesfallback:through to the core view.- Views keep the bundled Inter font by default through
OpenUiServices.fontFamily, now that the core theme's default font is the platform font. A theme that setsfontFamilystill wins. OpenUiChattakessendfor any transport,localeandrecords;agentis optional. The chat renders answers stored as text parts, andpackage:open_intelligent_ui/chat.dartexportsOpenUiAnswerView.- Button, IconButton and Pressable show a handled action's pending, done and failed states, ask for an inline
confirmation when the action has
confirm, and stay disabled after success withdisableAfterSuccess.OpenUiNodegainsactionStatus(prop)andrun(confirmed:). - Every rendered element has a stable key from its statement id (inline elements: parent id and
position).
OpenUiView(semanticsIdentifiers: true)also sets Semantics identifiers for UI tests. - Elements are keyed by statement id, so a statement that is renamed or moved inline mounts a new widget and drops its local widget state (an expanded map, a scroll position).
- All user-visible text comes from
OpenUiLocalizations(English by default). RegisterOpenUiLocalizationsDelegate({'fr': MyFrenchStrings()})inlocalizationsDelegatesto translate. - Right-to-left: layout, padding and positioned controls follow
Directionality. Charts, drawings and the map canvas stay left-to-right. - The engine's clock and random seams are public as
Impure(Impure.now,Impure.random); DatePicker's today uses them. - The golden tests (light and dark, every component) run on Linux only; regenerate with
fvm flutter test --update-goldens test/goldenson Linux. - Theme tokens:
OpenUiThemetakesradii,spacing,typography(scale, Text and Title sizes, weights, tabular figures) andcomponents(per-component styles for Card, Button, Badge and Table), and builds from a host theme withOpenUiTheme.fromColorSchemeorfromMaterial. Defaults are the reference's values, so nothing changes until you set them. The static radius, spacing and weight constants stay as the reference values. - Stock builders (
buildCard,buildButton, ...) are exported fromcomponents.dartso a host can wrap one. - The renderer is split into packages.
open_intelligent_uistill includes everything: every component, Inter, Lucide icons, links that open in the browser, andpackage:open_intelligent_ui/chat.dart. Nothing changes for apps that use it. For a smaller app, depend onopen_intelligent_ui_coreand add only what you need:open_intelligent_ui_maps(Map, MapMarker, OsrmStreetRoute),open_intelligent_ui_web(HtmlView, YouTube),open_intelligent_ui_math(Math),package:open_intelligent_ui_core/lucide.dart(icons) andopen_intelligent_ui_chat(OpenUiChat). Migrating fromopen_intelligent_uito the core: builders: intelligentUiBuilders -> builders = composeBuilders([mapBuilders, ...]) OpenUiSession(intelligentUi, ...) -> OpenUiSession(intelligentUiFor(builders), ...) intelligentUi.systemPrompt(chatPrompt) -> library.systemPrompt(chatPromptFor(library)) (icons) -> OpenUiServices(icons: lucideIconResolver) (links) -> OpenUiServices(openUrl: (u) => launchUrl(u)) Without the umbrella, text uses the platform font unless you bundle Inter or setfontFamily. OpenUiServices.iconsreplaces the built-in icon set;OpenUiView.fallbackServicesandOpenUiServices.orElsefill services a scope leaves unset.OpenUiScopecarries into routes.OpenUiChatgiven onlybuildersnow advertises only the components those builders draw.- First release: Flutter renderer for Open Intelligent UI answers (a port of
thesysdev/open-intelligent-ui at
9df2e64), withOpenUiView, a builder per component,OpenUiThemelight and dark tokens, injectableOpenUiServices, optional Wikimedia and OSRM clients, and a gallery example app. - Renderer slots:
OpenUiViewtakesOpenUiContent,OpenUiQueryLoading,OpenUiQueryError,OpenUiRetryand aqueryLoader, andOpenUiView.queryOfgives the query state, includingisRetrying. OpenUiPreview(withOpenUiPreview.of) renders a response's preview, as react-lang's preview renderer does.- A builder's own render error reaches
onErrorasrender-error. - Inter ships as the variable Inter 4.1 font, so weights 440, 560 and 640 render as the reference sets them.
- Icons are lucide-react 0.562.0's outlines, drawn at the reference's 1.8 stroke.
GlyphgainsstrokeWidth, and the icon font is removed. - CSS gradient backgrounds draw as Flutter gradients (linear and radial, plain or repeating).
- Maps match the reference's camera, zoom, pins and modal. The expanded map is a modal route, so its focus stays inside and Escape returns focus to Expand.
- The native HtmlView sandbox refuses to run unless the page has an opaque origin, and denies storage, cookies, caches, service workers and BroadcastChannel. The web view denies camera and microphone requests.
- Keyboard and screen-reader access: links, pins, popovers, flashcards and carousel arrows are focusable, timers are labelled, and lists, tables and radio groups carry their semantics.
- Phone breakpoints: layout, table and segmented controls change at 640px width, as the reference's CSS does.
- Markdown: inline code draws as a box, and list markers follow Chrome's placement.
- Svg: a bad path draws up to its first error.
- Charts and tables: chart hover follows pointer movement, and tables lay out with min-content widths and list and table semantics.
package:open_intelligent_ui/chat.dart:OpenUiChatrenders answers inai_sdk_flutter_uichats, andOpenUiUserMessageshows@ToAssistantturns with their form values. The example has an offline chat demo.- Behaviour change: no network by default. Map tiles and images no longer load until you allow them:
OpenUiServices(mapTiles: esriStreetTiles, imageLoader: networkImages), or allow a few hosts withimageLoader: allowImageHosts(['upload.wikimedia.org']). A blocked image shows the photo placeholder. The README's Network section lists every place that can reach the network.