@astryxdesign/core 0.7.5-canary.7e855c0 → 0.7.5-canary.85e48a0
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/dist/Layer/preserveAnimations.d.ts +11 -0
- package/dist/Layer/preserveAnimations.d.ts.map +1 -0
- package/dist/Layer/preserveAnimations.js +245 -0
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +154 -9
- package/dist/Layout/Layout.d.ts.map +1 -1
- package/dist/Layout/Layout.js +4 -0
- package/dist/Layout/LayoutContent.d.ts.map +1 -1
- package/dist/Layout/LayoutContent.js +2 -2
- package/dist/Layout/LayoutFooter.d.ts.map +1 -1
- package/dist/Layout/LayoutFooter.js +2 -1
- package/dist/Layout/LayoutHeader.d.ts.map +1 -1
- package/dist/Layout/LayoutHeader.js +2 -1
- package/dist/Layout/layoutEdges.stylex.d.ts +20 -0
- package/dist/Layout/layoutEdges.stylex.d.ts.map +1 -0
- package/dist/Layout/layoutEdges.stylex.js +28 -0
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +10 -2
- package/dist/SelectableCard/SelectableCard.d.ts +5 -5
- package/dist/SelectableCard/SelectableCard.js +5 -5
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +5 -5
- package/dist/Switch/switch.markers.stylex.d.ts +7 -2
- package/dist/Switch/switch.markers.stylex.d.ts.map +1 -1
- package/dist/Switch/switch.markers.stylex.js +8 -3
- package/dist/astryx.css +9 -6
- package/package.json +3 -3
- package/src/Layer/preserveAnimations.ts +304 -0
- package/src/Layer/useLayer.test.tsx +203 -0
- package/src/Layer/useLayer.tsx +162 -9
- package/src/Layout/Layout.tsx +18 -0
- package/src/Layout/LayoutContent.tsx +5 -14
- package/src/Layout/LayoutFooter.tsx +2 -0
- package/src/Layout/LayoutHeader.tsx +2 -0
- package/src/Layout/layoutEdges.stylex.ts +25 -0
- package/src/RadioList/RadioList.test.tsx +34 -7
- package/src/RadioList/RadioListItem.press.source-build.test.mjs +80 -0
- package/src/RadioList/RadioListItem.tsx +26 -12
- package/src/SelectableCard/SelectableCard.doc.mjs +6 -4
- package/src/SelectableCard/SelectableCard.tsx +5 -5
- package/src/Switch/Switch.focusRing.source-build.test.mjs +81 -0
- package/src/Switch/Switch.tsx +11 -9
- package/src/Switch/switch.markers.stylex.ts +7 -2
- package/src/Tooltip/__tests__/TooltipTallContentTracking.a11y.browser.spec.ts +1162 -0
- package/src/TopNav/TopNav.spec.md +190 -0
- package/src/TopNav/TopNavHeading.spec.md +204 -0
- package/src/TopNav/TopNavItem.spec.md +181 -0
- package/src/TopNav/TopNavMegaMenu.spec.md +190 -0
- package/src/TopNav/TopNavMegaMenuFeaturedCard.spec.md +150 -0
- package/src/TopNav/TopNavMegaMenuItem.spec.md +155 -0
- package/src/TopNav/TopNavMenu.spec.md +195 -0
- package/src/theme/derivedVarRegistry.test.ts +5 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run `reset`, which takes `root` out of rendering and back, and put every
|
|
3
|
+
* CSS animation and transition of `root` and its subtree back in the state it
|
|
4
|
+
* was in before. Recreated animations are matched to the ones they replace by
|
|
5
|
+
* element, pseudo-element and name, in order, and then by name alone (an
|
|
6
|
+
* effect script moved to another element or pseudo-element); a recreated
|
|
7
|
+
* animation with no predecessor (an entry animation that had already played
|
|
8
|
+
* and been dropped) is finished.
|
|
9
|
+
*/
|
|
10
|
+
export declare function preserveAnimations(root: Element, reset: () => void): void;
|
|
11
|
+
//# sourceMappingURL=preserveAnimations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preserveAnimations.d.ts","sourceRoot":"","sources":["../../src/Layer/preserveAnimations.ts"],"names":[],"mappings":"AAoPA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAkDzE"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file preserveAnimations.ts
|
|
5
|
+
* @input An element whose subtree is about to leave rendering for one forced
|
|
6
|
+
* layout, and the function that does it
|
|
7
|
+
* @output The same CSS animations and transitions afterwards, in the state
|
|
8
|
+
* they were in before
|
|
9
|
+
* @position Layer runtime; the re-placement of a layer that keeps its anchor
|
|
10
|
+
* clear (spec:AST-059 FR4)
|
|
11
|
+
*
|
|
12
|
+
* Taking an element out of rendering cancels every CSS animation and
|
|
13
|
+
* transition of it and its subtree. When it returns, the browser creates the
|
|
14
|
+
* animations again from the stylesheet, at their start, and the transitions
|
|
15
|
+
* not at all; script-created animations are untouched. `preserveAnimations`
|
|
16
|
+
* reads every animation's state first and, afterwards, gives each recreated
|
|
17
|
+
* CSS animation that state and resumes each cancelled transition with a
|
|
18
|
+
* script animation at the same point.
|
|
19
|
+
*
|
|
20
|
+
* The state is read generically, from what the platform exposes: every
|
|
21
|
+
* accessor with a setter on the animation's and its effect's prototype
|
|
22
|
+
* chains, every field of the effect's timing, and its keyframes. Only values
|
|
23
|
+
* that differ from the recreated animation's are written, so a value the
|
|
24
|
+
* stylesheet controls stays under its control. A few members are not plain
|
|
25
|
+
* state and are handled in their own step (`ORDERED`); the rest need no
|
|
26
|
+
* handling (`DERIVED`). What cannot be carried over is the Animation and
|
|
27
|
+
* effect objects themselves: the old ones are idle, their `addEventListener`
|
|
28
|
+
* listeners and `finished`/`ready` promises stay with them, and the browser
|
|
29
|
+
* fires `animationcancel`/`transitioncancel` for them and `animationstart`
|
|
30
|
+
* for the new ones.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Animation members written in a fixed order rather than generically: the
|
|
35
|
+
* timeline before the range that is measured on it, the rate before the
|
|
36
|
+
* time, and the start time (or, for a paused animation, the current time)
|
|
37
|
+
* last, once the play state is set. `effect` is not
|
|
38
|
+
* replaced, because a CSS animation whose effect script replaces leaves the
|
|
39
|
+
* stylesheet's control; its state is copied onto the new effect instead.
|
|
40
|
+
*/
|
|
41
|
+
const ORDERED = new Set(['effect', 'timeline', 'rangeStart', 'rangeEnd', 'playbackRate', 'startTime', 'currentTime']);
|
|
42
|
+
/** Every accessor with a setter on `object`'s prototype chain. */
|
|
43
|
+
function writableAccessors(object) {
|
|
44
|
+
const names = new Set();
|
|
45
|
+
for (let proto = Object.getPrototypeOf(object); proto != null && proto !== Object.prototype; proto = Object.getPrototypeOf(proto)) {
|
|
46
|
+
for (const [name, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(proto))) {
|
|
47
|
+
if (descriptor.set != null) {
|
|
48
|
+
names.add(name);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return [...names];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A textual form of a value that is compared by content rather than by
|
|
57
|
+
* identity: a CSS numeric value (as in a timeline range offset) through its
|
|
58
|
+
* serialization, a plain object (a range) through its members. Anything else
|
|
59
|
+
* is compared by identity (`null`).
|
|
60
|
+
*/
|
|
61
|
+
function contentOf(value) {
|
|
62
|
+
if (typeof CSSNumericValue !== 'undefined' && value instanceof CSSNumericValue) {
|
|
63
|
+
return value.toString();
|
|
64
|
+
}
|
|
65
|
+
if (value != null && typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype) {
|
|
66
|
+
return Object.entries(value).map(([key, inner]) => `${key}:${contentOf(inner) ?? String(inner)}`).join(';');
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
function differs(a, b) {
|
|
71
|
+
if (a === b) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const textA = contentOf(a);
|
|
75
|
+
return textA == null || textA !== contentOf(b);
|
|
76
|
+
}
|
|
77
|
+
function save(animation) {
|
|
78
|
+
const effect = animation.effect;
|
|
79
|
+
const values = {};
|
|
80
|
+
for (const name of writableAccessors(animation)) {
|
|
81
|
+
values[name] = animation[name];
|
|
82
|
+
}
|
|
83
|
+
const effectValues = {};
|
|
84
|
+
if (effect != null) {
|
|
85
|
+
for (const name of writableAccessors(effect)) {
|
|
86
|
+
effectValues[name] = effect[name];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
animation,
|
|
91
|
+
name: animation.animationName ?? '',
|
|
92
|
+
target: effect?.target ?? null,
|
|
93
|
+
pseudoElement: effect?.pseudoElement ?? null,
|
|
94
|
+
values,
|
|
95
|
+
effectValues,
|
|
96
|
+
timing: effect?.getTiming() ?? null,
|
|
97
|
+
keyframes: effect?.getKeyframes() ?? null,
|
|
98
|
+
playState: animation.playState,
|
|
99
|
+
replaceState: animation.replaceState
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function write(object, name, value) {
|
|
103
|
+
object[name] = value;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Give `next` the effect state `saved` had: every writable member. */
|
|
107
|
+
function restoreEffect(next, saved) {
|
|
108
|
+
for (const name of writableAccessors(next)) {
|
|
109
|
+
if (name in saved.effectValues && differs(saved.effectValues[name], next[name])) {
|
|
110
|
+
write(next, name, saved.effectValues[name]);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (saved.timing != null) {
|
|
114
|
+
const timing = next.getTiming();
|
|
115
|
+
const changed = {};
|
|
116
|
+
for (const [field, value] of Object.entries(saved.timing)) {
|
|
117
|
+
if (differs(value, timing[field])) {
|
|
118
|
+
changed[field] = value;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
if (Object.keys(changed).length > 0) {
|
|
122
|
+
next.updateTiming(changed);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (saved.keyframes != null && JSON.stringify(saved.keyframes) !== JSON.stringify(next.getKeyframes())) {
|
|
126
|
+
next.setKeyframes(saved.keyframes);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Give `next` the state `saved` had, member by member. */
|
|
131
|
+
function restore(next, saved) {
|
|
132
|
+
const effect = next.effect;
|
|
133
|
+
if (effect != null) {
|
|
134
|
+
restoreEffect(effect, saved);
|
|
135
|
+
}
|
|
136
|
+
const current = next;
|
|
137
|
+
for (const name of ['timeline', 'rangeStart', 'rangeEnd']) {
|
|
138
|
+
if (name in saved.values && differs(saved.values[name], current[name])) {
|
|
139
|
+
write(next, name, saved.values[name]);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
for (const name of writableAccessors(next)) {
|
|
143
|
+
if (!ORDERED.has(name) && name in saved.values && differs(saved.values[name], current[name])) {
|
|
144
|
+
write(next, name, saved.values[name]);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (saved.replaceState === 'persisted' && next.replaceState !== 'persisted') {
|
|
148
|
+
next.persist();
|
|
149
|
+
}
|
|
150
|
+
const rate = saved.values.playbackRate;
|
|
151
|
+
if (typeof rate === 'number' && rate !== next.playbackRate) {
|
|
152
|
+
next.playbackRate = rate;
|
|
153
|
+
}
|
|
154
|
+
if (saved.playState === 'paused' && next.playState !== 'paused') {
|
|
155
|
+
next.pause();
|
|
156
|
+
} else if (saved.playState !== 'paused' && next.playState === 'paused') {
|
|
157
|
+
next.play();
|
|
158
|
+
}
|
|
159
|
+
// A running animation is anchored to its timeline by its start time, which
|
|
160
|
+
// carries its current time on exactly. A paused one has none and keeps its
|
|
161
|
+
// current time. A finished one holds its end: finishing it again holds the
|
|
162
|
+
// same time, though its start time is then counted from now, since script
|
|
163
|
+
// cannot set a start time and a held time together.
|
|
164
|
+
const start = saved.values.startTime;
|
|
165
|
+
const time = saved.values.currentTime;
|
|
166
|
+
if (saved.playState === 'finished') {
|
|
167
|
+
next.finish();
|
|
168
|
+
} else if (start != null) {
|
|
169
|
+
next.startTime = start;
|
|
170
|
+
} else if (time != null) {
|
|
171
|
+
next.currentTime = time;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** Resume a cancelled CSS transition with a script animation in its state. */
|
|
176
|
+
function resumeTransition(saved) {
|
|
177
|
+
if (saved.target == null || saved.keyframes == null) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const replacement = saved.target.animate(saved.keyframes, {
|
|
181
|
+
pseudoElement: saved.pseudoElement ?? undefined
|
|
182
|
+
});
|
|
183
|
+
restore(replacement, saved);
|
|
184
|
+
}
|
|
185
|
+
function isTransition(animation) {
|
|
186
|
+
return typeof CSSTransition !== 'undefined' && animation instanceof CSSTransition;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Run `reset`, which takes `root` out of rendering and back, and put every
|
|
191
|
+
* CSS animation and transition of `root` and its subtree back in the state it
|
|
192
|
+
* was in before. Recreated animations are matched to the ones they replace by
|
|
193
|
+
* element, pseudo-element and name, in order, and then by name alone (an
|
|
194
|
+
* effect script moved to another element or pseudo-element); a recreated
|
|
195
|
+
* animation with no predecessor (an entry animation that had already played
|
|
196
|
+
* and been dropped) is finished.
|
|
197
|
+
*/
|
|
198
|
+
export function preserveAnimations(root, reset) {
|
|
199
|
+
if (typeof root.getAnimations !== 'function') {
|
|
200
|
+
reset();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const before = root.getAnimations({
|
|
204
|
+
subtree: true
|
|
205
|
+
});
|
|
206
|
+
const saved = before.map(save);
|
|
207
|
+
reset();
|
|
208
|
+
const after = root.getAnimations({
|
|
209
|
+
subtree: true
|
|
210
|
+
});
|
|
211
|
+
const current = new Set(after);
|
|
212
|
+
const survivors = new Set(before);
|
|
213
|
+
const cancelled = [];
|
|
214
|
+
for (const state of saved) {
|
|
215
|
+
if (current.has(state.animation)) {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
if (isTransition(state.animation)) {
|
|
219
|
+
resumeTransition(state);
|
|
220
|
+
} else {
|
|
221
|
+
cancelled.push(state);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const recreated = after.filter(animation => !survivors.has(animation));
|
|
225
|
+
const unmatched = [];
|
|
226
|
+
for (const animation of recreated) {
|
|
227
|
+
const effect = animation.effect;
|
|
228
|
+
const name = animation.animationName ?? '';
|
|
229
|
+
const index = cancelled.findIndex(state => state.name === name && state.target === (effect?.target ?? null) && state.pseudoElement === (effect?.pseudoElement ?? null));
|
|
230
|
+
if (index === -1) {
|
|
231
|
+
unmatched.push(animation);
|
|
232
|
+
} else {
|
|
233
|
+
restore(animation, cancelled.splice(index, 1)[0]);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
for (const animation of unmatched) {
|
|
237
|
+
const name = animation.animationName ?? '';
|
|
238
|
+
const index = cancelled.findIndex(state => state.name === name);
|
|
239
|
+
if (index === -1) {
|
|
240
|
+
animation.finish();
|
|
241
|
+
} else {
|
|
242
|
+
restore(animation, cancelled.splice(index, 1)[0]);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLayer.d.ts","sourceRoot":"","sources":["../../src/Layer/useLayer.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"useLayer.d.ts","sourceRoot":"","sources":["../../src/Layer/useLayer.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAOZ,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AA+HnD;;GAEG;AACH,UAAU,kBAAkB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Inset.stylex.js";
|
|
27
27
|
import { layerInsetProperties } from "./layerInset.js";
|
|
28
28
|
import { LAYER_CLEARANCE_PROPERTY, LAYER_CLEARS_ANCHOR_ATTRIBUTE, LAYER_SCROLLS_ATTRIBUTE, LAYER_CLEAR_FALLBACKS_PROPERTY, LAYER_TRY_FALLBACKS_PROPERTY, ensureSlideRules, getAnchorClearFallbacks, slideRuleName } from "./layerSlideRules.js";
|
|
29
|
+
import { preserveAnimations } from "./preserveAnimations.js";
|
|
29
30
|
import { useLayerContext } from "./LayerContext.js";
|
|
30
31
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
31
32
|
import { overlayPaddingReset } from "../Layout/padding.stylex.js";
|
|
@@ -176,6 +177,24 @@ const styles = {
|
|
|
176
177
|
function toCssLength(value) {
|
|
177
178
|
return typeof value === 'number' ? `${value}px` : value;
|
|
178
179
|
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Make the engine choose a shown layer's position option afresh: a browser
|
|
183
|
+
* keeps a laid-out layer on the option it last used until the layer stops
|
|
184
|
+
* being rendered, so the layer is taken out of rendering for one forced
|
|
185
|
+
* layout and restored, in the same task. No frame paints in between and the
|
|
186
|
+
* popover stays open, so no toggle event fires and focus and hover are
|
|
187
|
+
* untouched. Every CSS animation and transition of the layer and its content
|
|
188
|
+
* is put back in the state it was in (`preserveAnimations`).
|
|
189
|
+
*/
|
|
190
|
+
function placeAfresh(layer) {
|
|
191
|
+
preserveAnimations(layer, () => {
|
|
192
|
+
const display = layer.style.display;
|
|
193
|
+
layer.style.display = 'none';
|
|
194
|
+
layer.getBoundingClientRect();
|
|
195
|
+
layer.style.display = display;
|
|
196
|
+
});
|
|
197
|
+
}
|
|
179
198
|
const TRANSFORM_PROPERTIES = ['transform', 'translate', 'scale', 'rotate'];
|
|
180
199
|
function hasTransform(style) {
|
|
181
200
|
return TRANSFORM_PROPERTIES.some(name => {
|
|
@@ -307,27 +326,151 @@ function failsAnchor(layer, anchor) {
|
|
|
307
326
|
* standard list has failed it. The runtime calls this in the same task as
|
|
308
327
|
* every show and remount, and while the layer is open whenever its size, its
|
|
309
328
|
* content's size, its anchor's size or the viewport changes; each of those
|
|
310
|
-
* reads lands before the next frame paints
|
|
311
|
-
*
|
|
312
|
-
*
|
|
329
|
+
* reads lands before the next frame paints. A same-size anchor that moves on
|
|
330
|
+
* screen, in layout or because something scrolled, is read after paint, from
|
|
331
|
+
* the anchor-move observer (FR8). Scroll events are not read: during one the
|
|
332
|
+
* anchor has moved but the layer anchored to it not yet, so the read would
|
|
333
|
+
* compare a moved anchor with a stale layer. Once switched, a layer keeps its
|
|
334
|
+
* anchor-clear list until it next opens, so it never jumps back over its
|
|
335
|
+
* trigger while open; it is placed afresh (`placeAfresh`) only when the switch
|
|
336
|
+
* does not take effect at once, or when a later read finds it failing again.
|
|
313
337
|
*/
|
|
314
338
|
function keepAnchorClear(layer, anchor) {
|
|
315
339
|
if (anchor && failsAnchor(layer, anchor)) {
|
|
340
|
+
const switching = !layer.hasAttribute(LAYER_CLEARS_ANCHOR_ATTRIBUTE);
|
|
316
341
|
layer.setAttribute(LAYER_CLEARS_ANCHOR_ATTRIBUTE, '');
|
|
342
|
+
// A switch usually takes effect at once. The engine may instead keep the
|
|
343
|
+
// option it last used, even one the new list does not contain or one a
|
|
344
|
+
// scroll has since made fail: then, and on any later read that finds the
|
|
345
|
+
// switched layer failing again, place it afresh.
|
|
346
|
+
if (!switching || failsAnchor(layer, anchor)) {
|
|
347
|
+
placeAfresh(layer);
|
|
348
|
+
}
|
|
317
349
|
}
|
|
318
350
|
// A layer that fits has no scroll range and stays a plain box, so a wheel
|
|
319
351
|
// over it still scrolls the page.
|
|
320
352
|
layer.toggleAttribute(LAYER_SCROLLS_ATTRIBUTE, layer.scrollHeight > layer.clientHeight + 1);
|
|
321
353
|
}
|
|
322
354
|
|
|
355
|
+
/**
|
|
356
|
+
* Call `onMove` when an element moves on screen without changing size: in
|
|
357
|
+
* layout (a sibling above it grows, a margin changes) or because something
|
|
358
|
+
* scrolled. ResizeObserver sees only size. The element is observed by an
|
|
359
|
+
* IntersectionObserver whose root is the viewport shrunk, through
|
|
360
|
+
* `rootMargin`, to the element's own rectangle (the layout-shift technique of
|
|
361
|
+
* `@floating-ui/dom`'s `observeMove`), so any move changes the intersection
|
|
362
|
+
* ratio and fires the callback, which calls `onMove` and re-arms on the new
|
|
363
|
+
* rectangle. Intersection callbacks run after the frame that moved the
|
|
364
|
+
* element has painted, so the caller corrects that move in the next frame.
|
|
365
|
+
*
|
|
366
|
+
* A fresh observer's first report can already differ from its threshold: the
|
|
367
|
+
* element is partly outside the viewport, or it kept moving between the
|
|
368
|
+
* rectangle read and the observer's first check, as it does every frame of a
|
|
369
|
+
* smooth scroll. Any such report calls `onMove` and re-arms, at the reported
|
|
370
|
+
* ratio, or at once on the element's new rectangle when the report is 0 and
|
|
371
|
+
* the element moved, so a move that spans many frames is followed frame by
|
|
372
|
+
* frame. A report of 0 for an element that has not moved means a scrolled
|
|
373
|
+
* container clips it wholly; re-arming then would report 0 again every frame.
|
|
374
|
+
* Instead a second IntersectionObserver, rooted at the viewport with a
|
|
375
|
+
* threshold of 0 (it counts every ancestor's overflow clip), waits for the
|
|
376
|
+
* element to come back into view, then calls `onMove` and re-arms. Nothing
|
|
377
|
+
* runs on a timer. Returns the function that stops observing.
|
|
378
|
+
*/
|
|
379
|
+
function observeMove(element, onMove) {
|
|
380
|
+
const doc = element.ownerDocument;
|
|
381
|
+
if (typeof IntersectionObserver === 'undefined') {
|
|
382
|
+
return () => {};
|
|
383
|
+
}
|
|
384
|
+
let observer = null;
|
|
385
|
+
let visibility = null;
|
|
386
|
+
const stop = () => {
|
|
387
|
+
observer?.disconnect();
|
|
388
|
+
observer = null;
|
|
389
|
+
visibility?.disconnect();
|
|
390
|
+
visibility = null;
|
|
391
|
+
};
|
|
392
|
+
const moved = threshold => {
|
|
393
|
+
onMove();
|
|
394
|
+
arm(threshold);
|
|
395
|
+
};
|
|
396
|
+
const arm = threshold => {
|
|
397
|
+
stop();
|
|
398
|
+
const root = doc.documentElement;
|
|
399
|
+
const rect = element.getBoundingClientRect();
|
|
400
|
+
if (rect.width === 0 || rect.height === 0) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const top = Math.floor(rect.top);
|
|
404
|
+
const left = Math.floor(rect.left);
|
|
405
|
+
const right = Math.floor(root.clientWidth - rect.right);
|
|
406
|
+
const bottom = Math.floor(root.clientHeight - rect.bottom);
|
|
407
|
+
const hasMoved = () => {
|
|
408
|
+
const now = element.getBoundingClientRect();
|
|
409
|
+
return now.top !== rect.top || now.left !== rect.left || now.width !== rect.width || now.height !== rect.height;
|
|
410
|
+
};
|
|
411
|
+
// Clipped by a scrolled container: wait, without a timer, for the
|
|
412
|
+
// element to come back into view. A first report that already finds it
|
|
413
|
+
// in view only counts if it has moved, so a clip the move observer and
|
|
414
|
+
// this one judge differently cannot re-arm every frame.
|
|
415
|
+
const awaitVisible = () => {
|
|
416
|
+
let isFirstVisible = true;
|
|
417
|
+
visibility = new IntersectionObserver(entries => {
|
|
418
|
+
const visible = entries[entries.length - 1]?.isIntersecting ?? false;
|
|
419
|
+
const firstVisible = isFirstVisible;
|
|
420
|
+
isFirstVisible = false;
|
|
421
|
+
if (visible && (!firstVisible || hasMoved())) {
|
|
422
|
+
moved(1);
|
|
423
|
+
}
|
|
424
|
+
}, {
|
|
425
|
+
root: doc,
|
|
426
|
+
threshold: 0
|
|
427
|
+
});
|
|
428
|
+
visibility.observe(element);
|
|
429
|
+
};
|
|
430
|
+
let isFirst = true;
|
|
431
|
+
observer = new IntersectionObserver(entries => {
|
|
432
|
+
const ratio = entries[entries.length - 1]?.intersectionRatio ?? 0;
|
|
433
|
+
const first = isFirst;
|
|
434
|
+
isFirst = false;
|
|
435
|
+
if (ratio === threshold) {
|
|
436
|
+
// Still over its own rectangle, but a move smaller than the
|
|
437
|
+
// rounding of the root margin can leave the ratio at 1.
|
|
438
|
+
if (ratio === 1 && hasMoved()) {
|
|
439
|
+
moved(1);
|
|
440
|
+
}
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (!first || ratio > 0) {
|
|
444
|
+
moved(first ? ratio : 1);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
if (hasMoved()) {
|
|
448
|
+
moved(1);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
if (visibility === null) {
|
|
452
|
+
awaitVisible();
|
|
453
|
+
}
|
|
454
|
+
}, {
|
|
455
|
+
root: doc,
|
|
456
|
+
rootMargin: `${-top}px ${-right}px ${-bottom}px ${-left}px`,
|
|
457
|
+
threshold
|
|
458
|
+
});
|
|
459
|
+
observer.observe(element);
|
|
460
|
+
};
|
|
461
|
+
arm(1);
|
|
462
|
+
return stop;
|
|
463
|
+
}
|
|
464
|
+
|
|
323
465
|
/**
|
|
324
466
|
* Watch an open layer that keeps its anchor clear, and its anchor, for every
|
|
325
467
|
* change that can re-settle the layer over the anchor or give it a scroll
|
|
326
468
|
* range (spec:AST-059 FR4, FR8): the layer, its content or the anchor
|
|
327
|
-
* resizing (ResizeObserver)
|
|
328
|
-
* the
|
|
329
|
-
*
|
|
330
|
-
*
|
|
469
|
+
* resizing (ResizeObserver, before paint), the viewport resizing (before
|
|
470
|
+
* paint), and the anchor moving on screen without resizing, in layout or by a
|
|
471
|
+
* scroll (`observeMove`, after paint). Each calls `keepAnchorClear` for this layer and anchor while
|
|
472
|
+
* `isCurrent` says they are still the live pair. Returns the function that
|
|
473
|
+
* removes every observer and listener it added.
|
|
331
474
|
*/
|
|
332
475
|
function observeAnchorClearance(layer, anchor, isCurrent) {
|
|
333
476
|
const view = layer.ownerDocument.defaultView;
|
|
@@ -348,9 +491,11 @@ function observeAnchorClearance(layer, anchor, isCurrent) {
|
|
|
348
491
|
}
|
|
349
492
|
observer.observe(anchor);
|
|
350
493
|
}
|
|
494
|
+
const stopObservingMove = observeMove(anchor, reread);
|
|
351
495
|
view.addEventListener('resize', reread);
|
|
352
496
|
return () => {
|
|
353
497
|
observer?.disconnect();
|
|
498
|
+
stopObservingMove();
|
|
354
499
|
view.removeEventListener('resize', reread);
|
|
355
500
|
};
|
|
356
501
|
}
|
|
@@ -984,8 +1129,8 @@ function useLayerImplementation(options) {
|
|
|
984
1129
|
}, [isOpen, mode, updateAnchorInView]);
|
|
985
1130
|
|
|
986
1131
|
// A layer that keeps its anchor clear (FR4) re-reads its geometry while it
|
|
987
|
-
// is open: content that grows, an anchor that resizes or
|
|
988
|
-
// can each re-settle the standard list over the anchor or
|
|
1132
|
+
// is open: content that grows, an anchor that resizes or moves (in layout or
|
|
1133
|
+
// by a scroll) or a viewport resize can each re-settle the standard list over the anchor or
|
|
989
1134
|
// give the layer a scroll range (`observeAnchorClearance`). The external
|
|
990
1135
|
// systems are those browser observers and listeners; this effect binds them
|
|
991
1136
|
// while the layer is open and removes them when it closes, unmounts or is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/Layout/Layout.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/Layout/Layout.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAU,MAAM,OAAO,CAAC;AAS9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAO3D;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAoJ3C,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;IAC7D;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IAEzB;;OAEG;IACH,GAAG,CAAC,EAAE,SAAS,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAkBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,GAAG,EACH,MAAM,EACN,MAAM,EACN,MAAe,EACf,OAAO,EACP,GAAG,EACH,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACb,EAAE,WAAW,+BAsGb;yBAtHe,MAAM"}
|
package/dist/Layout/Layout.js
CHANGED
|
@@ -24,6 +24,8 @@ import { LayoutDividerContext } from "./LayoutDividerContext.js";
|
|
|
24
24
|
import { stack } from "../Stack/stack.stylex.js";
|
|
25
25
|
import { stackItem } from "../Stack/stackItem.stylex.js";
|
|
26
26
|
import { mergeProps } from "../utils/index.js";
|
|
27
|
+
import "./layoutEdges.stylex.js";
|
|
28
|
+
import { layoutFooterMarker, layoutHeaderMarker } from "./layoutEdges.stylex.js";
|
|
27
29
|
import { themeProps } from "../utils/themeProps.js";
|
|
28
30
|
import { layoutPaddingOuterXVarStyles, layoutPaddingOuterYVarStyles } from "./padding.stylex.js";
|
|
29
31
|
|
|
@@ -79,6 +81,8 @@ const styles = {
|
|
|
79
81
|
middle: {
|
|
80
82
|
kUk6DE: "x98rzlu",
|
|
81
83
|
kAzted: "x2lwn1j",
|
|
84
|
+
"--_layout-flush-block-start": "x1akq5vd",
|
|
85
|
+
"--_layout-flush-block-end": "x51rtne",
|
|
82
86
|
$$css: true
|
|
83
87
|
},
|
|
84
88
|
middleQuery: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutContent.d.ts","sourceRoot":"","sources":["../../src/Layout/LayoutContent.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAM5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"LayoutContent.d.ts","sourceRoot":"","sources":["../../src/Layout/LayoutContent.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAM5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAqFhD,MAAM,WAAW,kBAAmB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACnE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,YAAmB,EACnB,OAAO,EACP,KAAK,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,kBAAkB,+BAkDpB;yBA7De,aAAa"}
|
|
@@ -32,8 +32,8 @@ const styles = {
|
|
|
32
32
|
kVQacm: "x7giv3",
|
|
33
33
|
kZCmMZ: "xwjyata",
|
|
34
34
|
kwRFfy: "x1peupej",
|
|
35
|
-
kLKAdn: "
|
|
36
|
-
kGO01o: "
|
|
35
|
+
kLKAdn: "x1q01h0h",
|
|
36
|
+
kGO01o: "x12g7ifj",
|
|
37
37
|
"--container-padding-inline-start": "x408pgh",
|
|
38
38
|
"--container-padding-inline-end": "xikqloz",
|
|
39
39
|
"--container-padding-block-start": "xjmgx01",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutFooter.d.ts","sourceRoot":"","sources":["../../src/Layout/LayoutFooter.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"LayoutFooter.d.ts","sourceRoot":"","sources":["../../src/Layout/LayoutFooter.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAO5C,OAAO,KAAK,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAsD3D,MAAM,WAAW,iBAAkB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAClE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,UAAU,EACV,MAAM,EACN,KAAK,EACL,OAAO,EACP,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAuCnB;yBAnDe,YAAY"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { use } from 'react';
|
|
18
18
|
import * as stylex from '@stylexjs/stylex';
|
|
19
|
+
import { layoutFooterMarker } from "./layoutEdges.stylex.js";
|
|
19
20
|
import { LayoutDividerContext } from "./LayoutDividerContext.js";
|
|
20
21
|
import "../theme/tokens.stylex.js";
|
|
21
22
|
import { colorVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
@@ -108,7 +109,7 @@ export function LayoutFooter({
|
|
|
108
109
|
role: role,
|
|
109
110
|
"aria-label": label,
|
|
110
111
|
"data-divider": resolvedHasDivider || undefined,
|
|
111
|
-
...mergeProps(themeProps('layout-footer'), stylex.props(styles.footer, dynamicStyles.sizing(height ?? null), resolvedHasDivider && styles.divider, xstyle), className, style),
|
|
112
|
+
...mergeProps(themeProps('layout-footer'), stylex.props(layoutFooterMarker, styles.footer, dynamicStyles.sizing(height ?? null), resolvedHasDivider && styles.divider, xstyle), className, style),
|
|
112
113
|
...props,
|
|
113
114
|
children: /*#__PURE__*/_jsx("div", {
|
|
114
115
|
...stylex.props(styles.inner, isZeroPadding && styles.fullBleed, padding != null && paddingStyles[padding], padding != null && containerPaddingInlineVarStyles[padding], padding != null && containerPaddingBlockStartVarStyles[padding], padding != null && containerPaddingBlockEndVarStyles[padding]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutHeader.d.ts","sourceRoot":"","sources":["../../src/Layout/LayoutHeader.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"LayoutHeader.d.ts","sourceRoot":"","sources":["../../src/Layout/LayoutHeader.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAO5C,OAAO,KAAK,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAuD3D,MAAM,WAAW,iBAAkB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAClE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,WAAW,CAAC;IAE9B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,UAAU,EACV,MAAM,EACN,KAAK,EACL,OAAO,EACP,eAAe,EACf,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,iBAAiB,+BA6CnB;yBA1De,YAAY"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { use } from 'react';
|
|
19
19
|
import * as stylex from '@stylexjs/stylex';
|
|
20
|
+
import { layoutHeaderMarker } from "./layoutEdges.stylex.js";
|
|
20
21
|
import { LayoutDividerContext } from "./LayoutDividerContext.js";
|
|
21
22
|
import "../theme/tokens.stylex.js";
|
|
22
23
|
import { colorVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
@@ -110,7 +111,7 @@ export function LayoutHeader({
|
|
|
110
111
|
role: role,
|
|
111
112
|
"aria-label": label,
|
|
112
113
|
"data-divider": resolvedHasDivider || undefined,
|
|
113
|
-
...mergeProps(themeProps('layout-header'), stylex.props(styles.header, dynamicStyles.sizing(height ?? null), resolvedHasDivider && styles.divider, xstyle), className, style),
|
|
114
|
+
...mergeProps(themeProps('layout-header'), stylex.props(layoutHeaderMarker, styles.header, dynamicStyles.sizing(height ?? null), resolvedHasDivider && styles.divider, xstyle), className, style),
|
|
114
115
|
...props,
|
|
115
116
|
children: /*#__PURE__*/_jsx("div", {
|
|
116
117
|
...stylex.props(styles.inner, isZeroPadding && styles.fullBleed, padding != null && paddingStyles[padding], padding != null && containerPaddingInlineVarStyles[padding], padding != null && containerPaddingBlockStartVarStyles[padding], padding != null && containerPaddingBlockEndVarStyles[padding],
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file layoutEdges.stylex.ts
|
|
3
|
+
* @input StyleX markers
|
|
4
|
+
* @output Exports layoutHeaderMarker and layoutFooterMarker
|
|
5
|
+
* @position Internal markers LayoutHeader and LayoutFooter carry on their own
|
|
6
|
+
* element, so Layout's middle row can tell whether a divider-less header
|
|
7
|
+
* precedes it or a divider-less footer follows it with sibling relations
|
|
8
|
+
* alone, instead of a `:has()` on the layout followed by `*`, which makes
|
|
9
|
+
* engines restyle the whole layout on any change inside it
|
|
10
|
+
*
|
|
11
|
+
* SYNC: When modified, update:
|
|
12
|
+
* - /packages/core/src/Layout/Layout.tsx
|
|
13
|
+
* - /packages/core/src/Layout/LayoutHeader.tsx
|
|
14
|
+
* - /packages/core/src/Layout/LayoutFooter.tsx
|
|
15
|
+
* - /packages/core/src/Layout/LayoutContent.tsx
|
|
16
|
+
*/
|
|
17
|
+
import * as stylex from '@stylexjs/stylex';
|
|
18
|
+
export declare const layoutHeaderMarker: ReturnType<typeof stylex.defineMarker>;
|
|
19
|
+
export declare const layoutFooterMarker: ReturnType<typeof stylex.defineMarker>;
|
|
20
|
+
//# sourceMappingURL=layoutEdges.stylex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layoutEdges.stylex.d.ts","sourceRoot":"","sources":["../../src/Layout/layoutEdges.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,YAAY,CAC/C,CAAC;AACxB,eAAO,MAAM,kBAAkB,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,YAAY,CAC/C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file layoutEdges.stylex.ts
|
|
5
|
+
* @input StyleX markers
|
|
6
|
+
* @output Exports layoutHeaderMarker and layoutFooterMarker
|
|
7
|
+
* @position Internal markers LayoutHeader and LayoutFooter carry on their own
|
|
8
|
+
* element, so Layout's middle row can tell whether a divider-less header
|
|
9
|
+
* precedes it or a divider-less footer follows it with sibling relations
|
|
10
|
+
* alone, instead of a `:has()` on the layout followed by `*`, which makes
|
|
11
|
+
* engines restyle the whole layout on any change inside it
|
|
12
|
+
*
|
|
13
|
+
* SYNC: When modified, update:
|
|
14
|
+
* - /packages/core/src/Layout/Layout.tsx
|
|
15
|
+
* - /packages/core/src/Layout/LayoutHeader.tsx
|
|
16
|
+
* - /packages/core/src/Layout/LayoutFooter.tsx
|
|
17
|
+
* - /packages/core/src/Layout/LayoutContent.tsx
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import * as stylex from '@stylexjs/stylex';
|
|
21
|
+
export const layoutHeaderMarker = {
|
|
22
|
+
xo0ftvq: "xo0ftvq",
|
|
23
|
+
$$css: true
|
|
24
|
+
};
|
|
25
|
+
export const layoutFooterMarker = {
|
|
26
|
+
x1sz7nw1: "x1sz7nw1",
|
|
27
|
+
$$css: true
|
|
28
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioListItem.d.ts","sourceRoot":"","sources":["../../src/RadioList/RadioListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,EAAqB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGhE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAQ5C,OAAO,EAAO,KAAK,SAAS,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioListItem.d.ts","sourceRoot":"","sources":["../../src/RadioList/RadioListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,EAAqB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGhE,OAAO,KAA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