@lokalise/harmony 1.29.3 → 1.29.5-exp-teamSwitch.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/README.md +41 -0
- package/dist/harmony.cjs +3 -0
- package/dist/harmony.cjs.map +1 -1
- package/dist/harmony.mjs +5 -2
- package/dist/harmony100.cjs +14 -12
- package/dist/harmony100.cjs.map +1 -1
- package/dist/harmony100.mjs +13 -11
- package/dist/harmony100.mjs.map +1 -1
- package/dist/harmony101.cjs +132 -5
- package/dist/harmony101.cjs.map +1 -1
- package/dist/harmony101.mjs +132 -5
- package/dist/harmony101.mjs.map +1 -1
- package/dist/harmony102.cjs +12 -40
- package/dist/harmony102.cjs.map +1 -1
- package/dist/harmony102.mjs +11 -39
- package/dist/harmony102.mjs.map +1 -1
- package/dist/harmony103.cjs +4 -59
- package/dist/harmony103.cjs.map +1 -1
- package/dist/harmony103.mjs +5 -60
- package/dist/harmony103.mjs.map +1 -1
- package/dist/harmony104.cjs +39 -6
- package/dist/harmony104.cjs.map +1 -1
- package/dist/harmony104.mjs +39 -6
- package/dist/harmony104.mjs.map +1 -1
- package/dist/harmony105.cjs +60 -6
- package/dist/harmony105.cjs.map +1 -1
- package/dist/harmony105.mjs +59 -5
- package/dist/harmony105.mjs.map +1 -1
- package/dist/harmony106.cjs +8 -6
- package/dist/harmony106.cjs.map +1 -1
- package/dist/harmony106.mjs +7 -5
- package/dist/harmony106.mjs.map +1 -1
- package/dist/harmony107.cjs +6 -5
- package/dist/harmony107.cjs.map +1 -1
- package/dist/harmony107.mjs +6 -5
- package/dist/harmony108.cjs +95 -61
- package/dist/harmony108.cjs.map +1 -1
- package/dist/harmony108.mjs +95 -61
- package/dist/harmony108.mjs.map +1 -1
- package/dist/harmony109.cjs +13 -88
- package/dist/harmony109.cjs.map +1 -1
- package/dist/harmony109.mjs +13 -88
- package/dist/harmony109.mjs.map +1 -1
- package/dist/harmony110.cjs +15 -19
- package/dist/harmony110.cjs.map +1 -1
- package/dist/harmony110.mjs +14 -18
- package/dist/harmony110.mjs.map +1 -1
- package/dist/harmony111.cjs +34 -94
- package/dist/harmony111.cjs.map +1 -1
- package/dist/harmony111.mjs +34 -94
- package/dist/harmony111.mjs.map +1 -1
- package/dist/harmony112.cjs +26 -11
- package/dist/harmony112.cjs.map +1 -1
- package/dist/harmony112.mjs +26 -11
- package/dist/harmony112.mjs.map +1 -1
- package/dist/harmony113.cjs +12 -13
- package/dist/harmony113.cjs.map +1 -1
- package/dist/harmony113.mjs +12 -13
- package/dist/harmony113.mjs.map +1 -1
- package/dist/harmony114.cjs +13 -34
- package/dist/harmony114.cjs.map +1 -1
- package/dist/harmony114.mjs +13 -34
- package/dist/harmony114.mjs.map +1 -1
- package/dist/harmony115.cjs +14 -26
- package/dist/harmony115.cjs.map +1 -1
- package/dist/harmony115.mjs +14 -26
- package/dist/harmony115.mjs.map +1 -1
- package/dist/harmony116.cjs +62 -13
- package/dist/harmony116.cjs.map +1 -1
- package/dist/harmony116.mjs +61 -12
- package/dist/harmony116.mjs.map +1 -1
- package/dist/harmony117.cjs +88 -15
- package/dist/harmony117.cjs.map +1 -1
- package/dist/harmony117.mjs +88 -15
- package/dist/harmony117.mjs.map +1 -1
- package/dist/harmony118.cjs +19 -17
- package/dist/harmony118.cjs.map +1 -1
- package/dist/harmony118.mjs +18 -16
- package/dist/harmony118.mjs.map +1 -1
- package/dist/harmony119.cjs +11 -7
- package/dist/harmony119.cjs.map +1 -1
- package/dist/harmony119.mjs +11 -7
- package/dist/harmony119.mjs.map +1 -1
- package/dist/harmony120.cjs +15 -56
- package/dist/harmony120.cjs.map +1 -1
- package/dist/harmony120.mjs +15 -56
- package/dist/harmony120.mjs.map +1 -1
- package/dist/harmony121.cjs +20 -59
- package/dist/harmony121.cjs.map +1 -1
- package/dist/harmony121.mjs +20 -59
- package/dist/harmony121.mjs.map +1 -1
- package/dist/harmony122.cjs +13 -19
- package/dist/harmony122.cjs.map +1 -1
- package/dist/harmony122.mjs +12 -18
- package/dist/harmony122.mjs.map +1 -1
- package/dist/harmony123.cjs +5 -10
- package/dist/harmony123.cjs.map +1 -1
- package/dist/harmony123.mjs +5 -10
- package/dist/harmony123.mjs.map +1 -1
- package/dist/harmony124.cjs +11 -15
- package/dist/harmony124.cjs.map +1 -1
- package/dist/harmony124.mjs +11 -15
- package/dist/harmony124.mjs.map +1 -1
- package/dist/harmony125.cjs +28 -17
- package/dist/harmony125.cjs.map +1 -1
- package/dist/harmony125.mjs +28 -17
- package/dist/harmony125.mjs.map +1 -1
- package/dist/harmony126.cjs +12 -10
- package/dist/harmony126.cjs.map +1 -1
- package/dist/harmony126.mjs +12 -10
- package/dist/harmony126.mjs.map +1 -1
- package/dist/harmony127.cjs +7 -6
- package/dist/harmony127.cjs.map +1 -1
- package/dist/harmony127.mjs +7 -6
- package/dist/harmony127.mjs.map +1 -1
- package/dist/harmony128.cjs +57 -12
- package/dist/harmony128.cjs.map +1 -1
- package/dist/harmony128.mjs +57 -12
- package/dist/harmony128.mjs.map +1 -1
- package/dist/harmony129.cjs +58 -30
- package/dist/harmony129.cjs.map +1 -1
- package/dist/harmony129.mjs +58 -30
- package/dist/harmony129.mjs.map +1 -1
- package/dist/harmony130.cjs +19 -15
- package/dist/harmony130.cjs.map +1 -1
- package/dist/harmony130.mjs +18 -14
- package/dist/harmony130.mjs.map +1 -1
- package/dist/harmony131.cjs +1 -1
- package/dist/harmony131.mjs +1 -1
- package/dist/harmony15.cjs +1 -1
- package/dist/harmony15.mjs +1 -1
- package/dist/harmony22.cjs +1 -1
- package/dist/harmony22.mjs +1 -1
- package/dist/harmony23.cjs +1 -1
- package/dist/harmony23.mjs +1 -1
- package/dist/harmony31.cjs +9 -0
- package/dist/harmony31.cjs.map +1 -1
- package/dist/harmony31.mjs +12 -3
- package/dist/harmony31.mjs.map +1 -1
- package/dist/harmony61.cjs +7 -1
- package/dist/harmony61.cjs.map +1 -1
- package/dist/harmony61.mjs +7 -1
- package/dist/harmony61.mjs.map +1 -1
- package/dist/harmony68.cjs +1 -1
- package/dist/harmony68.mjs +1 -1
- package/dist/harmony69.cjs +1 -1
- package/dist/harmony69.mjs +1 -1
- package/dist/harmony70.cjs +1 -1
- package/dist/harmony70.mjs +1 -1
- package/dist/harmony71.cjs +2 -2
- package/dist/harmony71.mjs +2 -2
- package/dist/harmony72.cjs +2 -2
- package/dist/harmony72.mjs +2 -2
- package/dist/harmony73.cjs +2 -2
- package/dist/harmony73.mjs +2 -2
- package/dist/harmony74.cjs +2 -2
- package/dist/harmony74.mjs +2 -2
- package/dist/harmony75.cjs +3 -3
- package/dist/harmony75.mjs +3 -3
- package/dist/harmony76.cjs +6 -6
- package/dist/harmony76.mjs +6 -6
- package/dist/harmony79.cjs +2 -2
- package/dist/harmony79.mjs +2 -2
- package/dist/harmony81.cjs +12 -7
- package/dist/harmony81.cjs.map +1 -1
- package/dist/harmony81.mjs +11 -6
- package/dist/harmony81.mjs.map +1 -1
- package/dist/harmony82.cjs +20 -8
- package/dist/harmony82.cjs.map +1 -1
- package/dist/harmony82.mjs +20 -8
- package/dist/harmony82.mjs.map +1 -1
- package/dist/harmony83.cjs +3 -6
- package/dist/harmony83.cjs.map +1 -1
- package/dist/harmony83.mjs +3 -6
- package/dist/harmony83.mjs.map +1 -1
- package/dist/harmony84.cjs +9 -57
- package/dist/harmony84.cjs.map +1 -1
- package/dist/harmony84.mjs +8 -56
- package/dist/harmony84.mjs.map +1 -1
- package/dist/harmony85.cjs +9 -42
- package/dist/harmony85.cjs.map +1 -1
- package/dist/harmony85.mjs +8 -41
- package/dist/harmony85.mjs.map +1 -1
- package/dist/harmony86.cjs +57 -5
- package/dist/harmony86.cjs.map +1 -1
- package/dist/harmony86.mjs +57 -5
- package/dist/harmony86.mjs.map +1 -1
- package/dist/harmony87.cjs +42 -9
- package/dist/harmony87.cjs.map +1 -1
- package/dist/harmony87.mjs +41 -8
- package/dist/harmony87.mjs.map +1 -1
- package/dist/harmony88.cjs +6 -25
- package/dist/harmony88.cjs.map +1 -1
- package/dist/harmony88.mjs +5 -24
- package/dist/harmony88.mjs.map +1 -1
- package/dist/harmony89.cjs +6 -3
- package/dist/harmony89.cjs.map +1 -1
- package/dist/harmony89.mjs +6 -3
- package/dist/harmony89.mjs.map +1 -1
- package/dist/harmony90.cjs +24 -21
- package/dist/harmony90.cjs.map +1 -1
- package/dist/harmony90.mjs +23 -20
- package/dist/harmony90.mjs.map +1 -1
- package/dist/harmony91.cjs +3 -9
- package/dist/harmony91.cjs.map +1 -1
- package/dist/harmony91.mjs +3 -9
- package/dist/harmony91.mjs.map +1 -1
- package/dist/harmony92.cjs +19 -9
- package/dist/harmony92.cjs.map +1 -1
- package/dist/harmony92.mjs +21 -11
- package/dist/harmony92.mjs.map +1 -1
- package/dist/harmony93.cjs +11 -20
- package/dist/harmony93.cjs.map +1 -1
- package/dist/harmony93.mjs +11 -20
- package/dist/harmony93.mjs.map +1 -1
- package/dist/harmony94.cjs +2 -2
- package/dist/harmony94.mjs +2 -2
- package/dist/harmony95.cjs +22 -19
- package/dist/harmony95.cjs.map +1 -1
- package/dist/harmony95.mjs +21 -18
- package/dist/harmony95.mjs.map +1 -1
- package/dist/harmony96.cjs +5 -13
- package/dist/harmony96.cjs.map +1 -1
- package/dist/harmony96.mjs +5 -13
- package/dist/harmony96.mjs.map +1 -1
- package/dist/harmony97.cjs +5 -21
- package/dist/harmony97.cjs.map +1 -1
- package/dist/harmony97.mjs +5 -21
- package/dist/harmony97.mjs.map +1 -1
- package/dist/harmony98.cjs +6 -7
- package/dist/harmony98.cjs.map +1 -1
- package/dist/harmony98.mjs +5 -6
- package/dist/harmony98.mjs.map +1 -1
- package/dist/harmony99.cjs +18 -132
- package/dist/harmony99.cjs.map +1 -1
- package/dist/harmony99.mjs +18 -132
- package/dist/harmony99.mjs.map +1 -1
- package/dist/types/src/features/publicApi/hooks/useListTeamsQuery.test.d.ts +1 -0
- package/dist/types/src/features/publicApi/hooks/useSwitchTeamMutation.d.ts +15 -0
- package/dist/types/src/features/publicApi/hooks/useSwitchTeamMutation.test.d.ts +1 -0
- package/dist/types/src/features/publicApi/team.d.ts +61 -0
- package/dist/types/src/features/publicApi/types/teamTypes.d.ts +10 -0
- package/dist/types/tests/utils/apiHelpers.d.ts +20 -0
- package/dist/types/tests/utils/index.d.ts +1 -0
- package/package.json +5 -3
- /package/dist/types/tests/{utils.d.ts → utils/renderWithProviders.d.ts} +0 -0
package/README.md
CHANGED
@@ -85,3 +85,44 @@ const result: TeamUserResponse = async (client: Client) => {
|
|
85
85
|
});
|
86
86
|
}
|
87
87
|
```
|
88
|
+
|
89
|
+
### Tests
|
90
|
+
|
91
|
+
#### Query Hooks testing
|
92
|
+
Query hooks tests functionality has been developed due to inconsistencies in data structure from API responses and `zod` schemas. `zod.parse` will error if data is invalid and although this solution is not ideal (until we have data layer that is driving schemas for all apps), we need to do it this way.
|
93
|
+
|
94
|
+
It is important not to generate fake data but to use some actual payloads from API, as this iss the source of the problem (like date formatting for example).
|
95
|
+
|
96
|
+
If your hook is relatively simple, you may not need to add the hook tests as such, but simply add payload parsing test.
|
97
|
+
|
98
|
+
In order to test query hooks, utilise `@tests/utils/apiHelpers`. Setup is already extended with `msw` server setup, so there's no need to add any logic. Simply use normal `it` function, within witch you can use `mockGetResponse` (POST yet to be implemented) like in example below:
|
99
|
+
```ts
|
100
|
+
import {
|
101
|
+
mockGetResponse,
|
102
|
+
renderQueryHook
|
103
|
+
} from "@tests/utils/apiHelpers";
|
104
|
+
|
105
|
+
// Inside tests
|
106
|
+
// Create expected response
|
107
|
+
const response = {
|
108
|
+
user: {
|
109
|
+
id: 1,
|
110
|
+
name: 'Test User'
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
// Mock the response
|
115
|
+
mockGetResponse('/me', responseData)
|
116
|
+
|
117
|
+
// Use helper method renderQueryHook to utilise custom client and header builder
|
118
|
+
const { result } = renderQueryHook(({ client, builder}) => useListTeamsQuery(client, builder, {
|
119
|
+
queryKey: ['me']
|
120
|
+
}))
|
121
|
+
|
122
|
+
// Create necessary assertions
|
123
|
+
await waitFor(() => {
|
124
|
+
const { data , isSuccess} = result.current
|
125
|
+
expect(isSuccess).toBeTruthy();
|
126
|
+
expect(data).toEqual(responseData);
|
127
|
+
});
|
128
|
+
```
|
package/dist/harmony.cjs
CHANGED
@@ -120,6 +120,7 @@ exports.deleteScore = score.deleteScore;
|
|
120
120
|
exports.getScore = score.getScore;
|
121
121
|
exports.listTeams = team.listTeams;
|
122
122
|
exports.retrieveTeam = team.retrieveTeam;
|
123
|
+
exports.switchTeam = team.switchTeam;
|
123
124
|
exports.getTeamUser = teamUsers.getTeamUser;
|
124
125
|
exports.getUserToken = userToken.getUserToken;
|
125
126
|
exports.useAddLanguagesToProjectMutation = useAddLanguagesToProjectMutation.useAddLanguagesToProjectMutation;
|
@@ -208,6 +209,8 @@ exports.LIST_TEAMS_QUERY_SCHEMA = teamTypes.LIST_TEAMS_QUERY_SCHEMA;
|
|
208
209
|
exports.LIST_TEAMS_RESPONSE_SCHEMA = teamTypes.LIST_TEAMS_RESPONSE_SCHEMA;
|
209
210
|
exports.RETRIEVE_TEAM_PATH_PARAMS_SCHEMA = teamTypes.RETRIEVE_TEAM_PATH_PARAMS_SCHEMA;
|
210
211
|
exports.RETRIEVE_TEAM_RESPONSE_SCHEMA = teamTypes.RETRIEVE_TEAM_RESPONSE_SCHEMA;
|
212
|
+
exports.SWITCH_TEAM_REQUEST_BODY_SCHEMA = teamTypes.SWITCH_TEAM_REQUEST_BODY_SCHEMA;
|
213
|
+
exports.SWITCH_TEAM_RESPONSE_SCHEMA = teamTypes.SWITCH_TEAM_RESPONSE_SCHEMA;
|
211
214
|
exports.TEAMS_QUOTA_ALLOWED_SCHEMA = teamTypes.TEAMS_QUOTA_ALLOWED_SCHEMA;
|
212
215
|
exports.TEAMS_QUOTA_METRICS = teamTypes.TEAMS_QUOTA_METRICS;
|
213
216
|
exports.TEAMS_QUOTA_METRICS_SCHEMA = teamTypes.TEAMS_QUOTA_METRICS_SCHEMA;
|
package/dist/harmony.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"harmony.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"harmony.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/harmony.mjs
CHANGED
@@ -27,7 +27,7 @@ import { addLanguagesToProject, bulkUpdateProjectLanguages, listProjectLanguages
|
|
27
27
|
import { listPermissionTemplates } from "./harmony28.mjs";
|
28
28
|
import { createProject, deleteProject, getProjectPermissionMeta, listProjects, retrieveProject, updateProject } from "./harmony29.mjs";
|
29
29
|
import { deleteScore, getScore } from "./harmony30.mjs";
|
30
|
-
import { listTeams, retrieveTeam } from "./harmony31.mjs";
|
30
|
+
import { listTeams, retrieveTeam, switchTeam } from "./harmony31.mjs";
|
31
31
|
import { getTeamUser } from "./harmony32.mjs";
|
32
32
|
import { getUserToken } from "./harmony33.mjs";
|
33
33
|
import { useAddLanguagesToProjectMutation } from "./harmony34.mjs";
|
@@ -57,7 +57,7 @@ import { CREATE_PROJECT_REQUEST_BODY_SCHEMA, DELETE_PROJECT_RESPONSE_SCHEMA, GET
|
|
57
57
|
import { DELETE_SCORE_PATH_PARAMS_SCHEMA, DELETE_SCORE_RESPONSE_SCHEMA, GET_SCORE_REQUEST_QUERY_SCHEMA, GET_SCORE_RESPONSE_SCHEMA, ISSUE_SCHEMA, SEVERITY_ENUM } from "./harmony58.mjs";
|
58
58
|
import { API_PLUGIN_HEADER_SCHEMA, APU_TOKEN_AUTH_HEADER_SCHEMA, AUTHENTICATION_HEADERS_SCHEMA, AUTHORIZATION_HEADER_SCHEMA, BASE_API_ENDPOINT_HEADER_SCHEMA } from "./harmony59.mjs";
|
59
59
|
import { TEAM_ROLE_SCHEMA } from "./harmony60.mjs";
|
60
|
-
import { LIST_TEAMS_QUERY_SCHEMA, LIST_TEAMS_RESPONSE_SCHEMA, RETRIEVE_TEAM_PATH_PARAMS_SCHEMA, RETRIEVE_TEAM_RESPONSE_SCHEMA, TEAMS_QUOTA_ALLOWED_SCHEMA, TEAMS_QUOTA_METRICS, TEAMS_QUOTA_METRICS_SCHEMA, TEAMS_QUOTA_USAGE_SCHEMA, TEAM_API_BASE_HEADERS_SCHEMA, TEAM_QUOTA_ALLOWED_SCHEMA, TEAM_QUOTA_METRICS_SCHEMA, TEAM_QUOTA_USAGE_SCHEMA } from "./harmony61.mjs";
|
60
|
+
import { LIST_TEAMS_QUERY_SCHEMA, LIST_TEAMS_RESPONSE_SCHEMA, RETRIEVE_TEAM_PATH_PARAMS_SCHEMA, RETRIEVE_TEAM_RESPONSE_SCHEMA, SWITCH_TEAM_REQUEST_BODY_SCHEMA, SWITCH_TEAM_RESPONSE_SCHEMA, TEAMS_QUOTA_ALLOWED_SCHEMA, TEAMS_QUOTA_METRICS, TEAMS_QUOTA_METRICS_SCHEMA, TEAMS_QUOTA_USAGE_SCHEMA, TEAM_API_BASE_HEADERS_SCHEMA, TEAM_QUOTA_ALLOWED_SCHEMA, TEAM_QUOTA_METRICS_SCHEMA, TEAM_QUOTA_USAGE_SCHEMA } from "./harmony61.mjs";
|
61
61
|
import { TEAM_USER_API_BASE_HEADERS_SCHEMA, TEAM_USER_PATH_PARAMS_SCHEMA, TEAM_USER_RESPONSE_SCHEMA, TEAM_USER_SCHEMA } from "./harmony62.mjs";
|
62
62
|
import { JWT_TOKEN_SCHEMA, USER_TOKEN_REQUEST_HEADER_SCHEMA } from "./harmony63.mjs";
|
63
63
|
export {
|
@@ -128,6 +128,8 @@ export {
|
|
128
128
|
RETRIEVE_TEAM_RESPONSE_SCHEMA,
|
129
129
|
SEVERITY_ENUM,
|
130
130
|
START_PLAN_IDS,
|
131
|
+
SWITCH_TEAM_REQUEST_BODY_SCHEMA,
|
132
|
+
SWITCH_TEAM_RESPONSE_SCHEMA,
|
131
133
|
Sidebar,
|
132
134
|
SidebarTaskLanguageStatuses,
|
133
135
|
SidebarTaskStatuses,
|
@@ -197,6 +199,7 @@ export {
|
|
197
199
|
retrieveProjectQueryKey,
|
198
200
|
retrieveTeam,
|
199
201
|
retrieveTeamQueryKey,
|
202
|
+
switchTeam,
|
200
203
|
updateProject,
|
201
204
|
useAddLanguagesToProjectMutation,
|
202
205
|
useAuthenticatedProjectContributor,
|
package/dist/harmony100.cjs
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
const
|
7
|
-
|
8
|
-
|
9
|
-
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
5
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
6
|
+
const jwtTokenPayload = require("./harmony15.cjs");
|
7
|
+
const _NewJwtIssuedEvent = class _NewJwtIssuedEvent extends CustomEvent {
|
8
|
+
constructor(token) {
|
9
|
+
super(_NewJwtIssuedEvent.eventName, {
|
10
|
+
detail: { token, payload: jwtTokenPayload.parseJwtTokenPayload(token.accessToken) }
|
11
|
+
});
|
12
|
+
}
|
10
13
|
};
|
11
|
-
|
12
|
-
|
13
|
-
exports.
|
14
|
-
exports.navItem = navItem;
|
14
|
+
__publicField(_NewJwtIssuedEvent, "eventName", "new-jwt-issued");
|
15
|
+
let NewJwtIssuedEvent = _NewJwtIssuedEvent;
|
16
|
+
exports.NewJwtIssuedEvent = NewJwtIssuedEvent;
|
15
17
|
//# sourceMappingURL=harmony100.cjs.map
|
package/dist/harmony100.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"harmony100.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"harmony100.cjs","sources":["../src/features/auth/frontend/events/NewJwtIssuedEvent.ts"],"sourcesContent":["import type { JwtTokenPayload } from '@features/auth/core/types/jwtTokenPayload'\nimport { parseJwtTokenPayload } from '@features/auth/core/utils/jwtTokenPayload'\nimport type { JwtToken } from '@features/publicApi/types/userTokenTypes'\n\ntype NewJwtIssuedEventDetail = {\n\ttoken: JwtToken\n\tpayload: JwtTokenPayload | undefined\n}\n\n/**\n * This event is emitted when a new JWT token is issued or refreshed.\n */\nexport class NewJwtIssuedEvent extends CustomEvent<NewJwtIssuedEventDetail> {\n\tstatic readonly eventName = 'new-jwt-issued' as const\n\n\tconstructor(token: JwtToken) {\n\t\tsuper(NewJwtIssuedEvent.eventName, {\n\t\t\tdetail: { token, payload: parseJwtTokenPayload(token.accessToken) },\n\t\t})\n\t}\n}\n\nexport const isNewJwtIssuedEvent = (event: Event): event is NewJwtIssuedEvent =>\n\tevent.type === NewJwtIssuedEvent.eventName\n\ndeclare global {\n\tinterface WindowEventMap {\n\t\t[NewJwtIssuedEvent.eventName]: NewJwtIssuedEvent\n\t}\n}\n"],"names":["parseJwtTokenPayload"],"mappings":";;;;;;AAYO,MAAM,qBAAN,MAAM,2BAA0B,YAAqC;AAAA,EAG3E,YAAY,OAAiB;AAC5B,UAAM,mBAAkB,WAAW;AAAA,MAClC,QAAQ,EAAE,OAAO,SAASA,gBAAAA,qBAAqB,MAAM,WAAW,EAAE;AAAA,IAAA,CAClE;AAAA,EAAA;AAEH;AAPC,cADY,oBACI,aAAY;AADtB,IAAM,oBAAN;;"}
|
package/dist/harmony100.mjs
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4
|
+
import { parseJwtTokenPayload } from "./harmony15.mjs";
|
5
|
+
const _NewJwtIssuedEvent = class _NewJwtIssuedEvent extends CustomEvent {
|
6
|
+
constructor(token) {
|
7
|
+
super(_NewJwtIssuedEvent.eventName, {
|
8
|
+
detail: { token, payload: parseJwtTokenPayload(token.accessToken) }
|
9
|
+
});
|
10
|
+
}
|
8
11
|
};
|
12
|
+
__publicField(_NewJwtIssuedEvent, "eventName", "new-jwt-issued");
|
13
|
+
let NewJwtIssuedEvent = _NewJwtIssuedEvent;
|
9
14
|
export {
|
10
|
-
|
11
|
-
badge,
|
12
|
-
styles as default,
|
13
|
-
navItem
|
15
|
+
NewJwtIssuedEvent
|
14
16
|
};
|
15
17
|
//# sourceMappingURL=harmony100.mjs.map
|
package/dist/harmony100.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"harmony100.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"harmony100.mjs","sources":["../src/features/auth/frontend/events/NewJwtIssuedEvent.ts"],"sourcesContent":["import type { JwtTokenPayload } from '@features/auth/core/types/jwtTokenPayload'\nimport { parseJwtTokenPayload } from '@features/auth/core/utils/jwtTokenPayload'\nimport type { JwtToken } from '@features/publicApi/types/userTokenTypes'\n\ntype NewJwtIssuedEventDetail = {\n\ttoken: JwtToken\n\tpayload: JwtTokenPayload | undefined\n}\n\n/**\n * This event is emitted when a new JWT token is issued or refreshed.\n */\nexport class NewJwtIssuedEvent extends CustomEvent<NewJwtIssuedEventDetail> {\n\tstatic readonly eventName = 'new-jwt-issued' as const\n\n\tconstructor(token: JwtToken) {\n\t\tsuper(NewJwtIssuedEvent.eventName, {\n\t\t\tdetail: { token, payload: parseJwtTokenPayload(token.accessToken) },\n\t\t})\n\t}\n}\n\nexport const isNewJwtIssuedEvent = (event: Event): event is NewJwtIssuedEvent =>\n\tevent.type === NewJwtIssuedEvent.eventName\n\ndeclare global {\n\tinterface WindowEventMap {\n\t\t[NewJwtIssuedEvent.eventName]: NewJwtIssuedEvent\n\t}\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,qBAAN,MAAM,2BAA0B,YAAqC;AAAA,EAG3E,YAAY,OAAiB;AAC5B,UAAM,mBAAkB,WAAW;AAAA,MAClC,QAAQ,EAAE,OAAO,SAAS,qBAAqB,MAAM,WAAW,EAAE;AAAA,IAAA,CAClE;AAAA,EAAA;AAEH;AAPC,cADY,oBACI,aAAY;AADtB,IAAM,oBAAN;"}
|
package/dist/harmony101.cjs
CHANGED
@@ -1,8 +1,135 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
-
const
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
const floatingUi_utils = require("./harmony116.cjs");
|
4
|
+
async function detectOverflow(state, options) {
|
5
|
+
var _await$platform$isEle;
|
6
|
+
if (options === void 0) {
|
7
|
+
options = {};
|
8
|
+
}
|
9
|
+
const {
|
10
|
+
x,
|
11
|
+
y,
|
12
|
+
platform,
|
13
|
+
rects,
|
14
|
+
elements,
|
15
|
+
strategy
|
16
|
+
} = state;
|
17
|
+
const {
|
18
|
+
boundary = "clippingAncestors",
|
19
|
+
rootBoundary = "viewport",
|
20
|
+
elementContext = "floating",
|
21
|
+
altBoundary = false,
|
22
|
+
padding = 0
|
23
|
+
} = floatingUi_utils.evaluate(options, state);
|
24
|
+
const paddingObject = floatingUi_utils.getPaddingObject(padding);
|
25
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
26
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
27
|
+
const clippingClientRect = floatingUi_utils.rectToClientRect(await platform.getClippingRect({
|
28
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
|
29
|
+
boundary,
|
30
|
+
rootBoundary,
|
31
|
+
strategy
|
32
|
+
}));
|
33
|
+
const rect = elementContext === "floating" ? {
|
34
|
+
x,
|
35
|
+
y,
|
36
|
+
width: rects.floating.width,
|
37
|
+
height: rects.floating.height
|
38
|
+
} : rects.reference;
|
39
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
40
|
+
const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
|
41
|
+
x: 1,
|
42
|
+
y: 1
|
43
|
+
} : {
|
44
|
+
x: 1,
|
45
|
+
y: 1
|
46
|
+
};
|
47
|
+
const elementClientRect = floatingUi_utils.rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
48
|
+
elements,
|
49
|
+
rect,
|
50
|
+
offsetParent,
|
51
|
+
strategy
|
52
|
+
}) : rect);
|
53
|
+
return {
|
54
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
55
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
56
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
57
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
58
|
+
};
|
59
|
+
}
|
60
|
+
const shift = function(options) {
|
61
|
+
if (options === void 0) {
|
62
|
+
options = {};
|
63
|
+
}
|
64
|
+
return {
|
65
|
+
name: "shift",
|
66
|
+
options,
|
67
|
+
async fn(state) {
|
68
|
+
const {
|
69
|
+
x,
|
70
|
+
y,
|
71
|
+
placement
|
72
|
+
} = state;
|
73
|
+
const {
|
74
|
+
mainAxis: checkMainAxis = true,
|
75
|
+
crossAxis: checkCrossAxis = false,
|
76
|
+
limiter = {
|
77
|
+
fn: (_ref) => {
|
78
|
+
let {
|
79
|
+
x: x2,
|
80
|
+
y: y2
|
81
|
+
} = _ref;
|
82
|
+
return {
|
83
|
+
x: x2,
|
84
|
+
y: y2
|
85
|
+
};
|
86
|
+
}
|
87
|
+
},
|
88
|
+
...detectOverflowOptions
|
89
|
+
} = floatingUi_utils.evaluate(options, state);
|
90
|
+
const coords = {
|
91
|
+
x,
|
92
|
+
y
|
93
|
+
};
|
94
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
95
|
+
const crossAxis = floatingUi_utils.getSideAxis(floatingUi_utils.getSide(placement));
|
96
|
+
const mainAxis = floatingUi_utils.getOppositeAxis(crossAxis);
|
97
|
+
let mainAxisCoord = coords[mainAxis];
|
98
|
+
let crossAxisCoord = coords[crossAxis];
|
99
|
+
if (checkMainAxis) {
|
100
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
101
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
102
|
+
const min = mainAxisCoord + overflow[minSide];
|
103
|
+
const max = mainAxisCoord - overflow[maxSide];
|
104
|
+
mainAxisCoord = floatingUi_utils.clamp(min, mainAxisCoord, max);
|
105
|
+
}
|
106
|
+
if (checkCrossAxis) {
|
107
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
108
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
109
|
+
const min = crossAxisCoord + overflow[minSide];
|
110
|
+
const max = crossAxisCoord - overflow[maxSide];
|
111
|
+
crossAxisCoord = floatingUi_utils.clamp(min, crossAxisCoord, max);
|
112
|
+
}
|
113
|
+
const limitedCoords = limiter.fn({
|
114
|
+
...state,
|
115
|
+
[mainAxis]: mainAxisCoord,
|
116
|
+
[crossAxis]: crossAxisCoord
|
117
|
+
});
|
118
|
+
return {
|
119
|
+
...limitedCoords,
|
120
|
+
data: {
|
121
|
+
x: limitedCoords.x - x,
|
122
|
+
y: limitedCoords.y - y,
|
123
|
+
enabled: {
|
124
|
+
[mainAxis]: checkMainAxis,
|
125
|
+
[crossAxis]: checkCrossAxis
|
126
|
+
}
|
127
|
+
}
|
128
|
+
};
|
129
|
+
}
|
130
|
+
};
|
131
|
+
};
|
132
|
+
exports.rectToClientRect = floatingUi_utils.rectToClientRect;
|
133
|
+
exports.detectOverflow = detectOverflow;
|
134
|
+
exports.shift = shift;
|
8
135
|
//# sourceMappingURL=harmony101.cjs.map
|
package/dist/harmony101.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"harmony101.cjs","sources":["../src/components/Sidebar/Widgets/Tasks/TasksContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { SidebarTasksContextProps } from './types'\n\nexport const TasksContext = createContext({} as SidebarTasksContextProps)\n\nexport const useTasks = () => useContext(TasksContext)\n"],"names":["createContext","useContext"],"mappings":";;;AAGa,MAAA,eAAeA,MAAc,cAAA,CAA8B,CAAA;AAE3D,MAAA,WAAW,MAAMC,MAAAA,WAAW,YAAY;;;"}
|
1
|
+
{"version":3,"file":"harmony101.cjs","sources":["../node_modules/@floating-ui/core/dist/floating-ui.core.mjs"],"sourcesContent":["import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n let {\n reference,\n floating\n } = _ref;\n const sideAxis = getSideAxis(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const alignLength = getAxisLength(alignmentAxis);\n const side = getSide(placement);\n const isVertical = sideAxis === 'y';\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n let coords;\n switch (side) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n switch (getAlignment(placement)) {\n case 'start':\n coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);\n break;\n case 'end':\n coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);\n break;\n }\n return coords;\n}\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n const validMiddleware = middleware.filter(Boolean);\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement(rects, placement, rtl);\n let statefulPlacement = placement;\n let middlewareData = {};\n let resetCount = 0;\n for (let i = 0; i < validMiddleware.length; i++) {\n const {\n name,\n fn\n } = validMiddleware[i];\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData = {\n ...middlewareData,\n [name]: {\n ...middlewareData[name],\n ...data\n }\n };\n if (reset && resetCount <= 50) {\n resetCount++;\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n ({\n x,\n y\n } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n }\n i = -1;\n }\n }\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n var _await$platform$isEle;\n if (options === void 0) {\n options = {};\n }\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = state;\n const {\n boundary = 'clippingAncestors',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = evaluate(options, state);\n const paddingObject = getPaddingObject(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n boundary,\n rootBoundary,\n strategy\n }));\n const rect = elementContext === 'floating' ? {\n x,\n y,\n width: rects.floating.width,\n height: rects.floating.height\n } : rects.reference;\n const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n x: 1,\n y: 1\n } : {\n x: 1,\n y: 1\n };\n const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements,\n rect,\n offsetParent,\n strategy\n }) : rect);\n return {\n top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n };\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const min$1 = minPadding;\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(min$1, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n return true;\n });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'autoPlacement',\n options,\n async fn(state) {\n var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n const {\n rects,\n middlewareData,\n placement,\n platform,\n elements\n } = state;\n const {\n crossAxis = false,\n alignment,\n allowedPlacements = placements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n const currentPlacement = placements$1[currentIndex];\n if (currentPlacement == null) {\n return {};\n }\n const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n\n // Make `computeCoords` start from the right place.\n if (placement !== currentPlacement) {\n return {\n reset: {\n placement: placements$1[0]\n }\n };\n }\n const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements$1[currentIndex + 1];\n\n // There are more placements to check.\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n const placementsSortedByMostSpace = allOverflows.map(d => {\n const alignment = getAlignment(d.placement);\n return [d.placement, alignment && crossAxis ?\n // Check along the mainAxis and main crossAxis side.\n d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n // Check only the mainAxis.\n d.overflows[0], d.overflows];\n }).sort((a, b) => a[1] - b[1]);\n const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n // Aligned placements should not check their opposite crossAxis\n // side.\n getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n if (resetPlacement !== placement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n return {};\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'flip',\n options,\n async fn(state) {\n var _middlewareData$arrow, _middlewareData$flip;\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement,\n platform,\n elements\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n fallbackAxisSideDirection = 'none',\n flipAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n\n // If a reset by the arrow was caused due to an alignment offset being\n // added, we should skip any logic now since `flip()` has already done its\n // work.\n // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n const side = getSide(placement);\n const initialSideAxis = getSideAxis(initialPlacement);\n const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n }\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n if (checkMainAxis) {\n overflows.push(overflow[side]);\n }\n if (checkCrossAxis) {\n const sides = getAlignmentSides(placement, rects, rtl);\n overflows.push(overflow[sides[0]], overflow[sides[1]]);\n }\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }];\n\n // One or more sides is overflowing.\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip2, _overflowsData$filter;\n const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n const nextPlacement = placements[nextIndex];\n if (nextPlacement) {\n // Try next placement and re-run the lifecycle.\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n\n // First, find the candidates that fit on the mainAxis side of overflow,\n // then find the placement that fits the best on the main crossAxis side.\n let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n // Otherwise fallback.\n if (!resetPlacement) {\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$filter2;\n const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n if (hasFallbackAxisSideDirection) {\n const currentSideAxis = getSideAxis(d.placement);\n return currentSideAxis === initialSideAxis ||\n // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n currentSideAxis === 'y';\n }\n return true;\n }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n if (placement) {\n resetPlacement = placement;\n }\n break;\n }\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n }\n if (placement !== resetPlacement) {\n return {\n reset: {\n placement: resetPlacement\n }\n };\n }\n }\n return {};\n }\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'hide',\n options,\n async fn(state) {\n const {\n rects\n } = state;\n const {\n strategy = 'referenceHidden',\n ...detectOverflowOptions\n } = evaluate(options, state);\n switch (strategy) {\n case 'referenceHidden':\n {\n const overflow = await detectOverflow(state, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const offsets = getSideOffsets(overflow, rects.reference);\n return {\n data: {\n referenceHiddenOffsets: offsets,\n referenceHidden: isAnySideFullyClipped(offsets)\n }\n };\n }\n case 'escaped':\n {\n const overflow = await detectOverflow(state, {\n ...detectOverflowOptions,\n altBoundary: true\n });\n const offsets = getSideOffsets(overflow, rects.floating);\n return {\n data: {\n escapedOffsets: offsets,\n escaped: isAnySideFullyClipped(offsets)\n }\n };\n }\n default:\n {\n return {};\n }\n }\n }\n };\n};\n\nfunction getBoundingRect(rects) {\n const minX = min(...rects.map(rect => rect.left));\n const minY = min(...rects.map(rect => rect.top));\n const maxX = max(...rects.map(rect => rect.right));\n const maxY = max(...rects.map(rect => rect.bottom));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n}\nfunction getRectsByLine(rects) {\n const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n const groups = [];\n let prevRect = null;\n for (let i = 0; i < sortedRects.length; i++) {\n const rect = sortedRects[i];\n if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n groups.push([rect]);\n } else {\n groups[groups.length - 1].push(rect);\n }\n prevRect = rect;\n }\n return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'inline',\n options,\n async fn(state) {\n const {\n placement,\n elements,\n rects,\n platform,\n strategy\n } = state;\n // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n const {\n padding = 2,\n x,\n y\n } = evaluate(options, state);\n const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n const clientRects = getRectsByLine(nativeClientRects);\n const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n const paddingObject = getPaddingObject(padding);\n function getBoundingClientRect() {\n // There are two rects and they are disjoined.\n if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {\n // Find the first rect in which the point is fully inside.\n return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n }\n\n // There are 2 or more connected rects.\n if (clientRects.length >= 2) {\n if (getSideAxis(placement) === 'y') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getSide(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n const isLeftSide = getSide(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n const left = minLeft;\n const right = maxRight;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n return fallback;\n }\n const resetRects = await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n });\n if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n return {\n reset: {\n rects: resetRects\n }\n };\n }\n return {};\n }\n };\n};\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n const {\n placement,\n platform,\n elements\n } = state;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isVertical = getSideAxis(placement) === 'y';\n const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;\n const crossAxisMulti = rtl && isVertical ? -1 : 1;\n const rawValue = evaluate(options, state);\n\n // eslint-disable-next-line prefer-const\n let {\n mainAxis,\n crossAxis,\n alignmentAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: rawValue.mainAxis || 0,\n crossAxis: rawValue.crossAxis || 0,\n alignmentAxis: rawValue.alignmentAxis\n };\n if (alignment && typeof alignmentAxis === 'number') {\n crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n }\n return isVertical ? {\n x: crossAxis * crossAxisMulti,\n y: mainAxis * mainAxisMulti\n } : {\n x: mainAxis * mainAxisMulti,\n y: crossAxis * crossAxisMulti\n };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n if (options === void 0) {\n options = 0;\n }\n return {\n name: 'offset',\n options,\n async fn(state) {\n var _middlewareData$offse, _middlewareData$arrow;\n const {\n x,\n y,\n placement,\n middlewareData\n } = state;\n const diffCoords = await convertValueToCoords(state, options);\n\n // If the placement is the same and the arrow caused an alignment offset\n // then we don't need to change the positioning coordinates.\n if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: {\n ...diffCoords,\n placement\n }\n };\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'shift',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const crossAxis = getSideAxis(getSide(placement));\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n if (checkMainAxis) {\n const minSide = mainAxis === 'y' ? 'top' : 'left';\n const maxSide = mainAxis === 'y' ? 'bottom' : 'right';\n const min = mainAxisCoord + overflow[minSide];\n const max = mainAxisCoord - overflow[maxSide];\n mainAxisCoord = clamp(min, mainAxisCoord, max);\n }\n if (checkCrossAxis) {\n const minSide = crossAxis === 'y' ? 'top' : 'left';\n const maxSide = crossAxis === 'y' ? 'bottom' : 'right';\n const min = crossAxisCoord + overflow[minSide];\n const max = crossAxisCoord - overflow[maxSide];\n crossAxisCoord = clamp(min, crossAxisCoord, max);\n }\n const limitedCoords = limiter.fn({\n ...state,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return {\n ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y,\n enabled: {\n [mainAxis]: checkMainAxis,\n [crossAxis]: checkCrossAxis\n }\n }\n };\n }\n };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n options,\n fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = state;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = evaluate(offset, state);\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: 0,\n crossAxis: 0,\n ...rawOffset\n };\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2;\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = ['top', 'left'].includes(getSide(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'size',\n options,\n async fn(state) {\n var _state$middlewareData, _state$middlewareData2;\n const {\n placement,\n rects,\n platform,\n elements\n } = state;\n const {\n apply = () => {},\n ...detectOverflowOptions\n } = evaluate(options, state);\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isYAxis = getSideAxis(placement) === 'y';\n const {\n width,\n height\n } = rects.floating;\n let heightSide;\n let widthSide;\n if (side === 'top' || side === 'bottom') {\n heightSide = side;\n widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n } else {\n widthSide = side;\n heightSide = alignment === 'end' ? 'top' : 'bottom';\n }\n const maximumClippingHeight = height - overflow.top - overflow.bottom;\n const maximumClippingWidth = width - overflow.left - overflow.right;\n const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n const noShift = !state.middlewareData.shift;\n let availableHeight = overflowAvailableHeight;\n let availableWidth = overflowAvailableWidth;\n if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {\n availableWidth = maximumClippingWidth;\n }\n if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {\n availableHeight = maximumClippingHeight;\n }\n if (noShift && !alignment) {\n const xMin = max(overflow.left, 0);\n const xMax = max(overflow.right, 0);\n const yMin = max(overflow.top, 0);\n const yMax = max(overflow.bottom, 0);\n if (isYAxis) {\n availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));\n } else {\n availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));\n }\n }\n await apply({\n ...state,\n availableWidth,\n availableHeight\n });\n const nextDimensions = await platform.getDimensions(elements.floating);\n if (width !== nextDimensions.width || height !== nextDimensions.height) {\n return {\n reset: {\n rects: true\n }\n };\n }\n return {};\n }\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n"],"names":["evaluate","getPaddingObject","rectToClientRect","x","y","getSideAxis","getSide","getOppositeAxis","clamp"],"mappings":";;;AA8JA,eAAe,eAAe,OAAO,SAAS;AAC5C,MAAI;AACJ,MAAI,YAAY,QAAQ;AACtB,cAAU,CAAE;AAAA,EAChB;AACE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,IAAM;AACJ,QAAM;AAAA,IACJ,WAAW;AAAA,IACX,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,UAAU;AAAA,EACd,IAAMA,iBAAQ,SAAC,SAAS,KAAK;AAC3B,QAAM,gBAAgBC,iBAAgB,iBAAC,OAAO;AAC9C,QAAM,aAAa,mBAAmB,aAAa,cAAc;AACjE,QAAM,UAAU,SAAS,cAAc,aAAa,cAAc;AAClE,QAAM,qBAAqBC,iBAAAA,iBAAiB,MAAM,SAAS,gBAAgB;AAAA,IACzE,WAAW,wBAAwB,OAAO,SAAS,aAAa,OAAO,SAAS,SAAS,UAAU,OAAO,OAAO,OAAO,wBAAwB,QAAQ,UAAU,QAAQ,kBAAmB,OAAO,SAAS,sBAAsB,OAAO,SAAS,SAAS,mBAAmB,SAAS,QAAQ;AAAA,IAChS;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAG,CAAC;AACF,QAAM,OAAO,mBAAmB,aAAa;AAAA,IAC3C;AAAA,IACA;AAAA,IACA,OAAO,MAAM,SAAS;AAAA,IACtB,QAAQ,MAAM,SAAS;AAAA,EACxB,IAAG,MAAM;AACV,QAAM,eAAe,OAAO,SAAS,mBAAmB,OAAO,SAAS,SAAS,gBAAgB,SAAS,QAAQ;AAClH,QAAM,cAAe,OAAO,SAAS,aAAa,OAAO,SAAS,SAAS,UAAU,YAAY,KAAO,OAAO,SAAS,YAAY,OAAO,SAAS,SAAS,SAAS,YAAY,MAAO;AAAA,IACvL,GAAG;AAAA,IACH,GAAG;AAAA,EACP,IAAM;AAAA,IACF,GAAG;AAAA,IACH,GAAG;AAAA,EACJ;AACD,QAAM,oBAAoBA,iBAAAA,iBAAiB,SAAS,wDAAwD,MAAM,SAAS,sDAAsD;AAAA,IAC/K;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAA,IAAI,IAAI;AACT,SAAO;AAAA,IACL,MAAM,mBAAmB,MAAM,kBAAkB,MAAM,cAAc,OAAO,YAAY;AAAA,IACxF,SAAS,kBAAkB,SAAS,mBAAmB,SAAS,cAAc,UAAU,YAAY;AAAA,IACpG,OAAO,mBAAmB,OAAO,kBAAkB,OAAO,cAAc,QAAQ,YAAY;AAAA,IAC5F,QAAQ,kBAAkB,QAAQ,mBAAmB,QAAQ,cAAc,SAAS,YAAY;AAAA,EACjG;AACH;AA0lBK,MAAC,QAAQ,SAAU,SAAS;AAC/B,MAAI,YAAY,QAAQ;AACtB,cAAU,CAAE;AAAA,EAChB;AACE,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA,MAAM,GAAG,OAAO;AACd,YAAM;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,MACR,IAAU;AACJ,YAAM;AAAA,QACJ,UAAU,gBAAgB;AAAA,QAC1B,WAAW,iBAAiB;AAAA,QAC5B,UAAU;AAAA,UACR,IAAI,UAAQ;AACV,gBAAI;AAAA,cACF,GAAAC;AAAA,cACA,GAAAC;AAAA,YACd,IAAgB;AACJ,mBAAO;AAAA,cACL,GAAAD;AAAA,cACA,GAAAC;AAAA,YACD;AAAA,UACb;AAAA,QACS;AAAA,QACD,GAAG;AAAA,MACX,IAAUJ,iBAAQ,SAAC,SAAS,KAAK;AAC3B,YAAM,SAAS;AAAA,QACb;AAAA,QACA;AAAA,MACD;AACD,YAAM,WAAW,MAAM,eAAe,OAAO,qBAAqB;AAClE,YAAM,YAAYK,iBAAAA,YAAYC,iBAAO,QAAC,SAAS,CAAC;AAChD,YAAM,WAAWC,iBAAe,gBAAC,SAAS;AAC1C,UAAI,gBAAgB,OAAO,QAAQ;AACnC,UAAI,iBAAiB,OAAO,SAAS;AACrC,UAAI,eAAe;AACjB,cAAM,UAAU,aAAa,MAAM,QAAQ;AAC3C,cAAM,UAAU,aAAa,MAAM,WAAW;AAC9C,cAAM,MAAM,gBAAgB,SAAS,OAAO;AAC5C,cAAM,MAAM,gBAAgB,SAAS,OAAO;AAC5C,wBAAgBC,iBAAK,MAAC,KAAK,eAAe,GAAG;AAAA,MACrD;AACM,UAAI,gBAAgB;AAClB,cAAM,UAAU,cAAc,MAAM,QAAQ;AAC5C,cAAM,UAAU,cAAc,MAAM,WAAW;AAC/C,cAAM,MAAM,iBAAiB,SAAS,OAAO;AAC7C,cAAM,MAAM,iBAAiB,SAAS,OAAO;AAC7C,yBAAiBA,iBAAK,MAAC,KAAK,gBAAgB,GAAG;AAAA,MACvD;AACM,YAAM,gBAAgB,QAAQ,GAAG;AAAA,QAC/B,GAAG;AAAA,QACH,CAAC,QAAQ,GAAG;AAAA,QACZ,CAAC,SAAS,GAAG;AAAA,MACrB,CAAO;AACD,aAAO;AAAA,QACL,GAAG;AAAA,QACH,MAAM;AAAA,UACJ,GAAG,cAAc,IAAI;AAAA,UACrB,GAAG,cAAc,IAAI;AAAA,UACrB,SAAS;AAAA,YACP,CAAC,QAAQ,GAAG;AAAA,YACZ,CAAC,SAAS,GAAG;AAAA,UACzB;AAAA,QACA;AAAA,MACO;AAAA,IACP;AAAA,EACG;AACH;;;;","x_google_ignoreList":[0]}
|
package/dist/harmony101.mjs
CHANGED
@@ -1,8 +1,135 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
1
|
+
import { evaluate, getSideAxis, getSide, clamp, getPaddingObject, rectToClientRect, getOppositeAxis } from "./harmony116.mjs";
|
2
|
+
async function detectOverflow(state, options) {
|
3
|
+
var _await$platform$isEle;
|
4
|
+
if (options === void 0) {
|
5
|
+
options = {};
|
6
|
+
}
|
7
|
+
const {
|
8
|
+
x,
|
9
|
+
y,
|
10
|
+
platform,
|
11
|
+
rects,
|
12
|
+
elements,
|
13
|
+
strategy
|
14
|
+
} = state;
|
15
|
+
const {
|
16
|
+
boundary = "clippingAncestors",
|
17
|
+
rootBoundary = "viewport",
|
18
|
+
elementContext = "floating",
|
19
|
+
altBoundary = false,
|
20
|
+
padding = 0
|
21
|
+
} = evaluate(options, state);
|
22
|
+
const paddingObject = getPaddingObject(padding);
|
23
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
24
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
25
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
26
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
|
27
|
+
boundary,
|
28
|
+
rootBoundary,
|
29
|
+
strategy
|
30
|
+
}));
|
31
|
+
const rect = elementContext === "floating" ? {
|
32
|
+
x,
|
33
|
+
y,
|
34
|
+
width: rects.floating.width,
|
35
|
+
height: rects.floating.height
|
36
|
+
} : rects.reference;
|
37
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
38
|
+
const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
|
39
|
+
x: 1,
|
40
|
+
y: 1
|
41
|
+
} : {
|
42
|
+
x: 1,
|
43
|
+
y: 1
|
44
|
+
};
|
45
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
46
|
+
elements,
|
47
|
+
rect,
|
48
|
+
offsetParent,
|
49
|
+
strategy
|
50
|
+
}) : rect);
|
51
|
+
return {
|
52
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
53
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
54
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
55
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
56
|
+
};
|
57
|
+
}
|
58
|
+
const shift = function(options) {
|
59
|
+
if (options === void 0) {
|
60
|
+
options = {};
|
61
|
+
}
|
62
|
+
return {
|
63
|
+
name: "shift",
|
64
|
+
options,
|
65
|
+
async fn(state) {
|
66
|
+
const {
|
67
|
+
x,
|
68
|
+
y,
|
69
|
+
placement
|
70
|
+
} = state;
|
71
|
+
const {
|
72
|
+
mainAxis: checkMainAxis = true,
|
73
|
+
crossAxis: checkCrossAxis = false,
|
74
|
+
limiter = {
|
75
|
+
fn: (_ref) => {
|
76
|
+
let {
|
77
|
+
x: x2,
|
78
|
+
y: y2
|
79
|
+
} = _ref;
|
80
|
+
return {
|
81
|
+
x: x2,
|
82
|
+
y: y2
|
83
|
+
};
|
84
|
+
}
|
85
|
+
},
|
86
|
+
...detectOverflowOptions
|
87
|
+
} = evaluate(options, state);
|
88
|
+
const coords = {
|
89
|
+
x,
|
90
|
+
y
|
91
|
+
};
|
92
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
93
|
+
const crossAxis = getSideAxis(getSide(placement));
|
94
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
95
|
+
let mainAxisCoord = coords[mainAxis];
|
96
|
+
let crossAxisCoord = coords[crossAxis];
|
97
|
+
if (checkMainAxis) {
|
98
|
+
const minSide = mainAxis === "y" ? "top" : "left";
|
99
|
+
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
100
|
+
const min = mainAxisCoord + overflow[minSide];
|
101
|
+
const max = mainAxisCoord - overflow[maxSide];
|
102
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
103
|
+
}
|
104
|
+
if (checkCrossAxis) {
|
105
|
+
const minSide = crossAxis === "y" ? "top" : "left";
|
106
|
+
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
107
|
+
const min = crossAxisCoord + overflow[minSide];
|
108
|
+
const max = crossAxisCoord - overflow[maxSide];
|
109
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
110
|
+
}
|
111
|
+
const limitedCoords = limiter.fn({
|
112
|
+
...state,
|
113
|
+
[mainAxis]: mainAxisCoord,
|
114
|
+
[crossAxis]: crossAxisCoord
|
115
|
+
});
|
116
|
+
return {
|
117
|
+
...limitedCoords,
|
118
|
+
data: {
|
119
|
+
x: limitedCoords.x - x,
|
120
|
+
y: limitedCoords.y - y,
|
121
|
+
enabled: {
|
122
|
+
[mainAxis]: checkMainAxis,
|
123
|
+
[crossAxis]: checkCrossAxis
|
124
|
+
}
|
125
|
+
}
|
126
|
+
};
|
127
|
+
}
|
128
|
+
};
|
129
|
+
};
|
4
130
|
export {
|
5
|
-
|
6
|
-
|
131
|
+
detectOverflow,
|
132
|
+
rectToClientRect,
|
133
|
+
shift
|
7
134
|
};
|
8
135
|
//# sourceMappingURL=harmony101.mjs.map
|