npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@naspk/fnui

v0.1.0

Published

面向 fnOS 应用的双端 Vue 3 组件库,基于 tdesign-vue-next 与 tdesign-mobile-vue 封装。

Readme

@naspk/fnui

This package is under development. The current platform entries provide FnProvider, FnLayout, FnPage, FnButton, FnInput, FnTextarea, FnForm, FnFormItem, FnDialog, FnDrawer, FnCheckbox, FnRadio, FnSwitch, FnCheckboxGroup, FnRadioGroup, FnTabs, FnDataView, FnEmpty, FnSkeleton, FnLoading, FnIcon, FnSelect, FnInputNumber, FnTable, FnPopup, FnPopover, FnPagination, FnLoadMore, FnImageUpload, FnFileBrowser, FnAuthorizedPathField, and FnAuthorizationPanel, plus the initial P1 FnDatePicker and FnTimePicker. They require Vue and the corresponding TDesign peer dependency. Import only one platform and its CSS in a document. TDesign's current JavaScript entries also import component CSS as a side effect.

Utility CSS

The companion @naspk/fnui-theme package provides optional Tailwind CSS v3 and v4 integrations and an UnoCSS preset. They map fn-* utility colors to the active FnProvider theme without adding a runtime dependency. See the theme package README for setup, scope, and CSS precedence.

Configuration And Feedback

FnProvider accepts platform, theme, preset, and locale (default zh-CN). The reactive locale is exposed by useFnUi().locale() and applied as lang to the provider and overlay. Platform entries configure TDesign with its English locale for en* and Chinese otherwise; localeConfig overrides top-level TDesign locale sections. The platform-independent core provider has no TDesign configuration. fnUI's built-in default labels switch between Chinese and English as well; explicitly supplied labels are preserved. Other languages require application-provided text. Form validation errors already shown are updated on the next validation, not automatically retranslated. FnPage accepts a numeric pixel or CSS maxWidth and flushBottom.

FnIcon embeds all 2,358 SVG icons from TDesign Icons 0.4.12 locally. Use the official kebab-case name, for example file, folder-filled, or cloud-upload. No icon font, CDN, sprite request, or network access is needed at runtime. fnIconNames lists the official names; unknown names render an empty SVG with data-fn-icon-unknown.

back, info, and warning remain aliases for chevron-left, info-circle, and error-circle. Official names take precedence: forward and more now use their TDesign artwork; use chevron-right or ellipsis for the former directional arrow or horizontal dots. Decorative icons are hidden from assistive technology; provide label for informative icons. size accepts a number or CSS length; strokeWidth, strokeColor, and fillColor customize the SVG, which defaults to currentColor.

<FnIcon name="folder-filled" :size="24" label="Folder" />
<FnIcon name="file" stroke-color="var(--fn-primary)" />

The embedded artwork is distributed under the MIT license in LICENSE.tdesign-icons. To update it, change the pinned icon package version and generator version check, then run node scripts/generate-tdesign-icons.mjs from the workspace root and run the icon tests.

Call useFnFeedback() from a descendant of FnProvider. show() accepts message, tone (info, success, warning, or danger), duration in milliseconds, closable, and closeLabel. It returns an update() / destroy() handle. A duration of zero keeps the message until dismissed. clear() removes messages owned by that provider. Updating a message restarts its timer; provider unmount clears timers and handles become inert. During SSR show() is a no-op. This is a scoped fnUI implementation, not a wrapper of TDesign's global message service.

useFnDialog().confirm({ title, message, confirmText?, cancelText? }) returns Promise<boolean>. Requests within one provider are displayed in order. Confirm resolves true; cancel, Escape, provider unmount, and SSR resolve false. Clicking the backdrop does not dismiss this confirmation. It is a simple fnUI confirmation, not a substitute for a custom form dialog. Active confirmations lock document-root scrolling with a shared reference count; nested scroll locking and assistive technology behavior still require browser and device verification.

Common Composables

