August 15, 2026
Separating shared behavior into UIKit and FunctionKit
Extracting shared UI and browser behavior into UIKit and FunctionKit.
Introduction
Platform
#Platform
eric

Where shared behavior is useful

Search and arcade editing serve different purposes, yet both wait for input and release browser resources when a dialog closes. For example, fixing the same dialog-exit problem independently on several screens can leave one copy behind. Maintaining consistent behavior becomes more expensive as copies spread.

Mermaid
flowchart TD
    accTitle: Dependency direction between products and shared packages
    accDescr: WebCore consumes UIKit, FunctionKit, and DataKit; DataKit may use the product-neutral FunctionKit.
    W["WebCore product features"] --> U["UIKit interface behavior"]
    W --> F["FunctionKit general mechanisms"]
    W --> D["DataKit server data"]
    D --> F

A Kit groups reusable behavior in one package. Musecat extracted presentation, accessibility, time calculations and browser mechanisms that do not depend on a particular feature. Search targets and editing permissions remain in product code, where their meaning can be understood.

The roles of UIKit and FunctionKit

UIKit supplies dialog, input, transition and media behavior. FunctionKit provides reusable mechanisms for time, dates, location and browser capabilities. WebCore decides what a search means, which actions are allowed and what to save; DataKit handles server data and authentication. DataKit may also use product-neutral FunctionKit behavior.

Mermaid
sequenceDiagram
    accTitle: Waiting for search input and canceling requests
    accDescr: FunctionKit handles the input delay; the search feature owns queries, canceling previous requests, and applying results.
    participant I as Search input
    participant F as FunctionKit
    participant S as Search feature
    participant A as Search API
    I->>F: Changed query
    F-->>S: Pass query after delay
    S->>A: Cancelable query
    I->>S: Next input
    S->>A: Cancel previous request
    S->>S: Apply only valid responses

Dependencies point from product code toward the Kits. If a shared package imported an arcade route or a product role, its other consumers would inherit those assumptions. Public entry points expose supported behavior without making consumers depend on internal file locations.

Input delays and request cancellation

Search can wait briefly for typing to pause before making a request. Starting a timer, cancelling the previous wait and cleaning up on unmount are reusable FunctionKit mechanisms. Deciding whether to search unfinished composition, how to handle empty input and how to order results belongs to search itself.

An older response must not overwrite a newer query. The feature cancels obsolete requests and checks which input a response belongs to. Original-query and keyboard-correction requests also have different failure meanings: original-query failure produces an error, while an optional correction failure preserves valid original results. Successful results merge with duplicates removed.

Mermaid
flowchart TD
    accTitle: The scope of search failures
    accDescr: Failure of the original query is a search error; failure of auxiliary keyboard correction retains successful original results.
    Q["Original and auxiliary queries"] --> O{"Original succeeded"}
    O -->|"No"| E["Search error"]
    O -->|"Yes"| C{"Auxiliary succeeded"}
    C -->|"Yes"| M["Deduplicate and merge"]
    C -->|"No"| K["Keep original results"]

Dialogs follow a similar allocation of responsibility. UIKit owns presentation and closing lifecycle; the feature supplies unsaved-change intent and any navigation after saving.

Package fixes and feature development

A package fix reaches the screens using that shared mechanism. Public exports and package tests describe supported behavior, reducing the chance that an internal reorganization unexpectedly changes a consumer.

Similar-looking screens do not automatically need one configuration object. Features with different meanings can compose the available parts directly. The aim is to maintain repeated mechanisms once while keeping product decisions understandable in their own code.

Related articles and sources: Engineering history

Musecat
All About Arcades