@capgo/capacitor-sheets 8.0.11 → 8.0.12

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.
Files changed (49) hide show
  1. package/README.md +29 -1
  2. package/dist/angular/index.d.mts +18 -2
  3. package/dist/angular/index.d.ts +18 -2
  4. package/dist/angular/index.js +157 -16
  5. package/dist/angular/index.js.map +1 -1
  6. package/dist/angular/index.mjs +157 -16
  7. package/dist/angular/index.mjs.map +1 -1
  8. package/dist/{chunk-LY2DKBXN.mjs → chunk-7DYTSFX3.mjs} +27 -10
  9. package/dist/chunk-7DYTSFX3.mjs.map +1 -0
  10. package/dist/{chunk-FHGK4I6L.mjs → chunk-AXGC7BLW.mjs} +133 -9
  11. package/dist/chunk-AXGC7BLW.mjs.map +1 -0
  12. package/dist/{components-YSGBN2YD.mjs → components-STHKYCFN.mjs} +3 -3
  13. package/dist/index.d.mts +19 -3
  14. package/dist/index.d.ts +19 -3
  15. package/dist/index.js +158 -17
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +4 -4
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/react/index.d.mts +23 -2
  20. package/dist/react/index.d.ts +23 -2
  21. package/dist/react/index.js +157 -16
  22. package/dist/react/index.js.map +1 -1
  23. package/dist/react/index.mjs +157 -16
  24. package/dist/react/index.mjs.map +1 -1
  25. package/dist/solid/index.d.mts +23 -2
  26. package/dist/solid/index.d.ts +23 -2
  27. package/dist/solid/index.js +157 -16
  28. package/dist/solid/index.js.map +1 -1
  29. package/dist/solid/index.mjs +157 -16
  30. package/dist/solid/index.mjs.map +1 -1
  31. package/dist/{styles-VAFNQKVC.mjs → styles-P4J3AKBN.mjs} +2 -2
  32. package/dist/svelte/index.d.mts +18 -2
  33. package/dist/svelte/index.d.ts +18 -2
  34. package/dist/svelte/index.js +157 -16
  35. package/dist/svelte/index.js.map +1 -1
  36. package/dist/svelte/index.mjs +157 -16
  37. package/dist/svelte/index.mjs.map +1 -1
  38. package/dist/vue/index.d.mts +18 -2
  39. package/dist/vue/index.d.ts +18 -2
  40. package/dist/vue/index.js +157 -16
  41. package/dist/vue/index.js.map +1 -1
  42. package/dist/vue/index.mjs +157 -16
  43. package/dist/vue/index.mjs.map +1 -1
  44. package/docs/demos/ios-fullscreen-real-demo.webp +0 -0
  45. package/package.json +1 -1
  46. package/dist/chunk-FHGK4I6L.mjs.map +0 -1
  47. package/dist/chunk-LY2DKBXN.mjs.map +0 -1
  48. /package/dist/{components-YSGBN2YD.mjs.map → components-STHKYCFN.mjs.map} +0 -0
  49. /package/dist/{styles-VAFNQKVC.mjs.map → styles-P4J3AKBN.mjs.map} +0 -0