The following are available from @naspk/fnui/core, /desktop, and /mobile. Use them in component setup or a Vue effect scope to clean up automatically. They do not require FnProvider.

  • useFnToggle(initial?) returns a writable value ref and set(boolean) / toggle() methods. toggle() returns the new value.
  • useFnDebounce(source, delay?) returns a readonly value ref and stop(). The source and delay may be values, refs, or getters; delay defaults to 300 ms. The first value is immediate, subsequent changes are delayed. Stopping or disposing the scope cancels a pending update.
  • useFnAsync(task) returns readonly data, error, and loading refs plus execute(...args) and cancel(). The task receives an AbortSignal followed by the execution arguments. A new execution aborts the previous one; cancelled or stale results cannot update state. execute() still resolves or rejects with its own task's outcome, so callers must handle rejections. A task must honor the signal to stop its underlying work.
  • useFnEventListener(target, event, listener, options?) tracks a target, ref, or getter and returns an idempotent stop function. A changed target detaches the old listener. It supports standard event-listener options.
  • useFnMediaQuery(query, initial?) returns readonly matches and isSupported refs and a stop() method. It starts listening after mount to avoid hydration mismatches; initial defaults to false and is also used during SSR or when matchMedia is unavailable. Queries can be refs or getters.
  • useFnClipboard(resetDelay?) returns readonly copied and error refs plus copy(text): Promise<void>. Success resets after 2000 ms by default; unavailable or denied clipboard access rejects and sets error. Clipboard access normally requires a secure context and a user gesture.
import { ref } from 'vue'
import { useFnAsync, useFnDebounce, useFnToggle } from '@naspk/fnui/core'

const search = ref('')
const { value: debouncedSearch } = useFnDebounce(search, 300)
const { value: filtersOpen, toggle } = useFnToggle()
const { data: files, loading, error, execute } = useFnAsync(
  async (signal, query: string) => {
    const response = await fetch(`/api/files?q=${encodeURIComponent(query)}`, { signal })
    if (!response.ok) throw new Error(`Request failed: ${response.status}`)
    return response.json()
  },
)
// Call from an event handler or watcher and handle rejected requests:
// await execute(debouncedSearch.value).catch(console.error)

Forms

FnDatePicker and FnTimePicker accept controlled modelValue values of YYYY-MM-DD | null and HH:mm | null, respectively. The date range is 1900-01-01 through 2100-12-31. Invalid external values throw instead of being normalized. label, placeholder, confirmText, and cancelText customize the accessible trigger and actions; disabled and readonly prevent opening. Selection is a draft until confirmation, which emits update:modelValue then change only when the value differs. Cancel and dismissal discard the draft. The parent may reject an update. A null date opens at the current local date; a null time opens at 00:00. An external model change while open replaces the draft. There are no public slots or ref methods.

Desktop uses TDesign panels in an anchored fnUI popover; mobile uses a TDesign wheel inside a modal drawer with native confirm/cancel buttons. Optional range and v-model:range-value use native start/end controls; min and max set inclusive limits. disabledValue prevents confirming unavailable dates or times, including range endpoints. Single mode does not provide typed entry or clearing; timezone conversion, seconds and arbitrary formats are not supported. The vendor panels' keyboard, screen-reader, touch, and narrow-device behavior still requires acceptance.

FnInputNumber is a controlled native text input and stepper on both platforms, not a TDesign InputNumber wrapper. It accepts modelValue (number | null), min, max, positive finite step, optional precision (an integer from 0 to 12), disabled, readonly, placeholder, label, decreaseLabel, increaseLabel, and inputAttrs. Its ref exposes focus() and blur(); it has no slots. Enter or blur commits a decimal draft: empty means null, invalid text is discarded, and a valid value is rounded to precision when provided then clamped to the range. Increment/decrement buttons and arrow keys step the controlled value. Changes emit update:modelValue before change; a parent that rejects an update retains its value. Native attributes must be passed through inputAttrs. Arithmetic uses JavaScript numbers, not arbitrary precision; very large values and steps finer than 12 decimal places can be subject to floating-point rounding. Locale-specific decimal separators and exponent input are unsupported. Keyboard, touch, and assistive technology behavior still needs device testing.

FnInputNumberExact is the string-model alternative for exact decimal arithmetic. modelValue, min, max, and step are decimal strings; changes emit canonical decimal strings (or null) without floating-point conversion. locale controls the decimal separator and digits in the editor. Group separators and exponent notation are not accepted. It supports controlled updates, bounds, step buttons, arrow keys, focus() and blur().

