Compare commits
10
Commits
aafddfb146
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef8c73531d | ||
|
|
eec91ac8e5 | ||
|
|
f62103d44b | ||
|
|
1d3aa42b6c | ||
|
|
53b981112a | ||
|
|
7baaadb994 | ||
|
|
f2b5adab41 | ||
|
|
d24463b5ce | ||
|
|
5c83f59332 | ||
|
|
9a28ff7354 |
No files matched your search
@@ -2,6 +2,53 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [1.1.3] - 2026-09-09
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Use Inertia's location response for tenant-less SPA visits so Nova navigates to the selector instead of displaying its unrecoverable-error page.
|
||||||
|
- Return tenant-selection responses directly from middleware so Nova's exception handler cannot replace them with its generic error page.
|
||||||
|
|
||||||
|
## [1.1.2] - 2026-09-09
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Support Nova primary palettes whose color entries already include an alpha channel.
|
||||||
|
- Document that custom logo response callbacks may return `null` to use the default logo resolution.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Keep selected tenant branding on Nova's primary color in dark mode.
|
||||||
|
- Show successful tenant logos without decorative framing while retaining the framed initial fallback.
|
||||||
|
- Redirect tenant-less Inertia page visits to the selector instead of showing Nova's unrecoverable-error modal.
|
||||||
|
|
||||||
|
## [1.1.0] - 2026-09-09
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Promote the selected tenant name to header typography and color it with Nova's configured primary palette.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Prevent Nova's default logo height utility from clipping the tenant brand, preserve complete logo artwork, and show a tenant initial when the logo cannot load.
|
||||||
|
|
||||||
|
## [1.0.2] - 2026-09-09
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Republished the package without functional changes from version 1.0.1.
|
||||||
|
|
||||||
|
## [1.0.1] - 2026-09-09
|
||||||
|
|
||||||
|
### 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
|
## [1.0.0] - 2026-09-09
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -13,4 +60,9 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Optional tenant-aware Nova resource base and reusable context helpers.
|
- Optional tenant-aware Nova resource base and reusable context helpers.
|
||||||
- English and Persian translations.
|
- English and Persian translations.
|
||||||
|
|
||||||
|
[1.1.3]: https://github.com/MeghdadFadaee/nova-tenancy/releases/tag/v1.1.3
|
||||||
|
[1.1.2]: https://github.com/MeghdadFadaee/nova-tenancy/releases/tag/v1.1.2
|
||||||
|
[1.1.0]: https://github.com/MeghdadFadaee/nova-tenancy/releases/tag/v1.1.0
|
||||||
|
[1.0.2]: https://github.com/MeghdadFadaee/nova-tenancy/releases/tag/v1.0.2
|
||||||
|
[1.0.1]: https://github.com/MeghdadFadaee/nova-tenancy/releases/tag/v1.0.1
|
||||||
[1.0.0]: https://github.com/MeghdadFadaee/nova-tenancy/releases/tag/v1.0.0
|
[1.0.0]: https://github.com/MeghdadFadaee/nova-tenancy/releases/tag/v1.0.0
|
||||||
@@ -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 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.
|
If another package also replaces `AppLogo`, the last component registered by Nova wins.
|
||||||
|
|
||||||
## Customization
|
## Customization
|
||||||
@@ -198,11 +200,13 @@ NovaTenancy::landingUsing(
|
|||||||
);
|
);
|
||||||
|
|
||||||
NovaTenancy::logoResponseUsing(
|
NovaTenancy::logoResponseUsing(
|
||||||
fn (Request $request, Model $tenant): Response => Storage::disk('private')
|
fn (Request $request, Model $tenant): ?Response => Storage::disk('private')
|
||||||
->response($tenant->logo_path)
|
->response($tenant->logo_path)
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The logo response callback may return `null` to continue with the tenant URL or configured fallback logo.
|
||||||
|
|
||||||
`TenantSelected` and `TenantCleared` events are dispatched after changes. English and Persian translations can be published with:
|
`TenantSelected` and `TenantCleared` events are dispatched after changes. English and Persian translations can be published with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Vendored
+1
-1
@@ -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;Line truncated
|
.nova-tenancy-page{--nt-primary:rgba(var(--colors-primary-500,14,165,233));--nt-primary-soft:color-mix(in srgb,var(--nt-primary) 12%,transparent);--nt-primary-strong:rgba(var(--colors-primary-600,2,132,199));--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%,color-mix(in srgb,rgba(var(--colors-primary-400,56,189,248)) 58%,transparent),transparent 34%),radial-gradient(circle at 88% 85%,color-mix(in srgb,var(--nt-primary) 38%,transparent),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:color-mix(in srgb,rgba(var(--colors-primary-400,56,189,248)) 70%,transparent);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(--ntLine truncated
|
||||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
/*! For license information please see tool.js.LICENSE.txt */
|
/*! 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);t<n;t++)r[t]=e[t];return r}function c(){var e,n,t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",a=t.toStringTag||"@@toStringTag";function o(t,r,a,o){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return l(s,"_invoke",function(t,r,a){var o,c,l,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,c=0,l=e,d.n=t,i}};function p(t,r){for(c=t,l=r,n=0;!v&&u&&!a&&n<s.length;n++){var a,o=s[n],p=d.p,f=o[2];t>3?(a=f===r)&&(l=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=p&&((a=t<2&&p<o[1])?(c=0,d.v=r,d.n=o[1]):p<f&&(a=t<3||o[0]>r||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=Line truncated
|
(()=>{"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);t<n;t++)r[t]=e[t];return r}function l(){var e,n,t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",a=t.toStringTag||"@@toStringTag";function o(t,r,a,o){var l=r&&r.prototype instanceof u?r:u,s=Object.create(l.prototype);return i(s,"_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&&n<s.length;n++){var a,o=s[n],f=d.p,p=o[2];t>3?(a=p===r)&&(i=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=e):o[0]<=f&&((a=t<2&&f<o[1])?(l=0,d.v=r,d.n=o[1]):f<p&&(a=t<3||o[0]>r||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"},_={class:"nova-tenancy-sr-only"},V=["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"},D={key:3,class:"nova-tenancy-grid"},T=["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"},A=["title"],U={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=Line truncated
|
||||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"/js/tool.js": "/js/tool.js?id=c0dece73f13546b93269b715fbe0c31e",
|
"/js/tool.js": "/js/tool.js?id=54cef83dfae48e83d70e959fd452bc99",
|
||||||
"/css/tool.css": "/css/tool.css?id=52168e338d44c342bde21e45f3b08f9e"
|
"/css/tool.css": "/css/tool.css?id=78e955750268e2fd2573608a0d532c52"
|
||||||
}
|
}
|
||||||
+121
-68
@@ -1,9 +1,12 @@
|
|||||||
.nova-tenancy-page {
|
.nova-tenancy-page {
|
||||||
--nt-primary: #7c3aed;
|
--nt-primary: rgba(var(--colors-primary-500, 14, 165, 233));
|
||||||
--nt-primary-strong: #5b21b6;
|
--nt-primary-soft: color-mix(in srgb, var(--nt-primary) 12%, transparent);
|
||||||
--nt-surface: rgb(255 255 255 / 0.88);
|
--nt-primary-strong: rgba(var(--colors-primary-600, 2, 132, 199));
|
||||||
--nt-border: rgb(226 232 240 / 0.9);
|
--nt-surface: rgba(var(--colors-white, 255, 255, 255), 1);
|
||||||
--nt-muted: #64748b;
|
--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;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
@@ -19,14 +22,19 @@
|
|||||||
gap: 2rem;
|
gap: 2rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid rgb(255 255 255 / 0.16);
|
border: 1px solid rgb(255 255 255 / 0.16);
|
||||||
border-radius: 1.5rem;
|
border-radius: 1rem;
|
||||||
padding: clamp(1.5rem, 4vw, 3rem);
|
padding: clamp(1.5rem, 4vw, 3rem);
|
||||||
color: white;
|
color: white;
|
||||||
background:
|
background:
|
||||||
radial-gradient(circle at 12% 10%, rgb(167 139 250 / 0.48), transparent 34%),
|
radial-gradient(circle at 12% 10%, color-mix(in srgb, rgba(var(--colors-primary-400, 56, 189, 248)) 58%, transparent), transparent 34%),
|
||||||
radial-gradient(circle at 88% 85%, rgb(56 189 248 / 0.3), transparent 38%),
|
radial-gradient(circle at 88% 85%, color-mix(in srgb, var(--nt-primary) 38%, transparent), transparent 38%),
|
||||||
linear-gradient(135deg, #251259 0%, #4c1d95 48%, #172554 100%);
|
linear-gradient(
|
||||||
box-shadow: 0 24px 60px rgb(49 46 129 / 0.22);
|
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 {
|
.nova-tenancy-hero::after {
|
||||||
@@ -63,7 +71,7 @@
|
|||||||
|
|
||||||
.nova-tenancy-kicker {
|
.nova-tenancy-kicker {
|
||||||
margin: 0 0 0.65rem;
|
margin: 0 0 0.65rem;
|
||||||
color: #c4b5fd;
|
color: color-mix(in srgb, var(--nt-primary) 24%, white);
|
||||||
font-size: 0.72rem;
|
font-size: 0.72rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
letter-spacing: 0.16em;
|
letter-spacing: 0.16em;
|
||||||
@@ -81,7 +89,7 @@
|
|||||||
.nova-tenancy-description {
|
.nova-tenancy-description {
|
||||||
max-width: 35rem;
|
max-width: 35rem;
|
||||||
margin: 1rem 0 0;
|
margin: 1rem 0 0;
|
||||||
color: rgb(237 233 254 / 0.82);
|
color: rgb(255 255 255 / 0.82);
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
line-height: 1.7;
|
line-height: 1.7;
|
||||||
}
|
}
|
||||||
@@ -92,7 +100,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.8rem;
|
gap: 0.8rem;
|
||||||
border: 1px solid rgb(255 255 255 / 0.16);
|
border: 1px solid rgb(255 255 255 / 0.16);
|
||||||
border-radius: 1rem;
|
border-radius: 0.5rem;
|
||||||
padding: 0.8rem;
|
padding: 0.8rem;
|
||||||
background: rgb(255 255 255 / 0.1);
|
background: rgb(255 255 255 / 0.1);
|
||||||
backdrop-filter: blur(14px);
|
backdrop-filter: blur(14px);
|
||||||
@@ -111,7 +119,7 @@
|
|||||||
.nova-tenancy-current__logo {
|
.nova-tenancy-current__logo {
|
||||||
width: 3rem;
|
width: 3rem;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
color: #4c1d95;
|
color: var(--nt-primary-strong);
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +138,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-current__copy span {
|
.nova-tenancy-current__copy span {
|
||||||
color: rgb(237 233 254 / 0.7);
|
color: rgb(255 255 255 / 0.7);
|
||||||
font-size: 0.68rem;
|
font-size: 0.68rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
letter-spacing: 0.08em;
|
letter-spacing: 0.08em;
|
||||||
@@ -149,8 +157,8 @@
|
|||||||
height: 0.55rem;
|
height: 0.55rem;
|
||||||
border: 2px solid rgb(255 255 255 / 0.8);
|
border: 2px solid rgb(255 255 255 / 0.8);
|
||||||
border-radius: 9999px;
|
border-radius: 9999px;
|
||||||
background: #34d399;
|
background: rgba(var(--colors-green-400, 74, 222, 128), 1);
|
||||||
box-shadow: 0 0 0 4px rgb(52 211 153 / 0.2);
|
box-shadow: 0 0 0 4px rgba(var(--colors-green-400, 74, 222, 128), 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-toolbar {
|
.nova-tenancy-toolbar {
|
||||||
@@ -167,16 +175,16 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
border: 1px solid var(--nt-border);
|
border: 1px solid var(--nt-border);
|
||||||
border-radius: 0.9rem;
|
border-radius: 0.5rem;
|
||||||
padding-inline: 1rem;
|
padding-inline: 1rem;
|
||||||
background: var(--nt-surface);
|
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;
|
transition: border-color 160ms, box-shadow 160ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-search:focus-within {
|
.nova-tenancy-search:focus-within {
|
||||||
border-color: rgb(124 58 237 / 0.55);
|
border-color: color-mix(in srgb, rgba(var(--colors-primary-400, 56, 189, 248)) 70%, transparent);
|
||||||
box-shadow: 0 0 0 3px rgb(124 58 237 / 0.12);
|
box-shadow: 0 0 0 3px var(--nt-primary-soft);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-search svg {
|
.nova-tenancy-search svg {
|
||||||
@@ -192,7 +200,7 @@
|
|||||||
border: 0;
|
border: 0;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
padding: 0.85rem 0;
|
padding: 0.85rem 0;
|
||||||
color: #0f172a;
|
color: var(--nt-text);
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +213,7 @@
|
|||||||
color: var(--nt-primary-strong);
|
color: var(--nt-primary-strong);
|
||||||
font-size: 0.78rem;
|
font-size: 0.78rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
background: #ede9fe;
|
background: var(--nt-primary-soft);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-grid {
|
.nova-tenancy-grid {
|
||||||
@@ -215,30 +223,31 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-card {
|
.nova-tenancy-card {
|
||||||
--tenant-accent: #7c3aed;
|
--tenant-accent: var(--nt-primary);
|
||||||
|
--tenant-accent-contrast: white;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
min-height: 17rem;
|
min-height: 17rem;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1px solid var(--nt-border);
|
border: 1px solid var(--nt-border);
|
||||||
border-radius: 1.25rem;
|
border-radius: 0.5rem;
|
||||||
padding: 1.25rem;
|
padding: 1.25rem;
|
||||||
background: var(--nt-surface);
|
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;
|
transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-card:hover {
|
.nova-tenancy-card:hover {
|
||||||
transform: translateY(-3px);
|
transform: translateY(-3px);
|
||||||
border-color: color-mix(in srgb, var(--tenant-accent) 42%, transparent);
|
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 {
|
.nova-tenancy-card--selected {
|
||||||
border-color: color-mix(in srgb, var(--tenant-accent) 70%, transparent);
|
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),
|
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 {
|
.nova-tenancy-card__accent {
|
||||||
@@ -258,15 +267,16 @@
|
|||||||
.nova-tenancy-card__logo {
|
.nova-tenancy-card__logo {
|
||||||
width: 4rem;
|
width: 4rem;
|
||||||
height: 4rem;
|
height: 4rem;
|
||||||
color: var(--tenant-accent);
|
color: color-mix(in srgb, var(--tenant-accent) 72%, var(--nt-text));
|
||||||
font-size: 1.35rem;
|
font-size: 1.35rem;
|
||||||
|
border-radius: 0.5rem;
|
||||||
background: color-mix(in srgb, var(--tenant-accent) 11%, white);
|
background: color-mix(in srgb, var(--tenant-accent) 11%, white);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-badge {
|
.nova-tenancy-badge {
|
||||||
border-radius: 9999px;
|
border-radius: 9999px;
|
||||||
padding: 0.35rem 0.65rem;
|
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-size: 0.68rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
background: color-mix(in srgb, var(--tenant-accent) 10%, white);
|
background: color-mix(in srgb, var(--tenant-accent) 10%, white);
|
||||||
@@ -278,7 +288,7 @@
|
|||||||
height: 1.8rem;
|
height: 1.8rem;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
border-radius: 9999px;
|
border-radius: 9999px;
|
||||||
color: white;
|
color: var(--tenant-accent-contrast);
|
||||||
background: var(--tenant-accent);
|
background: var(--tenant-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,9 +308,9 @@
|
|||||||
|
|
||||||
.nova-tenancy-card__body h2 {
|
.nova-tenancy-card__body h2 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: #0f172a;
|
color: var(--nt-text);
|
||||||
font-size: 1.05rem;
|
font-size: 1rem;
|
||||||
font-weight: 750;
|
font-weight: 700;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,7 +326,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-card__body .nova-tenancy-card__key {
|
.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;
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,8 +338,8 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 0.55rem;
|
gap: 0.55rem;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: 0.75rem;
|
border-radius: 0.5rem;
|
||||||
font-weight: 750;
|
font-weight: 700;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: transform 150ms, background-color 150ms, opacity 150ms;
|
transition: transform 150ms, background-color 150ms, opacity 150ms;
|
||||||
}
|
}
|
||||||
@@ -337,7 +347,7 @@
|
|||||||
.nova-tenancy-select {
|
.nova-tenancy-select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 2.7rem;
|
min-height: 2.7rem;
|
||||||
color: white;
|
color: var(--tenant-accent-contrast);
|
||||||
background: var(--tenant-accent);
|
background: var(--tenant-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +358,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-select--selected {
|
.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);
|
background: color-mix(in srgb, var(--tenant-accent) 10%, white);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,8 +380,8 @@
|
|||||||
.nova-tenancy-spinner {
|
.nova-tenancy-spinner {
|
||||||
width: 1rem;
|
width: 1rem;
|
||||||
height: 1rem;
|
height: 1rem;
|
||||||
border: 2px solid rgb(255 255 255 / 0.4);
|
border: 2px solid color-mix(in srgb, currentColor 40%, transparent);
|
||||||
border-top-color: white;
|
border-top-color: currentColor;
|
||||||
border-radius: 9999px;
|
border-radius: 9999px;
|
||||||
animation: nova-tenancy-spin 650ms linear infinite;
|
animation: nova-tenancy-spin 650ms linear infinite;
|
||||||
}
|
}
|
||||||
@@ -385,7 +395,12 @@
|
|||||||
display: block;
|
display: block;
|
||||||
height: 1rem;
|
height: 1rem;
|
||||||
border-radius: 9999px;
|
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%;
|
background-size: 220% 100%;
|
||||||
animation: nova-tenancy-shimmer 1.4s ease infinite;
|
animation: nova-tenancy-shimmer 1.4s ease infinite;
|
||||||
}
|
}
|
||||||
@@ -406,7 +421,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border: 1px dashed var(--nt-border);
|
border: 1px dashed var(--nt-border);
|
||||||
border-radius: 1.25rem;
|
border-radius: 0.5rem;
|
||||||
padding: 2rem;
|
padding: 2rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: var(--nt-surface);
|
background: var(--nt-surface);
|
||||||
@@ -418,15 +433,15 @@
|
|||||||
height: 3.5rem;
|
height: 3.5rem;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
color: #be123c;
|
color: rgba(var(--colors-red-700, 185, 28, 28), 1);
|
||||||
font-size: 1.5rem;
|
font-size: 1.5rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
background: #ffe4e6;
|
background: rgba(var(--colors-red-100, 254, 226, 226), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-state__icon--empty {
|
.nova-tenancy-state__icon--empty {
|
||||||
color: var(--nt-primary);
|
color: var(--nt-primary);
|
||||||
background: #ede9fe;
|
background: var(--nt-primary-soft);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-state__icon svg {
|
.nova-tenancy-state__icon svg {
|
||||||
@@ -440,7 +455,7 @@
|
|||||||
|
|
||||||
.nova-tenancy-state h2 {
|
.nova-tenancy-state h2 {
|
||||||
margin: 1rem 0 0;
|
margin: 1rem 0 0;
|
||||||
color: #0f172a;
|
color: var(--nt-text);
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,7 +482,7 @@
|
|||||||
.nova-tenancy-pagination button {
|
.nova-tenancy-pagination button {
|
||||||
border: 1px solid var(--nt-border);
|
border: 1px solid var(--nt-border);
|
||||||
padding: 0.55rem 0.9rem;
|
padding: 0.55rem 0.9rem;
|
||||||
color: #334155;
|
color: var(--nt-text);
|
||||||
background: var(--nt-surface);
|
background: var(--nt-surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,38 +495,59 @@
|
|||||||
.nova-tenancy-brand {
|
.nova-tenancy-brand {
|
||||||
display: flex;
|
display: flex;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
max-width: 13.5rem;
|
max-width: 14.5rem;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.65rem;
|
gap: 0.75rem;
|
||||||
border: 0;
|
border: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
color: #334155;
|
color: rgba(var(--colors-primary-500, 14, 165, 233));
|
||||||
background: transparent;
|
background: transparent;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-brand__logo {
|
.nova-tenancy-brand__logo {
|
||||||
width: 2.5rem;
|
display: grid;
|
||||||
height: 2.5rem;
|
width: 2.75rem;
|
||||||
|
height: 2.75rem;
|
||||||
flex: none;
|
flex: none;
|
||||||
border-radius: 0.7rem;
|
place-items: center;
|
||||||
object-fit: cover;
|
overflow: hidden;
|
||||||
box-shadow: 0 3px 12px rgb(15 23 42 / 0.12);
|
border-radius: 0.65rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nova-tenancy-brand__logo img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nova-tenancy-brand__logo--fallback {
|
||||||
|
border: 1px solid color-mix(in srgb, rgba(var(--colors-primary-500, 14, 165, 233)) 24%, transparent);
|
||||||
|
color: rgba(var(--colors-primary-600, 2, 132, 199));
|
||||||
|
background: color-mix(in srgb, rgba(var(--colors-primary-500, 14, 165, 233)) 12%, transparent);
|
||||||
|
box-shadow: 0 3px 12px rgba(var(--colors-gray-900, 15, 23, 42), 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nova-tenancy-brand__initial {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 800;
|
||||||
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-brand__title {
|
.nova-tenancy-brand__title {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
font-size: 0.86rem;
|
font-size: 1.125rem;
|
||||||
font-weight: 750;
|
font-weight: 800;
|
||||||
|
line-height: 1.25;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nova-tenancy-select:focus-visible,
|
.nova-tenancy-select:focus-visible,
|
||||||
.nova-tenancy-button:focus-visible,
|
.nova-tenancy-button:focus-visible,
|
||||||
.nova-tenancy-pagination button:focus-visible,
|
.nova-tenancy-pagination button:focus-visible,
|
||||||
.nova-tenancy-brand:focus-visible {
|
.nova-tenancy-brand:focus-visible {
|
||||||
outline: 2px solid var(--nt-primary);
|
outline: 2px solid rgba(var(--colors-primary-500, 14, 165, 233));
|
||||||
outline-offset: 3px;
|
outline-offset: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -525,33 +561,50 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dark .nova-tenancy-page {
|
.dark .nova-tenancy-page {
|
||||||
--nt-surface: rgb(30 41 59 / 0.84);
|
--nt-primary-soft: color-mix(in srgb, var(--nt-primary) 20%, transparent);
|
||||||
--nt-border: rgb(71 85 105 / 0.72);
|
--nt-surface: rgba(var(--colors-gray-800, 30, 41, 59), 1);
|
||||||
--nt-muted: #94a3b8;
|
--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,
|
.dark .nova-tenancy-search input,
|
||||||
.dark .nova-tenancy-card__body h2,
|
.dark .nova-tenancy-card__body h2,
|
||||||
.dark .nova-tenancy-state h2,
|
.dark .nova-tenancy-state h2,
|
||||||
.dark .nova-tenancy-brand,
|
|
||||||
.dark .nova-tenancy-pagination button {
|
.dark .nova-tenancy-pagination button {
|
||||||
color: #f8fafc;
|
color: var(--nt-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .nova-tenancy-brand {
|
||||||
|
color: rgba(var(--colors-primary-500, 14, 165, 233));
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .nova-tenancy-brand__logo--fallback {
|
||||||
|
border-color: color-mix(in srgb, rgba(var(--colors-primary-500, 14, 165, 233)) 32%, transparent);
|
||||||
|
color: rgba(var(--colors-primary-500, 14, 165, 233));
|
||||||
|
background: color-mix(in srgb, rgba(var(--colors-primary-500, 14, 165, 233)) 20%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .nova-tenancy-count,
|
.dark .nova-tenancy-count,
|
||||||
.dark .nova-tenancy-state__icon--empty {
|
.dark .nova-tenancy-state__icon--empty {
|
||||||
color: #c4b5fd;
|
color: rgba(var(--colors-primary-500, 14, 165, 233));
|
||||||
background: rgb(91 33 182 / 0.3);
|
background: var(--nt-primary-soft);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .nova-tenancy-card__logo,
|
.dark .nova-tenancy-card__logo,
|
||||||
.dark .nova-tenancy-badge,
|
.dark .nova-tenancy-badge,
|
||||||
.dark .nova-tenancy-select--selected {
|
.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 {
|
.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%;
|
background-size: 220% 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,24 @@
|
|||||||
:title="title"
|
:title="title"
|
||||||
@click.stop.prevent="visitBrandDestination"
|
@click.stop.prevent="visitBrandDestination"
|
||||||
>
|
>
|
||||||
<img
|
<span
|
||||||
v-if="showLogo"
|
v-if="showLogo"
|
||||||
:key="logoUrl"
|
|
||||||
:src="logoUrl"
|
|
||||||
class="nova-tenancy-brand__logo"
|
class="nova-tenancy-brand__logo"
|
||||||
alt=""
|
:class="{ 'nova-tenancy-brand__logo--fallback': logoFailed }"
|
||||||
/>
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
v-if="!logoFailed"
|
||||||
|
:key="logoUrl"
|
||||||
|
:src="logoUrl"
|
||||||
|
alt=""
|
||||||
|
@error="logoFailed = true"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<span v-else class="nova-tenancy-brand__initial">
|
||||||
|
{{ initial }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
<span v-if="showTitle" class="nova-tenancy-brand__title">
|
<span v-if="showTitle" class="nova-tenancy-brand__title">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
@@ -21,12 +32,15 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||||
import { currentLogoUrl } from '../tenantState'
|
import { currentLogoUrl, tenantInitial } from '../tenantState'
|
||||||
|
|
||||||
|
defineOptions({ inheritAttrs: false })
|
||||||
|
|
||||||
const configuration = Nova.config('novaTenancy') || {}
|
const configuration = Nova.config('novaTenancy') || {}
|
||||||
const brand = ref(null)
|
const brand = ref(null)
|
||||||
const current = ref(configuration.current || null)
|
const current = ref(configuration.current || null)
|
||||||
const revision = ref(Date.now())
|
const revision = ref(Date.now())
|
||||||
|
const logoFailed = ref(false)
|
||||||
let parentLink = null
|
let parentLink = null
|
||||||
|
|
||||||
const showLogo = computed(() => configuration.branding?.show_logo !== false)
|
const showLogo = computed(() => configuration.branding?.show_logo !== false)
|
||||||
@@ -34,6 +48,7 @@ const showTitle = computed(() => configuration.branding?.show_title !== false)
|
|||||||
const title = computed(
|
const title = computed(
|
||||||
() => current.value?.title || configuration.copy?.selectTenant || 'Select tenant'
|
() => current.value?.title || configuration.copy?.selectTenant || 'Select tenant'
|
||||||
)
|
)
|
||||||
|
const initial = computed(() => tenantInitial(title.value))
|
||||||
const logoUrl = computed(() => {
|
const logoUrl = computed(() => {
|
||||||
const apiBase = configuration.apiBase || '/nova-vendor/nova-tenancy'
|
const apiBase = configuration.apiBase || '/nova-vendor/nova-tenancy'
|
||||||
const key = current.value?.key ?? 'none'
|
const key = current.value?.key ?? 'none'
|
||||||
@@ -44,6 +59,7 @@ const logoUrl = computed(() => {
|
|||||||
const updateCurrent = payload => {
|
const updateCurrent = payload => {
|
||||||
current.value = payload?.current ?? payload ?? null
|
current.value = payload?.current ?? payload ?? null
|
||||||
revision.value = Date.now()
|
revision.value = Date.now()
|
||||||
|
logoFailed.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const refreshCurrent = async () => {
|
const refreshCurrent = async () => {
|
||||||
|
|||||||
@@ -4,9 +4,32 @@ export const sameTenant = (left, right) =>
|
|||||||
export const tenantInitial = title =>
|
export const tenantInitial = title =>
|
||||||
String(title || 'T').trim().charAt(0).toLocaleUpperCase()
|
String(title || 'T').trim().charAt(0).toLocaleUpperCase()
|
||||||
|
|
||||||
export const tenantStyle = tenant => ({
|
export const accentContrast = accent => {
|
||||||
'--tenant-accent': tenant.accent || '#7c3aed',
|
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) =>
|
export const currentLogoUrl = (apiBase, tenantKey, revision) =>
|
||||||
`${apiBase}/current/logo?tenant=${encodeURIComponent(tenantKey ?? 'none')}&v=${revision}`
|
`${apiBase}/current/logo?tenant=${encodeURIComponent(tenantKey ?? 'none')}&v=${revision}`
|
||||||
@@ -17,6 +17,12 @@ class TenantNotSelected extends RuntimeException implements Responsable
|
|||||||
|
|
||||||
public function toResponse($request): Response
|
public function toResponse($request): Response
|
||||||
{
|
{
|
||||||
|
$destination = $this->selectorUrl();
|
||||||
|
|
||||||
|
if ($request instanceof Request && $request->header('X-Inertia') === 'true') {
|
||||||
|
return response('', 409, ['X-Inertia-Location' => url($destination)]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($request instanceof Request && $request->expectsJson()) {
|
if ($request instanceof Request && $request->expectsJson()) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => $this->getMessage(),
|
'message' => $this->getMessage(),
|
||||||
@@ -24,9 +30,14 @@ class TenantNotSelected extends RuntimeException implements Responsable
|
|||||||
], 409);
|
], 409);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return redirect()->to($destination);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function selectorUrl(): string
|
||||||
|
{
|
||||||
$novaPath = '/'.trim(Nova::path(), '/');
|
$novaPath = '/'.trim(Nova::path(), '/');
|
||||||
$toolPath = trim((string) config('nova-tenancy.routes.uri', 'nova-tenancy'), '/');
|
$toolPath = trim((string) config('nova-tenancy.routes.uri', 'nova-tenancy'), '/');
|
||||||
|
|
||||||
return redirect()->to("{$novaPath}/{$toolPath}");
|
return "{$novaPath}/{$toolPath}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ namespace MeghdadFadaee\NovaTenancy\Http\Middleware;
|
|||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use MeghdadFadaee\NovaTenancy\Contracts\CurrentTenantContext;
|
use MeghdadFadaee\NovaTenancy\Contracts\CurrentTenantContext;
|
||||||
|
use MeghdadFadaee\NovaTenancy\Exceptions\TenantNotSelected;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
class RequireTenant
|
class RequireTenant
|
||||||
@@ -14,7 +15,9 @@ class RequireTenant
|
|||||||
/** @param Closure(Request): Response $next */
|
/** @param Closure(Request): Response $next */
|
||||||
public function handle(Request $request, Closure $next): Response
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
$this->currentTenant->requireModel();
|
if (! $this->currentTenant->hasTenant()) {
|
||||||
|
return (new TenantNotSelected)->toResponse($request);
|
||||||
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -18,7 +18,7 @@ final class NovaTenancy
|
|||||||
/** @var (Closure(Request, Model&NovaTenant): string)|null */
|
/** @var (Closure(Request, Model&NovaTenant): string)|null */
|
||||||
protected static ?Closure $landingCallback = null;
|
protected static ?Closure $landingCallback = null;
|
||||||
|
|
||||||
/** @var (Closure(Request, Model&NovaTenant): Response)|null */
|
/** @var (Closure(Request, Model&NovaTenant): (Response|null))|null */
|
||||||
protected static ?Closure $logoResponseCallback = null;
|
protected static ?Closure $logoResponseCallback = null;
|
||||||
|
|
||||||
public static function current(): CurrentTenantContext
|
public static function current(): CurrentTenantContext
|
||||||
@@ -70,7 +70,7 @@ final class NovaTenancy
|
|||||||
return '/'.ltrim($path, '/');
|
return '/'.ltrim($path, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param Closure(Request, Model&NovaTenant): Response $callback */
|
/** @param Closure(Request, Model&NovaTenant): (Response|null) $callback */
|
||||||
public static function logoResponseUsing(Closure $callback): void
|
public static function logoResponseUsing(Closure $callback): void
|
||||||
{
|
{
|
||||||
self::$logoResponseCallback = $callback;
|
self::$logoResponseCallback = $callback;
|
||||||
|
|||||||
@@ -3,12 +3,22 @@
|
|||||||
namespace MeghdadFadaee\NovaTenancy\Providers;
|
namespace MeghdadFadaee\NovaTenancy\Providers;
|
||||||
|
|
||||||
use Illuminate\Contracts\Database\Eloquent\Builder;
|
use Illuminate\Contracts\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use LogicException;
|
use LogicException;
|
||||||
use MeghdadFadaee\NovaTenancy\Contracts\ProvidesNovaTenants;
|
use MeghdadFadaee\NovaTenancy\Contracts\ProvidesNovaTenants;
|
||||||
|
|
||||||
class UserTenantProvider extends EloquentTenantProvider
|
class UserTenantProvider extends EloquentTenantProvider
|
||||||
{
|
{
|
||||||
|
public function find(Request $request, int|string $key): ?Model
|
||||||
|
{
|
||||||
|
if ($request->user() === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::find($request, $key);
|
||||||
|
}
|
||||||
|
|
||||||
public function query(Request $request): Builder
|
public function query(Request $request): Builder
|
||||||
{
|
{
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
|||||||
@@ -51,4 +51,24 @@ describe('TenantAppLogo', () => {
|
|||||||
|
|
||||||
expect(Nova.visit).toHaveBeenCalledWith('/nova-tenancy')
|
expect(Nova.visit).toHaveBeenCalledWith('/nova-tenancy')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('does not inherit Nova logo sizing and falls back when the image fails', async () => {
|
||||||
|
const wrapper = mount(TenantAppLogo, {
|
||||||
|
attrs: { class: 'h-6' },
|
||||||
|
})
|
||||||
|
await flushPromises()
|
||||||
|
|
||||||
|
expect(wrapper.get('.nova-tenancy-brand').classes()).not.toContain('h-6')
|
||||||
|
expect(wrapper.get('.nova-tenancy-brand__logo').classes()).not.toContain(
|
||||||
|
'nova-tenancy-brand__logo--fallback'
|
||||||
|
)
|
||||||
|
|
||||||
|
await wrapper.get('.nova-tenancy-brand__logo img').trigger('error')
|
||||||
|
|
||||||
|
expect(wrapper.find('.nova-tenancy-brand__logo img').exists()).toBe(false)
|
||||||
|
expect(wrapper.get('.nova-tenancy-brand__logo').classes()).toContain(
|
||||||
|
'nova-tenancy-brand__logo--fallback'
|
||||||
|
)
|
||||||
|
expect(wrapper.get('.nova-tenancy-brand__initial').text()).toBe('A')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
import {
|
import {
|
||||||
|
accentContrast,
|
||||||
currentLogoUrl,
|
currentLogoUrl,
|
||||||
sameTenant,
|
sameTenant,
|
||||||
tenantInitial,
|
tenantInitial,
|
||||||
@@ -14,7 +15,12 @@ describe('tenant state helpers', () => {
|
|||||||
|
|
||||||
it('builds safe presentation fallbacks', () => {
|
it('builds safe presentation fallbacks', () => {
|
||||||
expect(tenantInitial(' alpha')).toBe('A')
|
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', () => {
|
it('creates a cache-busted fixed logo endpoint', () => {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use Illuminate\Http\Request;
|
|||||||
use MeghdadFadaee\NovaTenancy\Contracts\CurrentTenantContext;
|
use MeghdadFadaee\NovaTenancy\Contracts\CurrentTenantContext;
|
||||||
use MeghdadFadaee\NovaTenancy\CurrentTenant;
|
use MeghdadFadaee\NovaTenancy\CurrentTenant;
|
||||||
use MeghdadFadaee\NovaTenancy\Exceptions\TenantNotSelected;
|
use MeghdadFadaee\NovaTenancy\Exceptions\TenantNotSelected;
|
||||||
|
use MeghdadFadaee\NovaTenancy\Http\Middleware\RequireTenant;
|
||||||
use MeghdadFadaee\NovaTenancy\NovaTenancy;
|
use MeghdadFadaee\NovaTenancy\NovaTenancy;
|
||||||
use MeghdadFadaee\NovaTenancy\Providers\UserTenantProvider;
|
use MeghdadFadaee\NovaTenancy\Providers\UserTenantProvider;
|
||||||
use MeghdadFadaee\NovaTenancy\Tests\Fixtures\Tenant;
|
use MeghdadFadaee\NovaTenancy\Tests\Fixtures\Tenant;
|
||||||
@@ -30,6 +31,15 @@ it('resolves only an accessible tenant from the cookie', function (): void {
|
|||||||
expect((new CurrentTenant(new UserTenantProvider, $request))->model())->toBeNull();
|
expect((new CurrentTenant(new UserTenantProvider, $request))->model())->toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('ignores a persisted tenant cookie for unauthenticated requests', function (): void {
|
||||||
|
$request = Request::create('/nova/login');
|
||||||
|
$request->cookies->set('nova_tenant', '1');
|
||||||
|
|
||||||
|
$context = new CurrentTenant(new UserTenantProvider, $request);
|
||||||
|
|
||||||
|
expect($context->model())->toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
it('provides scoped string bindings and strict accessors', function (): void {
|
it('provides scoped string bindings and strict accessors', function (): void {
|
||||||
expect(app('CurrentTenantId'))->toBeNull()
|
expect(app('CurrentTenantId'))->toBeNull()
|
||||||
->and(app('CurrentTenantModel'))->toBeNull()
|
->and(app('CurrentTenantModel'))->toBeNull()
|
||||||
@@ -37,6 +47,44 @@ it('provides scoped string bindings and strict accessors', function (): void {
|
|||||||
->toThrow(TenantNotSelected::class);
|
->toThrow(TenantNotSelected::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('sends an inertia location response to tenant selection', function (): void {
|
||||||
|
$request = Request::create('/nova/dashboards/home', server: [
|
||||||
|
'HTTP_ACCEPT' => 'text/html, application/xhtml+xml',
|
||||||
|
'HTTP_X_INERTIA' => 'true',
|
||||||
|
'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = (new TenantNotSelected)->toResponse($request);
|
||||||
|
|
||||||
|
expect($response->getStatusCode())->toBe(409)
|
||||||
|
->and($response->headers->get('X-Inertia-Location'))->toEndWith('/nova/nova-tenancy');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns the selection response directly from tenant middleware', function (): void {
|
||||||
|
$request = Request::create('/nova/dashboards/home', server: [
|
||||||
|
'HTTP_ACCEPT' => 'text/html, application/xhtml+xml',
|
||||||
|
'HTTP_X_INERTIA' => 'true',
|
||||||
|
'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = (new RequireTenant(app(CurrentTenantContext::class)))
|
||||||
|
->handle($request, fn () => response()->noContent());
|
||||||
|
|
||||||
|
expect($response->getStatusCode())->toBe(409)
|
||||||
|
->and($response->headers->get('X-Inertia-Location'))->toEndWith('/nova/nova-tenancy');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns a conflict response for a json api request', function (): void {
|
||||||
|
$request = Request::create('/nova-api/resources', server: [
|
||||||
|
'HTTP_ACCEPT' => 'application/json',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = (new TenantNotSelected)->toResponse($request);
|
||||||
|
|
||||||
|
expect($response->getStatusCode())->toBe(409)
|
||||||
|
->and($response->getContent())->toContain('tenant_selection_required');
|
||||||
|
});
|
||||||
|
|
||||||
it('temporarily activates a tenant and restores the previous context', function (): void {
|
it('temporarily activates a tenant and restores the previous context', function (): void {
|
||||||
$user = User::query()->create(['name' => 'Ada']);
|
$user = User::query()->create(['name' => 'Ada']);
|
||||||
$first = Tenant::query()->create(['user_id' => $user->id, 'title' => 'First']);
|
$first = Tenant::query()->create(['user_id' => $user->id, 'title' => 'First']);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\Event;
|
||||||
use MeghdadFadaee\NovaTenancy\Events\TenantCleared;
|
use MeghdadFadaee\NovaTenancy\Events\TenantCleared;
|
||||||
use MeghdadFadaee\NovaTenancy\Events\TenantSelected;
|
use MeghdadFadaee\NovaTenancy\Events\TenantSelected;
|
||||||
|
use MeghdadFadaee\NovaTenancy\NovaTenancy;
|
||||||
use MeghdadFadaee\NovaTenancy\Tests\Fixtures\Tenant;
|
use MeghdadFadaee\NovaTenancy\Tests\Fixtures\Tenant;
|
||||||
use MeghdadFadaee\NovaTenancy\Tests\Fixtures\User;
|
use MeghdadFadaee\NovaTenancy\Tests\Fixtures\User;
|
||||||
|
|
||||||
@@ -89,3 +90,19 @@ it('renders a fallback for unsafe logo schemes', function (): void {
|
|||||||
->assertOk()
|
->assertOk()
|
||||||
->assertHeader('Content-Type', 'image/svg+xml; charset=UTF-8');
|
->assertHeader('Content-Type', 'image/svg+xml; charset=UTF-8');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('falls through when a custom logo response returns null', function (): void {
|
||||||
|
$user = User::query()->create(['name' => 'Ada']);
|
||||||
|
$tenant = Tenant::query()->create([
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'title' => 'Alpha',
|
||||||
|
'logo_url' => 'https://cdn.example.com/alpha.png',
|
||||||
|
]);
|
||||||
|
|
||||||
|
NovaTenancy::logoResponseUsing(fn () => null);
|
||||||
|
|
||||||
|
$this->actingAs($user)
|
||||||
|
->withCookie('nova_tenant', (string) $tenant->id)
|
||||||
|
->get('/testing/current/logo')
|
||||||
|
->assertRedirect('https://cdn.example.com/alpha.png');
|
||||||
|
});
|
||||||
Reference in new issue
Block a user