@@ -18,6 +18,11 @@ var CSS = `
18
18
  --cap-sheet-applied-safe-area-bottom: var(--cap-sheet-safe-area-bottom);
19
19
  --cap-sheet-applied-safe-area-left: var(--cap-sheet-safe-area-left);
20
20
  --cap-sheet-applied-safe-area-right: var(--cap-sheet-safe-area-right);
21
+ --cap-sheet-container-offset-top: 0em;
22
+ --cap-sheet-container-offset-bottom: 0em;
23
+ --cap-sheet-container-offset-left: 0em;
24
+ --cap-sheet-container-offset-right: 0em;
25
+ --cap-sheet-keyboard-offset: 0em;
21
26
  }
22
27
 
23
28
  @supports (height: 1dvh) {
@@ -46,10 +51,13 @@ cap-sheet-view {
46
51
  overscroll-behavior: none;
47
52
  contain: layout style;
48
53
  box-sizing: border-box;
49
- padding-block-start: var(--cap-sheet-applied-safe-area-top, 0em);
50
- padding-block-end: calc(var(--cap-sheet-applied-safe-area-bottom, 0em) + var(--cap-sheet-keyboard-offset, 0em));
51
- padding-inline-start: var(--cap-sheet-applied-safe-area-left, 0em);
52
- padding-inline-end: var(--cap-sheet-applied-safe-area-right, 0em);
54
+ padding-top: calc(var(--cap-sheet-applied-safe-area-top, 0em) + var(--cap-sheet-container-offset-top, 0em));
55
+ padding-bottom: calc(
56
+ var(--cap-sheet-applied-safe-area-bottom, 0em) + var(--cap-sheet-container-offset-bottom, 0em) +
57
+ var(--cap-sheet-keyboard-offset, 0em)
58
+ );
59
+ padding-left: calc(var(--cap-sheet-applied-safe-area-left, 0em) + var(--cap-sheet-container-offset-left, 0em));
60
+ padding-right: calc(var(--cap-sheet-applied-safe-area-right, 0em) + var(--cap-sheet-container-offset-right, 0em));
53
61
  }
54
62
 
55
63
  cap-sheet-view[hidden] {
@@ -94,6 +102,7 @@ cap-sheet-backdrop {
94
102
  }
95
103
 
96
104
  cap-sheet-content {
105
+ --cap-sheet-content-border-radius: var(--cap-sheet-radius) var(--cap-sheet-radius) 0 0;
97
106
  box-sizing: border-box;
98
107
  position: relative;
99
108
  display: block;
@@ -101,7 +110,7 @@ cap-sheet-content {
101
110
  max-height: 100%;
102
111
  color: CanvasText;
103
112
  background: var(--cap-sheet-surface);
104
- border-radius: var(--cap-sheet-radius) var(--cap-sheet-radius) 0 0;
113
+ border-radius: var(--cap-sheet-content-border-radius);
105
114
  box-shadow: var(--cap-sheet-shadow), var(--cap-sheet-edge-bleed-shadow, 0 0 0 0 transparent);
106
115
  overflow: auto;
107
116
  overscroll-behavior: contain;
@@ -112,27 +121,35 @@ cap-sheet-content {
112
121
  }
113
122
 
114
123
  cap-sheet-view[content-placement="top"] cap-sheet-content {
115
- border-radius: 0 0 var(--cap-sheet-radius) var(--cap-sheet-radius);
124
+ --cap-sheet-content-border-radius: 0 0 var(--cap-sheet-radius) var(--cap-sheet-radius);
116
125
  }
117
126
 
118
127
  cap-sheet-view[content-placement="left"] cap-sheet-content {
119
128
  width: min(88%, 28em);
120
129
  height: 100%;
121
130
  max-height: 100%;
122
- border-radius: 0 var(--cap-sheet-radius) var(--cap-sheet-radius) 0;
131
+ --cap-sheet-content-border-radius: 0 var(--cap-sheet-radius) var(--cap-sheet-radius) 0;
123
132
  }
124
133
 
125
134
  cap-sheet-view[content-placement="right"] cap-sheet-content {
126
135
  width: min(88%, 28em);
127
136
  height: 100%;
128
137
  max-height: 100%;
129
- border-radius: var(--cap-sheet-radius) 0 0 var(--cap-sheet-radius);
138
+ --cap-sheet-content-border-radius: var(--cap-sheet-radius) 0 0 var(--cap-sheet-radius);
130
139
  }
131
140
 
132
141
  cap-sheet-view[content-placement="center"] cap-sheet-content {
133
142
  width: min(90%, 30em);
134
143
  max-height: min(90%, 42em);
135
- border-radius: var(--cap-sheet-radius);
144
+ --cap-sheet-content-border-radius: var(--cap-sheet-radius);
145
+ }
146
+
147
+ cap-sheet-view[data-detached="true"] cap-sheet-content {
148
+ --cap-sheet-content-border-radius: var(--cap-sheet-detached-radius, var(--cap-sheet-radius));
149
+ }
150
+
151
+ cap-sheet-view[data-detached="true"] cap-sheet-content[data-cap-sheet-bleeds] {
152
+ --cap-sheet-edge-bleed-shadow: 0 0 0 0 transparent;
136
153
  }
137
154
 
138
155
  cap-sheet-bleeding-background {
@@ -252,4 +269,4 @@ export {
252
269
  CSS,
253
270
  injectCapSheetStyles
254
271
  };
255
- //# sourceMappingURL=chunk-LY2DKBXN.mjs.map
272
+ //# sourceMappingURL=chunk-7DYTSFX3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/styles.ts"],"sourcesContent":["const STYLE_ID = 'capgo-capacitor-sheets-styles';\n\nconst CSS = `\n:root {\n --cap-sheet-100-lvh-dvh-pct: 100%;\n --cap-sheet-backdrop-color: rgb(0 0 0);\n --cap-sheet-backdrop-opacity: 0.44;\n --cap-sheet-radius: 1.5em;\n --cap-sheet-handle-color: rgb(115 115 115);\n --cap-sheet-surface: Canvas;\n --cap-sheet-shadow: 0 0.5em 2.5em rgb(0 0 0 / 0.18);\n --cap-sheet-z-index: 1000;\n --cap-sheet-safe-area-top: max(env(safe-area-inset-top, 0em), var(--safe-area-inset-top, 0em));\n --cap-sheet-safe-area-bottom: max(env(safe-area-inset-bottom, 0em), var(--safe-area-inset-bottom, 0em));\n --cap-sheet-safe-area-left: max(env(safe-area-inset-left, 0em), var(--safe-area-inset-left, 0em));\n --cap-sheet-safe-area-right: max(env(safe-area-inset-right, 0em), var(--safe-area-inset-right, 0em));\n --cap-sheet-applied-safe-area-top: var(--cap-sheet-safe-area-top);\n --cap-sheet-applied-safe-area-bottom: var(--cap-sheet-safe-area-bottom);\n --cap-sheet-applied-safe-area-left: var(--cap-sheet-safe-area-left);\n --cap-sheet-applied-safe-area-right: var(--cap-sheet-safe-area-right);\n --cap-sheet-container-offset-top: 0em;\n --cap-sheet-container-offset-bottom: 0em;\n --cap-sheet-container-offset-left: 0em;\n --cap-sheet-container-offset-right: 0em;\n --cap-sheet-keyboard-offset: 0em;\n}\n\n@supports (height: 1dvh) {\n :root {\n --cap-sheet-100-lvh-dvh-pct: 100dvh;\n }\n}\n\ncap-sheet,\ncap-sheet-portal,\ncap-sheet-special-wrapper,\ncap-sheet-special-wrapper-content,\ncap-sheet-stack {\n display: contents;\n}\n\ncap-sheet-view {\n position: fixed;\n inset: 0;\n display: grid;\n width: 100%;\n height: var(--cap-sheet-100-lvh-dvh-pct);\n z-index: var(--cap-sheet-z-index);\n pointer-events: none;\n touch-action: none;\n overscroll-behavior: none;\n contain: layout style;\n box-sizing: border-box;\n padding-top: calc(var(--cap-sheet-applied-safe-area-top, 0em) + var(--cap-sheet-container-offset-top, 0em));\n padding-bottom: calc(\n var(--cap-sheet-applied-safe-area-bottom, 0em) + var(--cap-sheet-container-offset-bottom, 0em) +\n var(--cap-sheet-keyboard-offset, 0em)\n );\n padding-left: calc(var(--cap-sheet-applied-safe-area-left, 0em) + var(--cap-sheet-container-offset-left, 0em));\n padding-right: calc(var(--cap-sheet-applied-safe-area-right, 0em) + var(--cap-sheet-container-offset-right, 0em));\n}\n\ncap-sheet-view[hidden] {\n display: none !important;\n}\n\ncap-sheet-view[content-placement=\"top\"] {\n align-items: start;\n justify-items: center;\n}\n\ncap-sheet-view[content-placement=\"bottom\"],\ncap-sheet-view:not([content-placement]) {\n align-items: end;\n justify-items: center;\n}\n\ncap-sheet-view[content-placement=\"left\"] {\n align-items: center;\n justify-items: start;\n}\n\ncap-sheet-view[content-placement=\"right\"] {\n align-items: center;\n justify-items: end;\n}\n\ncap-sheet-view[content-placement=\"center\"] {\n align-items: center;\n justify-items: center;\n}\n\ncap-sheet-backdrop {\n position: absolute;\n inset: 0;\n display: block;\n background: var(--cap-sheet-backdrop-color);\n opacity: 0;\n pointer-events: none;\n touch-action: none;\n will-change: opacity;\n}\n\ncap-sheet-content {\n --cap-sheet-content-border-radius: var(--cap-sheet-radius) var(--cap-sheet-radius) 0 0;\n box-sizing: border-box;\n position: relative;\n display: block;\n width: min(100%, 34em);\n max-height: 100%;\n color: CanvasText;\n background: var(--cap-sheet-surface);\n border-radius: var(--cap-sheet-content-border-radius);\n box-shadow: var(--cap-sheet-shadow), var(--cap-sheet-edge-bleed-shadow, 0 0 0 0 transparent);\n overflow: auto;\n overscroll-behavior: contain;\n pointer-events: auto;\n touch-action: pan-x pan-y;\n will-change: transform, opacity;\n -webkit-overflow-scrolling: touch;\n}\n\ncap-sheet-view[content-placement=\"top\"] cap-sheet-content {\n --cap-sheet-content-border-radius: 0 0 var(--cap-sheet-radius) var(--cap-sheet-radius);\n}\n\ncap-sheet-view[content-placement=\"left\"] cap-sheet-content {\n width: min(88%, 28em);\n height: 100%;\n max-height: 100%;\n --cap-sheet-content-border-radius: 0 var(--cap-sheet-radius) var(--cap-sheet-radius) 0;\n}\n\ncap-sheet-view[content-placement=\"right\"] cap-sheet-content {\n width: min(88%, 28em);\n height: 100%;\n max-height: 100%;\n --cap-sheet-content-border-radius: var(--cap-sheet-radius) 0 0 var(--cap-sheet-radius);\n}\n\ncap-sheet-view[content-placement=\"center\"] cap-sheet-content {\n width: min(90%, 30em);\n max-height: min(90%, 42em);\n --cap-sheet-content-border-radius: var(--cap-sheet-radius);\n}\n\ncap-sheet-view[data-detached=\"true\"] cap-sheet-content {\n --cap-sheet-content-border-radius: var(--cap-sheet-detached-radius, var(--cap-sheet-radius));\n}\n\ncap-sheet-view[data-detached=\"true\"] cap-sheet-content[data-cap-sheet-bleeds] {\n --cap-sheet-edge-bleed-shadow: 0 0 0 0 transparent;\n}\n\ncap-sheet-bleeding-background {\n display: none;\n}\n\ncap-sheet-view[content-placement=\"bottom\"] cap-sheet-content[data-cap-sheet-bleeds],\ncap-sheet-view:not([content-placement]) cap-sheet-content[data-cap-sheet-bleeds] {\n --cap-sheet-edge-bleed-shadow: 0 8em 0 0 var(--cap-sheet-surface);\n}\n\ncap-sheet-view[content-placement=\"top\"] cap-sheet-content[data-cap-sheet-bleeds] {\n --cap-sheet-edge-bleed-shadow: 0 -8em 0 0 var(--cap-sheet-surface);\n}\n\ncap-sheet-view[content-placement=\"left\"] cap-sheet-content[data-cap-sheet-bleeds] {\n --cap-sheet-edge-bleed-shadow: -8em 0 0 0 var(--cap-sheet-surface);\n}\n\ncap-sheet-view[content-placement=\"right\"] cap-sheet-content[data-cap-sheet-bleeds] {\n --cap-sheet-edge-bleed-shadow: 8em 0 0 0 var(--cap-sheet-surface);\n}\n\ncap-sheet-handle {\n box-sizing: border-box;\n display: grid;\n place-items: center;\n width: 100%;\n height: 2.25em;\n cursor: grab;\n touch-action: none;\n}\n\ncap-sheet-handle::before {\n content: \"\";\n display: block;\n width: 2.75em;\n height: 0.3125em;\n border-radius: 999em;\n background: var(--cap-sheet-handle-color);\n opacity: 0.65;\n}\n\ncap-sheet-handle:active {\n cursor: grabbing;\n}\n\ncap-sheet-title,\ncap-sheet-description {\n display: block;\n}\n\ncap-sheet-outlet {\n display: block;\n transform-origin: center;\n will-change: transform, opacity, filter;\n}\n\ncap-scroll {\n display: block;\n overflow: auto;\n overscroll-behavior: contain;\n -webkit-overflow-scrolling: touch;\n scroll-behavior: smooth;\n}\n\ncap-scroll[axis=\"x\"] {\n overflow-x: auto;\n overflow-y: hidden;\n}\n\ncap-scroll[axis=\"y\"],\ncap-scroll:not([axis]) {\n overflow-x: hidden;\n overflow-y: auto;\n}\n\ncap-scroll-content {\n display: block;\n min-width: 100%;\n min-height: 100%;\n}\n\ncap-fixed {\n position: fixed;\n inset-inline: 0;\n z-index: calc(var(--cap-sheet-z-index) + 1);\n}\n\ncap-island,\ncap-external-overlay {\n display: contents;\n}\n\ncap-visually-hidden,\ncap-auto-focus-target[hidden-target] {\n position: absolute;\n width: 0.0625em;\n height: 0.0625em;\n margin: -0.0625em;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n border: 0;\n padding: 0;\n}\n`;\n\n/** Injects the structural styles required by the sheet web components. */\nexport function injectCapSheetStyles(root: Document = document): void {\n if (root.getElementById(STYLE_ID)) return;\n\n const style = root.createElement('style');\n style.id = STYLE_ID;\n style.textContent = CSS;\n root.head.appendChild(style);\n}\n\nexport { CSS as CAP_SHEETS_CSS };\n"],"mappings":";AAAA,IAAM,WAAW;AAEjB,IAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmQL,SAAS,qBAAqB,OAAiB,UAAgB;AACpE,MAAI,KAAK,eAAe,QAAQ,EAAG;AAEnC,QAAM,QAAQ,KAAK,cAAc,OAAO;AACxC,QAAM,KAAK;AACX,QAAM,cAAc;AACpB,OAAK,KAAK,YAAY,KAAK;AAC7B;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  injectCapSheetStyles
3
- } from "./chunk-LY2DKBXN.mjs";
3
+ } from "./chunk-7DYTSFX3.mjs";
4
4
 