FnForm validates model fields using its own rules on both platforms. Its ref exposes validate(), validateField(field), clearValidate(field?), and resetFields(). Validation returns a Promise<boolean>; false also means the result became stale because the model or rules changed. Validators can return true, false, an error string, or a promise of those values. Rules run in order, stopping at the first error. A model or rule change clears errors and invalidates outstanding checks. Submission emits submit and does not automatically validate.

FnFormItem provides id, error, and errorId through its default slot. Pass these to the input so the label and validation message are associated:

<FnForm ref="form" :model="model" :rules="rules">
  <FnFormItem field="name" label="Name" v-slot="{ id, error, errorId }">
    <FnInput v-model="model.name"
      :status="error ? 'error' : 'default'"
      :input-attrs="{ id, 'aria-describedby': errorId, 'aria-invalid': !!error }" />
  </FnFormItem>
</FnForm>

resetFields() restores the initial model snapshot, including nested plain objects, arrays and dates; other object instances retain their references. Replacing the model does not change the initial snapshot. Field names support dot paths and numeric brackets, e.g. user.contacts[0].email. An exact top-level key takes precedence over path traversal; inherited properties are not read. These rules are not the async-validator API. Input attributes are applied to the underlying DOM control after mounting, so their presence during SSR has not been established. FnInput also accepts type: text, password, search, tel, or url. The type is forwarded to the platform input during rendering, including SSR.

Mobile FnTextarea uses a native textarea with fnUI styling to avoid a TDesign mobile height-measurement error on rapid unmount; desktop continues to use TDesign. Mobile visual and accessibility behavior still needs browser and device verification.

Overlays

FnDialog and FnDrawer are controlled with visible and update:visible. The dialog's confirm event does not close it. Close requests emit update:visible, then close, then visible-change; dialog cancel also emits cancel. Close reasons include close, escape, and overlay, with cancel for the dialog's cancel action. Dialog presentation accepts dialog (default), sheet, or fullscreen.

Drawer requires a title, accepts placement (left, right, top, or bottom), CSS size, closeLabel, closeOnEscape, and closeOnOverlayClick; content and footer use the default and footer slots. Escape is enabled by default and overlay click is disabled by default. Both components must be inside FnProvider; they render after mounting into its overlay target. A shared stack manages Escape and focus for fnUI modals. Nested scroll locking, transition timing, and assistive technology behavior still need browser and device verification.

Selection And Tabs

FnSelect supports unique string or finite number option values, single or multiple controlled values, disabled options, and searchable lists. commitMode="confirm" keeps a draft until confirmation; cancelling discards it. immediate emits update:modelValue then change on selection. Set remote to disable local filtering and handle the search event in application code, including cancellation of stale requests. This first version uses an fnUI drawer and native radio / checkbox options on both platforms. clearable adds an immediate controlled clear action. An option's group provides a group label. allowCreate enables search and a create button; activation emits create with the trimmed text before requesting a selection. In confirmation mode the create intent is immediate even if the selection draft is later cancelled. The application owns the option list and persistence. virtual: { height, rowHeight, overscan? } bounds rendered rows, including group headings. The fixed row height must be at least 44 pixels; offscreen inputs are unmounted. Keyboard traversal across the virtual window and screen reader behavior require further verification.

Checkbox and radio groups use controlled modelValue and emit update:modelValue before change. Group choice values can be strings, numbers, or booleans; native HTML form submissions serialize values as strings. The controls use native inputs for semantics and TDesign for visual styling. FnSwitch uses a boolean model. Label, touch, keyboard, and screen-reader behavior require further device testing.

FnTabs accepts controlled modelValue, items with unique string or finite number values, and a label for its tab list. The panel slot receives item and value. Arrow keys, Home, and End move between enabled tabs; all panels remain mounted and inactive panels are hidden.

Data And Status

P0b Contracts

FnPopup is a controlled modal surface with visible, title, placement (left, right, top, bottom), size, closeLabel, closeOnEscape, and closeOnOverlayClick. It forwards update:visible, close, and visible-change, and accepts default and footer slots. It exposes no ref methods. It shares FnDrawer focus and modal-stack behavior.

