@cloudlet/toast 0.0.0-stage → 1.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +271 -0
  2. package/LICENSE +21 -0
  3. package/README.md +65 -2
  4. package/THIRD_PARTY_NOTICES.md +149 -0
  5. package/dist/contracts/controller.d.ts +71 -0
  6. package/dist/contracts/controller.d.ts.map +1 -0
  7. package/dist/contracts/events.d.ts +72 -0
  8. package/dist/contracts/events.d.ts.map +1 -0
  9. package/dist/contracts/identity.d.ts +32 -0
  10. package/dist/contracts/identity.d.ts.map +1 -0
  11. package/dist/contracts/internal.d.ts +188 -0
  12. package/dist/contracts/internal.d.ts.map +1 -0
  13. package/dist/contracts/notifications.d.ts +101 -0
  14. package/dist/contracts/notifications.d.ts.map +1 -0
  15. package/dist/contracts/operations.d.ts +76 -0
  16. package/dist/contracts/operations.d.ts.map +1 -0
  17. package/dist/contracts/snapshots.d.ts +48 -0
  18. package/dist/contracts/snapshots.d.ts.map +1 -0
  19. package/dist/core/bridge.d.ts +5 -0
  20. package/dist/core/bridge.d.ts.map +1 -0
  21. package/dist/core/bridge.js +277 -0
  22. package/dist/core/bridge.js.map +1 -0
  23. package/dist/core/controller.d.ts +117 -0
  24. package/dist/core/controller.d.ts.map +1 -0
  25. package/dist/core/controller.js +787 -0
  26. package/dist/core/controller.js.map +1 -0
  27. package/dist/core/validation.d.ts +17 -0
  28. package/dist/core/validation.d.ts.map +1 -0
  29. package/dist/core/validation.js +298 -0
  30. package/dist/core/validation.js.map +1 -0
  31. package/dist/create-cloudlet.d.ts +5 -0
  32. package/dist/create-cloudlet.d.ts.map +1 -0
  33. package/dist/create-cloudlet.js +34 -0
  34. package/dist/create-cloudlet.js.map +1 -0
  35. package/dist/index.d.ts +10 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +3 -0
  38. package/dist/react/announcer.d.ts +15 -0
  39. package/dist/react/announcer.d.ts.map +1 -0
  40. package/dist/react/announcer.js +140 -0
  41. package/dist/react/announcer.js.map +1 -0
  42. package/dist/react/bindings.d.ts +17 -0
  43. package/dist/react/bindings.d.ts.map +1 -0
  44. package/dist/react/bindings.js +47 -0
  45. package/dist/react/bindings.js.map +1 -0
  46. package/dist/react/card.d.ts +58 -0
  47. package/dist/react/card.d.ts.map +1 -0
  48. package/dist/react/card.js +300 -0
  49. package/dist/react/card.js.map +1 -0
  50. package/dist/react/generators.d.ts +46 -0
  51. package/dist/react/generators.d.ts.map +1 -0
  52. package/dist/react/generators.js +115 -0
  53. package/dist/react/generators.js.map +1 -0
  54. package/dist/react/gestures.d.ts +50 -0
  55. package/dist/react/gestures.d.ts.map +1 -0
  56. package/dist/react/gestures.js +239 -0
  57. package/dist/react/gestures.js.map +1 -0
  58. package/dist/react/host.d.ts +37 -0
  59. package/dist/react/host.d.ts.map +1 -0
  60. package/dist/react/host.js +816 -0
  61. package/dist/react/host.js.map +1 -0
  62. package/dist/react/motion.d.ts +206 -0
  63. package/dist/react/motion.d.ts.map +1 -0
  64. package/dist/react/motion.js +414 -0
  65. package/dist/react/motion.js.map +1 -0
  66. package/dist/react/plan.d.ts +45 -0
  67. package/dist/react/plan.d.ts.map +1 -0
  68. package/dist/react/plan.js +58 -0
  69. package/dist/react/plan.js.map +1 -0
  70. package/dist/react/renderer.d.ts +7 -0
  71. package/dist/react/renderer.d.ts.map +1 -0
  72. package/dist/react/renderer.js +62 -0
  73. package/dist/react/renderer.js.map +1 -0
  74. package/dist/react/shape.d.ts +7 -0
  75. package/dist/react/shape.d.ts.map +1 -0
  76. package/dist/react/shape.js +21 -0
  77. package/dist/react/shape.js.map +1 -0
  78. package/dist/react/viewport.d.ts +15 -0
  79. package/dist/react/viewport.d.ts.map +1 -0
  80. package/dist/react/viewport.js +16 -0
  81. package/dist/react/viewport.js.map +1 -0
  82. package/dist/react.d.ts +176 -0
  83. package/dist/react.d.ts.map +1 -0
  84. package/dist/react.js +2 -0
  85. package/dist/styles.css +1 -0
  86. package/package.json +19 -4
  87. package/src/contracts/controller.ts +61 -0
  88. package/src/contracts/events.ts +48 -0
  89. package/src/contracts/identity.ts +27 -0
  90. package/src/contracts/internal.ts +150 -0
  91. package/src/contracts/notifications.ts +104 -0
  92. package/src/contracts/operations.ts +71 -0
  93. package/src/contracts/snapshots.ts +59 -0
  94. package/src/core/bridge.ts +280 -0
  95. package/src/core/controller.ts +853 -0
  96. package/src/core/validation.ts +290 -0
  97. package/src/create-cloudlet.ts +43 -0
  98. package/src/index.ts +34 -0
  99. package/src/react/announcer.ts +198 -0
  100. package/src/react/bindings.tsx +56 -0
  101. package/src/react/card.tsx +222 -0
  102. package/src/react/generators.ts +274 -0
  103. package/src/react/gestures.ts +296 -0
  104. package/src/react/host.tsx +953 -0
  105. package/src/react/motion.ts +484 -0
  106. package/src/react/plan.ts +101 -0
  107. package/src/react/renderer.tsx +77 -0
  108. package/src/react/shape.ts +33 -0
  109. package/src/react/viewport.ts +10 -0
  110. package/src/react.ts +190 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.js","names":["freeze","handles","kernels","nextController","EMPTY","COLLAPSED","SERVER","RENDERER_SERVER","IDLE","APPLIED","UNCHANGED","reject","getControllerKernel","kernel","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","withRecord","args","error","action","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","value","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"],"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 FocusRequest, FocusRequestToken, ControllerDependencies, HostLease, OperationAnnouncementPhase, PresentationToken,\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, validateContent, validateOptions, validatePatch, validateSpec, validateTrackOptions } from './validation.js';\n\nexport interface 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;\nexport type Delivery = EventPayload | { readonly callback: () => void; readonly source: string; readonly handle?: NotificationHandle };\n\nexport interface 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. */\nexport interface IslandState<Slot> {\n readonly reason: IslandReason;\n current: RecordState<Slot>;\n}\n\nexport interface 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\nexport const ATTENTION_DELAY = 600;\n\nconst freeze = Object.freeze;\n\n// Weak registries authenticate capabilities without retaining disposed controllers.\nconst handles = new WeakSet<object>();\nconst kernels = new WeakMap<object, ControllerKernel<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});\nexport const 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 });\nexport const APPLIED = freeze({ status: 'applied' as const });\nexport const UNCHANGED = freeze({ status: 'unchanged' as const });\nexport const reject = <Reason extends string>(reason: Reason) => ({ status: 'rejected' as const, reason });\n\ntype Rejected<Reason extends string> = { status: 'rejected'; reason: Reason };\n\n/**\n * Controller state and transactions the renderer bridge needs (core/bridge.ts). The bridge travels\n * in the lazily loaded renderer chunk, so the start bundle carries only this accessor object.\n */\nexport interface ControllerKernel<Slot> {\n readonly options: ReturnType<typeof validateOptions>;\n readonly clock: ControllerDependencies<CancellationSignal>['clock'];\n readonly records: Map<string, RecordState<Slot>>;\n readonly globalPauses: Set<PauseReason>;\n readonly subscribe: CloudletController<Slot, CancellationSignal>['subscribe'];\n readonly onEvent: CloudletController<Slot, CancellationSignal>['onEvent'];\n readonly disposed: boolean;\n readonly presented: RecordState<Slot> | null;\n readonly rendererSnapshot: RendererSnapshot<Slot>;\n readonly overflow: number;\n lease: HostLease | null;\n lastLease: HostLease | null;\n hostDelay: number | undefined;\n hostAutoDismiss: boolean | undefined;\n island: IslandState<Slot> | null;\n attention: AttentionCandidate<Slot> | null;\n focusRequest: FocusRequest | null;\n focused: NotificationHandle | null;\n overflowAnnounced: number;\n readonly token: () => string;\n readonly diagnostic: (diagnostic: Diagnostic) => void;\n readonly failure: (code: Diagnostic['code'], source: string, error: unknown, handle?: NotificationHandle) => void;\n readonly mutate: (apply: (deliveries: Delivery[]) => void, final?: boolean) => typeof APPLIED;\n readonly commit: (deliveries?: readonly Delivery[], now?: number, final?: boolean) => void;\n readonly settle: () => number;\n readonly assign: (record: RecordState<Slot>) => void;\n readonly newest: () => RecordState<Slot> | null;\n readonly handleError: (handle: NotificationHandle) => HandleRejection | 'disposed' | undefined;\n readonly withRecord: <Args extends unknown[], Result>(action: (record: RecordState<Slot>, ...args: Args) => Result)\n => (handle: NotificationHandle, ...args: Args) => Result | Rejected<HandleRejection | 'disposed'>;\n readonly autoDismissing: (host: boolean | undefined) => boolean;\n readonly setHostAutoDismiss: (value: boolean | undefined) => void;\n readonly dismiss: (handle: NotificationHandle, reason: CloseReason) => typeof APPLIED | Rejected<HandleRejection | 'disposed'>;\n readonly acknowledgeOverflow: () => typeof APPLIED | typeof UNCHANGED | Rejected<'disposed'>;\n readonly reportRendererLoadError: (error: unknown) => void;\n}\n\nexport function getControllerKernel<Slot>(controller: object): ControllerKernel<Slot> {\n const kernel = kernels.get(controller);\n if (!kernel) throw new TypeError('Controller was not created by this Cloudlet package instance');\n // The registry stores the kernel together with its controller's opaque Slot type.\n return kernel as ControllerKernel<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\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\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 publish();\n kernels.set(controller, freeze<ControllerKernel<Slot>>({\n options, clock, records, globalPauses, subscribe: controller.subscribe, onEvent: controller.onEvent,\n get disposed() { return disposed; },\n get presented() { return presented; },\n get rendererSnapshot() { return rendererSnapshot; },\n get overflow() { return overflow; },\n get lease() { return lease; }, set lease(value) { lease = value; },\n get lastLease() { return lastLease; }, set lastLease(value) { lastLease = value; },\n get hostDelay() { return hostDelay; }, set hostDelay(value) { hostDelay = value; },\n get hostAutoDismiss() { return hostAutoDismiss; }, set hostAutoDismiss(value) { hostAutoDismiss = value; },\n get island() { return island; }, set island(value) { island = value; },\n get attention() { return attention; }, set attention(value) { attention = value; },\n get focusRequest() { return focusRequest; }, set focusRequest(value) { focusRequest = value; },\n get focused() { return focused; }, set focused(value) { focused = value; },\n get overflowAnnounced() { return overflowAnnounced; }, set overflowAnnounced(value) { overflowAnnounced = value; },\n token, diagnostic, failure, mutate, commit, settle, assign, newest, handleError, withRecord,\n autoDismissing, setHostAutoDismiss, dismiss, acknowledgeOverflow,\n reportRendererLoadError(error) {\n if (!disposed) diagnostic({ code: 'renderer-load-error', source: 'Toaster', message: 'Toaster renderer failed to load', error });\n },\n }) as ControllerKernel<unknown>);\n return controller;\n}\n"],"mappings":";AA4DA,IAAMA,IAAS,OAAO,QAGhBC,oBAAU,IAAI,QAAgB,GAC9BC,oBAAU,IAAI,QAA2C,GAC3DC,IAAiB,GACfC,IAA0BJ,EAAO,CAAC,CAAC,GACnCK,IAA4BL,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;CAAM,CAAC;AAClE,CAAC,GACYO,IAA2CP,EAAO;CAC7D,GAAGM;CAAQ,cAAc;CAAM,cAAc;CAC7C,eAAeN,EAAO;EAAE,eAAeI;EAA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W;GAAE,OAAOP;EAAU;EAClC,IAAI,QAAQ;GAAE,OAAOb;EAAO;EAAG,IAAI,MAAM,GAAO;GAAE,IAAQgF;EAAO;EACjE,IAAI,YAAY;GAAE,OAAO/E;EAAW;EAAG,IAAI,UAAU,GAAO;GAAE,IAAY+E;EAAO;EACjF,IAAI,YAAY;GAAE,OAAOxE;EAAW;EAAG,IAAI,UAAU,GAAO;GAAE,IAAYwE;EAAO;EACjF,IAAI,kBAAkB;GAAE,OAAOvE;EAAiB;EAAG,IAAI,gBAAgB,GAAO;GAAE,IAAkBuE;EAAO;EACzG,IAAI,SAAS;GAAE,OAAO1E;EAAQ;EAAG,IAAI,OAAO,GAAO;GAAE,IAAS0E;EAAO;EACrE,IAAI,YAAY;GAAE,OAAOtE;EAAW;EAAG,IAAI,UAAU,GAAO;GAAE,IAAYsE;EAAO;EACjF,IAAI,eAAe;GAAE,OAAOjF;EAAc;EAAG,IAAI,aAAa,GAAO;GAAE,IAAeiF;EAAO;EAC7F,IAAI,UAAU;GAAE,OAAOlF;EAAS;EAAG,IAAI,QAAQ,GAAO;GAAE,IAAUkF;EAAO;EACzE,IAAI,oBAAoB;GAAE,OAAOlE;EAAmB;EAAG,IAAI,kBAAkB,GAAO;GAAE,IAAoBkE;EAAO;EACjH;EAAO;EAAY;EAAS;EAAQ;EAAQ;EAAQ;EAAQ;EAAQ;EAAa;EACjF;EAAgB;EAAoB;EAAS;EAC7C,wBAAwB,GAAO;GAC7B,AAAKjE,KAAUwB,EAAW;IAAE,MAAM;IAAuB,QAAQ;IAAW,SAAS;IAAmC;GAAM,CAAC;EACjI;CACF,CAAC,CAA8B,GACxBvD;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,EAAM,GAAsB,GAAc,GAAuB;CACxE,EAAO,KAAK,OAAO,OAAO;EAAE;EAAM;CAAQ,CAAC,CAAC;AAC9C;AAGA,SAASC,EACP,GACA,GACA,GACA,GACA,IAAmC,CAAC,GACC;CACrC,IAAsB,OAAOC,KAAU,aAAnCA,KACC,OAAO,eAAeA,CAAK,MAAM,OAAO,aAAa,OAAO,eAAeA,CAAK,MAAM,MAAO;EAChG,EAAMC,GAAQL,GAAM,yBAAyB;EAC7C;CACF;CACA,IAAIM,IAAc;CAClB,KAAK,IAAML,KAAO,QAAQ,QAAQG,CAAK,GAAG;EACxC,IAAMG,IAAa,OAAO,yBAAyBH,GAAOH,CAAG;EAI7D,CAHI,OAAOA,KAAQ,YAAY,CAACO,EAAK,SAASP,CAAG,MAC/CC,EAAMG,GAAQN,EAAGC,GAAMC,CAAG,GAAG,eAAe,GAE1CM,KAAc,EAAE,WAAWA,MAC7BL,EAAMG,GAAQN,EAAGC,GAAMC,CAAG,GAAG,0BAA0B,GACvD,IAAc,MACLM,GAAY,UAAU,KAAA,MACrB,OAAON,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W,EAAK,YAAYA,EAAQ,YACvD,OAAO,OAAOP,CAAI;AAC3B;AAEA,SAASQ,EAAU,GAA0B,GAAoC;CAC/E,IAAIC,MAASC,GAAO,OAAO;CAC3B,IAAI,CAACD,KAAQ,CAACC,GAAO,OAAO;CAC5B,IAAM9C,IAAO,OAAO,KAAK6C,CAAI;CAC7B,OAAO7C,EAAK,WAAW,OAAO,KAAK8C,CAAK,CAAC,CAAC,UAAU9C,EAAK,OAAO,MAC9DV,EAAKwD,GAAOrD,CAAG,KAAK,OAAO,GAAIoD,EAAiCpD,IAAOqD,EAAkCrD,EAAI,CAAC;AAClH;AAGA,SAAgBsD,EACd,GACA,GACqC;CACrC,IAAMC,IAA+B,EAAE,GAAGL,EAAQ;CAClD,KAAK,IAAMlD,KAAOR,GAA6D;EAC7E,IAAMW,IAAQuB,EAAM1B;EACpB,AAAIG,MAAU,QAAQ;GAAC;GAAe;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"}