5
5
  // src/core/utils.ts
6
6
  var focusableSelector = [
@@ -252,6 +252,7 @@ function releaseThemeColorDimmer(documentRef) {
252
252
  var defaultOptions = {
253
253
  contentPlacement: "bottom",
254
254
  sheetRole: "dialog",
255
+ detached: false,
255
256
  safeArea: "auto",
256
257
  swipe: true,
257
258
  swipeDismissal: true,
@@ -282,21 +283,74 @@ function normalizeDetents(value) {
282
283
  if (Array.isArray(value)) return value.filter(Boolean);
283
284
  return parseList(value || null);
284
285
  }
286
+ var unitlessInsetPattern = /^-?(?:\d+(?:\.\d+)?|\.\d+)$/;
287
+ function normalizeInsetValue(value) {
288
+ return unitlessInsetPattern.test(value) ? `${value}px` : value;
289
+ }
290
+ function parseInset(value) {
291
+ const normalized = value?.trim();
292
+ return normalized ? normalizeInsetValue(normalized) : void 0;
293
+ }
294
+ function formatInsetValue(value) {
295
+ if (typeof value === "number") return Number.isFinite(value) ? `${value}px` : "0em";
296
+ const normalized = value?.trim();
297
+ return normalized ? normalizeInsetValue(normalized) : "0em";
298
+ }
299
+ function explicitInsetForEdge(options, edge) {
300
+ switch (edge) {
301
+ case "top":
302
+ return options.topInset;
303
+ case "bottom":
304
+ return options.bottomInset;
305
+ case "left":
306
+ return options.leftInset;
307
+ case "right":
308
+ return options.rightInset;
309
+ }
310
+ }
311
+ function containerInsetForEdge(options, edge) {
312
+ const values = [options.containerOffset?.[edge], explicitInsetForEdge(options, edge)].map(formatInsetValue).filter((value) => value !== "0em");
313
+ if (values.length === 0) return "0em";
314
+ if (values.length === 1) return values[0];
315
+ return `calc(${values.join(" + ")})`;
316
+ }
317
+ function hasOwnOption(options, key) {
318
+ return Object.prototype.hasOwnProperty.call(options, key);
319
+ }
320
+ function affectsDismissedOffset(options) {
321
+ return hasOwnOption(options, "contentPlacement") || hasOwnOption(options, "tracks") || hasOwnOption(options, "detents") || hasOwnOption(options, "safeArea") || hasOwnOption(options, "topInset") || hasOwnOption(options, "bottomInset") || hasOwnOption(options, "leftInset") || hasOwnOption(options, "rightInset") || hasOwnOption(options, "containerOffset");
322
+ }
285
323
  var safeAreaEdges = ["top", "bottom", "left", "right"];
286
324
  function parseSafeArea(value) {
287
325
  if (value === null) return void 0;
288
326
  const normalized = value.trim().toLowerCase();
289
- if (!normalized || normalized === "true" || normalized === "auto" || normalized === "all") return "auto";
327
+ if (!normalized || normalized === "auto") return "auto";
328
+ if (normalized === "true" || normalized === "all") return "all";
290
329
  if (normalized === "false" || normalized === "none" || normalized === "off") return "none";
291
330
  const edges = parseList(normalized).filter(
292
331
  (edge) => safeAreaEdges.includes(edge)
293
332
  );
294
333
  return edges.length > 0 ? edges : "auto";
295
334
  }
296
- function resolveSafeAreaEdges(value) {
335
+ function resolveAutoSafeAreaEdges(placement) {
336
+ switch (placement) {
337
+ case "bottom":
338
+ return ["bottom", "left", "right"];
339
+ case "top":
340
+ return ["top", "left", "right"];
341
+ case "left":
342
+ return ["top", "bottom", "left"];
343
+ case "right":
344
+ return ["top", "bottom", "right"];
345
+ case "center":
346
+ return safeAreaEdges;
347
+ }
348
+ }
349
+ function resolveSafeAreaEdges(value, placement) {
297
350
  if (value === false || value === "none") return [];
351
+ if (value === true || value === "all") return safeAreaEdges;
298
352
  if (Array.isArray(value)) return value.filter((edge) => safeAreaEdges.includes(edge));
299
- return safeAreaEdges;
353
+ return resolveAutoSafeAreaEdges(placement);
300
354
  }
301
355
  function readOptionsFromElement(root) {
302
356
  const placement = parsePlacement(root.getAttribute("content-placement"));
@@ -313,6 +367,11 @@ function readOptionsFromElement(root) {
313
367
  sheetRole: root.getAttribute("sheet-role") || defaultOptions.sheetRole,
314
368
  contentPlacement: placement,
315
369
  safeArea: parseSafeArea(root.getAttribute("safe-area")),
370
+ detached: parseBoolean(root.getAttribute("detached"), defaultOptions.detached),
371
+ topInset: parseInset(root.getAttribute("top-inset")),
372
+ bottomInset: parseInset(root.getAttribute("bottom-inset")),
373
+ leftInset: parseInset(root.getAttribute("left-inset")),
374
+ rightInset: parseInset(root.getAttribute("right-inset")),
316
375
  tracks: parseTracks(root.getAttribute("tracks"), placement === "center" ? "bottom" : placement),
317
376
  swipe: parseBoolean(root.getAttribute("swipe"), defaultOptions.swipe),
318
377
  swipeDismissal: parseBoolean(root.getAttribute("swipe-dismissal"), defaultOptions.swipeDismissal),
@@ -549,6 +608,11 @@ var SheetController = class {
549
608
  this.parts.content.setAttribute("aria-modal", attributeBoolean(this.options.inertOutside !== false));
550
609
  }
551
610
  this.linkAccessibleNames();
611
+ if (this.connected && !this.presented && this.parts.content && affectsDismissedOffset(options)) {
612
+ this.remeasure();
613
+ this.applyOffset(this.detentOffsetsPx[0] || this.hiddenOffsetPx, this.status);
614
+ this.updateDomState(false);
615
+ }
552
616
  this.registerStack();
553
617
  }
554
618
  /** Register a view, backdrop, content, or semantic part. */
@@ -703,12 +767,29 @@ var SheetController = class {
703
767
  const sign = trackSign(track);
704
768
  const axis = isVerticalTrack(track) ? "y" : "x";
705
769
  const rect = content.getBoundingClientRect();
770
+ const viewRect = view?.getBoundingClientRect();
706
771
  const size = axis === "y" ? rect.height : rect.width;
707
- this.hiddenOffsetPx = Math.max(size, 1) * sign;
772
+ const transformedX = axis === "x" ? this.currentOffsetPx : 0;
773
+ const transformedY = axis === "y" ? this.currentOffsetPx : 0;
774
+ const contentRect = {
775
+ top: rect.top - transformedY,
776
+ right: rect.right - transformedX,
777
+ bottom: rect.bottom - transformedY,
778
+ left: rect.left - transformedX
779
+ };
780
+ let hiddenOffsetPx = Math.max(size, 1) * sign;
781
+ if (viewRect) {
782
+ if (track === "top") hiddenOffsetPx = viewRect.top - contentRect.bottom;
783
+ if (track === "bottom") hiddenOffsetPx = viewRect.bottom - contentRect.top;
784
+ if (track === "left") hiddenOffsetPx = viewRect.left - contentRect.right;
785
+ if (track === "right") hiddenOffsetPx = viewRect.right - contentRect.left;
786
+ }
787
+ this.hiddenOffsetPx = Math.abs(hiddenOffsetPx) > 1 ? hiddenOffsetPx : sign;
708
788
  const detents = normalizeDetents(this.options.detents);
709
789
  const offsets = [this.hiddenOffsetPx];
790
+ const measureContext = content;
710
791
  for (const detent of detents) {
711
- const visible = measureCssLength(detent, content, axis);
792
+ const visible = measureCssLength(detent, measureContext, axis);
712
793
  const offset = Math.max(Math.abs(this.hiddenOffsetPx) - visible, 0) * sign;
713
794
  offsets.push(offset);
714
795
  }
@@ -878,13 +959,17 @@ var SheetController = class {
878
959
  applySafeArea() {
879
960
  const view = this.parts.view;
880
961
  if (!view) return;
881
- const edges = new Set(resolveSafeAreaEdges(this.options.safeArea));
962
+ const edges = new Set(
963
+ resolveSafeAreaEdges(this.options.safeArea, this.options.contentPlacement || defaultOptions.contentPlacement)
964
+ );
882
965
  view.dataset.safeArea = edges.size > 0 ? Array.from(edges).join(" ") : "none";
966
+ view.dataset.detached = this.options.detached ? "true" : "false";
883
967
  for (const edge of safeAreaEdges) {
884
968
  view.style.setProperty(
885
969
  `--cap-sheet-applied-safe-area-${edge}`,
886
970
  edges.has(edge) ? `var(--cap-sheet-safe-area-${edge})` : "0em"
887
971
  );
972
+ view.style.setProperty(`--cap-sheet-container-offset-${edge}`, containerInsetForEdge(this.options, edge));
888
973
  }
889
974
  }
890
975
  addGlobalListeners() {
@@ -1182,12 +1267,17 @@ var observed = [
1182
1267
  "default-active-detent",
1183
1268
  "default-presented",
1184
1269
  "detents",
1270
+ "detached",
1185
1271
  "focus-trap",
1186
1272
  "inert-outside",
1187
1273
  "native-edge-swipe-prevention",
1188
1274
  "native-focus-scroll-prevention",
1189
1275
  "presented",
1190
1276
  "restore-focus",
1277
+ "top-inset",
1278
+ "bottom-inset",
1279
+ "left-inset",
1280
+ "right-inset",
1191
1281
  "safe-area",
1192
1282
  "sheet-role",
1193
1283
  "stack",
@@ -1302,12 +1392,17 @@ function readChangedOptionsFromElement(element, name) {
1302
1392
  "default-active-detent": ["defaultActiveDetent"],
1303
1393
  "default-presented": ["defaultPresented"],
1304
1394
  detents: ["detents"],
1395
+ detached: ["detached"],
1305
1396
  "focus-trap": ["focusTrap"],
1306
1397
  "inert-outside": ["inertOutside"],
1307
1398
  "native-edge-swipe-prevention": ["nativeEdgeSwipePrevention"],
1308
1399
  "native-focus-scroll-prevention": ["nativeFocusScrollPrevention"],
1309
1400
  presented: ["presented"],
1310
1401
  "restore-focus": ["restoreFocus"],
1402
+ "top-inset": ["topInset"],
1403
+ "bottom-inset": ["bottomInset"],
1404
+ "left-inset": ["leftInset"],
1405
+ "right-inset": ["rightInset"],
1311
1406
  "safe-area": ["safeArea"],
1312
1407
  "sheet-role": ["sheetRole"],
1313
1408
  stack: ["stack"],
@@ -1324,6 +1419,19 @@ function readChangedOptionsFromElement(element, name) {
1324
1419
  }
1325
1420
  return changed;
1326
1421
  }
1422
+ function formatInsetAttribute(value) {
1423
+ if (typeof value === "number") return Number.isFinite(value) ? `${value}px` : void 0;
1424
+ const normalized = value.trim();
1425
+ return normalized || void 0;
1426
+ }
1427
+ function combineInsetAttributes(...values) {
1428
+ const parts = values.flatMap((value) => {
1429
+ const attributeValue = value === void 0 ? void 0 : formatInsetAttribute(value);
1430
+ return attributeValue ? [attributeValue] : [];
1431
+ });
1432
+ if (parts.length === 0) return void 0;
1433
+ return parts.length === 1 ? parts[0] : `calc(${parts.join(" + ")})`;
1434
+ }
1327
1435
  function applySheetOptions(element, options) {
1328
1436
  if (options.contentPlacement) element.setAttribute("content-placement", options.contentPlacement);
1329
1437
  if (options.detents !== void 0) {
@@ -1335,7 +1443,6 @@ function applySheetOptions(element, options) {
1335
1443
  }
1336
1444
  if (options.defaultPresented !== void 0)
1337
1445
  element.setAttribute("default-presented", String(options.defaultPresented));
1338
- if (options.presented !== void 0) element.toggleAttribute("presented", options.presented);
1339
1446
  if (options.sheetRole) element.setAttribute("sheet-role", options.sheetRole);
1340
1447
  if (options.safeArea !== void 0) {
1341
1448
  element.setAttribute(
@@ -1346,7 +1453,23 @@ function applySheetOptions(element, options) {
1346
1453
  if (options.stack) element.setAttribute("stack", options.stack);
1347
1454
  if (options.tracks)
1348
1455
  element.setAttribute("tracks", Array.isArray(options.tracks) ? options.tracks.join(" ") : options.tracks);
1456
+ for (const [key, attr, edge] of [
1457
+ ["topInset", "top-inset", "top"],
1458
+ ["bottomInset", "bottom-inset", "bottom"],
1459
+ ["leftInset", "left-inset", "left"],
1460
+ ["rightInset", "right-inset", "right"]
1461
+ ]) {
1462
+ const hasEdgeInset = Object.prototype.hasOwnProperty.call(options, key);
1463
+ const hasContainerOffset = Object.prototype.hasOwnProperty.call(options, "containerOffset");
1464
+ const attributeValue = combineInsetAttributes(options[key], options.containerOffset?.[edge]);
1465
+ if (attributeValue !== void 0) {
1466
+ element.setAttribute(attr, attributeValue);
1467
+ } else if (hasEdgeInset || hasContainerOffset) {
1468
+ element.removeAttribute(attr);
1469
+ }
1470
+ }
1349
1471
  for (const [key, attr] of [
1472
+ ["detached", "detached"],
1350
1473
  ["swipe", "swipe"],
1351
1474
  ["swipeDismissal", "swipe-dismissal"],
1352
1475
  ["swipeOvershoot", "swipe-overshoot"],
@@ -1365,6 +1488,7 @@ function applySheetOptions(element, options) {
1365
1488
  if (options.themeColorDimming !== void 0) {
1366
1489
  element.setAttribute("theme-color-dimming", options.themeColorDimming === false ? "false" : "auto");
1367
1490
  }
1491
+ if (options.presented !== void 0) element.toggleAttribute("presented", options.presented);
1368
1492
  }
1369
1493
 
1370
1494
  // src/components/sheet-actions.ts
@@ -1679,4 +1803,4 @@ export {
1679
1803
  CapAutoFocusTarget,
1680
1804
  CapSheetPortal
1681
1805
  };
1682
- //# sourceMappingURL=chunk-FHGK4I6L.mjs.map
1806
+ //# sourceMappingURL=chunk-AXGC7BLW.mjs.map