FnPopover accepts controlled visible, title, placement (top, bottom, left, right), disabled, triggerText, trigger (click or hover), openDelay, and closeDelay in milliseconds. It emits update:visible and visible-change; the trigger and default slots supply the button label and content. It exposes no ref methods. Desktop uses an anchored TDesign Popup; mobile uses a modal drawer, so desktop positioning does not apply on mobile. Hover mode uses pointer entry and keyboard focus on desktop; mobile retains click activation. Optional anchor is a CSS selector for an existing external trigger: desktop positions against that element, while mobile opens the usual drawer. The element must exist when the popover mounts; the caller owns its accessible name and state. Nested hover menus are unsupported.

FnPagination is controlled by page, pageSize, and total. It emits update:page followed by change with the requested page; it does not fetch or mutate data. disabled blocks navigation. The label, previousLabel, and nextLabel props provide accessible text. It renders previous/next buttons and the current/total page count; it has no slots or ref methods. pageSizeOptions enables a controlled size selector, emitting update:pageSize then page-size-change. The parent must adjust page when necessary. showJumper enables an integer page input; requests are clamped to the current page count and invalid entries are discarded.

FnLoadMore accepts loading, hasMore, disabled, error, automatic, and customizable labels. It emits load as an intent, never owns a cursor or performs a request. Its default slot replaces the status text; it has no ref methods. Automatic loading requires IntersectionObserver and falls back to the button when unavailable. Requests in the same Vue update cycle are coalesced; the application must set loading while a request is in progress to prevent subsequent requests. Automatic loading waits for a complete loading: true to false cycle before issuing another request.

FnImageUpload accepts controlled items (id, name, url, optional status and progress), multiple, disabled, accept, maxFiles, maxBytes, and customizable labels. It emits select with browser Files, reject with rejected files and reasons, and remove with an item id. The application owns upload, preview URLs, progress, retry, cancellation and item state; NAS paths are not files. The default slot replaces the chooser label. The ref exposes open() and openDirectory(). Optional directory uses webkitdirectory where supported; drop accepts files and emits drop-unsupported for folders. The component checks the browser-reported image MIME type and matches accept extensions, MIME types, or MIME wildcards, but these values can be forged or missing. The server must validate file contents, type and size independently before accepting an upload.

FnFileUpload provides a controlled list for ordinary file uploads. It emits select, reject, remove, cancel, and retry intents; applications own the actual transfers, concurrent task state, retry and resume protocols. Optional directory selection requires browser support for webkitdirectory. Optional drop enables file drag/drop. With directory, supported browsers traverse dropped folders and emit select-paths containing { file, path } before select. Traversal is limited to 10,000 entries and 32 levels; empty folders are not emitted. A newer drop supersedes an unfinished one. Failed or unsupported folder traversal emits drop-unsupported. Relative paths and file metadata are untrusted and require server validation. See docs/guides/file-upload.md for limits and supported states.

useFnUpload(adapter) is an optional in-memory task manager for FnFileUpload. The application's adapter receives each File, an AbortSignal, and an onProgress(percentage) callback. Connect items, add, cancel, retry and remove to the corresponding component props and events. Cancellation aborts the signal and marks the task paused; retry starts the adapter again from the beginning, not as a resumable transfer. Stale callbacks are ignored. Tasks are disposed with the Vue scope, or explicitly with dispose() outside a scope. It does not persist tasks, limit concurrency, implement a network protocol, or guarantee that a server stops work after cancellation.

FnFileBrowser is a controlled presentation shell. items contain unique string or finite-number id, name, kind (file or directory), and optional disabled. breadcrumbs contain opaque id and label values. It accepts selection, loading, and mode (table, list, grid), emits update:selection then selection-change, navigate with a breadcrumb id, and open with an item. It does not read paths or fetch files. It has no slots or ref methods; paging, sorting, tree navigation, and actions beyond opening must be implemented by the application.

FnAuthorizedPathField displays an opaque authorized path supplied through modelValue. Its choose event requests an application-owned picker; clear emits update:modelValue(null) followed by change(null). It does not grant or revoke access. FnAuthorizationPanel renders supplied items and emits revoke with an item id; confirmation and all authorization operations remain application responsibilities. Neither has slots or ref methods.

