Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- The selected files are submitted under the current `name`. Before, a change of `name` kept them under the old name, and a `name` set after the selection submitted no files.
- #### Form controls
- A change of the `value` or `checked` attribute keeps the control pristine, so a later `defaultValue` or `defaultChecked` still sets the value, as for a native control.
- #### Tile manager
- The tile transitions are styled also with a theme compiled from Sass. The tile manager adds their rules to the document instead of the theme style sheets. [#2608](https://github.com/IgniteUI/igniteui-webcomponents/issues/2608)
- #### Input, Textarea
- `stepUp()`, `stepDown()` and `setRangeText()` no longer clear the value when you call them before the first render.
- #### Mask input
Expand Down
31 changes: 19 additions & 12 deletions src/components/tile-manager/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ This directory hosts two public components: [`igc-tile-manager`](#igc-tile-manag
| 11 | 2026-11-02 | Tiles fit the responsive columns, a start after the last column moves back, nested managers keep their own column count and gap |
| 12 | 2026-11-02 | Percentage gaps in a resize, CSS `direction` in a drag, a drag copy that does not act as a tile, no count loop with the page scrollbar |
| 13 | 2026-11-02 | View transition names only during a transition of the manager, a stacking context for the content of a tile, a drag target that stays while the pointer is in it |
| 14 | 2026-11-17 | The tile manager adds its view transition rules to the document, instead of the theme style sheets |

## Overview

Expand Down Expand Up @@ -132,16 +133,16 @@ fullscreen by default - and its content below. While dragging is enabled, a tile
another position, and the rest of the tiles reflow around it. While resizing is enabled, adorners appear on the
side, the bottom and the corner of a tile, and dragging them changes its span.

Maximize, restore, a resize and a swap animate with a view transition. A tile that changes its size keeps its
content at its real size while its box grows or shrinks, so the text stays sharp. Its new content fades in during
the first 40% of the transition. The tiles that a maximized tile covers fade in place. The drag ghost stays on the
pointer during a swap. The view transition pseudo-elements belong to the document, so the theme style sheets
(`themes/light/*.css` and `themes/dark/*.css`) hold their rules. They select the view transition classes
`igc-tile-resize` and `igc-tile-rtl`, and the `dragged-tile-ghost` name. Without a theme style sheet, the tiles use
the default transition, and so does a size change in a browser without view transition classes. Only during a
transition, the tiles of its manager have a view transition name (`tile-transition-<id>`), so the transition captures
only them. An application that runs its own view transition gives a name to the tiles that it moves. An inline name of
the author stays.
Maximize, restore, a resize and a swap animate with a view transition. A tile that changes its size keeps its content
at its real size while its box grows or shrinks, so the text stays sharp. Its new content fades in during the first
40% of the transition. The tiles that a maximized tile covers fade in place. The drag ghost stays on the pointer
during a swap. The view transition pseudo-elements belong to the document, so a tile manager adds their rules to
`document.adoptedStyleSheets` when it connects, and a tile transition adds them again if the application replaced the
adopted sheets. A more specific rule of the application overrides them. They select the view transition classes
`igc-tile-resize` and `igc-tile-rtl`, and the `dragged-tile-ghost` name. A size change in a browser without view
transition classes uses the default transition. Only during a transition, the tiles of its manager have a view
transition name (`tile-transition-<id>`), so the transition captures only them. An application that runs its own view
transition gives a name to the tiles that it moves. An inline name of the author stays.

### Developer experience

Expand Down Expand Up @@ -586,8 +587,8 @@ The groups below mirror the `describe` blocks.
start event of the next drag.
45. A maximize, a restore or a resize marks the tile with `igc-tile-resize` (and `igc-tile-rtl` in RTL) until its view
transition ends, also after two quick clicks. The view transition classes of the author stay, and an inline one
returns when the transition ends. While a tile is maximized, the covered tiles have no view transition name. With a
theme style sheet, the new content of a maximizing tile fades in, and the drag ghost has no animation in a swap.
returns when the transition ends. While a tile is maximized, the covered tiles have no view transition name. The
new content of a maximizing tile fades in, and the drag ghost has no animation in a swap.
The tiles of a manager have a view transition name only while its transition runs, also after two quick clicks. A
swap and a restore name only the tiles of their manager, and an inline name of the author stays.

Expand All @@ -602,6 +603,12 @@ The groups below mirror the `describe` blocks.
47. The content of a tile, also fixed content with a z-index, stays under the next tile, and so do the resize handles
of the tile. The resize handles stay above content with any z-index.

### View transition rules

48. A tile manager adds the view transition rules to the document when it connects, once per document. A tile
transition adds them again after the application replaced the adopted style sheets.
49. Only a more specific rule of the application overrides the view transition rules.

## Assumptions and limitations

- Only `igc-tile` elements are projected into the grid; other content is ignored.
Expand Down
54 changes: 54 additions & 0 deletions src/components/tile-manager/themes/view-transitions.base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// The view transitions of the tile manager. The view transition pseudo-elements
// belong to the document, so a shadow root cannot style them. The tile manager
// adds this sheet to the adopted style sheets of the document (see
// `adoptTransitionStyles`).

// A tile that changes its size (`startSizeTransition`) stays above the
// tiles that move, come or go.
::view-transition-group(*.igc-tile-resize) {
z-index: 1;
}

// Clip the snapshots at their real size, so the content stays sharp.
::view-transition-old(*.igc-tile-resize),
::view-transition-new(*.igc-tile-resize) {
block-size: 100%;
object-fit: none;
object-position: left top;
overflow: clip;
mix-blend-mode: normal;
}

::view-transition-old(*.igc-tile-resize.igc-tile-rtl),
::view-transition-new(*.igc-tile-resize.igc-tile-rtl) {
object-position: right top;
}

::view-transition-new(*.igc-tile-resize) {
animation-name: igc-tile-fade-in;
}

@keyframes igc-tile-fade-in {
0% {
opacity: 0;
}

40%,
100% {
opacity: 1;
}
}

// The drag ghost stays on the pointer and above the tiles during a swap.
::view-transition-group(dragged-tile-ghost) {
z-index: 2;
animation: none;
}

::view-transition-new(dragged-tile-ghost) {
animation: none;
}

::view-transition-old(dragged-tile-ghost) {
display: none;
}
35 changes: 16 additions & 19 deletions src/components/tile-manager/tile-dnd.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -663,30 +663,27 @@ describe('Tile drag and drop', () => {
]);
});

