Files
smart-city-digital-twin-mar…/smart-app-city/frontend/node_modules/anser/lib/index.d.ts
Eric FELIXINE e30ae8ed09 feat(smart-app): implement complete mobile app MVP
- App.tsx: full navigation (Auth stack + Main tabs with 5 screens)
- Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen
- HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors
- MapScreen: interactive map with layer toggles (6 layers)
- MarketplaceScreen: categories (6), products (5), search
- ChatScreen: AI chat with quick prompts (4), bot responses
- ProfileScreen: user info, stats, menu (9 items), logout
- AlertsScreen: alert list with severity, acknowledge
- SensorsScreen: sensor list with type filters (6 types), search
- ZonesScreen: zone cards with stats
- SettingsScreen: language picker (FR/EN/ES/DE), privacy, about
- Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n
- Hooks: useSensors, useAlerts, useNotifications, useLocation
- Components: Card, Button, LoadingSpinner, ErrorBoundary, Header
- Services: iotService, notificationService (with axios API client)
- Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN)
- Theme: colors.ts with full design system (Blue Ocean palette)
- Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
2026-06-01 18:00:35 -04:00

178 lines
5.6 KiB
TypeScript
Executable File

// Type definitions for Anser
// Project: https://github.com/IonicaBizau/anser
export interface AnserJsonEntry {
/** The text. */
content: string;
/** The foreground color. */
fg: string;
/** The background color. */
bg: string;
/** The foreground true color (if 16m color is enabled). */
fg_truecolor: string;
/** The background true color (if 16m color is enabled). */
bg_truecolor: string;
/** `true` if a carriageReturn \r was fount at end of line. */
clearLine: boolean;
decoration: null | 'bold' | 'dim' | 'italic' | 'underline' | 'blink' | 'reverse' | 'hidden' | 'strikethrough';
/** `true` if the colors were processed, `false` otherwise. */
was_processed: boolean;
/** A function returning `true` if the content is empty, or `false` otherwise. */
isEmpty(): boolean;
}
export interface AnserOptions {
/** If `true`, the result will be an object. */
json?: boolean;
/** If `true`, HTML classes will be appended to the HTML output. */
use_classes?: boolean;
remove_empty?: boolean;
}
type OptionsWithJson = AnserOptions & { json: true };
export default class Anser {
/**
* Escape the input HTML.
*
* This does the minimum escaping of text to make it compliant with HTML.
* In particular, the '&','<', and '>' characters are escaped. This should
* be run prior to `ansiToHtml`.
*
* @param txt The input text (containing the ANSI snippets).
* @returns The escaped html.
*/
static escapeForHtml (txt: string): string;
/**
* Adds the links in the HTML.
*
* This replaces any links in the text with anchor tags that display the
* link. The links should have at least one whitespace character
* surrounding it. Also, you should apply this after you have run
* `ansiToHtml` on the text.
*
* @param txt The input text.
* @returns The HTML containing the <a> tags (unescaped).
*/
static linkify (txt: string): string;
/**
* This replaces ANSI terminal escape codes with SPAN tags that wrap the
* content.
*
* This function only interprets ANSI SGR (Select Graphic Rendition) codes
* that can be represented in HTML.
* For example, cursor movement codes are ignored and hidden from output.
* The default style uses colors that are very close to the prescribed
* standard. The standard assumes that the text will have a black
* background. These colors are set as inline styles on the SPAN tags.
*
* Another option is to set `use_classes: true` in the options argument.
* This will instead set classes on the spans so the colors can be set via
* CSS. The class names used are of the format `ansi-*-fg/bg` and
* `ansi-bright-*-fg/bg` where `*` is the color name,
* i.e black/red/green/yellow/blue/magenta/cyan/white.
*
* @param txt The input text.
* @param options The options.
* @returns The HTML output.
*/
static ansiToHtml (txt: string, options?: AnserOptions): string;
/**
* Converts ANSI input into JSON output.
*
* @param txt The input text.
* @param options The options.
* @returns The HTML output.
*/
static ansiToJson (txt: string, options?: AnserOptions): AnserJsonEntry[];
/**
* Converts ANSI input into text output.
*
* @param txt The input text.
* @returns The text output.
*/
static ansiToText (txt: string, options?: AnserOptions): string;
/**
* Sets up the palette.
*/
setupPalette (): void;
/**
* Escapes the input text.
*
* @param txt The input text.
* @returns The escpaed HTML output.
*/
escapeForHtml (txt: string): string;
/**
* Adds HTML link elements.
*
* @param txt The input text.
* @returns The HTML output containing link elements.
*/
linkify (txt: string): string;
/**
* Converts ANSI input into HTML output.
*
* @param txt The input text.
* @param options The options.
* @returns The HTML output.
*/
ansiToHtml (txt: string, options?: AnserOptions): string;
/**
* Converts ANSI input into HTML output.
*
* @param txt The input text.
* @param options The options.
* @returns The JSON output.
*/
ansiToJson (txt: string, options?: AnserOptions): AnserJsonEntry[];
/**
* Converts ANSI input into HTML output.
*
* @param txt The input text.
* @returns The text output.
*/
ansiToText (txt: string, options?: AnserOptions): string;
/**
* Processes the input.
*
* @param txt The input text.
* @param options The options.
* @param markup If false, the colors will not be parsed.
*/
process (txt: string, options: OptionsWithJson, markup?: boolean): AnserJsonEntry[];
process (txt: string, options?: AnserOptions, markup?: boolean): string;
/**
* Processes the current chunk into json output.
*
* @param text The input text.
* @param options The options.
* @param markup If false, the colors will not be parsed.
* @return The JSON output.
*/
processChunkJson (text: string, options?: AnserOptions, markup?: boolean): AnserJsonEntry;
/**
* Processes the current chunk of text.
*
* @param text The input text.
* @param options The options.
* @param markup If false, the colors will not be parsed.
* @return The result (object if `json` is wanted back or string otherwise).
*/
processChunk (text: string, options: OptionsWithJson, markup?: boolean): AnserJsonEntry;
processChunk (text: string, options?: AnserOptions, markup?: boolean): string;
}