FnTable uses the FnDataView contract below, fixed to table mode. It forwards the cell, loading, and empty slots and controlled selection and sort events; it exposes no additional ref methods. It uses native table markup with horizontal overflow on both platforms, not TDesign Table. Columns can specify pixel width, fixed (left or right) and fixedOffset; callers supply offsets for multiple fixed columns. cellSpan(row, column, index) returns rowSpan / colSpan; zero omits a covered cell. Callers are responsible for valid non-overlapping spans. Prefer FnDataView with an explicit item slot for mobile cards. Merged cells must not span across pagination boundaries.

FnDataView accepts rows, a required rowKey field or function, columns, and mode (table, list, or grid). Keys must be unique strings or finite numbers. selection and sort are controlled: updates emit update:selection / selection-change and update:sort / sort-change. Sorting emits intent without reordering rows. Select-all affects enabled rows on the current page and preserves selections outside it. The cell, item, loading, and empty slots customize rendering. pagination supports client pagination (slicing the provided rows) and manual pagination (the caller provides current-page rows and total); page and page-size updates emit controlled update:page / page-change and update:pageSize / page-size-change. Sorting and data fetching remain application-owned. The parent must update page and page size, including clamping after a size change. For tree tables, set childrenKey to the field containing child rows and control expandedKeys with update:expandedKeys / expand-change. Row keys must be unique across the whole tree, and cycles or shared rows are rejected. Client pagination counts root rows; expanded descendants follow their root. Select-all applies to the visible expanded rows on the page.

In table mode, virtual: { height, rowHeight, overscan? } bounds DOM rows in a fixed-height scroll viewport. Row heights must be at least 44 pixels; content exceeding the fixed height is clipped. Virtual mode cannot be used with cellSpan, list or grid mode. Selection still applies to the complete current page, not only the rendered window. Offscreen controls are unmounted: keyboard focus and assistive-technology support for virtualized rows still require browser and device verification.

FnEmpty exposes title, description, image and action slots. FnSkeleton provides text, avatar and paragraph themes, and FnLoading provides an inline loading state. These components are still under active development.

Basic P1 components

FnSlider and FnRate are controlled native inputs. Provide modelValue and an accessible label; changes emit update:modelValue then change. Slider supports numeric min, max, step and disabled; Rate supports integer values, count, disabled and readonly. Set range and use v-model:range-value for a slider range and marks for labelled ticks; allowHalf enables half ratings and allowClear allows clearing a rating. Slider also supports vertical orientation, native value titles, and change-end / range-change-end events for accepted values.

FnProgress displays a numeric percentage from 0 to 100 and requires label; showValue controls the visible percentage and indeterminate shows an unknown progress state. FnSteps accepts items and a zero-based current, with an optional item slot, vertical layout and controlled clickable navigation. Progress also supports a circular variant. FnCollapse accepts controlled modelValue, items and accordion; its content slot receives the current item; lazy defers closed content until first opening. Item values must be unique. All five use fnUI native semantic controls on both platforms, not TDesign's full API. See the per-component guides under docs/guides/ for validation and limitations.

FnTag, FnBadge, FnAvatar, FnImage, FnTypography, FnAlert, and FnCard provide the limited native presentation contracts documented there. FnBadge can cap numeric content with max, and FnAvatar falls back to its slot on image errors. Tags can be selected or closed; alerts can be dismissed with controlled visibility. Images require caller-provided alternative text; FnImage forwards native load and error events and supports fallbackSrc, but does not provide a viewer. FnTypography supports line clamping and explicit text copying through the browser Clipboard API.

FnMenu, FnTabBar, and FnSideBar expose explicit navigation layouts with controlled modelValue and items. FnBreadcrumb emits navigate for ancestor items and optionally collapses long paths with maxItems. Supply an accessible label and handle routing in the application. They do not automatically turn breadcrumbs into a Navbar.

FnNavigation provides application navigation in sidebar or bottom mode. In bottom mode, items beyond maxVisible (default 4) appear in a More drawer. Selection remains controlled and routing belongs to the application; use its item slot to render icons and labels. See the P1 contracts for details.

