Include dist files
This commit is contained in:
65
native-input/dist/esm/definitions.d.ts
vendored
Normal file
65
native-input/dist/esm/definitions.d.ts
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
import type { PluginListenerHandle } from '@capacitor/core';
|
||||
|
||||
/**
|
||||
* Colors are CSS color strings resolved on the web side from the chat theme
|
||||
* variables, so the native bar matches light/dark mode and the in-app palette.
|
||||
*/
|
||||
export interface NativeInputTheme {
|
||||
/** Bar / text field background. From `--chat-input-bg`. */
|
||||
inputBackground?: string;
|
||||
/** Text + caret color. From `--chat-input-text`. */
|
||||
text?: string;
|
||||
/** Placeholder color. */
|
||||
placeholder?: string;
|
||||
/** Accent used for the "+" button. From `--accent`. */
|
||||
accent?: string;
|
||||
/** Send button background. From `--chat-sent-bg`. */
|
||||
sendBackground?: string;
|
||||
/** Send button glyph color. From `--chat-sent-text`. */
|
||||
sendText?: string;
|
||||
/** Whether the app is currently in dark mode (drives the glass/blur tint). */
|
||||
dark?: boolean;
|
||||
}
|
||||
|
||||
export interface PresentOptions {
|
||||
/** Identifies the active chat so re-presents for a different chat reset text. */
|
||||
chatId: string;
|
||||
placeholder?: string;
|
||||
/** Pre-fill text (e.g. a half-typed draft when re-mounting). */
|
||||
text?: string;
|
||||
/** When false, the field is read-only and the send button is disabled. */
|
||||
canSend?: boolean;
|
||||
theme?: NativeInputTheme;
|
||||
}
|
||||
|
||||
export interface NativeInputPlugin {
|
||||
/** Create + show the native input bar pinned above the keyboard. */
|
||||
present(options: PresentOptions): Promise<void>;
|
||||
/** Remove the native input bar. */
|
||||
dismiss(): Promise<void>;
|
||||
setText(options: { text: string }): Promise<void>;
|
||||
getText(): Promise<{ text: string }>;
|
||||
focus(): Promise<void>;
|
||||
blur(): Promise<void>;
|
||||
setPlaceholder(options: { placeholder: string }): Promise<void>;
|
||||
setEnabled(options: { enabled: boolean }): Promise<void>;
|
||||
setTheme(options: { theme: NativeInputTheme }): Promise<void>;
|
||||
/** Hide/show without tearing down (e.g. when navigating away briefly). */
|
||||
setVisible(options: { visible: boolean }): Promise<void>;
|
||||
|
||||
/** Fires on every text edit. */
|
||||
addListener(eventName: 'inputChange', listenerFunc: (data: { text: string }) => void): Promise<PluginListenerHandle>;
|
||||
/** Fires when the user taps send / hits the send key. */
|
||||
addListener(eventName: 'send', listenerFunc: (data: { text: string }) => void): Promise<PluginListenerHandle>;
|
||||
/** Fires when the "+" attach button is tapped. */
|
||||
addListener(eventName: 'attach', listenerFunc: () => void): Promise<PluginListenerHandle>;
|
||||
/** Fires on focus / blur of the native field. */
|
||||
addListener(eventName: 'focusChange', listenerFunc: (data: { focused: boolean }) => void): Promise<PluginListenerHandle>;
|
||||
/**
|
||||
* Fires when the space the bar (and keyboard) occupies changes, in CSS px,
|
||||
* so the web layout can pad its scroll area / position the reply strip.
|
||||
*/
|
||||
addListener(eventName: 'heightChange', listenerFunc: (data: { bottomInset: number }) => void): Promise<PluginListenerHandle>;
|
||||
|
||||
removeAllListeners(): Promise<void>;
|
||||
}
|
||||
1
native-input/dist/esm/definitions.js
vendored
Normal file
1
native-input/dist/esm/definitions.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
4
native-input/dist/esm/index.d.ts
vendored
Normal file
4
native-input/dist/esm/index.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import type { NativeInputPlugin } from './definitions';
|
||||
declare const NativeInput: NativeInputPlugin;
|
||||
export * from './definitions';
|
||||
export { NativeInput };
|
||||
8
native-input/dist/esm/index.js
vendored
Normal file
8
native-input/dist/esm/index.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { registerPlugin } from '@capacitor/core';
|
||||
|
||||
const NativeInput = registerPlugin('NativeInput', {
|
||||
web: () => import('./web').then(m => new m.NativeInputWeb()),
|
||||
});
|
||||
|
||||
export * from './definitions';
|
||||
export { NativeInput };
|
||||
15
native-input/dist/esm/web.d.ts
vendored
Normal file
15
native-input/dist/esm/web.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { WebPlugin } from '@capacitor/core';
|
||||
import type { NativeInputPlugin } from './definitions';
|
||||
export declare class NativeInputWeb extends WebPlugin implements NativeInputPlugin {
|
||||
present(): Promise<void>;
|
||||
dismiss(): Promise<void>;
|
||||
setText(): Promise<void>;
|
||||
getText(): Promise<{ text: string }>;
|
||||
focus(): Promise<void>;
|
||||
blur(): Promise<void>;
|
||||
setPlaceholder(): Promise<void>;
|
||||
setEnabled(): Promise<void>;
|
||||
setTheme(): Promise<void>;
|
||||
setVisible(): Promise<void>;
|
||||
addListener(eventName: any, listenerFunc: any): Promise<any>;
|
||||
}
|
||||
17
native-input/dist/esm/web.js
vendored
Normal file
17
native-input/dist/esm/web.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { WebPlugin } from '@capacitor/core';
|
||||
|
||||
// No-op web implementation so the plugin import resolves in the browser build.
|
||||
// The HTML composer (textarea) is used on web; these methods are never the
|
||||
// active path there, but must exist to avoid runtime crashes.
|
||||
export class NativeInputWeb extends WebPlugin {
|
||||
async present() { /* no-op on web */ }
|
||||
async dismiss() { /* no-op on web */ }
|
||||
async setText() { /* no-op on web */ }
|
||||
async getText() { return { text: '' }; }
|
||||
async focus() { /* no-op on web */ }
|
||||
async blur() { /* no-op on web */ }
|
||||
async setPlaceholder() { /* no-op on web */ }
|
||||
async setEnabled() { /* no-op on web */ }
|
||||
async setTheme() { /* no-op on web */ }
|
||||
async setVisible() { /* no-op on web */ }
|
||||
}
|
||||
Reference in New Issue
Block a user