open_intelligent_ui_core 3.1.0
open_intelligent_ui_core: ^3.1.0 copied to clipboard
Core of the Open Intelligent UI Flutter renderer: layout, text, controls, charts and tables, with no map, web view, TeX or chat dependency.
3.1.0 #
- Markdown code fences can draw host widgets. The first word of a fence's info string is its tag;
OpenUiServices(markdownFences: {'chart': ...})maps tags to aMarkdownFenceBuilder, which gets aMarkdownFence(tag,info,body,isComplete). A fence that is still streaming reaches its builder withisCompletefalse; returning null, or a tag with no builder, keeps the plain code block.MarkdownBlocksis now exported fromcomponents.dartand takesfences:, which win over the scope's. - A Markdown heading that holds U+2028 or U+2029 no longer hangs the renderer.
- An app can depend on
ai_sdk_openuiand this package from git at one commit, with nodependency_overrides: unreleased siblings are path dependencies (seedocs/git-dependencies.md). - A component with no builder reports a
render-errorto the session'sonErrorinstead of rendering nothing silently.OpenUiView(fallback:)shows a widget when the settled answer has errors and no root, as when aValidationPolicyfails it.intelligentUiFor(builders, library:)takes a host library and throws anArgumentErrornaming each host-added component the lookup cannot build. - Theming without Material:
OpenUiThemeScopegives a subtree its ownOpenUiTheme(a dark view in a light app) with no MaterialThemeneeded, and reaches the date picker and menus. The defaultfontFamilyis now null (the platform font);OpenUiServices.fontFamilysets a fallback. Every colour comes from a token: newonTone,checkInk,chevron,floatShadow,inkOnLightandinkOnDark, andcopyWithtakesbrightness.OpenUiComponentStyletakesfontSizeandsizeper component (for exampleButton,Checkbox,Input,Carousel.arrow), andOpenUiTypography(tabularNums: true)sets tabular figures on all text. The iOS date popup in a dark view is now legible in a light app. - 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:). - A handled action in the unknown phase (cut off by a restore, being checked by the host) shows a spinner and a
"Checking…" note (
OpenUiLocalizations.checkingAction), and takes no tap: it reads as neither failed nor retryable. - 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. - An unnamed field or Form is named after that element id, not a process-wide
field-Ncounter, so what the user typed or picked survives a remount, a restore frominitialStateand other views rendered first. Two controls with the same label in one form keep separate values: the later one is named<label>~<id>. - 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).
- Chart values, tooltips and axis ticks follow the session's locale:
OpenUiSession(locale: 'en_IN')writes₹2,34,567and compacts to₹12.35L. With no locale they stay en-US.OpenUiNode.localeexposes it. - 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. - First release: the core renderer (
OpenUiView, layout, text, controls, charts, tables, SVG, Markdown, code), the 13 built-in icons and the lucide icon library (package:open_intelligent_ui_core/lucide.dart), split from open_intelligent_ui. allowImageHosts(hosts, maxBytes:, timeout:): an allow-listed image larger thanmaxBytes(10 MiB by default) or slower thantimeout(30 seconds by default) fails instead of downloading without limit.OpenUiServicesandMapTilescompare by value, so anOpenUiScoperebuilt with equal services (the same tear-offs and values) no longer rebuilds every component that reads them.- Form validation errors come from
OpenUiLocalizations, which now extendsValidationMessages: overridefieldRequired,invalidEmail,atLeastCharactersand the rest to translate them.OpenUiFormValidation.messagesholds the words a Form validates with. - 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. - DatePicker opens on today in its session's clock and time zone.
OpenUiNodegainslocalNow.