FnCascader selects a leaf; FnTreeSelect selects any node. Both accept recursive options with globally unique value keys and use a drawer for level-by-level navigation. FnTree accepts the same shape as items and uses local disclosure state. Set searchable for local path search, and multiple with v-model:checked-values for independent controlled checks; v-model remains the single-selection API. Nodes marked lazy can load children using the asynchronous loadChildren prop; failures emit load-error and can be retried. Search includes loaded nodes only. Selectors support clearable; FnTree supports controlled expandedValues and opt-in cascade checks across loaded enabled nodes. These controls do not expose the complete TDesign tree APIs.

FnImageViewer takes controlled visible and index, an images array of { src, alt }, and a title. FnTooltip is an interactive disclosure with optional desktop hover, rather than a hover-only tooltip. FnPopconfirm emits confirm without closing itself; control visible in the parent after handling the result. Their trigger slots are inside buttons and must not contain interactive descendants. Consult docs/guides/popconfirm.md for events, unsupported features and limits. The image viewer supports zoom, rotation, reset and scrolling enlarged images, with optional thumbnails, touch swipes, pinch zoom, drag panning and adjacent-image preloading.

P2 Calendar

FnCalendar displays a Monday-first inline month. Pass controlled month (YYYY-MM) and modelValue (YYYY-MM-DD or null). Date changes emit update:modelValue then change; month navigation emits update:month then month-change. min, max, disabled, disabledDate, and readonly control interaction; the day slot customizes day content. Set range and use v-model:range-value for controlled start/end selection. The calendar is a native fnUI implementation and does not offer multiple selection. See docs/guides/calendar.md for bounds, labels, validation, keyboard navigation, and accessibility limitations.

FnColorPicker is a controlled native color input for lowercase #rrggbb values and optional swatches. FnQRCode renders a platform TDesign SVG with a fixed high-contrast palette, quiet zone, and required accessible label. QR codes should not contain secrets without an explicit application decision.

FnGuide provides a controlled inline step panel and an optional overlay mode with target highlighting and shared modal focus management. FnSwiper provides controlled slide navigation through buttons or touch gestures, with optional looping, indicators and pausable autoplay. Their guides are in docs/guides/guide.md and docs/guides/swiper.md.

FnComment, FnDescriptions, FnStatistic, and FnTimeline provide semantic, display-only primitives. Applications own formatting, comment actions and ordering; scoped slots allow customized description and timeline content.

FnTransfer moves items through controlled requests, FnAnchor renders native navigation links, and FnSticky uses CSS sticky positioning. Transfer's searchable and sortable options filter and order each list independently without changing its controlled selection; bulk moves visible enabled items. Refer to the P2 contracts for scrolling, selection and feature limitations.

The mobile entry also exports FnSegmented, FnNavbar, and FnFab. Segmented selection is controlled, Navbar emits a back intent without navigating, and Fab stays in normal flow unless the application positions it. FnActionSheet uses the shared drawer stack and emits selection without automatically closing; the parent owns its visibility. FnSwipeCell supports horizontal touch gestures and a keyboard-accessible toggle; its open state is controlled. FnIndexes provides a bounded, scrollable list and button-based index navigation. See the P2 contracts for gesture, scrolling, and feature limitations.

Platform selection

@naspk/fnui/auto never imports either platform. Pass application-owned loaders and the startup environment explicitly:

import { createFnAutoLoader } from '@naspk/fnui/auto'

const runtime = createFnAutoLoader({
  desktop: () => import('./bootstrap.desktop'),
  mobile: () => import('./bootstrap.mobile'),
}, { viewportWidth: window.innerWidth })

await runtime.load()

Explicit platform takes precedence over a confirmed host (web or app), then the startup viewport. Without any information, desktop is the stable fallback. load() caches its promise, including failures; create a new loader to retry. Resizing does not switch the selected platform.

Host configuration

@naspk/fnui/host accepts an application-owned adapter; it does not load an SDK or detect a host. Apply the partial updates to application state and pass that state to FnProvider.

import { createFnHostBridge } from '@naspk/fnui/host'

const bridge = createFnHostBridge(adapter, updateConfig, reportError)
await bridge.ready
// Call bridge.dispose() when the application runtime is destroyed.

ready waits for the initial read, not completion of an asynchronous subscription. Read and subscription errors are sent to reportError. A subscription that resolves after disposal is immediately cleaned up. Theme and locale changes received while reading take precedence over stale initial values. SDK lifecycle, fallback preferences, locale mapping, and document language remain the application's responsibility.