diff --git a/CHANGELOG.md b/CHANGELOG.md index bade935..3cacdeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,14 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Changed + +- Make the selector palette, overview, surfaces, typography, focus states, and default tenant styling inherit Nova's configured brand and neutral colors. + ### Fixed - Ignore a persisted tenant cookie while Nova is serving an unauthenticated page, such as the login screen. +- Keep controls readable when a tenant uses a light accent color such as white. ## [1.0.0] - 2026-09-09 diff --git a/README.md b/README.md index 1f68802..0cf2f07 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,8 @@ Selection uses Nova's authenticated request client, stores the authorized tenant The package overrides Nova's `AppLogo` component with the selected tenant's logo and title. The image source remains the fixed authenticated endpoint `/nova-vendor/nova-tenancy/current/logo`; remote images are redirected to rather than fetched by the server. Only root-relative, HTTP, and HTTPS logo URLs are accepted by the default response and tenant list payload. +The selector inherits Nova's configured `brand.colors` palette, neutral card surfaces, typography, and dark-mode colors. A tenant accent overrides Nova's primary color only for that tenant's identity elements, with an automatically selected foreground color for accessible light and dark accents. + If another package also replaces `AppLogo`, the last component registered by Nova wins. ## Customization diff --git a/dist/css/tool.css b/dist/css/tool.css index 247db98..b99cae9 100644 --- a/dist/css/tool.css +++ b/dist/css/tool.css @@ -1 +1 @@ -.nova-tenancy-page{--nt-primary:#7c3aed;--nt-primary-strong:#5b21b6;--nt-surface:hsla(0,0%,100%,.88);--nt-border:rgba(226,232,240,.9);--nt-muted:#64748b;display:flex;flex-direction:column;gap:1.5rem;padding-bottom:3rem}.nova-tenancy-hero{align-items:flex-end;background:radial-gradient(circle at 12% 10%,rgba(167,139,250,.48),transparent 34%),radial-gradient(circle at 88% 85%,rgba(56,189,248,.3),transparent 38%),linear-gradient(135deg,#251259,#4c1d95 48%,#172554);border:1px solid hsla(0,0%,100%,.16);border-radius:1.5rem;box-shadow:0 24px 60px rgba(49,46,129,.22);color:#fff;display:flex;gap:2rem;justify-content:space-between;min-height:15rem;overflow:hidden;padding:clamp(1.5rem,4vw,3rem);position:relative}.nova-tenancy-hero:after{background-image:linear-gradient(hsla(0,0%,100%,.04) 1px,transparent 0),linear-gradient(90deg,hsla(0,0%,100%,.04) 1px,transparent 0);background-size:32px 32px;content:"";inset:0;-webkit-mask-image:linear-gradient(180deg,#000,transparent);mask-image:linear-gradient(180deg,#000,transparent);pointer-events:none;position:absolute}.nova-tenancy-hero__glow{background:hsla(0,0%,100%,.09);border-radius:9999px;filter:blur(2px);height:22rem;position:absolute;right:-5rem;top:-8rem;width:22rem}.nova-tenancy-current,.nova-tenancy-hero__content{position:relative;z-index:1}.nova-tenancy-hero__content{max-width:42rem}.nova-tenancy-kicker{color:#c4b5fd;font-size:.72rem;font-weight:800;letter-spacing:.16em;margin:0 0 .65rem;text-transform:uppercase}.nova-tenancy-title{font-size:clamp(2rem,5vw,3.5rem);font-weight:750;letter-spacing:-.045em;line-height:1;margin:0}.nova-tenancy-description{color:rgba(237,233,254,.82);font-size:1rem;line-height:1.7;margin:1rem 0 0;max-width:35rem}.nova-tenancy-current{align-items:center;backdrop-filter:blur(14px);background:hsla(0,0%,100%,.1);border:1px solid hsla(0,0%,100%,.16);border-radius:1rem;display:flex;gap:.8rem;min-width:min(100%,17rem);padding:.8rem}.nova-tenancy-card__logo,.nova-tenancy-current__logo{border-radius:.9rem;display:grid;flex:none;font-weight:800;overflow:hidden;place-items:center}.nova-tenancy-current__logo{background:#fff;color:#4c1d95;height:3rem;width:3rem}.nova-tenancy-card__logo img,.nova-tenancy-current__logo img{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.nova-tenancy-current__copy{display:flex;flex:1;flex-direction:column;min-width:0}.nova-tenancy-current__copy span{color:rgba(237,233,254,.7);font-size:.68rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase}.nova-tenancy-current__copy strong{margin-top:.15rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nova-tenancy-pulse{background:#34d399;border:2px solid hsla(0,0%,100%,.8);border-radius:9999px;box-shadow:0 0 0 4px rgba(52,211,153,.2);height:.55rem;width:.55rem}.nova-tenancy-toolbar{align-items:center;display:flex;gap:1rem}.nova-tenancy-search{align-items:center;background:var(--nt-surface);border:1px solid var(--nt-border);border-radius:.9rem;box-shadow:0 4px 18px rgba(15,23,42,.04);display:flex;flex:1;gap:.75rem;max-width:34rem;min-width:0;padding-inline:1rem;transition:border-color .16s,box-shadow .16s}.nova-tenancy-search:focus-within{border-color:rgba(124,58,237,.55);box-shadow:0 0 0 3px rgba(124,58,237,.12)}.nova-tenancy-search svg{fill:none;stroke:var(--nt-muted);stroke-linecap:round;stroke-width:1.8;width:1.2rem}.nova-tenancy-search input{background:transparent;border:0;color:#0f172a;outline:0;padding:.85rem 0;width:100%}.nova-tenancy-count{background:#ede9fe;border-radius:9999px;color:var(--nt-primary-strong);display:grid;font-size:.78rem;font-weight:800;height:2.5rem;min-width:2.5rem;place-items:center}.nova-tenancy-grid{display:grid;gap:1rem;grid-template-columns:repeat(auto-fill,minmax(min(100%,16rem),1fr))}.nova-tenancy-card{--tenant-accent:#7c3aed;background:var(--nt-surface);border:1px solid var(--nt-border);border-radius:1.25rem;box-shadow:0 10px 32px rgba(15,23,42,.055);display:flex;flex-direction:column;min-height:17rem;overflow:hidden;padding:1.25rem;position:relative;transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease}.nova-tenancy-card:hover{border-color:color-mix(in srgb,var(--tenant-accent) 42%,transparent);box-shadow:0 18px 42px rgba(15,23,42,.1);transform:translateY(-3px)}.nova-tenancy-card--selected{border-color:color-mix(in srgb,var(--tenant-accent) 70%,transparent);box-shadow:0 0 0 2px color-mix(in srgb,var(--tenant-accent) 16%,transparent),0 18px 42px rgba(15,23,42,.09)}.nova-tenancy-card__accent{background:linear-gradient(90deg,var(--tenant-accent),color-mix(in srgb,var(--tenant-accent) 25%,#fff));height:.26rem;inset:0 0 auto;position:absolute}.nova-tenancy-card__header{align-items:flex-start;display:flex;gap:1rem;justify-content:space-between}.nova-tenancy-card__logo{background:color-mix(in srgb,var(--tenant-accent) 11%,#fff);color:var(--tenant-accent);font-size:1.35rem;height:4rem;width:4rem}.nova-tenancy-badge{background:color-mix(in srgb,var(--tenant-accent) 10%,#fff);border-radius:9999px;color:var(--tenant-accent);font-size:.68rem;font-weight:800;padding:.35rem .65rem}.nova-tenancy-check{background:var(--tenant-accent);border-radius:9999px;color:#fff;display:grid;height:1.8rem;place-items:center;width:1.8rem}.nova-tenancy-check svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2;width:1rem}.nova-tenancy-card__body{flex:1;padding-block:1.2rem}.nova-tenancy-card__body h2{color:#0f172a;font-size:1.05rem;font-weight:750;line-height:1.4;margin:0}.nova-tenancy-card__body p{-webkit-box-orient:vertical;-webkit-line-clamp:2;color:var(--nt-muted);display:-webkit-box;font-size:.84rem;line-height:1.6;margin:.55rem 0 0;overflow:hidden}.nova-tenancy-card__body .nova-tenancy-card__key{color:color-mix(in srgb,var(--tenant-accent) 68%,#64748b);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.nova-tenancy-button,.nova-tenancy-pagination button,.nova-tenancy-select{align-items:center;border:0;border-radius:.75rem;cursor:pointer;display:inline-flex;font-weight:750;gap:.55rem;justify-content:center;transition:transform .15s,background-color .15s,opacity .15s}.nova-tenancy-select{background:var(--tenant-accent);color:#fff;min-height:2.7rem;width:100%}.nova-tenancy-button:hover,.nova-tenancy-pagination button:not(:disabled):hover,.nova-tenancy-select:not(:disabled):hover{transform:translateY(-1px)}.nova-tenancy-select--selected{background:color-mix(in srgb,var(--tenant-accent) 10%,#fff);color:var(--tenant-accent)}.nova-tenancy-pagination button:disabled,.nova-tenancy-select:disabled{cursor:default;opacity:.72}.nova-tenancy-select svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:1rem}.nova-tenancy-spinner{animation:nova-tenancy-spin .65s linear infinite;border:2px solid hsla(0,0%,100%,.4);border-radius:9999px;border-top-color:#fff;height:1rem;width:1rem}.nova-tenancy-card--skeleton{gap:1.3rem;pointer-events:none}.nova-tenancy-card--skeleton span{animation:nova-tenancy-shimmer 1.4s ease infinite;background:linear-gradient(90deg,#f1f5f9,#e2e8f0,#f1f5f9);background-size:220% 100%;border-radius:9999px;display:block;height:1rem}.nova-tenancy-card--skeleton span:first-child{border-radius:1rem;height:4rem;width:4rem}.nova-tenancy-card--skeleton span:nth-child(2){width:70%}.nova-tenancy-card--skeleton span:nth-child(3){width:45%}.nova-tenancy-state{align-items:center;background:var(--nt-surface);border:1px dashed var(--nt-border);border-radius:1.25rem;display:flex;flex-direction:column;justify-content:center;min-height:18rem;padding:2rem;text-align:center}.nova-tenancy-state__icon{background:#ffe4e6;border-radius:1rem;color:#be123c;display:grid;font-size:1.5rem;font-weight:800;height:3.5rem;place-items:center;width:3.5rem}.nova-tenancy-state__icon--empty{background:#ede9fe;color:var(--nt-primary)}.nova-tenancy-state__icon svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5;width:1.8rem}.nova-tenancy-state h2{color:#0f172a;font-size:1.1rem;margin:1rem 0 0}.nova-tenancy-state p{color:var(--nt-muted);margin:.5rem 0 0;max-width:28rem}.nova-tenancy-button{background:var(--nt-primary);color:#fff;margin-top:1rem;padding:.65rem 1rem}.nova-tenancy-pagination{align-items:center;display:flex;gap:.8rem;justify-content:center}.nova-tenancy-pagination button{background:var(--nt-surface);border:1px solid var(--nt-border);color:#334155;padding:.55rem .9rem}.nova-tenancy-pagination span{color:var(--nt-muted);font-size:.8rem;font-weight:700}.nova-tenancy-brand{align-items:center;background:transparent;border:0;color:#334155;cursor:pointer;display:flex;gap:.65rem;max-width:13.5rem;min-width:0;padding:0}.nova-tenancy-brand__logo{border-radius:.7rem;box-shadow:0 3px 12px rgba(15,23,42,.12);flex:none;height:2.5rem;-o-object-fit:cover;object-fit:cover;width:2.5rem}.nova-tenancy-brand__title{font-size:.86rem;font-weight:750;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nova-tenancy-brand:focus-visible,.nova-tenancy-button:focus-visible,.nova-tenancy-pagination button:focus-visible,.nova-tenancy-select:focus-visible{outline:2px solid var(--nt-primary);outline-offset:3px}.nova-tenancy-sr-only{clip:rect(0,0,0,0);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.dark .nova-tenancy-page{--nt-surface:rgba(30,41,59,.84);--nt-border:rgba(71,85,105,.72);--nt-muted:#94a3b8}.dark .nova-tenancy-brand,.dark .nova-tenancy-card__body h2,.dark .nova-tenancy-pagination button,.dark .nova-tenancy-search input,.dark .nova-tenancy-state h2{color:#f8fafc}.dark .nova-tenancy-count,.dark .nova-tenancy-state__icon--empty{background:rgba(91,33,182,.3);color:#c4b5fd}.dark .nova-tenancy-badge,.dark .nova-tenancy-card__logo,.dark .nova-tenancy-select--selected{background:color-mix(in srgb,var(--tenant-accent) 22%,#0f172a)}.dark .nova-tenancy-card--skeleton span{background:linear-gradient(90deg,#1e293b,#334155,#1e293b);background-size:220% 100%}@media (max-width:700px){.nova-tenancy-hero{align-items:stretch;flex-direction:column}.nova-tenancy-current{width:100%}.nova-tenancy-brand__title{display:none}}@media (prefers-reduced-motion:reduce){.nova-tenancy-button,.nova-tenancy-card,.nova-tenancy-pagination button,.nova-tenancy-select{transition:none}.nova-tenancy-card--skeleton span,.nova-tenancy-spinner{animation:none}}@keyframes nova-tenancy-spin{to{transform:rotate(1turn)}}@keyframes nova-tenancy-shimmer{to{background-position:-220% 0}} +.nova-tenancy-page{--nt-primary:rgba(var(--colors-primary-500,14,165,233),1);--nt-primary-soft:rgba(var(--colors-primary-500,14,165,233),0.12);--nt-primary-strong:rgba(var(--colors-primary-600,2,132,199),1);--nt-surface:rgba(var(--colors-white,255,255,255),1);--nt-border:rgba(var(--colors-gray-200,226,232,240),1);--nt-text:rgba(var(--colors-gray-900,15,23,42),1);--nt-muted:rgba(var(--colors-gray-500,100,116,139),1);--nt-shadow:rgba(var(--colors-gray-900,15,23,42),0.08);display:flex;flex-direction:column;gap:1.5rem;padding-bottom:3rem}.nova-tenancy-hero{align-items:flex-end;background:radial-gradient(circle at 12% 10%,rgba(var(--colors-primary-400,56,189,248),.58),transparent 34%),radial-gradient(circle at 88% 85%,rgba(var(--colors-primary-500,14,165,233),.38),transparent 38%),linear-gradient(135deg,color-mix(in srgb,var(--nt-primary-strong) 68%,#0f172a) 0,var(--nt-primary-strong) 50%,color-mix(in srgb,var(--nt-primary) 48%,#0f172a) 100%);border:1px solid hsla(0,0%,100%,.16);border-radius:1rem;box-shadow:0 24px 60px color-mix(in srgb,var(--nt-primary) 24%,transparent);color:#fff;display:flex;gap:2rem;justify-content:space-between;min-height:15rem;overflow:hidden;padding:clamp(1.5rem,4vw,3rem);position:relative}.nova-tenancy-hero:after{background-image:linear-gradient(hsla(0,0%,100%,.04) 1px,transparent 0),linear-gradient(90deg,hsla(0,0%,100%,.04) 1px,transparent 0);background-size:32px 32px;content:"";inset:0;-webkit-mask-image:linear-gradient(180deg,#000,transparent);mask-image:linear-gradient(180deg,#000,transparent);pointer-events:none;position:absolute}.nova-tenancy-hero__glow{background:hsla(0,0%,100%,.09);border-radius:9999px;filter:blur(2px);height:22rem;position:absolute;right:-5rem;top:-8rem;width:22rem}.nova-tenancy-current,.nova-tenancy-hero__content{position:relative;z-index:1}.nova-tenancy-hero__content{max-width:42rem}.nova-tenancy-kicker{color:color-mix(in srgb,var(--nt-primary) 24%,#fff);font-size:.72rem;font-weight:800;letter-spacing:.16em;margin:0 0 .65rem;text-transform:uppercase}.nova-tenancy-title{font-size:clamp(2rem,5vw,3.5rem);font-weight:750;letter-spacing:-.045em;line-height:1;margin:0}.nova-tenancy-description{color:hsla(0,0%,100%,.82);font-size:1rem;line-height:1.7;margin:1rem 0 0;max-width:35rem}.nova-tenancy-current{align-items:center;backdrop-filter:blur(14px);background:hsla(0,0%,100%,.1);border:1px solid hsla(0,0%,100%,.16);border-radius:.5rem;display:flex;gap:.8rem;min-width:min(100%,17rem);padding:.8rem}.nova-tenancy-card__logo,.nova-tenancy-current__logo{border-radius:.9rem;display:grid;flex:none;font-weight:800;overflow:hidden;place-items:center}.nova-tenancy-current__logo{background:#fff;color:var(--nt-primary-strong);height:3rem;width:3rem}.nova-tenancy-card__logo img,.nova-tenancy-current__logo img{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.nova-tenancy-current__copy{display:flex;flex:1;flex-direction:column;min-width:0}.nova-tenancy-current__copy span{color:hsla(0,0%,100%,.7);font-size:.68rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase}.nova-tenancy-current__copy strong{margin-top:.15rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nova-tenancy-pulse{background:rgba(var(--colors-green-400,74,222,128),1);border:2px solid hsla(0,0%,100%,.8);border-radius:9999px;box-shadow:0 0 0 4px rgba(var(--colors-green-400,74,222,128),.2);height:.55rem;width:.55rem}.nova-tenancy-toolbar{align-items:center;display:flex;gap:1rem}.nova-tenancy-search{align-items:center;background:var(--nt-surface);border:1px solid var(--nt-border);border-radius:.5rem;box-shadow:0 1px 3px var(--nt-shadow);display:flex;flex:1;gap:.75rem;max-width:34rem;min-width:0;padding-inline:1rem;transition:border-color .16s,box-shadow .16s}.nova-tenancy-search:focus-within{border-color:rgba(var(--colors-primary-400,56,189,248),.7);box-shadow:0 0 0 3px var(--nt-primary-soft)}.nova-tenancy-search svg{fill:none;stroke:var(--nt-muted);stroke-linecap:round;stroke-width:1.8;width:1.2rem}.nova-tenancy-search input{background:transparent;border:0;color:var(--nt-text);outline:0;padding:.85rem 0;width:100%}.nova-tenancy-count{background:var(--nt-primary-soft);border-radius:9999px;color:var(--nt-primary-strong);display:grid;font-size:.78rem;font-weight:800;height:2.5rem;min-width:2.5rem;place-items:center}.nova-tenancy-grid{display:grid;gap:1rem;grid-template-columns:repeat(auto-fill,minmax(min(100%,16rem),1fr))}.nova-tenancy-card{--tenant-accent:var(--nt-primary);--tenant-accent-contrast:#fff;background:var(--nt-surface);border:1px solid var(--nt-border);border-radius:.5rem;box-shadow:0 1px 3px var(--nt-shadow);display:flex;flex-direction:column;min-height:17rem;overflow:hidden;padding:1.25rem;position:relative;transition:transform .18s ease,border-color .18s ease,box-shadow .18s ease}.nova-tenancy-card:hover{border-color:color-mix(in srgb,var(--tenant-accent) 42%,transparent);box-shadow:0 10px 24px var(--nt-shadow);transform:translateY(-3px)}.nova-tenancy-card--selected{border-color:color-mix(in srgb,var(--tenant-accent) 70%,transparent);box-shadow:0 0 0 2px color-mix(in srgb,var(--tenant-accent) 16%,transparent),0 10px 24px var(--nt-shadow)}.nova-tenancy-card__accent{background:linear-gradient(90deg,var(--tenant-accent),color-mix(in srgb,var(--tenant-accent) 25%,#fff));height:.26rem;inset:0 0 auto;position:absolute}.nova-tenancy-card__header{align-items:flex-start;display:flex;gap:1rem;justify-content:space-between}.nova-tenancy-card__logo{background:color-mix(in srgb,var(--tenant-accent) 11%,#fff);border-radius:.5rem;font-size:1.35rem;height:4rem;width:4rem}.nova-tenancy-badge,.nova-tenancy-card__logo{color:color-mix(in srgb,var(--tenant-accent) 72%,var(--nt-text))}.nova-tenancy-badge{background:color-mix(in srgb,var(--tenant-accent) 10%,#fff);border-radius:9999px;font-size:.68rem;font-weight:800;padding:.35rem .65rem}.nova-tenancy-check{background:var(--tenant-accent);border-radius:9999px;color:var(--tenant-accent-contrast);display:grid;height:1.8rem;place-items:center;width:1.8rem}.nova-tenancy-check svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2;width:1rem}.nova-tenancy-card__body{flex:1;padding-block:1.2rem}.nova-tenancy-card__body h2{color:var(--nt-text);font-size:1rem;font-weight:700;line-height:1.4;margin:0}.nova-tenancy-card__body p{-webkit-box-orient:vertical;-webkit-line-clamp:2;color:var(--nt-muted);display:-webkit-box;font-size:.84rem;line-height:1.6;margin:.55rem 0 0;overflow:hidden}.nova-tenancy-card__body .nova-tenancy-card__key{color:color-mix(in srgb,var(--tenant-accent) 68%,var(--nt-muted));font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.nova-tenancy-button,.nova-tenancy-pagination button,.nova-tenancy-select{align-items:center;border:0;border-radius:.5rem;cursor:pointer;display:inline-flex;font-weight:700;gap:.55rem;justify-content:center;transition:transform .15s,background-color .15s,opacity .15s}.nova-tenancy-select{background:var(--tenant-accent);color:var(--tenant-accent-contrast);min-height:2.7rem;width:100%}.nova-tenancy-button:hover,.nova-tenancy-pagination button:not(:disabled):hover,.nova-tenancy-select:not(:disabled):hover{transform:translateY(-1px)}.nova-tenancy-select--selected{background:color-mix(in srgb,var(--tenant-accent) 10%,#fff);color:color-mix(in srgb,var(--tenant-accent) 72%,var(--nt-text))}.nova-tenancy-pagination button:disabled,.nova-tenancy-select:disabled{cursor:default;opacity:.72}.nova-tenancy-select svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.8;width:1rem}.nova-tenancy-spinner{animation:nova-tenancy-spin .65s linear infinite;border:2px solid color-mix(in srgb,currentColor 40%,transparent);border-radius:9999px;border-top-color:currentcolor;height:1rem;width:1rem}.nova-tenancy-card--skeleton{gap:1.3rem;pointer-events:none}.nova-tenancy-card--skeleton span{animation:nova-tenancy-shimmer 1.4s ease infinite;background:linear-gradient(90deg,rgba(var(--colors-gray-100,241,245,249),1),rgba(var(--colors-gray-200,226,232,240),1),rgba(var(--colors-gray-100,241,245,249),1));background-size:220% 100%;border-radius:9999px;display:block;height:1rem}.nova-tenancy-card--skeleton span:first-child{border-radius:1rem;height:4rem;width:4rem}.nova-tenancy-card--skeleton span:nth-child(2){width:70%}.nova-tenancy-card--skeleton span:nth-child(3){width:45%}.nova-tenancy-state{align-items:center;background:var(--nt-surface);border:1px dashed var(--nt-border);border-radius:.5rem;display:flex;flex-direction:column;justify-content:center;min-height:18rem;padding:2rem;text-align:center}.nova-tenancy-state__icon{background:rgba(var(--colors-red-100,254,226,226),1);border-radius:1rem;color:rgba(var(--colors-red-700,185,28,28),1);display:grid;font-size:1.5rem;font-weight:800;height:3.5rem;place-items:center;width:3.5rem}.nova-tenancy-state__icon--empty{background:var(--nt-primary-soft);color:var(--nt-primary)}.nova-tenancy-state__icon svg{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5;width:1.8rem}.nova-tenancy-state h2{color:var(--nt-text);font-size:1.1rem;margin:1rem 0 0}.nova-tenancy-state p{color:var(--nt-muted);margin:.5rem 0 0;max-width:28rem}.nova-tenancy-button{background:var(--nt-primary);color:#fff;margin-top:1rem;padding:.65rem 1rem}.nova-tenancy-pagination{align-items:center;display:flex;gap:.8rem;justify-content:center}.nova-tenancy-pagination button{background:var(--nt-surface);border:1px solid var(--nt-border);color:var(--nt-text);padding:.55rem .9rem}.nova-tenancy-pagination span{color:var(--nt-muted);font-size:.8rem;font-weight:700}.nova-tenancy-brand{align-items:center;background:transparent;border:0;color:var(--nt-text);cursor:pointer;display:flex;gap:.65rem;max-width:13.5rem;min-width:0;padding:0}.nova-tenancy-brand__logo{border-radius:.5rem;box-shadow:0 3px 12px rgba(var(--colors-gray-900,15,23,42),.12);flex:none;height:2.5rem;-o-object-fit:cover;object-fit:cover;width:2.5rem}.nova-tenancy-brand__title{font-size:.86rem;font-weight:750;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nova-tenancy-brand:focus-visible,.nova-tenancy-button:focus-visible,.nova-tenancy-pagination button:focus-visible,.nova-tenancy-select:focus-visible{outline:2px solid var(--nt-primary);outline-offset:3px}.nova-tenancy-sr-only{clip:rect(0,0,0,0);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}.dark .nova-tenancy-page{--nt-primary-soft:rgba(var(--colors-primary-500,14,165,233),0.2);--nt-surface:rgba(var(--colors-gray-800,30,41,59),1);--nt-border:rgba(var(--colors-gray-700,51,65,85),1);--nt-text:rgba(var(--colors-gray-100,241,245,249),1);--nt-muted:rgba(var(--colors-gray-400,148,163,184),1);--nt-shadow:rgba(0,0,0,.22)}.dark .nova-tenancy-brand,.dark .nova-tenancy-card__body h2,.dark .nova-tenancy-pagination button,.dark .nova-tenancy-search input,.dark .nova-tenancy-state h2{color:var(--nt-text)}.dark .nova-tenancy-count,.dark .nova-tenancy-state__icon--empty{background:var(--nt-primary-soft);color:rgba(var(--colors-primary-400,56,189,248),1)}.dark .nova-tenancy-badge,.dark .nova-tenancy-card__logo,.dark .nova-tenancy-select--selected{background:color-mix(in srgb,var(--tenant-accent) 22%,var(--nt-surface))}.dark .nova-tenancy-card--skeleton span{background:linear-gradient(90deg,rgba(var(--colors-gray-800,30,41,59),1),rgba(var(--colors-gray-700,51,65,85),1),rgba(var(--colors-gray-800,30,41,59),1));background-size:220% 100%}@media (max-width:700px){.nova-tenancy-hero{align-items:stretch;flex-direction:column}.nova-tenancy-current{width:100%}.nova-tenancy-brand__title{display:none}}@media (prefers-reduced-motion:reduce){.nova-tenancy-button,.nova-tenancy-card,.nova-tenancy-pagination button,.nova-tenancy-select{transition:none}.nova-tenancy-card--skeleton span,.nova-tenancy-spinner{animation:none}}@keyframes nova-tenancy-spin{to{transform:rotate(1turn)}}@keyframes nova-tenancy-shimmer{to{background-position:-220% 0}} diff --git a/dist/js/tool.js b/dist/js/tool.js index b213147..8201390 100644 --- a/dist/js/tool.js +++ b/dist/js/tool.js @@ -1,2 +1,2 @@ /*! For license information please see tool.js.LICENSE.txt */ -(()=>{"use strict";var e,n={733(){const e=Vue;var n=function(e,n){return null!==e&&null!==n&&String(e)===String(n)},t=function(e){return String(e||"T").trim().charAt(0).toLocaleUpperCase()},r=function(e){return{"--tenant-accent":e.accent||"#7c3aed"}};function a(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return o(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(e,n):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t3?(a=f===r)&&(l=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=p&&((a=t<2&&pr||r>f)&&(o[4]=t,o[5]=r,d.n=f,c=0))}if(a||t>1)return i;throw v=!0,r}return function(a,s,f){if(u>1)throw TypeError("Generator is already running");for(v&&1===s&&p(s,f),c=s,l=f;(n=c<2?e:l)||!v;){o||(c?c<3?(c>1&&(d.n=-1),p(c,l)):d.n=l:d.v=l);try{if(u=2,o){if(c||(a="next"),n=o[a]){if(!(n=n.call(o,l)))throw TypeError("iterator result is not an object");if(!n.done)return n;l=n.value,c<2&&(c=0)}else 1===c&&(n=o.return)&&n.call(o),c<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),c=1);o=e}else if((n=(v=d.n<0)?l:t.call(r,d))!==i)break}catch(n){o=e,c=1,l=n}finally{u=1}}return{value:n,done:v}}}(t,a,o),!0),s}var i={};function u(){}function s(){}function v(){}n=Object.getPrototypeOf;var d=[][r]?n(n([][r]())):(l(n={},r,function(){return this}),n),p=v.prototype=u.prototype=Object.create(d);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,l(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return s.prototype=v,l(p,"constructor",v),l(v,"constructor",s),s.displayName="GeneratorFunction",l(v,a,"GeneratorFunction"),l(p),l(p,a,"Generator"),l(p,r,function(){return this}),l(p,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:f}})()}function l(e,n,t,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}l=function(e,n,t,r){function o(n,t){l(e,n,function(e){return this._invoke(n,t,e)})}n?a?a(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:(o("next",0),o("throw",1),o("return",2))},l(e,n,t,r)}function i(e,n,t,r,a,o,c){try{var l=e[o](c),i=l.value}catch(e){return void t(e)}l.done?n(i):Promise.resolve(i).then(r,a)}function u(e){return function(){var n=this,t=arguments;return new Promise(function(r,a){var o=e.apply(n,t);function c(e){i(o,r,a,c,l,"next",e)}function l(e){i(o,r,a,c,l,"throw",e)}c(void 0)})}}var s={class:"nova-tenancy-page"},v={class:"nova-tenancy-hero"},d={class:"nova-tenancy-hero__content"},p={class:"nova-tenancy-kicker"},f={class:"nova-tenancy-title"},y={class:"nova-tenancy-description"},m={key:0,class:"nova-tenancy-current"},g={class:"nova-tenancy-current__logo"},k=["src"],h={key:1},b={class:"nova-tenancy-current__copy"},E=["aria-label"],N={class:"nova-tenancy-search"},B={class:"nova-tenancy-sr-only"},V=["placeholder"],_={key:0,class:"nova-tenancy-count"},S={key:0,class:"nova-tenancy-grid","aria-busy":"true"},w={key:1,class:"nova-tenancy-state",role:"alert"},P={key:2,class:"nova-tenancy-state"},O={key:3,class:"nova-tenancy-grid"},T=["aria-current"],D={class:"nova-tenancy-card__header"},j={class:"nova-tenancy-card__logo"},C=["src","onError"],x={key:1},M={key:0,class:"nova-tenancy-badge"},G=["title"],U={class:"nova-tenancy-card__body"},A={key:0},F={key:1,class:"nova-tenancy-card__key"},L=["disabled","aria-busy","onClick"],q={key:0,class:"nova-tenancy-spinner","aria-hidden":"true"},I={key:1,viewBox:"0 0 20 20","aria-hidden":"true"},$={key:4,class:"nova-tenancy-pagination","aria-label":"Pagination"},z=["disabled"],K=["disabled"];const H={__name:"NovaTenancy",setup:function(o){var l,i,H,R=Nova.config("novaTenancy")||{},W=R.copy||{},Z=(0,e.ref)([]),J=(0,e.ref)(null!==(l=null===(i=R.current)||void 0===i?void 0:i.key)&&void 0!==l?l:null),Q=(0,e.ref)(""),X=(0,e.ref)(!0),Y=(0,e.ref)(!1),ee=(0,e.ref)(null),ne=(0,e.reactive)(new Set),te=(0,e.reactive)({currentPage:1,lastPage:1,perPage:Number(R.perPage||12),total:0}),re=0,ae=(0,e.computed)(function(){var e,t;return Z.value.find(function(e){return ie(e)})||(n(null!==(e=null===(t=R.current)||void 0===t?void 0:t.key)&&void 0!==e?e:null,J.value)?R.current:null)}),oe=function(){var e=u(c().m(function e(){var n,t;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=++re,X.value=!0,Y.value=!1,e.p=1,e.n=2,Nova.request().get("".concat(R.apiBase||"/nova-vendor/nova-tenancy","/tenants"),{params:{search:Q.value||void 0,page:te.currentPage,perPage:te.perPage}});case 2:if(t=e.v,n===re){e.n=3;break}return e.a(2);case 3:Z.value=t.data.data,J.value=t.data.currentKey,Object.assign(te,t.data.meta),e.n=5;break;case 4:e.p=4,e.v,n===re&&(Y.value=!0);case 5:return e.p=5,n===re&&(X.value=!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),ce=function(){var e=u(c().m(function e(n){var t;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:if(null===ee.value&&!ie(n)){e.n=1;break}return e.a(2);case 1:return ee.value=String(n.key),e.p=2,e.n=3,Nova.request().post("".concat(R.apiBase||"/nova-vendor/nova-tenancy","/current"),{tenant:String(n.key)});case 3:t=e.v,J.value=t.data.current.key,Nova.$emit("nova-tenancy:changed",t.data),Nova.visit(t.data.redirectTo||"/"),e.n=5;break;case 4:e.p=4,e.v,Nova.$emit("error",W.error||"Unable to select tenant.");case 5:return e.p=5,ee.value=null,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(n){return e.apply(this,arguments)}}(),le=function(e){te.currentPage=e,oe()},ie=function(e){return n(e.key,J.value)},ue=t,se=r,ve=function(e){return ne.add(String(e))};return(0,e.watch)(Q,function(){clearTimeout(H),H=setTimeout(function(){te.currentPage=1,oe()},Number(R.searchDebounce||300))}),(0,e.onMounted)(oe),(0,e.onBeforeUnmount)(function(){return clearTimeout(H)}),function(n,t){var r=(0,e.resolveComponent)("Head");return(0,e.openBlock)(),(0,e.createElementBlock)("div",s,[(0,e.createVNode)(r,{title:(0,e.unref)(W).pageTitle},null,8,["title"]),(0,e.createElementVNode)("section",v,[t[5]||(t[5]=(0,e.createElementVNode)("div",{class:"nova-tenancy-hero__glow","aria-hidden":"true"},null,-1)),(0,e.createElementVNode)("div",d,[(0,e.createElementVNode)("p",p,(0,e.toDisplayString)((0,e.unref)(W).pageKicker),1),(0,e.createElementVNode)("h1",f,(0,e.toDisplayString)((0,e.unref)(W).pageTitle),1),(0,e.createElementVNode)("p",y,(0,e.toDisplayString)((0,e.unref)(W).pageDescription),1)]),ae.value?((0,e.openBlock)(),(0,e.createElementBlock)("div",m,[(0,e.createElementVNode)("div",g,[ae.value.logoUrl&&!ne.has(String(ae.value.key))?((0,e.openBlock)(),(0,e.createElementBlock)("img",{key:0,src:ae.value.logoUrl,alt:"",onError:t[0]||(t[0]=function(e){return ve(ae.value.key)})},null,40,k)):((0,e.openBlock)(),(0,e.createElementBlock)("span",h,(0,e.toDisplayString)((0,e.unref)(ue)(ae.value.title)),1))]),(0,e.createElementVNode)("div",b,[(0,e.createElementVNode)("span",null,(0,e.toDisplayString)((0,e.unref)(W).currentTenant),1),(0,e.createElementVNode)("strong",null,(0,e.toDisplayString)(ae.value.title),1)]),t[4]||(t[4]=(0,e.createElementVNode)("span",{class:"nova-tenancy-pulse","aria-hidden":"true"},null,-1))])):(0,e.createCommentVNode)("",!0)]),(0,e.createElementVNode)("section",{class:"nova-tenancy-toolbar","aria-label":(0,e.unref)(W).search},[(0,e.createElementVNode)("label",N,[t[6]||(t[6]=(0,e.createElementVNode)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},[(0,e.createElementVNode)("path",{d:"m21 21-4.35-4.35m2.35-5.65a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z"})],-1)),(0,e.createElementVNode)("span",B,(0,e.toDisplayString)((0,e.unref)(W).search),1),(0,e.withDirectives)((0,e.createElementVNode)("input",{"onUpdate:modelValue":t[1]||(t[1]=function(e){return Q.value=e}),type:"search",placeholder:(0,e.unref)(W).searchPlaceholder,autocomplete:"off"},null,8,V),[[e.vModelText,Q.value]])]),X.value?(0,e.createCommentVNode)("",!0):((0,e.openBlock)(),(0,e.createElementBlock)("span",_,(0,e.toDisplayString)(te.total.toLocaleString()),1))],8,E),X.value?((0,e.openBlock)(),(0,e.createElementBlock)("div",S,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(6,function(n){return(0,e.createElementVNode)("div",{key:n,class:"nova-tenancy-card nova-tenancy-card--skeleton"},a(t[7]||(t[7]=[(0,e.createElementVNode)("span",null,null,-1),(0,e.createElementVNode)("span",null,null,-1),(0,e.createElementVNode)("span",null,null,-1)])))}),64))])):Y.value?((0,e.openBlock)(),(0,e.createElementBlock)("div",w,[t[8]||(t[8]=(0,e.createElementVNode)("div",{class:"nova-tenancy-state__icon"},"!",-1)),(0,e.createElementVNode)("h2",null,(0,e.toDisplayString)((0,e.unref)(W).error),1),(0,e.createElementVNode)("button",{type:"button",class:"nova-tenancy-button",onClick:oe},(0,e.toDisplayString)((0,e.unref)(W).retry),1)])):0===Z.value.length?((0,e.openBlock)(),(0,e.createElementBlock)("div",P,[t[9]||(t[9]=(0,e.createElementVNode)("div",{class:"nova-tenancy-state__icon nova-tenancy-state__icon--empty"},[(0,e.createElementVNode)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},[(0,e.createElementVNode)("path",{d:"M3 21h18M5 21V7l7-4 7 4v14M9 10h.01M9 14h.01M9 18h.01M15 10h.01M15 14h.01M15 18h.01"})])],-1)),(0,e.createElementVNode)("h2",null,(0,e.toDisplayString)((0,e.unref)(W).emptyTitle),1),(0,e.createElementVNode)("p",null,(0,e.toDisplayString)((0,e.unref)(W).emptyDescription),1)])):((0,e.openBlock)(),(0,e.createElementBlock)("div",O,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(Z.value,function(n){return(0,e.openBlock)(),(0,e.createElementBlock)("article",{key:n.key,class:(0,e.normalizeClass)(["nova-tenancy-card",{"nova-tenancy-card--selected":ie(n)}]),style:(0,e.normalizeStyle)((0,e.unref)(se)(n)),"aria-current":ie(n)?"true":void 0},[t[12]||(t[12]=(0,e.createElementVNode)("div",{class:"nova-tenancy-card__accent","aria-hidden":"true"},null,-1)),(0,e.createElementVNode)("div",D,[(0,e.createElementVNode)("div",j,[n.logoUrl&&!ne.has(String(n.key))?((0,e.openBlock)(),(0,e.createElementBlock)("img",{key:0,src:n.logoUrl,alt:"",loading:"lazy",onError:function(e){return ve(n.key)}},null,40,C)):((0,e.openBlock)(),(0,e.createElementBlock)("span",x,(0,e.toDisplayString)((0,e.unref)(ue)(n.title)),1))]),n.badge?((0,e.openBlock)(),(0,e.createElementBlock)("span",M,(0,e.toDisplayString)(n.badge),1)):ie(n)?((0,e.openBlock)(),(0,e.createElementBlock)("span",{key:1,class:"nova-tenancy-check",title:(0,e.unref)(W).selected},a(t[10]||(t[10]=[(0,e.createElementVNode)("svg",{viewBox:"0 0 20 20","aria-hidden":"true"},[(0,e.createElementVNode)("path",{d:"m5 10 3 3 7-7"})],-1)])),8,G)):(0,e.createCommentVNode)("",!0)]),(0,e.createElementVNode)("div",U,[(0,e.createElementVNode)("h2",null,(0,e.toDisplayString)(n.title),1),n.description?((0,e.openBlock)(),(0,e.createElementBlock)("p",A,(0,e.toDisplayString)(n.description),1)):((0,e.openBlock)(),(0,e.createElementBlock)("p",F,"#"+(0,e.toDisplayString)(n.key),1))]),(0,e.createElementVNode)("button",{type:"button",class:(0,e.normalizeClass)(["nova-tenancy-select",{"nova-tenancy-select--selected":ie(n)}]),disabled:null!==ee.value||ie(n),"aria-busy":ee.value===String(n.key),onClick:function(e){return ce(n)}},[ee.value===String(n.key)?((0,e.openBlock)(),(0,e.createElementBlock)("span",q)):(0,e.createCommentVNode)("",!0),(0,e.createElementVNode)("span",null,(0,e.toDisplayString)(ie(n)?(0,e.unref)(W).selected:(0,e.unref)(W).select),1),ie(n)?(0,e.createCommentVNode)("",!0):((0,e.openBlock)(),(0,e.createElementBlock)("svg",I,a(t[11]||(t[11]=[(0,e.createElementVNode)("path",{d:"M4 10h12m-4-4 4 4-4 4"},null,-1)]))))],10,L)],14,T)}),128))])),te.lastPage>1?((0,e.openBlock)(),(0,e.createElementBlock)("nav",$,[(0,e.createElementVNode)("button",{type:"button",disabled:te.currentPage<=1||X.value,onClick:t[2]||(t[2]=function(e){return le(te.currentPage-1)})},(0,e.toDisplayString)((0,e.unref)(W).previous),9,z),(0,e.createElementVNode)("span",null,(0,e.toDisplayString)(te.currentPage)+" / "+(0,e.toDisplayString)(te.lastPage),1),(0,e.createElementVNode)("button",{type:"button",disabled:te.currentPage>=te.lastPage||X.value,onClick:t[3]||(t[3]=function(e){return le(te.currentPage+1)})},(0,e.toDisplayString)((0,e.unref)(W).next),9,K)])):(0,e.createCommentVNode)("",!0)])}}},R=H;function W(){var e,n,t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",a=t.toStringTag||"@@toStringTag";function o(t,r,a,o){var i=r&&r.prototype instanceof l?r:l,u=Object.create(i.prototype);return Z(u,"_invoke",function(t,r,a){var o,l,i,u=0,s=a||[],v=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(n,t){return o=n,l=0,i=e,d.n=t,c}};function p(t,r){for(l=t,i=r,n=0;!v&&u&&!a&&n3?(a=f===r)&&(i=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=e):o[0]<=p&&((a=t<2&&pr||r>f)&&(o[4]=t,o[5]=r,d.n=f,l=0))}if(a||t>1)return c;throw v=!0,r}return function(a,s,f){if(u>1)throw TypeError("Generator is already running");for(v&&1===s&&p(s,f),l=s,i=f;(n=l<2?e:i)||!v;){o||(l?l<3?(l>1&&(d.n=-1),p(l,i)):d.n=i:d.v=i);try{if(u=2,o){if(l||(a="next"),n=o[a]){if(!(n=n.call(o,i)))throw TypeError("iterator result is not an object");if(!n.done)return n;i=n.value,l<2&&(l=0)}else 1===l&&(n=o.return)&&n.call(o),l<2&&(i=TypeError("The iterator does not provide a '"+a+"' method"),l=1);o=e}else if((n=(v=d.n<0)?i:t.call(r,d))!==c)break}catch(n){o=e,l=1,i=n}finally{u=1}}return{value:n,done:v}}}(t,a,o),!0),u}var c={};function l(){}function i(){}function u(){}n=Object.getPrototypeOf;var s=[][r]?n(n([][r]())):(Z(n={},r,function(){return this}),n),v=u.prototype=l.prototype=Object.create(s);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Z(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e}return i.prototype=u,Z(v,"constructor",u),Z(u,"constructor",i),i.displayName="GeneratorFunction",Z(u,a,"GeneratorFunction"),Z(v),Z(v,a,"Generator"),Z(v,r,function(){return this}),Z(v,"toString",function(){return"[object Generator]"}),(W=function(){return{w:o,m:d}})()}function Z(e,n,t,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}Z=function(e,n,t,r){function o(n,t){Z(e,n,function(e){return this._invoke(n,t,e)})}n?a?a(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:(o("next",0),o("throw",1),o("return",2))},Z(e,n,t,r)}function J(e,n,t,r,a,o,c){try{var l=e[o](c),i=l.value}catch(e){return void t(e)}l.done?n(i):Promise.resolve(i).then(r,a)}var Q=["title"],X=["src"],Y={key:1,class:"nova-tenancy-brand__title"};const ee={__name:"TenantAppLogo",setup:function(n){var t=Nova.config("novaTenancy")||{},r=(0,e.ref)(null),a=(0,e.ref)(t.current||null),o=(0,e.ref)(Date.now()),c=null,l=(0,e.computed)(function(){var e;return!1!==(null===(e=t.branding)||void 0===e?void 0:e.show_logo)}),i=(0,e.computed)(function(){var e;return!1!==(null===(e=t.branding)||void 0===e?void 0:e.show_title)}),u=(0,e.computed)(function(){var e,n;return(null===(e=a.value)||void 0===e?void 0:e.title)||(null===(n=t.copy)||void 0===n?void 0:n.selectTenant)||"Select tenant"}),s=(0,e.computed)(function(){var e,n;return function(e,n,t){return"".concat(e,"/current/logo?tenant=").concat(encodeURIComponent(null!=n?n:"none"),"&v=").concat(t)}(t.apiBase||"/nova-vendor/nova-tenancy",null!==(e=null===(n=a.value)||void 0===n?void 0:n.key)&&void 0!==e?e:"none",o.value)}),v=function(e){var n,t;a.value=null!==(n=null!==(t=null==e?void 0:e.current)&&void 0!==t?t:e)&&void 0!==n?n:null,o.value=Date.now()},d=function(){var e,n=(e=W().m(function e(){var n;return W().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Nova.request().get("".concat(t.apiBase||"/nova-vendor/nova-tenancy","/current"));case 1:n=e.v,v(n.data),e.n=3;break;case 2:e.p=2,e.v;case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var n=this,t=arguments;return new Promise(function(r,a){var o=e.apply(n,t);function c(e){J(o,r,a,c,l,"next",e)}function l(e){J(o,r,a,c,l,"throw",e)}c(void 0)})});return function(){return n.apply(this,arguments)}}(),p=function(){var e,n;Nova.visit("home"===(n=null===(e=t.branding)||void 0===e?void 0:e.link)?"/":"string"==typeof n&&n.startsWith("/")?n:t.selectorPath||"/nova-tenancy")},f=function(e){e.preventDefault(),e.stopImmediatePropagation(),p()};return(0,e.onMounted)(function(){var e,n;Nova.$on("nova-tenancy:changed",v),null===(n=c=(null===(e=r.value)||void 0===e?void 0:e.closest("a"))||null)||void 0===n||n.addEventListener("click",f,!0),d()}),(0,e.onBeforeUnmount)(function(){var e;Nova.$off("nova-tenancy:changed",v),null===(e=c)||void 0===e||e.removeEventListener("click",f,!0)}),function(n,t){return(0,e.openBlock)(),(0,e.createElementBlock)("span",{ref_key:"brand",ref:r,class:"nova-tenancy-brand",title:u.value,onClick:(0,e.withModifiers)(p,["stop","prevent"])},[l.value?((0,e.openBlock)(),(0,e.createElementBlock)("img",{key:s.value,src:s.value,class:"nova-tenancy-brand__logo",alt:""},null,8,X)):(0,e.createCommentVNode)("",!0),i.value?((0,e.openBlock)(),(0,e.createElementBlock)("span",Y,(0,e.toDisplayString)(u.value),1)):(0,e.createCommentVNode)("",!0)],8,Q)}}},ne=ee;Nova.inertia("NovaTenancy",R),Nova.booting(function(e){var n;!1!==(null===(n=Nova.config("novaTenancy"))||void 0===n||null===(n=n.branding)||void 0===n?void 0:n.enabled)&&e.component("AppLogo",ne)}),Nova.request().interceptors.response.use(function(e){return e},function(e){var n,t;if(409===(null===(n=e.response)||void 0===n?void 0:n.status)&&"tenant_selection_required"===(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.code)){var r,a=(null===(r=Nova.config("novaTenancy"))||void 0===r?void 0:r.selectorPath)||"/nova-tenancy";Nova.visit(a)}return Promise.reject(e)})},351(){}},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var o=t[e]={exports:{}};return n[e](o,o.exports,r),o.exports}r.m=n,e=[],r.O=(n,t,a,o)=>{if(!t){var c=1/0;for(s=0;s=o)&&Object.keys(r.O).every(e=>r.O[e](t[i]))?t.splice(i--,1):(l=!1,o0&&e[s-1][2]>o;s--)e[s]=e[s-1];e[s]=[t,a,o]},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={416:0,757:0};r.O.j=n=>0===e[n];var n=(n,t)=>{var a,o,[c,l,i]=t,u=0;if(c.some(n=>0!==e[n])){for(a in l)r.o(l,a)&&(r.m[a]=l[a]);if(i)var s=i(r)}for(n&&n(t);ur(733));var a=r.O(void 0,[757],()=>r(351));a=r.O(a)})(); \ No newline at end of file +(()=>{"use strict";var e,n={733(){const e=Vue;var n=function(e,n){return null!==e&&null!==n&&String(e)===String(n)},t=function(e){return String(e||"T").trim().charAt(0).toLocaleUpperCase()},r=function(e){if(!/^#[0-9a-f]{6}$/i.test(e||""))return"#ffffff";var n=e.slice(1).match(/.{2}/g).map(function(e){return Number.parseInt(e,16)/255}).map(function(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}),t=.2126*n[0]+.7152*n[1]+.0722*n[2];return(t+.05)/.068>1.05/(t+.05)?"#0f172a":"#ffffff"},a=function(e){return e.accent?{"--tenant-accent":e.accent,"--tenant-accent-contrast":r(e.accent)}:{}};function o(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return c(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,n):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t3?(a=p===r)&&(i=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=e):o[0]<=f&&((a=t<2&&fr||r>p)&&(o[4]=t,o[5]=r,d.n=p,l=0))}if(a||t>1)return c;throw v=!0,r}return function(a,s,p){if(u>1)throw TypeError("Generator is already running");for(v&&1===s&&f(s,p),l=s,i=p;(n=l<2?e:i)||!v;){o||(l?l<3?(l>1&&(d.n=-1),f(l,i)):d.n=i:d.v=i);try{if(u=2,o){if(l||(a="next"),n=o[a]){if(!(n=n.call(o,i)))throw TypeError("iterator result is not an object");if(!n.done)return n;i=n.value,l<2&&(l=0)}else 1===l&&(n=o.return)&&n.call(o),l<2&&(i=TypeError("The iterator does not provide a '"+a+"' method"),l=1);o=e}else if((n=(v=d.n<0)?i:t.call(r,d))!==c)break}catch(n){o=e,l=1,i=n}finally{u=1}}return{value:n,done:v}}}(t,a,o),!0),s}var c={};function u(){}function s(){}function v(){}n=Object.getPrototypeOf;var d=[][r]?n(n([][r]())):(i(n={},r,function(){return this}),n),f=v.prototype=u.prototype=Object.create(d);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,i(e,a,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=v,i(f,"constructor",v),i(v,"constructor",s),s.displayName="GeneratorFunction",i(v,a,"GeneratorFunction"),i(f),i(f,a,"Generator"),i(f,r,function(){return this}),i(f,"toString",function(){return"[object Generator]"}),(l=function(){return{w:o,m:p}})()}function i(e,n,t,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}i=function(e,n,t,r){function o(n,t){i(e,n,function(e){return this._invoke(n,t,e)})}n?a?a(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:(o("next",0),o("throw",1),o("return",2))},i(e,n,t,r)}function u(e,n,t,r,a,o,c){try{var l=e[o](c),i=l.value}catch(e){return void t(e)}l.done?n(i):Promise.resolve(i).then(r,a)}function s(e){return function(){var n=this,t=arguments;return new Promise(function(r,a){var o=e.apply(n,t);function c(e){u(o,r,a,c,l,"next",e)}function l(e){u(o,r,a,c,l,"throw",e)}c(void 0)})}}var v={class:"nova-tenancy-page"},d={class:"nova-tenancy-hero"},f={class:"nova-tenancy-hero__content"},p={class:"nova-tenancy-kicker"},y={class:"nova-tenancy-title"},m={class:"nova-tenancy-description"},g={key:0,class:"nova-tenancy-current"},k={class:"nova-tenancy-current__logo"},h=["src"],b={key:1},E={class:"nova-tenancy-current__copy"},N=["aria-label"],B={class:"nova-tenancy-search"},V={class:"nova-tenancy-sr-only"},_=["placeholder"],S={key:0,class:"nova-tenancy-count"},w={key:0,class:"nova-tenancy-grid","aria-busy":"true"},P={key:1,class:"nova-tenancy-state",role:"alert"},O={key:2,class:"nova-tenancy-state"},T={key:3,class:"nova-tenancy-grid"},D=["aria-current"],j={class:"nova-tenancy-card__header"},C={class:"nova-tenancy-card__logo"},x=["src","onError"],M={key:1},G={key:0,class:"nova-tenancy-badge"},U=["title"],A={class:"nova-tenancy-card__body"},F={key:0},L={key:1,class:"nova-tenancy-card__key"},I=["disabled","aria-busy","onClick"],$={key:0,class:"nova-tenancy-spinner","aria-hidden":"true"},q={key:1,viewBox:"0 0 20 20","aria-hidden":"true"},z={key:4,class:"nova-tenancy-pagination","aria-label":"Pagination"},K=["disabled"],H=["disabled"];const R={__name:"NovaTenancy",setup:function(r){var c,i,u,R=Nova.config("novaTenancy")||{},W=R.copy||{},Z=(0,e.ref)([]),J=(0,e.ref)(null!==(c=null===(i=R.current)||void 0===i?void 0:i.key)&&void 0!==c?c:null),Q=(0,e.ref)(""),X=(0,e.ref)(!0),Y=(0,e.ref)(!1),ee=(0,e.ref)(null),ne=(0,e.reactive)(new Set),te=(0,e.reactive)({currentPage:1,lastPage:1,perPage:Number(R.perPage||12),total:0}),re=0,ae=(0,e.computed)(function(){var e,t;return Z.value.find(function(e){return ie(e)})||(n(null!==(e=null===(t=R.current)||void 0===t?void 0:t.key)&&void 0!==e?e:null,J.value)?R.current:null)}),oe=function(){var e=s(l().m(function e(){var n,t;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=++re,X.value=!0,Y.value=!1,e.p=1,e.n=2,Nova.request().get("".concat(R.apiBase||"/nova-vendor/nova-tenancy","/tenants"),{params:{search:Q.value||void 0,page:te.currentPage,perPage:te.perPage}});case 2:if(t=e.v,n===re){e.n=3;break}return e.a(2);case 3:Z.value=t.data.data,J.value=t.data.currentKey,Object.assign(te,t.data.meta),e.n=5;break;case 4:e.p=4,e.v,n===re&&(Y.value=!0);case 5:return e.p=5,n===re&&(X.value=!1),e.f(5);case 6:return e.a(2)}},e,null,[[1,4,5,6]])}));return function(){return e.apply(this,arguments)}}(),ce=function(){var e=s(l().m(function e(n){var t;return l().w(function(e){for(;;)switch(e.p=e.n){case 0:if(null===ee.value&&!ie(n)){e.n=1;break}return e.a(2);case 1:return ee.value=String(n.key),e.p=2,e.n=3,Nova.request().post("".concat(R.apiBase||"/nova-vendor/nova-tenancy","/current"),{tenant:String(n.key)});case 3:t=e.v,J.value=t.data.current.key,Nova.$emit("nova-tenancy:changed",t.data),Nova.visit(t.data.redirectTo||"/"),e.n=5;break;case 4:e.p=4,e.v,Nova.$emit("error",W.error||"Unable to select tenant.");case 5:return e.p=5,ee.value=null,e.f(5);case 6:return e.a(2)}},e,null,[[2,4,5,6]])}));return function(n){return e.apply(this,arguments)}}(),le=function(e){te.currentPage=e,oe()},ie=function(e){return n(e.key,J.value)},ue=t,se=a,ve=function(e){return ne.add(String(e))};return(0,e.watch)(Q,function(){clearTimeout(u),u=setTimeout(function(){te.currentPage=1,oe()},Number(R.searchDebounce||300))}),(0,e.onMounted)(oe),(0,e.onBeforeUnmount)(function(){return clearTimeout(u)}),function(n,t){var r=(0,e.resolveComponent)("Head");return(0,e.openBlock)(),(0,e.createElementBlock)("div",v,[(0,e.createVNode)(r,{title:(0,e.unref)(W).pageTitle},null,8,["title"]),(0,e.createElementVNode)("section",d,[t[5]||(t[5]=(0,e.createElementVNode)("div",{class:"nova-tenancy-hero__glow","aria-hidden":"true"},null,-1)),(0,e.createElementVNode)("div",f,[(0,e.createElementVNode)("p",p,(0,e.toDisplayString)((0,e.unref)(W).pageKicker),1),(0,e.createElementVNode)("h1",y,(0,e.toDisplayString)((0,e.unref)(W).pageTitle),1),(0,e.createElementVNode)("p",m,(0,e.toDisplayString)((0,e.unref)(W).pageDescription),1)]),ae.value?((0,e.openBlock)(),(0,e.createElementBlock)("div",g,[(0,e.createElementVNode)("div",k,[ae.value.logoUrl&&!ne.has(String(ae.value.key))?((0,e.openBlock)(),(0,e.createElementBlock)("img",{key:0,src:ae.value.logoUrl,alt:"",onError:t[0]||(t[0]=function(e){return ve(ae.value.key)})},null,40,h)):((0,e.openBlock)(),(0,e.createElementBlock)("span",b,(0,e.toDisplayString)((0,e.unref)(ue)(ae.value.title)),1))]),(0,e.createElementVNode)("div",E,[(0,e.createElementVNode)("span",null,(0,e.toDisplayString)((0,e.unref)(W).currentTenant),1),(0,e.createElementVNode)("strong",null,(0,e.toDisplayString)(ae.value.title),1)]),t[4]||(t[4]=(0,e.createElementVNode)("span",{class:"nova-tenancy-pulse","aria-hidden":"true"},null,-1))])):(0,e.createCommentVNode)("",!0)]),(0,e.createElementVNode)("section",{class:"nova-tenancy-toolbar","aria-label":(0,e.unref)(W).search},[(0,e.createElementVNode)("label",B,[t[6]||(t[6]=(0,e.createElementVNode)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},[(0,e.createElementVNode)("path",{d:"m21 21-4.35-4.35m2.35-5.65a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z"})],-1)),(0,e.createElementVNode)("span",V,(0,e.toDisplayString)((0,e.unref)(W).search),1),(0,e.withDirectives)((0,e.createElementVNode)("input",{"onUpdate:modelValue":t[1]||(t[1]=function(e){return Q.value=e}),type:"search",placeholder:(0,e.unref)(W).searchPlaceholder,autocomplete:"off"},null,8,_),[[e.vModelText,Q.value]])]),X.value?(0,e.createCommentVNode)("",!0):((0,e.openBlock)(),(0,e.createElementBlock)("span",S,(0,e.toDisplayString)(te.total.toLocaleString()),1))],8,N),X.value?((0,e.openBlock)(),(0,e.createElementBlock)("div",w,[((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(6,function(n){return(0,e.createElementVNode)("div",{key:n,class:"nova-tenancy-card nova-tenancy-card--skeleton"},o(t[7]||(t[7]=[(0,e.createElementVNode)("span",null,null,-1),(0,e.createElementVNode)("span",null,null,-1),(0,e.createElementVNode)("span",null,null,-1)])))}),64))])):Y.value?((0,e.openBlock)(),(0,e.createElementBlock)("div",P,[t[8]||(t[8]=(0,e.createElementVNode)("div",{class:"nova-tenancy-state__icon"},"!",-1)),(0,e.createElementVNode)("h2",null,(0,e.toDisplayString)((0,e.unref)(W).error),1),(0,e.createElementVNode)("button",{type:"button",class:"nova-tenancy-button",onClick:oe},(0,e.toDisplayString)((0,e.unref)(W).retry),1)])):0===Z.value.length?((0,e.openBlock)(),(0,e.createElementBlock)("div",O,[t[9]||(t[9]=(0,e.createElementVNode)("div",{class:"nova-tenancy-state__icon nova-tenancy-state__icon--empty"},[(0,e.createElementVNode)("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},[(0,e.createElementVNode)("path",{d:"M3 21h18M5 21V7l7-4 7 4v14M9 10h.01M9 14h.01M9 18h.01M15 10h.01M15 14h.01M15 18h.01"})])],-1)),(0,e.createElementVNode)("h2",null,(0,e.toDisplayString)((0,e.unref)(W).emptyTitle),1),(0,e.createElementVNode)("p",null,(0,e.toDisplayString)((0,e.unref)(W).emptyDescription),1)])):((0,e.openBlock)(),(0,e.createElementBlock)("div",T,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(Z.value,function(n){return(0,e.openBlock)(),(0,e.createElementBlock)("article",{key:n.key,class:(0,e.normalizeClass)(["nova-tenancy-card",{"nova-tenancy-card--selected":ie(n)}]),style:(0,e.normalizeStyle)((0,e.unref)(se)(n)),"aria-current":ie(n)?"true":void 0},[t[12]||(t[12]=(0,e.createElementVNode)("div",{class:"nova-tenancy-card__accent","aria-hidden":"true"},null,-1)),(0,e.createElementVNode)("div",j,[(0,e.createElementVNode)("div",C,[n.logoUrl&&!ne.has(String(n.key))?((0,e.openBlock)(),(0,e.createElementBlock)("img",{key:0,src:n.logoUrl,alt:"",loading:"lazy",onError:function(e){return ve(n.key)}},null,40,x)):((0,e.openBlock)(),(0,e.createElementBlock)("span",M,(0,e.toDisplayString)((0,e.unref)(ue)(n.title)),1))]),n.badge?((0,e.openBlock)(),(0,e.createElementBlock)("span",G,(0,e.toDisplayString)(n.badge),1)):ie(n)?((0,e.openBlock)(),(0,e.createElementBlock)("span",{key:1,class:"nova-tenancy-check",title:(0,e.unref)(W).selected},o(t[10]||(t[10]=[(0,e.createElementVNode)("svg",{viewBox:"0 0 20 20","aria-hidden":"true"},[(0,e.createElementVNode)("path",{d:"m5 10 3 3 7-7"})],-1)])),8,U)):(0,e.createCommentVNode)("",!0)]),(0,e.createElementVNode)("div",A,[(0,e.createElementVNode)("h2",null,(0,e.toDisplayString)(n.title),1),n.description?((0,e.openBlock)(),(0,e.createElementBlock)("p",F,(0,e.toDisplayString)(n.description),1)):((0,e.openBlock)(),(0,e.createElementBlock)("p",L,"#"+(0,e.toDisplayString)(n.key),1))]),(0,e.createElementVNode)("button",{type:"button",class:(0,e.normalizeClass)(["nova-tenancy-select",{"nova-tenancy-select--selected":ie(n)}]),disabled:null!==ee.value||ie(n),"aria-busy":ee.value===String(n.key),onClick:function(e){return ce(n)}},[ee.value===String(n.key)?((0,e.openBlock)(),(0,e.createElementBlock)("span",$)):(0,e.createCommentVNode)("",!0),(0,e.createElementVNode)("span",null,(0,e.toDisplayString)(ie(n)?(0,e.unref)(W).selected:(0,e.unref)(W).select),1),ie(n)?(0,e.createCommentVNode)("",!0):((0,e.openBlock)(),(0,e.createElementBlock)("svg",q,o(t[11]||(t[11]=[(0,e.createElementVNode)("path",{d:"M4 10h12m-4-4 4 4-4 4"},null,-1)]))))],10,I)],14,D)}),128))])),te.lastPage>1?((0,e.openBlock)(),(0,e.createElementBlock)("nav",z,[(0,e.createElementVNode)("button",{type:"button",disabled:te.currentPage<=1||X.value,onClick:t[2]||(t[2]=function(e){return le(te.currentPage-1)})},(0,e.toDisplayString)((0,e.unref)(W).previous),9,K),(0,e.createElementVNode)("span",null,(0,e.toDisplayString)(te.currentPage)+" / "+(0,e.toDisplayString)(te.lastPage),1),(0,e.createElementVNode)("button",{type:"button",disabled:te.currentPage>=te.lastPage||X.value,onClick:t[3]||(t[3]=function(e){return le(te.currentPage+1)})},(0,e.toDisplayString)((0,e.unref)(W).next),9,H)])):(0,e.createCommentVNode)("",!0)])}}},W=R;function Z(){var e,n,t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",a=t.toStringTag||"@@toStringTag";function o(t,r,a,o){var i=r&&r.prototype instanceof l?r:l,u=Object.create(i.prototype);return J(u,"_invoke",function(t,r,a){var o,l,i,u=0,s=a||[],v=!1,d={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(n,t){return o=n,l=0,i=e,d.n=t,c}};function f(t,r){for(l=t,i=r,n=0;!v&&u&&!a&&n3?(a=p===r)&&(i=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=e):o[0]<=f&&((a=t<2&&fr||r>p)&&(o[4]=t,o[5]=r,d.n=p,l=0))}if(a||t>1)return c;throw v=!0,r}return function(a,s,p){if(u>1)throw TypeError("Generator is already running");for(v&&1===s&&f(s,p),l=s,i=p;(n=l<2?e:i)||!v;){o||(l?l<3?(l>1&&(d.n=-1),f(l,i)):d.n=i:d.v=i);try{if(u=2,o){if(l||(a="next"),n=o[a]){if(!(n=n.call(o,i)))throw TypeError("iterator result is not an object");if(!n.done)return n;i=n.value,l<2&&(l=0)}else 1===l&&(n=o.return)&&n.call(o),l<2&&(i=TypeError("The iterator does not provide a '"+a+"' method"),l=1);o=e}else if((n=(v=d.n<0)?i:t.call(r,d))!==c)break}catch(n){o=e,l=1,i=n}finally{u=1}}return{value:n,done:v}}}(t,a,o),!0),u}var c={};function l(){}function i(){}function u(){}n=Object.getPrototypeOf;var s=[][r]?n(n([][r]())):(J(n={},r,function(){return this}),n),v=u.prototype=l.prototype=Object.create(s);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,J(e,a,"GeneratorFunction")),e.prototype=Object.create(v),e}return i.prototype=u,J(v,"constructor",u),J(u,"constructor",i),i.displayName="GeneratorFunction",J(u,a,"GeneratorFunction"),J(v),J(v,a,"Generator"),J(v,r,function(){return this}),J(v,"toString",function(){return"[object Generator]"}),(Z=function(){return{w:o,m:d}})()}function J(e,n,t,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}J=function(e,n,t,r){function o(n,t){J(e,n,function(e){return this._invoke(n,t,e)})}n?a?a(e,n,{value:t,enumerable:!r,configurable:!r,writable:!r}):e[n]=t:(o("next",0),o("throw",1),o("return",2))},J(e,n,t,r)}function Q(e,n,t,r,a,o,c){try{var l=e[o](c),i=l.value}catch(e){return void t(e)}l.done?n(i):Promise.resolve(i).then(r,a)}var X=["title"],Y=["src"],ee={key:1,class:"nova-tenancy-brand__title"};const ne={__name:"TenantAppLogo",setup:function(n){var t=Nova.config("novaTenancy")||{},r=(0,e.ref)(null),a=(0,e.ref)(t.current||null),o=(0,e.ref)(Date.now()),c=null,l=(0,e.computed)(function(){var e;return!1!==(null===(e=t.branding)||void 0===e?void 0:e.show_logo)}),i=(0,e.computed)(function(){var e;return!1!==(null===(e=t.branding)||void 0===e?void 0:e.show_title)}),u=(0,e.computed)(function(){var e,n;return(null===(e=a.value)||void 0===e?void 0:e.title)||(null===(n=t.copy)||void 0===n?void 0:n.selectTenant)||"Select tenant"}),s=(0,e.computed)(function(){var e,n;return function(e,n,t){return"".concat(e,"/current/logo?tenant=").concat(encodeURIComponent(null!=n?n:"none"),"&v=").concat(t)}(t.apiBase||"/nova-vendor/nova-tenancy",null!==(e=null===(n=a.value)||void 0===n?void 0:n.key)&&void 0!==e?e:"none",o.value)}),v=function(e){var n,t;a.value=null!==(n=null!==(t=null==e?void 0:e.current)&&void 0!==t?t:e)&&void 0!==n?n:null,o.value=Date.now()},d=function(){var e,n=(e=Z().m(function e(){var n;return Z().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Nova.request().get("".concat(t.apiBase||"/nova-vendor/nova-tenancy","/current"));case 1:n=e.v,v(n.data),e.n=3;break;case 2:e.p=2,e.v;case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var n=this,t=arguments;return new Promise(function(r,a){var o=e.apply(n,t);function c(e){Q(o,r,a,c,l,"next",e)}function l(e){Q(o,r,a,c,l,"throw",e)}c(void 0)})});return function(){return n.apply(this,arguments)}}(),f=function(){var e,n;Nova.visit("home"===(n=null===(e=t.branding)||void 0===e?void 0:e.link)?"/":"string"==typeof n&&n.startsWith("/")?n:t.selectorPath||"/nova-tenancy")},p=function(e){e.preventDefault(),e.stopImmediatePropagation(),f()};return(0,e.onMounted)(function(){var e,n;Nova.$on("nova-tenancy:changed",v),null===(n=c=(null===(e=r.value)||void 0===e?void 0:e.closest("a"))||null)||void 0===n||n.addEventListener("click",p,!0),d()}),(0,e.onBeforeUnmount)(function(){var e;Nova.$off("nova-tenancy:changed",v),null===(e=c)||void 0===e||e.removeEventListener("click",p,!0)}),function(n,t){return(0,e.openBlock)(),(0,e.createElementBlock)("span",{ref_key:"brand",ref:r,class:"nova-tenancy-brand",title:u.value,onClick:(0,e.withModifiers)(f,["stop","prevent"])},[l.value?((0,e.openBlock)(),(0,e.createElementBlock)("img",{key:s.value,src:s.value,class:"nova-tenancy-brand__logo",alt:""},null,8,Y)):(0,e.createCommentVNode)("",!0),i.value?((0,e.openBlock)(),(0,e.createElementBlock)("span",ee,(0,e.toDisplayString)(u.value),1)):(0,e.createCommentVNode)("",!0)],8,X)}}},te=ne;Nova.inertia("NovaTenancy",W),Nova.booting(function(e){var n;!1!==(null===(n=Nova.config("novaTenancy"))||void 0===n||null===(n=n.branding)||void 0===n?void 0:n.enabled)&&e.component("AppLogo",te)}),Nova.request().interceptors.response.use(function(e){return e},function(e){var n,t;if(409===(null===(n=e.response)||void 0===n?void 0:n.status)&&"tenant_selection_required"===(null===(t=e.response)||void 0===t||null===(t=t.data)||void 0===t?void 0:t.code)){var r,a=(null===(r=Nova.config("novaTenancy"))||void 0===r?void 0:r.selectorPath)||"/nova-tenancy";Nova.visit(a)}return Promise.reject(e)})},351(){}},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var o=t[e]={exports:{}};return n[e](o,o.exports,r),o.exports}r.m=n,e=[],r.O=(n,t,a,o)=>{if(!t){var c=1/0;for(s=0;s=o)&&Object.keys(r.O).every(e=>r.O[e](t[i]))?t.splice(i--,1):(l=!1,o0&&e[s-1][2]>o;s--)e[s]=e[s-1];e[s]=[t,a,o]},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={416:0,757:0};r.O.j=n=>0===e[n];var n=(n,t)=>{var a,o,[c,l,i]=t,u=0;if(c.some(n=>0!==e[n])){for(a in l)r.o(l,a)&&(r.m[a]=l[a]);if(i)var s=i(r)}for(n&&n(t);ur(733));var a=r.O(void 0,[757],()=>r(351));a=r.O(a)})(); \ No newline at end of file diff --git a/dist/mix-manifest.json b/dist/mix-manifest.json index acafecd..9300d01 100644 --- a/dist/mix-manifest.json +++ b/dist/mix-manifest.json @@ -1,4 +1,4 @@ { - "/js/tool.js": "/js/tool.js?id=c0dece73f13546b93269b715fbe0c31e", - "/css/tool.css": "/css/tool.css?id=52168e338d44c342bde21e45f3b08f9e" + "/js/tool.js": "/js/tool.js?id=288485568c9de20942b23e046929bbc5", + "/css/tool.css": "/css/tool.css?id=5cf63c35ace8a0beb48a7c1b2782b62e" } diff --git a/resources/css/tool.css b/resources/css/tool.css index c2f8746..6e2c9f2 100644 --- a/resources/css/tool.css +++ b/resources/css/tool.css @@ -1,9 +1,12 @@ .nova-tenancy-page { - --nt-primary: #7c3aed; - --nt-primary-strong: #5b21b6; - --nt-surface: rgb(255 255 255 / 0.88); - --nt-border: rgb(226 232 240 / 0.9); - --nt-muted: #64748b; + --nt-primary: rgba(var(--colors-primary-500, 14, 165, 233), 1); + --nt-primary-soft: rgba(var(--colors-primary-500, 14, 165, 233), 0.12); + --nt-primary-strong: rgba(var(--colors-primary-600, 2, 132, 199), 1); + --nt-surface: rgba(var(--colors-white, 255, 255, 255), 1); + --nt-border: rgba(var(--colors-gray-200, 226, 232, 240), 1); + --nt-text: rgba(var(--colors-gray-900, 15, 23, 42), 1); + --nt-muted: rgba(var(--colors-gray-500, 100, 116, 139), 1); + --nt-shadow: rgba(var(--colors-gray-900, 15, 23, 42), 0.08); display: flex; flex-direction: column; gap: 1.5rem; @@ -19,14 +22,19 @@ gap: 2rem; overflow: hidden; border: 1px solid rgb(255 255 255 / 0.16); - border-radius: 1.5rem; + border-radius: 1rem; padding: clamp(1.5rem, 4vw, 3rem); color: white; background: - radial-gradient(circle at 12% 10%, rgb(167 139 250 / 0.48), transparent 34%), - radial-gradient(circle at 88% 85%, rgb(56 189 248 / 0.3), transparent 38%), - linear-gradient(135deg, #251259 0%, #4c1d95 48%, #172554 100%); - box-shadow: 0 24px 60px rgb(49 46 129 / 0.22); + radial-gradient(circle at 12% 10%, rgba(var(--colors-primary-400, 56, 189, 248), 0.58), transparent 34%), + radial-gradient(circle at 88% 85%, rgba(var(--colors-primary-500, 14, 165, 233), 0.38), transparent 38%), + linear-gradient( + 135deg, + color-mix(in srgb, var(--nt-primary-strong) 68%, #0f172a) 0%, + var(--nt-primary-strong) 50%, + color-mix(in srgb, var(--nt-primary) 48%, #0f172a) 100% + ); + box-shadow: 0 24px 60px color-mix(in srgb, var(--nt-primary) 24%, transparent); } .nova-tenancy-hero::after { @@ -63,7 +71,7 @@ .nova-tenancy-kicker { margin: 0 0 0.65rem; - color: #c4b5fd; + color: color-mix(in srgb, var(--nt-primary) 24%, white); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; @@ -81,7 +89,7 @@ .nova-tenancy-description { max-width: 35rem; margin: 1rem 0 0; - color: rgb(237 233 254 / 0.82); + color: rgb(255 255 255 / 0.82); font-size: 1rem; line-height: 1.7; } @@ -92,7 +100,7 @@ align-items: center; gap: 0.8rem; border: 1px solid rgb(255 255 255 / 0.16); - border-radius: 1rem; + border-radius: 0.5rem; padding: 0.8rem; background: rgb(255 255 255 / 0.1); backdrop-filter: blur(14px); @@ -111,7 +119,7 @@ .nova-tenancy-current__logo { width: 3rem; height: 3rem; - color: #4c1d95; + color: var(--nt-primary-strong); background: white; } @@ -130,7 +138,7 @@ } .nova-tenancy-current__copy span { - color: rgb(237 233 254 / 0.7); + color: rgb(255 255 255 / 0.7); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; @@ -149,8 +157,8 @@ height: 0.55rem; border: 2px solid rgb(255 255 255 / 0.8); border-radius: 9999px; - background: #34d399; - box-shadow: 0 0 0 4px rgb(52 211 153 / 0.2); + background: rgba(var(--colors-green-400, 74, 222, 128), 1); + box-shadow: 0 0 0 4px rgba(var(--colors-green-400, 74, 222, 128), 0.2); } .nova-tenancy-toolbar { @@ -167,16 +175,16 @@ align-items: center; gap: 0.75rem; border: 1px solid var(--nt-border); - border-radius: 0.9rem; + border-radius: 0.5rem; padding-inline: 1rem; background: var(--nt-surface); - box-shadow: 0 4px 18px rgb(15 23 42 / 0.04); + box-shadow: 0 1px 3px var(--nt-shadow); transition: border-color 160ms, box-shadow 160ms; } .nova-tenancy-search:focus-within { - border-color: rgb(124 58 237 / 0.55); - box-shadow: 0 0 0 3px rgb(124 58 237 / 0.12); + border-color: rgba(var(--colors-primary-400, 56, 189, 248), 0.7); + box-shadow: 0 0 0 3px var(--nt-primary-soft); } .nova-tenancy-search svg { @@ -192,7 +200,7 @@ border: 0; outline: 0; padding: 0.85rem 0; - color: #0f172a; + color: var(--nt-text); background: transparent; } @@ -205,7 +213,7 @@ color: var(--nt-primary-strong); font-size: 0.78rem; font-weight: 800; - background: #ede9fe; + background: var(--nt-primary-soft); } .nova-tenancy-grid { @@ -215,30 +223,31 @@ } .nova-tenancy-card { - --tenant-accent: #7c3aed; + --tenant-accent: var(--nt-primary); + --tenant-accent-contrast: white; position: relative; display: flex; min-height: 17rem; flex-direction: column; overflow: hidden; border: 1px solid var(--nt-border); - border-radius: 1.25rem; + border-radius: 0.5rem; padding: 1.25rem; background: var(--nt-surface); - box-shadow: 0 10px 32px rgb(15 23 42 / 0.055); + box-shadow: 0 1px 3px var(--nt-shadow); transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease; } .nova-tenancy-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--tenant-accent) 42%, transparent); - box-shadow: 0 18px 42px rgb(15 23 42 / 0.1); + box-shadow: 0 10px 24px var(--nt-shadow); } .nova-tenancy-card--selected { border-color: color-mix(in srgb, var(--tenant-accent) 70%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tenant-accent) 16%, transparent), - 0 18px 42px rgb(15 23 42 / 0.09); + 0 10px 24px var(--nt-shadow); } .nova-tenancy-card__accent { @@ -258,15 +267,16 @@ .nova-tenancy-card__logo { width: 4rem; height: 4rem; - color: var(--tenant-accent); + color: color-mix(in srgb, var(--tenant-accent) 72%, var(--nt-text)); font-size: 1.35rem; + border-radius: 0.5rem; background: color-mix(in srgb, var(--tenant-accent) 11%, white); } .nova-tenancy-badge { border-radius: 9999px; padding: 0.35rem 0.65rem; - color: var(--tenant-accent); + color: color-mix(in srgb, var(--tenant-accent) 72%, var(--nt-text)); font-size: 0.68rem; font-weight: 800; background: color-mix(in srgb, var(--tenant-accent) 10%, white); @@ -278,7 +288,7 @@ height: 1.8rem; place-items: center; border-radius: 9999px; - color: white; + color: var(--tenant-accent-contrast); background: var(--tenant-accent); } @@ -298,9 +308,9 @@ .nova-tenancy-card__body h2 { margin: 0; - color: #0f172a; - font-size: 1.05rem; - font-weight: 750; + color: var(--nt-text); + font-size: 1rem; + font-weight: 700; line-height: 1.4; } @@ -316,7 +326,7 @@ } .nova-tenancy-card__body .nova-tenancy-card__key { - color: color-mix(in srgb, var(--tenant-accent) 68%, #64748b); + color: color-mix(in srgb, var(--tenant-accent) 68%, var(--nt-muted)); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; } @@ -328,8 +338,8 @@ justify-content: center; gap: 0.55rem; border: 0; - border-radius: 0.75rem; - font-weight: 750; + border-radius: 0.5rem; + font-weight: 700; cursor: pointer; transition: transform 150ms, background-color 150ms, opacity 150ms; } @@ -337,7 +347,7 @@ .nova-tenancy-select { width: 100%; min-height: 2.7rem; - color: white; + color: var(--tenant-accent-contrast); background: var(--tenant-accent); } @@ -348,7 +358,7 @@ } .nova-tenancy-select--selected { - color: var(--tenant-accent); + color: color-mix(in srgb, var(--tenant-accent) 72%, var(--nt-text)); background: color-mix(in srgb, var(--tenant-accent) 10%, white); } @@ -370,8 +380,8 @@ .nova-tenancy-spinner { width: 1rem; height: 1rem; - border: 2px solid rgb(255 255 255 / 0.4); - border-top-color: white; + border: 2px solid color-mix(in srgb, currentColor 40%, transparent); + border-top-color: currentColor; border-radius: 9999px; animation: nova-tenancy-spin 650ms linear infinite; } @@ -385,7 +395,12 @@ display: block; height: 1rem; border-radius: 9999px; - background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9); + background: linear-gradient( + 90deg, + rgba(var(--colors-gray-100, 241, 245, 249), 1), + rgba(var(--colors-gray-200, 226, 232, 240), 1), + rgba(var(--colors-gray-100, 241, 245, 249), 1) + ); background-size: 220% 100%; animation: nova-tenancy-shimmer 1.4s ease infinite; } @@ -406,7 +421,7 @@ justify-content: center; flex-direction: column; border: 1px dashed var(--nt-border); - border-radius: 1.25rem; + border-radius: 0.5rem; padding: 2rem; text-align: center; background: var(--nt-surface); @@ -418,15 +433,15 @@ height: 3.5rem; place-items: center; border-radius: 1rem; - color: #be123c; + color: rgba(var(--colors-red-700, 185, 28, 28), 1); font-size: 1.5rem; font-weight: 800; - background: #ffe4e6; + background: rgba(var(--colors-red-100, 254, 226, 226), 1); } .nova-tenancy-state__icon--empty { color: var(--nt-primary); - background: #ede9fe; + background: var(--nt-primary-soft); } .nova-tenancy-state__icon svg { @@ -440,7 +455,7 @@ .nova-tenancy-state h2 { margin: 1rem 0 0; - color: #0f172a; + color: var(--nt-text); font-size: 1.1rem; } @@ -467,7 +482,7 @@ .nova-tenancy-pagination button { border: 1px solid var(--nt-border); padding: 0.55rem 0.9rem; - color: #334155; + color: var(--nt-text); background: var(--nt-surface); } @@ -485,7 +500,7 @@ gap: 0.65rem; border: 0; padding: 0; - color: #334155; + color: var(--nt-text); background: transparent; cursor: pointer; } @@ -494,9 +509,9 @@ width: 2.5rem; height: 2.5rem; flex: none; - border-radius: 0.7rem; + border-radius: 0.5rem; object-fit: cover; - box-shadow: 0 3px 12px rgb(15 23 42 / 0.12); + box-shadow: 0 3px 12px rgba(var(--colors-gray-900, 15, 23, 42), 0.12); } .nova-tenancy-brand__title { @@ -525,9 +540,12 @@ } .dark .nova-tenancy-page { - --nt-surface: rgb(30 41 59 / 0.84); - --nt-border: rgb(71 85 105 / 0.72); - --nt-muted: #94a3b8; + --nt-primary-soft: rgba(var(--colors-primary-500, 14, 165, 233), 0.2); + --nt-surface: rgba(var(--colors-gray-800, 30, 41, 59), 1); + --nt-border: rgba(var(--colors-gray-700, 51, 65, 85), 1); + --nt-text: rgba(var(--colors-gray-100, 241, 245, 249), 1); + --nt-muted: rgba(var(--colors-gray-400, 148, 163, 184), 1); + --nt-shadow: rgb(0 0 0 / 0.22); } .dark .nova-tenancy-search input, @@ -535,23 +553,28 @@ .dark .nova-tenancy-state h2, .dark .nova-tenancy-brand, .dark .nova-tenancy-pagination button { - color: #f8fafc; + color: var(--nt-text); } .dark .nova-tenancy-count, .dark .nova-tenancy-state__icon--empty { - color: #c4b5fd; - background: rgb(91 33 182 / 0.3); + color: rgba(var(--colors-primary-400, 56, 189, 248), 1); + background: var(--nt-primary-soft); } .dark .nova-tenancy-card__logo, .dark .nova-tenancy-badge, .dark .nova-tenancy-select--selected { - background: color-mix(in srgb, var(--tenant-accent) 22%, #0f172a); + background: color-mix(in srgb, var(--tenant-accent) 22%, var(--nt-surface)); } .dark .nova-tenancy-card--skeleton span { - background: linear-gradient(90deg, #1e293b, #334155, #1e293b); + background: linear-gradient( + 90deg, + rgba(var(--colors-gray-800, 30, 41, 59), 1), + rgba(var(--colors-gray-700, 51, 65, 85), 1), + rgba(var(--colors-gray-800, 30, 41, 59), 1) + ); background-size: 220% 100%; } diff --git a/resources/js/tenantState.js b/resources/js/tenantState.js index 663ee1f..23a43d4 100644 --- a/resources/js/tenantState.js +++ b/resources/js/tenantState.js @@ -4,9 +4,32 @@ export const sameTenant = (left, right) => export const tenantInitial = title => String(title || 'T').trim().charAt(0).toLocaleUpperCase() -export const tenantStyle = tenant => ({ - '--tenant-accent': tenant.accent || '#7c3aed', -}) +export const accentContrast = accent => { + if (!/^#[0-9a-f]{6}$/i.test(accent || '')) return '#ffffff' + + const channels = accent + .slice(1) + .match(/.{2}/g) + .map(channel => Number.parseInt(channel, 16) / 255) + .map(channel => + channel <= 0.04045 + ? channel / 12.92 + : ((channel + 0.055) / 1.055) ** 2.4 + ) + const luminance = channels[0] * 0.2126 + channels[1] * 0.7152 + channels[2] * 0.0722 + const lightContrast = 1.05 / (luminance + 0.05) + const darkContrast = (luminance + 0.05) / 0.068 + + return darkContrast > lightContrast ? '#0f172a' : '#ffffff' +} + +export const tenantStyle = tenant => + tenant.accent + ? { + '--tenant-accent': tenant.accent, + '--tenant-accent-contrast': accentContrast(tenant.accent), + } + : {} export const currentLogoUrl = (apiBase, tenantKey, revision) => `${apiBase}/current/logo?tenant=${encodeURIComponent(tenantKey ?? 'none')}&v=${revision}` diff --git a/tests-js/tenantState.test.js b/tests-js/tenantState.test.js index ff91fea..9fc46b1 100644 --- a/tests-js/tenantState.test.js +++ b/tests-js/tenantState.test.js @@ -1,5 +1,6 @@ import { describe, expect, it } from 'vitest' import { + accentContrast, currentLogoUrl, sameTenant, tenantInitial, @@ -14,7 +15,12 @@ describe('tenant state helpers', () => { it('builds safe presentation fallbacks', () => { expect(tenantInitial(' alpha')).toBe('A') - expect(tenantStyle({ accent: null })).toEqual({ '--tenant-accent': '#7c3aed' }) + expect(tenantStyle({ accent: null })).toEqual({}) + expect(tenantStyle({ accent: '#ffffff' })).toEqual({ + '--tenant-accent': '#ffffff', + '--tenant-accent-contrast': '#0f172a', + }) + expect(accentContrast('#2563eb')).toBe('#ffffff') }) it('creates a cache-busted fixed logo endpoint', () => {