@zag-js/popper 0.0.0-dev-20220706194607 → 0.0.0-dev-20220709094240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/get-placement.d.ts +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/dist/index.mjs +5 -3
- package/dist/types.d.ts +1 -0
- package/package.json +2 -2
package/dist/get-placement.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { VirtualElement } from "@floating-ui/dom";
|
|
2
|
-
import type { PositioningOptions } from "./types";
|
|
1
|
+
import type { Placement, VirtualElement } from "@floating-ui/dom";
|
|
2
|
+
import type { BasePlacement, PositioningOptions } from "./types";
|
|
3
3
|
export declare function getPlacement(reference: HTMLElement | VirtualElement | null, floating: HTMLElement | null, opts?: PositioningOptions): () => void;
|
|
4
|
+
export declare function getBasePlacement(placement: Placement): BasePlacement;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
37
37
|
// src/index.ts
|
|
38
38
|
var src_exports = {};
|
|
39
39
|
__export(src_exports, {
|
|
40
|
+
getBasePlacement: () => getBasePlacement,
|
|
40
41
|
getPlacement: () => getPlacement,
|
|
41
42
|
getPlacementStyles: () => getPlacementStyles
|
|
42
43
|
});
|
|
@@ -277,6 +278,7 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
277
278
|
middleware,
|
|
278
279
|
strategy
|
|
279
280
|
}, config)).then((data) => {
|
|
281
|
+
var _a;
|
|
280
282
|
const x = Math.round(data.x);
|
|
281
283
|
const y = Math.round(data.y);
|
|
282
284
|
Object.assign(floating.style, {
|
|
@@ -285,15 +287,15 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
285
287
|
left: "0",
|
|
286
288
|
transform: `translate3d(${x}px, ${y}px, 0)`
|
|
287
289
|
});
|
|
288
|
-
return data;
|
|
289
|
-
}).then((data) => {
|
|
290
|
-
var _a;
|
|
291
290
|
(_a = options.onComplete) == null ? void 0 : _a.call(options, __spreadProps(__spreadValues({}, data), { compute }));
|
|
292
291
|
});
|
|
293
292
|
}
|
|
294
293
|
compute();
|
|
295
294
|
return callAll(options.listeners ? autoUpdate(reference, floating, compute, options.listeners) : void 0, options.onCleanup);
|
|
296
295
|
}
|
|
296
|
+
function getBasePlacement(placement) {
|
|
297
|
+
return placement.split("-")[0];
|
|
298
|
+
}
|
|
297
299
|
|
|
298
300
|
// src/get-styles.ts
|
|
299
301
|
var UNMEASURED_FLOATING_STYLE = {
|
package/dist/index.mjs
CHANGED
|
@@ -253,6 +253,7 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
253
253
|
middleware,
|
|
254
254
|
strategy
|
|
255
255
|
}, config)).then((data) => {
|
|
256
|
+
var _a;
|
|
256
257
|
const x = Math.round(data.x);
|
|
257
258
|
const y = Math.round(data.y);
|
|
258
259
|
Object.assign(floating.style, {
|
|
@@ -261,15 +262,15 @@ function getPlacement(reference, floating, opts = {}) {
|
|
|
261
262
|
left: "0",
|
|
262
263
|
transform: `translate3d(${x}px, ${y}px, 0)`
|
|
263
264
|
});
|
|
264
|
-
return data;
|
|
265
|
-
}).then((data) => {
|
|
266
|
-
var _a;
|
|
267
265
|
(_a = options.onComplete) == null ? void 0 : _a.call(options, __spreadProps(__spreadValues({}, data), { compute }));
|
|
268
266
|
});
|
|
269
267
|
}
|
|
270
268
|
compute();
|
|
271
269
|
return callAll(options.listeners ? autoUpdate(reference, floating, compute, options.listeners) : void 0, options.onCleanup);
|
|
272
270
|
}
|
|
271
|
+
function getBasePlacement(placement) {
|
|
272
|
+
return placement.split("-")[0];
|
|
273
|
+
}
|
|
273
274
|
|
|
274
275
|
// src/get-styles.ts
|
|
275
276
|
var UNMEASURED_FLOATING_STYLE = {
|
|
@@ -314,6 +315,7 @@ function getPlacementStyles(options) {
|
|
|
314
315
|
};
|
|
315
316
|
}
|
|
316
317
|
export {
|
|
318
|
+
getBasePlacement,
|
|
317
319
|
getPlacement,
|
|
318
320
|
getPlacementStyles
|
|
319
321
|
};
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/popper",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20220709094240",
|
|
4
4
|
"description": "Dynamic positioning logic for ui machines",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@floating-ui/dom": "0.5.4",
|
|
29
|
-
"@zag-js/dom-utils": "0.0.0-dev-
|
|
29
|
+
"@zag-js/dom-utils": "0.0.0-dev-20220709094240",
|
|
30
30
|
"@zag-js/utils": "0.1.2"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|