@theseam/ui-common 1.0.2-beta.15 → 1.0.2-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/theseam-ui-common-framework.mjs +150 -2
- package/fesm2022/theseam-ui-common-framework.mjs.map +1 -1
- package/fesm2022/theseam-ui-common-graphql.mjs +2 -2
- package/fesm2022/theseam-ui-common-graphql.mjs.map +1 -1
- package/framework/index.d.ts +89 -3
- package/framework/route-transitions/route-transitions.css +166 -0
- package/graphql/index.d.ts +10 -8
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ import { TheSeamButtonsModule } from '@theseam/ui-common/buttons';
|
|
|
25
25
|
import { TheSeamDynamicComponentLoader } from '@theseam/ui-common/dynamic-component-loader';
|
|
26
26
|
import { trigger, state, transition, style, animate, group, query, animateChild, keyframes } from '@angular/animations';
|
|
27
27
|
import * as i1$2 from '@angular/router';
|
|
28
|
-
import { RouterModule, NavigationEnd, NavigationStart, Router } from '@angular/router';
|
|
28
|
+
import { RouterModule, NavigationEnd, NavigationStart, Router, ActivatedRoute, RouterOutlet } from '@angular/router';
|
|
29
29
|
import * as i4 from '@angular/cdk/a11y';
|
|
30
30
|
import { A11yModule } from '@angular/cdk/a11y';
|
|
31
31
|
import * as i5 from '@theseam/ui-common/tooltip';
|
|
@@ -4138,9 +4138,157 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImpo
|
|
|
4138
4138
|
}]
|
|
4139
4139
|
}] });
|
|
4140
4140
|
|
|
4141
|
+
function computeDirection(prev, next) {
|
|
4142
|
+
let shared = 0;
|
|
4143
|
+
while (shared < prev.length &&
|
|
4144
|
+
shared < next.length &&
|
|
4145
|
+
prev[shared] === next[shared]) {
|
|
4146
|
+
shared++;
|
|
4147
|
+
}
|
|
4148
|
+
const prevRemaining = prev.length - shared;
|
|
4149
|
+
const nextRemaining = next.length - shared;
|
|
4150
|
+
if (prevRemaining === 0 && nextRemaining > 0)
|
|
4151
|
+
return 'deeper';
|
|
4152
|
+
if (prevRemaining > 0 && nextRemaining === 0)
|
|
4153
|
+
return 'shallower';
|
|
4154
|
+
return 'sibling';
|
|
4155
|
+
}
|
|
4156
|
+
|
|
4157
|
+
function getUrlSegments(snapshot) {
|
|
4158
|
+
const segments = [];
|
|
4159
|
+
let current = snapshot;
|
|
4160
|
+
while (current) {
|
|
4161
|
+
for (const seg of current.url) {
|
|
4162
|
+
if (seg.path) {
|
|
4163
|
+
segments.push(seg.path);
|
|
4164
|
+
}
|
|
4165
|
+
}
|
|
4166
|
+
current = current.firstChild;
|
|
4167
|
+
}
|
|
4168
|
+
return segments;
|
|
4169
|
+
}
|
|
4170
|
+
|
|
4171
|
+
function seamRouteTransition() {
|
|
4172
|
+
let isFirst = true;
|
|
4173
|
+
return (info) => {
|
|
4174
|
+
// Skip the first navigation (typically a redirect from / to /dashboard).
|
|
4175
|
+
// No animation on initial page load.
|
|
4176
|
+
if (isFirst) {
|
|
4177
|
+
isFirst = false;
|
|
4178
|
+
return;
|
|
4179
|
+
}
|
|
4180
|
+
const prevSegments = getUrlSegments(info.from);
|
|
4181
|
+
const nextSegments = getUrlSegments(info.to);
|
|
4182
|
+
const direction = computeDirection(prevSegments, nextSegments);
|
|
4183
|
+
document.documentElement.dataset['routeDirection'] = direction;
|
|
4184
|
+
};
|
|
4185
|
+
}
|
|
4186
|
+
|
|
4187
|
+
/**
|
|
4188
|
+
* A reusable shell component that wraps a `<router-outlet>` with automatic
|
|
4189
|
+
* directional slide transitions powered by the View Transition API.
|
|
4190
|
+
*
|
|
4191
|
+
* Use this as a parent route component in place of custom "Base" components.
|
|
4192
|
+
* It eliminates the need for per-module animation boilerplate and
|
|
4193
|
+
* `routeTransitionId` route data.
|
|
4194
|
+
*
|
|
4195
|
+
* ### Setup (one-time per app)
|
|
4196
|
+
*
|
|
4197
|
+
* 1. Register the transition callback in your router config:
|
|
4198
|
+
* ```typescript
|
|
4199
|
+
* import { seamRouteTransition } from '@theseam/ui-common'
|
|
4200
|
+
*
|
|
4201
|
+
* provideRouter(
|
|
4202
|
+
* routes,
|
|
4203
|
+
* withViewTransitions({ onViewTransitionCreated: seamRouteTransition() })
|
|
4204
|
+
* )
|
|
4205
|
+
* ```
|
|
4206
|
+
*
|
|
4207
|
+
* 2. Import the transition stylesheet in your global styles:
|
|
4208
|
+
* ```scss
|
|
4209
|
+
* @import '@theseam/ui-common/framework/route-transitions/route-transitions';
|
|
4210
|
+
* ```
|
|
4211
|
+
*
|
|
4212
|
+
* ### Usage in route configs
|
|
4213
|
+
*
|
|
4214
|
+
* ```typescript
|
|
4215
|
+
* import { SeamRouteShellComponent } from '@theseam/ui-common'
|
|
4216
|
+
*
|
|
4217
|
+
* const routes: Routes = [
|
|
4218
|
+
* {
|
|
4219
|
+
* path: '',
|
|
4220
|
+
* component: SeamRouteShellComponent,
|
|
4221
|
+
* children: [
|
|
4222
|
+
* { path: '', component: ClaimsTableComponent },
|
|
4223
|
+
* { path: ':id', component: ClaimDetailComponent },
|
|
4224
|
+
* ],
|
|
4225
|
+
* },
|
|
4226
|
+
* ]
|
|
4227
|
+
* ```
|
|
4228
|
+
*
|
|
4229
|
+
* ### Transition behavior
|
|
4230
|
+
*
|
|
4231
|
+
* Direction is determined automatically by comparing route URL segments:
|
|
4232
|
+
* - **Sibling** — same parent, different child: current slides right, new slides left.
|
|
4233
|
+
* - **Deeper** — navigating to a child route: both slide left.
|
|
4234
|
+
* - **Shallower** — navigating to a parent route: both slide right.
|
|
4235
|
+
* - **Cross-branch** — different sections entirely: treated as sibling of the
|
|
4236
|
+
* deepest shared ancestor.
|
|
4237
|
+
*
|
|
4238
|
+
* ### Customization
|
|
4239
|
+
*
|
|
4240
|
+
* Override CSS custom properties to adjust timing:
|
|
4241
|
+
* ```css
|
|
4242
|
+
* :root {
|
|
4243
|
+
* --seam-route-transition-duration: 300ms;
|
|
4244
|
+
* --seam-route-transition-easing: ease-out;
|
|
4245
|
+
* }
|
|
4246
|
+
* ```
|
|
4247
|
+
*
|
|
4248
|
+
* Transitions are automatically disabled when the user has
|
|
4249
|
+
* `prefers-reduced-motion: reduce` enabled.
|
|
4250
|
+
*
|
|
4251
|
+
* ### Nesting
|
|
4252
|
+
*
|
|
4253
|
+
* Multiple `SeamRouteShellComponent` instances can be nested at different
|
|
4254
|
+
* route depths. Each instance receives a unique `view-transition-name`
|
|
4255
|
+
* based on its depth in the route tree to avoid conflicts.
|
|
4256
|
+
*/
|
|
4257
|
+
class SeamRouteShellComponent {
|
|
4258
|
+
route = inject(ActivatedRoute);
|
|
4259
|
+
/** Unique view-transition-name based on route depth to avoid duplicates when nested. */
|
|
4260
|
+
transitionName = `seam-route-content-${this.getRouteDepth()}`;
|
|
4261
|
+
getRouteDepth() {
|
|
4262
|
+
let depth = 0;
|
|
4263
|
+
let current = this.route.snapshot;
|
|
4264
|
+
while (current.parent) {
|
|
4265
|
+
depth++;
|
|
4266
|
+
current = current.parent;
|
|
4267
|
+
}
|
|
4268
|
+
return depth;
|
|
4269
|
+
}
|
|
4270
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: SeamRouteShellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4271
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: SeamRouteShellComponent, isStandalone: true, selector: "seam-route-shell", host: { properties: { "style.view-transition-name": "transitionName", "style.display": "\"flex\"", "style.flex-direction": "\"column\"", "style.height": "\"100%\"" } }, ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
|
|
4272
|
+
}
|
|
4273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: SeamRouteShellComponent, decorators: [{
|
|
4274
|
+
type: Component,
|
|
4275
|
+
args: [{
|
|
4276
|
+
selector: 'seam-route-shell',
|
|
4277
|
+
template: `<router-outlet></router-outlet>`,
|
|
4278
|
+
host: {
|
|
4279
|
+
'[style.view-transition-name]': 'transitionName',
|
|
4280
|
+
'[style.display]': '"flex"',
|
|
4281
|
+
'[style.flex-direction]': '"column"',
|
|
4282
|
+
'[style.height]': '"100%"',
|
|
4283
|
+
},
|
|
4284
|
+
imports: [RouterOutlet],
|
|
4285
|
+
standalone: true,
|
|
4286
|
+
}]
|
|
4287
|
+
}] });
|
|
4288
|
+
|
|
4141
4289
|
/**
|
|
4142
4290
|
* Generated bundle index. Do not edit.
|
|
4143
4291
|
*/
|
|
4144
4292
|
|
|
4145
|
-
export { BaseLayoutContentDirective, BaseLayoutContentFooterDirective, BaseLayoutContentHeaderDirective, BaseLayoutSideBarDirective, BaseLayoutSideBarFooterDirective, BaseLayoutSideBarHeaderDirective, BaseLayoutTopBarDirective, DEFAULT_SIDE_NAV_CONFIG, DashboardComponent, DashboardWidgetContainerComponent, DashboardWidgetPortalOutletDirective, DashboardWidgetTemplateContainerComponent, DashboardWidgetsComponent, DashboardWidgetsPreferencesService, DashboardWidgetsService, HierarchyLevelResolver, HierarchyRouterOutletComponent, HorizontalNavComponent, NavItemComponent, SideNavComponent, SideNavItemComponent, SideNavToggleComponent, THESEAM_BASE_LAYOUT_REF, THESEAM_DASHBOARD_WIDGETS_PREFERENCES_ACCESSOR, THESEAM_SCHEMA_FRAMEWORK_OVERRIDES, THESEAM_SIDE_NAV_ACCESSOR, THESEAM_SIDE_NAV_CONFIG, THE_SEAM_BASE_LAYOUT, TheSeamBaseLayoutComponent, TheSeamBaseLayoutModule, TheSeamBaseLayoutNavToggleDirective, TheSeamDashboardModule, TheSeamDynamicRouterModule, TheSeamFramework, TheSeamNavModule, TheSeamSchemaFormFrameworkComponent, TheSeamSchemaFormModule, TheSeamSideNavModule, TheSeamTopBarComponent, TheSeamTopBarModule, TopBarCompactMenuBtnDetailDirective, TopBarItemDirective, TopBarMenuBtnDetailDirective, TopBarMenuButtonComponent, TopBarMenuDirective, TopBarNavToggleBtnDetailDirective, TopBarTitleComponent, applyItemConfig, areSameHorizontalNavItem, canBeActive, canExpand, canHaveChildren, extendFramework, fader, findHorizontalNavLinkItems, findLinkItems, getHorizontalNavItemStateProp, getItemStateProp, hasActiveChild, hasChildren, hasExpandedChild, horizontalNavItemCanBeActive, horizontalNavItemCanExpand, horizontalNavItemCanHaveChildren, horizontalNavItemHasActiveChild, horizontalNavItemHasChildren, horizontalNavItemHasExpandedChild, isExpanded, isHorizontalNavItemActive, isHorizontalNavItemExpanded, isHorizontalNavItemFocused, isHorizontalNavItemType, isNavItemActive, isNavItemType, routeChanges, setDefaultHorizontalNavItemState, setDefaultState, setHorizontalNavItemStateProp, setItemStateProp, sideNavExpandStateChangeFn, sideToSide, slider, stepper, transformer };
|
|
4293
|
+
export { BaseLayoutContentDirective, BaseLayoutContentFooterDirective, BaseLayoutContentHeaderDirective, BaseLayoutSideBarDirective, BaseLayoutSideBarFooterDirective, BaseLayoutSideBarHeaderDirective, BaseLayoutTopBarDirective, DEFAULT_SIDE_NAV_CONFIG, DashboardComponent, DashboardWidgetContainerComponent, DashboardWidgetPortalOutletDirective, DashboardWidgetTemplateContainerComponent, DashboardWidgetsComponent, DashboardWidgetsPreferencesService, DashboardWidgetsService, HierarchyLevelResolver, HierarchyRouterOutletComponent, HorizontalNavComponent, NavItemComponent, SeamRouteShellComponent, SideNavComponent, SideNavItemComponent, SideNavToggleComponent, THESEAM_BASE_LAYOUT_REF, THESEAM_DASHBOARD_WIDGETS_PREFERENCES_ACCESSOR, THESEAM_SCHEMA_FRAMEWORK_OVERRIDES, THESEAM_SIDE_NAV_ACCESSOR, THESEAM_SIDE_NAV_CONFIG, THE_SEAM_BASE_LAYOUT, TheSeamBaseLayoutComponent, TheSeamBaseLayoutModule, TheSeamBaseLayoutNavToggleDirective, TheSeamDashboardModule, TheSeamDynamicRouterModule, TheSeamFramework, TheSeamNavModule, TheSeamSchemaFormFrameworkComponent, TheSeamSchemaFormModule, TheSeamSideNavModule, TheSeamTopBarComponent, TheSeamTopBarModule, TopBarCompactMenuBtnDetailDirective, TopBarItemDirective, TopBarMenuBtnDetailDirective, TopBarMenuButtonComponent, TopBarMenuDirective, TopBarNavToggleBtnDetailDirective, TopBarTitleComponent, applyItemConfig, areSameHorizontalNavItem, canBeActive, canExpand, canHaveChildren, computeDirection, extendFramework, fader, findHorizontalNavLinkItems, findLinkItems, getHorizontalNavItemStateProp, getItemStateProp, getUrlSegments, hasActiveChild, hasChildren, hasExpandedChild, horizontalNavItemCanBeActive, horizontalNavItemCanExpand, horizontalNavItemCanHaveChildren, horizontalNavItemHasActiveChild, horizontalNavItemHasChildren, horizontalNavItemHasExpandedChild, isExpanded, isHorizontalNavItemActive, isHorizontalNavItemExpanded, isHorizontalNavItemFocused, isHorizontalNavItemType, isNavItemActive, isNavItemType, routeChanges, seamRouteTransition, setDefaultHorizontalNavItemState, setDefaultState, setHorizontalNavItemStateProp, setItemStateProp, sideNavExpandStateChangeFn, sideToSide, slider, stepper, transformer };
|
|
4146
4294
|
//# sourceMappingURL=theseam-ui-common-framework.mjs.map
|