it('keeps the drag ghost on the pointer in a swap with a theme style sheet', async () => {
it('keeps the drag ghost on the pointer in a swap', async () => {
const [dragged, target] = [getTile(0), getTile(1)];

// The theme style sheets style the view transitions of the tiles.
await withDocumentSheets([bootstrap.styleSheet!], async () => {
simulatePointerDown(dragged);
simulateTileDragOver(dragged, getCenterPoint(target));

const transition = getActiveViewTransition()!;
await transition.ready;
simulatePointerDown(dragged);
simulateTileDragOver(dragged, getCenterPoint(target));

const ghostAnimations = document
.getAnimations()
.filter((animation) =>
(animation.effect as KeyframeEffect).pseudoElement?.includes(
'(dragged-tile-ghost)'
)
);
const transition = getActiveViewTransition()!;
await transition.ready;

const ghostAnimations = document
.getAnimations()
.filter((animation) =>
(animation.effect as KeyframeEffect).pseudoElement?.includes(
'(dragged-tile-ghost)'
)
);

simulateLostPointerCapture(dragged);
await transition.finished;
simulateLostPointerCapture(dragged);
await transition.finished;

expect(ghostAnimations).to.be.empty;
});
expect(ghostAnimations).to.be.empty;
});

it('cancels the drag when an `igcTileDragStart` listener moves the tile', async () => {
Expand Down
107 changes: 87 additions & 20 deletions src/components/tile-manager/tile-manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import {
import { simulateClick } from '#internals/testing/simulate.spec.js';
import { firstOf } from '#internals/utils/arrays.js';
import { getCenterPoint } from '#internals/utils/dom.js';
import { styles as bootstrap } from '../../styles/themes/light/bootstrap.css.js';
import IgcIconButtonComponent from '../button/icon-button.js';
import { styles as transitionStyles } from './themes/view-transitions.base.css.js';
import IgcTileManagerComponent from './tile-manager.js';
import IgcTileComponent from './tile.js';

Expand Down Expand Up @@ -1137,29 +1137,26 @@ describe('Tile Manager component', () => {
expect(tile.style.viewTransitionClass).to.equal('');
});

it('fades the new content of a maximizing tile in with a theme style sheet', async () => {
it('fades the new content of a maximizing tile in', async () => {
const tile = tileManager.tiles[0];

// The theme style sheets style the view transitions of the tiles.
await withDocumentSheets([bootstrap.styleSheet!], async () => {
simulateClick(getActionButtons(tile)[0]);
simulateClick(getActionButtons(tile)[0]);

const transition = getActiveViewTransition()!;
await transition.ready;

const fadeIn = document
.getAnimations()
.find(
(animation) =>
animation instanceof CSSAnimation &&
animation.animationName === 'igc-tile-fade-in' &&
(animation.effect as KeyframeEffect).pseudoElement ===
`::view-transition-new(${tile.style.viewTransitionName})`
);
const transition = getActiveViewTransition()!;
await transition.ready;

const fadeIn = document
.getAnimations()
.find(
(animation) =>
animation instanceof CSSAnimation &&
animation.animationName === 'igc-tile-fade-in' &&
(animation.effect as KeyframeEffect).pseudoElement ===
`::view-transition-new(${tile.style.viewTransitionName})`
);

expect(fadeIn).to.exist;
await transition.finished;
});
expect(fadeIn).to.exist;
await transition.finished;
});

it('aligns the transition of a right-to-left tile to its right edge', async () => {
Expand Down Expand Up @@ -1299,6 +1296,76 @@ describe('Tile Manager component', () => {
});
});

describe('View transition rules', () => {
allowMotion();

beforeEach(async () => {
tileManager = await fixture<IgcTileManagerComponent>(createTileManager());
});

it('adds its view transition rules to the document on connect and in a transition', async () => {
const [maximize] = getActionButtons(tileManager.tiles[0]);
const application = new CSSStyleSheet();

await withDocumentSheets([], async () => {
document.adoptedStyleSheets = [];
tileManager.parentElement!.append(tileManager);

expect(document.adoptedStyleSheets).to.have.ordered.members([
transitionStyles.styleSheet,
]);

// The application replaces the adopted sheets.
document.adoptedStyleSheets = [application];

for (const _ of [1, 2]) {
simulateClick(maximize);
await getActiveViewTransition()?.finished;

expect(document.adoptedStyleSheets).to.have.ordered.members([
application,
transitionStyles.styleSheet,
]);
}
});
});

it('lets only a more specific rule of the application override its view transition rules', async () => {
const tile = tileManager.tiles[0];
const application = new CSSStyleSheet();
const zIndexes: string[] = [];

await withDocumentSheets([], async () => {
// The rule of the application comes after the tile rules.
document.adoptedStyleSheets = [
transitionStyles.styleSheet!,
application,
];

for (const selector of [
'::view-transition-group(*)',
':root::view-transition-group(*.igc-tile-resize)',
]) {
application.replaceSync(`${selector} { z-index: 5; }`);
simulateClick(getActionButtons(tile)[0]);

const transition = getActiveViewTransition()!;
await transition.ready;

zIndexes.push(
getComputedStyle(
document.documentElement,
`::view-transition-group(${tile.style.viewTransitionName})`
).zIndex
);
await transition.finished;
}
});

expect(zIndexes).to.deep.equal(['1', '5']);
});
});

describe('Manual slot assignment', () => {
beforeEach(async () => {
tileManager = await fixture<IgcTileManagerComponent>(html`
Expand Down
7 changes: 6 additions & 1 deletion src/components/tile-manager/tile-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { applyLayout, serializeTiles } from './serializer.js';
import { styles as shared } from './themes/shared/tile-manager.common.css.js';
import { styles } from './themes/tile-manager.base.css.js';
import IgcTileComponent from './tile.js';
import { childTiles } from './transitions.js';
import { adoptTransitionStyles, childTiles } from './transitions.js';

/* blazorAdditionalDependency: IgcTileComponent */
/**
Expand Down Expand Up @@ -224,6 +224,11 @@ export default class IgcTileManagerComponent extends LitElement {
});
}

public override connectedCallback(): void {
super.connectedCallback();
adoptTransitionStyles();
}

protected override firstUpdated(): void {
this._tilesState.assignPositions();
this._tilesState.assignTiles();
Expand Down
18 changes: 17 additions & 1 deletion src/components/tile-manager/transitions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import { startViewTransition } from '#animations/view-transition.js';
import { getOrInsertComputed } from '#internals/utils/objects.js';
import { styles as transitionStyles } from './themes/view-transitions.base.css.js';
import type IgcTileComponent from './tile.js';

/**
* Adds the view transition rules of the tiles to the document, once. A tile
* transition adds them again if the application replaced the adopted sheets.
*/
export function adoptTransitionStyles(): void {
const sheet = transitionStyles.styleSheet;
const { adoptedStyleSheets } = document;
Comment thread
adrianptrv marked this conversation as resolved.
Resolved

if (sheet && !adoptedStyleSheets.includes(sheet)) {
adoptedStyleSheets.push(sheet);
}
}

/**
* The inline view transition class of each tile before its first size
* transition. Only the latest transition restores it.
Expand Down Expand Up @@ -53,6 +67,8 @@ export function startTileTransition(
parent: ParentNode | null,
update: () => void
): ViewTransition {
adoptTransitionStyles();

const releases = childTiles(parent).map(holdName);
const transition = startViewTransition(update);
const release = () => {
Expand All @@ -68,7 +84,7 @@ export function startTileTransition(
/**
* Starts a view transition in which `tile` changes its size. Until it ends, the
* tile also has the `igc-tile-resize` view transition class, and `igc-tile-rtl`
* in RTL. The theme style sheets style them (see `_view-transitions.scss`).
* in RTL.
*/
export function startSizeTransition(
tile: HTMLElement,
Expand Down
2 changes: 0 additions & 2 deletions src/styles/themes/base/_theme.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@use 'sass:map';
@use 'igniteui-theming' as *;
@use 'view-transitions';

@mixin theme($palette, $elevations, $typeface, $type-scale, $variant) {
/* Two counters for integer and fractional parts */
Expand Down Expand Up @@ -35,6 +34,5 @@
);
@include sizing();
@include spacing();
@include view-transitions.tile-manager();
}

Loading