@mhmo91/schmancy 0.4.24 → 0.4.32
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/ai/sheet.md +87 -25
- package/dist/ai/sheet.md +87 -25
- package/dist/{avatar-Cb_cbT8R.js → avatar-CVzlATFH.js} +3 -3
- package/dist/{avatar-Cb_cbT8R.js.map → avatar-CVzlATFH.js.map} +1 -1
- package/dist/{avatar-CP5pbPbp.cjs → avatar-DIALT_3k.cjs} +2 -2
- package/dist/{avatar-CP5pbPbp.cjs.map → avatar-DIALT_3k.cjs.map} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +91 -92
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/{sheet-DmrPnCAk.js → sheet-BGuqw1NG.js} +2 -2
- package/dist/{sheet-DmrPnCAk.js.map → sheet-BGuqw1NG.js.map} +1 -1
- package/dist/{sheet-DMOsLeJL.cjs → sheet-DlLj6OeU.cjs} +2 -2
- package/dist/{sheet-DMOsLeJL.cjs.map → sheet-DlLj6OeU.cjs.map} +1 -1
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +6 -7
- package/dist/{sheet.service-sSYoAEbY.cjs → sheet.service-DQQ44gXD.cjs} +3 -3
- package/dist/{sheet.service-sSYoAEbY.cjs.map → sheet.service-DQQ44gXD.cjs.map} +1 -1
- package/dist/{sheet.service-22gvsyq8.js → sheet.service-Dm2r1_ji.js} +98 -107
- package/dist/{sheet.service-22gvsyq8.js.map → sheet.service-Dm2r1_ji.js.map} +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/theme.js +1 -1
- package/package.json +1 -1
- package/types/src/sheet/sheet.service.d.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./animated-text-DcLpvyCq.js";
|
|
2
2
|
import { F as g, H as u, b as D, S as w, a as T, r as b } from "./area.component-xbNRrst9.js";
|
|
3
|
-
import { l as M, h as R, c as A, f as v, j as N, a as H, b as E, d as B, e as F, k as
|
|
3
|
+
import { l as M, h as R, c as A, f as v, j as N, a as H, b as E, d as B, e as F, k as O, g as $, i as j, n as k, s as L } from "./utils-jduntaQU.js";
|
|
4
4
|
import "./autocomplete-BqRrw118.js";
|
|
5
|
-
import { $ as Y, H as z, q as V, S as W, f as G, c as K, g as _, d as q, e as Q, h as J, a as U, b as X, j as Z, l as aa, m as ea, n as ra, k as ta, o as oa, p as sa, W as ca, s as na, i as ma, t as Sa } from "./avatar-
|
|
6
|
-
import { S as
|
|
5
|
+
import { $ as Y, H as z, q as V, S as W, f as G, c as K, g as _, d as q, e as Q, h as J, a as U, b as X, j as Z, l as aa, m as ea, n as ra, k as ta, o as oa, p as sa, W as ca, s as na, i as ma, t as Sa } from "./avatar-CVzlATFH.js";
|
|
6
|
+
import { S as ya } from "./boat-ByFTBKD2.js";
|
|
7
7
|
import "./spinner-Bh6XkC88.js";
|
|
8
8
|
import { S as pa, a as la } from "./icon-button-TbwQrO1b.js";
|
|
9
9
|
import "./media-D6ba0wB1.js";
|
|
@@ -15,7 +15,7 @@ import { S as ba } from "./payment-card-form-D7PV8spa.js";
|
|
|
15
15
|
import { S as Ma, v as Ra } from "./date-range-CA_4vjWe.js";
|
|
16
16
|
import { S as va } from "./date-range-inline-DFjyAvPv.js";
|
|
17
17
|
import { S as Ha, d as Ea } from "./delay-BJwsHbg3.js";
|
|
18
|
-
import { C as Fa, S as
|
|
18
|
+
import { C as Fa, S as Oa, a as $a } from "./dialog-content-CEZqJRzH.js";
|
|
19
19
|
import { $ as ka, D as La } from "./dialog-service-DFMlRcXf.js";
|
|
20
20
|
import { c as Ya, f as za, r as Va } from "./ripple-BumgqsDT.js";
|
|
21
21
|
import "./divider-DfetUf4S.js";
|
|
@@ -27,7 +27,7 @@ import { a as Ua, S as Xa } from "./input-BUtEXu3y.js";
|
|
|
27
27
|
import { S as ae, c as ee, a as re, b as te } from "./flex-CXMNh-nH.js";
|
|
28
28
|
import { L as se, a as ce, S as ne } from "./list-BCD8h2Do.js";
|
|
29
29
|
import "./menu-C0SauakY.js";
|
|
30
|
-
import { $ as Se, N as ie, S as
|
|
30
|
+
import { $ as Se, N as ie, S as ye, a as he } from "./notification-service-X8mRASdk.js";
|
|
31
31
|
import "./option-DVlCqux7.js";
|
|
32
32
|
import "./progress-BZ6AFT0f.js";
|
|
33
33
|
import { a as le, R as fe } from "./radio-button-D4Y1bWGN.js";
|
|
@@ -35,48 +35,47 @@ import { mutationObserver as de } from "./rxjs-utils.js";
|
|
|
35
35
|
import "rxjs";
|
|
36
36
|
import "./index-CuY8m6ta.js";
|
|
37
37
|
import { S as ge, s as ue } from "./select-wui4bIUE.js";
|
|
38
|
-
import "./sheet-
|
|
39
|
-
import {
|
|
40
|
-
import { S as
|
|
41
|
-
import { S as Oe, a as
|
|
42
|
-
import { B as
|
|
43
|
-
import { p as
|
|
44
|
-
import { a as
|
|
45
|
-
import { a as
|
|
38
|
+
import "./sheet-BGuqw1NG.js";
|
|
39
|
+
import { S as we, d as Te, b as be, a as Ie, c as Me, T as Re, f as Ae, s as ve, t as Ne } from "./sheet.service-Dm2r1_ji.js";
|
|
40
|
+
import { S as Ee, a as Be } from "./slider-Dwm1KfNL.js";
|
|
41
|
+
import { S as Oe, a as $e, b as je, s as ke } from "./schmancy-steps-container-BskkdQwD.js";
|
|
42
|
+
import { B as Pe, I as Ye, L as ze, M as Ve, S as We, a as Ge, b as Ke, d as _e, c as qe } from "./context-object-CDDP4bTk.js";
|
|
43
|
+
import { p as Je, a as Ue, u as Xe, F as Ze, c as ar, D as er, y as rr, B as tr, A as or, w as sr, v as cr, x as nr, C as mr, E as Sr, t as ir, z as yr, b as hr, r as pr, d as lr, q as fr, f as xr, g as dr, i as Cr, j as gr, k as ur, l as Dr, o as wr, h as Tr, n as br, m as Ir, e as Mr, s as Rr } from "./selector-hook-DL0SIQiY.js";
|
|
44
|
+
import { a as vr, S as Nr } from "./surface-DhiuAGb8.js";
|
|
45
|
+
import { a as Er, S as Br } from "./table-DSZ9kmUG.js";
|
|
46
46
|
import "./tabs-compatibility-B7aJnQ0X.js";
|
|
47
47
|
import "./textarea-Bq0XdGaH.js";
|
|
48
48
|
import { S as Or } from "./theme.interface-C5Kj6WjD.js";
|
|
49
49
|
import "./theme-button-DYoygmRA.js";
|
|
50
|
-
import { S as
|
|
51
|
-
import { S as
|
|
52
|
-
import { SchmancyEvents as
|
|
53
|
-
import { T as
|
|
54
|
-
import { S as
|
|
55
|
-
import { i as
|
|
50
|
+
import { S as jr, t as kr } from "./tooltip-DBuaAFmK.js";
|
|
51
|
+
import { S as Pr } from "./tree-CfE695gp.js";
|
|
52
|
+
import { SchmancyEvents as zr } from "./types.js";
|
|
53
|
+
import { T as Wr } from "./typewriter-BZ_adVXB.js";
|
|
54
|
+
import { S as Kr } from "./typography-DI5RXpWs.js";
|
|
55
|
+
import { i as qr } from "./intersection-CJxzz8c-.js";
|
|
56
56
|
export {
|
|
57
57
|
ka as $dialog,
|
|
58
58
|
Y as $drawer,
|
|
59
59
|
Se as $notify,
|
|
60
|
-
|
|
61
|
-
Ye as BaseStore,
|
|
60
|
+
Pe as BaseStore,
|
|
62
61
|
Fa as ConfirmDialog,
|
|
63
62
|
La as DialogService,
|
|
64
63
|
g as FINDING_MORTIES,
|
|
65
64
|
u as HERE_RICKY,
|
|
66
65
|
D as HISTORY_STRATEGY,
|
|
67
66
|
z as HereMorty,
|
|
68
|
-
|
|
67
|
+
Ye as IndexedDBStorageManager,
|
|
69
68
|
se as List,
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
ze as LocalStorageManager,
|
|
70
|
+
Ve as MemoryStorageManager,
|
|
72
71
|
ie as NotificationAudioService,
|
|
73
72
|
le as RadioButton,
|
|
74
73
|
fe as RadioGroup,
|
|
75
74
|
w as SchmancyArea,
|
|
76
|
-
|
|
75
|
+
We as SchmancyArrayStore,
|
|
77
76
|
V as SchmancyAvatar,
|
|
78
77
|
W as SchmancyBadgeV2,
|
|
79
|
-
|
|
78
|
+
ya as SchmancyBoat,
|
|
80
79
|
pa as SchmancyButton,
|
|
81
80
|
xa as SchmancyCheckbox,
|
|
82
81
|
Ca as SchmancyCircularProgress,
|
|
@@ -92,18 +91,18 @@ export {
|
|
|
92
91
|
U as SchmancyContentDrawerSheetMode,
|
|
93
92
|
X as SchmancyContentDrawerSheetState,
|
|
94
93
|
qa as SchmancyCountriesSelect,
|
|
95
|
-
|
|
94
|
+
Er as SchmancyDataTable,
|
|
96
95
|
Ma as SchmancyDateRange,
|
|
97
96
|
va as SchmancyDateRangeInline,
|
|
98
97
|
Ha as SchmancyDelay,
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
Oa as SchmancyDialog,
|
|
99
|
+
$a as SchmancyDialogContent,
|
|
101
100
|
Z as SchmancyDrawerAppbar,
|
|
102
101
|
aa as SchmancyDrawerNavbarMode,
|
|
103
102
|
ea as SchmancyDrawerNavbarState,
|
|
104
103
|
Ga as SchmancyDropdown,
|
|
105
104
|
Ka as SchmancyDropdownContent,
|
|
106
|
-
|
|
105
|
+
zr as SchmancyEvents,
|
|
107
106
|
ae as SchmancyFlex,
|
|
108
107
|
ee as SchmancyFlexV2,
|
|
109
108
|
re as SchmancyGrid,
|
|
@@ -114,36 +113,36 @@ export {
|
|
|
114
113
|
ra as SchmancyNavigationDrawer,
|
|
115
114
|
ta as SchmancyNavigationDrawerContent,
|
|
116
115
|
oa as SchmancyNavigationDrawerSidebar,
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
ye as SchmancyNotification,
|
|
117
|
+
he as SchmancyNotificationContainer,
|
|
119
118
|
ba as SchmancyPaymentCardForm,
|
|
120
119
|
te as SchmancyScroll,
|
|
121
120
|
ge as SchmancySelect,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
we as SchmancySheetPosition,
|
|
122
|
+
Ee as SchmancySlide,
|
|
123
|
+
Be as SchmancySlider,
|
|
125
124
|
Oe as SchmancyStep,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
$e as SchmancyStepsContainer,
|
|
126
|
+
Ge as SchmancyStoreObject,
|
|
127
|
+
vr as SchmancySurface,
|
|
128
|
+
Nr as SchmancySurfaceTypeContext,
|
|
129
|
+
Br as SchmancyTableRow,
|
|
131
130
|
sa as SchmancyTeleportation,
|
|
132
131
|
Or as SchmancyTheme,
|
|
133
|
-
|
|
132
|
+
Te as SchmancyThemeComponent,
|
|
134
133
|
Qa as SchmancyTimezonesSelect,
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
jr as SchmancyTooltip,
|
|
135
|
+
Pr as SchmancyTree,
|
|
136
|
+
Kr as SchmancyTypography,
|
|
138
137
|
la as SchmnacyIconButton,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
138
|
+
Ke as SessionStorageManager,
|
|
139
|
+
be as SheetHereMorty,
|
|
140
|
+
Ie as SheetWhereAreYouRicky,
|
|
141
|
+
je as StepsController,
|
|
142
|
+
_e as StoreError,
|
|
143
|
+
Me as ThemeHereIAm,
|
|
144
|
+
Re as ThemeWhereAreYou,
|
|
145
|
+
Wr as TypewriterElement,
|
|
147
146
|
ca as WhereAreYouRicky,
|
|
148
147
|
T as area,
|
|
149
148
|
M as buildQueryString,
|
|
@@ -151,50 +150,50 @@ export {
|
|
|
151
150
|
R as compareActiveRoutes,
|
|
152
151
|
A as compareCustomElementConstructors,
|
|
153
152
|
v as compareRouteActions,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
153
|
+
Je as compareValues,
|
|
154
|
+
Ue as createArrayContext,
|
|
155
|
+
Xe as createCollectionSelector,
|
|
156
|
+
Ze as createCompoundSelector,
|
|
157
|
+
ar as createContext,
|
|
158
|
+
er as createCountSelector,
|
|
159
|
+
rr as createEntriesSelector,
|
|
160
|
+
tr as createFilterSelector,
|
|
161
|
+
or as createFindSelector,
|
|
162
|
+
sr as createItemSelector,
|
|
163
|
+
cr as createItemsSelector,
|
|
164
|
+
nr as createKeysSelector,
|
|
165
|
+
mr as createMapSelector,
|
|
166
|
+
Sr as createOptimizedSelector,
|
|
168
167
|
N as createRouteCacheKey,
|
|
169
|
-
|
|
168
|
+
ir as createSelector,
|
|
170
169
|
yr as createSortSelector,
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
qe as createStorageManager,
|
|
171
|
+
hr as createTestArrayContext,
|
|
173
172
|
H as debounce,
|
|
174
173
|
E as decodeRouteState,
|
|
175
174
|
B as deepMerge,
|
|
176
175
|
Ea as delayContext,
|
|
177
176
|
F as encodeRouteState,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
O as extractQueryParams,
|
|
178
|
+
pr as filterArray,
|
|
179
|
+
lr as filterArrayItems,
|
|
180
|
+
fr as filterMap,
|
|
181
|
+
xr as filterMapItems,
|
|
182
|
+
Ae as formateTheme,
|
|
184
183
|
za as fullHeight,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
184
|
+
dr as getFieldValue,
|
|
185
|
+
$ as getTagName,
|
|
186
|
+
qr as intersection$,
|
|
187
|
+
Cr as isArray,
|
|
188
|
+
gr as isDate,
|
|
189
|
+
ur as isIterable,
|
|
190
|
+
Dr as isMap,
|
|
191
|
+
wr as isNil,
|
|
192
|
+
Tr as isNumber,
|
|
194
193
|
j as isObject,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
194
|
+
br as isPlainObject,
|
|
195
|
+
Ir as isSet,
|
|
196
|
+
Mr as isString,
|
|
198
197
|
de as mutationObserver,
|
|
199
198
|
k as normalizeTagName,
|
|
200
199
|
Va as ripple,
|
|
@@ -203,12 +202,12 @@ export {
|
|
|
203
202
|
na as schmancyContentDrawer,
|
|
204
203
|
ma as schmancyNavDrawer,
|
|
205
204
|
ue as select,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
Rr as selectItem,
|
|
206
|
+
ve as sheet,
|
|
207
|
+
ke as stepsContext,
|
|
208
|
+
Ne as tailwindStyles,
|
|
210
209
|
Sa as teleport,
|
|
211
|
-
|
|
210
|
+
kr as tooltip,
|
|
212
211
|
Ra as validateInitialDateRange
|
|
213
212
|
};
|
|
214
213
|
//# sourceMappingURL=index.js.map
|
package/dist/nav-drawer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./avatar-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./avatar-DIALT_3k.cjs");exports.$drawer=e.$drawer,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>e.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=e.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=e.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>e.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerSidebar}),exports.schmancyNavDrawer=e.schmancyNavDrawer;
|
|
2
2
|
//# sourceMappingURL=nav-drawer.cjs.map
|
package/dist/nav-drawer.js
CHANGED
|
@@ -6,7 +6,7 @@ import { customElement as v, property as c, query as k, queryAssignedElements as
|
|
|
6
6
|
import { css as S, html as y } from "lit";
|
|
7
7
|
import { $ as C } from "./litElement.mixin-DGeprHKB.js";
|
|
8
8
|
import { when as $ } from "lit/directives/when.js";
|
|
9
|
-
import { S as O, s as u, a as U, b as j } from "./sheet.service-
|
|
9
|
+
import { S as O, s as u, a as U, b as j } from "./sheet.service-Dm2r1_ji.js";
|
|
10
10
|
var P = Object.getOwnPropertyDescriptor;
|
|
11
11
|
let f = class extends x(S``) {
|
|
12
12
|
render() {
|
|
@@ -138,4 +138,4 @@ o([c({ type: String, reflect: !0 })], n.prototype, "uid", 2), o([c({ type: Boole
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
})], n.prototype, "onOpenChange", 1), n = o([v("schmancy-sheet")], n);
|
|
141
|
-
//# sourceMappingURL=sheet-
|
|
141
|
+
//# sourceMappingURL=sheet-BGuqw1NG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet-DmrPnCAk.js","sources":["../src/sheet/header.ts","../src/sheet/sheet.ts","../src/sheet/hook.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\n@customElement('schmancy-sheet-header')\nexport default class SchmancySheetHeader extends TailwindElement(css``) {\n\trender() {\n\t\treturn html`\n\t\t\t<sch-flex class=\"absolute top-0 left-0 md:left-[unset] md:right-0\">\n\t\t\t\t<div class=\"block md:hidden flex-1 justify-start items-start\">\n\t\t\t\t\t<slot name=\"back\">\n\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span class=\"text-[24px]\">← </span>\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"hidden md:block flex-1 justify-end items-end\">\n\t\t\t\t\t<slot name=\"actions\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tclose\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\t\t\t</sch-flex>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet-header': SchmancySheetHeader\n\t}\n}\n","import { $LitElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { when } from 'lit/directives/when.js'\nimport { fromEvent, merge, of, take, takeUntil, tap } from 'rxjs'\nimport { on } from './hook'\nimport style from './sheet.scss?inline'\nimport {\n\tSchmancySheetPosition,\n\tSheetHereMorty,\n\tSheetWhereAreYouRicky,\n\tSheetWhereAreYouRickyEvent,\n\tsheet,\n} from './sheet.service'\n\n@customElement('schmancy-sheet')\nexport default class SchmancySheet extends $LitElement(style) {\n\t@property({ type: String, reflect: true }) uid!: string\n\t@property({ type: Boolean, reflect: true }) open = false\n\t@property({ type: String, reflect: true }) header: 'hidden' | 'visible' = 'visible'\n\t@property({ type: String, reflect: true }) position: SchmancySheetPosition = SchmancySheetPosition.Side\n\t@property({ type: Boolean, reflect: true }) persist = false\n\t@property({ type: Boolean, reflect: true }) lock = false\n\t@property({ type: Boolean, reflect: true }) handleHistory = true\n\t@property({ type: String, reflect: true }) title = ''\n\n\t@query('.sheet') private sheet!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) private assignedElements!: HTMLElement[]\n\n\t@property() focusAttribute = 'autofocus'\n\tprivate lastFocusedElement: HTMLElement | null = null\n\n\t@on('open')\n\tonOpenChange(_oldValue: boolean, newValue: boolean) {\n\t\tif (newValue) {\n\t\t\tthis.lastFocusedElement = document.activeElement as HTMLElement\n\t\t\tthis.addFocusTrap()\n\t\t\tthis.focus()\n\t\t} else {\n\t\t\tthis.removeFocusTrap()\n\t\t\tthis.lastFocusedElement?.focus()\n\t\t\tthis.lastFocusedElement = null\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setupEventListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\n\t}\n\n\tprivate setupEventListeners() {\n\t\t// Handle browser back button - only if handleHistory is true\n\t\tconst popState$ = this.handleHistory\n\t\t\t? fromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\t\t\ttap(e => {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tthis.closeSheet()\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: of(null).pipe(take(0)) // Empty observable if handleHistory is false\n\n\t\t// Handle ESC key - respect allowOverlayDismiss\n\t\tconst keyUp$ = fromEvent<KeyboardEvent>(window, 'keyup').pipe(\n\t\t\ttap(event => {\n\t\t\t\t// Only handle ESC key dismissal if allowOverlayDismiss is true\n\t\t\t\tif (event.key === 'Escape' && !this.sheetContainsFocus() && !this.lock) {\n\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\n\t\t// Handle inter-component communication\n\t\tconst rickyComm$ = fromEvent<SheetWhereAreYouRickyEvent>(window, SheetWhereAreYouRicky).pipe(\n\t\t\ttap(e => {\n\t\t\t\tif (e.detail.uid === this.uid) this.announcePresence()\n\t\t\t}),\n\t\t)\n\n\t\tmerge(popState$, keyUp$, rickyComm$).pipe(takeUntil(this.disconnecting)).subscribe()\n\t}\n\n\tprivate sheetContainsFocus(): boolean {\n\t\treturn this.sheet?.contains(document.activeElement) ?? false\n\t}\n\n\tprivate announcePresence() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(SheetHereMorty, {\n\t\t\t\tdetail: { sheet: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate addFocusTrap() {\n\t\tdocument.addEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate removeFocusTrap() {\n\t\tdocument.removeEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate handleFocusIn = (e: Event) => {\n\t\tif (!this.sheet?.contains(e.target as Node)) {\n\t\t\tthis.focus()\n\t\t}\n\t}\n\n\tsetIsSheetShown(isShown: boolean) {\n\t\tthis.sheet?.setAttribute('aria-hidden', String(!isShown))\n\t\tthis.sheet?.setAttribute('aria-modal', String(isShown))\n\t}\n\n\tcloseSheet() {\n\t\tthis.open = false\n\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t}\n\n\tprivate getFocusElement(): HTMLElement | null {\n\t\tconst selector = `[${this.focusAttribute}]`\n\t\treturn (this.assignedElements.find(el => el.matches(selector) || el.querySelector(selector)) as HTMLElement) ?? null\n\t}\n\n\toverride focus() {\n\t\tthis.getFocusElement()?.focus()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"sheet\" role=\"dialog\" aria-labelledby=\"sheet-title\" aria-hidden=${!this.open} aria-modal=${this.open}>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"overlay\"\n\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\tif (!this.lock) {\n\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t></div>\n\t\t\t\t<schmancy-grid\n\t\t\t\t\trows=${this.header === 'hidden' ? '1fr' : 'auto 1fr'}\n\t\t\t\t\tclass=\"content w-full\"\n\t\t\t\t\tdata-position=${this.position}\n\t\t\t\t>\n\t\t\t\t\t${when(\n\t\t\t\t\t\tthis.header !== 'hidden',\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\thtml`<schmancy-sheet-header\n\t\t\t\t\t\t\t\tclass=\"sticky top-0 z-50 w-full\"\n\t\t\t\t\t\t\t\t@dismiss=${(e: CustomEvent) => {\n\t\t\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tid=\"sheet-title\"\n\t\t\t\t\t\t\t\ttitle=${this.title}\n\t\t\t\t\t\t\t></schmancy-sheet-header>`,\n\t\t\t\t\t)}\n\n\t\t\t\t\t<schmancy-surface rounded=\"left\" fill=\"all\" id=\"body\" class=\"overflow-auto\" type=\"surface\">\n\t\t\t\t\t\t<schmancy-scroll> <slot></slot></schmancy-scroll>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</schmancy-grid>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet': SchmancySheet\n\t}\n}\n","// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n//\n// Usage:\n//\n// @watch('propName')\n// handlePropChange(oldValue, newValue) {\n// ...\n// }\n//\ninterface WatchOptions {\n\twaitUntilFirstUpdate?: boolean\n}\n\nexport function on(propName: string, options?: WatchOptions) {\n\treturn (protoOrDescriptor: any, name: string): any => {\n\t\tconst { willUpdate } = protoOrDescriptor\n\n\t\toptions = Object.assign({ waitUntilFirstUpdate: false }, options) as WatchOptions\n\n\t\tprotoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n\t\t\twillUpdate.call(this, changedProps)\n\n\t\t\tif (changedProps.has(propName)) {\n\t\t\t\tconst oldValue = changedProps.get(propName)\n\t\t\t\tconst newValue = this[propName]\n\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\tif (!options?.waitUntilFirstUpdate || this.hasUpdated) {\n\t\t\t\t\t\tthis[name].call(this, oldValue, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["SchmancySheetHeader","TailwindElement","css","render","html","this","dispatchEvent","CustomEvent","bubbles","composed","customElement","SchmancySheet","$LitElement","constructor","super","arguments","open","header","position","SchmancySheetPosition","Side","persist","lock","handleHistory","title","focusAttribute","lastFocusedElement","handleFocusIn","e","sheet","contains","target","focus","_oldValue","newValue","document","activeElement","addFocusTrap","removeFocusTrap","connectedCallback","setupEventListeners","disconnectedCallback","disconnecting","next","popState$","fromEvent","window","pipe","tap","preventDefault","closeSheet","of","take","keyUp$","event","key","sheetContainsFocus","dismiss","uid","rickyComm$","SheetWhereAreYouRicky","detail","announcePresence","merge","takeUntil","subscribe","SheetHereMorty","addEventListener","removeEventListener","isShown","setAttribute","String","selector","assignedElements","find","el","matches","querySelector","getFocusElement","stopPropagation","when","propName","options","__decorateClass","property","type","reflect","prototype","Boolean","query","queryAssignedElements","flatten","protoOrDescriptor","name","willUpdate","Object","assign","waitUntilFirstUpdate","changedProps","call","has","oldValue","get","hasUpdated"],"mappings":";;;;;;;;;;AAKA,IAAqBA,IAArB,cAAiDC,EAAgBC;EAChE,SAAAC;AACQ,WAAAC;AAA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,EAiBpB4E,WAAA,gBAAA,CAAA,GAjBoB5E,IAArBwE,EAAA,CADCzE,EAAc,gBACMC,CAAAA,GAAAA,CAAAA;"}
|
|
1
|
+
{"version":3,"file":"sheet-BGuqw1NG.js","sources":["../src/sheet/header.ts","../src/sheet/sheet.ts","../src/sheet/hook.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\n@customElement('schmancy-sheet-header')\nexport default class SchmancySheetHeader extends TailwindElement(css``) {\n\trender() {\n\t\treturn html`\n\t\t\t<sch-flex class=\"absolute top-0 left-0 md:left-[unset] md:right-0\">\n\t\t\t\t<div class=\"block md:hidden flex-1 justify-start items-start\">\n\t\t\t\t\t<slot name=\"back\">\n\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span class=\"text-[24px]\">← </span>\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"hidden md:block flex-1 justify-end items-end\">\n\t\t\t\t\t<slot name=\"actions\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tclose\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\t\t\t</sch-flex>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet-header': SchmancySheetHeader\n\t}\n}\n","import { $LitElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { when } from 'lit/directives/when.js'\nimport { fromEvent, merge, of, take, takeUntil, tap } from 'rxjs'\nimport { on } from './hook'\nimport style from './sheet.scss?inline'\nimport {\n\tSchmancySheetPosition,\n\tSheetHereMorty,\n\tSheetWhereAreYouRicky,\n\tSheetWhereAreYouRickyEvent,\n\tsheet,\n} from './sheet.service'\n\n@customElement('schmancy-sheet')\nexport default class SchmancySheet extends $LitElement(style) {\n\t@property({ type: String, reflect: true }) uid!: string\n\t@property({ type: Boolean, reflect: true }) open = false\n\t@property({ type: String, reflect: true }) header: 'hidden' | 'visible' = 'visible'\n\t@property({ type: String, reflect: true }) position: SchmancySheetPosition = SchmancySheetPosition.Side\n\t@property({ type: Boolean, reflect: true }) persist = false\n\t@property({ type: Boolean, reflect: true }) lock = false\n\t@property({ type: Boolean, reflect: true }) handleHistory = true\n\t@property({ type: String, reflect: true }) title = ''\n\n\t@query('.sheet') private sheet!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) private assignedElements!: HTMLElement[]\n\n\t@property() focusAttribute = 'autofocus'\n\tprivate lastFocusedElement: HTMLElement | null = null\n\n\t@on('open')\n\tonOpenChange(_oldValue: boolean, newValue: boolean) {\n\t\tif (newValue) {\n\t\t\tthis.lastFocusedElement = document.activeElement as HTMLElement\n\t\t\tthis.addFocusTrap()\n\t\t\tthis.focus()\n\t\t} else {\n\t\t\tthis.removeFocusTrap()\n\t\t\tthis.lastFocusedElement?.focus()\n\t\t\tthis.lastFocusedElement = null\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setupEventListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\n\t}\n\n\tprivate setupEventListeners() {\n\t\t// Handle browser back button - only if handleHistory is true\n\t\tconst popState$ = this.handleHistory\n\t\t\t? fromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\t\t\ttap(e => {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tthis.closeSheet()\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: of(null).pipe(take(0)) // Empty observable if handleHistory is false\n\n\t\t// Handle ESC key - respect allowOverlayDismiss\n\t\tconst keyUp$ = fromEvent<KeyboardEvent>(window, 'keyup').pipe(\n\t\t\ttap(event => {\n\t\t\t\t// Only handle ESC key dismissal if allowOverlayDismiss is true\n\t\t\t\tif (event.key === 'Escape' && !this.sheetContainsFocus() && !this.lock) {\n\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\n\t\t// Handle inter-component communication\n\t\tconst rickyComm$ = fromEvent<SheetWhereAreYouRickyEvent>(window, SheetWhereAreYouRicky).pipe(\n\t\t\ttap(e => {\n\t\t\t\tif (e.detail.uid === this.uid) this.announcePresence()\n\t\t\t}),\n\t\t)\n\n\t\tmerge(popState$, keyUp$, rickyComm$).pipe(takeUntil(this.disconnecting)).subscribe()\n\t}\n\n\tprivate sheetContainsFocus(): boolean {\n\t\treturn this.sheet?.contains(document.activeElement) ?? false\n\t}\n\n\tprivate announcePresence() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(SheetHereMorty, {\n\t\t\t\tdetail: { sheet: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate addFocusTrap() {\n\t\tdocument.addEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate removeFocusTrap() {\n\t\tdocument.removeEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate handleFocusIn = (e: Event) => {\n\t\tif (!this.sheet?.contains(e.target as Node)) {\n\t\t\tthis.focus()\n\t\t}\n\t}\n\n\tsetIsSheetShown(isShown: boolean) {\n\t\tthis.sheet?.setAttribute('aria-hidden', String(!isShown))\n\t\tthis.sheet?.setAttribute('aria-modal', String(isShown))\n\t}\n\n\tcloseSheet() {\n\t\tthis.open = false\n\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t}\n\n\tprivate getFocusElement(): HTMLElement | null {\n\t\tconst selector = `[${this.focusAttribute}]`\n\t\treturn (this.assignedElements.find(el => el.matches(selector) || el.querySelector(selector)) as HTMLElement) ?? null\n\t}\n\n\toverride focus() {\n\t\tthis.getFocusElement()?.focus()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"sheet\" role=\"dialog\" aria-labelledby=\"sheet-title\" aria-hidden=${!this.open} aria-modal=${this.open}>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"overlay\"\n\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\tif (!this.lock) {\n\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t></div>\n\t\t\t\t<schmancy-grid\n\t\t\t\t\trows=${this.header === 'hidden' ? '1fr' : 'auto 1fr'}\n\t\t\t\t\tclass=\"content w-full\"\n\t\t\t\t\tdata-position=${this.position}\n\t\t\t\t>\n\t\t\t\t\t${when(\n\t\t\t\t\t\tthis.header !== 'hidden',\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\thtml`<schmancy-sheet-header\n\t\t\t\t\t\t\t\tclass=\"sticky top-0 z-50 w-full\"\n\t\t\t\t\t\t\t\t@dismiss=${(e: CustomEvent) => {\n\t\t\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tid=\"sheet-title\"\n\t\t\t\t\t\t\t\ttitle=${this.title}\n\t\t\t\t\t\t\t></schmancy-sheet-header>`,\n\t\t\t\t\t)}\n\n\t\t\t\t\t<schmancy-surface rounded=\"left\" fill=\"all\" id=\"body\" class=\"overflow-auto\" type=\"surface\">\n\t\t\t\t\t\t<schmancy-scroll> <slot></slot></schmancy-scroll>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</schmancy-grid>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet': SchmancySheet\n\t}\n}\n","// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n//\n// Usage:\n//\n// @watch('propName')\n// handlePropChange(oldValue, newValue) {\n// ...\n// }\n//\ninterface WatchOptions {\n\twaitUntilFirstUpdate?: boolean\n}\n\nexport function on(propName: string, options?: WatchOptions) {\n\treturn (protoOrDescriptor: any, name: string): any => {\n\t\tconst { willUpdate } = protoOrDescriptor\n\n\t\toptions = Object.assign({ waitUntilFirstUpdate: false }, options) as WatchOptions\n\n\t\tprotoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n\t\t\twillUpdate.call(this, changedProps)\n\n\t\t\tif (changedProps.has(propName)) {\n\t\t\t\tconst oldValue = changedProps.get(propName)\n\t\t\t\tconst newValue = this[propName]\n\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\tif (!options?.waitUntilFirstUpdate || this.hasUpdated) {\n\t\t\t\t\t\tthis[name].call(this, oldValue, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["SchmancySheetHeader","TailwindElement","css","render","html","this","dispatchEvent","CustomEvent","bubbles","composed","customElement","SchmancySheet","$LitElement","constructor","super","arguments","open","header","position","SchmancySheetPosition","Side","persist","lock","handleHistory","title","focusAttribute","lastFocusedElement","handleFocusIn","e","sheet","contains","target","focus","_oldValue","newValue","document","activeElement","addFocusTrap","removeFocusTrap","connectedCallback","setupEventListeners","disconnectedCallback","disconnecting","next","popState$","fromEvent","window","pipe","tap","preventDefault","closeSheet","of","take","keyUp$","event","key","sheetContainsFocus","dismiss","uid","rickyComm$","SheetWhereAreYouRicky","detail","announcePresence","merge","takeUntil","subscribe","SheetHereMorty","addEventListener","removeEventListener","isShown","setAttribute","String","selector","assignedElements","find","el","matches","querySelector","getFocusElement","stopPropagation","when","propName","options","__decorateClass","property","type","reflect","prototype","Boolean","query","queryAssignedElements","flatten","protoOrDescriptor","name","willUpdate","Object","assign","waitUntilFirstUpdate","changedProps","call","has","oldValue","get","hasUpdated"],"mappings":";;;;;;;;;;AAKA,IAAqBA,IAArB,cAAiDC,EAAgBC;EAChE,SAAAC;AACQ,WAAAC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,gBAKO,MACHC;AAAAA,WAAAC,cACJ,IAAIC,YAAY,WAAW,EAC1BC,SAAAA,IACAC,UAAAA,GAEF,CAAA,CAAA;AAAA,IAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAWQ,MACHJ;AAAAA,WAAAC,cACJ,IAAIC,YAAY,WAAW,EAC1BC,SAAAA,IACAC,UAAAA,GAEF,CAAA,CAAA;AAAA,IAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EACA;AAAA;AA/BaT;;;GAArB,CADCU,EAAc,2BACMV;;;;;ACWrB,IAAqBW,IAArB,cAA2CC;EAA3C,cAAAC;AAAAC,aAAAC,SAEoDV,GAAAA,KAAAW,WACuBX,KAAAY,SAAA,WAC/BZ,KAAAa,WAAkCC,EAAsBC,MAC7Cf,KAAAgB,UAAAA,IACHhB,KAAAiB,OAAAA,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AA,GAXdhF,EAW8B4E,WAAA,oBAAA,IAEtCJ,EAAA,CAAXC,MAbmBzE,EAaR4E,WAAA,kBAAA,CAIZJ,GAAAA,EAAA,ECfkBF,IDcd,QCbG,CAACW,GAAwBC,MAAAA;AACzB,UAAAC,YAAEA,EAAAA,IAAeF;AAEvBV,EAAAA,IAAUa,OAAOC,OAAO,EAAEC,sBAAAA,MAA+Bf,CAEvCU,GAAAA,EAAAE,aAAa,SAAUI,GAAAA;AAGpC,QAFOJ,EAAAK,KAAK9F,MAAM6F,CAElBA,GAAAA,EAAaE,IAAInB,CAAW,GAAA;AACzB,YAAAoB,IAAWH,EAAaI,IAAIrB,CAC5B/C,GAAAA,IAAW7B,KAAK4E,CAElBoB;AAAAA,MAAAA,MAAanE,MACXgD,GAASe,wBAAAA,CAAwB5F,KAAKkG,cAC1ClG,KAAKwF,GAAMM,KAAK9F,MAAMgG,GAAUnE,CAElC;AAAA,IAAA;AAAA,EAEF;AAAA,EDrBmBvB,GAAAA,EAiBpB4E,WAAA,gBAAA,CAAA,GAjBoB5E,IAArBwE,EAAA,CADCzE,EAAc,gBACMC,CAAAA,GAAAA,CAAAA;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const a=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const v=require("./tailwind.mixin-CBu1BEQZ.cjs"),r=require("lit/decorators.js"),u=require("lit"),f=require("./litElement.mixin-CII9bbap.cjs"),b=require("lit/directives/when.js"),d=require("./sheet.service-
|
|
1
|
+
"use strict";const a=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const v=require("./tailwind.mixin-CBu1BEQZ.cjs"),r=require("lit/decorators.js"),u=require("lit"),f=require("./litElement.mixin-CII9bbap.cjs"),b=require("lit/directives/when.js"),d=require("./sheet.service-DQQ44gXD.cjs");var g=Object.getOwnPropertyDescriptor;let y=class extends v.TailwindElement(u.css``){render(){return u.html`
|
|
2
2
|
<sch-flex class="absolute top-0 left-0 md:left-[unset] md:right-0">
|
|
3
3
|
<div class="block md:hidden flex-1 justify-start items-start">
|
|
4
4
|
<slot name="back">
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
</schmancy-grid>
|
|
45
45
|
</div>
|
|
46
46
|
`}};var p,m;o([r.property({type:String,reflect:!0})],n.prototype,"uid",2),o([r.property({type:Boolean,reflect:!0})],n.prototype,"open",2),o([r.property({type:String,reflect:!0})],n.prototype,"header",2),o([r.property({type:String,reflect:!0})],n.prototype,"position",2),o([r.property({type:Boolean,reflect:!0})],n.prototype,"persist",2),o([r.property({type:Boolean,reflect:!0})],n.prototype,"lock",2),o([r.property({type:Boolean,reflect:!0})],n.prototype,"handleHistory",2),o([r.property({type:String,reflect:!0})],n.prototype,"title",2),o([r.query(".sheet")],n.prototype,"sheet",2),o([r.queryAssignedElements({flatten:!0})],n.prototype,"assignedElements",2),o([r.property()],n.prototype,"focusAttribute",2),o([(p="open",(t,s)=>{const{willUpdate:c}=t;m=Object.assign({waitUntilFirstUpdate:!1},m),t.willUpdate=function(e){if(c.call(this,e),e.has(p)){const h=e.get(p),i=this[p];h!==i&&(m?.waitUntilFirstUpdate&&!this.hasUpdated||this[s].call(this,h,i))}}})],n.prototype,"onOpenChange",1),n=o([r.customElement("schmancy-sheet")],n);
|
|
47
|
-
//# sourceMappingURL=sheet-
|
|
47
|
+
//# sourceMappingURL=sheet-DlLj6OeU.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet-DMOsLeJL.cjs","sources":["../src/sheet/header.ts","../src/sheet/sheet.ts","../src/sheet/hook.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\n@customElement('schmancy-sheet-header')\nexport default class SchmancySheetHeader extends TailwindElement(css``) {\n\trender() {\n\t\treturn html`\n\t\t\t<sch-flex class=\"absolute top-0 left-0 md:left-[unset] md:right-0\">\n\t\t\t\t<div class=\"block md:hidden flex-1 justify-start items-start\">\n\t\t\t\t\t<slot name=\"back\">\n\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span class=\"text-[24px]\">← </span>\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"hidden md:block flex-1 justify-end items-end\">\n\t\t\t\t\t<slot name=\"actions\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tclose\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\t\t\t</sch-flex>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet-header': SchmancySheetHeader\n\t}\n}\n","import { $LitElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { when } from 'lit/directives/when.js'\nimport { fromEvent, merge, of, take, takeUntil, tap } from 'rxjs'\nimport { on } from './hook'\nimport style from './sheet.scss?inline'\nimport {\n\tSchmancySheetPosition,\n\tSheetHereMorty,\n\tSheetWhereAreYouRicky,\n\tSheetWhereAreYouRickyEvent,\n\tsheet,\n} from './sheet.service'\n\n@customElement('schmancy-sheet')\nexport default class SchmancySheet extends $LitElement(style) {\n\t@property({ type: String, reflect: true }) uid!: string\n\t@property({ type: Boolean, reflect: true }) open = false\n\t@property({ type: String, reflect: true }) header: 'hidden' | 'visible' = 'visible'\n\t@property({ type: String, reflect: true }) position: SchmancySheetPosition = SchmancySheetPosition.Side\n\t@property({ type: Boolean, reflect: true }) persist = false\n\t@property({ type: Boolean, reflect: true }) lock = false\n\t@property({ type: Boolean, reflect: true }) handleHistory = true\n\t@property({ type: String, reflect: true }) title = ''\n\n\t@query('.sheet') private sheet!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) private assignedElements!: HTMLElement[]\n\n\t@property() focusAttribute = 'autofocus'\n\tprivate lastFocusedElement: HTMLElement | null = null\n\n\t@on('open')\n\tonOpenChange(_oldValue: boolean, newValue: boolean) {\n\t\tif (newValue) {\n\t\t\tthis.lastFocusedElement = document.activeElement as HTMLElement\n\t\t\tthis.addFocusTrap()\n\t\t\tthis.focus()\n\t\t} else {\n\t\t\tthis.removeFocusTrap()\n\t\t\tthis.lastFocusedElement?.focus()\n\t\t\tthis.lastFocusedElement = null\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setupEventListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\n\t}\n\n\tprivate setupEventListeners() {\n\t\t// Handle browser back button - only if handleHistory is true\n\t\tconst popState$ = this.handleHistory\n\t\t\t? fromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\t\t\ttap(e => {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tthis.closeSheet()\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: of(null).pipe(take(0)) // Empty observable if handleHistory is false\n\n\t\t// Handle ESC key - respect allowOverlayDismiss\n\t\tconst keyUp$ = fromEvent<KeyboardEvent>(window, 'keyup').pipe(\n\t\t\ttap(event => {\n\t\t\t\t// Only handle ESC key dismissal if allowOverlayDismiss is true\n\t\t\t\tif (event.key === 'Escape' && !this.sheetContainsFocus() && !this.lock) {\n\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\n\t\t// Handle inter-component communication\n\t\tconst rickyComm$ = fromEvent<SheetWhereAreYouRickyEvent>(window, SheetWhereAreYouRicky).pipe(\n\t\t\ttap(e => {\n\t\t\t\tif (e.detail.uid === this.uid) this.announcePresence()\n\t\t\t}),\n\t\t)\n\n\t\tmerge(popState$, keyUp$, rickyComm$).pipe(takeUntil(this.disconnecting)).subscribe()\n\t}\n\n\tprivate sheetContainsFocus(): boolean {\n\t\treturn this.sheet?.contains(document.activeElement) ?? false\n\t}\n\n\tprivate announcePresence() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(SheetHereMorty, {\n\t\t\t\tdetail: { sheet: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate addFocusTrap() {\n\t\tdocument.addEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate removeFocusTrap() {\n\t\tdocument.removeEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate handleFocusIn = (e: Event) => {\n\t\tif (!this.sheet?.contains(e.target as Node)) {\n\t\t\tthis.focus()\n\t\t}\n\t}\n\n\tsetIsSheetShown(isShown: boolean) {\n\t\tthis.sheet?.setAttribute('aria-hidden', String(!isShown))\n\t\tthis.sheet?.setAttribute('aria-modal', String(isShown))\n\t}\n\n\tcloseSheet() {\n\t\tthis.open = false\n\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t}\n\n\tprivate getFocusElement(): HTMLElement | null {\n\t\tconst selector = `[${this.focusAttribute}]`\n\t\treturn (this.assignedElements.find(el => el.matches(selector) || el.querySelector(selector)) as HTMLElement) ?? null\n\t}\n\n\toverride focus() {\n\t\tthis.getFocusElement()?.focus()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"sheet\" role=\"dialog\" aria-labelledby=\"sheet-title\" aria-hidden=${!this.open} aria-modal=${this.open}>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"overlay\"\n\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\tif (!this.lock) {\n\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t></div>\n\t\t\t\t<schmancy-grid\n\t\t\t\t\trows=${this.header === 'hidden' ? '1fr' : 'auto 1fr'}\n\t\t\t\t\tclass=\"content w-full\"\n\t\t\t\t\tdata-position=${this.position}\n\t\t\t\t>\n\t\t\t\t\t${when(\n\t\t\t\t\t\tthis.header !== 'hidden',\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\thtml`<schmancy-sheet-header\n\t\t\t\t\t\t\t\tclass=\"sticky top-0 z-50 w-full\"\n\t\t\t\t\t\t\t\t@dismiss=${(e: CustomEvent) => {\n\t\t\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tid=\"sheet-title\"\n\t\t\t\t\t\t\t\ttitle=${this.title}\n\t\t\t\t\t\t\t></schmancy-sheet-header>`,\n\t\t\t\t\t)}\n\n\t\t\t\t\t<schmancy-surface rounded=\"left\" fill=\"all\" id=\"body\" class=\"overflow-auto\" type=\"surface\">\n\t\t\t\t\t\t<schmancy-scroll> <slot></slot></schmancy-scroll>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</schmancy-grid>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet': SchmancySheet\n\t}\n}\n","// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n//\n// Usage:\n//\n// @watch('propName')\n// handlePropChange(oldValue, newValue) {\n// ...\n// }\n//\ninterface WatchOptions {\n\twaitUntilFirstUpdate?: boolean\n}\n\nexport function on(propName: string, options?: WatchOptions) {\n\treturn (protoOrDescriptor: any, name: string): any => {\n\t\tconst { willUpdate } = protoOrDescriptor\n\n\t\toptions = Object.assign({ waitUntilFirstUpdate: false }, options) as WatchOptions\n\n\t\tprotoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n\t\t\twillUpdate.call(this, changedProps)\n\n\t\t\tif (changedProps.has(propName)) {\n\t\t\t\tconst oldValue = changedProps.get(propName)\n\t\t\t\tconst newValue = this[propName]\n\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\tif (!options?.waitUntilFirstUpdate || this.hasUpdated) {\n\t\t\t\t\t\tthis[name].call(this, oldValue, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["SchmancySheetHeader","TailwindElement","css","html","this","dispatchEvent","CustomEvent","bubbles","composed","customElement","SchmancySheet","$LitElement","super","arguments","open","header","position","SchmancySheetPosition","Side","persist","lock","handleHistory","title","focusAttribute","lastFocusedElement","handleFocusIn","e","sheet","contains","target","focus","_oldValue","newValue","document","activeElement","addFocusTrap","removeFocusTrap","connectedCallback","setupEventListeners","disconnectedCallback","disconnecting","next","popState$","fromEvent","window","pipe","tap","preventDefault","closeSheet","of","take","keyUp$","event","key","sheetContainsFocus","dismiss","uid","rickyComm$","SheetWhereAreYouRicky","detail","announcePresence","merge","takeUntil","subscribe","SheetHereMorty","addEventListener","removeEventListener","isShown","setAttribute","String","selector","assignedElements","find","el","matches","querySelector","getFocusElement","stopPropagation","when","propName","options","__decorateClass","property","type","reflect","prototype","Boolean","query","queryAssignedElements","flatten","protoOrDescriptor","name","willUpdate","Object","assign","waitUntilFirstUpdate","changedProps","call","has","oldValue","get","hasUpdated"],"mappings":"qXAKA,IAAqBA,EAArB,cAAiDC,EAAAA,gBAAgBC,EAAAA,KAAA,CAAA,CAChE,QACQ,CAAA,OAAAC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,gBAKO,IACHC,CAAAA,KAAAC,cACJ,IAAIC,YAAY,UAAW,CAC1BC,QAAAA,GACAC,SAAAA,EAEF,CAAA,CAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAWQ,IACHJ,CAAAA,KAAAC,cACJ,IAAIC,YAAY,UAAW,CAC1BC,QAAAA,GACAC,SAAAA,EAEF,CAAA,CAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GACA,CAAA,EA/BaR,wGAArB,CADCS,EAAAA,cAAc,uBAAA,CAAA,EACMT,mMCWrB,IAAqBU,EAArB,cAA2CC,kyCAA3C,aAAAC,CAAAA,MAAAA,GAAAC,WAEoDT,KAAAU,KAAAA,GACuBV,KAAAW,OAAA,UAC/BX,KAAAY,SAAkCC,EAAAA,sBAAsBC,KAC7Cd,KAAAe,QAAAA,GACHf,KAAAgB,KAAAA,GACShB,KAAAiB,cAAAA,GACTjB,KAAAkB,MAAA,GAKtBlB,KAAAmB,eAAA,YAC7BnB,KAAQoB,mBAAyC,KA8EzCpB,KAAAqB,cAAiBC,GACnBtB,CAAAA,KAAKuB,OAAOC,SAASF,EAAEG,SAC3BzB,KAAK0B,MAAAA,CAAM,CAEb,CA/EA,aAAaC,EAAoBC,EAAAA,CAC5BA,GACH5B,KAAKoB,mBAAqBS,SAASC,cACnC9B,KAAK+B,eACL/B,KAAK0B,MAAAA,IAEL1B,KAAKgC,gBAAAA,EACLhC,KAAKoB,oBAAoBM,MAAAA,EACzB1B,KAAKoB,mBAAqB,KAC3B,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EDrBmBtB,EAAAA,EAiBpB2E,UAAA,eAAA,CAAA,EAjBoB3E,EAArBuE,EAAA,CADCxE,EAAAA,cAAc,gBACMC,CAAAA,EAAAA,CAAAA"}
|
|
1
|
+
{"version":3,"file":"sheet-DlLj6OeU.cjs","sources":["../src/sheet/header.ts","../src/sheet/sheet.ts","../src/sheet/hook.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\n@customElement('schmancy-sheet-header')\nexport default class SchmancySheetHeader extends TailwindElement(css``) {\n\trender() {\n\t\treturn html`\n\t\t\t<sch-flex class=\"absolute top-0 left-0 md:left-[unset] md:right-0\">\n\t\t\t\t<div class=\"block md:hidden flex-1 justify-start items-start\">\n\t\t\t\t\t<slot name=\"back\">\n\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span class=\"text-[24px]\">← </span>\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"hidden md:block flex-1 justify-end items-end\">\n\t\t\t\t\t<slot name=\"actions\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tclose\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\t\t\t</sch-flex>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet-header': SchmancySheetHeader\n\t}\n}\n","import { $LitElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { when } from 'lit/directives/when.js'\nimport { fromEvent, merge, of, take, takeUntil, tap } from 'rxjs'\nimport { on } from './hook'\nimport style from './sheet.scss?inline'\nimport {\n\tSchmancySheetPosition,\n\tSheetHereMorty,\n\tSheetWhereAreYouRicky,\n\tSheetWhereAreYouRickyEvent,\n\tsheet,\n} from './sheet.service'\n\n@customElement('schmancy-sheet')\nexport default class SchmancySheet extends $LitElement(style) {\n\t@property({ type: String, reflect: true }) uid!: string\n\t@property({ type: Boolean, reflect: true }) open = false\n\t@property({ type: String, reflect: true }) header: 'hidden' | 'visible' = 'visible'\n\t@property({ type: String, reflect: true }) position: SchmancySheetPosition = SchmancySheetPosition.Side\n\t@property({ type: Boolean, reflect: true }) persist = false\n\t@property({ type: Boolean, reflect: true }) lock = false\n\t@property({ type: Boolean, reflect: true }) handleHistory = true\n\t@property({ type: String, reflect: true }) title = ''\n\n\t@query('.sheet') private sheet!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) private assignedElements!: HTMLElement[]\n\n\t@property() focusAttribute = 'autofocus'\n\tprivate lastFocusedElement: HTMLElement | null = null\n\n\t@on('open')\n\tonOpenChange(_oldValue: boolean, newValue: boolean) {\n\t\tif (newValue) {\n\t\t\tthis.lastFocusedElement = document.activeElement as HTMLElement\n\t\t\tthis.addFocusTrap()\n\t\t\tthis.focus()\n\t\t} else {\n\t\t\tthis.removeFocusTrap()\n\t\t\tthis.lastFocusedElement?.focus()\n\t\t\tthis.lastFocusedElement = null\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setupEventListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\n\t}\n\n\tprivate setupEventListeners() {\n\t\t// Handle browser back button - only if handleHistory is true\n\t\tconst popState$ = this.handleHistory\n\t\t\t? fromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\t\t\ttap(e => {\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tthis.closeSheet()\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t: of(null).pipe(take(0)) // Empty observable if handleHistory is false\n\n\t\t// Handle ESC key - respect allowOverlayDismiss\n\t\tconst keyUp$ = fromEvent<KeyboardEvent>(window, 'keyup').pipe(\n\t\t\ttap(event => {\n\t\t\t\t// Only handle ESC key dismissal if allowOverlayDismiss is true\n\t\t\t\tif (event.key === 'Escape' && !this.sheetContainsFocus() && !this.lock) {\n\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\n\t\t// Handle inter-component communication\n\t\tconst rickyComm$ = fromEvent<SheetWhereAreYouRickyEvent>(window, SheetWhereAreYouRicky).pipe(\n\t\t\ttap(e => {\n\t\t\t\tif (e.detail.uid === this.uid) this.announcePresence()\n\t\t\t}),\n\t\t)\n\n\t\tmerge(popState$, keyUp$, rickyComm$).pipe(takeUntil(this.disconnecting)).subscribe()\n\t}\n\n\tprivate sheetContainsFocus(): boolean {\n\t\treturn this.sheet?.contains(document.activeElement) ?? false\n\t}\n\n\tprivate announcePresence() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(SheetHereMorty, {\n\t\t\t\tdetail: { sheet: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate addFocusTrap() {\n\t\tdocument.addEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate removeFocusTrap() {\n\t\tdocument.removeEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate handleFocusIn = (e: Event) => {\n\t\tif (!this.sheet?.contains(e.target as Node)) {\n\t\t\tthis.focus()\n\t\t}\n\t}\n\n\tsetIsSheetShown(isShown: boolean) {\n\t\tthis.sheet?.setAttribute('aria-hidden', String(!isShown))\n\t\tthis.sheet?.setAttribute('aria-modal', String(isShown))\n\t}\n\n\tcloseSheet() {\n\t\tthis.open = false\n\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t}\n\n\tprivate getFocusElement(): HTMLElement | null {\n\t\tconst selector = `[${this.focusAttribute}]`\n\t\treturn (this.assignedElements.find(el => el.matches(selector) || el.querySelector(selector)) as HTMLElement) ?? null\n\t}\n\n\toverride focus() {\n\t\tthis.getFocusElement()?.focus()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"sheet\" role=\"dialog\" aria-labelledby=\"sheet-title\" aria-hidden=${!this.open} aria-modal=${this.open}>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"overlay\"\n\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\tif (!this.lock) {\n\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t></div>\n\t\t\t\t<schmancy-grid\n\t\t\t\t\trows=${this.header === 'hidden' ? '1fr' : 'auto 1fr'}\n\t\t\t\t\tclass=\"content w-full\"\n\t\t\t\t\tdata-position=${this.position}\n\t\t\t\t>\n\t\t\t\t\t${when(\n\t\t\t\t\t\tthis.header !== 'hidden',\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\thtml`<schmancy-sheet-header\n\t\t\t\t\t\t\t\tclass=\"sticky top-0 z-50 w-full\"\n\t\t\t\t\t\t\t\t@dismiss=${(e: CustomEvent) => {\n\t\t\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tid=\"sheet-title\"\n\t\t\t\t\t\t\t\ttitle=${this.title}\n\t\t\t\t\t\t\t></schmancy-sheet-header>`,\n\t\t\t\t\t)}\n\n\t\t\t\t\t<schmancy-surface rounded=\"left\" fill=\"all\" id=\"body\" class=\"overflow-auto\" type=\"surface\">\n\t\t\t\t\t\t<schmancy-scroll> <slot></slot></schmancy-scroll>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</schmancy-grid>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet': SchmancySheet\n\t}\n}\n","// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n//\n// Usage:\n//\n// @watch('propName')\n// handlePropChange(oldValue, newValue) {\n// ...\n// }\n//\ninterface WatchOptions {\n\twaitUntilFirstUpdate?: boolean\n}\n\nexport function on(propName: string, options?: WatchOptions) {\n\treturn (protoOrDescriptor: any, name: string): any => {\n\t\tconst { willUpdate } = protoOrDescriptor\n\n\t\toptions = Object.assign({ waitUntilFirstUpdate: false }, options) as WatchOptions\n\n\t\tprotoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n\t\t\twillUpdate.call(this, changedProps)\n\n\t\t\tif (changedProps.has(propName)) {\n\t\t\t\tconst oldValue = changedProps.get(propName)\n\t\t\t\tconst newValue = this[propName]\n\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\tif (!options?.waitUntilFirstUpdate || this.hasUpdated) {\n\t\t\t\t\t\tthis[name].call(this, oldValue, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["SchmancySheetHeader","TailwindElement","css","html","this","dispatchEvent","CustomEvent","bubbles","composed","customElement","SchmancySheet","$LitElement","super","arguments","open","header","position","SchmancySheetPosition","Side","persist","lock","handleHistory","title","focusAttribute","lastFocusedElement","handleFocusIn","e","sheet","contains","target","focus","_oldValue","newValue","document","activeElement","addFocusTrap","removeFocusTrap","connectedCallback","setupEventListeners","disconnectedCallback","disconnecting","next","popState$","fromEvent","window","pipe","tap","preventDefault","closeSheet","of","take","keyUp$","event","key","sheetContainsFocus","dismiss","uid","rickyComm$","SheetWhereAreYouRicky","detail","announcePresence","merge","takeUntil","subscribe","SheetHereMorty","addEventListener","removeEventListener","isShown","setAttribute","String","selector","assignedElements","find","el","matches","querySelector","getFocusElement","stopPropagation","when","propName","options","__decorateClass","property","type","reflect","prototype","Boolean","query","queryAssignedElements","flatten","protoOrDescriptor","name","willUpdate","Object","assign","waitUntilFirstUpdate","changedProps","call","has","oldValue","get","hasUpdated"],"mappings":"qXAKA,IAAqBA,EAArB,cAAiDC,EAAAA,gBAAgBC,EAAAA,KAAA,CAAA,CAChE,QACQ,CAAA,OAAAC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,gBAKO,IACHC,CAAAA,KAAAC,cACJ,IAAIC,YAAY,UAAW,CAC1BC,QAAAA,GACAC,SAAAA,EAEF,CAAA,CAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAWQ,IACHJ,CAAAA,KAAAC,cACJ,IAAIC,YAAY,UAAW,CAC1BC,QAAAA,GACAC,SAAAA,EAEF,CAAA,CAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GACA,CAAA,EA/BaR,wGAArB,CADCS,EAAAA,cAAc,uBAAA,CAAA,EACMT,mMCWrB,IAAqBU,EAArB,cAA2CC,kyCAA3C,aAAAC,CAAAA,MAAAA,GAAAC,WAEoDT,KAAAU,KAAAA,GACuBV,KAAAW,OAAA,UAC/BX,KAAAY,SAAkCC,EAAAA,sBA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AAA,EAAA,ECfkBF,EDcd,OCbG,CAACW,EAAwBC,IAAAA,CACzB,MAAAC,WAAEA,CAAAA,EAAeF,EAEvBV,EAAUa,OAAOC,OAAO,CAAEC,qBAAsB,EAAA,EAASf,GAEvCU,EAAAE,WAAa,SAAUI,EAGpC,CAAA,GAFOJ,EAAAK,KAAK7F,KAAM4F,GAElBA,EAAaE,IAAInB,GAAW,CACzB,MAAAoB,EAAWH,EAAaI,IAAIrB,CAC5B/C,EAAAA,EAAW5B,KAAK2E,CAAAA,EAElBoB,IAAanE,IACXgD,GAASe,uBAAwB3F,KAAKiG,YAC1CjG,KAAKuF,CAAMM,EAAAA,KAAK7F,KAAM+F,EAAUnE,CAElC,EAAA,CAEF,CAAA,EDrBmBtB,EAAAA,EAiBpB2E,UAAA,eAAA,CAAA,EAjBoB3E,EAArBuE,EAAA,CADCxE,EAAAA,cAAc,gBACMC,CAAAA,EAAAA,CAAAA"}
|
package/dist/sheet.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./sheet-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./sheet-DlLj6OeU.cjs");const e=require("./sheet.service-DQQ44gXD.cjs");exports.SchmancySheetPosition=e.SchmancySheetPosition,exports.SheetHereMorty=e.SheetHereMorty,exports.SheetWhereAreYouRicky=e.SheetWhereAreYouRicky,exports.sheet=e.sheet;
|
|
2
2
|
//# sourceMappingURL=sheet.cjs.map
|
package/dist/sheet.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import "./sheet-
|
|
2
|
-
import {
|
|
1
|
+
import "./sheet-BGuqw1NG.js";
|
|
2
|
+
import { S as r, b as s, a, s as h } from "./sheet.service-Dm2r1_ji.js";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
S as sheet
|
|
4
|
+
r as SchmancySheetPosition,
|
|
5
|
+
s as SheetHereMorty,
|
|
6
|
+
a as SheetWhereAreYouRicky,
|
|
7
|
+
h as sheet
|
|
9
8
|
};
|
|
10
9
|
//# sourceMappingURL=sheet.js.map
|