@cloudlet/toast 0.0.0-stage → 1.0.0-rc.3
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.
- package/CHANGELOG.md +236 -0
- package/LICENSE +21 -0
- package/README.md +64 -2
- package/THIRD_PARTY_NOTICES.md +149 -0
- package/dist/contracts/controller.d.ts +71 -0
- package/dist/contracts/controller.d.ts.map +1 -0
- package/dist/contracts/events.d.ts +72 -0
- package/dist/contracts/events.d.ts.map +1 -0
- package/dist/contracts/identity.d.ts +32 -0
- package/dist/contracts/identity.d.ts.map +1 -0
- package/dist/contracts/internal.d.ts +188 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/notifications.d.ts +101 -0
- package/dist/contracts/notifications.d.ts.map +1 -0
- package/dist/contracts/operations.d.ts +76 -0
- package/dist/contracts/operations.d.ts.map +1 -0
- package/dist/contracts/snapshots.d.ts +48 -0
- package/dist/contracts/snapshots.d.ts.map +1 -0
- package/dist/core/controller.d.ts +7 -0
- package/dist/core/controller.d.ts.map +1 -0
- package/dist/core/controller.js +954 -0
- package/dist/core/controller.js.map +1 -0
- package/dist/core/validation.d.ts +17 -0
- package/dist/core/validation.d.ts.map +1 -0
- package/dist/core/validation.js +298 -0
- package/dist/core/validation.js.map +1 -0
- package/dist/create-cloudlet.d.ts +5 -0
- package/dist/create-cloudlet.d.ts.map +1 -0
- package/dist/create-cloudlet.js +34 -0
- package/dist/create-cloudlet.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/react/announcer.d.ts +15 -0
- package/dist/react/announcer.d.ts.map +1 -0
- package/dist/react/announcer.js +134 -0
- package/dist/react/announcer.js.map +1 -0
- package/dist/react/bindings.d.ts +8 -0
- package/dist/react/bindings.d.ts.map +1 -0
- package/dist/react/bindings.js +84 -0
- package/dist/react/bindings.js.map +1 -0
- package/dist/react/card.d.ts +58 -0
- package/dist/react/card.d.ts.map +1 -0
- package/dist/react/card.js +300 -0
- package/dist/react/card.js.map +1 -0
- package/dist/react/generators.d.ts +46 -0
- package/dist/react/generators.d.ts.map +1 -0
- package/dist/react/generators.js +115 -0
- package/dist/react/generators.js.map +1 -0
- package/dist/react/gestures.d.ts +50 -0
- package/dist/react/gestures.d.ts.map +1 -0
- package/dist/react/gestures.js +239 -0
- package/dist/react/gestures.js.map +1 -0
- package/dist/react/host.d.ts +37 -0
- package/dist/react/host.d.ts.map +1 -0
- package/dist/react/host.js +816 -0
- package/dist/react/host.js.map +1 -0
- package/dist/react/motion.d.ts +206 -0
- package/dist/react/motion.d.ts.map +1 -0
- package/dist/react/motion.js +414 -0
- package/dist/react/motion.js.map +1 -0
- package/dist/react/plan.d.ts +45 -0
- package/dist/react/plan.d.ts.map +1 -0
- package/dist/react/plan.js +58 -0
- package/dist/react/plan.js.map +1 -0
- package/dist/react/shape.d.ts +7 -0
- package/dist/react/shape.d.ts.map +1 -0
- package/dist/react/shape.js +21 -0
- package/dist/react/shape.js.map +1 -0
- package/dist/react/viewport.d.ts +15 -0
- package/dist/react/viewport.d.ts.map +1 -0
- package/dist/react/viewport.js +16 -0
- package/dist/react/viewport.js.map +1 -0
- package/dist/react.d.ts +176 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +2 -0
- package/dist/styles.css +1 -0
- package/package.json +17 -4
- package/src/contracts/controller.ts +61 -0
- package/src/contracts/events.ts +47 -0
- package/src/contracts/identity.ts +27 -0
- package/src/contracts/internal.ts +150 -0
- package/src/contracts/notifications.ts +104 -0
- package/src/contracts/operations.ts +71 -0
- package/src/contracts/snapshots.ts +59 -0
- package/src/core/controller.ts +1038 -0
- package/src/core/validation.ts +290 -0
- package/src/create-cloudlet.ts +43 -0
- package/src/index.ts +34 -0
- package/src/react/announcer.ts +189 -0
- package/src/react/bindings.tsx +100 -0
- package/src/react/card.tsx +222 -0
- package/src/react/generators.ts +274 -0
- package/src/react/gestures.ts +296 -0
- package/src/react/host.tsx +947 -0
- package/src/react/motion.ts +484 -0
- package/src/react/plan.ts +101 -0
- package/src/react/shape.ts +33 -0
- package/src/react/viewport.ts +10 -0
- package/src/react.ts +190 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.js","names":["ATTENTION_DELAY","freeze","handles","bridges","nextController","EMPTY","COLLAPSED","SERVER","RENDERER_SERVER","IDLE","APPLIED","UNCHANGED","reject","getRendererBridge","bridge","controller","createCloudletCore","options","validateOptions","inputOptions","dependencies","clock","identity","records","listeners","eventListeners","operationSubscriptions","globalPauses","batches","focused","focusRequest","lease","lastLease","serial","autoId","revision","eventSequence","island","presented","hostDelay","hostAutoDismiss","attention","cancelAttention","attentionEpoch","overflow","overflowAnnounced","disposed","delivering","cancelTimer","timerEpoch","snapshot","rendererSnapshot","token","stackOrder","newest","retryable","operation","record","requiresAction","wantsAttention","rule","interacting","pauses","current","handleError","handle","leaseError","value","currentError","withRecord","args","error","action","withCurrent","withOperation","expected","diagnostic","diagnosticValue","failure","source","notifyListeners","listener","set","enqueue","notify","delivery","deliveries","event","release","at","final","batch","settle","now","stopTimer","schedule","deadline","active","epoch","due","commit","publish","notifications","present","armAttention","mutate","apply","assign","retire","next","stopAttention","nominate","candidate","autoDismissing","host","setHostAutoDismiss","changed","budget","remove","order","index","onClose","notice","dismiss","reason","acknowledgeOverflow","subscribe","admit","issues","validateSpec","spec","insert","existing","occurrences","overflowValue","id","copyContent","initialize","emit","replaceContent","content","kind","track","factory","sourceThen","validateTrackOptions","input","field","key","cancelValue","cancelCallback","classifierValue","classifier","config","subscribers","notification","attached","snapshotValue","attemptNumber","createAttempt","cancellation","context","resolve","fail","result","fulfill","rejectResult","attempt","finish","first","getSnapshot","live","binding","run","deliver","initialStatus","status","fallback","mapper","mapped","validateContent","uiApplied","requestCancellation","patchContent","cancellationReason","cancel","start","restart","previous","admission","admitted","unsubscribe","validatePatch","patch","priority","durationChanged","previousBudget","nextBudget","count","target","copied","validHostOptions","validDelay","withLease","hostOptions","nextLease","change","presentation","focusToken","outcome","acknowledgeAnnouncements","acknowledgements","actionToken","failed","message","report","acks","changes","validCount","maximum","ack"],"sources":["../../src/core/controller.ts"],"sourcesContent":["import type { CloudletController, ControllerOptions, FocusTarget } from '../contracts/controller.js';\nimport type { Diagnostic, EventBase, SemanticEvent } from '../contracts/events.js';\nimport type { ActionAttemptToken, ControllerIdentity, Generation, HandleRejection, NotificationHandle, OperationAttemptToken, Unsubscribe } from '../contracts/identity.js';\nimport type {\n AnnouncementAcknowledgement, BridgeRejection, BridgeResult, FocusRequest, FocusRequestToken,\n ControllerDependencies, HostLease, HostOptions, OperationAnnouncementPhase, PauseChange, PresentationToken, RendererBridge,\n RendererSnapshot,\n} from '../contracts/internal.js';\nimport type { AdmissionResult, CloseReason, NotificationContent, NotificationKind, NotificationPatch, NotificationSpec, OperationAdmissionResult, Priority } from '../contracts/notifications.js';\nimport type { AttemptStartResult, CancellationSignal, CancelResult, OperationAttempt, OperationContext, OperationHandle, OperationSnapshot, OperationSource, OperationStatus, TrackOptions } from '../contracts/operations.js';\nimport type { ActionSnapshot, ControllerSnapshot, IslandReason, IslandSnapshot, PauseReason } from '../contracts/snapshots.js';\nimport { copyContent, patchContent, validDelay, validateContent, validateOptions, validatePatch, validateSpec, validateTrackOptions } from './validation.js';\n\ninterface OperationBinding {\n readonly getSnapshot: () => OperationSnapshot;\n readonly retry: () => AttemptStartResult<unknown>;\n readonly cancel: (reason?: unknown) => CancelResult;\n readonly detach: () => Delivery;\n}\n\ntype EventPayload = SemanticEvent extends infer E ? E extends SemanticEvent ? Omit<E, keyof EventBase> : never : never;\ntype Delivery = EventPayload | { readonly callback: () => void; readonly source: string; readonly handle?: NotificationHandle };\n\ninterface RecordState<Slot> {\n readonly handle: NotificationHandle;\n readonly dedupeKey: string | undefined;\n readonly onClose: NotificationSpec<Slot>['onClose'];\n content: Readonly<NotificationContent<Slot>>;\n kind: NotificationKind;\n priority: Priority;\n occurrences: number;\n remaining: number | null;\n activeSince: number | null;\n presentation: PresentationToken | null;\n readable: boolean;\n everPresented: boolean;\n readonly pauses: Set<PauseReason>;\n queuedAnnounced: boolean;\n firstAnnounced: boolean;\n occurrencesAnnounced: number;\n operation: OperationBinding | null;\n readonly operationAnnounced: Set<OperationAnnouncementPhase>;\n action: ActionSnapshot;\n actionAnnounced?: { readonly token: ActionAttemptToken; readonly status: 'pending' | 'failed' };\n}\n\n/** Open Island state; `null` is the collapsed stack. */\ninterface IslandState<Slot> {\n readonly reason: IslandReason;\n current: RecordState<Slot>;\n}\n\ninterface AttentionCandidate<Slot> {\n readonly record: RecordState<Slot>;\n due: number;\n /** Expired during user interaction or without a host; restarts the delay afterwards. */\n waiting: boolean;\n}\n\nconst ATTENTION_DELAY = 600;\n\nconst freeze = Object.freeze;\n\n// Weak registries authenticate capabilities without retaining disposed controllers.\nconst handles = new WeakSet<object>();\nconst bridges = new WeakMap<object, RendererBridge<unknown>>();\nlet nextController = 0;\nconst EMPTY: readonly never[] = freeze([]);\nconst COLLAPSED: IslandSnapshot = freeze({ open: false, reason: null, current: null });\nconst SERVER: ControllerSnapshot<never> = freeze({\n controller: null, revision: 0, disposed: false, notifications: EMPTY, stack: EMPTY,\n island: COLLAPSED, overflow: freeze({ count: 0, pending: false }),\n});\nconst RENDERER_SERVER: RendererSnapshot<never> = freeze({\n ...SERVER, presentation: null, focusRequest: null,\n announcements: freeze({ notifications: EMPTY, overflowCount: 0 }),\n});\nconst IDLE = freeze({ status: 'idle' as const });\nconst APPLIED = freeze({ status: 'applied' as const });\nconst UNCHANGED = freeze({ status: 'unchanged' as const });\nconst reject = <Reason extends string>(reason: Reason) => ({ status: 'rejected' as const, reason });\n\nexport function getRendererBridge<Slot, Signal extends CancellationSignal>(controller: CloudletController<Slot, Signal>): RendererBridge<Slot> {\n const bridge = bridges.get(controller);\n if (!bridge) throw new TypeError('Controller was not created by this Cloudlet package instance');\n // The registry stores the bridge together with its controller's opaque Slot type.\n return bridge as RendererBridge<Slot>;\n}\n\n/** The sole owner of notification state, the stack/Island, budgets, attention and host leases. */\nexport function createCloudletCore<Slot = never, Signal extends CancellationSignal = CancellationSignal>(\n inputOptions: ControllerOptions | undefined,\n dependencies: ControllerDependencies<Signal>,\n): CloudletController<Slot, Signal> {\n const options = validateOptions(inputOptions);\n if (!dependencies?.clock || typeof dependencies.clock.now !== 'function' || typeof dependencies.clock.schedule !== 'function') {\n throw new TypeError('Cloudlet requires a monotonic clock');\n }\n const clock = dependencies.clock;\n if (typeof dependencies.createCancellation !== 'function') throw new TypeError('Cloudlet requires a cancellation source factory');\n const identity = `cloudlet-${++nextController}` as ControllerIdentity;\n const records = new Map<string, RecordState<Slot>>();\n const listeners = new Set<() => void>();\n const eventListeners = new Set<(event: SemanticEvent) => void>();\n const operationSubscriptions = new Map<Set<() => void>, Delivery>();\n const globalPauses = new Set<PauseReason>();\n const batches: (() => void)[] = [];\n let focused: NotificationHandle | null = null;\n let focusRequest: FocusRequest | null = null;\n let lease: HostLease | null = null;\n let lastLease: HostLease | null = null;\n let serial = 0;\n let autoId = 0;\n let revision = 0;\n let eventSequence = 0;\n let island: IslandState<Slot> | null = null;\n // The presented record: Island current when open, otherwise the newest record.\n let presented: RecordState<Slot> | null = null;\n let hostDelay: number | undefined;\n /** `Toaster autoDismiss`: overrides ControllerOptions.autoDismiss while defined and attached. */\n let hostAutoDismiss: boolean | undefined;\n let attention: AttentionCandidate<Slot> | null = null;\n let cancelAttention: Unsubscribe | null = null;\n let attentionEpoch = 0;\n let overflow = 0;\n let overflowAnnounced = 0;\n let disposed = false;\n let delivering = false;\n let cancelTimer: Unsubscribe | null = null;\n let timerEpoch = 0;\n let snapshot: ControllerSnapshot<Slot>;\n let rendererSnapshot: RendererSnapshot<Slot>;\n\n const token = () => `${identity}:${++serial}`;\n // Map insertion order is admission order; the stack shows newest first.\n const stackOrder = () => [...records.values()].reverse();\n const newest = (): RecordState<Slot> | null => stackOrder()[0] ?? null;\n // A settled factory can always retry; only an unsuccessful attempt offers retry as an action.\n const retryable = (record: RecordState<Slot>) => {\n const operation = record.operation?.getSnapshot();\n return !!operation?.canRetry && operation.status !== 'fulfilled';\n };\n const requiresAction = (record: RecordState<Slot>) => !!record.content.action\n || retryable(record) || record.content.attention === 'open';\n const wantsAttention = (record: RecordState<Slot>) => {\n const rule = record.content.attention ?? 'auto';\n return rule === 'open' || (rule === 'auto' && (requiresAction(record) || !!record.content.description));\n };\n const interacting = () => globalPauses.has('hover') || globalPauses.has('focus')\n || [...records.values()].some((record) => record.pauses.has('gesture'));\n const pauses = (record: RecordState<Slot>): PauseReason[] => {\n const current = record === presented;\n return [\n ...(!current ? ['inactive' as const] : []),\n ...(lease === null ? ['no-host' as const] : []),\n ...(current && !record.readable ? ['presentation-pending' as const] : []),\n // An Island opened by the user, or a slide that asks for action, keeps its time.\n ...(current && island && (island.reason === 'user' || requiresAction(record)) ? ['island' as const] : []),\n ...(record.action.status === 'pending' ? ['action-pending' as const] : []),\n ...globalPauses, ...record.pauses,\n ];\n };\n const handleError = (handle: NotificationHandle): HandleRejection | 'disposed' | undefined => {\n if (disposed) return 'disposed';\n if (typeof handle !== 'object' || handle === null || !handles.has(handle)) return 'invalid-handle';\n if (handle.controller !== identity) return 'foreign-controller';\n if (records.get(handle.id)?.handle !== handle) return 'stale-handle';\n return undefined;\n };\n const leaseError = (value: HostLease): 'disposed' | 'stale-lease' | undefined =>\n disposed ? 'disposed' : lease === null || value !== lease ? 'stale-lease' : undefined;\n const currentError = (handle: NotificationHandle): BridgeRejection | undefined =>\n handleError(handle) ?? (records.get(handle.id) !== presented ? 'not-current' : undefined);\n\n // Capability validation always precedes method-specific validation/mutation.\n function withRecord<Args extends unknown[], Result>(action: (record: RecordState<Slot>, ...args: Args) => Result) {\n return (handle: NotificationHandle, ...args: Args) => {\n const error = handleError(handle);\n return error ? reject(error) : action(records.get(handle.id)!, ...args);\n };\n }\n function withCurrent<Args extends unknown[], Result>(action: (record: RecordState<Slot>, ...args: Args) => Result) {\n return withRecord((record, ...args: Args) => record !== presented ? reject('not-current') : action(record, ...args));\n }\n function withOperation<Args extends unknown[], Result>(action: (operation: OperationBinding, ...args: Args) => Result) {\n return withRecord((record, expected: OperationAttemptToken, ...args: Args) => {\n const operation = record.operation;\n return !operation ? reject('no-operation') : operation.getSnapshot().token !== expected\n ? reject('stale-operation-token') : action(operation, ...args);\n });\n }\n\n function diagnostic(diagnosticValue: Diagnostic): void {\n const value = freeze({ ...diagnosticValue });\n enqueue([{ type: 'diagnostic', diagnostic: value }]);\n }\n function failure(code: Diagnostic['code'], source: string, error: unknown, handle?: NotificationHandle): void {\n diagnostic({ code, source, message: `${source} failed`, error, ...(handle ? { handle } : {}) });\n }\n function notifyListeners(set: Set<() => void>, source: string): void {\n for (const listener of [...set]) {\n if (!set.has(listener)) continue;\n try { listener(); } catch (error) {\n failure('listener-error', source, error);\n }\n }\n }\n function enqueue(deliveries: readonly Delivery[], notify = false, at = clock.now(), final = false, release = false): void {\n batches.push(() => {\n if (notify) notifyListeners(listeners, 'subscribe');\n for (const delivery of deliveries) {\n if ('callback' in delivery) {\n try { delivery.callback(); } catch (error) {\n failure('callback-error', delivery.source, error, delivery.handle);\n }\n continue;\n }\n const event: SemanticEvent = freeze({ ...delivery, controller: identity, sequence: ++eventSequence,\n at: release ? clock.now() : at });\n for (const listener of [...eventListeners]) {\n if (!eventListeners.has(listener)) continue;\n try { listener(event); } catch (error) {\n if (event.type !== 'diagnostic') failure('listener-error', 'onEvent', error);\n }\n }\n if (event.type === 'diagnostic') {\n try { options.onDiagnostic?.(event.diagnostic); } catch { /* No recursive diagnostics. */ }\n }\n }\n // Close-callback diagnostics are queued before disposal releases observers.\n if (final) enqueue([{ type: 'disposed' }], false, at, false, true);\n if (release) {\n listeners.clear(); eventListeners.clear();\n for (const set of operationSubscriptions.keys()) set.clear();\n operationSubscriptions.clear();\n }\n });\n if (delivering) return;\n delivering = true;\n try {\n let batch: (() => void) | undefined;\n while ((batch = batches.shift())) batch();\n } finally { delivering = false; }\n }\n function settle(): number {\n const now = clock.now();\n for (const record of records.values()) {\n if (record.activeSince !== null && record.remaining !== null) {\n record.remaining = Math.max(0, record.remaining - Math.max(0, now - record.activeSince));\n record.activeSince = now;\n }\n }\n return now;\n }\n function stopTimer(): void {\n ++timerEpoch;\n cancelTimer?.();\n cancelTimer = null;\n }\n function schedule(now: number): void {\n stopTimer();\n let deadline = Infinity;\n for (const record of records.values()) {\n const active = record.remaining !== null && pauses(record).length === 0 && !disposed;\n record.activeSince = active ? now : null;\n if (active) deadline = Math.min(deadline, now + record.remaining!);\n }\n if (!Number.isFinite(deadline)) return;\n const epoch = timerEpoch;\n cancelTimer = clock.schedule(deadline, () => {\n if (disposed || epoch !== timerEpoch) return;\n const at = settle();\n const due = [...records.values()].filter((record) => record.activeSince !== null && record.remaining === 0);\n const deliveries: Delivery[] = [];\n for (const record of due) remove(record, 'timeout', deliveries);\n // An early delivery only rearms; a late delivery closes exactly the due generations.\n if (due.length) commit(deliveries, at);\n else schedule(at);\n });\n }\n function publish(): void {\n const current = [...records.values()];\n const notifications = freeze(current.map((record) => freeze({\n handle: record.handle, kind: record.kind, content: record.content, priority: record.priority,\n occurrences: record.occurrences, location: record === presented ? 'current' as const : 'stack' as const,\n remainingMs: record.remaining, pauseReasons: freeze(pauses(record)), operation: record.operation?.getSnapshot() ?? null, action: record.action,\n })));\n snapshot = freeze({ controller: identity, revision, disposed, notifications,\n stack: freeze(stackOrder().map((record) => record.handle)),\n island: island ? freeze({ open: true, reason: island.reason, current: island.current.handle }) : COLLAPSED,\n overflow: freeze({ count: overflow, pending: overflow > 0 }),\n });\n rendererSnapshot = freeze({ ...snapshot,\n presentation: presented ? freeze({ handle: presented.handle, token: presented.presentation, readable: presented.readable }) : null,\n focusRequest,\n announcements: freeze({ overflowCount: overflowAnnounced,\n notifications: freeze(current.map((record) => freeze({\n handle: record.handle, queued: record.queuedAnnounced, firstPresentation: record.firstAnnounced,\n occurrences: record.occurrencesAnnounced, action: record.actionAnnounced ?? null, operation: record.operation ? freeze({\n token: record.operation.getSnapshot().token, phases: freeze([...record.operationAnnounced]),\n }) : null,\n }))),\n }),\n });\n }\n function commit(deliveries: readonly Delivery[] = [], now = clock.now(), final = false): void {\n present();\n schedule(now);\n armAttention(now);\n ++revision;\n publish();\n enqueue(deliveries, true, now, final);\n }\n // Every state mutation settles the old budget, publishes once, then delivers.\n // The presented record is derived inside that transaction, before subscribers can reenter.\n function mutate(apply: (deliveries: Delivery[]) => void, final = false) {\n const now = settle();\n const deliveries: Delivery[] = [];\n apply(deliveries);\n commit(deliveries, now, final);\n return APPLIED;\n }\n function assign(record: RecordState<Slot>): void {\n record.readable = false;\n record.presentation = lease === null ? null : token() as PresentationToken;\n }\n function retire(record: RecordState<Slot>): void {\n record.presentation = null;\n record.readable = false;\n record.pauses.clear();\n if (focused === record.handle) focused = null;\n if (focusRequest?.target.kind === 'notification' && focusRequest.target.handle === record.handle) focusRequest = null;\n }\n /** A change of the presented record mints a new presentation token; its predecessor keeps its budget. */\n function present(): void {\n const next = island ? island.current : newest();\n if (next === presented) return;\n if (presented) retire(presented);\n presented = next;\n if (next) assign(next);\n }\n function stopAttention(): void {\n ++attentionEpoch;\n cancelAttention?.();\n cancelAttention = null;\n }\n /** Newest candidate wins: a new nomination replaces the pending one. */\n function nominate(record: RecordState<Slot>, now: number): void {\n if (wantsAttention(record)) attention = { record, due: now + (hostDelay ?? options.attentionDelay ?? ATTENTION_DELAY), waiting: false };\n }\n function armAttention(now: number): void {\n stopAttention();\n const candidate = attention;\n if (!candidate || disposed) return;\n // Without a host nothing has landed yet: wait without allocating a timer.\n if (lease === null) { candidate.waiting = true; return; }\n if (candidate.waiting) {\n if (interacting()) return;\n candidate.waiting = false;\n candidate.due = now + (hostDelay ?? options.attentionDelay ?? ATTENTION_DELAY);\n }\n const epoch = attentionEpoch;\n cancelAttention = clock.schedule(candidate.due, () => {\n if (disposed || epoch !== attentionEpoch || attention !== candidate) return;\n const at = clock.now();\n if (at < candidate.due) { armAttention(at); return; }\n cancelAttention = null;\n // Expiry during hover/focus/gesture waits; the next release restarts the delay.\n if (interacting()) { candidate.waiting = true; return; }\n attention = null;\n const record = candidate.record;\n if (!wantsAttention(record) || island?.current === record) return;\n mutate(() => {\n if (island) island.current = record;\n else island = { reason: 'attention', current: record };\n });\n });\n }\n const autoDismissing = (host: boolean | undefined) => (host ?? options.autoDismiss) !== false;\n /** Off stops every budget; on starts each one in full. */\n function setHostAutoDismiss(value: boolean | undefined): void {\n const changed = autoDismissing(value) !== autoDismissing(hostAutoDismiss);\n hostAutoDismiss = value;\n if (!changed) return;\n for (const record of records.values()) record.remaining = budget(record);\n }\n function budget(record: RecordState<Slot>): number | null {\n if (!autoDismissing(hostAutoDismiss)) return null;\n if (record.content.duration !== undefined) return record.content.duration;\n return (record.kind === 'info' || record.kind === 'success') && !record.content.action ? 6000 : null;\n }\n function remove(record: RecordState<Slot>, reason: CloseReason, deliveries: Delivery[]): void {\n if (island?.current === record) {\n // The next older slide, else the next newer one, else the Island closes.\n const order = stackOrder();\n const index = order.indexOf(record);\n const next = order[index + 1] ?? order[index - 1];\n if (next) island.current = next; else island = null;\n }\n if (attention?.record === record) attention = null;\n records.delete(record.handle.id);\n if (record.operation) deliveries.push(record.operation.detach());\n deliveries.push({ type: 'closed', handle: record.handle, reason });\n if (record.onClose) {\n const onClose = record.onClose;\n const notice = freeze({ handle: record.handle, reason });\n deliveries.push({ callback: () => onClose(notice), source: 'onClose', handle: record.handle });\n }\n }\n const dismiss = withRecord((record, reason: CloseReason) =>\n mutate((deliveries) => remove(record, reason, deliveries)));\n function acknowledgeOverflow() {\n if (disposed) return reject('disposed');\n if (!overflow) return UNCHANGED;\n return mutate((deliveries) => {\n deliveries.push({ type: 'overflow-acknowledged', count: overflow });\n overflow = overflowAnnounced = 0;\n if (focusRequest?.target.kind === 'overflow') focusRequest = null;\n });\n }\n function subscribe<T>(set: Set<T>, listener: T): Unsubscribe {\n if (typeof listener !== 'function') throw new TypeError('Listener must be a function');\n if (disposed) return () => {};\n set.add(listener);\n return () => { set.delete(listener); };\n }\n function admit(spec: NotificationSpec<Slot>): AdmissionResult {\n if (disposed) return reject('disposed');\n const issues = validateSpec(spec);\n if (issues.length) {\n diagnostic({ code: 'invalid-input', source: 'show', message: 'Invalid notification specification' });\n return { ...reject('invalid-input'), issues };\n }\n return insert(spec);\n }\n function insert(spec: NotificationSpec<Slot>, initialize?: (record: RecordState<Slot>) => void): AdmissionResult {\n if (spec.id !== undefined && records.has(spec.id)) return reject('id-conflict');\n const existing = spec.dedupeKey === undefined ? undefined : [...records.values()].find((record) => record.dedupeKey === spec.dedupeKey);\n if (existing) {\n let occurrences = existing.occurrences;\n mutate((deliveries) => {\n occurrences = existing.occurrences = Math.min(Number.MAX_SAFE_INTEGER, occurrences + 1);\n deliveries.push({ type: 'deduplicated', handle: existing.handle, occurrences });\n });\n return { status: 'deduplicated', handle: existing.handle, occurrences };\n }\n if (records.size >= 100) {\n mutate((deliveries) => {\n overflow = Math.min(Number.MAX_SAFE_INTEGER, overflow + 1);\n const overflowValue = freeze({ count: overflow, pending: true });\n deliveries.push({ type: 'overflow', count: overflow });\n if (options.onOverflow) deliveries.push({ callback: () => options.onOverflow!(overflowValue), source: 'onOverflow' });\n });\n return reject('capacity');\n }\n const now = settle();\n let id = spec.id;\n if (id === undefined) { do { id = `${identity}:notification-${++autoId}`; } while (records.has(id)); }\n const handle = freeze({ id, controller: identity, generation: token() as Generation }) as NotificationHandle;\n handles.add(handle);\n const record: RecordState<Slot> = {\n handle: handle,\n dedupeKey: spec.dedupeKey,\n onClose: spec.onClose,\n content: copyContent(spec),\n kind: spec.kind ?? 'info',\n priority: spec.priority ?? 'normal',\n occurrences: 1,\n remaining: null,\n activeSince: null,\n presentation: null,\n readable: false,\n everPresented: false,\n pauses: new Set(),\n queuedAnnounced: false,\n firstAnnounced: false,\n occurrencesAnnounced: 0,\n operation: null,\n operationAnnounced: new Set(),\n action: IDLE,\n };\n record.remaining = budget(record);\n records.set(id, record);\n initialize?.(record);\n nominate(record, now);\n const deliveries: Delivery[] = [{ type: 'admitted', handle }];\n if (record.operation) {\n const operation = record.operation.getSnapshot();\n deliveries.push({ type: 'operation-started', handle, token: operation.token, attempt: operation.attempt });\n }\n commit(deliveries, now);\n return { status: 'created', handle };\n }\n function emit(deliveries: readonly Delivery[]): void {\n if (disposed) return;\n enqueue(deliveries);\n }\n function replaceContent(record: RecordState<Slot>, content: Readonly<NotificationContent<Slot>>, kind: NotificationKind): void {\n record.content = content;\n record.kind = kind;\n record.remaining = kind === 'loading' ? null : budget(record);\n // A replacement owns a new action context; old completions cannot close it.\n record.action = IDLE;\n if (record === presented) assign(record);\n // A runner phase (terminal result or new attempt) is evaluated like an admission.\n nominate(record, clock.now());\n if (focusRequest?.target.kind === 'notification' && focusRequest.target.handle === record.handle &&\n focusRequest.target.control === 'action' && !content.action) focusRequest = null;\n }\n function track<T>(source: OperationSource<T, Signal>, input: TrackOptions<T, Slot, Signal>): OperationHandle<T> {\n const factory = typeof source === 'function' ? source : null;\n let sourceThen: PromiseLike<T>['then'] | undefined;\n if (!factory && (source === null || typeof source !== 'object' || typeof (sourceThen = source.then) !== 'function')) {\n throw new TypeError('Operation source must be a factory or thenable');\n }\n const issues = validateTrackOptions(input, factory !== null);\n // Invalid presentation options cannot suppress a valid business source. Read\n // only data properties here; validation never executes option accessors.\n const field = (key: keyof TrackOptions<T, Slot, Signal>): unknown => input && typeof input === 'object'\n ? Object.getOwnPropertyDescriptor(input, key)?.value : undefined;\n const cancelValue = field('cancel');\n const cancelCallback = !factory && typeof cancelValue === 'function' ? cancelValue as (reason: unknown) => void : null;\n const classifierValue = field('isCancellation');\n const classifier = typeof classifierValue === 'function' ? classifierValue as NonNullable<TrackOptions<T, Slot, Signal>['isCancellation']> : null;\n const config = issues.length ? null : freeze({ ...input,\n pending: copyContent(input.pending),\n success: typeof input.success === 'function' ? input.success : copyContent(input.success),\n error: typeof input.error === 'function' ? input.error : copyContent(input.error),\n ...(input.cancelled === undefined ? {} : { cancelled: typeof input.cancelled === 'function' ? input.cancelled : copyContent(input.cancelled) }),\n });\n const subscribers = new Set<() => void>();\n let notification: NotificationHandle | null = null;\n let attached = false;\n let snapshotValue: OperationSnapshot;\n let attemptNumber = 0;\n type Attempt = {\n readonly public: OperationAttempt<T>;\n readonly context: OperationContext<Signal>;\n readonly abort: (reason?: unknown) => void;\n readonly resolve: (value: T | PromiseLike<T>) => void;\n readonly reject: (reason: unknown) => void;\n status: OperationStatus;\n cancelRequested: boolean;\n };\n function createAttempt(): Attempt {\n const cancellation = dependencies.createCancellation();\n const context = freeze({ signal: cancellation.signal, token: token() as OperationAttemptToken, attempt: ++attemptNumber });\n let resolve!: Attempt['resolve'];\n let fail!: Attempt['reject'];\n const result = new Promise<T>((fulfill, rejectResult) => { resolve = fulfill; fail = rejectResult; });\n const attempt: Attempt = {\n public: freeze({ token: context.token, attempt: context.attempt, result }), context,\n abort: cancellation.abort, resolve, reject: fail, status: 'pending', cancelRequested: false,\n };\n // Observe both branches without altering the public promise's value/reason.\n // The derived internal chain is handled as well, even if a platform port fails.\n void result.then((value) => finish(attempt, 'fulfilled', value), (error: unknown) => finish(attempt, 'rejected', error))\n .catch((error: unknown) => {\n if (!disposed) failure('callback-error', 'operation-settlement', error);\n });\n return attempt;\n }\n const first = createAttempt();\n let current = first;\n function getSnapshot(): OperationSnapshot {\n const next = {\n token: current.context.token, attempt: current.context.attempt, status: current.status,\n cancelRequested: current.cancelRequested,\n canCancel: !disposed && current.status === 'pending' && !current.cancelRequested && (!!factory || !!cancelCallback),\n canRetry: !disposed && !!factory && current.status !== 'pending',\n notification: attached && !disposed ? notification : null,\n };\n if (!snapshotValue || Object.keys(next).some((key) => next[key as keyof OperationSnapshot] !== snapshotValue[key as keyof OperationSnapshot])) {\n snapshotValue = freeze(next);\n }\n return snapshotValue;\n }\n const notify: Delivery = { source: 'operation.subscribe',\n callback: () => notifyListeners(subscribers, 'operation.subscribe') };\n function live(attempt: Attempt): RecordState<Slot> | undefined {\n if (disposed || current !== attempt || !attached || !notification) return undefined;\n const record = records.get(notification.id);\n return record?.handle === notification && record.operation === binding ? record : undefined;\n }\n function run(attempt: Attempt): void {\n // Validate and assimilate the same then method once, preserving its receiver.\n // Reading a user accessor again could replace the business outcome.\n try { attempt.resolve(factory ? factory(attempt.context) : { then: sourceThen!.bind(source) }); }\n catch (error) { attempt.reject(error); }\n }\n function deliver(deliveries: Delivery[], apply?: () => void): void {\n if (apply) {\n const now = settle();\n apply();\n commit(deliveries, now);\n } else emit(deliveries);\n }\n function finish(attempt: Attempt, initialStatus: 'fulfilled' | 'rejected', value: unknown): void {\n attempt.status = initialStatus;\n if (initialStatus === 'rejected') {\n try {\n const cancelled = classifier ? classifier(value, attempt.context) === true\n : attempt.cancelRequested && value !== null && typeof value === 'object' && 'name' in value && value.name === 'AbortError';\n if (cancelled) attempt.status = 'cancelled';\n } catch (error) {\n if (!disposed) failure('cancellation-error', 'isCancellation', error);\n }\n }\n let content: Readonly<NotificationContent<Slot>> | undefined;\n if (live(attempt) && config) {\n const status = attempt.status;\n const fallback = status === 'fulfilled' ? options.messages?.operationSuccess ?? 'Completed'\n : status === 'cancelled' ? options.messages?.operationCancelled ?? 'Cancelled'\n : options.messages?.operationError ?? 'Something went wrong';\n try {\n const mapper = status === 'fulfilled' ? config.success : status === 'cancelled' ? config.cancelled : config.error;\n const mapped = typeof mapper === 'function' ? mapper(value as T) : mapper ?? { title: fallback };\n if (validateContent(mapped).length) throw new TypeError('Invalid terminal notification content');\n content = copyContent(mapped);\n } catch (error) {\n content = freeze({ title: fallback, announcementPriority: 'polite' });\n if (!disposed) failure('mapper-error', `track.${status}`, error, notification ?? undefined);\n }\n }\n // User mappers, classifiers and diagnostic listeners are reentrant.\n const record = live(attempt);\n const uiApplied = !!record && !!content;\n const deliveries: Delivery[] = [\n ...(current === attempt ? [notify] : []),\n { type: 'operation-settled', handle: notification, token: attempt.context.token, status: attempt.status, uiApplied },\n ];\n deliver(deliveries, record && content ? () => replaceContent(record, content,\n attempt.status === 'fulfilled' ? 'success' : attempt.status === 'cancelled' ? 'warning' : 'error') : undefined);\n }\n function requestCancellation(attempt: Attempt, reason: unknown): void {\n attempt.cancelRequested = true;\n const record = live(attempt);\n const deliveries: Delivery[] = [notify, { type: 'cancellation-requested', handle: notification, token: attempt.context.token }];\n deliver(deliveries, record ? () => {\n record.content = patchContent(record.content, { title: options.messages?.cancellationRequested ?? 'Cancellation requested' });\n } : undefined);\n try {\n attempt.abort(reason);\n cancelCallback?.(reason);\n } catch (error) {\n if (!disposed) failure('cancellation-error', 'cancel', error, notification ?? undefined);\n }\n }\n function cancellationReason(): Error {\n const error = new Error('Cancellation requested');\n error.name = 'AbortError';\n return error;\n }\n function cancel(reason: unknown = cancellationReason()): CancelResult {\n if (disposed) return reject('disposed');\n if (current.status !== 'pending') return { status: 'unchanged', reason: 'settled' };\n if (!factory && !cancelCallback) return reject('not-cancellable');\n if (current.cancelRequested) return { status: 'unchanged', reason: 'already-requested' };\n requestCancellation(current, reason);\n return { status: 'requested' };\n }\n function start(restart: boolean): AttemptStartResult<T> {\n if (disposed) return reject('disposed');\n if (!factory) return reject('not-retryable');\n if (current.status === 'pending' && !restart) return reject('already-pending');\n const previous = current;\n const next = createAttempt();\n current = next; // Invalidate old ownership before any observer or abort callback.\n const record = live(next);\n const deliveries: Delivery[] = [notify, { type: 'operation-started', handle: notification, token: next.context.token, attempt: next.context.attempt }];\n deliver(deliveries, record && config ? () => {\n record.operationAnnounced.clear();\n replaceContent(record, config.pending, 'loading');\n } : undefined);\n if (previous.status === 'pending' && !previous.cancelRequested) requestCancellation(previous, cancellationReason());\n run(next);\n return { status: 'started', attempt: next.public };\n }\n const binding: OperationBinding = {\n getSnapshot, retry: () => start(false), cancel,\n detach: () => { attached = false; return notify; },\n };\n let admission: OperationAdmissionResult;\n if (disposed) admission = reject('disposed');\n else if (!config) {\n admission = { ...reject('invalid-input'), issues };\n diagnostic({ code: 'invalid-input', source: 'track', message: 'Invalid operation options' });\n } else {\n const admitted = insert({ ...config.pending, ...config, kind: 'loading' }, (record) => {\n notification = record.handle;\n attached = true;\n record.operation = binding;\n });\n // No dedupe key can reach this path (validated TrackOptions).\n if (admitted.status === 'deduplicated') throw new Error('Tracked operation cannot be deduplicated');\n admission = admitted;\n }\n if (admission.status === 'rejected') emit([{ type: 'operation-started', handle: null, token: first.context.token, attempt: 1 }]);\n run(first);\n return freeze({ ...first.public, admission: freeze(admission), getSnapshot,\n subscribe(listener: () => void) {\n const unsubscribe = subscribe(subscribers, listener);\n if (subscribers.size) operationSubscriptions.set(subscribers, notify);\n return () => { unsubscribe(); if (!subscribers.size) operationSubscriptions.delete(subscribers); };\n },\n cancel, retry: () => start(false), restart: () => start(true),\n });\n }\n\n const controller = freeze<CloudletController<Slot, Signal>>({\n show: (spec) => admit(spec),\n track,\n update: withRecord((record, patch: NotificationPatch<Slot>) => {\n const handle = record.handle;\n const issues = validatePatch(patch);\n if (issues.length) {\n diagnostic({ code: 'invalid-input', source: 'update', message: 'Invalid notification patch', handle });\n return { ...reject('invalid-input'), issues };\n }\n if (record.action.status === 'pending' && Object.prototype.hasOwnProperty.call(patch, 'action')) return reject('action-pending');\n if (record.operation && (Object.prototype.hasOwnProperty.call(patch, 'kind') ||\n (record.operation.getSnapshot().status === 'pending' && Object.prototype.hasOwnProperty.call(patch, 'duration')))) return reject('operation-owned');\n const content = patchContent(record.content, patch);\n const kind = patch.kind ?? record.kind;\n const priority = patch.priority ?? record.priority;\n const durationChanged = Object.prototype.hasOwnProperty.call(patch, 'duration');\n if (content === record.content && kind === record.kind && priority === record.priority && !durationChanged &&\n !(Object.prototype.hasOwnProperty.call(patch, 'action') && record.action.status === 'failed')) return UNCHANGED;\n return mutate((deliveries) => {\n const previousBudget = budget(record);\n record.content = content;\n if (Object.prototype.hasOwnProperty.call(patch, 'action')) record.action = IDLE;\n record.kind = kind;\n record.priority = priority;\n const nextBudget = budget(record);\n if (durationChanged || previousBudget !== nextBudget) record.remaining = nextBudget;\n if (focusRequest?.target.kind === 'notification' && focusRequest.target.handle === handle && focusRequest.target.control === 'action' && !content.action) focusRequest = null;\n if (attention?.record === record && !wantsAttention(record)) attention = null;\n deliveries.push({ type: 'updated', handle });\n });\n }),\n getHandle: (id) => !disposed && typeof id === 'string' ? records.get(id)?.handle : undefined,\n dismiss: (handle) => dismiss(handle, 'programmatic'),\n clear() {\n if (disposed) return reject('disposed');\n const count = records.size;\n if (!count) return { status: 'cleared', count };\n mutate((deliveries) => {\n for (const record of records.values()) remove(record, 'clear', deliveries);\n });\n return { status: 'cleared', count };\n },\n requestFocus(target: FocusTarget = { kind: 'anchor' }) {\n if (disposed) return reject('disposed');\n if (target?.kind === 'notification') {\n const error = handleError(target.handle);\n if (error) return reject(error);\n }\n if (!lease) return reject('no-host');\n if (!target || !['anchor', 'notification', 'overflow'].includes(target.kind)) return reject('unavailable');\n if (target.kind === 'notification') {\n const record = records.get(target.handle.id)!;\n if (record !== presented) return reject('not-visible');\n if (target.control !== undefined && !['action', 'close'].includes(target.control)) return reject('unavailable');\n if (target.control === 'action' && !record.content.action) return reject('unavailable');\n // Card controls exist only inside the open Island; the collapsed pill has none.\n if (target.control !== undefined && !island) return reject('not-visible');\n }\n if (target.kind === 'overflow' && !overflow) return reject('unavailable');\n mutate(() => {\n const copied: FocusTarget = target.kind === 'notification'\n ? freeze({ kind: target.kind, handle: target.handle, ...(target.control ? { control: target.control } : {}) })\n : freeze({ kind: target.kind });\n focusRequest = freeze({ token: token() as FocusRequestToken, target: copied });\n });\n return { status: 'requested' };\n },\n acknowledgeOverflow,\n getSnapshot: () => snapshot,\n getServerSnapshot: () => SERVER,\n subscribe: (listener) => subscribe(listeners, listener),\n onEvent: (listener) => subscribe(eventListeners, listener),\n dispose() {\n if (disposed) return;\n mutate((deliveries) => {\n disposed = true;\n for (const record of records.values()) remove(record, 'dispose', deliveries);\n // Detached/admission-rejected handles also lose their capabilities.\n for (const notify of operationSubscriptions.values()) if (!deliveries.includes(notify)) deliveries.push(notify);\n lease = lastLease = null;\n island = null;\n attention = null;\n stopAttention();\n focusRequest = null;\n globalPauses.clear();\n overflow = overflowAnnounced = 0;\n }, true);\n },\n });\n\n function validHostOptions(value: HostOptions | undefined): boolean {\n if (value === undefined) return true;\n return value !== null && typeof value === 'object' && Object.keys(value).every((key) => key === 'attentionDelay')\n && (value.attentionDelay === undefined || validDelay(value.attentionDelay));\n }\n // Preserve the bridge's lease-first validation order in one entry guard.\n function withLease<Args extends unknown[], Result>(action: (...args: Args) => Result) {\n return (value: HostLease, ...args: Args) => {\n const error = leaseError(value);\n return error ? reject(error) : action(...args);\n };\n }\n const bridge = freeze<RendererBridge<Slot>>({\n renderError: options.messages?.renderError ?? 'Content unavailable',\n reportInvalidContainer(message, error) {\n if (!disposed) diagnostic({ code: 'invalid-container', source: 'Toaster.container', message, ...(error === undefined ? {} : { error }) });\n },\n attach(hostOptions) {\n if (disposed) return reject('disposed');\n if (lease !== null) {\n diagnostic({ code: 'second-host', source: 'attach', message: 'A renderer is already attached' });\n return reject('host-exists');\n }\n if (!validHostOptions(hostOptions)) return reject('invalid-input');\n const nextLease = token() as HostLease;\n mutate(() => {\n lease = lastLease = nextLease;\n hostDelay = hostOptions?.attentionDelay;\n if (presented) assign(presented);\n });\n return { status: 'attached', lease: nextLease };\n },\n detach(value) {\n if (disposed) return reject('disposed');\n if (lease === null && lastLease !== null && value === lastLease) return UNCHANGED;\n const error = leaseError(value);\n if (error) return reject(error);\n return mutate(() => {\n lease = null;\n hostDelay = undefined;\n setHostAutoDismiss(undefined);\n focusRequest = null;\n focused = null;\n globalPauses.clear();\n for (const record of records.values()) { record.pauses.clear(); record.readable = false; record.presentation = null; }\n });\n },\n getSnapshot: () => rendererSnapshot,\n getServerSnapshot: () => RENDERER_SERVER,\n subscribe: controller.subscribe,\n onEvent: controller.onEvent,\n openIsland: withLease((reason: IslandReason, handle?: NotificationHandle) => {\n if (reason !== 'user' && reason !== 'attention') return reject('invalid-input');\n let record: RecordState<Slot> | null;\n if (handle === undefined) record = newest();\n else {\n const error = handleError(handle);\n if (error) return reject(error);\n record = records.get(handle.id)!;\n }\n if (!record) return reject('empty');\n const target = record;\n if (island?.current === target) return UNCHANGED;\n // An open Island only moves its slider; the opening reason is kept.\n return mutate(() => {\n if (island) island.current = target;\n else island = { reason, current: target };\n });\n }),\n collapseIsland: withLease(() => island ? mutate(() => { island = null; }) : UNCHANGED),\n setAutoDismiss: withLease((value?: boolean) => {\n if (value !== undefined && typeof value !== 'boolean') return reject('invalid-input');\n if (autoDismissing(value) === autoDismissing(hostAutoDismiss)) { hostAutoDismiss = value; return UNCHANGED; }\n return mutate(() => setHostAutoDismiss(value));\n }),\n navigate: withLease(withRecord((record) => {\n if (!island) return reject('island-closed');\n if (island.current === record) return UNCHANGED;\n return mutate(() => {\n island!.current = record;\n // Navigation is interaction (DESIGN §5): a pending auto-open restarts its delay,\n // and reaching the initiator by hand fulfils it.\n if (attention?.record === record) attention = null;\n else if (attention) { attention.waiting = false; attention.due = clock.now() + (hostDelay ?? options.attentionDelay ?? ATTENTION_DELAY); }\n });\n })),\n setPause: withLease((change: PauseChange) => {\n if (!change || typeof change.active !== 'boolean') return reject('invalid-input');\n let set: Set<PauseReason>;\n if (change.scope === 'host') {\n if (!['hover', 'focus', 'document-hidden', 'window-blur'].includes(change.reason)) return reject('invalid-input');\n set = globalPauses;\n } else if (change.scope === 'notification') {\n const error = currentError(change.handle);\n if (error) return reject(error);\n if (!['gesture', 'content-transition'].includes(change.reason)) return reject('invalid-input');\n set = records.get(change.handle.id)!.pauses;\n } else return reject('invalid-input');\n if (set.has(change.reason) === change.active) return UNCHANGED;\n return mutate(() => {\n if (change.active) set.add(change.reason); else set.delete(change.reason);\n });\n }),\n // Informational since the stack has no slots to protect; it has no observable effect.\n setFocused: withLease((handle: NotificationHandle | null) => {\n const error = (handle === null ? undefined : currentError(handle));\n if (error) return reject(error);\n if (focused === handle) return UNCHANGED;\n focused = handle;\n return APPLIED;\n }),\n beginPresentation: withLease(withCurrent((record, previous: PresentationToken) => {\n if (record.presentation !== previous) return reject('stale-presentation');\n const presentation = token() as PresentationToken;\n mutate(() => { record.presentation = presentation; record.readable = false; });\n return { status: 'started' as const, token: presentation };\n })),\n acknowledgePresentation: withLease(withCurrent((record, presentation: PresentationToken) => {\n if (record.presentation !== presentation) return reject('stale-presentation');\n if (record.readable) return UNCHANGED;\n return mutate((deliveries) => {\n deliveries.push({ type: 'presented', handle: record.handle, firstPresentation: !record.everPresented });\n record.readable = record.everPresented = true;\n });\n })),\n acknowledgeFocus: withLease((focusToken: FocusRequestToken, outcome: 'focused' | 'unavailable') => {\n if (focusRequest?.token !== focusToken) return reject('stale-focus-request');\n if (outcome !== 'focused' && outcome !== 'unavailable') return reject('invalid-input');\n return mutate(() => { focusRequest = null; });\n }),\n acknowledgeOverflow: withLease(() => {\n return acknowledgeOverflow();\n }),\n acknowledgeAnnouncements: withLease((acknowledgements: readonly AnnouncementAcknowledgement[]) => {\n return acknowledgeAnnouncements(acknowledgements);\n }),\n dismiss: withLease((handle: NotificationHandle, reason: 'close-button' | 'swipe' | 'navigation') => {\n const error = handleError(handle);\n if (error) return reject(error);\n // Renderer close reasons are a closed protocol, never an exit callback.\n if (!['close-button', 'swipe', 'navigation'].includes(reason)) return reject('invalid-input');\n return dismiss(handle, reason);\n }),\n invokeAction: withLease(withRecord((record) => {\n const handle = record.handle;\n const action = record.content.action;\n if (!action || action.kind !== 'command') return reject('no-command');\n if (record.action.status === 'pending') return reject('already-pending');\n const actionToken = token() as ActionAttemptToken;\n const live = () => !disposed && records.get(handle.id) === record &&\n record.action.status === 'pending' && record.action.token === actionToken;\n const now = settle();\n record.action = freeze({ status: 'pending', token: actionToken });\n commit([{ type: 'action-started', handle, token: actionToken }], now);\n function failed(reason: unknown): void {\n if (!live()) return;\n let message = options.messages?.actionError ?? 'Action failed';\n if (action?.kind === 'command' && action.errorMessage) {\n try {\n const mapped = action.errorMessage(reason);\n if (typeof mapped !== 'string' || !mapped.trim()) throw new TypeError('Invalid action error message');\n message = mapped;\n } catch (error) {\n if (!disposed) failure('mapper-error', 'action.errorMessage', error, handle);\n }\n }\n if (!live()) return;\n const now = settle();\n record.action = freeze({ status: 'failed', token: actionToken, message });\n commit([{ type: 'action-failed', handle, token: actionToken, message }], now);\n }\n let result: Promise<unknown>;\n try { result = Promise.resolve(action.run(freeze({ handle, token: actionToken }))); }\n catch (error) { result = Promise.reject(error); }\n void result.then(() => {\n if (live()) dismiss(handle, 'action-success');\n }, failed).catch((error: unknown) => {\n if (!disposed) failure('callback-error', 'action-settlement', error, handle);\n });\n return { status: 'started' as const };\n })),\n retryOperation: withLease(withOperation((operation) => {\n const result = operation.retry();\n return result.status === 'started' ? { status: 'started' as const, token: result.attempt.token } : result;\n })),\n cancelOperation: withLease(withOperation((operation, reason?: unknown) => operation.cancel(reason))),\n reportDiagnostic: withLease((report: Diagnostic) => {\n if (!report || typeof report.source !== 'string' || typeof report.message !== 'string'\n || !['invalid-input', 'second-host', 'stale-host', 'mapper-error', 'callback-error', 'listener-error', 'cancellation-error', 'slot-error', 'formatter-error', 'invalid-container'].includes(report.code)) return reject('invalid-input');\n diagnostic(report);\n return APPLIED;\n }),\n });\n\n function acknowledgeAnnouncements(acks: readonly AnnouncementAcknowledgement[]): BridgeResult {\n if (!Array.isArray(acks)) return reject('invalid-input');\n // Stage only effective changes; no ledger mutation occurs until every\n // acknowledgement has passed validation. Repeated counts remain monotonic.\n const changes: (() => void)[] = [];\n const validCount = (count: number, maximum: number) => Number.isSafeInteger(count) && count >= 0 && count <= maximum;\n for (const ack of acks) {\n if (!ack || typeof ack !== 'object') return reject('invalid-input');\n if (ack.kind === 'overflow') {\n if (!validCount(ack.count, overflow)) return reject('invalid-input');\n if (ack.count > overflowAnnounced) changes.push(() => { overflowAnnounced = Math.max(overflowAnnounced, ack.count); });\n continue;\n }\n const error = handleError(ack.handle);\n if (error) return reject(error);\n const record = records.get(ack.handle.id)!;\n if (ack.kind === 'operation') {\n const operation = record.operation?.getSnapshot();\n if (!operation || operation.token !== ack.token) return reject('stale-operation-token');\n if (!['started', 'fulfilled', 'rejected', 'cancelled', 'cancel-requested'].includes(ack.phase)) return reject('invalid-input');\n if (ack.phase === 'cancel-requested' ? !operation.cancelRequested\n : ack.phase !== 'started' && ack.phase !== operation.status) return reject('invalid-input');\n if (!record.operationAnnounced.has(ack.phase)) changes.push(() => { record.operationAnnounced.add(ack.phase); });\n } else if (ack.kind === 'action') {\n if (record.action.status === 'idle' || record.action.token !== ack.token || record.action.status !== ack.status) return reject('invalid-input');\n if (record.actionAnnounced?.token !== ack.token || record.actionAnnounced?.status !== ack.status) {\n changes.push(() => { record.actionAnnounced = freeze({ token: ack.token, status: ack.status }); });\n }\n } else if (ack.kind === 'occurrences') {\n if (!validCount(ack.count, record.occurrences)) return reject('invalid-input');\n if (ack.count > record.occurrencesAnnounced) changes.push(() => { record.occurrencesAnnounced = Math.max(record.occurrencesAnnounced, ack.count); });\n } else if (ack.kind === 'queued' || ack.kind === 'first-presentation') {\n const key = ack.kind === 'queued' ? 'queuedAnnounced' : 'firstAnnounced';\n if (!record[key]) changes.push(() => { record[key] = true; });\n } else return reject('invalid-input');\n }\n if (!changes.length) return UNCHANGED;\n return mutate(() => { for (const apply of changes) apply(); });\n }\n\n publish();\n bridges.set(controller, bridge as RendererBridge<unknown>);\n return controller;\n}\n"],"mappings":";;AA2DA,IAAMA,IAAkB,KAElBC,IAAS,OAAO,QAGhBC,oBAAU,IAAI,QAAgB,GAC9BC,qBAAU,IAAI,QAAyC,GACzDC,IAAiB,GACfC,IAA0BJ,EAAO,CAAC,CAAC,GACnCK,KAA4BL,EAAO;CAAE,MAAM;CAAO,QAAQ;CAAM,SAAS;AAAK,CAAC,GAC/EM,IAAoCN,EAAO;CAC/C,YAAY;CAAM,UAAU;CAAG,UAAU;CAAO,eAAeI;CAAO,OAAOA;CAC7E,QAAQC;CAAW,UAAUL,EAAO;EAAE,OAAO;EAAG,SAAS;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AI;KAAO,CAAC;IAAG,CAAC;GAErG,OAAO,IAAIA,EAAI,SAAS,eAAe;IACrC,IAAI,CAACF,EAAWE,EAAI,OAAOnK,EAAO,WAAW,GAAG,OAAO7C,EAAO,eAAe;IAC7E,AAAIgN,EAAI,QAAQnK,EAAO,wBAAsBgK,EAAQ,WAAW;KAAE,EAAO,uBAAuB,KAAK,IAAIhK,EAAO,sBAAsBmK,EAAI,KAAK;IAAG,CAAC;GACrJ,OAAO,IAAIA,EAAI,SAAS,YAAYA,EAAI,SAAS,sBAAsB;IACrE,IAAMxE,IAAMwE,EAAI,SAAS,WAAW,oBAAoB;IACxD,AAAKnK,EAAO2F,MAAMqE,EAAQ,WAAW;KAAE,EAAOrE,KAAO;IAAM,CAAC;GAC9D,OAAO,OAAOxI,EAAO,eAAe;EACtC;EAEA,OADK6M,EAAQ,SACNhH,QAAa;GAAE,KAAK,IAAMC,KAAS+G,GAAS,EAAM;EAAG,CAAC,IADjC9M;CAE9B;CAIA,OAFA0F,GAAQ,GACRlG,GAAQ,IAAIY,IAAYD,EAAiC,GAClDC;AACT"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ControllerOptions } from '../contracts/controller.js';
|
|
2
|
+
import type { InputIssue } from '../contracts/identity.js';
|
|
3
|
+
import type { NotificationContent, NotificationPatch } from '../contracts/notifications.js';
|
|
4
|
+
export declare function validateSpec(value: unknown): readonly InputIssue[];
|
|
5
|
+
export declare function validatePatch(value: unknown): readonly InputIssue[];
|
|
6
|
+
/** Operation content cannot set identity, scheduling priority or notification kind. */
|
|
7
|
+
export declare function validateContent(value: unknown, pending?: boolean): readonly InputIssue[];
|
|
8
|
+
/** Validate before copying or invoking user code; mapper output is validated separately. */
|
|
9
|
+
export declare function validateTrackOptions(value: unknown, isFactory: boolean): readonly InputIssue[];
|
|
10
|
+
/** Attention delays are finite nonnegative milliseconds. */
|
|
11
|
+
export declare const validDelay: (value: unknown) => value is number;
|
|
12
|
+
export declare function validateOptions(options: ControllerOptions | undefined): ControllerOptions;
|
|
13
|
+
/** Call after validation. Copy only the library's structures, never the caller's opaque payloads. */
|
|
14
|
+
export declare function copyContent<Slot>(content: NotificationContent<Slot>): Readonly<NotificationContent<Slot>>;
|
|
15
|
+
/** Kind and priority belong to the record; this helper changes only presentation content. */
|
|
16
|
+
export declare function patchContent<Slot>(content: Readonly<NotificationContent<Slot>>, patch: NotificationPatch<Slot>): Readonly<NotificationContent<Slot>>;
|
|
17
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/core/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAEV,mBAAmB,EACnB,iBAAiB,EAGlB,MAAM,+BAA+B,CAAC;AAyIvC,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,UAAU,EAAE,CAQlE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,UAAU,EAAE,CAKnE;AAED,uFAAuF;AACvF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,UAAQ,GAAG,SAAS,UAAU,EAAE,CAQtF;AAED,4FAA4F;AAC5F,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,SAAS,UAAU,EAAE,CAiB9F;AAED,4DAA4D;AAC5D,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,KAAK,IAAI,MACc,CAAC;AAEpE,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,iBAAiB,CA0BzF;AA2BD,qGAAqG;AACrG,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,mBAAmB,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CASzG;AAUD,6FAA6F;AAC7F,wBAAgB,YAAY,CAAC,IAAI,EAC/B,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,EAC5C,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,GAC7B,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAerC"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
//#region src/core/validation.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"title",
|
|
4
|
+
"description",
|
|
5
|
+
"icon",
|
|
6
|
+
"progress",
|
|
7
|
+
"action",
|
|
8
|
+
"announcementPriority",
|
|
9
|
+
"duration",
|
|
10
|
+
"attention"
|
|
11
|
+
], t = [
|
|
12
|
+
...e,
|
|
13
|
+
"kind",
|
|
14
|
+
"priority"
|
|
15
|
+
], n = [
|
|
16
|
+
...t,
|
|
17
|
+
"id",
|
|
18
|
+
"dedupeKey",
|
|
19
|
+
"onClose"
|
|
20
|
+
], r = [
|
|
21
|
+
"operationSuccess",
|
|
22
|
+
"operationError",
|
|
23
|
+
"operationCancelled",
|
|
24
|
+
"cancellationRequested",
|
|
25
|
+
"actionError",
|
|
26
|
+
"renderError"
|
|
27
|
+
], i = Object.freeze([]), a = Object.hasOwn, o = (e, t) => e ? `${e}.${String(t)}` : String(t);
|
|
28
|
+
function s(e, t, n) {
|
|
29
|
+
e.push(Object.freeze({
|
|
30
|
+
path: t,
|
|
31
|
+
message: n
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
function c(e, t, n, r, i = []) {
|
|
35
|
+
if (typeof e != "object" || !e || Object.getPrototypeOf(e) !== Object.prototype && Object.getPrototypeOf(e) !== null) {
|
|
36
|
+
s(r, t, "Expected a plain object");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
let a = !1;
|
|
40
|
+
for (let c of Reflect.ownKeys(e)) {
|
|
41
|
+
let l = Object.getOwnPropertyDescriptor(e, c);
|
|
42
|
+
(typeof c != "string" || !n.includes(c)) && s(r, o(t, c), "Unknown field"), l && !("value" in l) ? (s(r, o(t, c), "Expected a data property"), a = !0) : l?.value === void 0 && (typeof c != "string" || !i.includes(c)) && s(r, o(t, c), "Omit optional fields instead of passing undefined");
|
|
43
|
+
}
|
|
44
|
+
return a ? void 0 : e;
|
|
45
|
+
}
|
|
46
|
+
function l(e, t, n, r) {
|
|
47
|
+
for (let [i, c, l] of r) {
|
|
48
|
+
let r = a(e, i);
|
|
49
|
+
if (!l && (!r || e[i] === void 0)) continue;
|
|
50
|
+
let u = l === "own" && !r ? void 0 : e[i];
|
|
51
|
+
(typeof c == "string" ? c === "nonempty string" ? typeof u == "string" && u.trim().length > 0 : typeof u === c : typeof u == "string" && c.includes(u)) || s(t, o(n, i), typeof c == "string" ? `Expected a ${c}` : `Expected one of: ${c.join(", ")}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function u(e, t, n, r, i) {
|
|
55
|
+
for (let c of r) a(e, c) && s(t, o(n, c), `Field is not allowed for ${i}`);
|
|
56
|
+
}
|
|
57
|
+
function d(e, t) {
|
|
58
|
+
let n = c(e, "description", [
|
|
59
|
+
"kind",
|
|
60
|
+
"text",
|
|
61
|
+
"content",
|
|
62
|
+
"announcement"
|
|
63
|
+
], t, ["content"]);
|
|
64
|
+
n && (n.kind === "text" ? (u(n, t, "description", ["content", "announcement"], "a text description"), l(n, t, "description", [[
|
|
65
|
+
"text",
|
|
66
|
+
"string",
|
|
67
|
+
"own"
|
|
68
|
+
]])) : n.kind === "rich" ? (u(n, t, "description", ["text"], "a rich description"), a(n, "content") || s(t, "description.content", "Required field"), l(n, t, "description", [[
|
|
69
|
+
"announcement",
|
|
70
|
+
"nonempty string",
|
|
71
|
+
"own"
|
|
72
|
+
]])) : l(n, t, "description", [[
|
|
73
|
+
"kind",
|
|
74
|
+
["text", "rich"],
|
|
75
|
+
!0
|
|
76
|
+
]]));
|
|
77
|
+
}
|
|
78
|
+
function f(e, t) {
|
|
79
|
+
let n = c(e, "progress", [
|
|
80
|
+
"kind",
|
|
81
|
+
"value",
|
|
82
|
+
"label"
|
|
83
|
+
], t);
|
|
84
|
+
n && (n.kind === "determinate" ? (typeof n.value != "number" || !Number.isFinite(n.value) || n.value < 0 || n.value > 1) && s(t, "progress.value", "Expected a finite number between 0 and 1") : n.kind === "indeterminate" ? u(n, t, "progress", ["value"], "indeterminate progress") : l(n, t, "progress", [[
|
|
85
|
+
"kind",
|
|
86
|
+
["indeterminate", "determinate"],
|
|
87
|
+
!0
|
|
88
|
+
]]), l(n, t, "progress", [["label", "string"]]));
|
|
89
|
+
}
|
|
90
|
+
function p(e) {
|
|
91
|
+
if (/[\u0000-\u001f\u007f]/u.test(e)) return !1;
|
|
92
|
+
let t = e.trim(), n = t.indexOf(":"), r = t.search(/[/?#]/u);
|
|
93
|
+
if (n === -1 || r !== -1 && r < n) return !0;
|
|
94
|
+
let i = t.slice(0, n).toLowerCase();
|
|
95
|
+
return [
|
|
96
|
+
"http",
|
|
97
|
+
"https",
|
|
98
|
+
"mailto",
|
|
99
|
+
"tel"
|
|
100
|
+
].includes(i);
|
|
101
|
+
}
|
|
102
|
+
function m(e, t) {
|
|
103
|
+
let n = c(e, "action", [
|
|
104
|
+
"kind",
|
|
105
|
+
"label",
|
|
106
|
+
"run",
|
|
107
|
+
"errorMessage",
|
|
108
|
+
"href",
|
|
109
|
+
"target",
|
|
110
|
+
"rel"
|
|
111
|
+
], t);
|
|
112
|
+
n && (l(n, t, "action", [[
|
|
113
|
+
"label",
|
|
114
|
+
"nonempty string",
|
|
115
|
+
!0
|
|
116
|
+
]]), n.kind === "command" ? (u(n, t, "action", [
|
|
117
|
+
"href",
|
|
118
|
+
"target",
|
|
119
|
+
"rel"
|
|
120
|
+
], "a command action"), l(n, t, "action", [[
|
|
121
|
+
"run",
|
|
122
|
+
"function",
|
|
123
|
+
!0
|
|
124
|
+
], ["errorMessage", "function"]])) : n.kind === "link" ? (u(n, t, "action", ["run", "errorMessage"], "a link action"), l(n, t, "action", [[
|
|
125
|
+
"href",
|
|
126
|
+
"nonempty string",
|
|
127
|
+
!0
|
|
128
|
+
]]), typeof n.href == "string" && !p(n.href) && s(t, "action.href", "Unsupported or unsafe URL"), l(n, t, "action", [["target", [
|
|
129
|
+
"_self",
|
|
130
|
+
"_blank",
|
|
131
|
+
"_parent",
|
|
132
|
+
"_top"
|
|
133
|
+
]], ["rel", "string"]])) : l(n, t, "action", [[
|
|
134
|
+
"kind",
|
|
135
|
+
["command", "link"],
|
|
136
|
+
!0
|
|
137
|
+
]]));
|
|
138
|
+
}
|
|
139
|
+
function h(e, t, n) {
|
|
140
|
+
l(e, t, "", [
|
|
141
|
+
[
|
|
142
|
+
"title",
|
|
143
|
+
"nonempty string",
|
|
144
|
+
!n || a(e, "title")
|
|
145
|
+
],
|
|
146
|
+
["kind", [
|
|
147
|
+
"info",
|
|
148
|
+
"success",
|
|
149
|
+
"loading",
|
|
150
|
+
"warning",
|
|
151
|
+
"error"
|
|
152
|
+
]],
|
|
153
|
+
["priority", ["normal", "high"]],
|
|
154
|
+
["announcementPriority", [
|
|
155
|
+
"polite",
|
|
156
|
+
"assertive",
|
|
157
|
+
"off"
|
|
158
|
+
]],
|
|
159
|
+
["attention", [
|
|
160
|
+
"auto",
|
|
161
|
+
"open",
|
|
162
|
+
"stack"
|
|
163
|
+
]]
|
|
164
|
+
]);
|
|
165
|
+
for (let [r, i] of [
|
|
166
|
+
["description", d],
|
|
167
|
+
["progress", f],
|
|
168
|
+
["action", m]
|
|
169
|
+
]) a(e, r) && e[r] !== void 0 && !(n && e[r] === null) && i(e[r], t);
|
|
170
|
+
a(e, "duration") && e.duration !== void 0 && e.duration !== null && (typeof e.duration != "number" || !Number.isFinite(e.duration) || e.duration < 0) && s(t, "duration", "Expected null or a finite nonnegative duration");
|
|
171
|
+
}
|
|
172
|
+
function g(e) {
|
|
173
|
+
return e.length === 0 ? i : Object.freeze(e);
|
|
174
|
+
}
|
|
175
|
+
function _(e) {
|
|
176
|
+
let t = [], r = c(e, "", n, t);
|
|
177
|
+
return r && (h(r, t, !1), l(r, t, "", [
|
|
178
|
+
["id", "nonempty string"],
|
|
179
|
+
["dedupeKey", "nonempty string"],
|
|
180
|
+
["onClose", "function"]
|
|
181
|
+
])), g(t);
|
|
182
|
+
}
|
|
183
|
+
function v(e) {
|
|
184
|
+
let n = [], r = c(e, "", t, n);
|
|
185
|
+
return r && h(r, n, !0), g(n);
|
|
186
|
+
}
|
|
187
|
+
function y(t, n = !1) {
|
|
188
|
+
let r = [], i = c(t, "", e, r);
|
|
189
|
+
return i && (h(i, r, !1), n && a(i, "duration") && s(r, "duration", "Pending content cannot define a duration")), g(r);
|
|
190
|
+
}
|
|
191
|
+
function b(e, t) {
|
|
192
|
+
let n = [], r = c(e, "", [
|
|
193
|
+
"id",
|
|
194
|
+
"priority",
|
|
195
|
+
"pending",
|
|
196
|
+
"success",
|
|
197
|
+
"error",
|
|
198
|
+
"cancelled",
|
|
199
|
+
"cancel",
|
|
200
|
+
"isCancellation",
|
|
201
|
+
"onClose"
|
|
202
|
+
], n);
|
|
203
|
+
if (!r) return g(n);
|
|
204
|
+
l(r, n, "", [["id", "nonempty string"], ["priority", ["normal", "high"]]]);
|
|
205
|
+
for (let e of [
|
|
206
|
+
"pending",
|
|
207
|
+
"success",
|
|
208
|
+
"error",
|
|
209
|
+
"cancelled"
|
|
210
|
+
]) if ((e !== "cancelled" || a(r, e)) && (e === "pending" || typeof r[e] != "function")) for (let t of y(r[e], e === "pending")) s(n, t.path ? `${e}.${t.path}` : e, t.message);
|
|
211
|
+
return l(r, n, "", [
|
|
212
|
+
["cancel", "function"],
|
|
213
|
+
["isCancellation", "function"],
|
|
214
|
+
["onClose", "function"]
|
|
215
|
+
]), t && a(r, "cancel") && s(n, "cancel", "Factory cancellation uses its attempt signal"), g(n);
|
|
216
|
+
}
|
|
217
|
+
var x = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0;
|
|
218
|
+
function S(e) {
|
|
219
|
+
if (e === void 0) return Object.freeze({ autoDismiss: !0 });
|
|
220
|
+
let t = [], n = c(e, "", [
|
|
221
|
+
"autoDismiss",
|
|
222
|
+
"attentionDelay",
|
|
223
|
+
"messages",
|
|
224
|
+
"onOverflow",
|
|
225
|
+
"onDiagnostic"
|
|
226
|
+
], t);
|
|
227
|
+
if (n && (l(n, t, "", [
|
|
228
|
+
["autoDismiss", "boolean"],
|
|
229
|
+
["onOverflow", "function"],
|
|
230
|
+
["onDiagnostic", "function"]
|
|
231
|
+
]), a(n, "attentionDelay") && n.attentionDelay !== void 0 && typeof n.attentionDelay != "number" && s(t, "attentionDelay", "Expected a number"), a(n, "messages") && n.messages !== void 0)) {
|
|
232
|
+
let e = c(n.messages, "messages", r, t);
|
|
233
|
+
e && l(e, t, "messages", r.map((e) => [e, "string"]));
|
|
234
|
+
}
|
|
235
|
+
if (t.length) throw TypeError(t.map(({ path: e, message: t }) => `${e || "options"}: ${t}`).join("; "));
|
|
236
|
+
if (e.attentionDelay !== void 0 && !x(e.attentionDelay)) throw RangeError("attentionDelay: Expected a finite nonnegative number of milliseconds");
|
|
237
|
+
let i = { autoDismiss: e.autoDismiss ?? !0 };
|
|
238
|
+
return e.attentionDelay !== void 0 && (i.attentionDelay = e.attentionDelay), e.messages !== void 0 && (i.messages = C(e.messages, [], r)), e.onOverflow !== void 0 && (i.onOverflow = e.onOverflow), e.onDiagnostic !== void 0 && (i.onDiagnostic = e.onDiagnostic), Object.freeze(i);
|
|
239
|
+
}
|
|
240
|
+
function C(e, t, n = []) {
|
|
241
|
+
let r = {};
|
|
242
|
+
for (let i of [...t, ...n]) {
|
|
243
|
+
let n = e[i];
|
|
244
|
+
(t.includes(i) || n !== void 0) && (r[i] = n);
|
|
245
|
+
}
|
|
246
|
+
return Object.freeze(r);
|
|
247
|
+
}
|
|
248
|
+
function w(e) {
|
|
249
|
+
return e.kind === "text" ? C(e, ["kind", "text"]) : C(e, [
|
|
250
|
+
"kind",
|
|
251
|
+
"content",
|
|
252
|
+
"announcement"
|
|
253
|
+
]);
|
|
254
|
+
}
|
|
255
|
+
function T(e) {
|
|
256
|
+
return e.kind === "indeterminate" ? C(e, ["kind"], ["label"]) : C(e, ["kind", "value"], ["label"]);
|
|
257
|
+
}
|
|
258
|
+
function E(e) {
|
|
259
|
+
return e.kind === "command" ? C(e, [
|
|
260
|
+
"kind",
|
|
261
|
+
"label",
|
|
262
|
+
"run"
|
|
263
|
+
], ["errorMessage"]) : C(e, [
|
|
264
|
+
"kind",
|
|
265
|
+
"label",
|
|
266
|
+
"href"
|
|
267
|
+
], ["target", "rel"]);
|
|
268
|
+
}
|
|
269
|
+
function D(e) {
|
|
270
|
+
let t = {
|
|
271
|
+
title: e.title,
|
|
272
|
+
announcementPriority: e.announcementPriority ?? "polite"
|
|
273
|
+
};
|
|
274
|
+
return e.description !== void 0 && (t.description = w(e.description)), a(e, "icon") && (t.icon = e.icon), e.progress !== void 0 && (t.progress = T(e.progress)), e.action !== void 0 && (t.action = E(e.action)), e.duration !== void 0 && (t.duration = e.duration), e.attention !== void 0 && (t.attention = e.attention), Object.freeze(t);
|
|
275
|
+
}
|
|
276
|
+
function O(e, t) {
|
|
277
|
+
if (e === t) return !0;
|
|
278
|
+
if (!e || !t) return !1;
|
|
279
|
+
let n = Object.keys(e);
|
|
280
|
+
return n.length === Object.keys(t).length && n.every((n) => a(t, n) && Object.is(e[n], t[n]));
|
|
281
|
+
}
|
|
282
|
+
function k(t, n) {
|
|
283
|
+
let r = { ...t };
|
|
284
|
+
for (let t of e) {
|
|
285
|
+
let e = n[t];
|
|
286
|
+
e === null && [
|
|
287
|
+
"description",
|
|
288
|
+
"icon",
|
|
289
|
+
"progress",
|
|
290
|
+
"action"
|
|
291
|
+
].includes(t) ? delete r[t] : e !== void 0 && (r[t] = e);
|
|
292
|
+
}
|
|
293
|
+
return r.title === t.title && r.announcementPriority === t.announcementPriority && r.duration === t.duration && a(r, "duration") === a(t, "duration") && r.attention === t.attention && Object.is(r.icon, t.icon) && a(r, "icon") === a(t, "icon") && O(r.description, t.description) && O(r.progress, t.progress) && O(r.action, t.action) ? t : D(r);
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
export { D as copyContent, k as patchContent, x as validDelay, y as validateContent, S as validateOptions, v as validatePatch, _ as validateSpec, b as validateTrackOptions };
|
|
297
|
+
|
|
298
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","names":["contentKeys","patchKeys","specKeys","messageKeys","noIssues","owns","at","path","key","issue","record","value","issues","hasAccessor","descriptor","keys","undefinedKeys","fields","rule","required","rules","own","data","forbidden","variant","description","progress","safeHref","href","colon","boundary","scheme","action","common","patch","validate","finish","validateSpec","validatePatch","validateContent","pending","validateTrackOptions","problem","isFactory","validDelay","validateOptions","options","messages","message","result","copyFields","copy","optional","item","copyDescription","copyProgress","copyAction","copyContent","content","equalData","left","right","patchContent","merged"],"sources":["../../src/core/validation.ts"],"sourcesContent":["import type { ControllerOptions } from '../contracts/controller.js';\nimport type { InputIssue } from '../contracts/identity.js';\nimport type {\n Description,\n NotificationContent,\n NotificationPatch,\n PrimaryAction,\n Progress,\n} from '../contracts/notifications.js';\n\nconst contentKeys = ['title', 'description', 'icon', 'progress', 'action', 'announcementPriority', 'duration', 'attention'];\nconst patchKeys = [...contentKeys, 'kind', 'priority'];\nconst specKeys = [...patchKeys, 'id', 'dedupeKey', 'onClose'];\nconst messageKeys = [\n 'operationSuccess', 'operationError', 'operationCancelled', 'cancellationRequested', 'actionError', 'renderError',\n] as const;\nconst noIssues: readonly InputIssue[] = Object.freeze([]);\nconst owns = Object.hasOwn;\nconst at = (path: string, key: PropertyKey): string => path ? `${path}.${String(key)}` : String(key);\n\nfunction issue(issues: InputIssue[], path: string, message: string): void {\n issues.push(Object.freeze({ path, message }));\n}\n\n/** Only Cloudlet-owned data records are inspected. Opaque slots are never passed here. */\nfunction record(\n value: unknown,\n path: string,\n keys: readonly string[],\n issues: InputIssue[],\n undefinedKeys: readonly string[] = [],\n): Record<string, unknown> | undefined {\n if (value === null || typeof value !== 'object' ||\n (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)) {\n issue(issues, path, 'Expected a plain object');\n return undefined;\n }\n let hasAccessor = false;\n for (const key of Reflect.ownKeys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (typeof key !== 'string' || !keys.includes(key)) {\n issue(issues, at(path, key), 'Unknown field');\n }\n if (descriptor && !('value' in descriptor)) {\n issue(issues, at(path, key), 'Expected a data property');\n hasAccessor = true;\n } else if (descriptor?.value === undefined &&\n (typeof key !== 'string' || !undefinedKeys.includes(key))) {\n issue(issues, at(path, key), 'Omit optional fields instead of passing undefined');\n }\n }\n return hasAccessor ? undefined : value as Record<string, unknown>;\n}\n\ntype Rule = 'string' | 'nonempty string' | 'function' | 'boolean' | readonly string[];\ntype Fields = readonly (readonly [key: string, rule: Rule, required?: boolean | 'own'])[];\n\n/** Optional undefined is already diagnosed by record; required fields still validate. */\nfunction fields(data: Record<string, unknown>, issues: InputIssue[], path: string, rules: Fields): void {\n for (const [key, rule, required] of rules) {\n const own = owns(data, key);\n if (!required && (!own || data[key] === undefined)) continue;\n const value = required === 'own' && !own ? undefined : data[key];\n const valid = typeof rule === 'string'\n ? rule === 'nonempty string' ? typeof value === 'string' && value.trim().length > 0 : typeof value === rule\n : typeof value === 'string' && rule.includes(value);\n if (!valid) issue(issues, at(path, key), typeof rule === 'string' ? `Expected a ${rule}` : `Expected one of: ${rule.join(', ')}`);\n }\n}\n\nfunction forbidden(data: Record<string, unknown>, issues: InputIssue[], path: string, keys: readonly string[], variant: string): void {\n for (const key of keys) if (owns(data, key)) issue(issues, at(path, key), `Field is not allowed for ${variant}`);\n}\n\nfunction description(value: unknown, issues: InputIssue[]): void {\n const data = record(value, 'description', ['kind', 'text', 'content', 'announcement'], issues, ['content']);\n if (!data) return;\n if (data.kind === 'text') {\n forbidden(data, issues, 'description', ['content', 'announcement'], 'a text description');\n fields(data, issues, 'description', [['text', 'string', 'own']]);\n } else if (data.kind === 'rich') {\n forbidden(data, issues, 'description', ['text'], 'a rich description');\n if (!owns(data, 'content')) issue(issues, 'description.content', 'Required field');\n fields(data, issues, 'description', [['announcement', 'nonempty string', 'own']]);\n } else fields(data, issues, 'description', [['kind', ['text', 'rich'], true]]);\n}\n\nfunction progress(value: unknown, issues: InputIssue[]): void {\n const data = record(value, 'progress', ['kind', 'value', 'label'], issues);\n if (!data) return;\n if (data.kind === 'determinate') {\n if (typeof data.value !== 'number' || !Number.isFinite(data.value) || data.value < 0 || data.value > 1) {\n issue(issues, 'progress.value', 'Expected a finite number between 0 and 1');\n }\n } else if (data.kind === 'indeterminate') forbidden(data, issues, 'progress', ['value'], 'indeterminate progress');\n else fields(data, issues, 'progress', [['kind', ['indeterminate', 'determinate'], true]]);\n fields(data, issues, 'progress', [['label', 'string']]);\n}\n\nfunction safeHref(value: string): boolean {\n // URL parsers strip controls before interpreting schemes; rejecting them prevents scheme obfuscation.\n if (/[\\u0000-\\u001f\\u007f]/u.test(value)) return false;\n const href = value.trim();\n const colon = href.indexOf(':');\n const boundary = href.search(/[/?#]/u);\n if (colon === -1 || (boundary !== -1 && boundary < colon)) return true;\n const scheme = href.slice(0, colon).toLowerCase();\n return ['http', 'https', 'mailto', 'tel'].includes(scheme);\n}\n\nfunction action(value: unknown, issues: InputIssue[]): void {\n const data = record(value, 'action', ['kind', 'label', 'run', 'errorMessage', 'href', 'target', 'rel'], issues);\n if (!data) return;\n fields(data, issues, 'action', [['label', 'nonempty string', true]]);\n if (data.kind === 'command') {\n forbidden(data, issues, 'action', ['href', 'target', 'rel'], 'a command action');\n fields(data, issues, 'action', [['run', 'function', true], ['errorMessage', 'function']]);\n } else if (data.kind === 'link') {\n forbidden(data, issues, 'action', ['run', 'errorMessage'], 'a link action');\n fields(data, issues, 'action', [['href', 'nonempty string', true]]);\n if (typeof data.href === 'string' && !safeHref(data.href)) issue(issues, 'action.href', 'Unsupported or unsafe URL');\n fields(data, issues, 'action', [['target', ['_self', '_blank', '_parent', '_top']], ['rel', 'string']]);\n } else fields(data, issues, 'action', [['kind', ['command', 'link'], true]]);\n}\n\nfunction common(data: Record<string, unknown>, issues: InputIssue[], patch: boolean): void {\n fields(data, issues, '', [\n ['title', 'nonempty string', !patch || owns(data, 'title')],\n ['kind', ['info', 'success', 'loading', 'warning', 'error']],\n ['priority', ['normal', 'high']], ['announcementPriority', ['polite', 'assertive', 'off']],\n ['attention', ['auto', 'open', 'stack']],\n ]);\n for (const [key, validate] of [['description', description], ['progress', progress], ['action', action]] as const) {\n if (owns(data, key) && data[key] !== undefined && !(patch && data[key] === null)) validate(data[key], issues);\n }\n if (owns(data, 'duration') && data.duration !== undefined && data.duration !== null &&\n (typeof data.duration !== 'number' || !Number.isFinite(data.duration) || data.duration < 0)) {\n issue(issues, 'duration', 'Expected null or a finite nonnegative duration');\n }\n}\n\nfunction finish(issues: InputIssue[]): readonly InputIssue[] {\n return issues.length === 0 ? noIssues : Object.freeze(issues);\n}\n\nexport function validateSpec(value: unknown): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', specKeys, issues);\n if (data) {\n common(data, issues, false);\n fields(data, issues, '', [['id', 'nonempty string'], ['dedupeKey', 'nonempty string'], ['onClose', 'function']]);\n }\n return finish(issues);\n}\n\nexport function validatePatch(value: unknown): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', patchKeys, issues);\n if (data) common(data, issues, true);\n return finish(issues);\n}\n\n/** Operation content cannot set identity, scheduling priority or notification kind. */\nexport function validateContent(value: unknown, pending = false): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', contentKeys, issues);\n if (data) {\n common(data, issues, false);\n if (pending && owns(data, 'duration')) issue(issues, 'duration', 'Pending content cannot define a duration');\n }\n return finish(issues);\n}\n\n/** Validate before copying or invoking user code; mapper output is validated separately. */\nexport function validateTrackOptions(value: unknown, isFactory: boolean): readonly InputIssue[] {\n const issues: InputIssue[] = [];\n const data = record(value, '', [\n 'id', 'priority', 'pending', 'success', 'error', 'cancelled', 'cancel', 'isCancellation', 'onClose',\n ], issues);\n if (!data) return finish(issues);\n fields(data, issues, '', [['id', 'nonempty string'], ['priority', ['normal', 'high']]]);\n for (const key of ['pending', 'success', 'error', 'cancelled'] as const) {\n if (key === 'cancelled' && !owns(data, key)) continue;\n if (key !== 'pending' && typeof data[key] === 'function') continue;\n for (const problem of validateContent(data[key], key === 'pending')) {\n issue(issues, problem.path ? `${key}.${problem.path}` : key, problem.message);\n }\n }\n fields(data, issues, '', [['cancel', 'function'], ['isCancellation', 'function'], ['onClose', 'function']]);\n if (isFactory && owns(data, 'cancel')) issue(issues, 'cancel', 'Factory cancellation uses its attempt signal');\n return finish(issues);\n}\n\n/** Attention delays are finite nonnegative milliseconds. */\nexport const validDelay = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value) && value >= 0;\n\nexport function validateOptions(options: ControllerOptions | undefined): ControllerOptions {\n if (options === undefined) return Object.freeze({ autoDismiss: true });\n const issues: InputIssue[] = [];\n const data = record(options, '', ['autoDismiss', 'attentionDelay', 'messages', 'onOverflow', 'onDiagnostic'], issues);\n if (data) {\n fields(data, issues, '', [['autoDismiss', 'boolean'], ['onOverflow', 'function'], ['onDiagnostic', 'function']]);\n if (owns(data, 'attentionDelay') && data.attentionDelay !== undefined && typeof data.attentionDelay !== 'number') {\n issue(issues, 'attentionDelay', 'Expected a number');\n }\n if (owns(data, 'messages') && data.messages !== undefined) {\n const messages = record(data.messages, 'messages', messageKeys, issues);\n if (messages) fields(messages, issues, 'messages', messageKeys.map((key) => [key, 'string']));\n }\n }\n if (issues.length) throw new TypeError(issues.map(({ path, message }) => `${path || 'options'}: ${message}`).join('; '));\n if (options.attentionDelay !== undefined && !validDelay(options.attentionDelay)) {\n throw new RangeError('attentionDelay: Expected a finite nonnegative number of milliseconds');\n }\n const result: { -readonly [Key in keyof ControllerOptions]: ControllerOptions[Key] } = { autoDismiss: options.autoDismiss ?? true };\n if (options.attentionDelay !== undefined) result.attentionDelay = options.attentionDelay;\n if (options.messages !== undefined) {\n result.messages = copyFields(options.messages, [], messageKeys);\n }\n if (options.onOverflow !== undefined) result.onOverflow = options.onOverflow;\n if (options.onDiagnostic !== undefined) result.onDiagnostic = options.onDiagnostic;\n return Object.freeze(result);\n}\n\n/** Required fields retain undefined opaque slots; each variant has an explicit whitelist. */\nfunction copyFields<Value extends object>(value: Value, required: readonly (keyof Value)[], optional: readonly (keyof Value)[] = []): Value {\n const copy = {} as Value;\n for (const key of [...required, ...optional]) {\n const item = value[key];\n if (required.includes(key) || item !== undefined) copy[key] = item;\n }\n return Object.freeze(copy);\n}\n\nfunction copyDescription<Slot>(value: Description<Slot>): Description<Slot> {\n return value.kind === 'text' ? copyFields(value, ['kind', 'text']) : copyFields(value, ['kind', 'content', 'announcement']);\n}\n\nfunction copyProgress(value: Progress): Progress {\n return value.kind === 'indeterminate' ? copyFields(value, ['kind'], ['label']) : copyFields(value, ['kind', 'value'], ['label']);\n}\n\nfunction copyAction(value: PrimaryAction): PrimaryAction {\n return value.kind === 'command' ? copyFields(value, ['kind', 'label', 'run'], ['errorMessage'])\n : copyFields(value, ['kind', 'label', 'href'], ['target', 'rel']);\n}\n\ntype MutableContent<Slot> = { -readonly [Key in keyof NotificationContent<Slot>]: NotificationContent<Slot>[Key] };\n\n/** Call after validation. Copy only the library's structures, never the caller's opaque payloads. */\nexport function copyContent<Slot>(content: NotificationContent<Slot>): Readonly<NotificationContent<Slot>> {\n const copy: MutableContent<Slot> = { title: content.title, announcementPriority: content.announcementPriority ?? 'polite' };\n if (content.description !== undefined) copy.description = copyDescription(content.description);\n if (owns(content, 'icon')) copy.icon = content.icon as Slot;\n if (content.progress !== undefined) copy.progress = copyProgress(content.progress);\n if (content.action !== undefined) copy.action = copyAction(content.action);\n if (content.duration !== undefined) copy.duration = content.duration;\n if (content.attention !== undefined) copy.attention = content.attention;\n return Object.freeze(copy);\n}\n\nfunction equalData(left: object | undefined, right: object | undefined): boolean {\n if (left === right) return true;\n if (!left || !right) return false;\n const keys = Object.keys(left);\n return keys.length === Object.keys(right).length && keys.every((key) =>\n owns(right, key) && Object.is((left as Record<string, unknown>)[key], (right as Record<string, unknown>)[key]));\n}\n\n/** Kind and priority belong to the record; this helper changes only presentation content. */\nexport function patchContent<Slot>(\n content: Readonly<NotificationContent<Slot>>,\n patch: NotificationPatch<Slot>,\n): Readonly<NotificationContent<Slot>> {\n const merged: MutableContent<Slot> = { ...content };\n for (const key of contentKeys as readonly (keyof NotificationContent<Slot>)[]) {\n const value = patch[key];\n if (value === null && ['description', 'icon', 'progress', 'action'].includes(key)) delete merged[key];\n // Fields are copied between the matching keys of these validated shapes.\n else if (value !== undefined) (merged as Record<string, unknown>)[key] = value;\n }\n if (merged.title === content.title && merged.announcementPriority === content.announcementPriority &&\n merged.duration === content.duration && owns(merged, 'duration') === owns(content, 'duration') &&\n merged.attention === content.attention &&\n Object.is(merged.icon, content.icon) && owns(merged, 'icon') === owns(content, 'icon') &&\n equalData(merged.description, content.description) && equalData(merged.progress, content.progress) &&\n equalData(merged.action, content.action)) return content;\n return copyContent(merged);\n}\n"],"mappings":";AAUA,IAAMA,IAAc;CAAC;CAAS;CAAe;CAAQ;CAAY;CAAU;CAAwB;CAAY;AAAW,GACpHC,IAAY;CAAC,GAAGD;CAAa;CAAQ;AAAU,GAC/CE,IAAW;CAAC,GAAGD;CAAW;CAAM;CAAa;AAAS,GACtDE,IAAc;CAClB;CAAoB;CAAkB;CAAsB;CAAyB;CAAe;AACtG,GACMC,IAAkC,OAAO,OAAO,CAAC,CAAC,GAClDC,IAAO,OAAO,QACdC,KAAM,GAAc,MAA6BC,IAAO,GAAGA,EAAK,GAAG,OAAOC,CAAG,MAAM,OAAOA,CAAG;AAEnG,SAASC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GAAQ;GAAY;EAAQ,CAAC,CAAC,SAASH,CAAG,IAAG,OAAOuD,EAAOvD,KAExFG,MAAU,KAAA,MAAW,EAAoCH,KAAOG;CAC3E;CAOA,OANIoD,EAAO,UAAUL,EAAQ,SAASK,EAAO,yBAAyBL,EAAQ,wBAC1EK,EAAO,aAAaL,EAAQ,YAAYrD,EAAK0D,GAAQ,UAAU,MAAM1D,EAAKqD,GAAS,UAAU,KAC7FK,EAAO,cAAcL,EAAQ,aAC7B,OAAO,GAAGK,EAAO,MAAML,EAAQ,IAAI,KAAKrD,EAAK0D,GAAQ,MAAM,MAAM1D,EAAKqD,GAAS,MAAM,KACrFC,EAAUI,EAAO,aAAaL,EAAQ,WAAW,KAAKC,EAAUI,EAAO,UAAUL,EAAQ,QAAQ,KACjGC,EAAUI,EAAO,QAAQL,EAAQ,MAAM,IAAUA,IAC9CD,EAAYM,CAAM;AAC3B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ControllerOptions } from './contracts/controller.js';
|
|
2
|
+
import type { ReactCloudletController } from './react.js';
|
|
3
|
+
/** DOM-free state with lazy native clock and per-attempt cancellation adapters. */
|
|
4
|
+
export declare function createCloudlet(options?: ControllerOptions): ReactCloudletController;
|
|
5
|
+
//# sourceMappingURL=create-cloudlet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-cloudlet.d.ts","sourceRoot":"","sources":["../src/create-cloudlet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AA8B1D,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,uBAAuB,CAQnF"}
|