@trymellon/js 1.7.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,514 @@
1
+ /**
2
+ * FSM constants. Single source for initial state.
3
+ */
4
+ /** Initial FSM state (pre-attach). */
5
+ declare const INITIAL_UI_STATE: "IDLE";
6
+
7
+ /** UI FSM types — presentation layer. No DOM/core deps (types only). Aligned to 01-arquitectura §4. */
8
+
9
+ /** UI state machine states. */
10
+ type UIState = 'IDLE' | 'EVALUATING_ENV' | 'READY' | 'READY_REGISTER' | 'READY_LOGIN' | 'AUTHENTICATING' | 'SUCCESS' | 'ERROR' | 'FALLBACK' | 'FALLBACK_EMAIL' | 'FALLBACK_QR';
11
+ /** Component mode (mode attribute). */
12
+ type UIMode = 'login' | 'register' | 'auto';
13
+ /** Client status in UI layer (port/adapter map from core). */
14
+ type UIClientStatus = {
15
+ isPasskeySupported: boolean;
16
+ platformAuthenticatorAvailable: boolean;
17
+ recommendedFlow: 'passkey' | 'fallback';
18
+ };
19
+ /** getClientStatus result for EVALUATING_ENV → READY* transition. */
20
+ type EnvResolvedPayload = {
21
+ recommendedFlow: 'passkey' | 'fallback';
22
+ mode: UIMode;
23
+ /** When recommendedFlow === 'fallback', available fallback channel. */
24
+ fallbackType?: 'email' | 'qr';
25
+ };
26
+ /** Modal tab (register | login). */
27
+ type TabKind = 'register' | 'login';
28
+ /** Events that trigger FSM transitions. */
29
+ type FSMEvent = {
30
+ type: 'ENV_EVAL_START';
31
+ } | {
32
+ type: 'ENV_RESOLVED';
33
+ payload: EnvResolvedPayload;
34
+ } | {
35
+ type: 'ENV_DETACH';
36
+ } | {
37
+ type: 'ENV_ERROR';
38
+ } | {
39
+ type: 'RESET';
40
+ } | {
41
+ type: 'TAB_CHANGE';
42
+ payload: {
43
+ tab: TabKind;
44
+ };
45
+ } | {
46
+ type: 'START_AUTH';
47
+ } | {
48
+ type: 'AUTH_SUCCESS';
49
+ } | {
50
+ type: 'AUTH_ERROR';
51
+ } | {
52
+ type: 'AUTH_FALLBACK';
53
+ } | {
54
+ type: 'AUTH_FALLBACK_EMAIL';
55
+ } | {
56
+ type: 'AUTH_FALLBACK_QR';
57
+ };
58
+
59
+ /**
60
+ * Port: client environment evaluation (passkey/fallback). Contract only; implementation in adapters.
61
+ */
62
+
63
+ /** Contract to get client capability status (browser/device). */
64
+ interface EnvStatusPort {
65
+ getClientStatus(): Promise<UIClientStatus>;
66
+ }
67
+
68
+ /**
69
+ * Use case: evaluate environment (getClientStatus) and return next FSM state. Validates params and port response at boundary; domain + EnvStatusPort only. No DOM.
70
+ */
71
+
72
+ type RunEnvEvalParams = {
73
+ envStatusPort: EnvStatusPort;
74
+ currentState: UIState;
75
+ mode: UIMode;
76
+ isMobileOverride?: boolean;
77
+ /** When recommendedFlow is fallback, allows fixing FALLBACK_EMAIL vs FALLBACK_QR (e.g. modal). */
78
+ fallbackType?: 'email' | 'qr';
79
+ };
80
+
81
+ /**
82
+ * Type contracts for parsed UI attributes. Types only; no DOM/core. Parsing lives in adapters.
83
+ */
84
+
85
+ /** Presentation theme (theme attribute). */
86
+ type ThemeKind = 'light' | 'dark';
87
+ /** Button action: direct-auth (ceremony only) or open-modal (emit open-request / show modal). */
88
+ type ButtonAction = 'direct-auth' | 'open-modal';
89
+ /** Button presentation variant: default (inline icon+text) or pill (landing: circle + label, touch ≥48px). */
90
+ type ButtonVariant = 'default' | 'pill';
91
+ /** Modal presentation variant: default (standard panel/tabs) or minimal (landing: rounded-2xl, border-2, light tabs). */
92
+ type ModalVariant = 'default' | 'minimal';
93
+ /** Parsed and normalized host attributes (trymellon-auth). */
94
+ type ParsedAttributes = {
95
+ appId: string;
96
+ publishableKey: string;
97
+ mode: UIMode;
98
+ externalUserId: string | null;
99
+ theme: ThemeKind;
100
+ action: ButtonAction;
101
+ triggerOnly: boolean;
102
+ buttonVariant: ButtonVariant;
103
+ };
104
+ /** Modal display mode: overlay vs inline. */
105
+ type ModalDisplayMode = 'modal' | 'inline';
106
+ /** Active modal tab: register | login. */
107
+ type ModalTabKind = 'register' | 'login';
108
+ /** Tab labels for register/login. */
109
+ type TabLabels = {
110
+ register: string;
111
+ login: string;
112
+ };
113
+ /** Fallback type when recommendedFlow is fallback (fallback-type attribute). */
114
+ type FallbackTypeKind = 'email' | 'qr';
115
+ /** Parsed and normalized modal attributes (trymellon-auth-modal). */
116
+ type ParsedModalAttributes = {
117
+ open: boolean;
118
+ mode: ModalDisplayMode;
119
+ tab: ModalTabKind;
120
+ tabLabels: TabLabels;
121
+ theme: ThemeKind;
122
+ sessionId: string | null;
123
+ onboardingUrl: string | null;
124
+ isMobileOverride: boolean | null;
125
+ fallbackType?: FallbackTypeKind;
126
+ appId: string;
127
+ publishableKey: string;
128
+ /** Optional app name shown in dialog title (e.g. "My App — Sign in or register"). */
129
+ appName: string | null;
130
+ /** Optional full dialog title; overrides default/app-name title when set. */
131
+ dialogTitle: string | null;
132
+ /** Optional dialog description; overrides default copy when set. */
133
+ dialogDescription: string | null;
134
+ /** Optional external user id for register; when missing, SDK uses a generated UUID (no external UI needed). */
135
+ externalUserId: string | null;
136
+ modalVariant: ModalVariant;
137
+ };
138
+
139
+ /**
140
+ * Port: UI rendering onto a surface. Contract only; implementation in adapters. Imports from ../domain only.
141
+ */
142
+
143
+ /** Render options (theme, mode, pre-ceremony signal for register, button variant, labels). */
144
+ type RenderOptions = {
145
+ theme?: ThemeKind;
146
+ mode?: UIMode;
147
+ /** When false and state is READY_REGISTER, show "Preparing…" instead of button (session-id missing or empty). */
148
+ registerSessionReady?: boolean;
149
+ /** Button presentation variant. Default: default. */
150
+ buttonVariant?: ButtonVariant;
151
+ /** Primary button label (e.g. trigger "TryMellon", inside modal "Try Passkey"). Omit = "TryMellon". */
152
+ primaryButtonLabel?: string;
153
+ /** Primary button aria-label. Omit = derived from primaryButtonLabel or default. */
154
+ primaryButtonAriaLabel?: string;
155
+ };
156
+
157
+ /**
158
+ * Port: core event subscription and re-emission on host. Source of truth for modal WC event contract (names, detail types).
159
+ * Contract only; implementation in adapters. No import from ../core.
160
+ */
161
+
162
+ /** Public auth operation for host (login | register). */
163
+ type AuthOperation = TabKind;
164
+ /** Optional user info in mellon:success; minimal shape for host without coupling to core. */
165
+ type MellonSuccessUserInfo = {
166
+ userId: string;
167
+ externalUserId?: string;
168
+ email?: string;
169
+ metadata?: Record<string, unknown>;
170
+ };
171
+ /** mellon:success detail. Token required; token only in this event. Sensitive: backend only, validate server-side. */
172
+ type MellonSuccessDetail = {
173
+ operation: AuthOperation;
174
+ token: string;
175
+ nonce?: string;
176
+ user?: MellonSuccessUserInfo;
177
+ /** Redirect URL after login when core provides it. */
178
+ redirectUrl?: string;
179
+ };
180
+ /** mellon:error detail (code, message, operation, optional nonce). bubbles: true, composed: true. */
181
+ type MellonErrorDetail = {
182
+ operation: AuthOperation;
183
+ code: string;
184
+ message: string;
185
+ nonce?: string;
186
+ };
187
+ /** mellon:start and mellon:cancelled detail (operation, optional nonce for ceremony correlation). */
188
+ type MellonOperationDetail = {
189
+ operation: AuthOperation;
190
+ nonce?: string;
191
+ };
192
+ /** mellon:open detail (optional source, timestamp for observability). */
193
+ type MellonOpenDetail = Record<string, never> | {
194
+ source?: 'user' | 'api';
195
+ timestamp?: number;
196
+ };
197
+ /** mellon:close detail (optional reason, timestamp for observability). */
198
+ type MellonCloseDetail = Record<string, never> | {
199
+ reason: 'user' | 'success' | 'error' | 'cancel';
200
+ timestamp?: number;
201
+ };
202
+ /** mellon:fallback detail (channel chosen in UI). */
203
+ type MellonFallbackDetail = {
204
+ operation?: AuthOperation;
205
+ fallbackType?: 'email' | 'qr';
206
+ };
207
+ /** Minimal core contract for event subscription (on → unsubscribe). */
208
+ interface CoreWithEvents {
209
+ on(event: string, handler: (...args: unknown[]) => void): () => void;
210
+ }
211
+ /** Contract to subscribe core to host and re-emit as CustomEvents. Returns unsubscribe. */
212
+ interface CoreEventsPort {
213
+ subscribe(core: CoreWithEvents, host: HTMLElement): () => void;
214
+ }
215
+ /** Minimal core surface for UI: start auth and subscribe to events. */
216
+ interface CoreAuthPort extends CoreWithEvents {
217
+ authenticate(options?: CoreAuthOptions): void;
218
+ register(options?: CoreAuthOptions): void;
219
+ }
220
+ /** Options when starting auth from UI. */
221
+ interface CoreAuthOptions {
222
+ externalUserId?: string | null;
223
+ }
224
+
225
+ interface CoreConfig {
226
+ appId: string;
227
+ publishableKey: string;
228
+ }
229
+
230
+ type PendingAuthOperation = 'register' | 'authenticate';
231
+ declare class AuthController {
232
+ private _currentState;
233
+ private _lastRenderedState;
234
+ private _renderDirty;
235
+ private _pendingOperation;
236
+ private _currentNonce;
237
+ private _envEvalRequestId;
238
+ get currentState(): UIState;
239
+ setState(next: UIState): void;
240
+ invalidateRender(): void;
241
+ /**
242
+ * Decides if a render is needed based on state/dirty flag.
243
+ * Returns true when the caller should render and marks state as clean.
244
+ */
245
+ consumeRenderDecision(): boolean;
246
+ setPendingOperationFromTab(tab: TabKind): void;
247
+ get pendingOperation(): PendingAuthOperation;
248
+ setNonce(nonce: string | undefined): void;
249
+ consumeCancelledDetailIfAuthenticating(): MellonOperationDetail | null;
250
+ handleAuthSuccess(): void;
251
+ handleAuthError(): void;
252
+ onStartEvent(detail: MellonOperationDetail | undefined): void;
253
+ startAuthFromClick(core: CoreAuthPort | null, tab: TabKind, options?: CoreAuthOptions): void;
254
+ runEnvEval(params: Omit<RunEnvEvalParams, 'currentState'>): Promise<UIState | null>;
255
+ reset(): void;
256
+ setStateForRender(state: UIState): void;
257
+ }
258
+
259
+ /**
260
+ * Abstract base for <trymellon-auth> and <trymellon-auth-modal>. Shared lifecycle: teardown, host/fallback listeners, Mellon handlers, env eval.
261
+ * AuthController encapsulates FSM/env-eval; this base wires it to HTMLElement and DOM events.
262
+ */
263
+
264
+ /**
265
+ * Abstract base: FSM, core, event bridge, env eval, fallback/shadow click.
266
+ * Subclasses define observedAttributes, parsing, _render() and (modal only) open/tab.
267
+ * Render flow: setState / invalidateRender → scheduleRenderIfNeeded → _render (single path).
268
+ */
269
+ declare abstract class AuthElementBase extends HTMLElement {
270
+ protected _controller: AuthController;
271
+ protected _unsubscribeBridge: (() => void) | null;
272
+ protected _core: CoreAuthPort | null;
273
+ protected _lastCoreConfig: CoreConfig | null;
274
+ /** Encapsulates state assignment and schedules render. Single canonical way to change _currentState and trigger _render. */
275
+ protected setState(next: UIState): void;
276
+ /** Marks that a re-render is needed even if FSM state did not change (e.g. theme or props). */
277
+ protected invalidateRender(): void;
278
+ /** Compares current state with last render; if changed or dirty, calls _render and updates cache. */
279
+ protected scheduleRenderIfNeeded(): void;
280
+ /** If state was AUTHENTICATING: build detail, dispatch mellon:cancelled, clear nonce; return true. Else false. */
281
+ protected _emitCancelledIfAuthenticating(): boolean;
282
+ /**
283
+ * Injects auth core and starts env eval. Pass null to detach and transition to IDLE.
284
+ * Multi-write safe: teardown existing core before attaching new one. Host must call reset() before re-open if WC stays in DOM.
285
+ * @param core - CoreAuthPort-compatible instance, or null to detach.
286
+ */
287
+ attachCore(core: unknown): void;
288
+ protected _teardownCore(): void;
289
+ protected _attachHostListeners(): void;
290
+ protected _onMellonSuccess: () => void;
291
+ protected _onMellonError: () => void;
292
+ protected _onMellonStart: (e: Event) => void;
293
+ /**
294
+ * Semantic logic for "click on primary auth button". Subclasses register DOM delegation
295
+ * (e.g. adapters/interactions/dom.adapter) and call this method from the callback.
296
+ */
297
+ protected startAuthFromClick(): void;
298
+ /**
299
+ * Emits mellon:fallback. With type = email|qr sets detail.fallbackType; without type (generic "Continue") does not set fallbackType.
300
+ */
301
+ protected dispatchFallback(type?: 'email' | 'qr'): void;
302
+ protected _runEnvEval(): Promise<void>;
303
+ protected _maybeAutoCreateCoreAndRunEnvEval(): void;
304
+ /** Single path: compare config with last, attach or detach core. No per-call special cases. */
305
+ protected _reconcileCoreFromConfig(): void;
306
+ disconnectedCallback(): void;
307
+ /** Current FSM state (read-only). */
308
+ get currentState(): UIState;
309
+ /**
310
+ * Transitions FSM to IDLE, clears in-flight ceremony, re-renders. If state was AUTHENTICATING, emits mellon:cancelled first.
311
+ * Host must call reset() before re-open if WC remains in DOM after close.
312
+ */
313
+ reset(): void;
314
+ /** Tests only: set state and re-render without FSM transition. */
315
+ setStateForRender(state: UIState): void;
316
+ protected abstract getTabKind(): TabKind;
317
+ protected abstract getCoreAuthOptions(): {
318
+ externalUserId?: string | null;
319
+ };
320
+ protected abstract canStartAuth(): boolean;
321
+ protected abstract getEnvEvalParams(): Omit<RunEnvEvalParams, 'envStatusPort' | 'currentState'>;
322
+ protected abstract getCoreConfig(): {
323
+ appId: string;
324
+ publishableKey: string;
325
+ } | null;
326
+ protected abstract getFallbackDetail(): MellonFallbackDetail;
327
+ protected abstract _render(): void;
328
+ }
329
+
330
+ /**
331
+ * Web Component <trymellon-auth>. Shadow DOM open + attributes + render by state.
332
+ * Option A (default): action=open-modal without trigger-only → emits mellon:open-request and shows internal modal.
333
+ * Option B (escape hatch): trigger-only="true" → only emits mellon:open-request; host mounts <trymellon-auth-modal> separately.
334
+ */
335
+
336
+ declare class TryMellonAuthElement extends AuthElementBase {
337
+ static get observedAttributes(): string[];
338
+ protected _parsed: ParsedAttributes;
339
+ private _internalModal;
340
+ /** Element that opened the modal; single source for focus restore on close. */
341
+ private _focusRestoreTarget;
342
+ private _unregisterInteractions;
343
+ private _onInternalModalClose;
344
+ private _restoreFocusToTrigger;
345
+ connectedCallback(): void;
346
+ private _registerInteractions;
347
+ attributeChangedCallback(name: string, _oldValue: string | null, _newValue: string | null): void;
348
+ private _onPrimaryClick;
349
+ protected getTabKind(): TabKind;
350
+ protected getCoreAuthOptions(): {
351
+ externalUserId?: string | null;
352
+ };
353
+ protected canStartAuth(): boolean;
354
+ protected getEnvEvalParams(): Omit<RunEnvEvalParams, 'envStatusPort' | 'currentState'>;
355
+ protected getCoreConfig(): {
356
+ appId: string;
357
+ publishableKey: string;
358
+ } | null;
359
+ protected getFallbackDetail(): MellonFallbackDetail;
360
+ protected _render(): void;
361
+ private _syncThemeAttribute;
362
+ private _syncInternalModalAttributes;
363
+ private _ensureInternalModal;
364
+ disconnectedCallback(): void;
365
+ }
366
+
367
+ /**
368
+ * Web Component <trymellon-auth-modal>. Public API per 01-limites-api-publica.md.
369
+ * Extends AuthElementBase; attributes, parsing, modal structure, open/tab and _render only.
370
+ */
371
+
372
+ declare class TryMellonAuthModalElement extends AuthElementBase {
373
+ static get observedAttributes(): string[];
374
+ protected _parsed: ParsedModalAttributes;
375
+ private _focusTrap;
376
+ private _unregisterInteractions;
377
+ /** When external-user-id is not set, register uses this UUID so backend can notify client without external UI. */
378
+ private _generatedExternalUserId;
379
+ private _qrLoadTimeoutId;
380
+ private _qrSlotChangeBound;
381
+ /** Escape closes modal via same path as open=false → _transitionToIdle. */
382
+ private _boundEscapeKeydown;
383
+ connectedCallback(): void;
384
+ private _registerInteractions;
385
+ attributeChangedCallback(name: string, oldValue: string | null, _newValue: string | null): void;
386
+ private _startQrLoadWait;
387
+ private _clearQrLoadWait;
388
+ /** Single path to IDLE: close event, cancelled if needed, reset FSM, structure, render, visibility. Called from open→false and reset(). */
389
+ private _transitionToIdle;
390
+ get open(): boolean;
391
+ set open(value: boolean);
392
+ get mode(): 'modal' | 'inline';
393
+ set mode(value: 'modal' | 'inline');
394
+ get tab(): 'register' | 'login';
395
+ set tab(value: 'register' | 'login');
396
+ get tabLabels(): string;
397
+ set tabLabels(value: string | undefined);
398
+ get theme(): 'light' | 'dark';
399
+ set theme(value: 'light' | 'dark');
400
+ get sessionId(): string | null;
401
+ set sessionId(value: string | null);
402
+ get onboardingUrl(): string | null;
403
+ set onboardingUrl(value: string | null);
404
+ get isMobileOverride(): boolean | null;
405
+ set isMobileOverride(value: boolean | null);
406
+ get fallbackType(): 'email' | 'qr' | undefined;
407
+ set fallbackType(value: 'email' | 'qr' | undefined);
408
+ get appId(): string;
409
+ set appId(value: string);
410
+ get publishableKey(): string;
411
+ set publishableKey(value: string);
412
+ get appName(): string | null;
413
+ set appName(value: string | null);
414
+ get dialogTitle(): string | null;
415
+ set dialogTitle(value: string | null);
416
+ get dialogDescription(): string | null;
417
+ set dialogDescription(value: string | null);
418
+ get externalUserId(): string | null;
419
+ set externalUserId(value: string | null);
420
+ /**
421
+ * Reset override: transitions to IDLE, clears ceremony and emits `mellon:cancelled` if was AUTHENTICATING.
422
+ * Also emits `mellon:close` with the reason for the current state (success | cancel | error | user).
423
+ * Host must call `reset()` before reopening if the WC stays in the DOM for a clean state.
424
+ */
425
+ disconnectedCallback(): void;
426
+ reset(): void;
427
+ protected getTabKind(): TabKind;
428
+ protected getCoreAuthOptions(): {
429
+ externalUserId?: string | null;
430
+ };
431
+ /** Single path: explicit attr > generated UUID for register > none. No special-case branches in getCoreAuthOptions. */
432
+ private _resolveExternalUserId;
433
+ /** Passkey register is always allowed (external user id optional; SDK uses UUID when not set). */
434
+ protected canStartAuth(): boolean;
435
+ protected getEnvEvalParams(): Omit<RunEnvEvalParams, 'envStatusPort' | 'currentState'>;
436
+ protected getCoreConfig(): {
437
+ appId: string;
438
+ publishableKey: string;
439
+ } | null;
440
+ protected getFallbackDetail(): MellonFallbackDetail;
441
+ /** Reflects open/mode in DOM (wrapper/overlay hidden). Syncs focus trap: activate when open, deactivate restores focus on close. */
442
+ private _applyModalVisibility;
443
+ protected _render(): void;
444
+ }
445
+
446
+ /**
447
+ * Pure UI FSM — no DOM, no I/O. (currentState, event) → nextState.
448
+ * Transitions per 02-fsm-estado-modal.
449
+ */
450
+
451
+ /**
452
+ * Next FSM state from current state and event. RESET from any state → IDLE.
453
+ * Undefined transitions leave state unchanged (idempotent).
454
+ */
455
+ declare function getNextState(currentState: UIState, event: FSMEvent): UIState;
456
+
457
+ /**
458
+ * WC styles. Injected via adoptedStyleSheets or <style> + textContent. No innerHTML.
459
+ * Constructable Stylesheet when supported; <style> fallback (e.g. Safari <16.4).
460
+ */
461
+ /**
462
+ * Host overrides via CSS custom properties. Delegation: --mellon-* fallback to MDS-like tokens
463
+ * (--surface-elevated, --text-strong, etc.) so the host can drive look without coupling.
464
+ * Default: white-label minimal TryMellon — neutral with a cool tint (220°), WCAG AA.
465
+ * Theming and accessibility are configurable via WC attributes and host CSS.
466
+ */
467
+ declare const BASE_STYLES: string;
468
+ /** Returns CSSStyleSheet for adoptedStyleSheets when supported; null otherwise (use <style> + textContent). */
469
+ declare function createConstructableStylesheet(): CSSStyleSheet | null;
470
+ /** Returns CSS string for <style> textContent (fallback). */
471
+ declare function getStylesFallback(): string;
472
+
473
+ /**
474
+ * Centralized constants for the infra layer (event bridge).
475
+ * CustomEvent names for core → host communication.
476
+ */
477
+ /** Event name when modal opens (WC lifecycle). */
478
+ declare const MELLON_OPEN = "mellon:open";
479
+ /** Event name when button/host requests modal open. bubbles: true, composed: true; detail empty or minimal. */
480
+ declare const MELLON_OPEN_REQUEST = "mellon:open-request";
481
+ /** Event name when modal closes (WC lifecycle). */
482
+ declare const MELLON_CLOSE = "mellon:close";
483
+ /** Event name when auth completes (core → host). bubbles: false, composed: true; listener on WC element. */
484
+ declare const MELLON_SUCCESS = "mellon:success";
485
+ /** Event name when auth fails (core → host). bubbles: true, composed: true. */
486
+ declare const MELLON_ERROR = "mellon:error";
487
+ /** Event name when ceremony starts (core → host). */
488
+ declare const MELLON_START = "mellon:start";
489
+ /** Event name when ceremony is cancelled (host close or reset from AUTHENTICATING). bubbles: true, composed: true. */
490
+ declare const MELLON_CANCELLED = "mellon:cancelled";
491
+ /** Fired on fallback UI click inside WC (no external navigation). */
492
+ declare const MELLON_FALLBACK = "mellon:fallback";
493
+ /** Event name when tab changes (register ↔ login) in the modal. */
494
+ declare const MELLON_TAB_CHANGE = "mellon:tab-change";
495
+
496
+ /**
497
+ * Event bridge: Core EventEmitter → DOM CustomEvents on the WC host element.
498
+ * Token only in mellon:success; bubbles:false, composed:true. At most once success per ceremony; no error after success.
499
+ * Payload as unknown; narrow with type guards to port types. P1-B: nonce in detail when present; no public API to dispatch success with arbitrary detail.
500
+ * Constants: infra/constants.ts.
501
+ */
502
+
503
+ /** Event-bridge adapter: CoreEventsPort (core → CustomEvents on host). */
504
+ declare const eventBridgeAdapter: CoreEventsPort;
505
+
506
+ /** @trymellon/js/ui — Web Component entry. */
507
+
508
+ declare const UI_VERSION = "0.1.0";
509
+ /** Canonical tag: button + internal modal (Option A) or trigger only (Option B with trigger-only). */
510
+ declare const TRYMELLON_AUTH_TAG = "trymellon-auth";
511
+ /** Modal tag; used internally by <trymellon-auth> (Option A) or by host (Option B). */
512
+ declare const TRYMELLON_AUTH_MODAL_TAG = "trymellon-auth-modal";
513
+
514
+ export { BASE_STYLES, type CoreEventsPort, type CoreWithEvents, type EnvResolvedPayload, type FSMEvent, INITIAL_UI_STATE, MELLON_CANCELLED, MELLON_CLOSE, MELLON_ERROR, MELLON_FALLBACK, MELLON_OPEN, MELLON_OPEN_REQUEST, MELLON_START, MELLON_SUCCESS, MELLON_TAB_CHANGE, type MellonCloseDetail, type MellonErrorDetail, type MellonFallbackDetail, type MellonOpenDetail, type MellonOperationDetail, type MellonSuccessDetail, type ParsedAttributes, type RenderOptions, TRYMELLON_AUTH_MODAL_TAG, TRYMELLON_AUTH_TAG, type TabKind, type ThemeKind, TryMellonAuthElement, TryMellonAuthModalElement, type UIMode, type UIState, UI_VERSION, createConstructableStylesheet, eventBridgeAdapter, getNextState, getStylesFallback };