@atlaskit/top-layer 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/animations/presets.js +46 -48
- package/dist/cjs/dialog/dialog-content.compiled.css +46 -2
- package/dist/cjs/dialog/dialog-content.js +39 -2
- package/dist/cjs/internal/use-animated-visibility.js +4 -4
- package/dist/cjs/popover/popover.compiled.css +22 -2
- package/dist/cjs/popover/popover.js +19 -3
- package/dist/es2019/animations/presets.js +42 -299
- package/dist/es2019/dialog/dialog-content.compiled.css +46 -2
- package/dist/es2019/dialog/dialog-content.js +35 -2
- package/dist/es2019/internal/use-animated-visibility.js +4 -4
- package/dist/es2019/popover/popover.compiled.css +22 -2
- package/dist/es2019/popover/popover.js +19 -3
- package/dist/esm/animations/presets.js +45 -48
- package/dist/esm/dialog/dialog-content.compiled.css +46 -2
- package/dist/esm/dialog/dialog-content.js +39 -2
- package/dist/esm/internal/use-animated-visibility.js +4 -4
- package/dist/esm/popover/popover.compiled.css +22 -2
- package/dist/esm/popover/popover.js +19 -3
- package/dist/types/animations/presets.d.ts +18 -0
- package/dist/types/animations/types.d.ts +10 -14
- package/dist/types/dialog/types.d.ts +9 -1
- package/dist/types/internal/use-animated-visibility.d.ts +2 -2
- package/package.json +13 -31
- package/dist/cjs/internal/ensure-preset-styles.js +0 -34
- package/dist/cjs/internal/use-animation-preset.js +0 -24
- package/dist/cjs/internal/use-preset-styles.js +0 -27
- package/dist/es2019/internal/ensure-preset-styles.js +0 -29
- package/dist/es2019/internal/use-animation-preset.js +0 -18
- package/dist/es2019/internal/use-preset-styles.js +0 -22
- package/dist/esm/internal/ensure-preset-styles.js +0 -28
- package/dist/esm/internal/use-animation-preset.js +0 -18
- package/dist/esm/internal/use-preset-styles.js +0 -21
- package/dist/types/internal/ensure-preset-styles.d.ts +0 -6
- package/dist/types/internal/use-animation-preset.d.ts +0 -11
- package/dist/types/internal/use-preset-styles.d.ts +0 -15
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ensurePresetStyles = ensurePresetStyles;
|
|
7
|
-
/**
|
|
8
|
-
* Per-preset CSS injection.
|
|
9
|
-
*
|
|
10
|
-
* Each preset's CSS is injected at most once into `<head>`.
|
|
11
|
-
* Shared by both PopoverContent and DialogContent.
|
|
12
|
-
*
|
|
13
|
-
* Note: injected `<style>` elements and the tracking Set are append-only -
|
|
14
|
-
* they are never removed. This is intentional: the number of distinct
|
|
15
|
-
* presets is bounded (handful of animation presets), so the
|
|
16
|
-
* memory footprint is negligible. Removing styles would risk breaking
|
|
17
|
-
* other instances of the same preset that are still mounted.
|
|
18
|
-
*
|
|
19
|
-
* Decision (2026-03-17 audit): Accepted as a non-issue. The bounded
|
|
20
|
-
* preset count (~5 presets) makes cleanup unnecessary. We plan to move
|
|
21
|
-
* to a Compiled-based solution which will handle style injection and
|
|
22
|
-
* deduplication natively.
|
|
23
|
-
*/
|
|
24
|
-
var injectedPresets = new Set();
|
|
25
|
-
function ensurePresetStyles(_ref) {
|
|
26
|
-
var preset = _ref.preset;
|
|
27
|
-
if (injectedPresets.has(preset.name) || typeof document === 'undefined') {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
injectedPresets.add(preset.name);
|
|
31
|
-
var style = document.createElement('style');
|
|
32
|
-
style.textContent = preset.css;
|
|
33
|
-
document.head.appendChild(style);
|
|
34
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useAnimationPreset = useAnimationPreset;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _ensurePresetStyles = require("./ensure-preset-styles");
|
|
9
|
-
/**
|
|
10
|
-
* Normalizes the `animate` prop to a preset (or null) and ensures its CSS
|
|
11
|
-
* is injected once into document.head. Used by PopupContent, Popover, and
|
|
12
|
-
* DialogContent so they do not duplicate this logic.
|
|
13
|
-
*/
|
|
14
|
-
function useAnimationPreset(animate) {
|
|
15
|
-
var preset = animate != null && animate !== false ? animate : null;
|
|
16
|
-
(0, _react.useInsertionEffect)(function () {
|
|
17
|
-
if (preset) {
|
|
18
|
-
(0, _ensurePresetStyles.ensurePresetStyles)({
|
|
19
|
-
preset: preset
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}, [preset]);
|
|
23
|
-
return preset;
|
|
24
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.usePresetStyles = usePresetStyles;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _ensurePresetStyles = require("./ensure-preset-styles");
|
|
9
|
-
/**
|
|
10
|
-
* Normalizes a preset prop to a value (or null) and ensures its CSS
|
|
11
|
-
* is injected once into `document.head`.
|
|
12
|
-
*
|
|
13
|
-
* Works with any preset that has `{ css, name }` - animation presets
|
|
14
|
-
* (TAnimationPreset) satisfies this shape.
|
|
15
|
-
*/
|
|
16
|
-
function usePresetStyles(_ref) {
|
|
17
|
-
var preset = _ref.preset;
|
|
18
|
-
var resolved = preset != null && preset !== false ? preset : null;
|
|
19
|
-
(0, _react.useInsertionEffect)(function () {
|
|
20
|
-
if (resolved) {
|
|
21
|
-
(0, _ensurePresetStyles.ensurePresetStyles)({
|
|
22
|
-
preset: resolved
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}, [resolved]);
|
|
26
|
-
return resolved;
|
|
27
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-preset CSS injection.
|
|
3
|
-
*
|
|
4
|
-
* Each preset's CSS is injected at most once into `<head>`.
|
|
5
|
-
* Shared by both PopoverContent and DialogContent.
|
|
6
|
-
*
|
|
7
|
-
* Note: injected `<style>` elements and the tracking Set are append-only -
|
|
8
|
-
* they are never removed. This is intentional: the number of distinct
|
|
9
|
-
* presets is bounded (handful of animation presets), so the
|
|
10
|
-
* memory footprint is negligible. Removing styles would risk breaking
|
|
11
|
-
* other instances of the same preset that are still mounted.
|
|
12
|
-
*
|
|
13
|
-
* Decision (2026-03-17 audit): Accepted as a non-issue. The bounded
|
|
14
|
-
* preset count (~5 presets) makes cleanup unnecessary. We plan to move
|
|
15
|
-
* to a Compiled-based solution which will handle style injection and
|
|
16
|
-
* deduplication natively.
|
|
17
|
-
*/
|
|
18
|
-
const injectedPresets = new Set();
|
|
19
|
-
export function ensurePresetStyles({
|
|
20
|
-
preset
|
|
21
|
-
}) {
|
|
22
|
-
if (injectedPresets.has(preset.name) || typeof document === 'undefined') {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
injectedPresets.add(preset.name);
|
|
26
|
-
const style = document.createElement('style');
|
|
27
|
-
style.textContent = preset.css;
|
|
28
|
-
document.head.appendChild(style);
|
|
29
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useInsertionEffect } from 'react';
|
|
2
|
-
import { ensurePresetStyles } from './ensure-preset-styles';
|
|
3
|
-
/**
|
|
4
|
-
* Normalizes the `animate` prop to a preset (or null) and ensures its CSS
|
|
5
|
-
* is injected once into document.head. Used by PopupContent, Popover, and
|
|
6
|
-
* DialogContent so they do not duplicate this logic.
|
|
7
|
-
*/
|
|
8
|
-
export function useAnimationPreset(animate) {
|
|
9
|
-
const preset = animate != null && animate !== false ? animate : null;
|
|
10
|
-
useInsertionEffect(() => {
|
|
11
|
-
if (preset) {
|
|
12
|
-
ensurePresetStyles({
|
|
13
|
-
preset
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}, [preset]);
|
|
17
|
-
return preset;
|
|
18
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useInsertionEffect } from 'react';
|
|
2
|
-
import { ensurePresetStyles } from './ensure-preset-styles';
|
|
3
|
-
/**
|
|
4
|
-
* Normalizes a preset prop to a value (or null) and ensures its CSS
|
|
5
|
-
* is injected once into `document.head`.
|
|
6
|
-
*
|
|
7
|
-
* Works with any preset that has `{ css, name }` - animation presets
|
|
8
|
-
* (TAnimationPreset) satisfies this shape.
|
|
9
|
-
*/
|
|
10
|
-
export function usePresetStyles({
|
|
11
|
-
preset
|
|
12
|
-
}) {
|
|
13
|
-
const resolved = preset != null && preset !== false ? preset : null;
|
|
14
|
-
useInsertionEffect(() => {
|
|
15
|
-
if (resolved) {
|
|
16
|
-
ensurePresetStyles({
|
|
17
|
-
preset: resolved
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}, [resolved]);
|
|
21
|
-
return resolved;
|
|
22
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-preset CSS injection.
|
|
3
|
-
*
|
|
4
|
-
* Each preset's CSS is injected at most once into `<head>`.
|
|
5
|
-
* Shared by both PopoverContent and DialogContent.
|
|
6
|
-
*
|
|
7
|
-
* Note: injected `<style>` elements and the tracking Set are append-only -
|
|
8
|
-
* they are never removed. This is intentional: the number of distinct
|
|
9
|
-
* presets is bounded (handful of animation presets), so the
|
|
10
|
-
* memory footprint is negligible. Removing styles would risk breaking
|
|
11
|
-
* other instances of the same preset that are still mounted.
|
|
12
|
-
*
|
|
13
|
-
* Decision (2026-03-17 audit): Accepted as a non-issue. The bounded
|
|
14
|
-
* preset count (~5 presets) makes cleanup unnecessary. We plan to move
|
|
15
|
-
* to a Compiled-based solution which will handle style injection and
|
|
16
|
-
* deduplication natively.
|
|
17
|
-
*/
|
|
18
|
-
var injectedPresets = new Set();
|
|
19
|
-
export function ensurePresetStyles(_ref) {
|
|
20
|
-
var preset = _ref.preset;
|
|
21
|
-
if (injectedPresets.has(preset.name) || typeof document === 'undefined') {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
injectedPresets.add(preset.name);
|
|
25
|
-
var style = document.createElement('style');
|
|
26
|
-
style.textContent = preset.css;
|
|
27
|
-
document.head.appendChild(style);
|
|
28
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useInsertionEffect } from 'react';
|
|
2
|
-
import { ensurePresetStyles } from './ensure-preset-styles';
|
|
3
|
-
/**
|
|
4
|
-
* Normalizes the `animate` prop to a preset (or null) and ensures its CSS
|
|
5
|
-
* is injected once into document.head. Used by PopupContent, Popover, and
|
|
6
|
-
* DialogContent so they do not duplicate this logic.
|
|
7
|
-
*/
|
|
8
|
-
export function useAnimationPreset(animate) {
|
|
9
|
-
var preset = animate != null && animate !== false ? animate : null;
|
|
10
|
-
useInsertionEffect(function () {
|
|
11
|
-
if (preset) {
|
|
12
|
-
ensurePresetStyles({
|
|
13
|
-
preset: preset
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}, [preset]);
|
|
17
|
-
return preset;
|
|
18
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useInsertionEffect } from 'react';
|
|
2
|
-
import { ensurePresetStyles } from './ensure-preset-styles';
|
|
3
|
-
/**
|
|
4
|
-
* Normalizes a preset prop to a value (or null) and ensures its CSS
|
|
5
|
-
* is injected once into `document.head`.
|
|
6
|
-
*
|
|
7
|
-
* Works with any preset that has `{ css, name }` - animation presets
|
|
8
|
-
* (TAnimationPreset) satisfies this shape.
|
|
9
|
-
*/
|
|
10
|
-
export function usePresetStyles(_ref) {
|
|
11
|
-
var preset = _ref.preset;
|
|
12
|
-
var resolved = preset != null && preset !== false ? preset : null;
|
|
13
|
-
useInsertionEffect(function () {
|
|
14
|
-
if (resolved) {
|
|
15
|
-
ensurePresetStyles({
|
|
16
|
-
preset: resolved
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}, [resolved]);
|
|
20
|
-
return resolved;
|
|
21
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type TPresetWithCssAndName = {
|
|
2
|
-
css: string;
|
|
3
|
-
name: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Normalizes the `animate` prop to a preset (or null) and ensures its CSS
|
|
7
|
-
* is injected once into document.head. Used by PopupContent, Popover, and
|
|
8
|
-
* DialogContent so they do not duplicate this logic.
|
|
9
|
-
*/
|
|
10
|
-
export declare function useAnimationPreset<T extends TPresetWithCssAndName>(animate: T | false | null | undefined): T | null;
|
|
11
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
type TPresetWithCssAndName = {
|
|
2
|
-
css: string;
|
|
3
|
-
name: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Normalizes a preset prop to a value (or null) and ensures its CSS
|
|
7
|
-
* is injected once into `document.head`.
|
|
8
|
-
*
|
|
9
|
-
* Works with any preset that has `{ css, name }` - animation presets
|
|
10
|
-
* (TAnimationPreset) satisfies this shape.
|
|
11
|
-
*/
|
|
12
|
-
export declare function usePresetStyles<T extends TPresetWithCssAndName>({ preset, }: {
|
|
13
|
-
preset: T | false | null | undefined;
|
|
14
|
-
}): T | null;
|
|
15
|
-
export {};
|