@cloudlet/toast 1.1.2 → 1.3.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.
- package/CHANGELOG.md +52 -0
- package/README.md +2 -2
- package/dist/contracts/internal.d.ts +8 -0
- package/dist/contracts/internal.d.ts.map +1 -1
- package/dist/contracts/notifications.d.ts +1 -1
- package/dist/contracts/notifications.d.ts.map +1 -1
- package/dist/core/bridge.js +1 -0
- package/dist/core/bridge.js.map +1 -1
- package/dist/core/controller.d.ts +2 -1
- package/dist/core/controller.d.ts.map +1 -1
- package/dist/core/controller.js +45 -41
- package/dist/core/controller.js.map +1 -1
- package/dist/react/card.d.ts.map +1 -1
- package/dist/react/card.js +2 -0
- package/dist/react/card.js.map +1 -1
- package/dist/react/gestures.d.ts +6 -0
- package/dist/react/gestures.d.ts.map +1 -1
- package/dist/react/gestures.js +28 -15
- package/dist/react/gestures.js.map +1 -1
- package/dist/react/host.d.ts.map +1 -1
- package/dist/react/host.js +297 -257
- package/dist/react/host.js.map +1 -1
- package/dist/react.d.ts +9 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/contracts/internal.ts +4 -0
- package/src/contracts/notifications.ts +1 -0
- package/src/core/bridge.ts +2 -0
- package/src/core/controller.ts +23 -16
- package/src/react/card.tsx +2 -1
- package/src/react/gestures.ts +45 -8
- package/src/react/host.tsx +63 -13
- package/src/react.ts +9 -2
package/dist/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.cloudlet-host{--cloudlet-pill-height:44px;--cloudlet-pill-radius:9999px;--cloudlet-pill-max-width:22rem;--cloudlet-island-radius:24px;--cloudlet-island-max-width:26rem;--cloudlet-tail-offset:4px;--cloudlet-tail-scale:.9;--cloudlet-control-min-size:44px;--cloudlet-viewport-gutter:16px;--cloudlet-font-family:system-ui, sans-serif;--cloudlet-font-size:.875rem;--cloudlet-background:#fff;--cloudlet-foreground:#111113;--cloudlet-muted:#6e6e76;--cloudlet-border:color-mix(in oklab, var(--cloudlet-foreground) 10%, transparent);--cloudlet-action-background:color-mix(in oklab, var(--cloudlet-foreground) 8%, transparent);--cloudlet-shadow:0 10px 30px -12px #00000040, 0 1px 2px #00000014;--cloudlet-tail-background:var(--cloudlet-background);--cloudlet-tail-border:var(--cloudlet-border);--cloudlet-focus:#245cdb;--cloudlet-success:oklch(72.3% .219 142.136);--cloudlet-error:oklch(63.7% .237 25.331);--cloudlet-info:oklch(68.5% .169 237.323);--cloudlet-warning:oklch(79.5% .184 86.047);--cloudlet-loading:oklch(55.6% 0 0);--cloudlet-badge:#d70015;--cloudlet-badge-foreground:#fff;--cloudlet-field-background:var(--cloudlet-action-background);--cloudlet-field-border:transparent;--cloudlet-placeholder:color-mix(in oklab, var(--cloudlet-muted) 85%, var(--cloudlet-foreground));--cloudlet-z-index:1000;--cloudlet-safe-top:env(safe-area-inset-top,0px);--cloudlet-safe-right:env(safe-area-inset-right,0px);--cloudlet-safe-bottom:env(safe-area-inset-bottom,0px);--cloudlet-safe-left:env(safe-area-inset-left,0px);--cloudlet-top:calc(var(--cloudlet-safe-top) + var(--cloudlet-gutter-top,var(--cloudlet-viewport-gutter)) + var(--cloudlet-obstruction-top,0px));--cloudlet-bottom:calc(var(--cloudlet-safe-bottom) + var(--cloudlet-gutter-bottom,var(--cloudlet-viewport-gutter)) + var(--cloudlet-obstruction-bottom,0px));--cloudlet-left:calc(var(--cloudlet-safe-left) + var(--cloudlet-gutter-left,var(--cloudlet-viewport-gutter)) + var(--cloudlet-obstruction-left,0px));--cloudlet-right:calc(var(--cloudlet-safe-right) + var(--cloudlet-gutter-right,var(--cloudlet-viewport-gutter)) + var(--cloudlet-obstruction-right,0px));--cloudlet-host-height:max(0px, calc(var(--cloudlet-viewport-height,100dvh) - var(--cloudlet-top) - var(--cloudlet-bottom)));--cloudlet-available-height:max(0px, calc(var(--cloudlet-host-height) - var(--cloudlet-reserved-height,0px)));z-index:var(--cloudlet-z-index);left:calc(var(--cloudlet-viewport-left,0px) + var(--cloudlet-left));right:calc(var(--cloudlet-viewport-right,0px) + var(--cloudlet-right));bottom:calc(var(--cloudlet-viewport-bottom,0px) + var(--cloudlet-bottom));max-width:var(--cloudlet-island-max-width);max-height:var(--cloudlet-host-height);color:var(--cloudlet-foreground);font:400 var(--cloudlet-font-size)/1.43 var(--cloudlet-font-family);text-align:start;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;pointer-events:none;isolation:isolate;--cloudlet-status:var(--cloudlet-loading);flex-direction:column;margin-inline:auto;display:flex;position:fixed}.cloudlet-host,.cloudlet-host *,.cloudlet-host :before,.cloudlet-host :after{box-sizing:border-box}.cloudlet-host :where(h2,p,ol,li){margin:0;padding:0}.cloudlet-host :where(button,a){font:inherit;color:inherit;line-height:inherit;letter-spacing:inherit;text-transform:none;min-width:var(--cloudlet-control-min-size);min-height:var(--cloudlet-control-min-size);touch-action:manipulation}.cloudlet-host button{appearance:none;cursor:pointer;background:0 0;border:0;border-radius:24px;justify-content:center;align-items:center;margin:0;padding:10px;display:inline-flex}.cloudlet-host button[aria-disabled=true]{color:var(--cloudlet-muted);cursor:progress}.cloudlet-host a{border-radius:24px;align-items:center;padding:10px 16px;text-decoration:underline;display:inline-flex}.cloudlet-host :focus-visible{outline:2px solid var(--cloudlet-focus);outline-offset:2px}.cloudlet-host:focus-visible{outline:2px solid var(--cloudlet-focus);outline-offset:-2px}.cloudlet-host [hidden]{display:none!important}.cloudlet-host [data-kind=success]{--cloudlet-status:var(--cloudlet-success)}.cloudlet-host [data-kind=error]{--cloudlet-status:var(--cloudlet-error)}.cloudlet-host [data-kind=info]{--cloudlet-status:var(--cloudlet-info)}.cloudlet-host [data-kind=warning]{--cloudlet-status:var(--cloudlet-warning)}.cloudlet-host [data-kind=loading]{--cloudlet-status:var(--cloudlet-loading)}.cloudlet-host .cloudlet-stack{flex:none;align-self:center;width:fit-content;max-width:100%;position:relative}.cloudlet-host[data-state=island] .cloudlet-stack{width:100%}.cloudlet-host .cloudlet-shell{transform-origin:50% 0;z-index:1;position:relative}.cloudlet-host[data-edge=bottom] .cloudlet-shell{transform-origin:50% 100%}.cloudlet-host .cloudlet-bg{pointer-events:none;box-shadow:var(--cloudlet-shadow);position:absolute;top:0;left:50%;overflow:visible;transform:translate(-50%)}.cloudlet-host .cloudlet-bg path{fill:var(--cloudlet-background);stroke:var(--cloudlet-border);stroke-width:1px}.cloudlet-host :is(.cloudlet-tail,.cloudlet-exit){pointer-events:none;position:absolute;top:0;left:50%}.cloudlet-host .cloudlet-tail{z-index:0;border-radius:var(--cloudlet-pill-radius);background:var(--cloudlet-tail-background);border:1px solid var(--cloudlet-tail-border);box-shadow:var(--cloudlet-shadow);transform-origin:50% 100%;opacity:0}.cloudlet-host .cloudlet-tail[data-cloudlet-tail="2"]{z-index:-1;background:color-mix(in oklab, var(--cloudlet-tail-background) 60%, var(--cloudlet-background))}.cloudlet-host .cloudlet-exit{z-index:2;transform-origin:50% 0}.cloudlet-host[data-edge=bottom] :is(.cloudlet-bg,.cloudlet-tail,.cloudlet-exit,.cloudlet-badge){top:auto;bottom:0}.cloudlet-host[data-edge=bottom] .cloudlet-tail{transform-origin:50% 0}.cloudlet-host[data-edge=bottom] .cloudlet-exit{transform-origin:50% 100%}.cloudlet-host .cloudlet-exit:empty{display:none}.cloudlet-host .cloudlet-clip{pointer-events:auto;color:var(--cloudlet-foreground);overflow-wrap:anywhere;width:fit-content;min-width:0;max-width:min(100%, var(--cloudlet-pill-max-width));min-height:var(--cloudlet-pill-height);border-radius:var(--cloudlet-pill-radius);flex-direction:column;display:flex;position:relative}.cloudlet-host .cloudlet-shell[data-state=island]>.cloudlet-clip{width:100%;max-width:100%;max-height:var(--cloudlet-available-height);border-radius:var(--cloudlet-island-radius)}.cloudlet-host :is(.cloudlet-slide-out,.cloudlet-chrome-out){pointer-events:none;position:absolute;top:0;left:0}.cloudlet-host :is(.cloudlet-slide-out,.cloudlet-chrome-out):empty{display:none}.cloudlet-host .cloudlet-chrome-out .cloudlet-clip{width:100%;max-width:none}.cloudlet-host .cloudlet-ghost{visibility:hidden}.cloudlet-host .cloudlet-slide{flex-direction:column;flex:0 auto;min-height:0;display:flex;position:relative}.cloudlet-host .cloudlet-header{flex:none;min-width:0;display:flex;position:relative}.cloudlet-host .cloudlet-heading{min-width:0;min-height:var(--cloudlet-pill-height);flex:1;align-items:center;gap:10px;padding-block:6px;padding-inline:10px 16px;display:flex}.cloudlet-host .cloudlet-shell[data-state=island] .cloudlet-heading{padding-block:10px 6px;padding-inline:14px 52px}.cloudlet-host .cloudlet-heading-out{pointer-events:none;display:flex;position:absolute;inset:0}.cloudlet-host .cloudlet-heading-out:empty{display:none}.cloudlet-host .cloudlet-title{font:inherit;text-transform:none;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-weight:500;overflow:hidden}.cloudlet-host .cloudlet-shell[data-state=island] .cloudlet-title{white-space:normal;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box}.cloudlet-host .cloudlet-title:focus{outline:none}.cloudlet-host .cloudlet-title:focus-visible{outline:2px solid var(--cloudlet-focus);outline-offset:2px;border-radius:4px}.cloudlet-host .cloudlet-pill{z-index:1;pointer-events:auto;border-radius:var(--cloudlet-pill-radius);width:100%;height:100%;padding:0;position:absolute;inset:0}.cloudlet-host .cloudlet-pill,.cloudlet-host .cloudlet-shell[data-state=island]>.cloudlet-clip,.cloudlet-host .cloudlet-shell[data-state=island] .cloudlet-body{touch-action:pan-y}.cloudlet-host .cloudlet-shell[data-state=island]>.cloudlet-clip>.cloudlet-slide>.cloudlet-header{touch-action:none}.cloudlet-host[data-dragging]{-webkit-user-select:none;user-select:none}.cloudlet-host .cloudlet-peek{pointer-events:none;position:absolute;top:0;left:0}.cloudlet-host .cloudlet-badge{z-index:2;background:var(--cloudlet-badge);min-width:20px;height:20px;color:var(--cloudlet-badge-foreground);box-shadow:0 0 0 2px var(--cloudlet-background);font:600 .6875rem/20px var(--cloudlet-font-family);font-variant-numeric:tabular-nums;text-align:center;pointer-events:none;opacity:0;border-radius:9999px;padding-inline:6px;display:grid;position:absolute;top:0;left:50%}.cloudlet-host .cloudlet-badge>*{grid-area:1/1}.cloudlet-host .cloudlet-icon{width:24px;height:24px;color:var(--cloudlet-status);background:color-mix(in oklab, var(--cloudlet-status) 18%, transparent);border-radius:50%;flex:none;place-items:center;display:grid;position:relative}.cloudlet-host .cloudlet-glyph{place-items:center;width:16px;height:16px;display:grid;overflow:hidden}.cloudlet-host .cloudlet-glyph>.cloudlet-slot{place-items:center;width:100%;height:100%;display:grid}.cloudlet-host .cloudlet-glyph :is(svg,img){max-width:100%;max-height:100%;display:block}.cloudlet-host :is(svg.cloudlet-glyph,button>svg){fill:none;stroke:currentColor;stroke-width:1.75px;stroke-linecap:round;stroke-linejoin:round;display:block}.cloudlet-host .cloudlet-ring{fill:none;stroke-width:2px;width:32px;height:32px;position:absolute;inset:-4px;overflow:visible}.cloudlet-host .cloudlet-ring-track{stroke:color-mix(in oklab, var(--cloudlet-status) 18%, transparent)}.cloudlet-host .cloudlet-progress-fill{stroke:color-mix(in oklab, var(--cloudlet-status) 75%, var(--cloudlet-foreground));stroke-linecap:round}.cloudlet-host .cloudlet-close{top:8px;z-index:1;width:32px;min-width:0;height:32px;min-height:0;color:var(--cloudlet-muted);background:var(--cloudlet-action-background);border-radius:50%;padding:0;position:absolute;inset-inline-end:8px}.cloudlet-host .cloudlet-close>svg{width:16px;height:16px}.cloudlet-host :is(.cloudlet-close,.cloudlet-action,.cloudlet-overflow button):before{content:"";inset-block:calc((var(--cloudlet-control-min-size) - 32px) / -2);position:absolute;inset-inline:0}.cloudlet-host button.cloudlet-close:before{inset-inline:calc((var(--cloudlet-control-min-size) - 32px) / -2);border-radius:50%}.cloudlet-host .cloudlet-body{overscroll-behavior:contain;min-height:0;max-height:min(calc(var(--cloudlet-available-height) * .6), 24rem);flex-direction:column;padding-block:0 10px;padding-inline:48px 16px;display:flex;position:relative;overflow:auto}.cloudlet-host .cloudlet-body:not(:has(>:not(.cloudlet-actions:empty))){padding-bottom:4px}.cloudlet-host .cloudlet-body-out{pointer-events:none;position:absolute;left:0;right:0}.cloudlet-host .cloudlet-body-out:empty{display:none}.cloudlet-host .cloudlet-description{color:var(--cloudlet-muted);padding-block:0 4px;font-size:.8125rem;line-height:1.45}.cloudlet-host .cloudlet-actions{flex-wrap:wrap;flex:none;gap:12px 8px;display:flex}.cloudlet-host .cloudlet-actions:empty{display:none}.cloudlet-host .cloudlet-actions:not(:empty){margin-block:8px 2px}.cloudlet-host :is(.cloudlet-action,.cloudlet-overflow button){overflow-wrap:anywhere;min-width:0;max-width:100%;min-height:32px;color:var(--cloudlet-foreground);background:var(--cloudlet-action-background);border-radius:9999px;padding:6px 14px;font-size:.8125rem;font-weight:500;line-height:1.5;text-decoration:none;position:relative}.cloudlet-host .cloudlet-action.cloudlet-primary{color:color-mix(in oklab, var(--cloudlet-status) 55%, var(--cloudlet-foreground));background:color-mix(in oklab, var(--cloudlet-status) 12%, transparent)}.cloudlet-host :is(.cloudlet-action,.cloudlet-overflow button)[aria-disabled=true]{color:var(--cloudlet-muted)}@media (hover:hover){.cloudlet-host :is(.cloudlet-close,.cloudlet-action,.cloudlet-overflow button):hover{background:color-mix(in oklab, var(--cloudlet-foreground) 13%, transparent)}.cloudlet-host .cloudlet-close:hover{color:var(--cloudlet-foreground)}.cloudlet-host .cloudlet-action.cloudlet-primary:hover{background:color-mix(in oklab, var(--cloudlet-status) 20%, transparent)}.cloudlet-host .cloudlet-action.cloudlet-submit:hover{background:color-mix(in oklab, var(--cloudlet-status) 70%, #000)}}.cloudlet-host .cloudlet-action-error{color:var(--cloudlet-muted);padding-block:4px;font-size:.8125rem}.cloudlet-host .cloudlet-form{flex-direction:column;gap:8px;margin-block:4px 2px;display:flex}.cloudlet-host .cloudlet-form-row{grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:4px 8px;display:grid}.cloudlet-host .cloudlet-field{border:1px solid var(--cloudlet-field-border);width:100%;min-width:0;min-height:36px;color:var(--cloudlet-foreground);background:var(--cloudlet-field-background);font:inherit;resize:none;overflow-wrap:anywhere;border-radius:18px;grid-column:1;margin:0;padding:7px 13px;line-height:20px}.cloudlet-host .cloudlet-field::placeholder{color:var(--cloudlet-placeholder);opacity:1}.cloudlet-host .cloudlet-field:focus-visible{outline-offset:1px}.cloudlet-host .cloudlet-field[aria-invalid=true]{border-color:var(--cloudlet-error)}.cloudlet-host .cloudlet-field[aria-invalid=true]:focus-visible{outline-color:var(--cloudlet-error);border-color:#0000}.cloudlet-host .cloudlet-field[readonly]{color:var(--cloudlet-muted)}.cloudlet-host :is(.cloudlet-form>.cloudlet-action-error,.cloudlet-form~.cloudlet-action-error){padding-inline:14px}.cloudlet-host .cloudlet-field-error{color:color-mix(in oklab, var(--cloudlet-error) 70%, var(--cloudlet-foreground));grid-column:1/-1;padding-inline:14px;font-size:.8125rem}.cloudlet-host .cloudlet-action.cloudlet-submit{color:#fff;background:color-mix(in oklab, var(--cloudlet-status) 80%, #000);border-radius:50%;grid-column:2;place-items:center;width:36px;min-width:0;height:36px;min-height:0;padding:0;display:grid}.cloudlet-host .cloudlet-submit>svg{stroke-width:2px;width:16px;height:16px}.cloudlet-host button.cloudlet-submit:before{inset:calc((var(--cloudlet-control-min-size) - 36px) / -2);border-radius:50%}.cloudlet-host .cloudlet-indicator{color:var(--cloudlet-muted);flex-wrap:wrap;flex:none;justify-content:center;align-items:center;column-gap:8px;padding-bottom:6px;font-size:.75rem;display:flex}.cloudlet-host .cloudlet-indicator .cloudlet-dot-button{min-width:24px;min-height:24px;padding:8px}.cloudlet-host .cloudlet-dot{background:color-mix(in oklab, var(--cloudlet-foreground) 25%, transparent);border-radius:50%;width:6px;height:6px;display:block}.cloudlet-host .cloudlet-indicator [aria-current=true] .cloudlet-dot{background:var(--cloudlet-foreground)}.cloudlet-host .cloudlet-page{font-variant-numeric:tabular-nums;padding:8px;display:grid}.cloudlet-host .cloudlet-page>*{grid-area:1/1}.cloudlet-host .cloudlet-overflow{flex-wrap:wrap;justify-content:center;align-items:center;gap:4px 8px;min-width:0;display:flex}.cloudlet-host .cloudlet-overflow button{font-size:.75rem}.cloudlet-host .cloudlet-live{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.cloudlet-announcer{clip-path:inset(50%);white-space:nowrap;pointer-events:none;border:0;width:1px;height:1px;margin:-1px;padding:0;position:fixed;top:0;left:0;overflow:hidden}.cloudlet-host[data-position=top-center]{top:calc(var(--cloudlet-viewport-top,0px) + var(--cloudlet-top));bottom:auto}@media (width>=48rem){.cloudlet-host[data-position=auto]{top:calc(var(--cloudlet-viewport-top,0px) + var(--cloudlet-top));bottom:auto}}.cloudlet-host[data-theme=dark]{--cloudlet-background:#1c1c1e;--cloudlet-foreground:#f5f5f7;--cloudlet-muted:#a1a1aa;--cloudlet-focus:#93b4ff;--cloudlet-shadow:0 12px 32px -12px #0009;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--cloudlet-tail-background:color-mix(in oklab, var(--cloudlet-foreground) 14%, var(--cloudlet-background));--cloudlet-tail-border:color-mix(in oklab, var(--cloudlet-foreground) 18%, transparent)}@media (prefers-color-scheme:dark){.cloudlet-host[data-theme=system]{--cloudlet-background:#1c1c1e;--cloudlet-foreground:#f5f5f7;--cloudlet-muted:#a1a1aa;--cloudlet-focus:#93b4ff;--cloudlet-shadow:0 12px 32px -12px #0009;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--cloudlet-tail-background:color-mix(in oklab, var(--cloudlet-foreground) 14%, var(--cloudlet-background));--cloudlet-tail-border:color-mix(in oklab, var(--cloudlet-foreground) 18%, transparent)}}@keyframes cloudlet-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:no-preference){.cloudlet-host .cloudlet-spinner{animation:.8s linear infinite cloudlet-spin}.cloudlet-host .cloudlet-ring[data-progress=indeterminate]{animation:1s linear infinite cloudlet-spin}.cloudlet-host[data-reduced-motion=true] :is(.cloudlet-spinner,.cloudlet-ring){animation:none}}@media (forced-colors:active){.cloudlet-host[data-theme]{--cloudlet-background:Canvas;--cloudlet-foreground:CanvasText;--cloudlet-muted:CanvasText;--cloudlet-border:CanvasText;--cloudlet-focus:Highlight;--cloudlet-action-background:Canvas;--cloudlet-status:CanvasText;--cloudlet-success:CanvasText;--cloudlet-error:CanvasText;--cloudlet-info:CanvasText;--cloudlet-warning:CanvasText;--cloudlet-loading:CanvasText;--cloudlet-badge:Highlight;--cloudlet-badge-foreground:HighlightText}.cloudlet-host :is(.cloudlet-bg,.cloudlet-icon,.cloudlet-badge,.cloudlet-dot){forced-color-adjust:none}.cloudlet-host .cloudlet-icon{outline-offset:-1px;background:canvas;outline:1px solid canvastext}.cloudlet-host .cloudlet-ring-track{stroke:graytext}.cloudlet-host .cloudlet-dot{background:canvas;outline:1px solid canvastext}.cloudlet-host .cloudlet-indicator [aria-current=true] .cloudlet-dot{background:canvastext}.cloudlet-host :is(.cloudlet-close,.cloudlet-action,.cloudlet-overflow button){border:1px solid buttontext}.cloudlet-host .cloudlet-field{color:fieldtext;background:field;border-color:canvastext}.cloudlet-host .cloudlet-field[aria-invalid=true]{border-width:2px}.cloudlet-host .cloudlet-action.cloudlet-submit{forced-color-adjust:none;color:highlighttext;background:highlight;border-color:highlight}}
|
|
1
|
+
.cloudlet-host{--cloudlet-pill-height:44px;--cloudlet-pill-radius:9999px;--cloudlet-pill-max-width:22rem;--cloudlet-island-radius:24px;--cloudlet-island-max-width:26rem;--cloudlet-tail-offset:4px;--cloudlet-tail-scale:.9;--cloudlet-control-min-size:44px;--cloudlet-viewport-gutter:16px;--cloudlet-font-family:system-ui, sans-serif;--cloudlet-font-size:.875rem;--cloudlet-background:#fff;--cloudlet-foreground:#111113;--cloudlet-muted:#6e6e76;--cloudlet-border:color-mix(in oklab, var(--cloudlet-foreground) 10%, transparent);--cloudlet-action-background:color-mix(in oklab, var(--cloudlet-foreground) 8%, transparent);--cloudlet-shadow:0 10px 30px -12px #00000040, 0 1px 2px #00000014;--cloudlet-tail-background:var(--cloudlet-background);--cloudlet-tail-border:var(--cloudlet-border);--cloudlet-focus:#245cdb;--cloudlet-success:oklch(72.3% .219 142.136);--cloudlet-error:oklch(63.7% .237 25.331);--cloudlet-info:oklch(68.5% .169 237.323);--cloudlet-warning:oklch(79.5% .184 86.047);--cloudlet-loading:oklch(55.6% 0 0);--cloudlet-badge:#d70015;--cloudlet-badge-foreground:#fff;--cloudlet-field-background:var(--cloudlet-action-background);--cloudlet-field-border:transparent;--cloudlet-placeholder:color-mix(in oklab, var(--cloudlet-muted) 85%, var(--cloudlet-foreground));--cloudlet-z-index:1000;--cloudlet-safe-top:env(safe-area-inset-top,0px);--cloudlet-safe-right:env(safe-area-inset-right,0px);--cloudlet-safe-bottom:env(safe-area-inset-bottom,0px);--cloudlet-safe-left:env(safe-area-inset-left,0px);--cloudlet-top:calc(var(--cloudlet-safe-top) + var(--cloudlet-gutter-top,var(--cloudlet-viewport-gutter)) + var(--cloudlet-obstruction-top,0px));--cloudlet-bottom:calc(var(--cloudlet-safe-bottom) + var(--cloudlet-gutter-bottom,var(--cloudlet-viewport-gutter)) + var(--cloudlet-obstruction-bottom,0px));--cloudlet-left:calc(var(--cloudlet-safe-left) + var(--cloudlet-gutter-left,var(--cloudlet-viewport-gutter)) + var(--cloudlet-obstruction-left,0px));--cloudlet-right:calc(var(--cloudlet-safe-right) + var(--cloudlet-gutter-right,var(--cloudlet-viewport-gutter)) + var(--cloudlet-obstruction-right,0px));--cloudlet-host-height:max(0px, calc(var(--cloudlet-viewport-height,100dvh) - var(--cloudlet-top) - var(--cloudlet-bottom)));--cloudlet-available-height:max(0px, calc(var(--cloudlet-host-height) - var(--cloudlet-reserved-height,0px)));z-index:var(--cloudlet-z-index);left:calc(var(--cloudlet-viewport-left,0px) + var(--cloudlet-left));right:calc(var(--cloudlet-viewport-right,0px) + var(--cloudlet-right));bottom:calc(var(--cloudlet-viewport-bottom,0px) + var(--cloudlet-bottom));max-width:var(--cloudlet-island-max-width);max-height:var(--cloudlet-host-height);color:var(--cloudlet-foreground);--cloudlet-anchor:50%;font:400 var(--cloudlet-font-size)/1.43 var(--cloudlet-font-family);text-align:start;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;pointer-events:none;isolation:isolate;--cloudlet-status:var(--cloudlet-loading);flex-direction:column;margin-inline:auto;display:flex;position:fixed}.cloudlet-host,.cloudlet-host *,.cloudlet-host :before,.cloudlet-host :after{box-sizing:border-box}.cloudlet-host :where(h2,p,ol,li){margin:0;padding:0}.cloudlet-host :where(button,a){font:inherit;color:inherit;line-height:inherit;letter-spacing:inherit;text-transform:none;min-width:var(--cloudlet-control-min-size);min-height:var(--cloudlet-control-min-size);touch-action:manipulation}.cloudlet-host button{appearance:none;cursor:pointer;background:0 0;border:0;border-radius:24px;justify-content:center;align-items:center;margin:0;padding:10px;display:inline-flex}.cloudlet-host button[aria-disabled=true]{color:var(--cloudlet-muted);cursor:progress}.cloudlet-host a{border-radius:24px;align-items:center;padding:10px 16px;text-decoration:underline;display:inline-flex}.cloudlet-host :focus-visible{outline:2px solid var(--cloudlet-focus);outline-offset:2px}.cloudlet-host:focus-visible{outline:2px solid var(--cloudlet-focus);outline-offset:-2px}.cloudlet-host [hidden]{display:none!important}.cloudlet-host [data-kind=success]{--cloudlet-status:var(--cloudlet-success)}.cloudlet-host [data-kind=error]{--cloudlet-status:var(--cloudlet-error)}.cloudlet-host [data-kind=info]{--cloudlet-status:var(--cloudlet-info)}.cloudlet-host [data-kind=warning]{--cloudlet-status:var(--cloudlet-warning)}.cloudlet-host [data-kind=loading]{--cloudlet-status:var(--cloudlet-loading)}.cloudlet-host .cloudlet-stack{flex:none;align-self:center;width:fit-content;max-width:100%;position:relative}.cloudlet-host[data-state=island] .cloudlet-stack{width:100%}.cloudlet-host .cloudlet-shell{transform-origin:var(--cloudlet-anchor) 0;z-index:1;position:relative}.cloudlet-host[data-edge=bottom] .cloudlet-shell{transform-origin:var(--cloudlet-anchor) 100%}.cloudlet-host .cloudlet-bg{top:0;left:var(--cloudlet-anchor);transform:translateX(calc(-1 * var(--cloudlet-anchor)));pointer-events:none;box-shadow:var(--cloudlet-shadow);position:absolute;overflow:visible}.cloudlet-host .cloudlet-bg path{fill:var(--cloudlet-background);stroke:var(--cloudlet-border);stroke-width:1px}.cloudlet-host :is(.cloudlet-tail,.cloudlet-exit){top:0;left:var(--cloudlet-anchor);pointer-events:none;position:absolute}.cloudlet-host .cloudlet-tail{z-index:0;border-radius:var(--cloudlet-pill-radius);background:var(--cloudlet-tail-background);border:1px solid var(--cloudlet-tail-border);box-shadow:var(--cloudlet-shadow);transform-origin:var(--cloudlet-anchor) 100%;opacity:0}.cloudlet-host .cloudlet-tail[data-cloudlet-tail="2"]{z-index:-1;background:color-mix(in oklab, var(--cloudlet-tail-background) 60%, var(--cloudlet-background))}.cloudlet-host .cloudlet-exit{z-index:2;transform-origin:var(--cloudlet-anchor) 0}.cloudlet-host[data-edge=bottom] :is(.cloudlet-bg,.cloudlet-tail,.cloudlet-exit,.cloudlet-badge){top:auto;bottom:0}.cloudlet-host[data-edge=bottom] .cloudlet-tail{transform-origin:var(--cloudlet-anchor) 0}.cloudlet-host[data-edge=bottom] .cloudlet-exit{transform-origin:var(--cloudlet-anchor) 100%}.cloudlet-host .cloudlet-exit:empty{display:none}.cloudlet-host .cloudlet-clip{pointer-events:auto;color:var(--cloudlet-foreground);overflow-wrap:anywhere;width:fit-content;min-width:0;max-width:min(100%, var(--cloudlet-pill-max-width));min-height:var(--cloudlet-pill-height);border-radius:var(--cloudlet-pill-radius);flex-direction:column;display:flex;position:relative}.cloudlet-host .cloudlet-shell[data-state=island]>.cloudlet-clip{width:100%;max-width:100%;max-height:var(--cloudlet-available-height);border-radius:var(--cloudlet-island-radius)}.cloudlet-host :is(.cloudlet-slide-out,.cloudlet-chrome-out){pointer-events:none;position:absolute;top:0;left:0}.cloudlet-host :is(.cloudlet-slide-out,.cloudlet-chrome-out):empty{display:none}.cloudlet-host .cloudlet-chrome-out .cloudlet-clip{width:100%;max-width:none}.cloudlet-host .cloudlet-ghost{visibility:hidden}.cloudlet-host .cloudlet-slide{flex-direction:column;flex:0 auto;min-height:0;display:flex;position:relative}.cloudlet-host .cloudlet-header{flex:none;min-width:0;display:flex;position:relative}.cloudlet-host .cloudlet-heading{min-width:0;min-height:var(--cloudlet-pill-height);flex:1;align-items:center;gap:10px;padding-block:6px;padding-inline:10px 16px;display:flex}.cloudlet-host .cloudlet-shell[data-state=island] .cloudlet-heading{padding-block:10px 6px;padding-inline:14px 52px}.cloudlet-host .cloudlet-heading-out{pointer-events:none;display:flex;position:absolute;inset:0}.cloudlet-host .cloudlet-heading-out:empty{display:none}.cloudlet-host .cloudlet-title{font:inherit;text-transform:none;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-weight:500;overflow:hidden}.cloudlet-host .cloudlet-shell[data-state=island] .cloudlet-title{white-space:normal;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box}.cloudlet-host .cloudlet-title:focus{outline:none}.cloudlet-host .cloudlet-title:focus-visible{outline:2px solid var(--cloudlet-focus);outline-offset:2px;border-radius:4px}.cloudlet-host .cloudlet-pill{z-index:1;pointer-events:auto;border-radius:var(--cloudlet-pill-radius);width:100%;height:100%;padding:0;position:absolute;inset:0}.cloudlet-host .cloudlet-pill,.cloudlet-host .cloudlet-shell[data-state=island]>.cloudlet-clip,.cloudlet-host .cloudlet-shell[data-state=island] .cloudlet-body{touch-action:pan-y}.cloudlet-host .cloudlet-shell[data-state=island]>.cloudlet-clip>.cloudlet-slide>.cloudlet-header{touch-action:none}.cloudlet-host[data-dragging]{-webkit-user-select:none;user-select:none}.cloudlet-host .cloudlet-peek{pointer-events:none;position:absolute;top:0;left:0}.cloudlet-host .cloudlet-badge{z-index:2;background:var(--cloudlet-badge);min-width:20px;height:20px;color:var(--cloudlet-badge-foreground);box-shadow:0 0 0 2px var(--cloudlet-background);font:600 .6875rem/20px var(--cloudlet-font-family);font-variant-numeric:tabular-nums;text-align:center;pointer-events:none;opacity:0;border-radius:9999px;padding-inline:6px;display:grid;position:absolute;top:0;left:50%}.cloudlet-host .cloudlet-badge>*{grid-area:1/1}.cloudlet-host .cloudlet-icon{width:24px;height:24px;color:var(--cloudlet-status);background:color-mix(in oklab, var(--cloudlet-status) 18%, transparent);border-radius:50%;flex:none;place-items:center;display:grid;position:relative}.cloudlet-host .cloudlet-glyph{place-items:center;width:16px;height:16px;display:grid;overflow:hidden}.cloudlet-host .cloudlet-glyph>.cloudlet-slot{place-items:center;width:100%;height:100%;display:grid}.cloudlet-host .cloudlet-glyph :is(svg,img){max-width:100%;max-height:100%;display:block}.cloudlet-host :is(svg.cloudlet-glyph,button>svg){fill:none;stroke:currentColor;stroke-width:1.75px;stroke-linecap:round;stroke-linejoin:round;display:block}.cloudlet-host .cloudlet-ring{fill:none;stroke-width:2px;width:32px;height:32px;position:absolute;inset:-4px;overflow:visible}.cloudlet-host .cloudlet-ring-track{stroke:color-mix(in oklab, var(--cloudlet-status) 18%, transparent)}.cloudlet-host .cloudlet-progress-fill{stroke:color-mix(in oklab, var(--cloudlet-status) 75%, var(--cloudlet-foreground));stroke-linecap:round}.cloudlet-host .cloudlet-close{top:8px;z-index:1;width:32px;min-width:0;height:32px;min-height:0;color:var(--cloudlet-muted);background:var(--cloudlet-action-background);border-radius:50%;padding:0;position:absolute;inset-inline-end:8px}.cloudlet-host .cloudlet-close>svg{width:16px;height:16px}.cloudlet-host :is(.cloudlet-close,.cloudlet-action,.cloudlet-clear,.cloudlet-overflow button):before{content:"";inset-block:calc((var(--cloudlet-control-min-size) - 32px) / -2);position:absolute;inset-inline:0}.cloudlet-host button.cloudlet-close:before{inset-inline:calc((var(--cloudlet-control-min-size) - 32px) / -2);border-radius:50%}.cloudlet-host .cloudlet-body{overscroll-behavior:contain;min-height:0;max-height:min(calc(var(--cloudlet-available-height) * .6), 24rem);flex-direction:column;padding-block:0 10px;padding-inline:48px 16px;display:flex;position:relative;overflow:auto}.cloudlet-host .cloudlet-body:not(:has(>:not(.cloudlet-actions:empty))){padding-bottom:4px}.cloudlet-host .cloudlet-body-out{pointer-events:none;position:absolute;left:0;right:0}.cloudlet-host .cloudlet-body-out:empty{display:none}.cloudlet-host .cloudlet-description{color:var(--cloudlet-muted);padding-block:0 4px;font-size:.8125rem;line-height:1.45}.cloudlet-host .cloudlet-actions{flex-wrap:wrap;flex:none;gap:12px 8px;display:flex}.cloudlet-host .cloudlet-actions:empty{display:none}.cloudlet-host .cloudlet-actions:not(:empty){margin-block:8px 2px}.cloudlet-host :is(.cloudlet-action,.cloudlet-clear,.cloudlet-overflow button){overflow-wrap:anywhere;min-width:0;max-width:100%;min-height:32px;color:var(--cloudlet-foreground);background:var(--cloudlet-action-background);border-radius:9999px;padding:6px 14px;font-size:.8125rem;font-weight:500;line-height:1.5;text-decoration:none;position:relative}.cloudlet-host .cloudlet-action.cloudlet-primary{color:color-mix(in oklab, var(--cloudlet-status) 55%, var(--cloudlet-foreground));background:color-mix(in oklab, var(--cloudlet-status) 12%, transparent)}.cloudlet-host :is(.cloudlet-action,.cloudlet-overflow button)[aria-disabled=true]{color:var(--cloudlet-muted)}@media (hover:hover){.cloudlet-host :is(.cloudlet-close,.cloudlet-action,.cloudlet-clear,.cloudlet-overflow button):hover{background:color-mix(in oklab, var(--cloudlet-foreground) 13%, transparent)}.cloudlet-host .cloudlet-close:hover{color:var(--cloudlet-foreground)}.cloudlet-host .cloudlet-clear[data-armed=true]:hover{background:color-mix(in oklab, var(--cloudlet-error) 22%, transparent)}.cloudlet-host .cloudlet-action.cloudlet-primary:hover{background:color-mix(in oklab, var(--cloudlet-status) 20%, transparent)}.cloudlet-host .cloudlet-action.cloudlet-submit:hover{background:color-mix(in oklab, var(--cloudlet-status) 70%, #000)}}.cloudlet-host .cloudlet-action-error{color:var(--cloudlet-muted);padding-block:4px;font-size:.8125rem}.cloudlet-host .cloudlet-form{flex-direction:column;gap:8px;margin-block:4px 2px;display:flex}.cloudlet-host .cloudlet-form-row{grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:4px 8px;display:grid}.cloudlet-host .cloudlet-field{border:1px solid var(--cloudlet-field-border);width:100%;min-width:0;min-height:36px;color:var(--cloudlet-foreground);background:var(--cloudlet-field-background);font:inherit;resize:none;overflow-wrap:anywhere;border-radius:18px;grid-column:1;margin:0;padding:7px 13px;line-height:20px}.cloudlet-host .cloudlet-field::placeholder{color:var(--cloudlet-placeholder);opacity:1}.cloudlet-host .cloudlet-field:focus-visible{outline-offset:1px}.cloudlet-host .cloudlet-field[aria-invalid=true]{border-color:var(--cloudlet-error)}.cloudlet-host .cloudlet-field[aria-invalid=true]:focus-visible{outline-color:var(--cloudlet-error);border-color:#0000}.cloudlet-host .cloudlet-field[readonly]{color:var(--cloudlet-muted)}.cloudlet-host :is(.cloudlet-form>.cloudlet-action-error,.cloudlet-form~.cloudlet-action-error){padding-inline:14px}.cloudlet-host .cloudlet-field-error{color:color-mix(in oklab, var(--cloudlet-error) 70%, var(--cloudlet-foreground));grid-column:1/-1;padding-inline:14px;font-size:.8125rem}.cloudlet-host .cloudlet-action.cloudlet-submit{color:#fff;background:color-mix(in oklab, var(--cloudlet-status) 80%, #000);border-radius:50%;grid-column:2;place-items:center;width:36px;min-width:0;height:36px;min-height:0;padding:0;display:grid}.cloudlet-host .cloudlet-submit>svg{stroke-width:2px;width:16px;height:16px}.cloudlet-host button.cloudlet-submit:before{inset:calc((var(--cloudlet-control-min-size) - 36px) / -2);border-radius:50%}.cloudlet-host .cloudlet-indicator{color:var(--cloudlet-muted);flex:none;grid-template-columns:1fr auto 1fr;align-items:center;column-gap:8px;padding:0 16px 6px;font-size:.75rem;display:grid}.cloudlet-host .cloudlet-indicator>:is(.cloudlet-dots,.cloudlet-page){grid-column:2}.cloudlet-host .cloudlet-dots{display:flex}.cloudlet-host .cloudlet-indicator .cloudlet-dot-button{min-width:24px;min-height:24px;padding:8px}.cloudlet-host .cloudlet-dot{background:color-mix(in oklab, var(--cloudlet-foreground) 25%, transparent);border-radius:50%;width:6px;height:6px;display:block}.cloudlet-host .cloudlet-indicator [aria-current=true] .cloudlet-dot{background:var(--cloudlet-foreground)}.cloudlet-host .cloudlet-page{font-variant-numeric:tabular-nums;padding:8px;display:grid}.cloudlet-host .cloudlet-page>*{grid-area:1/1}.cloudlet-host button.cloudlet-clear{overflow-wrap:normal;grid-column:3;justify-self:end;font-size:.75rem;display:grid}.cloudlet-host .cloudlet-clear>*{grid-area:1/1;transition:opacity .2s,visibility .2s}.cloudlet-host .cloudlet-clear[data-armed=true]>:first-child,.cloudlet-host .cloudlet-clear[data-armed=false]>:last-child{opacity:0;visibility:hidden}.cloudlet-host .cloudlet-clear[data-armed=true]{color:color-mix(in oklab, var(--cloudlet-error) 70%, var(--cloudlet-foreground));background:color-mix(in oklab, var(--cloudlet-error) 14%, transparent)}.cloudlet-host .cloudlet-overflow{flex-wrap:wrap;grid-column:1/-1;justify-content:center;align-items:center;gap:4px 8px;min-width:0;display:flex}.cloudlet-host .cloudlet-overflow button{font-size:.75rem}.cloudlet-host .cloudlet-live{clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.cloudlet-announcer{clip-path:inset(50%);white-space:nowrap;pointer-events:none;border:0;width:1px;height:1px;margin:-1px;padding:0;position:fixed;top:0;left:0;overflow:hidden}.cloudlet-host[data-position^=top-]{top:calc(var(--cloudlet-viewport-top,0px) + var(--cloudlet-top));bottom:auto}.cloudlet-host[data-align=left]{--cloudlet-anchor:0%;margin-left:0;margin-right:auto}.cloudlet-host[data-align=right]{--cloudlet-anchor:100%;margin-left:auto;margin-right:0}.cloudlet-host[data-align=left] .cloudlet-stack{margin-right:auto}.cloudlet-host[data-align=right] .cloudlet-stack{margin-left:auto}@media (width>=48rem){.cloudlet-host[data-position=auto]{top:calc(var(--cloudlet-viewport-top,0px) + var(--cloudlet-top));bottom:auto}}.cloudlet-host[data-theme=dark]{--cloudlet-background:#1c1c1e;--cloudlet-foreground:#f5f5f7;--cloudlet-muted:#a1a1aa;--cloudlet-focus:#93b4ff;--cloudlet-shadow:0 12px 32px -12px #0009;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--cloudlet-tail-background:color-mix(in oklab, var(--cloudlet-foreground) 14%, var(--cloudlet-background));--cloudlet-tail-border:color-mix(in oklab, var(--cloudlet-foreground) 18%, transparent)}@media (prefers-color-scheme:dark){.cloudlet-host[data-theme=system]{--cloudlet-background:#1c1c1e;--cloudlet-foreground:#f5f5f7;--cloudlet-muted:#a1a1aa;--cloudlet-focus:#93b4ff;--cloudlet-shadow:0 12px 32px -12px #0009;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--cloudlet-tail-background:color-mix(in oklab, var(--cloudlet-foreground) 14%, var(--cloudlet-background));--cloudlet-tail-border:color-mix(in oklab, var(--cloudlet-foreground) 18%, transparent)}}@keyframes cloudlet-spin{to{transform:rotate(360deg)}}@media (prefers-reduced-motion:no-preference){.cloudlet-host .cloudlet-spinner{animation:.8s linear infinite cloudlet-spin}.cloudlet-host .cloudlet-ring[data-progress=indeterminate]{animation:1s linear infinite cloudlet-spin}.cloudlet-host[data-reduced-motion=true] :is(.cloudlet-spinner,.cloudlet-ring){animation:none}.cloudlet-host:not([data-reduced-motion=true]) .cloudlet-clear>*{transition:opacity .2s,filter .2s,visibility .2s}.cloudlet-host:not([data-reduced-motion=true]) .cloudlet-clear[data-armed=true]>:first-child,.cloudlet-host:not([data-reduced-motion=true]) .cloudlet-clear[data-armed=false]>:last-child{filter:blur(2px)}}@media (forced-colors:active){.cloudlet-host[data-theme]{--cloudlet-background:Canvas;--cloudlet-foreground:CanvasText;--cloudlet-muted:CanvasText;--cloudlet-border:CanvasText;--cloudlet-focus:Highlight;--cloudlet-action-background:Canvas;--cloudlet-status:CanvasText;--cloudlet-success:CanvasText;--cloudlet-error:CanvasText;--cloudlet-info:CanvasText;--cloudlet-warning:CanvasText;--cloudlet-loading:CanvasText;--cloudlet-badge:Highlight;--cloudlet-badge-foreground:HighlightText}.cloudlet-host :is(.cloudlet-bg,.cloudlet-icon,.cloudlet-badge,.cloudlet-dot){forced-color-adjust:none}.cloudlet-host .cloudlet-icon{outline-offset:-1px;background:canvas;outline:1px solid canvastext}.cloudlet-host .cloudlet-ring-track{stroke:graytext}.cloudlet-host .cloudlet-dot{background:canvas;outline:1px solid canvastext}.cloudlet-host .cloudlet-indicator [aria-current=true] .cloudlet-dot{background:canvastext}.cloudlet-host :is(.cloudlet-close,.cloudlet-action,.cloudlet-clear,.cloudlet-overflow button){border:1px solid buttontext}.cloudlet-host .cloudlet-clear[data-armed=true]{border-width:2px}.cloudlet-host .cloudlet-field{color:fieldtext;background:field;border-color:canvastext}.cloudlet-host .cloudlet-field[aria-invalid=true]{border-width:2px}.cloudlet-host .cloudlet-action.cloudlet-submit{forced-color-adjust:none;color:highlighttext;background:highlight;border-color:highlight}}
|
package/package.json
CHANGED
|
@@ -160,6 +160,10 @@ export interface RendererBridge<Slot = never> {
|
|
|
160
160
|
readonly acknowledgeOverflow: (lease: HostLease) => BridgeResult;
|
|
161
161
|
readonly acknowledgeAnnouncements: (lease: HostLease, acknowledgements: readonly AnnouncementAcknowledgement[]) => BridgeResult;
|
|
162
162
|
readonly dismiss: (lease: HostLease, handle: NotificationHandle, reason: RendererCloseReason) => MutationResult | { readonly status: 'rejected'; readonly reason: 'stale-lease' };
|
|
163
|
+
/** The open Island's clear button: removes every record (`reason: 'clear-button'`) and acknowledges the missed count. */
|
|
164
|
+
readonly clearAll: (lease: HostLease) =>
|
|
165
|
+
| { readonly status: 'cleared'; readonly count: number }
|
|
166
|
+
| { readonly status: 'rejected'; readonly reason: 'disposed' | 'stale-lease' | 'island-closed' };
|
|
163
167
|
/** Runs a command, or validates and submits a form. */
|
|
164
168
|
readonly invokeAction: (lease: HostLease, handle: NotificationHandle) => ActionResult;
|
|
165
169
|
readonly setFormValue: (lease: HostLease, handle: NotificationHandle, name: string, value: string) =>
|
package/src/core/bridge.ts
CHANGED
|
@@ -214,6 +214,8 @@ function createRendererBridge<Slot>(k: ControllerKernel<Slot>): RendererBridge<S
|
|
|
214
214
|
if (!['close-button', 'swipe', 'navigation'].includes(reason)) return reject('invalid-input');
|
|
215
215
|
return k.dismiss(handle, reason);
|
|
216
216
|
}),
|
|
217
|
+
// The button lives only in the open Island.
|
|
218
|
+
clearAll: withLease(() => k.island ? k.clear('clear-button') : reject('island-closed')),
|
|
217
219
|
invokeAction: withLease(k.withRecord((record) => {
|
|
218
220
|
const handle = record.handle;
|
|
219
221
|
const action = record.content.action;
|
package/src/core/controller.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CloudletController, ControllerOptions, FocusTarget } from '../contracts/controller.js';
|
|
1
|
+
import type { ClearResult, CloudletController, ControllerOptions, FocusTarget } from '../contracts/controller.js';
|
|
2
2
|
import type { Diagnostic, EventBase, SemanticEvent } from '../contracts/events.js';
|
|
3
3
|
import type { ActionAttemptToken, ControllerIdentity, Generation, HandleRejection, NotificationHandle, OperationAttemptToken, Unsubscribe } from '../contracts/identity.js';
|
|
4
4
|
import type {
|
|
@@ -130,6 +130,7 @@ export interface ControllerKernel<Slot> {
|
|
|
130
130
|
readonly setHostAutoDismiss: (value: boolean | undefined) => void;
|
|
131
131
|
readonly dismiss: (handle: NotificationHandle, reason: CloseReason) => typeof APPLIED | Rejected<HandleRejection | 'disposed'>;
|
|
132
132
|
readonly acknowledgeOverflow: () => typeof APPLIED | typeof UNCHANGED | Rejected<'disposed'>;
|
|
133
|
+
readonly clear: (reason: 'clear' | 'clear-button') => ClearResult;
|
|
133
134
|
readonly reportRendererLoadError: (error: unknown) => void;
|
|
134
135
|
}
|
|
135
136
|
|
|
@@ -469,14 +470,28 @@ export function createCloudletCore<Slot = never, Signal extends CancellationSign
|
|
|
469
470
|
}
|
|
470
471
|
const dismiss = withRecord((record, reason: CloseReason) =>
|
|
471
472
|
mutate((deliveries) => remove(record, reason, deliveries)));
|
|
473
|
+
function forgetOverflow(deliveries: Delivery[]) {
|
|
474
|
+
deliveries.push({ type: 'overflow-acknowledged', count: overflow });
|
|
475
|
+
overflow = overflowAnnounced = 0;
|
|
476
|
+
if (focusRequest?.target.kind === 'overflow') focusRequest = null;
|
|
477
|
+
}
|
|
472
478
|
function acknowledgeOverflow() {
|
|
473
479
|
if (disposed) return reject('disposed');
|
|
474
480
|
if (!overflow) return UNCHANGED;
|
|
475
|
-
return mutate(
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
481
|
+
return mutate(forgetOverflow);
|
|
482
|
+
}
|
|
483
|
+
/** `clear()`, or the Island's clear button, which also acknowledges the missed count: nothing is left. */
|
|
484
|
+
function clear(reason: 'clear' | 'clear-button'): ClearResult {
|
|
485
|
+
if (disposed) return reject('disposed');
|
|
486
|
+
const count = records.size;
|
|
487
|
+
const acknowledge = reason === 'clear-button' && overflow > 0;
|
|
488
|
+
if (count || acknowledge) {
|
|
489
|
+
mutate((deliveries) => {
|
|
490
|
+
for (const record of records.values()) remove(record, reason, deliveries);
|
|
491
|
+
if (acknowledge) forgetOverflow(deliveries);
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
return { status: 'cleared', count };
|
|
480
495
|
}
|
|
481
496
|
function subscribe<T>(set: Set<T>, listener: T): Unsubscribe {
|
|
482
497
|
if (typeof listener !== 'function') throw new TypeError('Listener must be a function');
|
|
@@ -802,15 +817,7 @@ export function createCloudletCore<Slot = never, Signal extends CancellationSign
|
|
|
802
817
|
}),
|
|
803
818
|
getHandle: (id) => !disposed && typeof id === 'string' ? records.get(id)?.handle : undefined,
|
|
804
819
|
dismiss: (handle) => dismiss(handle, 'programmatic'),
|
|
805
|
-
clear()
|
|
806
|
-
if (disposed) return reject('disposed');
|
|
807
|
-
const count = records.size;
|
|
808
|
-
if (!count) return { status: 'cleared', count };
|
|
809
|
-
mutate((deliveries) => {
|
|
810
|
-
for (const record of records.values()) remove(record, 'clear', deliveries);
|
|
811
|
-
});
|
|
812
|
-
return { status: 'cleared', count };
|
|
813
|
-
},
|
|
820
|
+
clear: () => clear('clear'),
|
|
814
821
|
requestFocus(target: FocusTarget = { kind: 'anchor' }) {
|
|
815
822
|
if (disposed) return reject('disposed');
|
|
816
823
|
if (target?.kind === 'notification') {
|
|
@@ -876,7 +883,7 @@ export function createCloudletCore<Slot = never, Signal extends CancellationSign
|
|
|
876
883
|
get focused() { return focused; }, set focused(value) { focused = value; },
|
|
877
884
|
get overflowAnnounced() { return overflowAnnounced; }, set overflowAnnounced(value) { overflowAnnounced = value; },
|
|
878
885
|
token, diagnostic, failure, mutate, commit, settle, assign, newest, formOf, handleError, withRecord,
|
|
879
|
-
autoDismissing, setHostAutoDismiss, dismiss, acknowledgeOverflow,
|
|
886
|
+
autoDismissing, setHostAutoDismiss, dismiss, acknowledgeOverflow, clear,
|
|
880
887
|
reportRendererLoadError(error) {
|
|
881
888
|
if (!disposed) diagnostic({ code: 'renderer-load-error', source: 'Toaster', message: 'Toaster renderer failed to load', error });
|
|
882
889
|
},
|
package/src/react/card.tsx
CHANGED
|
@@ -10,7 +10,8 @@ export const defaultLabels: CloudletLabels = {
|
|
|
10
10
|
region: 'Notifications', island: 'Current notifications', carousel: 'carousel', slide: 'slide',
|
|
11
11
|
close: 'Close notification', retry: 'Retry',
|
|
12
12
|
cancel: 'Request cancellation', cancellationRequested: 'Cancellation requested',
|
|
13
|
-
acknowledgeOverflow: 'Acknowledge missed notifications',
|
|
13
|
+
acknowledgeOverflow: 'Acknowledge missed notifications', clearAll: 'Clear all', clearAllConfirm: count => `Clear ${count}`,
|
|
14
|
+
collapse: 'Press Escape to collapse',
|
|
14
15
|
stackSummary: (title, count, missed) => [title, ...(count > 1 ? [`${count} notifications`] : []),
|
|
15
16
|
...(missed > 0 ? [`${missed} missed`] : [])].join(', '),
|
|
16
17
|
page: (index, total) => `${index} of ${total}`,
|
package/src/react/gestures.ts
CHANGED
|
@@ -51,6 +51,12 @@ export interface SwipeCandidate {
|
|
|
51
51
|
interface SwipeOptions {
|
|
52
52
|
/** Null ignores the input; the candidate is released exactly once. */
|
|
53
53
|
readonly begin: (target: Element, input: 'pointer' | 'wheel') => SwipeCandidate | null;
|
|
54
|
+
/**
|
|
55
|
+
* The open Island under a wheel stream: until the stream's axis is decided, and for every
|
|
56
|
+
* mostly horizontal event after that, the browser gets no wheel event from it (no history swipe),
|
|
57
|
+
* even where no swipe can start (an end of the slider, reduced motion, outside the slides).
|
|
58
|
+
*/
|
|
59
|
+
readonly claimsWheel?: (target: Element) => boolean;
|
|
54
60
|
readonly now: () => number;
|
|
55
61
|
}
|
|
56
62
|
|
|
@@ -72,7 +78,13 @@ interface PointerSwipe {
|
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
interface WheelSwipe {
|
|
75
|
-
|
|
81
|
+
/** Started over the open Island (`claimsWheel`). */
|
|
82
|
+
readonly claimed: boolean;
|
|
83
|
+
/** Decided after `MOTION.swipe.intent` px of summed travel, like a pointer. */
|
|
84
|
+
axis: SwipeAxis | null;
|
|
85
|
+
travelX: number;
|
|
86
|
+
travelY: number;
|
|
87
|
+
candidate: SwipeCandidate | null;
|
|
76
88
|
session: SwipeSession | null;
|
|
77
89
|
/** Committed early: the rest of the stream (macOS momentum) is swallowed until it goes idle. */
|
|
78
90
|
spent: boolean;
|
|
@@ -235,18 +247,43 @@ export function createSwipe(root: HTMLElement, options: SwipeOptions) {
|
|
|
235
247
|
}
|
|
236
248
|
}
|
|
237
249
|
if (!wheel) {
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
wheel = { candidate: session ? candidate : null, session, spent: false, spentAt: 0, lastDx: dx, offset: 0, velocity: 0, time, timer: 0 };
|
|
250
|
+
const claimed = event.target instanceof view.Element && (options.claimsWheel?.(event.target) ?? false);
|
|
251
|
+
wheel = {
|
|
252
|
+
claimed, axis: null, travelX: 0, travelY: 0, candidate: null, session: null,
|
|
253
|
+
spent: false, spentAt: 0, lastDx: dx, offset: 0, velocity: 0, time, timer: 0,
|
|
254
|
+
};
|
|
244
255
|
}
|
|
245
256
|
const stream = wheel;
|
|
246
257
|
view.clearTimeout(stream.timer);
|
|
247
258
|
stream.timer = view.setTimeout(() => endWheel(true), swipe.wheelIdle);
|
|
248
259
|
stream.lastDx = dx;
|
|
249
|
-
if (!stream.
|
|
260
|
+
if (!stream.axis) {
|
|
261
|
+
// The first event alone does not decide: a trackpad swipe often lands diagonally (1, 2 px).
|
|
262
|
+
stream.travelX += dx;
|
|
263
|
+
stream.travelY += dy;
|
|
264
|
+
const horizontal = Math.abs(stream.travelX);
|
|
265
|
+
const vertical = Math.abs(stream.travelY);
|
|
266
|
+
if (Math.max(horizontal, vertical) >= swipe.intent) {
|
|
267
|
+
stream.axis = horizontal > vertical ? 'x' : 'y';
|
|
268
|
+
const target = event.target;
|
|
269
|
+
const candidate = stream.axis === 'x' && target instanceof view.Element ? options.begin(target, 'wheel') : null;
|
|
270
|
+
const session = candidate?.x ? candidate.start('x') : null;
|
|
271
|
+
if (candidate && !session) candidate.release();
|
|
272
|
+
if (session) {
|
|
273
|
+
stream.candidate = candidate;
|
|
274
|
+
stream.session = session;
|
|
275
|
+
// The travel of the intent window counts, as a pointer's does.
|
|
276
|
+
stream.offset = dx - stream.travelX;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (!stream.session) {
|
|
281
|
+
// A stream that started vertical stays native until it goes idle; over the Island its
|
|
282
|
+
// sideways events are still held back from the browser's back/forward swipe.
|
|
283
|
+
if (stream.claimed && (!stream.axis || Math.abs(dx) > Math.abs(dy))) event.preventDefault();
|
|
284
|
+
stream.time = time;
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
250
287
|
event.preventDefault();
|
|
251
288
|
// Fingers moving left scroll right (positive deltaX): the content follows the fingers.
|
|
252
289
|
const elapsed = time - stream.time;
|
package/src/react/host.tsx
CHANGED
|
@@ -91,6 +91,8 @@ const rulePaths = {
|
|
|
91
91
|
} as const;
|
|
92
92
|
type Rule = keyof typeof rulePaths;
|
|
93
93
|
|
|
94
|
+
/** Milliseconds the clear button waits for its second press. */
|
|
95
|
+
const CLEAR_CONFIRM = 3000;
|
|
94
96
|
const clamp01 = (value: number) => Math.max(0, Math.min(1, value));
|
|
95
97
|
/** Native `inert` without relying on React 19's boolean prop (React 18.2 is supported). */
|
|
96
98
|
const inertRef = (node: HTMLElement | null) => node?.setAttribute('inert', '');
|
|
@@ -168,6 +170,9 @@ function createHostRuntime(owner: Host) {
|
|
|
168
170
|
let gestureTarget: { readonly handle: NotificationHandle; readonly open: boolean } | null = null;
|
|
169
171
|
/** A committed swipe dismiss: its exit snapshot keeps flying from the release point. */
|
|
170
172
|
let fling: (Fling & { readonly handle: NotificationHandle }) | null = null;
|
|
173
|
+
/** The clear button's first press arms it; a second press within `CLEAR_CONFIRM` clears the stack. */
|
|
174
|
+
let armed = false;
|
|
175
|
+
let disarmTimer: number | undefined;
|
|
171
176
|
// Formatter failures found during render are reported after commit, once per function.
|
|
172
177
|
const failedFormatters = new WeakSet<object>();
|
|
173
178
|
const formatterErrors: unknown[] = [];
|
|
@@ -247,6 +252,8 @@ function createHostRuntime(owner: Host) {
|
|
|
247
252
|
}
|
|
248
253
|
const bottomEdge = () => rootRef.current?.dataset.edge === 'bottom';
|
|
249
254
|
const edgeSign = (): -1 | 1 => bottomEdge() ? 1 : -1;
|
|
255
|
+
/** Where the layers hang in the stack's layout box: 0 at its left, ½ in the centre, 1 at its right (CSS `--cloudlet-anchor`). */
|
|
256
|
+
const anchor = () => { const align = rootRef.current?.dataset.align; return align === 'left' ? 0 : align === 'right' ? 1 : 0.5; };
|
|
250
257
|
|
|
251
258
|
/** The only DOM writer of animated values: scoped CSSOM rules and SVG attributes. */
|
|
252
259
|
function write(frame: ShellFrame) {
|
|
@@ -258,6 +265,10 @@ function createHostRuntime(owner: Host) {
|
|
|
258
265
|
// At the bottom edge the silhouette grows upwards: it is anchored to the layout bottom.
|
|
259
266
|
const bottom = bottomEdge();
|
|
260
267
|
const top = bottom ? layout.height - height : 0;
|
|
268
|
+
// A side position keeps the silhouette against its edge of the layout box: the morph grows away from it.
|
|
269
|
+
const along = anchor();
|
|
270
|
+
const hang = `translateX(${-along * 100}%)`;
|
|
271
|
+
const left = (layout.width - width) * along;
|
|
261
272
|
if (r.shell) {
|
|
262
273
|
r.shell.opacity = String(clamp01(frame.opacity));
|
|
263
274
|
r.shell.transform = still ? 'none' : `translate(${px(frame.dragX)}, ${px(frame.y + frame.dragY)}) scale(${frame.scale})`;
|
|
@@ -274,13 +285,13 @@ function createHostRuntime(owner: Host) {
|
|
|
274
285
|
// Layout keeps the box at the top and a transform carries it to the bottom edge: a growing
|
|
275
286
|
// silhouette then moves no layout start point, so the morph is not counted as layout shift (CLS).
|
|
276
287
|
r.bg.top = '0px'; r.bg.bottom = 'auto';
|
|
277
|
-
r.bg.transform =
|
|
288
|
+
r.bg.transform = `${hang} translateY(${px(top)})`;
|
|
278
289
|
}
|
|
279
|
-
if (r.clip) r.clip.clipPath = `path("${createRoundedRectPath(width, height, radius,
|
|
290
|
+
if (r.clip) r.clip.clipPath = `path("${createRoundedRectPath(width, height, radius, left, top)}")`;
|
|
280
291
|
if (r.badge) {
|
|
281
292
|
const scale = still ? 1 : constants.badge.scale + (1 - constants.badge.scale) * frame.badge;
|
|
282
|
-
// Outer corner: top right, mirrored in RTL; the bottom corner at the bottom edge.
|
|
283
|
-
const x = (
|
|
293
|
+
// Outer corner: top right, mirrored in RTL; the bottom corner at the bottom edge. The badge hangs from the layout centre.
|
|
294
|
+
const x = (rtl ? left + 10 : left + width - 10) - layout.width / 2;
|
|
284
295
|
r.badge.opacity = String(clamp01(frame.badge));
|
|
285
296
|
r.badge.transform = `translate(calc(${px(x)} - 50%), ${bottom ? '6px' : '-6px'}) scale(${scale})`;
|
|
286
297
|
}
|
|
@@ -293,7 +304,7 @@ function createHostRuntime(owner: Host) {
|
|
|
293
304
|
rule.width = px(width);
|
|
294
305
|
rule.height = px(Math.min(height, tokens.pillHeight));
|
|
295
306
|
rule.opacity = String(clamp01(frame[`tail${index}Opacity`]));
|
|
296
|
-
rule.transform =
|
|
307
|
+
rule.transform = `${hang} translateY(${px(inward * slot * (tokens.tailOffset + constants.hoverLift * frame.lift))}) scale(${Math.pow(tokens.tailScale, slot)})`;
|
|
297
308
|
}
|
|
298
309
|
if (r.slideOut) {
|
|
299
310
|
r.slideOut.transform = still ? 'none' : `translateX(${px(frame.slide - frame.slideDirection * frame.slideWidth)})`;
|
|
@@ -327,7 +338,7 @@ function createHostRuntime(owner: Host) {
|
|
|
327
338
|
if (r.bodyOut) r.bodyOut.opacity = String(clamp01(frame.bodyOut));
|
|
328
339
|
if (r.exit) {
|
|
329
340
|
r.exit.opacity = String(clamp01(frame.exitOpacity));
|
|
330
|
-
r.exit.transform = still ?
|
|
341
|
+
r.exit.transform = still ? hang : `${hang} translate(${px(frame.exitX)}, ${px(frame.exitY)}) scale(${frame.exitScale})`;
|
|
331
342
|
}
|
|
332
343
|
if (progressActive && progressFill?.isConnected) progressFill.setAttribute('stroke-dasharray', `${Math.round(frame.progress * 10000) / 100} 100`);
|
|
333
344
|
}
|
|
@@ -659,6 +670,11 @@ function createHostRuntime(owner: Host) {
|
|
|
659
670
|
},
|
|
660
671
|
};
|
|
661
672
|
}
|
|
673
|
+
/** A wheel stream over the open Island never reaches the browser's back/forward swipe. */
|
|
674
|
+
function claimsWheel(target: Element): boolean {
|
|
675
|
+
const shell = shellRef.current;
|
|
676
|
+
return !!shell && shellView(owner.props.snapshot).open && shell.contains(target);
|
|
677
|
+
}
|
|
662
678
|
function componentDidMount() {
|
|
663
679
|
const root = rootRef.current;
|
|
664
680
|
const shell = shellRef.current;
|
|
@@ -674,7 +690,7 @@ function createHostRuntime(owner: Host) {
|
|
|
674
690
|
}
|
|
675
691
|
for (const container of [exitRef.current, slideOutRef.current, chromeOutRef.current]) container?.setAttribute('inert', '');
|
|
676
692
|
announcer.mount(root);
|
|
677
|
-
swipe = createSwipe(root, { begin: beginSwipe, now: () => view.performance.now() });
|
|
693
|
+
swipe = createSwipe(root, { begin: beginSwipe, claimsWheel, now: () => view.performance.now() });
|
|
678
694
|
const media = view.matchMedia?.('(prefers-reduced-motion: reduce)');
|
|
679
695
|
reduced = media?.matches ?? false;
|
|
680
696
|
root.dataset.reducedMotion = String(reduced);
|
|
@@ -750,7 +766,8 @@ function createHostRuntime(owner: Host) {
|
|
|
750
766
|
const root = rootRef.current;
|
|
751
767
|
const active = doc.activeElement;
|
|
752
768
|
if (!root || !view || !(active instanceof view.HTMLElement) || active === root || !root.contains(active)
|
|
753
|
-
|
|
769
|
+
// `clearAll` turning false removes the clear button without a snapshot change.
|
|
770
|
+
|| (structure(previous.snapshot) === structure(owner.props.snapshot) && clearable(previous) === clearable(owner.props))) return pending;
|
|
754
771
|
// The commit may remove or hide the focused branch: park focus on the stable anchor
|
|
755
772
|
// (or outside after the last record) before React mutates the DOM.
|
|
756
773
|
focusedBefore = active;
|
|
@@ -771,6 +788,8 @@ function createHostRuntime(owner: Host) {
|
|
|
771
788
|
const target = primaryFocus() ?? rootRef.current?.querySelector<HTMLElement>('[data-cloudlet-overflow]') ?? null;
|
|
772
789
|
if (!restoreFocus(target)) rootRef.current?.focus({ preventScroll: true });
|
|
773
790
|
}
|
|
791
|
+
// The button left (collapse, the stack shrank, the prop): the next one starts unarmed.
|
|
792
|
+
if (armed && !clearable(owner.props)) disarm(false);
|
|
774
793
|
motion?.setTimeScale(owner.props.options.motion?.timeScale);
|
|
775
794
|
syncConstants();
|
|
776
795
|
// A swipe never continues on another record or state (arrival, programmatic dismiss, Escape).
|
|
@@ -788,6 +807,7 @@ function createHostRuntime(owner: Host) {
|
|
|
788
807
|
function componentWillUnmount() {
|
|
789
808
|
swipe?.dispose(); swipe = null;
|
|
790
809
|
peek = null; fling = null;
|
|
810
|
+
disarm(false);
|
|
791
811
|
announcer.dispose();
|
|
792
812
|
mounted = false;
|
|
793
813
|
cleanup?.(); cleanup = null;
|
|
@@ -805,6 +825,24 @@ function createHostRuntime(owner: Host) {
|
|
|
805
825
|
(active as HTMLElement | null)?.blur();
|
|
806
826
|
}
|
|
807
827
|
}
|
|
828
|
+
function disarm(update = true) {
|
|
829
|
+
view?.clearTimeout(disarmTimer);
|
|
830
|
+
disarmTimer = undefined;
|
|
831
|
+
if (!armed) return;
|
|
832
|
+
armed = false;
|
|
833
|
+
if (update && mounted) owner.forceUpdate();
|
|
834
|
+
}
|
|
835
|
+
function pressClear() {
|
|
836
|
+
if (armed) {
|
|
837
|
+
disarm();
|
|
838
|
+
bridge.clearAll(lease);
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
armed = true;
|
|
842
|
+
disarmTimer = view?.setTimeout(disarm, CLEAR_CONFIRM);
|
|
843
|
+
owner.forceUpdate();
|
|
844
|
+
}
|
|
845
|
+
const clearable = (props: HostProps) => props.options.clearAll !== false && shellView(props.snapshot).open && props.snapshot.stack.length > 1;
|
|
808
846
|
const navigate = (handle: NotificationHandle) => {
|
|
809
847
|
navigating = handle;
|
|
810
848
|
if (bridge.dismiss(lease, handle, 'navigation').status !== 'applied') navigating = null;
|
|
@@ -845,17 +883,20 @@ function createHostRuntime(owner: Host) {
|
|
|
845
883
|
if (current.badge) badgeCount = current.count;
|
|
846
884
|
const preview = open && peek ? snapshot.notifications.find(item => item.handle === peek!.handle) : undefined;
|
|
847
885
|
const position = options.position ?? 'auto';
|
|
848
|
-
const
|
|
886
|
+
const named = String(position);
|
|
887
|
+
const bottom = named.startsWith('bottom-') || (position === 'auto' && view?.matchMedia?.('(min-width: 48rem)').matches === false);
|
|
888
|
+
const align = named.endsWith('-left') ? 'left' : named.endsWith('-right') ? 'right' : 'center';
|
|
849
889
|
const tails = Math.min(2, Math.max(current.depth, heldTails));
|
|
850
890
|
const slot = presented ? slotRenderer(bridge, lease, presented.handle, rejectSlotFocus) : null;
|
|
851
891
|
const page = format(labels.page, defaultLabels.page, index + 1, total);
|
|
892
|
+
const confirm = format(labels.clearAllConfirm, defaultLabels.clearAllConfirm, total);
|
|
852
893
|
const part = partClasses(options.classNames);
|
|
853
894
|
return <>
|
|
854
895
|
{options.offsets && <OffsetStyles key={options.nonce ?? ''} instance={instance} offsets={options.offsets} nonce={options.nonce} />}
|
|
855
896
|
<div ref={rootRef} className={part('host', 'cloudlet-host')} role="region" aria-label={labels.region} tabIndex={-1}
|
|
856
897
|
data-cloudlet-focus-anchor="" data-cloudlet-instance={instance} data-theme={theme}
|
|
857
898
|
data-resolved-theme={theme === 'system' ? view?.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' : theme}
|
|
858
|
-
data-position={position} data-edge={bottom ? 'bottom' : 'top'} data-state={open ? 'island' : 'stack'}
|
|
899
|
+
data-position={position} data-edge={bottom ? 'bottom' : 'top'} data-align={align} data-state={open ? 'island' : 'stack'}
|
|
859
900
|
data-island-reason={snapshot.island.reason ?? undefined} data-overflow={snapshot.overflow.pending} dir={dir}
|
|
860
901
|
onPointerDownCapture={event => { activation = (event.target as Element).closest('button'); }}
|
|
861
902
|
onPointerCancelCapture={() => { activation = null; }}
|
|
@@ -871,7 +912,8 @@ function createHostRuntime(owner: Host) {
|
|
|
871
912
|
const target = (event.target as Element).closest('button');
|
|
872
913
|
// A double click must not fire a one-shot action twice; close, the pill and the dots are
|
|
873
914
|
// repeatable on purpose (each click dismisses or shows another record).
|
|
874
|
-
|
|
915
|
+
// The clear button counts too: a double click must not arm and confirm it at once.
|
|
916
|
+
const oneShot = !!target?.matches('[data-cloudlet-control="action"], [data-cloudlet-control="retry"], [data-cloudlet-control="cancel"], [data-cloudlet-control="clear"]');
|
|
875
917
|
if (target && (repeating || (oneShot && event.detail > 1) || (activation && activation !== target))) { event.preventDefault(); event.stopPropagation(); }
|
|
876
918
|
activation = null;
|
|
877
919
|
}}
|
|
@@ -908,11 +950,19 @@ function createHostRuntime(owner: Host) {
|
|
|
908
950
|
{presented && open && closeButton(labels, part, () => bridge.dismiss(lease, presented.handle, 'close-button'))}
|
|
909
951
|
{open && (total > 1 || missed > 0) && <div className={part('indicator', 'cloudlet-indicator')}>{total > 5
|
|
910
952
|
? <p className="cloudlet-page" aria-hidden="true"><span className="cloudlet-page-value">{page}</span><span className="cloudlet-page-out" /></p>
|
|
911
|
-
: total > 1 && snapshot.stack.map((handle, position) =>
|
|
953
|
+
: total > 1 && <div className="cloudlet-dots">{snapshot.stack.map((handle, position) =>
|
|
912
954
|
<button key={handle.generation} type="button" className="cloudlet-dot-button" aria-current={position === index ? 'true' : undefined}
|
|
913
955
|
aria-label={format(labels.page, defaultLabels.page, position + 1, total)} onClick={() => bridge.navigate(lease, handle)}>
|
|
914
956
|
<span className="cloudlet-dot" aria-hidden="true" />
|
|
915
|
-
</button>)}
|
|
957
|
+
</button>)}</div>}
|
|
958
|
+
{clearable(owner.props) && <>
|
|
959
|
+
{/* Both labels share one cell, so the button keeps its width when it arms. */}
|
|
960
|
+
<button type="button" className={part('clear', 'cloudlet-clear')} data-cloudlet-control="clear" data-armed={armed}
|
|
961
|
+
onClick={pressClear} onBlur={() => disarm()}>
|
|
962
|
+
<span aria-hidden={armed || undefined}>{labels.clearAll}</span><span aria-hidden={!armed || undefined}>{confirm}</span>
|
|
963
|
+
</button>
|
|
964
|
+
<span role="status" className="cloudlet-live">{armed ? confirm : ''}</span>
|
|
965
|
+
</>}
|
|
916
966
|
{missed > 0 && <div className={part('overflow', 'cloudlet-overflow')}>
|
|
917
967
|
<p>{format(labels.overflowCount, defaultLabels.overflowCount, missed)}</p>
|
|
918
968
|
<button type="button" data-cloudlet-overflow="" onClick={() => bridge.acknowledgeOverflow(lease)}>{labels.acknowledgeOverflow}</button>
|
package/src/react.ts
CHANGED
|
@@ -50,6 +50,10 @@ export interface CloudletLabels {
|
|
|
50
50
|
readonly cancel: string;
|
|
51
51
|
readonly cancellationRequested: string;
|
|
52
52
|
readonly acknowledgeOverflow: string;
|
|
53
|
+
/** The Island's clear button. */
|
|
54
|
+
readonly clearAll: string;
|
|
55
|
+
/** The clear button after the first press: a second press clears this many notifications. */
|
|
56
|
+
readonly clearAllConfirm: (count: number) => string;
|
|
53
57
|
/** Hidden hint that Escape collapses the Island. */
|
|
54
58
|
readonly collapse: string;
|
|
55
59
|
/** Name of the collapsed stack button: top title, records in the stack, missed notifications. */
|
|
@@ -160,10 +164,11 @@ export interface ToasterMotion {
|
|
|
160
164
|
|
|
161
165
|
/** Styling hooks of the renderer; see `ToasterProps.classNames`. */
|
|
162
166
|
export type CloudletPart = 'host' | 'stack' | 'pill' | 'tail' | 'badge' | 'island' | 'header' | 'icon' | 'title'
|
|
163
|
-
| 'close' | 'body' | 'description' | 'actions' | 'action' | 'indicator' | 'overflow' | 'form' | 'field' | 'field-error';
|
|
167
|
+
| 'close' | 'body' | 'description' | 'actions' | 'action' | 'indicator' | 'clear' | 'overflow' | 'form' | 'field' | 'field-error';
|
|
164
168
|
|
|
165
169
|
export interface ToasterProps {
|
|
166
|
-
|
|
170
|
+
/** Physical: `-left` and `-right` stay on that side in RTL too. Default `auto`. */
|
|
171
|
+
readonly position?: 'auto' | 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
167
172
|
readonly theme?: 'system' | 'light' | 'dark';
|
|
168
173
|
readonly dir?: 'ltr' | 'rtl';
|
|
169
174
|
/** Read after mount; a connected HTML Element in the mounting root's document. Fixed until remount. */
|
|
@@ -176,6 +181,8 @@ export interface ToasterProps {
|
|
|
176
181
|
readonly attention?: ToasterAttention;
|
|
177
182
|
/** Overrides the controller's `autoDismiss` while defined; changes apply without remount. */
|
|
178
183
|
readonly autoDismiss?: boolean;
|
|
184
|
+
/** The clear button in the open Island with two or more notifications; default true. Read on every render. */
|
|
185
|
+
readonly clearAll?: boolean;
|
|
179
186
|
/** Read on every render. */
|
|
180
187
|
readonly motion?: ToasterMotion;
|
|
181
188
|
/** Extra classes per part, added to the own `cloudlet-*` classes (never replacing them). Read on every render. */
|