@@ -0,0 +1,34 @@
1
+ import { createCloudletCore as e } from "./core/controller.js";
2
+ //#region src/create-cloudlet.ts
3
+ function t() {
4
+ return {
5
+ now: () => globalThis.performance.now(),
6
+ schedule(e, t) {
7
+ let n = !1, r, i = () => {
8
+ let a = Math.max(0, e - globalThis.performance.now());
9
+ r = globalThis.setTimeout(() => {
10
+ n || (globalThis.performance.now() < e ? i() : t());
11
+ }, Math.min(a, 2147483647));
12
+ };
13
+ return i(), () => {
14
+ n || (n = !0, globalThis.clearTimeout(r));
15
+ };
16
+ }
17
+ };
18
+ }
19
+ function n(n) {
20
+ return e(n, {
21
+ clock: t(),
22
+ createCancellation: () => {
23
+ let e = new AbortController();
24
+ return {
25
+ signal: e.signal,
26
+ abort: (t) => e.abort(t)
27
+ };
28
+ }
29
+ });
30
+ }
31
+ //#endregion
32
+ export { n as createCloudlet };
33
+
34
+ //# sourceMappingURL=create-cloudlet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-cloudlet.js","names":["createWebClock","cancelled","timer","schedule","delay","deadline","callback","createCloudlet","createCloudletCore","options","controller","reason"],"sources":["../src/create-cloudlet.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ControllerOptions } from './contracts/controller.js';\nimport type { MonotonicClock } from './contracts/internal.js';\nimport type { ReactCloudletController } from './react.js';\nimport { createCloudletCore } from './core/controller.js';\n\n/** A lazy web adapter: constructing a controller allocates no timers or listeners. */\nfunction createWebClock(): MonotonicClock {\n return {\n now: () => globalThis.performance.now(),\n schedule(deadline, callback) {\n let cancelled = false;\n let timer: ReturnType<typeof globalThis.setTimeout>;\n const schedule = () => {\n const delay = Math.max(0, deadline - globalThis.performance.now());\n // Browsers clamp longer delays to a signed 32-bit timeout. Re-arm only\n // at that boundary so long explicit durations cannot expire early.\n timer = globalThis.setTimeout(() => {\n if (cancelled) return;\n if (globalThis.performance.now() < deadline) schedule();\n else callback();\n }, Math.min(delay, 2_147_483_647));\n };\n schedule();\n return () => {\n if (cancelled) return;\n cancelled = true;\n globalThis.clearTimeout(timer);\n };\n },\n };\n}\n\n/** DOM-free state with lazy native clock and per-attempt cancellation adapters. */\nexport function createCloudlet(options?: ControllerOptions): ReactCloudletController {\n return createCloudletCore<ReactNode, AbortSignal>(options, {\n clock: createWebClock(),\n createCancellation: () => {\n const controller = new AbortController();\n return { signal: controller.signal, abort: (reason) => controller.abort(reason) };\n },\n });\n}\n"],"mappings":";;AAOA,SAASA,IAAiC;CACxC,OAAO;EACL,WAAW,WAAW,YAAY,IAAI;EACtC,SAAS,GAAU,GAAU;GAC3B,IAAIC,IAAY,IACZC,GACEC,UAAiB;IACrB,IAAMC,IAAQ,KAAK,IAAI,GAAGC,IAAW,WAAW,YAAY,IAAI,CAAC;IAGjE,IAAQ,WAAW,iBAAiB;KAClC,AAAIJ,MACA,WAAW,YAAY,IAAI,IAAII,IAAUF,EAAS,IACjDG,EAAS;IAChB,GAAG,KAAK,IAAIF,GAAO,UAAa,CAAC;GACnC;GAEA,OADAD,EAAS,SACI;IACX,AAAIF,MACJ,IAAY,IACZ,WAAW,aAAaC,CAAK;GAC/B;EACF;CACF;AACF;AAGA,SAAgBK,EAAe,GAAsD;CACnF,OAAOC,EAA2CC,GAAS;EACzD,OAAOT,EAAe;EACtB,0BAA0B;GACxB,IAAMU,IAAa,IAAI,gBAAgB;GACvC,OAAO;IAAE,QAAQA,EAAW;IAAQ,QAAQ,MAAWA,EAAW,MAAMC,CAAM;GAAE;EAClF;CACF,CAAC;AACH"}
@@ -0,0 +1,10 @@
1
+ export { createCloudlet } from './create-cloudlet.js';
2
+ export { CloudletProvider, useCloudlet, useOptionalCloudlet, Toaster } from './react.js';
3
+ export type * from './contracts/identity.js';
4
+ export type * from './contracts/notifications.js';
5
+ export type * from './contracts/operations.js';
6
+ export type * from './contracts/snapshots.js';
7
+ export type * from './contracts/events.js';
8
+ export type * from './contracts/controller.js';
9
+ export type { ReactNotificationSpec, ReactNotificationPatch, ReactCloudletController, ReactOperationContext, ReactOperationFactory, ReactTrackOptions, CreateCloudlet, CloudletProviderProps, EdgeInsets, ToasterOffsets, ToasterAttention, ToasterMotion, CloudletSpring, CloudletTimedSpring, CloudletMotionConstants, CloudletMotionOverrides, CloudletPart, CloudletLabels, AnnouncementFormatters, ToasterProps, CloudletProviderComponent, UseCloudlet, UseOptionalCloudlet, ToasterComponent, } from './react.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACzF,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,8BAA8B,CAAC;AAClD,mBAAmB,2BAA2B,CAAC;AAC/C,mBAAmB,0BAA0B,CAAC;AAC9C,mBAAmB,uBAAuB,CAAC;AAC3C,mBAAmB,2BAA2B,CAAC;AAC/C,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,yBAAyB,EACzB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { createCloudlet as e } from "./create-cloudlet.js";
2
+ import { CloudletProvider as t, Toaster as n, useCloudlet as r, useOptionalCloudlet as i } from "./react.js";
3
+ export { t as CloudletProvider, n as Toaster, e as createCloudlet, r as useCloudlet, i as useOptionalCloudlet };