@oxy.so/bloom 1.0.8 → 1.1.1
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/docs/content-panel.mdx +26 -0
- package/lib/commonjs/content-panel/ContentPanel.web.js +75 -5
- package/lib/commonjs/content-panel/ContentPanel.web.js.map +1 -1
- package/lib/module/content-panel/ContentPanel.web.js +75 -5
- package/lib/module/content-panel/ContentPanel.web.js.map +1 -1
- package/lib/typescript/commonjs/content-panel/ContentPanel.web.d.ts +31 -0
- package/lib/typescript/commonjs/content-panel/ContentPanel.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/content-panel/types.d.ts +36 -0
- package/lib/typescript/commonjs/content-panel/types.d.ts.map +1 -1
- package/lib/typescript/module/content-panel/ContentPanel.web.d.ts +31 -0
- package/lib/typescript/module/content-panel/ContentPanel.web.d.ts.map +1 -1
- package/lib/typescript/module/content-panel/types.d.ts +36 -0
- package/lib/typescript/module/content-panel/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/content-panel/ContentPanel.web.tsx +88 -11
- package/src/content-panel/types.ts +36 -0
- package/src/__tests__/support/collision-fixture-barrel.ts +0 -20
- package/src/__tests__/support/constructed-style-sheets.ts +0 -68
- package/src/__tests__/support/press-host.ts +0 -30
- package/src/__tests__/support/rendered-style.ts +0 -99
- package/src/__tests__/support/unread-hook-fixture.ts +0 -33
- package/src/theme/__tests__/__fixtures__/golden-resolved-tokens.json +0 -7682
- package/src/theme/__tests__/fixtures/color-engine-golden.json +0 -1
package/docs/content-panel.mdx
CHANGED
|
@@ -28,6 +28,32 @@ import { ContentPanel } from '@oxy.so/bloom/content-panel';
|
|
|
28
28
|
| `surfaceStyle` / `surfaceClassName` | the surface itself |
|
|
29
29
|
| `contentStyle` / `contentClassName` | the column inside it |
|
|
30
30
|
| `maskColor` | the colour the gutter mask fades to |
|
|
31
|
+
| `overlaySizing` | (web) how the mask/border overlays size themselves — see below |
|
|
32
|
+
|
|
33
|
+
## `overlaySizing`: viewport chrome vs. a bounded shell
|
|
34
|
+
|
|
35
|
+
The web overlays default to `overlaySizing="viewport"`: sized to `100dvh` and
|
|
36
|
+
`position: sticky`-pinned, so they read as a constant frame around the visible
|
|
37
|
+
slice of a panel whose own DOM height can exceed one screen — the right choice
|
|
38
|
+
in a document that actually scrolls (a feed page that grows with content).
|
|
39
|
+
|
|
40
|
+
A consumer whose OWN shell already bounds the panel's height — a fixed app
|
|
41
|
+
shell with its own internal scroll containers, no document scroll — doesn't
|
|
42
|
+
have that problem, and viewport-sizing there is actively wrong: the overlay
|
|
43
|
+
still reads `100dvh` regardless of how much of the viewport is actually the
|
|
44
|
+
panel's, so anything placed OUTSIDE the panel (a header above it, say) gets
|
|
45
|
+
painted over. `overlaySizing="panel"` fixes that: the overlays size to the
|
|
46
|
+
panel's own real box via CSS Grid layer-stacking instead of viewport math, so
|
|
47
|
+
they never extend past whatever height the panel actually has.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<View style={{ flex: 1 }}>
|
|
51
|
+
<ExternalHeader />
|
|
52
|
+
<ContentPanel framed overlaySizing="panel">
|
|
53
|
+
<SettingsScreen />
|
|
54
|
+
</ContentPanel>
|
|
55
|
+
</View>
|
|
56
|
+
```
|
|
31
57
|
|
|
32
58
|
## `framedFrom` is why the branch is not in your screen
|
|
33
59
|
|
|
@@ -35,6 +35,37 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
35
35
|
* content rather than displacing it). They render BEFORE the content wrapper so
|
|
36
36
|
* z-index — not DOM order — decides layering.
|
|
37
37
|
*
|
|
38
|
+
* That sticky/`100dvh` sizing is itself a CHOICE, not the only mode — see
|
|
39
|
+
* `overlaySizing`. It is correct exactly when the panel's own DOM height can
|
|
40
|
+
* exceed one viewport in a document that actually scrolls (dvh gives the
|
|
41
|
+
* overlay a fixed, viewport-sized height that a percentage cannot: percentage
|
|
42
|
+
* heights need a definite ancestor height, which an auto-height document-flow
|
|
43
|
+
* ancestor never has). A consumer whose OWN shell already bounds the panel's
|
|
44
|
+
* height (no document scroll) doesn't have that problem, and viewport-sizing
|
|
45
|
+
* there is actively wrong — the overlay reads `100dvh` regardless of how much
|
|
46
|
+
* of the viewport is actually the panel's, so anything the consumer placed
|
|
47
|
+
* outside the panel (a header above it, say) gets painted over.
|
|
48
|
+
* `overlaySizing="panel"` is that second mode: CSS Grid layer-stacking (every
|
|
49
|
+
* child placed in the same `grid-area: 1/1`) instead of sticky/dvh/negative-
|
|
50
|
+
* margin — each child fills exactly the grid cell, i.e. exactly the panel's
|
|
51
|
+
* own box, whatever that box's real height is. No `position: absolute` (that
|
|
52
|
+
* takes the content wrapper out of flow, which is not what "panel" mode
|
|
53
|
+
* changes — only the two overlays' sizing mechanism changes) and no percentage
|
|
54
|
+
* margin (the well-known CSS quirk where a vertical margin percentage resolves
|
|
55
|
+
* against the containing block's WIDTH, not its height, so it cannot express
|
|
56
|
+
* "100% of my own height" at all).
|
|
57
|
+
*
|
|
58
|
+
* The bleed-mask's `clip-path` also changes with the mode, not just its box
|
|
59
|
+
* size: `inset(-12px)` (viewport mode) is a deliberate small halo — the
|
|
60
|
+
* `box-shadow`'s `GUTTER_MASK_SPREAD` is 40px, and the clip-path caps how much
|
|
61
|
+
* of that is actually allowed to paint past the box edge. A document-scroll
|
|
62
|
+
* consumer has nothing else positioned right above/below the panel for that
|
|
63
|
+
* halo to land on. A bounded-shell consumer might — the whole reason for
|
|
64
|
+
* `overlaySizing="panel"` is that something IS placed right outside the panel
|
|
65
|
+
* — so panel mode clips the shadow flush to the box (`inset(0)`, zero bleed)
|
|
66
|
+
* rather than merely resizing the box and leaving a smaller bleed that could
|
|
67
|
+
* still reach a close sibling.
|
|
68
|
+
*
|
|
38
69
|
* Framing is tri-state via the `framed` prop:
|
|
39
70
|
*
|
|
40
71
|
* - `undefined` (DEFAULT) → RESPONSIVE, driven purely by NativeWind: full-bleed
|
|
@@ -116,7 +147,9 @@ const ContentPanelComponent = ({
|
|
|
116
147
|
contentClassName,
|
|
117
148
|
contentStyle,
|
|
118
149
|
showStickyFrame,
|
|
119
|
-
maskColor
|
|
150
|
+
maskColor,
|
|
151
|
+
overlaySizing = 'viewport',
|
|
152
|
+
overlayTopOffset
|
|
120
153
|
}) => {
|
|
121
154
|
// Dev-only invariant — must run unconditionally (before deriving any
|
|
122
155
|
// mode-specific branch) so the hook order stays stable (rules of hooks).
|
|
@@ -132,6 +165,7 @@ const ContentPanelComponent = ({
|
|
|
132
165
|
// Responsive mode selects a pre-shipped literal breakpoint bundle by value;
|
|
133
166
|
// `framed === true`/`false` ignore `framedFrom` (fixed always/never framing).
|
|
134
167
|
const bp = RESPONSIVE_WEB[framedFrom];
|
|
168
|
+
const boundToPanel = overlaySizing === 'panel';
|
|
135
169
|
|
|
136
170
|
// Whole literal class strings selected per mode (the Tailwind content-scan
|
|
137
171
|
// over `lib/**` requires each arbitrary/`min-*`/`max-*`/`web:` token stay
|
|
@@ -139,23 +173,59 @@ const ContentPanelComponent = ({
|
|
|
139
173
|
// only spliced in, never assembled from parts).
|
|
140
174
|
const surfaceBase = responsive ? `flex-1 ${bp.surface}` : framed ? 'flex-1 rounded-radius-28' : 'flex-1';
|
|
141
175
|
const contentBase = responsive ? `flex-1 ${bp.content}` : framed ? 'flex-1 rounded-radius-28 web:overflow-x-clip' : 'flex-1';
|
|
142
|
-
|
|
143
|
-
|
|
176
|
+
// `overlaySizing="panel"`: the surface becomes a single-cell CSS Grid so the
|
|
177
|
+
// overlays and the content wrapper below can all be placed in that ONE cell
|
|
178
|
+
// (`web:[grid-area:1/1]`) and each fill it exactly — `minmax(0,1fr)` (not
|
|
179
|
+
// `1fr` alone) on both axes so the track can still SHRINK below its content's
|
|
180
|
+
// intrinsic size, the grid-track equivalent of the flex `min-height: 0`
|
|
181
|
+
// fix — without it, a tall scrollable child would grow the row instead of
|
|
182
|
+
// being clipped/scrolled inside a fixed-height cell.
|
|
183
|
+
const gridStackClass = boundToPanel ? 'web:grid web:[grid-template-columns:minmax(0,1fr)] web:[grid-template-rows:minmax(0,1fr)]' : '';
|
|
184
|
+
const surfaceClass = [surfaceBase, gridStackClass, surfaceClassName ?? 'bg-card'].filter(Boolean).join(' ');
|
|
185
|
+
const contentClass = [contentBase, boundToPanel ? 'web:[grid-area:1/1]' : '', contentClassName].filter(Boolean).join(' ');
|
|
186
|
+
|
|
187
|
+
// `overlayTopOffset`: the viewport-mode overlays are sized/positioned from
|
|
188
|
+
// literal Tailwind classes (`top-2`, `h-[calc(100dvh-16px)]`, a matching
|
|
189
|
+
// negative `margin-bottom`) because those values are constants known at
|
|
190
|
+
// build time. An offset is a runtime number (a consumer's measured header
|
|
191
|
+
// height), which a Tailwind arbitrary class can't express — content-scanning
|
|
192
|
+
// needs the literal class string in source, not a value computed later — so
|
|
193
|
+
// this shifts the same three properties via inline `style` instead, which
|
|
194
|
+
// has no such constraint. No-op in `panel` mode (already starts at the
|
|
195
|
+
// panel's own box) and when unset (0/undefined) — the className values are
|
|
196
|
+
// left standing on their own in both of those cases.
|
|
197
|
+
// RN's `ViewStyle.height`/`marginBottom` types only accept a number or a
|
|
198
|
+
// `${number}%` string (not an arbitrary CSS `calc()` string), because most
|
|
199
|
+
// of this type is shared with native, where `calc()` doesn't exist. This
|
|
200
|
+
// file is web-only, where it's a real, valid CSS value react-native-web
|
|
201
|
+
// passes straight through — the same reasoning `WebViewStyle`/`asViewStyle`
|
|
202
|
+
// document in OxyHQ/Mention's `types/webStyles.ts` for the identical need.
|
|
203
|
+
const topOffsetStyle = !boundToPanel && overlayTopOffset ? {
|
|
204
|
+
top: 8 + overlayTopOffset,
|
|
205
|
+
height: `calc(100dvh - ${16 + overlayTopOffset}px)`,
|
|
206
|
+
marginBottom: `calc(-100dvh + ${16 + overlayTopOffset}px)`
|
|
207
|
+
} : undefined;
|
|
144
208
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ContentPanelNestingContext.Provider, {
|
|
145
209
|
value: true,
|
|
146
210
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styledPrimitives.StyledView, {
|
|
211
|
+
testID: "content-panel-surface",
|
|
147
212
|
className: surfaceClass,
|
|
148
213
|
style: surfaceStyle,
|
|
149
214
|
children: [showOverlays && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledPrimitives.StyledView, {
|
|
215
|
+
testID: "content-panel-bleed-mask",
|
|
150
216
|
pointerEvents: "none",
|
|
151
|
-
className: responsive ? `web:sticky web:top-2 z-30 h-[calc(100dvh-16px)] w-full rounded-radius-28 ${bp.overlayHidden} web:[margin-bottom:calc(-100dvh+16px)] web:[clip-path:inset(-12px)]` : 'web:sticky web:top-2 z-30 h-[calc(100dvh-16px)] w-full rounded-radius-28 web:[margin-bottom:calc(-100dvh+16px)] web:[clip-path:inset(-12px)]',
|
|
217
|
+
className: boundToPanel ? `web:[grid-area:1/1] z-30 h-full w-full rounded-radius-28 ${responsive ? bp.overlayHidden : ''} web:[clip-path:inset(0)]` : responsive ? `web:sticky web:top-2 z-30 h-[calc(100dvh-16px)] w-full rounded-radius-28 ${bp.overlayHidden} web:[margin-bottom:calc(-100dvh+16px)] web:[clip-path:inset(-12px)]` : 'web:sticky web:top-2 z-30 h-[calc(100dvh-16px)] w-full rounded-radius-28 web:[margin-bottom:calc(-100dvh+16px)] web:[clip-path:inset(-12px)]',
|
|
152
218
|
style: {
|
|
219
|
+
...topOffsetStyle,
|
|
153
220
|
boxShadow: `0 0 0 ${GUTTER_MASK_SPREAD}px ${maskColor ?? colors.background}`
|
|
154
221
|
}
|
|
155
222
|
}, "bleed-mask"), showOverlays && showStickyFrame !== false && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledPrimitives.StyledView, {
|
|
223
|
+
testID: "content-panel-border-frame",
|
|
156
224
|
pointerEvents: "none",
|
|
157
|
-
|
|
225
|
+
style: topOffsetStyle,
|
|
226
|
+
className: boundToPanel ? `web:[grid-area:1/1] z-[120] h-full w-full rounded-radius-28 border border-border ${responsive ? bp.overlayHidden : ''}` : responsive ? `web:sticky web:top-2 z-[120] h-[calc(100dvh-16px)] w-full rounded-radius-28 border border-border ${bp.overlayHidden} web:[margin-bottom:calc(-100dvh+16px)]` : 'web:sticky web:top-2 z-[120] h-[calc(100dvh-16px)] w-full rounded-radius-28 border border-border web:[margin-bottom:calc(-100dvh+16px)]'
|
|
158
227
|
}, "border-frame"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styledPrimitives.StyledView, {
|
|
228
|
+
testID: "content-panel-content",
|
|
159
229
|
className: contentClass,
|
|
160
230
|
style: contentStyle,
|
|
161
231
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_styledPrimitives","_useTheme","_context","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GUTTER_MASK_SPREAD","exports","PANEL_TOP_INSET","PANEL_BOTTOM_INSET","RESPONSIVE_WEB","surface","content","overlayHidden","ContentPanelComponent","children","framed","framedFrom","surfaceClassName","surfaceStyle","contentClassName","contentStyle","showStickyFrame","maskColor","useContentPanelNestingGuard","colors","useTheme","responsive","undefined","showOverlays","bp","surfaceBase","contentBase","surfaceClass","join","contentClass","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_styledPrimitives","_useTheme","_context","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GUTTER_MASK_SPREAD","exports","PANEL_TOP_INSET","PANEL_BOTTOM_INSET","RESPONSIVE_WEB","surface","content","overlayHidden","ContentPanelComponent","children","framed","framedFrom","surfaceClassName","surfaceStyle","contentClassName","contentStyle","showStickyFrame","maskColor","overlaySizing","overlayTopOffset","useContentPanelNestingGuard","colors","useTheme","responsive","undefined","showOverlays","bp","boundToPanel","surfaceBase","contentBase","gridStackClass","surfaceClass","filter","Boolean","join","contentClass","topOffsetStyle","top","height","marginBottom","jsx","ContentPanelNestingContext","Provider","value","jsxs","StyledView","testID","className","style","pointerEvents","boxShadow","background","ContentPanel","memo","displayName"],"sourceRoot":"../../../src","sources":["content-panel/ContentPanel.web.tsx"],"mappings":"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HgB,UAAU,GACR,oGAAoGG,EAAE,CAACnB,aAAa,yCAAyC,GAC7J;MACP,GAVG,cAWL,CACF,eAKD,IAAA3B,WAAA,CAAA4D,GAAA,EAAC/D,iBAAA,CAAAoE,UAAU;QAAeC,MAAM,EAAC,uBAAuB;QAACC,SAAS,EAAEZ,YAAa;QAACa,KAAK,EAAEjC,YAAa;QAAAN,QAAA,EACnGA;MAAQ,GADK,SAEJ,CAAC;IAAA,CACH;EAAC,CACsB,CAAC;AAE1C,CAAC;AAEM,MAAM2C,YAAY,GAAAnD,OAAA,CAAAmD,YAAA,gBAAG,IAAAC,WAAI,EAAC7C,qBAAqB,CAAC;AACvD4C,YAAY,CAACE,WAAW,GAAG,cAAc","ignoreList":[]}
|
|
@@ -25,6 +25,37 @@
|
|
|
25
25
|
* content rather than displacing it). They render BEFORE the content wrapper so
|
|
26
26
|
* z-index — not DOM order — decides layering.
|
|
27
27
|
*
|
|
28
|
+
* That sticky/`100dvh` sizing is itself a CHOICE, not the only mode — see
|
|
29
|
+
* `overlaySizing`. It is correct exactly when the panel's own DOM height can
|
|
30
|
+
* exceed one viewport in a document that actually scrolls (dvh gives the
|
|
31
|
+
* overlay a fixed, viewport-sized height that a percentage cannot: percentage
|
|
32
|
+
* heights need a definite ancestor height, which an auto-height document-flow
|
|
33
|
+
* ancestor never has). A consumer whose OWN shell already bounds the panel's
|
|
34
|
+
* height (no document scroll) doesn't have that problem, and viewport-sizing
|
|
35
|
+
* there is actively wrong — the overlay reads `100dvh` regardless of how much
|
|
36
|
+
* of the viewport is actually the panel's, so anything the consumer placed
|
|
37
|
+
* outside the panel (a header above it, say) gets painted over.
|
|
38
|
+
* `overlaySizing="panel"` is that second mode: CSS Grid layer-stacking (every
|
|
39
|
+
* child placed in the same `grid-area: 1/1`) instead of sticky/dvh/negative-
|
|
40
|
+
* margin — each child fills exactly the grid cell, i.e. exactly the panel's
|
|
41
|
+
* own box, whatever that box's real height is. No `position: absolute` (that
|
|
42
|
+
* takes the content wrapper out of flow, which is not what "panel" mode
|
|
43
|
+
* changes — only the two overlays' sizing mechanism changes) and no percentage
|
|
44
|
+
* margin (the well-known CSS quirk where a vertical margin percentage resolves
|
|
45
|
+
* against the containing block's WIDTH, not its height, so it cannot express
|
|
46
|
+
* "100% of my own height" at all).
|
|
47
|
+
*
|
|
48
|
+
* The bleed-mask's `clip-path` also changes with the mode, not just its box
|
|
49
|
+
* size: `inset(-12px)` (viewport mode) is a deliberate small halo — the
|
|
50
|
+
* `box-shadow`'s `GUTTER_MASK_SPREAD` is 40px, and the clip-path caps how much
|
|
51
|
+
* of that is actually allowed to paint past the box edge. A document-scroll
|
|
52
|
+
* consumer has nothing else positioned right above/below the panel for that
|
|
53
|
+
* halo to land on. A bounded-shell consumer might — the whole reason for
|
|
54
|
+
* `overlaySizing="panel"` is that something IS placed right outside the panel
|
|
55
|
+
* — so panel mode clips the shadow flush to the box (`inset(0)`, zero bleed)
|
|
56
|
+
* rather than merely resizing the box and leaving a smaller bleed that could
|
|
57
|
+
* still reach a close sibling.
|
|
58
|
+
*
|
|
28
59
|
* Framing is tri-state via the `framed` prop:
|
|
29
60
|
*
|
|
30
61
|
* - `undefined` (DEFAULT) → RESPONSIVE, driven purely by NativeWind: full-bleed
|
|
@@ -110,7 +141,9 @@ const ContentPanelComponent = ({
|
|
|
110
141
|
contentClassName,
|
|
111
142
|
contentStyle,
|
|
112
143
|
showStickyFrame,
|
|
113
|
-
maskColor
|
|
144
|
+
maskColor,
|
|
145
|
+
overlaySizing = 'viewport',
|
|
146
|
+
overlayTopOffset
|
|
114
147
|
}) => {
|
|
115
148
|
// Dev-only invariant — must run unconditionally (before deriving any
|
|
116
149
|
// mode-specific branch) so the hook order stays stable (rules of hooks).
|
|
@@ -126,6 +159,7 @@ const ContentPanelComponent = ({
|
|
|
126
159
|
// Responsive mode selects a pre-shipped literal breakpoint bundle by value;
|
|
127
160
|
// `framed === true`/`false` ignore `framedFrom` (fixed always/never framing).
|
|
128
161
|
const bp = RESPONSIVE_WEB[framedFrom];
|
|
162
|
+
const boundToPanel = overlaySizing === 'panel';
|
|
129
163
|
|
|
130
164
|
// Whole literal class strings selected per mode (the Tailwind content-scan
|
|
131
165
|
// over `lib/**` requires each arbitrary/`min-*`/`max-*`/`web:` token stay
|
|
@@ -133,23 +167,59 @@ const ContentPanelComponent = ({
|
|
|
133
167
|
// only spliced in, never assembled from parts).
|
|
134
168
|
const surfaceBase = responsive ? `flex-1 ${bp.surface}` : framed ? 'flex-1 rounded-radius-28' : 'flex-1';
|
|
135
169
|
const contentBase = responsive ? `flex-1 ${bp.content}` : framed ? 'flex-1 rounded-radius-28 web:overflow-x-clip' : 'flex-1';
|
|
136
|
-
|
|
137
|
-
|
|
170
|
+
// `overlaySizing="panel"`: the surface becomes a single-cell CSS Grid so the
|
|
171
|
+
// overlays and the content wrapper below can all be placed in that ONE cell
|
|
172
|
+
// (`web:[grid-area:1/1]`) and each fill it exactly — `minmax(0,1fr)` (not
|
|
173
|
+
// `1fr` alone) on both axes so the track can still SHRINK below its content's
|
|
174
|
+
// intrinsic size, the grid-track equivalent of the flex `min-height: 0`
|
|
175
|
+
// fix — without it, a tall scrollable child would grow the row instead of
|
|
176
|
+
// being clipped/scrolled inside a fixed-height cell.
|
|
177
|
+
const gridStackClass = boundToPanel ? 'web:grid web:[grid-template-columns:minmax(0,1fr)] web:[grid-template-rows:minmax(0,1fr)]' : '';
|
|
178
|
+
const surfaceClass = [surfaceBase, gridStackClass, surfaceClassName ?? 'bg-card'].filter(Boolean).join(' ');
|
|
179
|
+
const contentClass = [contentBase, boundToPanel ? 'web:[grid-area:1/1]' : '', contentClassName].filter(Boolean).join(' ');
|
|
180
|
+
|
|
181
|
+
// `overlayTopOffset`: the viewport-mode overlays are sized/positioned from
|
|
182
|
+
// literal Tailwind classes (`top-2`, `h-[calc(100dvh-16px)]`, a matching
|
|
183
|
+
// negative `margin-bottom`) because those values are constants known at
|
|
184
|
+
// build time. An offset is a runtime number (a consumer's measured header
|
|
185
|
+
// height), which a Tailwind arbitrary class can't express — content-scanning
|
|
186
|
+
// needs the literal class string in source, not a value computed later — so
|
|
187
|
+
// this shifts the same three properties via inline `style` instead, which
|
|
188
|
+
// has no such constraint. No-op in `panel` mode (already starts at the
|
|
189
|
+
// panel's own box) and when unset (0/undefined) — the className values are
|
|
190
|
+
// left standing on their own in both of those cases.
|
|
191
|
+
// RN's `ViewStyle.height`/`marginBottom` types only accept a number or a
|
|
192
|
+
// `${number}%` string (not an arbitrary CSS `calc()` string), because most
|
|
193
|
+
// of this type is shared with native, where `calc()` doesn't exist. This
|
|
194
|
+
// file is web-only, where it's a real, valid CSS value react-native-web
|
|
195
|
+
// passes straight through — the same reasoning `WebViewStyle`/`asViewStyle`
|
|
196
|
+
// document in OxyHQ/Mention's `types/webStyles.ts` for the identical need.
|
|
197
|
+
const topOffsetStyle = !boundToPanel && overlayTopOffset ? {
|
|
198
|
+
top: 8 + overlayTopOffset,
|
|
199
|
+
height: `calc(100dvh - ${16 + overlayTopOffset}px)`,
|
|
200
|
+
marginBottom: `calc(-100dvh + ${16 + overlayTopOffset}px)`
|
|
201
|
+
} : undefined;
|
|
138
202
|
return /*#__PURE__*/_jsx(ContentPanelNestingContext.Provider, {
|
|
139
203
|
value: true,
|
|
140
204
|
children: /*#__PURE__*/_jsxs(StyledView, {
|
|
205
|
+
testID: "content-panel-surface",
|
|
141
206
|
className: surfaceClass,
|
|
142
207
|
style: surfaceStyle,
|
|
143
208
|
children: [showOverlays && /*#__PURE__*/_jsx(StyledView, {
|
|
209
|
+
testID: "content-panel-bleed-mask",
|
|
144
210
|
pointerEvents: "none",
|
|
145
|
-
className: responsive ? `web:sticky web:top-2 z-30 h-[calc(100dvh-16px)] w-full rounded-radius-28 ${bp.overlayHidden} web:[margin-bottom:calc(-100dvh+16px)] web:[clip-path:inset(-12px)]` : 'web:sticky web:top-2 z-30 h-[calc(100dvh-16px)] w-full rounded-radius-28 web:[margin-bottom:calc(-100dvh+16px)] web:[clip-path:inset(-12px)]',
|
|
211
|
+
className: boundToPanel ? `web:[grid-area:1/1] z-30 h-full w-full rounded-radius-28 ${responsive ? bp.overlayHidden : ''} web:[clip-path:inset(0)]` : responsive ? `web:sticky web:top-2 z-30 h-[calc(100dvh-16px)] w-full rounded-radius-28 ${bp.overlayHidden} web:[margin-bottom:calc(-100dvh+16px)] web:[clip-path:inset(-12px)]` : 'web:sticky web:top-2 z-30 h-[calc(100dvh-16px)] w-full rounded-radius-28 web:[margin-bottom:calc(-100dvh+16px)] web:[clip-path:inset(-12px)]',
|
|
146
212
|
style: {
|
|
213
|
+
...topOffsetStyle,
|
|
147
214
|
boxShadow: `0 0 0 ${GUTTER_MASK_SPREAD}px ${maskColor ?? colors.background}`
|
|
148
215
|
}
|
|
149
216
|
}, "bleed-mask"), showOverlays && showStickyFrame !== false && /*#__PURE__*/_jsx(StyledView, {
|
|
217
|
+
testID: "content-panel-border-frame",
|
|
150
218
|
pointerEvents: "none",
|
|
151
|
-
|
|
219
|
+
style: topOffsetStyle,
|
|
220
|
+
className: boundToPanel ? `web:[grid-area:1/1] z-[120] h-full w-full rounded-radius-28 border border-border ${responsive ? bp.overlayHidden : ''}` : responsive ? `web:sticky web:top-2 z-[120] h-[calc(100dvh-16px)] w-full rounded-radius-28 border border-border ${bp.overlayHidden} web:[margin-bottom:calc(-100dvh+16px)]` : 'web:sticky web:top-2 z-[120] h-[calc(100dvh-16px)] w-full rounded-radius-28 border border-border web:[margin-bottom:calc(-100dvh+16px)]'
|
|
152
221
|
}, "border-frame"), /*#__PURE__*/_jsx(StyledView, {
|
|
222
|
+
testID: "content-panel-content",
|
|
153
223
|
className: contentClass,
|
|
154
224
|
style: contentStyle,
|
|
155
225
|
children: children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","memo","StyledView","useTheme","ContentPanelNestingContext","useContentPanelNestingGuard","jsx","_jsx","jsxs","_jsxs","GUTTER_MASK_SPREAD","PANEL_TOP_INSET","PANEL_BOTTOM_INSET","RESPONSIVE_WEB","surface","content","overlayHidden","ContentPanelComponent","children","framed","framedFrom","surfaceClassName","surfaceStyle","contentClassName","contentStyle","showStickyFrame","maskColor","colors","responsive","undefined","showOverlays","bp","surfaceBase","contentBase","surfaceClass","join","contentClass","
|
|
1
|
+
{"version":3,"names":["React","memo","StyledView","useTheme","ContentPanelNestingContext","useContentPanelNestingGuard","jsx","_jsx","jsxs","_jsxs","GUTTER_MASK_SPREAD","PANEL_TOP_INSET","PANEL_BOTTOM_INSET","RESPONSIVE_WEB","surface","content","overlayHidden","ContentPanelComponent","children","framed","framedFrom","surfaceClassName","surfaceStyle","contentClassName","contentStyle","showStickyFrame","maskColor","overlaySizing","overlayTopOffset","colors","responsive","undefined","showOverlays","bp","boundToPanel","surfaceBase","contentBase","gridStackClass","surfaceClass","filter","Boolean","join","contentClass","topOffsetStyle","top","height","marginBottom","Provider","value","testID","className","style","pointerEvents","boxShadow","background","ContentPanel","displayName"],"sourceRoot":"../../../src","sources":["content-panel/ContentPanel.web.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AAGnC,SAASC,UAAU,QAAQ,gCAA6B;AAExD,SAASC,QAAQ,QAAQ,uBAAoB;AAC7C,SACEC,0BAA0B,EAC1BC,2BAA2B,QACtB,cAAW;AAAC,SAAAC,GAAA,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aAAa,EAAC,MAAM;QACpBF,SAAS,EACPhB,YAAY,GACR,4DAA4DJ,UAAU,GAAGG,EAAE,CAACjB,aAAa,GAAG,EAAE,2BAA2B,GACzHc,UAAU,GACR,4EAA4EG,EAAE,CAACjB,aAAa,sEAAsE,GAClK,8IACP;QACDmC,KAAK,EAAE;UAAE,GAAGR,cAAc;UAAEU,SAAS,EAAE,SAAS3C,kBAAkB,MAAMgB,SAAS,IAAIG,MAAM,CAACyB,UAAU;QAAG;MAAE,GAVvG,YAWL,CACF,EAGAtB,YAAY,IAAIP,eAAe,KAAK,KAAK,iBACxClB,IAAA,CAACL,UAAU;QAET+C,MAAM,EAAC,4BAA4B;QACnCG,aAAa,EAAC,MAAM;QACpBD,KAAK,EAAER,cAAe;QACtBO,SAAS,EACPhB,YAAY,GACR,oFAAoFJ,UAAU,GAAGG,EAAE,CAACjB,aAAa,GAAG,EAAE,EAAE,GACxHc,UAAU,GACR,oGAAoGG,EAAE,CAACjB,aAAa,yCAAyC,GAC7J;MACP,GAVG,cAWL,CACF,eAKDT,IAAA,CAACL,UAAU;QAAe+C,MAAM,EAAC,uBAAuB;QAACC,SAAS,EAAER,YAAa;QAACS,KAAK,EAAE3B,YAAa;QAAAN,QAAA,EACnGA;MAAQ,GADK,SAEJ,CAAC;IAAA,CACH;EAAC,CACsB,CAAC;AAE1C,CAAC;AAED,OAAO,MAAMqC,YAAY,gBAAGtD,IAAI,CAACgB,qBAAqB,CAAC;AACvDsC,YAAY,CAACC,WAAW,GAAG,cAAc","ignoreList":[]}
|
|
@@ -23,6 +23,37 @@
|
|
|
23
23
|
* content rather than displacing it). They render BEFORE the content wrapper so
|
|
24
24
|
* z-index — not DOM order — decides layering.
|
|
25
25
|
*
|
|
26
|
+
* That sticky/`100dvh` sizing is itself a CHOICE, not the only mode — see
|
|
27
|
+
* `overlaySizing`. It is correct exactly when the panel's own DOM height can
|
|
28
|
+
* exceed one viewport in a document that actually scrolls (dvh gives the
|
|
29
|
+
* overlay a fixed, viewport-sized height that a percentage cannot: percentage
|
|
30
|
+
* heights need a definite ancestor height, which an auto-height document-flow
|
|
31
|
+
* ancestor never has). A consumer whose OWN shell already bounds the panel's
|
|
32
|
+
* height (no document scroll) doesn't have that problem, and viewport-sizing
|
|
33
|
+
* there is actively wrong — the overlay reads `100dvh` regardless of how much
|
|
34
|
+
* of the viewport is actually the panel's, so anything the consumer placed
|
|
35
|
+
* outside the panel (a header above it, say) gets painted over.
|
|
36
|
+
* `overlaySizing="panel"` is that second mode: CSS Grid layer-stacking (every
|
|
37
|
+
* child placed in the same `grid-area: 1/1`) instead of sticky/dvh/negative-
|
|
38
|
+
* margin — each child fills exactly the grid cell, i.e. exactly the panel's
|
|
39
|
+
* own box, whatever that box's real height is. No `position: absolute` (that
|
|
40
|
+
* takes the content wrapper out of flow, which is not what "panel" mode
|
|
41
|
+
* changes — only the two overlays' sizing mechanism changes) and no percentage
|
|
42
|
+
* margin (the well-known CSS quirk where a vertical margin percentage resolves
|
|
43
|
+
* against the containing block's WIDTH, not its height, so it cannot express
|
|
44
|
+
* "100% of my own height" at all).
|
|
45
|
+
*
|
|
46
|
+
* The bleed-mask's `clip-path` also changes with the mode, not just its box
|
|
47
|
+
* size: `inset(-12px)` (viewport mode) is a deliberate small halo — the
|
|
48
|
+
* `box-shadow`'s `GUTTER_MASK_SPREAD` is 40px, and the clip-path caps how much
|
|
49
|
+
* of that is actually allowed to paint past the box edge. A document-scroll
|
|
50
|
+
* consumer has nothing else positioned right above/below the panel for that
|
|
51
|
+
* halo to land on. A bounded-shell consumer might — the whole reason for
|
|
52
|
+
* `overlaySizing="panel"` is that something IS placed right outside the panel
|
|
53
|
+
* — so panel mode clips the shadow flush to the box (`inset(0)`, zero bleed)
|
|
54
|
+
* rather than merely resizing the box and leaving a smaller bleed that could
|
|
55
|
+
* still reach a close sibling.
|
|
56
|
+
*
|
|
26
57
|
* Framing is tri-state via the `framed` prop:
|
|
27
58
|
*
|
|
28
59
|
* - `undefined` (DEFAULT) → RESPONSIVE, driven purely by NativeWind: full-bleed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentPanel.web.d.ts","sourceRoot":"","sources":["../../../../src/content-panel/ContentPanel.web.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ContentPanel.web.d.ts","sourceRoot":"","sources":["../../../../src/content-panel/ContentPanel.web.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,OAAO,KAAe,MAAM,OAAO,CAAC;AAUpC,OAAO,KAAK,EAAgC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE/E,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,6DAA6D;AAC7D,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,2DAA2D;AAC3D,eAAO,MAAM,kBAAkB,IAAI,CAAC;AA4KpC,eAAO,MAAM,YAAY,+CAA8B,CAAC"}
|
|
@@ -44,5 +44,41 @@ export interface ContentPanelProps {
|
|
|
44
44
|
* API parity — no-op on native (there is no bleed-mask), like `framed`.
|
|
45
45
|
*/
|
|
46
46
|
maskColor?: string;
|
|
47
|
+
/**
|
|
48
|
+
* How the WEB overlays (bleed-mask, border-frame) size themselves. No-op on
|
|
49
|
+
* native (there are no overlays to size).
|
|
50
|
+
* - `'viewport'` (DEFAULT) — sized to the dynamic viewport height (`100dvh`)
|
|
51
|
+
* and `position: sticky`-pinned, so they read as a constant frame around
|
|
52
|
+
* the visible slice of a panel whose own DOM height can exceed one screen
|
|
53
|
+
* — the document-scroll case (e.g. a feed whose page grows with content).
|
|
54
|
+
* Requires the panel to sit in a document that actually scrolls; see
|
|
55
|
+
* `ContentPanel.web.tsx`'s doc comment.
|
|
56
|
+
* - `'panel'` — sized to the panel's own real box via CSS Grid layer-
|
|
57
|
+
* stacking (the overlays and the content wrapper all occupy the same
|
|
58
|
+
* grid cell) instead of viewport math. The right mode for a consumer
|
|
59
|
+
* whose own shell already bounds the panel's height (no document
|
|
60
|
+
* scroll — a fixed app shell with its own internal scroll containers),
|
|
61
|
+
* where anything the consumer places outside the panel (e.g. a header
|
|
62
|
+
* above it) must never be overlapped by an overlay sized to the whole
|
|
63
|
+
* viewport.
|
|
64
|
+
*/
|
|
65
|
+
overlaySizing?: 'viewport' | 'panel';
|
|
66
|
+
/**
|
|
67
|
+
* Pixels of REAL, persistent chrome the consumer has placed above the panel
|
|
68
|
+
* — outside it, in normal document flow — that the viewport-mode overlays
|
|
69
|
+
* (`overlaySizing="viewport"`, the default) do not otherwise know about.
|
|
70
|
+
* No-op when `overlaySizing="panel"` (that mode already starts at the
|
|
71
|
+
* panel's own box, wherever that is) and on native (no overlays there).
|
|
72
|
+
*
|
|
73
|
+
* The overlays are sized/positioned off the VIEWPORT (`top: 8px`,
|
|
74
|
+
* `height: calc(100dvh - 16px)`) on the assumption that the panel begins
|
|
75
|
+
* near the true top of the screen. A consumer with its own sticky chrome
|
|
76
|
+
* above the panel (a header, say, kept sticky-pinned the same way) shifts
|
|
77
|
+
* where the panel visually starts without moving the panel's own DOM
|
|
78
|
+
* position, so the overlays would still read from viewport 0 and paint
|
|
79
|
+
* over that chrome. This shifts their `top` down and shrinks their height
|
|
80
|
+
* by the same amount, so they begin exactly where the panel visually does.
|
|
81
|
+
*/
|
|
82
|
+
overlayTopOffset?: number;
|
|
47
83
|
}
|
|
48
84
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/content-panel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,4BAA4B,GAAG,GA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;IACpC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;;;;;;OAiBG;IACH,aAAa,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IACrC;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -23,6 +23,37 @@
|
|
|
23
23
|
* content rather than displacing it). They render BEFORE the content wrapper so
|
|
24
24
|
* z-index — not DOM order — decides layering.
|
|
25
25
|
*
|
|
26
|
+
* That sticky/`100dvh` sizing is itself a CHOICE, not the only mode — see
|
|
27
|
+
* `overlaySizing`. It is correct exactly when the panel's own DOM height can
|
|
28
|
+
* exceed one viewport in a document that actually scrolls (dvh gives the
|
|
29
|
+
* overlay a fixed, viewport-sized height that a percentage cannot: percentage
|
|
30
|
+
* heights need a definite ancestor height, which an auto-height document-flow
|
|
31
|
+
* ancestor never has). A consumer whose OWN shell already bounds the panel's
|
|
32
|
+
* height (no document scroll) doesn't have that problem, and viewport-sizing
|
|
33
|
+
* there is actively wrong — the overlay reads `100dvh` regardless of how much
|
|
34
|
+
* of the viewport is actually the panel's, so anything the consumer placed
|
|
35
|
+
* outside the panel (a header above it, say) gets painted over.
|
|
36
|
+
* `overlaySizing="panel"` is that second mode: CSS Grid layer-stacking (every
|
|
37
|
+
* child placed in the same `grid-area: 1/1`) instead of sticky/dvh/negative-
|
|
38
|
+
* margin — each child fills exactly the grid cell, i.e. exactly the panel's
|
|
39
|
+
* own box, whatever that box's real height is. No `position: absolute` (that
|
|
40
|
+
* takes the content wrapper out of flow, which is not what "panel" mode
|
|
41
|
+
* changes — only the two overlays' sizing mechanism changes) and no percentage
|
|
42
|
+
* margin (the well-known CSS quirk where a vertical margin percentage resolves
|
|
43
|
+
* against the containing block's WIDTH, not its height, so it cannot express
|
|
44
|
+
* "100% of my own height" at all).
|
|
45
|
+
*
|
|
46
|
+
* The bleed-mask's `clip-path` also changes with the mode, not just its box
|
|
47
|
+
* size: `inset(-12px)` (viewport mode) is a deliberate small halo — the
|
|
48
|
+
* `box-shadow`'s `GUTTER_MASK_SPREAD` is 40px, and the clip-path caps how much
|
|
49
|
+
* of that is actually allowed to paint past the box edge. A document-scroll
|
|
50
|
+
* consumer has nothing else positioned right above/below the panel for that
|
|
51
|
+
* halo to land on. A bounded-shell consumer might — the whole reason for
|
|
52
|
+
* `overlaySizing="panel"` is that something IS placed right outside the panel
|
|
53
|
+
* — so panel mode clips the shadow flush to the box (`inset(0)`, zero bleed)
|
|
54
|
+
* rather than merely resizing the box and leaving a smaller bleed that could
|
|
55
|
+
* still reach a close sibling.
|
|
56
|
+
*
|
|
26
57
|
* Framing is tri-state via the `framed` prop:
|
|
27
58
|
*
|
|
28
59
|
* - `undefined` (DEFAULT) → RESPONSIVE, driven purely by NativeWind: full-bleed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentPanel.web.d.ts","sourceRoot":"","sources":["../../../../src/content-panel/ContentPanel.web.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ContentPanel.web.d.ts","sourceRoot":"","sources":["../../../../src/content-panel/ContentPanel.web.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AACH,OAAO,KAAe,MAAM,OAAO,CAAC;AAUpC,OAAO,KAAK,EAAgC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE/E,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,6DAA6D;AAC7D,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,2DAA2D;AAC3D,eAAO,MAAM,kBAAkB,IAAI,CAAC;AA4KpC,eAAO,MAAM,YAAY,+CAA8B,CAAC"}
|
|
@@ -44,5 +44,41 @@ export interface ContentPanelProps {
|
|
|
44
44
|
* API parity — no-op on native (there is no bleed-mask), like `framed`.
|
|
45
45
|
*/
|
|
46
46
|
maskColor?: string;
|
|
47
|
+
/**
|
|
48
|
+
* How the WEB overlays (bleed-mask, border-frame) size themselves. No-op on
|
|
49
|
+
* native (there are no overlays to size).
|
|
50
|
+
* - `'viewport'` (DEFAULT) — sized to the dynamic viewport height (`100dvh`)
|
|
51
|
+
* and `position: sticky`-pinned, so they read as a constant frame around
|
|
52
|
+
* the visible slice of a panel whose own DOM height can exceed one screen
|
|
53
|
+
* — the document-scroll case (e.g. a feed whose page grows with content).
|
|
54
|
+
* Requires the panel to sit in a document that actually scrolls; see
|
|
55
|
+
* `ContentPanel.web.tsx`'s doc comment.
|
|
56
|
+
* - `'panel'` — sized to the panel's own real box via CSS Grid layer-
|
|
57
|
+
* stacking (the overlays and the content wrapper all occupy the same
|
|
58
|
+
* grid cell) instead of viewport math. The right mode for a consumer
|
|
59
|
+
* whose own shell already bounds the panel's height (no document
|
|
60
|
+
* scroll — a fixed app shell with its own internal scroll containers),
|
|
61
|
+
* where anything the consumer places outside the panel (e.g. a header
|
|
62
|
+
* above it) must never be overlapped by an overlay sized to the whole
|
|
63
|
+
* viewport.
|
|
64
|
+
*/
|
|
65
|
+
overlaySizing?: 'viewport' | 'panel';
|
|
66
|
+
/**
|
|
67
|
+
* Pixels of REAL, persistent chrome the consumer has placed above the panel
|
|
68
|
+
* — outside it, in normal document flow — that the viewport-mode overlays
|
|
69
|
+
* (`overlaySizing="viewport"`, the default) do not otherwise know about.
|
|
70
|
+
* No-op when `overlaySizing="panel"` (that mode already starts at the
|
|
71
|
+
* panel's own box, wherever that is) and on native (no overlays there).
|
|
72
|
+
*
|
|
73
|
+
* The overlays are sized/positioned off the VIEWPORT (`top: 8px`,
|
|
74
|
+
* `height: calc(100dvh - 16px)`) on the assumption that the panel begins
|
|
75
|
+
* near the true top of the screen. A consumer with its own sticky chrome
|
|
76
|
+
* above the panel (a header, say, kept sticky-pinned the same way) shifts
|
|
77
|
+
* where the panel visually starts without moving the panel's own DOM
|
|
78
|
+
* position, so the overlays would still read from viewport 0 and paint
|
|
79
|
+
* over that chrome. This shifts their `top` down and shrinks their height
|
|
80
|
+
* by the same amount, so they begin exactly where the panel visually does.
|
|
81
|
+
*/
|
|
82
|
+
overlayTopOffset?: number;
|
|
47
83
|
}
|
|
48
84
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/content-panel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,4BAA4B,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;AAElE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,4BAA4B,CAAC;IAC1C,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/content-panel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAA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